/*************************************************************************** * * Copyright (C) 2001 International Business Machines * All rights reserved. * * This file is part of the GPFS mmfslinux kernel module. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *************************************************************************** */ /* @(#)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 */ #ifndef _h_linux2gpfs #define _h_linux2gpfs #include #include #ifdef __cplusplus #include #endif #include #include #ifdef __cplusplus #include #endif #include #include #ifdef NTRACE #define PRINTINODE(i) ((void)0) #define PRINTDENTRY(d) ((void)0) #define PRINTSBLOCK(s) ((void)0) #define PRINTFILE(f) ((void)0) #else #define PRINTINODE(i) printInode(i) #define PRINTDENTRY(d) printDentry(d) #define PRINTSBLOCK(s) printSblock(s) #define PRINTFILE(f) printFile(f) #endif /* check if inode belongs to GPFS */ #define GPFS_TYPE(IP) (!(iP) ? false : \ (!(iP->i_sb) ? false : \ (!(iP->i_sb->s_type) ? false : \ !strcmp(iP->i_sb->s_type->name, "gpfs")))) /* forward declarations */ struct ext_cred_t; struct dentry; struct super_block; struct file; struct nameidata; struct page; struct iattr; struct inode; struct vm_area_struct; #ifdef P_NFS4 typedef struct { u32 state[4]; } stateid_t; typedef struct { u32 cl_boot; u32 cl_id; } clientid_t; #endif /* inode.C */ #ifdef __cplusplus extern "C" { #endif void setCred(struct ext_cred_t *); #if LINUX_KERNEL_VERSION >= 2060000 int gpfs_i_create(struct inode *, struct dentry *, int, struct nameidata *); struct dentry *gpfs_i_lookup(struct inode *, struct dentry *, struct nameidata *); #else int gpfs_i_create(struct inode *, struct dentry *, int); struct dentry *gpfs_i_lookup(struct inode *, struct dentry *); #endif int gpfs_i_link(struct dentry *, struct inode *, struct dentry *); int gpfs_i_unlink(struct inode *, struct dentry *); int gpfs_i_symlink(struct inode *, struct dentry *, const char *); int gpfs_i_mkdir(struct inode *, struct dentry *, int); int gpfs_i_rmdir(struct inode *, struct dentry *); #if LINUX_KERNEL_VERSION >= 2050000 int gpfs_i_mknod(struct inode *, struct dentry *, int, dev_t); #else int gpfs_i_mknod(struct inode *, struct dentry *, int, int); #endif int gpfs_i_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); int gpfs_i_readlink(struct dentry *, char *, int); #if LINUX_KERNEL_VERSION >= 2061600 void* gpfs_i_follow_link(struct dentry *dentry, struct nameidata *nd); #else int gpfs_i_follow_link(struct dentry *dentry, struct nameidata *nd); #endif int gpfs_i_readpage(struct file *, struct page *); #if LINUX_KERNEL_VERSION >= 2050000 int gpfs_i_writepage(struct page *pageP, struct writeback_control *wbcP); #else int gpfs_i_writepage(struct page *pageP); #endif int gpfs_i_bmap(struct inode *, int); void gpfs_i_truncate(struct inode *); #if LINUX_KERNEL_VERSION >= 2060000 int gpfs_i_permission(struct inode *, int, struct nameidata *); #else int gpfs_i_permission(struct inode *, int); #endif int gpfs_i_smap(struct inode *, int); int gpfs_i_updatepage(struct file *, struct page *, const char *, unsigned long, uint, int); int gpfs_i_revalidate(struct dentry *); int gpfs_i_setattr(struct dentry *, struct iattr *); #if LINUX_KERNEL_VERSION >= 2050000 int gpfs_i_getattr(struct vfsmount *mnt, struct dentry *, struct kstat *); #else int gpfs_i_getattr(struct dentry *, struct iattr *); #endif #if LINUX_KERNEL_VERSION > 2060000 int gpfs_i_setxattr(struct dentry *, const char *, const void *, size_t, int); ssize_t gpfs_i_getxattr(struct dentry *, const char *, void *, size_t); ssize_t gpfs_i_listxattr(struct dentry *, char *, size_t); int gpfs_i_removexattr(struct dentry *, const char *); int gpfs_set_posix_acl(struct dentry *, int, const void *, size_t); int gpfs_get_posix_acl(struct dentry *, int, const void *, size_t); #endif int gpfs_i_getattr_internal(struct inode *iP); int gpfs_i_setattr_internal(struct inode *iP, struct iattr *aP); void printInode(struct inode *); void printDentry(struct dentry *); void printDentryTree(struct dentry *, int maxPrint); void setIopTable(struct inode *iP, Boolean xperm); void printSuper(struct super_block *sbP); void printSuperList(struct super_block *sbP); #ifdef HAS_IOP_PUT_LINK #if LINUX_KERNEL_VERSION >= 2061600 void gpfs_i_put_link(struct dentry *dentry, struct nameidata *nd, void* cookie); #else void gpfs_i_put_link(struct dentry *dentry, struct nameidata *nd); #endif #endif #ifdef __cplusplus } #endif /* file.C */ #ifdef __cplusplus extern "C" { #endif loff_t gpfs_f_llseek(struct file *, loff_t, int); ssize_t gpfs_f_read(struct file *, char *, size_t, loff_t *); ssize_t gpfs_f_dir_read(struct file *, char *, size_t, loff_t *); ssize_t gpfs_f_write(struct file *, const char *, size_t, loff_t *); int gpfs_f_readdir(struct file *, void *, filldir_t); uint gpfs_f_poll(struct file *, struct poll_table_struct *); int gpfs_f_ioctl(struct inode *, struct file *, uint, unsigned long); int gpfs_f_mmap(struct file *, struct vm_area_struct *); int gpfs_f_open(struct inode *, struct file *); int gpfs_f_release(struct inode *, struct file *); int gpfs_f_fsync(struct file *, struct dentry *, int datasync); int gpfs_f_fasync(int, struct file *, int); int gpfs_f_lock(struct file *, int, struct file_lock *); int gpfs_f_flock(struct file *, int, struct file_lock *); ssize_t gpfs_f_readv(struct kiocb *, const struct iovec *, unsigned long, loff_t ); ssize_t gpfs_f_writev(struct kiocb *, const struct iovec *, unsigned long, loff_t ); int gpfs_f_cleanup(struct inode *iP, struct file *fP); #if LINUX_KERNEL_VERSION > 2060300 struct page *gpfs_filemap_nopage(struct vm_area_struct * area, unsigned long address, int *no_share); #else struct page *gpfs_filemap_nopage(struct vm_area_struct * area, unsigned long address, int no_share); #endif void gpfs_filemap_close(struct vm_area_struct * area); void gpfs_filemap_open(struct vm_area_struct * area); #ifdef NFS4_CLUSTER int gpfs_f_share(struct file *, unsigned int, unsigned int); #endif /* NFS4_CLUSTER */ #if LINUX_KERNEL_VERSION >= 2060000 ssize_t gpfs_f_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iovecP, loff_t offset, unsigned long count); #elif defined(SUSE_LINUX) int gpfs_f_direct_IO(int rw, struct file *file, struct kiobuf *kiobuf, unsigned long in_offset, int count); #endif #ifdef P_NFS4 int gpfs_layout_get(struct inode *inode, void *p); int gpfs_get_devicelist(struct super_block *sbP, void *p); int gpfs_get_deviceinfo(struct super_block *sb, void *p); int gpfs_layout_return(struct inode *inode, void *p); int gpfs_get_state(struct inode *inode, void *fh, void *p); void gpfs_get_verifier(struct super_block *sb, u32 *p); #endif #ifdef __cplusplus } #endif /* super.C */ #ifdef __cplusplus extern "C" { #endif #ifdef VERBOSETRACE void TraceBKL(); #else #define TraceBKL() ((void)0) #endif void gpfs_s_read_inode(struct inode *); void gpfs_s_read_inode2(struct inode *, void *); void gpfs_s_delete_inode(struct inode *); int gpfs_s_notify_change(struct dentry *, struct iattr *); void gpfs_s_put_super(struct super_block *); #if LINUX_KERNEL_VERSION >= 2060000 int gpfs_s_statfs(struct dentry *, struct kstatfs *); void gpfs_destory_inodecache(void); int gpfs_init_inodecache(void); struct inode *gpfs_alloc_inode(struct super_block *); void gpfs_destroy_inode(struct inode *); #else int gpfs_s_statfs(struct super_block *, struct statfs *); #endif #if LINUX_KERNEL_VERSION >= 2061700 void gpfs_s_umount_begin(struct vfsmount *, int); #else void gpfs_s_umount_begin(struct super_block *); #endif int gpfs_s_remount(struct super_block *, int *, char *); #if LINUX_KERNEL_VERSION > 2060000 struct dentry *gpfs_decode_fh(struct super_block *sbP, __u32 *fh, int len, int fhtype, int (*acceptable)(void *context, struct dentry *dentry), void *context); int gpfs_encode_fh(struct dentry *dentry, __u32 *fh, int *lenp, int need_parent); struct dentry *gpfs_get_dentry(struct super_block *sb, void *data); struct dentry *gpfs_get_dparent(struct dentry * dentry); #else struct dentry *gpfs_fh_to_dentry(struct super_block *sbP, __u32 *fh, int len, int fhtype, int parent); int gpfs_dentry_to_fh(struct dentry *, __u32 *fh, int *lenp, int need_parent); #endif #ifdef NFS4_CLUSTER int gpfs_s_fs_locations(struct super_block *, char **); #endif void gpfs_s_write_inode(struct inode *); void gpfs_s_clear_inode(struct inode *); void gpfs_s_write_super(struct super_block *); #if LINUX_KERNEL_VERSION >= 2050000 int gpfs_get_sb(struct file_system_type *fsTypeP, int flags, const char *devNameP, void *dataP, struct vfsmount *mnt); int gpfs_fill_super(struct super_block *, void *, int); #else struct super_block *gpfs_fill_super(struct super_block *, void *, int); #endif int mmfsd_release(struct inode *, struct file *); int exec_mmfs(void *); void kill_mmfsd(void); void gpfs_unreg_fs(); int gpfs_reg_fs(); int fork_mmfsd(); int fork_mount_helper(char *data); #ifdef __cplusplus } #endif /* Find gpfs info from a linux inode. */ #define VP_TO_CNP(VP) ((struct cxiNode_t *)((VP)->PRVINODE)) #define VP_TO_GNP(VP) ((gpfsNode_t *)((VP)->PRVINODE)) #define VP_TO_NFSP(VP) ((VP_TO_CNP((struct inode *)(VP))->nfsP)) #define VP_TO_PVP(VP) ((struct gpfsVfsData_t *)(SBLOCK_PRIVATE((VP)->i_sb))) /* block.C */ #ifdef __cplusplus extern "C" { #endif int gpfs_b_open(struct inode *inode, struct file *file); int gpfs_b_release(struct inode *inode, struct file *file); int gpfs_b_ioctl(struct inode *inode, struct file *file, unsigned p1, unsigned long p2); int gpfs_block_init(); void gpfs_block_clean(); int gpfs_fb_open(struct inode *inode, struct file *file); int gpfs_fb_release(struct inode *inode, struct file *file); int gpfs_fb_ioctl(struct inode *inode, struct file *file, unsigned p1, unsigned long p2); ssize_t gpfs_fb_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos); ssize_t gpfs_fb_write(struct file *file, const char *buf, size_t nbytes, loff_t *ppos); #ifdef __cplusplus } #endif /* dir.C */ #ifdef __cplusplus extern "C" { #endif #if LINUX_KERNEL_VERSION >= 2060000 int gpfs_d_invalid(struct dentry *dentry, struct nameidata *); int gpfs_d_revalidate(struct dentry *dentry, struct nameidata *); #ifdef CCL int gpfs_d_valid_if_Samba(struct dentry *dentry, struct nameidata *); int gpfs_d_invalid_if_Samba(struct dentry *dentry, struct nameidata *); #endif #else int gpfs_d_invalid(struct dentry *dentry, int flags); int gpfs_d_revalidate(struct dentry *dentry, int flags); #ifdef CCL int gpfs_d_valid_if_Samba(struct dentry *dentry, int flags); int gpfs_d_invalid_if_Samba(struct dentry *dentry, int flags); #endif #endif #ifdef __cplusplus } #endif /* gplInit.C */ #ifdef __cplusplus extern "C" { #endif void reset_gpfs_operations(); void gpfs_clean(); int gpfs_init(); #ifdef __cplusplus } #endif /* gpfs operations tables */ extern struct gpfs_operations gpfs_ops; extern struct super_operations gpfs_sops; extern struct super_operations null_sops; #if LINUX_KERNEL_VERSION > 2060000 extern struct export_operations gpfs_export_ops; #endif #define gpfs_dops_valid (*(struct dentry_operations*)0) /* no ops defined */ extern struct dentry_operations gpfs_dops_ddeletepending; extern struct dentry_operations gpfs_dops_invalid; extern struct dentry_operations gpfs_dops_revalidate; #ifdef CCL extern struct dentry_operations gpfs_dops_valid_if_Samba; extern struct dentry_operations gpfs_dops_invalid_if_Samba; #endif extern struct file_operations gpfs_fops; extern struct file_operations gpfs_fops_no_sendfile; extern struct file_operations gpfs_dir_fops; extern struct file_operations gpfs_cleanup_fops; #if LINUX_KERNEL_VERSION < 2050000 extern struct file_operations gpfs_fbps; extern struct block_device_operations gpfs_bops; #endif extern struct inode_operations gpfs_iops_stdperm; extern struct inode_operations gpfs_iops_xperm; extern struct inode_operations gpfs_dir_iops_stdperm; extern struct inode_operations gpfs_dir_iops_xperm; extern struct inode_operations gpfs_link_iops; extern struct address_space_operations gpfs_aops; extern struct address_space_operations gpfs_aops_after_inode_delete; extern struct vm_operations_struct gpfs_vmop; #endif /* _h_linux2gpfs */