Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: LGPL-2.1 */
0002 /*
0003  *
0004  *   Copyright (c) International Business Machines  Corp., 2002, 2007
0005  *   Author(s): Steve French (sfrench@us.ibm.com)
0006  *
0007  */
0008 
0009 #ifndef _CIFSFS_H
0010 #define _CIFSFS_H
0011 
0012 #include <linux/hash.h>
0013 
0014 #define ROOT_I 2
0015 
0016 /*
0017  * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down
0018  * so that it will fit. We use hash_64 to convert the value to 31 bits, and
0019  * then add 1, to ensure that we don't end up with a 0 as the value.
0020  */
0021 static inline ino_t
0022 cifs_uniqueid_to_ino_t(u64 fileid)
0023 {
0024     if ((sizeof(ino_t)) < (sizeof(u64)))
0025         return (ino_t)hash_64(fileid, (sizeof(ino_t) * 8) - 1) + 1;
0026 
0027     return (ino_t)fileid;
0028 
0029 }
0030 
0031 static inline void cifs_set_time(struct dentry *dentry, unsigned long time)
0032 {
0033     dentry->d_fsdata = (void *) time;
0034 }
0035 
0036 static inline unsigned long cifs_get_time(struct dentry *dentry)
0037 {
0038     return (unsigned long) dentry->d_fsdata;
0039 }
0040 
0041 extern struct file_system_type cifs_fs_type, smb3_fs_type;
0042 extern const struct address_space_operations cifs_addr_ops;
0043 extern const struct address_space_operations cifs_addr_ops_smallbuf;
0044 
0045 /* Functions related to super block operations */
0046 extern void cifs_sb_active(struct super_block *sb);
0047 extern void cifs_sb_deactive(struct super_block *sb);
0048 
0049 /* Functions related to inodes */
0050 extern const struct inode_operations cifs_dir_inode_ops;
0051 extern struct inode *cifs_root_iget(struct super_block *);
0052 extern int cifs_create(struct user_namespace *, struct inode *,
0053                struct dentry *, umode_t, bool excl);
0054 extern int cifs_atomic_open(struct inode *, struct dentry *,
0055                 struct file *, unsigned, umode_t);
0056 extern struct dentry *cifs_lookup(struct inode *, struct dentry *,
0057                   unsigned int);
0058 extern int cifs_unlink(struct inode *dir, struct dentry *dentry);
0059 extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
0060 extern int cifs_mknod(struct user_namespace *, struct inode *, struct dentry *,
0061               umode_t, dev_t);
0062 extern int cifs_mkdir(struct user_namespace *, struct inode *, struct dentry *,
0063               umode_t);
0064 extern int cifs_rmdir(struct inode *, struct dentry *);
0065 extern int cifs_rename2(struct user_namespace *, struct inode *,
0066             struct dentry *, struct inode *, struct dentry *,
0067             unsigned int);
0068 extern int cifs_revalidate_file_attr(struct file *filp);
0069 extern int cifs_revalidate_dentry_attr(struct dentry *);
0070 extern int cifs_revalidate_file(struct file *filp);
0071 extern int cifs_revalidate_dentry(struct dentry *);
0072 extern int cifs_invalidate_mapping(struct inode *inode);
0073 extern int cifs_revalidate_mapping(struct inode *inode);
0074 extern int cifs_zap_mapping(struct inode *inode);
0075 extern int cifs_getattr(struct user_namespace *, const struct path *,
0076             struct kstat *, u32, unsigned int);
0077 extern int cifs_setattr(struct user_namespace *, struct dentry *,
0078             struct iattr *);
0079 extern int cifs_fiemap(struct inode *, struct fiemap_extent_info *, u64 start,
0080                u64 len);
0081 
0082 extern const struct inode_operations cifs_file_inode_ops;
0083 extern const struct inode_operations cifs_symlink_inode_ops;
0084 extern const struct inode_operations cifs_dfs_referral_inode_operations;
0085 
0086 
0087 /* Functions related to files and directories */
0088 extern const struct file_operations cifs_file_ops;
0089 extern const struct file_operations cifs_file_direct_ops; /* if directio mnt */
0090 extern const struct file_operations cifs_file_strict_ops; /* if strictio mnt */
0091 extern const struct file_operations cifs_file_nobrl_ops; /* no brlocks */
0092 extern const struct file_operations cifs_file_direct_nobrl_ops;
0093 extern const struct file_operations cifs_file_strict_nobrl_ops;
0094 extern int cifs_open(struct inode *inode, struct file *file);
0095 extern int cifs_close(struct inode *inode, struct file *file);
0096 extern int cifs_closedir(struct inode *inode, struct file *file);
0097 extern ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to);
0098 extern ssize_t cifs_direct_readv(struct kiocb *iocb, struct iov_iter *to);
0099 extern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to);
0100 extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from);
0101 extern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from);
0102 extern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from);
0103 extern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock);
0104 extern int cifs_lock(struct file *, int, struct file_lock *);
0105 extern int cifs_fsync(struct file *, loff_t, loff_t, int);
0106 extern int cifs_strict_fsync(struct file *, loff_t, loff_t, int);
0107 extern int cifs_flush(struct file *, fl_owner_t id);
0108 extern int cifs_file_mmap(struct file * , struct vm_area_struct *);
0109 extern int cifs_file_strict_mmap(struct file * , struct vm_area_struct *);
0110 extern const struct file_operations cifs_dir_ops;
0111 extern int cifs_dir_open(struct inode *inode, struct file *file);
0112 extern int cifs_readdir(struct file *file, struct dir_context *ctx);
0113 
0114 /* Functions related to dir entries */
0115 extern const struct dentry_operations cifs_dentry_ops;
0116 extern const struct dentry_operations cifs_ci_dentry_ops;
0117 
0118 #ifdef CONFIG_CIFS_DFS_UPCALL
0119 extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
0120 #else
0121 #define cifs_dfs_d_automount NULL
0122 #endif
0123 
0124 /* Functions related to symlinks */
0125 extern const char *cifs_get_link(struct dentry *, struct inode *,
0126             struct delayed_call *);
0127 extern int cifs_symlink(struct user_namespace *mnt_userns, struct inode *inode,
0128             struct dentry *direntry, const char *symname);
0129 
0130 #ifdef CONFIG_CIFS_XATTR
0131 extern const struct xattr_handler *cifs_xattr_handlers[];
0132 extern ssize_t  cifs_listxattr(struct dentry *, char *, size_t);
0133 #else
0134 # define cifs_xattr_handlers NULL
0135 # define cifs_listxattr NULL
0136 #endif
0137 
0138 extern ssize_t cifs_file_copychunk_range(unsigned int xid,
0139                     struct file *src_file, loff_t off,
0140                     struct file *dst_file, loff_t destoff,
0141                     size_t len, unsigned int flags);
0142 
0143 extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
0144 extern void cifs_setsize(struct inode *inode, loff_t offset);
0145 extern int cifs_truncate_page(struct address_space *mapping, loff_t from);
0146 
0147 struct smb3_fs_context;
0148 extern struct dentry *cifs_smb3_do_mount(struct file_system_type *fs_type,
0149                      int flags, struct smb3_fs_context *ctx);
0150 
0151 #ifdef CONFIG_CIFS_NFSD_EXPORT
0152 extern const struct export_operations cifs_export_ops;
0153 #endif /* CONFIG_CIFS_NFSD_EXPORT */
0154 
0155 /* when changing internal version - update following two lines at same time */
0156 #define SMB3_PRODUCT_BUILD 39
0157 #define CIFS_VERSION   "2.39"
0158 #endif              /* _CIFSFS_H */