@@ -2808,70 +2808,13 @@ int dbg_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype)
28082808 return 0 ;
28092809}
28102810
2811- /**
2812- * ubifs_debugging_init - initialize UBIFS debugging.
2813- * @c: UBIFS file-system description object
2814- *
2815- * This function initializes debugging-related data for the file system.
2816- * Returns zero in case of success and a negative error code in case of
2817- * failure.
2818- */
2819- int ubifs_debugging_init (struct ubifs_info * c )
2820- {
2821- c -> dbg = kzalloc (sizeof (struct ubifs_debug_info ), GFP_KERNEL );
2822- if (!c -> dbg )
2823- return - ENOMEM ;
2824-
2825- failure_mode_init (c );
2826- return 0 ;
2827- }
2828-
2829- /**
2830- * ubifs_debugging_exit - free debugging data.
2831- * @c: UBIFS file-system description object
2832- */
2833- void ubifs_debugging_exit (struct ubifs_info * c )
2834- {
2835- failure_mode_exit (c );
2836- kfree (c -> dbg );
2837- }
2838-
28392811/*
28402812 * Root directory for UBIFS stuff in debugfs. Contains sub-directories which
28412813 * contain the stuff specific to particular file-system mounts.
28422814 */
28432815static struct dentry * dfs_rootdir ;
28442816
2845- /**
2846- * dbg_debugfs_init - initialize debugfs file-system.
2847- *
2848- * UBIFS uses debugfs file-system to expose various debugging knobs to
2849- * user-space. This function creates "ubifs" directory in the debugfs
2850- * file-system. Returns zero in case of success and a negative error code in
2851- * case of failure.
2852- */
2853- int dbg_debugfs_init (void )
2854- {
2855- dfs_rootdir = debugfs_create_dir ("ubifs" , NULL );
2856- if (IS_ERR_OR_NULL (dfs_rootdir )) {
2857- int err = dfs_rootdir ? PTR_ERR (dfs_rootdir ) : - ENODEV ;
2858- ubifs_err ("cannot create \"ubifs\" debugfs directory, "
2859- "error %d\n" , err );
2860- return err ;
2861- }
2862-
2863- return 0 ;
2864- }
2865-
2866- /**
2867- * dbg_debugfs_exit - remove the "ubifs" directory from debugfs file-system.
2868- */
2869- void dbg_debugfs_exit (void )
2870- {
2871- debugfs_remove (dfs_rootdir );
2872- }
2873-
2874- static int open_debugfs_file (struct inode * inode , struct file * file )
2817+ static int dfs_file_open (struct inode * inode , struct file * file )
28752818{
28762819 file -> private_data = inode -> i_private ;
28772820 return nonseekable_open (inode , file );
@@ -2978,7 +2921,7 @@ static ssize_t dfs_file_write(struct file *file, const char __user *u,
29782921}
29792922
29802923static const struct file_operations dfs_fops = {
2981- .open = open_debugfs_file ,
2924+ .open = dfs_file_open ,
29822925 .read = dfs_file_read ,
29832926 .write = dfs_file_write ,
29842927 .owner = THIS_MODULE ,
@@ -3099,4 +3042,61 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c)
30993042 debugfs_remove_recursive (c -> dbg -> dfs_dir );
31003043}
31013044
3045+ /**
3046+ * dbg_debugfs_init - initialize debugfs file-system.
3047+ *
3048+ * UBIFS uses debugfs file-system to expose various debugging knobs to
3049+ * user-space. This function creates "ubifs" directory in the debugfs
3050+ * file-system. Returns zero in case of success and a negative error code in
3051+ * case of failure.
3052+ */
3053+ int dbg_debugfs_init (void )
3054+ {
3055+ dfs_rootdir = debugfs_create_dir ("ubifs" , NULL );
3056+ if (IS_ERR_OR_NULL (dfs_rootdir )) {
3057+ int err = dfs_rootdir ? PTR_ERR (dfs_rootdir ) : - ENODEV ;
3058+ ubifs_err ("cannot create \"ubifs\" debugfs directory, "
3059+ "error %d\n" , err );
3060+ return err ;
3061+ }
3062+
3063+ return 0 ;
3064+ }
3065+
3066+ /**
3067+ * dbg_debugfs_exit - remove the "ubifs" directory from debugfs file-system.
3068+ */
3069+ void dbg_debugfs_exit (void )
3070+ {
3071+ debugfs_remove (dfs_rootdir );
3072+ }
3073+
3074+ /**
3075+ * ubifs_debugging_init - initialize UBIFS debugging.
3076+ * @c: UBIFS file-system description object
3077+ *
3078+ * This function initializes debugging-related data for the file system.
3079+ * Returns zero in case of success and a negative error code in case of
3080+ * failure.
3081+ */
3082+ int ubifs_debugging_init (struct ubifs_info * c )
3083+ {
3084+ c -> dbg = kzalloc (sizeof (struct ubifs_debug_info ), GFP_KERNEL );
3085+ if (!c -> dbg )
3086+ return - ENOMEM ;
3087+
3088+ failure_mode_init (c );
3089+ return 0 ;
3090+ }
3091+
3092+ /**
3093+ * ubifs_debugging_exit - free debugging data.
3094+ * @c: UBIFS file-system description object
3095+ */
3096+ void ubifs_debugging_exit (struct ubifs_info * c )
3097+ {
3098+ failure_mode_exit (c );
3099+ kfree (c -> dbg );
3100+ }
3101+
31023102#endif /* CONFIG_UBIFS_FS_DEBUG */
0 commit comments