path: root/ctree.h
diff options
authorSu Yanjun <>2018-10-12 15:41:53 +0800
committerDavid Sterba <>2018-10-25 16:11:40 +0200
commit22e47679504de19b3d3256f1d741d5465112fe0a (patch)
tree622a52cd9f9b3f9d6bc89cce90e5dd0e128b7d31 /ctree.h
parentb4843d366906cdb5b1198c0206b720ba28ee66f6 (diff)
btrfs-progs: consitfy keys passed to serch functions
When using gcc8 to compile btrfs-progs, it complains as below: ctree.c: In function 'btrfs_search_slot_for_read': ctree.c:1249:45: warning: passing argument 3 of 'btrfs_search_slot' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] ret = btrfs_search_slot(NULL, root, key, p, 0, 0); Change btrfs_search_slot prototype with 'const' qualifier for argument 3. Also fix similar problems as above change. Signed-off-by: Su Yanjun <> Signed-off-by: David Sterba <>
Diffstat (limited to 'ctree.h')
1 files changed, 5 insertions, 5 deletions
diff --git a/ctree.h b/ctree.h
index 3c396e7d..2d45d93b 100644
--- a/ctree.h
+++ b/ctree.h
@@ -1984,7 +1984,7 @@ static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
- struct btrfs_key *cpu)
+ const struct btrfs_key *cpu)
disk->offset = cpu_to_le64(cpu->offset);
disk->type = cpu->type;
@@ -2563,7 +2563,7 @@ u64 add_new_free_space(struct btrfs_block_group_cache *block_group,
u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset);
/* ctree.c */
-int btrfs_comp_cpu_keys(struct btrfs_key *k1, struct btrfs_key *k2);
+int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2);
int btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path,
int level, int slot);
enum btrfs_tree_block_status
@@ -2606,9 +2606,9 @@ int btrfs_split_item(struct btrfs_trans_handle *trans,
struct btrfs_path *path,
struct btrfs_key *new_key,
unsigned long split_offset);
-int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
- *root, struct btrfs_key *key, struct btrfs_path *p, int
- ins_len, int cow);
+int btrfs_search_slot(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root, const struct btrfs_key *key,
+ struct btrfs_path *p, int ins_len, int cow);
int btrfs_search_slot_for_read(struct btrfs_root *root,
const struct btrfs_key *key,
struct btrfs_path *p, int find_higher,