diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/hpfs/dir.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'fs/hpfs/dir.c')
-rw-r--r-- | fs/hpfs/dir.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 2338130cceba..f46ae025bfb5 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -6,16 +6,15 @@ | |||
6 | * directory VFS functions | 6 | * directory VFS functions |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | ||
10 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
11 | #include "hpfs_fn.h" | 10 | #include "hpfs_fn.h" |
12 | 11 | ||
13 | static int hpfs_dir_release(struct inode *inode, struct file *filp) | 12 | static int hpfs_dir_release(struct inode *inode, struct file *filp) |
14 | { | 13 | { |
15 | lock_kernel(); | 14 | hpfs_lock(inode->i_sb); |
16 | hpfs_del_pos(inode, &filp->f_pos); | 15 | hpfs_del_pos(inode, &filp->f_pos); |
17 | /*hpfs_write_if_changed(inode);*/ | 16 | /*hpfs_write_if_changed(inode);*/ |
18 | unlock_kernel(); | 17 | hpfs_unlock(inode->i_sb); |
19 | return 0; | 18 | return 0; |
20 | } | 19 | } |
21 | 20 | ||
@@ -30,7 +29,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) | |||
30 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); | 29 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); |
31 | struct super_block *s = i->i_sb; | 30 | struct super_block *s = i->i_sb; |
32 | 31 | ||
33 | lock_kernel(); | 32 | hpfs_lock(s); |
34 | 33 | ||
35 | /*printk("dir lseek\n");*/ | 34 | /*printk("dir lseek\n");*/ |
36 | if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok; | 35 | if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok; |
@@ -43,12 +42,12 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) | |||
43 | } | 42 | } |
44 | mutex_unlock(&i->i_mutex); | 43 | mutex_unlock(&i->i_mutex); |
45 | ok: | 44 | ok: |
46 | unlock_kernel(); | 45 | hpfs_unlock(s); |
47 | return filp->f_pos = new_off; | 46 | return filp->f_pos = new_off; |
48 | fail: | 47 | fail: |
49 | mutex_unlock(&i->i_mutex); | 48 | mutex_unlock(&i->i_mutex); |
50 | /*printk("illegal lseek: %016llx\n", new_off);*/ | 49 | /*printk("illegal lseek: %016llx\n", new_off);*/ |
51 | unlock_kernel(); | 50 | hpfs_unlock(s); |
52 | return -ESPIPE; | 51 | return -ESPIPE; |
53 | } | 52 | } |
54 | 53 | ||
@@ -64,7 +63,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
64 | int c1, c2 = 0; | 63 | int c1, c2 = 0; |
65 | int ret = 0; | 64 | int ret = 0; |
66 | 65 | ||
67 | lock_kernel(); | 66 | hpfs_lock(inode->i_sb); |
68 | 67 | ||
69 | if (hpfs_sb(inode->i_sb)->sb_chk) { | 68 | if (hpfs_sb(inode->i_sb)->sb_chk) { |
70 | if (hpfs_chk_sectors(inode->i_sb, inode->i_ino, 1, "dir_fnode")) { | 69 | if (hpfs_chk_sectors(inode->i_sb, inode->i_ino, 1, "dir_fnode")) { |
@@ -89,9 +88,9 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
89 | hpfs_error(inode->i_sb, "not a directory, fnode %08lx", | 88 | hpfs_error(inode->i_sb, "not a directory, fnode %08lx", |
90 | (unsigned long)inode->i_ino); | 89 | (unsigned long)inode->i_ino); |
91 | } | 90 | } |
92 | if (hpfs_inode->i_dno != fno->u.external[0].disk_secno) { | 91 | if (hpfs_inode->i_dno != le32_to_cpu(fno->u.external[0].disk_secno)) { |
93 | e = 1; | 92 | e = 1; |
94 | hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, fno->u.external[0].disk_secno); | 93 | hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, le32_to_cpu(fno->u.external[0].disk_secno)); |
95 | } | 94 | } |
96 | brelse(bh); | 95 | brelse(bh); |
97 | if (e) { | 96 | if (e) { |
@@ -157,7 +156,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
157 | goto again; | 156 | goto again; |
158 | } | 157 | } |
159 | tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3); | 158 | tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3); |
160 | if (filldir(dirent, tempname, de->namelen, old_pos, de->fnode, DT_UNKNOWN) < 0) { | 159 | if (filldir(dirent, tempname, de->namelen, old_pos, le32_to_cpu(de->fnode), DT_UNKNOWN) < 0) { |
161 | filp->f_pos = old_pos; | 160 | filp->f_pos = old_pos; |
162 | if (tempname != de->name) kfree(tempname); | 161 | if (tempname != de->name) kfree(tempname); |
163 | hpfs_brelse4(&qbh); | 162 | hpfs_brelse4(&qbh); |
@@ -167,7 +166,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
167 | hpfs_brelse4(&qbh); | 166 | hpfs_brelse4(&qbh); |
168 | } | 167 | } |
169 | out: | 168 | out: |
170 | unlock_kernel(); | 169 | hpfs_unlock(inode->i_sb); |
171 | return ret; | 170 | return ret; |
172 | } | 171 | } |
173 | 172 | ||
@@ -197,10 +196,10 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
197 | struct inode *result = NULL; | 196 | struct inode *result = NULL; |
198 | struct hpfs_inode_info *hpfs_result; | 197 | struct hpfs_inode_info *hpfs_result; |
199 | 198 | ||
200 | lock_kernel(); | 199 | hpfs_lock(dir->i_sb); |
201 | if ((err = hpfs_chk_name(name, &len))) { | 200 | if ((err = hpfs_chk_name(name, &len))) { |
202 | if (err == -ENAMETOOLONG) { | 201 | if (err == -ENAMETOOLONG) { |
203 | unlock_kernel(); | 202 | hpfs_unlock(dir->i_sb); |
204 | return ERR_PTR(-ENAMETOOLONG); | 203 | return ERR_PTR(-ENAMETOOLONG); |
205 | } | 204 | } |
206 | goto end_add; | 205 | goto end_add; |
@@ -222,7 +221,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
222 | * Get inode number, what we're after. | 221 | * Get inode number, what we're after. |
223 | */ | 222 | */ |
224 | 223 | ||
225 | ino = de->fnode; | 224 | ino = le32_to_cpu(de->fnode); |
226 | 225 | ||
227 | /* | 226 | /* |
228 | * Go find or make an inode. | 227 | * Go find or make an inode. |
@@ -237,7 +236,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
237 | hpfs_init_inode(result); | 236 | hpfs_init_inode(result); |
238 | if (de->directory) | 237 | if (de->directory) |
239 | hpfs_read_inode(result); | 238 | hpfs_read_inode(result); |
240 | else if (de->ea_size && hpfs_sb(dir->i_sb)->sb_eas) | 239 | else if (le32_to_cpu(de->ea_size) && hpfs_sb(dir->i_sb)->sb_eas) |
241 | hpfs_read_inode(result); | 240 | hpfs_read_inode(result); |
242 | else { | 241 | else { |
243 | result->i_mode |= S_IFREG; | 242 | result->i_mode |= S_IFREG; |
@@ -251,8 +250,6 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
251 | hpfs_result = hpfs_i(result); | 250 | hpfs_result = hpfs_i(result); |
252 | if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; | 251 | if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; |
253 | 252 | ||
254 | hpfs_decide_conv(result, name, len); | ||
255 | |||
256 | if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) { | 253 | if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) { |
257 | hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures"); | 254 | hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures"); |
258 | goto bail1; | 255 | goto bail1; |
@@ -264,19 +261,19 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
264 | */ | 261 | */ |
265 | 262 | ||
266 | if (!result->i_ctime.tv_sec) { | 263 | if (!result->i_ctime.tv_sec) { |
267 | if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, de->creation_date))) | 264 | if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date)))) |
268 | result->i_ctime.tv_sec = 1; | 265 | result->i_ctime.tv_sec = 1; |
269 | result->i_ctime.tv_nsec = 0; | 266 | result->i_ctime.tv_nsec = 0; |
270 | result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, de->write_date); | 267 | result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date)); |
271 | result->i_mtime.tv_nsec = 0; | 268 | result->i_mtime.tv_nsec = 0; |
272 | result->i_atime.tv_sec = local_to_gmt(dir->i_sb, de->read_date); | 269 | result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date)); |
273 | result->i_atime.tv_nsec = 0; | 270 | result->i_atime.tv_nsec = 0; |
274 | hpfs_result->i_ea_size = de->ea_size; | 271 | hpfs_result->i_ea_size = le32_to_cpu(de->ea_size); |
275 | if (!hpfs_result->i_ea_mode && de->read_only) | 272 | if (!hpfs_result->i_ea_mode && de->read_only) |
276 | result->i_mode &= ~0222; | 273 | result->i_mode &= ~0222; |
277 | if (!de->directory) { | 274 | if (!de->directory) { |
278 | if (result->i_size == -1) { | 275 | if (result->i_size == -1) { |
279 | result->i_size = de->file_size; | 276 | result->i_size = le32_to_cpu(de->file_size); |
280 | result->i_data.a_ops = &hpfs_aops; | 277 | result->i_data.a_ops = &hpfs_aops; |
281 | hpfs_i(result)->mmu_private = result->i_size; | 278 | hpfs_i(result)->mmu_private = result->i_size; |
282 | /* | 279 | /* |
@@ -298,8 +295,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
298 | 295 | ||
299 | end: | 296 | end: |
300 | end_add: | 297 | end_add: |
301 | hpfs_set_dentry_operations(dentry); | 298 | hpfs_unlock(dir->i_sb); |
302 | unlock_kernel(); | ||
303 | d_add(dentry, result); | 299 | d_add(dentry, result); |
304 | return NULL; | 300 | return NULL; |
305 | 301 | ||
@@ -312,7 +308,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
312 | 308 | ||
313 | /*bail:*/ | 309 | /*bail:*/ |
314 | 310 | ||
315 | unlock_kernel(); | 311 | hpfs_unlock(dir->i_sb); |
316 | return ERR_PTR(-ENOENT); | 312 | return ERR_PTR(-ENOENT); |
317 | } | 313 | } |
318 | 314 | ||