1 /* $NetBSD: iso9660_rrip.h,v 1.5 2009/01/10 22:06:29 bjh21 Exp $ */
4 * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
5 * Perez-Rathke and Ram Vedam. All rights reserved.
7 * This code was written by Daniel Watt, Walter Deignan, Ryan Gabrys,
8 * Alan Perez-Rathke and Ram Vedam.
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY DANIEL WATT, WALTER DEIGNAN, RYAN
21 * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL DANIEL WATT, WALTER DEIGNAN, RYAN
25 * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 * USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
36 #ifndef __ISO9660_RRIP_H__
37 #define __ISO9660_RRIP_H__
40 * This will hold all the functions needed to
41 * write an ISO 9660 image with Rock Ridge Extensions
44 /* For writing must use ISO_RRIP_EXTREF structure */
47 #include <cd9660_rrip.h>
49 #include <sys/queue.h>
51 #define PX_LENGTH 0x2C
52 #define PN_LENGTH 0x14
53 #define TF_CREATION 0x00
54 #define TF_MODIFY 0x01
55 #define TF_ACCESS 0x02
56 #define TF_ATTRIBUTES 0x04
57 #define TF_BACKUP 0x08
58 #define TF_EXPIRATION 0x10
59 #define TF_EFFECTIVE 0x20
60 #define TF_LONGFORM 0x40
61 #define NM_CONTINUE 0x80
62 #define NM_CURRENT 0x100
63 #define NM_PARENT 0x200
66 #define SUSP_LOC_ENTRY 0x01
67 #define SUSP_LOC_DOT 0x02
68 #define SUSP_LOC_DOTDOT 0x04
70 #define SUSP_TYPE_SUSP 1
71 #define SUSP_TYPE_RRIP 2
73 #define SUSP_ENTRY_SUSP_CE 1
74 #define SUSP_ENTRY_SUSP_PD 2
75 #define SUSP_ENTRY_SUSP_SP 3
76 #define SUSP_ENTRY_SUSP_ST 4
77 #define SUSP_ENTRY_SUSP_ER 5
78 #define SUSP_ENTRY_SUSP_ES 6
80 #define SUSP_ENTRY_RRIP_PX 1
81 #define SUSP_ENTRY_RRIP_PN 2
82 #define SUSP_ENTRY_RRIP_SL 3
83 #define SUSP_ENTRY_RRIP_NM 4
84 #define SUSP_ENTRY_RRIP_CL 5
85 #define SUSP_ENTRY_RRIP_PL 6
86 #define SUSP_ENTRY_RRIP_RE 7
87 #define SUSP_ENTRY_RRIP_TF 8
88 #define SUSP_ENTRY_RRIP_SF 9
90 #define SUSP_RRIP_ER_EXT_ID "IEEE_P1282"
91 #define SUSP_RRIP_ER_EXT_DES "THE IEEE P1282 PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS."
92 #define SUSP_RRIP_ER_EXT_SRC "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION."
94 #define SL_FLAGS_NONE 0
95 #define SL_FLAGS_CONTINUE 1
96 #define SL_FLAGS_CURRENT 2
97 #define SL_FLAGS_PARENT 4
98 #define SL_FLAGS_ROOT 8
102 u_char mode [ISODCL(5,12)];
103 u_char links [ISODCL(13,20)];
104 u_char uid [ISODCL(21,28)];
105 u_char gid [ISODCL(29,36)];
106 u_char serial [ISODCL(37,44)];
111 u_char high [ISODCL(5,12)];
112 u_char low [ISODCL(13,20)];
117 u_char flags [ISODCL ( 4, 4)];
118 u_char component [ISODCL ( 4, 256)];
124 u_char flags [ISODCL ( 4, 4)];
125 u_char timestamp [ISODCL ( 5, 256)];
128 #define RRIP_NM_FLAGS_NONE 0x00
129 #define RRIP_NM_FLAGS_CONTINUE 0x01
130 #define RRIP_NM_FLAGS_CURRENT 0x02
131 #define RRIP_NM_FLAGS_PARENT 0x04
135 u_char flags [ISODCL ( 4, 4)];
136 u_char altname [ISODCL ( 4, 256)];
139 /* Note that this is the same structure as cd9660_rrip.h : ISO_RRIP_CONT */
142 u_char ca_sector [ISODCL ( 5, 12)];
143 u_char offset [ISODCL ( 13, 20)];
144 u_char length [ISODCL ( 21, 28)];
149 u_char padding_area [ISODCL ( 4, 256)];
154 u_char check [ISODCL ( 4, 5)];
155 u_char len_skp [ISODCL ( 6, 6)];
164 u_char len_id [ISODCL ( 4, 4)];
165 u_char len_des [ISODCL ( 5, 5)];
166 u_char len_src [ISODCL ( 6, 6)];
167 u_char ext_ver [ISODCL ( 7, 7)];
168 u_char ext_data [ISODCL (8,256)];
169 /* u_char ext_id [ISODCL ( 8, 256)];
170 u_char ext_des [ISODCL ( 257, 513)];
171 u_char ext_src [ISODCL ( 514, 770)];*/
176 u_char ext_seq [ISODCL ( 4, 4)];
204 struct ISO_SUSP_ATTRIBUTES {
208 char last_in_suf; /* last entry in the System Use Field? */
209 /* Dan's addons - will merge later. This allows use of a switch */
210 char susp_type; /* SUSP or RRIP */
211 char entry_type; /* Record type */
213 TAILQ_ENTRY(ISO_SUSP_ATTRIBUTES) rr_ll;
216 #define CD9660_SUSP_ENTRY_SIZE(entry)\
217 ((int) ((entry)->attr.su_entry.SP.h.length[0]))
219 /* Recursive function - move later to func pointer code*/
220 int cd9660_susp_finalize(cd9660node *);
222 /* These two operate on single nodes */
223 int cd9660_susp_finalize_node(cd9660node *);
224 int cd9660_rrip_finalize_node(cd9660node *);
226 /* POSIX File attribute */
227 int cd9660node_rrip_px(struct ISO_SUSP_ATTRIBUTES *, fsnode *);
230 int cd9660node_rrip_pn(struct ISO_SUSP_ATTRIBUTES *, fsnode *);
233 int cd9660node_rrip_SL(struct ISO_SUSP_ATTRIBUTES *, fsnode *);
235 /* Alternate Name function */
236 void cd9660_rrip_NM(cd9660node *);
237 void cd9660_rrip_add_NM(cd9660node *,const char *);
239 /* Parent and child link function */
240 int cd9660_rrip_PL(struct ISO_SUSP_ATTRIBUTES *, cd9660node *);
241 int cd9660_rrip_CL(struct ISO_SUSP_ATTRIBUTES *, cd9660node *);
242 int cd9660_rrip_RE(struct ISO_SUSP_ATTRIBUTES *, cd9660node *);
244 int cd9660node_rrip_tf(struct ISO_SUSP_ATTRIBUTES *, fsnode *);
249 * Relocation directory function. I'm not quite sure what
250 * sort of parameters are needed, but personally I don't think
251 * any parameters are needed except for the memory address where
252 * the information needs to be put in
254 int cd9660node_rrip_re(void *, fsnode *);
257 * Don't know if this function is needed because it apparently is an
258 * optional feature that does not really need to be implemented but I
259 * thought I should add it anyway.
261 int cd9660_susp_ce (struct ISO_SUSP_ATTRIBUTES *, cd9660node *);
262 int cd9660_susp_pd (struct ISO_SUSP_ATTRIBUTES *, int);
263 int cd9660_susp_sp (struct ISO_SUSP_ATTRIBUTES *, cd9660node *);
264 int cd9660_susp_st (struct ISO_SUSP_ATTRIBUTES *, cd9660node *);
266 struct ISO_SUSP_ATTRIBUTES *cd9660_susp_ER(cd9660node *, u_char, const char *,
267 const char *, const char *);
268 struct ISO_SUSP_ATTRIBUTES *cd9660_susp_ES(struct ISO_SUSP_ATTRIBUTES*,
272 /* Helper functions */
274 /* Common SUSP/RRIP functions */
275 int cd9660_susp_initialize(cd9660node *, cd9660node *, cd9660node *);
276 int cd9660_susp_initialize_node(cd9660node *);
277 struct ISO_SUSP_ATTRIBUTES *cd9660node_susp_create_node(int, int, const char *,
279 struct ISO_SUSP_ATTRIBUTES *cd9660node_susp_add_entry(cd9660node *,
280 struct ISO_SUSP_ATTRIBUTES *, struct ISO_SUSP_ATTRIBUTES *, int);
282 /* RRIP specific functions */
283 int cd9660_rrip_initialize_node(cd9660node *, cd9660node *, cd9660node *);
284 void cd9660_createSL(cd9660node *);
286 /* Functions that probably can be removed */
287 /* int cd9660node_initialize_node(int, char *); */