]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - libfdisk/src/sgi.c
libfdisk: remove dependence on libsmartcols
[thirdparty/util-linux.git] / libfdisk / src / sgi.c
index c782ef3fa31419c60559f894db06a49a24dacc66..8e8d3208e1357f47be6c0c7418d4f243917f4a50 100644 (file)
@@ -10,6 +10,7 @@
  *               Arnaldo Carvalho de Melo <acme@conectiva.com.br>, Mar 1999,
  *               Phillip Kesling <pkesling@sgi.com>, Mar 2003.
  */
+
 #include "c.h"
 #include "nls.h"
 #include "all-io.h"
@@ -138,7 +139,7 @@ int fdisk_sgi_create_info(struct fdisk_context *cxt)
        sgilabel->volume[0].num_bytes = cpu_to_be32(sizeof(struct sgi_info));
        strncpy((char *) sgilabel->volume[0].name, "sgilabel", 8);
 
-       fdisk_info(cxt, _("SGI info created on second sector"));
+       fdisk_info(cxt, _("SGI info created on second sector."));
        return 0;
 }
 
@@ -253,7 +254,7 @@ static int sgi_list_table(struct fdisk_context *cxt)
        int rc = 0;
 
        if (fdisk_context_display_details(cxt))
-               fdisk_colon(cxt, _(
+               fdisk_info(cxt, _(
                        "Label geometry: %d heads, %llu sectors\n"
                        "                %llu cylinders, %d physical cylinders\n"
                        "                %d extra sects/cyl, interleave %d:1\n"),
@@ -261,7 +262,7 @@ static int sgi_list_table(struct fdisk_context *cxt)
                        cxt->geom.cylinders, be16_to_cpu(sgiparam->pcylcount),
                        (int) sgiparam->sparecyl, be16_to_cpu(sgiparam->ilfact));
 
-       fdisk_colon(cxt, _("Bootfile: %s"), sgilabel->boot_file);
+       fdisk_info(cxt, _("Bootfile: %s"), sgilabel->boot_file);
        return rc;
 }
 
@@ -567,14 +568,14 @@ static int verify_disklabel(struct fdisk_context *cxt, int verbose)
                                   sgi_get_start_sector(cxt, Index[0]));
 
                if (verbose && sgi_get_num_sectors(cxt, Index[0]) != lastblock)
-                       DBG(LABEL, dbgprint(
+                       DBG(LABEL, ul_debug(
                                "entire disk partition=%ds, but disk=%ds",
                                sgi_get_num_sectors(cxt, Index[0]),
                                lastblock));
                lastblock = sgi_get_num_sectors(cxt, Index[0]);
        } else if (verbose) {
                fdisk_info(cxt, _("Partition 11 should cover the entire disk."));
-               DBG(LABEL, dbgprint("sysid=%d\tpartition=%d",
+               DBG(LABEL, ul_debug("sysid=%d\tpartition=%d",
                               sgi_get_sysid(cxt, Index[0]), Index[0]+1));
        }
        for (i=1, start=0; i<sortcount; i++) {
@@ -582,12 +583,12 @@ static int verify_disklabel(struct fdisk_context *cxt, int verbose)
 
                if (verbose && cylsize
                    && (sgi_get_start_sector(cxt, Index[i]) % cylsize) != 0)
-                       DBG(LABEL, dbgprint("partition %d does not start on "
+                       DBG(LABEL, ul_debug("partition %d does not start on "
                                        "cylinder boundary.", Index[i]+1));
 
                if (verbose && cylsize
                    && sgi_get_num_sectors(cxt, Index[i]) % cylsize != 0)
-                       DBG(LABEL, dbgprint("partition %d does not end on "
+                       DBG(LABEL, ul_debug("partition %d does not end on "
                                        "cylinder boundary.", Index[i]+1));
 
                /* We cannot handle several "entire disk" entries. */
@@ -623,7 +624,7 @@ static int verify_disklabel(struct fdisk_context *cxt, int verbose)
                if (cylsize && start % cylsize)
                        start += cylsize - (start % cylsize);
 
-               DBG(LABEL, dbgprint("%2d:%12d\t%12d\t%12d", Index[i],
+               DBG(LABEL, ul_debug("%2d:%12d\t%12d\t%12d", Index[i],
                                       sgi_get_start_sector(cxt, Index[i]),
                                       sgi_get_num_sectors(cxt, Index[i]),
                                       sgi_get_sysid(cxt, Index[i])));
@@ -906,6 +907,7 @@ static int sgi_create_disklabel(struct fdisk_context *cxt)
 {
        struct fdisk_sgi_label *sgi;
        struct sgi_disklabel *sgilabel;
+       int rc;
 
        assert(cxt);
        assert(cxt->label);
@@ -934,7 +936,10 @@ static int sgi_create_disklabel(struct fdisk_context *cxt)
                }
        }
 #endif
-       fdisk_zeroize_firstsector(cxt);
+       rc = fdisk_init_firstsector_buffer(cxt);
+       if (rc)
+               return rc;
+
        sgi = (struct fdisk_sgi_label *) cxt->label;
        sgi->header = (struct sgi_disklabel *) cxt->firstsector;
 
@@ -1078,14 +1083,14 @@ static int sgi_toggle_partition_flag(struct fdisk_context *cxt, size_t i, unsign
 static const struct fdisk_column sgi_columns[] =
 {
        { FDISK_COL_DEVICE,     N_("Device"),    10,    0 },
-       { 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 },
-       { FDISK_COL_ATTR,       N_("Attrs"),      0,    TT_FL_RIGHT }
+       { FDISK_COL_START,      N_("Start"),      5,    FDISK_COLFL_NUMBER },
+       { FDISK_COL_END,        N_("End"),        5,    FDISK_COLFL_NUMBER },
+       { FDISK_COL_SECTORS,    N_("Sectors"),    5,    FDISK_COLFL_NUMBER },
+       { FDISK_COL_CYLINDERS,  N_("Cylinders"),  5,    FDISK_COLFL_NUMBER },
+       { FDISK_COL_SIZE,       N_("Size"),       5,    FDISK_COLFL_NUMBER | FDISK_COLFL_EYECANDY },
+       { FDISK_COL_TYPEID,     N_("Id"),         2,    FDISK_COLFL_NUMBER },
+       { FDISK_COL_TYPE,       N_("Type"),     0.1,    FDISK_COLFL_EYECANDY },
+       { FDISK_COL_ATTR,       N_("Attrs"),      0,    FDISK_COLFL_NUMBER }
 };
 
 static const struct fdisk_label_operations sgi_operations =