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