a2a65e8a6d33d705a38946c238813b3a8fde58ec
[linux-2.6.git] / include / linux / rcfs.h
1 #ifndef _LINUX_RCFS_H
2 #define _LINUX_RCFS_H
3
4 #include <linux/kernel.h>
5 #include <linux/fs.h>
6 #include <linux/ckrm.h>
7 #include <linux/ckrm_rc.h>
8 #include <linux/ckrm_ce.h>
9
10
11
12 /* The following declarations cannot be included in any of ckrm*.h files without 
13    jumping hoops. Remove later when rearrangements done */
14
15 // Hubertus .. taken out 
16 //extern ckrm_res_callback_t ckrm_res_ctlrs[CKRM_MAX_RES_CTLRS];
17
18 #define RCFS_MAGIC      0x4feedbac
19 #define RCFS_MAGF_NAMELEN 20
20 extern int RCFS_IS_MAGIC;
21
22 #define rcfs_is_magic(dentry)  ((dentry)->d_fsdata == &RCFS_IS_MAGIC)
23
24 typedef struct rcfs_inode_info {
25         ckrm_core_class_t *core;
26         char *name;
27         struct inode vfs_inode;
28 } rcfs_inode_info_t;
29
30 #define RCFS_DEFAULT_DIR_MODE   (S_IFDIR | S_IRUGO | S_IXUGO)
31 #define RCFS_DEFAULT_FILE_MODE  (S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP |S_IROTH)
32
33
34 struct rcfs_magf {
35         char name[RCFS_MAGF_NAMELEN];
36         int mode;
37         struct inode_operations *i_op;
38         struct file_operations *i_fop;
39 };
40
41 struct rcfs_mfdesc {
42         struct rcfs_magf *rootmf;     // Root directory and its magic files
43         int              rootmflen;   // length of above array
44         // Can have a different magf describing magic files for non-root entries too
45 };
46
47 extern struct rcfs_mfdesc *genmfdesc[];
48
49 inline struct rcfs_inode_info *RCFS_I(struct inode *inode);
50
51 int rcfs_empty(struct dentry *);
52 struct inode *rcfs_get_inode(struct super_block *, int, dev_t);
53 int rcfs_mknod(struct inode *, struct dentry *, int, dev_t);
54 int _rcfs_mknod(struct inode *, struct dentry *, int , dev_t);
55 int rcfs_mkdir(struct inode *, struct dentry *, int);
56 ckrm_core_class_t *rcfs_make_core(struct dentry *, struct ckrm_core_class *);
57 struct dentry *rcfs_set_magf_byname(char *, void *);
58
59 struct dentry * rcfs_create_internal(struct dentry *, struct rcfs_magf *, int);
60 int rcfs_delete_internal(struct dentry *);
61 int rcfs_create_magic(struct dentry *, struct rcfs_magf *, int);
62 int rcfs_clear_magic(struct dentry *);
63
64
65 extern struct super_operations rcfs_super_ops;
66 extern struct address_space_operations rcfs_aops;
67
68 extern struct inode_operations rcfs_dir_inode_operations;
69 extern struct inode_operations rcfs_rootdir_inode_operations;
70 extern struct inode_operations rcfs_file_inode_operations;
71
72
73 extern struct file_operations target_fileops;
74 extern struct file_operations shares_fileops;
75 extern struct file_operations stats_fileops;
76 extern struct file_operations config_fileops;
77 extern struct file_operations members_fileops;
78 extern struct file_operations rcfs_file_operations;
79
80 // Callbacks into rcfs from ckrm 
81
82 typedef struct rcfs_functions {
83         int  (* mkroot)(struct rcfs_magf *,int, struct dentry **);
84         int  (* rmroot)(struct dentry *);
85         int  (* register_classtype)(ckrm_classtype_t *);
86         int  (* deregister_classtype)(ckrm_classtype_t *);
87 } rcfs_fn_t;
88
89 int rcfs_register_classtype(ckrm_classtype_t *);
90 int rcfs_deregister_classtype(ckrm_classtype_t *);
91 int rcfs_mkroot(struct rcfs_magf *, int , struct dentry **);
92 int rcfs_rmroot(struct dentry *);
93
94 #define RCFS_ROOT "/rcfs"         // Hubertus .. we should use the mount point instead of hardcoded
95 extern struct dentry *rcfs_rootde;
96
97
98 #endif /* _LINUX_RCFS_H */