Whamcloud - gitweb
Header file for LprocFS
[fs/lustre-release.git] / lustre / include / linux / lprocfs.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2002 Intel Corporation
5  *
6  */
7
8 /*
9  * Author: Hariharan Thantry
10  * File Name: lprocfs.h 
11  * 
12  * Header file for the LProcFS file system
13  */
14
15 #ifndef _LPROCFS_H
16 #define _LPROCFS_H
17
18 #ifndef LPROCFS_EXISTS
19 #define LPROCFS_EXISTS  
20 #endif
21
22 #define LPROCFS_SUCCESS 1
23 #define LPROCFS_FAILURE -1
24
25 #include <linux/time.h>
26 #include <linux/proc_fs.h>
27 #include <linux/config.h>
28 #include <linux/param.h>
29 /* #include <linux/msr.h> */
30
31 typedef enum lprofilers {
32         e_generic=0,
33         e_specific
34 }lprofilers_e;
35         
36
37 typedef struct lprocfs_vars{
38         char* name;
39         read_proc_t* read_fptr;
40         write_proc_t* write_fptr;
41 }lprocfs_vars_t; 
42
43  typedef struct lprocfs_group {
44         char** dir_namespace;
45         lprocfs_vars_t* count_func_namespace;
46         lprofilers_e prof_type;
47 }lprocfs_group_t;
48
49 typedef struct lprocfs_obd_nm {
50         char* obd_clname;
51         lprocfs_group_t* obd_names;
52         unsigned int cntr_blk_sz;
53 }lprocfs_obd_nm_t;
54
55
56
57 /*
58  * Structure defining the variables to be maintained
59  * on a per attribute basis for entries. The size of
60  * the profiling entry needs to be passed during registration
61  * with LProcFS, to enable it to allocate space. It is expected
62  * that on a per-device class basis, there would exist only
63  * one signature.
64  */
65  
66 struct lprofiler_gen {
67         __u64 min_time;
68         __u64 max_time; 
69         __u64 sum_time;
70         __u64 num_ops;
71         /*
72          * Default, used for storing intermediate
73          * value
74          */
75         unsigned long long start_time;
76         
77 };
78
79 struct lprofiler_ldlm {
80
81         __u64 min_time;
82         __u64 max_time;
83         __u64 sum_time;
84         __u64 num_ops;
85         __u64 start_time;
86
87         __u64 num_total;
88         __u64 num_zerolatency;
89         __u64 num_zerolatency_inflight;
90         __u64 num_zerolatency_done;
91         __u64 non_zero_mintime;
92         __u64 non_zero_maxtime;
93         __u64 non_zero_sumtime;
94 };
95
96 struct lprofiler_ptlrpc {
97         __u64 min_time;
98         __u64 max_time; 
99         __u64 sum_time;
100         __u64 num_ops;
101         /*
102          * Default, used for storing intermediate
103          * value
104          */
105         __u64 start_time;
106         __u64 msgs_alloc;
107
108         __u64 msgs_max;
109         __u64 recv_count;
110         
111         __u64 recv_length;
112         __u64 send_count;
113         __u64 send_length;
114         __u64 portal_kmemory;
115
116
117 };
118
119  
120
121 struct namespace_index{
122         char* name;
123 };
124
125 struct groupspace_index{
126         char* name;
127         struct namespace_index* directory;
128         struct namespace_index* counters;
129
130 };
131
132 /*
133  * Used for connections and such
134  */
135
136
137 typedef enum te_leafType {
138
139         e_String=0,
140         e_longlong
141
142 }e_varType;
143
144
145
146 struct lprocfs_conn_namespace{
147         char* leaf_name;
148         e_varType type;
149         union{
150                 char* string_val;
151                 __u64 cntr_val;
152         }x;
153
154 };
155
156
157
158
159 #ifdef LPROCFS_EXISTS
160
161 /*
162  * Utility functions to return the timeofday
163  * 
164  */
165 static inline unsigned long lprocfs_util_gettime(void)
166 {
167         return 0;
168         /*
169         struct timeval myTime;
170         __u64 temp;
171         do_gettimeofday(&myTime);
172         temp=((__u64)(myTime.tv_usec))&0xFFFFFFFF;
173         temp|=(((__u64)(myTime.tv_sec))<<(8*sizeof(unsigned long)));
174         return temp;
175         */
176
177 }
178 static inline unsigned long lprocfs_util_getdiff(unsigned long x, 
179                                                  unsigned long y)
180 {
181         return ((x>y)?(x-y):(y-x));
182         /*
183         __u64 tempSec=0;
184         __u64 tempuSec=0;
185         tempSec=((y>>8*sizeof(unsigned long))-(x>>8*sizeof(unsigned long)));
186         if(tempSec<0)tempSec=-tempSec;
187         tempuSec=((y&0xFFFFFFFF)-(x&0xFFFFFFFF));
188         if(tempuSec<0)tempuSec=-tempuSec;
189         return(tempSec*1000000+tempuSec);
190         */
191
192 }
193
194 #define LPROCFS_NAMESPACE_ENUM(CLASS, NAME) e_ ##CLASS## _##NAME
195
196
197 #define DEV_PROF_START(DEV_CLASS, OBD, PROF_CLASS, ATTRIBUTE)         \
198 do {                                                                  \
199         struct lprofiler_##PROF_CLASS *x;                             \
200         int index=LPROCFS_NAMESPACE_ENUM(DEV_CLASS, ATTRIBUTE);       \
201         x=(struct lprofiler_##PROF_CLASS *)((OBD)->counters);         \
202         x+=index;                                                     \
203         /* rdtscl(x->start_time); */                                  \
204         x->start_time=lprocfs_util_gettime();                         \
205 }while(0)                                                             \
206
207
208 #define DEV_PROF_END(DEV_CLASS, OBD, PROF_CLASS, ATTRIBUTE)                   \
209 do{                                                                           \
210         unsigned long end_time, delta;                                        \
211         int index=LPROCFS_NAMESPACE_ENUM(DEV_CLASS, ATTRIBUTE);               \
212         struct lprofiler_##PROF_CLASS *x=                                     \
213                 (struct lprofiler_##PROF_CLASS*)((OBD)->counters);            \
214         x+=index;                                                             \
215         end_time=lprocfs_util_gettime();                                      \
216         delta=lprocfs_util_getdiff(x->start_time, end_time);                  \
217         if((delta<x->min_time)||(x->min_time==0))x->min_time=delta;           \
218         if(delta>x->max_time)x->max_time=delta;                               \
219         x->sum_time+=delta;                                                   \
220         (x->num_ops)++;                                                       \
221 }while(0)                                                                     \
222
223 /*
224 #define DEV_PROF_END(DEV_CLASS, OBD, PROF_CLASS, ATTRIBUTE)                   \
225 do{                                                                           \
226         __u64 end_time, delta;                                   \
227         int index=LPROCFS_NAMESPACE_ENUM(DEV_CLASS, ATTRIBUTE);               \
228         struct lprofiler_##PROF_CLASS *x=                              \
229                 (struct lprofiler_##PROF_CLASS*)((OBD)->counters);     \
230         x+=index;                                                             \
231         end_time=lprocfs_util_gettime();                                      \
232         delta=lprocfs_util_getdiff(x->start_time, end_time);                  \
233         if((delta<x->min_time)||(x->min_time==0))x->min_time=delta;           \
234         if(delta>x->max_time)x->max_time=delta;                               \
235         x->sum_time+=delta;                                                   \
236         (x->num_ops)++;                                                       \
237 }while(0)                                                                     \
238 */
239 /*
240 #define DEV_PRINT_CNTR(DEV_CLASS, OBD, PROF_CLASS, ATTRIBUTE)                 \
241 do{                                                                           \
242         int index=LPROCFS_NAMESPACE_ENUM(DEV_CLASS, ATTRIBUTE);               \
243         struct lprofiler_##PROF_CLASS *x=                              \
244                 (struct lprofiler_##PROF_CLASS *)&((OBD)->counters);   \
245         x+=index;                                                             \
246         printk("Max_time=%lld(usec)\n", x->max_time);                         \
247         printk("Min_time=%lld(usec)\n", x->min_time);                         \
248         printk("Sum_time=%lld(usec)\n", x->sum_time);                         \
249         printk("Num_ops=%lld\n", x->num_ops);                                 \
250 } while(0)                                                                    \
251 */
252
253
254 /*
255  * This enum is used as an array index into the counts 
256  * that are maintained for the MDS device. The number of
257  * entries here determine the amount of memory allocated
258  * for counters for every instance of this class of
259  * device
260  */
261
262
263 enum {
264         LPROCFS_NAMESPACE_ENUM(mdc, mgmt_setup),
265         LPROCFS_NAMESPACE_ENUM(mdc, mgmt_cleanup),
266         LPROCFS_NAMESPACE_ENUM(mdc, mgmt_connect),
267         LPROCFS_NAMESPACE_ENUM(mdc, mgmt_disconnect),
268         LPROCFS_NAMESPACE_ENUM(mdc, reint),
269         LPROCFS_NAMESPACE_ENUM(mdc, getstatus),
270         LPROCFS_NAMESPACE_ENUM(mdc, getattr),
271         LPROCFS_NAMESPACE_ENUM(mdc, setattr),
272         LPROCFS_NAMESPACE_ENUM(mdc, open),
273         LPROCFS_NAMESPACE_ENUM(mdc, readpage),
274         LPROCFS_NAMESPACE_ENUM(mdc, create),
275         LPROCFS_NAMESPACE_ENUM(mdc, unlink),
276         LPROCFS_NAMESPACE_ENUM(mdc, link),
277         LPROCFS_NAMESPACE_ENUM(mdc, rename),
278         LPROCFS_MAX_ENUM_DIR_MDC
279 };
280
281 enum {
282         LPROCFS_NAMESPACE_ENUM(mds, mgmt_setup),
283         LPROCFS_NAMESPACE_ENUM(mds, mgmt_cleanup),
284         LPROCFS_NAMESPACE_ENUM(mds, mgmt_connect),
285         LPROCFS_NAMESPACE_ENUM(mds, mgmt_disconnect),
286         LPROCFS_NAMESPACE_ENUM(mds, getstatus),
287         LPROCFS_NAMESPACE_ENUM(mds, connect),
288         LPROCFS_NAMESPACE_ENUM(mds, disconnect_callback),
289         LPROCFS_NAMESPACE_ENUM(mds, getattr),
290         LPROCFS_NAMESPACE_ENUM(mds, readpage),
291         LPROCFS_NAMESPACE_ENUM(mds, open),
292         LPROCFS_NAMESPACE_ENUM(mds, close),
293         LPROCFS_NAMESPACE_ENUM(mds, create),
294         LPROCFS_NAMESPACE_ENUM(mds, unlink),
295         LPROCFS_NAMESPACE_ENUM(mds, link),
296         LPROCFS_NAMESPACE_ENUM(mds, rename),
297         LPROCFS_NAMESPACE_ENUM(mds, reint_summary),
298         LPROCFS_NAMESPACE_ENUM(mds, reint_setattr),
299         LPROCFS_NAMESPACE_ENUM(mds, reint_create),
300         LPROCFS_NAMESPACE_ENUM(mds, reint_unlink),
301         LPROCFS_NAMESPACE_ENUM(mds, reint_link),
302         LPROCFS_NAMESPACE_ENUM(mds, reint_rename),
303         LPROCFS_NAMESPACE_ENUM(mds, reint_recreate),
304         LPROCFS_MAX_ENUM_DIR_MDS
305
306 };
307 enum {
308         LPROCFS_NAMESPACE_ENUM(osc, mgmt_setup),
309         LPROCFS_NAMESPACE_ENUM(osc, mgmt_cleanup),
310         LPROCFS_NAMESPACE_ENUM(osc, mgmt_connect),
311         LPROCFS_NAMESPACE_ENUM(osc, mgmt_disconnect),
312         LPROCFS_NAMESPACE_ENUM(osc, create),
313         LPROCFS_NAMESPACE_ENUM(osc, destroy),
314         LPROCFS_NAMESPACE_ENUM(osc, getattr),
315         LPROCFS_NAMESPACE_ENUM(osc, setattr),
316         LPROCFS_NAMESPACE_ENUM(osc, open),
317         LPROCFS_NAMESPACE_ENUM(osc, close),
318         LPROCFS_NAMESPACE_ENUM(osc, brw),
319         LPROCFS_NAMESPACE_ENUM(osc, punch),
320         LPROCFS_NAMESPACE_ENUM(osc, summary),
321         LPROCFS_NAMESPACE_ENUM(osc, cancel),
322         LPROCFS_MAX_ENUM_DIR_OSC
323
324 };
325
326 enum {
327         LPROCFS_NAMESPACE_ENUM(ost, mgmt_setup),
328         LPROCFS_NAMESPACE_ENUM(ost, mgmt_cleanup),
329         LPROCFS_NAMESPACE_ENUM(ost, mgmt_connect),
330         LPROCFS_NAMESPACE_ENUM(ost, mgmt_disconnect),
331         LPROCFS_NAMESPACE_ENUM(ost, create),
332         LPROCFS_NAMESPACE_ENUM(ost, destroy),
333         LPROCFS_NAMESPACE_ENUM(ost, getattr),
334         LPROCFS_NAMESPACE_ENUM(ost, setattr),
335         LPROCFS_NAMESPACE_ENUM(ost, open),
336         LPROCFS_NAMESPACE_ENUM(ost, close),
337         LPROCFS_NAMESPACE_ENUM(ost, brw),
338         LPROCFS_NAMESPACE_ENUM(ost, punch),
339         LPROCFS_NAMESPACE_ENUM(ost, summary),
340         LPROCFS_NAMESPACE_ENUM(ost, cancel),
341         LPROCFS_NAMESPACE_ENUM(ost, getinfo),
342         LPROCFS_MAX_ENUM_DIR_OST
343
344 };
345
346
347 enum {
348         LPROCFS_NAMESPACE_ENUM(lov, mgmt_setup),
349         LPROCFS_NAMESPACE_ENUM(lov, mgmt_cleanup),
350         LPROCFS_NAMESPACE_ENUM(lov, mgmt_connect),
351         LPROCFS_NAMESPACE_ENUM(lov, mgmt_disconnect),
352         LPROCFS_NAMESPACE_ENUM(lov, create),
353         LPROCFS_NAMESPACE_ENUM(lov, destroy),
354         LPROCFS_NAMESPACE_ENUM(lov, getattr),
355         LPROCFS_NAMESPACE_ENUM(lov, setattr),
356         LPROCFS_NAMESPACE_ENUM(lov, open),
357         LPROCFS_NAMESPACE_ENUM(lov, close),
358         LPROCFS_NAMESPACE_ENUM(lov, brw),
359         LPROCFS_NAMESPACE_ENUM(lov, punch),
360         LPROCFS_NAMESPACE_ENUM(lov, summary),
361         LPROCFS_NAMESPACE_ENUM(lov, cancel),
362         LPROCFS_NAMESPACE_ENUM(lov, getinfo),
363         LPROCFS_MAX_ENUM_DIR_LOV
364
365
366 };
367
368 enum {
369         LPROCFS_NAMESPACE_ENUM(obdfilter, mgmt_setup),
370         LPROCFS_NAMESPACE_ENUM(obdfilter, mgmt_cleanup),
371         LPROCFS_NAMESPACE_ENUM(obdfilter, mgmt_connect),
372         LPROCFS_NAMESPACE_ENUM(obdfilter, mgmt_disconnect),
373         LPROCFS_NAMESPACE_ENUM(obdfilter, create),
374         LPROCFS_NAMESPACE_ENUM(obdfilter, destroy),
375         LPROCFS_NAMESPACE_ENUM(obdfilter, getattr),
376         LPROCFS_NAMESPACE_ENUM(obdfilter, setattr),
377         LPROCFS_NAMESPACE_ENUM(obdfilter, open),
378         LPROCFS_NAMESPACE_ENUM(obdfilter, close),
379         LPROCFS_NAMESPACE_ENUM(obdfilter, brw),
380         LPROCFS_NAMESPACE_ENUM(obdfilter, punch),
381         LPROCFS_NAMESPACE_ENUM(obdfilter, summary),
382         LPROCFS_NAMESPACE_ENUM(obdfilter, cancel),
383         LPROCFS_NAMESPACE_ENUM(obdfilter, getinfo),
384         LPROCFS_MAX_ENUM_DIR_OBDFILTER
385
386 };
387
388 enum {
389   
390         LPROCFS_NAMESPACE_ENUM(ldlm, mgmt_setup),
391         LPROCFS_NAMESPACE_ENUM(ldlm, mgmt_cleanup),
392         LPROCFS_NAMESPACE_ENUM(ldlm, mgmt_connect),
393         LPROCFS_NAMESPACE_ENUM(ldlm, mgmt_disconnect),
394         LPROCFS_NAMESPACE_ENUM(ldlm, locks_enqueus),
395         LPROCFS_NAMESPACE_ENUM(ldlm, locks_cancels),
396         LPROCFS_NAMESPACE_ENUM(ldlm, locks_converts),
397         LPROCFS_NAMESPACE_ENUM(ldlm, locks_matches),
398         LPROCFS_MAX_ENUM_DIR_LDLM
399 };
400
401 enum {
402
403         LPROCFS_NAMESPACE_ENUM(ptlrpc, mgmt_setup),
404         LPROCFS_NAMESPACE_ENUM(ptlrpc, mgmt_cleanup),
405         LPROCFS_NAMESPACE_ENUM(ptlrpc, mgmt_connect),
406         LPROCFS_NAMESPACE_ENUM(ptlrpc, mgmt_disconnect),
407         LPROCFS_NAMESPACE_ENUM(ptlrpc, counters),
408         LPROCFS_NAMESPACE_ENUM(ptlrpc, network),
409         LPROCFS_MAX_ENUM_DIR_PTLRPC
410        
411 };
412
413 #define LPROCFS_DIR_INDEX(CLASS, DIR) \
414                          [LPROCFS_NAMESPACE_ENUM(CLASS, DIR)]={#DIR}
415
416 /*
417  * Similar rule for profiling counters
418  */
419
420
421 enum {
422         LPROCFS_NAMESPACE_ENUM(mdc, min_time),
423         LPROCFS_NAMESPACE_ENUM(mdc, max_time),
424         LPROCFS_NAMESPACE_ENUM(mdc, sum_time),
425         LPROCFS_NAMESPACE_ENUM(mdc, num_ops),
426         LPROF_MDC_MAX
427
428
429 };
430 enum {
431         LPROCFS_NAMESPACE_ENUM(mds, min_time),
432         LPROCFS_NAMESPACE_ENUM(mds, max_time),
433         LPROCFS_NAMESPACE_ENUM(mds, sum_time),
434         LPROCFS_NAMESPACE_ENUM(mds, num_ops),
435         LPROF_MDS_MAX
436
437
438 };
439 enum {
440         LPROCFS_NAMESPACE_ENUM(osc, min_time),
441         LPROCFS_NAMESPACE_ENUM(osc, max_time),
442         LPROCFS_NAMESPACE_ENUM(osc, sum_time),
443         LPROCFS_NAMESPACE_ENUM(osc, num_ops),
444         LPROF_OSC_MAX
445
446
447 };
448
449 enum {
450         LPROCFS_NAMESPACE_ENUM(ost, min_time),
451         LPROCFS_NAMESPACE_ENUM(ost, max_time),
452         LPROCFS_NAMESPACE_ENUM(ost, sum_time),
453         LPROCFS_NAMESPACE_ENUM(ost, num_ops),
454         LPROF_OST_MAX
455
456
457 };
458 enum {
459         LPROCFS_NAMESPACE_ENUM(lov, min_time),
460         LPROCFS_NAMESPACE_ENUM(lov, max_time),
461         LPROCFS_NAMESPACE_ENUM(lov, sum_time),
462         LPROCFS_NAMESPACE_ENUM(lov, num_ops),
463         LPROF_LOV_MAX
464
465
466 };
467 enum {
468         LPROCFS_NAMESPACE_ENUM(obdfilter, min_time),
469         LPROCFS_NAMESPACE_ENUM(obdfilter, max_time),
470         LPROCFS_NAMESPACE_ENUM(obdfilter, sum_time),
471         LPROCFS_NAMESPACE_ENUM(obdfilter, num_ops),
472         LPROF_OBDFILTER_MAX
473
474
475 };
476
477
478 enum {
479         LPROCFS_NAMESPACE_ENUM(ldlm, min_time),
480         LPROCFS_NAMESPACE_ENUM(ldlm, max_time),
481         LPROCFS_NAMESPACE_ENUM(ldlm, sum_time),
482         LPROCFS_NAMESPACE_ENUM(ldlm, num_ops),
483         LPROCFS_NAMESPACE_ENUM(ldlm, num_total),
484         LPROCFS_NAMESPACE_ENUM(ldlm, num_zerolatency),
485         LPROCFS_NAMESPACE_ENUM(ldlm, num_zerolatency_inflight),
486         LPROCFS_NAMESPACE_ENUM(ldlm, num_zerolatency_done),
487         LPROCFS_NAMESPACE_ENUM(ldlm, nonzero_mintime),
488         LPROCFS_NAMESPACE_ENUM(ldlm, nonzero_maxtime),
489         LPROCFS_NAMESPACE_ENUM(ldlm, nonzero_sumtime),
490         LPROF_LDLM_MAX
491 };
492
493 enum {
494
495         LPROCFS_NAMESPACE_ENUM(ptlrpc, min_time),
496         LPROCFS_NAMESPACE_ENUM(ptlrpc, max_time),
497         LPROCFS_NAMESPACE_ENUM(ptlrpc, sum_time),
498         LPROCFS_NAMESPACE_ENUM(ptlrpc, num_ops),
499
500         LPROCFS_NAMESPACE_ENUM(ptlrpc, msgs_alloc),
501         LPROCFS_NAMESPACE_ENUM(ptlrpc, msgs_max),
502         LPROCFS_NAMESPACE_ENUM(ptlrpc, recv_count),
503         LPROCFS_NAMESPACE_ENUM(ptlrpc, recv_length),
504         LPROCFS_NAMESPACE_ENUM(ptlrpc, send_count),
505         LPROCFS_NAMESPACE_ENUM(ptlrpc, send_length),
506         LPROCFS_NAMESPACE_ENUM(ptlrpc, portal_kmemory),
507         LPROF_PTLRPC_MAX
508
509 };
510
511
512
513
514 /*
515  * and for groups
516  */
517 #define LPROCFS_ENUM(X) e_##X
518
519 enum {
520         LPROCFS_ENUM(mdc),
521         LPROCFS_ENUM(mds),
522         LPROCFS_ENUM(osc),
523         LPROCFS_ENUM(ost),
524         LPROCFS_ENUM(lov),
525         LPROCFS_ENUM(obdfilter),
526         LPROCFS_ENUM(ldlm),
527         LPROCFS_ENUM(ptlrpc),
528         LPROCFS_GROUP_MAX
529
530 };
531  
532 #define LPROCFS_CNTR_INDEX(CLASS, NAME) \
533                    [LPROCFS_NAMESPACE_ENUM(CLASS, NAME)]={#NAME}
534
535 #define LPROCFS_GROUP_CREATE(CLASS) \
536       [LPROCFS_ENUM(CLASS)]={#CLASS, dir_##CLASS##_index, prof_##CLASS##_index}
537
538 /*
539  * OBD Namespace API: Obtain the namespace group index, given a name
540  */
541 int lprocfs_get_nm(char* name, 
542                    lprocfs_obd_nm_t* collection);
543
544
545
546 /*
547  * OBD device APIs
548  */
549
550 int lprocfs_reg_dev(struct obd_device* device, 
551                          lprocfs_group_t* namespace, 
552                          unsigned int cnt_struct_size);
553
554 int lprocfs_dereg_dev(struct obd_device* device);
555
556 /*
557  * Connections API
558  */
559 int lprocfs_reg_conn(unsigned int conn_number, 
560                           struct lprocfs_conn_namespace* namespace);
561 int lprocfs_dereg_conn(unsigned int conn_number);
562
563 /*
564  * Import/Export APIs
565  */
566 int lprocfs_add_export(unsigned int conn_number, 
567                        struct obd_device* device);
568 int lprocfs_add_import(unsigned int conn_number, 
569                        struct obd_device* device);
570 int lprocfs_remove_export(unsigned int conn_number, 
571                           struct obd_device* device);
572 int lprocfs_remove_import(unsigned int conn_number, 
573                           struct obd_device* device);
574
575 /*
576  * Utility functions
577  */
578
579 struct proc_dir_entry* lprocfs_add_dir(struct proc_dir_entry* root, 
580                                        const char* name,            
581                                        const char* tok,             
582                                        unsigned int* escape);
583
584
585 struct proc_dir_entry* lprocfs_mkdir(const char* dname, 
586                                      struct proc_dir_entry *parent);
587
588
589 struct proc_dir_entry* lprocfs_bfs_srch(struct proc_dir_entry* root, 
590                                           const char* name);
591  
592 struct proc_dir_entry* lprocfs_srch(struct proc_dir_entry* head, 
593                                     const char* name);
594
595 int lprocfs_link_dir_counters(struct obd_device* device, 
596                               struct proc_dir_entry* this_dev_root, 
597                               lprocfs_group_t* namespace, 
598                               unsigned int cnt_struct_size, 
599                               unsigned int class_array_index);
600
601 int lprocfs_create_dir_namespace(struct proc_dir_entry* this_dev_root, 
602                                  lprocfs_group_t* namespace, 
603                                  unsigned int *num_dirs);
604
605 int lprocfs_getclass_idx(struct groupspace_index* group, 
606                          const char* classname);
607 struct proc_dir_entry* lprocfs_mkinitdir(struct obd_device* device);
608 int lprocfs_get_idx(struct namespace_index* class, const char* dir_name);
609 unsigned int lprocfs_add_var(struct obd_device* device, 
610                              struct proc_dir_entry* root, 
611                              lprocfs_vars_t* variable, 
612                              int dir_arr_index, 
613                              int cnt_arr_index, 
614                              unsigned int cnt_arr_size, 
615                              lprofilers_e type);
616
617
618 void lprocfs_remove_all(struct proc_dir_entry* root);
619
620 /*
621  * List of read/write functions that will implement reading
622  * or writing to counters/other variables from userland
623  * processes. Note that the definition allows as many different
624  * functions to be defined as there are counter-variables.
625  * In practice, however, the module implementor is expected
626  * to have a different function only when the variable types are
627  * different, for e.g counter types will have one read/write
628  * function, while strings will have another.
629  * 
630  */
631
632 int lprocfs_ll_rd(char* page, char **start, off_t off,
633                  int count, int *eof, void *data);
634 int lprocfs_ll_wr(struct file* file, const char *buffer,
635                   unsigned long count, void *data);
636
637 int rd_other(char* page, char **start, off_t off,
638              int count, int *eof, void *data);
639 int wr_other(struct file* file, const char *buffer,
640              unsigned long count, void *data);
641
642 int rd_string(char* page, char **start, off_t off,
643               int count, int *eof, void *data);
644 int wr_string(struct file* file, const char *buffer,
645               unsigned long count, void *data);
646
647
648
649
650 #else /* LProcFS not compiled */
651
652 #define DEV_PROF_START(DEV_CLASS, OBD, PROF_CLASS, ATTRIBUTE) 0
653 #define DEV_PROF_END(DEV_CLASS, OBD, PROF_CLASS, ATTRIBUTE) 0
654 #define DEV_PRINT_CNTR(DEV_CLASS, OBD, PROF_CLASS, ATTRIBUTE) 0
655
656 static inline int lprocfs_get_nm(char* name,
657                                  lprocfs_obd_nm_t* collection)
658  { 
659          return -1; 
660  }
661 static inline int lprocfs_reg_dev(struct obd_device* device, 
662                                   lprocfs_group_t* namespace, 
663                                   unsigned int cnt_struct_size) 
664
665         return 0; 
666 }
667 static inline int lprocfs_dereg_dev(struct obd_device* device) 
668
669         return LPROCFS_SUCCESS; 
670 }
671 static inline int lprocfs_reg_conn(unsigned int conn_number, 
672                                    struct lprocfs_conn_namespace* nm) 
673
674         return 0; 
675 }
676 static inline int lprocfs_dereg_conn(unsigned int conn_number) 
677
678         return 0; 
679 }
680 static inline int lprocfs_add_export(unsigned int conn_number, 
681                                      struct obd_device* device)
682
683         return 0; 
684 }
685 static inline int lprocfs_add_import(unsigned int conn_number, 
686                                      struct obd_device* device)
687
688         return 0; 
689 }
690 static inline int lprocfs_remove_export(unsigned int conn_number, 
691                                         struct obd_device* device)
692
693         return 0; 
694 }
695 static inline int lprocfs_remove_import(unsigned int conn_number, 
696                                         struct obd_device* device)
697
698         return 0; 
699 }
700
701
702 #endif /* LPROCFS_EXISTS */
703
704 #endif /* __LPROCFS_H__ */