From patchwork Mon May 23 02:20:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 12858409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 118D2C433EF for ; Mon, 23 May 2022 02:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbiEWCVH (ORCPT ); Sun, 22 May 2022 22:21:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351198AbiEWCVC (ORCPT ); Sun, 22 May 2022 22:21:02 -0400 Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20EA2B57 for ; Sun, 22 May 2022 19:21:00 -0700 (PDT) Received: by mail-vs1-xe34.google.com with SMTP id m188so4751277vsm.2 for ; Sun, 22 May 2022 19:21:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=Q3jKQaxqAE7GBPPEIBwvitJGeUWBviEptDmBFb5Uuqo=; b=D9BMmHvLWxOybZU1gk5riHki1g7Q4q1Wh2tQAB2kTpBllSHqAs6I/cZJbY4xiJIT8o F/vHQAWFXxejXV73YLaZ3hM5qMygWcRZzsj6S1yv5k0rksbTK9KfgeVGqRB6nwPOtLpN s7igEKccfnx4qvSTwo5wB8UD79yRIzHne3jCOuwMeDAEvIojayBG2zjhGpTFvTBDQHHO GHHu23UVIUi4l3tf1Z8aDHEc8zSQ6gvP2bfMvLeVZyMkByQxmPh0CW3DQ/KtPpGmccaH +Mrrqlj2QqLND132FMKqBj6Hg6KNwehSIeGCnfRo0T2L3/CdOjAQ6bJD2pjyTE2L9345 7EiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Q3jKQaxqAE7GBPPEIBwvitJGeUWBviEptDmBFb5Uuqo=; b=lR2UYJpSj3wQkyNwea91IWKqizYszPUaydIn0XtlDHucCNfnopOCrim1wh9aWABsOD MrJbsCSnvYpI9iHto/Vv4IvVn4BzcEt22dA8416tKwfhxiXoHRbj7L1BrQ8CTovt0J92 3C5Jj7t7Zd9fctU+1HRJiWfKpHW/+tI+L/vl7uCMWjbHpgbhFZ0H+5VyMafQAQwXVem+ y4tc3uS+5UKsogBdh2DMPcC0CBCAS4INdjh7Y4n6VHdyTRGS7S7IxKbdC6S4OeoWWdGl MXEmlSLBE+upxLhuiBYpY0Od59SjLoetTCRBELmxParv+2vDlZe0a2tsDb+023Dgi/41 v7pw== X-Gm-Message-State: AOAM531xzMiPvdop4TPUABnTl6aGMo2QSJqesNIceaMGTolJa5r1e33d 5G9NWVJT9X7NKP/0D9oe63pehHqeXQDEs5qL4RXmA9tVXOM= X-Google-Smtp-Source: ABdhPJwVCpjE6I6y1septQuGn2LsPmR3OM1ZlLijeVRdNryWbX3+QA/iDLyi7gbFTft1gVA2UoeA+T2PKcYKtwNgzKo= X-Received: by 2002:a67:fe57:0:b0:335:ef50:1b94 with SMTP id m23-20020a67fe57000000b00335ef501b94mr6312596vsr.6.1653272458985; Sun, 22 May 2022 19:20:58 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Sun, 22 May 2022 21:20:46 -0500 Message-ID: Subject: [PATCH][SMB3] Add various fsctl structs To: CIFS , samba-technical Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Add various fsctl structs Add missing structure definition for various newer fsctl operations - duplicate_extents_ex - get_integrity_information - query_file_regions - query_on_disk_volume_info And move a few more fsctl definitions to smbfs_common From d14d769821b2591a35cdb122117d091726afb418 Mon Sep 17 00:00:00 2001 From: Steve French Date: Sun, 22 May 2022 21:14:42 -0500 Subject: [PATCH] [SMB3] Add various fsctl structs Add missing structure definition for various newer fsctl operations - duplicate_extents_ex - get_integrity_information - query_file_regions - query_on_disk_volume_info Signed-off-by: Steve French --- fs/cifs/smb2pdu.h | 22 -------- fs/smbfs_common/smb2pdu.h | 108 +++++++++++++++++++++++++++++++++++--- 2 files changed, 101 insertions(+), 29 deletions(-) diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index d8c4388b190d..f57881b8464f 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h @@ -260,28 +260,6 @@ struct get_retrieval_pointers_refcount_rsp { struct smb3_extents extents[]; } __packed; -struct fsctl_set_integrity_information_req { - __le16 ChecksumAlgorithm; - __le16 Reserved; - __le32 Flags; -} __packed; - -struct fsctl_get_integrity_information_rsp { - __le16 ChecksumAlgorithm; - __le16 Reserved; - __le32 Flags; - __le32 ChecksumChunkSizeInBytes; - __le32 ClusterSizeInBytes; -} __packed; - -/* Integrity ChecksumAlgorithm choices for above */ -#define CHECKSUM_TYPE_NONE 0x0000 -#define CHECKSUM_TYPE_CRC64 0x0002 -#define CHECKSUM_TYPE_UNCHANGED 0xFFFF /* set only */ - -/* Integrity flags for above */ -#define FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF 0x00000001 - /* See MS-DFSC 2.2.2 */ struct fsctl_get_dfs_referral_req { __le16 MaxReferralLevel; diff --git a/fs/smbfs_common/smb2pdu.h b/fs/smbfs_common/smb2pdu.h index 0507aecfc669..2cab413fffee 100644 --- a/fs/smbfs_common/smb2pdu.h +++ b/fs/smbfs_common/smb2pdu.h @@ -1244,6 +1244,106 @@ struct file_zero_data_information { __le64 BeyondFinalZero; } __packed; +/* See MS-FSCC 2.3.7 */ +struct duplicate_extents_to_file { + __u64 PersistentFileHandle; /* source file handle, opaque endianness */ + __u64 VolatileFileHandle; + __le64 SourceFileOffset; + __le64 TargetFileOffset; + __le64 ByteCount; /* Bytes to be copied */ +} __packed; + +/* See MS-FSCC 2.3.8 */ +#define DUPLICATE_EXTENTS_DATA_EX_SOURCE_ATOMIC 0x00000001 +struct duplicate_extents_to_file_ex { + __u64 PersistentFileHandle; /* source file handle, opaque endianness */ + __u64 VolatileFileHandle; + __le64 SourceFileOffset; + __le64 TargetFileOffset; + __le64 ByteCount; /* Bytes to be copied */ + __le32 Flags; + __le32 Reserved; +} __packed; + + +/* See MS-FSCC 2.3.20 */ +struct fsctl_get_integrity_information_rsp { + __le16 ChecksumAlgorithm; + __le16 Reserved; + __le32 Flags; + __le32 ChecksumChunkSizeInBytes; + __le32 ClusterSizeInBytes; +} __packed; + +/* See MS-FSCC 2.3.55 */ +struct fsctl_query_file_regions_req { + __le64 FileOffset; + __le64 Length; + __le32 DesiredUsage; + __le32 Reserved; +} __packed; + +/* DesiredUsage flags see MS-FSCC 2.3.56.1 */ +#define FILE_USAGE_INVALID_RANGE 0x00000000 +#define FILE_USAGE_VALID_CACHED_DATA 0x00000001 +#define FILE_USAGE_NONCACHED_DATA 0x00000002 + +struct file_region_info { + __le64 FileOffset; + __le64 Length; + __le32 DesiredUsage; + __le32 Reserved; +} __packed; + +/* See MS-FSCC 2.3.56 */ +struct fsctl_query_file_region_rsp { + __le32 Flags; + __le32 TotalRegionEntryCount; + __le32 RegionEntryCount; + __u32 Reserved; + struct file_region_info Regions[]; +} __packed; + +/* See MS-FSCC 2.3.58 */ +struct fsctl_query_on_disk_vol_info_rsp { + __le64 DirectoryCount; + __le64 FileCount; + __le16 FsFormatMajVersion; + __le16 FsFormatMinVersion; + __u8 FsFormatName[24]; + __le64 FormatTime; + __le64 LastUpdateTime; + __u8 CopyrightInfo[68]; + __u8 AbstractInfo[68]; + __u8 FormatImplInfo[68]; + __u8 LastModifyImplInfo[68]; +} __packed; + +/* See MS-FSCC 2.3.73 */ +struct fsctl_set_integrity_information_req { + __le16 ChecksumAlgorithm; + __le16 Reserved; + __le32 Flags; +} __packed; + +/* See MS-FSCC 2.3.75 */ +struct fsctl_set_integrity_info_ex_req { + __u8 EnableIntegrity; + __u8 KeepState; + __u16 Reserved; + __le32 Flags; + __u8 Version; + __u8 Reserved2[7]; +} __packed; + +/* Integrity ChecksumAlgorithm choices for above */ +#define CHECKSUM_TYPE_NONE 0x0000 +#define CHECKSUM_TYPE_CRC64 0x0002 +#define CHECKSUM_TYPE_UNCHANGED 0xFFFF /* set only */ + +/* Integrity flags for above */ +#define FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF 0x00000001 + /* Reparse structures - see MS-FSCC 2.1.2 */ /* struct fsctl_reparse_info_req is empty, only response structs (see below) */ @@ -1304,13 +1404,6 @@ struct validate_negotiate_info_rsp { __le16 Dialect; /* Dialect in use for the connection */ } __packed; -struct duplicate_extents_to_file { - __u64 PersistentFileHandle; /* source file handle, opaque endianness */ - __u64 VolatileFileHandle; - __le64 SourceFileOffset; - __le64 TargetFileOffset; - __le64 ByteCount; /* Bytes to be copied */ -} __packed; /* Possible InfoType values */ #define SMB2_O_INFO_FILE 0x01 @@ -1419,6 +1512,7 @@ struct smb2_query_info_rsp { * PDU query infolevel structure definitions */ +/* See MS-FSCC 2.3.52 */ struct file_allocated_range_buffer { __le64 file_offset; __le64 length; -- 2.34.1