4 #include <linux/kp30.h>
6 #define LL_FID_NAMELEN (16 + 1 + 8 + 1)
9 #include <linux/lvfs_linux.h>
13 #include <lvfs_user_fs.h>
25 struct lvfs_callback_ops {
26 struct dentry *(*l_fid2dentry)(__u64 id_ino, __u32 gen, __u64 gr, void *data);
29 #define OBD_RUN_CTXT_MAGIC 0xC0FFEEAA
30 #define OBD_CTXT_DEBUG /* development-only debugging */
31 struct lvfs_run_ctxt {
32 struct vfsmount *pwdmnt;
35 struct lvfs_ucred luc;
37 struct lvfs_callback_ops cb_ops;
45 #define OBD_SET_CTXT_MAGIC(ctxt) (ctxt)->magic = OBD_RUN_CTXT_MAGIC
47 #define OBD_SET_CTXT_MAGIC(ctxt) do {} while(0)
51 struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *, __u64, __u32, __u64 ,void *data);
53 void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
54 struct lvfs_ucred *cred);
55 void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
56 struct lvfs_ucred *cred);
59 int lvfs_reint(struct super_block *sb, void *r_rec);
60 int lvfs_undo(struct super_block *sb, void *r_rec);
61 struct dentry *simple_mkdir(struct dentry *dir, char *name, int mode, int fix);
62 struct dentry *simple_mknod(struct dentry *dir, char *name, int mode, int fix);
63 int lustre_fread(struct file *file, void *buf, int len, loff_t *off);
64 int lustre_fwrite(struct file *file, const void *buf, int len, loff_t *off);
65 int lustre_fsync(struct file *file);
66 long l_readdir(struct file * file, struct list_head *dentry_list);
68 static inline void l_dput(struct dentry *de)
70 if (!de || IS_ERR(de))
72 //shrink_dcache_parent(de);
73 LASSERT(atomic_read(&de->d_count) > 0);
78 void *lock_dir(struct inode *dir, struct qstr *name);
79 void unlock_dir(struct inode *dir, void *lock);
82 /* We need to hold the inode semaphore over the dcache lookup itself, or we
83 * run the risk of entering the filesystem lookup path concurrently on SMP
84 * systems, and instantiating two inodes for the same entry. We still
85 * protect against concurrent addition/removal races with the DLM locking.
87 static inline struct dentry *ll_lookup_one_len(const char *fid_name,
88 struct dentry *dparent,
91 struct dentry *dchild;
96 qstr.len = fid_namelen;
97 lock = lock_dir(dparent->d_inode, &qstr);
99 down(&dparent->d_inode->i_sem);
102 dchild = lookup_one_len(fid_name, dparent, fid_namelen);
105 unlock_dir(dparent->d_inode, lock);
107 up(&dparent->d_inode->i_sem);
112 static inline void ll_sleep(int t)
114 set_current_state(TASK_INTERRUPTIBLE);
115 schedule_timeout(t * HZ);
116 set_current_state(TASK_RUNNING);
120 static inline int ll_fid2str(char *str, __u64 id, __u32 generation)
122 return sprintf(str, "%llx:%08x", (unsigned long long)id, generation);