924fb5bf2a648b472b3c36a40723a3edbaeaa90d
[linux-flexiantxendom0-3.2.10.git] / fs / hostfs / metadata.h
1 /* 
2  * Copyright (C) 2004 Piotr Neuman (sikkh@wp.pl) and 
3  * Jeff Dike (jdike@addtoit.com)
4  * Licensed under the GPL
5  */
6
7 #ifndef __UM_FS_METADATA
8 #define __UM_FS_METADATA
9
10 #include "linux/fs.h"
11 #include "linux/list.h"
12 #include "os.h"
13 #include "hostfs.h"
14
15 struct humfs {
16         struct externfs_data ext;
17         __u64 used;
18         __u64 total;
19         char *data;
20         int mmap;
21         int direct;
22         struct humfs_meta_ops *meta;
23 };
24
25 struct humfs_file {
26         struct humfs *mount;
27         struct file_handle data;
28         struct externfs_inode ext;
29 };
30
31 struct humfs_meta_ops {
32         struct list_head list;
33         char *name;
34         struct humfs_file *(*init_file)(void);
35         int (*open_file)(struct humfs_file *hf, const char *path, 
36                          struct inode *inode, struct humfs *humfs);
37         int (*create_file)(struct humfs_file *hf, const char *path, int mode, 
38                            int uid, int gid, struct inode *inode, 
39                            struct humfs *humfs);
40         void (*close_file)(struct humfs_file *humfs);
41         int (*ownerships)(const char *path, int *mode_out, int *uid_out, 
42                           int *gid_out, char *type_out, int *maj_out, 
43                           int *min_out, struct humfs *humfs);
44         int (*make_node)(const char *path, int mode, int uid, int gid,
45                          int type, int major, int minor, struct humfs *humfs);
46         int (*create_link)(const char *to, const char *from, 
47                            struct humfs *humfs);
48         int (*remove_file)(const char *path, struct humfs *humfs);
49         int (*create_dir)(const char *path, int mode, int uid, int gid, 
50                           struct humfs *humfs);
51         int (*remove_dir)(const char *path, struct humfs *humfs);
52         int (*change_ownerships)(const char *path, int mode, int uid, int gid,
53                                  struct humfs *humfs);
54         int (*rename_file)(const char *from, const char *to, 
55                            struct humfs *humfs);
56         void (*invisible)(struct humfs_file *hf);
57         struct humfs *(*init_mount)(char *root);
58         void (*free_mount)(struct humfs *humfs);
59 };
60
61 extern void register_meta(struct humfs_meta_ops *ops);
62 extern void unregister_meta(struct humfs_meta_ops *ops);
63
64 extern char *humfs_path(char *dir, char *file);
65 extern char *humfs_name(struct inode *inode, char *prefix);
66 extern struct humfs *inode_humfs_info(struct inode *inode);
67
68 #endif
69
70 /*
71  * Overrides for Emacs so that we follow Linus's tabbing style.
72  * Emacs will notice this stuff at the end of the file and automatically
73  * adjust the settings for this buffer only.  This must remain at the end
74  * of the file.
75  * ---------------------------------------------------------------------------
76  * Local variables:
77  * c-file-style: "linux"
78  * End:
79  */