diff options
author | Neil Brown <neilb@suse.de> | 2004-11-01 04:49:34 +0000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2004-11-01 04:49:34 +0000 |
commit | b5e64645037e99b5f05c9499b27b422ae60d23a9 (patch) | |
tree | f0999c8649d1488a367ee3d9442aff538ae366a8 /util.c | |
parent | e5329c3747a4e9eb7addbfaa59b8d5e8688ce2a1 (diff) | |
download | mdadm-b5e64645037e99b5f05c9499b27b422ae60d23a9.tar.gz mdadm-b5e64645037e99b5f05c9499b27b422ae60d23a9.tar.xz mdadm-b5e64645037e99b5f05c9499b27b422ae60d23a9.zip |
mdadm-1.8.0mdadm-1.8.0
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -212,15 +212,23 @@ int load_super(int fd, mdp_super_t *super) * 6 - wrong major version */ unsigned long size; + unsigned long long dsize; unsigned long long offset; - if (ioctl(fd, BLKGETSIZE, &size)) - return 1; +#ifdef BLKGETSIZE64 + if (ioctl(fd, BLKGETSIZE64, &dsize) != 0) +#endif + { + if (ioctl(fd, BLKGETSIZE, &size)) + return 1; + else + dsize = size << 9; + } - if (size < MD_RESERVED_SECTORS*2) + if (dsize < MD_RESERVED_SECTORS*2) return 2; - offset = MD_NEW_SIZE_SECTORS(size); + offset = MD_NEW_SIZE_SECTORS(dsize>>9); offset *= 512; @@ -242,16 +250,25 @@ int load_super(int fd, mdp_super_t *super) int store_super(int fd, mdp_super_t *super) { - long size; + unsigned long size; + unsigned long long dsize; + long long offset; - if (ioctl(fd, BLKGETSIZE, &size)) - return 1; +#ifdef BLKGETSIZE64 + if (ioctl(fd, BLKGETSIZE64, &dsize) != 0) +#endif + { + if (ioctl(fd, BLKGETSIZE, &size)) + return 1; + else + dsize = ((unsigned long long)size) << 9; + } - if (size < MD_RESERVED_SECTORS*2) + if (dsize < MD_RESERVED_SECTORS*2) return 2; - offset = MD_NEW_SIZE_SECTORS(size); + offset = MD_NEW_SIZE_SECTORS(dsize>>9); offset *= 512; |