1 /* Part of libvboxfs - (c) 2012, D.C. van Moolenbroek */ 2 3 #ifndef _VBOXFS_VBOXFS_H 4 #define _VBOXFS_VBOXFS_H 5 6 #define VBOXFS_CALL_CREATE 3 /* create, open, lookup */ 7 #define VBOXFS_CALL_CLOSE 4 /* close handle */ 8 #define VBOXFS_CALL_READ 5 /* read from file */ 9 #define VBOXFS_CALL_WRITE 6 /* write to file */ 10 #define VBOXFS_CALL_LIST 8 /* list directory contents */ 11 #define VBOXFS_CALL_INFO 9 /* get/set file information */ 12 #define VBOXFS_CALL_REMOVE 11 /* remove file or directory */ 13 #define VBOXFS_CALL_UNMAP_FOLDER 13 /* unmap folder */ 14 #define VBOXFS_CALL_RENAME 14 /* rename file or directory */ 15 #define VBOXFS_CALL_SET_UTF8 16 /* switch to UTF8 */ 16 #define VBOXFS_CALL_MAP_FOLDER 17 /* map folder */ 17 18 #define VBOXFS_INVALID_HANDLE ((vboxfs_handle_t) ~0LL) 19 20 typedef u32_t vboxfs_root_t; 21 typedef u64_t vboxfs_handle_t; 22 23 typedef struct { 24 u16_t size; 25 u16_t len; 26 char data[PATH_MAX]; 27 } vboxfs_path_t; 28 29 #define VBOXFS_NO_RESULT 0 30 #define VBOXFS_PATH_NOT_FOUND 1 31 #define VBOXFS_FILE_NOT_FOUND 2 32 #define VBOXFS_FILE_EXISTS 3 33 #define VBOXFS_FILE_CREATED 4 34 #define VBOXFS_FILE_REPLACED 5 35 36 #define VBOXFS_OBJATTR_ADD_NONE 1 /* no other attributes */ 37 #define VBOXFS_OBJATTR_ADD_UNIX 2 /* POSIX attributes */ 38 #define VBOXFS_OBJATTR_ADD_EATTR 3 /* extended attributes */ 39 40 typedef struct { 41 u32_t mode; 42 u32_t add; 43 union { 44 struct { 45 u32_t uid; 46 u32_t gid; 47 u32_t nlinks; 48 u32_t dev; 49 u64_t inode; 50 u32_t flags; 51 u32_t gen; 52 u32_t rdev; 53 }; 54 struct { 55 u64_t easize; 56 }; 57 }; 58 } vboxfs_objattr_t; 59 60 /* Thankfully, MINIX uses the universal UNIX mode values. */ 61 #define VBOXFS_GET_MODE(mode) ((mode) & 0xffff) 62 #define VBOXFS_SET_MODE(type, perm) ((type) | ((perm) & ALLPERMS)) 63 64 typedef struct { 65 u64_t size; 66 u64_t disksize; 67 u64_t atime; 68 u64_t mtime; 69 u64_t ctime; 70 u64_t crtime; 71 vboxfs_objattr_t attr; 72 } vboxfs_objinfo_t; 73 74 #define VBOXFS_CRFLAG_LOOKUP 0x00000001 75 #define VBOXFS_CRFLAG_DIRECTORY 0x00000004 76 #define VBOXFS_CRFLAG_OPEN_IF_EXISTS 0x00000000 77 #define VBOXFS_CRFLAG_FAIL_IF_EXISTS 0x00000010 78 #define VBOXFS_CRFLAG_REPLACE_IF_EXISTS 0x00000020 79 #define VBOXFS_CRFLAG_TRUNC_IF_EXISTS 0x00000030 80 #define VBOXFS_CRFLAG_CREATE_IF_NEW 0x00000000 81 #define VBOXFS_CRFLAG_FAIL_IF_NEW 0x00000100 82 #define VBOXFS_CRFLAG_READ 0x00001000 83 #define VBOXFS_CRFLAG_WRITE 0x00002000 84 #define VBOXFS_CRFLAG_APPEND 0x00004000 85 #define VBOXFS_CRFLAG_READ_ATTR 0x00010000 86 #define VBOXFS_CRFLAG_WRITE_ATTR 0x00020000 87 88 typedef struct { 89 vboxfs_handle_t handle; 90 u32_t result; 91 u32_t flags; 92 vboxfs_objinfo_t info; 93 } vboxfs_crinfo_t; 94 95 typedef struct { 96 vboxfs_objinfo_t info; 97 u16_t shortlen; 98 u16_t shortname[14]; 99 vboxfs_path_t name; /* WARNING: name data size is dynamic! */ 100 } vboxfs_dirinfo_t; 101 102 #define VBOXFS_INFO_GET 0x00 /* get file information */ 103 #define VBOXFS_INFO_SET 0x01 /* set file information */ 104 105 #define VBOXFS_INFO_SIZE 0x04 /* get/set file size */ 106 #define VBOXFS_INFO_FILE 0x08 /* get/set file attributes */ 107 #define VBOXFS_INFO_VOLUME 0x10 /* get volume information */ 108 109 #define VBOXFS_REMOVE_FILE 0x01 /* remove file */ 110 #define VBOXFS_REMOVE_DIR 0x02 /* remove directory */ 111 #define VBOXFS_REMOVE_SYMLINK 0x04 /* remove symbolic link */ 112 113 #define VBOXFS_RENAME_FILE 0x01 /* rename file */ 114 #define VBOXFS_RENAME_DIR 0x02 /* rename directory */ 115 #define VBOXFS_RENAME_REPLACE 0x04 /* replace target if it exists */ 116 117 typedef struct { 118 u32_t namemax; 119 u8_t remote; 120 u8_t casesens; 121 u8_t readonly; 122 u8_t unicode; 123 u8_t fscomp; 124 u8_t filecomp; 125 u16_t reserved; 126 } vboxfs_fsprops_t; 127 128 typedef struct { 129 u64_t total; 130 u64_t free; 131 u32_t blocksize; 132 u32_t sectorsize; 133 u32_t serial; 134 vboxfs_fsprops_t props; 135 } vboxfs_volinfo_t; 136 137 #endif /* !_VBOXFS_VBOXFS_H */ 138