rock.c (b7e56edba4b02f2079042c326a8cd72a44635817) | rock.c (4f819a7899b06afcd7623ab9d00fd81503ad3e24) |
---|---|
1/* 2 * linux/fs/isofs/rock.c 3 * 4 * (C) 1992, 1993 Eric Youngdale 5 * 6 * Rock Ridge Extensions to iso9660 7 */ 8 9#include <linux/slab.h> 10#include <linux/pagemap.h> | 1/* 2 * linux/fs/isofs/rock.c 3 * 4 * (C) 1992, 1993 Eric Youngdale 5 * 6 * Rock Ridge Extensions to iso9660 7 */ 8 9#include <linux/slab.h> 10#include <linux/pagemap.h> |
11#include <linux/smp_lock.h> | |
12 13#include "isofs.h" 14#include "rock.h" 15 16/* 17 * These functions are designed to read the system areas of a directory record 18 * and extract relevant information. There are different functions provided 19 * depending upon what information we need at the time. One function fills --- 636 unchanged lines hidden (view full) --- 656/* 657 * readpage() for symlinks: reads symlink contents into the page and either 658 * makes it uptodate and returns 0 or returns error (-EIO) 659 */ 660static int rock_ridge_symlink_readpage(struct file *file, struct page *page) 661{ 662 struct inode *inode = page->mapping->host; 663 struct iso_inode_info *ei = ISOFS_I(inode); | 11 12#include "isofs.h" 13#include "rock.h" 14 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 --- 636 unchanged lines hidden (view full) --- 655/* 656 * readpage() for symlinks: reads symlink contents into the page and either 657 * makes it uptodate and returns 0 or returns error (-EIO) 658 */ 659static int rock_ridge_symlink_readpage(struct file *file, struct page *page) 660{ 661 struct inode *inode = page->mapping->host; 662 struct iso_inode_info *ei = ISOFS_I(inode); |
663 struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb); |
|
664 char *link = kmap(page); 665 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); 666 struct buffer_head *bh; 667 char *rpnt = link; 668 unsigned char *pnt; 669 struct iso_directory_record *raw_de; 670 unsigned long block, offset; 671 int sig; 672 struct rock_ridge *rr; 673 struct rock_state rs; 674 int ret; 675 | 664 char *link = kmap(page); 665 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); 666 struct buffer_head *bh; 667 char *rpnt = link; 668 unsigned char *pnt; 669 struct iso_directory_record *raw_de; 670 unsigned long block, offset; 671 int sig; 672 struct rock_ridge *rr; 673 struct rock_state rs; 674 int ret; 675 |
676 if (!ISOFS_SB(inode->i_sb)->s_rock) | 676 if (!sbi->s_rock) |
677 goto error; 678 679 init_rock_state(&rs, inode); 680 block = ei->i_iget5_block; | 677 goto error; 678 679 init_rock_state(&rs, inode); 680 block = ei->i_iget5_block; |
681 lock_kernel(); | 681 mutex_lock(&sbi->s_mutex); |
682 bh = sb_bread(inode->i_sb, block); 683 if (!bh) 684 goto out_noread; 685 686 offset = ei->i_iget5_offset; 687 pnt = (unsigned char *)bh->b_data + offset; 688 689 raw_de = (struct iso_directory_record *)pnt; --- 53 unchanged lines hidden (view full) --- 743 goto repeat; 744 if (ret < 0) 745 goto fail; 746 747 if (rpnt == link) 748 goto fail; 749 brelse(bh); 750 *rpnt = '\0'; | 682 bh = sb_bread(inode->i_sb, block); 683 if (!bh) 684 goto out_noread; 685 686 offset = ei->i_iget5_offset; 687 pnt = (unsigned char *)bh->b_data + offset; 688 689 raw_de = (struct iso_directory_record *)pnt; --- 53 unchanged lines hidden (view full) --- 743 goto repeat; 744 if (ret < 0) 745 goto fail; 746 747 if (rpnt == link) 748 goto fail; 749 brelse(bh); 750 *rpnt = '\0'; |
751 unlock_kernel(); | 751 mutex_unlock(&sbi->s_mutex); |
752 SetPageUptodate(page); 753 kunmap(page); 754 unlock_page(page); 755 return 0; 756 757 /* error exit from macro */ 758out: 759 kfree(rs.buffer); 760 goto fail; 761out_noread: 762 printk("unable to read i-node block"); 763 goto fail; 764out_bad_span: 765 printk("symlink spans iso9660 blocks\n"); 766fail: 767 brelse(bh); | 752 SetPageUptodate(page); 753 kunmap(page); 754 unlock_page(page); 755 return 0; 756 757 /* error exit from macro */ 758out: 759 kfree(rs.buffer); 760 goto fail; 761out_noread: 762 printk("unable to read i-node block"); 763 goto fail; 764out_bad_span: 765 printk("symlink spans iso9660 blocks\n"); 766fail: 767 brelse(bh); |
768 unlock_kernel(); | 768 mutex_unlock(&sbi->s_mutex); |
769error: 770 SetPageError(page); 771 kunmap(page); 772 unlock_page(page); 773 return -EIO; 774} 775 776const struct address_space_operations isofs_symlink_aops = { 777 .readpage = rock_ridge_symlink_readpage 778}; | 769error: 770 SetPageError(page); 771 kunmap(page); 772 unlock_page(page); 773 return -EIO; 774} 775 776const struct address_space_operations isofs_symlink_aops = { 777 .readpage = rock_ridge_symlink_readpage 778}; |