VTreeFS library

This commit is contained in:
David van Moolenbroek
2010-08-10 20:05:51 +00:00
parent 4e95b347a7
commit bee1f38e01
18 changed files with 1791 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ INCS+= minix/a.out.h minix/bitmap.h minix/callnr.h minix/cdrom.h \
minix/rs.h minix/safecopies.h minix/sched.h minix/sef.h minix/sound.h \
minix/spin.h minix/sys_config.h minix/sysinfo.h minix/syslib.h \
minix/sysutil.h minix/timers.h minix/tty.h minix/type.h minix/types.h \
minix/u64.h minix/vfsif.h minix/vm.h \
minix/u64.h minix/vfsif.h minix/vm.h minix/vtreefs.h \
minix/compiler.h minix/compiler-ack.h minix/sha2.h minix/sha1.h minix/md5.h
INCS+= net/hton.h net/if.h net/ioctl.h net/netlib.h
INCS+= net/gen/arp_io.h net/gen/dhcp.h net/gen/ether.h \

57
include/minix/vtreefs.h Normal file
View File

@@ -0,0 +1,57 @@
#ifndef _MINIX_VTREEFS_H
#define _MINIX_VTREEFS_H
struct inode;
typedef int index_t;
typedef void *cbdata_t;
#define NO_INDEX ((index_t) -1)
/* Maximum file name length, excluding terminating null character. It is set
* to a low value to limit memory usage, but can be changed to any value.
*/
#define PNAME_MAX 16
struct inode_stat {
mode_t mode; /* file mode (type and permissions) */
uid_t uid; /* user ID */
gid_t gid; /* group ID */
off_t size; /* file size */
dev_t dev; /* device number (for char/block type files) */
};
struct fs_hooks {
void (*init_hook)(void);
void (*cleanup_hook)(void);
int (*lookup_hook)(struct inode *inode, char *name, cbdata_t cbdata);
int (*getdents_hook)(struct inode *inode, cbdata_t cbdata);
int (*read_hook)(struct inode *inode, off_t offset, char **ptr,
size_t *len, cbdata_t cbdata);
int (*rdlink_hook)(struct inode *inode, char *ptr, size_t max,
cbdata_t cbdata);
int (*message_hook)(message *m);
};
extern struct inode *add_inode(struct inode *parent, char *name, index_t index,
struct inode_stat *stat, index_t nr_indexed_entries, cbdata_t cbdata);
extern void delete_inode(struct inode *inode);
extern struct inode *get_inode_by_name(struct inode *parent, char *name);
extern struct inode *get_inode_by_index(struct inode *parent, index_t index);
extern char const *get_inode_name(struct inode *inode);
extern index_t get_inode_index(struct inode *inode);
extern cbdata_t get_inode_cbdata(struct inode *inode);
extern struct inode *get_root_inode(void);
extern struct inode *get_parent_inode(struct inode *inode);
extern struct inode *get_first_inode(struct inode *parent);
extern struct inode *get_next_inode(struct inode *previous);
extern void get_inode_stat(struct inode *inode, struct inode_stat *stat);
extern void set_inode_stat(struct inode *inode, struct inode_stat *stat);
extern void start_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes,
struct inode_stat *stat, index_t nr_indexed_entries);
#endif /* _MINIX_VTREEFS_H */