OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [fs/] [reiserfs/] [procfs.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* -*- linux-c -*- */
2
/* fs/reiserfs/procfs.c */
3
/*
4
 * Copyright 2000-2002 by Hans Reiser, licensing governed by reiserfs/README
5
 */
6
 
7
/* proc info support a la one created by Sizif@Botik.RU for PGC */
8
 
9
/* $Id: procfs.c,v 1.1.1.1 2004-04-15 01:10:47 phoenix Exp $ */
10
 
11
#include <linux/config.h>
12
#include <linux/module.h>
13
#include <linux/sched.h>
14
#include <asm/uaccess.h>
15
#include <linux/reiserfs_fs.h>
16
#include <linux/reiserfs_fs_sb.h>
17
#include <linux/smp_lock.h>
18
#include <linux/locks.h>
19
#include <linux/init.h>
20
#include <linux/proc_fs.h>
21
 
22
#if defined( REISERFS_PROC_INFO )
23
 
24
/*
25
 * LOCKING:
26
 *
27
 * We rely on new Alexander Viro's super-block locking.
28
 *
29
 */
30
 
31
static struct super_block *procinfo_prologue( kdev_t dev )
32
{
33
        struct super_block *result;
34
 
35
        /* get super-block by device */
36
        result = get_super( dev );
37
        if( result != NULL ) {
38
                if( !reiserfs_is_super( result ) ) {
39
                        printk( KERN_DEBUG "reiserfs: procfs-52: "
40
                                "non-reiserfs super found\n" );
41
                        drop_super( result );
42
                        result = NULL;
43
                }
44
        } else
45
                printk( KERN_DEBUG "reiserfs: procfs-74: "
46
                        "race between procinfo and umount\n" );
47
        return result;
48
}
49
 
50
int procinfo_epilogue( struct super_block *super )
51
{
52
        drop_super( super );
53
        return 0;
54
}
55
 
56
int reiserfs_proc_tail( int len, char *buffer, char **start,
57
                        off_t offset, int count, int *eof )
58
{
59
        /* this is black procfs magic */
60
        if( offset >= len ) {
61
                *start = buffer;
62
                *eof = 1;
63
                return 0;
64
        }
65
        *start = buffer + offset;
66
        if( ( len -= offset ) > count ) {
67
                return count;
68
        }
69
        *eof = 1;
70
        return len;
71
}
72
 
73
int reiserfs_version_in_proc( char *buffer, char **start, off_t offset,
74
                              int count, int *eof, void *data )
75
{
76
        int len = 0;
77
        struct super_block *sb;
78
        char *format;
79
 
80
        sb = procinfo_prologue( ( kdev_t ) ( long ) data );
81
        if( sb == NULL )
82
                return -ENOENT;
83
        if ( sb->u.reiserfs_sb.s_properties & (1 << REISERFS_3_6) ) {
84
                format = "3.6";
85
        } else if ( sb->u.reiserfs_sb.s_properties & (1 << REISERFS_3_5) ) {
86
                format = "3.5";
87
        } else {
88
                format = "unknown";
89
        }
90
        len += sprintf( &buffer[ len ], "%s format\twith checks %s\n",
91
                        format,
92
#if defined( CONFIG_REISERFS_CHECK )
93
                        "on"
94
#else
95
                        "off"
96
#endif
97
                );
98
        procinfo_epilogue( sb );
99
        return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
100
}
101
 
102
int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset,
103
                                     int count, int *eof, void *data )
104
{
105
        int len = 0;
106
        return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
107
}
108
 
109
#define SF( x ) ( r -> x )
110
#define SFP( x ) SF( s_proc_info_data.x )
111
#define SFPL( x ) SFP( x[ level ] )
112
#define SFPF( x ) SFP( scan_bitmap.x )
113
#define SFPJ( x ) SFP( journal.x )
114
 
115
#define D2C( x ) le16_to_cpu( x )
116
#define D4C( x ) le32_to_cpu( x )
117
#define DF( x ) D2C( rs -> s_v1.x )
118
#define DFL( x ) D4C( rs -> s_v1.x )
119
#define DP( x ) D2C( rs -> x )
120
#define DPL( x ) D4C( rs -> x )
121
 
122
#define objectid_map( s, rs ) (old_format_only (s) ?                            \
123
                         (__u32 *)((struct reiserfs_super_block_v1 *)rs + 1) :  \
