summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-05-14 23:47:17 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-05-14 23:47:17 +0100
commitd901cc916102f1aaccfb73396b48aa303e5b8cd7 (patch)
tree7c2fd470088874ab99b5922393327170e653cf01 /python
parent4aa4ecc380edc509aba886417c67d9c39ab51c9a (diff)
downloadlibguestfs-d901cc916102f1aaccfb73396b48aa303e5b8cd7.tar.gz
libguestfs-d901cc916102f1aaccfb73396b48aa303e5b8cd7.tar.xz
libguestfs-d901cc916102f1aaccfb73396b48aa303e5b8cd7.zip
Add support for zerofree command.
Diffstat (limited to 'python')
-rw-r--r--python/guestfs-py.c26
-rw-r--r--python/guestfs.py14
2 files changed, 40 insertions, 0 deletions
diff --git a/python/guestfs-py.c b/python/guestfs-py.c
index 3a09afb3..8301c703 100644
--- a/python/guestfs-py.c
+++ b/python/guestfs-py.c
@@ -3402,6 +3402,31 @@ py_guestfs_hexdump (PyObject *self, PyObject *args)
return py_r;
}
+static PyObject *
+py_guestfs_zerofree (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ const char *device;
+
+ if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_zerofree",
+ &py_g, &device))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_zerofree (g, device);
+ if (r == -1) {
+ PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
+ return NULL;
+ }
+
+ Py_INCREF (Py_None);
+ py_r = Py_None;
+ return py_r;
+}
+
static PyMethodDef methods[] = {
{ (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
{ (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
@@ -3525,6 +3550,7 @@ static PyMethodDef methods[] = {
{ (char *) "strings", py_guestfs_strings, METH_VARARGS, NULL },
{ (char *) "strings_e", py_guestfs_strings_e, METH_VARARGS, NULL },
{ (char *) "hexdump", py_guestfs_hexdump, METH_VARARGS, NULL },
+ { (char *) "zerofree", py_guestfs_zerofree, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
diff --git a/python/guestfs.py b/python/guestfs.py
index e61ba656..044e1fac 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -1334,3 +1334,17 @@ class GuestFS:
"""
return libguestfsmod.hexdump (self._o, path)
+ def zerofree (self, device):
+ u"""This runs the *zerofree* program on "device". This
+ program claims to zero unused inodes and disk blocks on
+ an ext2/3 filesystem, thus making it possible to
+ compress the filesystem more effectively.
+
+ You should not run this program if the filesystem is
+ mounted.
+
+ It is possible that using this program can damage the
+ filesystem or data on the filesystem.
+ """
+ return libguestfsmod.zerofree (self._o, device)
+