home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / bsd / dev / disk_label.h next >
Text File  |  1993-10-19  |  2KB  |  87 lines

  1. /* Copyright (c) 1991 by NeXT Computer, Inc.
  2.  *
  3.  *    File:    bsd/dev/disk_label.h - NeXT disk label definition.
  4.  *
  5.  * HISTORY
  6.  * 28-Mar-92  Doug Mitchell at NeXT
  7.  *    Split out from <bsd/dev/disk.h>.
  8.  */
  9.  
  10. #ifndef    _BSD_DEV_DISK_LABEL_
  11. #define    _BSD_DEV_DISK_LABEL_
  12.  
  13. #import <bsd/sys/disktab.h>
  14.  
  15. #define    NLABELS        4        /* # of labels on a disk */
  16. #define    MAXLBLLEN    24        /* dl_label[] size */
  17. #define    NBAD        1670        /* sized to make label ~= 8KB */
  18.  
  19. /*
  20.  *  if dl_version >= DL_V3 then the bad block table is relocated
  21.  *  to a structure separate from the disk label.
  22.  */
  23. typedef union {
  24.     unsigned short    DL_v3_checksum;
  25.     int    DL_bad[NBAD];            /* block number that is bad */
  26. } dl_un_t;
  27.  
  28. typedef struct disk_label {
  29.     int        dl_version;        // label version number
  30.     int        dl_label_blkno;        // block # where this label is
  31.     int        dl_size;        // size of media area (sectors)
  32.     char        dl_label[MAXLBLLEN];    // media label
  33.     unsigned    dl_flags;        // flags (see DL_xxx, below)
  34.     unsigned    dl_tag;            // volume tag
  35.     struct    disktab dl_dt;            // common info in disktab
  36.     dl_un_t        dl_un;
  37.     unsigned short    dl_checksum;        // ones complement checksum
  38.     
  39.     /* add things here so dl_checksum stays in a fixed place */
  40. } disk_label_t;
  41.  
  42. /*
  43.  * Known label versions.
  44.  */
  45. #define    DL_V1        0x4e655854    /* version #1: "NeXT" */
  46. #define    DL_V2        0x646c5632    /* version #2: "dlV2" */
  47. #define    DL_V3        0x646c5633    /* version #3: "dlV3" */
  48. #define    DL_VERSION    DL_V3        /* default version */
  49.  
  50.  
  51. /*
  52.  * dl_flags values
  53.  */
  54. #define    DL_UNINIT    0x80000000    /* label is uninitialized */
  55.  
  56. /*
  57.  * Aliases for disktab fields
  58.  */
  59. #define    dl_name        dl_dt.d_name
  60. #define    dl_type        dl_dt.d_type
  61. #define dl_part        dl_dt.d_partitions
  62. #define    dl_front    dl_dt.d_front
  63. #define    dl_back        dl_dt.d_back
  64. #define    dl_ngroups    dl_dt.d_ngroups
  65. #define    dl_ag_size    dl_dt.d_ag_size
  66. #define    dl_ag_alts    dl_dt.d_ag_alts
  67. #define    dl_ag_off    dl_dt.d_ag_off
  68. #define    dl_secsize    dl_dt.d_secsize
  69. #define    dl_ncyl        dl_dt.d_ncylinders
  70. #define    dl_nsect    dl_dt.d_nsectors
  71. #define    dl_ntrack    dl_dt.d_ntracks
  72. #define    dl_rpm        dl_dt.d_rpm
  73. #define    dl_bootfile    dl_dt.d_bootfile
  74. #define    dl_boot0_blkno    dl_dt.d_boot0_blkno
  75. #define    dl_hostname    dl_dt.d_hostname
  76. #define    dl_rootpartition dl_dt.d_rootpartition
  77. #define    dl_rwpartition    dl_dt.d_rwpartition
  78.  
  79. /*
  80.  * Other aliases
  81.  */
  82. #define    dl_v3_checksum    dl_un.DL_v3_checksum
  83. #define    dl_bad        dl_un.DL_bad
  84.  
  85. #endif    _BSD_DEV_DISK_LABEL_
  86.  
  87.