kernel: scheduling fix for ARM
[minix.git] / lib / libhgfs / const.h
blobb679fde3de860b60f8cec0f696e5c4b4087c2135
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')
13 /* RPC constants */
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) \
27 RPC_RESET; \
28 RPC_NEXT8 = 'f'; \
29 RPC_NEXT8 = ' '; \
30 RPC_NEXT32 = 0; \
31 RPC_NEXT32 = r; /* start a RPC request */
33 /* HGFS requests */
34 enum {
35 HGFS_REQ_OPEN,
36 HGFS_REQ_READ,
37 HGFS_REQ_WRITE,
38 HGFS_REQ_CLOSE,
39 HGFS_REQ_OPENDIR,
40 HGFS_REQ_READDIR,
41 HGFS_REQ_CLOSEDIR,
42 HGFS_REQ_GETATTR,
43 HGFS_REQ_SETATTR,
44 HGFS_REQ_MKDIR,
45 HGFS_REQ_UNLINK,
46 HGFS_REQ_RMDIR,
47 HGFS_REQ_RENAME,
48 HGFS_REQ_QUERYVOL
51 /* HGFS open types */
52 enum {
53 HGFS_OPEN_TYPE_O,
54 HGFS_OPEN_TYPE_OT,
55 HGFS_OPEN_TYPE_CO,
56 HGFS_OPEN_TYPE_C,
57 HGFS_OPEN_TYPE_COT
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 */