From: Bart Van Assche <bvanassche@acm.org>
To: Martijn Coenen <maco@android.com>,
axboe@kernel.dk, hch@lst.de, ming.lei@redhat.com
Cc: narayan@google.com, zezeozue@google.com, kernel-team@android.com,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
maco@google.com, Chaitanya.Kulkarni@wdc.com
Subject: Re: [PATCH 2/4] loop: Factor out configuring loop from status.
Date: Mon, 20 Apr 2020 06:34:24 -0700 [thread overview]
Message-ID: <50090c2e-d882-507f-43a7-5ed76c36390c@acm.org> (raw)
In-Reply-To: <20200420080409.111693-3-maco@android.com>
On 4/20/20 1:04 AM, Martijn Coenen wrote:
No trailing dot at the end of a patch subject please.
> static int
> -loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
> +loop_set_from_status(struct loop_device *lo, const struct loop_info64 *info)
> {
> int err;
> struct loop_func_table *xfer;
> kuid_t uid = current_uid();
> +
> + if ((unsigned int) info->lo_encrypt_key_size > LO_KEY_SIZE)
> + return -EINVAL;
> +
> + err = loop_release_xfer(lo);
> + if (err)
> + return err;
> +
> + if (info->lo_encrypt_type) {
> + unsigned int type = info->lo_encrypt_type;
> +
> + if (type >= MAX_LO_CRYPT)
> + return -EINVAL;
> + xfer = xfer_funcs[type];
> + if (xfer == NULL)
> + return -EINVAL;
> + } else
> + xfer = NULL;
> +
> + err = loop_init_xfer(lo, xfer, info);
> + if (err)
> + return err;
> +
> + lo->lo_offset = info->lo_offset;
> + lo->lo_sizelimit = info->lo_sizelimit;
> + memcpy(lo->lo_file_name, info->lo_file_name, LO_NAME_SIZE);
> + memcpy(lo->lo_crypt_name, info->lo_crypt_name, LO_NAME_SIZE);
> + lo->lo_file_name[LO_NAME_SIZE-1] = 0;
> + lo->lo_crypt_name[LO_NAME_SIZE-1] = 0;
> +
> + if (!xfer)
> + xfer = &none_funcs;
> + lo->transfer = xfer->transfer;
> + lo->ioctl = xfer->ioctl;
> +
> + if ((lo->lo_flags & LO_FLAGS_AUTOCLEAR) !=
> + (info->lo_flags & LO_FLAGS_AUTOCLEAR))
> + lo->lo_flags ^= LO_FLAGS_AUTOCLEAR;
> +
> + lo->lo_encrypt_key_size = info->lo_encrypt_key_size;
> + lo->lo_init[0] = info->lo_init[0];
> + lo->lo_init[1] = info->lo_init[1];
> + if (info->lo_encrypt_key_size) {
> + memcpy(lo->lo_encrypt_key, info->lo_encrypt_key,
> + info->lo_encrypt_key_size);
> + lo->lo_key_owner = uid;
> + }
> +
> + return 0;
> +}
Please add a (one line?) comment above this function that explains the
purpose of this function. Is the purpose of this function perhaps to
initialize loop device parameters based on the information received from
user space (the 'info' argument)?
Thanks,
Bart.
next prev parent reply other threads:[~2020-04-20 13:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 8:04 [PATCH 0/4] Add a new LOOP_SET_FD_AND_STATUS ioctl Martijn Coenen
2020-04-20 8:04 ` [PATCH 1/4] loop: Refactor size calculation Martijn Coenen
2020-04-20 13:22 ` Bart Van Assche
2020-04-21 11:48 ` Martijn Coenen
2020-04-21 15:26 ` Bart Van Assche
2020-04-20 8:04 ` [PATCH 2/4] loop: Factor out configuring loop from status Martijn Coenen
2020-04-20 13:34 ` Bart Van Assche [this message]
2020-04-20 13:49 ` Bart Van Assche
2020-04-21 11:46 ` Martijn Coenen
2020-04-20 8:04 ` [PATCH 3/4] loop: Move loop_set_from_status() and friends up Martijn Coenen
2020-04-20 13:43 ` Bart Van Assche
2020-04-20 8:04 ` [PATCH 4/4] loop: Add LOOP_SET_FD_AND_STATUS ioctl Martijn Coenen
2020-04-22 6:19 ` Christoph Hellwig
2020-04-22 8:06 ` Martijn Coenen
2020-04-22 8:07 ` Christoph Hellwig
2020-04-22 15:10 ` Bart Van Assche
2020-04-27 7: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=50090c2e-d882-507f-43a7-5ed76c36390c@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 \
--cc=maco@google.com \
--cc=ming.lei@redhat.com \
--cc=narayan@google.com \
--cc=zezeozue@google.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;
as well as URLs for NNTP newsgroup(s).