diff options
author | David Howells <dhowells@redhat.com> | 2018-05-18 06:46:14 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-05-18 06:46:14 -0400 |
commit | 10495a0071516df40953574925df74be2a00cd89 (patch) | |
tree | 2f81c0c3d688485dc4730c6de50a9db55b8fbd35 /fs/afs | |
parent | 96362fb474bad694812c18cbc9943fe0f7e2ce31 (diff) |
afs: Move /proc management functions to the end of the file
In fs/afs/proc.c, move functions that create and remove /proc files to the
end of the source file as a first stage in getting rid of all the forward
declarations.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs')
-rw-r--r-- | fs/afs/proc.c | 160 |
1 files changed, 79 insertions, 81 deletions
diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 3aad32762989..4bb612b04f3c 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c | |||
@@ -127,45 +127,6 @@ static const struct file_operations afs_proc_sysname_fops = { | |||
127 | .write = afs_proc_sysname_write, | 127 | .write = afs_proc_sysname_write, |
128 | }; | 128 | }; |
129 | 129 | ||
130 | static int afs_proc_stats_show(struct seq_file *m, void *v); | ||
131 | |||
132 | /* | ||
133 | * initialise the /proc/fs/afs/ directory | ||
134 | */ | ||
135 | int afs_proc_init(struct afs_net *net) | ||
136 | { | ||
137 | _enter(""); | ||
138 | |||
139 | net->proc_afs = proc_mkdir("fs/afs", NULL); | ||
140 | if (!net->proc_afs) | ||
141 | goto error_dir; | ||
142 | |||
143 | if (!proc_create("cells", 0644, net->proc_afs, &afs_proc_cells_fops) || | ||
144 | !proc_create("rootcell", 0644, net->proc_afs, &afs_proc_rootcell_fops) || | ||
145 | !proc_create_seq("servers", 0644, net->proc_afs, &afs_proc_servers_ops) || | ||
146 | !proc_create_single("stats", 0644, net->proc_afs, afs_proc_stats_show) || | ||
147 | !proc_create("sysname", 0644, net->proc_afs, &afs_proc_sysname_fops)) | ||
148 | goto error_tree; | ||
149 | |||
150 | _leave(" = 0"); | ||
151 | return 0; | ||
152 | |||
153 | error_tree: | ||
154 | proc_remove(net->proc_afs); | ||
155 | error_dir: | ||
156 | _leave(" = -ENOMEM"); | ||
157 | return -ENOMEM; | ||
158 | } | ||
159 | |||
160 | /* | ||
161 | * clean up the /proc/fs/afs/ directory | ||
162 | */ | ||
163 | void afs_proc_cleanup(struct afs_net *net) | ||
164 | { | ||
165 | proc_remove(net->proc_afs); | ||
166 | net->proc_afs = NULL; | ||
167 | } | ||
168 | |||
169 | /* | 130 | /* |
170 | * open "/proc/fs/afs/cells" which provides a summary of extant cells | 131 | * open "/proc/fs/afs/cells" which provides a summary of extant cells |
171 | */ | 132 | */ |
@@ -384,48 +345,6 @@ out: | |||
384 | } | 345 | } |
385 | 346 | ||
386 | /* | 347 | /* |
387 | * initialise /proc/fs/afs/<cell>/ | ||
388 | */ | ||
389 | int afs_proc_cell_setup(struct afs_net *net, struct afs_cell *cell) | ||
390 | { | ||
391 | struct proc_dir_entry *dir; | ||
392 | |||
393 | _enter("%p{%s},%p", cell, cell->name, net->proc_afs); | ||
394 | |||
395 | dir = proc_mkdir(cell->name, net->proc_afs); | ||
396 | if (!dir) | ||
397 | goto error_dir; | ||
398 | |||
399 | if (!proc_create_seq_data("vlservers", 0, dir, | ||
400 | &afs_proc_cell_vlservers_ops, cell)) | ||
401 | goto error_tree; | ||
402 | if (!proc_create_seq_data("volumes", 0, dir, &afs_proc_cell_volumes_ops, | ||
403 | cell)) | ||
404 | goto error_tree; | ||
405 | |||
406 | _leave(" = 0"); | ||
407 | return 0; | ||
408 | |||
409 | error_tree: | ||
410 | remove_proc_subtree(cell->name, net->proc_afs); | ||
411 | error_dir: | ||
412 | _leave(" = -ENOMEM"); | ||
413 | return -ENOMEM; | ||
414 | } | ||
415 | |||
416 | /* | ||
417 | * remove /proc/fs/afs/<cell>/ | ||
418 | */ | ||
419 | void afs_proc_cell_remove(struct afs_net *net, struct afs_cell *cell) | ||
420 | { | ||
421 | _enter(""); | ||
422 | |||
423 | remove_proc_subtree(cell->name, net->proc_afs); | ||
424 | |||
425 | _leave(""); | ||
426 | } | ||
427 | |||
428 | /* | ||
429 | * set up the iterator to start reading from the cells list and return the | 348 | * set up the iterator to start reading from the cells list and return the |
430 | * first item | 349 | * first item |
431 | */ | 350 | */ |
@@ -842,3 +761,82 @@ static int afs_proc_stats_show(struct seq_file *m, void *v) | |||
842 | atomic_long_read(&net->n_store_bytes)); | 761 | atomic_long_read(&net->n_store_bytes)); |
843 | return 0; | 762 | return 0; |
844 | } | 763 | } |
764 | |||
765 | /* | ||
766 | * initialise /proc/fs/afs/<cell>/ | ||
767 | */ | ||
768 | int afs_proc_cell_setup(struct afs_net *net, struct afs_cell *cell) | ||
769 | { | ||
770 | struct proc_dir_entry *dir; | ||
771 | |||
772 | _enter("%p{%s},%p", cell, cell->name, net->proc_afs); | ||
773 | |||
774 | dir = proc_mkdir(cell->name, net->proc_afs); | ||
775 | if (!dir) | ||
776 | goto error_dir; | ||
777 | |||
778 | if (!proc_create_seq_data("vlservers", 0, dir, | ||
779 | &afs_proc_cell_vlservers_ops, cell)) | ||
780 | goto error_tree; | ||
781 | if (!proc_create_seq_data("volumes", 0, dir, | ||
782 | &afs_proc_cell_volumes_ops, cell)) | ||
783 | goto error_tree; | ||
784 | |||
785 | _leave(" = 0"); | ||
786 | return 0; | ||
787 | |||
788 | error_tree: | ||
789 | remove_proc_subtree(cell->name, net->proc_afs); | ||
790 | error_dir: | ||
791 | _leave(" = -ENOMEM"); | ||
792 | return -ENOMEM; | ||
793 | } | ||
794 | |||
795 | /* | ||
796 | * remove /proc/fs/afs/<cell>/ | ||
797 | */ | ||
798 | void afs_proc_cell_remove(struct afs_net *net, struct afs_cell *cell) | ||
799 | { | ||
800 | _enter(""); | ||
801 | |||
802 | remove_proc_subtree(cell->name, net->proc_afs); | ||
803 | |||
804 | _leave(""); | ||
805 | } | ||
806 | |||
807 | /* | ||
808 | * initialise the /proc/fs/afs/ directory | ||
809 | */ | ||
810 | int afs_proc_init(struct afs_net *net) | ||
811 | { | ||
812 | _enter(""); | ||
813 | |||
814 | net->proc_afs = proc_mkdir("fs/afs", NULL); | ||
815 | if (!net->proc_afs) | ||
816 | goto error_dir; | ||
817 | |||
818 | if (!proc_create("cells", 0644, net->proc_afs, &afs_proc_cells_fops) || | ||
819 | !proc_create("rootcell", 0644, net->proc_afs, &afs_proc_rootcell_fops) || | ||
820 | !proc_create_seq("servers", 0644, net->proc_afs, &afs_proc_servers_ops) || | ||
821 | !proc_create_single("stats", 0644, net->proc_afs, afs_proc_stats_show) || | ||
822 | !proc_create("sysname", 0644, net->proc_afs, &afs_proc_sysname_fops)) | ||
823 | goto error_tree; | ||
824 | |||
825 | _leave(" = 0"); | ||
826 | return 0; | ||
827 | |||
828 | error_tree: | ||
829 | proc_remove(net->proc_afs); | ||
830 | error_dir: | ||
831 | _leave(" = -ENOMEM"); | ||
832 | return -ENOMEM; | ||
833 | } | ||
834 | |||
835 | /* | ||
836 | * clean up the /proc/fs/afs/ directory | ||
837 | */ | ||
838 | void afs_proc_cleanup(struct afs_net *net) | ||
839 | { | ||
840 | proc_remove(net->proc_afs); | ||
841 | net->proc_afs = NULL; | ||
842 | } | ||