* [PATCH 1/2] fdisk: don't call update_units() in label probes if not necessary @ 2012-07-12 9:47 Petr Uzel 2012-07-12 9:47 ` [PATCH 2/2] fdisk: rename label probing functions Petr Uzel 2012-07-16 16:25 ` [PATCH 1/2] fdisk: don't call update_units() in label probes if not necessary Karel Zak 0 siblings, 2 replies; 5+ messages in thread From: Petr Uzel @ 2012-07-12 9:47 UTC (permalink / raw) To: util-linux; +Cc: Davidlohr Bueso update_units() is called in _probe_labels before the label probes are started, so we don't need to call it again in probers, unless it messes around with geometry, which currently only check_sun_label() does (so keep the call to update_units() in this one). Signed-off-by: Petr Uzel <petr.uzel@suse.cz> --- fdisks/fdiskaixlabel.c | 1 - fdisks/fdiskmaclabel.c | 1 - fdisks/fdisksgilabel.c | 1 - 3 files changed, 0 insertions(+), 3 deletions(-) diff --git a/fdisks/fdiskaixlabel.c b/fdisks/fdiskaixlabel.c index 474a177..f908abc 100644 --- a/fdisks/fdiskaixlabel.c +++ b/fdisks/fdiskaixlabel.c @@ -57,7 +57,6 @@ static int check_aix_label(struct fdisk_context *cxt) return 0; } other_endian = (aixlabel->magic == AIX_LABEL_MAGIC_SWAPPED); - update_units(cxt); disklabel = AIX_LABEL; partitions= 1016; volumes = 15; diff --git a/fdisks/fdiskmaclabel.c b/fdisks/fdiskmaclabel.c index 1b82660..cbdf592 100644 --- a/fdisks/fdiskmaclabel.c +++ b/fdisks/fdiskmaclabel.c @@ -72,7 +72,6 @@ check_mac_label(struct fdisk_context *cxt) IS_MAC: other_endian = (maclabel->magic == MAC_LABEL_MAGIC_SWAPPED); // =? - update_units(cxt); disklabel = MAC_LABEL; partitions= 1016; // =? volumes = 15; // =? diff --git a/fdisks/fdisksgilabel.c b/fdisks/fdisksgilabel.c index 32dae78..c0b346a 100644 --- a/fdisks/fdisksgilabel.c +++ b/fdisks/fdisksgilabel.c @@ -151,7 +151,6 @@ check_sgi_label(struct fdisk_context *cxt) { fprintf(stderr, _("Detected sgi disklabel with wrong checksum.\n")); } - update_units(cxt); disklabel = SGI_LABEL; partitions= 16; volumes = 15; -- 1.7.7 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] fdisk: rename label probing functions 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 ` Petr Uzel 2012-07-12 10:40 ` Davidlohr Bueso 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 1 sibling, 2 replies; 5+ messages in thread From: Petr Uzel @ 2012-07-12 9:47 UTC (permalink / raw) To: util-linux; +Cc: Davidlohr Bueso 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). 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, }; -- 1.7.7 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] fdisk: rename label probing functions 2012-07-12 9:47 ` [PATCH 2/2] fdisk: rename label probing functions Petr Uzel @ 2012-07-12 10:40 ` Davidlohr Bueso 2012-07-16 16:25 ` Karel Zak 1 sibling, 0 replies; 5+ messages in thread From: Davidlohr Bueso @ 2012-07-12 10:40 UTC (permalink / raw) To: Petr Uzel, util-linux 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, > }; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] fdisk: rename label probing functions 2012-07-12 9:47 ` [PATCH 2/2] fdisk: rename label probing functions Petr Uzel 2012-07-12 10:40 ` Davidlohr Bueso @ 2012-07-16 16:25 ` Karel Zak 1 sibling, 0 replies; 5+ messages in thread From: Karel Zak @ 2012-07-16 16:25 UTC (permalink / raw) To: Petr Uzel; +Cc: util-linux, Davidlohr Bueso On Thu, Jul 12, 2012 at 11:47:19AM +0200, Petr Uzel wrote: > 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(-) Applied, thanks. -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] fdisk: don't call update_units() in label probes if not necessary 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-16 16:25 ` Karel Zak 1 sibling, 0 replies; 5+ messages in thread From: Karel Zak @ 2012-07-16 16:25 UTC (permalink / raw) To: Petr Uzel; +Cc: util-linux, Davidlohr Bueso On Thu, Jul 12, 2012 at 11:47:18AM +0200, Petr Uzel wrote: > fdisks/fdiskaixlabel.c | 1 - > fdisks/fdiskmaclabel.c | 1 - > fdisks/fdisksgilabel.c | 1 - > 3 files changed, 0 insertions(+), 3 deletions(-) Applied, thanks. -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-16 16:25 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
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).