Whamcloud - gitweb
* demos/snaprest.sh: ensure client is disconnected after snaprestore
[fs/lustre-release.git] / lustre / include / linux / obdfs.h
1 /* object based disk file system
2  * 
3  * This software is licensed under the GPL.  See the file COPYING in the
4  * top directory of this distribution for details.
5  * 
6  * Copyright (C), 1999, Stelias Computing Inc
7  *
8  *
9  */
10
11
12 #ifndef _OBDFS_H
13 #define OBDFS_H
14 #include <linux/obd_class.h>
15
16 /* super.c */
17 void obdfs_read_inode(struct inode *inode);
18
19
20 /* rw.c */
21 int obdfs_readpage(struct dentry *dentry, struct page *page);
22 int obdfs_writepage(struct dentry *dentry, struct page *page);
23 struct page *obdfs_getpage(struct inode *inode, unsigned long offset, int create, int locked);
24 int obdfs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf);
25
26 /* namei.c */
27 struct dentry *obdfs_lookup(struct inode * dir, struct dentry *dentry);
28 int obdfs_create (struct inode * dir, struct dentry * dentry, int mode);
29 int obdfs_mkdir(struct inode *dir, struct dentry *dentry, int mode);
30 int obdfs_rmdir(struct inode *dir, struct dentry *dentry);
31 int obdfs_unlink(struct inode *dir, struct dentry *dentry);
32 int obdfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev);
33 int obdfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname);
34 int obdfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry);
35 int obdfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry);
36 /* dir.c */
37 int obdfs_check_dir_entry (const char * function, struct inode * dir,
38                           struct ext2_dir_entry_2 * de,
39                           struct page * page,
40                            unsigned long offset);
41 /* symlink.c */
42 int obdfs_readlink (struct dentry *, char *, int);
43 struct dentry *obdfs_follow_link(struct dentry *, struct dentry *, unsigned int); 
44
45 struct obdfs_sb_info {
46         struct obd_conn osi_conn;
47         struct super_block *osi_super;
48         struct obd_device *osi_obd;
49         struct obd_ops *osi_ops;     
50         ino_t           osi_rootino; /* which root inode */
51         int             osi_minor;   /* minor of /dev/obdX */
52 };
53
54 void obdfs_sysctl_init(void);
55 void obdfs_sysctl_clean(void);
56
57 struct obdfs_inode_info;
58
59 extern struct file_operations obdfs_file_operations;
60 extern struct inode_operations obdfs_file_inode_operations;
61 extern struct inode_operations obdfs_dir_inode_operations;
62 extern struct inode_operations obdfs_symlink_inode_operations;
63
64 static inline struct obd_ops *iops(struct inode *i)
65 {
66         struct obdfs_sb_info *sbi = (struct obdfs_sb_info *) &i->i_sb->u.generic_sbp;
67         return sbi->osi_ops;
68 }
69
70 static inline struct obd_conn *iid(struct inode *i)
71 {
72         struct obdfs_sb_info *sbi = (struct obdfs_sb_info *) &i->i_sb->u.generic_sbp;
73         return &sbi->osi_conn;
74 }
75
76 #define NOLOCK 0
77 #define LOCKED 1
78
79 #ifdef OPS
80 #warning "*** WARNING redefining OPS"
81 #else
82 #define OPS(sb,op) ((struct obdfs_sb_info *)(& ## sb ## ->u.generic_sbp))->osi_ops->o_ ## op
83 #define IOPS(inode,op) ((struct obdfs_sb_info *)(& ## inode->i_sb ## ->u.generic_sbp))->osi_ops->o_ ## op
84 #endif
85
86 #ifdef ID
87 #warning "*** WARNING redefining ID"
88 #else
89 #define ID(sb) (&((struct obdfs_sb_info *)( & ## sb ## ->u.generic_sbp))->osi_conn)
90 #define IID(inode) (&((struct obdfs_sb_info *)( & ## inode->i_sb ## ->u.generic_sbp))->osi_conn)
91 #endif
92
93 #define OBDFS_SUPER_MAGIC 0x4711
94
95 #endif
96