Skip to content

Commit da353f6

Browse files
committed
btrfs: constify device path passed to relevant helpers
Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 0b58170 commit da353f6

4 files changed

Lines changed: 22 additions & 18 deletions

File tree

‎fs/btrfs/dev-replace.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,9 @@ void btrfs_after_dev_replace_commit(struct btrfs_fs_info *fs_info)
304304
dev_replace->cursor_left_last_write_of_item;
305305
}
306306

307-
int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, char *tgtdev_name,
308-
u64 srcdevid, char *srcdev_name, int read_src)
307+
int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
308+
const char *tgtdev_name, u64 srcdevid, const char *srcdev_name,
309+
int read_src)
309310
{
310311
struct btrfs_root *root = fs_info->dev_root;
311312
struct btrfs_trans_handle *trans;

‎fs/btrfs/dev-replace.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans,
2727
void btrfs_after_dev_replace_commit(struct btrfs_fs_info *fs_info);
2828
int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
2929
struct btrfs_ioctl_dev_replace_args *args);
30-
int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, char *tgtdev_name,
31-
u64 srcdevid, char *srcdev_name, int read_src);
30+
int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
31+
const char *tgtdev_name, u64 srcdevid, const char *srcdev_name,
32+
int read_src);
3233
void btrfs_dev_replace_status(struct btrfs_fs_info *fs_info,
3334
struct btrfs_ioctl_dev_replace_args *args);
3435
int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info,

‎fs/btrfs/volumes.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ static int btrfs_add_device(struct btrfs_trans_handle *trans,
17251725
* Function to update ctime/mtime for a given device path.
17261726
* Mainly used for ctime/mtime based probe like libblkid.
17271727
*/
1728-
static void update_dev_time(char *path_name)
1728+
static void update_dev_time(const char *path_name)
17291729
{
17301730
struct file *filp;
17311731

@@ -1851,7 +1851,8 @@ void btrfs_assign_next_active_device(struct btrfs_fs_info *fs_info,
18511851
fs_info->fs_devices->latest_bdev = next_device->bdev;
18521852
}
18531853

1854-
int btrfs_rm_device(struct btrfs_fs_info *fs_info, char *device_path, u64 devid)
1854+
int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
1855+
u64 devid)
18551856
{
18561857
struct btrfs_device *device;
18571858
struct btrfs_fs_devices *cur_devices;
@@ -2091,7 +2092,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
20912092
}
20922093

20932094
static int btrfs_find_device_by_path(struct btrfs_fs_info *fs_info,
2094-
char *device_path,
2095+
const char *device_path,
20952096
struct btrfs_device **device)
20962097
{
20972098
int ret = 0;
@@ -2118,7 +2119,7 @@ static int btrfs_find_device_by_path(struct btrfs_fs_info *fs_info,
21182119
}
21192120

21202121
int btrfs_find_device_missing_or_by_path(struct btrfs_fs_info *fs_info,
2121-
char *device_path,
2122+
const char *device_path,
21222123
struct btrfs_device **device)
21232124
{
21242125
*device = NULL;
@@ -2151,7 +2152,8 @@ int btrfs_find_device_missing_or_by_path(struct btrfs_fs_info *fs_info,
21512152
* Lookup a device given by device id, or the path if the id is 0.
21522153
*/
21532154
int btrfs_find_device_by_devspec(struct btrfs_fs_info *fs_info, u64 devid,
2154-
char *devpath, struct btrfs_device **device)
2155+
const char *devpath,
2156+
struct btrfs_device **device)
21552157
{
21562158
int ret;
21572159

@@ -2307,7 +2309,7 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans,
23072309
return ret;
23082310
}
23092311

2310-
int btrfs_init_new_device(struct btrfs_fs_info *fs_info, char *device_path)
2312+
int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path)
23112313
{
23122314
struct btrfs_root *root = fs_info->dev_root;
23132315
struct request_queue *q;
@@ -2515,7 +2517,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, char *device_path)
25152517
}
25162518

25172519
int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
2518-
char *device_path,
2520+
const char *device_path,
25192521
struct btrfs_device *srcdev,
25202522
struct btrfs_device **device_out)
25212523
{
@@ -7102,7 +7104,7 @@ int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info,
71027104
return 0;
71037105
}
71047106

7105-
void btrfs_scratch_superblocks(struct block_device *bdev, char *device_path)
7107+
void btrfs_scratch_superblocks(struct block_device *bdev, const char *device_path)
71067108
{
71077109
struct buffer_head *bh;
71087110
struct btrfs_super_block *disk_super;

‎fs/btrfs/volumes.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,26 +422,26 @@ void btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices, int step);
422422
void btrfs_assign_next_active_device(struct btrfs_fs_info *fs_info,
423423
struct btrfs_device *device, struct btrfs_device *this_dev);
424424
int btrfs_find_device_missing_or_by_path(struct btrfs_fs_info *fs_info,
425-
char *device_path,
425+
const char *device_path,
426426
struct btrfs_device **device);
427427
int btrfs_find_device_by_devspec(struct btrfs_fs_info *fs_info, u64 devid,
428-
char *devpath,
428+
const char *devpath,
429429
struct btrfs_device **device);
430430
struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,
431431
const u64 *devid,
432432
const u8 *uuid);
433433
int btrfs_rm_device(struct btrfs_fs_info *fs_info,
434-
char *device_path, u64 devid);
434+
const char *device_path, u64 devid);
435435
void btrfs_cleanup_fs_uuids(void);
436436
int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len);
437437
int btrfs_grow_device(struct btrfs_trans_handle *trans,
438438
struct btrfs_device *device, u64 new_size);
439439
struct btrfs_device *btrfs_find_device(struct btrfs_fs_info *fs_info, u64 devid,
440440
u8 *uuid, u8 *fsid);
441441
int btrfs_shrink_device(struct btrfs_device *device, u64 new_size);
442-
int btrfs_init_new_device(struct btrfs_fs_info *fs_info, char *path);
442+
int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *path);
443443
int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
444-
char *device_path,
444+
const char *device_path,
445445
struct btrfs_device *srcdev,
446446
struct btrfs_device **device_out);
447447
int btrfs_balance(struct btrfs_balance_control *bctl,
@@ -474,7 +474,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
474474
struct btrfs_device *tgtdev);
475475
void btrfs_init_dev_replace_tgtdev_for_resume(struct btrfs_fs_info *fs_info,
476476
struct btrfs_device *tgtdev);
477-
void btrfs_scratch_superblocks(struct block_device *bdev, char *device_path);
477+
void btrfs_scratch_superblocks(struct block_device *bdev, const char *device_path);
478478
int btrfs_is_parity_mirror(struct btrfs_mapping_tree *map_tree,
479479
u64 logical, u64 len, int mirror_num);
480480
unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,

0 commit comments

Comments
 (0)