diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/guestfs-py.c | 50 | ||||
-rw-r--r-- | python/guestfs.py | 20 |
2 files changed, 70 insertions, 0 deletions
diff --git a/python/guestfs-py.c b/python/guestfs-py.c index 7d28af43..59a891ff 100644 --- a/python/guestfs-py.c +++ b/python/guestfs-py.c @@ -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 } }; diff --git a/python/guestfs.py b/python/guestfs.py index 30728be5..d838aaea 100644 --- a/python/guestfs.py +++ b/python/guestfs.py @@ -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) + |