udftools

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
libudffs.h
Go to the documentation of this file.
1 /*
2 * libudffs.h
3 *
4 * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 */
22
28 #ifndef __LIBUDFFS_H
29 #define __LIBUDFFS_H
30
31 #include "ecma_167.h"
32 #include "osta_udf.h"
33 #include "udf_endian.h"
34
35 #define FLAG_FREED_BITMAP 0x00000001
36 #define FLAG_FREED_TABLE 0x00000002
37 #define FLAG_UNALLOC_BITMAP 0x00000004
38 #define FLAG_UNALLOC_TABLE 0x00000008
39 #define FLAG_SPACE_BITMAP (FLAG_FREED_BITMAP|FLAG_UNALLOC_BITMAP)
40 #define FLAG_SPACE_TABLE (FLAG_FREED_TABLE|FLAG_UNALLOC_TABLE)
41 #define FLAG_SPACE (FLAG_SPACE_BITMAP|FLAG_SPACE_TABLE)
42
43 #define FLAG_EFE 0x00000010
44
45 #define FLAG_UNICODE8 0x00000020
46 #define FLAG_UNICODE16 0x00000040
47 #define FLAG_UTF8 0x00000080
48 #define FLAG_CHARSET (FLAG_UNICODE8|FLAG_UNICODE16|FLAG_UTF8)
49
50 #define FLAG_STRATEGY4096 0x00000100
51 #define FLAG_BLANK_TERMINAL 0x00000200
52
53 #define FLAG_BRIDGE 0x00000400
54 #define FLAG_CLOSED 0x00000800
55 #define FLAG_VAT 0x00001000
56
57 struct udf_extent;
58 struct udf_desc;
59 struct udf_data;
60
61 enum udf_space_type
62 {
63 RESERVED = 0x0001, /* Reserved Space */
64 VRS = 0x0002, /* Volume Recognition Sequence */
65 ANCHOR = 0x0004, /* Anchor */
66 PVDS = 0x0008, /* Primary Volume Descriptor Sequence */
67 RVDS = 0x0010, /* Reserved Volume Descriptor Sequence */
68 LVID = 0x0020, /* Logical Volume Identifier */
69 STABLE = 0x0040, /* Sparing Table */
70 SSPACE = 0x0080, /* Sparing Space */
71 PSPACE = 0x0100, /* Partition Space */
72 USPACE = 0x0200, /* Unallocated Space */
73 BAD = 0x0400, /* Bad Blocks */
74 UDF_SPACE_TYPE_SIZE = 11,
75 };
76
77 struct udf_sizing
78 {
79 uint32_t align;
80 uint32_t numSize;
81 uint32_t denomSize;
82 uint32_t minSize;
83 };
84
85 enum udf_alloc_type
86 {
87 VDS_SIZE,
88 LVID_SIZE,
89 STABLE_SIZE,
90 SSPACE_SIZE,
91 PSPACE_SIZE,
92 UDF_ALLOC_TYPE_SIZE,
93 };
94
95 struct udf_disc
96 {
97 uint16_t udf_rev;
98 uint16_t blocksize;
99 uint8_t blocksize_bits;
100 uint32_t flags;
101
102 uint32_t uid;
103 uint32_t gid;
104
105 struct udf_sizing sizing[UDF_ALLOC_TYPE_SIZE];
106
107 int (*write)(struct udf_disc *, struct udf_extent *);
108 void *write_data;
109
110 struct volStructDesc *udf_vrs[3];
111 struct anchorVolDescPtr *udf_anchor[3];
112 struct primaryVolDesc *udf_pvd[2];
113 struct logicalVolDesc *udf_lvd[2];
114 struct partitionDesc *udf_pd[2];
115 struct unallocSpaceDesc *udf_usd[2];
116 struct impUseVolDesc *udf_iuvd[2];
117 struct terminatingDesc *udf_td[2];
118 struct logicalVolIntegrityDesc *udf_lvid;
119
120 struct sparingTable *udf_stable[4];
121
122 uint32_t *vat;
123 uint64_t vat_entries;
124
125 struct fileSetDesc *udf_fsd;
126
127 struct udf_extent *head;
128 struct udf_extent *tail;
129 };
130
131 struct udf_extent
132 {
133 enum udf_space_type space_type;
134 uint32_t start;
135 uint32_t blocks;
136
137 struct udf_desc *head;
138 struct udf_desc *tail;
139
140 struct udf_extent *next;
141 struct udf_extent *prev;
142 };
143
144 struct udf_desc
145 {
146 uint16_t ident;
147 uint32_t offset;
148 uint64_t length;
149 struct udf_data *data;
150
151 struct udf_desc *next;
152 struct udf_desc *prev;
153 };
154
155 struct udf_data
156 {
157 uint64_t length;
158 void *buffer;
159 struct udf_data *next;
160 struct udf_data *prev;
161 };
162
163 /* crc.c */
164 extern uint16_t udf_crc(uint8_t *, uint32_t, uint16_t);
165
166 /* extent.c */
167 struct udf_extent *next_extent(struct udf_extent *, enum udf_space_type);
168 uint32_t next_extent_size(struct udf_extent *, enum udf_space_type, uint32_t, uint32_t);
169 struct udf_extent *prev_extent(struct udf_extent *, enum udf_space_type);
170 uint32_t prev_extent_size(struct udf_extent *, enum udf_space_type, uint32_t, uint32_t);
171 struct udf_extent *find_extent(struct udf_disc *, uint32_t);
172 struct udf_extent *set_extent(struct udf_disc *, enum udf_space_type, uint32_t,uint32_t);
173 struct udf_desc *next_desc(struct udf_desc *, uint16_t);
174 struct udf_desc *find_desc(struct udf_extent *, uint32_t);
175 struct udf_desc *set_desc(struct udf_disc *, struct udf_extent *, uint16_t, uint32_t, uint32_t, struct udf_data *);
176 void append_data(struct udf_desc *, struct udf_data *);
177 struct udf_data *alloc_data(void *, int);
178
179 /* unicode.c */
180 extern size_t decode_utf8(dstring *, char *, size_t);
181 extern size_t encode_utf8(dstring *, char *, char *, size_t);
182 extern size_t decode_string(struct udf_disc *, dstring *, char *, size_t);
183 extern size_t encode_string(struct udf_disc *, dstring *, char *, char *, size_t);
184
185 #endif /* __LIBUDFFS_H */
udf_disc::write_data
void * write_data
Definition: libudffs.h:108
udf_space_type
udf_space_type
Definition: libudffs.h:61
BAD
Definition: libudffs.h:73
udf_extent::blocks
uint32_t blocks
Definition: libudffs.h:135
udf_disc::vat_entries
uint64_t vat_entries
Definition: libudffs.h:123
udf_disc::tail
struct udf_extent * tail
Definition: libudffs.h:128
udf_disc::blocksize
uint16_t blocksize
Definition: libudffs.h:98
udf_disc::udf_lvid
struct logicalVolIntegrityDesc * udf_lvid
Definition: libudffs.h:118
PVDS
Definition: libudffs.h:66
next_desc
struct udf_desc * next_desc(struct udf_desc *, uint16_t)
find the next udf_descriptor of a given tag ident on a udf_descriptor list
Definition: extent.c:351
udf_endian.h
sparingTable
Definition: osta_udf.h:192
find_extent
struct udf_extent * find_extent(struct udf_disc *, uint32_t)
find the udf_extent on a udf_disc's udf_extent list which contains a particular block ...
Definition: extent.c:207
udf_disc::udf_pd
struct partitionDesc * udf_pd[2]
Definition: libudffs.h:114
USPACE
Definition: libudffs.h:72
udf_extent::next
struct udf_extent * next
Definition: libudffs.h:140
ecma_167.h
anchorVolDescPtr
Definition: ecma_167.h:233
udf_disc::vat
uint32_t * vat
Definition: libudffs.h:122
udf_crc
uint16_t udf_crc(uint8_t *, uint32_t, uint16_t)
Definition: crc.c:88
udf_extent::tail
struct udf_desc * tail
Definition: libudffs.h:138
decode_utf8
size_t decode_utf8(dstring *, char *, size_t)
Definition: unicode.c:32
udf_disc::udf_pvd
struct primaryVolDesc * udf_pvd[2]
Definition: libudffs.h:112
LVID
Definition: libudffs.h:68
udf_data::prev
struct udf_data * prev
Definition: libudffs.h:160
set_extent
struct udf_extent * set_extent(struct udf_disc *, enum udf_space_type, uint32_t, uint32_t)
set the space_type, location and size of a udf_extent on a udf_disc's udf_extent list, splitting the udf_extent if required to have the returned udf_extent only contain the requested blocks
Definition: extent.c:230
udf_disc::uid
uint32_t uid
Definition: libudffs.h:102
udf_disc::head
struct udf_extent * head
Definition: libudffs.h:127
udf_desc::length
uint64_t length
Definition: libudffs.h:148
udf_disc::udf_anchor
struct anchorVolDescPtr * udf_anchor[3]
Definition: libudffs.h:111
RESERVED
Definition: libudffs.h:63
udf_sizing
Definition: libudffs.h:77
find_desc
struct udf_desc * find_desc(struct udf_extent *, uint32_t)
search the udf_descriptor list of a udf_extent to find the udf_descriptor that describes a particular...
Definition: extent.c:366
dstring
uint8_t dstring
Definition: ecma_167.h:63
udf_desc::next
struct udf_desc * next
Definition: libudffs.h:151
udf_desc::data
struct udf_data * data
Definition: libudffs.h:149
encode_string
size_t encode_string(struct udf_disc *, dstring *, char *, char *, size_t)
Definition: unicode.c:191
udf_data::length
uint64_t length
Definition: libudffs.h:157
VRS
Definition: libudffs.h:64
ANCHOR
Definition: libudffs.h:65
prev_extent
struct udf_extent * prev_extent(struct udf_extent *, enum udf_space_type)
find the previous udf_extent of a given space_type on a udf_extent list
Definition: extent.c:159
next_extent_size
uint32_t next_extent_size(struct udf_extent *, enum udf_space_type, uint32_t, uint32_t)
find the next udf_extent of a given space_type on a udf_extent list that satisfies the necessary size...
Definition: extent.c:129
UDF_SPACE_TYPE_SIZE
Definition: libudffs.h:74
VDS_SIZE
Definition: libudffs.h:87
logicalVolDesc
Definition: ecma_167.h:296
SSPACE_SIZE
Definition: libudffs.h:90
udf_data::next
struct udf_data * next
Definition: libudffs.h:159
udf_desc::ident
uint16_t ident
Definition: libudffs.h:146
primaryVolDesc
Definition: ecma_167.h:203
udf_disc::udf_usd
struct unallocSpaceDesc * udf_usd[2]
Definition: libudffs.h:115
udf_alloc_type
udf_alloc_type
Definition: libudffs.h:85
udf_data
Definition: libudffs.h:155
udf_sizing::denomSize
uint32_t denomSize
Definition: libudffs.h:81
alloc_data
struct udf_data * alloc_data(void *, int)
allocate a new udf_data item and initialize it with either allocated zeros or the supplied payload ...
Definition: extent.c:462
udf_disc::sizing
struct udf_sizing sizing[UDF_ALLOC_TYPE_SIZE]
Definition: libudffs.h:105
SSPACE
Definition: libudffs.h:70
PSPACE_SIZE
Definition: libudffs.h:91
fileSetDesc
Definition: ecma_167.h:425
udf_disc::gid
uint32_t gid
Definition: libudffs.h:103
udf_extent
Definition: libudffs.h:131
udf_disc::udf_vrs
struct volStructDesc * udf_vrs[3]
Definition: libudffs.h:110
PSPACE
Definition: libudffs.h:71
udf_desc::prev
struct udf_desc * prev
Definition: libudffs.h:152
LVID_SIZE
Definition: libudffs.h:88
udf_extent::start
uint32_t start
Definition: libudffs.h:134
set_desc
struct udf_desc * set_desc(struct udf_disc *, struct udf_extent *, uint16_t, uint32_t, uint32_t, struct udf_data *)
allocate a new udf_descriptor having a udf_data item and insert it into the udf_descriptor list of a ...
Definition: extent.c:393
STABLE
Definition: libudffs.h:69
udf_disc::udf_td
struct terminatingDesc * udf_td[2]
Definition: libudffs.h:117
udf_sizing::minSize
uint32_t minSize
Definition: libudffs.h:82
udf_disc::flags
uint32_t flags
Definition: libudffs.h:100
encode_utf8
size_t encode_utf8(dstring *, char *, char *, size_t)
Definition: unicode.c:68
udf_desc
Definition: libudffs.h:144
logicalVolIntegrityDesc
Definition: ecma_167.h:360
udf_desc::offset
uint32_t offset
Definition: libudffs.h:147
terminatingDesc
Definition: ecma_167.h:353
udf_disc
Definition: libudffs.h:95
RVDS
Definition: libudffs.h:67
volStructDesc
Definition: ecma_167.h:101
udf_extent::head
struct udf_desc * head
Definition: libudffs.h:137
append_data
void append_data(struct udf_desc *, struct udf_data *)
append a udf_data list to the end of the udf_data list of a udf_descriptor and update the udf_descrip...
Definition: extent.c:442
STABLE_SIZE
Definition: libudffs.h:89
prev_extent_size
uint32_t prev_extent_size(struct udf_extent *, enum udf_space_type, uint32_t, uint32_t)
find the previous udf_extent of a given space_type on a udf_extent list that satisfies the necessary ...
Definition: extent.c:176
udf_extent::prev
struct udf_extent * prev
Definition: libudffs.h:141
udf_disc::blocksize_bits
uint8_t blocksize_bits
Definition: libudffs.h:99
udf_disc::udf_rev
uint16_t udf_rev
Definition: libudffs.h:97
udf_data::buffer
void * buffer
Definition: libudffs.h:158
UDF_ALLOC_TYPE_SIZE
Definition: libudffs.h:92
next_extent
struct udf_extent * next_extent(struct udf_extent *, enum udf_space_type)
find the next udf_extent of a given space_type on a udf_extent list
Definition: extent.c:112
udf_disc::udf_fsd
struct fileSetDesc * udf_fsd
Definition: libudffs.h:125
udf_sizing::align
uint32_t align
Definition: libudffs.h:79
unallocSpaceDesc
Definition: ecma_167.h:344
udf_disc::write
int(* write)(struct udf_disc *, struct udf_extent *)
Definition: libudffs.h:107
partitionDesc
Definition: ecma_167.h:260
udf_extent::space_type
enum udf_space_type space_type
Definition: libudffs.h:133
udf_disc::udf_lvd
struct logicalVolDesc * udf_lvd[2]
Definition: libudffs.h:113
decode_string
size_t decode_string(struct udf_disc *, dstring *, char *, size_t)
Definition: unicode.c:178
udf_disc::udf_stable
struct sparingTable * udf_stable[4]
Definition: libudffs.h:120
udf_sizing::numSize
uint32_t numSize
Definition: libudffs.h:80
impUseVolDesc
Definition: ecma_167.h:251
udf_disc::udf_iuvd
struct impUseVolDesc * udf_iuvd[2]
Definition: libudffs.h:116
osta_udf.h