124
                         (__u32 *)(rs + 1))
125
#define MAP( i ) D4C( objectid_map( sb, rs )[ i ] )
126
 
127
#define DJF( x ) le32_to_cpu( rs -> x )
128
#define DJV( x ) le32_to_cpu( s_v1 -> x )
129
#define DJP( x ) le32_to_cpu( jp -> x ) 
130
#define JF( x ) ( r -> s_journal -> x )
131
 
132
int reiserfs_super_in_proc( char *buffer, char **start, off_t offset,
133
                            int count, int *eof, void *data )
134
{
135
        struct super_block *sb;
136
        struct reiserfs_sb_info *r;
137
        int len = 0;
138
 
139
        sb = procinfo_prologue( ( kdev_t ) ( long ) data );
140
        if( sb == NULL )
141
                return -ENOENT;
142
        r = &sb->u.reiserfs_sb;
143
        len += sprintf( &buffer[ len ],
144
                        "state: \t%s\n"
145
                        "mount options: \t%s%s%s%s%s%s%s%s%s%s%s%s\n"
146
                        "gen. counter: \t%i\n"
147
                        "s_kmallocs: \t%i\n"
148
                        "s_disk_reads: \t%i\n"
149
                        "s_disk_writes: \t%i\n"
150
                        "s_fix_nodes: \t%i\n"
151
                        "s_do_balance: \t%i\n"
152
                        "s_unneeded_left_neighbor: \t%i\n"
153
                        "s_good_search_by_key_reada: \t%i\n"
154
                        "s_bmaps: \t%i\n"
155
                        "s_bmaps_without_search: \t%i\n"
156
                        "s_direct2indirect: \t%i\n"
157
                        "s_indirect2direct: \t%i\n"
158
                        "\n"
159
                        "max_hash_collisions: \t%i\n"
160
 
161
                        "breads: \t%lu\n"
162
                        "bread_misses: \t%lu\n"
163
 
164
                        "search_by_key: \t%lu\n"
165
                        "search_by_key_fs_changed: \t%lu\n"
166
                        "search_by_key_restarted: \t%lu\n"
167
 
168
                        "insert_item_restarted: \t%lu\n"
169
                        "paste_into_item_restarted: \t%lu\n"
170
                        "cut_from_item_restarted: \t%lu\n"
171
                        "delete_solid_item_restarted: \t%lu\n"
172
                        "delete_item_restarted: \t%lu\n"
173
 
174
                        "leaked_oid: \t%lu\n"
175
                        "leaves_removable: \t%lu\n",
176
 
177
                        SF( s_mount_state ) == REISERFS_VALID_FS ?
178
                        "REISERFS_VALID_FS" : "REISERFS_ERROR_FS",
179
                        reiserfs_r5_hash( sb ) ? "FORCE_R5 " : "",
180
                        reiserfs_rupasov_hash( sb ) ? "FORCE_RUPASOV " : "",
181
                        reiserfs_tea_hash( sb ) ? "FORCE_TEA " : "",
182
                        reiserfs_hash_detect( sb ) ? "DETECT_HASH " : "",
183
                        reiserfs_no_border( sb ) ? "NO_BORDER " : "BORDER ",
184
                        reiserfs_no_unhashed_relocation( sb ) ? "NO_UNHASHED_RELOCATION " : "",
185
                        reiserfs_hashed_relocation( sb ) ? "UNHASHED_RELOCATION " : "",
186
                        reiserfs_test4( sb ) ? "TEST4 " : "",
187
                        have_large_tails( sb ) ? "TAILS " : have_small_tails(sb)?"SMALL_TAILS ":"NO_TAILS ",
188
                        replay_only( sb ) ? "REPLAY_ONLY " : "",
189
                        reiserfs_dont_log( sb ) ? "DONT_LOG " : "LOG ",
190
                        convert_reiserfs( sb ) ? "CONV " : "",
191
 
192
                        atomic_read( &r -> s_generation_counter ),
193
                        SF( s_kmallocs ),
194
                        SF( s_disk_reads ),
195
                        SF( s_disk_writes ),
196
                        SF( s_fix_nodes ),
197
                        SF( s_do_balance ),
198
                        SF( s_unneeded_left_neighbor ),
199
                        SF( s_good_search_by_key_reada ),
200
                        SF( s_bmaps ),
201
                        SF( s_bmaps_without_search ),
202
                        SF( s_direct2indirect ),
203
                        SF( s_indirect2direct ),
204
                        SFP( max_hash_collisions ),
205
                        SFP( breads ),
206
                        SFP( bread_miss ),
207
                        SFP( search_by_key ),
208
                        SFP( search_by_key_fs_changed ),
209
                        SFP( search_by_key_restarted ),
210
 
211
                        SFP( insert_item_restarted ),
212
                        SFP( paste_into_item_restarted ),
213
                        SFP( cut_from_item_restarted ),
214
                        SFP( delete_solid_item_restarted ),
215
                        SFP( delete_item_restarted ),
216
 
217
                        SFP( leaked_oid ),
218
                        SFP( leaves_removable ) );
219
 
220
        procinfo_epilogue( sb );
221
        return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
222
}
223
 
