From: Randy Dunlap <rdunlap@infradead.org>
To: Lukas Prediger <lumip@lumip.de>
Cc: axboe@kernel.dk, hch@infradead.org, linux-kernel@vger.kernel.org,
phil@philpotter.co.uk
Subject: Re: [PATCH v2] drivers/cdrom: improved ioctl for media change detection
Date: Thu, 9 Sep 2021 18:25:35 -0700 [thread overview]
Message-ID: <10f60086-2be0-d26d-dfa6-fe128772a409@infradead.org> (raw)
In-Reply-To: <20210909180553.8299-1-lumip@lumip.de>
On 9/9/21 11:05 AM, Lukas Prediger wrote:
>>> As this is not a packed struct, would not a smaller value still take up
>>> the same space?
>> Might as well be explicit about it and also make it obvious that there
>> is some space available for other fields.
> I had this as a __u8 in the first submission but Jens asked me to change it.
> From his feedback on this:
>
> "The struct layout should be modified such that there are no holes or
> padding in it. Probably just make the has_changed a flags thing, and
> make it u64 as well. Then you can define bit 0 to be HAS_CHANGED, and
> that leaves you room to add more flags in the future."
> https://lore.kernel.org/lkml/6d6c533d-465e-33ee-5801-cb7ea84924a8@kernel.dk/
>
> I changed it to __u64 to address this. We could think about turning it
> back to a __u8 (or bool) and add some explicit padding members
> (a __u8 reserved[3]?), but honestly I don't see much real benefit in that
> compared to how it is now.
I have no problem with Jens's suggestion. It would look more like this:
+{
+ __s64 last_media_change; /* Timestamp of the last detected media
+ * change in ms. May be set by caller, updated
+ * upon successful return of ioctl.
+ */
+ __u64 media_flags; /* various <struct> flags */
#define MEDIA_CHANGED 0x1 /* Set to 1 by ioctl if last detected media */
/* other bits of media_flags available for future use */
and not having __u64 has_changed;
which is overkill for a flag.
--
~Randy
next prev parent reply other threads:[~2021-09-10 1:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-29 14:37 [PATCH v2] drivers/cdrom: improved ioctl for media change detection Lukas Prediger
2021-09-06 20:11 ` Jens Axboe
2021-09-06 22:57 ` Phillip Potter
2021-09-08 23:51 ` Phillip Potter
2021-09-09 18:04 ` Lukas Prediger
2021-09-09 23:07 ` Phillip Potter
2021-09-07 6:35 ` Christoph Hellwig
2021-09-09 0:17 ` Phillip Potter
2021-09-09 0:42 ` Randy Dunlap
2021-09-09 18:05 ` Lukas Prediger
2021-09-09 23:20 ` Phillip Potter
2021-09-10 1:25 ` Randy Dunlap [this message]
2021-09-10 7:59 ` Phillip Potter
2021-09-09 23:00 ` Phillip Potter
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=10f60086-2be0-d26d-dfa6-fe128772a409@infradead.org \
--to=rdunlap@infradead.org \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumip@lumip.de \
--cc=phil@philpotter.co.uk \
/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).