diff options
author | Neil Brown <neilb@suse.de> | 2006-01-30 23:23:45 +0000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-01-30 23:23:45 +0000 |
commit | 8fac0577f01646cb8a768c0830a884f74c63a18c (patch) | |
tree | 80f70444c7fb89aa7e610b4a360b575129033470 /util.c | |
parent | 91eedefcdddd6c4f4e159cfb9be9de38c9b39c7d (diff) | |
download | mdadm-8fac0577f01646cb8a768c0830a884f74c63a18c.tar.gz mdadm-8fac0577f01646cb8a768c0830a884f74c63a18c.tar.xz mdadm-8fac0577f01646cb8a768c0830a884f74c63a18c.zip |
Stuff like..
- report Intent Bitmap in --detail
- report internal bitmap in --examine
- pass' --force through to --grow --bitmap
- support v.large arrays in --grow --bitmap
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -676,6 +676,35 @@ struct supertype *guess_super(int fd) return NULL; } +unsigned long long get_component_size(int fd) +{ + /* Find out the component size of the array. + * We cannot trust GET_ARRAY_INFO ioctl as it's + * size field is only 32bits. + * So look in /sys/block/mdXXX/md/component_size + */ + struct stat stb; + char fname[50]; + int n; + if (fstat(fd, &stb)) return 0; + if (major(stb.st_rdev) == 9) + sprintf(fname, "/sys/block/md%d/component_size", + minor(stb.st_rdev)); + else + sprintf(fname, "/sys/block/md_d%d/component_size", + minor(stb.st_rdev)/16); + fd = open(fname, O_RDONLY); + if (fd < 0) + return 0; + n = read(fd, fname, sizeof(fname)); + close(fd); + if (n == sizeof(fname)) + return 0; + fname[n] = 0; + return strtoull(fname, NULL, 10); +} + + #ifdef __TINYC__ /* tinyc doesn't optimize this check in ioctl.h out ... */ unsigned int __invalid_size_argument_for_IOC = 0; |