[AFS]: Clean up the AFS sources
Clean up the AFS sources. Also remove references to AFS keys. RxRPC keys are used instead. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
17926a7932
commit
ec26815ad8
161
fs/afs/proc.c
161
fs/afs/proc.c
@@ -1,4 +1,4 @@
|
||||
/* proc.c: /proc interface for AFS
|
||||
/* /proc interface for AFS
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
@@ -130,7 +130,6 @@ static const struct file_operations afs_proc_cell_servers_fops = {
|
||||
.release = afs_proc_cell_servers_release,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* initialise the /proc/fs/afs/ directory
|
||||
*/
|
||||
@@ -142,47 +141,43 @@ int afs_proc_init(void)
|
||||
|
||||
proc_afs = proc_mkdir("fs/afs", NULL);
|
||||
if (!proc_afs)
|
||||
goto error;
|
||||
goto error_dir;
|
||||
proc_afs->owner = THIS_MODULE;
|
||||
|
||||
p = create_proc_entry("cells", 0, proc_afs);
|
||||
if (!p)
|
||||
goto error_proc;
|
||||
goto error_cells;
|
||||
p->proc_fops = &afs_proc_cells_fops;
|
||||
p->owner = THIS_MODULE;
|
||||
|
||||
p = create_proc_entry("rootcell", 0, proc_afs);
|
||||
if (!p)
|
||||
goto error_cells;
|
||||
goto error_rootcell;
|
||||
p->proc_fops = &afs_proc_rootcell_fops;
|
||||
p->owner = THIS_MODULE;
|
||||
|
||||
_leave(" = 0");
|
||||
return 0;
|
||||
|
||||
error_cells:
|
||||
error_rootcell:
|
||||
remove_proc_entry("cells", proc_afs);
|
||||
error_proc:
|
||||
error_cells:
|
||||
remove_proc_entry("fs/afs", NULL);
|
||||
error:
|
||||
error_dir:
|
||||
_leave(" = -ENOMEM");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
} /* end afs_proc_init() */
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* clean up the /proc/fs/afs/ directory
|
||||
*/
|
||||
void afs_proc_cleanup(void)
|
||||
{
|
||||
remove_proc_entry("rootcell", proc_afs);
|
||||
remove_proc_entry("cells", proc_afs);
|
||||
|
||||
remove_proc_entry("fs/afs", NULL);
|
||||
}
|
||||
|
||||
} /* end afs_proc_cleanup() */
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* open "/proc/fs/afs/cells" which provides a summary of extant cells
|
||||
*/
|
||||
@@ -199,9 +194,8 @@ static int afs_proc_cells_open(struct inode *inode, struct file *file)
|
||||
m->private = PDE(inode)->data;
|
||||
|
||||
return 0;
|
||||
} /* end afs_proc_cells_open() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* set up the iterator to start reading from the cells list and return the
|
||||
* first item
|
||||
@@ -225,9 +219,8 @@ static void *afs_proc_cells_start(struct seq_file *m, loff_t *_pos)
|
||||
break;
|
||||
|
||||
return _p != &afs_proc_cells ? _p : NULL;
|
||||
} /* end afs_proc_cells_start() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* move to next cell in cells list
|
||||
*/
|
||||
@@ -241,19 +234,16 @@ static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos)
|
||||
_p = v == (void *) 1 ? afs_proc_cells.next : _p->next;
|
||||
|
||||
return _p != &afs_proc_cells ? _p : NULL;
|
||||
} /* end afs_proc_cells_next() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* clean up after reading from the cells list
|
||||
*/
|
||||
static void afs_proc_cells_stop(struct seq_file *p, void *v)
|
||||
{
|
||||
up_read(&afs_proc_cells_sem);
|
||||
}
|
||||
|
||||
} /* end afs_proc_cells_stop() */
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* display a header line followed by a load of cell lines
|
||||
*/
|
||||
@@ -261,19 +251,18 @@ static int afs_proc_cells_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link);
|
||||
|
||||
/* display header on line 1 */
|
||||
if (v == (void *) 1) {
|
||||
/* display header on line 1 */
|
||||
seq_puts(m, "USE NAME\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* display one cell per line on subsequent lines */
|
||||
seq_printf(m, "%3d %s\n", atomic_read(&cell->usage), cell->name);
|
||||
|
||||
seq_printf(m, "%3d %s\n",
|
||||
atomic_read(&cell->usage), cell->name);
|
||||
return 0;
|
||||
} /* end afs_proc_cells_show() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* handle writes to /proc/fs/afs/cells
|
||||
* - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]"
|
||||
@@ -331,25 +320,23 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
|
||||
goto done;
|
||||
|
||||
printk("kAFS: Added new cell '%s'\n", name);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
goto inval;
|
||||
}
|
||||
|
||||
ret = size;
|
||||
|
||||
done:
|
||||
done:
|
||||
kfree(kbuf);
|
||||
_leave(" = %d", ret);
|
||||
return ret;
|
||||
|
||||
inval:
|
||||
inval:
|
||||
ret = -EINVAL;
|
||||
printk("kAFS: Invalid Command on /proc/fs/afs/cells file\n");
|
||||
goto done;
|
||||
} /* end afs_proc_cells_write() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* Stubs for /proc/fs/afs/rootcell
|
||||
*/
|
||||
@@ -369,7 +356,6 @@ static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* handle writes to /proc/fs/afs/rootcell
|
||||
* - to initialize rootcell: echo "cell.name:192.168.231.14"
|
||||
@@ -407,14 +393,13 @@ static ssize_t afs_proc_rootcell_write(struct file *file,
|
||||
if (ret >= 0)
|
||||
ret = size; /* consume everything, always */
|
||||
|
||||
infault:
|
||||
infault:
|
||||
kfree(kbuf);
|
||||
nomem:
|
||||
nomem:
|
||||
_leave(" = %d", ret);
|
||||
return ret;
|
||||
} /* end afs_proc_rootcell_write() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* initialise /proc/fs/afs/<cell>/
|
||||
*/
|
||||
@@ -426,25 +411,25 @@ int afs_proc_cell_setup(struct afs_cell *cell)
|
||||
|
||||
cell->proc_dir = proc_mkdir(cell->name, proc_afs);
|
||||
if (!cell->proc_dir)
|
||||
return -ENOMEM;
|
||||
goto error_dir;
|
||||
|
||||
p = create_proc_entry("servers", 0, cell->proc_dir);
|
||||
if (!p)
|
||||
goto error_proc;
|
||||
goto error_servers;
|
||||
p->proc_fops = &afs_proc_cell_servers_fops;
|
||||
p->owner = THIS_MODULE;
|
||||
p->data = cell;
|
||||
|
||||
p = create_proc_entry("vlservers", 0, cell->proc_dir);
|
||||
if (!p)
|
||||
goto error_servers;
|
||||
goto error_vlservers;
|
||||
p->proc_fops = &afs_proc_cell_vlservers_fops;
|
||||
p->owner = THIS_MODULE;
|
||||
p->data = cell;
|
||||
|
||||
p = create_proc_entry("volumes", 0, cell->proc_dir);
|
||||
if (!p)
|
||||
goto error_vlservers;
|
||||
goto error_volumes;
|
||||
p->proc_fops = &afs_proc_cell_volumes_fops;
|
||||
p->owner = THIS_MODULE;
|
||||
p->data = cell;
|
||||
@@ -452,17 +437,17 @@ int afs_proc_cell_setup(struct afs_cell *cell)
|
||||
_leave(" = 0");
|
||||
return 0;
|
||||
|
||||
error_vlservers:
|
||||
error_volumes:
|
||||
remove_proc_entry("vlservers", cell->proc_dir);
|
||||
error_servers:
|
||||
error_vlservers:
|
||||
remove_proc_entry("servers", cell->proc_dir);
|
||||
error_proc:
|
||||
error_servers:
|
||||
remove_proc_entry(cell->name, proc_afs);
|
||||
error_dir:
|
||||
_leave(" = -ENOMEM");
|
||||
return -ENOMEM;
|
||||
} /* end afs_proc_cell_setup() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* remove /proc/fs/afs/<cell>/
|
||||
*/
|
||||
@@ -476,9 +461,8 @@ void afs_proc_cell_remove(struct afs_cell *cell)
|
||||
remove_proc_entry(cell->name, proc_afs);
|
||||
|
||||
_leave("");
|
||||
} /* end afs_proc_cell_remove() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells
|
||||
*/
|
||||
@@ -500,9 +484,8 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file)
|
||||
m->private = cell;
|
||||
|
||||
return 0;
|
||||
} /* end afs_proc_cell_volumes_open() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* close the file and release the ref to the cell
|
||||
*/
|
||||
@@ -511,14 +494,12 @@ static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file)
|
||||
struct afs_cell *cell = PDE(inode)->data;
|
||||
int ret;
|
||||
|
||||
ret = seq_release(inode,file);
|
||||
ret = seq_release(inode, file);
|
||||
|
||||
afs_put_cell(cell);
|
||||
|
||||
return ret;
|
||||
} /* end afs_proc_cell_volumes_release() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* set up the iterator to start reading from the cells list and return the
|
||||
* first item
|
||||
@@ -545,9 +526,8 @@ static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos)
|
||||
break;
|
||||
|
||||
return _p != &cell->vl_list ? _p : NULL;
|
||||
} /* end afs_proc_cell_volumes_start() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* move to next cell in cells list
|
||||
*/
|
||||
@@ -562,12 +542,11 @@ static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v,
|
||||
(*_pos)++;
|
||||
|
||||
_p = v;
|
||||
_p = v == (void *) 1 ? cell->vl_list.next : _p->next;
|
||||
_p = (v == (void *) 1) ? cell->vl_list.next : _p->next;
|
||||
|
||||
return _p != &cell->vl_list ? _p : NULL;
|
||||
} /* end afs_proc_cell_volumes_next() */
|
||||
return (_p != &cell->vl_list) ? _p : NULL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* clean up after reading from the cells list
|
||||
*/
|
||||
@@ -576,10 +555,8 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)
|
||||
struct afs_cell *cell = p->private;
|
||||
|
||||
up_read(&cell->vl_sem);
|
||||
}
|
||||
|
||||
} /* end afs_proc_cell_volumes_stop() */
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* display a header line followed by a load of volume lines
|
||||
*/
|
||||
@@ -600,13 +577,11 @@ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v)
|
||||
vlocation->vldb.vid[0],
|
||||
vlocation->vldb.vid[1],
|
||||
vlocation->vldb.vid[2],
|
||||
vlocation->vldb.name
|
||||
);
|
||||
vlocation->vldb.name);
|
||||
|
||||
return 0;
|
||||
} /* end afs_proc_cell_volumes_show() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume
|
||||
* location server
|
||||
@@ -629,9 +604,8 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file)
|
||||
m->private = cell;
|
||||
|
||||
return 0;
|
||||
} /* end afs_proc_cell_vlservers_open() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* close the file and release the ref to the cell
|
||||
*/
|
||||
@@ -644,11 +618,9 @@ static int afs_proc_cell_vlservers_release(struct inode *inode,
|
||||
ret = seq_release(inode,file);
|
||||
|
||||
afs_put_cell(cell);
|
||||
|
||||
return ret;
|
||||
} /* end afs_proc_cell_vlservers_release() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* set up the iterator to start reading from the cells list and return the
|
||||
* first item
|
||||
@@ -672,9 +644,8 @@ static void *afs_proc_cell_vlservers_start(struct seq_file *m, loff_t *_pos)
|
||||
return NULL;
|
||||
|
||||
return &cell->vl_addrs[pos];
|
||||
} /* end afs_proc_cell_vlservers_start() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* move to next cell in cells list
|
||||
*/
|
||||
@@ -692,9 +663,8 @@ static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v,
|
||||
return NULL;
|
||||
|
||||
return &cell->vl_addrs[pos];
|
||||
} /* end afs_proc_cell_vlservers_next() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* clean up after reading from the cells list
|
||||
*/
|
||||
@@ -703,10 +673,8 @@ static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v)
|
||||
struct afs_cell *cell = p->private;
|
||||
|
||||
up_read(&cell->vl_sem);
|
||||
}
|
||||
|
||||
} /* end afs_proc_cell_vlservers_stop() */
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* display a header line followed by a load of volume lines
|
||||
*/
|
||||
@@ -722,11 +690,9 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
|
||||
|
||||
/* display one cell per line on subsequent lines */
|
||||
seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr));
|
||||
|
||||
return 0;
|
||||
} /* end afs_proc_cell_vlservers_show() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* open "/proc/fs/afs/<cell>/servers" which provides a summary of active
|
||||
* servers
|
||||
@@ -747,11 +713,9 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file)
|
||||
|
||||
m = file->private_data;
|
||||
m->private = cell;
|
||||
|
||||
return 0;
|
||||
} /* end afs_proc_cell_servers_open() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* close the file and release the ref to the cell
|
||||
*/
|
||||
@@ -764,11 +728,9 @@ static int afs_proc_cell_servers_release(struct inode *inode,
|
||||
ret = seq_release(inode, file);
|
||||
|
||||
afs_put_cell(cell);
|
||||
|
||||
return ret;
|
||||
} /* end afs_proc_cell_servers_release() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* set up the iterator to start reading from the cells list and return the
|
||||
* first item
|
||||
@@ -796,9 +758,8 @@ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos)
|
||||
break;
|
||||
|
||||
return _p != &cell->sv_list ? _p : NULL;
|
||||
} /* end afs_proc_cell_servers_start() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* move to next cell in cells list
|
||||
*/
|
||||
@@ -816,9 +777,8 @@ static void *afs_proc_cell_servers_next(struct seq_file *p, void *v,
|
||||
_p = v == (void *) 1 ? cell->sv_list.next : _p->next;
|
||||
|
||||
return _p != &cell->sv_list ? _p : NULL;
|
||||
} /* end afs_proc_cell_servers_next() */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* clean up after reading from the cells list
|
||||
*/
|
||||
@@ -828,10 +788,8 @@ static void afs_proc_cell_servers_stop(struct seq_file *p, void *v)
|
||||
struct afs_cell *cell = p->private;
|
||||
|
||||
read_unlock(&cell->sv_lock);
|
||||
}
|
||||
|
||||
} /* end afs_proc_cell_servers_stop() */
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* display a header line followed by a load of volume lines
|
||||
*/
|
||||
@@ -849,10 +807,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v)
|
||||
/* display one cell per line on subsequent lines */
|
||||
sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr));
|
||||
seq_printf(m, "%3d %-15.15s %5d\n",
|
||||
atomic_read(&server->usage),
|
||||
ipaddr,
|
||||
server->fs_state
|
||||
);
|
||||
atomic_read(&server->usage), ipaddr, server->fs_state);
|
||||
|
||||
return 0;
|
||||
} /* end afs_proc_cell_servers_show() */
|
||||
}
|
||||
|
Reference in New Issue
Block a user