224
int reiserfs_per_level_in_proc( char *buffer, char **start, off_t offset,
225
                                int count, int *eof, void *data )
226
{
227
        struct super_block *sb;
228
        struct reiserfs_sb_info *r;
229
        int len = 0;
230
        int level;
231
 
232
        sb = procinfo_prologue( ( kdev_t ) ( long ) data );
233
        if( sb == NULL )
234
                return -ENOENT;
235
        r = &sb->u.reiserfs_sb;
236
 
237
        len += sprintf( &buffer[ len ],
238
                        "level\t"
239
                        "     balances"
240
                        " [sbk:  reads"
241
                        "   fs_changed"
242
                        "   restarted]"
243
                        "   free space"
244
                        "        items"
245
                        "   can_remove"
246
                        "         lnum"
247
                        "         rnum"
248
                        "       lbytes"
249
                        "       rbytes"
250
                        "     get_neig"
251
                        " get_neig_res"
252
                        "  need_l_neig"
253
                        "  need_r_neig"
254
                        "\n"
255
 
256
                );
257
 
258
        for( level = 0 ; level < MAX_HEIGHT ; ++ level ) {
259
                if( len > PAGE_SIZE - 240 ) {
260
                        len += sprintf( &buffer[ len ], "... and more\n" );
261
                        break;
262
                }
263
                len += sprintf( &buffer[ len ],
264
                                "%i\t"
265
                                " %12lu"
266
                                " %12lu"
267
                                " %12lu"
268
                                " %12lu"
269
                                " %12lu"
270
                                " %12lu"
271
                                " %12lu"
272
                                " %12li"
273
                                " %12li"
274
                                " %12li"
275
                                " %12li"
276
                                " %12lu"
277
                                " %12lu"
278
                                " %12lu"
279
                                " %12lu"
280
                                "\n",
281
                                level,
282
                                SFPL( balance_at ),
283
                                SFPL( sbk_read_at ),
284
                                SFPL( sbk_fs_changed ),
285
                                SFPL( sbk_restarted ),
286
                                SFPL( free_at ),
287
                                SFPL( items_at ),
288
                                SFPL( can_node_be_removed ),
289
                                SFPL( lnum ),
290
                                SFPL( rnum ),
291
                                SFPL( lbytes ),
292
                                SFPL( rbytes ),
293
                                SFPL( get_neighbors ),
294
                                SFPL( get_neighbors_restart ),
295
                                SFPL( need_l_neighbor ),
296
                                SFPL( need_r_neighbor )
297
                        );
298
        }
299
 
300
        procinfo_epilogue( sb );
301
        return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
302
}
303
 
304
int reiserfs_bitmap_in_proc( char *buffer, char **start, off_t offset,
305
                             int count, int *eof, void *data )
306
{
307
        struct super_block *sb;
308
        struct reiserfs_sb_info *r = &sb->u.reiserfs_sb;
309
        int len = 0;
310
 
311
        sb = procinfo_prologue( ( kdev_t ) ( long ) data );
312
        if( sb == NULL )
313
                return -ENOENT;
314
        r = &sb->u.reiserfs_sb;
315
 
316
        len += sprintf( &buffer[ len ], "free_block: %lu\n"
317
                        "  scan_bitmap:"
318
                        "          wait"
319
                        "          bmap"
320
                        "         retry"
321
                        "        stolen"
322
                        "  journal_hint"
323
                        "journal_nohint"
324
                        "\n"
325
                        " %14lu"
326
                        " %14lu"
327
                        " %14lu"
328
                        " %14lu"
329
                        " %14lu"
330
                        " %14lu"
331
                        " %14lu"
332
                        "\n",
333
                        SFP( free_block ),
334
                        SFPF( call ),
335
                        SFPF( wait ),
336
                        SFPF( bmap ),
337
                        SFPF( retry ),
338
                        SFPF( stolen ),
339
                        SFPF( in_journal_hint ),
340
                        SFPF( in_journal_nohint ) );
341
 
342
        procinfo_epilogue( sb );
343
        return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
344
}
345
 
346
int reiserfs_on_disk_super_in_proc( char *buffer, char **start, off_t offset,
347
                                    int count, int *eof, void *data )
348
{
349
        struct super_block *sb;
350
        struct reiserfs_sb_info *sb_info;
351
        struct reiserfs_super_block *rs;
352
        int hash_code;
353
        int len = 0;
354
 
355
        sb = procinfo_prologue( ( kdev_t ) ( long ) data );
356
        if( sb == NULL )
357
                return -ENOENT;
358
        sb_info = &sb->u.reiserfs_sb;
359
        rs = sb_info -> s_rs;
360
        hash_code = DFL( s_hash_function_code );
361
 
362
        len += sprintf( &buffer[ len ],
363
                        "block_count: \t%i\n"
364
                        "free_blocks: \t%i\n"
365
                        "root_block: \t%i\n"
366
                        "blocksize: \t%i\n"
367
                        "oid_maxsize: \t%i\n"
368
                        "oid_cursize: \t%i\n"
369
                        "umount_state: \t%i\n"
370
                        "magic: \t%10.10s\n"
371
                        "fs_state: \t%i\n"
372
                        "hash: \t%s\n"
373
                        "tree_height: \t%i\n"
374
                        "bmap_nr: \t%i\n"
375
                        "version: \t%i\n"
376
                        "reserved_for_journal: \t%i\n"
377
                        "inode_generation: \t%i\n"
378
                        "flags: \t%x[%s]\n",
379
 
380
                        DFL( s_block_count ),
381
                        DFL( s_free_blocks ),
382
                        DFL( s_root_block ),
383
                        DF( s_blocksize ),
384
                        DF( s_oid_maxsize ),
385
                        DF( s_oid_cursize ),
386
                        DF( s_umount_state ),
387
                        rs -> s_v1.s_magic,
388
                        DF( s_fs_state ),
389
                        hash_code == TEA_HASH ? "tea" :
390
                        ( hash_code == YURA_HASH ) ? "rupasov" :
391
                        ( hash_code == R5_HASH ) ? "r5" :
392
                        ( hash_code == UNSET_HASH ) ? "unset" : "unknown",
393
                        DF( s_tree_height ),
394
                        DF( s_bmap_nr ),
395
                        DF( s_version ),
396
                        DF( s_reserved_for_journal ),
397
                        DPL( s_inode_generation ),
398
                        DPL( s_flags ),
399
                        (DPL( s_flags ) & reiserfs_attrs_cleared
400
                        ? "attrs_cleared" : "" ));
401
 
402
        procinfo_epilogue( sb );
403
        return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
404
}
405
 
406
int reiserfs_oidmap_in_proc( char *buffer, char **start, off_t offset,
407
                             int count, int *eof, void *data )
408
{
409
        struct super_block *sb;
410
        struct reiserfs_sb_info *sb_info;
411
        struct reiserfs_super_block *rs;
412
        int i;
413
        unsigned int mapsize;
414
        unsigned long total_used;
415
        int len = 0;
416
        int exact;
417
 
418
        sb = procinfo_prologue( ( kdev_t ) ( long ) data );
419
        if( sb == NULL )
420
                return -ENOENT;
421
        sb_info = &sb->u.reiserfs_sb;
422
        rs = sb_info -> s_rs;
423
        mapsize = le16_to_cpu( rs -> s_v1.s_oid_cursize );
424
        total_used = 0;
425
 
426
        for( i = 0 ; i < mapsize ; ++i ) {
427
                __u32 right;
428
 
429
                right = ( i == mapsize - 1 ) ? MAX_KEY_OBJECTID : MAP( i + 1 );
430
                len += sprintf( &buffer[ len ], "%s: [ %x .. %x )\n",
431
                                ( i & 1 ) ? "free" : "used", MAP( i ), right );
432
                if( ! ( i & 1 ) ) {
433
                        total_used += right - MAP( i );
434
                }
435
                if( len > PAGE_SIZE - 100 ) {
436
                        len += sprintf( &buffer[ len ], "... and more\n" );
437
                        break;
438
                }
439
        }
440
#if defined( REISERFS_USE_OIDMAPF )
441
        if( sb_info -> oidmap.use_file && ( sb_info -> oidmap.mapf != NULL ) ) {
442
                loff_t size;
443
 
444
                size = sb_info -> oidmap.mapf -> f_dentry -> d_inode -> i_size;
445
                total_used += size / sizeof( reiserfs_oidinterval_d_t );
446
                exact = 1;
447
        } else
448
#endif
449
        {
450
                exact = ( i == mapsize );
451
        }
452
        len += sprintf( &buffer[ len ], "total: \t%i [%i/%i] used: %lu [%s]\n",
453
                        i,
454
                        mapsize, le16_to_cpu( rs -> s_v1.s_oid_maxsize ),
455
                        total_used, exact ? "exact" : "estimation" );
456
 
457
        procinfo_epilogue( sb );
458
        return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
459
}
460
 
