162306a36Sopenharmony_ci/* SPDX-License-Identifier: LGPL-2.1 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright (c) International Business Machines Corp., 2002, 2007 562306a36Sopenharmony_ci * Author(s): Steve French (sfrench@us.ibm.com) 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef _CIFSFS_H 1062306a36Sopenharmony_ci#define _CIFSFS_H 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <linux/hash.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#define ROOT_I 2 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* 1762306a36Sopenharmony_ci * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down 1862306a36Sopenharmony_ci * so that it will fit. We use hash_64 to convert the value to 31 bits, and 1962306a36Sopenharmony_ci * then add 1, to ensure that we don't end up with a 0 as the value. 2062306a36Sopenharmony_ci */ 2162306a36Sopenharmony_cistatic inline ino_t 2262306a36Sopenharmony_cicifs_uniqueid_to_ino_t(u64 fileid) 2362306a36Sopenharmony_ci{ 2462306a36Sopenharmony_ci if ((sizeof(ino_t)) < (sizeof(u64))) 2562306a36Sopenharmony_ci return (ino_t)hash_64(fileid, (sizeof(ino_t) * 8) - 1) + 1; 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci return (ino_t)fileid; 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci} 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_cistatic inline void cifs_set_time(struct dentry *dentry, unsigned long time) 3262306a36Sopenharmony_ci{ 3362306a36Sopenharmony_ci dentry->d_fsdata = (void *) time; 3462306a36Sopenharmony_ci} 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_cistatic inline unsigned long cifs_get_time(struct dentry *dentry) 3762306a36Sopenharmony_ci{ 3862306a36Sopenharmony_ci return (unsigned long) dentry->d_fsdata; 3962306a36Sopenharmony_ci} 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ciextern struct file_system_type cifs_fs_type, smb3_fs_type; 4262306a36Sopenharmony_ciextern const struct address_space_operations cifs_addr_ops; 4362306a36Sopenharmony_ciextern const struct address_space_operations cifs_addr_ops_smallbuf; 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci/* Functions related to super block operations */ 4662306a36Sopenharmony_ciextern void cifs_sb_active(struct super_block *sb); 4762306a36Sopenharmony_ciextern void cifs_sb_deactive(struct super_block *sb); 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci/* Functions related to inodes */ 5062306a36Sopenharmony_ciextern const struct inode_operations cifs_dir_inode_ops; 5162306a36Sopenharmony_ciextern struct inode *cifs_root_iget(struct super_block *); 5262306a36Sopenharmony_ciextern int cifs_create(struct mnt_idmap *, struct inode *, 5362306a36Sopenharmony_ci struct dentry *, umode_t, bool excl); 5462306a36Sopenharmony_ciextern int cifs_atomic_open(struct inode *, struct dentry *, 5562306a36Sopenharmony_ci struct file *, unsigned, umode_t); 5662306a36Sopenharmony_ciextern struct dentry *cifs_lookup(struct inode *, struct dentry *, 5762306a36Sopenharmony_ci unsigned int); 5862306a36Sopenharmony_ciextern int cifs_unlink(struct inode *dir, struct dentry *dentry); 5962306a36Sopenharmony_ciextern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *); 6062306a36Sopenharmony_ciextern int cifs_mknod(struct mnt_idmap *, struct inode *, struct dentry *, 6162306a36Sopenharmony_ci umode_t, dev_t); 6262306a36Sopenharmony_ciextern int cifs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *, 6362306a36Sopenharmony_ci umode_t); 6462306a36Sopenharmony_ciextern int cifs_rmdir(struct inode *, struct dentry *); 6562306a36Sopenharmony_ciextern int cifs_rename2(struct mnt_idmap *, struct inode *, 6662306a36Sopenharmony_ci struct dentry *, struct inode *, struct dentry *, 6762306a36Sopenharmony_ci unsigned int); 6862306a36Sopenharmony_ciextern int cifs_revalidate_file_attr(struct file *filp); 6962306a36Sopenharmony_ciextern int cifs_revalidate_dentry_attr(struct dentry *); 7062306a36Sopenharmony_ciextern int cifs_revalidate_file(struct file *filp); 7162306a36Sopenharmony_ciextern int cifs_revalidate_dentry(struct dentry *); 7262306a36Sopenharmony_ciextern int cifs_invalidate_mapping(struct inode *inode); 7362306a36Sopenharmony_ciextern int cifs_revalidate_mapping(struct inode *inode); 7462306a36Sopenharmony_ciextern int cifs_zap_mapping(struct inode *inode); 7562306a36Sopenharmony_ciextern int cifs_getattr(struct mnt_idmap *, const struct path *, 7662306a36Sopenharmony_ci struct kstat *, u32, unsigned int); 7762306a36Sopenharmony_ciextern int cifs_setattr(struct mnt_idmap *, struct dentry *, 7862306a36Sopenharmony_ci struct iattr *); 7962306a36Sopenharmony_ciextern int cifs_fiemap(struct inode *, struct fiemap_extent_info *, u64 start, 8062306a36Sopenharmony_ci u64 len); 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ciextern const struct inode_operations cifs_file_inode_ops; 8362306a36Sopenharmony_ciextern const struct inode_operations cifs_symlink_inode_ops; 8462306a36Sopenharmony_ciextern const struct inode_operations cifs_namespace_inode_operations; 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci/* Functions related to files and directories */ 8862306a36Sopenharmony_ciextern const struct file_operations cifs_file_ops; 8962306a36Sopenharmony_ciextern const struct file_operations cifs_file_direct_ops; /* if directio mnt */ 9062306a36Sopenharmony_ciextern const struct file_operations cifs_file_strict_ops; /* if strictio mnt */ 9162306a36Sopenharmony_ciextern const struct file_operations cifs_file_nobrl_ops; /* no brlocks */ 9262306a36Sopenharmony_ciextern const struct file_operations cifs_file_direct_nobrl_ops; 9362306a36Sopenharmony_ciextern const struct file_operations cifs_file_strict_nobrl_ops; 9462306a36Sopenharmony_ciextern int cifs_open(struct inode *inode, struct file *file); 9562306a36Sopenharmony_ciextern int cifs_close(struct inode *inode, struct file *file); 9662306a36Sopenharmony_ciextern int cifs_closedir(struct inode *inode, struct file *file); 9762306a36Sopenharmony_ciextern ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to); 9862306a36Sopenharmony_ciextern ssize_t cifs_direct_readv(struct kiocb *iocb, struct iov_iter *to); 9962306a36Sopenharmony_ciextern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to); 10062306a36Sopenharmony_ciextern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from); 10162306a36Sopenharmony_ciextern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from); 10262306a36Sopenharmony_ciextern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from); 10362306a36Sopenharmony_ciextern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock); 10462306a36Sopenharmony_ciextern int cifs_lock(struct file *, int, struct file_lock *); 10562306a36Sopenharmony_ciextern int cifs_fsync(struct file *, loff_t, loff_t, int); 10662306a36Sopenharmony_ciextern int cifs_strict_fsync(struct file *, loff_t, loff_t, int); 10762306a36Sopenharmony_ciextern int cifs_flush(struct file *, fl_owner_t id); 10862306a36Sopenharmony_ciextern int cifs_file_mmap(struct file *file, struct vm_area_struct *vma); 10962306a36Sopenharmony_ciextern int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma); 11062306a36Sopenharmony_ciextern const struct file_operations cifs_dir_ops; 11162306a36Sopenharmony_ciextern int cifs_dir_open(struct inode *inode, struct file *file); 11262306a36Sopenharmony_ciextern int cifs_readdir(struct file *file, struct dir_context *ctx); 11362306a36Sopenharmony_ciextern void cifs_pages_written_back(struct inode *inode, loff_t start, unsigned int len); 11462306a36Sopenharmony_ciextern void cifs_pages_write_failed(struct inode *inode, loff_t start, unsigned int len); 11562306a36Sopenharmony_ciextern void cifs_pages_write_redirty(struct inode *inode, loff_t start, unsigned int len); 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci/* Functions related to dir entries */ 11862306a36Sopenharmony_ciextern const struct dentry_operations cifs_dentry_ops; 11962306a36Sopenharmony_ciextern const struct dentry_operations cifs_ci_dentry_ops; 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ciextern struct vfsmount *cifs_d_automount(struct path *path); 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci/* Functions related to symlinks */ 12462306a36Sopenharmony_ciextern const char *cifs_get_link(struct dentry *, struct inode *, 12562306a36Sopenharmony_ci struct delayed_call *); 12662306a36Sopenharmony_ciextern int cifs_symlink(struct mnt_idmap *idmap, struct inode *inode, 12762306a36Sopenharmony_ci struct dentry *direntry, const char *symname); 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci#ifdef CONFIG_CIFS_XATTR 13062306a36Sopenharmony_ciextern const struct xattr_handler *cifs_xattr_handlers[]; 13162306a36Sopenharmony_ciextern ssize_t cifs_listxattr(struct dentry *, char *, size_t); 13262306a36Sopenharmony_ci#else 13362306a36Sopenharmony_ci# define cifs_xattr_handlers NULL 13462306a36Sopenharmony_ci# define cifs_listxattr NULL 13562306a36Sopenharmony_ci#endif 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ciextern ssize_t cifs_file_copychunk_range(unsigned int xid, 13862306a36Sopenharmony_ci struct file *src_file, loff_t off, 13962306a36Sopenharmony_ci struct file *dst_file, loff_t destoff, 14062306a36Sopenharmony_ci size_t len, unsigned int flags); 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ciextern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); 14362306a36Sopenharmony_ciextern void cifs_setsize(struct inode *inode, loff_t offset); 14462306a36Sopenharmony_ciextern int cifs_truncate_page(struct address_space *mapping, loff_t from); 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_cistruct smb3_fs_context; 14762306a36Sopenharmony_ciextern struct dentry *cifs_smb3_do_mount(struct file_system_type *fs_type, 14862306a36Sopenharmony_ci int flags, struct smb3_fs_context *ctx); 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci#ifdef CONFIG_CIFS_NFSD_EXPORT 15162306a36Sopenharmony_ciextern const struct export_operations cifs_export_ops; 15262306a36Sopenharmony_ci#endif /* CONFIG_CIFS_NFSD_EXPORT */ 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ci/* when changing internal version - update following two lines at same time */ 15562306a36Sopenharmony_ci#define SMB3_PRODUCT_BUILD 45 15662306a36Sopenharmony_ci#define CIFS_VERSION "2.45" 15762306a36Sopenharmony_ci#endif /* _CIFSFS_H */ 158