summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-30 18:57:07 +0100
committerRichard Jones <rjones@redhat.com>2009-04-30 18:57:07 +0100
commit0703248d233744047515418893dac05ce013a642 (patch)
treeead0b718136e64b179b9d46f3fc314cdd49f2149 /python
parentc69c3695303d5a660ad093a076c2e364ae6061de (diff)
downloadlibguestfs-0703248d233744047515418893dac05ce013a642.tar.gz
libguestfs-0703248d233744047515418893dac05ce013a642.tar.xz
libguestfs-0703248d233744047515418893dac05ce013a642.zip
Add generated code for 'fsck' 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 3f3cb4de..6b93b276 100644
--- a/python/guestfs-py.c
+++ b/python/guestfs-py.c
@@ -3002,6 +3002,31 @@ py_guestfs_get_e2uuid (PyObject *self, PyObject *args)
return py_r;
}
+static PyObject *
+py_guestfs_fsck (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ const char *fstype;
+ const char *device;
+
+ if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_fsck",
+ &py_g, &fstype, &device))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_fsck (g, fstype, device);
+ if (r == -1) {
+ PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
+ return NULL;
+ }
+
+ py_r = PyInt_FromLong ((long) r);
+ return py_r;
+}
+
static PyMethodDef methods[] = {
{ (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
{ (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
@@ -3109,6 +3134,7 @@ static PyMethodDef methods[] = {
{ (char *) "get_e2label", py_guestfs_get_e2label, METH_VARARGS, NULL },
{ (char *) "set_e2uuid", py_guestfs_set_e2uuid, METH_VARARGS, NULL },
{ (char *) "get_e2uuid", py_guestfs_get_e2uuid, METH_VARARGS, NULL },
+ { (char *) "fsck", py_guestfs_fsck, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
diff --git a/python/guestfs.py b/python/guestfs.py
index 2fced28e..37dce2bf 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -1149,3 +1149,17 @@ class GuestFS:
"""
return libguestfsmod.get_e2uuid (self._o, device)
+ def fsck (self, fstype, device):
+ u"""This runs the filesystem checker (fsck) on "device"
+ which should have filesystem type "fstype".
+
+ The returned integer is the status. See fsck(8) for the
+ list of status codes from "fsck", and note that multiple
+ status codes can be summed together.
+
+ It is entirely equivalent to running "fsck -a -t fstype
+ device". Note that checking or repairing NTFS volumes is
+ not supported (by linux-ntfs).
+ """
+ return libguestfsmod.fsck (self._o, fstype, device)
+