From patchwork Thu Oct 15 17:44:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 54068 Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9FHiEA8001110 for ; Thu, 15 Oct 2009 17:44:14 GMT Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 66674AD24B; Thu, 15 Oct 2009 11:43:03 -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-yw0-f194.google.com (mail-yw0-f194.google.com [209.85.211.194]) by lists.samba.org (Postfix) with ESMTP id 798CEAD186 for ; Thu, 15 Oct 2009 11:42:57 -0600 (MDT) Received: by ywh32 with SMTP id 32so1006356ywh.14 for ; Thu, 15 Oct 2009 10:44:07 -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=VGPA8fvwKbeULuadCZuMkeTqyHPTVoocbsG2ywZ0iHA=; b=TrFKy4ZFopuhDg3xfg6DumFtjbh7tVF2/0jbVaTn1ol/he0JgxfmFne/8RdiYlWCEB 50chp2NhVvK13VxHblLGd7oLPpV5uGv4pwL4gLO9hhJ16jXAZ6fRkO6e2kmMa0L5hugs RIrY4+0v0H5R8S9gKUQzNHJVJ8eE1V9LCIjS0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=WREg/Zalgl31/cxIjInrFfKVkygQTmGuu1UNIyOX6OV5DoYFdXYr0ynv0pSWzglN/o m0kWoqA+kEItGODT3Snpy1z0AdZXpxDrdt+8kO9v9Ux4UFTIZsV/srPVV9IcON5LtRNT JbzxRXy04qNAJgjm9UKi+ArW7/L+GGEQI1Qto= MIME-Version: 1.0 Received: by 10.100.235.1 with SMTP id i1mr558083anh.40.1255628647242; Thu, 15 Oct 2009 10:44:07 -0700 (PDT) Date: Thu, 15 Oct 2009 12:44:06 -0500 Message-ID: <4a4634330910151044m2933483eydf653406bf599ccf@mail.gmail.com> From: Shirish Pargaonkar To: linux-cifs-client@lists.samba.org, linux-fsdevel Subject: [linux-cifs-client] [patch][3/3] ioctl calls 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 diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c index f946506..d351321 100644 --- a/fs/cifs/ioctl.c +++ b/fs/cifs/ioctl.c @@ -30,11 +30,46 @@ #define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) +int +ChkNMPHmode(unsigned short smode) +{ + int rc = -1; + + if ((smode & BYTESTREAMNMREAD) && (smode & MESSAGENMREAD)) { + cFYI(1, ("SetNMPHMode both bye and message read bytes set")); + return rc; + } + if ((smode & BLOCKINGNMPIPE) && (smode & NONBLOCKINGNMPIPE)) + return rc; + + return 0; +} + +unsigned short +SetNMPHmode(unsigned short smode, unsigned short cmode) +{ + unsigned short mode; + + mode = cmode; + + if (smode & NONBLOCKINGNMPIPE) + mode = mode & 0x7FFF; + if (smode & BLOCKINGNMPIPE) + mode = mode | 0x8000; + if (smode & BYTESTREAMNMREAD) + mode = mode & 0xFCFF; + if (smode & MESSAGENMREAD) + mode = mode | 0x0100; + + return mode; +} + long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) { struct inode *inode = filep->f_dentry->d_inode; int rc = -ENOTTY; /* strange error - but the precedent */ int xid; + unsigned short cmode, smode; struct cifs_sb_info *cifs_sb; #ifdef CONFIG_CIFS_POSIX __u64 ExtAttrBits = 0; @@ -60,6 +95,12 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) FreeXid(xid); return -EIO; } + + if (!pSMBFile && (command != CIFS_IOC_CHECKUMOUNT)) { + cFYI(1, ("cifs_ioctl: NULL file pointer")); + FreeXid(xid); + return -EBADF; + } #endif /* CONFIG_CIFS_POSIX */