⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 procfs.c

📁 ARM 嵌入式 系统 设计与实例开发 实验教材 二源码
💻 C
📖 第 1 页 / 共 2 页
字号:
			"hash: \t%s\n"			"tree_height: \t%i\n"			"bmap_nr: \t%i\n"			"version: \t%i\n",			DFL( s_block_count ),			DFL( s_free_blocks ),			DFL( s_root_block ),			DF( s_blocksize ),			DF( s_oid_maxsize ),			DF( s_oid_cursize ),			DF( s_state ),			rs -> s_magic,			hash_code == TEA_HASH ? "tea" :			( hash_code == YURA_HASH ) ? "rupasov" :			( hash_code == R5_HASH ) ? "r5" :			( hash_code == UNSET_HASH ) ? "unset" : "unknown",			DF( s_tree_height ),			DF( s_bmap_nr ),			DF( s_version ) );	procinfo_epilogue( sb );	return reiserfs_proc_tail( len, buffer, start, offset, count, eof );}int reiserfs_oidmap_in_proc( char *buffer, char **start, off_t offset,			     int count, int *eof, void *data ){	struct super_block *sb;	struct reiserfs_sb_info *sb_info;	struct reiserfs_super_block *rs;	int i;	unsigned int mapsize;	unsigned long total_used;	int len = 0;	int exact;    	sb = procinfo_prologue( ( kdev_t ) ( long ) data );	if( sb == NULL )		return -ENOENT;	sb_info = &sb->u.reiserfs_sb;	rs = sb_info -> s_rs;	mapsize = le16_to_cpu( rs -> s_oid_cursize );	total_used = 0;	for( i = 0 ; i < mapsize ; ++i ) {		__u32 right;		right = ( i == mapsize - 1 ) ? MAX_KEY_OBJECTID : MAP( i + 1 );		len += sprintf( &buffer[ len ], "%s: [ %x .. %x )\n",				( i & 1 ) ? "free" : "used", MAP( i ), right );		if( ! ( i & 1 ) ) {			total_used += right - MAP( i );		}		if( len > PAGE_SIZE - 100 ) {			len += sprintf( &buffer[ len ], "... and more\n" );			break;		}	}#if defined( REISERFS_USE_OIDMAPF )	if( sb_info -> oidmap.use_file && ( sb_info -> oidmap.mapf != NULL ) ) {		loff_t size;		size = sb_info -> oidmap.mapf -> f_dentry -> d_inode -> i_size;		total_used += size / sizeof( reiserfs_oidinterval_d_t );		exact = 1;	} else#endif	{		exact = ( i == mapsize );	}	len += sprintf( &buffer[ len ], "total: \t%i [%i/%i] used: %lu [%s]\n", 			i, 			mapsize, le16_to_cpu( rs -> s_oid_maxsize ),			total_used, exact ? "exact" : "estimation" );	procinfo_epilogue( sb );	return reiserfs_proc_tail( len, buffer, start, offset, count, eof );}int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset,			      int count, int *eof, void *data ){	struct super_block *sb;	struct reiserfs_sb_info *r;	struct reiserfs_super_block *rs;	int len = 0;    	sb = procinfo_prologue( ( kdev_t ) ( long ) data );	if( sb == NULL )		return -ENOENT;	r = &sb->u.reiserfs_sb;	rs = r -> s_rs;	len += sprintf( &buffer[ len ], 			/* on-disk fields */			"s_journal_block: \t%i\n"			"s_journal_dev: \t%s[%x]\n"			"s_orig_journal_size: \t%i\n"			"s_journal_trans_max: \t%i\n"			"s_journal_block_count: \t%i\n"			"s_journal_max_batch: \t%i\n"			"s_journal_max_commit_age: \t%i\n"			"s_journal_max_trans_age: \t%i\n"			/* incore fields */			"j_state: \t%li\n"						"j_trans_id: \t%lu\n"			"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_journal_list_index: \t%i\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",			DJF( s_journal_block ),			DJF( s_journal_dev ) == 0 ? "none" : bdevname( DJF( s_journal_dev ) ), 			DJF( s_journal_dev ),			DJF( s_orig_journal_size ),			DJF( s_journal_trans_max ),			DJF( s_journal_block_count ),			DJF( s_journal_max_batch ),			DJF( s_journal_max_commit_age ),			DJF( s_journal_max_trans_age ),						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_journal_list_index ),			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 )		);	procinfo_epilogue( sb );	return reiserfs_proc_tail( len, buffer, start, offset, count, eof );}static struct proc_dir_entry *proc_info_root = NULL;static const char *proc_info_root_name = "fs/reiserfs";int reiserfs_proc_info_init( struct super_block *sb ){	spin_lock_init( & __PINFO( sb ).lock );	sb->u.reiserfs_sb.procdir = proc_mkdir( bdevname( sb -> s_dev ), 						proc_info_root );	if( sb->u.reiserfs_sb.procdir ) {		sb->u.reiserfs_sb.procdir -> owner = THIS_MODULE;		return 0;	}	reiserfs_warning( "reiserfs: cannot create /proc/%s/%s\n",			  proc_info_root_name, bdevname( sb -> s_dev ) );	return 1;}int reiserfs_proc_info_done( struct super_block *sb ){	spin_lock( & __PINFO( sb ).lock );	__PINFO( sb ).exiting = 1;	spin_unlock( & __PINFO( sb ).lock );	if ( proc_info_root ) {		remove_proc_entry( bdevname( sb -> s_dev ), proc_info_root );		sb->u.reiserfs_sb.procdir = NULL;	}	return 0;}/* Create /proc/fs/reiserfs/DEV/name and attach read procedure @func   to it.  Other parts of reiserfs use this function to make their   per-device statistics available via /proc */struct proc_dir_entry *reiserfs_proc_register( struct super_block *sb, 					       char *name, read_proc_t *func ){	return ( sb->u.reiserfs_sb.procdir ) ? create_proc_read_entry		( name, 0, sb->u.reiserfs_sb.procdir, func, 		  ( void * ) ( long ) sb -> s_dev ) : NULL;}void reiserfs_proc_unregister( struct super_block *sb, const char *name ){	remove_proc_entry( name, sb->u.reiserfs_sb.procdir );}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, 0 );		if( proc_info_root ) {			proc_info_root -> owner = THIS_MODULE;		} else {			reiserfs_warning( "reiserfs: cannot create /proc/%s\n",					  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, 0 );	}	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( struct super_block *sb, 					       char *name, 					       read_proc_t *func ) { return NULL; }void reiserfs_proc_unregister( struct super_block *sb, const char *name ) {;}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; }int reiserfs_version_in_proc( char *buffer, char **start, off_t offset,			      int count, int *eof, void *data ){ return 0; }int reiserfs_super_in_proc( char *buffer, char **start, off_t offset,			    int count, int *eof, void *data ){ return 0; }int reiserfs_per_level_in_proc( char *buffer, char **start, off_t offset,				int count, int *eof, void *data ){ return 0; }int reiserfs_bitmap_in_proc( char *buffer, char **start, off_t offset,			     int count, int *eof, void *data ){ return 0; }int reiserfs_on_disk_super_in_proc( char *buffer, char **start, off_t offset,				    int count, int *eof, void *data ){ return 0; }int reiserfs_oidmap_in_proc( char *buffer, char **start, off_t offset,			     int count, int *eof, void *data ){ return 0; }int reiserfs_journal_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 + -