diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-02-27 11:13:45 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-02-27 11:13:45 +0000 |
commit | 51aa51884e8dfa22b489e958743bf8f3ac3785cc (patch) | |
tree | 61b671296b83ad5e24acea17517ec9cd8ae2ad93 /daemon | |
parent | 2e788ca45eddc4c6fdb4a3ac5fa6f74c54c98437 (diff) | |
download | libguestfs-51aa51884e8dfa22b489e958743bf8f3ac3785cc.tar.gz libguestfs-51aa51884e8dfa22b489e958743bf8f3ac3785cc.tar.xz libguestfs-51aa51884e8dfa22b489e958743bf8f3ac3785cc.zip |
New API: ntfsfix for fixing problems on NTFS.
Note this is not a "chkdsk" equivalent tool.
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/ntfs.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/daemon/ntfs.c b/daemon/ntfs.c index e8be3445..235ecbcd 100644 --- a/daemon/ntfs.c +++ b/daemon/ntfs.c @@ -115,3 +115,32 @@ do_ntfsresize_size (const char *device, int64_t size) optargs_bitmask = GUESTFS_NTFSRESIZE_OPTS_SIZE_BITMASK; return do_ntfsresize_opts (device, size, 0); } + +/* Takes optional arguments, consult optargs_bitmask. */ +int +do_ntfsfix (const char *device, int clearbadsectors) +{ + const char *argv[MAX_ARGS]; + size_t i = 0; + int r; + char *err; + + ADD_ARG (argv, i, "ntfsfix"); + + if ((optargs_bitmask & GUESTFS_NTFSFIX_CLEARBADSECTORS_BITMASK) && + clearbadsectors) + ADD_ARG (argv, i, "-b"); + + ADD_ARG (argv, i, device); + ADD_ARG (argv, i, NULL); + + r = commandv (NULL, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", device, err); + free (err); + return -1; + } + + free (err); + return 0; +} |