source: gpfs_3.1_ker2.6.20/lpp/mmfs/src/include/gpl-linux/linux2gpfs.h @ 16

Last change on this file since 16 was 16, checked in by rock, 16 years ago
File size: 14.2 KB
Line 
1/***************************************************************************
2 *
3 * Copyright (C) 2001 International Business Machines
4 * All rights reserved.
5 *
6 * This file is part of the GPFS mmfslinux kernel module.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 *  1. Redistributions of source code must retain the above copyright notice,
13 *     this list of conditions and the following disclaimer.
14 *  2. Redistributions in binary form must reproduce the above copyright
15 *     notice, this list of conditions and the following disclaimer in the
16 *     documentation and/or other materials provided with the distribution.
17 *  3. The name of the author may not be used to endorse or promote products
18 *     derived from this software without specific prior written
19 *     permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 *************************************************************************** */
33/* @(#)02       1.85.1.3  src/avs/fs/mmfs/ts/kernext/gpl-linux/linux2gpfs.h, mmfs, avs_rgpfs24, rgpfs24s007a 10/8/06 03:17:31 */
34#ifndef _h_linux2gpfs
35#define _h_linux2gpfs
36
37#include <cxiTypes.h>
38#include <Logger-gpl.h>
39
40#ifdef __cplusplus
41#include <prelinux.h>
42#endif
43
44#include <linux/kdev_t.h>
45#include <linux/fs.h>
46
47#ifdef __cplusplus
48#include <postlinux.h>
49#endif
50#include <cxiSystem.h>
51#include <verdep.h>
52
53#ifdef NTRACE
54#define PRINTINODE(i)  ((void)0)
55#define PRINTDENTRY(d) ((void)0)
56#define PRINTSBLOCK(s) ((void)0)
57#define PRINTFILE(f)   ((void)0)
58#else
59#define PRINTINODE(i)  printInode(i)
60#define PRINTDENTRY(d) printDentry(d)
61#define PRINTSBLOCK(s) printSblock(s)
62#define PRINTFILE(f)   printFile(f)
63#endif
64
65/* check if inode belongs to GPFS */
66#define GPFS_TYPE(IP) (!(iP) ? false : \
67                        (!(iP->i_sb) ? false : \
68                          (!(iP->i_sb->s_type) ? false : \
69                            !strcmp(iP->i_sb->s_type->name, "gpfs"))))
70
71
72/* forward declarations */
73struct ext_cred_t;
74struct dentry;
75struct super_block;
76struct file;
77struct nameidata;
78struct page;
79struct iattr;
80struct inode;
81struct vm_area_struct;
82#ifdef P_NFS4
83typedef struct {
84  u32 state[4];
85} stateid_t;
86typedef struct {
87  u32             cl_boot;
88  u32             cl_id;
89} clientid_t;
90#endif
91
92/* inode.C */
93#ifdef __cplusplus
94extern "C"
95{
96#endif
97  void setCred(struct ext_cred_t *);
98#if LINUX_KERNEL_VERSION >= 2060000
99  int gpfs_i_create(struct inode *, struct dentry *, int, struct nameidata *);
100  struct dentry *gpfs_i_lookup(struct inode *, struct dentry *, struct nameidata *);
101#else
102  int gpfs_i_create(struct inode *, struct dentry *, int);
103  struct dentry *gpfs_i_lookup(struct inode *, struct dentry *);
104#endif
105  int gpfs_i_link(struct dentry *, struct inode *, struct dentry *);
106  int gpfs_i_unlink(struct inode *, struct dentry *);
107  int gpfs_i_symlink(struct inode *, struct dentry *, const char *);
108  int gpfs_i_mkdir(struct inode *, struct dentry *, int);
109  int gpfs_i_rmdir(struct inode *, struct dentry *);
110#if LINUX_KERNEL_VERSION >= 2050000
111  int gpfs_i_mknod(struct inode *, struct dentry *, int, dev_t);
112#else
113  int gpfs_i_mknod(struct inode *, struct dentry *, int, int);
114#endif
115  int gpfs_i_rename(struct inode *, struct dentry *, struct inode *,
116                    struct dentry *);
117  int gpfs_i_readlink(struct dentry *, char *, int);
118#if LINUX_KERNEL_VERSION >= 2061600
119  void* gpfs_i_follow_link(struct dentry *dentry, struct nameidata *nd);
120#else
121  int gpfs_i_follow_link(struct dentry *dentry, struct nameidata *nd);
122#endif
123  int gpfs_i_readpage(struct file *, struct page *);
124#if LINUX_KERNEL_VERSION >= 2050000
125  int gpfs_i_writepage(struct page *pageP, struct writeback_control *wbcP);
126#else
127  int gpfs_i_writepage(struct page *pageP);
128#endif
129  int gpfs_i_bmap(struct inode *, int);
130  void gpfs_i_truncate(struct inode *);
131#if LINUX_KERNEL_VERSION >= 2060000
132  int gpfs_i_permission(struct inode *, int, struct nameidata *);
133#else
134  int gpfs_i_permission(struct inode *, int);
135#endif
136  int gpfs_i_smap(struct inode *, int);
137  int gpfs_i_updatepage(struct file *, struct page *, const char *,
138                        unsigned long, uint, int);
139  int gpfs_i_revalidate(struct dentry *);
140  int gpfs_i_setattr(struct dentry *, struct iattr *);
141#if LINUX_KERNEL_VERSION >= 2050000
142  int gpfs_i_getattr(struct vfsmount *mnt, struct dentry *, 
143                     struct kstat *);
144#else
145  int gpfs_i_getattr(struct dentry *, struct iattr *);
146#endif
147
148#if LINUX_KERNEL_VERSION > 2060000
149  int gpfs_i_setxattr(struct dentry *, const char *, const void *, size_t, int);
150  ssize_t gpfs_i_getxattr(struct dentry *, const char *, void *, size_t);
151  ssize_t gpfs_i_listxattr(struct dentry *, char *, size_t);
152  int gpfs_i_removexattr(struct dentry *, const char *);
153  int gpfs_set_posix_acl(struct dentry *, int, const void *, size_t);
154  int gpfs_get_posix_acl(struct dentry *, int, const void *, size_t);
155#endif
156
157  int gpfs_i_getattr_internal(struct inode *iP);
158  int gpfs_i_setattr_internal(struct inode *iP, struct iattr *aP);
159  void printInode(struct inode *);
160  void printDentry(struct dentry *);
161  void printDentryTree(struct dentry *, int maxPrint);
162  void setIopTable(struct inode *iP, Boolean xperm);
163  void printSuper(struct super_block *sbP);
164  void printSuperList(struct super_block *sbP);
165
166#ifdef HAS_IOP_PUT_LINK
167#if LINUX_KERNEL_VERSION >= 2061600
168void gpfs_i_put_link(struct dentry *dentry, struct nameidata *nd, void* cookie);
169#else
170void gpfs_i_put_link(struct dentry *dentry, struct nameidata *nd);
171#endif
172#endif
173
174#ifdef __cplusplus
175}
176#endif
177
178/* file.C */
179#ifdef __cplusplus
180extern "C"
181{
182#endif
183  loff_t gpfs_f_llseek(struct file *, loff_t, int);
184  ssize_t gpfs_f_read(struct file *, char *, size_t, loff_t *);
185  ssize_t gpfs_f_dir_read(struct file *, char *, size_t, loff_t *);
186  ssize_t gpfs_f_write(struct file *, const char *, size_t, loff_t *);
187  int gpfs_f_readdir(struct file *, void *, filldir_t);
188  uint gpfs_f_poll(struct file *, struct poll_table_struct *);
189  int gpfs_f_ioctl(struct inode *, struct file *, uint, unsigned long);
190  int gpfs_f_mmap(struct file *, struct vm_area_struct *);
191  int gpfs_f_open(struct inode *, struct file *);
192  int gpfs_f_release(struct inode *, struct file *);
193  int gpfs_f_fsync(struct file *, struct dentry *, int datasync);
194  int gpfs_f_fasync(int, struct file *, int);
195  int gpfs_f_lock(struct file *, int, struct file_lock *);
196  int gpfs_f_flock(struct file *, int, struct file_lock *);
197  ssize_t gpfs_f_readv(struct kiocb *, const struct iovec *, unsigned long,
198                   loff_t );
199  ssize_t gpfs_f_writev(struct kiocb *, const struct iovec *, unsigned long,
200                    loff_t );
201  int gpfs_f_cleanup(struct inode *iP, struct file *fP);
202#if LINUX_KERNEL_VERSION > 2060300
203  struct page *gpfs_filemap_nopage(struct vm_area_struct * area,
204                                 unsigned long address, int *no_share);
205#else
206  struct page *gpfs_filemap_nopage(struct vm_area_struct * area,
207                                 unsigned long address, int no_share);
208#endif
209  void gpfs_filemap_close(struct vm_area_struct * area);
210  void gpfs_filemap_open(struct vm_area_struct * area);
211#ifdef NFS4_CLUSTER
212  int gpfs_f_share(struct file *, unsigned int, unsigned int);
213#endif /* NFS4_CLUSTER */
214
215#if LINUX_KERNEL_VERSION >= 2060000
216  ssize_t gpfs_f_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iovecP,
217                           loff_t offset, unsigned long count);
218#elif defined(SUSE_LINUX)
219  int gpfs_f_direct_IO(int rw, struct file *file, struct kiobuf *kiobuf,
220                        unsigned long in_offset, int count);
221#endif
222
223#ifdef P_NFS4
224  int gpfs_layout_get(struct inode *inode, void *p);
225  int gpfs_get_devicelist(struct super_block *sbP, void *p);
226  int gpfs_get_deviceinfo(struct super_block *sb, void *p);
227  int gpfs_layout_return(struct inode *inode, void *p);
228  int gpfs_get_state(struct inode *inode, void *fh, void *p);
229  void gpfs_get_verifier(struct super_block *sb, u32 *p);
230#endif
231
232#ifdef __cplusplus
233}
234#endif
235
236/* super.C */
237#ifdef __cplusplus
238extern "C"
239{
240#endif
241#ifdef VERBOSETRACE
242  void TraceBKL();
243#else
244#define TraceBKL() ((void)0)
245#endif
246  void gpfs_s_read_inode(struct inode *);
247  void gpfs_s_read_inode2(struct inode *, void *);
248  void gpfs_s_delete_inode(struct inode *);
249  int gpfs_s_notify_change(struct dentry *, struct iattr *);
250  void gpfs_s_put_super(struct super_block *);
251#if LINUX_KERNEL_VERSION >= 2060000
252  int gpfs_s_statfs(struct dentry *, struct kstatfs *);
253  void gpfs_destory_inodecache(void);
254  int gpfs_init_inodecache(void);
255  struct inode *gpfs_alloc_inode(struct super_block *);
256  void gpfs_destroy_inode(struct inode *);
257#else
258  int gpfs_s_statfs(struct super_block *, struct statfs *);
259#endif
260#if LINUX_KERNEL_VERSION >= 2061700
261  void gpfs_s_umount_begin(struct vfsmount *, int);
262#else
263  void gpfs_s_umount_begin(struct super_block *);
264#endif
265  int gpfs_s_remount(struct super_block *, int *, char *);
266#if LINUX_KERNEL_VERSION > 2060000
267  struct dentry *gpfs_decode_fh(struct super_block *sbP, __u32 *fh,
268                 int len, int fhtype, 
269           int (*acceptable)(void *context, struct dentry *dentry),
270                                   void *context);
271  int gpfs_encode_fh(struct dentry *dentry, __u32 *fh, int *lenp, int need_parent);
272  struct dentry *gpfs_get_dentry(struct super_block *sb, void *data);
273  struct dentry *gpfs_get_dparent(struct dentry * dentry);
274#else
275  struct dentry *gpfs_fh_to_dentry(struct super_block *sbP, __u32 *fh,
276                 int len, int fhtype, int parent);
277  int gpfs_dentry_to_fh(struct dentry *, __u32 *fh, int *lenp, int need_parent);
278#endif
279#ifdef NFS4_CLUSTER
280  int gpfs_s_fs_locations(struct super_block *, char **);
281#endif
282  void gpfs_s_write_inode(struct inode *);
283  void gpfs_s_clear_inode(struct inode *);
284  void gpfs_s_write_super(struct super_block *);
285#if LINUX_KERNEL_VERSION >= 2050000
286  int gpfs_get_sb(struct file_system_type *fsTypeP,
287                                  int flags, const char *devNameP, void *dataP,
288          struct vfsmount *mnt);
289  int gpfs_fill_super(struct super_block *, void *, int);
290#else
291  struct super_block *gpfs_fill_super(struct super_block *, void *, int);
292#endif
293  int mmfsd_release(struct inode *, struct file *);
294  int exec_mmfs(void *);
295  void kill_mmfsd(void);
296  void gpfs_unreg_fs();
297  int gpfs_reg_fs();
298  int fork_mmfsd();
299  int fork_mount_helper(char *data);
300#ifdef __cplusplus
301}
302#endif
303
304/* Find gpfs info from a linux inode. */
305#define VP_TO_CNP(VP)  ((struct cxiNode_t *)((VP)->PRVINODE))
306#define VP_TO_GNP(VP)  ((gpfsNode_t *)((VP)->PRVINODE))
307#define VP_TO_NFSP(VP) ((VP_TO_CNP((struct inode *)(VP))->nfsP))
308
309#define VP_TO_PVP(VP)  ((struct gpfsVfsData_t *)(SBLOCK_PRIVATE((VP)->i_sb)))
310
311/* block.C */
312#ifdef __cplusplus
313extern "C"
314{
315#endif
316  int gpfs_b_open(struct inode *inode, struct file *file);
317  int gpfs_b_release(struct inode *inode, struct file *file);
318  int gpfs_b_ioctl(struct inode *inode, struct file *file, unsigned p1,
319                   unsigned long p2);
320  int gpfs_block_init();
321  void gpfs_block_clean();
322
323  int gpfs_fb_open(struct inode *inode, struct file *file);
324  int gpfs_fb_release(struct inode *inode, struct file *file);
325  int gpfs_fb_ioctl(struct inode *inode, struct file *file, unsigned p1,
326                    unsigned long p2);
327  ssize_t gpfs_fb_read(struct file *file, char *buf, size_t nbytes, 
328                       loff_t *ppos);
329  ssize_t gpfs_fb_write(struct file *file, const char *buf, size_t nbytes,
330                        loff_t *ppos);
331#ifdef __cplusplus
332}
333#endif
334
335/* dir.C */
336#ifdef __cplusplus
337extern "C"
338{
339#endif
340#if LINUX_KERNEL_VERSION >= 2060000
341  int gpfs_d_invalid(struct dentry *dentry, struct nameidata *);
342  int gpfs_d_revalidate(struct dentry *dentry, struct nameidata *);
343#ifdef CCL
344  int gpfs_d_valid_if_Samba(struct dentry *dentry, struct nameidata *);
345  int gpfs_d_invalid_if_Samba(struct dentry *dentry, struct nameidata *);
346#endif
347#else
348  int gpfs_d_invalid(struct dentry *dentry, int flags);
349  int gpfs_d_revalidate(struct dentry *dentry, int flags);
350#ifdef CCL
351  int gpfs_d_valid_if_Samba(struct dentry *dentry, int flags);
352  int gpfs_d_invalid_if_Samba(struct dentry *dentry, int flags);
353#endif
354#endif
355#ifdef __cplusplus
356}
357#endif
358
359/* gplInit.C */
360#ifdef __cplusplus
361extern "C"
362{
363#endif
364  void reset_gpfs_operations();
365  void gpfs_clean();
366  int  gpfs_init();
367
368
369#ifdef __cplusplus
370}
371#endif
372
373/* gpfs operations tables */
374extern struct gpfs_operations   gpfs_ops;
375extern struct super_operations  gpfs_sops;
376extern struct super_operations  null_sops;
377#if LINUX_KERNEL_VERSION > 2060000
378extern struct export_operations gpfs_export_ops;
379#endif
380
381#define gpfs_dops_valid (*(struct dentry_operations*)0)  /* no ops defined */
382extern struct dentry_operations gpfs_dops_ddeletepending;
383extern struct dentry_operations gpfs_dops_invalid;
384extern struct dentry_operations gpfs_dops_revalidate;
385#ifdef CCL
386extern struct dentry_operations gpfs_dops_valid_if_Samba;
387extern struct dentry_operations gpfs_dops_invalid_if_Samba;
388#endif
389extern struct file_operations gpfs_fops;
390extern struct file_operations gpfs_fops_no_sendfile;
391extern struct file_operations gpfs_dir_fops;
392extern struct file_operations gpfs_cleanup_fops;
393#if LINUX_KERNEL_VERSION < 2050000
394extern struct file_operations gpfs_fbps;
395extern struct block_device_operations gpfs_bops;
396#endif
397extern struct inode_operations  gpfs_iops_stdperm;
398extern struct inode_operations  gpfs_iops_xperm;
399extern struct inode_operations  gpfs_dir_iops_stdperm;
400extern struct inode_operations  gpfs_dir_iops_xperm;
401extern struct inode_operations  gpfs_link_iops;
402extern struct address_space_operations gpfs_aops;
403extern struct address_space_operations gpfs_aops_after_inode_delete;
404extern struct vm_operations_struct gpfs_vmop;
405
406#endif /* _h_linux2gpfs */
Note: See TracBrowser for help on using the repository browser.