xref: /linux/fs/smb/client/smb2glob.h (revision 7c4bf530aefad8b5b47ffb464daa90b3f0662930)
1 /* SPDX-License-Identifier: LGPL-2.1 */
2 /*
3  *
4  *   Definitions for various global variables and structures
5  *
6  *   Copyright (C) International Business Machines  Corp., 2002, 2011
7  *                 Etersoft, 2012
8  *   Author(s): Steve French (sfrench@us.ibm.com)
9  *              Jeremy Allison (jra@samba.org)
10  *              Pavel Shilovsky (pshilovsky@samba.org) 2012
11  *
12  */
13 #ifndef _SMB2_GLOB_H
14 #define _SMB2_GLOB_H
15 
16 #define COMP_PID(cfile) ((cfile) ? (cfile)->fid.persistent_fid : COMPOUND_FID)
17 #define COMP_VID(cfile) ((cfile) ? (cfile)->fid.volatile_fid : COMPOUND_FID)
18 
19 static inline void cifs_stats_fail_inc(struct cifs_tcon *tcon, uint16_t code)
20 {
21 	cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_failed[code]);
22 }
23 
24 /*
25  *****************************************************************
26  * Constants go here
27  *****************************************************************
28  */
29 
30 /*
31  * Identifiers for functions that use the open, operation, close pattern
32  * in smb2inode.c:smb2_compound_op()
33  */
34 enum smb2_compound_ops {
35 	SMB2_OP_SET_DELETE = 1,
36 	SMB2_OP_SET_INFO,
37 	SMB2_OP_QUERY_INFO,
38 	SMB2_OP_QUERY_DIR,
39 	SMB2_OP_MKDIR,
40 	SMB2_OP_RENAME,
41 	SMB2_OP_HARDLINK,
42 	SMB2_OP_SET_EOF,
43 	SMB2_OP_UNLINK,
44 	SMB2_OP_POSIX_QUERY_INFO,
45 	SMB2_OP_SET_REPARSE,
46 	SMB2_OP_GET_REPARSE,
47 	SMB2_OP_QUERY_WSL_EA,
48 	SMB2_OP_OPEN_QUERY,
49 };
50 
51 /* Used when constructing chained read requests. */
52 #define CHAINED_REQUEST 1
53 #define START_OF_CHAIN 2
54 #define END_OF_CHAIN 4
55 #define RELATED_REQUEST 8
56 
57 /*
58  *****************************************************************
59  * Struct definitions go here
60  *****************************************************************
61  */
62 
63 struct status_to_posix_error {
64 	__u32 smb2_status;
65 	int posix_error;
66 	char *status_string;
67 };
68 
69 #endif	/* _SMB2_GLOB_H */
70