X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fdaemon.h;h=b2b81523765329efd0b26d497f291dc9ae8313bc;hp=ca71265746170f7555fd38923578709670d63418;hb=d73a4f097f96e7246718671b0a85cb94f0d3a88f;hpb=1765330e07a48dc6f7bdef7007f69ebe606fa731 diff --git a/daemon/daemon.h b/daemon/daemon.h index ca71265..b2b8152 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -64,6 +64,13 @@ extern void main_loop (int sock); extern void reply_with_error (const char *fs, ...); extern void reply_with_perror (const char *fs, ...); +/* daemon functions that receive files (FileIn) should call + * receive_file for each FileIn parameter. + */ +#if 0 +extern void receive_file (); +#endif + /* daemon functions that return files (FileOut) should call * reply, then send_file for each FileOut parameter. */ @@ -107,6 +114,19 @@ extern void reply (xdrproc_t xdrp, char *ret); } \ } while (0) +/* Helper for functions which need either an absolute path in the + * mounted filesystem, OR a /dev/ device which exists. + */ +#define NEED_ROOT_OR_IS_DEVICE(path,errcode) \ + do { \ + if (strncmp ((path), "/dev/", 5) == 0) \ + IS_DEVICE ((path),(errcode)); \ + else { \ + NEED_ROOT ((path),(errcode)); \ + ABS_PATH ((path),(errcode)); \ + } \ + } while (0) + /* NB: * (1) You must match CHROOT_IN and CHROOT_OUT even along error paths. * (2) You must not change directory! cwd must always be "/", otherwise