1 #ifndef _MINIX_VTREEFS_H 2 #define _MINIX_VTREEFS_H 3 4 struct inode; 5 typedef int index_t; 6 typedef void *cbdata_t; 7 8 #define NO_INDEX ((index_t) -1) 9 10 /* Maximum file name length, excluding terminating null character. It is set 11 * to a low value to limit memory usage, but can be changed to any value. 12 */ 13 #define PNAME_MAX 24 14 15 struct inode_stat { 16 mode_t mode; /* file mode (type and permissions) */ 17 uid_t uid; /* user ID */ 18 gid_t gid; /* group ID */ 19 off_t size; /* file size */ 20 dev_t dev; /* device number (for char/block type files) */ 21 }; 22 23 struct fs_hooks { 24 void (*init_hook)(void); 25 void (*cleanup_hook)(void); 26 int (*lookup_hook)(struct inode *inode, char *name, cbdata_t cbdata); 27 int (*getdents_hook)(struct inode *inode, cbdata_t cbdata); 28 ssize_t (*read_hook)(struct inode *inode, char *ptr, size_t len, 29 off_t off, cbdata_t cbdata); 30 ssize_t (*write_hook)(struct inode *inode, char *ptr, size_t max, 31 off_t off, cbdata_t cbdata); 32 int (*trunc_hook)(struct inode *inode, off_t offset, cbdata_t cbdata); 33 int (*mknod_hook)(struct inode *inode, char *name, 34 struct inode_stat *stat, cbdata_t cbdata); 35 int (*unlink_hook)(struct inode *inode, cbdata_t cbdata); 36 int (*slink_hook)(struct inode *inode, char *name, 37 struct inode_stat *stat, char *path, cbdata_t cbdata); 38 int (*rdlink_hook)(struct inode *inode, char *ptr, size_t max, 39 cbdata_t cbdata); 40 int (*chstat_hook)(struct inode *inode, struct inode_stat *stat, 41 cbdata_t cbdata); 42 void (*message_hook)(message *m, int ipc_status); 43 }; 44 45 extern struct inode *add_inode(struct inode *parent, const char *name, 46 index_t index, const struct inode_stat *stat, 47 index_t nr_indexed_slots, cbdata_t cbdata); 48 extern void delete_inode(struct inode *inode); 49 50 extern struct inode *get_inode_by_name(const struct inode *parent, 51 const char *name); 52 extern struct inode *get_inode_by_index(const struct inode *parent, 53 index_t index); 54 55 extern const char *get_inode_name(const struct inode *inode); 56 extern index_t get_inode_index(const struct inode *inode); 57 extern index_t get_inode_slots(const struct inode *inode); 58 extern cbdata_t get_inode_cbdata(const struct inode *inode); 59 extern void *get_inode_extra(const struct inode *inode); 60 61 extern struct inode *get_root_inode(void); 62 extern struct inode *get_parent_inode(const struct inode *inode); 63 extern struct inode *get_first_inode(const struct inode *parent); 64 extern struct inode *get_next_inode(const struct inode *previous); 65 66 extern void get_inode_stat(const struct inode *inode, struct inode_stat *stat); 67 extern void set_inode_stat(struct inode *inode, struct inode_stat *stat); 68 69 extern void run_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes, 70 size_t inode_extra, struct inode_stat *stat, index_t nr_indexed_slots, 71 size_t buf_size); 72 73 #endif /* _MINIX_VTREEFS_H */ 74