Whamcloud - gitweb
Updated lprocfs.c. First cut
authorthantry <thantry>
Fri, 6 Sep 2002 22:58:30 +0000 (22:58 +0000)
committerthantry <thantry>
Fri, 6 Sep 2002 22:58:30 +0000 (22:58 +0000)
lustre/obdclass/lprocfs.c

index b36b9ef..eead8be 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/version.h>
 #include <linux/proc_fs.h>
 #include <linux/slab.h>
+#include <linux/types.h>
 
 #define DEBUG_SUBSYSTEM S_CLASS
 #define MAX_STRING_SIZE 100
@@ -62,9 +63,7 @@ char escape_char='%';
  * Externs
  */
 extern struct proc_dir_entry proc_root; /* Defined in proc/root.c */
-extern void l_lock_init(struct lustre_lock* );
-extern void l_lock(struct lustre_lock* );
-extern void l_unlock(struct lustre_lock* );
+
 
 /*
  * Globals
@@ -73,7 +72,7 @@ extern void l_unlock(struct lustre_lock* );
 static struct proc_dir_entry *proc_lustre_root = 0;
 static struct proc_dir_entry *proc_lustre_dev_root = 0;
 
-struct lustre_lock proc_lustre_lock;
+/* struct lustre_lock proc_lustre_lock; */
 /* static struct proc_dir_entry *proc_lustre_conn_root = 0; */
 char* testStr="General..";
 
