2 * iso9660 - An iso9660 CDI driver with Rockridge support
4 * Copyright (C) 2008 Janosch Gräf
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 3 of the License, or (at your option)
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef _ISO9660_ROCKRIDGE_H_
21 #define _ISO9660_ROCKRIDGE_H_
23 #include <sys/types.h>
26 #include "directory_record.h"
28 #define ISO9660_ROCKRIDGE_VERSION 1
30 #define ISO9660_ROCKRIDGE_SL_FLAG_LAST 1
32 #define ISO9660_ROCKRIDGE_NAMEFLAG_CONTINUE 1
33 #define ISO9660_ROCKRIDGE_NAMEFLAG_CURRENT 2
34 #define ISO9660_ROCKRIDGE_NAMEFLAG_PARENT 4
35 #define ISO9660_ROCKRIDGE_NAMEFLAG_ROOT 8
37 #define ISO9660_ROCKRIDGE_TFFLAG_CREATION 1
38 #define ISO9660_ROCKRIDGE_TFFLAG_MODIFY 2
39 #define ISO9660_ROCKRIDGE_TFFLAG_ACCESS 4
40 #define ISO9660_ROCKRIDGE_TFFLAG_ATTRIBUTES 8
41 #define ISO9660_ROCKRIDGE_TFFLAG_BACKUP 16
42 #define ISO9660_ROCKRIDGE_TFFLAG_EXPIRATION 32
43 #define ISO9660_ROCKRIDGE_TFFLAG_EFFECTIVE 64
44 #define ISO9660_ROCKRIDGE_TFFLAG_LONGFORM 128
46 #define ISO9660_ROCKRIDGE_SIG_SP ('S'|('P'<<8))
47 #define ISO9660_ROCKRIDGE_SIG_ST ('S'|('T'<<8))
48 #define ISO9660_ROCKRIDGE_SIG_RR ('R'|('R'<<8)) ///< @todo Actually the SUE must start with SP and not with RR
49 #define ISO9660_ROCKRIDGE_SIG_PX ('P'|('X'<<8))
50 #define ISO9660_ROCKRIDGE_SIG_PN ('P'|('N'<<8))
51 #define ISO9660_ROCKRIDGE_SIG_SL ('S'|('L'<<8))
52 #define ISO9660_ROCKRIDGE_SIG_NM ('N'|('M'<<8))
53 #define ISO9660_ROCKRIDGE_SIG_CL ('C'|('L'<<8))
54 #define ISO9660_ROCKRIDGE_SIG_PL ('P'|('L'<<8))
55 #define ISO9660_ROCKRIDGE_SIG_RE ('R'|('E'<<8))
56 #define ISO9660_ROCKRIDGE_SIG_RF ('R'|('F'<<8))
57 #define ISO9660_ROCKRIDGE_SIG_SF ('S'|('F'<<8))
59 // Some POSIX stat stuff
61 #define RS_IFMT 00170000
62 #define RS_IFSOCK 00140000
63 #define RS_IFLNK 00120000
64 #define RS_IFREG 00100000
65 #define RS_IFBLK 00060000
66 #define RS_IFDIR 00040000
67 #define RS_IFCHR 00020000
68 #define RS_IFIFO 00010000
70 #define RS_ISLNK(m) (((m)&RS_IFMT)==RS_IFLNK)
71 #define RS_ISREG(m) (((m)&RS_IFMT)==RS_IFREG)
72 #define RS_ISDIR(m) (((m)&RS_IFMT)==RS_IFDIR)
73 #define RS_ISCHR(m) (((m)&RS_IFMT)==RS_IFCHR)
74 #define RS_ISBLK(m) (((m)&RS_IFMT)==RS_IFBLK)
75 #define RS_ISFIFO(m) (((m)&RS_IFMT)==RS_IFIFO)
76 #define RS_ISSOCK(m) (((m)&RS_IFMT)==RS_IFSOCK)
78 typedef unsigned int rmode_t
;
80 // Rockridge System Use Entry
81 struct iso9660_rockridge
{
90 } __attribute__ ((packed
));
92 /// @todo Actually the SUE must start with SP and not with RR
93 struct iso9660_rockridge_rr
{
95 struct iso9660_rockridge header
;
97 } __attribute__ ((packed
));
99 // Rockridge System Use Entry for file permissions
100 struct iso9660_rockridge_px
{
102 struct iso9660_rockridge header
;
104 // File mode (like in sys/stat.h)
108 // Number of links (like in sys/stat.h)
120 // File serial number
123 } __attribute__ ((packed
));
125 // Rockridge System Use Entry for device nodes
126 struct iso9660_rockridge_pn
{
128 struct iso9660_rockridge header
;
135 } __attribute__ ((packed
));
137 // Rockridge SL Component
138 struct iso9660_rockridge_sl_component
{
142 } __attribute__ ((packed
));
144 // Rockridge System Use Entry for symbolic links
145 struct iso9660_rockridge_sl
{
147 struct iso9660_rockridge header
;
153 struct iso9660_rockridge_sl_component component_area
[0];
154 } __attribute__ ((packed
));
156 // Rockridge System Use Entry for POSIX names
157 struct iso9660_rockridge_nm
{
159 struct iso9660_rockridge header
;
166 } __attribute__ ((packed
));
168 // Rockridge System Use Entry for timestamps
169 struct iso9660_rockridge_tf
{
171 struct iso9660_rockridge header
;
173 // Flags (Type of timestamp
176 uint32_t timestamps
[0];
177 } __attribute__ ((packed
));
179 int iso9660_rockridge_scan(struct iso9660_dirrec
*dirrec
,char **_name
,mode_t
*mode
,uid_t
*uid
,gid_t
*gid
,nlink_t
*nlink
,uint64_t *atime
,uint64_t *ctime
,uint64_t *mtime
);