| 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 |
|
| 9 |
#ifndef _CIFSFS_H |
| 10 |
#define _CIFSFS_H |
| 11 |
|
| 12 |
#include <linux/hash.h> |
| 13 |
|
| 14 |
#define ROOT_I 2 |
| 15 |
|
| 16 |
/* |
| 17 |
* ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down |
| 18 |
* so that it will fit. We use hash_64 to convert the value to 31 bits, and |
| 19 |
* then add 1, to ensure that we don't end up with a 0 as the value. |
| 20 |
*/ |
| 21 |
static inline ino_t |
| 22 |
cifs_uniqueid_to_ino_t(u64 fileid) |
| 23 |
{ |
| 24 |
if ((sizeof(ino_t)) < (sizeof(u64))) |
| 25 |
return (ino_t)hash_64(fileid, (sizeof(ino_t) * 8) - 1) + 1; |
| 26 |
|
| 27 |
return (ino_t)fileid; |
| 28 |
|
| 29 |
} |
| 30 |
|
| 31 |
static inline void cifs_set_time(struct dentry *dentry, unsigned long time) |
| 32 |
{ |
| 33 |
dentry->d_fsdata = (void *) time; |
| 34 |
} |
| 35 |
|
| 36 |
static inline unsigned long cifs_get_time(struct dentry *dentry) |
| 37 |
{ |
| 38 |
return (unsigned long) dentry->d_fsdata; |
| 39 |
} |
| 40 |
|
| 41 |
extern struct file_system_type cifs_fs_type, smb3_fs_type; |
| 42 |
extern const struct address_space_operations cifs_addr_ops; |
| 43 |
extern const struct address_space_operations cifs_addr_ops_smallbuf; |
| 44 |
|
| 45 |
/* Functions related to super block operations */ |
| 46 |
void cifs_sb_active(struct super_block *sb); |
| 47 |
void cifs_sb_deactive(struct super_block *sb); |
| 48 |
|
| 49 |
/* Functions related to inodes */ |
| 50 |
extern const struct inode_operations cifs_dir_inode_ops; |
| 51 |
struct inode *cifs_root_iget(struct super_block *sb); |
| 52 |
int cifs_create(struct mnt_idmap *idmap, struct inode *inode, |
| 53 |
struct dentry *direntry, umode_t mode, bool excl); |
| 54 |
int cifs_atomic_open(struct inode *inode, struct dentry *direntry, |
| 55 |
struct file *file, unsigned int oflags, umode_t mode); |
| 56 |
struct dentry *cifs_lookup(struct inode *parent_dir_inode, |
| 57 |
struct dentry *direntry, unsigned int flags); |
| 58 |
int cifs_unlink(struct inode *dir, struct dentry *dentry); |
| 59 |
int cifs_hardlink(struct dentry *old_file, struct inode *inode, |
| 60 |
struct dentry *direntry); |
| 61 |
int cifs_mknod(struct mnt_idmap *idmap, struct inode *inode, |
| 62 |
struct dentry *direntry, umode_t mode, dev_t device_number); |
| 63 |
struct dentry *cifs_mkdir(struct mnt_idmap *idmap, struct inode *inode, |
| 64 |
struct dentry *direntry, umode_t mode); |
| 65 |
int cifs_rmdir(struct inode *inode, struct dentry *direntry); |
| 66 |
int cifs_rename2(struct mnt_idmap *idmap, struct inode *source_dir, |
| 67 |
struct dentry *source_dentry, struct inode *target_dir, |
| 68 |
struct dentry *target_dentry, unsigned int flags); |
| 69 |
int cifs_revalidate_file_attr(struct file *filp); |
| 70 |
int cifs_revalidate_dentry_attr(struct dentry *dentry); |
| 71 |
int cifs_revalidate_file(struct file *filp); |
| 72 |
int cifs_revalidate_dentry(struct dentry *dentry); |
| 73 |
int cifs_revalidate_mapping(struct inode *inode); |
| 74 |
int cifs_zap_mapping(struct inode *inode); |
| 75 |
int cifs_getattr(struct mnt_idmap *idmap, const struct path *path, |
| 76 |
struct kstat *stat, u32 request_mask, unsigned int flags); |
| 77 |
int cifs_setattr(struct mnt_idmap *idmap, struct dentry *direntry, |
| 78 |
struct iattr *attrs); |
| 79 |
int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start, |
| 80 |
u64 len); |
| 81 |
|
| 82 |
extern const struct inode_operations cifs_file_inode_ops; |
| 83 |
extern const struct inode_operations cifs_symlink_inode_ops; |
| 84 |
extern const struct inode_operations cifs_namespace_inode_operations; |
| 85 |
|
| 86 |
|
| 87 |
/* Functions related to files and directories */ |
| 88 |
extern const struct netfs_request_ops cifs_req_ops; |
| 89 |
extern const struct file_operations cifs_file_ops; |
| 90 |
extern const struct file_operations cifs_file_direct_ops; /* if directio mnt */ |
| 91 |
extern const struct file_operations cifs_file_strict_ops; /* if strictio mnt */ |
| 92 |
extern const struct file_operations cifs_file_nobrl_ops; /* no brlocks */ |
| 93 |
extern const struct file_operations cifs_file_direct_nobrl_ops; |
| 94 |
extern const struct file_operations cifs_file_strict_nobrl_ops; |
| 95 |
int cifs_open(struct inode *inode, struct file *file); |
| 96 |
int cifs_close(struct inode *inode, struct file *file); |
| 97 |
int cifs_closedir(struct inode *inode, struct file *file); |
| 98 |
ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to); |
| 99 |
ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from); |
| 100 |
ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from); |
| 101 |
ssize_t cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter); |
| 102 |
int cifs_flock(struct file *file, int cmd, struct file_lock *fl); |
| 103 |
int cifs_lock(struct file *file, int cmd, struct file_lock *flock); |
| 104 |
int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync); |
| 105 |
int cifs_strict_fsync(struct file *file, loff_t start, loff_t end, |
| 106 |
int datasync); |
| 107 |
int cifs_flush(struct file *file, fl_owner_t id); |
| 108 |
int cifs_file_mmap_prepare(struct vm_area_desc *desc); |
| 109 |
int cifs_file_strict_mmap_prepare(struct vm_area_desc *desc); |
| 110 |
extern const struct file_operations cifs_dir_ops; |
| 111 |
int cifs_readdir(struct file *file, struct dir_context *ctx); |
| 112 |
|
| 113 |
/* Functions related to dir entries */ |
| 114 |
extern const struct dentry_operations cifs_dentry_ops; |
| 115 |
extern const struct dentry_operations cifs_ci_dentry_ops; |
| 116 |
|
| 117 |
struct vfsmount *cifs_d_automount(struct path *path); |
| 118 |
|
| 119 |
/* Functions related to symlinks */ |
| 120 |
const char *cifs_get_link(struct dentry *dentry, struct inode *inode, |
| 121 |
struct delayed_call *done); |
| 122 |
int cifs_symlink(struct mnt_idmap *idmap, struct inode *inode, |
| 123 |
struct dentry *direntry, const char *symname); |
| 124 |
|
| 125 |
#ifdef CONFIG_CIFS_XATTR |
| 126 |
extern const struct xattr_handler * const cifs_xattr_handlers[]; |
| 127 |
ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size); |
| 128 |
#else |
| 129 |
# define cifs_xattr_handlers NULL |
| 130 |
# define cifs_listxattr NULL |
| 131 |
#endif |
| 132 |
|
| 133 |
ssize_t cifs_file_copychunk_range(unsigned int xid, struct file *src_file, |
| 134 |
loff_t off, struct file *dst_file, |
| 135 |
loff_t destoff, size_t len, |
| 136 |
unsigned int flags); |
| 137 |
|
| 138 |
long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg); |
| 139 |
void cifs_setsize(struct inode *inode, loff_t offset); |
| 140 |
|
| 141 |
struct smb3_fs_context; |
| 142 |
struct dentry *cifs_smb3_do_mount(struct file_system_type *fs_type, int flags, |
| 143 |
struct smb3_fs_context *old_ctx); |
| 144 |
|
| 145 |
#ifdef CONFIG_CIFS_NFSD_EXPORT |
| 146 |
extern const struct export_operations cifs_export_ops; |
| 147 |
#endif /* CONFIG_CIFS_NFSD_EXPORT */ |
| 148 |
|
| 149 |
/* when changing internal version - update following two lines at same time */ |
| 150 |
#define SMB3_PRODUCT_BUILD 59 |
| 151 |
#define CIFS_VERSION "2.59" |
| 152 |
#endif /* _CIFSFS_H */ |