mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: bintian.wang@linaro.org
Cc: linux-kernel@vger.kernel.org,
	Mike Lockwood <lockwood@android.com>,
	dmitry pervushin <dpervushin@gmail.com>,
	Colin Cross <ccross@android.com>,
	Android Kernel Team <kernel-team@android.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	John Stultz <john.stultz@linaro.org>
Subject: Re: [PATCH RFC] Add FAT_IOCTL_GET_VOLUME_ID
Date: Mon, 01 Jul 2013 21:00:54 +0900	[thread overview]
Message-ID: <87mwq6ij61.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <1372678828-11776-1-git-send-email-bintian.wang@linaro.org> (bintian wang's message of "Mon, 1 Jul 2013 19:40:28 +0800")

bintian.wang@linaro.org writes:

> From: Mike Lockwood <lockwood@android.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@mail.parknet.co.jp>

  reply	other threads:[~2013-07-01 12:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01 11:40 bintian.wang
2013-07-01 12:00 ` OGAWA Hirofumi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-07-03  2:19 bintian.wang
2013-07-03  3:22 ` OGAWA Hirofumi
2013-07-01  2:39 bintian.wang
2013-07-01  6:12 ` OGAWA Hirofumi
2013-07-01  6:19   ` OGAWA Hirofumi
     [not found]     ` <CAJ2TvK=SVMfuFw+U46z-iCS1sYZgnmdk+sr30NeNFTayot7g8g@mail.gmail.com>
     [not found]       ` <CAO+d-qrq9XD2d0FtoA7ZkCsSkka0sfgERb-OeNoU2kLXpF+PVA@mail.gmail.com>
2013-07-01  9:29         ` OGAWA Hirofumi
     [not found]           ` <CAO+d-qqs0uUqNcmOhgZdKeaJQxd5y+TyKVFSpgknoUkX2YidfQ@mail.gmail.com>
2013-07-01 11:43             ` OGAWA Hirofumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwq6ij61.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=bintian.wang@linaro.org \
    --cc=ccross@android.com \
    --cc=dpervushin@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lockwood@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®