1 /* adapted from NeXT headers: 2 * usr/include/sys/disktab.h 3 * usr/include/nextdev/disk.h 4 * simplified since we don't ware about disktab, and version < 3. 5 * see also: 6 * https://doxygen.reactos.org/d7/d53/bootblock_8h.html 7 */ 8 9 #include <sys/types.h> 10 11 /* actually not packed, but aligned at 2 bytes */ 12 #pragma pack(push,2) 13 14 struct disk_label { 15 #define DL_V1 0x4e655854 /* version #1: "NeXT" */ 16 #define DL_V2 0x646c5632 /* version #2: "dlV2" */ 17 #define DL_V3 0x646c5633 /* version #3: "dlV3" */ 18 #define DL_VERSION DL_V3 /* default version */ 19 int dl_version; /* label version number */ 20 int dl_label_blkno; /* block # where this label is */ 21 int dl_size; /* size of media area (sectors) */ 22 #define MAXLBLLEN 24 23 char dl_label[MAXLBLLEN]; /* media label */ 24 u_int32_t dl_flags; /* flags */ 25 #define DL_UNINIT 0x80000000 /* label is uninitialized */ 26 u_int32_t dl_tag; /* volume tag */ 27 /* the rest really is a struct disktab dl_dt;*/ /* common info in disktab */ 28 #define MAXDNMLEN 24 29 char dl_name[MAXDNMLEN]; /* drive name */ 30 #define MAXTYPLEN 24 31 char dl_type[MAXTYPLEN]; /* drive type */ 32 int dl_secsize; /* sector size in bytes */ 33 int dl_ntrack; /* # tracks/cylinder */ 34 int dl_nsect; /* # sectors/track */ 35 int dl_ncyl; /* # cylinders */ 36 int dl_rpm; /* revolutions/minute */ 37 short dl_front; /* size of front porch (sectors) */ 38 short dl_back; /* size of back porch (sectors) */ 39 short dl_ngroups; /* number of alt groups */ 40 short dl_ag_size; /* alt group size (sectors) */ 41 short dl_ag_alts; /* alternate sectors / alt group */ 42 short dl_ag_off; /* sector offset to first alternate */ 43 #define NBOOTS 2 44 int dl_boot0_blkno[NBOOTS]; /* "blk 0" boot locations */ 45 #define MAXBFLEN 24 46 char dl_bootfile[MAXBFLEN]; /* default bootfile */ 47 #define MAXHNLEN 32 48 char dl_hostname[MAXHNLEN]; /* host name */ 49 char dl_rootpartition; /* root partition e.g. 'a' */ 50 char dl_rwpartition; /* r/w partition e.g. 'b' */ 51 #define NPART 8 52 struct partition { 53 int p_base; /* base sector# of partition */ 54 int p_size; /* #sectors in partition */ 55 short p_bsize; /* block size in bytes */ 56 short p_fsize; /* frag size in bytes */ 57 char p_opt; /* 's'pace/'t'ime optimization pref */ 58 short p_cpg; /* cylinders per group */ 59 short p_density; /* bytes per inode density */ 60 char p_minfree; /* minfree (%) */ 61 char p_newfs; /* run newfs during init */ 62 #define MAXMPTLEN 16 63 char p_mountpt[MAXMPTLEN];/* mount point */ 64 char p_automnt; /* auto-mount when inserted */ 65 #define MAXFSTLEN 8 66 char p_type[MAXFSTLEN];/* file system type */ 67 } dl_part[NPART]; 68 69 /* 70 * if dl_version >= DL_V3 then the bad block table is relocated 71 * to a structure separate from the disk label. 72 */ 73 union { 74 u_int16_t DL_v3_checksum; 75 #define NBAD 1670 /* sized to make label ~= 8KB */ 76 int DL_bad[NBAD]; /* block number that is bad */ 77 } dl_un; 78 #define dl_v3_checksum dl_un.DL_v3_checksum 79 #define dl_bad dl_un.DL_bad 80 u_int16_t dl_checksum; /* ones complement checksum */ 81 82 /* add things here so dl_checksum stays in a fixed place */ 83 }; 84 85 #pragma pack(pop) 86 87