18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * fs/cifs/cifsfs.h 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (c) International Business Machines Corp., 2002, 2007 58c2ecf20Sopenharmony_ci * Author(s): Steve French (sfrench@us.ibm.com) 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This library is free software; you can redistribute it and/or modify 88c2ecf20Sopenharmony_ci * it under the terms of the GNU Lesser General Public License as published 98c2ecf20Sopenharmony_ci * by the Free Software Foundation; either version 2.1 of the License, or 108c2ecf20Sopenharmony_ci * (at your option) any later version. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * This library is distributed in the hope that it will be useful, 138c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 148c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 158c2ecf20Sopenharmony_ci * the GNU Lesser General Public License for more details. 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * You should have received a copy of the GNU Lesser General Public License 188c2ecf20Sopenharmony_ci * along with this library; if not, write to the Free Software 198c2ecf20Sopenharmony_ci * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 208c2ecf20Sopenharmony_ci */ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#ifndef _CIFSFS_H 238c2ecf20Sopenharmony_ci#define _CIFSFS_H 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#include <linux/hash.h> 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define ROOT_I 2 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* 308c2ecf20Sopenharmony_ci * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down 318c2ecf20Sopenharmony_ci * so that it will fit. We use hash_64 to convert the value to 31 bits, and 328c2ecf20Sopenharmony_ci * then add 1, to ensure that we don't end up with a 0 as the value. 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_cistatic inline ino_t 358c2ecf20Sopenharmony_cicifs_uniqueid_to_ino_t(u64 fileid) 368c2ecf20Sopenharmony_ci{ 378c2ecf20Sopenharmony_ci if ((sizeof(ino_t)) < (sizeof(u64))) 388c2ecf20Sopenharmony_ci return (ino_t)hash_64(fileid, (sizeof(ino_t) * 8) - 1) + 1; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci return (ino_t)fileid; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci} 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic inline void cifs_set_time(struct dentry *dentry, unsigned long time) 458c2ecf20Sopenharmony_ci{ 468c2ecf20Sopenharmony_ci dentry->d_fsdata = (void *) time; 478c2ecf20Sopenharmony_ci} 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_cistatic inline unsigned long cifs_get_time(struct dentry *dentry) 508c2ecf20Sopenharmony_ci{ 518c2ecf20Sopenharmony_ci return (unsigned long) dentry->d_fsdata; 528c2ecf20Sopenharmony_ci} 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciextern struct file_system_type cifs_fs_type, smb3_fs_type; 558c2ecf20Sopenharmony_ciextern const struct address_space_operations cifs_addr_ops; 568c2ecf20Sopenharmony_ciextern const struct address_space_operations cifs_addr_ops_smallbuf; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* Functions related to super block operations */ 598c2ecf20Sopenharmony_ciextern void cifs_sb_active(struct super_block *sb); 608c2ecf20Sopenharmony_ciextern void cifs_sb_deactive(struct super_block *sb); 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* Functions related to inodes */ 638c2ecf20Sopenharmony_ciextern const struct inode_operations cifs_dir_inode_ops; 648c2ecf20Sopenharmony_ciextern struct inode *cifs_root_iget(struct super_block *); 658c2ecf20Sopenharmony_ciextern int cifs_create(struct inode *, struct dentry *, umode_t, 668c2ecf20Sopenharmony_ci bool excl); 678c2ecf20Sopenharmony_ciextern int cifs_atomic_open(struct inode *, struct dentry *, 688c2ecf20Sopenharmony_ci struct file *, unsigned, umode_t); 698c2ecf20Sopenharmony_ciextern struct dentry *cifs_lookup(struct inode *, struct dentry *, 708c2ecf20Sopenharmony_ci unsigned int); 718c2ecf20Sopenharmony_ciextern int cifs_unlink(struct inode *dir, struct dentry *dentry); 728c2ecf20Sopenharmony_ciextern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *); 738c2ecf20Sopenharmony_ciextern int cifs_mknod(struct inode *, struct dentry *, umode_t, dev_t); 748c2ecf20Sopenharmony_ciextern int cifs_mkdir(struct inode *, struct dentry *, umode_t); 758c2ecf20Sopenharmony_ciextern int cifs_rmdir(struct inode *, struct dentry *); 768c2ecf20Sopenharmony_ciextern int cifs_rename2(struct inode *, struct dentry *, struct inode *, 778c2ecf20Sopenharmony_ci struct dentry *, unsigned int); 788c2ecf20Sopenharmony_ciextern int cifs_revalidate_file_attr(struct file *filp); 798c2ecf20Sopenharmony_ciextern int cifs_revalidate_dentry_attr(struct dentry *); 808c2ecf20Sopenharmony_ciextern int cifs_revalidate_file(struct file *filp); 818c2ecf20Sopenharmony_ciextern int cifs_revalidate_dentry(struct dentry *); 828c2ecf20Sopenharmony_ciextern int cifs_invalidate_mapping(struct inode *inode); 838c2ecf20Sopenharmony_ciextern int cifs_revalidate_mapping(struct inode *inode); 848c2ecf20Sopenharmony_ciextern int cifs_zap_mapping(struct inode *inode); 858c2ecf20Sopenharmony_ciextern int cifs_getattr(const struct path *, struct kstat *, u32, unsigned int); 868c2ecf20Sopenharmony_ciextern int cifs_setattr(struct dentry *, struct iattr *); 878c2ecf20Sopenharmony_ciextern int cifs_fiemap(struct inode *, struct fiemap_extent_info *, u64 start, 888c2ecf20Sopenharmony_ci u64 len); 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ciextern const struct inode_operations cifs_file_inode_ops; 918c2ecf20Sopenharmony_ciextern const struct inode_operations cifs_symlink_inode_ops; 928c2ecf20Sopenharmony_ciextern const struct inode_operations cifs_dfs_referral_inode_operations; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci/* Functions related to files and directories */ 968c2ecf20Sopenharmony_ciextern const struct file_operations cifs_file_ops; 978c2ecf20Sopenharmony_ciextern const struct file_operations cifs_file_direct_ops; /* if directio mnt */ 988c2ecf20Sopenharmony_ciextern const struct file_operations cifs_file_strict_ops; /* if strictio mnt */ 998c2ecf20Sopenharmony_ciextern const struct file_operations cifs_file_nobrl_ops; /* no brlocks */ 1008c2ecf20Sopenharmony_ciextern const struct file_operations cifs_file_direct_nobrl_ops; 1018c2ecf20Sopenharmony_ciextern const struct file_operations cifs_file_strict_nobrl_ops; 1028c2ecf20Sopenharmony_ciextern int cifs_open(struct inode *inode, struct file *file); 1038c2ecf20Sopenharmony_ciextern int cifs_close(struct inode *inode, struct file *file); 1048c2ecf20Sopenharmony_ciextern int cifs_closedir(struct inode *inode, struct file *file); 1058c2ecf20Sopenharmony_ciextern ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to); 1068c2ecf20Sopenharmony_ciextern ssize_t cifs_direct_readv(struct kiocb *iocb, struct iov_iter *to); 1078c2ecf20Sopenharmony_ciextern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to); 1088c2ecf20Sopenharmony_ciextern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from); 1098c2ecf20Sopenharmony_ciextern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from); 1108c2ecf20Sopenharmony_ciextern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from); 1118c2ecf20Sopenharmony_ciextern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock); 1128c2ecf20Sopenharmony_ciextern int cifs_lock(struct file *, int, struct file_lock *); 1138c2ecf20Sopenharmony_ciextern int cifs_fsync(struct file *, loff_t, loff_t, int); 1148c2ecf20Sopenharmony_ciextern int cifs_strict_fsync(struct file *, loff_t, loff_t, int); 1158c2ecf20Sopenharmony_ciextern int cifs_flush(struct file *, fl_owner_t id); 1168c2ecf20Sopenharmony_ciextern int cifs_file_mmap(struct file * , struct vm_area_struct *); 1178c2ecf20Sopenharmony_ciextern int cifs_file_strict_mmap(struct file * , struct vm_area_struct *); 1188c2ecf20Sopenharmony_ciextern const struct file_operations cifs_dir_ops; 1198c2ecf20Sopenharmony_ciextern int cifs_dir_open(struct inode *inode, struct file *file); 1208c2ecf20Sopenharmony_ciextern int cifs_readdir(struct file *file, struct dir_context *ctx); 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci/* Functions related to dir entries */ 1238c2ecf20Sopenharmony_ciextern const struct dentry_operations cifs_dentry_ops; 1248c2ecf20Sopenharmony_ciextern const struct dentry_operations cifs_ci_dentry_ops; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci#ifdef CONFIG_CIFS_DFS_UPCALL 1278c2ecf20Sopenharmony_ciextern struct vfsmount *cifs_dfs_d_automount(struct path *path); 1288c2ecf20Sopenharmony_ci#else 1298c2ecf20Sopenharmony_cistatic inline struct vfsmount *cifs_dfs_d_automount(struct path *path) 1308c2ecf20Sopenharmony_ci{ 1318c2ecf20Sopenharmony_ci return ERR_PTR(-EREMOTE); 1328c2ecf20Sopenharmony_ci} 1338c2ecf20Sopenharmony_ci#endif 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci/* Functions related to symlinks */ 1368c2ecf20Sopenharmony_ciextern const char *cifs_get_link(struct dentry *, struct inode *, 1378c2ecf20Sopenharmony_ci struct delayed_call *); 1388c2ecf20Sopenharmony_ciextern int cifs_symlink(struct inode *inode, struct dentry *direntry, 1398c2ecf20Sopenharmony_ci const char *symname); 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci#ifdef CONFIG_CIFS_XATTR 1428c2ecf20Sopenharmony_ciextern const struct xattr_handler *cifs_xattr_handlers[]; 1438c2ecf20Sopenharmony_ciextern ssize_t cifs_listxattr(struct dentry *, char *, size_t); 1448c2ecf20Sopenharmony_ci#else 1458c2ecf20Sopenharmony_ci# define cifs_xattr_handlers NULL 1468c2ecf20Sopenharmony_ci# define cifs_listxattr NULL 1478c2ecf20Sopenharmony_ci#endif 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ciextern ssize_t cifs_file_copychunk_range(unsigned int xid, 1508c2ecf20Sopenharmony_ci struct file *src_file, loff_t off, 1518c2ecf20Sopenharmony_ci struct file *dst_file, loff_t destoff, 1528c2ecf20Sopenharmony_ci size_t len, unsigned int flags); 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ciextern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); 1558c2ecf20Sopenharmony_ciextern void cifs_setsize(struct inode *inode, loff_t offset); 1568c2ecf20Sopenharmony_ciextern int cifs_truncate_page(struct address_space *mapping, loff_t from); 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci#ifdef CONFIG_CIFS_NFSD_EXPORT 1598c2ecf20Sopenharmony_ciextern const struct export_operations cifs_export_ops; 1608c2ecf20Sopenharmony_ci#endif /* CONFIG_CIFS_NFSD_EXPORT */ 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci#define CIFS_VERSION "2.29" 1638c2ecf20Sopenharmony_ci#endif /* _CIFSFS_H */ 164