X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Fafs%2FLINUX%2Fosi_proc.c;h=2ac51afb74a7bb274ae059d8f601666cee8660d8;hp=7b378e296cced92ca27ca43a773cea87bb72f666;hb=d0a166bdffce2d2498cab54cc458d9489d05c299;hpb=224eb9ff60ffc7658428557cb98dfdf59b61b8d5 diff --git a/src/afs/LINUX/osi_proc.c b/src/afs/LINUX/osi_proc.c index 7b378e2..2ac51af 100644 --- a/src/afs/LINUX/osi_proc.c +++ b/src/afs/LINUX/osi_proc.c @@ -18,6 +18,9 @@ RCSID ("$Header$"); #include /* early to avoid printf->printk mapping */ +#ifdef HAVE_KERNEL_LINUX_SEQ_FILE_H +#include +#endif #include "afs/sysincludes.h" #include "afsincludes.h" #include "afs/nfsclient.h" @@ -34,10 +37,6 @@ RCSID #include #include -#ifdef HAVE_KERNEL_LINUX_SEQ_FILE_H -#include -#endif - struct proc_dir_entry *openafs_procfs; #ifdef HAVE_KERNEL_LINUX_SEQ_FILE_H @@ -46,6 +45,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) struct afs_q *cq, *tq; loff_t n = 0; + AFS_GLOCK(); ObtainReadLock(&afs_xcell); for (cq = CellLRU.next; cq != &CellLRU; cq = tq) { tq = QNext(cq); @@ -54,8 +54,9 @@ static void *c_start(struct seq_file *m, loff_t *pos) break; } if (cq == &CellLRU) - return NULL; + cq = NULL; + AFS_GUNLOCK(); return cq; } @@ -63,18 +64,22 @@ static void *c_next(struct seq_file *m, void *p, loff_t *pos) { struct afs_q *cq = p, *tq; + AFS_GLOCK(); (*pos)++; tq = QNext(cq); if (tq == &CellLRU) return NULL; + AFS_GUNLOCK(); return tq; } static void c_stop(struct seq_file *m, void *p) { + AFS_GLOCK(); ReleaseReadLock(&afs_xcell); + AFS_GUNLOCK(); } static int c_show(struct seq_file *m, void *p) @@ -317,14 +322,23 @@ void osi_proc_init(void) { struct proc_dir_entry *entry; - +#if !defined(EXPORTED_PROC_ROOT_FS) + char path[64]; +#endif + +#if defined(EXPORTED_PROC_ROOT_FS) openafs_procfs = proc_mkdir(PROC_FSDIRNAME, proc_root_fs); - +#else + sprintf(path, "fs/%s", PROC_FSDIRNAME); + openafs_procfs = proc_mkdir(path, NULL); +#endif #ifdef HAVE_KERNEL_LINUX_SEQ_FILE_H entry = create_proc_entry("unixusers", 0, openafs_procfs); if (entry) { entry->proc_fops = &afs_unixuser_fops; +#if defined(STRUCT_PROC_DIR_ENTRY_HAS_OWNER) entry->owner = THIS_MODULE; +#endif } entry = create_proc_entry(PROC_CELLSERVDB_NAME, 0, openafs_procfs); if (entry) @@ -332,15 +346,26 @@ osi_proc_init(void) #else entry = create_proc_info_entry(PROC_CELLSERVDB_NAME, (S_IFREG|S_IRUGO), openafs_procfs, csdbproc_info); #endif +#if defined(STRUCT_PROC_DIR_ENTRY_HAS_OWNER) entry->owner = THIS_MODULE; +#endif } void osi_proc_clean(void) { +#if !defined(EXPORTED_PROC_ROOT_FS) + char path[64]; +#endif + remove_proc_entry(PROC_CELLSERVDB_NAME, openafs_procfs); #ifdef HAVE_KERNEL_LINUX_SEQ_FILE_H remove_proc_entry("unixusers", openafs_procfs); #endif +#if defined(EXPORTED_PROC_ROOT_FS) remove_proc_entry(PROC_FSDIRNAME, proc_root_fs); +#else + sprintf(path, "fs/%s", PROC_FSDIRNAME); + remove_proc_entry(path, NULL); +#endif }