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