linux/fs/smb/client/misc.c

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

#include <linux/slab.h>
#include <linux/ctype.h>
#include <linux/mempool.h>
#include <linux/vmalloc.h>
#include "cifspdu.h"
#include "cifsglob.h"
#include "cifsproto.h"
#include "cifs_debug.h"
#include "smberr.h"
#include "nterr.h"
#include "cifs_unicode.h"
#include "smb2pdu.h"
#include "cifsfs.h"
#ifdef CONFIG_CIFS_DFS_UPCALL
#include "dns_resolve.h"
#include "dfs_cache.h"
#include "dfs.h"
#endif
#include "fs_context.h"
#include "cached_dir.h"

/* The xid serves as a useful identifier for each incoming vfs request,
   in a similar way to the mid which is useful to track each sent smb,
   and CurrentXid can also provide a running counter (although it
   will eventually wrap past zero) of the total vfs operations handled
   since the cifs fs was mounted */

unsigned int
_get_xid(void)
{}

void
_free_xid(unsigned int xid)
{}

struct cifs_ses *
sesInfoAlloc(void)
{}

void
sesInfoFree(struct cifs_ses *buf_to_free)
{}

struct cifs_tcon *
tcon_info_alloc(bool dir_leases_enabled, enum smb3_tcon_ref_trace trace)
{}

void
tconInfoFree(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
{}

struct smb_hdr *
cifs_buf_get(void)
{}

void
cifs_buf_release(void *buf_to_free)
{}

struct smb_hdr *
cifs_small_buf_get(void)
{}

void
cifs_small_buf_release(void *buf_to_free)
{}

void
free_rsp_buf(int resp_buftype, void *rsp)
{}

/* NB: MID can not be set if treeCon not passed in, in that
   case it is responsibility of caller to set the mid */
void
header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
		const struct cifs_tcon *treeCon, int word_count
		/* length of fixed section (word count) in two byte units  */)
{}

static int
check_smb_hdr(struct smb_hdr *smb)
{}

int
checkSMB(char *buf, unsigned int total_read, struct TCP_Server_Info *server)
{}

bool
is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
{}

void
dump_smb(void *buf, int smb_buf_length)
{}

void
cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
{}

void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock)
{}

/*
 * We wait for oplock breaks to be processed before we attempt to perform
 * writes.
 */
int cifs_get_writer(struct cifsInodeInfo *cinode)
{}

void cifs_put_writer(struct cifsInodeInfo *cinode)
{}

/**
 * cifs_queue_oplock_break - queue the oplock break handler for cfile
 * @cfile: The file to break the oplock on
 *
 * This function is called from the demultiplex thread when it
 * receives an oplock break for @cfile.
 *
 * Assumes the tcon->open_file_lock is held.
 * Assumes cfile->file_info_lock is NOT held.
 */
void cifs_queue_oplock_break(struct cifsFileInfo *cfile)
{}

void cifs_done_oplock_break(struct cifsInodeInfo *cinode)
{}

bool
backup_cred(struct cifs_sb_info *cifs_sb)
{}

void
cifs_del_pending_open(struct cifs_pending_open *open)
{}

void
cifs_add_pending_open_locked(struct cifs_fid *fid, struct tcon_link *tlink,
			     struct cifs_pending_open *open)
{}

void
cifs_add_pending_open(struct cifs_fid *fid, struct tcon_link *tlink,
		      struct cifs_pending_open *open)
{}

/*
 * Critical section which runs after acquiring deferred_lock.
 * As there is no reference count on cifs_deferred_close, pdclose
 * should not be used outside deferred_lock.
 */
bool
cifs_is_deferred_close(struct cifsFileInfo *cfile, struct cifs_deferred_close **pdclose)
{}

/*
 * Critical section which runs after acquiring deferred_lock.
 */
void
cifs_add_deferred_close(struct cifsFileInfo *cfile, struct cifs_deferred_close *dclose)
{}

/*
 * Critical section which runs after acquiring deferred_lock.
 */
void
cifs_del_deferred_close(struct cifsFileInfo *cfile)
{}

void
cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode)
{}

void
cifs_close_all_deferred_files(struct cifs_tcon *tcon)
{}
void
cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path)
{}

/*
 * If a dentry has been deleted, all corresponding open handles should know that
 * so that we do not defer close them.
 */
void cifs_mark_open_handles_for_deleted_file(struct inode *inode,
					     const char *path)
{}

/* parses DFS referral V3 structure
 * caller is responsible for freeing target_nodes
 * returns:
 * - on success - 0
 * - on failure - errno
 */
int
parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size,
		    unsigned int *num_of_nodes,
		    struct dfs_info3_param **target_nodes,
		    const struct nls_table *nls_codepage, int remap,
		    const char *searchName, bool is_unicode)
{}

/**
 * cifs_alloc_hash - allocate hash and hash context together
 * @name: The name of the crypto hash algo
 * @sdesc: SHASH descriptor where to put the pointer to the hash TFM
 *
 * The caller has to make sure @sdesc is initialized to either NULL or
 * a valid context. It can be freed via cifs_free_hash().
 */
int
cifs_alloc_hash(const char *name, struct shash_desc **sdesc)
{}

/**
 * cifs_free_hash - free hash and hash context together
 * @sdesc: Where to find the pointer to the hash TFM
 *
 * Freeing a NULL descriptor is safe.
 */
void
cifs_free_hash(struct shash_desc **sdesc)
{}

void extract_unc_hostname(const char *unc, const char **h, size_t *len)
{}

/**
 * copy_path_name - copy src path to dst, possibly truncating
 * @dst: The destination buffer
 * @src: The source name
 *
 * returns number of bytes written (including trailing nul)
 */
int copy_path_name(char *dst, const char *src)
{}

struct super_cb_data {};

static void tcon_super_cb(struct super_block *sb, void *arg)
{}

static struct super_block *__cifs_get_super(void (*f)(struct super_block *, void *),
					    void *data)
{}

static void __cifs_put_super(struct super_block *sb)
{}

struct super_block *cifs_get_dfs_tcon_super(struct cifs_tcon *tcon)
{}

void cifs_put_tcp_super(struct super_block *sb)
{}

#ifdef CONFIG_CIFS_DFS_UPCALL
int match_target_ip(struct TCP_Server_Info *server,
		    const char *share, size_t share_len,
		    bool *result)
{}

int cifs_update_super_prepath(struct cifs_sb_info *cifs_sb, char *prefix)
{}

/*
 * Handle weird Windows SMB server behaviour. It responds with
 * STATUS_OBJECT_NAME_INVALID code to SMB2 QUERY_INFO request for
 * "\<server>\<dfsname>\<linkpath>" DFS reference, where <dfsname> contains
 * non-ASCII unicode symbols.
 */
int cifs_inval_name_dfs_link_error(const unsigned int xid,
				   struct cifs_tcon *tcon,
				   struct cifs_sb_info *cifs_sb,
				   const char *full_path,
				   bool *islink)
{}
#endif

int cifs_wait_for_server_reconnect(struct TCP_Server_Info *server, bool retry)
{}