History

init: remove the bstat helper

The only caller of the bstat function becomes cleaner and simpler when open coding the function.

Christoph Hellwig committed 6 years ago

Commit 881627f1 parent 9e96c8c2 files · +4 −14Browse files

Unified · Split

2 files
  1. init/do_mounts.h +0 −10
  2. init/do_mounts_md.c +4 −4
init/do_mounts.h+0−10
@@ -20,16 +20,6 @@ static inline int create_dev(char *name, dev_t dev) · 19 unmodified lines
2020 return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
2121 }
2222
23−static inline u32 bstat(char *name)
24−{
25− struct kstat stat;
26− if (vfs_stat(name, &stat) != 0)
27− return 0;
28− if (!S_ISBLK(stat.mode))
29− return 0;
30− return stat.rdev;
31−}
32−
3323 #ifdef CONFIG_BLK_DEV_RAM
3424
3525 int __init rd_load_disk(int n);
init/do_mounts_md.c+4−4
@@ -138,9 +138,9 @@ static void __init md_setup_drive(void) · 137 unmodified lines
138138 dev = MKDEV(MD_MAJOR, minor);
139139 create_dev(name, dev);
140140 for (i = 0; i < MD_SB_DISKS && devname != NULL; i++) {
141+ struct kstat stat;
141142 char *p;
142143 char comp_name[64];
143− u32 rdev;
144144
145145 p = strchr(devname, ',');
146146 if (p)
@@ -150,9 +150,9 @@ static void __init md_setup_drive(void) · 3 unmodified lines
150150 if (strncmp(devname, "/dev/", 5) == 0)
151151 devname += 5;
152152 snprintf(comp_name, 63, "/dev/%s", devname);
153− rdev = bstat(comp_name);
154− if (rdev)
155− dev = new_decode_dev(rdev);
153+ if (vfs_stat(comp_name, &stat) == 0 &&
154+ S_ISBLK(stat.mode))
155+ dev = new_decode_dev(stat.rdev);
156156 if (!dev) {
157157 printk(KERN_WARNING "md: Unknown device name: %s\n", devname);
158158 break;