diff options
author | Wanlong Gao <gaowanlong@cn.fujitsu.com> | 2012-02-10 17:10:02 +0800 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-02-10 09:34:13 +0000 |
commit | a2b3e0900ee14e5a49d526c24e22edefc3030f99 (patch) | |
tree | 99e4877512bb160388f7e6c9b299235002fc0705 /daemon | |
parent | 6ca8a2db6d6f1028a35ece616af44538074483fc (diff) | |
download | libguestfs-a2b3e0900ee14e5a49d526c24e22edefc3030f99.tar.gz libguestfs-a2b3e0900ee14e5a49d526c24e22edefc3030f99.tar.xz libguestfs-a2b3e0900ee14e5a49d526c24e22edefc3030f99.zip |
NEW API: add a new api wipefs
Add the new api wipefs to erase the filesystem signatures
on a device but now erase any data.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/zero.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/daemon/zero.c b/daemon/zero.c index 398f8440..00badd23 100644 --- a/daemon/zero.c +++ b/daemon/zero.c @@ -73,6 +73,30 @@ do_zero (const char *device) } int +optgroup_wipefs_available (void) +{ + return prog_exists ("wipefs"); +} + +int +do_wipefs (const char *device) +{ + int r; + char *err = NULL; + + const char *wipefs[] = {"wipefs", "-a", device, NULL}; + r = commandv (NULL, &err, wipefs); + if (r == -1) { + reply_with_error ("%s", err); + free (err); + return -1; + } + + free (err); + return 0; +} + +int do_zero_device (const char *device) { int64_t ssize = do_blockdev_getsize64 (device); |