From: Karel Zak <kzak@redhat.com>
To: util-linux <util-linux@vger.kernel.org>, Davidlohr Bueso <dave@gnu.org>
Subject: Re: [PATCH 02/10] fdisk: API: add to label operations to context
Date: Tue, 24 Jul 2012 13:22:17 +0200 [thread overview]
Message-ID: <20120724112217.GB7057@x2.net.home> (raw)
In-Reply-To: <20120724094131.GB2086@foxbat.suse.cz>
On Tue, Jul 24, 2012 at 11:41:31AM +0200, Petr Uzel wrote:
> On Sun, Jul 22, 2012 at 07:05:01PM +0200, Davidlohr Bueso wrote:
> > From: Davidlohr Bueso <dave@gnu.org>
> >
> > The context structure is the fdisk API's main data type as it keeps all data together. Add the
> > label structure to it, so that the pt-specific operations can be called from the context.
Applied with changes, thanks.
> > The internal probing function is updated so that if a label is not probed, for example when a
> > disk is not formated, it will default to use either sun or dos label operations. This avoids
This is not so simple. You have to apply geometry and another
settings (sector size, ...) from user *before* you create a new disk
label. (See the original code, get_boot() and get_geometry()
functions.)
It means that we should not create any default disklabel in
fdisk_new_context_from_filename(). I think it will be better to make
the API less complex and split this task into two steps:
cxt = fdisk_new_context_from_filename(devname, 0);
/* --- here apply your setting to the new context -- */
if (!fdisk_dev_has_disklabel(cxt))
fdisk_create_disklabel(cxt, NULL); /* NULL means default */
It should be our common rule that the API is well fragmented to small
usable functions.
Maybe one day we will create
fdisk_new_context()
fdisk_context_assign_device()
because the current fdisk_new_context_from_filename() is already too
complex for some scenarios -- for example if you want to add some
callbacks to the context. We will see ;-)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2012-07-24 11:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-22 17:05 [PATCH 02/10] fdisk: API: add to label operations to context Davidlohr Bueso
2012-07-24 9:41 ` Petr Uzel
2012-07-24 10:36 ` Davidlohr Bueso
2012-07-24 11:22 ` Karel Zak [this message]
2012-07-24 11:32 ` Davidlohr Bueso
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=20120724112217.GB7057@x2.net.home \
--to=kzak@redhat.com \
--cc=dave@gnu.org \
--cc=util-linux@vger.kernel.org \
/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).