diff options
author | Neil Brown <neilb@suse.de> | 2002-03-07 00:17:40 +0100 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2002-03-07 00:17:40 +0100 |
commit | cd29a5c835c11cbcedc10487677eac6a946ad61b (patch) | |
tree | d4bb1a92ee76d8680522baace561aaa1ceaaebae /util.c | |
parent | mdctl-0.5 (diff) | |
download | mdadm-cd29a5c835c11cbcedc10487677eac6a946ad61b.tar.xz mdadm-cd29a5c835c11cbcedc10487677eac6a946ad61b.zip |
mdctl-0.6mdctl-0.6
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1,7 +1,7 @@ /* * mdctl - manage Linux "md" devices aka RAID arrays. * - * Copyright (C) 2001 Neil Brown <neilb@cse.unsw.edu.au> + * Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au> * * * This program is free software; you can redistribute it and/or modify @@ -424,3 +424,16 @@ int calc_sb_csum(mdp_super_t *super) super->sb_csum = oldcsum; return csum; } + +char *human_size(long kbytes) +{ + static char buf[30]; + + if (kbytes < 2000) + buf[0]=0; + else if (kbytes < 2*1024*1024) + sprintf(buf, " (%d MiB)", kbytes>>10); + else + sprintf(buf, " (%d GiB)", kbytes>>20); + return buf; +} |