Generated code for e2fsck-f command.

This commit is contained in:
Richard Jones
2009-05-21 16:18:16 +01:00
parent 0f81d0941a
commit 3e408f4934
23 changed files with 388 additions and 3 deletions

View File

@@ -3688,6 +3688,31 @@ py_guestfs_find (PyObject *self, PyObject *args)
return py_r;
}
static PyObject *
py_guestfs_e2fsck_f (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_e2fsck_f",
&py_g, &device))
return NULL;
g = get_handle (py_g);
r = guestfs_e2fsck_f (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 },
@@ -3822,6 +3847,7 @@ static PyMethodDef methods[] = {
{ (char *) "lvresize", py_guestfs_lvresize, METH_VARARGS, NULL },
{ (char *) "resize2fs", py_guestfs_resize2fs, METH_VARARGS, NULL },
{ (char *) "find", py_guestfs_find, METH_VARARGS, NULL },
{ (char *) "e2fsck_f", py_guestfs_e2fsck_f, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};

View File

@@ -1433,6 +1433,13 @@ class GuestFS:
def resize2fs (self, device):
u"""This resizes an ext2 or ext3 filesystem to match the
size of the underlying device.
*Note:* It is sometimes required that you run
"g.e2fsck_f" on the "device" before calling this
command. For unknown reasons "resize2fs" sometimes gives
an error about this and sometimes not. In any case, it
is always safe to call "g.e2fsck_f" before calling this
function.
"""
return libguestfsmod.resize2fs (self._o, device)
@@ -1467,3 +1474,13 @@ class GuestFS:
"""
return libguestfsmod.find (self._o, directory)
def e2fsck_f (self, device):
u"""This runs "e2fsck -p -f device", ie. runs the ext2/ext3
filesystem checker on "device", noninteractively ("-p"),
even if the filesystem appears to be clean ("-f").
This command is only needed because of "g.resize2fs"
(q.v.). Normally you should use "g.fsck".
"""
return libguestfsmod.e2fsck_f (self._o, device)