original development tree for Linux kernel GTP module; now long in mainline.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

775 lines
18 KiB

  1. /*
  2. * linux/fs/isofs/rock.c
  3. *
  4. * (C) 1992, 1993 Eric Youngdale
  5. *
  6. * Rock Ridge Extensions to iso9660
  7. */
  8. #include <linux/slab.h>
  9. #include <linux/pagemap.h>
  10. #include "isofs.h"
  11. #include "rock.h"
  12. /*
  13. * These functions are designed to read the system areas of a directory record
  14. * and extract relevant information. There are different functions provided
  15. * depending upon what information we need at the time. One function fills
  16. * out an inode structure, a second one extracts a filename, a third one
  17. * returns a symbolic link name, and a fourth one returns the extent number
  18. * for the file.
  19. */
  20. #define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */
  21. struct rock_state {
  22. void *buffer;
  23. unsigned char *chr;
  24. int len;
  25. int cont_size;
  26. int cont_extent;
  27. int cont_offset;
  28. struct inode *inode;
  29. };
  30. /*
  31. * This is a way of ensuring that we have something in the system
  32. * use fields that is compatible with Rock Ridge. Return zero on success.
  33. */
  34. static int check_sp(struct rock_ridge *rr, struct inode *inode)
  35. {
  36. if (rr->u.SP.magic[0] != 0xbe)
  37. return -1;
  38. if (rr->u.SP.magic[1] != 0xef)
  39. return -1;
  40. ISOFS_SB(inode->i_sb)->s_rock_offset = rr->u.SP.skip;
  41. return 0;
  42. }
  43. static void setup_rock_ridge(struct iso_directory_record *de,
  44. struct inode *inode, struct rock_state *rs)
  45. {
  46. rs->len = sizeof(struct iso_directory_record) + de->name_len[0];
  47. if (rs->len & 1)
  48. (rs->len)++;
  49. rs->chr = (unsigned char *)de + rs->len;
  50. rs->len = *((unsigned char *)de) - rs->len;
  51. if (rs->len < 0)
  52. rs->len = 0;
  53. if (ISOFS_SB(inode->i_sb)->s_rock_offset != -1) {
  54. rs->len -= ISOFS_SB(inode->i_sb)->s_rock_offset;
  55. rs->chr += ISOFS_SB(inode->i_sb)->s_rock_offset;
  56. if (rs->len < 0)
  57. rs->len = 0;
  58. }
  59. }
  60. static void init_rock_state(struct rock_state *rs, struct inode *inode)
  61. {
  62. memset(rs, 0, sizeof(*rs));
  63. rs->inode = inode;
  64. }
  65. /*
  66. * Returns 0 if the caller should continue scanning, 1 if the scan must end
  67. * and -ve on error.
  68. */
  69. static int rock_continue(struct rock_state *rs)
  70. {
  71. int ret = 1;
  72. int blocksize = 1 << rs->inode->i_blkbits;
  73. const int min_de_size = offsetof(struct rock_ridge, u);
  74. kfree(rs->buffer);
  75. rs->buffer = NULL;
  76. if ((unsigned)rs->cont_offset > blocksize - min_de_size ||
  77. (unsigned)rs->cont_size > blocksize ||
  78. (unsigned)(rs->cont_offset + rs->cont_size) > blocksize) {
  79. printk(KERN_NOTICE "rock: corrupted directory entry. "
  80. "extent=%d, offset=%d, size=%d\n",
  81. rs->cont_extent, rs->cont_offset, rs->cont_size);
  82. ret = -EIO;
  83. goto out;
  84. }
  85. if (rs->cont_extent) {
  86. struct buffer_head *bh;
  87. rs->buffer = kmalloc(rs->cont_size, GFP_KERNEL);
  88. if (!rs->buffer) {
  89. ret = -ENOMEM;
  90. goto out;
  91. }
  92. ret = -EIO;
  93. bh = sb_bread(rs->inode->i_sb, rs->cont_extent);
  94. if (bh) {
  95. memcpy(rs->buffer, bh->b_data + rs->cont_offset,
  96. rs->cont_size);
  97. put_bh(bh);
  98. rs->chr = rs->buffer;
  99. rs->len = rs->cont_size;
  100. rs->cont_extent = 0;
  101. rs->cont_size = 0;
  102. rs->cont_offset = 0;
  103. return 0;
  104. }
  105. printk("Unable to read rock-ridge attributes\n");
  106. }
  107. out:
  108. kfree(rs->buffer);
  109. rs->buffer = NULL;
  110. return ret;
  111. }
  112. /*
  113. * We think there's a record of type `sig' at rs->chr. Parse the signature
  114. * and make sure that there's really room for a record of that type.
  115. */
  116. static int rock_check_overflow(struct rock_state *rs, int sig)
  117. {
  118. int len;
  119. switch (sig) {
  120. case SIG('S', 'P'):
  121. len = sizeof(struct SU_SP_s);
  122. break;
  123. case SIG('C', 'E'):
  124. len = sizeof(struct SU_CE_s);
  125. break;
  126. case SIG('E', 'R'):
  127. len = sizeof(struct SU_ER_s);
  128. break;
  129. case SIG('R', 'R'):
  130. len = sizeof(struct RR_RR_s);
  131. break;
  132. case SIG('P', 'X'):
  133. len = sizeof(struct RR_PX_s);
  134. break;
  135. case SIG('P', 'N'):
  136. len = sizeof(struct RR_PN_s);
  137. break;
  138. case SIG('S', 'L'):
  139. len = sizeof(struct RR_SL_s);
  140. break;
  141. case SIG('N', 'M'):
  142. len = sizeof(struct RR_NM_s);
  143. break;
  144. case SIG('C', 'L'):
  145. len = sizeof(struct RR_CL_s);
  146. break;
  147. case SIG('P', 'L'):
  148. len = sizeof(struct RR_PL_s);
  149. break;
  150. case SIG('T', 'F'):
  151. len = sizeof(struct RR_TF_s);
  152. break;
  153. case SIG('Z', 'F'):
  154. len = sizeof(struct RR_ZF_s);
  155. break;
  156. default:
  157. len = 0;
  158. break;
  159. }
  160. len += offsetof(struct rock_ridge, u);
  161. if (len > rs->len) {
  162. printk(KERN_NOTICE "rock: directory entry would overflow "
  163. "storage\n");
  164. printk(KERN_NOTICE "rock: sig=0x%02x, size=%d, remaining=%d\n",
  165. sig, len, rs->len);
  166. return -EIO;
  167. }
  168. return 0;
  169. }
  170. /*
  171. * return length of name field; 0: not found, -1: to be ignored
  172. */
  173. int get_rock_ridge_filename(struct iso_directory_record *de,
  174. char *retname, struct inode *inode)
  175. {
  176. struct rock_state rs;
  177. struct rock_ridge *rr;
  178. int sig;
  179. int retnamlen = 0;
  180. int truncate = 0;
  181. int ret = 0;
  182. if (!ISOFS_SB(inode->i_sb)->s_rock)
  183. return 0;
  184. *retname = 0;
  185. init_rock_state(&rs, inode);
  186. setup_rock_ridge(de, inode, &rs);
  187. repeat:
  188. while (rs.len > 2) { /* There may be one byte for padding somewhere */
  189. rr = (struct rock_ridge *)rs.chr;
  190. /*
  191. * Ignore rock ridge info if rr->len is out of range, but
  192. * don't return -EIO because that would make the file
  193. * invisible.
  194. */
  195. if (rr->len < 3)
  196. goto out; /* Something got screwed up here */
  197. sig = isonum_721(rs.chr);
  198. if (rock_check_overflow(&rs, sig))
  199. goto eio;
  200. rs.chr += rr->len;
  201. rs.len -= rr->len;
  202. /*
  203. * As above, just ignore the rock ridge info if rr->len
  204. * is bogus.
  205. */
  206. if (rs.len < 0)
  207. goto out; /* Something got screwed up here */
  208. switch (sig) {
  209. case SIG('R', 'R'):
  210. if ((rr->u.RR.flags[0] & RR_NM) == 0)
  211. goto out;
  212. break;
  213. case SIG('S', 'P'):
  214. if (check_sp(rr, inode))
  215. goto out;
  216. break;
  217. case SIG('C', 'E'):
  218. rs.cont_extent = isonum_733(rr->u.CE.extent);
  219. rs.cont_offset = isonum_733(rr->u.CE.offset);
  220. rs.cont_size = isonum_733(rr->u.CE.size);
  221. break;
  222. case SIG('N', 'M'):
  223. if (truncate)
  224. break;
  225. if (rr->len < 5)
  226. break;
  227. /*
  228. * If the flags are 2 or 4, this indicates '.' or '..'.
  229. * We don't want to do anything with this, because it
  230. * screws up the code that calls us. We don't really
  231. * care anyways, since we can just use the non-RR
  232. * name.
  233. */
  234. if (rr->u.NM.flags & 6)
  235. break;
  236. if (rr->u.NM.flags & ~1) {
  237. printk("Unsupported NM flag settings (%d)\n",
  238. rr->u.NM.flags);
  239. break;
  240. }
  241. if ((strlen(retname) + rr->len - 5) >= 254) {
  242. truncate = 1;
  243. break;
  244. }
  245. strncat(retname, rr->u.NM.name, rr->len - 5);
  246. retnamlen += rr->len - 5;
  247. break;
  248. case SIG('R', 'E'):
  249. kfree(rs.buffer);
  250. return -1;
  251. default:
  252. break;
  253. }
  254. }
  255. ret = rock_continue(&rs);
  256. if (ret == 0)
  257. goto repeat;
  258. if (ret == 1)
  259. return retnamlen; /* If 0, this file did not have a NM field */
  260. out:
  261. kfree(rs.buffer);
  262. return ret;
  263. eio:
  264. ret = -EIO;
  265. goto out;
  266. }
  267. static int
  268. parse_rock_ridge_inode_internal(struct iso_directory_record *de,
  269. struct inode *inode, int regard_xa)
  270. {
  271. int symlink_len = 0;
  272. int cnt, sig;
  273. struct inode *reloc;
  274. struct rock_ridge *rr;
  275. int rootflag;
  276. struct rock_state rs;
  277. int ret = 0;
  278. if (!ISOFS_SB(inode->i_sb)->s_rock)
  279. return 0;
  280. init_rock_state(&rs, inode);
  281. setup_rock_ridge(de, inode, &rs);
  282. if (regard_xa) {
  283. rs.chr += 14;
  284. rs.len -= 14;
  285. if (rs.len < 0)
  286. rs.len = 0;
  287. }
  288. repeat:
  289. while (rs.len > 2) { /* There may be one byte for padding somewhere */
  290. rr = (struct rock_ridge *)rs.chr;
  291. /*
  292. * Ignore rock ridge info if rr->len is out of range, but
  293. * don't return -EIO because that would make the file
  294. * invisible.
  295. */
  296. if (rr->len < 3)
  297. goto out; /* Something got screwed up here */
  298. sig = isonum_721(rs.chr);
  299. if (rock_check_overflow(&rs, sig))
  300. goto eio;
  301. rs.chr += rr->len;
  302. rs.len -= rr->len;
  303. /*
  304. * As above, just ignore the rock ridge info if rr->len
  305. * is bogus.
  306. */
  307. if (rs.len < 0)
  308. goto out; /* Something got screwed up here */
  309. switch (sig) {
  310. #ifndef CONFIG_ZISOFS /* No flag for SF or ZF */
  311. case SIG('R', 'R'):
  312. if ((rr->u.RR.flags[0] &
  313. (RR_PX | RR_TF | RR_SL | RR_CL)) == 0)
  314. goto out;
  315. break;
  316. #endif
  317. case SIG('S', 'P'):
  318. if (check_sp(rr, inode))
  319. goto out;
  320. break;
  321. case SIG('C', 'E'):
  322. rs.cont_extent = isonum_733(rr->u.CE.extent);
  323. rs.cont_offset = isonum_733(rr->u.CE.offset);
  324. rs.cont_size = isonum_733(rr->u.CE.size);
  325. break;
  326. case SIG('E', 'R'):
  327. ISOFS_SB(inode->i_sb)->s_rock = 1;
  328. printk(KERN_DEBUG "ISO 9660 Extensions: ");
  329. {
  330. int p;
  331. for (p = 0; p < rr->u.ER.len_id; p++)
  332. printk("%c", rr->u.ER.data[p]);
  333. }
  334. printk("\n");
  335. break;
  336. case SIG('P', 'X'):
  337. inode->i_mode = isonum_733(rr->u.PX.mode);
  338. set_nlink(inode, isonum_733(rr->u.PX.n_links));
  339. i_uid_write(inode, isonum_733(rr->u.PX.uid));
  340. i_gid_write(inode, isonum_733(rr->u.PX.gid));
  341. break;
  342. case SIG('P', 'N'):
  343. {
  344. int high, low;
  345. high = isonum_733(rr->u.PN.dev_high);
  346. low = isonum_733(rr->u.PN.dev_low);
  347. /*
  348. * The Rock Ridge standard specifies that if
  349. * sizeof(dev_t) <= 4, then the high field is
  350. * unused, and the device number is completely
  351. * stored in the low field. Some writers may
  352. * ignore this subtlety,
  353. * and as a result we test to see if the entire
  354. * device number is
  355. * stored in the low field, and use that.
  356. */
  357. if ((low & ~0xff) && high == 0) {
  358. inode->i_rdev =
  359. MKDEV(low >> 8, low & 0xff);
  360. } else {
  361. inode->i_rdev =
  362. MKDEV(high, low);
  363. }
  364. }
  365. break;
  366. case SIG('T', 'F'):
  367. /*
  368. * Some RRIP writers incorrectly place ctime in the
  369. * TF_CREATE field. Try to handle this correctly for
  370. * either case.
  371. */
  372. /* Rock ridge never appears on a High Sierra disk */
  373. cnt = 0;
  374. if (rr->u.TF.flags & TF_CREATE) {
  375. inode->i_ctime.tv_sec =
  376. iso_date(rr->u.TF.times[cnt++].time,
  377. 0);
  378. inode->i_ctime.tv_nsec = 0;
  379. }
  380. if (rr->u.TF.flags & TF_MODIFY) {
  381. inode->i_mtime.tv_sec =
  382. iso_date(rr->u.TF.times[cnt++].time,
  383. 0);
  384. inode->i_mtime.tv_nsec = 0;
  385. }
  386. if (rr->u.TF.flags & TF_ACCESS) {
  387. inode->i_atime.tv_sec =
  388. iso_date(rr->u.TF.times[cnt++].time,
  389. 0);
  390. inode->i_atime.tv_nsec = 0;
  391. }
  392. if (rr->u.TF.flags & TF_ATTRIBUTES) {
  393. inode->i_ctime.tv_sec =
  394. iso_date(rr->u.TF.times[cnt++].time,
  395. 0);
  396. inode->i_ctime.tv_nsec = 0;
  397. }
  398. break;
  399. case SIG('S', 'L'):
  400. {
  401. int slen;
  402. struct SL_component *slp;
  403. struct SL_component *oldslp;
  404. slen = rr->len - 5;
  405. slp = &rr->u.SL.link;
  406. inode->i_size = symlink_len;
  407. while (slen > 1) {
  408. rootflag = 0;
  409. switch (slp->flags & ~1) {
  410. case 0:
  411. inode->i_size +=
  412. slp->len;
  413. break;
  414. case 2:
  415. inode->i_size += 1;
  416. break;
  417. case 4:
  418. inode->i_size += 2;
  419. break;
  420. case 8:
  421. rootflag = 1;
  422. inode->i_size += 1;
  423. break;
  424. default:
  425. printk("Symlink component flag "
  426. "not implemented\n");
  427. }
  428. slen -= slp->len + 2;
  429. oldslp = slp;
  430. slp = (struct SL_component *)
  431. (((char *)slp) + slp->len + 2);
  432. if (slen < 2) {
  433. if (((rr->u.SL.
  434. flags & 1) != 0)
  435. &&
  436. ((oldslp->
  437. flags & 1) == 0))
  438. inode->i_size +=
  439. 1;
  440. break;
  441. }
  442. /*
  443. * If this component record isn't
  444. * continued, then append a '/'.
  445. */
  446. if (!rootflag
  447. && (oldslp->flags & 1) == 0)
  448. inode->i_size += 1;
  449. }
  450. }
  451. symlink_len = inode->i_size;
  452. break;
  453. case SIG('R', 'E'):
  454. printk(KERN_WARNING "Attempt to read inode for "
  455. "relocated directory\n");
  456. goto out;
  457. case SIG('C', 'L'):
  458. ISOFS_I(inode)->i_first_extent =
  459. isonum_733(rr->u.CL.location);
  460. reloc =
  461. isofs_iget(inode->i_sb,
  462. ISOFS_I(inode)->i_first_extent,
  463. 0);
  464. if (IS_ERR(reloc)) {
  465. ret = PTR_ERR(reloc);
  466. goto out;
  467. }
  468. inode->i_mode = reloc->i_mode;
  469. set_nlink(inode, reloc->i_nlink);
  470. inode->i_uid = reloc->i_uid;
  471. inode->i_gid = reloc->i_gid;
  472. inode->i_rdev = reloc->i_rdev;
  473. inode->i_size = reloc->i_size;
  474. inode->i_blocks = reloc->i_blocks;
  475. inode->i_atime = reloc->i_atime;
  476. inode->i_ctime = reloc->i_ctime;
  477. inode->i_mtime = reloc->i_mtime;
  478. iput(reloc);
  479. break;
  480. #ifdef CONFIG_ZISOFS
  481. case SIG('Z', 'F'): {
  482. int algo;
  483. if (ISOFS_SB(inode->i_sb)->s_nocompress)
  484. break;
  485. algo = isonum_721(rr->u.ZF.algorithm);
  486. if (algo == SIG('p', 'z')) {
  487. int block_shift =
  488. isonum_711(&rr->u.ZF.parms[1]);
  489. if (block_shift > 17) {
  490. printk(KERN_WARNING "isofs: "
  491. "Can't handle ZF block "
  492. "size of 2^%d\n",
  493. block_shift);
  494. } else {
  495. /*
  496. * Note: we don't change
  497. * i_blocks here
  498. */
  499. ISOFS_I(inode)->i_file_format =
  500. isofs_file_compressed;
  501. /*
  502. * Parameters to compression
  503. * algorithm (header size,
  504. * block size)
  505. */
  506. ISOFS_I(inode)->i_format_parm[0] =
  507. isonum_711(&rr->u.ZF.parms[0]);
  508. ISOFS_I(inode)->i_format_parm[1] =
  509. isonum_711(&rr->u.ZF.parms[1]);
  510. inode->i_size =
  511. isonum_733(rr->u.ZF.
  512. real_size);
  513. }
  514. } else {
  515. printk(KERN_WARNING
  516. "isofs: Unknown ZF compression "
  517. "algorithm: %c%c\n",
  518. rr->u.ZF.algorithm[0],
  519. rr->u.ZF.algorithm[1]);
  520. }
  521. break;
  522. }
  523. #endif
  524. default:
  525. break;
  526. }
  527. }
  528. ret = rock_continue(&rs);
  529. if (ret == 0)
  530. goto repeat;
  531. if (ret == 1)
  532. ret = 0;
  533. out:
  534. kfree(rs.buffer);
  535. return ret;
  536. eio:
  537. ret = -EIO;
  538. goto out;
  539. }
  540. static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
  541. {
  542. int slen;
  543. int rootflag;
  544. struct SL_component *oldslp;
  545. struct SL_component *slp;
  546. slen = rr->len - 5;
  547. slp = &rr->u.SL.link;
  548. while (slen > 1) {
  549. rootflag = 0;
  550. switch (slp->flags & ~1) {
  551. case 0:
  552. if (slp->len > plimit - rpnt)
  553. return NULL;
  554. memcpy(rpnt, slp->text, slp->len);
  555. rpnt += slp->len;
  556. break;
  557. case 2:
  558. if (rpnt >= plimit)
  559. return NULL;
  560. *rpnt++ = '.';
  561. break;
  562. case 4:
  563. if (2 > plimit - rpnt)
  564. return NULL;
  565. *rpnt++ = '.';
  566. *rpnt++ = '.';
  567. break;
  568. case 8:
  569. if (rpnt >= plimit)
  570. return NULL;
  571. rootflag = 1;
  572. *rpnt++ = '/';
  573. break;
  574. default:
  575. printk("Symlink component flag not implemented (%d)\n",
  576. slp->flags);
  577. }
  578. slen -= slp->len + 2;
  579. oldslp = slp;
  580. slp = (struct SL_component *)((char *)slp + slp->len + 2);
  581. if (slen < 2) {
  582. /*
  583. * If there is another SL record, and this component
  584. * record isn't continued, then add a slash.
  585. */
  586. if ((!rootflag) && (rr->u.SL.flags & 1) &&
  587. !(oldslp->flags & 1)) {
  588. if (rpnt >= plimit)
  589. return NULL;
  590. *rpnt++ = '/';
  591. }
  592. break;
  593. }
  594. /*
  595. * If this component record isn't continued, then append a '/'.
  596. */
  597. if (!rootflag && !(oldslp->flags & 1)) {
  598. if (rpnt >= plimit)
  599. return NULL;
  600. *rpnt++ = '/';
  601. }
  602. }
  603. return rpnt;
  604. }
  605. int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)
  606. {
  607. int result = parse_rock_ridge_inode_internal(de, inode, 0);
  608. /*
  609. * if rockridge flag was reset and we didn't look for attributes
  610. * behind eventual XA attributes, have a look there
  611. */
  612. if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)
  613. && (ISOFS_SB(inode->i_sb)->s_rock == 2)) {
  614. result = parse_rock_ridge_inode_internal(de, inode, 14);
  615. }
  616. return result;
  617. }
  618. /*
  619. * readpage() for symlinks: reads symlink contents into the page and either
  620. * makes it uptodate and returns 0 or returns error (-EIO)
  621. */
  622. static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
  623. {
  624. struct inode *inode = page->mapping->host;
  625. struct iso_inode_info *ei = ISOFS_I(inode);
  626. struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
  627. char *link = kmap(page);
  628. unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
  629. struct buffer_head *bh;
  630. char *rpnt = link;
  631. unsigned char *pnt;
  632. struct iso_directory_record *raw_de;
  633. unsigned long block, offset;
  634. int sig;
  635. struct rock_ridge *rr;
  636. struct rock_state rs;
  637. int ret;
  638. if (!sbi->s_rock)
  639. goto error;
  640. init_rock_state(&rs, inode);
  641. block = ei->i_iget5_block;
  642. bh = sb_bread(inode->i_sb, block);
  643. if (!bh)
  644. goto out_noread;
  645. offset = ei->i_iget5_offset;
  646. pnt = (unsigned char *)bh->b_data + offset;
  647. raw_de = (struct iso_directory_record *)pnt;
  648. /*
  649. * If we go past the end of the buffer, there is some sort of error.
  650. */
  651. if (offset + *pnt > bufsize)
  652. goto out_bad_span;
  653. /*
  654. * Now test for possible Rock Ridge extensions which will override
  655. * some of these numbers in the inode structure.
  656. */
  657. setup_rock_ridge(raw_de, inode, &rs);
  658. repeat:
  659. while (rs.len > 2) { /* There may be one byte for padding somewhere */
  660. rr = (struct rock_ridge *)rs.chr;
  661. if (rr->len < 3)
  662. goto out; /* Something got screwed up here */
  663. sig = isonum_721(rs.chr);
  664. if (rock_check_overflow(&rs, sig))
  665. goto out;
  666. rs.chr += rr->len;
  667. rs.len -= rr->len;
  668. if (rs.len < 0)
  669. goto out; /* corrupted isofs */
  670. switch (sig) {
  671. case SIG('R', 'R'):
  672. if ((rr->u.RR.flags[0] & RR_SL) == 0)
  673. goto out;
  674. break;
  675. case SIG('S', 'P'):
  676. if (check_sp(rr, inode))
  677. goto out;
  678. break;
  679. case SIG('S', 'L'):
  680. rpnt = get_symlink_chunk(rpnt, rr,
  681. link + (PAGE_SIZE - 1));
  682. if (rpnt == NULL)
  683. goto out;
  684. break;
  685. case SIG('C', 'E'):
  686. /* This tells is if there is a continuation record */
  687. rs.cont_extent = isonum_733(rr->u.CE.extent);
  688. rs.cont_offset = isonum_733(rr->u.CE.offset);
  689. rs.cont_size = isonum_733(rr->u.CE.size);
  690. default:
  691. break;
  692. }
  693. }
  694. ret = rock_continue(&rs);
  695. if (ret == 0)
  696. goto repeat;
  697. if (ret < 0)
  698. goto fail;
  699. if (rpnt == link)
  700. goto fail;
  701. brelse(bh);
  702. *rpnt = '\0';
  703. SetPageUptodate(page);
  704. kunmap(page);
  705. unlock_page(page);
  706. return 0;
  707. /* error exit from macro */
  708. out:
  709. kfree(rs.buffer);
  710. goto fail;
  711. out_noread:
  712. printk("unable to read i-node block");
  713. goto fail;
  714. out_bad_span:
  715. printk("symlink spans iso9660 blocks\n");
  716. fail:
  717. brelse(bh);
  718. error:
  719. SetPageError(page);
  720. kunmap(page);
  721. unlock_page(page);
  722. return -EIO;
  723. }
  724. const struct address_space_operations isofs_symlink_aops = {
  725. .readpage = rock_ridge_symlink_readpage
  726. };