lib: devid2kname() should take a dev_t
authorJes Sorensen <jsorensen@fb.com>
Fri, 29 Sep 2017 21:54:12 +0000 (17:54 -0400)
committerJes Sorensen <jsorensen@fb.com>
Fri, 29 Sep 2017 21:54:12 +0000 (17:54 -0400)
Make devid2kname() and devid2devnm() consistent in their APIs

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
lib.c
mdadm.h

diff --git a/lib.c b/lib.c
index be093e8..60890b9 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -61,7 +61,7 @@ int get_mdp_major(void)
        return mdp_major;
 }
 
-char *devid2kname(int devid)
+char *devid2kname(dev_t devid)
 {
        char path[30];
        char link[PATH_MAX];
@@ -73,8 +73,7 @@ char *devid2kname(int devid)
         * /sys/dev/block/%d:%d link which must look like
         * and take the last component.
         */
-       sprintf(path, "/sys/dev/block/%d:%d", major(devid),
-               minor(devid));
+       sprintf(path, "/sys/dev/block/%d:%d", major(devid), minor(devid));
        n = readlink(path, link, sizeof(link) - 1);
        if (n > 0) {
                link[n] = 0;
diff --git a/mdadm.h b/mdadm.h
index 191ae8f..db08188 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -1537,7 +1537,7 @@ extern void print_r10_layout(int layout);
 extern char *find_free_devnm(int use_partitions);
 
 extern void put_md_name(char *name);
-extern char *devid2kname(int devid);
+extern char *devid2kname(dev_t devid);
 extern char *devid2devnm(dev_t devid);
 extern dev_t devnm2devid(char *devnm);
 extern char *get_md_name(char *devnm);