summaryrefslogtreecommitdiff
path: root/isofs/rr.h
blob: ab80e4bdda8b6d6b6dfa2417959b15f2df984569 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/*
   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
   Written by Thomas Bushnell, n/BSG.

   This file is part of the GNU Hurd.

   The GNU Hurd is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2, or (at
   your option) any later version.

   The GNU Hurd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. */

#include "iso9660.h"

/* The results of an rrip_scan_lookup call are one of these */
struct rrip_lookup
{
  /* PX */
  mode_t mode;
  nlink_t nlink;
  uid_t uid;
  gid_t gid;

  /* PN */
  dev_t rdev;

  /* SL */
  char *target;

  /* NM */
  char *name;			/* name of this entry if changed (malloced) */

  /* CL */
  off_t newloc;			/* relocated directory */

  /* PL */
  off_t parloc;			/* parent of relocated directory */

  /* TF */
  int tfflags;
  struct timespec atime, mtime, ctime;	/* file times */

  /* CL */
  struct dirrect *realdirent;	/* actual directory entry for attributes */

  /* RL */
  off_t realfilestart;		/* override file start in dir entry */

  /* AU */
  uid_t author;

  /* TR */
  size_t translen;
  char *trans;

  /* MD */
  mode_t allmode;

  /* FL */
  long flags;

  int valid;
};

/* VALID in one of these is from the following bits */
#define VALID_PX	0x0001
#define VALID_PN	0x0002
#define VALID_SL	0x0004
#define VALID_NM	0x0008
#define VALID_CL	0x0010
#define VALID_PL	0x0020
#define VALID_TF	0x0040
#define VALID_RE	0x0080
#define VALID_AU	0x0100
#define VALID_TR	0x0200
#define VALID_MD	0x0400
#define VALID_FL	0x0800


/* Definitions for System Use Sharing Protocol.
   Version 1.  Revision 1.10.  Dated July 16, 1993. */

/* A system use field begins with the following header */
struct su_header
{
  char sig[2];
  unsigned char len;
  char version;
};

/* The body of a CE (Continuation Area) field */
struct su_ce
{
  char continuation[8];
  char offset[8];
  char size[8];
};

/* The body of a SP (Sharing Protocol Indicator) field */
struct su_sp
{
  unsigned char check[2];
  u_char skip;
};

#define SU_SP_CHECK_0 0xbe
#define SU_SP_CHECK_1 0xef

/* The body of a ER (Extension Reference) field */
struct su_er
{
  u_char len_id;
  u_char len_des;
  u_char len_src;
  u_char ext_ver;
  char more[0];
};




/* Definitions for Rock Ridge extensions.
   Version 1.  Revision 1.10.  Dated July 13, 1993. */

/* These are the ER values to indicate the presence of Rock-Ridge
   extensions. */
#define ROCK_VERS	1
#define ROCK_ID		"RRIP_1991A"
#define ROCK_DES	\
    "THE ROCK RIDGE INTERCHANGE PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS"
#define ROCK_SRC	\
    "ROCK RIDGE SPECIFICATION VERSION 1 REVISION 1.10 JULY 13 1993"

/* The body of a PX (Posix Attributes) field. */
struct rr_px
{
  char mode[8];
  char nlink[8];
  char uid[8];
  char gid[8];
};

/* The body of a PN (Posix Device Node) field. */
struct rr_pn
{
  char high[8];
  char low[8];
};

/* The body of a SL (Symbolic Link) field. */
struct rr_sl
{
  u_char flags;
  char data[0];
};

/* Each component in the DATA is: */
struct rr_sl_comp
{
  u_char flags;
  u_char len;
  char name[0];
};

/* The body of a NM (Alternate Name) field. */
struct rr_nm
{
  u_char flags;
  char name[0];
};

/* Flags for SL and NM components */
#define NAME_CONTINUE	0x01
#define NAME_DOT	0x02
#define NAME_DOTDOT	0x04
#define NAME_ROOT	0x08
#define NAME_VOLROOT	0x10
#define NAME_HOST	0x20

/* The body of a CL (Child Directory Location) field. */
struct rr_cl
{
  char loc[8];
};

/* The body of a PL (Parent Directory Location) field. */
struct rr_pl
{
  char loc[8];
};

/* The body of a TF (Time Stamp) field. */
struct rr_tf
{
  u_char flags;
  char data[0];
};

/* Flags for a TF */
#define TF_CREATION	0x01
#define TF_MODIFY	0x02
#define TF_ACCESS	0x04
#define TF_ATTRIBUTES	0x08
#define TF_BACKUP	0x10
#define TF_EXPIRATION	0x20
#define TF_EFFECTIVE	0x40
#define TF_LONG_FORM	0x80


/* The body of a SF (Sparse File) field. */
struct rr_sf
{
  char size[8];
};


/* GNU extensions */

#define GNUEXT_VERS	1
#define GNUEXT_ID	"GNUEXT_1997"
#define GNUEXT_DES \
   "The GNU Extensions provide support for special GNU filesystem features"
#define GNUEXT_SRC \
   "GNU Hurd source release 0.3 or later"

/* AU -- author (version 1) */
struct gn_au
{
  char author[8];
};

/* TR -- translator (version 1) */
struct gn_tr
{
  u_char len;
  char data[0];
};

/* MD -- full mode (version 1) */
struct gn_md
{
  char mode[8];
};

/* FL -- flags (version 1) */
struct gn_fl
{
  char flags[8];
};


/* Rock-Ridge related functions. */

int rrip_match_lookup (struct dirrect *, const char *,
		       size_t, struct rrip_lookup *);
void rrip_lookup (struct dirrect *, struct rrip_lookup *, int);
void rrip_initialize (struct dirrect *);
void release_rrip (struct rrip_lookup *);