461
int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset,
462
                              int count, int *eof, void *data )
463
{
464
        struct super_block *sb;
465
        struct reiserfs_sb_info *r;
466
        struct reiserfs_super_block *rs;
467
        struct journal_params *jp;
468
        int len = 0;
469
 
470
        sb = procinfo_prologue( ( kdev_t ) ( long ) data );
471
        if( sb == NULL )
472
                return -ENOENT;
473
        r = &sb->u.reiserfs_sb;
474
        rs = r -> s_rs;
475
        jp = &rs->s_v1.s_journal;
476
 
477
        len += sprintf( &buffer[ len ],
478
                        /* on-disk fields */
479
                        "jp_journal_1st_block: \t%i\n"
480
                        "jp_journal_dev: \t%s[%x]\n"
481
                        "jp_journal_size: \t%i\n"
482
                        "jp_journal_trans_max: \t%i\n"
483
                        "jp_journal_magic: \t%i\n"
484
                        "jp_journal_max_batch: \t%i\n"
485
                        "jp_journal_max_commit_age: \t%i\n"
486
                        "jp_journal_max_trans_age: \t%i\n"
487
                        /* incore fields */
488
                        "j_1st_reserved_block: \t%i\n"
489
                        "j_state: \t%li\n"
490
                        "j_trans_id: \t%lu\n"
491
                        "j_mount_id: \t%lu\n"
492
                        "j_start: \t%lu\n"
493
                        "j_len: \t%lu\n"
494
                        "j_len_alloc: \t%lu\n"
495
                        "j_wcount: \t%i\n"
496
                        "j_bcount: \t%lu\n"
497
                        "j_first_unflushed_offset: \t%lu\n"
498
                        "j_last_flush_trans_id: \t%lu\n"
499
                        "j_trans_start_time: \t%li\n"
500
                        "j_journal_list_index: \t%i\n"
501
                        "j_list_bitmap_index: \t%i\n"
502
                        "j_must_wait: \t%i\n"
503
                        "j_next_full_flush: \t%i\n"
504
                        "j_next_async_flush: \t%i\n"
505
                        "j_cnode_used: \t%i\n"
506
                        "j_cnode_free: \t%i\n"
507
                        "\n"
508
                        /* reiserfs_proc_info_data_t.journal fields */
509
                        "in_journal: \t%12lu\n"
510
                        "in_journal_bitmap: \t%12lu\n"
511
                        "in_journal_reusable: \t%12lu\n"
512
                        "lock_journal: \t%12lu\n"
513
                        "lock_journal_wait: \t%12lu\n"
514
                        "journal_begin: \t%12lu\n"
515
                        "journal_relock_writers: \t%12lu\n"
516
                        "journal_relock_wcount: \t%12lu\n"
517
                        "mark_dirty: \t%12lu\n"
518
                        "mark_dirty_already: \t%12lu\n"
519
                        "mark_dirty_notjournal: \t%12lu\n"
520
                        "restore_prepared: \t%12lu\n"
521
                        "prepare: \t%12lu\n"
522
                        "prepare_retry: \t%12lu\n",
523
 
524
                        DJP( jp_journal_1st_block ),
525
                        DJP( jp_journal_dev ) == 0 ? "none" : bdevname(to_kdev_t(DJP( jp_journal_dev ))),
526
                        DJP( jp_journal_dev ),
527
                        DJP( jp_journal_size ),
528
                        DJP( jp_journal_trans_max ),
529
                        DJP( jp_journal_magic ),
530
                        DJP( jp_journal_max_batch ),
531
                        DJP( jp_journal_max_commit_age ),
532
                        DJP( jp_journal_max_trans_age ),
533
 
534
                        JF( j_1st_reserved_block ),
535
                        JF( j_state ),
536
                        JF( j_trans_id ),
537
                        JF( j_mount_id ),
538
                        JF( j_start ),
539
                        JF( j_len ),
540
                        JF( j_len_alloc ),
541
                        atomic_read( & r -> s_journal -> j_wcount ),
542
                        JF( j_bcount ),
543
                        JF( j_first_unflushed_offset ),
544
                        JF( j_last_flush_trans_id ),
545
                        JF( j_trans_start_time ),
546
                        JF( j_journal_list_index ),
547
                        JF( j_list_bitmap_index ),
548
                        JF( j_must_wait ),
549
                        JF( j_next_full_flush ),
550
                        JF( j_next_async_flush ),
551
                        JF( j_cnode_used ),
552
                        JF( j_cnode_free ),
553
 
554
                        SFPJ( in_journal ),
555
                        SFPJ( in_journal_bitmap ),
556
                        SFPJ( in_journal_reusable ),
557
                        SFPJ( lock_journal ),
558
                        SFPJ( lock_journal_wait ),
559
                        SFPJ( journal_being ),
560
                        SFPJ( journal_relock_writers ),
561
                        SFPJ( journal_relock_wcount ),
562
                        SFPJ( mark_dirty ),
563
                        SFPJ( mark_dirty_already ),
564
                        SFPJ( mark_dirty_notjournal ),
565
                        SFPJ( restore_prepared ),
566
                        SFPJ( prepare ),
567
                        SFPJ( prepare_retry )
568
                );
569
 
570
        procinfo_epilogue( sb );
571
        return reiserfs_proc_tail( len, buffer, start, offset, count, eof );
572
}
573
 