@@ -97,9 +96,7 @@ struct namespace_index dir_mdc_index[] = {
         LPROCFS_DIR_INDEX(mdc, create),
         LPROCFS_DIR_INDEX(mdc, unlink),
         LPROCFS_DIR_INDEX(mdc, link),
-        LPROCFS_DIR_INDEX(mdc, rename)
-        /* Maintain this last comma */
-        ,
+        LPROCFS_DIR_INDEX(mdc, rename),
 
 };
 struct namespace_index dir_mds_index[] = {
@@ -124,9 +121,7 @@ struct namespace_index dir_mds_index[] = {
         LPROCFS_DIR_INDEX(mds, reint_unlink),
         LPROCFS_DIR_INDEX(mds, reint_link),
         LPROCFS_DIR_INDEX(mds, reint_rename),
-        LPROCFS_DIR_INDEX(mds, reint_recreate)
-        /* Maintain this last comma */
-        ,
+        LPROCFS_DIR_INDEX(mds, reint_recreate),
 
 
 };
@@ -145,9 +140,7 @@ struct namespace_index dir_osc_index[] = {
         LPROCFS_DIR_INDEX(osc, brw),
         LPROCFS_DIR_INDEX(osc, punch),
         LPROCFS_DIR_INDEX(osc, summary),
-        LPROCFS_DIR_INDEX(osc, cancel)
-        /* Maintain this last comma */
-        ,
+        LPROCFS_DIR_INDEX(osc, cancel),
 
 };
 
@@ -166,9 +159,7 @@ struct namespace_index dir_ost_index[] = {
         LPROCFS_DIR_INDEX(ost, punch),
         LPROCFS_DIR_INDEX(ost, summary),
         LPROCFS_DIR_INDEX(ost, cancel),
-        LPROCFS_DIR_INDEX(ost, getinfo)
-        /* Maintain this last comma */
-        ,
+        LPROCFS_DIR_INDEX(ost, getinfo),
 
 };
 struct namespace_index dir_lov_index[] = {
@@ -186,9 +177,7 @@ struct namespace_index dir_lov_index[] = {
         LPROCFS_DIR_INDEX(lov, punch),
         LPROCFS_DIR_INDEX(lov, summary),
         LPROCFS_DIR_INDEX(lov, cancel),
-        LPROCFS_DIR_INDEX(lov, getinfo)
-        /* Maintain this last comma */
-        ,
+        LPROCFS_DIR_INDEX(lov, getinfo),
 
 };
 struct namespace_index dir_obdfilter_index[] = {
@@ -207,9 +196,7 @@ struct namespace_index dir_obdfilter_index[] = {
         LPROCFS_DIR_INDEX(obdfilter, punch),
         LPROCFS_DIR_INDEX(obdfilter, summary),
         LPROCFS_DIR_INDEX(obdfilter, cancel),
-        LPROCFS_DIR_INDEX(obdfilter, getinfo)
-        /* Maintain this last comma */
-        ,
+        LPROCFS_DIR_INDEX(obdfilter, getinfo),
 };  
 
 struct namespace_index dir_ldlm_index[] = {
@@ -221,9 +208,7 @@ struct namespace_index dir_ldlm_index[] = {
         LPROCFS_DIR_INDEX(ldlm, locks_enqueus),
         LPROCFS_DIR_INDEX(ldlm, locks_cancels),
         LPROCFS_DIR_INDEX(ldlm, locks_converts),
-        LPROCFS_DIR_INDEX(ldlm, locks_matches)
-        /* Maintain this last comma */
-        ,
+        LPROCFS_DIR_INDEX(ldlm, locks_matches),
 };  
 struct namespace_index dir_ptlrpc_index[] = {
 
@@ -231,10 +216,7 @@ struct namespace_index dir_ptlrpc_index[] = {
         LPROCFS_DIR_INDEX(ptlrpc, mgmt_cleanup),
         LPROCFS_DIR_INDEX(ptlrpc, mgmt_connect),
         LPROCFS_DIR_INDEX(ptlrpc, mgmt_disconnect),
-        LPROCFS_DIR_INDEX(ptlrpc, counters)
-        
-        /* Maintain this last comma */
-        ,
+        LPROCFS_DIR_INDEX(ptlrpc, counters),
 };  
 
 
@@ -245,9 +227,7 @@ struct namespace_index prof_mdc_index[] = {
         LPROCFS_CNTR_INDEX(mdc, min_time),
         LPROCFS_CNTR_INDEX(mdc, max_time),
         LPROCFS_CNTR_INDEX(mdc, sum_time),
-        LPROCFS_CNTR_INDEX(mdc, num_ops)
-        /* Maintain this comma */
-        ,
+        LPROCFS_CNTR_INDEX(mdc, num_ops),
 
 
 };
@@ -257,9 +237,7 @@ struct namespace_index prof_mds_index[]= {
         LPROCFS_CNTR_INDEX(mds, min_time),
         LPROCFS_CNTR_INDEX(mds, max_time),
         LPROCFS_CNTR_INDEX(mds, sum_time),
-        LPROCFS_CNTR_INDEX(mds, num_ops)
-        /* Maintain this comma */
-        ,
+        LPROCFS_CNTR_INDEX(mds, num_ops),
 };
 struct namespace_index prof_osc_index[]= {
 
@@ -267,9 +245,7 @@ struct namespace_index prof_osc_index[]= {
         LPROCFS_CNTR_INDEX(osc, min_time),
         LPROCFS_CNTR_INDEX(osc, max_time),
         LPROCFS_CNTR_INDEX(osc, sum_time),
-        LPROCFS_CNTR_INDEX(osc, num_ops)
-        /* Maintain this comma */
-        ,
+        LPROCFS_CNTR_INDEX(osc, num_ops),
 };
 struct namespace_index prof_ost_index[]= {
 
@@ -277,9 +253,7 @@ struct namespace_index prof_ost_index[]= {
         LPROCFS_CNTR_INDEX(ost, min_time),
         LPROCFS_CNTR_INDEX(ost, max_time),
         LPROCFS_CNTR_INDEX(ost, sum_time),
-        LPROCFS_CNTR_INDEX(ost, num_ops)
-        /* Maintain this comma */
-        ,
+        LPROCFS_CNTR_INDEX(ost, num_ops),
 };
 struct namespace_index prof_lov_index[]= {
 
@@ -287,9 +261,7 @@ struct namespace_index prof_lov_index[]= {
         LPROCFS_CNTR_INDEX(lov, min_time),
         LPROCFS_CNTR_INDEX(lov, max_time),
         LPROCFS_CNTR_INDEX(lov, sum_time),
-        LPROCFS_CNTR_INDEX(lov, num_ops)
-        /* Maintain this comma */
-        ,
+        LPROCFS_CNTR_INDEX(lov, num_ops),
 };
 struct namespace_index prof_obdfilter_index[]= {
 
@@ -297,9 +269,7 @@ struct namespace_index prof_obdfilter_index[]= {
         LPROCFS_CNTR_INDEX(obdfilter, min_time),
         LPROCFS_CNTR_INDEX(obdfilter, max_time),
         LPROCFS_CNTR_INDEX(obdfilter, sum_time),
-        LPROCFS_CNTR_INDEX(obdfilter, num_ops)
-        /* Maintain this comma */
-        ,
+        LPROCFS_CNTR_INDEX(obdfilter, num_ops),
 };
 
 struct namespace_index prof_ldlm_index[] = {
@@ -313,9 +283,7 @@ struct namespace_index prof_ldlm_index[] = {
         LPROCFS_CNTR_INDEX(ldlm, num_zerolatency_done),
         LPROCFS_CNTR_INDEX(ldlm, nonzero_mintime),
         LPROCFS_CNTR_INDEX(ldlm, nonzero_maxtime),
-        LPROCFS_CNTR_INDEX(ldlm, nonzero_sumtime)
-         /* Maintain this comma */ 
-        ,
+        LPROCFS_CNTR_INDEX(ldlm, nonzero_sumtime),
 
 
 };
@@ -331,9 +299,7 @@ struct namespace_index prof_ptlrpc_index[] = {
         LPROCFS_CNTR_INDEX(ptlrpc, recv_length),
         LPROCFS_CNTR_INDEX(ptlrpc, send_count),
         LPROCFS_CNTR_INDEX(ptlrpc, send_length),
-        LPROCFS_CNTR_INDEX(ptlrpc, portal_kmemory)
-        /* Maintain this comma */
-        ,
+        LPROCFS_CNTR_INDEX(ptlrpc, portal_kmemory),
 
 
 };
@@ -352,9 +318,7 @@ struct groupspace_index class_index[] = {
         LPROCFS_GROUP_CREATE(lov),
         LPROCFS_GROUP_CREATE(obdfilter),
         LPROCFS_GROUP_CREATE(ldlm),
-        LPROCFS_GROUP_CREATE(ptlrpc)
-        /* Retain this comma */
-        ,
+        LPROCFS_GROUP_CREATE(ptlrpc),
 
 };
 
@@ -364,12 +328,12 @@ struct groupspace_index class_index[] = {
  */
 
 /*
- * lprocfs_register_dev: Registers an instance of the OBD device in the
+ * lprocfs_reg_dev: Registers an instance of the OBD device in the
  *                       proc hierarchy
  */
 
-int lprocfs_register_dev(struct obd_device* device, \
-                         lprocfs_group_t* namespace, \
+int lprocfs_reg_dev(struct obd_device* device, 
+                         lprocfs_group_t* namespace, 
                          unsigned int cnt_struct_size)
 {
         
@@ -390,15 +354,15 @@ int lprocfs_register_dev(struct obd_device* device, \
         if(this_dev_root==0){
                 CERROR("Could not create initial directory");
                 return LPROCFS_FAILURE;
-                
         }
-        l_lock_init(&proc_lustre_lock); 
+        
         
         /*
          * Obtain the class-array index
          */
         
-        class_array_index=lprocfs_util_getclass_idx(class_index, device->obd_type->typ_name);
+        class_array_index=lprocfs_getclass_idx(class_index, \
+                                               device->obd_type->typ_name);
         
         if(class_array_index==LPROCFS_FAILURE){
                 CERROR("!! Could not find class !! \n");
@@ -410,7 +374,9 @@ int lprocfs_register_dev(struct obd_device* device, \
          * Create the directory namespace
          */
         
-        retval=lprocfs_create_dir_namespace(this_dev_root, namespace, &num_directories);
+        retval=lprocfs_create_dir_namespace(this_dev_root, \
+                                            namespace,\
+                                            &num_directories);
         if(retval==LPROCFS_FAILURE){
                 CERROR("!!Could not create proc directory structure !!\n");
                 return LPROCFS_FAILURE;
@@ -423,19 +389,14 @@ int lprocfs_register_dev(struct obd_device* device, \
          */
         
         if(cnt_struct_size!=0){
-                device->counters=kmalloc(num_directories*cnt_struct_size, \
-                                         GFP_KERNEL);
-                if(!device->counters){
-                        CERROR("!!Could not allocate memory for proc counters!!");
-                        return LPROCFS_FAILURE;
-                        
-                }
-                memset(device->counters, 0, num_directories*cnt_struct_size);
+                OBD_ALLOC(device->counters, num_directories*cnt_struct_size);
+                device->cntr_mem_size=num_directories*cnt_struct_size;
         } 
         
         
         /*
-         * Iterate the proc-dir-namespace, obtain corresponding directory(attribute)
+         * Iterate the proc-dir-namespace, obtain corresponding 
+         * directory(attribute)
          * entries. Create the proc-counters from namespace, link them into 
          * dev counters
          */
@@ -507,11 +468,11 @@ int lprocfs_register_dev(struct obd_device* device, \
         return LPROCFS_SUCCESS;
 }
 
-int lprocfs_link_dir_counters(struct obd_device* device, \
-                              struct proc_dir_entry* this_dev_root, \
-                              lprocfs_group_t* namespace, \
-                              unsigned int cnt_struct_size, \
-                              unsigned int class_array_index)
+int lprocfs_link_dir_counters(struct obd_device* device, 
+                              struct proc_dir_entry* root, 
+                              lprocfs_group_t* namespace, 
+                              unsigned int sz, 
+                              unsigned int cl_idx)
 {
         
         
@@ -519,38 +480,45 @@ int lprocfs_link_dir_counters(struct obd_device* device, \
         unsigned int j=0;
         unsigned int k=0;
         unsigned int escape=0;
-        int dir_array_index=-1;
-        int cnt_array_index=-1;
+        int dir_idx=-1;
+        int cnt_idx=-1;
         
-        struct proc_dir_entry* this_dir_root=0;
+        struct proc_dir_entry* dir_root=0;
         lprocfs_group_t* temp;
-        lprocfs_vars_t* func_n_counters;
+        lprocfs_vars_t* fn_ctr;
+        struct namespace_index* cntr_names;
         
         while(1) {
                 temp=&namespace[i];
-                dir_array_index=-1;
+                dir_idx=-1;
                 if(temp->count_func_namespace==0) break;
+                
                 while((temp->dir_namespace)[j]!=0){
-                        this_dir_root=lprocfs_util_add_dir_node(this_dev_root, (temp->dir_namespace)[j], (const char*)tok, &escape);
+                        dir_root=lprocfs_add_dir(root,\
+                                                 (temp->dir_namespace)[j], \
+                                                 (const char*)tok, &escape);
                         if(escape){
                                 j++;
                                 continue;
                         }
-                        dir_array_index=lprocfs_util_get_index(class_index[class_array_index].directory,(temp->dir_namespace)[j]);
-                        /* printk("Class name=%s, Directory name=%s, index=%d\t", device->obd_type->typ_name, (temp->dir_namespace)[j], dir_array_index); */
+                        dir_idx=lprocfs_get_idx(class_index[cl_idx].directory,\
+                                                (temp->dir_namespace)[j]);
                         while(1){
-                                cnt_array_index=-1;
-                                func_n_counters=&((temp->count_func_namespace)[k]);
-                                if(func_n_counters->read_fptr==0)break;
-                                cnt_array_index=lprocfs_util_get_index(class_index[class_array_index].counters, func_n_counters->name);
-                                /* printk("Counter name=%s, index=%d\n", func_n_counters->name, cnt_array_index); */
-                                if(lprocfs_util_add_var_node(device, \
-                                                             this_dir_root, \
-                                                             func_n_counters, \
-                                                             dir_array_index, \
-                                                             cnt_array_index, \
-                                                             cnt_struct_size, \
-                                                             temp->prof_type)==LPROCFS_FAILURE){
+                                cnt_idx=-1;
+                                fn_ctr=&((temp->count_func_namespace)[k]);
+                                if(fn_ctr->read_fptr==0)break;
+                                cntr_names=class_index[cl_idx].counters;
+                                cnt_idx=lprocfs_get_idx(cntr_names, \
+                                                        fn_ctr->name);
+                               
+                                if(lprocfs_add_var(device, \
+                                                   dir_root, \
+                                                   fn_ctr, \
+                                                   dir_idx, \
+                                                   cnt_idx, \
+                                                   sz, \
+                                                   temp->prof_type)==\
+                                   LPROCFS_FAILURE){
                                         CERROR("Could not create leaf node!");
                                         return LPROCFS_FAILURE;
                                         
@@ -575,14 +543,14 @@ int lprocfs_link_dir_counters(struct obd_device* device, \
 
 
 
-int lprocfs_create_dir_namespace(struct proc_dir_entry* this_dev_root, \
+int lprocfs_create_dir_namespace(struct proc_dir_entry* root, \
                                  lprocfs_group_t* namespace, \
                                  unsigned int *num_dirs)
 
 {
         unsigned int i=0;
         unsigned int j=0;
-        struct proc_dir_entry* this_dir_root=0;
+        struct proc_dir_entry* dir_root=0;
         lprocfs_group_t* temp;
         unsigned int escape=0;
 
@@ -590,9 +558,12 @@ int lprocfs_create_dir_namespace(struct proc_dir_entry* this_dev_root, \
                 temp=&namespace[i];
                 if(temp->count_func_namespace==0) break;
                 while((temp->dir_namespace)[j]!=0){
-                        this_dir_root=lprocfs_util_add_dir_node(this_dev_root, (temp->dir_namespace)[j], (const char*)tok, &escape);
-                        if(this_dir_root==0){
-                                CERROR("!! Could not create directory entry %s !! \n", (temp->dir_namespace)[j]);
+                        dir_root=lprocfs_add_dir(root, \
+                                                 (temp->dir_namespace)[j], \
+                                                 (const char*)tok, &escape);
+                        if(dir_root==0){
+                                CERROR("!! Could not create dir  %s !! \n", \
+                                       (temp->dir_namespace)[j]);
                                 return LPROCFS_FAILURE;
                         }
                         if(temp->prof_type!=e_specific && !escape)
@@ -611,7 +582,8 @@ int lprocfs_create_dir_namespace(struct proc_dir_entry* this_dev_root, \
 
 
 
-int lprocfs_util_getclass_idx(struct groupspace_index* group, const char* classname)
+int lprocfs_getclass_idx(struct groupspace_index* group, 
+                         const char* classname)
 {
         unsigned int idx=0;
         while(group[idx].name!=""){
@@ -637,13 +609,13 @@ struct proc_dir_entry* lprocfs_mkinitdir(struct obd_device* device)
         
         if (!proc_lustre_root) {
                 proc_lustre_root = 
-                        lprocfs_util_mkdir("lustre", &proc_root);
+                        lprocfs_mkdir("lustre", &proc_root);
                 if (!proc_lustre_root){
                         CERROR(" !! Cannot create /proc/lustre !! \n");
                         return 0;
                 }
                 proc_lustre_dev_root = 
-                        lprocfs_util_mkdir("devices", proc_lustre_root);
+                        lprocfs_mkdir("devices", proc_lustre_root);
                 
                 if(!proc_lustre_dev_root){
                         CERROR(" !! Cannot create /proc/lustre/devices !! \n");
@@ -656,12 +628,15 @@ struct proc_dir_entry* lprocfs_mkinitdir(struct obd_device* device)
          * this class in the lprocfs hierarchy. 
          */
         
-        temp_proc=lprocfs_search(proc_lustre_dev_root, device->obd_type->typ_name);
+        temp_proc=lprocfs_srch(proc_lustre_dev_root, \
+                                 device->obd_type->typ_name);
         
         if(!temp_proc){
-                temp_proc=lprocfs_util_mkdir(device->obd_type->typ_name, proc_lustre_dev_root);
+                temp_proc=lprocfs_mkdir(device->obd_type->typ_name, \
+                                        proc_lustre_dev_root);
                 if(!temp_proc){
-                        CERROR("!! Could not create proc for device class %s !!\n", device->obd_type->typ_name);
+                        CERROR("! Proc dir for device class %s !!\n", \
+                               device->obd_type->typ_name);
                         return 0;
                 }
         }
@@ -669,9 +644,10 @@ struct proc_dir_entry* lprocfs_mkinitdir(struct obd_device* device)
          * Next create the proc_dir_entry for this instance
          */
         
-        this_dev_root=lprocfs_util_mkdir(device->obd_name, temp_proc);
+        this_dev_root=lprocfs_mkdir(device->obd_name, temp_proc);
         if(!this_dev_root){
-                CERROR("!! Cannot create proc entry for device instance %s !! \n", device->obd_name);
+                CERROR("!Cant create proc entry for instance %s !! \n", \
+                       device->obd_name);
                 return 0;
         }
         
@@ -682,7 +658,8 @@ struct proc_dir_entry* lprocfs_mkinitdir(struct obd_device* device)
 
 
 
-int lprocfs_util_get_index(struct namespace_index* class, const char* dir_name)
+int lprocfs_get_idx(struct namespace_index* class, 
+                    const char* dir_name)
 {
 
         unsigned int index = 0;
@@ -718,7 +695,8 @@ int lprocfs_util_get_index(struct namespace_index* class, const char* dir_name)
 
 
 
-struct proc_dir_entry* lprocfs_util_mkdir(const char* dname, struct proc_dir_entry *parent)
+struct proc_dir_entry* lprocfs_mkdir(const char* dname, 
+                                     struct proc_dir_entry *parent)
 {
        struct proc_dir_entry *child_dir_entry;
         
@@ -742,18 +720,19 @@ struct proc_dir_entry* lprocfs_util_mkdir(const char* dname, struct proc_dir_ent
  * Returns non-zero on success, zero on failure
  */
 
-unsigned int lprocfs_util_add_var_node(struct obd_device* device, \
-                                       struct proc_dir_entry* root, \
-                                       lprocfs_vars_t* variable, \
-                                       int dir_arr_index, \
-                                       int cnt_arr_index, \
-                                       unsigned int cnt_struct_size, \
-                                       lprocfs_profilers_e type \
-                                       )
+unsigned int lprocfs_add_var(struct obd_device* device, 
+                             struct proc_dir_entry* root, 
+                             lprocfs_vars_t* variable, 
+                             int dir_idx, 
+                             int cnt_idx, 
+                             unsigned int sz, 
+                             lprofilers_e type 
+                             )
 {
         struct proc_dir_entry* new_proc_entry;
-        unsigned long long* temp;
+        __u64* temp;
         unsigned int actual_idx;
+        unsigned int blk_size;
                        
         new_proc_entry=create_proc_entry(variable->name, \
                                          DEFAULT_MODE,
@@ -767,11 +746,12 @@ unsigned int lprocfs_util_add_var_node(struct obd_device* device, \
         switch(type){
         case e_generic:
                 if(device->counters) {
-                        if(dir_arr_index!=-1 && cnt_arr_index!=-1){
-                                temp=(unsigned long long*)device->counters;
-                                actual_idx=(dir_arr_index*((cnt_struct_size)/(sizeof(unsigned long long))))+cnt_arr_index;
+                        if(dir_idx!=-1 && cnt_idx!=-1){
+                                temp=(__u64*)device->counters;
+                                blk_size=((sz)/(sizeof(__u64)));
+                                actual_idx=(dir_idx*blk_size)+cnt_idx;
                                 temp+=actual_idx;
-                                new_proc_entry->data = (unsigned long long*)temp;
+                                new_proc_entry->data =(__u64*)temp;
                         }
                 }
                 break;
@@ -794,10 +774,10 @@ unsigned int lprocfs_util_add_var_node(struct obd_device* device, \
  * the escaping character (#)
  */
 
-struct proc_dir_entry* lprocfs_util_add_dir_node(struct proc_dir_entry *root, \
-                                                 const char* string,          \
-                                                 const char* tok,             \
-                                                 unsigned int* escape)
+struct proc_dir_entry* lprocfs_add_dir(struct proc_dir_entry *root, 
+                                       const char* string,          
+                                       const char* tok,             
+                                       unsigned int* escape)
 {
         struct proc_dir_entry* new_root=0;
         struct proc_dir_entry* temp_entry=0;
@@ -833,11 +813,11 @@ struct proc_dir_entry* lprocfs_util_add_dir_node(struct proc_dir_entry *root, \
 
         new_root=root;
         while(my_str!=NULL){
-                temp_entry=lprocfs_search(new_root, my_str);
+                temp_entry=lprocfs_srch(new_root, my_str);
                 if(temp_entry==0){
-                        new_entry=lprocfs_util_mkdir(my_str, new_root);
+                        new_entry=lprocfs_mkdir(my_str, new_root);
                         if(new_entry==0){
-                                CERROR("!! LPROCFS: Failed to create new directory %s !!\n", \
+                                CERROR("! Did not create new dir %s !!\n", \
                                        my_str);
                                 return 0;
                                 }
@@ -852,7 +832,8 @@ struct proc_dir_entry* lprocfs_util_add_dir_node(struct proc_dir_entry *root, \
 }
 
 
-struct proc_dir_entry* lprocfs_search(struct proc_dir_entry* head, const char* name)
+struct proc_dir_entry* lprocfs_srch(struct proc_dir_entry* head, 
+                                    const char* name)
 {
         struct proc_dir_entry* temp;
 
@@ -868,7 +849,7 @@ struct proc_dir_entry* lprocfs_search(struct proc_dir_entry* head, const char* n
 
 
 
-struct proc_dir_entry* lprocfs_bfs_search(struct proc_dir_entry* root, const char* name)
+struct proc_dir_entry* lprocfs_bfs_srch(struct proc_dir_entry* root, const char* name)
 {                                                          
     
         struct proc_dir_entry* temp=root;    
@@ -879,21 +860,21 @@ struct proc_dir_entry* lprocfs_bfs_search(struct proc_dir_entry* root, const cha
         if(!strcmp(temp->name, name)){
                 return temp;
         }
-        if((temp=lprocfs_bfs_search(root->next, name))!=0){
+        if((temp=lprocfs_bfs_srch(root->next, name))!=0){
                 return temp;
         }
-        if((temp=lprocfs_bfs_search(root->subdir, name))!=0){
+        if((temp=lprocfs_bfs_srch(root->subdir, name))!=0){
                 return temp;
         }
         return temp;
 } 
 
-int  lprocfs_get_namespace(char* name, \
-                           lprocfs_obd_namespace_t* collection)
+int  lprocfs_get_nm(char* name, \
+                    lprocfs_obd_nm_t* collection)
 {
         int i=0;
-        while(collection[i].obd_namespace!=0){
-                if(!strcmp(collection[i].obd_classname, name)){
+        while(collection[i].obd_names!=0){
+                if(!strcmp(collection[i].obd_clname, name)){
                         return i;
                 }
                 i++;
@@ -902,7 +883,7 @@ int  lprocfs_get_namespace(char* name, \
 
 }
 
-int lprocfs_deregister_dev (struct obd_device* device)
+int lprocfs_dereg_dev (struct obd_device* device)
 {
 
         struct proc_dir_entry* temp;
@@ -919,22 +900,21 @@ int lprocfs_deregister_dev (struct obd_device* device)
         }
         printk("SEARCH: Device = %s\n", device->obd_name);
         
-        l_lock(&proc_lustre_lock);
-        
-        temp=lprocfs_bfs_search(proc_lustre_dev_root->subdir, device->obd_name);
+        temp=lprocfs_bfs_srch(proc_lustre_dev_root->subdir, \
+                              device->obd_name);
         if(temp==0){
                 CERROR("!! No root obtained, device does not exist !!\n");
                 return LPROCFS_FAILURE;
         }
         
         lprocfs_remove_all(temp);
-        l_unlock(&proc_lustre_lock);
-
+        
         /*
          * Free the memory held by counters
          */
         if(device->counters)
-                kfree(device->counters);
+                OBD_FREE(device->counters, 
+                         device->cntr_mem_size);
         
         
         return LPROCFS_SUCCESS;
@@ -958,31 +938,31 @@ void lprocfs_remove_all(struct proc_dir_entry* root)
 }
 
 
-int lprocfs_longlong_read(char* page, char **start, off_t off,
+int lprocfs_ll_rd(char* page, char **start, off_t off,
                 int count, int *eof, void *data)
 {
         int len;
-        unsigned long long* temp=(unsigned long long*)data;
+        __u64* temp=(__u64*)data;
         
         len=sprintf(page, "%lld\n", *temp);
         
         return len;
 }
 
-int read_other(char* page, char **start, off_t off,
+int rd_other(char* page, char **start, off_t off,
                 int count, int *eof, void *data)
 {
   printk("Hello other");
   return 0;
 
 }
-int read_string(char* page, char **start, off_t off,
+int rd_string(char* page, char **start, off_t off,
                 int count, int *eof, void *data)
 {
   printk("Hello string");
   return 0;
 }
-int lprocfs_longlong_write(struct file* file, const char *buffer,
+int lprocfs_ll_wr(struct file* file, const char *buffer,
                  unsigned long count, void *data)
 {
   printk("Write default");
@@ -990,7 +970,7 @@ int lprocfs_longlong_write(struct file* file, const char *buffer,
 
 }
 
-int write_other(struct file* file, const char *buffer,
+int wr_other(struct file* file, const char *buffer,
                  unsigned long count, void *data)
 {
   printk("Write other");
@@ -998,20 +978,20 @@ int write_other(struct file* file, const char *buffer,
 
 }
 
-int write_string(struct file* file, const char *buffer,
-                 unsigned long count, void *data)
+int wr_string(struct file* file, const char *buffer,
+                  unsigned long count, void *data)
 {
         printk("Write string");
         return 0;
 
 }
 
-int lprocfs_register_conn(unsigned int conn_number, \
+int lprocfs_reg_conn(unsigned int conn_number, 
                           struct lprocfs_conn_namespace* namespace)
 {
         return 0;
 }
-int lprocfs_deregister_conn(unsigned int conn_number)
+int lprocfs_dereg_conn(unsigned int conn_number)
 {
         return 0;
 }
@@ -1019,19 +999,23 @@ int lprocfs_deregister_conn(unsigned int conn_number)
 /*
  * Import/Export APIs
  */
-int lprocfs_add_export(unsigned int conn_number, struct obd_device* device)
+int lprocfs_add_export(unsigned int conn_number, 
+                       struct obd_device* device)
 {
         return 0;
 }
-int lprocfs_add_import(unsigned int conn_number, struct obd_device* device)
+int lprocfs_add_import(unsigned int conn_number, 
+                       struct obd_device* device)
 {
         return 0;
 }
-int lprocfs_remove_export(unsigned int conn_number, struct obd_device* device)
+int lprocfs_remove_export(unsigned int conn_number, 
+                          struct obd_device* device)
 {
         return 0;
 }
-int lprocfs_remove_import(unsigned int conn_number, struct obd_device* device)
+int lprocfs_remove_import(unsigned int conn_number, 
+                          struct obd_device* device)
 {
         return 0;
 }