[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87mwq6ij61.fsf@devron.myhome.or.jp>
Date: Mon, 01 Jul 2013 21:00:54 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: bintian.wang@...aro.org
Cc: linux-kernel@...r.kernel.org, Mike Lockwood <lockwood@...roid.com>,
dmitry pervushin <dpervushin@...il.com>,
Colin Cross <ccross@...roid.com>,
Android Kernel Team <kernel-team@...roid.com>,
Andrew Morton <akpm@...ux-foundation.org>,
John Stultz <john.stultz@...aro.org>
Subject: Re: [PATCH RFC] Add FAT_IOCTL_GET_VOLUME_ID
bintian.wang@...aro.org writes:
> From: Mike Lockwood <lockwood@...roid.com>
>
> Adds vfat ioctl command FAT_IOCTL_GET_VOLUME_ID, with this command
> we can get the vfat volume ID using following code:
>
> ioctl(fd, FAT_IOCTL_GET_VOLUME_ID, &volume_ID)
>
> This patch is a modified version of the android kernel patch by Mike Lockwood,
> the original patch makes the return value of ioctl() as the volume ID,
> Dmitry Pervushin noticed some volume IDs abiguous with error returns:
> for example, if volume id is set to "0xFFFFFDAD", that matches -ENOIOCTLCMD,
> we get a wrong volume ID "0xFFFFFFFF" from the user space.
>
> This patch fixes above bug by adding a parameter to ioctl to get the correct
> volume ID.
Personally, I have no objection to do this small one in kernel
though. Please add use case of android to changelog, it would help to
understand.
> +static unsigned int fat_ioctl_volume_id(struct inode *inode)
> +{
> + struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
> + return sbi->vol_id;
> +}
> +
> long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> {
> struct inode *inode = file_inode(filp);
> @@ -124,6 +130,8 @@ long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> return fat_ioctl_get_attributes(inode, user_attr);
> case FAT_IOCTL_SET_ATTRIBUTES:
> return fat_ioctl_set_attributes(filp, user_attr);
> + case FAT_IOCTL_GET_VOLUME_ID:
> + return put_user(fat_ioctl_volume_id(inode), user_attr);
> default:
> return -ENOTTY; /* Inappropriate ioctl for device */
> }
Please push put_user() down into fat_ioctl_volume_id() like others. So,
generic_ioctl() itself can forget about the detail of each ioctl.
Thanks.
--
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists