nfsd4: implement reclaim_complete
[safe/jmp/linux-2.6] / fs / reiserfs / procfs.c
index fc2f43c..7a99811 100644 (file)
@@ -8,21 +8,15 @@
 
 /* proc info support a la one created by Sizif@Botik.RU for PGC */
 
-/* $Id: procfs.c,v 1.1.8.2 2001/07/15 17:08:42 god Exp $ */
-
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/time.h>
 #include <linux/seq_file.h>
 #include <asm/uaccess.h>
 #include <linux/reiserfs_fs.h>
 #include <linux/reiserfs_fs_sb.h>
-#include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <linux/proc_fs.h>
 
-#if defined( REISERFS_PROC_INFO )
-
 /*
  * LOCKING:
  *
@@ -52,14 +46,6 @@ static int show_version(struct seq_file *m, struct super_block *sb)
        return 0;
 }
 
-int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
-                                   int count, int *eof, void *data)
-{
-       *start = buffer;
-       *eof = 1;
-       return 0;
-}
-
 #define SF( x ) ( r -> x )
 #define SFP( x ) SF( s_proc_info_data.x )
 #define SFPL( x ) SFP( x[ level ] )
@@ -88,7 +74,6 @@ static int show_super(struct seq_file *m, struct super_block *sb)
        seq_printf(m, "state: \t%s\n"
                   "mount options: \t%s%s%s%s%s%s%s%s%s%s%s\n"
                   "gen. counter: \t%i\n"
-                  "s_kmallocs: \t%i\n"
                   "s_disk_reads: \t%i\n"
                   "s_disk_writes: \t%i\n"
                   "s_fix_nodes: \t%i\n"
@@ -128,7 +113,7 @@ static int show_super(struct seq_file *m, struct super_block *sb)
                   "SMALL_TAILS " : "NO_TAILS ",
                   replay_only(sb) ? "REPLAY_ONLY " : "",
                   convert_reiserfs(sb) ? "CONV " : "",
-                  atomic_read(&r->s_generation_counter), SF(s_kmallocs),
+                  atomic_read(&r->s_generation_counter),
                   SF(s_disk_reads), SF(s_disk_writes), SF(s_fix_nodes),
                   SF(s_do_balance), SF(s_unneeded_left_neighbor),
                   SF(s_good_search_by_key_reada), SF(s_bmaps),
@@ -297,7 +282,7 @@ static int show_oidmap(struct seq_file *m, struct super_block *sb)
        }
 #if defined( REISERFS_USE_OIDMAPF )
        if (sb_info->oidmap.use_file && (sb_info->oidmap.mapf != NULL)) {
-               loff_t size = sb_info->oidmap.mapf->f_dentry->d_inode->i_size;
+               loff_t size = sb_info->oidmap.mapf->f_path.dentry->d_inode->i_size;
                total_used += size / sizeof(reiserfs_oidinterval_d_t);
        }
 #endif
@@ -326,7 +311,7 @@ static int show_journal(struct seq_file *m, struct super_block *sb)
                   /* incore fields */
                   "j_1st_reserved_block: \t%i\n"
                   "j_state: \t%li\n"
-                  "j_trans_id: \t%lu\n"
+                  "j_trans_id: \t%u\n"
                   "j_mount_id: \t%lu\n"
                   "j_start: \t%lu\n"
                   "j_len: \t%lu\n"
@@ -334,7 +319,7 @@ static int show_journal(struct seq_file *m, struct super_block *sb)
                   "j_wcount: \t%i\n"
                   "j_bcount: \t%lu\n"
                   "j_first_unflushed_offset: \t%lu\n"
-                  "j_last_flush_trans_id: \t%lu\n"
+                  "j_last_flush_trans_id: \t%u\n"
                   "j_trans_start_time: \t%li\n"
                   "j_list_bitmap_index: \t%i\n"
                   "j_must_wait: \t%i\n"
@@ -423,12 +408,6 @@ static void *r_start(struct seq_file *m, loff_t * pos)
                return NULL;
 
        up_write(&s->s_umount);
-
-       if (de->deleted) {
-               deactivate_super(s);
-               return NULL;
-       }
-
        return s;
 }
 
@@ -453,7 +432,7 @@ static int r_show(struct seq_file *m, void *v)
        return show(m, v);
 }
 
