root / lab4 / .minix-src / include / minix / vtreefs.h @ 13
History | View | Annotate | Download (2.8 KB)
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, for which
|
11 |
* the name will be allocated statically. Longer names will be allocated
|
12 |
* dynamically, and should not be used for system-critical file systems.
|
13 |
*/
|
14 |
#define PNAME_MAX 24 |
15 |
|
16 |
struct inode_stat {
|
17 |
mode_t mode; /* file mode (type and permissions) */
|
18 |
uid_t uid; /* user ID */
|
19 |
gid_t gid; /* group ID */
|
20 |
off_t size; /* file size */
|
21 |
dev_t dev; /* device number (for char/block type files) */
|
22 |
}; |
23 |
|
24 |
struct fs_hooks {
|
25 |
void (*init_hook)(void); |
26 |
void (*cleanup_hook)(void); |
27 |
int (*lookup_hook)(struct inode *inode, char *name, cbdata_t cbdata); |
28 |
int (*getdents_hook)(struct inode *inode, cbdata_t cbdata); |
29 |
ssize_t (*read_hook)(struct inode *inode, char *ptr, size_t len, |
30 |
off_t off, cbdata_t cbdata); |
31 |
ssize_t (*write_hook)(struct inode *inode, char *ptr, size_t max, |
32 |
off_t off, cbdata_t cbdata); |
33 |
int (*trunc_hook)(struct inode *inode, off_t offset, cbdata_t cbdata); |
34 |
int (*mknod_hook)(struct inode *inode, char *name, |
35 |
struct inode_stat *stat, cbdata_t cbdata);
|
36 |
int (*unlink_hook)(struct inode *inode, cbdata_t cbdata); |
37 |
int (*slink_hook)(struct inode *inode, char *name, |
38 |
struct inode_stat *stat, char *path, cbdata_t cbdata); |
39 |
int (*rdlink_hook)(struct inode *inode, char *ptr, size_t max, |
40 |
cbdata_t cbdata); |
41 |
int (*chstat_hook)(struct inode *inode, struct inode_stat *stat, |
42 |
cbdata_t cbdata); |
43 |
void (*message_hook)(message *m, int ipc_status); |
44 |
}; |
45 |
|
46 |
extern struct inode *add_inode(struct inode *parent, const char *name, |
47 |
index_t index, const struct inode_stat *stat, |
48 |
index_t nr_indexed_slots, cbdata_t cbdata); |
49 |
extern void delete_inode(struct inode *inode); |
50 |
|
51 |
extern struct inode *get_inode_by_name(const struct inode *parent, |
52 |
const char *name); |
53 |
extern struct inode *get_inode_by_index(const struct inode *parent, |
54 |
index_t index); |
55 |
|
56 |
extern const char *get_inode_name(const struct inode *inode); |
57 |
extern index_t get_inode_index(const struct inode *inode); |
58 |
extern index_t get_inode_slots(const struct inode *inode); |
59 |
extern cbdata_t get_inode_cbdata(const struct inode *inode); |
60 |
extern void *get_inode_extra(const struct inode *inode); |
61 |
|
62 |
extern struct inode *get_root_inode(void); |
63 |
extern struct inode *get_parent_inode(const struct inode *inode); |
64 |
extern struct inode *get_first_inode(const struct inode *parent); |
65 |
extern struct inode *get_next_inode(const struct inode *previous); |
66 |
|
67 |
extern void get_inode_stat(const struct inode *inode, struct inode_stat *stat); |
68 |
extern void set_inode_stat(struct inode *inode, struct inode_stat *stat); |
69 |
|
70 |
extern void run_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes, |
71 |
size_t inode_extra, struct inode_stat *stat, index_t nr_indexed_slots,
|
72 |
size_t buf_size); |
73 |
|
74 |
#endif /* _MINIX_VTREEFS_H */ |