From: Davidlohr Bueso <dave@gnu.org>
To: Karel Zak <kzak@redhat.com>
Cc: Petr Uzel <petr.uzel@suse.cz>, util-linux <util-linux@vger.kernel.org>
Subject: Re: [PATCH 5/6] fdisk: introduce fdisk context
Date: Wed, 23 May 2012 11:51:16 +0200 [thread overview]
Message-ID: <1337766676.24092.3.camel@offworld> (raw)
In-Reply-To: <20120523094250.GA1297@x2.net.home>
On Wed, 2012-05-23 at 11:42 +0200, Karel Zak wrote:
> On Mon, May 21, 2012 at 10:28:03PM +0200, Davidlohr Bueso wrote:
> > This is the first patch that adds the initial parts of the new fdisk
> > internal API. Two functions are created to both init and deinit the
> > fdisk context. Only the device's descriptor and path are added as a
> > start and these are replaced throughout fdisk.c and label specific
> > code.
>
> Applied (and the rest of the patches too), thanks.
thanks.
>
> > All logic that opens the file does it with
> > fdisk_new_context_from_filename(), and this enforces always opening
> > the device with rw
>
> I have added 'readonly' option to the fdisk_new_context_from_filename().
Well I wanted to leave it open for new features like when no device is
passed (-l option IIRC) and read from /proc/partitions.
>
> It would be better to minimize number of situation where we somewhere
> open devices read-write. For example udevd, udisks, ... are pretty
> sensitive to write operations (to detect new PT or new filesystem
> etc.).
>
> Notes:
>
> 1/ What about to rename fdisk_new_context_from_filename() to
> fdisk_new_context()? I guess that the device name is mandatory option.
>
> 2/ Please, don't use global 'cxt' if possible. See for example
>
Totally agree. I plan to gradually modify current functions to pass cxt
as an argument instead of doing it globally - but it was kind of
invasive for this pachset.
> get_geometry() -> get_topology()
>
> disk.c: In function ‘get_topology’:
> fdisk.c:456:18: warning: unused parameter ‘fd’ [-Wunused-parameter]
>
> there is get_geometry(cxt->fd, ...), but get_topology() ignores the
> parameter 'fd' and the function uses the global cxt->fd. This is
> nasty :-)
>
> It would be better to rename global 'cxt' to something less generic
> and everywhere in functions use 'cxt' parameter, for example:
>
> get_geometry(struct fdisk_context *cxt, struct geom *g);
Yep, that's my plan.
>
> Karel
>
prev parent reply other threads:[~2012-05-23 9:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-20 16:11 [PATCH 5/6] fdisk: introduce fdisk context Davidlohr Bueso
2012-05-21 9:40 ` Karel Zak
2012-05-21 10:44 ` Davidlohr Bueso
2012-05-21 20:14 ` Davidlohr Bueso
2012-05-21 20:28 ` Davidlohr Bueso
2012-05-23 9:42 ` Karel Zak
2012-05-23 9:51 ` Davidlohr Bueso [this message]
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=1337766676.24092.3.camel@offworld \
--to=dave@gnu.org \
--cc=kzak@redhat.com \
--cc=petr.uzel@suse.cz \
--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).