Whamcloud - gitweb
- remainder of rmdir changes
[fs/lustre-release.git] / lustre / obdclass / proc_lustre.c
index e9fe724..714a0e5 100644 (file)
@@ -1,5 +1,10 @@
 /* proc_lustre.c manages /proc/lustre/obd. 
  *
+ * Copyright (c) 2001 Rumi Zahir <rumi.zahir@intel.com>
+ *
+ * This code is issued under the GNU General Public License.
+ * See the file COPYING in this distribution
+ *
  * OBD devices materialize in /proc as a directory:
  *              /proc/lustre/obd/<number>
  * when /dev/obd<number> is opened. When the device is closed, the 
  *     proc_lustre_remove_obd_entry() removes a
  *     /proc/lustre/obd/<obdid>/ entry by name. This is the only
  *     function that is exported to other modules. 
- *
- * Copyright (c) 2001 Rumi Zahir <rumi.zahir@intel.com>
  */
 
+#define EXPORT_SYMTAB
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/version.h>
 #include <linux/proc_fs.h>
 
+#define DEBUG_SUBSYSTEM S_CLASS
+
 #include <linux/obd_support.h>
 #include <linux/obd_class.h>
 
-
 #ifdef CONFIG_PROC_FS
 extern struct proc_dir_entry proc_root;
 
@@ -61,7 +66,7 @@ proc_lustre_mkdir(const char* dname, struct proc_dir_entry *parent)
                                            &proc_root);
 #endif
        if (!child_dir_entry)
-               printk ("lustre: failed to create /proc  entry %s\n", dname);
+                CERROR("lustre: failed to create /proc entry %s\n", dname);
        
        return child_dir_entry;
 }
@@ -76,7 +81,7 @@ static int read_lustre_status(char *page, char **start, off_t offset,
        
        if (obddev->obd_refcnt==0) { 
                /* obd is unused */
-               p += sprintf(&page[p], "open but unused\n\0");
+               p += sprintf(&page[p], "open but unused\n");
        }
        else {  /* obd in use */
                p += sprintf(&page[p], "refcnt(%d)", obddev->obd_refcnt);
@@ -121,7 +126,7 @@ static int read_lustre_status(char *page, char **start, off_t offset,
                        }
                }
                
-               p += sprintf(&page[p], "\n\0");
+               p += sprintf(&page[p], "\n");
        }
 
        /* Compute eof and return value */
@@ -184,14 +189,14 @@ void proc_lustre_remove_obd_entry(const char* name, struct obd_device *obd)
                        
                obd_entry = obd_dir;
                obd_dir = obd_dir->parent;
-       
-               /* If /proc/lustre/obd/XXX or /proc/lustre/obd or
-                * /proc/lustre are being removed, then reset 
+
+               /* If /proc/lustre/obd/foo or /proc/lustre/obd or
+                * /proc/lustre is being removed, then reset
                 * internal variables
                 */
-               
-               if (obd_entry == obd->obd_proc_entry) 
-                       obd->obd_proc_entry=0; /* /proc/lustre/obd/XXX */
+
+               if (obd_entry == obd->obd_proc_entry)
+                       obd->obd_proc_entry=0; /* /proc/lustre/obd/foo */
                else 
                        if (obd_entry == proc_lustre_obd_dir_entry)
                                proc_lustre_obd_dir_entry=0;