-static struct seq_operations r_ops = {
+static const struct seq_operations r_ops = {
        .start = r_start,
        .next = r_next,
        .stop = r_stop,
@@ -471,11 +450,12 @@ static int r_open(struct inode *inode, struct file *file)
        return ret;
 }
 
-static struct file_operations r_file_operations = {
+static const struct file_operations r_file_operations = {
        .open = r_open,
        .read = seq_read,
        .llseek = seq_lseek,
        .release = seq_release,
+       .owner = THIS_MODULE,
 };
 
 static struct proc_dir_entry *proc_info_root = NULL;
@@ -484,21 +464,24 @@ static const char proc_info_root_name[] = "fs/reiserfs";
 static void add_file(struct super_block *sb, char *name,
                     int (*func) (struct seq_file *, struct super_block *))
 {
-       struct proc_dir_entry *de;
-       de = create_proc_entry(name, 0, REISERFS_SB(sb)->procdir);
-       if (de) {
-               de->data = func;
-               de->proc_fops = &r_file_operations;
-       }
+       proc_create_data(name, 0, REISERFS_SB(sb)->procdir,
+                        &r_file_operations, func);
 }
 
 int reiserfs_proc_info_init(struct super_block *sb)
 {
+       char b[BDEVNAME_SIZE];
+       char *s;
+
+       /* Some block devices use /'s */
+       strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE);
+       s = strchr(b, '/');
+       if (s)
+               *s = '!';
+
        spin_lock_init(&__PINFO(sb).lock);
-       REISERFS_SB(sb)->procdir =
-           proc_mkdir(reiserfs_bdevname(sb), proc_info_root);
+       REISERFS_SB(sb)->procdir = proc_mkdir(b, proc_info_root);
        if (REISERFS_SB(sb)->procdir) {
-               REISERFS_SB(sb)->procdir->owner = THIS_MODULE;
                REISERFS_SB(sb)->procdir->data = sb;
                add_file(sb, "version", show_version);
                add_file(sb, "super", show_super);
@@ -509,14 +492,23 @@ int reiserfs_proc_info_init(struct super_block *sb)
                add_file(sb, "journal", show_journal);
                return 0;
        }
-       reiserfs_warning(sb, "reiserfs: cannot create /proc/%s/%s",
-                        proc_info_root_name, reiserfs_bdevname(sb));
+       reiserfs_warning(sb, "cannot create /proc/%s/%s",
+                        proc_info_root_name, b);
        return 1;
 }
 
 int reiserfs_proc_info_done(struct super_block *sb)
 {
        struct proc_dir_entry *de = REISERFS_SB(sb)->procdir;
+       char b[BDEVNAME_SIZE];
+       char *s;
+
+       /* Some block devices use /'s */
+       strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE);
+       s = strchr(b, '/');
+       if (s)
+               *s = '!';
+
        if (de) {
                remove_proc_entry("journal", de);
                remove_proc_entry("oidmap", de);
@@ -530,34 +522,18 @@ int reiserfs_proc_info_done(struct super_block *sb)
        __PINFO(sb).exiting = 1;
        spin_unlock(&__PINFO(sb).lock);
        if (proc_info_root) {
-               remove_proc_entry(reiserfs_bdevname(sb), proc_info_root);
+               remove_proc_entry(b, proc_info_root);
                REISERFS_SB(sb)->procdir = NULL;
        }
        return 0;
 }
 
-struct proc_dir_entry *reiserfs_proc_register_global(char *name,
-                                                    read_proc_t * func)
-{
-       return (proc_info_root) ? create_proc_read_entry(name, 0,
-                                                        proc_info_root,
-                                                        func, NULL) : NULL;
-}
-
-void reiserfs_proc_unregister_global(const char *name)
-{
-       remove_proc_entry(name, proc_info_root);
-}
-
 int reiserfs_proc_info_global_init(void)
 {
        if (proc_info_root == NULL) {
                proc_info_root = proc_mkdir(proc_info_root_name, NULL);
-               if (proc_info_root) {
-                       proc_info_root->owner = THIS_MODULE;
-               } else {
-                       reiserfs_warning(NULL,
-                                        "reiserfs: cannot create /proc/%s",
+               if (!proc_info_root) {
+                       reiserfs_warning(NULL, "cannot create /proc/%s",
                                         proc_info_root_name);
                        return 1;
                }
@@ -573,50 +549,7 @@ int reiserfs_proc_info_global_done(void)
        }
        return 0;
 }
-
-/* REISERFS_PROC_INFO */
-#else
-
-int reiserfs_proc_info_init(struct super_block *sb)
-{
-       return 0;
-}
-int reiserfs_proc_info_done(struct super_block *sb)
-{
-       return 0;
-}
-
-struct proc_dir_entry *reiserfs_proc_register_global(char *name,
-                                                    read_proc_t * func)
-{
-       return NULL;
-}
-
-void reiserfs_proc_unregister_global(const char *name)
-{;
-}
-
-int reiserfs_proc_info_global_init(void)
-{
-       return 0;
-}
-int reiserfs_proc_info_global_done(void)
-{
-       return 0;
-}
-
-int reiserfs_global_version_in_proc(char *buffer, char **start,
-                                   off_t offset,
-                                   int count, int *eof, void *data)
-{
-       return 0;
-}
-
-/* REISERFS_PROC_INFO */
-#endif
-
 /*
- * $Log: procfs.c,v $
  * Revision 1.1.8.2  2001/07/15 17:08:42  god
  *  . use get_super() in procfs.c
  *  . remove remove_save_link() from reiserfs_do_truncate()
@@ -632,7 +565,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start,
  *
  */
 
-/* 
+/*
  * Make Linus happy.
  * Local variables:
  * c-indentation-style: "K&R"