1: /*
   2:  * 1995/06/08 - Borrowed from disklabel.c
   3:  *
   4:  * Many of the unused or invariant fields are omitted from the display.  This
   5:  * has the benefit of having everything fit on one screen - important since
   6:  * the standalone console driver does not do xon/xoff.
   7:  *
   8:  *  The partition display is jagged because the minimal printf() function
   9:  * does not do field padding or justification.
  10: */
  11: 
  12: #define DKTYPENAMES
  13: #include <sys/param.h>
  14: #include "saio.h"
  15: 
  16: displaylabel(lp)
  17:     register struct disklabel *lp;
  18:     {
  19:     register int i;
  20:     register struct partition *pp;
  21:     char    junk[32];
  22: 
  23:     putchar('\n');
  24:     if  (lp->d_type < DKMAXTYPES)
  25:         printf("type: %s\n", dktypenames[lp->d_type]);
  26:     else
  27:         printf("type: %d\n", lp->d_type);
  28:     strncpy(junk, lp->d_typename, sizeof (lp->d_typename));
  29:     junk[sizeof(lp->d_typename)] = '\0';
  30:     printf("disk: %s\n", junk);
  31: 
  32:     strncpy(junk, lp->d_packname, sizeof (lp->d_packname));
  33:     junk[sizeof(lp->d_packname)] = '\0';
  34:     printf("label: %s\n", junk);
  35: 
  36:     printf("flags:");
  37:     if  (lp->d_flags & D_REMOVABLE)
  38:         printf(" removeable");
  39:     if  (lp->d_flags & D_ECC)
  40:         printf(" ecc");
  41:     if  (lp->d_flags & D_BADSECT)
  42:         printf(" badsect");
  43:     printf("\n");
  44:     printf("bytes/sector: %d\n", lp->d_secsize);
  45:     printf("sectors/track: %d\n", lp->d_nsectors);
  46:     printf("tracks/cylinder: %d\n", lp->d_ntracks);
  47:     printf("sectors/cylinder: %d\n", lp->d_secpercyl);
  48:     printf("cylinders: %d\n", lp->d_ncylinders);
  49:     printf("rpm: %d\n", lp->d_rpm);
  50:     printf("drivedata: ");
  51:     for (i = 0; i < NDDATA; i++)
  52:         printf("%D ", lp->d_drivedata[i]);
  53:     printf("\n\n%d partitions:\n", lp->d_npartitions);
  54:     printf("#        size   offset    fstype   [fsize bsize]\n");
  55:     pp = lp->d_partitions;
  56:     for (i = 0; i < lp->d_npartitions; i++, pp++)
  57:         {
  58:         if  (pp->p_size == 0)
  59:             continue;
  60:         printf("  %c: %D %D  ", 'a' + i,
  61:             pp->p_size, pp->p_offset);
  62:         if  ((unsigned) pp->p_fstype < FSMAXTYPES)
  63:             printf("%s", fstypenames[pp->p_fstype]);
  64:         else
  65:             printf("%d", pp->p_fstype);
  66:         switch  (pp->p_fstype)
  67:             {
  68:             case FS_V71K:
  69:             case FS_UNUSED:
  70:                 printf("    %d %d ", pp->p_fsize,
  71:                     pp->p_fsize * pp->p_frag);
  72:                 break;
  73:             default:
  74:                 printf("               ");
  75:                 break;
  76:             }
  77:         printf("\t# (Cyl. %D", pp->p_offset / lp->d_secpercyl);
  78:         if  (pp->p_offset % lp->d_secpercyl)
  79:             putchar('*');
  80:         else
  81:             putchar(' ');
  82:         printf("- %D",
  83:             (pp->p_offset +
  84:             pp->p_size + lp->d_secpercyl - 1) /
  85:             lp->d_secpercyl - 1);
  86:         if  (pp->p_size % lp->d_secpercyl)
  87:             putchar('*');
  88:         printf(")\n");
  89:         }
  90:     putchar('\n');
  91:     }

Defined functions

displaylabel defined in line 16; used 7 times

Defined macros

DKTYPENAMES defined in line 12; never used
Last modified: 1995-06-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2835
Valid CSS Valid XHTML 1.0 Strict