Commit aabe003b authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

restore all

parent 4b52beab
...@@ -28,7 +28,16 @@ function init(){ ...@@ -28,7 +28,16 @@ function init(){
}); });
}); });
$("body").append($("<div>").css({padding:"0px 0px 10px 0px"}).append(b0).append(b1)); var b2 = $("<button>",{id:"b2"}).css({margin:"0px 0px 0px 10px"}).html("apply all");
b2.click(function(){
$.ajax({
url: "debugfs.php?cmd=restore"
});
});
$("body").append($("<div>").css({padding:"0px 0px 10px 0px"}).append(b0).append(b1).append(b2));
var t = $("<table border=\"1\">").html("\ var t = $("<table border=\"1\">").html("\
<tr>\ <tr>\
......
...@@ -96,6 +96,28 @@ function update_config($data){ ...@@ -96,6 +96,28 @@ function update_config($data){
file_put_contents($tmp_config,$data); file_put_contents($tmp_config,$data);
} }
function apply_config_to_control(){
global $tmp_config;
$arr_config = json_decode(file_get_contents($tmp_config),true);
foreach($arr_config as $k0 => $v0){
foreach($v0['configs'] as $k1 => $v1){
if ($v1['state']==1){
foreach($v1['lines'] as $k2 => $v2){
$file = $v2['file'];
$lineno = $v2['lineno'];
$flag = $v2['flags'];
if ($flag=="p") $sign = "+";
else $sign = "-";
exec("echo -n 'file $file line $lineno ${sign}p' > /sys/kernel/debug/dynamic_debug/control");
echo "echo -n 'file $file line $lineno ${sign}p'\n";
}
}
}
}
}
function sync_to_config($file,$line,$flag){ function sync_to_config($file,$line,$flag){
global $tmp_config; global $tmp_config;
...@@ -130,7 +152,7 @@ function sync_to_config($file,$line,$flag){ ...@@ -130,7 +152,7 @@ function sync_to_config($file,$line,$flag){
update_config(json_encode($arr_config)); update_config(json_encode($arr_config));
} }
if (($cmd=="do_nothing")||($cmd=="restore")){ if ($cmd=="do_nothing"){
if (isset($_GET['file'])) $file = $_GET['file']; if (isset($_GET['file'])) $file = $_GET['file'];
else $file = "/sys/kernel/debug/dynamic_debug/control"; else $file = "/sys/kernel/debug/dynamic_debug/control";
...@@ -190,6 +212,11 @@ if ($cmd=="sync"){ ...@@ -190,6 +212,11 @@ if ($cmd=="sync"){
if ($cmd=="savetofs"){ if ($cmd=="savetofs"){
copy($tmp_config,$config); copy($tmp_config,$config);
} }
if ($cmd=="restore"){
apply_config_to_control();
}
//single line: echo -n 'file gamma_tables.c +p' > /sys/kernel/debug/dynamic_debug/control //single line: echo -n 'file gamma_tables.c +p' > /sys/kernel/debug/dynamic_debug/control
?> ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment