blob: e981c040a49b3e2c448c85c4c539edf544c13df7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/fs/isofs/rock.c
3 *
4 * (C) 1992, 1993 Eric Youngdale
5 *
6 * Rock Ridge Extensions to iso9660
7 */
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/slab.h>
10#include <linux/pagemap.h>
11#include <linux/smp_lock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
Al Viro94f2f712005-04-25 18:32:12 -070013#include "isofs.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include "rock.h"
15
16/* These functions are designed to read the system areas of a directory record
17 * and extract relevant information. There are different functions provided
18 * depending upon what information we need at the time. One function fills
19 * out an inode structure, a second one extracts a filename, a third one
20 * returns a symbolic link name, and a fourth one returns the extent number
21 * for the file. */
22
Andrew Morton1d372112005-06-21 17:16:42 -070023#define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25/* This is a way of ensuring that we have something in the system
26 use fields that is compatible with Rock Ridge */
27#define CHECK_SP(FAIL) \
28 if(rr->u.SP.magic[0] != 0xbe) FAIL; \
29 if(rr->u.SP.magic[1] != 0xef) FAIL; \
30 ISOFS_SB(inode->i_sb)->s_rock_offset=rr->u.SP.skip;
31/* We define a series of macros because each function must do exactly the
32 same thing in certain places. We use the macros to ensure that everything
33 is done correctly */
34
35#define CONTINUE_DECLS \
36 int cont_extent = 0, cont_offset = 0, cont_size = 0; \
37 void *buffer = NULL
38
39#define CHECK_CE \
40 {cont_extent = isonum_733(rr->u.CE.extent); \
41 cont_offset = isonum_733(rr->u.CE.offset); \
42 cont_size = isonum_733(rr->u.CE.size);}
43
44#define SETUP_ROCK_RIDGE(DE,CHR,LEN) \
45 {LEN= sizeof(struct iso_directory_record) + DE->name_len[0]; \
46 if(LEN & 1) LEN++; \
47 CHR = ((unsigned char *) DE) + LEN; \
48 LEN = *((unsigned char *) DE) - LEN; \
49 if (LEN<0) LEN=0; \
50 if (ISOFS_SB(inode->i_sb)->s_rock_offset!=-1) \
51 { \
52 LEN-=ISOFS_SB(inode->i_sb)->s_rock_offset; \
53 CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \
54 if (LEN<0) LEN=0; \
55 } \
Andrew Morton1d372112005-06-21 17:16:42 -070056}
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
58#define MAYBE_CONTINUE(LABEL,DEV) \
59 {if (buffer) { kfree(buffer); buffer = NULL; } \
60 if (cont_extent){ \
61 int block, offset, offset1; \
62 struct buffer_head * pbh; \
63 buffer = kmalloc(cont_size,GFP_KERNEL); \
64 if (!buffer) goto out; \
65 block = cont_extent; \
66 offset = cont_offset; \
67 offset1 = 0; \
68 pbh = sb_bread(DEV->i_sb, block); \
69 if(pbh){ \
70 if (offset > pbh->b_size || offset + cont_size > pbh->b_size){ \
71 brelse(pbh); \
72 goto out; \
73 } \
74 memcpy(buffer + offset1, pbh->b_data + offset, cont_size - offset1); \
75 brelse(pbh); \
76 chr = (unsigned char *) buffer; \
77 len = cont_size; \
78 cont_extent = 0; \
79 cont_size = 0; \
80 cont_offset = 0; \
81 goto LABEL; \
82 } \
83 printk("Unable to read rock-ridge attributes\n"); \
84 }}
85
86/* return length of name field; 0: not found, -1: to be ignored */
Andrew Morton1d372112005-06-21 17:16:42 -070087int get_rock_ridge_filename(struct iso_directory_record *de,
88 char *retname, struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -070089{
Andrew Morton1d372112005-06-21 17:16:42 -070090 int len;
91 unsigned char *chr;
92 CONTINUE_DECLS;
Andrew Morton7fa393a2005-06-21 17:16:43 -070093 struct rock_ridge *rr;
94 int sig;
95 int retnamlen = 0;
96 int truncate = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070097
Andrew Morton1d372112005-06-21 17:16:42 -070098 if (!ISOFS_SB(inode->i_sb)->s_rock)
99 return 0;
100 *retname = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
Andrew Morton1d372112005-06-21 17:16:42 -0700102 SETUP_ROCK_RIDGE(de, chr, len);
Andrew Morton7fa393a2005-06-21 17:16:43 -0700103repeat:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104
Andrew Morton7fa393a2005-06-21 17:16:43 -0700105 while (len > 2) { /* There may be one byte for padding somewhere */
106 rr = (struct rock_ridge *)chr;
107 if (rr->len < 3)
108 goto out; /* Something got screwed up here */
109 sig = isonum_721(chr);
110 chr += rr->len;
111 len -= rr->len;
112 if (len < 0)
113 goto out; /* corrupted isofs */
Andrew Morton1d372112005-06-21 17:16:42 -0700114
Andrew Morton7fa393a2005-06-21 17:16:43 -0700115 switch (sig) {
116 case SIG('R', 'R'):
117 if ((rr->u.RR.flags[0] & RR_NM) == 0)
118 goto out;
119 break;
120 case SIG('S', 'P'):
121 CHECK_SP(goto out);
122 break;
123 case SIG('C', 'E'):
124 CHECK_CE;
125 break;
126 case SIG('N', 'M'):
127 if (truncate)
Andrew Morton1d372112005-06-21 17:16:42 -0700128 break;
Andrew Morton7fa393a2005-06-21 17:16:43 -0700129 if (rr->len < 5)
Andrew Morton1d372112005-06-21 17:16:42 -0700130 break;
Andrew Morton7fa393a2005-06-21 17:16:43 -0700131 /*
132 * If the flags are 2 or 4, this indicates '.' or '..'.
133 * We don't want to do anything with this, because it
134 * screws up the code that calls us. We don't really
135 * care anyways, since we can just use the non-RR
136 * name.
137 */
138 if (rr->u.NM.flags & 6)
Andrew Morton1d372112005-06-21 17:16:42 -0700139 break;
Andrew Morton1d372112005-06-21 17:16:42 -0700140
Andrew Morton7fa393a2005-06-21 17:16:43 -0700141 if (rr->u.NM.flags & ~1) {
142 printk("Unsupported NM flag settings (%d)\n",
143 rr->u.NM.flags);
Andrew Morton1d372112005-06-21 17:16:42 -0700144 break;
145 }
Andrew Morton7fa393a2005-06-21 17:16:43 -0700146 if ((strlen(retname) + rr->len - 5) >= 254) {
147 truncate = 1;
148 break;
149 }
150 strncat(retname, rr->u.NM.name, rr->len - 5);
151 retnamlen += rr->len - 5;
152 break;
153 case SIG('R', 'E'):
154 if (buffer)
155 kfree(buffer);
156 return -1;
157 default:
158 break;
Andrew Morton1d372112005-06-21 17:16:42 -0700159 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 }
Andrew Morton1d372112005-06-21 17:16:42 -0700161 MAYBE_CONTINUE(repeat, inode);
Andrew Morton7fa393a2005-06-21 17:16:43 -0700162 kfree(buffer);
Andrew Morton1d372112005-06-21 17:16:42 -0700163 return retnamlen; /* If 0, this file did not have a NM field */
Andrew Morton7fa393a2005-06-21 17:16:43 -0700164out:
Andrew Morton1d372112005-06-21 17:16:42 -0700165 if (buffer)
166 kfree(buffer);
167 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168}
169
170static int
171parse_rock_ridge_inode_internal(struct iso_directory_record *de,
172 struct inode *inode, int regard_xa)
173{
Andrew Morton1d372112005-06-21 17:16:42 -0700174 int len;
175 unsigned char *chr;
176 int symlink_len = 0;
Andrew Morton7fa393a2005-06-21 17:16:43 -0700177 int cnt, sig;
178 struct inode *reloc;
179 struct rock_ridge *rr;
180 int rootflag;
181
Andrew Morton1d372112005-06-21 17:16:42 -0700182 CONTINUE_DECLS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183
Andrew Morton1d372112005-06-21 17:16:42 -0700184 if (!ISOFS_SB(inode->i_sb)->s_rock)
185 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186
Andrew Morton1d372112005-06-21 17:16:42 -0700187 SETUP_ROCK_RIDGE(de, chr, len);
188 if (regard_xa) {
189 chr += 14;
190 len -= 14;
191 if (len < 0)
192 len = 0;
193 }
194
Andrew Morton7fa393a2005-06-21 17:16:43 -0700195repeat:
196 while (len > 2) { /* There may be one byte for padding somewhere */
197 rr = (struct rock_ridge *)chr;
198 if (rr->len < 3)
199 goto out; /* Something got screwed up here */
200 sig = isonum_721(chr);
201 chr += rr->len;
202 len -= rr->len;
203 if (len < 0)
204 goto out; /* corrupted isofs */
Andrew Morton1d372112005-06-21 17:16:42 -0700205
Andrew Morton7fa393a2005-06-21 17:16:43 -0700206 switch (sig) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207#ifndef CONFIG_ZISOFS /* No flag for SF or ZF */
Andrew Morton7fa393a2005-06-21 17:16:43 -0700208 case SIG('R', 'R'):
209 if ((rr->u.RR.flags[0] &
210 (RR_PX | RR_TF | RR_SL | RR_CL)) == 0)
Andrew Morton1d372112005-06-21 17:16:42 -0700211 goto out;
Andrew Morton7fa393a2005-06-21 17:16:43 -0700212 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213#endif
Andrew Morton7fa393a2005-06-21 17:16:43 -0700214 case SIG('S', 'P'):
215 CHECK_SP(goto out);
216 break;
217 case SIG('C', 'E'):
218 CHECK_CE;
219 break;
220 case SIG('E', 'R'):
221 ISOFS_SB(inode->i_sb)->s_rock = 1;
222 printk(KERN_DEBUG "ISO 9660 Extensions: ");
223 {
224 int p;
225 for (p = 0; p < rr->u.ER.len_id; p++)
226 printk("%c", rr->u.ER.data[p]);
Andrew Morton1d372112005-06-21 17:16:42 -0700227 }
Andrew Morton7fa393a2005-06-21 17:16:43 -0700228 printk("\n");
229 break;
230 case SIG('P', 'X'):
231 inode->i_mode = isonum_733(rr->u.PX.mode);
232 inode->i_nlink = isonum_733(rr->u.PX.n_links);
233 inode->i_uid = isonum_733(rr->u.PX.uid);
234 inode->i_gid = isonum_733(rr->u.PX.gid);
235 break;
236 case SIG('P', 'N'):
237 {
238 int high, low;
239 high = isonum_733(rr->u.PN.dev_high);
240 low = isonum_733(rr->u.PN.dev_low);
241 /*
242 * The Rock Ridge standard specifies that if
243 * sizeof(dev_t) <= 4, then the high field is
244 * unused, and the device number is completely
245 * stored in the low field. Some writers may
246 * ignore this subtlety,
247 * and as a result we test to see if the entire
248 * device number is
249 * stored in the low field, and use that.
250 */
251 if ((low & ~0xff) && high == 0) {
252 inode->i_rdev =
253 MKDEV(low >> 8, low & 0xff);
254 } else {
255 inode->i_rdev =
256 MKDEV(high, low);
257 }
258 }
259 break;
260 case SIG('T', 'F'):
261 /*
262 * Some RRIP writers incorrectly place ctime in the
263 * TF_CREATE field. Try to handle this correctly for
264 * either case.
265 */
266 /* Rock ridge never appears on a High Sierra disk */
267 cnt = 0;
268 if (rr->u.TF.flags & TF_CREATE) {
269 inode->i_ctime.tv_sec =
270 iso_date(rr->u.TF.times[cnt++].time,
271 0);
272 inode->i_ctime.tv_nsec = 0;
273 }
274 if (rr->u.TF.flags & TF_MODIFY) {
275 inode->i_mtime.tv_sec =
276 iso_date(rr->u.TF.times[cnt++].time,
277 0);
278 inode->i_mtime.tv_nsec = 0;
279 }
280 if (rr->u.TF.flags & TF_ACCESS) {
281 inode->i_atime.tv_sec =
282 iso_date(rr->u.TF.times[cnt++].time,
283 0);
284 inode->i_atime.tv_nsec = 0;
285 }
286 if (rr->u.TF.flags & TF_ATTRIBUTES) {
287 inode->i_ctime.tv_sec =
288 iso_date(rr->u.TF.times[cnt++].time,
289 0);
290 inode->i_ctime.tv_nsec = 0;
291 }
292 break;
293 case SIG('S', 'L'):
294 {
295 int slen;
296 struct SL_component *slp;
297 struct SL_component *oldslp;
298 slen = rr->len - 5;
299 slp = &rr->u.SL.link;
300 inode->i_size = symlink_len;
301 while (slen > 1) {
302 rootflag = 0;
303 switch (slp->flags & ~1) {
304 case 0:
305 inode->i_size +=
306 slp->len;
307 break;
308 case 2:
309 inode->i_size += 1;
310 break;
311 case 4:
312 inode->i_size += 2;
313 break;
314 case 8:
315 rootflag = 1;
316 inode->i_size += 1;
317 break;
318 default:
319 printk("Symlink component flag "
320 "not implemented\n");
321 }
322 slen -= slp->len + 2;
323 oldslp = slp;
324 slp = (struct SL_component *)
325 (((char *)slp) + slp->len + 2);
326
327 if (slen < 2) {
328 if (((rr->u.SL.
329 flags & 1) != 0)
330 &&
331 ((oldslp->
332 flags & 1) == 0))
333 inode->i_size +=
334 1;
335 break;
336 }
337
338 /*
339 * If this component record isn't
340 * continued, then append a '/'.
341 */
342 if (!rootflag
343 && (oldslp->flags & 1) == 0)
344 inode->i_size += 1;
345 }
346 }
347 symlink_len = inode->i_size;
348 break;
349 case SIG('R', 'E'):
350 printk(KERN_WARNING "Attempt to read inode for "
351 "relocated directory\n");
352 goto out;
353 case SIG('C', 'L'):
354 ISOFS_I(inode)->i_first_extent =
355 isonum_733(rr->u.CL.location);
356 reloc =
357 isofs_iget(inode->i_sb,
358 ISOFS_I(inode)->i_first_extent,
359 0);
360 if (!reloc)
361 goto out;
362 inode->i_mode = reloc->i_mode;
363 inode->i_nlink = reloc->i_nlink;
364 inode->i_uid = reloc->i_uid;
365 inode->i_gid = reloc->i_gid;
366 inode->i_rdev = reloc->i_rdev;
367 inode->i_size = reloc->i_size;
368 inode->i_blocks = reloc->i_blocks;
369 inode->i_atime = reloc->i_atime;
370 inode->i_ctime = reloc->i_ctime;
371 inode->i_mtime = reloc->i_mtime;
372 iput(reloc);
373 break;
374#ifdef CONFIG_ZISOFS
375 case SIG('Z', 'F'): {
376 int algo;
377
378 if (ISOFS_SB(inode->i_sb)->s_nocompress)
379 break;
380 algo = isonum_721(rr->u.ZF.algorithm);
381 if (algo == SIG('p', 'z')) {
382 int block_shift =
383 isonum_711(&rr->u.ZF.parms[1]);
384 if (block_shift < PAGE_CACHE_SHIFT
385 || block_shift > 17) {
386 printk(KERN_WARNING "isofs: "
387 "Can't handle ZF block "
388 "size of 2^%d\n",
389 block_shift);
390 } else {
391 /*
392 * Note: we don't change
393 * i_blocks here
394 */
395 ISOFS_I(inode)->i_file_format =
396 isofs_file_compressed;
397 /*
398 * Parameters to compression
399 * algorithm (header size,
400 * block size)
401 */
402 ISOFS_I(inode)->i_format_parm[0] =
403 isonum_711(&rr->u.ZF.parms[0]);
404 ISOFS_I(inode)->i_format_parm[1] =
405 isonum_711(&rr->u.ZF.parms[1]);
406 inode->i_size =
407 isonum_733(rr->u.ZF.
408 real_size);
409 }
410 } else {
411 printk(KERN_WARNING
412 "isofs: Unknown ZF compression "
413 "algorithm: %c%c\n",
414 rr->u.ZF.algorithm[0],
415 rr->u.ZF.algorithm[1]);
416 }
417 break;
418 }
419#endif
420 default:
421 break;
Andrew Morton1d372112005-06-21 17:16:42 -0700422 }
423 }
424 MAYBE_CONTINUE(repeat, inode);
Andrew Morton7fa393a2005-06-21 17:16:43 -0700425out:
Andrew Morton1d372112005-06-21 17:16:42 -0700426 if (buffer)
427 kfree(buffer);
428 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429}
430
431static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
432{
433 int slen;
434 int rootflag;
435 struct SL_component *oldslp;
436 struct SL_component *slp;
437 slen = rr->len - 5;
438 slp = &rr->u.SL.link;
439 while (slen > 1) {
440 rootflag = 0;
441 switch (slp->flags & ~1) {
442 case 0:
443 if (slp->len > plimit - rpnt)
444 return NULL;
445 memcpy(rpnt, slp->text, slp->len);
Andrew Morton1d372112005-06-21 17:16:42 -0700446 rpnt += slp->len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 break;
448 case 2:
449 if (rpnt >= plimit)
450 return NULL;
Andrew Morton1d372112005-06-21 17:16:42 -0700451 *rpnt++ = '.';
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452 break;
453 case 4:
454 if (2 > plimit - rpnt)
455 return NULL;
Andrew Morton1d372112005-06-21 17:16:42 -0700456 *rpnt++ = '.';
457 *rpnt++ = '.';
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 break;
459 case 8:
460 if (rpnt >= plimit)
461 return NULL;
462 rootflag = 1;
Andrew Morton1d372112005-06-21 17:16:42 -0700463 *rpnt++ = '/';
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 break;
465 default:
466 printk("Symlink component flag not implemented (%d)\n",
Andrew Morton1d372112005-06-21 17:16:42 -0700467 slp->flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700468 }
469 slen -= slp->len + 2;
470 oldslp = slp;
Andrew Morton1d372112005-06-21 17:16:42 -0700471 slp = (struct SL_component *)((char *)slp + slp->len + 2);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472
473 if (slen < 2) {
474 /*
475 * If there is another SL record, and this component
476 * record isn't continued, then add a slash.
477 */
478 if ((!rootflag) && (rr->u.SL.flags & 1) &&
479 !(oldslp->flags & 1)) {
480 if (rpnt >= plimit)
481 return NULL;
Andrew Morton1d372112005-06-21 17:16:42 -0700482 *rpnt++ = '/';
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 }
484 break;
485 }
486
487 /*
488 * If this component record isn't continued, then append a '/'.
489 */
490 if (!rootflag && !(oldslp->flags & 1)) {
491 if (rpnt >= plimit)
492 return NULL;
Andrew Morton1d372112005-06-21 17:16:42 -0700493 *rpnt++ = '/';
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 }
495 }
496 return rpnt;
497}
498
Andrew Morton1d372112005-06-21 17:16:42 -0700499int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500{
Andrew Morton1d372112005-06-21 17:16:42 -0700501 int result = parse_rock_ridge_inode_internal(de, inode, 0);
502 /* if rockridge flag was reset and we didn't look for attributes
503 * behind eventual XA attributes, have a look there */
504 if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)
505 && (ISOFS_SB(inode->i_sb)->s_rock == 2)) {
506 result = parse_rock_ridge_inode_internal(de, inode, 14);
507 }
508 return result;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509}
510
511/* readpage() for symlinks: reads symlink contents into the page and either
512 makes it uptodate and returns 0 or returns error (-EIO) */
513
514static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
515{
516 struct inode *inode = page->mapping->host;
Andrew Morton1d372112005-06-21 17:16:42 -0700517 struct iso_inode_info *ei = ISOFS_I(inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 char *link = kmap(page);
519 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
520 struct buffer_head *bh;
521 char *rpnt = link;
522 unsigned char *pnt;
523 struct iso_directory_record *raw_inode;
524 CONTINUE_DECLS;
525 unsigned long block, offset;
526 int sig;
527 int len;
528 unsigned char *chr;
529 struct rock_ridge *rr;
530
531 if (!ISOFS_SB(inode->i_sb)->s_rock)
532 goto error;
533
534 block = ei->i_iget5_block;
535 lock_kernel();
536 bh = sb_bread(inode->i_sb, block);
537 if (!bh)
538 goto out_noread;
539
Andrew Morton1d372112005-06-21 17:16:42 -0700540 offset = ei->i_iget5_offset;
541 pnt = (unsigned char *)bh->b_data + offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542
Andrew Morton1d372112005-06-21 17:16:42 -0700543 raw_inode = (struct iso_directory_record *)pnt;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544
545 /*
546 * If we go past the end of the buffer, there is some sort of error.
547 */
548 if (offset + *pnt > bufsize)
549 goto out_bad_span;
550
551 /* Now test for possible Rock Ridge extensions which will override
552 some of these numbers in the inode structure. */
553
554 SETUP_ROCK_RIDGE(raw_inode, chr, len);
555
Andrew Morton7fa393a2005-06-21 17:16:43 -0700556repeat:
557 while (len > 2) { /* There may be one byte for padding somewhere */
Andrew Morton1d372112005-06-21 17:16:42 -0700558 rr = (struct rock_ridge *)chr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 if (rr->len < 3)
560 goto out; /* Something got screwed up here */
561 sig = isonum_721(chr);
562 chr += rr->len;
563 len -= rr->len;
564 if (len < 0)
565 goto out; /* corrupted isofs */
566
567 switch (sig) {
568 case SIG('R', 'R'):
569 if ((rr->u.RR.flags[0] & RR_SL) == 0)
570 goto out;
571 break;
572 case SIG('S', 'P'):
573 CHECK_SP(goto out);
574 break;
575 case SIG('S', 'L'):
576 rpnt = get_symlink_chunk(rpnt, rr,
577 link + (PAGE_SIZE - 1));
578 if (rpnt == NULL)
579 goto out;
580 break;
581 case SIG('C', 'E'):
582 /* This tells is if there is a continuation record */
583 CHECK_CE;
584 default:
585 break;
586 }
587 }
588 MAYBE_CONTINUE(repeat, inode);
Andrew Morton7fa393a2005-06-21 17:16:43 -0700589 kfree(buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590
591 if (rpnt == link)
592 goto fail;
593 brelse(bh);
594 *rpnt = '\0';
595 unlock_kernel();
596 SetPageUptodate(page);
597 kunmap(page);
598 unlock_page(page);
599 return 0;
600
601 /* error exit from macro */
Andrew Morton7fa393a2005-06-21 17:16:43 -0700602out:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 if (buffer)
604 kfree(buffer);
605 goto fail;
Andrew Morton7fa393a2005-06-21 17:16:43 -0700606out_noread:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 printk("unable to read i-node block");
608 goto fail;
Andrew Morton7fa393a2005-06-21 17:16:43 -0700609out_bad_span:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 printk("symlink spans iso9660 blocks\n");
Andrew Morton7fa393a2005-06-21 17:16:43 -0700611fail:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 brelse(bh);
613 unlock_kernel();
Andrew Morton7fa393a2005-06-21 17:16:43 -0700614error:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 SetPageError(page);
616 kunmap(page);
617 unlock_page(page);
618 return -EIO;
619}
620
621struct address_space_operations isofs_symlink_aops = {
Andrew Morton1d372112005-06-21 17:16:42 -0700622 .readpage = rock_ridge_symlink_readpage
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623};