diff options
author | Tony Luck <tony.luck@intel.com> | 2005-07-15 19:59:00 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-07-15 19:59:00 -0400 |
commit | 08848e446bcd2130c26945be966446389d25bcc2 (patch) | |
tree | e31e6ec7a1d9e8f6bbf8cdee2692eb42f4869f47 /fs | |
parent | 46906c4415f88cebfad530917bada0835d651824 (diff) | |
parent | 38d84c3bd6dd22bdb1f797c87006931133d71aea (diff) |
Auto merge with /home/aegl/GIT/linus
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext2/xip.c | 81 | ||||
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 9 | ||||
-rw-r--r-- | fs/hppfs/hppfs_kern.c | 6 |
3 files changed, 50 insertions, 46 deletions
diff --git a/fs/ext2/xip.c b/fs/ext2/xip.c index d44431d1a338..0aa5ac159c09 100644 --- a/fs/ext2/xip.c +++ b/fs/ext2/xip.c | |||
@@ -15,66 +15,79 @@ | |||
15 | #include "xip.h" | 15 | #include "xip.h" |
16 | 16 | ||
17 | static inline int | 17 | static inline int |
18 | __inode_direct_access(struct inode *inode, sector_t sector, unsigned long *data) { | 18 | __inode_direct_access(struct inode *inode, sector_t sector, |
19 | unsigned long *data) | ||
20 | { | ||
19 | BUG_ON(!inode->i_sb->s_bdev->bd_disk->fops->direct_access); | 21 | BUG_ON(!inode->i_sb->s_bdev->bd_disk->fops->direct_access); |
20 | return inode->i_sb->s_bdev->bd_disk->fops | 22 | return inode->i_sb->s_bdev->bd_disk->fops |
21 | ->direct_access(inode->i_sb->s_bdev,sector,data); | 23 | ->direct_access(inode->i_sb->s_bdev,sector,data); |
22 | } | 24 | } |
23 | 25 | ||
26 | static inline int | ||
27 | __ext2_get_sector(struct inode *inode, sector_t offset, int create, | ||
28 | sector_t *result) | ||
29 | { | ||
30 | struct buffer_head tmp; | ||
31 | int rc; | ||
32 | |||
33 | memset(&tmp, 0, sizeof(struct buffer_head)); | ||
34 | rc = ext2_get_block(inode, offset/ (PAGE_SIZE/512), &tmp, | ||
35 | create); | ||
36 | *result = tmp.b_blocknr; | ||
37 | |||
38 | /* did we get a sparse block (hole in the file)? */ | ||
39 | if (!(*result)) { | ||
40 | BUG_ON(create); | ||
41 | rc = -ENODATA; | ||
42 | } | ||
43 | |||
44 | return rc; | ||
45 | } | ||
46 | |||
24 | int | 47 | int |
25 | ext2_clear_xip_target(struct inode *inode, int block) { | 48 | ext2_clear_xip_target(struct inode *inode, int block) |
26 | sector_t sector = block*(PAGE_SIZE/512); | 49 | { |
50 | sector_t sector = block * (PAGE_SIZE/512); | ||
27 | unsigned long data; | 51 | unsigned long data; |
28 | int rc; | 52 | int rc; |
29 | 53 | ||
30 | rc = __inode_direct_access(inode, sector, &data); | 54 | rc = __inode_direct_access(inode, sector, &data); |
31 | if (rc) | 55 | if (!rc) |
32 | return rc; | 56 | clear_page((void*)data); |
33 | clear_page((void*)data); | 57 | return rc; |
34 | return 0; | ||
35 | } | 58 | } |
36 | 59 | ||
37 | void ext2_xip_verify_sb(struct super_block *sb) | 60 | void ext2_xip_verify_sb(struct super_block *sb) |
38 | { | 61 | { |
39 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 62 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
40 | 63 | ||
41 | if ((sbi->s_mount_opt & EXT2_MOUNT_XIP)) { | 64 | if ((sbi->s_mount_opt & EXT2_MOUNT_XIP) && |
42 | if ((sb->s_bdev == NULL) || | 65 | !sb->s_bdev->bd_disk->fops->direct_access) { |
43 | sb->s_bdev->bd_disk == NULL || | 66 | sbi->s_mount_opt &= (~EXT2_MOUNT_XIP); |
44 | sb->s_bdev->bd_disk->fops == NULL || | 67 | ext2_warning(sb, __FUNCTION__, |
45 | sb->s_bdev->bd_disk->fops->direct_access == NULL) { | 68 | "ignoring xip option - not supported by bdev"); |
46 | sbi->s_mount_opt &= (~EXT2_MOUNT_XIP); | ||
47 | ext2_warning(sb, __FUNCTION__, | ||
48 | "ignoring xip option - not supported by bdev"); | ||
49 | } | ||
50 | } | 69 | } |
51 | } | 70 | } |
52 | 71 | ||
53 | struct page* | 72 | struct page * |
54 | ext2_get_xip_page(struct address_space *mapping, sector_t blockno, | 73 | ext2_get_xip_page(struct address_space *mapping, sector_t offset, |
55 | int create) | 74 | int create) |
56 | { | 75 | { |
57 | int rc; | 76 | int rc; |
58 | unsigned long data; | 77 | unsigned long data; |
59 | struct buffer_head tmp; | 78 | sector_t sector; |
60 | 79 | ||
61 | tmp.b_state = 0; | 80 | /* first, retrieve the sector number */ |
62 | tmp.b_blocknr = 0; | 81 | rc = __ext2_get_sector(mapping->host, offset, create, §or); |
63 | rc = ext2_get_block(mapping->host, blockno/(PAGE_SIZE/512) , &tmp, | ||
64 | create); | ||
65 | if (rc) | 82 | if (rc) |
66 | return ERR_PTR(rc); | 83 | goto error; |
67 | if (tmp.b_blocknr == 0) { | ||
68 | /* SPARSE block */ | ||
69 | BUG_ON(create); | ||
70 | return ERR_PTR(-ENODATA); | ||
71 | } | ||
72 | 84 | ||
85 | /* retrieve address of the target data */ | ||
73 | rc = __inode_direct_access | 86 | rc = __inode_direct_access |
74 | (mapping->host,tmp.b_blocknr*(PAGE_SIZE/512) ,&data); | 87 | (mapping->host, sector * (PAGE_SIZE/512), &data); |
75 | if (rc) | 88 | if (!rc) |
76 | return ERR_PTR(rc); | 89 | return virt_to_page(data); |
77 | 90 | ||
78 | SetPageUptodate(virt_to_page(data)); | 91 | error: |
79 | return virt_to_page(data); | 92 | return ERR_PTR(rc); |
80 | } | 93 | } |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 4bf43ea87c46..88e68caa3784 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
16 | #include <linux/blkdev.h> | 16 | #include <linux/blkdev.h> |
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | #include <linux/root_dev.h> | ||
19 | #include <linux/statfs.h> | 18 | #include <linux/statfs.h> |
20 | #include <linux/kdev_t.h> | 19 | #include <linux/kdev_t.h> |
21 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
@@ -160,8 +159,6 @@ static int read_name(struct inode *ino, char *name) | |||
160 | ino->i_size = i_size; | 159 | ino->i_size = i_size; |
161 | ino->i_blksize = i_blksize; | 160 | ino->i_blksize = i_blksize; |
162 | ino->i_blocks = i_blocks; | 161 | ino->i_blocks = i_blocks; |
163 | if((ino->i_sb->s_dev == ROOT_DEV) && (ino->i_uid == getuid())) | ||
164 | ino->i_uid = 0; | ||
165 | return(0); | 162 | return(0); |
166 | } | 163 | } |
167 | 164 | ||
@@ -841,16 +838,10 @@ int hostfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
841 | attrs.ia_mode = attr->ia_mode; | 838 | attrs.ia_mode = attr->ia_mode; |
842 | } | 839 | } |
843 | if(attr->ia_valid & ATTR_UID){ | 840 | if(attr->ia_valid & ATTR_UID){ |
844 | if((dentry->d_inode->i_sb->s_dev == ROOT_DEV) && | ||
845 | (attr->ia_uid == 0)) | ||
846 | attr->ia_uid = getuid(); | ||
847 | attrs.ia_valid |= HOSTFS_ATTR_UID; | 841 | attrs.ia_valid |= HOSTFS_ATTR_UID; |
848 | attrs.ia_uid = attr->ia_uid; | 842 | attrs.ia_uid = attr->ia_uid; |
849 | } | 843 | } |
850 | if(attr->ia_valid & ATTR_GID){ | 844 | if(attr->ia_valid & ATTR_GID){ |
851 | if((dentry->d_inode->i_sb->s_dev == ROOT_DEV) && | ||
852 | (attr->ia_gid == 0)) | ||
853 | attr->ia_gid = getgid(); | ||
854 | attrs.ia_valid |= HOSTFS_ATTR_GID; | 845 | attrs.ia_valid |= HOSTFS_ATTR_GID; |
855 | attrs.ia_gid = attr->ia_gid; | 846 | attrs.ia_gid = attr->ia_gid; |
856 | } | 847 | } |
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c index 6f553e17c375..ff150fedb981 100644 --- a/fs/hppfs/hppfs_kern.c +++ b/fs/hppfs/hppfs_kern.c | |||
@@ -233,7 +233,7 @@ static ssize_t read_proc(struct file *file, char *buf, ssize_t count, | |||
233 | set_fs(USER_DS); | 233 | set_fs(USER_DS); |
234 | 234 | ||
235 | if(ppos) *ppos = file->f_pos; | 235 | if(ppos) *ppos = file->f_pos; |
236 | return(n); | 236 | return n; |
237 | } | 237 | } |
238 | 238 | ||
239 | static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count) | 239 | static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count) |
@@ -254,7 +254,7 @@ static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count) | |||
254 | err = os_read_file(fd, new_buf, cur); | 254 | err = os_read_file(fd, new_buf, cur); |
255 | if(err < 0){ | 255 | if(err < 0){ |
256 | printk("hppfs_read : read failed, errno = %d\n", | 256 | printk("hppfs_read : read failed, errno = %d\n", |
257 | count); | 257 | err); |
258 | n = err; | 258 | n = err; |
259 | goto out_free; | 259 | goto out_free; |
260 | } | 260 | } |
@@ -271,7 +271,7 @@ static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count) | |||
271 | out_free: | 271 | out_free: |
272 | kfree(new_buf); | 272 | kfree(new_buf); |
273 | out: | 273 | out: |
274 | return(n); | 274 | return n; |
275 | } | 275 | } |
276 | 276 | ||
277 | static ssize_t hppfs_read(struct file *file, char *buf, size_t count, | 277 | static ssize_t hppfs_read(struct file *file, char *buf, size_t count, |