574
 
575
static struct proc_dir_entry *proc_info_root = NULL;
576
static const char *proc_info_root_name = "fs/reiserfs";
577
 
578
int reiserfs_proc_info_init( struct super_block *sb )
579
{
580
        spin_lock_init( & __PINFO( sb ).lock );
581
        sb->u.reiserfs_sb.procdir = proc_mkdir( bdevname( sb -> s_dev ),
582
                                                proc_info_root );
583
        if( sb->u.reiserfs_sb.procdir ) {
584
                sb->u.reiserfs_sb.procdir -> owner = THIS_MODULE;
585
                return 0;
586
        }
587
        reiserfs_warning( sb, "reiserfs: cannot create /proc/%s/%s\n",
588
                          proc_info_root_name, bdevname( sb -> s_dev ) );
589
        return 1;
590
}
591
 
592
 
593
int reiserfs_proc_info_done( struct super_block *sb )
594
{
595
        spin_lock( & __PINFO( sb ).lock );
596
        __PINFO( sb ).exiting = 1;
597
        spin_unlock( & __PINFO( sb ).lock );
598
        if ( proc_info_root ) {
599
                remove_proc_entry( bdevname( sb -> s_dev ), proc_info_root );
600
                sb->u.reiserfs_sb.procdir = NULL;
601
        }
602
        return 0;
603
}
604
 
605
/* Create /proc/fs/reiserfs/DEV/name and attach read procedure @func
606
   to it.  Other parts of reiserfs use this function to make their
607
   per-device statistics available via /proc */
608
 
609
struct proc_dir_entry *reiserfs_proc_register( struct super_block *sb,
610
                                               char *name, read_proc_t *func )
611
{
612
        return ( sb->u.reiserfs_sb.procdir ) ? create_proc_read_entry
613
                ( name, 0, sb->u.reiserfs_sb.procdir, func,
614
                  ( void * ) ( long ) sb -> s_dev ) : NULL;
615
}
616
 
617
void reiserfs_proc_unregister( struct super_block *sb, const char *name )
618
{
619
        remove_proc_entry( name, sb->u.reiserfs_sb.procdir );
620
}
621
 
622
struct proc_dir_entry *reiserfs_proc_register_global( char *name,
623
                                                      read_proc_t *func )
