linux/fs/smb/client/cifsfs.c

// SPDX-License-Identifier: LGPL-2.1
/*
 *
 *   Copyright (C) International Business Machines  Corp., 2002,2008
 *   Author(s): Steve French ([email protected])
 *
 *   Common Internet FileSystem (CIFS) client
 *
 */

/* Note that BB means BUGBUG (ie something to fix eventually) */

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/filelock.h>
#include <linux/mount.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/seq_file.h>
#include <linux/vfs.h>
#include <linux/mempool.h>
#include <linux/delay.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/namei.h>
#include <linux/random.h>
#include <linux/splice.h>
#include <linux/uuid.h>
#include <linux/xattr.h>
#include <uapi/linux/magic.h>
#include <net/ipv6.h>
#include "cifsfs.h"
#include "cifspdu.h"
#define DECLARE_GLOBALS_HERE
#include "cifsglob.h"
#include "cifsproto.h"
#include "cifs_debug.h"
#include "cifs_fs_sb.h"
#include <linux/mm.h>
#include <linux/key-type.h>
#include "cifs_spnego.h"
#include "fscache.h"
#ifdef CONFIG_CIFS_DFS_UPCALL
#include "dfs_cache.h"
#endif
#ifdef CONFIG_CIFS_SWN_UPCALL
#include "netlink.h"
#endif
#include "fs_context.h"
#include "cached_dir.h"

/*
 * DOS dates from 1980/1/1 through 2107/12/31
 * Protocol specifications indicate the range should be to 119, which
 * limits maximum year to 2099. But this range has not been checked.
 */
#define SMB_DATE_MAX
#define SMB_DATE_MIN
#define SMB_TIME_MAX

int cifsFYI =;
bool traceSMB;
bool enable_oplocks =;
bool linuxExtEnabled =;
bool lookupCacheEnabled =;
bool disable_legacy_dialects; /* false by default */
bool enable_gcm_256 =;
bool require_gcm_256; /* false by default */
bool enable_negotiate_signing; /* false by default */
unsigned int global_secflags =;
/* unsigned int ntlmv2_support = 0; */
unsigned int sign_CIFS_PDUs =;

/*
 * Global transaction id (XID) information
 */
unsigned int GlobalCurrentXid;	/* protected by GlobalMid_Sem */
unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */
unsigned int GlobalMaxActiveXid;	/* prot by GlobalMid_Sem */
spinlock_t GlobalMid_Lock; /* protects above & list operations on midQ entries */

/*
 *  Global counters, updated atomically
 */
atomic_t sesInfoAllocCount;
atomic_t tconInfoAllocCount;
atomic_t tcpSesNextId;
atomic_t tcpSesAllocCount;
atomic_t tcpSesReconnectCount;
atomic_t tconInfoReconnectCount;

atomic_t mid_count;
atomic_t buf_alloc_count;
atomic_t small_buf_alloc_count;
#ifdef CONFIG_CIFS_STATS2
atomic_t total_buf_alloc_count;
atomic_t total_small_buf_alloc_count;
#endif/* STATS2 */
struct list_head	cifs_tcp_ses_list;
spinlock_t		cifs_tcp_ses_lock;
static const struct super_operations cifs_super_ops;
unsigned int CIFSMaxBufSize =;
module_param(CIFSMaxBufSize, uint, 0444);
MODULE_PARM_DESC();
unsigned int cifs_min_rcv =;
module_param(cifs_min_rcv, uint, 0444);
MODULE_PARM_DESC();
unsigned int cifs_min_small =;
module_param(cifs_min_small, uint, 0444);
MODULE_PARM_DESC();
unsigned int cifs_max_pending =;
module_param(cifs_max_pending, uint, 0444);
MODULE_PARM_DESC();
unsigned int dir_cache_timeout =;
module_param(dir_cache_timeout, uint, 0644);
MODULE_PARM_DESC();
#ifdef CONFIG_CIFS_STATS2
unsigned int slow_rsp_threshold =;
module_param(slow_rsp_threshold, uint, 0644);
MODULE_PARM_DESC();
#endif /* STATS2 */

module_param(enable_oplocks, bool, 0644);
MODULE_PARM_DESC();

module_param(enable_gcm_256, bool, 0644);
MODULE_PARM_DESC();

module_param(require_gcm_256, bool, 0644);
MODULE_PARM_DESC();

module_param(enable_negotiate_signing, bool, 0644);
MODULE_PARM_DESC();

module_param(disable_legacy_dialects, bool, 0644);
MODULE_PARM_DESC();

struct workqueue_struct	*cifsiod_wq;
struct workqueue_struct	*decrypt_wq;
struct workqueue_struct	*fileinfo_put_wq;
struct workqueue_struct	*cifsoplockd_wq;
struct workqueue_struct	*deferredclose_wq;
struct workqueue_struct	*serverclose_wq;
__u32 cifs_lock_secret;

/*
 * Bumps refcount for cifs super block.
 * Note that it should be only called if a referece to VFS super block is
 * already held, e.g. in open-type syscalls context. Otherwise it can race with
 * atomic_dec_and_test in deactivate_locked_super.
 */
void
cifs_sb_active(struct super_block *sb)
{}

void
cifs_sb_deactive(struct super_block *sb)
{}

static int
cifs_read_super(struct super_block *sb)
{}

static void cifs_kill_sb(struct super_block *sb)
{}

static int
cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
{}

static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len)
{}

static int cifs_permission(struct mnt_idmap *idmap,
			   struct inode *inode, int mask)
{}

