diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-30 13:09:44 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-30 13:10:45 +0100 |
commit | 0884d8bbae6d76a603ec1385ada2938f88981c5c (patch) | |
tree | 15c91a3bc58ba3537d4b52c48accf8703f3d8ffb /daemon | |
parent | f850e1f065fb04df7cc87a921ab3c658741cc393 (diff) | |
download | libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.gz libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.xz libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.zip |
Generated code for mknod, mkfifo, mknod_b, mknod_c, umask.
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/actions.h | 5 | ||||
-rw-r--r-- | daemon/guestfsd.c | 3 | ||||
-rw-r--r-- | daemon/stubs.c | 157 |
3 files changed, 165 insertions, 0 deletions
diff --git a/daemon/actions.h b/daemon/actions.h index 3f8b7a80..ad44d535 100644 --- a/daemon/actions.h +++ b/daemon/actions.h @@ -153,3 +153,8 @@ extern int do_mount_loop (char *file, char *mountpoint); extern int do_mkswap (char *device); extern int do_mkswap_L (char *label, char *device); extern int do_mkswap_U (char *uuid, char *device); +extern int do_mknod (int mode, int devmajor, int devminor, char *path); +extern int do_mkfifo (int mode, char *path); +extern int do_mknod_b (int mode, int devmajor, int devminor, char *path); +extern int do_mknod_c (int mode, int devmajor, int devminor, char *path); +extern int do_umask (int mask); diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 030aabea..7eabbd47 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -160,6 +160,9 @@ main (int argc, char *argv[]) setenv ("SHELL", "/bin/sh", 1); setenv ("LANG", "C", 1); + /* We document that umask defaults to 022 (it should be this anyway). */ + umask (022); + /* Resolve the hostname. */ memset (&hints, 0, sizeof hints); hints.ai_socktype = SOCK_STREAM; diff --git a/daemon/stubs.c b/daemon/stubs.c index 48f16c28..033f42cd 100644 --- a/daemon/stubs.c +++ b/daemon/stubs.c @@ -3335,6 +3335,148 @@ done: xdr_free ((xdrproc_t) xdr_guestfs_mkswap_U_args, (char *) &args); } +static void mknod_stub (XDR *xdr_in) +{ + int r; + struct guestfs_mknod_args args; + int mode; + int devmajor; + int devminor; + char *path; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_mknod_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "mknod"); + return; + } + mode = args.mode; + devmajor = args.devmajor; + devminor = args.devminor; + path = args.path; + + r = do_mknod (mode, devmajor, devminor, path); + if (r == -1) + /* do_mknod has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_mknod_args, (char *) &args); +} + +static void mkfifo_stub (XDR *xdr_in) +{ + int r; + struct guestfs_mkfifo_args args; + int mode; + char *path; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_mkfifo_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "mkfifo"); + return; + } + mode = args.mode; + path = args.path; + + r = do_mkfifo (mode, path); + if (r == -1) + /* do_mkfifo has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_mkfifo_args, (char *) &args); +} + +static void mknod_b_stub (XDR *xdr_in) +{ + int r; + struct guestfs_mknod_b_args args; + int mode; + int devmajor; + int devminor; + char *path; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_mknod_b_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "mknod_b"); + return; + } + mode = args.mode; + devmajor = args.devmajor; + devminor = args.devminor; + path = args.path; + + r = do_mknod_b (mode, devmajor, devminor, path); + if (r == -1) + /* do_mknod_b has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_mknod_b_args, (char *) &args); +} + +static void mknod_c_stub (XDR *xdr_in) +{ + int r; + struct guestfs_mknod_c_args args; + int mode; + int devmajor; + int devminor; + char *path; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_mknod_c_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "mknod_c"); + return; + } + mode = args.mode; + devmajor = args.devmajor; + devminor = args.devminor; + path = args.path; + + r = do_mknod_c (mode, devmajor, devminor, path); + if (r == -1) + /* do_mknod_c has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_mknod_c_args, (char *) &args); +} + +static void umask_stub (XDR *xdr_in) +{ + int r; + struct guestfs_umask_args args; + int mask; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_umask_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "umask"); + return; + } + mask = args.mask; + + r = do_umask (mask); + if (r == -1) + /* do_umask has already called reply_with_error */ + goto done; + + struct guestfs_umask_ret ret; + ret.oldmask = r; + reply ((xdrproc_t) &xdr_guestfs_umask_ret, (char *) &ret); +done: + xdr_free ((xdrproc_t) xdr_guestfs_umask_args, (char *) &args); +} + void dispatch_incoming_message (XDR *xdr_in) { switch (proc_nr) { @@ -3734,6 +3876,21 @@ void dispatch_incoming_message (XDR *xdr_in) case GUESTFS_PROC_MKSWAP_U: mkswap_U_stub (xdr_in); break; + case GUESTFS_PROC_MKNOD: + mknod_stub (xdr_in); + break; + case GUESTFS_PROC_MKFIFO: + mkfifo_stub (xdr_in); + break; + case GUESTFS_PROC_MKNOD_B: + mknod_b_stub (xdr_in); + break; + case GUESTFS_PROC_MKNOD_C: + mknod_c_stub (xdr_in); + break; + case GUESTFS_PROC_UMASK: + umask_stub (xdr_in); + break; default: reply_with_error ("dispatch_incoming_message: unknown procedure number %d, set LIBGUESTFS_PATH to point to the matching libguestfs appliance directory", proc_nr); } |