Whamcloud - gitweb
e38ee13f8a9d6245b6bbd522d0abbea5f10b791d
[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  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  */
36
37 #ifndef __LVFS_LINUX_H__
38 #define __LVFS_LINUX_H__
39
40 #include <linux/kernel.h>
41 #include <linux/module.h>
42 #include <linux/fs.h>
43 #include <linux/namei.h>
44 #include <linux/sched.h>
45
46 #include <lvfs.h>
47
48 #define l_file file
49 #define l_dentry dentry
50 #define l_inode inode
51
52 #define l_filp_open filp_open
53
54 struct lvfs_run_ctxt;
55 struct l_file *l_dentry_open(struct lvfs_run_ctxt *, struct l_dentry *,
56                              int flags);
57
58 struct l_linux_dirent {
59         cfs_list_t      lld_list;
60         ino_t           lld_ino;
61         unsigned long   lld_off;
62         char            lld_name[LL_FID_NAMELEN];
63 };
64 struct l_readdir_callback {
65         struct l_linux_dirent *lrc_dirent;
66         cfs_list_t            *lrc_list;
67 };
68
69 #define LVFS_DENTRY_PARAM_MAGIC         20070216UL
70 struct lvfs_dentry_params
71 {
72         unsigned long    ldp_inum;
73         void            *ldp_ptr;
74         __u32            ldp_magic;
75 };
76 #define LVFS_DENTRY_PARAMS_INIT         { .ldp_magic = LVFS_DENTRY_PARAM_MAGIC }
77
78 #define BDEVNAME_DECLARE_STORAGE(foo) char foo[BDEVNAME_SIZE]
79 #define ll_bdevname(SB, STORAGE) __bdevname(kdev_t_to_nr(SB->s_dev), STORAGE)
80 #define lvfs_sbdev(SB)       ((SB)->s_bdev)
81 #define lvfs_sbdev_type      struct block_device *
82 #define lvfs_sbdev_sync      fsync_bdev
83
84 int fsync_bdev(struct block_device *);
85
86 /* Instead of calling within lvfs (a layering violation) */
87 #define lvfs_set_rdonly(obd, sb) \
88         __lvfs_set_rdonly(lvfs_sbdev(sb), fsfilt_journal_sbdev(obd, sb))
89
90 void __lvfs_set_rdonly(lvfs_sbdev_type dev, lvfs_sbdev_type jdev);
91
92 int lvfs_check_rdonly(lvfs_sbdev_type dev);
93 void lvfs_clear_rdonly(lvfs_sbdev_type dev);
94
95 #endif /*  __LVFS_LINUX_H__ */