Commit 2fd09253 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. tmp version in /tmp 2. savetofs button

parent 8a7451f6
...@@ -19,7 +19,15 @@ function init(){ ...@@ -19,7 +19,15 @@ function init(){
} }
}); });
$("body").append($("<div>").css({padding:"0px 0px 10px 0px"}).append(b0)); var b1 = $("<button>",{id:"b1"}).css({margin:"0px 0px 0px 10px"}).html("save to fs");
b1.click(function(){
$.ajax({
url: "debugfs.php?cmd=savetofs"
});
});
$("body").append($("<div>").css({padding:"0px 0px 10px 0px"}).append(b0).append(b1));
var t = $("<table border=\"1\">").html("\ var t = $("<table border=\"1\">").html("\
<tr>\ <tr>\
......
<?php <?php
//globals
$config = "debugfs.json";
$tmp_config = "/tmp/$config";
if (isset($_GET['cmd'])) if (isset($_GET['cmd']))
$cmd = $_GET['cmd']; $cmd = $_GET['cmd'];
...@@ -27,7 +30,6 @@ function control_records_sort($a,$b){ ...@@ -27,7 +30,6 @@ function control_records_sort($a,$b){
} }
return ($afile<$bfile)?-1:1; return ($afile<$bfile)?-1:1;
} }
function get_control($f){ function get_control($f){
...@@ -89,13 +91,16 @@ function get_control($f){ ...@@ -89,13 +91,16 @@ function get_control($f){
} }
function update_config($data){ function update_config($data){
global $tmp_config;
// debugfs.json // debugfs.json
file_put_contents("debugfs.json",$data); file_put_contents($tmp_config,$data);
} }
function sync_to_config($file,$line,$flag){ function sync_to_config($file,$line,$flag){
global $tmp_config;
//$arr_debugfs = get_control("/sys/kernel/debug/dynamic_debug/control"); //$arr_debugfs = get_control("/sys/kernel/debug/dynamic_debug/control");
$arr_config = json_decode(file_get_contents("debugfs.json"),true); $arr_config = json_decode(file_get_contents($tmp_config),true);
foreach($arr_config as $k => $v){ foreach($arr_config as $k => $v){
if ($v['file']==$file) $dc = $k; if ($v['file']==$file) $dc = $k;
...@@ -132,16 +137,22 @@ if (($cmd=="do_nothing")||($cmd=="restore")){ ...@@ -132,16 +137,22 @@ if (($cmd=="do_nothing")||($cmd=="restore")){
//echo json_encode(get_control($file)); //echo json_encode(get_control($file));
//echo "<pre>"; //echo "<pre>";
if (!is_file("debugfs.json")) { if (!is_file($tmp_config)) {
if (is_file($config)) {
copy($config,$tmp_config);
$json_data = file_get_contents($tmp_config);
echo $json_data;
}else{
$arr = get_control($file); $arr = get_control($file);
//print_r($arr); //print_r($arr);
update_config(json_encode($arr)); update_config(json_encode($arr));
echo json_encode($arr); echo json_encode($arr);
}
//echo "debugfs.json was missing, refresh page\n"; //echo "debugfs.json was missing, refresh page\n";
}else{ }else{
$json_data = file_get_contents("debugfs.json"); $json_data = file_get_contents($tmp_config);
//print_r(json_decode($json_data));
echo $json_data; echo $json_data;
//print_r(json_decode($json_data));
} }
} }
...@@ -176,7 +187,9 @@ if ($cmd=="sync"){ ...@@ -176,7 +187,9 @@ if ($cmd=="sync"){
update_config($data); update_config($data);
} }
if ($cmd=="savetofs"){
copy($tmp_config,$config);
}
//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