4 * Structure definitions for io control for cifs/smb3
6 * Copyright (c) 2015 Steve French <steve.french@primarydata.com>
8 * This library is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published
10 * by the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
16 * the GNU Lesser General Public License for more details.
20 struct smb_mnt_fs_info {
21 __u32 version; /* 0001 */
24 __u32 vol_serial_number;
25 __u32 vol_create_time;
29 __u32 optimal_sector_size;
30 __u32 max_bytes_chunk;
32 __u32 max_path_component;
34 __u32 device_characteristics;
36 __u64 cifs_posix_caps;
39 struct smb_snapshot_array {
40 __u32 number_of_snapshots;
41 __u32 number_of_snapshots_returned;
42 __u32 snapshot_array_size;
46 /* query_info flags */
47 #define PASSTHRU_QUERY_INFO 0x00000000
48 #define PASSTHRU_FSCTL 0x00000001
49 #define PASSTHRU_SET_INFO 0x00000002
50 struct smb_query_info {
52 __u32 file_info_class;
53 __u32 additional_information;
55 __u32 input_buffer_length;
56 __u32 output_buffer_length;
61 * Dumping the commonly used 16 byte (e.g. CCM and GCM128) keys still supported
62 * for backlevel compatibility, but is not sufficient for dumping the less
63 * frequently used GCM256 (32 byte) keys (see the newer "CIFS_DUMP_FULL_KEY"
64 * ioctl for dumping decryption info for GCM256 mounts)
66 struct smb3_key_debug_info {
69 __u8 auth_key[16]; /* SMB2_NTLMV2_SESSKEY_SIZE */
70 __u8 smb3encryptionkey[SMB3_SIGN_KEY_SIZE];
71 __u8 smb3decryptionkey[SMB3_SIGN_KEY_SIZE];
75 * Dump variable-sized keys
77 struct smb3_full_key_debug_info {
78 /* INPUT: size of userspace buffer */
82 * INPUT: 0 for current user, otherwise session to dump
83 * OUTPUT: session id that was dumped
87 __u8 session_key_length;
88 __u8 server_in_key_length;
89 __u8 server_out_key_length;
92 * return this struct with the keys appended at the end:
93 * __u8 session_key[session_key_length];
94 * __u8 server_in_key[server_in_key_length];
95 * __u8 server_out_key[server_out_key_length];
100 __u32 completion_filter;
104 #define CIFS_IOCTL_MAGIC 0xCF
105 #define CIFS_IOC_COPYCHUNK_FILE _IOW(CIFS_IOCTL_MAGIC, 3, int)
106 #define CIFS_IOC_SET_INTEGRITY _IO(CIFS_IOCTL_MAGIC, 4)
107 #define CIFS_IOC_GET_MNT_INFO _IOR(CIFS_IOCTL_MAGIC, 5, struct smb_mnt_fs_info)
108 #define CIFS_ENUMERATE_SNAPSHOTS _IOR(CIFS_IOCTL_MAGIC, 6, struct smb_snapshot_array)
109 #define CIFS_QUERY_INFO _IOWR(CIFS_IOCTL_MAGIC, 7, struct smb_query_info)
110 #define CIFS_DUMP_KEY _IOWR(CIFS_IOCTL_MAGIC, 8, struct smb3_key_debug_info)
111 #define CIFS_IOC_NOTIFY _IOW(CIFS_IOCTL_MAGIC, 9, struct smb3_notify)
112 #define CIFS_DUMP_FULL_KEY _IOWR(CIFS_IOCTL_MAGIC, 10, struct smb3_full_key_debug_info)
113 #define CIFS_IOC_SHUTDOWN _IOR ('X', 125, __u32)
116 * Flags for going down operation
118 #define CIFS_GOING_FLAGS_DEFAULT 0x0 /* going down */
119 #define CIFS_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not data */
120 #define CIFS_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor data */
122 static inline bool cifs_forced_shutdown(struct cifs_sb_info *sbi)
124 if (CIFS_MOUNT_SHUTDOWN & sbi->mnt_cifs_flags)