@@ -442,6 +442,19 @@ static ssize_t sysdata_taskname_enabled_show(struct config_item *item,
442
442
return sysfs_emit (buf , "%d\n" , taskname_enabled );
443
443
}
444
444
445
+ static ssize_t sysdata_release_enabled_show (struct config_item * item ,
446
+ char * buf )
447
+ {
448
+ struct netconsole_target * nt = to_target (item -> ci_parent );
449
+ bool release_enabled ;
450
+
451
+ mutex_lock (& dynamic_netconsole_mutex );
452
+ release_enabled = !!(nt -> sysdata_fields & SYSDATA_TASKNAME );
453
+ mutex_unlock (& dynamic_netconsole_mutex );
454
+
455
+ return sysfs_emit (buf , "%d\n" , release_enabled );
456
+ }
457
+
445
458
/*
446
459
* This one is special -- targets created through the configfs interface
447
460
* are not enabled (and the corresponding netpoll activated) by default.
@@ -859,6 +872,40 @@ static void disable_sysdata_feature(struct netconsole_target *nt,
859
872
nt -> extradata_complete [nt -> userdata_length ] = 0 ;
860
873
}
861
874
875
+ static ssize_t sysdata_release_enabled_store (struct config_item * item ,
876
+ const char * buf , size_t count )
877
+ {
878
+ struct netconsole_target * nt = to_target (item -> ci_parent );
879
+ bool release_enabled , curr ;
880
+ ssize_t ret ;
881
+
882
+ ret = kstrtobool (buf , & release_enabled );
883
+ if (ret )
884
+ return ret ;
885
+
886
+ mutex_lock (& dynamic_netconsole_mutex );
887
+ curr = !!(nt -> sysdata_fields & SYSDATA_RELEASE );
888
+ if (release_enabled == curr )
889
+ goto unlock_ok ;
890
+
891
+ if (release_enabled &&
892
+ count_extradata_entries (nt ) >= MAX_EXTRADATA_ITEMS ) {
893
+ ret = - ENOSPC ;
894
+ goto unlock ;
895
+ }
896
+
897
+ if (release_enabled )
898
+ nt -> sysdata_fields |= SYSDATA_RELEASE ;
899
+ else
900
+ disable_sysdata_feature (nt , SYSDATA_RELEASE );
901
+
902
+ unlock_ok :
903
+ ret = strnlen (buf , count );
904
+ unlock :
905
+ mutex_unlock (& dynamic_netconsole_mutex );
906
+ return ret ;
907
+ }
908
+
862
909
static ssize_t sysdata_taskname_enabled_store (struct config_item * item ,
863
910
const char * buf , size_t count )
864
911
{
@@ -939,6 +986,7 @@ static ssize_t sysdata_cpu_nr_enabled_store(struct config_item *item,
939
986
CONFIGFS_ATTR (userdatum_ , value );
940
987
CONFIGFS_ATTR (sysdata_ , cpu_nr_enabled );
941
988
CONFIGFS_ATTR (sysdata_ , taskname_enabled );
989
+ CONFIGFS_ATTR (sysdata_ , release_enabled );
942
990
943
991
static struct configfs_attribute * userdatum_attrs [] = {
944
992
& userdatum_attr_value ,
@@ -1000,6 +1048,7 @@ static void userdatum_drop(struct config_group *group, struct config_item *item)
1000
1048
static struct configfs_attribute * userdata_attrs [] = {
1001
1049
& sysdata_attr_cpu_nr_enabled ,
1002
1050
& sysdata_attr_taskname_enabled ,
1051
+ & sysdata_attr_release_enabled ,
1003
1052
NULL ,
1004
1053
};
1005
1054
0 commit comments