1948 zpool list should show more detailed pool information
[unleashed.git] / usr / src / uts / common / sys / fs / hsfs_rrip.h
blobf05e367d42e6bfd81b3aa8f59ed5e8b0e0df5da9
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
22 * ISO 9660 RRIP extension filesystem specifications
25 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 #ifndef _SYS_FS_HSFS_RRIP_H
30 #define _SYS_FS_HSFS_RRIP_H
32 #pragma ident "%Z%%M% %I% %E% SMI"
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
39 * Mount options specific to HSFS.
40 * This is not a good place for them; we should probably have a file
41 * named hsfs_mount.h for such stuff.
43 #define HSFSMNT_NORRIP 0x1 /* -nrr option found */
44 #define HSFSMNT_NOTRAILDOT 0x2 /* ignore trailing '.' */
45 #define HSFSMNT_NOMAPLCASE 0x4 /* do not map filenames to lcase */
46 #define HSFSMNT_NOTRAILSPACE 0x8 /* no trailing space in iso 9660 */
47 #define HSFSMNT_NOVERSION 0x10 /* no version info in iso 9660 */
48 #define HSFSMNT_NOJOLIET 0x20 /* ignore Joliet even if present */
49 #define HSFSMNT_JOLIETLONG 0x40 /* do not truncate Joliet filenames */
50 #define HSFSMNT_NOVERS2 0x80 /* ignore ISO-9660:1999 */
51 #define HSFSMNT_INODE 0x1000 /* May use ext_lbn as inode #, */
52 /* FS is from a recent mkisofs */
55 * XXX: The following flag was used in the past to instruct the kernel to
56 * ignore Rock Ridge extensions on a CD. Unfortunately, this was
57 * implemented as part of the generic mount flags, a bad idea.
58 * This flag should not be used anymore. The HSFSMNT_NORRIP
59 * flag should be used in its place. The hsfs_mount code currently
60 * understands this flag, but this functionality should go
61 * away in the future.
63 #define MS_NO_RRIP 0x800000 /* if set, don't use Rock Ridge */
66 #define MIN(a, b) ((a) < (b) ? (a) : (b))
69 * Make sure we have this first
72 #define RRIP_VERSION 1
73 #define RRIP_SUF_VERSION 1
74 #define RRIP_EXT_VERSION 1
76 #define RRIP_BIT 1 /* loc. in extension_name_table in susp.c */
78 #define IS_RRIP_IMPLEMENTED(fsp) (IS_IMPL_BIT_SET(fsp, RRIP_BIT) ? 1 : 0)
83 * RRIP signature macros
85 #define RRIP_CL "CL"
86 #define RRIP_NM "NM"
87 #define RRIP_PL "PL"
88 #define RRIP_PN "PN"
89 #define RRIP_PX "PX"
90 #define RRIP_RE "RE"
91 #define RRIP_RR "RR"
92 #define RRIP_SL "SL"
93 #define RRIP_TF "TF"
96 * RRIP ER extension fields
98 #define RRIP_ER_EXT_ID "RRIP_1991A"
100 #define RRIP_ER_EXT_DES "THE ROCK RIDGE INTERCHANGE PROTOCOL PROVIDES \
101 SUPPORT FOR POSIX FILE SYSTEM SEMANTICS."
103 #define RRIP_ER_EXT_SRC "PLEASE CONTACT DISC PUBLISHER FOR \
104 SPECIFICATION SOURCE. SEE PUBLISHER IDENTIFIER IN PRIMARY VOLUME DESCRIPTOR \
105 FOR CONTACT INFORMATION."
108 * "TF" time macros
110 #define RRIP_TF_FLAGS(x) *(RRIP_tf_flags(x))
111 #define RRIP_tf_flags(x) (&((uchar_t *)(x))[4])
113 #define RRIP_TIME_START_BP 5
115 #define RRIP_TF_TIME_LENGTH(x) (IS_TIME_BIT_SET(RRIP_TF_FLAGS(x), \
116 RRIP_TF_LONG_BIT) ? \
117 ISO_DATE_LEN : ISO_SHORT_DATE_LEN)
120 * Time location bits
122 #define RRIP_TF_CREATION_BIT 0x01
123 #define RRIP_TF_MODIFY_BIT 0x02
124 #define RRIP_TF_ACCESS_BIT 0x04
125 #define RRIP_TF_ATTRIBUTES_BIT 0x08
126 #define RRIP_TF_BACKUP_BIT 0x10
127 #define RRIP_TF_EXPIRATION_BIT 0x20
128 #define RRIP_TF_EFFECTIVE_BIT 0x40
129 #define RRIP_TF_LONG_BIT 0x80
133 #define RRIP_tf_creation(x) (&((uchar_t *)x)[RRIP_TIME_START_BP])
134 #define RRIP_tf_modify(x) (&((uchar_t *)x)[RRIP_TIME_START_BP + \
135 (RRIP_TF_TIME_LENGTH(x) * \
136 (IS_TIME_BIT_SET(RRIP_TF_FLAGS(x), \
137 RRIP_TF_CREATION_BIT)))])
139 #define RRIP_tf_access(x) (&((uchar_t *)x)[RRIP_TIME_START_BP + \
140 (RRIP_TF_TIME_LENGTH(x) * \
141 (IS_TIME_BIT_SET(RRIP_TF_FLAGS(x), \
142 RRIP_TF_CREATION_BIT) + \
143 IS_TIME_BIT_SET(RRIP_TF_FLAGS(x), \
144 RRIP_TF_MODIFY_BIT)))])
146 #define RRIP_tf_attributes(x) (&((uchar_t *)x)[RRIP_TIME_START_BP + \
147 (RRIP_TF_TIME_LENGTH(x) * \
148 (IS_TIME_BIT_SET(RRIP_TF_FLAGS(x), \
149 RRIP_TF_CREATION_BIT) + \
150 IS_TIME_BIT_SET(RRIP_TF_FLAGS(x), \
151 RRIP_TF_MODIFY_BIT) + \
152 IS_TIME_BIT_SET(RRIP_TF_FLAGS(x), \
153 RRIP_TF_ACCESS_BIT)))])
158 * Check if TF Bits are set.
160 * Note : IS_TIME_BIT_SET(x, y) must be kept returning 1 and 0.
161 * see RRIP_tf_*(x) Macros
163 #define IS_TIME_BIT_SET(x, y) (((x) & (y)) ? 1 : 0)
164 #define SET_TIME_BIT(x, y) ((x) |= (y))
168 * "PX" Posix attibutes
170 #define RRIP_mode(x) (&((uchar_t *)x)[4])
171 #define RRIP_MODE(x) (mode_t)BOTH_INT(RRIP_mode(x))
173 #define RRIP_nlink(x) (&((uchar_t *)x)[12])
174 #define RRIP_NLINK(x) (short)BOTH_INT(RRIP_nlink(x))
176 #define RRIP_uid(x) (&((uchar_t *)x)[20])
177 #define RRIP_UID(x) (uid_t)BOTH_INT(RRIP_uid(x))
179 #define RRIP_gid(x) (&((uchar_t *)x)[28])
180 #define RRIP_GID(x) (gid_t)BOTH_INT(RRIP_gid(x))
182 #define RRIP_ino(x) (&((uchar_t *)x)[36])
183 #define RRIP_INO(x) (uint32_t)BOTH_INT(RRIP_ino(x))
185 #define RRIP_PX_OLD_SIZE 36
186 #define RRIP_PX_SIZE 44
189 * "PN" Posix major/minor numbers
192 #define RRIP_major(x) (&((uchar_t *)x)[4])
193 #define RRIP_MAJOR(x) BOTH_INT(RRIP_major(x))
195 #define RRIP_minor(x) (&((uchar_t *)x)[12])
196 #define RRIP_MINOR(x) BOTH_INT(RRIP_minor(x))
200 * "NM" alternate name and "SL" symbolic link macros...
203 #define SYM_LINK_LEN(x) (strlen(x) + 1)
204 #define RRIP_NAME_LEN_BASE 5
205 #define RRIP_NAME_LEN(x) (SUF_LEN(x) - RRIP_NAME_LEN_BASE)
207 #define RRIP_NAME_FLAGS(x) (((uchar_t *)x)[4])
210 * These are for the flag bits in the NM and SL and must remain <= 8 bits
212 #define RRIP_NAME_CONTINUE 0x01
213 #define RRIP_NAME_CURRENT 0x02
214 #define RRIP_NAME_PARENT 0x04
215 #define RRIP_NAME_ROOT 0x08
216 #define RRIP_NAME_VOLROOT 0x10
217 #define RRIP_NAME_HOST 0x20
221 * These are unique to use in the > 8 bits of sig_args.name_flags
222 * They are > 8 so that we can share bits from above.
223 * This can grow to 32 bits.
225 #define RRIP_NAME_CHANGE 0x40
226 #define RRIP_SYM_LINK_COMPLETE 0x80 /* set if sym link already read */
227 /* from SUA (no longer than a short) */
230 * Bit handling....
232 #define SET_NAME_BIT(x, y) ((x) |= (y))
233 #define UNSET_NAME_BIT(x, y) ((x) &= ~(y))
234 #define IS_NAME_BIT_SET(x, y) ((x) & (y))
235 #define NAME_HAS_CHANGED(flag) \
236 (IS_NAME_BIT_SET(flag, RRIP_NAME_CHANGE) ? 1 : 0)
238 #define RRIP_name(x) (&((uchar_t *)x)[5])
239 #define RRIP_NAME(x) RRIP_name(x)
242 * This is the maximum filename length that we support
244 #define RRIP_FILE_NAMELEN 255
248 * SL Symbolic link macros (in addition to common name flag macos
250 /* these two macros are from the SL SUF pointer */
251 #define RRIP_sl_comp(x) (&((uchar_t *)x)[5])
252 #define RRIP_SL_COMP(x) RRIP_sl_comp(x)
253 #define RRIP_SL_FLAGS(x) (((uchar_t *)x)[4])
256 /* these macros are from the component pointer within the SL SUF */
257 #define RRIP_comp(x) (&((uchar_t *)x)[2])
258 #define RRIP_COMP(x) RRIP_comp(x)
259 #define RRIP_COMP_FLAGS(x) (((uchar_t *)x)[0])
260 #define RRIP_COMP_LEN(x) (RRIP_COMP_NAME_LEN(x) + 2)
261 #define RRIP_COMP_NAME_LEN(x) (((uchar_t *)x)[1])
265 * Directory hierarchy macros
269 * Macros for checking relocation bits in flags member of dlist
270 * structure defined in iso_impl.h
272 #define IS_RELOC_BIT_SET(x, y) (((x) & (y)) ? 1 : 0)
273 #define SET_RELOC_BIT(x, y) ((x) |= (y))
275 #define CHILD_LINK 0x01
276 #define PARENT_LINK 0x02
277 #define RELOCATED_DIR 0x04
279 #define RRIP_child_lbn(x) (&((uchar_t *)x)[4])
280 #define RRIP_CHILD_LBN(x) (uint_t)BOTH_INT(RRIP_child_lbn(x))
282 #define RRIP_parent_lbn(x) (&((uchar_t *)x)[4])
283 #define RRIP_PARENT_LBN(x) (uint_t)BOTH_INT(RRIP_parent_lbn(x))
286 #ifdef _KERNEL
289 * Forward declarations
291 extern uchar_t *rrip_name(sig_args_t *);
292 extern uchar_t *rrip_file_attr(sig_args_t *);
293 extern uchar_t *rrip_dev_nodes(sig_args_t *);
294 extern uchar_t *rrip_file_time(sig_args_t *);
295 extern uchar_t *rrip_sym_link(sig_args_t *);
296 extern uchar_t *rrip_parent_link(sig_args_t *);
297 extern uchar_t *rrip_child_link(sig_args_t *);
298 extern uchar_t *rrip_reloc_dir(sig_args_t *);
299 extern uchar_t *rrip_rock_ridge(sig_args_t *);
300 extern void hs_check_root_dirent(struct vnode *vp, struct hs_direntry *hdp);
301 extern int rrip_namecopy(char *from, char *to, char *tmp_name,
302 uchar_t *dirp, uint_t last_offset,
303 struct hsfs *fsp, struct hs_direntry *hdp);
304 #endif /* _KERNEL */
306 #ifdef __cplusplus
308 #endif
310 #endif /* _SYS_FS_HSFS_RRIP_H */