cifsfs.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* SPDX-License-Identifier: LGPL-2.1 */
  2. /*
  3. *
  4. * Copyright (c) International Business Machines Corp., 2002, 2007
  5. * Author(s): Steve French ([email protected])
  6. *
  7. */
  8. #ifndef _CIFSFS_H
  9. #define _CIFSFS_H
  10. #include <linux/hash.h>
  11. #define ROOT_I 2
  12. /*
  13. * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down
  14. * so that it will fit. We use hash_64 to convert the value to 31 bits, and
  15. * then add 1, to ensure that we don't end up with a 0 as the value.
  16. */
  17. static inline ino_t
  18. cifs_uniqueid_to_ino_t(u64 fileid)
  19. {
  20. if ((sizeof(ino_t)) < (sizeof(u64)))
  21. return (ino_t)hash_64(fileid, (sizeof(ino_t) * 8) - 1) + 1;
  22. return (ino_t)fileid;
  23. }
  24. static inline void cifs_set_time(struct dentry *dentry, unsigned long time)
  25. {
  26. dentry->d_fsdata = (void *) time;
  27. }
  28. static inline unsigned long cifs_get_time(struct dentry *dentry)
  29. {
  30. return (unsigned long) dentry->d_fsdata;
  31. }
  32. extern struct file_system_type cifs_fs_type, smb3_fs_type;
  33. extern const struct address_space_operations cifs_addr_ops;
  34. extern const struct address_space_operations cifs_addr_ops_smallbuf;
  35. /* Functions related to super block operations */
  36. extern void cifs_sb_active(struct super_block *sb);
  37. extern void cifs_sb_deactive(struct super_block *sb);
  38. /* Functions related to inodes */
  39. extern const struct inode_operations cifs_dir_inode_ops;
  40. extern struct inode *cifs_root_iget(struct super_block *);
  41. extern int cifs_create(struct user_namespace *, struct inode *,
  42. struct dentry *, umode_t, bool excl);
  43. extern int cifs_atomic_open(struct inode *, struct dentry *,
  44. struct file *, unsigned, umode_t);
  45. extern struct dentry *cifs_lookup(struct inode *, struct dentry *,
  46. unsigned int);
  47. extern int cifs_unlink(struct inode *dir, struct dentry *dentry);
  48. extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
  49. extern int cifs_mknod(struct user_namespace *, struct inode *, struct dentry *,
  50. umode_t, dev_t);
  51. extern int cifs_mkdir(struct user_namespace *, struct inode *, struct dentry *,
  52. umode_t);
  53. extern int cifs_rmdir(struct inode *, struct dentry *);
  54. extern int cifs_rename2(struct user_namespace *, struct inode *,
  55. struct dentry *, struct inode *, struct dentry *,
  56. unsigned int);
  57. extern int cifs_revalidate_file_attr(struct file *filp);
  58. extern int cifs_revalidate_dentry_attr(struct dentry *);
  59. extern int cifs_revalidate_file(struct file *filp);
  60. extern int cifs_revalidate_dentry(struct dentry *);
  61. extern int cifs_invalidate_mapping(struct inode *inode);
  62. extern int cifs_revalidate_mapping(struct inode *inode);
  63. extern int cifs_zap_mapping(struct inode *inode);
  64. extern int cifs_getattr(struct user_namespace *, const struct path *,
  65. struct kstat *, u32, unsigned int);
  66. extern int cifs_setattr(struct user_namespace *, struct dentry *,
  67. struct iattr *);
  68. extern int cifs_fiemap(struct inode *, struct fiemap_extent_info *, u64 start,
  69. u64 len);
  70. extern const struct inode_operations cifs_file_inode_ops;
  71. extern const struct inode_operations cifs_symlink_inode_ops;
  72. extern const struct inode_operations cifs_dfs_referral_inode_operations;
  73. /* Functions related to files and directories */
  74. extern const struct file_operations cifs_file_ops;
  75. extern const struct file_operations cifs_file_direct_ops; /* if directio mnt */
  76. extern const struct file_operations cifs_file_strict_ops; /* if strictio mnt */
  77. extern const struct file_operations cifs_file_nobrl_ops; /* no brlocks */
  78. extern const struct file_operations cifs_file_direct_nobrl_ops;
  79. extern const struct file_operations cifs_file_strict_nobrl_ops;
  80. extern int cifs_open(struct inode *inode, struct file *file);
  81. extern int cifs_close(struct inode *inode, struct file *file);
  82. extern int cifs_closedir(struct inode *inode, struct file *file);
  83. extern ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to);
  84. extern ssize_t cifs_direct_readv(struct kiocb *iocb, struct iov_iter *to);
  85. extern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to);
  86. extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from);
  87. extern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from);
  88. extern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from);
  89. extern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock);
  90. extern int cifs_lock(struct file *, int, struct file_lock *);
  91. extern int cifs_fsync(struct file *, loff_t, loff_t, int);
  92. extern int cifs_strict_fsync(struct file *, loff_t, loff_t, int);
  93. extern int cifs_flush(struct file *, fl_owner_t id);
  94. extern int cifs_file_mmap(struct file *file, struct vm_area_struct *vma);
  95. extern int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma);
  96. extern const struct file_operations cifs_dir_ops;
  97. extern int cifs_dir_open(struct inode *inode, struct file *file);
  98. extern int cifs_readdir(struct file *file, struct dir_context *ctx);
  99. /* Functions related to dir entries */
  100. extern const struct dentry_operations cifs_dentry_ops;
  101. extern const struct dentry_operations cifs_ci_dentry_ops;
  102. #ifdef CONFIG_CIFS_DFS_UPCALL
  103. extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
  104. #else
  105. static inline struct vfsmount *cifs_dfs_d_automount(struct path *path)
  106. {
  107. return ERR_PTR(-EREMOTE);
  108. }
  109. #endif
  110. /* Functions related to symlinks */
  111. extern const char *cifs_get_link(struct dentry *, struct inode *,
  112. struct delayed_call *);
  113. extern int cifs_symlink(struct user_namespace *mnt_userns, struct inode *inode,
  114. struct dentry *direntry, const char *symname);
  115. #ifdef CONFIG_CIFS_XATTR
  116. extern const struct xattr_handler *cifs_xattr_handlers[];
  117. extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
  118. #else
  119. # define cifs_xattr_handlers NULL
  120. # define cifs_listxattr NULL
  121. #endif
  122. extern ssize_t cifs_file_copychunk_range(unsigned int xid,
  123. struct file *src_file, loff_t off,
  124. struct file *dst_file, loff_t destoff,
  125. size_t len, unsigned int flags);
  126. extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
  127. extern void cifs_setsize(struct inode *inode, loff_t offset);
  128. extern int cifs_truncate_page(struct address_space *mapping, loff_t from);
  129. struct smb3_fs_context;
  130. extern struct dentry *cifs_smb3_do_mount(struct file_system_type *fs_type,
  131. int flags, struct smb3_fs_context *ctx);
  132. #ifdef CONFIG_CIFS_NFSD_EXPORT
  133. extern const struct export_operations cifs_export_ops;
  134. #endif /* CONFIG_CIFS_NFSD_EXPORT */
  135. /* when changing internal version - update following two lines at same time */
  136. #define SMB3_PRODUCT_BUILD 40
  137. #define CIFS_VERSION "2.40"
  138. #endif /* _CIFSFS_H */