aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/hypfs
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 /arch/s390/hypfs
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/s390/hypfs')
-rw-r--r--arch/s390/hypfs/hypfs.h3
-rw-r--r--arch/s390/hypfs/hypfs_dbfs.c2
-rw-r--r--arch/s390/hypfs/hypfs_diag.c4
-rw-r--r--arch/s390/hypfs/hypfs_vm.c2
-rw-r--r--arch/s390/hypfs/inode.c52
5 files changed, 32 insertions, 31 deletions
diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h
index f41e0ef7fdf..d9df5a060a8 100644
--- a/arch/s390/hypfs/hypfs.h
+++ b/arch/s390/hypfs/hypfs.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * arch/s390/hypfs/hypfs.h
2 * Hypervisor filesystem for Linux on s390. 3 * Hypervisor filesystem for Linux on s390.
3 * 4 *
4 * Copyright IBM Corp. 2006 5 * Copyright (C) IBM Corp. 2006
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com> 6 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */ 7 */
7 8
diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c
index 13e76dabbe8..b478013b7fe 100644
--- a/arch/s390/hypfs/hypfs_dbfs.c
+++ b/arch/s390/hypfs/hypfs_dbfs.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Hypervisor filesystem for Linux on s390 - debugfs interface 2 * Hypervisor filesystem for Linux on s390 - debugfs interface
3 * 3 *
4 * Copyright IBM Corp. 2010 4 * Copyright (C) IBM Corp. 2010
5 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com> 5 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
6 */ 6 */
7 7
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 7fd3690b676..6023c6dc1fb 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * arch/s390/hypfs/hypfs_diag.c
2 * Hypervisor filesystem for Linux on s390. Diag 204 and 224 3 * Hypervisor filesystem for Linux on s390. Diag 204 and 224
3 * implementation. 4 * implementation.
4 * 5 *
@@ -561,9 +562,10 @@ static int dbfs_d204_create(void **data, void **data_free_ptr, size_t *size)
561 void *base; 562 void *base;
562 563
563 buf_size = PAGE_SIZE * (diag204_buf_pages + 1) + sizeof(d204->hdr); 564 buf_size = PAGE_SIZE * (diag204_buf_pages + 1) + sizeof(d204->hdr);
564 base = vzalloc(buf_size); 565 base = vmalloc(buf_size);
565 if (!base) 566 if (!base)
566 return -ENOMEM; 567 return -ENOMEM;
568 memset(base, 0, buf_size);
567 d204 = page_align_ptr(base + sizeof(d204->hdr)) - sizeof(d204->hdr); 569 d204 = page_align_ptr(base + sizeof(d204->hdr)) - sizeof(d204->hdr);
568 rc = diag204_do_store(d204->buf, diag204_buf_pages); 570 rc = diag204_do_store(d204->buf, diag204_buf_pages);
569 if (rc) { 571 if (rc) {
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
index 4f6afaa8bd8..e54796002f6 100644
--- a/arch/s390/hypfs/hypfs_vm.c
+++ b/arch/s390/hypfs/hypfs_vm.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Hypervisor filesystem for Linux on s390. z/VM implementation. 2 * Hypervisor filesystem for Linux on s390. z/VM implementation.
3 * 3 *
4 * Copyright IBM Corp. 2006 4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com> 5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */ 6 */
7 7
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 06ea69bd387..6fe874fc5f8 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * arch/s390/hypfs/inode.c
2 * Hypervisor filesystem for Linux on s390. 3 * Hypervisor filesystem for Linux on s390.
3 * 4 *
4 * Copyright IBM Corp. 2006, 2008 5 * Copyright IBM Corp. 2006, 2008
@@ -31,8 +32,8 @@ static struct dentry *hypfs_create_update_file(struct super_block *sb,
31 struct dentry *dir); 32 struct dentry *dir);
32 33
33struct hypfs_sb_info { 34struct hypfs_sb_info {
34 kuid_t uid; /* uid used for files and dirs */ 35 uid_t uid; /* uid used for files and dirs */
35 kgid_t gid; /* gid used for files and dirs */ 36 gid_t gid; /* gid used for files and dirs */
36 struct dentry *update_file; /* file to trigger update */ 37 struct dentry *update_file; /* file to trigger update */
37 time_t last_update; /* last update time in secs since 1970 */ 38 time_t last_update; /* last update time in secs since 1970 */
38 struct mutex lock; /* lock to protect update process */ 39 struct mutex lock; /* lock to protect update process */
@@ -72,6 +73,8 @@ static void hypfs_remove(struct dentry *dentry)
72 struct dentry *parent; 73 struct dentry *parent;
73 74
74 parent = dentry->d_parent; 75 parent = dentry->d_parent;
76 if (!parent || !parent->d_inode)
77 return;
75 mutex_lock(&parent->d_inode->i_mutex); 78 mutex_lock(&parent->d_inode->i_mutex);
76 if (hypfs_positive(dentry)) { 79 if (hypfs_positive(dentry)) {
77 if (S_ISDIR(dentry->d_inode->i_mode)) 80 if (S_ISDIR(dentry->d_inode->i_mode))
@@ -94,26 +97,27 @@ static void hypfs_delete_tree(struct dentry *root)
94 } 97 }
95} 98}
96 99
97static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode) 100static struct inode *hypfs_make_inode(struct super_block *sb, int mode)
98{ 101{
99 struct inode *ret = new_inode(sb); 102 struct inode *ret = new_inode(sb);
100 103
101 if (ret) { 104 if (ret) {
102 struct hypfs_sb_info *hypfs_info = sb->s_fs_info; 105 struct hypfs_sb_info *hypfs_info = sb->s_fs_info;
103 ret->i_ino = get_next_ino();
104 ret->i_mode = mode; 106 ret->i_mode = mode;
105 ret->i_uid = hypfs_info->uid; 107 ret->i_uid = hypfs_info->uid;
106 ret->i_gid = hypfs_info->gid; 108 ret->i_gid = hypfs_info->gid;
107 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; 109 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
108 if (S_ISDIR(mode)) 110 if (mode & S_IFDIR)
109 set_nlink(ret, 2); 111 ret->i_nlink = 2;
112 else
113 ret->i_nlink = 1;
110 } 114 }
111 return ret; 115 return ret;
112} 116}
113 117
114static void hypfs_evict_inode(struct inode *inode) 118static void hypfs_evict_inode(struct inode *inode)
115{ 119{
116 clear_inode(inode); 120 end_writeback(inode);
117 kfree(inode->i_private); 121 kfree(inode->i_private);
118} 122}
119 123
@@ -227,8 +231,6 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
227{ 231{
228 char *str; 232 char *str;
229 substring_t args[MAX_OPT_ARGS]; 233 substring_t args[MAX_OPT_ARGS];
230 kuid_t uid;
231 kgid_t gid;
232 234
233 if (!options) 235 if (!options)
234 return 0; 236 return 0;
@@ -243,18 +245,12 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
243 case opt_uid: 245 case opt_uid:
244 if (match_int(&args[0], &option)) 246 if (match_int(&args[0], &option))
245 return -EINVAL; 247 return -EINVAL;
246 uid = make_kuid(current_user_ns(), option); 248 hypfs_info->uid = option;
247 if (!uid_valid(uid))
248 return -EINVAL;
249 hypfs_info->uid = uid;
250 break; 249 break;
251 case opt_gid: 250 case opt_gid:
252 if (match_int(&args[0], &option)) 251 if (match_int(&args[0], &option))
253 return -EINVAL; 252 return -EINVAL;
254 gid = make_kgid(current_user_ns(), option); 253 hypfs_info->gid = option;
255 if (!gid_valid(gid))
256 return -EINVAL;
257 hypfs_info->gid = gid;
258 break; 254 break;
259 case opt_err: 255 case opt_err:
260 default: 256 default:
@@ -265,12 +261,12 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
265 return 0; 261 return 0;
266} 262}
267 263
268static int hypfs_show_options(struct seq_file *s, struct dentry *root) 264static int hypfs_show_options(struct seq_file *s, struct vfsmount *mnt)
269{ 265{
270 struct hypfs_sb_info *hypfs_info = root->d_sb->s_fs_info; 266 struct hypfs_sb_info *hypfs_info = mnt->mnt_sb->s_fs_info;
271 267
272 seq_printf(s, ",uid=%u", from_kuid_munged(&init_user_ns, hypfs_info->uid)); 268 seq_printf(s, ",uid=%u", hypfs_info->uid);
273 seq_printf(s, ",gid=%u", from_kgid_munged(&init_user_ns, hypfs_info->gid)); 269 seq_printf(s, ",gid=%u", hypfs_info->gid);
274 return 0; 270 return 0;
275} 271}
276 272
@@ -299,9 +295,11 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
299 return -ENOMEM; 295 return -ENOMEM;
300 root_inode->i_op = &simple_dir_inode_operations; 296 root_inode->i_op = &simple_dir_inode_operations;
301 root_inode->i_fop = &simple_dir_operations; 297 root_inode->i_fop = &simple_dir_operations;
302 sb->s_root = root_dentry = d_make_root(root_inode); 298 sb->s_root = root_dentry = d_alloc_root(root_inode);
303 if (!root_dentry) 299 if (!root_dentry) {
300 iput(root_inode);
304 return -ENOMEM; 301 return -ENOMEM;
302 }
305 if (MACHINE_IS_VM) 303 if (MACHINE_IS_VM)
306 rc = hypfs_vm_create_files(sb, root_dentry); 304 rc = hypfs_vm_create_files(sb, root_dentry);
307 else 305 else
@@ -337,7 +335,7 @@ static void hypfs_kill_super(struct super_block *sb)
337 335
338static struct dentry *hypfs_create_file(struct super_block *sb, 336static struct dentry *hypfs_create_file(struct super_block *sb,
339 struct dentry *parent, const char *name, 337 struct dentry *parent, const char *name,
340 char *data, umode_t mode) 338 char *data, mode_t mode)
341{ 339{
342 struct dentry *dentry; 340 struct dentry *dentry;
343 struct inode *inode; 341 struct inode *inode;
@@ -354,16 +352,16 @@ static struct dentry *hypfs_create_file(struct super_block *sb,
354 dentry = ERR_PTR(-ENOMEM); 352 dentry = ERR_PTR(-ENOMEM);
355 goto fail; 353 goto fail;
356 } 354 }
357 if (S_ISREG(mode)) { 355 if (mode & S_IFREG) {
358 inode->i_fop = &hypfs_file_ops; 356 inode->i_fop = &hypfs_file_ops;
359 if (data) 357 if (data)
360 inode->i_size = strlen(data); 358 inode->i_size = strlen(data);
361 else 359 else
362 inode->i_size = 0; 360 inode->i_size = 0;
363 } else if (S_ISDIR(mode)) { 361 } else if (mode & S_IFDIR) {
364 inode->i_op = &simple_dir_inode_operations; 362 inode->i_op = &simple_dir_inode_operations;
365 inode->i_fop = &simple_dir_operations; 363 inode->i_fop = &simple_dir_operations;
366 inc_nlink(parent->d_inode); 364 parent->d_inode->i_nlink++;
367 } else 365 } else
368 BUG(); 366 BUG();
369 inode->i_private = data; 367 inode->i_private = data;