22fd57558402db6bd4c2a0c890980342e50fb592
[libguestfs.git] / daemon / stubs.c
1 /* libguestfs generated file
2  * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3  * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
4  *
5  * Copyright (C) 2009 Red Hat Inc.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #include <rpc/types.h>
23 #include <rpc/xdr.h>
24 #include "daemon.h"
25 #include "../src/guestfs_protocol.h"
26 #include "actions.h"
27
28 static void mount_stub (XDR *xdr_in)
29 {
30   int r;
31   struct guestfs_mount_args args;
32   const char *device;
33   const char *mountpoint;
34
35   if (!xdr_guestfs_mount_args (xdr_in, &args)) {
36     reply_with_error ("mount: daemon failed to decode procedure arguments");
37     return;
38   }
39   device = args.device;
40   mountpoint = args.mountpoint;
41
42   r = do_mount (device, mountpoint);
43   if (r == -1)
44     /* do_mount has already called reply_with_error, so just return */
45     return;
46
47   reply (NULL, NULL);
48 }
49
50 static void sync_stub (XDR *xdr_in)
51 {
52   int r;
53
54   r = do_sync ();
55   if (r == -1)
56     /* do_sync has already called reply_with_error, so just return */
57     return;
58
59   reply (NULL, NULL);
60 }
61
62 static void touch_stub (XDR *xdr_in)
63 {
64   int r;
65   struct guestfs_touch_args args;
66   const char *path;
67
68   if (!xdr_guestfs_touch_args (xdr_in, &args)) {
69     reply_with_error ("touch: daemon failed to decode procedure arguments");
70     return;
71   }
72   path = args.path;
73
74   r = do_touch (path);
75   if (r == -1)
76     /* do_touch has already called reply_with_error, so just return */
77     return;
78
79   reply (NULL, NULL);
80 }
81
82 void dispatch_incoming_message (XDR *xdr_in)
83 {
84   switch (proc_nr) {
85     case GUESTFS_PROC_MOUNT:
86       mount_stub (xdr_in);
87       break;
88     case GUESTFS_PROC_SYNC:
89       sync_stub (xdr_in);
90       break;
91     case GUESTFS_PROC_TOUCH:
92       touch_stub (xdr_in);
93       break;
94     default:
95       reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr);
96   }
97 }