1 /* Header.h v1.0 Definitions for ODS2 file headers */ 2 3 /* Small macro to swap words in a longword */ 4 5 #define swapw(w) (w[0]<<16 | w[1]) 6 7 /* File characteristic definitions */ 8 9 #define FCH$M_NOBACKUP 0x2 10 #define FCH$M_CONTIGB 0x20 11 #define FCH$M_LOCKED 0x40 12 #define FCH$M_CONTIG 0x80 13 #define FCH$M_DIRECTORY 0x2000 14 #define FCH$M_MARKDEL 0x8000 15 #define FCH$M_ERASE 0x20000 16 17 /* File and record attribute definitions */ 18 19 #define FAT$C_FIXED 0x1 20 #define FAT$C_VARIABLE 0x2 21 #define FAT$C_VFC 0x3 22 #define FAT$C_UNDEFINED 0x0 23 #define FAT$C_STREAM 0x4 24 #define FAT$C_STREAMLF 0x5 25 #define FAT$C_STREAMCR 0x6 26 27 #define FAT$C_DIRECT 0x3 28 #define FAT$C_INDEXED 0x2 29 #define FAT$C_RELATIVE 0x1 30 #define FAT$C_SEQUENTIAL 0x0 31 32 #define FAT$M_FORTRANCC 0x1 33 #define FAT$M_IMPLIEDCC 0x2 34 #define FAT$M_PRINTCC 0x4 35 #define FAT$M_NOSPAN 0x8 36 #define FAT$M_MSBRCW 0x10 37 38 /* Type definitions for basic data types */ 39 40 typedef unsigned char u_byte; 41 typedef unsigned short u_word; 42 typedef unsigned int u_long; 43 44 /* Structure of time */ 45 46 struct TIME { 47 unsigned char time[8]; 48 }; 49 50 /* Definition of a UIC */ 51 52 struct UIC { 53 u_word uic$w_mem; 54 u_word uic$w_grp; 55 }; 56 57 /* Definition for a FID */ 58 59 struct fiddef { 60 u_word fid$w_num; 61 u_word fid$w_seq; 62 u_byte fid$b_rvn; 63 u_byte fid$b_nmx; 64 }; 65 66 /* RMS record definition */ 67 68 struct RECATTR { 69 u_byte fat$b_rtype; 70 u_byte fat$b_rattrib; 71 u_word fat$w_rsize; 72 u_word fat$l_hiblk[2]; 73 u_word fat$l_efblk[2]; 74 u_word fat$w_ffbyte; 75 u_byte fat$b_bktsize; 76 u_byte fat$b_vfcsize; 77 u_word fat$w_maxrec; 78 u_word fat$w_defext; 79 u_word fat$w_gbc; 80 u_byte fat$_UU0[8]; 81 u_word fat$w_versions; 82 }; 83 84 /* Layout of the volume home block... */ 85 86 struct HOME { 87 u_long hm2$l_homelbn; 88 u_long hm2$l_alhomelbn; 89 u_long hm2$l_altidxlbn; 90 u_word hm2$w_struclev; 91 u_word hm2$w_cluster; 92 u_word hm2$w_homevbn; 93 u_word hm2$w_alhomevbn; 94 u_word hm2$w_altidxvbn; 95 u_word hm2$w_ibmapvbn; 96 u_long hm2$l_ibmaplbn; 97 u_long hm2$l_maxfiles; 98 u_word hm2$w_ibmapsize; 99 u_word hm2$w_resfiles; 100 u_word hm2$w_devtype; 101 u_word hm2$w_rvn; 102 u_word hm2$w_setcount; 103 u_word hm2$w_volchar; 104 struct UIC hm2$w_volowner; 105 u_long hm2$l_reserved1; 106 u_word hm2$w_protect; 107 u_word hm2$w_fileprot; 108 u_word hm2$w_reserved2; 109 u_word hm2$w_checksum1; 110 struct TIME hm2$q_credate; 111 u_byte hm2$b_window; 112 u_byte hm2$b_lru_lim; 113 u_word hm2$w_extend; 114 struct TIME hm2$q_retainmin; 115 struct TIME hm2$q_retainmax; 116 struct TIME hm2$q_revdate; 117 u_byte hm2$r_min_class[20]; 118 u_byte hm2$r_max_class[20]; 119 u_byte hm2$t_reserved3[320]; 120 u_long hm2$l_serialnum; 121 char hm2$t_strucname[12]; 122 char hm2$t_volname[12]; 123 char hm2$t_ownername[12]; 124 char hm2$t_format[12]; 125 u_word hm2$w_reserved4; 126 u_word hm2$w_checksum2; 127 }; 128 129 /* Structure of the header identification area */ 130 131 struct IDENT { 132 char fi2$t_filename[20]; 133 u_word fi2$w_revision; 134 struct TIME fi2$q_credate; 135 struct TIME fi2$q_revdate; 136 struct TIME fi2$q_expdate; 137 struct TIME fi2$q_bakdate; 138 char fi2$t_filenamext[66]; 139 }; 140 141 /* File header layout */ 142 143 struct HEAD { 144 u_byte fh2$b_idoffset; 145 u_byte fh2$b_mpoffset; 146 u_byte fh2$b_acoffset; 147 u_byte fh2$b_rsoffset; 148 u_word fh2$w_seg_num; 149 u_word fh2$w_struclev; 150 struct fiddef fh2$w_fid; 151 struct fiddef fh2$w_ext_fid; 152 struct RECATTR fh2$w_recattr; 153 u_long fh2$l_filechar; 154 u_word fh2$w_reserved1; 155 u_byte fh2$b_map_inuse; 156 u_byte fh2$b_acc_mode; 157 struct UIC fh2$l_fileowner; 158 u_word fh2$w_fileprot; 159 struct fiddef fh2$w_backlink; 160 u_byte fh2$b_journal; 161 u_byte fh2$b_ru_active; 162 u_word fh2$w_reserved2; 163 u_long fh2$l_highwater; 164 u_byte fh2$b_reserved3[8]; 165 u_byte fh2$r_class_prot[20]; 166 u_byte fh2$r_restofit[402]; 167 u_word fh2$w_checksum; 168 }; 169 170 /* Storage control block layout */ 171 172 struct SCB { 173 u_word scb$w_struclev; 174 u_word scb$w_cluster; 175 u_long scb$l_volsize; 176 u_long scb$l_blksize; 177 u_long scb$l_sectors; 178 u_long scb$l_tracks; 179 u_long scb$l_cylinders; 180 u_long scb$l_status; 181 u_long scb$l_status2; 182 u_word scb$w_writecnt; 183 char scb$t_volockname[12]; 184 struct TIME scb$q_mounttime; 185 u_word scb$w_backrev; 186 u_long scb$q_genernum[2]; 187 char scb$b_reserved[446]; 188 u_word scb$w_checksum; 189 }; 190