From patchwork Thu May 16 08:49:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Pervushin X-Patchwork-Id: 16975 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f198.google.com (mail-ye0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B02C923903 for ; Thu, 16 May 2013 08:50:18 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m13sf3144452yen.5 for ; Thu, 16 May 2013 01:49:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=sZBksBnp5Z5jndHgENheKcsiIgYl9dBqYhze5+LcF3I=; b=SVDcYuefzsksTW8atifunZJqVt1LvSybu7apINTjF9M5HuEHIDtIX2ROyWsVHmgFo4 B3+fGQduyAsfKahgwkvk4WfqxIz+r7o3YkH/JO+nhP8SPm34vLIRPnDUGUvv/iwdMpxv a+83DrHSJ5qcTfRXfDFgGv87g9CynnLXdw3UryUdDsGN3Rb1Segd+ORhlmfkV+4f6Rco phmCflAcZg0uYPfphv0ZQl0HjxErUeVTdX7z1oSmbQLxp1q6WbpnJYAgoYcxlSMLgAVs YFhRbHnofB72VezCiVieXZtwMIiU02EGPtoVwkD/3tcmrav12s2WoficGjmXKpEdO9Ri h8qw== X-Received: by 10.224.217.195 with SMTP id hn3mr25382953qab.5.1368694179914; Thu, 16 May 2013 01:49:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.118.104 with SMTP id kl8ls1110541qeb.78.gmail; Thu, 16 May 2013 01:49:39 -0700 (PDT) X-Received: by 10.58.208.228 with SMTP id mh4mr14525704vec.23.1368694179766; Thu, 16 May 2013 01:49:39 -0700 (PDT) Received: from mail-vb0-x232.google.com (mail-vb0-x232.google.com [2607:f8b0:400c:c02::232]) by mx.google.com with ESMTPS id sc6si3454561vdc.8.2013.05.16.01.49.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 01:49:39 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::232; Received: by mail-vb0-f50.google.com with SMTP id w15so60759vbb.23 for ; Thu, 16 May 2013 01:49:39 -0700 (PDT) X-Received: by 10.220.46.197 with SMTP id k5mr27624350vcf.40.1368694179564; Thu, 16 May 2013 01:49:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp54527vcs; Thu, 16 May 2013 01:49:38 -0700 (PDT) X-Received: by 10.181.12.1 with SMTP id em1mr22476803wid.4.1368694178562; Thu, 16 May 2013 01:49:38 -0700 (PDT) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [2a00:1450:400c:c05::232]) by mx.google.com with ESMTPS id dd6si1004476wib.71.2013.05.16.01.49.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 01:49:38 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::232 is neither permitted nor denied by best guess record for domain of dmitry.pervushin@linaro.org) client-ip=2a00:1450:400c:c05::232; Received: by mail-wi0-f178.google.com with SMTP id ey16so2457499wid.5 for ; Thu, 16 May 2013 01:49:38 -0700 (PDT) X-Received: by 10.180.205.206 with SMTP id li14mr22056275wic.33.1368694178186; Thu, 16 May 2013 01:49:38 -0700 (PDT) Received: from localhost.localdomain (ANice-652-1-300-72.w83-197.abo.wanadoo.fr. [83.197.63.72]) by mx.google.com with ESMTPSA id d5sm2269026wic.1.2013.05.16.01.49.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 01:49:37 -0700 (PDT) From: dmitry pervushin To: axel.fagerstedt@linaro.org Cc: patches@linaro.org, dmitry pervushin Subject: [PATCH 2/3] VFAT GET_VOLUME_ID ioctl Date: Thu, 16 May 2013 10:49:03 +0200 Message-Id: <1368694144-20863-2-git-send-email-dmitry.pervushin@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1368694144-20863-1-git-send-email-dmitry.pervushin@linaro.org> References: <1368694144-20863-1-git-send-email-dmitry.pervushin@linaro.org> X-Gm-Message-State: ALoCoQk6Xe7ixHiQ0+ciqALwd31A0U+dj0iEfAkOMK4z3OubQntBe+wlffuHWQQY/OTYGPfHsLc6 X-Original-Sender: dmitry.pervushin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add VFAT_GET_VOLUME_ID ioctl, which returns the volume id via passed pointer to u32 --- fs/fat/dir.c | 22 +++++++++++++++++++--- include/uapi/linux/msdos_fs.h | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/fs/fat/dir.c b/fs/fat/dir.c index eef52ee..37849b1 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c @@ -783,6 +783,24 @@ static int fat_ioctl_volume_id(struct inode *dir) return sbi->vol_id; } +static long fat_dir_generic_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) +{ + struct inode *inode = file_inode(filp); + u32 id; + + switch (cmd) { + case VFAT_IOCTL_GET_VOLUME_ID_BROKEN: + return fat_ioctl_volume_id(inode); + case VFAT_IOCTL_GET_VOLUME_ID: + if (inode->i_ino != MSDOS_ROOT_INO) + return -EINVAL; + id = fat_ioctl_volume_id(inode); + return copy_to_user((u32 *)arg, &id, sizeof(id)); + } + return fat_generic_ioctl(filp, cmd, arg); +} + static long fat_dir_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { @@ -799,10 +817,8 @@ static long fat_dir_ioctl(struct file *filp, unsigned int cmd, short_only = 0; both = 1; break; - case VFAT_IOCTL_GET_VOLUME_ID_BROKEN: - return fat_ioctl_volume_id(inode); default: - return fat_generic_ioctl(filp, cmd, arg); + return fat_dir_generic_ioctl(filp, cmd, arg); } if (!access_ok(VERIFY_WRITE, d1, sizeof(struct __fat_dirent[2]))) diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h index fddfc61..b322512 100644 --- a/include/uapi/linux/msdos_fs.h +++ b/include/uapi/linux/msdos_fs.h @@ -105,6 +105,7 @@ struct __fat_dirent { #define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) #define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) #define VFAT_IOCTL_GET_VOLUME_ID_BROKEN _IOR('r', 0x12, __u32) +#define VFAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x13, __u32) struct fat_boot_sector { __u8 ignored[3]; /* Boot strap short or near jump */