Whamcloud - gitweb
- make HEAD from b_post_cmd3
[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 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
11 #include <linux/namei.h>
12 #endif
13 #include <linux/sched.h>
14
15 #include <lvfs.h>
16
17 #define l_file file
18 #define l_dentry dentry
19 #define l_inode inode
20
21 #define l_filp_open filp_open
22
23 struct lvfs_run_ctxt;
24 struct l_file *l_dentry_open(struct lvfs_run_ctxt *, struct l_dentry *,
25                              int flags);
26
27 struct l_linux_dirent {
28         struct list_head lld_list;
29         ino_t           lld_ino;
30         unsigned long   lld_off;
31         char            lld_name[LL_FID_NAMELEN];
32 };
33 struct l_readdir_callback {
34         struct l_linux_dirent *lrc_dirent;
35         struct list_head      *lrc_list;
36 };
37
38 #define LVFS_DENTRY_PARAM_MAGIC         20070216UL
39 struct lvfs_dentry_params
40 {
41         unsigned long    ldp_inum;
42         void            *ldp_ptr;
43         __u32            ldp_magic;
44 };
45 #define LVFS_DENTRY_PARAMS_INIT         { .ldp_magic = LVFS_DENTRY_PARAM_MAGIC }
46
47 # if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
48 #  define BDEVNAME_DECLARE_STORAGE(foo) char foo[BDEVNAME_SIZE]
49 #  define ll_bdevname(SB, STORAGE) __bdevname(kdev_t_to_nr(SB->s_dev), STORAGE)
50 #  define lvfs_sbdev(SB)       ((SB)->s_bdev)
51 #  define lvfs_sbdev_type      struct block_device *
52    int fsync_bdev(struct block_device *);
53 #  define lvfs_sbdev_sync      fsync_bdev
54 # else
55 #  define BDEVNAME_DECLARE_STORAGE(foo) char __unused_##foo
56 #  define ll_bdevname(SB,STORAGE) ((void)__unused_##STORAGE,bdevname(lvfs_sbdev(SB)))
57 #  define lvfs_sbdev(SB)       (kdev_t_to_nr((SB)->s_dev))
58 #  define lvfs_sbdev_type      kdev_t
59 #  define lvfs_sbdev_sync      fsync_dev
60 # endif
61
62 /* Instead of calling within lvfs (a layering violation) */
63 #define lvfs_set_rdonly(obd, sb) \
64         __lvfs_set_rdonly(lvfs_sbdev(sb), fsfilt_journal_sbdev(obd, sb))
65
66 void __lvfs_set_rdonly(lvfs_sbdev_type dev, lvfs_sbdev_type jdev);
67
68 int lvfs_check_rdonly(lvfs_sbdev_type dev);
69 void lvfs_clear_rdonly(lvfs_sbdev_type dev);
70
71 #endif /*  __LVFS_LINUX_H__ */