hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
kernel/fs/udf/ecma_167.h
....@@ -2,9 +2,10 @@
22 * ecma_167.h
33 *
44 * This file is based on ECMA-167 3rd edition (June 1997)
5
- * http://www.ecma.ch
5
+ * https://www.ecma.ch
66 *
7
- * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
7
+ * Copyright (c) 2001-2002 Ben Fennema
8
+ * Copyright (c) 2017-2019 Pali Rohár <pali@kernel.org>
89 * All rights reserved.
910 *
1011 * Redistribution and use in source and binary forms, with or without
....@@ -32,10 +33,18 @@
3233 * SUCH DAMAGE.
3334 */
3435
36
+/**
37
+ * @file
38
+ * ECMA-167r3 defines and structure definitions
39
+ */
40
+
3541 #include <linux/types.h>
3642
3743 #ifndef _ECMA_167_H
3844 #define _ECMA_167_H 1
45
+
46
+/* Character sets and coding - d-characters (ECMA 167r3 1/7.2) */
47
+typedef uint8_t dchars;
3948
4049 /* Character set specification (ECMA 167r3 1/7.2.1) */
4150 struct charspec {
....@@ -54,6 +63,7 @@
5463 #define CHARSPEC_TYPE_CS7 0x07 /* (1/7.2.9) */
5564 #define CHARSPEC_TYPE_CS8 0x08 /* (1/7.2.10) */
5665
66
+/* Fixed-length character fields - d-string (EMCA 167r3 1/7.2.12) */
5767 typedef uint8_t dstring;
5868
5969 /* Timestamp (ECMA 167r3 1/7.3) */
....@@ -85,8 +95,8 @@
8595 } __packed;
8696
8797 /* Flags (ECMA 167r3 1/7.4.1) */
88
-#define ENTITYID_FLAGS_DIRTY 0x00
89
-#define ENTITYID_FLAGS_PROTECTED 0x01
98
+#define ENTITYID_FLAGS_DIRTY 0x01
99
+#define ENTITYID_FLAGS_PROTECTED 0x02
90100
91101 /* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
92102 #define VSD_STD_ID_LEN 5
....@@ -186,6 +196,13 @@
186196 uint8_t structVersion;
187197 uint8_t reserved;
188198 uint8_t structData[2040];
199
+} __packed;
200
+
201
+/* Generic Descriptor */
202
+struct genericDesc {
203
+ struct tag descTag;
204
+ __le32 volDescSeqNum;
205
+ uint8_t reserved[492];
189206 } __packed;
190207
191208 /* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
....@@ -302,7 +319,7 @@
302319
303320 /* Partition Map Type (ECMA 167r3 3/10.7.1.1) */
304321 #define GP_PARTITION_MAP_TYPE_UNDEF 0x00
305
-#define GP_PARTIITON_MAP_TYPE_1 0x01
322
+#define GP_PARTITION_MAP_TYPE_1 0x01
306323 #define GP_PARTITION_MAP_TYPE_2 0x02
307324
308325 /* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */
....@@ -709,6 +726,7 @@
709726 #define EXTATTR_DEV_SPEC 12
710727 #define EXTATTR_IMP_USE 2048
711728 #define EXTATTR_APP_USE 65536
729
+#define EXTATTR_SUBTYPE 1
712730
713731 /* Unallocated Space Entry (ECMA 167r3 4/14.11) */
714732 struct unallocSpaceEntry {
....@@ -740,10 +758,12 @@
740758 /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
741759
742760 /* Extent Length (ECMA 167r3 4/14.14.1.1) */
761
+#define EXT_LENGTH_MASK 0x3FFFFFFF
762
+#define EXT_TYPE_MASK 0xC0000000
743763 #define EXT_RECORDED_ALLOCATED 0x00000000
744764 #define EXT_NOT_RECORDED_ALLOCATED 0x40000000
745765 #define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000
746
-#define EXT_NEXT_EXTENT_ALLOCDECS 0xC0000000
766
+#define EXT_NEXT_EXTENT_ALLOCDESCS 0xC0000000
747767
748768 /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
749769
....@@ -760,7 +780,7 @@
760780 uint8_t componentType;
761781 uint8_t lengthComponentIdent;
762782 __le16 componentFileVersionNum;
763
- dstring componentIdent[0];
783
+ dchars componentIdent[0];
764784 } __packed;
765785
766786 /* File Entry (ECMA 167r3 4/14.17) */