From: Davidlohr Bueso <dave@gnu.org>
To: Petr Uzel <petr.uzel@suse.cz>, util-linux <util-linux@vger.kernel.org>
Subject: Re: [PATCH 2/2] fdisk: rename label probing functions
Date: Thu, 12 Jul 2012 12:40:57 +0200 [thread overview]
Message-ID: <1342089657.20502.0.camel@offworld> (raw)
In-Reply-To: <1342086439-21462-2-git-send-email-petr.uzel@suse.cz>
On Thu, 2012-07-12 at 11:47 +0200, Petr Uzel wrote:
> Rename check_$foo_label() to $foo_probe_label():
>
> 1/ 'probe' is more appropriate verb than 'check' for these functions
> 2/ making label name first part of the funciton name is IMO more
> friendly for tags completion (e.g. vim + cscope/ctags).
>
acked on both patches. The write, new, delete, etc. label operations will also
need to be renamed.
I think we should also comment these functions thoroughly. For example,
$foo_probe_labels() specifying the return values (1 is always used when
detected, 0 otherwise).
I'll send some patches shortly.
> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
> ---
> fdisks/fdiskaixlabel.c | 4 ++--
> fdisks/fdiskbsdlabel.c | 4 ++--
> fdisks/fdiskdoslabel.c | 4 ++--
> fdisks/fdiskmaclabel.c | 4 ++--
> fdisks/fdisksgilabel.c | 4 ++--
> fdisks/fdisksunlabel.c | 4 ++--
> 6 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/fdisks/fdiskaixlabel.c b/fdisks/fdiskaixlabel.c
> index f908abc..ebf9365 100644
> --- a/fdisks/fdiskaixlabel.c
> +++ b/fdisks/fdiskaixlabel.c
> @@ -49,7 +49,7 @@ aix_nolabel(struct fdisk_context *cxt)
> return;
> }
>
> -static int check_aix_label(struct fdisk_context *cxt)
> +static int aix_probe_label(struct fdisk_context *cxt)
> {
> if (aixlabel->magic != AIX_LABEL_MAGIC &&
> aixlabel->magic != AIX_LABEL_MAGIC_SWAPPED) {
> @@ -68,5 +68,5 @@ static int check_aix_label(struct fdisk_context *cxt)
> const struct fdisk_label aix_label =
> {
> .name = "aix",
> - .probe = check_aix_label
> + .probe = aix_probe_label,
> };
> diff --git a/fdisks/fdiskbsdlabel.c b/fdisks/fdiskbsdlabel.c
> index 9ede3ef..548a86d 100644
> --- a/fdisks/fdiskbsdlabel.c
> +++ b/fdisks/fdiskbsdlabel.c
> @@ -110,7 +110,7 @@ static struct xbsd_disklabel xbsd_dlabel;
> * so this does not mean that there is a BSD disk label.
> */
> static int
> -check_osf_label(struct fdisk_context *cxt) {
> +osf_probe_label(struct fdisk_context *cxt) {
> if (xbsd_readlabel (cxt, NULL, &xbsd_dlabel) == 0)
> return 0;
> return 1;
> @@ -849,5 +849,5 @@ alpha_bootblock_checksum (char *boot)
> const struct fdisk_label bsd_label =
> {
> .name = "bsd",
> - .probe = check_osf_label
> + .probe = osf_probe_label,
> };
> diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c
> index 27536da..a115e66 100644
> --- a/fdisks/fdiskdoslabel.c
> +++ b/fdisks/fdiskdoslabel.c
> @@ -316,7 +316,7 @@ void dos_delete_partition(int i)
> }
> }
>
> -static int check_dos_label(struct fdisk_context *cxt)
> +static int dos_probe_label(struct fdisk_context *cxt)
> {
> int i;
>
> @@ -684,5 +684,5 @@ void dos_write_table(struct fdisk_context *cxt)
> const struct fdisk_label dos_label =
> {
> .name = "dos",
> - .probe = check_dos_label,
> + .probe = dos_probe_label,
> };
> diff --git a/fdisks/fdiskmaclabel.c b/fdisks/fdiskmaclabel.c
> index cbdf592..555245d 100644
> --- a/fdisks/fdiskmaclabel.c
> +++ b/fdisks/fdiskmaclabel.c
> @@ -48,7 +48,7 @@ mac_nolabel(struct fdisk_context *cxt)
> }
>
> static int
> -check_mac_label(struct fdisk_context *cxt)
> +mac_probe_label(struct fdisk_context *cxt)
> {
> /*
> Conversion: only 16 bit should compared
> @@ -83,5 +83,5 @@ IS_MAC:
> const struct fdisk_label mac_label =
> {
> .name = "mac",
> - .probe = check_mac_label
> + .probe = mac_probe_label,
> };
> diff --git a/fdisks/fdisksgilabel.c b/fdisks/fdisksgilabel.c
> index c0b346a..071a84e 100644
> --- a/fdisks/fdisksgilabel.c
> +++ b/fdisks/fdisksgilabel.c
> @@ -128,7 +128,7 @@ two_s_complement_32bit_sum(unsigned int *base, int size /* in bytes */) {
> }
>
> static int
> -check_sgi_label(struct fdisk_context *cxt) {
> +sgi_probe_label(struct fdisk_context *cxt) {
> if (sizeof(sgilabel) > 512) {
> fprintf(stderr,
> _("According to MIPS Computer Systems, Inc the "
> @@ -880,5 +880,5 @@ fill_sgiinfo(void)
> const struct fdisk_label sgi_label =
> {
> .name = "sgi",
> - .probe = check_sgi_label
> + .probe = sgi_probe_label,
> };
> diff --git a/fdisks/fdisksunlabel.c b/fdisks/fdisksunlabel.c
> index d1f6054..909f159 100644
> --- a/fdisks/fdisksunlabel.c
> +++ b/fdisks/fdisksunlabel.c
> @@ -78,7 +78,7 @@ static void init(void)
> partitions = SUN_NUM_PARTITIONS;
> }
>
> -static int check_sun_label(struct fdisk_context *cxt)
> +static int sun_probe_label(struct fdisk_context *cxt)
> {
> unsigned short *ush;
> int csum;
> @@ -646,5 +646,5 @@ int sun_get_sysid(struct fdisk_context *cxt, int i)
> const struct fdisk_label sun_label =
> {
> .name = "sun",
> - .probe = check_sun_label,
> + .probe = sun_probe_label,
> };
next prev parent reply other threads:[~2012-07-12 10:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 9:47 [PATCH 1/2] fdisk: don't call update_units() in label probes if not necessary Petr Uzel
2012-07-12 9:47 ` [PATCH 2/2] fdisk: rename label probing functions Petr Uzel
2012-07-12 10:40 ` Davidlohr Bueso [this message]
2012-07-16 16:25 ` Karel Zak
2012-07-16 16:25 ` [PATCH 1/2] fdisk: don't call update_units() in label probes if not necessary Karel Zak
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=1342089657.20502.0.camel@offworld \
--to=dave@gnu.org \
--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).