@@ -29,6 +29,7 @@ typedef enum {
2929 attr_last_error_time ,
3030 attr_feature ,
3131 attr_pointer_ui ,
32+ attr_pointer_ul ,
3233 attr_pointer_atomic ,
3334 attr_journal_task ,
3435} attr_id_t ;
@@ -160,6 +161,9 @@ static struct ext4_attr ext4_attr_##_name = { \
160161#define EXT4_RW_ATTR_SBI_UI (_name ,_elname ) \
161162 EXT4_ATTR_OFFSET(_name, 0644, pointer_ui, ext4_sb_info, _elname)
162163
164+ #define EXT4_RW_ATTR_SBI_UL (_name ,_elname ) \
165+ EXT4_ATTR_OFFSET(_name, 0644, pointer_ul, ext4_sb_info, _elname)
166+
163167#define EXT4_ATTR_PTR (_name ,_mode ,_id ,_ptr ) \
164168static struct ext4_attr ext4_attr_##_name = { \
165169 .attr = {.name = __stringify(_name), .mode = _mode }, \
@@ -194,6 +198,9 @@ EXT4_RW_ATTR_SBI_UI(warning_ratelimit_interval_ms, s_warning_ratelimit_state.int
194198EXT4_RW_ATTR_SBI_UI (warning_ratelimit_burst , s_warning_ratelimit_state .burst );
195199EXT4_RW_ATTR_SBI_UI (msg_ratelimit_interval_ms , s_msg_ratelimit_state .interval );
196200EXT4_RW_ATTR_SBI_UI (msg_ratelimit_burst , s_msg_ratelimit_state .burst );
201+ #ifdef CONFIG_EXT4_DEBUG
202+ EXT4_RW_ATTR_SBI_UL (simulate_fail , s_simulate_fail );
203+ #endif
197204EXT4_RO_ATTR_ES_UI (errors_count , s_error_count );
198205EXT4_ATTR (first_error_time , 0444 , first_error_time );
199206EXT4_ATTR (last_error_time , 0444 , last_error_time );
@@ -228,6 +235,9 @@ static struct attribute *ext4_attrs[] = {
228235 ATTR_LIST (first_error_time ),
229236 ATTR_LIST (last_error_time ),
230237 ATTR_LIST (journal_task ),
238+ #ifdef CONFIG_EXT4_DEBUG
239+ ATTR_LIST (simulate_fail ),
240+ #endif
231241 NULL ,
232242};
233243ATTRIBUTE_GROUPS (ext4 );
@@ -318,6 +328,11 @@ static ssize_t ext4_attr_show(struct kobject *kobj,
318328 else
319329 return snprintf (buf , PAGE_SIZE , "%u\n" ,
320330 * ((unsigned int * ) ptr ));
331+ case attr_pointer_ul :
332+ if (!ptr )
333+ return 0 ;
334+ return snprintf (buf , PAGE_SIZE , "%lu\n" ,
335+ * ((unsigned long * ) ptr ));
321336 case attr_pointer_atomic :
322337 if (!ptr )
323338 return 0 ;
@@ -361,6 +376,14 @@ static ssize_t ext4_attr_store(struct kobject *kobj,
361376 else
362377 * ((unsigned int * ) ptr ) = t ;
363378 return len ;
379+ case attr_pointer_ul :
380+ if (!ptr )
381+ return 0 ;
382+ ret = kstrtoul (skip_spaces (buf ), 0 , & t );
383+ if (ret )
384+ return ret ;
385+ * ((unsigned long * ) ptr ) = t ;
386+ return len ;
364387 case attr_inode_readahead :
365388 return inode_readahead_blks_store (sbi , buf , len );
366389 case attr_trigger_test_error :
0 commit comments