Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: LGPL-2.1 */
0002 /*
0003  *
0004  *   Structure definitions for io control for cifs/smb3
0005  *
0006  *   Copyright (c) 2015 Steve French <steve.french@primarydata.com>
0007  *
0008  */
0009 
0010 struct smb_mnt_fs_info {
0011     __u32   version; /* 0001 */
0012     __u16   protocol_id;
0013     __u16   tcon_flags;
0014     __u32   vol_serial_number;
0015     __u32   vol_create_time;
0016     __u32   share_caps;
0017     __u32   share_flags;
0018     __u32   sector_flags;
0019     __u32   optimal_sector_size;
0020     __u32   max_bytes_chunk;
0021     __u32   fs_attributes;
0022     __u32   max_path_component;
0023     __u32   device_type;
0024     __u32   device_characteristics;
0025     __u32   maximal_access;
0026     __u64   cifs_posix_caps;
0027 } __packed;
0028 
0029 struct smb_snapshot_array {
0030     __u32   number_of_snapshots;
0031     __u32   number_of_snapshots_returned;
0032     __u32   snapshot_array_size;
0033     /*  snapshots[]; */
0034 } __packed;
0035 
0036 /* query_info flags */
0037 #define PASSTHRU_QUERY_INFO 0x00000000
0038 #define PASSTHRU_FSCTL      0x00000001
0039 #define PASSTHRU_SET_INFO   0x00000002
0040 struct smb_query_info {
0041     __u32   info_type;
0042     __u32   file_info_class;
0043     __u32   additional_information;
0044     __u32   flags;
0045     __u32   input_buffer_length;
0046     __u32   output_buffer_length;
0047     /* char buffer[]; */
0048 } __packed;
0049 
0050 /*
0051  * Dumping the commonly used 16 byte (e.g. CCM and GCM128) keys still supported
0052  * for backlevel compatibility, but is not sufficient for dumping the less
0053  * frequently used GCM256 (32 byte) keys (see the newer "CIFS_DUMP_FULL_KEY"
0054  * ioctl for dumping decryption info for GCM256 mounts)
0055  */
0056 struct smb3_key_debug_info {
0057     __u64   Suid;
0058     __u16   cipher_type;
0059     __u8    auth_key[16]; /* SMB2_NTLMV2_SESSKEY_SIZE */
0060     __u8    smb3encryptionkey[SMB3_SIGN_KEY_SIZE];
0061     __u8    smb3decryptionkey[SMB3_SIGN_KEY_SIZE];
0062 } __packed;
0063 
0064 /*
0065  * Dump variable-sized keys
0066  */
0067 struct smb3_full_key_debug_info {
0068     /* INPUT: size of userspace buffer */
0069     __u32   in_size;
0070 
0071     /*
0072      * INPUT: 0 for current user, otherwise session to dump
0073      * OUTPUT: session id that was dumped
0074      */
0075     __u64   session_id;
0076     __u16   cipher_type;
0077     __u8    session_key_length;
0078     __u8    server_in_key_length;
0079     __u8    server_out_key_length;
0080     __u8    data[];
0081     /*
0082      * return this struct with the keys appended at the end:
0083      * __u8 session_key[session_key_length];
0084      * __u8 server_in_key[server_in_key_length];
0085      * __u8 server_out_key[server_out_key_length];
0086      */
0087 } __packed;
0088 
0089 struct smb3_notify {
0090     __u32   completion_filter;
0091     bool    watch_tree;
0092 } __packed;
0093 
0094 #define CIFS_IOCTL_MAGIC    0xCF
0095 #define CIFS_IOC_COPYCHUNK_FILE _IOW(CIFS_IOCTL_MAGIC, 3, int)
0096 #define CIFS_IOC_SET_INTEGRITY  _IO(CIFS_IOCTL_MAGIC, 4)
0097 #define CIFS_IOC_GET_MNT_INFO _IOR(CIFS_IOCTL_MAGIC, 5, struct smb_mnt_fs_info)
0098 #define CIFS_ENUMERATE_SNAPSHOTS _IOR(CIFS_IOCTL_MAGIC, 6, struct smb_snapshot_array)
0099 #define CIFS_QUERY_INFO _IOWR(CIFS_IOCTL_MAGIC, 7, struct smb_query_info)
0100 #define CIFS_DUMP_KEY _IOWR(CIFS_IOCTL_MAGIC, 8, struct smb3_key_debug_info)
0101 #define CIFS_IOC_NOTIFY _IOW(CIFS_IOCTL_MAGIC, 9, struct smb3_notify)
0102 #define CIFS_DUMP_FULL_KEY _IOWR(CIFS_IOCTL_MAGIC, 10, struct smb3_full_key_debug_info)
0103 #define CIFS_IOC_SHUTDOWN _IOR ('X', 125, __u32)
0104 
0105 /*
0106  * Flags for going down operation
0107  */
0108 #define CIFS_GOING_FLAGS_DEFAULT                0x0     /* going down */
0109 #define CIFS_GOING_FLAGS_LOGFLUSH               0x1     /* flush log but not data */
0110 #define CIFS_GOING_FLAGS_NOLOGFLUSH             0x2     /* don't flush log nor data */
0111 
0112 static inline bool cifs_forced_shutdown(struct cifs_sb_info *sbi)
0113 {
0114     if (CIFS_MOUNT_SHUTDOWN & sbi->mnt_cifs_flags)
0115         return true;
0116     else
0117         return false;
0118 }