summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libfdisk/src/bsd.c8
-rw-r--r--libfdisk/src/dos.c1
-rw-r--r--libfdisk/src/gpt.c1
-rw-r--r--libfdisk/src/label.c11
-rw-r--r--libfdisk/src/sgi.c1
-rw-r--r--libfdisk/src/sun.c1
-rw-r--r--libfdisk/src/table.c9
7 files changed, 20 insertions, 12 deletions
diff --git a/libfdisk/src/bsd.c b/libfdisk/src/bsd.c
index 849536328..d24c10434 100644
--- a/libfdisk/src/bsd.c
+++ b/libfdisk/src/bsd.c
@@ -877,9 +877,11 @@ static const struct fdisk_label_operations bsd_operations =
static const struct fdisk_column bsd_columns[] =
{
{ FDISK_COL_DEVICE, N_("Slice"), 1, 0 },
- { FDISK_COL_START, N_("Start"), 9, TT_FL_RIGHT },
- { FDISK_COL_END, N_("End"), 9, TT_FL_RIGHT },
- { FDISK_COL_SIZE, N_("Size"), 9, TT_FL_RIGHT },
+ { FDISK_COL_START, N_("Start"), 5, TT_FL_RIGHT },
+ { FDISK_COL_END, N_("End"), 5, TT_FL_RIGHT },
+ { FDISK_COL_SIZE, N_("Size"), 5, TT_FL_RIGHT },
+ { FDISK_COL_SECTORS, N_("Sectors"), 5, TT_FL_RIGHT },
+ { FDISK_COL_CYLINDERS, N_("Cylinders"), 5, TT_FL_RIGHT },
{ FDISK_COL_TYPE, N_("Type"), 8, 0 },
{ FDISK_COL_FSIZE, N_("Fsize"), 5, TT_FL_RIGHT },
{ FDISK_COL_BSIZE, N_("Bsize"), 5, TT_FL_RIGHT },
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 63072fc3f..1beeb6573 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -1836,6 +1836,7 @@ static const struct fdisk_column dos_columns[] =
{ FDISK_COL_START, N_("Start"), 5, TT_FL_RIGHT },
{ FDISK_COL_END, N_("End"), 5, TT_FL_RIGHT },
{ FDISK_COL_SECTORS, N_("Sectors"), 5, TT_FL_RIGHT },
+ { FDISK_COL_CYLINDERS, N_("Cylinders"), 5, TT_FL_RIGHT },
{ FDISK_COL_SIZE, N_("Size"), 5, TT_FL_RIGHT, FDISK_COLFL_EYECANDY },
{ FDISK_COL_TYPEID, N_("Id"), 2, TT_FL_RIGHT },
{ FDISK_COL_TYPE, N_("Type"), 0.1, TT_FL_TRUNC },
diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c
index c9917cf56..8c1c86835 100644
--- a/libfdisk/src/gpt.c
+++ b/libfdisk/src/gpt.c
@@ -2269,6 +2269,7 @@ static const struct fdisk_column gpt_columns[] =
{ FDISK_COL_START, N_("Start"), 5, TT_FL_RIGHT },
{ FDISK_COL_END, N_("End"), 5, TT_FL_RIGHT },
{ FDISK_COL_SECTORS, N_("Sectors"), 5, TT_FL_RIGHT },
+ { FDISK_COL_CYLINDERS, N_("Cylinders"), 5, TT_FL_RIGHT },
{ FDISK_COL_SIZE, N_("Size"), 5, TT_FL_RIGHT, FDISK_COLFL_EYECANDY },
{ FDISK_COL_TYPE, N_("Type"), 0.1, TT_FL_TRUNC, FDISK_COLFL_EYECANDY },
/* expert */
diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c
index 00b25ee29..d04363a1d 100644
--- a/libfdisk/src/label.c
+++ b/libfdisk/src/label.c
@@ -137,13 +137,20 @@ int fdisk_get_columns(struct fdisk_context *cxt, int all, int **cols, size_t *nc
if (!c)
return -ENOMEM;
for (n = 0, i = 0; i < cxt->label->ncolumns; i++) {
+ int id = cxt->label->columns[i].id;
+
if (!all &&
((fdisk_context_display_details(cxt) &&
(cxt->label->columns[i].flags & FDISK_COLFL_EYECANDY))
|| (!fdisk_context_display_details(cxt) &&
- (cxt->label->columns[i].flags & FDISK_COLFL_DETAIL))))
+ (cxt->label->columns[i].flags & FDISK_COLFL_DETAIL))
+ || (id == FDISK_COL_SECTORS &&
+ fdisk_context_use_cylinders(cxt))
+ || (id == FDISK_COL_CYLINDERS &&
+ !fdisk_context_use_cylinders(cxt))))
continue;
- c[n++] = cxt->label->columns[i].id;
+
+ c[n++] = id;
}
if (cols)
*cols = c;
diff --git a/libfdisk/src/sgi.c b/libfdisk/src/sgi.c
index 33a13c8b7..19daf3ad4 100644
--- a/libfdisk/src/sgi.c
+++ b/libfdisk/src/sgi.c
@@ -1121,6 +1121,7 @@ static const struct fdisk_column sgi_columns[] =
{ FDISK_COL_START, N_("Start"), 5, TT_FL_RIGHT },
{ FDISK_COL_END, N_("End"), 5, TT_FL_RIGHT },
{ FDISK_COL_SECTORS, N_("Sectors"), 5, TT_FL_RIGHT },
+ { FDISK_COL_CYLINDERS, N_("Cylinders"), 5, TT_FL_RIGHT },
{ FDISK_COL_SIZE, N_("Size"), 5, TT_FL_RIGHT, FDISK_COLFL_EYECANDY },
{ FDISK_COL_TYPEID, N_("Id"), 2, TT_FL_RIGHT },
{ FDISK_COL_TYPE, N_("Type"), 0.1, TT_FL_TRUNC, FDISK_COLFL_EYECANDY },
diff --git a/libfdisk/src/sun.c b/libfdisk/src/sun.c
index 9c064f28e..2b31358b9 100644
--- a/libfdisk/src/sun.c
+++ b/libfdisk/src/sun.c
@@ -988,6 +988,7 @@ static const struct fdisk_column sun_columns[] =
{ FDISK_COL_START, N_("Start"), 5, TT_FL_RIGHT },
{ FDISK_COL_END, N_("End"), 5, TT_FL_RIGHT },
{ FDISK_COL_SECTORS, N_("Sectors"), 5, TT_FL_RIGHT },
+ { FDISK_COL_CYLINDERS, N_("Cylinders"), 5, TT_FL_RIGHT },
{ FDISK_COL_SIZE, N_("Size"), 5, TT_FL_RIGHT },
{ FDISK_COL_TYPEID, N_("Id"), 2, TT_FL_RIGHT },
{ FDISK_COL_TYPE, N_("Type"), 0.1, TT_FL_TRUNC },
diff --git a/libfdisk/src/table.c b/libfdisk/src/table.c
index 1d034d428..c934910a1 100644
--- a/libfdisk/src/table.c
+++ b/libfdisk/src/table.c
@@ -322,13 +322,8 @@ int fdisk_table_to_string(struct fdisk_table *tb,
/* define columns */
for (j = 0; j < ncols; j++) {
col = fdisk_label_get_column(cxt->label, cols[j]);
- if (!col)
- continue;
- tt_define_column(tt,
- col->id == FDISK_COL_SECTORS &&
- fdisk_context_use_cylinders(cxt) ?
- _("Cylinders") : col->name,
- col->width, col->tt_flags);
+ if (col)
+ tt_define_column(tt, col->name, col->width, col->tt_flags);
}
fdisk_reset_iter(&itr, FDISK_ITER_FORWARD);