|
static const struct file_operations afs_proc_cell_servers_fops = { .open = afs_proc_cell_servers_open, .read = seq_read, .llseek = seq_lseek, .release = afs_proc_cell_servers_release, .owner = THIS_MODULE, }; /* * initialise the /proc/fs/afs/ directory */ int afs_proc_init(void) { struct proc_dir_entry *p; _enter(""); proc_afs = proc_mkdir("fs/afs", NULL); if (!proc_afs) goto error_dir; proc_afs->owner = THIS_MODULE; p = proc_create("cells", 0, proc_afs, &afs_proc_cells_fops); if (!p) goto error_cells; p = proc_create("rootcell", 0, proc_afs, &afs_proc_rootcell_fops); if (!p) goto error_rootcell; _leave(" = 0"); return 0; error_rootcell: remove_proc_entry("cells", proc_afs); error_cells: remove_proc_entry("fs/afs", NULL); error_dir: _leave(" = -ENOMEM"); return -ENOMEM; } /* * 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); } /* * open "/proc/fs/afs/cells" which provides a summary of extant cells */ static int afs_proc_cells_open(struct inode *inode, struct file *file) { struct seq_file *m; int ret; ret = seq_open(file, &afs_proc_cells_ops); if (ret < 0) return ret; m = file->private_data; m->private = PDE(inode)->data; return 0; } |
