diff options
author | Eric Sandeen <sandeen@redhat.com> | 2013-04-11 10:44:18 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-04-23 18:56:26 +0200 |
commit | 1997b9dc79829ee50d97a47bd4ec5ec58cc99238 (patch) | |
tree | f714c3f0a059d40e05ae4c2820e0d609c133d988 /mkfs.c | |
parent | c9ef717ba30a755f44b1bfd85a3b8d14fb5444bd (diff) |
btrfs-progs: use clearer var names in is_ssd()
is_ssd() uses nondescript variable names; path - to what?
disk - it's a dev_t not a disk name, unlike dev, which is
a name not a dev_t!
Rename some vars to make things hopefully clearer:
wholedisk - the name of the node for the entire disk
devno - the dev_t of the device we're mkfs'ing
sysfs_path - the path in sysfs we ultimately check
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'mkfs.c')
-rw-r--r-- | mkfs.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1216,9 +1216,9 @@ static int check_leaf_or_node_size(u32 size, u32 sectorsize) static int is_ssd(const char *file) { blkid_probe probe; - char dev[32]; - char path[PATH_MAX]; - dev_t disk; + char wholedisk[32]; + char sysfs_path[PATH_MAX]; + dev_t devno; int fd; char rotational; @@ -1227,18 +1227,19 @@ static int is_ssd(const char *file) return 0; /* Device number of this disk (possibly a partition) */ - disk = blkid_probe_get_devno(probe); - if (!disk) + devno = blkid_probe_get_devno(probe); + if (!devno) return 0; /* Get whole disk name (not full path) for this devno */ - blkid_devno_to_wholedisk(disk, dev, sizeof(dev), NULL); + blkid_devno_to_wholedisk(devno, wholedisk, sizeof(wholedisk), NULL); - snprintf(path, PATH_MAX, "/sys/block/%s/queue/rotational", dev); + snprintf(sysfs_path, PATH_MAX, "/sys/block/%s/queue/rotational", + wholedisk); blkid_free_probe(probe); - fd = open(path, O_RDONLY); + fd = open(sysfs_path, O_RDONLY); if (fd < 0) { return 0; } |