624
{
625
        return ( proc_info_root ) ? create_proc_read_entry( name, 0,
626
                                                            proc_info_root,
627
                                                            func, NULL ) : NULL;
628
}
629
 
630
void reiserfs_proc_unregister_global( const char *name )
631
{
632
        remove_proc_entry( name, proc_info_root );
633
}
634
 
635
int reiserfs_proc_info_global_init( void )
636
{
637
        if( proc_info_root == NULL ) {
638
                proc_info_root = proc_mkdir( proc_info_root_name, 0 );
639
                if( proc_info_root ) {
640
                        proc_info_root -> owner = THIS_MODULE;
641
                } else {
642
                        reiserfs_warning( NULL, "reiserfs: cannot create /proc/%s\n",
643
                                          proc_info_root_name );
644
                        return 1;
645
                }
646
        }
647
        return 0;
648
}
649
 
650
int reiserfs_proc_info_global_done( void )
651
{
652
        if ( proc_info_root != NULL ) {
653
                proc_info_root = NULL;
654
                remove_proc_entry( proc_info_root_name, 0 );
655
        }
656
        return 0;
657
}
658
 
659
/* REISERFS_PROC_INFO */
660
#else
661
 
662
int reiserfs_proc_info_init( struct super_block *sb ) { return 0; }
663
int reiserfs_proc_info_done( struct super_block *sb ) { return 0; }
664
 
665
struct proc_dir_entry *reiserfs_proc_register( struct super_block *sb,
666
                                               char *name,
667
                                               read_proc_t *func )
668
{ return NULL; }
669
 
670
void reiserfs_proc_unregister( struct super_block *sb, const char *name )
671
{;}
672
 
673
struct proc_dir_entry *reiserfs_proc_register_global( char *name,
674
                                                      read_proc_t *func )
675
{ return NULL; }
676
 
677
void reiserfs_proc_unregister_global( const char *name ) {;}
678
 
679
int reiserfs_proc_info_global_init( void ) { return 0; }
680
int reiserfs_proc_info_global_done( void ) { return 0; }
681
 
682
int reiserfs_global_version_in_proc( char *buffer, char **start,
683
                                     off_t offset,
684
                                     int count, int *eof, void *data )
685
{ return 0; }
686
 
687
int reiserfs_version_in_proc( char *buffer, char **start, off_t offset,
688
                              int count, int *eof, void *data )
689
{ return 0; }
690
 
691
int reiserfs_super_in_proc( char *buffer, char **start, off_t offset,
692
                            int count, int *eof, void *data )
693
{ return 0; }
694
 
695
int reiserfs_per_level_in_proc( char *buffer, char **start, off_t offset,
696
                                int count, int *eof, void *data )
697
{ return 0; }
698
 
699
int reiserfs_bitmap_in_proc( char *buffer, char **start, off_t offset,
700
                             int count, int *eof, void *data )
701
{ return 0; }
702
 
703
int reiserfs_on_disk_super_in_proc( char *buffer, char **start, off_t offset,
704
                                    int count, int *eof, void *data )
705
{ return 0; }
706
 
707
int reiserfs_oidmap_in_proc( char *buffer, char **start, off_t offset,
708
                             int count, int *eof, void *data )
709
{ return 0; }
710
 
711
int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset,
712
                              int count, int *eof, void *data )
713
{ return 0; }
714
 
715
/* REISERFS_PROC_INFO */
716
#endif
717
 
718
/*
719
 * $Log: not supported by cvs2svn $
720
 * Revision 1.1.8.2  2001/07/15 17:08:42  god
721
 *  . use get_super() in procfs.c
722
 *  . remove remove_save_link() from reiserfs_do_truncate()
723
 *
724
 * I accept terms and conditions stated in the Legal Agreement
725
 * (available at http://www.namesys.com/legalese.html)
726
 *
727
 * Revision 1.1.8.1  2001/07/11 16:48:50  god
728
 * proc info support
729
 *
730
 * I accept terms and conditions stated in the Legal Agreement
731
 * (available at http://www.namesys.com/legalese.html)
732
 *
733
 */
734
 
735
/*
736
 * Make Linus happy.
737
 * Local variables:
738
 * c-indentation-style: "K&R"
739
 * mode-name: "LC"
740
 * c-basic-offset: 8
741
 * tab-width: 8
742
 * End:
743
 */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.