summaryrefslogtreecommitdiffstats
path: root/daemon/daemon.h
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-18 13:17:12 +0100
committerRichard Jones <rjones@redhat.com>2009-04-18 13:17:12 +0100
commit1765330e07a48dc6f7bdef7007f69ebe606fa731 (patch)
tree659ce188bbe1a0568fc4b58504c6de025b9b2e3d /daemon/daemon.h
parent92804dec7c4982d2039f81586bc4a5cacb46217b (diff)
downloadlibguestfs-1765330e07a48dc6f7bdef7007f69ebe606fa731.tar.gz
libguestfs-1765330e07a48dc6f7bdef7007f69ebe606fa731.tar.xz
libguestfs-1765330e07a48dc6f7bdef7007f69ebe606fa731.zip
Rewrite of main loop impl, start of FileIn/FileOut support.
Diffstat (limited to 'daemon/daemon.h')
-rw-r--r--daemon/daemon.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 27d86c9b..ca712657 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -30,7 +30,7 @@
#include "../src/guestfs_protocol.h"
-/* in guestfsd.c */
+/*-- in guestfsd.c --*/
extern int xwrite (int sock, const void *buf, size_t len);
extern int xread (int sock, void *buf, size_t len);
@@ -44,25 +44,37 @@ extern int command (char **stdoutput, char **stderror, const char *name, ...);
extern int commandv (char **stdoutput, char **stderror,
char * const* const argv);
-/* in proto.c */
+/*-- in proto.c --*/
extern int proc_nr;
extern int serial;
-/* in mount.c */
+/*-- in mount.c --*/
extern int root_mounted;
-/* in stubs.c (auto-generated) */
+/*-- in stubs.c (auto-generated) --*/
extern void dispatch_incoming_message (XDR *);
extern guestfs_lvm_int_pv_list *parse_command_line_pvs (void);
extern guestfs_lvm_int_vg_list *parse_command_line_vgs (void);
extern guestfs_lvm_int_lv_list *parse_command_line_lvs (void);
-/* in proto.c */
+/*-- in proto.c --*/
extern void main_loop (int sock);
+
+/* ordinary daemon functions use these to indicate errors */
extern void reply_with_error (const char *fs, ...);
extern void reply_with_perror (const char *fs, ...);
+
+/* daemon functions that return files (FileOut) should call
+ * reply, then send_file for each FileOut parameter.
+ */
+#if 0
+extern void send_file ();
+#endif
+
+/* only call this if there is a FileOut parameter */
extern void reply (xdrproc_t xdrp, char *ret);
+/* Helper for functions that need a root filesystem mounted. */
#define NEED_ROOT(errcode) \
do { \
if (!root_mounted) { \
@@ -72,6 +84,7 @@ extern void reply (xdrproc_t xdrp, char *ret);
} \
while (0)
+/* Helper for functions that need an argument ("path") that is absolute. */
#define ABS_PATH(path,errcode) \
do { \
if ((path)[0] != '/') { \
@@ -80,6 +93,7 @@ extern void reply (xdrproc_t xdrp, char *ret);
} \
} while (0)
+/* Helper for functions that need an argument ("path") that is a device. */
#define IS_DEVICE(path,errcode) \
do { \
struct stat statbuf; \
@@ -104,6 +118,7 @@ extern void reply (xdrproc_t xdrp, char *ret);
#define CHROOT_OUT \
do { int old_errno = errno; chroot ("."); errno = old_errno; } while (0)
+/* Marks functions which are not implemented. */
#define XXX_NOT_IMPL(errcode) \
do { \
reply_with_error ("%s: function not implemented", __func__); \