Commit b42d570c authored by Al Viro's avatar Al Viro

afs: get rid of junk in fs/afs/proc.c

kill pointless method instances and don't bother with ->owner - it's
ignored for procfs files anyway, make use of remove_proc_subtree() for
removal, get rid of cell->proc_dir.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 479e64c2
...@@ -195,7 +195,6 @@ struct afs_cell { ...@@ -195,7 +195,6 @@ struct afs_cell {
struct list_head link; /* main cell list link */ struct list_head link; /* main cell list link */
struct key *anonymous_key; /* anonymous user key for this cell */ struct key *anonymous_key; /* anonymous user key for this cell */
struct list_head proc_link; /* /proc cell list link */ struct list_head proc_link; /* /proc cell list link */
struct proc_dir_entry *proc_dir; /* /proc dir for this cell */
#ifdef CONFIG_AFS_FSCACHE #ifdef CONFIG_AFS_FSCACHE
struct fscache_cookie *cache; /* caching cookie */ struct fscache_cookie *cache; /* caching cookie */
#endif #endif
......
...@@ -41,11 +41,8 @@ static const struct file_operations afs_proc_cells_fops = { ...@@ -41,11 +41,8 @@ static const struct file_operations afs_proc_cells_fops = {
.write = afs_proc_cells_write, .write = afs_proc_cells_write,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = seq_release, .release = seq_release,
.owner = THIS_MODULE,
}; };
static int afs_proc_rootcell_open(struct inode *inode, struct file *file);
static int afs_proc_rootcell_release(struct inode *inode, struct file *file);
static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
size_t size, loff_t *_pos); size_t size, loff_t *_pos);
static ssize_t afs_proc_rootcell_write(struct file *file, static ssize_t afs_proc_rootcell_write(struct file *file,
...@@ -53,17 +50,12 @@ static ssize_t afs_proc_rootcell_write(struct file *file, ...@@ -53,17 +50,12 @@ static ssize_t afs_proc_rootcell_write(struct file *file,
size_t size, loff_t *_pos); size_t size, loff_t *_pos);
static const struct file_operations afs_proc_rootcell_fops = { static const struct file_operations afs_proc_rootcell_fops = {
.open = afs_proc_rootcell_open,
.read = afs_proc_rootcell_read, .read = afs_proc_rootcell_read,
.write = afs_proc_rootcell_write, .write = afs_proc_rootcell_write,
.llseek = no_llseek, .llseek = no_llseek,
.release = afs_proc_rootcell_release,
.owner = THIS_MODULE,
}; };
static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file); static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file);
static int afs_proc_cell_volumes_release(struct inode *inode,
struct file *file);
static void *afs_proc_cell_volumes_start(struct seq_file *p, loff_t *pos); static void *afs_proc_cell_volumes_start(struct seq_file *p, loff_t *pos);
static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v,
loff_t *pos); loff_t *pos);
...@@ -81,14 +73,11 @@ static const struct file_operations afs_proc_cell_volumes_fops = { ...@@ -81,14 +73,11 @@ static const struct file_operations afs_proc_cell_volumes_fops = {
.open = afs_proc_cell_volumes_open, .open = afs_proc_cell_volumes_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = afs_proc_cell_volumes_release, .release = seq_release,
.owner = THIS_MODULE,
}; };
static int afs_proc_cell_vlservers_open(struct inode *inode, static int afs_proc_cell_vlservers_open(struct inode *inode,
struct file *file); struct file *file);
static int afs_proc_cell_vlservers_release(struct inode *inode,
struct file *file);
static void *afs_proc_cell_vlservers_start(struct seq_file *p, loff_t *pos); static void *afs_proc_cell_vlservers_start(struct seq_file *p, loff_t *pos);
static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v, static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v,
loff_t *pos); loff_t *pos);
...@@ -106,13 +95,10 @@ static const struct file_operations afs_proc_cell_vlservers_fops = { ...@@ -106,13 +95,10 @@ static const struct file_operations afs_proc_cell_vlservers_fops = {
.open = afs_proc_cell_vlservers_open, .open = afs_proc_cell_vlservers_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = afs_proc_cell_vlservers_release, .release = seq_release,
.owner = THIS_MODULE,
}; };
static int afs_proc_cell_servers_open(struct inode *inode, struct file *file); static int afs_proc_cell_servers_open(struct inode *inode, struct file *file);
static int afs_proc_cell_servers_release(struct inode *inode,
struct file *file);
static void *afs_proc_cell_servers_start(struct seq_file *p, loff_t *pos); static void *afs_proc_cell_servers_start(struct seq_file *p, loff_t *pos);
static void *afs_proc_cell_servers_next(struct seq_file *p, void *v, static void *afs_proc_cell_servers_next(struct seq_file *p, void *v,
loff_t *pos); loff_t *pos);
...@@ -130,8 +116,7 @@ static const struct file_operations afs_proc_cell_servers_fops = { ...@@ -130,8 +116,7 @@ static const struct file_operations afs_proc_cell_servers_fops = {
.open = afs_proc_cell_servers_open, .open = afs_proc_cell_servers_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = afs_proc_cell_servers_release, .release = seq_release,
.owner = THIS_MODULE,
}; };
/* /*
...@@ -139,29 +124,21 @@ static const struct file_operations afs_proc_cell_servers_fops = { ...@@ -139,29 +124,21 @@ static const struct file_operations afs_proc_cell_servers_fops = {
*/ */
int afs_proc_init(void) int afs_proc_init(void)
{ {
struct proc_dir_entry *p;
_enter(""); _enter("");
proc_afs = proc_mkdir("fs/afs", NULL); proc_afs = proc_mkdir("fs/afs", NULL);
if (!proc_afs) if (!proc_afs)
goto error_dir; goto error_dir;
p = proc_create("cells", 0, proc_afs, &afs_proc_cells_fops); if (!proc_create("cells", 0, proc_afs, &afs_proc_cells_fops) ||
if (!p) !proc_create("rootcell", 0, proc_afs, &afs_proc_rootcell_fops))
goto error_cells; goto error_tree;
p = proc_create("rootcell", 0, proc_afs, &afs_proc_rootcell_fops);
if (!p)
goto error_rootcell;
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
error_rootcell: error_tree:
remove_proc_entry("cells", proc_afs); remove_proc_subtree("fs/afs", NULL);
error_cells:
remove_proc_entry("fs/afs", NULL);
error_dir: error_dir:
_leave(" = -ENOMEM"); _leave(" = -ENOMEM");
return -ENOMEM; return -ENOMEM;
...@@ -172,9 +149,7 @@ int afs_proc_init(void) ...@@ -172,9 +149,7 @@ int afs_proc_init(void)
*/ */
void afs_proc_cleanup(void) void afs_proc_cleanup(void)
{ {
remove_proc_entry("rootcell", proc_afs); remove_proc_subtree("fs/afs", NULL);
remove_proc_entry("cells", proc_afs);
remove_proc_entry("fs/afs", NULL);
} }
/* /*
...@@ -319,19 +294,6 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf, ...@@ -319,19 +294,6 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
goto done; goto done;
} }
/*
* Stubs for /proc/fs/afs/rootcell
*/
static int afs_proc_rootcell_open(struct inode *inode, struct file *file)
{
return 0;
}
static int afs_proc_rootcell_release(struct inode *inode, struct file *file)
{
return 0;
}
static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
size_t size, loff_t *_pos) size_t size, loff_t *_pos)
{ {
...@@ -387,38 +349,27 @@ static ssize_t afs_proc_rootcell_write(struct file *file, ...@@ -387,38 +349,27 @@ static ssize_t afs_proc_rootcell_write(struct file *file,
*/ */
int afs_proc_cell_setup(struct afs_cell *cell) int afs_proc_cell_setup(struct afs_cell *cell)
{ {
struct proc_dir_entry *p; struct proc_dir_entry *dir;
_enter("%p{%s}", cell, cell->name); _enter("%p{%s}", cell, cell->name);
cell->proc_dir = proc_mkdir(cell->name, proc_afs); dir = proc_mkdir(cell->name, proc_afs);
if (!cell->proc_dir) if (!dir)
goto error_dir; goto error_dir;
p = proc_create_data("servers", 0, cell->proc_dir, if (!proc_create_data("servers", 0, dir,
&afs_proc_cell_servers_fops, cell); &afs_proc_cell_servers_fops, cell) ||
if (!p) !proc_create_data("vlservers", 0, dir,
goto error_servers; &afs_proc_cell_vlservers_fops, cell) ||
!proc_create_data("volumes", 0, dir,
p = proc_create_data("vlservers", 0, cell->proc_dir, &afs_proc_cell_volumes_fops, cell))
&afs_proc_cell_vlservers_fops, cell); goto error_tree;
if (!p)
goto error_vlservers;
p = proc_create_data("volumes", 0, cell->proc_dir,
&afs_proc_cell_volumes_fops, cell);
if (!p)
goto error_volumes;
_leave(" = 0"); _leave(" = 0");
return 0; return 0;
error_volumes: error_tree:
remove_proc_entry("vlservers", cell->proc_dir); remove_proc_subtree(cell->name, proc_afs);
error_vlservers:
remove_proc_entry("servers", cell->proc_dir);
error_servers:
remove_proc_entry(cell->name, proc_afs);
error_dir: error_dir:
_leave(" = -ENOMEM"); _leave(" = -ENOMEM");
return -ENOMEM; return -ENOMEM;
...@@ -431,10 +382,7 @@ void afs_proc_cell_remove(struct afs_cell *cell) ...@@ -431,10 +382,7 @@ void afs_proc_cell_remove(struct afs_cell *cell)
{ {
_enter(""); _enter("");
remove_proc_entry("volumes", cell->proc_dir); remove_proc_subtree(cell->name, proc_afs);
remove_proc_entry("vlservers", cell->proc_dir);
remove_proc_entry("servers", cell->proc_dir);
remove_proc_entry(cell->name, proc_afs);
_leave(""); _leave("");
} }
...@@ -462,14 +410,6 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file) ...@@ -462,14 +410,6 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file)
return 0; return 0;
} }
/*
* close the file and release the ref to the cell
*/
static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file)
{
return seq_release(inode, file);
}
/* /*
* set up the iterator to start reading from the cells list and return the * set up the iterator to start reading from the cells list and return the
* first item * first item
...@@ -568,15 +508,6 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file) ...@@ -568,15 +508,6 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file)
return 0; return 0;
} }
/*
* close the file and release the ref to the cell
*/
static int afs_proc_cell_vlservers_release(struct inode *inode,
struct file *file)
{
return seq_release(inode, file);
}
/* /*
* set up the iterator to start reading from the cells list and return the * set up the iterator to start reading from the cells list and return the
* first item * first item
...@@ -672,15 +603,6 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file) ...@@ -672,15 +603,6 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file)
return 0; return 0;
} }
/*
* close the file and release the ref to the cell
*/
static int afs_proc_cell_servers_release(struct inode *inode,
struct file *file)
{
return seq_release(inode, file);
}
/* /*
* set up the iterator to start reading from the cells list and return the * set up the iterator to start reading from the cells list and return the
* first item * first item
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment