From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jeff Sharkey <jsharkey@android.com>
Cc: Jin Qian <jinqian@android.com>, "Ning, Yu" <yu.ning@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
David Turner <digit@google.com>,
"pprabhu@google.com" <pprabhu@google.com>
Subject: Re: allocate an official device major number for virtio device?
Date: Thu, 3 Mar 2016 14:43:35 -0800 [thread overview]
Message-ID: <20160303224335.GA19410@kroah.com> (raw)
In-Reply-To: <CAA=BWVbpwF2W6v0efA+NkeEHVK-3fF4_NhDPJBGgVRpchvH8jA@mail.gmail.com>
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
On Thu, Mar 03, 2016 at 03:12:04PM -0700, Jeff Sharkey wrote:
> Adding a bit more context, in Android when we receive a uevent about a
> new disk we use a separate userspace utility (sgdisk) to inspect the
> partitions it contains, and we construct our own mknod() for the
> partitions that we're interested in. (We're doing this manually
> because Android doesn't have devtmpfs.)
Note, you can easily fix the 'no devtmpfs' issue :)
Well, not "easily" but note that because Android diverged from the
traditional (i.e. standard) device naming scheme, you all really are on
your own here, this is your own hole you have dug yourself into, I have
very little sympathy at all, sorry.
> Disks with GPT can have up to 128 partitions, but when mknod()'ing the
> partition devices I need to carefully ignore any partitions beyond the
> maximum number of partitions supported by the underlying device
> system, otherwise I risk jumping into the next disk. The maximum
> number of partitions appears to be well-known for certain major device
> numbers (Documentation/devices.txt says 15 for SCSI, or reading
> perdev_minors for MMC).
>
> Is there a good way to determine this upper limit for disks surfaced
> through virtio_blk? Currently I've been using the major device number
> as a heuristic, which is what kicked off this entire discussion.
The kernel should know about this already, doesn't /sys/dev/block/
already contain pointers to the known partitions? If not, how are you
creating a partition that the kernel doesn't know about?
And why not just use libudev and the disk probing tools that it provides
already for all of this instead of using something "non-standard" (i.e.
sgdisk)? It already has worked all of this out for you, why reimplement
the wheel again?
thanks,
greg k-h
next prev parent reply other threads:[~2016-03-03 22:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 1:08 allocate an official device major number for virtio device? Jin Qian
2016-03-03 1:25 ` Greg Kroah-Hartman
2016-03-03 1:48 ` Jin Qian
2016-03-03 3:52 ` Ning, Yu
2016-03-03 14:46 ` One Thousand Gnomes
2016-03-03 17:18 ` Greg Kroah-Hartman
2016-03-03 19:32 ` Jin Qian
2016-03-03 20:00 ` Greg Kroah-Hartman
2016-03-03 22:12 ` Jeff Sharkey
2016-03-03 22:35 ` Richard Weinberger
2016-03-03 22:43 ` Greg Kroah-Hartman [this message]
2016-03-03 17:17 ` Greg Kroah-Hartman
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=20160303224335.GA19410@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=digit@google.com \
--cc=jinqian@android.com \
--cc=jsharkey@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pprabhu@google.com \
--cc=yu.ning@intel.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