Skip to contentSkip to conversation

fdisk: API: comment labels array

PATCH Applied Davidlohr Bueso 2 participants 5 messages Jul 24, 2012 – Jul 26, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 fdisk: API: comment labels array

From: Davidlohr Bueso <[email protected]>

---
 fdisks/utils.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fdisks/utils.c +3 -1
index 8de64c2..c4ffe04 100644
@@ -35,7 +35,9 @@
 int fdisk_debug_mask;
 
 /*
- * label probing functions
+ * Label probing functions.
+ * Must have the same order as fdisk_labeltype as the index
+ * depends on it.
  */
 static const struct fdisk_label *labels[] =
 {
Signature · 1 line
1.7.4.1
maintainer
#1 lore raw
Quoted 12 lines · Davidlohr Bueso

From: Davidlohr Bueso <[email protected]>

---
 fdisks/utils.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fdisks/utils.c +0 -0
index 8de64c2..c4ffe04 100644

fdisks/utils.c line 40

Quoted 7 lines
fdisks/utils.c +3 -1
@@ -35,7 +35,9 @@
 int fdisk_debug_mask;
 
 /*
- * label probing functions
+ * Label probing functions.
+ * Must have the same order as fdisk_labeltype as the index
+ * depends on it.

This (rely on comment) is bad way.

fdisks/utils.c line 43

Quoted 3 lines
fdisks/utils.c +0 -0
  */
 static const struct fdisk_label *labels[] =
 {

Use:

static const struct fdisk_label[] =
{
[XXX_LABEL] = &xxx_label,
[YYY_LABEL] = &yyy_label
}

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#2 lore raw
Quoted 27 lines · Karel Zak
Quoted 12 lines · Davidlohr Bueso

From: Davidlohr Bueso <[email protected]>

---
 fdisks/utils.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fdisks/utils.c +0 -0
index 8de64c2..c4ffe04 100644

fdisks/utils.c line 40

Quoted 7 lines
fdisks/utils.c +3 -1
@@ -35,7 +35,9 @@
 int fdisk_debug_mask;
 
 /*
- * label probing functions
+ * Label probing functions.
+ * Must have the same order as fdisk_labeltype as the index
+ * depends on it.

This (rely on comment) is bad way.

fdisks/utils.c line 43

Quoted 3 lines
fdisks/utils.c +0 -0
  */
 static const struct fdisk_label *labels[] =
 {
Quoted 8 lines

Use:

static const struct fdisk_label[] =
{
[XXX_LABEL] = &xxx_label,
[YYY_LABEL] = &yyy_label
}

Yes, this is how we normally do it, but since we have an offset of 1 to the index, it looks weired. I guess we need to straighten out fdisk_labeltype and fix the menu along with it.

Quoted 2 lines

Karel

maintainer
#3 lore raw
Quoted 30 lines · Davidlohr Bueso
Quoted 29 lines · Karel Zak
Quoted 12 lines · Davidlohr Bueso

From: Davidlohr Bueso <[email protected]>

---
 fdisks/utils.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fdisks/utils.c +0 -0
index 8de64c2..c4ffe04 100644

fdisks/utils.c line 40

Quoted 7 lines
fdisks/utils.c +3 -1
@@ -35,7 +35,9 @@
 int fdisk_debug_mask;
 
 /*
- * label probing functions
+ * Label probing functions.
+ * Must have the same order as fdisk_labeltype as the index
+ * depends on it.

This (rely on comment) is bad way.

fdisks/utils.c line 43

Quoted 3 lines
fdisks/utils.c +0 -0
  */
 static const struct fdisk_label *labels[] =
 {

Use:

Quoted 8 lines
Quoted 6 lines

static const struct fdisk_label[] =
{
[XXX_LABEL] = &xxx_label,
[YYY_LABEL] = &yyy_label
}

Yes, this is how we normally do it, but since we have an offset of 1 to

Ah yes, I see menu... I'll apply the patch tomorrow.

Quoted 2 lines

the index, it looks weired. I guess we need to straighten out fdisk_labeltype and fix the menu along with it.

It would be nice to be without the IDs at all. The API should not be affected by any program specific menu or so...

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com