reiserfscore: constify struct pointer arguments
There are many cases where functions take pointers to keys, item heads, paths, etc and don't modify them. Let's annotate them properly. Signed-off-by: Jeff Mahoney <jeffm@suse.com>
This commit is contained in:
1 parent
9b52a79ba2
commit
6daa8a9c5a
16 files changed
+97
-91
No files matched your search
+2
-2
@@ -1008,7 +1008,7 @@ static int bad_node(reiserfs_filsys_t fs, struct buffer_head **path, int h)
|
||||
}
|
||||
|
||||
/* internal node bh must point to block */
|
||||
static int get_pos(struct buffer_head *bh, unsigned long block)
|
||||
static int get_pos(const struct buffer_head *bh, unsigned long block)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1052,7 +1052,7 @@ static struct reiserfs_key *rkey(struct buffer_head **path, int h)
|
||||
static int bad_path(reiserfs_filsys_t fs, struct buffer_head **path, int h1)
|
||||
{
|
||||
int h = 0;
|
||||
struct reiserfs_key *dk;
|
||||
const struct reiserfs_key *dk;
|
||||
int pos = 0;
|
||||
|
||||
while (path[h])
|
||||
|
||||
+4
-3
@@ -129,8 +129,8 @@ void link_relocated_files(void);
|
||||
int should_relocate(struct item_head *ih);
|
||||
void relocate_dir(struct item_head *ih, int change_ih);
|
||||
|
||||
extern __u32 objectid_for_relocation(struct reiserfs_key *key);
|
||||
extern void linked_already(struct reiserfs_key *new_key);
|
||||
extern __u32 objectid_for_relocation(const struct reiserfs_key *key);
|
||||
extern void linked_already(const struct reiserfs_key *new_key);
|
||||
|
||||
/* file.c */
|
||||
struct si {
|
||||
@@ -178,7 +178,8 @@ int is_dot(char *name, int namelen);
|
||||
struct reiserfs_path *path, struct reiserfs_key *key);*/
|
||||
int rebuild_check_regular_file(struct reiserfs_path *path, void *sd,
|
||||
struct item_head *new_ih);
|
||||
int rebuild_semantic_pass(struct reiserfs_key *key, struct reiserfs_key *parent,
|
||||
int rebuild_semantic_pass(struct reiserfs_key *key,
|
||||
const struct reiserfs_key *parent,
|
||||
int is_dot_dot, struct item_head *new_ih);
|
||||
|
||||
/* lost+found.c */
|
||||
|
||||
+1
-1
@@ -597,7 +597,7 @@ static __inline__ int does_it_fit_into_dev(__u64 offset, __u64 fs_size)
|
||||
fs_size) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int is_wrong_short_key(struct reiserfs_key *key)
|
||||
static int is_wrong_short_key(const struct reiserfs_key *key)
|
||||
{
|
||||
if (get_key_dirid(key) == 0 || get_key_objectid(key) == 0
|
||||
|| get_key_objectid(key) == 1 || get_key_dirid(key) == ~(__u32) 0
|
||||
|
||||
+4
-4
@@ -33,7 +33,7 @@ struct relocated {
|
||||
beginning of semantic pass */
|
||||
static struct relocated *relocated_list = NULL;
|
||||
|
||||
static __u32 get_relocated_objectid_from_list(struct reiserfs_key *key)
|
||||
static __u32 get_relocated_objectid_from_list(const struct reiserfs_key *key)
|
||||
{
|
||||
struct relocated *cur = relocated_list;
|
||||
|
||||
@@ -48,7 +48,7 @@ static __u32 get_relocated_objectid_from_list(struct reiserfs_key *key)
|
||||
}
|
||||
|
||||
/* return objectid the object has to be remapped with */
|
||||
__u32 objectid_for_relocation(struct reiserfs_key * key)
|
||||
__u32 objectid_for_relocation(const struct reiserfs_key * key)
|
||||
{
|
||||
struct relocated *cur;
|
||||
__u32 cur_id;
|
||||
@@ -89,7 +89,7 @@ static __u64 link_one(struct relocated *file)
|
||||
return len;
|
||||
}
|
||||
|
||||
void linked_already(struct reiserfs_key *new_key /*, link_func_t link_func */ )
|
||||
void linked_already(const struct reiserfs_key *new_key /*, link_func_t link_func */ )
|
||||
{
|
||||
struct relocated *cur = relocated_list;
|
||||
struct relocated *prev = NULL;
|
||||
@@ -170,7 +170,7 @@ struct si *save_and_delete_file_item(struct si *si, struct reiserfs_path *path)
|
||||
int should_relocate(struct item_head *ih)
|
||||
{
|
||||
struct reiserfs_key key;
|
||||
struct reiserfs_key *rkey;
|
||||
const struct reiserfs_key *rkey;
|
||||
struct reiserfs_path path;
|
||||
struct item_head *path_ih;
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ void pass_4_check_unaccessed_items(void)
|
||||
struct buffer_head *bh;
|
||||
struct item_head *ih;
|
||||
unsigned long items;
|
||||
struct reiserfs_key *rdkey;
|
||||
const struct reiserfs_key *rdkey;
|
||||
|
||||
path.path_length = ILLEGAL_PATH_ELEMENT_OFFSET;
|
||||
key = root_dir_key;
|
||||
|
||||
+11
-10
@@ -7,13 +7,14 @@
|
||||
static struct reiserfs_key *trunc_links = NULL;
|
||||
static __u32 links_num = 0;
|
||||
|
||||
int wrong_mode(struct reiserfs_key *key, __u16 * mode, __u64 real_size,
|
||||
int wrong_mode(const struct reiserfs_key *key, __u16 * mode, __u64 real_size,
|
||||
int symlink);
|
||||
int wrong_st_blocks(struct reiserfs_key *key, __u32 * blocks, __u32 sd_blocks,
|
||||
__u16 mode, int new_format);
|
||||
int wrong_st_size(struct reiserfs_key *key, unsigned long long max_file_size,
|
||||
int blocksize, __u64 * size, __u64 sd_size, int type);
|
||||
int wrong_first_direct_byte(struct reiserfs_key *key, int blocksize,
|
||||
int wrong_st_blocks(const struct reiserfs_key *key, __u32 * blocks,
|
||||
__u32 sd_blocks, __u16 mode, int new_format);
|
||||
int wrong_st_size(const struct reiserfs_key *key,
|
||||
unsigned long long max_file_size, int blocksize,
|
||||
__u64 * size, __u64 sd_size, int type);
|
||||
int wrong_first_direct_byte(const struct reiserfs_key *key, int blocksize,
|
||||
__u32 * first_direct_byte,
|
||||
__u32 sd_first_direct_byte, __u32 size);
|
||||
void get_object_key(struct reiserfs_de_head *deh, struct reiserfs_key *key,
|
||||
@@ -32,7 +33,7 @@ struct reiserfs_path_key {
|
||||
static struct reiserfs_path_key *head_key = NULL;
|
||||
static struct reiserfs_path_key *tail_key = NULL;
|
||||
|
||||
static int check_path_key(struct reiserfs_key *key)
|
||||
static int check_path_key(const struct reiserfs_key *key)
|
||||
{
|
||||
struct reiserfs_path_key *cur = head_key;
|
||||
|
||||
@@ -48,7 +49,7 @@ static int check_path_key(struct reiserfs_key *key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_path_key(struct reiserfs_key *key)
|
||||
static int add_path_key(const struct reiserfs_key *key)
|
||||
{
|
||||
if (check_path_key(key))
|
||||
return LOOP_FOUND;
|
||||
@@ -228,7 +229,7 @@ static int check_check_regular_file(struct reiserfs_path *path, void *sd,
|
||||
|
||||
/* returns buffer, containing found directory item.*/
|
||||
static char *get_next_directory_item(struct reiserfs_key *key, /* on return this will contain key of next item in the tree */
|
||||
struct reiserfs_key *parent,
|
||||
const struct reiserfs_key *parent,
|
||||
struct item_head *ih, __u32 * pos_in_item,
|
||||
int dir_format)
|
||||
{
|
||||
@@ -382,7 +383,7 @@ start_again:
|
||||
|
||||
/* semantic pass of --check */
|
||||
static int check_semantic_pass(struct reiserfs_key *key,
|
||||
struct reiserfs_key *parent, int dot_dot,
|
||||
const struct reiserfs_key *parent, int dot_dot,
|
||||
struct item_head *new_ih)
|
||||
{
|
||||
struct reiserfs_path path;
|
||||
|
||||
+11
-8
@@ -97,7 +97,8 @@ void erase_name(int len)
|
||||
}
|
||||
|
||||
/* *size is "real" file size, sd_size - size from stat data */
|
||||
int wrong_st_size(struct reiserfs_key *key, unsigned long long max_file_size,
|
||||
int wrong_st_size(const struct reiserfs_key *key,
|
||||
unsigned long long max_file_size,
|
||||
int blocksize, __u64 * size, __u64 sd_size, int type)
|
||||
{
|
||||
if (sd_size <= max_file_size) {
|
||||
@@ -175,8 +176,8 @@ int wrong_st_size(struct reiserfs_key *key, unsigned long long max_file_size,
|
||||
| file, dir, link | blocks | generation | blocks |
|
||||
|------------------------------------------------------------------|
|
||||
*/
|
||||
int wrong_st_blocks(struct reiserfs_key *key, __u32 * blocks, __u32 sd_blocks,
|
||||
__u16 mode, int new_format)
|
||||
int wrong_st_blocks(const struct reiserfs_key *key, __u32 * blocks,
|
||||
__u32 sd_blocks, __u16 mode, int new_format)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -231,7 +232,7 @@ int wrong_st_rdev (struct reiserfs_key *key, __u32 * sd_rdev, __u16 mode, int ne
|
||||
*/
|
||||
/* only regular files and symlinks may have items but stat
|
||||
data. Symlink should have body */
|
||||
int wrong_mode(struct reiserfs_key *key, __u16 * mode, __u64 real_size,
|
||||
int wrong_mode(const struct reiserfs_key *key, __u16 * mode, __u64 real_size,
|
||||
int symlink)
|
||||
{
|
||||
int retval = 0;
|
||||
@@ -269,7 +270,7 @@ int wrong_mode(struct reiserfs_key *key, __u16 * mode, __u64 real_size,
|
||||
}
|
||||
|
||||
/* key is a key of last file item */
|
||||
int wrong_first_direct_byte(struct reiserfs_key *key, int blocksize,
|
||||
int wrong_first_direct_byte(const struct reiserfs_key *key, int blocksize,
|
||||
__u32 * first_direct_byte,
|
||||
__u32 sd_first_direct_byte, __u32 size)
|
||||
{
|
||||
@@ -539,7 +540,7 @@ int rebuild_check_regular_file(struct reiserfs_path *path, void *sd,
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int is_rootdir_key(struct reiserfs_key *key)
|
||||
static int is_rootdir_key(const struct reiserfs_key *key)
|
||||
{
|
||||
if (comp_keys(key, &root_dir_key))
|
||||
return 0;
|
||||
@@ -550,7 +551,8 @@ static int is_rootdir_key(struct reiserfs_key *key)
|
||||
static char *get_next_directory_item(struct reiserfs_key *key, /* on return this will
|
||||
contain key of next item
|
||||
in the tree */
|
||||
struct reiserfs_key *parent, struct item_head *ih, /*not in tree */
|
||||
const struct reiserfs_key *parent,
|
||||
struct item_head *ih, /*not in tree */
|
||||
__u32 * pos_in_item)
|
||||
{
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
@@ -724,7 +726,8 @@ int fix_obviously_wrong_sd_mode(struct reiserfs_path *path)
|
||||
object, STAT_DATA_NOT_FOUND if stat data was not found or RELOCATED when
|
||||
file was relocated because its objectid was already marked as used by
|
||||
another file */
|
||||
int rebuild_semantic_pass(struct reiserfs_key *key, struct reiserfs_key *parent,
|
||||
int rebuild_semantic_pass(struct reiserfs_key *key,
|
||||
const struct reiserfs_key *parent,
|
||||
int dot_dot, struct item_head *new_ih)
|
||||
{
|
||||
struct reiserfs_path path;
|
||||
|
||||
+3
-3
@@ -5,13 +5,13 @@
|
||||
|
||||
#include "fsck.h"
|
||||
|
||||
static int do_items_have_the_same_type(struct item_head *ih,
|
||||
struct reiserfs_key *key)
|
||||
static int do_items_have_the_same_type(const struct item_head *ih,
|
||||
const struct reiserfs_key *key)
|
||||
{
|
||||
return (get_type(&ih->ih_key) == get_type(key)) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int are_items_in_the_same_node(struct reiserfs_path *path)
|
||||
static int are_items_in_the_same_node(const struct reiserfs_path *path)
|
||||
{
|
||||
return (PATH_LAST_POSITION(path) <
|
||||
B_NR_ITEMS(PATH_PLAST_BUFFER(path)) - 1) ? 1 : 0;
|
||||
|
||||
Reference in new issue
Block a user