Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / include / linux / lvfs_linux.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4 #ifndef __LVFS_LINUX_H__
5 #define __LVFS_LINUX_H__
6
7 #include <linux/kernel.h>
8 #include <linux/module.h>
9 #include <linux/fs.h>
10 #include <linux/namei.h>
11 #include <linux/sched.h>
12
13 #include <lvfs.h>
14
15 #define l_file file
16 #define l_dentry dentry
17 #define l_inode inode
18
19 #define l_filp_open filp_open
20
21 struct lvfs_run_ctxt;
22 struct l_file *l_dentry_open(struct lvfs_run_ctxt *, struct l_dentry *,
23                              int flags);
24
25 struct l_linux_dirent {
26         struct list_head lld_list;
27         ino_t           lld_ino;
28         unsigned long   lld_off;
29         char            lld_name[LL_FID_NAMELEN];
30 };
31 struct l_readdir_callback {
32         struct l_linux_dirent *lrc_dirent;
33         struct list_head      *lrc_list;
34 };
35
36 #define LVFS_DENTRY_PARAM_MAGIC         20070216UL
37 struct lvfs_dentry_params
38 {
39         unsigned long    ldp_inum;
40         void            *ldp_ptr;
41         __u32            ldp_magic;
42 };
43 #define LVFS_DENTRY_PARAMS_INIT         { .ldp_magic = LVFS_DENTRY_PARAM_MAGIC }
44
45 #define BDEVNAME_DECLARE_STORAGE(foo) char foo[BDEVNAME_SIZE]
46 #define ll_bdevname(SB, STORAGE) __bdevname(kdev_t_to_nr(SB->s_dev), STORAGE)
47 #define lvfs_sbdev(SB)       ((SB)->s_bdev)
48 #define lvfs_sbdev_type      struct block_device *
49 #define lvfs_sbdev_sync      fsync_bdev
50
51 int fsync_bdev(struct block_device *);
52
53 /* Instead of calling within lvfs (a layering violation) */
54 #define lvfs_set_rdonly(obd, sb) \
55         __lvfs_set_rdonly(lvfs_sbdev(sb), fsfilt_journal_sbdev(obd, sb))
56
57 void __lvfs_set_rdonly(lvfs_sbdev_type dev, lvfs_sbdev_type jdev);
58
59 int lvfs_check_rdonly(lvfs_sbdev_type dev);
60 void lvfs_clear_rdonly(lvfs_sbdev_type dev);
61
62 #endif /*  __LVFS_LINUX_H__ */