All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Martijn Coenen <maco@android.com>, axboe@kernel.dk, hch@lst.de
Cc: Chaitanya.Kulkarni@wdc.com, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH] loop: Add LOOP_SET_FD_WITH_OFFSET ioctl.
Date: Sun, 29 Mar 2020 13:19:59 -0700	[thread overview]
Message-ID: <81b67b60-5b2f-f98f-f5df-1ddc2b2ae6b4@acm.org> (raw)
In-Reply-To: <20200329140459.18155-1-maco@android.com>

On 2020-03-29 07:04, Martijn Coenen wrote:
> -static int loop_set_fd(struct loop_device *lo, fmode_t mode,
> -		       struct block_device *bdev, unsigned int arg)
> +static int loop_set_fd_with_offset(struct loop_device *lo, fmode_t mode,
> +		struct block_device *bdev, unsigned int arg, loff_t offset)

Since this function has to be modified, please add an additional patch
to rename 'arg' into 'fd'. Additionally, how about renaming
"loop_set_fd_with_offset" into "loop_set_fd_and_offset"? I think the
latter name reflects more clearly the purpose of this function.

> @@ -1624,6 +1625,17 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
>  		break;
>  	case LOOP_GET_STATUS64:
>  		return loop_get_status64(lo, (struct loop_info64 __user *) arg);
> +	case LOOP_SET_FD_WITH_OFFSET: {
> +		struct loop_fd_with_offset fdwo;
> +
> +		if (copy_from_user(&fdwo,
> +				(struct loop_fd_with_offset __user *) arg,
> +				sizeof(struct loop_fd_with_offset)))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The kernel code that I'm familiar with uses sizeof(<variable name>)
instead of sizeof(<struct name>). That makes it less likely that
changing the type of the variable will introduce a mismatch between the
sizeof() expression and the size of the variable.

Thanks,

Bart.

  parent reply	other threads:[~2020-03-29 20:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29 14:04 [PATCH] loop: Add LOOP_SET_FD_WITH_OFFSET ioctl Martijn Coenen
2020-03-29 16:48 ` Chaitanya Kulkarni
2020-03-29 20:19 ` Bart Van Assche [this message]
2020-03-30  1:00 ` Ming Lei
2020-03-30  8:06   ` Martijn Coenen
2020-03-31  7:48     ` Christoph Hellwig
2020-03-31 11:25       ` Martijn Coenen
2020-03-31 11:40 Martijn Coenen
2020-03-31 11:42 ` Martijn Coenen

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=81b67b60-5b2f-f98f-f5df-1ddc2b2ae6b4@acm.org \
    --to=bvanassche@acm.org \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kernel-team@android.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.