mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-13 09:11:36 +00:00
btrfs-progs: add prefix to get_partition_size
This is a public helper for devices, add the prefix to make it clear. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c7b5f884e0
commit
51c0ece9f6
@ -712,7 +712,7 @@ static int load_device_info(int fd, struct device_info **device_info_ptr,
|
||||
} else {
|
||||
strcpy(info[ndevs].path, (char *)dev_info.path);
|
||||
info[ndevs].device_size =
|
||||
get_partition_size((char *)dev_info.path);
|
||||
device_get_partition_size((const char *)dev_info.path);
|
||||
}
|
||||
info[ndevs].size = dev_info.total_bytes;
|
||||
++ndevs;
|
||||
@ -893,7 +893,7 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode,
|
||||
col++;
|
||||
}
|
||||
|
||||
unused = get_partition_size(device_info_ptr[i].path)
|
||||
unused = device_get_partition_size(device_info_ptr[i].path)
|
||||
- total_allocated;
|
||||
|
||||
table_printf(matrix, unallocated_col, vhdr_skip + i, ">%s",
|
||||
|
@ -261,7 +261,7 @@ static int cmd_replace_start(const struct cmd_struct *cmd,
|
||||
strncpy((char *)start_args.start.srcdev_name, srcdev,
|
||||
BTRFS_DEVICE_PATH_NAME_MAX);
|
||||
start_args.start.srcdevid = 0;
|
||||
srcdev_size = get_partition_size(srcdev);
|
||||
srcdev_size = device_get_partition_size(srcdev);
|
||||
} else {
|
||||
error("source device must be a block device or a devid");
|
||||
goto leave_with_error;
|
||||
@ -271,7 +271,7 @@ static int cmd_replace_start(const struct cmd_struct *cmd,
|
||||
if (ret)
|
||||
goto leave_with_error;
|
||||
|
||||
dstdev_size = get_partition_size(dstdev);
|
||||
dstdev_size = device_get_partition_size(dstdev);
|
||||
if (srcdev_size > dstdev_size) {
|
||||
error("target device smaller than source device (required %llu bytes)",
|
||||
srcdev_size);
|
||||
|
@ -283,7 +283,10 @@ u64 disk_size(const char *path)
|
||||
return sfs.f_bsize * sfs.f_blocks;
|
||||
}
|
||||
|
||||
u64 get_partition_size(const char *dev)
|
||||
/*
|
||||
* Read partition size using the low-level ioctl
|
||||
*/
|
||||
u64 device_get_partition_size(const char *dev)
|
||||
{
|
||||
u64 result;
|
||||
int fd = open(dev, O_RDONLY);
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
int device_discard_blocks(int fd, u64 start, u64 len);
|
||||
int device_zero_blocks(int fd, off_t start, size_t len);
|
||||
u64 get_partition_size(const char *dev);
|
||||
u64 device_get_partition_size(const char *dev);
|
||||
u64 disk_size(const char *path);
|
||||
u64 btrfs_device_size(int fd, struct stat *st);
|
||||
int btrfs_prepare_device(int fd, const char *file, u64 *block_count_ret,
|
||||
|
Loading…
Reference in New Issue
Block a user