aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-07-19 10:05:21 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-09-03 22:52:49 -0400
commita118cfdf993a67a95d9a68452bc10b0604de7177 (patch)
treed1d443aca7be45e5d4cb65190972d99c37ad4a47 /arch/s390
parente334cf4fe8913a8940fc93fd38cef793877b6c79 (diff)
don't pass superblock to hypfs_{mkdir,create*}
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/hypfs/hypfs.h9
-rw-r--r--arch/s390/hypfs/hypfs_diag.c28
-rw-r--r--arch/s390/hypfs/hypfs_vm.c20
-rw-r--r--arch/s390/hypfs/inode.c28
4 files changed, 39 insertions, 46 deletions
diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h
index 6fd0c7e992c8..79f2ac55253f 100644
--- a/arch/s390/hypfs/hypfs.h
+++ b/arch/s390/hypfs/hypfs.h
@@ -18,15 +18,12 @@
18#define UPDATE_FILE_MODE 0220 18#define UPDATE_FILE_MODE 0220
19#define DIR_MODE 0550 19#define DIR_MODE 0550
20 20
21extern struct dentry *hypfs_mkdir(struct super_block *sb, struct dentry *parent, 21extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name);
22 const char *name);
23 22
24extern struct dentry *hypfs_create_u64(struct super_block *sb, 23extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name,
25 struct dentry *dir, const char *name,
26 __u64 value); 24 __u64 value);
27 25
28extern struct dentry *hypfs_create_str(struct super_block *sb, 26extern struct dentry *hypfs_create_str(struct dentry *dir, const char *name,
29 struct dentry *dir, const char *name,
30 char *string); 27 char *string);
31 28
32/* LPAR Hypervisor */ 29/* LPAR Hypervisor */
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 42bb152512e6..5eeffeefae06 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -631,25 +631,25 @@ static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)
631 631
632 snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_info_type, 632 snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_info_type,
633 cpu_info)); 633 cpu_info));
634 cpu_dir = hypfs_mkdir(cpus_dir->d_sb, cpus_dir, buffer); 634 cpu_dir = hypfs_mkdir(cpus_dir, buffer);
635 rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "mgmtime", 635 rc = hypfs_create_u64(cpu_dir, "mgmtime",
636 cpu_info__acc_time(diag204_info_type, cpu_info) - 636 cpu_info__acc_time(diag204_info_type, cpu_info) -
637 cpu_info__lp_time(diag204_info_type, cpu_info)); 637 cpu_info__lp_time(diag204_info_type, cpu_info));
638 if (IS_ERR(rc)) 638 if (IS_ERR(rc))
639 return PTR_ERR(rc); 639 return PTR_ERR(rc);
640 rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "cputime", 640 rc = hypfs_create_u64(cpu_dir, "cputime",
641 cpu_info__lp_time(diag204_info_type, cpu_info)); 641 cpu_info__lp_time(diag204_info_type, cpu_info));
642 if (IS_ERR(rc)) 642 if (IS_ERR(rc))
643 return PTR_ERR(rc); 643 return PTR_ERR(rc);
644 if (diag204_info_type == INFO_EXT) { 644 if (diag204_info_type == INFO_EXT) {
645 rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "onlinetime", 645 rc = hypfs_create_u64(cpu_dir, "onlinetime",
646 cpu_info__online_time(diag204_info_type, 646 cpu_info__online_time(diag204_info_type,
647 cpu_info)); 647 cpu_info));
648 if (IS_ERR(rc)) 648 if (IS_ERR(rc))
649 return PTR_ERR(rc); 649 return PTR_ERR(rc);
650 } 650 }
651 diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer); 651 diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer);
652 rc = hypfs_create_str(cpu_dir->d_sb, cpu_dir, "type", buffer); 652 rc = hypfs_create_str(cpu_dir, "type", buffer);
653 return PTR_RET(rc); 653 return PTR_RET(rc);
654} 654}
655 655
@@ -663,10 +663,10 @@ static void *hypfs_create_lpar_files(struct dentry *systems_dir, void *part_hdr)
663 663
664 part_hdr__part_name(diag204_info_type, part_hdr, lpar_name); 664 part_hdr__part_name(diag204_info_type, part_hdr, lpar_name);
665 lpar_name[LPAR_NAME_LEN] = 0; 665 lpar_name[LPAR_NAME_LEN] = 0;
666 lpar_dir = hypfs_mkdir(systems_dir->d_sb, systems_dir, lpar_name); 666 lpar_dir = hypfs_mkdir(systems_dir, lpar_name);
667 if (IS_ERR(lpar_dir)) 667 if (IS_ERR(lpar_dir))
668 return lpar_dir; 668 return lpar_dir;
669 cpus_dir = hypfs_mkdir(lpar_dir->d_sb, lpar_dir, "cpus"); 669 cpus_dir = hypfs_mkdir(lpar_dir, "cpus");
670 if (IS_ERR(cpus_dir)) 670 if (IS_ERR(cpus_dir))
671 return cpus_dir; 671 return cpus_dir;
672 cpu_info = part_hdr + part_hdr__size(diag204_info_type); 672 cpu_info = part_hdr + part_hdr__size(diag204_info_type);
@@ -688,15 +688,15 @@ static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info)
688 688
689 snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_info_type, 689 snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_info_type,
690 cpu_info)); 690 cpu_info));
691 cpu_dir = hypfs_mkdir(cpus_dir->d_sb, cpus_dir, buffer); 691 cpu_dir = hypfs_mkdir(cpus_dir, buffer);
692 if (IS_ERR(cpu_dir)) 692 if (IS_ERR(cpu_dir))
693 return PTR_ERR(cpu_dir); 693 return PTR_ERR(cpu_dir);
694 rc = hypfs_create_u64(cpu_dir->d_sb, cpu_dir, "mgmtime", 694 rc = hypfs_create_u64(cpu_dir, "mgmtime",
695 phys_cpu__mgm_time(diag204_info_type, cpu_info)); 695 phys_cpu__mgm_time(diag204_info_type, cpu_info));
696 if (IS_ERR(rc)) 696 if (IS_ERR(rc))
697 return PTR_ERR(rc); 697 return PTR_ERR(rc);
698 diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer); 698 diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer);
699 rc = hypfs_create_str(cpu_dir->d_sb, cpu_dir, "type", buffer); 699 rc = hypfs_create_str(cpu_dir, "type", buffer);
700 return PTR_RET(rc); 700 return PTR_RET(rc);
701} 701}
702 702
@@ -706,7 +706,7 @@ static void *hypfs_create_phys_files(struct dentry *parent_dir, void *phys_hdr)
706 void *cpu_info; 706 void *cpu_info;
707 struct dentry *cpus_dir; 707 struct dentry *cpus_dir;
708 708
709 cpus_dir = hypfs_mkdir(parent_dir->d_sb, parent_dir, "cpus"); 709 cpus_dir = hypfs_mkdir(parent_dir, "cpus");
710 if (IS_ERR(cpus_dir)) 710 if (IS_ERR(cpus_dir))
711 return cpus_dir; 711 return cpus_dir;
712 cpu_info = phys_hdr + phys_hdr__size(diag204_info_type); 712 cpu_info = phys_hdr + phys_hdr__size(diag204_info_type);
@@ -731,7 +731,7 @@ int hypfs_diag_create_files(struct dentry *root)
731 if (IS_ERR(buffer)) 731 if (IS_ERR(buffer))
732 return PTR_ERR(buffer); 732 return PTR_ERR(buffer);
733 733
734 systems_dir = hypfs_mkdir(root->d_sb, root, "systems"); 734 systems_dir = hypfs_mkdir(root, "systems");
735 if (IS_ERR(systems_dir)) { 735 if (IS_ERR(systems_dir)) {
736 rc = PTR_ERR(systems_dir); 736 rc = PTR_ERR(systems_dir);
737 goto err_out; 737 goto err_out;
@@ -752,12 +752,12 @@ int hypfs_diag_create_files(struct dentry *root)
752 goto err_out; 752 goto err_out;
753 } 753 }
754 } 754 }
755 hyp_dir = hypfs_mkdir(root->d_sb, root, "hyp"); 755 hyp_dir = hypfs_mkdir(root, "hyp");
756 if (IS_ERR(hyp_dir)) { 756 if (IS_ERR(hyp_dir)) {
757 rc = PTR_ERR(hyp_dir); 757 rc = PTR_ERR(hyp_dir);
758 goto err_out; 758 goto err_out;
759 } 759 }
760 ptr = hypfs_create_str(root->d_sb, hyp_dir, "type", "LPAR Hypervisor"); 760 ptr = hypfs_create_str(hyp_dir, "type", "LPAR Hypervisor");
761 if (IS_ERR(ptr)) { 761 if (IS_ERR(ptr)) {
762 rc = PTR_ERR(ptr); 762 rc = PTR_ERR(ptr);
763 goto err_out; 763 goto err_out;
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
index a7c5b57663e5..24908ce149f1 100644
--- a/arch/s390/hypfs/hypfs_vm.c
+++ b/arch/s390/hypfs/hypfs_vm.c
@@ -110,7 +110,7 @@ static void diag2fc_free(const void *data)
110#define ATTRIBUTE(dir, name, member) \ 110#define ATTRIBUTE(dir, name, member) \
111do { \ 111do { \
112 void *rc; \ 112 void *rc; \
113 rc = hypfs_create_u64(dir->d_sb, dir, name, member); \ 113 rc = hypfs_create_u64(dir, name, member); \
114 if (IS_ERR(rc)) \ 114 if (IS_ERR(rc)) \
115 return PTR_ERR(rc); \ 115 return PTR_ERR(rc); \
116} while(0) 116} while(0)
@@ -129,13 +129,13 @@ static int hpyfs_vm_create_guest(struct dentry *systems_dir,
129 memcpy(guest_name, data->guest_name, NAME_LEN); 129 memcpy(guest_name, data->guest_name, NAME_LEN);
130 EBCASC(guest_name, NAME_LEN); 130 EBCASC(guest_name, NAME_LEN);
131 strim(guest_name); 131 strim(guest_name);
132 guest_dir = hypfs_mkdir(systems_dir->d_sb, systems_dir, guest_name); 132 guest_dir = hypfs_mkdir(systems_dir, guest_name);
133 if (IS_ERR(guest_dir)) 133 if (IS_ERR(guest_dir))
134 return PTR_ERR(guest_dir); 134 return PTR_ERR(guest_dir);
135 ATTRIBUTE(guest_dir, "onlinetime_us", data->el_time); 135 ATTRIBUTE(guest_dir, "onlinetime_us", data->el_time);
136 136
137 /* logical cpu information */ 137 /* logical cpu information */
138 cpus_dir = hypfs_mkdir(guest_dir->d_sb, guest_dir, "cpus"); 138 cpus_dir = hypfs_mkdir(guest_dir, "cpus");
139 if (IS_ERR(cpus_dir)) 139 if (IS_ERR(cpus_dir))
140 return PTR_ERR(cpus_dir); 140 return PTR_ERR(cpus_dir);
141 ATTRIBUTE(cpus_dir, "cputime_us", data->used_cpu); 141 ATTRIBUTE(cpus_dir, "cputime_us", data->used_cpu);
@@ -147,7 +147,7 @@ static int hpyfs_vm_create_guest(struct dentry *systems_dir,
147 ATTRIBUTE(cpus_dir, "weight_cur", data->cpu_shares); 147 ATTRIBUTE(cpus_dir, "weight_cur", data->cpu_shares);
148 148
149 /* memory information */ 149 /* memory information */
150 mem_dir = hypfs_mkdir(guest_dir->d_sb, guest_dir, "mem"); 150 mem_dir = hypfs_mkdir(guest_dir, "mem");
151 if (IS_ERR(mem_dir)) 151 if (IS_ERR(mem_dir))
152 return PTR_ERR(mem_dir); 152 return PTR_ERR(mem_dir);
153 ATTRIBUTE(mem_dir, "min_KiB", data->mem_min_kb); 153 ATTRIBUTE(mem_dir, "min_KiB", data->mem_min_kb);
@@ -156,7 +156,7 @@ static int hpyfs_vm_create_guest(struct dentry *systems_dir,
156 ATTRIBUTE(mem_dir, "share_KiB", data->mem_share_kb); 156 ATTRIBUTE(mem_dir, "share_KiB", data->mem_share_kb);
157 157
158 /* samples */ 158 /* samples */
159 samples_dir = hypfs_mkdir(guest_dir->d_sb, guest_dir, "samples"); 159 samples_dir = hypfs_mkdir(guest_dir, "samples");
160 if (IS_ERR(samples_dir)) 160 if (IS_ERR(samples_dir))
161 return PTR_ERR(samples_dir); 161 return PTR_ERR(samples_dir);
162 ATTRIBUTE(samples_dir, "cpu_using", data->cpu_use_samp); 162 ATTRIBUTE(samples_dir, "cpu_using", data->cpu_use_samp);
@@ -180,31 +180,31 @@ int hypfs_vm_create_files(struct dentry *root)
180 return PTR_ERR(data); 180 return PTR_ERR(data);
181 181
182 /* Hpervisor Info */ 182 /* Hpervisor Info */
183 dir = hypfs_mkdir(root->d_sb, root, "hyp"); 183 dir = hypfs_mkdir(root, "hyp");
184 if (IS_ERR(dir)) { 184 if (IS_ERR(dir)) {
185 rc = PTR_ERR(dir); 185 rc = PTR_ERR(dir);
186 goto failed; 186 goto failed;
187 } 187 }
188 file = hypfs_create_str(root->d_sb, dir, "type", "z/VM Hypervisor"); 188 file = hypfs_create_str(dir, "type", "z/VM Hypervisor");
189 if (IS_ERR(file)) { 189 if (IS_ERR(file)) {
190 rc = PTR_ERR(file); 190 rc = PTR_ERR(file);
191 goto failed; 191 goto failed;
192 } 192 }
193 193
194 /* physical cpus */ 194 /* physical cpus */
195 dir = hypfs_mkdir(root->d_sb, root, "cpus"); 195 dir = hypfs_mkdir(root, "cpus");
196 if (IS_ERR(dir)) { 196 if (IS_ERR(dir)) {
197 rc = PTR_ERR(dir); 197 rc = PTR_ERR(dir);
198 goto failed; 198 goto failed;
199 } 199 }
200 file = hypfs_create_u64(root->d_sb, dir, "count", data->lcpus); 200 file = hypfs_create_u64(dir, "count", data->lcpus);
201 if (IS_ERR(file)) { 201 if (IS_ERR(file)) {
202 rc = PTR_ERR(file); 202 rc = PTR_ERR(file);
203 goto failed; 203 goto failed;
204 } 204 }
205 205
206 /* guests */ 206 /* guests */
207 dir = hypfs_mkdir(root->d_sb, root, "systems"); 207 dir = hypfs_mkdir(root, "systems");
208 if (IS_ERR(dir)) { 208 if (IS_ERR(dir)) {
209 rc = PTR_ERR(dir); 209 rc = PTR_ERR(dir);
210 goto failed; 210 goto failed;
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index aa5de3f54ce3..ddfe09b45134 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -28,8 +28,7 @@
28#define HYPFS_MAGIC 0x687970 /* ASCII 'hyp' */ 28#define HYPFS_MAGIC 0x687970 /* ASCII 'hyp' */
29#define TMP_SIZE 64 /* size of temporary buffers */ 29#define TMP_SIZE 64 /* size of temporary buffers */
30 30
31static struct dentry *hypfs_create_update_file(struct super_block *sb, 31static struct dentry *hypfs_create_update_file(struct dentry *dir);
32 struct dentry *dir);
33 32
34struct hypfs_sb_info { 33struct hypfs_sb_info {
35 kuid_t uid; /* uid used for files and dirs */ 34 kuid_t uid; /* uid used for files and dirs */
@@ -307,7 +306,7 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
307 rc = hypfs_diag_create_files(root_dentry); 306 rc = hypfs_diag_create_files(root_dentry);
308 if (rc) 307 if (rc)
309 return rc; 308 return rc;
310 sbi->update_file = hypfs_create_update_file(sb, root_dentry); 309 sbi->update_file = hypfs_create_update_file(root_dentry);
311 if (IS_ERR(sbi->update_file)) 310 if (IS_ERR(sbi->update_file))
312 return PTR_ERR(sbi->update_file); 311 return PTR_ERR(sbi->update_file);
313 hypfs_update_update(sb); 312 hypfs_update_update(sb);
@@ -334,8 +333,7 @@ static void hypfs_kill_super(struct super_block *sb)
334 kill_litter_super(sb); 333 kill_litter_super(sb);
335} 334}
336 335
337static struct dentry *hypfs_create_file(struct super_block *sb, 336static struct dentry *hypfs_create_file(struct dentry *parent, const char *name,
338 struct dentry *parent, const char *name,
339 char *data, umode_t mode) 337 char *data, umode_t mode)
340{ 338{
341 struct dentry *dentry; 339 struct dentry *dentry;
@@ -347,7 +345,7 @@ static struct dentry *hypfs_create_file(struct super_block *sb,
347 dentry = ERR_PTR(-ENOMEM); 345 dentry = ERR_PTR(-ENOMEM);
348 goto fail; 346 goto fail;
349 } 347 }
350 inode = hypfs_make_inode(sb, mode); 348 inode = hypfs_make_inode(parent->d_sb, mode);
351 if (!inode) { 349 if (!inode) {
352 dput(dentry); 350 dput(dentry);
353 dentry = ERR_PTR(-ENOMEM); 351 dentry = ERR_PTR(-ENOMEM);
@@ -373,24 +371,22 @@ fail:
373 return dentry; 371 return dentry;
374} 372}
375 373
376struct dentry *hypfs_mkdir(struct super_block *sb, struct dentry *parent, 374struct dentry *hypfs_mkdir(struct dentry *parent, const char *name)
377 const char *name)
378{ 375{
379 struct dentry *dentry; 376 struct dentry *dentry;
380 377
381 dentry = hypfs_create_file(sb, parent, name, NULL, S_IFDIR | DIR_MODE); 378 dentry = hypfs_create_file(parent, name, NULL, S_IFDIR | DIR_MODE);
382 if (IS_ERR(dentry)) 379 if (IS_ERR(dentry))
383 return dentry; 380 return dentry;
384 hypfs_add_dentry(dentry); 381 hypfs_add_dentry(dentry);
385 return dentry; 382 return dentry;
386} 383}
387 384
388static struct dentry *hypfs_create_update_file(struct super_block *sb, 385static struct dentry *hypfs_create_update_file(struct dentry *dir)
389 struct dentry *dir)
390{ 386{
391 struct dentry *dentry; 387 struct dentry *dentry;
392 388
393 dentry = hypfs_create_file(sb, dir, "update", NULL, 389 dentry = hypfs_create_file(dir, "update", NULL,
394 S_IFREG | UPDATE_FILE_MODE); 390 S_IFREG | UPDATE_FILE_MODE);
395 /* 391 /*
396 * We do not put the update file on the 'delete' list with 392 * We do not put the update file on the 'delete' list with
@@ -400,7 +396,7 @@ static struct dentry *hypfs_create_update_file(struct super_block *sb,
400 return dentry; 396 return dentry;
401} 397}
402 398
403struct dentry *hypfs_create_u64(struct super_block *sb, struct dentry *dir, 399struct dentry *hypfs_create_u64(struct dentry *dir,
404 const char *name, __u64 value) 400 const char *name, __u64 value)
405{ 401{
406 char *buffer; 402 char *buffer;
@@ -412,7 +408,7 @@ struct dentry *hypfs_create_u64(struct super_block *sb, struct dentry *dir,
412 if (!buffer) 408 if (!buffer)
413 return ERR_PTR(-ENOMEM); 409 return ERR_PTR(-ENOMEM);
414 dentry = 410 dentry =
415 hypfs_create_file(sb, dir, name, buffer, S_IFREG | REG_FILE_MODE); 411 hypfs_create_file(dir, name, buffer, S_IFREG | REG_FILE_MODE);
416 if (IS_ERR(dentry)) { 412 if (IS_ERR(dentry)) {
417 kfree(buffer); 413 kfree(buffer);
418 return ERR_PTR(-ENOMEM); 414 return ERR_PTR(-ENOMEM);
@@ -421,7 +417,7 @@ struct dentry *hypfs_create_u64(struct super_block *sb, struct dentry *dir,
421 return dentry; 417 return dentry;
422} 418}
423 419
424struct dentry *hypfs_create_str(struct super_block *sb, struct dentry *dir, 420struct dentry *hypfs_create_str(struct dentry *dir,
425 const char *name, char *string) 421 const char *name, char *string)
426{ 422{
427 char *buffer; 423 char *buffer;
@@ -432,7 +428,7 @@ struct dentry *hypfs_create_str(struct super_block *sb, struct dentry *dir,
432 return ERR_PTR(-ENOMEM); 428 return ERR_PTR(-ENOMEM);
433 sprintf(buffer, "%s\n", string); 429 sprintf(buffer, "%s\n", string);
434 dentry = 430 dentry =
435 hypfs_create_file(sb, dir, name, buffer, S_IFREG | REG_FILE_MODE); 431 hypfs_create_file(dir, name, buffer, S_IFREG | REG_FILE_MODE);
436 if (IS_ERR(dentry)) { 432 if (IS_ERR(dentry)) {
437 kfree(buffer); 433 kfree(buffer);
438 return ERR_PTR(-ENOMEM); 434 return ERR_PTR(-ENOMEM);