Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8c9f186 authored by David Sterba's avatar David Sterba
Browse files

btrfs: constify structs with op functions or static definitions



There are some op tables that can be easily made const, similarly the
sysfs feature and raid tables. This is motivated by PaX CONSTIFY plugin.

Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
parent f749303b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -750,7 +750,7 @@ static int comp_num_workspace[BTRFS_COMPRESS_TYPES];
static atomic_t comp_alloc_workspace[BTRFS_COMPRESS_TYPES];
static wait_queue_head_t comp_workspace_wait[BTRFS_COMPRESS_TYPES];

static struct btrfs_compress_op *btrfs_compress_op[] = {
static const struct btrfs_compress_op * const btrfs_compress_op[] = {
	&btrfs_zlib_compress,
	&btrfs_lzo_compress,
};
+2 −2
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ struct btrfs_compress_op {
			  size_t srclen, size_t destlen);
};

extern struct btrfs_compress_op btrfs_zlib_compress;
extern struct btrfs_compress_op btrfs_lzo_compress;
extern const struct btrfs_compress_op btrfs_zlib_compress;
extern const struct btrfs_compress_op btrfs_lzo_compress;

#endif
+2 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@
#include <asm/cpufeature.h>
#endif

static struct extent_io_ops btree_extent_io_ops;
static const struct extent_io_ops btree_extent_io_ops;
static void end_workqueue_fn(struct btrfs_work *work);
static void free_fs_root(struct btrfs_root *root);
static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
@@ -4287,7 +4287,7 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root)
	return 0;
}

static struct extent_io_ops btree_extent_io_ops = {
static const struct extent_io_ops btree_extent_io_ops = {
	.readpage_end_io_hook = btree_readpage_end_io_hook,
	.readpage_io_failed_hook = btree_io_failed_hook,
	.submit_bio_hook = btree_submit_bio_hook,
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ struct extent_io_tree {
	u64 dirty_bytes;
	int track_uptodate;
	spinlock_t lock;
	struct extent_io_ops *ops;
	const struct extent_io_ops *ops;
};

struct extent_state {
+1 −1
Original line number Diff line number Diff line
@@ -434,7 +434,7 @@ static int lzo_decompress(struct list_head *ws, unsigned char *data_in,
	return ret;
}

struct btrfs_compress_op btrfs_lzo_compress = {
const struct btrfs_compress_op btrfs_lzo_compress = {
	.alloc_workspace	= lzo_alloc_workspace,
	.free_workspace		= lzo_free_workspace,
	.compress_pages		= lzo_compress_pages,
Loading