summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-30 13:09:44 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-30 13:10:45 +0100
commit0884d8bbae6d76a603ec1385ada2938f88981c5c (patch)
tree15c91a3bc58ba3537d4b52c48accf8703f3d8ffb /python
parentf850e1f065fb04df7cc87a921ab3c658741cc393 (diff)
downloadlibguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.gz
libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.xz
libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.zip
Generated code for mknod, mkfifo, mknod_b, mknod_c, umask.
Diffstat (limited to 'python')
-rw-r--r--python/guestfs-py.c139
-rw-r--r--python/guestfs.py49
2 files changed, 188 insertions, 0 deletions
diff --git a/python/guestfs-py.c b/python/guestfs-py.c
index bf27d0d5..98a14a03 100644
--- a/python/guestfs-py.c
+++ b/python/guestfs-py.c
@@ -5053,6 +5053,140 @@ py_guestfs_mkswap_U (PyObject *self, PyObject *args)
return py_r;
}
+static PyObject *
+py_guestfs_mknod (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ int mode;
+ int devmajor;
+ int devminor;
+ const char *path;
+
+ if (!PyArg_ParseTuple (args, (char *) "Oiiis:guestfs_mknod",
+ &py_g, &mode, &devmajor, &devminor, &path))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_mknod (g, mode, devmajor, devminor, path);
+ 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 PyObject *
+py_guestfs_mkfifo (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ int mode;
+ const char *path;
+
+ if (!PyArg_ParseTuple (args, (char *) "Ois:guestfs_mkfifo",
+ &py_g, &mode, &path))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_mkfifo (g, mode, path);
+ 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 PyObject *
+py_guestfs_mknod_b (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ int mode;
+ int devmajor;
+ int devminor;
+ const char *path;
+
+ if (!PyArg_ParseTuple (args, (char *) "Oiiis:guestfs_mknod_b",
+ &py_g, &mode, &devmajor, &devminor, &path))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_mknod_b (g, mode, devmajor, devminor, path);
+ 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 PyObject *
+py_guestfs_mknod_c (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ int mode;
+ int devmajor;
+ int devminor;
+ const char *path;
+
+ if (!PyArg_ParseTuple (args, (char *) "Oiiis:guestfs_mknod_c",
+ &py_g, &mode, &devmajor, &devminor, &path))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_mknod_c (g, mode, devmajor, devminor, path);
+ 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 PyObject *
+py_guestfs_umask (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ int mask;
+
+ if (!PyArg_ParseTuple (args, (char *) "Oi:guestfs_umask",
+ &py_g, &mask))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_umask (g, mask);
+ 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 },
@@ -5242,6 +5376,11 @@ static PyMethodDef methods[] = {
{ (char *) "mkswap", py_guestfs_mkswap, METH_VARARGS, NULL },
{ (char *) "mkswap_L", py_guestfs_mkswap_L, METH_VARARGS, NULL },
{ (char *) "mkswap_U", py_guestfs_mkswap_U, METH_VARARGS, NULL },
+ { (char *) "mknod", py_guestfs_mknod, METH_VARARGS, NULL },
+ { (char *) "mkfifo", py_guestfs_mkfifo, METH_VARARGS, NULL },
+ { (char *) "mknod_b", py_guestfs_mknod_b, METH_VARARGS, NULL },
+ { (char *) "mknod_c", py_guestfs_mknod_c, METH_VARARGS, NULL },
+ { (char *) "umask", py_guestfs_umask, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
diff --git a/python/guestfs.py b/python/guestfs.py
index d334a910..bb9bc087 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -1905,3 +1905,52 @@ class GuestFS:
"""
return libguestfsmod.mkswap_U (self._o, uuid, device)
+ def mknod (self, mode, devmajor, devminor, path):
+ u"""This call creates block or character special devices, or
+ named pipes (FIFOs).
+
+ The "mode" parameter should be the mode, using the
+ standard constants. "devmajor" and "devminor" are the
+ device major and minor numbers, only used when creating
+ block and character special devices.
+ """
+ return libguestfsmod.mknod (self._o, mode, devmajor, devminor, path)
+
+ def mkfifo (self, mode, path):
+ u"""This call creates a FIFO (named pipe) called "path" with
+ mode "mode". It is just a convenient wrapper around
+ "g.mknod".
+ """
+ return libguestfsmod.mkfifo (self._o, mode, path)
+
+ def mknod_b (self, mode, devmajor, devminor, path):
+ u"""This call creates a block device node called "path" with
+ mode "mode" and device major/minor "devmajor" and
+ "devminor". It is just a convenient wrapper around
+ "g.mknod".
+ """
+ return libguestfsmod.mknod_b (self._o, mode, devmajor, devminor, path)
+
+ def mknod_c (self, mode, devmajor, devminor, path):
+ u"""This call creates a char device node called "path" with
+ mode "mode" and device major/minor "devmajor" and
+ "devminor". It is just a convenient wrapper around
+ "g.mknod".
+ """
+ return libguestfsmod.mknod_c (self._o, mode, devmajor, devminor, path)
+
+ def umask (self, mask):
+ u"""This function sets the mask used for creating new files
+ and device nodes to "mask & 0777".
+
+ Typical umask values would be 022 which creates new
+ files with permissions like "-rw-r--r--" or
+ "-rwxr-xr-x", and 002 which creates new files with
+ permissions like "-rw-rw-r--" or "-rwxrwxr-x".
+
+ See also umask(2), "g.mknod", "g.mkdir".
+
+ This call returns the previous umask.
+ """
+ return libguestfsmod.umask (self._o, mask)
+