static struct kmem_cache *cifs_inode_cachep;
static struct kmem_cache *cifs_req_cachep;
static struct kmem_cache *cifs_mid_cachep;
static struct kmem_cache *cifs_sm_req_cachep;
static struct kmem_cache *cifs_io_request_cachep;
static struct kmem_cache *cifs_io_subrequest_cachep;
mempool_t *cifs_sm_req_poolp;
mempool_t *cifs_req_poolp;
mempool_t *cifs_mid_poolp;
mempool_t cifs_io_request_pool;
mempool_t cifs_io_subrequest_pool;

static struct inode *
cifs_alloc_inode(struct super_block *sb)
{}

static void
cifs_free_inode(struct inode *inode)
{}

static void
cifs_evict_inode(struct inode *inode)
{}

static void
cifs_show_address(struct seq_file *s, struct TCP_Server_Info *server)
{}

static void
cifs_show_security(struct seq_file *s, struct cifs_ses *ses)
{}

static void
cifs_show_cache_flavor(struct seq_file *s, struct cifs_sb_info *cifs_sb)
{}

/*
 * cifs_show_devname() is used so we show the mount device name with correct
 * format (e.g. forward slashes vs. back slashes) in /proc/mounts
 */
static int cifs_show_devname(struct seq_file *m, struct dentry *root)
{}

/*
 * cifs_show_options() is for displaying mount options in /proc/mounts.
 * Not all settable options are displayed but most of the important
 * ones are.
 */
static int
cifs_show_options(struct seq_file *s, struct dentry *root)
{}

static void cifs_umount_begin(struct super_block *sb)
{}

static int cifs_freeze(struct super_block *sb)
{}

#ifdef CONFIG_CIFS_STATS2
static int cifs_show_stats(struct seq_file *s, struct dentry *root)
{}
#endif

static int cifs_write_inode(struct inode *inode, struct writeback_control *wbc)
{}

static int cifs_drop_inode(struct inode *inode)
{}

static const struct super_operations cifs_super_ops =;

/*
 * Get root dentry from superblock according to prefix path mount option.
 * Return dentry with refcount + 1 on success and NULL otherwise.
 */
static struct dentry *
cifs_get_root(struct smb3_fs_context *ctx, struct super_block *sb)
{}

static int cifs_set_super(struct super_block *sb, void *data)
{}

struct dentry *
cifs_smb3_do_mount(struct file_system_type *fs_type,
	      int flags, struct smb3_fs_context *old_ctx)
{}

static loff_t cifs_llseek(struct file *file, loff_t offset, int whence)
{}

static int
cifs_setlease(struct file *file, int arg, struct file_lease **lease, void **priv)
{}

struct file_system_type cifs_fs_type =;
MODULE_ALIAS_FS();

struct file_system_type smb3_fs_type =;
MODULE_ALIAS_FS();
MODULE_ALIAS();

const struct inode_operations cifs_dir_inode_ops =;

const struct inode_operations cifs_file_inode_ops =;

const char *cifs_get_link(struct dentry *dentry, struct inode *inode,
			    struct delayed_call *done)
{}

const struct inode_operations cifs_symlink_inode_ops =;

/*
 * Advance the EOF marker to after the source range.
 */
static int cifs_precopy_set_eof(struct inode *src_inode, struct cifsInodeInfo *src_cifsi,
				struct cifs_tcon *src_tcon,
				unsigned int xid, loff_t src_end)
{}

/*
 * Flush out either the folio that overlaps the beginning of a range in which
 * pos resides or the folio that overlaps the end of a range unless that folio
 * is entirely within the range we're going to invalidate.  We extend the flush
 * bounds to encompass the folio.
 */
static int cifs_flush_folio(struct inode *inode, loff_t pos, loff_t *_fstart, loff_t *_fend,
			    bool first)
{}

static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
		struct file *dst_file, loff_t destoff, loff_t len,
		unsigned int remap_flags)
{}

ssize_t cifs_file_copychunk_range(unsigned int xid,
				struct file *src_file, loff_t off,
				struct file *dst_file, loff_t destoff,
				size_t len, unsigned int flags)
{}

/*
 * Directory operations under CIFS/SMB2/SMB3 are synchronous, so fsync()
 * is a dummy operation.
 */
static int cifs_dir_fsync(struct file *file, loff_t start, loff_t end, int datasync)
{}

static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
				struct file *dst_file, loff_t destoff,
				size_t len, unsigned int flags)
{}

const struct file_operations cifs_file_ops =;

const struct file_operations cifs_file_strict_ops =;

const struct file_operations cifs_file_direct_ops =;

const struct file_operations cifs_file_nobrl_ops =;

const struct file_operations cifs_file_strict_nobrl_ops =;

const struct file_operations cifs_file_direct_nobrl_ops =;

const struct file_operations cifs_dir_ops =;

static void
cifs_init_once(void *inode)
{}

static int __init
cifs_init_inodecache(void)
{}

static void
cifs_destroy_inodecache(void)
{}

static int
cifs_init_request_bufs(void)
{}

static void
cifs_destroy_request_bufs(void)
{}

static int init_mids(void)
{}

static void destroy_mids(void)
{}

static int cifs_init_netfs(void)
{}

static void cifs_destroy_netfs(void)
{}

static int __init
init_cifs(void)
{}

static void __exit
exit_cifs(void)
{}

MODULE_AUTHOR();
MODULE_LICENSE();	/* combination of LGPL + GPL source behaves as GPL */
MODULE_DESCRIPTION();
MODULE_VERSION();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
MODULE_SOFTDEP();
module_init()
module_exit()