aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/inode.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/hpfs/inode.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'fs/hpfs/inode.c')
-rw-r--r--fs/hpfs/inode.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c
index 5dc06c83710..338cd836845 100644
--- a/fs/hpfs/inode.c
+++ b/fs/hpfs/inode.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/user_namespace.h>
11#include "hpfs_fn.h" 10#include "hpfs_fn.h"
12 11
13void hpfs_init_inode(struct inode *i) 12void hpfs_init_inode(struct inode *i)
@@ -54,21 +53,21 @@ void hpfs_read_inode(struct inode *i)
54 i->i_mode &= ~0111; 53 i->i_mode &= ~0111;
55 i->i_op = &hpfs_file_iops; 54 i->i_op = &hpfs_file_iops;
56 i->i_fop = &hpfs_file_ops; 55 i->i_fop = &hpfs_file_ops;
57 clear_nlink(i);*/ 56 i->i_nlink = 0;*/
58 make_bad_inode(i); 57 make_bad_inode(i);
59 return; 58 return;
60 } 59 }
61 if (hpfs_sb(i->i_sb)->sb_eas) { 60 if (hpfs_sb(i->i_sb)->sb_eas) {
62 if ((ea = hpfs_get_ea(i->i_sb, fnode, "UID", &ea_size))) { 61 if ((ea = hpfs_get_ea(i->i_sb, fnode, "UID", &ea_size))) {
63 if (ea_size == 2) { 62 if (ea_size == 2) {
64 i_uid_write(i, le16_to_cpu(*(__le16*)ea)); 63 i->i_uid = le16_to_cpu(*(__le16*)ea);
65 hpfs_inode->i_ea_uid = 1; 64 hpfs_inode->i_ea_uid = 1;
66 } 65 }
67 kfree(ea); 66 kfree(ea);
68 } 67 }
69 if ((ea = hpfs_get_ea(i->i_sb, fnode, "GID", &ea_size))) { 68 if ((ea = hpfs_get_ea(i->i_sb, fnode, "GID", &ea_size))) {
70 if (ea_size == 2) { 69 if (ea_size == 2) {
71 i_gid_write(i, le16_to_cpu(*(__le16*)ea)); 70 i->i_gid = le16_to_cpu(*(__le16*)ea);
72 hpfs_inode->i_ea_gid = 1; 71 hpfs_inode->i_ea_gid = 1;
73 } 72 }
74 kfree(ea); 73 kfree(ea);
@@ -78,7 +77,7 @@ void hpfs_read_inode(struct inode *i)
78 i->i_mode = S_IFLNK | 0777; 77 i->i_mode = S_IFLNK | 0777;
79 i->i_op = &page_symlink_inode_operations; 78 i->i_op = &page_symlink_inode_operations;
80 i->i_data.a_ops = &hpfs_symlink_aops; 79 i->i_data.a_ops = &hpfs_symlink_aops;
81 set_nlink(i, 1); 80 i->i_nlink = 1;
82 i->i_size = ea_size; 81 i->i_size = ea_size;
83 i->i_blocks = 1; 82 i->i_blocks = 1;
84 brelse(bh); 83 brelse(bh);
@@ -102,7 +101,7 @@ void hpfs_read_inode(struct inode *i)
102 } 101 }
103 if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) { 102 if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
104 brelse(bh); 103 brelse(bh);
105 set_nlink(i, 1); 104 i->i_nlink = 1;
106 i->i_size = 0; 105 i->i_size = 0;
107 i->i_blocks = 1; 106 i->i_blocks = 1;
108 init_special_inode(i, mode, 107 init_special_inode(i, mode,
@@ -111,7 +110,7 @@ void hpfs_read_inode(struct inode *i)
111 } 110 }
112 } 111 }
113 } 112 }
114 if (fnode_is_dir(fnode)) { 113 if (fnode->dirflag) {
115 int n_dnodes, n_subdirs; 114 int n_dnodes, n_subdirs;
116 i->i_mode |= S_IFDIR; 115 i->i_mode |= S_IFDIR;
117 i->i_op = &hpfs_dir_iops; 116 i->i_op = &hpfs_dir_iops;
@@ -126,13 +125,13 @@ void hpfs_read_inode(struct inode *i)
126 hpfs_count_dnodes(i->i_sb, hpfs_inode->i_dno, &n_dnodes, &n_subdirs, NULL); 125 hpfs_count_dnodes(i->i_sb, hpfs_inode->i_dno, &n_dnodes, &n_subdirs, NULL);
127 i->i_blocks = 4 * n_dnodes; 126 i->i_blocks = 4 * n_dnodes;
128 i->i_size = 2048 * n_dnodes; 127 i->i_size = 2048 * n_dnodes;
129 set_nlink(i, 2 + n_subdirs); 128 i->i_nlink = 2 + n_subdirs;
130 } else { 129 } else {
131 i->i_mode |= S_IFREG; 130 i->i_mode |= S_IFREG;
132 if (!hpfs_inode->i_ea_mode) i->i_mode &= ~0111; 131 if (!hpfs_inode->i_ea_mode) i->i_mode &= ~0111;
133 i->i_op = &hpfs_file_iops; 132 i->i_op = &hpfs_file_iops;
134 i->i_fop = &hpfs_file_ops; 133 i->i_fop = &hpfs_file_ops;
135 set_nlink(i, 1); 134 i->i_nlink = 1;
136 i->i_size = le32_to_cpu(fnode->file_size); 135 i->i_size = le32_to_cpu(fnode->file_size);
137 i->i_blocks = ((i->i_size + 511) >> 9) + 1; 136 i->i_blocks = ((i->i_size + 511) >> 9) + 1;
138 i->i_data.a_ops = &hpfs_aops; 137 i->i_data.a_ops = &hpfs_aops;
@@ -150,13 +149,13 @@ static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode)
150 hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 stuctures", i->i_ino); 149 hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 stuctures", i->i_ino);
151 } else*/ if (hpfs_sb(i->i_sb)->sb_eas >= 2) { 150 } else*/ if (hpfs_sb(i->i_sb)->sb_eas >= 2) {
152 __le32 ea; 151 __le32 ea;
153 if (!uid_eq(i->i_uid, hpfs_sb(i->i_sb)->sb_uid) || hpfs_inode->i_ea_uid) { 152 if ((i->i_uid != hpfs_sb(i->i_sb)->sb_uid) || hpfs_inode->i_ea_uid) {
154 ea = cpu_to_le32(i_uid_read(i)); 153 ea = cpu_to_le32(i->i_uid);
155 hpfs_set_ea(i, fnode, "UID", (char*)&ea, 2); 154 hpfs_set_ea(i, fnode, "UID", (char*)&ea, 2);
156 hpfs_inode->i_ea_uid = 1; 155 hpfs_inode->i_ea_uid = 1;
157 } 156 }
158 if (!gid_eq(i->i_gid, hpfs_sb(i->i_sb)->sb_gid) || hpfs_inode->i_ea_gid) { 157 if ((i->i_gid != hpfs_sb(i->i_sb)->sb_gid) || hpfs_inode->i_ea_gid) {
159 ea = cpu_to_le32(i_gid_read(i)); 158 ea = cpu_to_le32(i->i_gid);
160 hpfs_set_ea(i, fnode, "GID", (char *)&ea, 2); 159 hpfs_set_ea(i, fnode, "GID", (char *)&ea, 2);
161 hpfs_inode->i_ea_gid = 1; 160 hpfs_inode->i_ea_gid = 1;
162 } 161 }
@@ -262,11 +261,9 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
262 hpfs_lock(inode->i_sb); 261 hpfs_lock(inode->i_sb);
263 if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root) 262 if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root)
264 goto out_unlock; 263 goto out_unlock;
265 if ((attr->ia_valid & ATTR_UID) && 264 if ((attr->ia_valid & ATTR_UID) && attr->ia_uid >= 0x10000)
266 from_kuid(&init_user_ns, attr->ia_uid) >= 0x10000)
267 goto out_unlock; 265 goto out_unlock;
268 if ((attr->ia_valid & ATTR_GID) && 266 if ((attr->ia_valid & ATTR_GID) && attr->ia_gid >= 0x10000)
269 from_kgid(&init_user_ns, attr->ia_gid) >= 0x10000)
270 goto out_unlock; 267 goto out_unlock;
271 if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) 268 if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size)
272 goto out_unlock; 269 goto out_unlock;
@@ -277,12 +274,9 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
277 274
278 if ((attr->ia_valid & ATTR_SIZE) && 275 if ((attr->ia_valid & ATTR_SIZE) &&
279 attr->ia_size != i_size_read(inode)) { 276 attr->ia_size != i_size_read(inode)) {
280 error = inode_newsize_ok(inode, attr->ia_size); 277 error = vmtruncate(inode, attr->ia_size);
281 if (error) 278 if (error)
282 goto out_unlock; 279 goto out_unlock;
283
284 truncate_setsize(inode, attr->ia_size);
285 hpfs_truncate(inode);
286 } 280 }
287 281
288 setattr_copy(inode, attr); 282 setattr_copy(inode, attr);
@@ -305,7 +299,7 @@ void hpfs_write_if_changed(struct inode *inode)
305void hpfs_evict_inode(struct inode *inode) 299void hpfs_evict_inode(struct inode *inode)
306{ 300{
307 truncate_inode_pages(&inode->i_data, 0); 301 truncate_inode_pages(&inode->i_data, 0);
308 clear_inode(inode); 302 end_writeback(inode);
309 if (!inode->i_nlink) { 303 if (!inode->i_nlink) {
310 hpfs_lock(inode->i_sb); 304 hpfs_lock(inode->i_sb);
311 hpfs_remove_fnode(inode->i_sb, inode->i_ino); 305 hpfs_remove_fnode(inode->i_sb, inode->i_ino);