diff mbox

[1/3] Data structures and defines for Named Pipes

Message ID 4a4634330910151040r3a61019m66b6ddcb648111cd@mail.gmail.com
State New
Headers show

Commit Message

Shirish Pargaonkar Oct. 15, 2009, 5:40 p.m. UTC
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 <shirishpargaonkar@gmail.com>
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 */

Comments

Christoph Hellwig Oct. 15, 2009, 6:12 p.m. UTC | #1
On Thu, Oct 15, 2009 at 12:40:00PM -0500, Shirish Pargaonkar wrote:
> Add data structures and defines (ioctl commands etc.) for Named Pipe
> support in cifs

I don't think this stuff has any place in the kernel.  Just implement
the named pipes directly in wine.
diff mbox

Patch

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);