1 /* $NetBSD: iso9660_rrip.h,v 1.6 2013/01/28 21:03:28 christos 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
34 #ifndef __ISO9660_RRIP_H__
35 #define __ISO9660_RRIP_H__
38 * This will hold all the functions needed to
39 * write an ISO 9660 image with Rock Ridge Extensions
42 /* For writing must use ISO_RRIP_EXTREF structure */
45 #include <cd9660_rrip.h>
47 #include <sys/queue.h>
49 #define PX_LENGTH 0x2C
50 #define PN_LENGTH 0x14
51 #define TF_CREATION 0x00
52 #define TF_MODIFY 0x01
53 #define TF_ACCESS 0x02
54 #define TF_ATTRIBUTES 0x04
55 #define TF_BACKUP 0x08
56 #define TF_EXPIRATION 0x10
57 #define TF_EFFECTIVE 0x20
58 #define TF_LONGFORM 0x40
59 #define NM_CONTINUE 0x80
60 #define NM_CURRENT 0x100
61 #define NM_PARENT 0x200
64 #define SUSP_LOC_ENTRY 0x01
65 #define SUSP_LOC_DOT 0x02
66 #define SUSP_LOC_DOTDOT 0x04
68 #define SUSP_TYPE_SUSP 1
69 #define SUSP_TYPE_RRIP 2
71 #define SUSP_ENTRY_SUSP_CE 1
72 #define SUSP_ENTRY_SUSP_PD 2
73 #define SUSP_ENTRY_SUSP_SP 3
74 #define SUSP_ENTRY_SUSP_ST 4
75 #define SUSP_ENTRY_SUSP_ER 5
76 #define SUSP_ENTRY_SUSP_ES 6
78 #define SUSP_ENTRY_RRIP_PX 1
79 #define SUSP_ENTRY_RRIP_PN 2
80 #define SUSP_ENTRY_RRIP_SL 3
81 #define SUSP_ENTRY_RRIP_NM 4
82 #define SUSP_ENTRY_RRIP_CL 5
83 #define SUSP_ENTRY_RRIP_PL 6
84 #define SUSP_ENTRY_RRIP_RE 7
85 #define SUSP_ENTRY_RRIP_TF 8
86 #define SUSP_ENTRY_RRIP_SF 9
88 #define SUSP_RRIP_ER_EXT_ID "IEEE_P1282"
89 #define SUSP_RRIP_ER_EXT_DES "THE IEEE P1282 PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS."
90 #define SUSP_RRIP_ER_EXT_SRC "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION."
92 #define SL_FLAGS_NONE 0
93 #define SL_FLAGS_CONTINUE 1
94 #define SL_FLAGS_CURRENT 2
95 #define SL_FLAGS_PARENT 4
96 #define SL_FLAGS_ROOT 8
100 u_char mode
[ISODCL(5,12)];
101 u_char links
[ISODCL(13,20)];
102 u_char uid
[ISODCL(21,28)];
103 u_char gid
[ISODCL(29,36)];
104 u_char serial
[ISODCL(37,44)];/* Not used */
109 u_char high
[ISODCL(5,12)];
110 u_char low
[ISODCL(13,20)];
115 u_char flags
[ISODCL ( 4, 4)];
116 u_char component
[ISODCL ( 4, 256)];
122 u_char flags
[ISODCL ( 4, 4)];
123 u_char timestamp
[ISODCL ( 5, 256)];
126 #define RRIP_NM_FLAGS_NONE 0x00
127 #define RRIP_NM_FLAGS_CONTINUE 0x01
128 #define RRIP_NM_FLAGS_CURRENT 0x02
129 #define RRIP_NM_FLAGS_PARENT 0x04
133 u_char flags
[ISODCL ( 4, 4)];
134 u_char altname
[ISODCL ( 4, 256)];
137 /* Note that this is the same structure as cd9660_rrip.h : ISO_RRIP_CONT */
140 u_char ca_sector
[ISODCL ( 5, 12)];
141 u_char offset
[ISODCL ( 13, 20)];
142 u_char length
[ISODCL ( 21, 28)];
147 u_char padding_area
[ISODCL ( 4, 256)];
152 u_char check
[ISODCL ( 4, 5)];
153 u_char len_skp
[ISODCL ( 6, 6)];
162 u_char len_id
[ISODCL ( 4, 4)];
163 u_char len_des
[ISODCL ( 5, 5)];
164 u_char len_src
[ISODCL ( 6, 6)];
165 u_char ext_ver
[ISODCL ( 7, 7)];
166 u_char ext_data
[ISODCL (8,256)];
167 /* u_char ext_id [ISODCL ( 8, 256)];
168 u_char ext_des [ISODCL ( 257, 513)];
169 u_char ext_src [ISODCL ( 514, 770)];*/
174 u_char ext_seq
[ISODCL ( 4, 4)];
202 struct ISO_SUSP_ATTRIBUTES
{
206 char last_in_suf
; /* last entry in the System Use Field? */
207 /* Dan's addons - will merge later. This allows use of a switch */
208 char susp_type
; /* SUSP or RRIP */
209 char entry_type
; /* Record type */
211 TAILQ_ENTRY(ISO_SUSP_ATTRIBUTES
) rr_ll
;
214 #define CD9660_SUSP_ENTRY_SIZE(entry)\
215 ((int) ((entry)->attr.su_entry.SP.h.length[0]))
217 /* Recursive function - move later to func pointer code*/
218 int cd9660_susp_finalize(iso9660_disk
*, cd9660node
*);
220 /* These two operate on single nodes */
221 int cd9660_susp_finalize_node(iso9660_disk
*, cd9660node
*);
222 int cd9660_rrip_finalize_node(iso9660_disk
*, cd9660node
*);
224 /* POSIX File attribute */
225 int cd9660node_rrip_px(struct ISO_SUSP_ATTRIBUTES
*, fsnode
*);
228 int cd9660node_rrip_pn(struct ISO_SUSP_ATTRIBUTES
*, fsnode
*);
231 int cd9660node_rrip_SL(struct ISO_SUSP_ATTRIBUTES
*, fsnode
*);
233 /* Alternate Name function */
234 void cd9660_rrip_NM(cd9660node
*);
235 void cd9660_rrip_add_NM(cd9660node
*,const char *);
237 /* Parent and child link function */
238 int cd9660_rrip_PL(struct ISO_SUSP_ATTRIBUTES
*, cd9660node
*);
239 int cd9660_rrip_CL(struct ISO_SUSP_ATTRIBUTES
*, cd9660node
*);
240 int cd9660_rrip_RE(struct ISO_SUSP_ATTRIBUTES
*, cd9660node
*);
242 int cd9660node_rrip_tf(struct ISO_SUSP_ATTRIBUTES
*, fsnode
*);
247 * Relocation directory function. I'm not quite sure what
248 * sort of parameters are needed, but personally I don't think
249 * any parameters are needed except for the memory address where
250 * the information needs to be put in
252 int cd9660node_rrip_re(void *, fsnode
*);
255 * Don't know if this function is needed because it apparently is an
256 * optional feature that does not really need to be implemented but I
257 * thought I should add it anyway.
259 int cd9660_susp_ce (struct ISO_SUSP_ATTRIBUTES
*, cd9660node
*);
260 int cd9660_susp_pd (struct ISO_SUSP_ATTRIBUTES
*, int);
261 int cd9660_susp_sp (struct ISO_SUSP_ATTRIBUTES
*, cd9660node
*);
262 int cd9660_susp_st (struct ISO_SUSP_ATTRIBUTES
*, cd9660node
*);
264 struct ISO_SUSP_ATTRIBUTES
*cd9660_susp_ER(cd9660node
*, u_char
, const char *,
265 const char *, const char *);
266 struct ISO_SUSP_ATTRIBUTES
*cd9660_susp_ES(struct ISO_SUSP_ATTRIBUTES
*,
270 /* Helper functions */
272 /* Common SUSP/RRIP functions */
273 int cd9660_susp_initialize(iso9660_disk
*, cd9660node
*, cd9660node
*,
275 int cd9660_susp_initialize_node(iso9660_disk
*, cd9660node
*);
276 struct ISO_SUSP_ATTRIBUTES
*cd9660node_susp_create_node(int, int, const char *,
278 struct ISO_SUSP_ATTRIBUTES
*cd9660node_susp_add_entry(cd9660node
*,
279 struct ISO_SUSP_ATTRIBUTES
*, struct ISO_SUSP_ATTRIBUTES
*, int);
281 /* RRIP specific functions */
282 int cd9660_rrip_initialize_node(iso9660_disk
*, cd9660node
*, cd9660node
*,
284 void cd9660_createSL(cd9660node
*);
286 /* Functions that probably can be removed */
287 /* int cd9660node_initialize_node(int, char *); */