From patchwork Wed Feb 13 05:47:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 10809137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 826D1139A for ; Wed, 13 Feb 2019 05:47:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ECDA2BD6B for ; Wed, 13 Feb 2019 05:47:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F7022BD70; Wed, 13 Feb 2019 05:47:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C83F92BD6B for ; Wed, 13 Feb 2019 05:47:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727666AbfBMFrq (ORCPT ); Wed, 13 Feb 2019 00:47:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56940 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725562AbfBMFrp (ORCPT ); Wed, 13 Feb 2019 00:47:45 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DAD6B10FA5; Wed, 13 Feb 2019 05:47:45 +0000 (UTC) Received: from test1135.test.redhat.com (vpn2-54-96.bne.redhat.com [10.64.54.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 699EC101E846; Wed, 13 Feb 2019 05:47:45 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 1/2] smbinfo: Update the usage text with the new infolevels Date: Wed, 13 Feb 2019 15:47:36 +1000 Message-Id: <20190213054737.31425-2-lsahlber@redhat.com> In-Reply-To: <20190213054737.31425-1-lsahlber@redhat.com> References: <20190213054737.31425-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 13 Feb 2019 05:47:45 +0000 (UTC) Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ronnie Sahlberg --- smbinfo.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/smbinfo.c b/smbinfo.c index de9ebf6..c2cea9e 100644 --- a/smbinfo.c +++ b/smbinfo.c @@ -57,6 +57,24 @@ usage(char *name) { fprintf(stderr, "Usage: %s \n" "Commands are\n" + " fileaccessinfo:\n" + " Prints FileAccessInfo for a cifs file.\n" + " filealigninfo:\n" + " Prints FileAlignInfo for a cifs file.\n" + " fileallinfo:\n" + " Prints FileAllInfo for a cifs file.\n" + " filebasicinfo:\n" + " Prints FileBasicInfo for a cifs file.\n" + " fileeainfo:\n" + " Prints FileEAInfo for a cifs file.\n" + " fileinternalinfo:\n" + " Prints FileInternalInfo for a cifs file.\n" + " filemodeinfo:\n" + " Prints FileModeInfo for a cifs file.\n" + " filepositioninfo:\n" + " Prints FilePositionInfo for a cifs file.\n" + " filestandardinfo:\n" + " Prints FileStandardInfo for a cifs file.\n" " secdesc:\n" " Prints the security descriptor for a cifs file.\n" " quota:\n" From patchwork Wed Feb 13 05:47:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 10809141 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B430D139A for ; Wed, 13 Feb 2019 05:47:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A29B42BD6B for ; Wed, 13 Feb 2019 05:47:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9731F2BD70; Wed, 13 Feb 2019 05:47:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F0742BD6B for ; Wed, 13 Feb 2019 05:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729004AbfBMFru (ORCPT ); Wed, 13 Feb 2019 00:47:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60152 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725562AbfBMFrt (ORCPT ); Wed, 13 Feb 2019 00:47:49 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8BB756696E; Wed, 13 Feb 2019 05:47:49 +0000 (UTC) Received: from test1135.test.redhat.com (vpn2-54-96.bne.redhat.com [10.64.54.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF5335D9D1; Wed, 13 Feb 2019 05:47:48 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH 2/2] smbinfo: add FileFsFullSizeInformation Date: Wed, 13 Feb 2019 15:47:37 +1000 Message-Id: <20190213054737.31425-3-lsahlber@redhat.com> In-Reply-To: <20190213054737.31425-1-lsahlber@redhat.com> References: <20190213054737.31425-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 13 Feb 2019 05:47:49 +0000 (UTC) Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ronnie Sahlberg --- smbinfo.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ smbinfo.rst | 2 ++ 2 files changed, 51 insertions(+) diff --git a/smbinfo.c b/smbinfo.c index c2cea9e..6375db7 100644 --- a/smbinfo.c +++ b/smbinfo.c @@ -67,6 +67,8 @@ usage(char *name) " Prints FileBasicInfo for a cifs file.\n" " fileeainfo:\n" " Prints FileEAInfo for a cifs file.\n" + " filefsfullsizeinfo:\n" + " Prints FileFsFullSizeInfo for a cifs share.\n" " fileinternalinfo:\n" " Prints FileInternalInfo for a cifs file.\n" " filemodeinfo:\n" @@ -492,6 +494,51 @@ fileeainfo(int f) free(qi); } +static void +print_filefullsizeinfo(uint8_t *sd) +{ + uint32_t u32; + uint64_t u64; + + memcpy(&u64, &sd[0], 8); + printf("Total Allocation Units: %" PRIu64 "\n", le64toh(u64)); + + memcpy(&u64, &sd[8], 8); + printf("Caller Available Allocation Units: %" PRIu64 "\n", + le64toh(u64)); + + memcpy(&u64, &sd[16], 8); + printf("Actual Available Allocation Units: %" PRIu64 "\n", + le64toh(u64)); + + memcpy(&u32, &sd[24], 4); + printf("Sectors Per Allocation Unit: %" PRIu32 "\n", le32toh(u32)); + + memcpy(&u32, &sd[28], 4); + printf("Bytes Per Sector: %" PRIu32 "\n", le32toh(u32)); +} + +static void +filefsfullsizeinfo(int f) +{ + struct smb_query_info *qi; + + qi = malloc(sizeof(struct smb_query_info) + 32); + memset(qi, 0, sizeof(qi) + 32); + qi->info_type = 0x02; + qi->file_info_class = 7; + qi->additional_information = 0; + qi->input_buffer_length = 32; + + if (ioctl(f, CIFS_QUERY_INFO, qi) < 0) { + fprintf(stderr, "ioctl failed with %s\n", strerror(errno)); + exit(1); + } + + print_filefullsizeinfo((uint8_t *)(&qi[1])); + free(qi); +} + static void fileallinfo(int f) { @@ -759,6 +806,8 @@ int main(int argc, char *argv[]) filebasicinfo(f); else if (!strcmp(argv[1], "fileeainfo")) fileeainfo(f); + else if (!strcmp(argv[1], "filefsfullsizeinfo")) + filefsfullsizeinfo(f); else if (!strcmp(argv[1], "fileinternalinfo")) fileinternalinfo(f); else if (!strcmp(argv[1], "filemodeinfo")) diff --git a/smbinfo.rst b/smbinfo.rst index 2119f93..7bdbda4 100644 --- a/smbinfo.rst +++ b/smbinfo.rst @@ -49,6 +49,8 @@ COMMAND `fileeainfo`: Prints the FileEaInformation class +`filefsfullsizeinfo`: Prints the FileFsFullSizeInformation class + `fileinternalinfo`: Prints the FileInternalInformation class `filemodeinfo`: Prints the FileModeInformation class