libcdio  2.1.0
rock.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005, 2006 2008, 2012 Rocky Bernstein <rocky@gnu.org>
3 
4  See also rock.c by Eric Youngdale (1993) from GNU/Linux
5  This is Copyright 1993 Yggdrasil Computing, Incorporated
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
28 
29 #ifndef CDIO_ROCK_H_
30 #define CDIO_ROCK_H_
31 
32 #include <cdio/types.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37 
43 extern enum iso_rock_enums {
44  ISO_ROCK_IRUSR = 000400,
45  ISO_ROCK_IWUSR = 000200,
46  ISO_ROCK_IXUSR = 000100,
47  ISO_ROCK_IRGRP = 000040,
48  ISO_ROCK_IWGRP = 000020,
49  ISO_ROCK_IXGRP = 000010,
50  ISO_ROCK_IROTH = 000004,
51  ISO_ROCK_IWOTH = 000002,
52  ISO_ROCK_IXOTH = 000001,
54  ISO_ROCK_ISUID = 004000,
55  ISO_ROCK_ISGID = 002000,
56  ISO_ROCK_ISVTX = 001000,
58  ISO_ROCK_ISSOCK = 0140000,
59  ISO_ROCK_ISLNK = 0120000,
60  ISO_ROCK_ISREG = 0100000,
61  ISO_ROCK_ISBLK = 060000,
62  ISO_ROCK_ISCHR = 020000,
63  ISO_ROCK_ISDIR = 040000,
64  ISO_ROCK_ISFIFO = 010000
66 
67 #define ISO_ROCK_IRUSR 000400
68 #define ISO_ROCK_IWUSR 000200
69 #define ISO_ROCK_IXUSR 000100
70 #define ISO_ROCK_IRGRP 000040
71 #define ISO_ROCK_IWGRP 000020
72 #define ISO_ROCK_IXGRP 000010
73 #define ISO_ROCK_IROTH 000004
74 #define ISO_ROCK_IWOTH 000002
75 #define ISO_ROCK_IXOTH 000001
77 #define ISO_ROCK_ISUID 004000
78 #define ISO_ROCK_ISGID 002000
79 #define ISO_ROCK_ISVTX 001000
81 #define ISO_ROCK_ISSOCK 0140000
82 #define ISO_ROCK_ISLNK 0120000
83 #define ISO_ROCK_ISREG 0100000
84 #define ISO_ROCK_ISBLK 060000
85 #define ISO_ROCK_ISCHR 020000
86 #define ISO_ROCK_ISDIR 040000
87 #define ISO_ROCK_ISFIFO 010000
90 #define ISO_ROCK_ENFMT ISO_ROCK_ISGID
91 
93 
100 typedef struct iso_su_sp_s{
101  unsigned char magic[2];
102  uint8_t skip;
104 
106 typedef struct iso_su_er_s {
108  unsigned char len_des;
109  unsigned char len_src;
111  char data[EMPTY_ARRAY_SIZE];
113 
114 typedef struct iso_su_ce_s {
115  char extent[8];
116  char offset[8];
117  char size[8];
118 } iso_su_ce_t;
119 
121 typedef struct iso_rock_px_s {
131 
140 typedef struct iso_rock_pn_s {
146 
148 typedef enum {
154 
155 #define ISO_ROCK_SL_CONTINUE 1
156 #define ISO_ROCK_SL_CURRENT 2
157 #define ISO_ROCK_SL_PARENT 4
158 #define ISO_ROCK_SL_ROOT 8
159 
160 typedef struct iso_rock_sl_part_s {
161  uint8_t flags;
162  uint8_t len;
163  char text[EMPTY_ARRAY_SIZE];
165 
167 typedef struct iso_rock_sl_s {
168  unsigned char flags;
169  iso_rock_sl_part_t link;
171 
175 typedef enum {
180 
181 #define ISO_ROCK_NM_CONTINUE 1
182 #define ISO_ROCK_NM_CURRENT 2
183 #define ISO_ROCK_NM_PARENT 4
184 
185 
186 typedef struct iso_rock_nm_s {
187  unsigned char flags;
188  char name[EMPTY_ARRAY_SIZE];
190 
192 typedef struct iso_rock_cl_s {
193  char location[1];
195 
197 typedef struct iso_rock_pl_s {
198  char location[1];
200 
202 typedef enum {
212 
213 /* These are the bits and their meanings for flags in the TF structure. */
214 #define ISO_ROCK_TF_CREATE 1
215 #define ISO_ROCK_TF_MODIFY 2
216 #define ISO_ROCK_TF_ACCESS 4
217 #define ISO_ROCK_TF_ATTRIBUTES 8
218 #define ISO_ROCK_TF_BACKUP 16
219 #define ISO_ROCK_TF_EXPIRATION 32
220 #define ISO_ROCK_TF_EFFECTIVE 64
221 #define ISO_ROCK_TF_LONG_FORM 128
222 
224 typedef struct iso_rock_tf_s {
225  uint8_t flags;
226  uint8_t time_bytes[EMPTY_ARRAY_SIZE];
238 
240 typedef struct iso_rock_sf_s {
243  uint8_t table_depth;
245 
246 typedef struct iso_extension_record_s {
247  char signature[2];
254  union {
255  iso_su_sp_t SP;
257  iso_su_er_t ER;
260  iso_rock_px_t PX;
261  iso_rock_pn_t PN;
262  iso_rock_sl_t SL;
263  iso_rock_nm_t NM;
264  iso_rock_cl_t CL;
265  iso_rock_pl_t PL;
266  iso_rock_tf_t TF;
267  } u;
269 
270 typedef struct iso_rock_time_s {
271  bool b_used;
273  bool b_longdate;
275  union
276  {
279  } t;
281 
282 typedef struct iso_rock_statbuf_s {
291  uint8_t s_rock_offset;
292  int i_symlink;
294  char *psz_symlink;
296  iso_rock_time_t create;
297  iso_rock_time_t modify;
300  iso_rock_time_t access;
302  iso_rock_time_t attributes;
304  iso_rock_time_t backup;
305  iso_rock_time_t expiration;
307  iso_rock_time_t effective;
309  uint32_t i_rdev;
314 
316 
318 int get_rock_ridge_filename(iso9660_dir_t * de, /*out*/ char * retname,
319  /*out*/ iso9660_stat_t *p_stat);
320 
321  int parse_rock_ridge_stat(iso9660_dir_t *de, /*out*/ iso9660_stat_t *p_stat);
322 
326  mode_t
328 
362 const char *iso9660_get_rock_attr_str(posix_mode_t st_mode);
363 
371 
372 #ifdef __cplusplus
373 }
374 #endif /* __cplusplus */
375 
376 #endif /* CDIO_ROCK_H_ */
377 
378 /*
379  * Local variables:
380  * c-file-style: "gnu"
381  * tab-width: 8
382  * indent-tabs-mode: nil
383  * End:
384  */
Definition: rock.h:192
iso9660_dtime_t dtime
Definition: rock.h:278
#define ISO_ROCK_IWOTH
Definition: rock.h:74
#define ISO_ROCK_SL_PARENT
Definition: rock.h:157
#define ISO_ROCK_NM_PARENT
Definition: rock.h:183
Definition: rock.h:140
iso_rock_time_t attributes
Definition: rock.h:302
Common type definitions used pervasively in libcdio.
struct iso_su_er_s iso_su_er_t
#define PRAGMA_END_PACKED
Definition: types.h:169
uint8_t iso711_t
ISO 9660 Integer and Character types.
Definition: iso9660.h:49
struct iso_rock_statbuf_s iso_rock_statbuf_t
unsigned char len_des
Definition: rock.h:108
iso_su_ce_t CE
Definition: rock.h:259
char * psz_symlink
Definition: rock.h:294
posix_nlink_t st_nlinks
Definition: rock.h:288
iso_rock_tf_flag_t iso_rock_tf_flag
int parse_rock_ridge_stat(iso9660_dir_t *de, iso9660_stat_t *p_stat)
iso_su_sp_t SP
Definition: rock.h:255
unsigned char flags
Definition: rock.h:187
uint32_t posix_nlink_t
Definition: posix.h:27
#define ISO_ROCK_ISUID
Definition: rock.h:77
iso_rock_sl_flag_t iso_rock_sl_flag
#define ISO_ROCK_TF_LONG_FORM
Definition: rock.h:221
iso711_t len_id
Definition: rock.h:107
Definition: rock.h:186
#define ISO_ROCK_NM_CONTINUE
Definition: rock.h:181
#define ISO_ROCK_SL_CURRENT
Definition: rock.h:156
#define ISO_ROCK_ISFIFO
Definition: rock.h:87
unsigned char magic[2]
Definition: rock.h:101
#define ISO_ROCK_TF_EXPIRATION
Definition: rock.h:219
#define PRAGMA_BEGIN_PACKED
Definition: types.h:168
iso_rock_pn_t PN
Definition: rock.h:261
iso_rock_time_t create
Definition: rock.h:296
struct iso_rock_px_s iso_rock_px_t
int i_symlink
Definition: rock.h:292
iso711_t len
Definition: rock.h:250
posix_gid_t st_gid
Definition: rock.h:290
struct iso_rock_nm_s iso_rock_nm_t
iso_rock_enums
Definition: rock.h:43
uint64_t iso733_t
Definition: iso9660.h:56
iso_rock_tf_flag_t
Definition: rock.h:202
#define ISO_ROCK_IXUSR
Definition: rock.h:69
Definition: rock.h:106
#define ISO_ROCK_ISBLK
Definition: rock.h:84
uint32_t posix_mode_t
Definition: posix.h:26
uint8_t table_depth
Definition: rock.h:243
#define ISO_ROCK_SL_ROOT
Definition: rock.h:158
Definition: rock.h:100
struct iso_rock_sf_s iso_rock_sf_t
iso_rock_tf_t TF
Definition: rock.h:266
iso711_t version
Definition: rock.h:253
#define ISO_ROCK_TF_ATTRIBUTES
Definition: rock.h:217
Definition: rock.h:160
uint8_t s_rock_offset
Definition: rock.h:291
#define ISO_ROCK_TF_BACKUP
Definition: rock.h:218
mode_t iso9660_get_posix_filemode_from_rock(const iso_rock_statbuf_t *rr)
Definition: rock.h:240
#define ISO_ROCK_TF_CREATE
Definition: rock.h:214
uint32_t posix_gid_t
Definition: posix.h:29
ISO-9660 shorter-format time structure. See ECMA 9.1.5.
Definition: iso9660.h:184
struct iso_su_ce_s iso_su_ce_t
struct iso_rock_cl_s iso_rock_cl_t
#define ISO_ROCK_IROTH
Definition: rock.h:73
iso711_t ext_ver
Definition: rock.h:110
#define ISO_ROCK_IRGRP
Definition: rock.h:70
iso_rock_nm_t NM
Definition: rock.h:263
const char * iso9660_get_rock_attr_str(posix_mode_t st_mode)
#define ISO_ROCK_IWUSR
Definition: rock.h:68
struct iso_rock_sl_s iso_rock_sl_t
struct iso_rock_pn_s iso_rock_pn_t
iso_rock_sl_part_t link
Definition: rock.h:169
iso733_t st_nlinks
Definition: rock.h:124
struct iso_rock_tf_s iso_rock_tf_t
iso733_t virtual_size_high
Definition: rock.h:241
iso_rock_time_t backup
Definition: rock.h:304
#define ISO_ROCK_ISSOCK
Definition: rock.h:81
iso_rock_cl_t CL
Definition: rock.h:264
iso_rock_pl_t PL
Definition: rock.h:265
Definition: rock.h:282
#define ISO_ROCK_IRUSR
Definition: rock.h:67
#define ISO_ROCK_IXGRP
Definition: rock.h:72
iso_rock_sl_t SL
Definition: rock.h:262
#define ISO_ROCK_IWGRP
Definition: rock.h:71
Unix stat-like version of iso9660_dir.
Definition: iso9660.h:530
iso9660_ltime_t ltime
Definition: rock.h:277
uint32_t posix_uid_t
Definition: posix.h:28
Definition: rock.h:270
iso_rock_time_t access
Definition: rock.h:300
posix_uid_t st_uid
Definition: rock.h:289
struct iso_rock_pl_s iso_rock_pl_t
iso_rock_time_t effective
Definition: rock.h:307
uint8_t skip
Definition: rock.h:102
struct iso_rock_time_s iso_rock_time_t
posix_mode_t st_mode
Definition: rock.h:287
#define ISO_ROCK_ISREG
Definition: rock.h:83
PRAGMA_BEGIN_PACKED struct iso_su_sp_s iso_su_sp_t
#define ISO_ROCK_TF_EFFECTIVE
Definition: rock.h:220
uint8_t flags
Definition: rock.h:161
iso_rock_nm_flag_t iso_rock_nm_flag
iso_rock_px_t PX
Definition: rock.h:260
iso733_t virtual_size_low
Definition: rock.h:242
struct iso_rock_sl_part_s iso_rock_sl_part_t
Definition: rock.h:167
Definition: rock.h:114
unsigned char len_src
Definition: rock.h:109
#define ISO_ROCK_ISCHR
Definition: rock.h:85
iso733_t st_uid
Definition: rock.h:126
Definition: rock.h:246
struct iso_extension_record_s iso_extension_record_t
#define ISO_ROCK_ISLNK
Definition: rock.h:82
bool b_used
Definition: rock.h:271
bool_3way_t
Definition: types.h:236
Definition: rock.h:224
iso_rock_time_t expiration
Definition: rock.h:305
bool_3way_t b3_rock
Definition: rock.h:283
unsigned char flags
Definition: rock.h:168
bool b_longdate
Definition: rock.h:273
#define ISO_ROCK_TF_MODIFY
Definition: rock.h:215
iso_rock_sl_flag_t
Definition: rock.h:148
#define ISO_ROCK_SL_CONTINUE
Definition: rock.h:155
uint8_t len
Definition: rock.h:162
int i_symlink_max
Definition: rock.h:293
#define GNUC_PACKED
Definition: types.h:151
iso733_t dev_low
Definition: rock.h:143
iso_rock_time_t modify
Definition: rock.h:297
PRAGMA_END_PACKED int get_rock_ridge_filename(iso9660_dir_t *de, char *retname, iso9660_stat_t *p_stat)
#define ISO_ROCK_ISVTX
Definition: rock.h:79
#define ISO_ROCK_NM_CURRENT
Definition: rock.h:182
#define ISO_ROCK_IXOTH
Definition: rock.h:75
#define ISO_ROCK_ISGID
Definition: rock.h:78
uint8_t flags
Definition: rock.h:225
Definition: rock.h:121
iso_rock_nm_flag_t
Definition: rock.h:175
#define EMPTY_ARRAY_SIZE
Definition: iso9660.h:62
iso_su_er_t ER
Definition: rock.h:257
uint32_t i_rdev
Definition: rock.h:309
iso733_t dev_high
Definition: rock.h:141
#define ISO_ROCK_ISDIR
Definition: rock.h:86
iso733_t st_gid
Definition: rock.h:128
iso733_t st_mode
Definition: rock.h:122
ISO-9660 longer-format time structure.
Definition: iso9660.h:207
Definition: rock.h:197
Format of an ISO-9660 directory record.
Definition: iso9660.h:248
#define ISO_ROCK_TF_ACCESS
Definition: rock.h:216