📄 procfs.c
字号:
"j_mount_id: \t%lu\n" "j_start: \t%lu\n" "j_len: \t%lu\n" "j_len_alloc: \t%lu\n" "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_trans_start_time: \t%li\n" "j_list_bitmap_index: \t%i\n" "j_must_wait: \t%i\n" "j_next_full_flush: \t%i\n" "j_next_async_flush: \t%i\n" "j_cnode_used: \t%i\n" "j_cnode_free: \t%i\n" "\n" /* reiserfs_proc_info_data_t.journal fields */ "in_journal: \t%12lu\n" "in_journal_bitmap: \t%12lu\n" "in_journal_reusable: \t%12lu\n" "lock_journal: \t%12lu\n" "lock_journal_wait: \t%12lu\n" "journal_begin: \t%12lu\n" "journal_relock_writers: \t%12lu\n" "journal_relock_wcount: \t%12lu\n" "mark_dirty: \t%12lu\n" "mark_dirty_already: \t%12lu\n" "mark_dirty_notjournal: \t%12lu\n" "restore_prepared: \t%12lu\n" "prepare: \t%12lu\n" "prepare_retry: \t%12lu\n", DJP(jp_journal_1st_block), bdevname(SB_JOURNAL(sb)->j_dev_bd, b), DJP(jp_journal_dev), DJP(jp_journal_size), DJP(jp_journal_trans_max), DJP(jp_journal_magic), DJP(jp_journal_max_batch), SB_JOURNAL(sb)->j_max_commit_age, DJP(jp_journal_max_trans_age), JF(j_1st_reserved_block), JF(j_state), JF(j_trans_id), JF(j_mount_id), JF(j_start), JF(j_len), JF(j_len_alloc), atomic_read(&r->s_journal->j_wcount), JF(j_bcount), JF(j_first_unflushed_offset), JF(j_last_flush_trans_id), JF(j_trans_start_time), JF(j_list_bitmap_index), JF(j_must_wait), JF(j_next_full_flush), JF(j_next_async_flush), JF(j_cnode_used), JF(j_cnode_free), SFPJ(in_journal), SFPJ(in_journal_bitmap), SFPJ(in_journal_reusable), SFPJ(lock_journal), SFPJ(lock_journal_wait), SFPJ(journal_being), SFPJ(journal_relock_writers), SFPJ(journal_relock_wcount), SFPJ(mark_dirty), SFPJ(mark_dirty_already), SFPJ(mark_dirty_notjournal), SFPJ(restore_prepared), SFPJ(prepare), SFPJ(prepare_retry) ); return 0;}/* iterator */static int test_sb(struct super_block *sb, void *data){ return data == sb;}static int set_sb(struct super_block *sb, void *data){ return -ENOENT;}static void *r_start(struct seq_file *m, loff_t * pos){ struct proc_dir_entry *de = m->private; struct super_block *s = de->parent->data; loff_t l = *pos; if (l) return NULL; if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, s))) return NULL; up_write(&s->s_umount); return s;}static void *r_next(struct seq_file *m, void *v, loff_t * pos){ ++*pos; if (v) deactivate_super(v); return NULL;}static void r_stop(struct seq_file *m, void *v){ if (v) deactivate_super(v);}static int r_show(struct seq_file *m, void *v){ struct proc_dir_entry *de = m->private; int (*show) (struct seq_file *, struct super_block *) = de->data; return show(m, v);}static struct seq_operations r_ops = { .start = r_start, .next = r_next, .stop = r_stop, .show = r_show,};static int r_open(struct inode *inode, struct file *file){ int ret = seq_open(file, &r_ops); if (!ret) { struct seq_file *m = file->private_data; m->private = PDE(inode); } return ret;}static const struct file_operations r_file_operations = { .open = r_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release,};static struct proc_dir_entry *proc_info_root = NULL;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; }}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(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); add_file(sb, "per-level", show_per_level); add_file(sb, "bitmap", show_bitmap); add_file(sb, "on-disk-super", show_on_disk_super); add_file(sb, "oidmap", show_oidmap); add_file(sb, "journal", show_journal); return 0; } reiserfs_warning(sb, "reiserfs: 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); remove_proc_entry("on-disk-super", de); remove_proc_entry("bitmap", de); remove_proc_entry("per-level", de); remove_proc_entry("super", de); remove_proc_entry("version", de); } spin_lock(&__PINFO(sb).lock); __PINFO(sb).exiting = 1; spin_unlock(&__PINFO(sb).lock); if (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", proc_info_root_name); return 1; } } return 0;}int reiserfs_proc_info_global_done(void){ if (proc_info_root != NULL) { proc_info_root = NULL; remove_proc_entry(proc_info_root_name, NULL); } return 0;}/* REISERFS_PROC_INFO */#elseint 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() * * I accept terms and conditions stated in the Legal Agreement * (available at http://www.namesys.com/legalese.html) * * Revision 1.1.8.1 2001/07/11 16:48:50 god * proc info support * * I accept terms and conditions stated in the Legal Agreement * (available at http://www.namesys.com/legalese.html) * *//* * Make Linus happy. * Local variables: * c-indentation-style: "K&R" * mode-name: "LC" * c-basic-offset: 8 * tab-width: 8 * End: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -