From patchwork Thu Oct 15 17:40:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 36133 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by ozlabs.org (Postfix) with ESMTP id C4DE2B7B83 for ; Fri, 16 Oct 2009 04:40:07 +1100 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 8072AAD1DC; Thu, 15 Oct 2009 11:38:56 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.8 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mail-gx0-f222.google.com (mail-gx0-f222.google.com [209.85.217.222]) by lists.samba.org (Postfix) with ESMTP id 950E3AD186 for ; Thu, 15 Oct 2009 11:38:50 -0600 (MDT) Received: by gxk22 with SMTP id 22so1173730gxk.0 for ; Thu, 15 Oct 2009 10:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=YzLA62LDoVXWB16mkdt7/DdsHv5v6TRMTs+TF31m8EU=; b=xvDY5vAr5Gm4UcLcfgZ+vikdqYkSlAFb6m80jeb8BjWsgn5k6Odtqbh+nmB6DIBDag ITBa6mEVH3HJHAq0lHuTePCa+oCPL7P2cD46uhDw0RcGtlvAZJs2vQA648p4HjbjDe7V Iv1IeZwwbCptPMQG2mejiRFP6EzEYdsoVvjVQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=SnfOAoGDqfGFoURn8P9hFuRAWuMdpXUGjTiBNrG4IG3A2td2xF+aTB7bUUghHJstz7 t3kzIViVnTJnA/2hk+72BVtCDGPVvRANlMF0A/5Zm/8C8Me5Q7so68OO3tQ1dW0ZIe26 jFo46VaJUw4/3wtDY04z+Fpl2TF0D6WeOlNZE= MIME-Version: 1.0 Received: by 10.101.57.14 with SMTP id j14mr511971ank.105.1255628400336; Thu, 15 Oct 2009 10:40:00 -0700 (PDT) Date: Thu, 15 Oct 2009 12:40:00 -0500 Message-ID: <4a4634330910151040r3a61019m66b6ddcb648111cd@mail.gmail.com> From: Shirish Pargaonkar To: linux-cifs-client@lists.samba.org, linux-fsdevel Subject: [linux-cifs-client] [patch][1/3] Data structures and defines for Named Pipes X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org Add data structures and defines (ioctl commands etc.) for Named Pipe support in cifs From 02cc49c80d125beac34cf82d312f5f221311dd62 Mon Sep 17 00:00:00 2001 From: Shirish Pargaonkar Date: Thu, 15 Oct 2009 08:14:44 -0500 Subject: [PATCH] Header file changes for Named Pipe support --- fs/cifs/cifsglob.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/cifs/cifspdu.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ fs/cifs/cifsproto.h | 15 +++++++++++++++ 3 files changed, 108 insertions(+), 0 deletions(-) #endif /* _CIFSPROTO_H */ diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 5d0fde1..6ee9dae 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -612,6 +612,54 @@ require use of the stronger protocol */ ***************************************************************** */ +/* + ***************************************************************** + * Named Pipe data structures and ioctl commands + ***************************************************************** + */ + +#define MAXPIPENAMELEN 256 +#define MAXPEEKNMBUFSIZE 8192 + +struct qnmp_info { + unsigned short outbuf; + unsigned short inbuf; + unsigned char maxinst; + unsigned char curinst; + unsigned char length; + char pipename[MAXPIPENAMELEN]; +}; + +struct qnmp_hinfo { + unsigned short mode; +}; + +struct peeknmp_info { + unsigned int size; + unsigned short bavail; + unsigned short bremain; + unsigned short conntype; + char buffer[MAXPEEKNMBUFSIZE]; +}; + +struct transnmp_info { + unsigned int wsize; + char sendbuf[MAXPEEKNMBUFSIZE]; + unsigned rsize; + char recvbuf[MAXPEEKNMBUFSIZE]; +}; + +#define CIFS_QUERYNMPIPE _IOR(0xCF, 0x3, struct qnmp_info) +#define CIFS_PEEKNMPIPE _IOWR(0xCF, 0x4, struct peeknmp_info) +#define CIFS_GETNMPIPEHANDSTATE _IOR(0xCF, 0x5, struct qnmp_hinfo) +#define CIFS_SETNMPIPEHANDSTATE _IOW(0xCF, 0x6, struct qnmp_hinfo) +#define CIFS_TRANSACTNMPIPE _IOWR(0xCF, 0x7, struct qnmp_hinfo) + +#define NONBLOCKINGNMPIPE 0x0008 +#define BLOCKINGNMPIPE 0x0004 +#define MESSAGENMREAD 0x0002 +#define BYTESTREAMNMREAD 0x0001 + #define UID_HASH (16) /* diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 2d07f89..df922dc 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h @@ -49,6 +49,7 @@ #define SMB_COM_QUERY_INFORMATION 0x08 /* aka getattr */ #define SMB_COM_SETATTR 0x09 /* trivial response */ #define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */ +#define SMB_COM_TRANSACTION 0x25 #define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/ #define SMB_COM_OPEN_ANDX 0x2D /* Legacy open for old servers */ #define SMB_COM_READ_ANDX 0x2E @@ -1269,6 +1270,50 @@ typedef struct smb_com_ntransact_rsp { /* parms and data follow */ } __attribute__((packed)) NTRANSACT_RSP; +typedef struct smb_com_transact_req { + struct smb_hdr hdr; /* wct >= 19 */ + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; + __u8 MaxSetupCount; + __u8 Reserved; + __u16 Flags; + __le32 Timeout; + __le16 Reserved1; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; + __u8 SetupCount; + __u8 Reserved2; + __le16 Function; + __le16 Fid; + __le16 ByteCount; + unsigned char pad[1]; + unsigned char Name[1]; + unsigned char Param[1]; + unsigned char Data[1]; +} __attribute__((packed)) TRANS_REQ; + +typedef struct smb_com_transact_rsp { + struct smb_hdr hdr; /* wct = 18 */ + __u16 Reserved; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; + __u8 SetupCount; /* 0 */ + __u16 ByteCount; + __u8 Reserved1; + /* __u8 Pad[3]; */ + /* parms and data follow */ +} __attribute__((packed)) TRANS_RSP; + typedef struct smb_com_transaction_ioctl_req { struct smb_hdr hdr; /* wct = 23 */ __u8 MaxSetupCount; diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 6928c24..21e553f 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -388,4 +388,19 @@ extern int CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon, const struct nls_table *nls_codepage, int remap_special_chars); extern int CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon, const int netfid, __u64 *pExtAttrBits, __u64 *pMask); +extern int CIFSSMBTransQNmPipe(const int, struct cifsTconInfo *, + unsigned long, __u16, const struct nls_table *, int); +extern int CIFSSMBTransSetNmPHState(const int, struct cifsTconInfo *, + unsigned long, __u16, const struct nls_table *, int); +extern int CIFSSMBTranWaitNmPipe(const int, struct cifsTconInfo *, + const unsigned char *, unsigned char *, + __u16, const struct nls_table *, int); +extern int CIFSSMBTransPeekNmPipe(const int, struct cifsTconInfo *, + unsigned long, __u16, const struct nls_table *, int); +extern int CIFSSMBTransGetNmPHState(const int, struct cifsTconInfo *, + unsigned long, __u16, const struct nls_table *, int); +extern int CIFSSMBTransNmPipe(const int, struct cifsTconInfo *, + unsigned char *, __u16, const struct nls_table *, int); +extern int ChkNMPHmode(unsigned short); +extern unsigned short SetNMPHmode(unsigned short, unsigned short);