summaryrefslogtreecommitdiffstats
path: root/Manage.c
diff options
context:
space:
mode:
authorZhilong Liu <zlliu@suse.com>2017-05-04 20:16:21 +0800
committerJes Sorensen <jsorensen@fb.com>2017-05-05 11:04:02 -0400
commit0a6bff09d41650f27136d56a0604c9af46b6f583 (patch)
tree77af2c5e53c1190e97e821eb5e2243a6276ec733 /Manage.c
parent935795398d52a589598fa13e6cb6272619c5d134 (diff)
downloadmdadm-0a6bff09d41650f27136d56a0604c9af46b6f583.tar.gz
mdadm/util: unify fstat checking blkdev into function
declare function fstat_is_blkdev() to integrate repeated fstat checking block device operations, it returns true/1 when it is a block device, and returns false/0 when it isn't. The fd and devname are necessary parameters, *rdev is optional, parse the pointer of dev_t *rdev, if valid, assigned the device number to dev_t *rdev, if NULL, ignores. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'Manage.c')
-rw-r--r--Manage.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Manage.c b/Manage.c
index 230309b8..af55266b 100644
--- a/Manage.c
+++ b/Manage.c
@@ -1513,7 +1513,7 @@ int Manage_subdevs(char *devname, int fd,
struct stat stb;
tfd = dev_open(dv->devname, O_RDONLY);
if (tfd >= 0) {
- fstat(tfd, &stb);
+ fstat_is_blkdev(tfd, dv->devname, &rdev);
close(tfd);
} else {
int open_err = errno;