ecma_167.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:21k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * ecma_167.h
  3.  *
  4.  * This file is based on ECMA-167 3rd edition (June 1997)
  5.  * http://www.ecma.ch
  6.  *
  7.  * Copyright (c) 2001-2002  Ben Fennema <bfennema@falcon.csc.calpoly.edu>
  8.  * All rights reserved.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions, and the following disclaimer,
  15.  *    without modification.
  16.  * 2. The name of the author may not be used to endorse or promote products
  17.  *    derived from this software without specific prior written permission.
  18.  *
  19.  * Alternatively, this software may be distributed under the terms of the
  20.  * GNU Public License ("GPL").
  21.  *
  22.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  23.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25.  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  26.  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32.  * SUCH DAMAGE.
  33.  */
  34. #include <linux/types.h>
  35. #ifndef _ECMA_167_H
  36. #define _ECMA_167_H 1
  37. /* Character set specification (ECMA 167r3 1/7.2.1) */
  38. typedef struct
  39. {
  40. uint8_t charSetType;
  41. uint8_t charSetInfo[63];
  42. } __attribute__ ((packed)) charspec;
  43. /* Character Set Type (ECMA 167r3 1/7.2.1.1) */
  44. #define CHARSPEC_TYPE_CS0 0x00 /* (1/7.2.2) */
  45. #define CHARSPEC_TYPE_CS1 0x01 /* (1/7.2.3) */
  46. #define CHARSPEC_TYPE_CS2 0x02 /* (1/7.2.4) */
  47. #define CHARSPEC_TYPE_CS3 0x03 /* (1/7.2.5) */
  48. #define CHARSPEC_TYPE_CS4 0x04 /* (1/7.2.6) */
  49. #define CHARSPEC_TYPE_CS5 0x05 /* (1/7.2.7) */
  50. #define CHARSPEC_TYPE_CS6 0x06 /* (1/7.2.8) */
  51. #define CHARSPEC_TYPE_CS7 0x07 /* (1/7.2.9) */
  52. #define CHARSPEC_TYPE_CS8 0x08 /* (1/7.2.10) */
  53. typedef uint8_t dstring;
  54. /* Timestamp (ECMA 167r3 1/7.3) */
  55. typedef struct
  56. {
  57. uint16_t typeAndTimezone;
  58. int16_t year;
  59. uint8_t month;
  60. uint8_t day;
  61. uint8_t hour;
  62. uint8_t minute;
  63. uint8_t second;
  64. uint8_t centiseconds;
  65. uint8_t hundredsOfMicroseconds;
  66. uint8_t microseconds;
  67. } __attribute__ ((packed)) timestamp;
  68. /* Type and Time Zone (ECMA 167r3 1/7.3.1) */
  69. #define TIMESTAMP_TYPE_MASK 0xF000
  70. #define TIMESTAMP_TYPE_CUT 0x0000
  71. #define TIMESTAMP_TYPE_LOCAL 0x1000
  72. #define TIMESTAMP_TYPE_AGREEMENT 0x2000
  73. #define TIMESTAMP_TIMEZONE_MASK 0x0FFF
  74. /* Entity identifier (ECMA 167r3 1/7.4) */
  75. typedef struct
  76. {
  77. uint8_t flags;
  78. uint8_t ident[23];
  79. uint8_t identSuffix[8];
  80. } __attribute__ ((packed)) regid;
  81. /* Flags (ECMA 167r3 1/7.4.1) */
  82. #define ENTITYID_FLAGS_DIRTY 0x00
  83. #define ENTITYID_FLAGS_PROTECTED 0x01
  84. /* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
  85. #define VSD_STD_ID_LEN 5
  86. struct volStructDesc
  87. {
  88. uint8_t structType;
  89. uint8_t stdIdent[VSD_STD_ID_LEN];
  90. uint8_t structVersion;
  91. uint8_t structData[2041];
  92. } __attribute__ ((packed));
  93. /* Standard Identifier (EMCA 167r2 2/9.1.2) */
  94. #define VSD_STD_ID_NSR02 "NSR02" /* (3/9.1) */
  95. /* Standard Identifier (ECMA 167r3 2/9.1.2) */
  96. #define VSD_STD_ID_BEA01 "BEA01" /* (2/9.2) */
  97. #define VSD_STD_ID_BOOT2 "BOOT2" /* (2/9.4) */
  98. #define VSD_STD_ID_CD001 "CD001" /* (ECMA-119) */
  99. #define VSD_STD_ID_CDW02 "CDW02" /* (ECMA-168) */
  100. #define VSD_STD_ID_NSR03 "NSR03" /* (3/9.1) */
  101. #define VSD_STD_ID_TEA01 "TEA01" /* (2/9.3) */
  102. /* Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */
  103. struct beginningExtendedAreaDesc
  104. {
  105. uint8_t structType;
  106. uint8_t stdIdent[VSD_STD_ID_LEN];
  107. uint8_t structVersion;
  108. uint8_t structData[2041];
  109. } __attribute__ ((packed));
  110. /* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */
  111. struct terminatingExtendedAreaDesc
  112. {
  113. uint8_t structType;
  114. uint8_t stdIdent[VSD_STD_ID_LEN];
  115. uint8_t structVersion;
  116. uint8_t structData[2041];
  117. } __attribute__ ((packed));
  118. /* Boot Descriptor (ECMA 167r3 2/9.4) */
  119. struct bootDesc
  120. {
  121. uint8_t structType;
  122. uint8_t stdIdent[VSD_STD_ID_LEN];
  123. uint8_t structVersion;
  124. uint8_t reserved1;
  125. regid archType;
  126. regid bootIdent;
  127. uint32_t bootExtLocation;
  128. uint32_t bootExtLength;
  129. uint64_t loadAddress;
  130. uint64_t startAddress;
  131. timestamp descCreationDateAndTime;
  132. uint16_t flags;
  133. uint8_t reserved2[32];
  134. uint8_t bootUse[1906];
  135. } __attribute__ ((packed));
  136. /* Flags (ECMA 167r3 2/9.4.12) */
  137. #define BOOT_FLAGS_ERASE 0x01
  138. /* Extent Descriptor (ECMA 167r3 3/7.1) */
  139. typedef struct
  140. {
  141. uint32_t extLength;
  142. uint32_t extLocation;
  143. } __attribute__ ((packed)) extent_ad;
  144. /* Descriptor Tag (ECMA 167r3 3/7.2) */
  145. typedef struct
  146. {
  147. uint16_t tagIdent;
  148. uint16_t descVersion;
  149. uint8_t tagChecksum;
  150. uint8_t reserved;
  151. uint16_t tagSerialNum;
  152. uint16_t descCRC;
  153. uint16_t descCRCLength;
  154. uint32_t tagLocation;
  155. } __attribute__ ((packed)) tag;
  156. /* Tag Identifier (ECMA 167r3 3/7.2.1) */
  157. #define TAG_IDENT_PVD 0x0001
  158. #define TAG_IDENT_AVDP 0x0002
  159. #define TAG_IDENT_VDP 0x0003
  160. #define TAG_IDENT_IUVD 0x0004
  161. #define TAG_IDENT_PD 0x0005
  162. #define TAG_IDENT_LVD 0x0006
  163. #define TAG_IDENT_USD 0x0007
  164. #define TAG_IDENT_TD 0x0008
  165. #define TAG_IDENT_LVID 0x0009
  166. /* NSR Descriptor (ECMA 167r3 3/9.1) */
  167. struct NSRDesc
  168. {
  169. uint8_t structType;
  170. uint8_t stdIdent[VSD_STD_ID_LEN];
  171. uint8_t structVersion;
  172. uint8_t reserved;
  173. uint8_t structData[2040];
  174. } __attribute__ ((packed));
  175. /* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
  176. struct primaryVolDesc
  177. {
  178. tag descTag;
  179. uint32_t volDescSeqNum;
  180. uint32_t primaryVolDescNum;
  181. dstring volIdent[32];
  182. uint16_t volSeqNum;
  183. uint16_t maxVolSeqNum;
  184. uint16_t interchangeLvl;
  185. uint16_t maxInterchangeLvl;
  186. uint32_t charSetList;
  187. uint32_t maxCharSetList;
  188. dstring volSetIdent[128];
  189. charspec descCharSet;
  190. charspec explanatoryCharSet;
  191. extent_ad volAbstract;
  192. extent_ad volCopyright;
  193. regid appIdent;
  194. timestamp recordingDateAndTime;
  195. regid impIdent;
  196. uint8_t impUse[64];
  197. uint32_t predecessorVolDescSeqLocation;
  198. uint16_t flags;
  199. uint8_t reserved[22];
  200. } __attribute__ ((packed));
  201. /* Flags (ECMA 167r3 3/10.1.21) */
  202. #define PVD_FLAGS_VSID_COMMON 0x0001
  203. /* Anchor Volume Descriptor Pointer (ECMA 167r3 3/10.2) */
  204. struct anchorVolDescPtr
  205. {
  206. tag descTag;
  207. extent_ad mainVolDescSeqExt;
  208. extent_ad reserveVolDescSeqExt;
  209. uint8_t   reserved[480];
  210. } __attribute__ ((packed));
  211. /* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */
  212. struct volDescPtr
  213. {
  214. tag descTag;
  215. uint32_t volDescSeqNum;
  216. extent_ad nextVolDescSeqExt;
  217. uint8_t reserved[484];
  218. } __attribute__ ((packed));
  219. /* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */
  220. struct impUseVolDesc
  221. {
  222. tag descTag;
  223. uint32_t volDescSeqNum;
  224. regid impIdent;
  225. uint8_t impUse[460];
  226. } __attribute__ ((packed));
  227. /* Partition Descriptor (ECMA 167r3 3/10.5) */
  228. struct partitionDesc
  229. {
  230. tag descTag;
  231. uint32_t volDescSeqNum;
  232. uint16_t partitionFlags;
  233. uint16_t partitionNumber;
  234. regid partitionContents;
  235. uint8_t partitionContentsUse[128];
  236. uint32_t accessType;
  237. uint32_t partitionStartingLocation;
  238. uint32_t partitionLength;
  239. regid impIdent;
  240. uint8_t impUse[128];
  241. uint8_t reserved[156];
  242. } __attribute__ ((packed));
  243. /* Partition Flags (ECMA 167r3 3/10.5.3) */
  244. #define PD_PARTITION_FLAGS_ALLOC 0x0001
  245. /* Partition Contents (ECMA 167r2 3/10.5.3) */
  246. #define PD_PARTITION_CONTENTS_NSR02 "+NSR02"
  247. /* Partition Contents (ECMA 167r3 3/10.5.5) */
  248. #define PD_PARTITION_CONTENTS_FDC01 "+FDC01"
  249. #define PD_PARTITION_CONTENTS_CD001 "+CD001"
  250. #define PD_PARTITION_CONTENTS_CDW02 "+CDW02"
  251. #define PD_PARTITION_CONTENTS_NSR03 "+NSR03"
  252. /* Access Type (ECMA 167r3 3/10.5.7) */
  253. #define PD_ACCESS_TYPE_NONE 0x00000000
  254. #define PD_ACCESS_TYPE_READ_ONLY 0x00000001
  255. #define PD_ACCESS_TYPE_WRITE_ONCE 0x00000002
  256. #define PD_ACCESS_TYPE_REWRITABLE 0x00000003
  257. #define PD_ACCESS_TYPE_OVERWRITABLE 0x00000004
  258. /* Logical Volume Descriptor (ECMA 167r3 3/10.6) */
  259. struct logicalVolDesc
  260. {
  261. tag descTag;
  262. uint32_t volDescSeqNum;
  263. charspec descCharSet;
  264. dstring logicalVolIdent[128];
  265. uint32_t logicalBlockSize;
  266. regid domainIdent;
  267. uint8_t logicalVolContentsUse[16];
  268. uint32_t mapTableLength;
  269. uint32_t numPartitionMaps;
  270. regid impIdent;
  271. uint8_t impUse[128];
  272. extent_ad integritySeqExt;
  273. uint8_t partitionMaps[0];
  274. } __attribute__ ((packed));
  275. /* Generic Partition Map (ECMA 167r3 3/10.7.1) */
  276. struct genericPartitionMap
  277. {
  278. uint8_t partitionMapType;
  279. uint8_t partitionMapLength;
  280. uint8_t partitionMapping[0];
  281. } __attribute__ ((packed));
  282. /* Partition Map Type (ECMA 167r3 3/10.7.1.1) */
  283. #define GP_PARTITION_MAP_TYPE_UNDEF 0x00
  284. #define GP_PARTIITON_MAP_TYPE_1 0x01
  285. #define GP_PARTITION_MAP_TYPE_2 0x02
  286. /* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */
  287. struct genericPartitionMap1
  288. {
  289. uint8_t partitionMapType;
  290. uint8_t partitionMapLength;
  291. uint16_t volSeqNum;
  292. uint16_t partitionNum;
  293. } __attribute__ ((packed));
  294. /* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */
  295. struct genericPartitionMap2
  296. {
  297. uint8_t partitionMapType;
  298. uint8_t partitionMapLength; 
  299. uint8_t partitionIdent[62];
  300. } __attribute__ ((packed));
  301. /* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */
  302. struct unallocSpaceDesc
  303. {
  304. tag descTag;
  305. uint32_t volDescSeqNum;
  306. uint32_t numAllocDescs;
  307. extent_ad allocDescs[0];
  308. } __attribute__ ((packed));
  309. /* Terminating Descriptor (ECMA 167r3 3/10.9) */
  310. struct terminatingDesc
  311. {
  312. tag descTag;
  313. uint8_t reserved[496];
  314. } __attribute__ ((packed));
  315. /* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */
  316. struct logicalVolIntegrityDesc
  317. {
  318. tag descTag;
  319. timestamp recordingDateAndTime;
  320. uint32_t integrityType;
  321. extent_ad nextIntegrityExt;
  322. uint8_t logicalVolContentsUse[32];
  323. uint32_t numOfPartitions;
  324. uint32_t lengthOfImpUse;
  325. uint32_t freeSpaceTable[0];
  326. uint32_t sizeTable[0];
  327. uint8_t impUse[0];
  328. } __attribute__ ((packed));
  329. /* Integrity Type (ECMA 167r3 3/10.10.3) */
  330. #define LVID_INTEGRITY_TYPE_OPEN 0x00000000
  331. #define LVID_INTEGRITY_TYPE_CLOSE 0x00000001
  332. /* Recorded Address (ECMA 167r3 4/7.1) */
  333. typedef struct 
  334. {
  335. uint32_t logicalBlockNum;
  336. uint16_t partitionReferenceNum;
  337. } __attribute__ ((packed)) lb_addr;
  338. /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
  339. typedef struct
  340. {
  341.         uint32_t extLength;
  342.         uint32_t extPosition;
  343. } __attribute__ ((packed)) short_ad;
  344. /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
  345. typedef struct
  346. {
  347. uint32_t extLength;
  348. lb_addr extLocation;
  349. uint8_t impUse[6];
  350. } __attribute__ ((packed)) long_ad;
  351. /* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */
  352. typedef struct
  353. {
  354. uint32_t extLength;
  355. uint32_t recordedLength;
  356. uint32_t informationLength;
  357. lb_addr extLocation;
  358. } __attribute__ ((packed)) ext_ad;
  359. /* Descriptor Tag (ECMA 167r3 4/7.2 - See 3/7.2) */
  360. /* Tag Identifier (ECMA 167r3 4/7.2.1) */
  361. #define TAG_IDENT_FSD 0x0100
  362. #define TAG_IDENT_FID 0x0101
  363. #define TAG_IDENT_AED 0x0102
  364. #define TAG_IDENT_IE 0x0103
  365. #define TAG_IDENT_TE 0x0104
  366. #define TAG_IDENT_FE 0x0105
  367. #define TAG_IDENT_EAHD 0x0106
  368. #define TAG_IDENT_USE 0x0107
  369. #define TAG_IDENT_SBD 0x0108
  370. #define TAG_IDENT_PIE 0x0109
  371. #define TAG_IDENT_EFE 0x010A
  372. /* File Set Descriptor (ECMA 167r3 4/14.1) */
  373. struct fileSetDesc
  374. {
  375. tag descTag;
  376. timestamp recordingDateAndTime;
  377. uint16_t interchangeLvl;
  378. uint16_t maxInterchangeLvl;
  379. uint32_t charSetList;
  380. uint32_t maxCharSetList;
  381. uint32_t fileSetNum;
  382. uint32_t fileSetDescNum;
  383. charspec logicalVolIdentCharSet;
  384. dstring logicalVolIdent[128];
  385. charspec fileSetCharSet;
  386. dstring fileSetIdent[32];
  387. dstring copyrightFileIdent[32];
  388. dstring abstractFileIdent[32];
  389. long_ad rootDirectoryICB;
  390. regid domainIdent;
  391. long_ad nextExt;
  392. long_ad streamDirectoryICB;
  393. uint8_t reserved[32];
  394. } __attribute__ ((packed));
  395. /* Partition Header Descriptor (ECMA 167r3 4/14.3) */
  396. struct partitionHeaderDesc
  397. {
  398. short_ad unallocSpaceTable;
  399. short_ad unallocSpaceBitmap;
  400. short_ad partitionIntegrityTable;
  401. short_ad freedSpaceTable;
  402. short_ad freedSpaceBitmap;
  403. uint8_t reserved[88];
  404. } __attribute__ ((packed));
  405. /* File Identifier Descriptor (ECMA 167r3 4/14.4) */
  406. struct fileIdentDesc
  407. {
  408. tag descTag;
  409. uint16_t fileVersionNum;
  410. uint8_t fileCharacteristics;
  411. uint8_t lengthFileIdent;
  412. long_ad icb;
  413. uint16_t lengthOfImpUse;
  414. uint8_t impUse[0];
  415. uint8_t fileIdent[0];
  416. uint8_t padding[0];
  417. } __attribute__ ((packed));
  418. /* File Characteristics (ECMA 167r3 4/14.4.3) */
  419. #define FID_FILE_CHAR_HIDDEN 0x01
  420. #define FID_FILE_CHAR_DIRECTORY 0x02
  421. #define FID_FILE_CHAR_DELETED 0x04
  422. #define FID_FILE_CHAR_PARENT 0x08
  423. #define FID_FILE_CHAR_METADATA 0x10
  424. /* Allocation Ext Descriptor (ECMA 167r3 4/14.5) */
  425. struct allocExtDesc
  426. {
  427. tag descTag;
  428. uint32_t previousAllocExtLocation;
  429. uint32_t lengthAllocDescs;
  430. } __attribute__ ((packed));
  431. /* ICB Tag (ECMA 167r3 4/14.6) */
  432. typedef struct
  433. {
  434. uint32_t priorRecordedNumDirectEntries;
  435. uint16_t strategyType;
  436. uint16_t strategyParameter;
  437. uint16_t numEntries;
  438. uint8_t reserved;
  439. uint8_t fileType;
  440. lb_addr parentICBLocation;
  441. uint16_t flags;
  442. } __attribute__ ((packed)) icbtag;
  443. /* Strategy Type (ECMA 167r3 4/14.6.2) */
  444. #define ICBTAG_STRATEGY_TYPE_UNDEF 0x0000
  445. #define ICBTAG_STRATEGY_TYPE_1 0x0001
  446. #define ICBTAG_STRATEGY_TYPE_2 0x0002
  447. #define ICBTAG_STRATEGY_TYPE_3 0x0003
  448. #define ICBTAG_STRATEGY_TYPE_4 0x0004
  449. /* File Type (ECMA 167r3 4/14.6.6) */
  450. #define ICBTAG_FILE_TYPE_UNDEF 0x00
  451. #define ICBTAG_FILE_TYPE_USE 0x01
  452. #define ICBTAG_FILE_TYPE_PIE 0x02
  453. #define ICBTAG_FILE_TYPE_IE 0x03
  454. #define ICBTAG_FILE_TYPE_DIRECTORY 0x04
  455. #define ICBTAG_FILE_TYPE_REGULAR 0x05
  456. #define ICBTAG_FILE_TYPE_BLOCK 0x06
  457. #define ICBTAG_FILE_TYPE_CHAR 0x07
  458. #define ICBTAG_FILE_TYPE_EA 0x08
  459. #define ICBTAG_FILE_TYPE_FIFO 0x09
  460. #define ICBTAG_FILE_TYPE_SOCKET 0x0A
  461. #define ICBTAG_FILE_TYPE_TE 0x0B
  462. #define ICBTAG_FILE_TYPE_SYMLINK 0x0C
  463. #define ICBTAG_FILE_TYPE_STREAMDIR 0x0D
  464. /* Flags (ECMA 167r3 4/14.6.8) */
  465. #define ICBTAG_FLAG_AD_MASK 0x0007
  466. #define ICBTAG_FLAG_AD_SHORT 0x0000
  467. #define ICBTAG_FLAG_AD_LONG 0x0001
  468. #define ICBTAG_FLAG_AD_EXTENDED 0x0002
  469. #define ICBTAG_FLAG_AD_IN_ICB 0x0003
  470. #define ICBTAG_FLAG_SORTED 0x0008
  471. #define ICBTAG_FLAG_NONRELOCATABLE 0x0010
  472. #define ICBTAG_FLAG_ARCHIVE 0x0020
  473. #define ICBTAG_FLAG_SETUID 0x0040
  474. #define ICBTAG_FLAG_SETGID 0x0080
  475. #define ICBTAG_FLAG_STICKY 0x0100
  476. #define ICBTAG_FLAG_CONTIGUOUS 0x0200
  477. #define ICBTAG_FLAG_SYSTEM 0x0400
  478. #define ICBTAG_FLAG_TRANSFORMED 0x0800
  479. #define ICBTAG_FLAG_MULTIVERSIONS 0x1000
  480. #define ICBTAG_FLAG_STREAM 0x2000
  481. /* Indirect Entry (ECMA 167r3 4/14.7) */
  482. struct indirectEntry
  483. {
  484. tag descTag;
  485. icbtag icbTag;
  486. long_ad indirectICB;
  487. } __attribute__ ((packed));
  488. /* Terminal Entry (ECMA 167r3 4/14.8) */
  489. struct terminalEntry
  490. {
  491. tag descTag;
  492. icbtag icbTag;
  493. } __attribute__ ((packed));
  494. /* File Entry (ECMA 167r3 4/14.9) */
  495. struct fileEntry
  496. {
  497. tag descTag;
  498. icbtag icbTag;
  499. uint32_t uid;
  500. uint32_t gid;
  501. uint32_t permissions;
  502. uint16_t fileLinkCount;
  503. uint8_t recordFormat;
  504. uint8_t recordDisplayAttr;
  505. uint32_t recordLength;
  506. uint64_t informationLength;
  507. uint64_t logicalBlocksRecorded;
  508. timestamp accessTime;
  509. timestamp modificationTime;
  510. timestamp attrTime;
  511. uint32_t checkpoint;
  512. long_ad extendedAttrICB;
  513. regid impIdent;
  514. uint64_t uniqueID;
  515. uint32_t lengthExtendedAttr;
  516. uint32_t lengthAllocDescs;
  517. uint8_t extendedAttr[0];
  518. uint8_t allocDescs[0];
  519. } __attribute__ ((packed));
  520. /* Permissions (ECMA 167r3 4/14.9.5) */
  521. #define FE_PERM_O_EXEC 0x00000001U
  522. #define FE_PERM_O_WRITE 0x00000002U
  523. #define FE_PERM_O_READ 0x00000004U
  524. #define FE_PERM_O_CHATTR 0x00000008U
  525. #define FE_PERM_O_DELETE 0x00000010U
  526. #define FE_PERM_G_EXEC 0x00000020U
  527. #define FE_PERM_G_WRITE 0x00000040U
  528. #define FE_PERM_G_READ 0x00000080U
  529. #define FE_PERM_G_CHATTR 0x00000100U
  530. #define FE_PERM_G_DELETE 0x00000200U
  531. #define FE_PERM_U_EXEC 0x00000400U
  532. #define FE_PERM_U_WRITE 0x00000800U
  533. #define FE_PERM_U_READ 0x00001000U
  534. #define FE_PERM_U_CHATTR 0x00002000U
  535. #define FE_PERM_U_DELETE 0x00004000U
  536. /* Record Format (ECMA 167r3 4/14.9.7) */
  537. #define FE_RECORD_FMT_UNDEF 0x00
  538. #define FE_RECORD_FMT_FIXED_PAD 0x01
  539. #define FE_RECORD_FMT_FIXED 0x02
  540. #define FE_RECORD_FMT_VARIABLE8 0x03
  541. #define FE_RECORD_FMT_VARIABLE16 0x04
  542. #define FE_RECORD_FMT_VARIABLE16_MSB 0x05
  543. #define FE_RECORD_FMT_VARIABLE32 0x06
  544. #define FE_RECORD_FMT_PRINT 0x07
  545. #define FE_RECORD_FMT_LF 0x08
  546. #define FE_RECORD_FMT_CR 0x09
  547. #define FE_RECORD_FMT_CRLF 0x0A
  548. #define FE_RECORD_FMT_LFCR 0x0B
  549. #define Record Display Attributes (ECMA 167r3 4/14.9.8) */
  550. #define FE_RECORD_DISPLAY_ATTR_UNDEF 0x00
  551. #define FE_RECORD_DISPLAY_ATTR_1 0x01
  552. #define FE_RECORD_DISPLAY_ATTR_2 0x02
  553. #define FE_RECORD_DISPLAY_ATTR_3 0x03
  554. /* Extended Attribute Header Descriptor (ECMA 167r3 4/14.10.1) */
  555. struct extendedAttrHeaderDesc
  556. {
  557. tag descTag;
  558. uint32_t impAttrLocation;
  559. uint32_t appAttrLocation;
  560. } __attribute__ ((packed));
  561. /* Generic Format (ECMA 167r3 4/14.10.2) */
  562. struct genericFormat
  563. {
  564. uint32_t attrType;
  565. uint8_t attrSubtype;
  566. uint8_t reserved[3];
  567. uint32_t attrLength;
  568. uint8_t attrData[0];
  569. } __attribute__ ((packed));
  570. /* Character Set Information (ECMA 167r3 4/14.10.3) */
  571. struct charSetInfo
  572. {
  573. uint32_t attrType;
  574. uint8_t attrSubtype;
  575. uint8_t reserved[3];
  576. uint32_t attrLength;
  577. uint32_t escapeSeqLength;
  578. uint8_t charSetType;
  579. uint8_t escapeSeq[0];
  580. } __attribute__ ((packed));
  581. /* Alternate Permissions (ECMA 167r3 4/14.10.4) */
  582. struct altPerms
  583. {
  584. uint32_t attrType;
  585. uint8_t attrSubtype;
  586. uint8_t reserved[3];
  587. uint32_t attrLength;
  588. uint16_t ownerIdent;
  589. uint16_t groupIdent;
  590. uint16_t permission;
  591. } __attribute__ ((packed));
  592. /* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */
  593. struct fileTimesExtAttr
  594. {
  595. uint32_t attrType;
  596. uint8_t attrSubtype;
  597. uint8_t reserved[3];
  598. uint32_t attrLength;
  599. uint32_t dataLength;
  600. uint32_t fileTimeExistence;
  601. uint8_t fileTimes;
  602. } __attribute__ ((packed));
  603. /* FileTimeExistence (ECMA 167r3 4/14.10.5.6) */
  604. #define FTE_CREATION 0x00000001
  605. #define FTE_DELETION 0x00000004
  606. #define FTE_EFFECTIVE 0x00000008
  607. #define FTE_BACKUP 0x00000002
  608. /* Information Times Extended Attribute (ECMA 167r3 4/14.10.6) */
  609. struct infoTimesExtAttr
  610. {
  611. uint32_t attrType;
  612. uint8_t attrSubtype;
  613. uint8_t reserved[3];
  614. uint32_t attrLength;
  615. uint32_t dataLength;
  616. uint32_t infoTimeExistence;
  617. uint8_t infoTimes[0];
  618. } __attribute__ ((packed));
  619. /* Device Specification (ECMA 167r3 4/14.10.7) */
  620. struct deviceSpec
  621. {
  622. uint32_t attrType;
  623. uint8_t attrSubtype;
  624. uint8_t reserved[3];
  625. uint32_t attrLength;
  626. uint32_t impUseLength;
  627. uint32_t majorDeviceIdent;
  628. uint32_t minorDeviceIdent;
  629. uint8_t impUse[0];
  630. } __attribute__ ((packed));
  631. /* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */
  632. struct impUseExtAttr
  633. {
  634. uint32_t attrType;
  635. uint8_t attrSubtype;
  636. uint8_t reserved[3];
  637. uint32_t attrLength;
  638. uint32_t impUseLength;
  639. regid impIdent;
  640. uint8_t impUse[0];
  641. } __attribute__ ((packed));
  642. /* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */
  643. struct appUseExtAttr
  644. {
  645. uint32_t attrType;
  646. uint8_t attrSubtype;
  647. uint8_t reserved[3];
  648. uint32_t attrLength;
  649. uint32_t appUseLength;
  650. regid appIdent;
  651. uint8_t appUse[0];
  652. } __attribute__ ((packed));
  653. #define EXTATTR_CHAR_SET 1
  654. #define EXTATTR_ALT_PERMS 3
  655. #define EXTATTR_FILE_TIMES 5
  656. #define EXTATTR_INFO_TIMES 6
  657. #define EXTATTR_DEV_SPEC 12
  658. #define EXTATTR_IMP_USE 2048
  659. #define EXTATTR_APP_USE 65536
  660. /* Unallocated Space Entry (ECMA 167r3 4/14.11) */
  661. struct unallocSpaceEntry
  662. {
  663. tag descTag;
  664. icbtag icbTag;
  665. uint32_t lengthAllocDescs;
  666. uint8_t allocDescs[0];
  667. } __attribute__ ((packed));
  668. /* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */
  669. struct spaceBitmapDesc
  670. {
  671. tag descTag;
  672. uint32_t numOfBits;
  673. uint32_t numOfBytes;
  674. uint8_t bitmap[0];
  675. } __attribute__ ((packed));
  676. /* Partition Integrity Entry (ECMA 167r3 4/14.13) */
  677. struct partitionIntegrityEntry
  678. {
  679. tag descTag;
  680. icbtag icbTag;
  681. timestamp recordingDateAndTime;
  682. uint8_t integrityType;
  683. uint8_t reserved[175];
  684. regid impIdent;
  685. uint8_t impUse[256];
  686. } __attribute__ ((packed));
  687. /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
  688. /* Extent Length (ECMA 167r3 4/14.14.1.1) */
  689. #define EXT_RECORDED_ALLOCATED 0x00000000
  690. #define EXT_NOT_RECORDED_ALLOCATED 0x40000000
  691. #define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000
  692. #define EXT_NEXT_EXTENT_ALLOCDECS 0xC0000000
  693. /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
  694. /* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */
  695. /* Logical Volume Header Descriptor (ECMA 167r3 4/14.15) */
  696. struct logicalVolHeaderDesc
  697. {
  698. uint64_t uniqueID;
  699. uint8_t reserved[24];
  700. } __attribute__ ((packed));
  701. /* Path Component (ECMA 167r3 4/14.16.1) */
  702. struct pathComponent
  703. {
  704. uint8_t componentType;
  705. uint8_t lengthComponentIdent;
  706. uint16_t componentFileVersionNum;
  707. dstring componentIdent[0];
  708. } __attribute__ ((packed));
  709. /* File Entry (ECMA 167r3 4/14.17) */
  710. struct extendedFileEntry
  711. {
  712. tag descTag;
  713. icbtag icbTag;
  714. uint32_t uid;
  715. uint32_t gid;
  716. uint32_t permissions;
  717. uint16_t fileLinkCount;
  718. uint8_t recordFormat;
  719. uint8_t recordDisplayAttr;
  720. uint32_t recordLength;
  721. uint64_t informationLength;
  722. uint64_t objectSize;
  723. uint64_t logicalBlocksRecorded;
  724. timestamp accessTime;
  725. timestamp modificationTime;
  726. timestamp createTime;
  727. timestamp attrTime;
  728. uint32_t checkpoint;
  729. uint32_t reserved;
  730. long_ad extendedAttrICB;
  731. long_ad streamDirectoryICB;
  732. regid impIdent;
  733. uint64_t uniqueID;
  734. uint32_t lengthExtendedAttr;
  735. uint32_t lengthAllocDescs;
  736. uint8_t extendedAttr[0];
  737. uint8_t allocDescs[0];
  738. } __attribute__ ((packed));
  739. #endif /* _ECMA_167_H */