summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-04-10 13:13:07 +0100
committerRichard Jones <rjones@redhat.com>2010-04-10 13:41:45 +0100
commitf8210da95888f0060b25dcca2ae299d5c16ff814 (patch)
tree40b676b65c3fd650be602118789f3a61c0f19de9
parente323d93ed2ab3b55885273ab6bd911e2996346d9 (diff)
downloadlibguestfs-f8210da95888f0060b25dcca2ae299d5c16ff814.tar.gz
libguestfs-f8210da95888f0060b25dcca2ae299d5c16ff814.tar.xz
libguestfs-f8210da95888f0060b25dcca2ae299d5c16ff814.zip
New API: ntfsresize.
This implements the ntfsresize operation, using the external program from ntfsprogs.
-rw-r--r--daemon/ntfs.c23
-rwxr-xr-xsrc/generator.ml8
2 files changed, 31 insertions, 0 deletions
diff --git a/daemon/ntfs.c b/daemon/ntfs.c
index 73ccbbcd..8938dbde 100644
--- a/daemon/ntfs.c
+++ b/daemon/ntfs.c
@@ -35,6 +35,13 @@ optgroup_ntfs3g_available (void)
}
int
+optgroup_ntfsprogs_available (void)
+{
+ int r = access ("/usr/sbin/ntfsresize", X_OK);
+ return r == 0;
+}
+
+int
do_ntfs_3g_probe (int rw, const char *device)
{
char *err;
@@ -52,3 +59,19 @@ do_ntfs_3g_probe (int rw, const char *device)
return r;
}
+
+int
+do_ntfsresize (const char *device)
+{
+ char *err;
+ int r;
+
+ r = command (NULL, &err, "ntfsresize", "-P", device, NULL);
+ if (r == -1) {
+ reply_with_error ("%s: %s", device, err);
+ free (err);
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/generator.ml b/src/generator.ml
index 9d190977..24b9bc0b 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4373,6 +4373,14 @@ I<xz compressed> tar file) into C<directory>.");
This command packs the contents of C<directory> and downloads
it to local file C<tarball> (as an xz compressed tar archive).");
+ ("ntfsresize", (RErr, [Device "device"]), 231, [Optional "ntfsprogs"],
+ [],
+ "resize an NTFS filesystem",
+ "\
+This command resizes an NTFS filesystem, expanding or
+shrinking it to the size of the underlying device.
+See also L<ntfsresize(8)>.");
+
]
let all_functions = non_daemon_functions @ daemon_functions