4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
35 #define UD_VOL_REC_START (32 * 1024)
36 #define UD_VOL_REC_BSZ 2048
37 #define UD_VOL_REC_END (256 * UD_VOL_REC_BSZ)
39 #define UD_ECMA_VER2 0x00000002
40 #define UD_ECMA_VER3 0x00000003
41 #define UD_ECMA_UNKN 0xFFFFFFFF
47 #define lb_roundup(sz, lbsz) \
48 (((sz) + (lbsz - 1)) & (~(lbsz - 1)))
58 uint32_t part_loc
[MAX_PARTS
];
59 uint32_t part_len
[MAX_PARTS
];
70 * All addresses are the lbsize block numbers
71 * offseted into the partition
75 #define INVALID_UDFS 0x0000
76 #define VALID_UDFS 0x0001
77 #define VALID_MVDS 0x0002
78 #define VALID_RVDS 0x0004
80 uint32_t ecma_version
;
89 uint32_t avdp_loc
; /* First Readable avdp */
101 * location of the latest lvid
110 * Location of the most usable fsd
111 * on WORM we have to follow till the
113 * FSD location is absolute disk location
114 * after translating using maps and partitions
123 uint32_t vat_icb_loc
;
124 uint32_t vat_icb_len
;
128 uint16_t udp_flags
; /* See below */
129 #define UDP_BITMAPS 0x00
130 #define UDP_SPACETBLS 0x01
132 uint16_t udp_number
; /* partition Number */
133 uint32_t udp_seqno
; /* to find the prevailaing desc */
134 uint32_t udp_access
; /* access type */
135 uint32_t udp_start
; /* Starting block no of partition */
136 uint32_t udp_length
; /* Lenght of the partition */
137 uint32_t udp_unall_loc
; /* unall space tbl or bitmap loc */
138 uint32_t udp_unall_len
; /* unall space tbl or bitmap length */
139 uint32_t udp_freed_loc
; /* freed space tbl or bitmap loc */
140 uint32_t udp_freed_len
; /* freed space tbl or bitmap length */
143 uint32_t udp_nfree
; /* No of free blocks in the partition */
144 uint32_t udp_nblocks
; /* Total no of blks in the partition */
151 #define UDM_MAP_NORM 0x00
152 #define UDM_MAP_VPM 0x01
153 #define UDM_MAP_SPM 0x02
158 uint32_t udm_vat_icb_loc
;
167 uint32_t udm_loc
[MAX_SPM
];
168 struct buf
*udm_sbp
[MAX_SPM
];
169 caddr_t udm_spaddr
[MAX_SPM
];
174 #define REG_DOM_ID 0x1
175 #define REG_UDF_ID 0x2
176 #define REG_UDF_II 0x4
178 #define EI_FLG_DIRTY 0x01
179 #define EI_FLG_PROT 0x02
181 struct dom_id_suffix
{
182 uint16_t dis_udf_revison
;
183 uint8_t dis_domain_flags
;
187 #define PROTECT_SOFT_WRITE 0x01
188 #define PROTECT_HARD_WRITE 0x02
190 struct udf_id_suffix
{
191 uint16_t uis_udf_revision
;
192 uint8_t uis_os_class
;
193 uint8_t uis_os_identifier
;
197 struct impl_id_suffix
{
198 uint8_t iis_os_class
;
199 uint8_t iis_os_identifier
;
203 #define OS_CLASS_UNDEFINED 0x00
204 #define OS_CLASS_DOS_WIN3x 0x01
205 #define OS_CLASS_OS_2 0x02
206 #define OS_CLASS_MAC_OS_7 0x02
207 #define OS_CLASS_UNIX 0x04
208 #define OS_CLASS_WIN_95 0x05
209 #define OS_CLASS_WIN_NT 0x06
211 #define OS_IDENTIFIER_GENERIC 0x00
212 #define OS_IDENTIFIER_IBM_AIX 0x01
213 #define OS_IDENTIFIER_SOLARIS 0x02
214 #define OS_IDENTIFIER_HP_UX 0x03
215 #define OS_IDENTIFIER_SG_IRIX 0x04
216 #define OS_IDENTIFIER_LINUX 0x05
217 #define OS_IDENTIFIER_MK_LINUX 0x06
218 #define OS_IDENTIFIER_FREE_BSD 0x07
223 struct ud_part part
[MAX_PARTS
];
225 struct ud_map maps
[MAX_MAPS
];
229 typedef struct ud_handle
*ud_handle_t
;
232 int ud_init(int, ud_handle_t
*);
233 void ud_fini(ud_handle_t
);
234 int32_t ud_open_dev(ud_handle_t
, char *, uint32_t);
235 void ud_close_dev(ud_handle_t
);
236 int32_t ud_read_dev(ud_handle_t
, uint64_t, uint8_t *, uint32_t);
237 int32_t ud_write_dev(ud_handle_t
, uint64_t, uint8_t *, uint32_t);
239 int32_t ud_fill_udfs_info(ud_handle_t
);
240 int32_t ud_get_num_blks(ud_handle_t
, uint32_t *);
242 int32_t ud_verify_tag(ud_handle_t
, struct tag
*,
243 uint16_t, uint32_t, int32_t, int32_t);
244 void ud_make_tag(ud_handle_t
, struct tag
*, uint16_t, uint32_t, uint16_t);
245 uint32_t ud_xlate_to_daddr(ud_handle_t
, uint16_t, uint32_t);
246 void ud_convert2local(int8_t *, int8_t *, int32_t);
248 void print_charspec(FILE *, char *, struct charspec
*);
249 void print_dstring(FILE *, char *, uint16_t, char *, uint8_t);
250 void set_dstring(dstring_t
*, char *, int32_t);
251 void print_tstamp(FILE *, char *, tstamp_t
*);
252 void print_regid(FILE *, char *, struct regid
*, int32_t);
254 void print_ext_ad(FILE *, char *, struct extent_ad
*);
255 void print_tag(FILE *, struct tag
*);
256 void print_pvd(FILE *, struct pri_vol_desc
*);
257 void print_avd(FILE *, struct anch_vol_desc_ptr
*);
258 void print_vdp(FILE *, struct vol_desc_ptr
*);
259 void print_iuvd(FILE *, struct iuvd_desc
*);
260 void print_part(FILE *, struct part_desc
*);
261 void print_lvd(FILE *, struct log_vol_desc
*);
262 void print_usd(FILE *, struct unall_spc_desc
*);
263 void print_lvid(FILE *, struct log_vol_int_desc
*);
264 void print_part(FILE *, struct part_desc
*);
266 void print_fsd(FILE *, ud_handle_t h
, struct file_set_desc
*);
267 void print_phdr(FILE *, struct phdr_desc
*);
268 void print_fid(FILE *, struct file_id
*);
269 void print_aed(FILE *, struct alloc_ext_desc
*);
270 void print_icb_tag(FILE *, struct icb_tag
*);
271 void print_ie(FILE *, struct indirect_entry
*);
272 void print_td(FILE *, struct term_desc
*);
273 void print_fe(FILE *, struct file_entry
*);
274 void print_pmaps(FILE *, uint8_t *, int32_t);
275 void print_short_ad(FILE *, char *, struct short_ad
*);
276 void print_long_ad(FILE *, char *, struct long_ad
*);
282 #endif /* _UD_LIB_H */