1 /* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
3 /* Various macros used here and there */
4 #define MAKELONG(a,b) ((a) | ((b) << 16))
5 #define HIWORD(d) ((d) >> 16)
6 #define LOWORD(d) ((d) & 0xffff)
7 #define BYTES(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
9 /* Valid channel types for channel_open() */
10 #define CH_IN BYTES('T', 'C', 'L', 'O')
11 #define CH_OUT BYTES('R', 'P', 'C', 'I')
14 #define RPC_BUF_SIZE 6134 /* max size of RPC request */
15 #define RPC_HDR_SIZE 10 /* RPC HGFS header size */
17 /* RPC macros. These NEED NOT be portable. VMware only does x86(-64) anyway. */
18 /* ..all this because ACK can't pack structures :( */
19 #define RPC_NEXT8 *(((u8_t*)(++rpc_ptr))-1) /* get/set next byte */
20 #define RPC_NEXT16 *(((u16_t*)(rpc_ptr+=2))-1) /* get/set next short */
21 #define RPC_NEXT32 *(((u32_t*)(rpc_ptr+=4))-1) /* get/set next long */
22 #define RPC_LEN (rpc_ptr - rpc_buf) /* request length thus far */
23 #define RPC_ADVANCE(n) rpc_ptr += n /* skip n bytes in buffer */
24 #define RPC_PTR (rpc_ptr) /* pointer to next data */
25 #define RPC_RESET rpc_ptr = rpc_buf /* start at beginning */
26 #define RPC_REQUEST(r) \
31 RPC_NEXT32 = r; /* start a RPC request */
60 /* HGFS mode/perms conversion macros */
61 #define HGFS_MODE_TO_PERM(m) (((m) & S_IRWXU) >> 6)
62 #define HGFS_PERM_TO_MODE(p) (((p) << 6) & S_IRWXU)
64 /* HGFS attribute flags */
65 #define HGFS_ATTR_SIZE 0x01 /* get/set file size */
66 #define HGFS_ATTR_CRTIME 0x02 /* get/set file creation time */
67 #define HGFS_ATTR_ATIME 0x04 /* get/set file access time */
68 #define HGFS_ATTR_MTIME 0x08 /* get/set file modification time */
69 #define HGFS_ATTR_CTIME 0x10 /* get/set file change time */
70 #define HGFS_ATTR_MODE 0x20 /* get/set file mode */
71 #define HGFS_ATTR_ATIME_SET 0x40 /* set specific file access time */
72 #define HGFS_ATTR_MTIME_SET 0x80 /* set specific file modify time */