Generated code for df / df-h.

This commit is contained in:
Richard W.M. Jones
2009-06-29 12:26:11 +01:00
parent 405cf2a577
commit b2ed0f4c55
23 changed files with 653 additions and 2 deletions

View File

@@ -4805,6 +4805,54 @@ py_guestfs_tail_n (PyObject *self, PyObject *args)
return py_r;
}
static PyObject *
py_guestfs_df (PyObject *self, PyObject *args)
{
PyObject *py_g;
guestfs_h *g;
PyObject *py_r;
char *r;
if (!PyArg_ParseTuple (args, (char *) "O:guestfs_df",
&py_g))
return NULL;
g = get_handle (py_g);
r = guestfs_df (g);
if (r == NULL) {
PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
return NULL;
}
py_r = PyString_FromString (r);
free (r);
return py_r;
}
static PyObject *
py_guestfs_df_h (PyObject *self, PyObject *args)
{
PyObject *py_g;
guestfs_h *g;
PyObject *py_r;
char *r;
if (!PyArg_ParseTuple (args, (char *) "O:guestfs_df_h",
&py_g))
return NULL;
g = get_handle (py_g);
r = guestfs_df_h (g);
if (r == NULL) {
PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
return NULL;
}
py_r = PyString_FromString (r);
free (r);
return py_r;
}
static PyMethodDef methods[] = {
{ (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
{ (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
@@ -4984,6 +5032,8 @@ static PyMethodDef methods[] = {
{ (char *) "head_n", py_guestfs_head_n, METH_VARARGS, NULL },
{ (char *) "tail", py_guestfs_tail, METH_VARARGS, NULL },
{ (char *) "tail_n", py_guestfs_tail_n, METH_VARARGS, NULL },
{ (char *) "df", py_guestfs_df, METH_VARARGS, NULL },
{ (char *) "df_h", py_guestfs_df_h, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};

View File

@@ -1807,3 +1807,23 @@ class GuestFS:
"""
return libguestfsmod.tail_n (self._o, nrlines, path)
def df (self):
u"""This command runs the "df" command to report disk space
used.
This command is mostly useful for interactive sessions.
It is *not* intended that you try to parse the output
string. Use "statvfs" from programs.
"""
return libguestfsmod.df (self._o)
def df_h (self):
u"""This command runs the "df -h" command to report disk
space used in human-readable format.
This command is mostly useful for interactive sessions.
It is *not* intended that you try to parse the output
string. Use "statvfs" from programs.
"""
return libguestfsmod.df_h (self._o)