Browse Source

Merge branch 'master' of bitbucket.org:ckolivas/ckpool

master
Con Kolivas 10 years ago
parent
commit
5364b78659
  1. 162
      pool/inc.php
  2. 152
      pool/page.php
  3. 1253
      src/ckdb.c
  4. 142
      src/ckdb.h
  5. 1
      src/ckdb_cmd.c
  6. 51
      src/ckdb_data.c

162
pool/inc.php

@ -0,0 +1,162 @@
<?php
#
function GBaseJS()
{
$g = "function hasCan(){var c0=document.getElementById('can0');c=document.getElementById('can');return !!(c0&&c&&c.getContext&&c.getContext('2d'));}
function sep(d){ans={};var ar=d.split('\\t');var l=ar.length;for(var i=0;i<l;i++){var e=ar[i].indexOf('=');ans[ar[i].substr(0,e)]=ar[i].substr(e+1)};return ans}
function dfmt(c,e){var d=new Date(e*1000);var DD,HH,MM;if(c['utc']){DD=d.getUTCDate();HH=d.getUTCHours();MM=d.getUTCMinutes()}else{DD=d.getDate();HH=d.getHours();MM=d.getMinutes()}var ans=''+DD+'/';if(HH<10){ans+='0'}ans+=''+HH+':';if(MM<10){ans+='0'}ans+=''+MM;return ans}
function ccb(c,n){var e=document.getElementById(n);c[n]=(e&&e.checked)}
function gch(z,zm){if(z<0.5){return 0.5}if(z>(zm-0.5)){return(zm-0.5)}return z}
function gchx(c,x){return gch(x*c['xm']+c['xo'],c['ctx'].canvas.width)}
function gchy(c,y){return gch((1-y)*c['ym']+c['yo'],c['ctx'].canvas.height)}
function gx0(c){return -c['xo']/c['xm']};
function gy0(c){return -c['yo']/c['ym']};
function gto(c,xo,yo){c['xo']+=xo;c['yo']+=yo}
function gts(c,xs,ys){c['xm']*=xs;c['ym']*=ys}
function gtso(c,xs,ys){gto(c,c['xm']*(1.0-xs)/2.0,c['ym']*(1.0-ys)/2.0);gts(c,xs,ys)}
function gfs(c,bg){c['ctx'].fillStyle=bg}
function gss(c,fg){c['ctx'].strokeStyle=fg}
function glw(c,w){c['ctx'].lineWidth=w}
function gfz(c,x,y,ox,oy,t,co,a){gfs(c,co);c['ctx'].textAlign=a;c['ctx'].fillText(t,gchx(c,x)+ox,gchy(c,y)-oy)}
function gbe(c,x,y){c['ctx'].beginPath();c['ctx'].moveTo(gchx(c,x),gchy(c,y))}
function gln(c,x,y){c['ctx'].lineTo(gchx(c,x),gchy(c,y))}
function gct(c,x1,y1,x2,y2,x3,y3){c['ctx'].bezierCurveTo(gchx(c,x1),gchy(c,y1),gchx(c,x2),gchy(c,y2),gchx(c,x3),gchy(c,y3))}
function glm(c,x,y){c['ctx'].moveTo(gchx(c,x),gchy(c,y))}
function gle(c){c['ctx'].closePath()}
function gfl(c){c['ctx'].fill()}
function gst(c){c['ctx'].stroke()}
function gfi(c){gle(c);gst(c)}
function gbd(c){gbe(c,0,0);gln(c,1,0);gln(c,1,1);gln(c,0,1);gle(c);gfl(c);gst(c)}
function ggr(c,xs,ys,yt,xn,x0,x1,y0,y1,ar,nx,vx,vy,av,w,cols){
gtso(c,xs,ys);
gss(c,'black');glw(c,1.5);
gbe(c,0,1);gln(c,0,0);gln(c,1,0);gst(c);
glw(c,0.2);
var hi=c['ctx'].measureText('M').width, wi=c['ctx'].measureText('1').width;
for(var i=0;i<11;i++){var y=i/10.0;gbe(c,-0.01,y);gln(c,1,y);gst(c);var t=''+(((y1-y0)*i/10+y0).toFixed(2));gfz(c,0,y,-wi,0,t,'black','end')}
gfz(c,gx0(c),0.55,wi,0,yt,'#0080ff','left');
var m=Math.round(0.5+xn/20.0);
for(var i=0;i<xn;i++){var n=ar[nx+i];var x=ar[vx+i];var xo=(x-x0)/(x1-x0);if(c['skey']&&(i<(xn-1))&&(i%m)==0){gbe(c,xo,0);gln(c,xo,-0.01);gst(c);gfz(c,xo,0,0,-hi*1.5,n,'#00a050','center')}if(c['slines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}}
var xhr=3600+x1-(x1%3600);
gss(c,'brown');
if(c['tkey']||c['tlines']){var hlv=c['hln'][c['hl']];hrs=c['hrs'][c['hr']]*3600/hlv;
var l=0;tpos=2.7;if(c['over']){tpos=1.5}
for(var i=xhr;i>=x0;i-=hrs){var n=dfmt(c,i);var xo=(i-x0)/(x1-x0);if(xo<=1&&c['tkey']&&((l%hlv)==0)){gbe(c,xo,0);gln(c,xo,-0.02);gst(c);gfz(c,xo,0,0,-hi*tpos,n,'brown','center')}if(xo<=1&&c['tlines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}l++}}
glw(c,1);
if(c['smooth']){for(var j=1;j<w.length;j++){var f=1;gss(c,cols[j-1]);
var xa=0,ya=0,xb=0,yb=0;
for(var i=0;i<xn;i++){var x=ar[vx+i];var y=ar[w[j]+vy+i];var xo=(x-x0)/(x1-x0);var yo=(y-y0)/(y1-y0);if(f==1){gbe(c,xo,yo);f=0;xb=xo;yb=yo}else{gct(c,(xa+xb)/2,(ya+yb)/2,xb,yb,(xb+xo)/2,(yb+yo)/2)}xa=xb;ya=yb;xb=xo;yb=yo}gct(c,(xa+xb)/2,(ya+yb)/2,xo,yo,xo,yo);gst(c);}}
else{for(var j=1;j<w.length;j++){var f=1;gss(c,cols[j-1]);
for(var i=0;i<xn;i++){var x=ar[vx+i];var y=ar[w[j]+vy+i];var xo=(x-x0)/(x1-x0);var yo=(y-y0)/(y1-y0);if(f==1){gbe(c,xo,yo);f=0}else{gln(c,xo,yo)}}gst(c);}}
glw(c,1);
for(var j=1;j<w.length;j++){if(av[j-1]>0){gss(c,'red');var y=(av[j-1]-y0)/(y1-y0);gbe(c,0,y);gln(c,1,y);gst(c);
var t=''+av[j-1].toFixed(2)+'av';gfz(c,1,y,1,0,t,cols[j-1],'left')}}
if(c['tkey']){var col,hrl=c['hrs'].length;for(var i=0;i<hrl;i++){if(c['hr']==i){col='red'}else{col='black'}gfz(c,1,0,c['xo']-c['pxe'],hi*(i+1)*2,''+c['hrs'][i],col,'end')}for(var i=0;i<c['hln'].length;i++){if(c['hl']==i){col='red'}else{col='black'}gfz(c,1,0,c['xo']-c['pxe'],hi*(i+2+hrl)*2,''+c['hrs'][i],col,'end')}}
}
function sn(i,shi){if(shi.indexOf(' Shift ')<0){return ''+(i%10)}else{return shi.replace(/.* ([a-z])[a-z]*$/,'$1')}}
function gc(c){var div=document.getElementById('can0');while(div.firstChild){div.removeChild(div.firstChild)}c['can']=document.createElement('canvas');c['can'].id='can';c['wx']=window.innerWidth;c['wy']=window.innerHeight;c['xm']=Math.max(Math.round(c['wx']*0.9+0.5),400);c['ym']=Math.max(Math.round(c['wy']*0.8+0.5),400);if(c['ym']>c['xm']){c['ym']=c['xm']}c['xo']=0.0;c['yo']=0.0;c['ctx']=c['can'].getContext('2d');c['ctx'].canvas.width=c['xm']+1;c['ctx'].canvas.height=c['ym']+1;div.appendChild(c['can']);c['pxe']=Math.max(Math.round(c['xm']/250),1)}
function opts(t,i){var e=document.getElementById(i);if(t.checked){e.style.visibility='visible'}else{e.style.visibility='hidden'}}
function ghrs(c){c['hrs']=[1,2,3,4,6,8,12,24,48];c['hln']=[1,2,3,4,6]}
function ghg(c,dx){var tl=dx/(gchx(c,1)/50)/3600;for(var j=c['hrs'].length-1;j>=0;j--){if(tl<c['hrs'][j]){c['hr']=j}else{break}}if(tl<0.5){var tb=1/tl;for(var k=0;k<c['hln'].length;k++){if(c['hln'][k]<tb){c['hl']=k}else{break}}}else{c['hl']=1}}
function gopt(c,cbx){for(var i=0;i<cbx.length;i++){ccb(c,cbx[i])}}
function doinit(cbx,xon){for(var i=0;i<cbx.length;i++){var e=document.getElementById(cbx[i]);if(e){var n=gcn(cbx[i]);if(n==''){if(xon[cbx[i]]){e.checked=true}else{e.checked=false}}else{if(n=='1'){e.checked=true}else{e.checked=false}}}}}
";
return $g;
}
#
function TipsJS()
{
$t = "function untip(e){if(e){if(typeof e.tmo!='undefined'){clearTimeout(e.tmo);delete e.tmo}e.style.opacity=0;e.style.visibility='hidden'}}
function tip(i,n){var e=document.getElementById(i);if(e){if(e.style.visibility=='visible'){untip(e)}else{e.style.visibility='visible';e.style.opacity=0.95;e.tmo=setTimeout(function(){untip(e)},n)}}}
";
return $t;
}
function TipsCSS()
{
$c = "span.tip0 {position:absolute;z-index:42;pointer-events:none;font-size:smaller;text-align:left;}
span.notip {position:relative;color:#0077ee;background:#bbffff;border-style:solid;border-color:black;border-width:1px;left:-10px;width:200px;padding:2px;float:left;transition:visibility 0.5s,opacity 0.5s;visibility:hidden;opacity:0}
span.tip {visibility: visibile;}
span.q {position: relative; width: 16px; height: 16px; display: inline-block; background-color: #0077ee; line-height: 16px; color: White; font-size: 13px; font-weight: bold; border-radius: 8px; text-align: center; cursor: pointer;}
ul.tip {margin-top:0;margin-bottom:0;list-style:disc inside none;margin-left:0;padding-left:0.5em;display:block}
li {padding-left:0.5em;}
";
return $c;
}
#
function HeadJS()
{
$h = "function gcn(n){var ans='',d=document.cookie;if(d){var c0=d.indexOf(n+'='),cs=d.indexOf(' '+n+'=');if(c0==0||cs>0){if(cs>0){c0=cs+1}var c=d.substr(c0).split(';',1);var e=c[0].indexOf('=');if(e>0){ans=c[0].substr(e+1)}}}return ans}
function scnv(n,v){var d=new Date();d.setTime(d.getTime()+(864*Math.pow(10,8)));document.cookie=n+'='+v+'; expires='+d.toUTCString()+'; path=/'}
function ni(e,o){if(e){if(o==0){e.defd=e.style.display;e.style.display='none'}else{e.style.display=e.defd}}}
function domin(o){var e=document.getElementById('minicb');if(e){if(o==0){e.checked=true}else{e.checked=false}};for(var i=0;i<10;i++){e=document.getElementById('mini'+i);ni(e,o)}}
function mini(){var hm=gcn('mini');if(hm==''){domin(1)}else{domin(0)}}
function md(e){var c='';if(e.checked){c='y'}scnv('mini',c);mini()}
function tim(){var e=document.getElementById('ftr');if(e){var now=new Date(),t=document.createTextNode(now.toLocaleString());e.appendChild(t)}}
function jst(){var e=document.getElementById('jst');if(e){e.style.visibility='hidden'}}";
return $h;
}
#
function HeadCSS($iCrap = false)
{
$h = "input[type=checkbox] {vertical-align: -2px;}
form {display: inline-block;}
html, body {height: 100%; font-family:Arial, Verdana, sans-serif; font-size:12pt; background-color:#eeffff; text-align: center; background-repeat: no-repeat; background-position: center;}
.page {min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -50px; position: relative;}
div.jst {color:red; font-weight: bold; font-size: 8; text-align: center; vertical-align: top;}
div.accwarn {color:red; font-weight: bold; font-size: 8; text-align: center; vertical-align: top;}
div.topd {background-color:#cff; border-color: #cff; border-style: solid; border-width: 9px;}
.topdes {color:blue; text-align: right;}
.topdesl {color:blue; text-align: left;}
.topwho {color:black; font-weight: bold; margin-right: 8px;}
.topdat {margin-left: 8px; margin-right: 24px; color:green; font-weight: bold;}
span.nb {white-space: pre;}
span.login {float: right; margin-left: 8px; margin-right: 24px;}
span.hil {color:blue;}
span.user {color:green;}
span.addr {color:brown;}
span.warn {color:orange; font-weight:bold;}
span.urg {color:red; font-weight:bold;}
span.err {color:red; font-weight:bold; font-size:120%;}
span.alert {color:red; font-weight:bold; font-size:250%;}
input.tiny {width: 0px; height: 0px; margin: 0px; padding: 0px; outline: none; border: 0px;}
#n42 {margin:0; position: relative; color:#ffffff; background:#0077ee;}
#n42 a {color:#fff; text-decoration:none; padding: 6px; display:block;}
#n42 td {min-width: 100px; float: left; vertical-align: top; padding: 0px 2px;}
#n42 td.navboxr {float: right;}
#n42 td.nav {position: relative;}
#n42 td.ts {border-width: 1px; border-color: #0022ee; border-style: solid none none none;}";
if (!$iCrap)
{
$h .= "
#n42 div.sub {left: 0px; z-index: 42; position: absolute; visibility: hidden;}
#n42 td.nav:hover {background:#0099ee;}
#n42 td.nav:hover div.sub {background:#0077ee; visibility: visible;}";
}
$h .= "
h1 {margin-top: 20px; float:middle; font-size: 20px;}
.foot, .push {height: 50px;}
.title {background-color: #909090;}
.even {background-color: #cccccc;}
.odd {background-color: #a8a8a8;}
.hid {display: none;}
.dl {text-align: left; padding: 2px 8px;}
.dr {text-align: right; padding: 2px 8px;}
.dc {text-align: center; padding: 2px 8px;}
.dls {text-align: left; padding: 2px 8px; text-decoration:line-through; font-weight:lighter;}
.drs {text-align: right; padding: 2px 8px; text-decoration:line-through; font-weight:lighter;}
.dcs {text-align: center; padding: 2px 8px; text-decoration:line-through; font-weight:lighter;}
.st0 {font-weight:bold;}
.st1 {color:red; font-weight:bold;}
.st2 {color:green; font-weight:bold;}
.st3 {color:blue; font-weight:bold;}
.fthi {color:red; font-size:7px;}
.ftlo {color:green; font-size:7px;}
.ft {color:blue; font-size:7px;}
.ftl {text-align: left; color:blue; font-size:7px; display:inline-block; width:20%; white-space: nowrap;}
.ftm {text-align: middle; font-size:10pt; display:inline-block; width:60%; white-space: nowrap;}
.ftr {text-align: rigth; color:blue; font-size:7px; display:inline-block; width:20%; white-space: nowrap;}";
return $h;
}
#
?>

152
pool/page.php

@ -1,5 +1,7 @@
<?php <?php
# #
include_once('inc.php');
#
global $site_title; global $site_title;
global $page_title; global $page_title;
global $page_scripts; global $page_scripts;
@ -38,7 +40,7 @@ function addScript($script)
if ($page_scripts == '') if ($page_scripts == '')
$page_scripts = "<script type='text/javascript'>\n"; $page_scripts = "<script type='text/javascript'>\n";
$page_scripts .= trim($script); $page_scripts .= $script;
} }
} }
# #
@ -51,82 +53,16 @@ function addCSS($css)
# #
function addGBase() function addGBase()
{ {
$g = "function hasCan(){var c0=document.getElementById('can0');c=document.getElementById('can');return !!(c0&&c&&c.getContext&&c.getContext('2d'));} $g = GBaseJS();
function sep(d){ans={};var ar=d.split('\\t');var l=ar.length;for(var i=0;i<l;i++){var e=ar[i].indexOf('=');ans[ar[i].substr(0,e)]=ar[i].substr(e+1)};return ans}
function dfmt(c,e){var d=new Date(e*1000);var DD,HH,MM;if(c['utc']){DD=d.getUTCDate();HH=d.getUTCHours();MM=d.getUTCMinutes()}else{DD=d.getDate();HH=d.getHours();MM=d.getMinutes()}var ans=''+DD+'/';if(HH<10){ans+='0'}ans+=''+HH+':';if(MM<10){ans+='0'}ans+=''+MM;return ans}
function ccb(c,n){var e=document.getElementById(n);c[n]=(e&&e.checked)}
function gch(z,zm){if(z<0.5){return 0.5}if(z>(zm-0.5)){return(zm-0.5)}return z}
function gchx(c,x){return gch(x*c['xm']+c['xo'],c['ctx'].canvas.width)}
function gchy(c,y){return gch((1-y)*c['ym']+c['yo'],c['ctx'].canvas.height)}
function gx0(c){return -c['xo']/c['xm']};
function gy0(c){return -c['yo']/c['ym']};
function gto(c,xo,yo){c['xo']+=xo;c['yo']+=yo}
function gts(c,xs,ys){c['xm']*=xs;c['ym']*=ys}
function gtso(c,xs,ys){gto(c,c['xm']*(1.0-xs)/2.0,c['ym']*(1.0-ys)/2.0);gts(c,xs,ys)}
function gfs(c,bg){c['ctx'].fillStyle=bg}
function gss(c,fg){c['ctx'].strokeStyle=fg}
function glw(c,w){c['ctx'].lineWidth=w}
function gfz(c,x,y,ox,oy,t,co,a){gfs(c,co);c['ctx'].textAlign=a;c['ctx'].fillText(t,gchx(c,x)+ox,gchy(c,y)-oy)}
function gbe(c,x,y){c['ctx'].beginPath();c['ctx'].moveTo(gchx(c,x),gchy(c,y))}
function gln(c,x,y){c['ctx'].lineTo(gchx(c,x),gchy(c,y))}
function gct(c,x1,y1,x2,y2,x3,y3){c['ctx'].bezierCurveTo(gchx(c,x1),gchy(c,y1),gchx(c,x2),gchy(c,y2),gchx(c,x3),gchy(c,y3))}
function glm(c,x,y){c['ctx'].moveTo(gchx(c,x),gchy(c,y))}
function gle(c){c['ctx'].closePath()}
function gfl(c){c['ctx'].fill()}
function gst(c){c['ctx'].stroke()}
function gfi(c){gle(c);gst(c)}
function gbd(c){gbe(c,0,0);gln(c,1,0);gln(c,1,1);gln(c,0,1);gle(c);gfl(c);gst(c)}
function ggr(c,xs,ys,yt,xn,x0,x1,y0,y1,ar,nx,vx,vy,av,w,cols){
gtso(c,xs,ys);
gss(c,'black');glw(c,1.5);
gbe(c,0,1);gln(c,0,0);gln(c,1,0);gst(c);
glw(c,0.2);
var hi=c['ctx'].measureText('M').width, wi=c['ctx'].measureText('1').width;
for(var i=0;i<11;i++){var y=i/10.0;gbe(c,-0.01,y);gln(c,1,y);gst(c);var t=''+(((y1-y0)*i/10+y0).toFixed(2));gfz(c,0,y,-wi,0,t,'black','end')}
gfz(c,gx0(c),0.55,wi,0,yt,'#0080ff','left');
var m=Math.round(0.5+xn/20.0);
for(var i=0;i<xn;i++){var n=ar[nx+i];var x=ar[vx+i];var xo=(x-x0)/(x1-x0);if(c['skey']&&(i<(xn-1))&&(i%m)==0){gbe(c,xo,0);gln(c,xo,-0.01);gst(c);gfz(c,xo,0,0,-hi*1.5,n,'#00a050','center')}if(c['slines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}}
var xhr=3600+x1-(x1%3600);
gss(c,'brown');
if(c['tkey']||c['tlines']){var hlv=c['hln'][c['hl']];hrs=c['hrs'][c['hr']]*3600/hlv;
var l=0;tpos=2.7;if(c['over']){tpos=1.5}
for(var i=xhr;i>=x0;i-=hrs){var n=dfmt(c,i);var xo=(i-x0)/(x1-x0);if(xo<=1&&c['tkey']&&((l%hlv)==0)){gbe(c,xo,0);gln(c,xo,-0.02);gst(c);gfz(c,xo,0,0,-hi*tpos,n,'brown','center')}if(xo<=1&&c['tlines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}l++}}
glw(c,1);
if(c['smooth']){for(var j=1;j<w.length;j++){var f=1;gss(c,cols[j-1]);
var xa=0,ya=0,xb=0,yb=0;
for(var i=0;i<xn;i++){var x=ar[vx+i];var y=ar[w[j]+vy+i];var xo=(x-x0)/(x1-x0);var yo=(y-y0)/(y1-y0);if(f==1){gbe(c,xo,yo);f=0;xb=xo;yb=yo}else{gct(c,(xa+xb)/2,(ya+yb)/2,xb,yb,(xb+xo)/2,(yb+yo)/2)}xa=xb;ya=yb;xb=xo;yb=yo}gct(c,(xa+xb)/2,(ya+yb)/2,xo,yo,xo,yo);gst(c);}}
else{for(var j=1;j<w.length;j++){var f=1;gss(c,cols[j-1]);
for(var i=0;i<xn;i++){var x=ar[vx+i];var y=ar[w[j]+vy+i];var xo=(x-x0)/(x1-x0);var yo=(y-y0)/(y1-y0);if(f==1){gbe(c,xo,yo);f=0}else{gln(c,xo,yo)}}gst(c);}}
glw(c,1);
for(var j=1;j<w.length;j++){if(av[j-1]>0){gss(c,'red');var y=(av[j-1]-y0)/(y1-y0);gbe(c,0,y);gln(c,1,y);gst(c);
var t=''+av[j-1].toFixed(2)+'av';gfz(c,1,y,1,0,t,cols[j-1],'left')}}
if(c['tkey']){var col,hrl=c['hrs'].length;for(var i=0;i<hrl;i++){if(c['hr']==i){col='red'}else{col='black'}gfz(c,1,0,c['xo']-c['pxe'],hi*(i+1)*2,''+c['hrs'][i],col,'end')}for(var i=0;i<c['hln'].length;i++){if(c['hl']==i){col='red'}else{col='black'}gfz(c,1,0,c['xo']-c['pxe'],hi*(i+2+hrl)*2,''+c['hrs'][i],col,'end')}}
}
function sn(i,shi){if(shi.indexOf(' Shift ')<0){return ''+(i%10)}else{return shi.replace(/.* ([a-z])[a-z]*$/,'$1')}}
function gc(c){var div=document.getElementById('can0');while(div.firstChild){div.removeChild(div.firstChild)}c['can']=document.createElement('canvas');c['can'].id='can';c['wx']=window.innerWidth;c['wy']=window.innerHeight;c['xm']=Math.max(Math.round(c['wx']*0.9+0.5),400);c['ym']=Math.max(Math.round(c['wy']*0.8+0.5),400);if(c['ym']>c['xm']){c['ym']=c['xm']}c['xo']=0.0;c['yo']=0.0;c['ctx']=c['can'].getContext('2d');c['ctx'].canvas.width=c['xm']+1;c['ctx'].canvas.height=c['ym']+1;div.appendChild(c['can']);c['pxe']=Math.max(Math.round(c['xm']/250),1)}
function opts(t,i){var e=document.getElementById(i);if(t.checked){e.style.visibility='visible'}else{e.style.visibility='hidden'}}
function ghrs(c){c['hrs']=[1,2,3,4,6,8,12,24,48];c['hln']=[1,2,3,4,6]}
function ghg(c,dx){var tl=dx/(gchx(c,1)/50)/3600;for(var j=c['hrs'].length-1;j>=0;j--){if(tl<c['hrs'][j]){c['hr']=j}else{break}}if(tl<0.5){var tb=1/tl;for(var k=0;k<c['hln'].length;k++){if(c['hln'][k]<tb){c['hl']=k}else{break}}}else{c['hl']=1}}
function gopt(c,cbx){for(var i=0;i<cbx.length;i++){ccb(c,cbx[i])}}
function doinit(cbx,xon){for(var i=0;i<cbx.length;i++){var e=document.getElementById(cbx[i]);if(e){var n=gcn(cbx[i]);if(n==''){if(xon[cbx[i]]){e.checked=true}else{e.checked=false}}else{if(n=='1'){e.checked=true}else{e.checked=false}}}}}
";
addScript($g); addScript($g);
} }
# #
function addTips() function addTips()
{ {
$t = "function untip(e){if(e){if(typeof e.tmo!='undefined'){clearTimeout(e.tmo);delete e.tmo}e.style.opacity=0;e.style.visibility='hidden'}} $t = TipsJS();
function tip(i,n){var e=document.getElementById(i);if(e){if(e.style.visibility=='visible'){untip(e)}else{e.style.visibility='visible';e.style.opacity=0.95;e.tmo=setTimeout(function(){untip(e)},n)}}}
";
addScript($t); addScript($t);
$tcss = "span.tip0 {position:absolute;z-index:42;pointer-events:none;font-size:smaller;text-align:left;} $tcss = TipsCSS();
span.notip {position:relative;color:#0077ee;background:#bbffff;border-style:solid;border-color:black;border-width:1px;left:-10px;width:200px;padding:2px;float:left;transition:visibility 0.5s,opacity 0.5s;visibility:hidden;opacity:0}
span.tip {visibility: visibile;}
span.q {position: relative; width: 16px; height: 16px; display: inline-block; background-color: #0077ee; line-height: 16px; color: White; font-size: 13px; font-weight: bold; border-radius: 8px; text-align: center; cursor: pointer; }
ul.tip {margin-top:0;margin-bottom:0;list-style:disc inside none;margin-left:0;padding-left:0.5em;display:block}
li {padding-left:0.5em;}
";
addCSS($tcss); addCSS($tcss);
} }
# #
@ -198,76 +134,12 @@ function pghead($css_marker, $script_marker, $name)
$head .= "<meta content='IE=edge' http-equiv='X-UA-Compatible'>"; $head .= "<meta content='IE=edge' http-equiv='X-UA-Compatible'>";
$head .= "<meta content='width=device-width, initial-scale=1' name='viewport'>"; $head .= "<meta content='width=device-width, initial-scale=1' name='viewport'>";
$head .= "<script type='text/javascript'> $head .= "<script type='text/javascript'>\n";
function gcn(n){var ans='',d=document.cookie;if(d){var c0=d.indexOf(n+'='),cs=d.indexOf(' '+n+'=');if(c0==0||cs>0){if(cs>0){c0=cs+1}var c=d.substr(c0).split(';',1);var e=c[0].indexOf('=');if(e>0){ans=c[0].substr(e+1)}}}return ans} $head .= HeadJS();
function scnv(n,v){var d=new Date();d.setTime(d.getTime()+(864*Math.pow(10,8)));document.cookie=n+'='+v+'; expires='+d.toUTCString()+'; path=/'} $head .= "\n</script>\n";
function ni(e,o){if(e){if(o==0){e.defd=e.style.display;e.style.display='none'}else{e.style.display=e.defd}}} $head .= "<style type='text/css'>\n";
function domin(o){var e=document.getElementById('minicb');if(e){if(o==0){e.checked=true}else{e.checked=false}};for(var i=0;i<10;i++){e=document.getElementById('mini'+i);ni(e,o)}} $head .= HeadCSS($iCrap);
function mini(){var hm=gcn('mini');if(hm==''){domin(1)}else{domin(0)}} $head .= "\n$css_marker\n</style>\n";
function md(e){var c='';if(e.checked){c='y'}scnv('mini',c);mini()}
function tim(){var e=document.getElementById('ftr');if(e){var now=new Date(),t=document.createTextNode(now.toLocaleString());e.appendChild(t)}}
function jst(){var e=document.getElementById('jst');if(e){e.style.visibility='hidden'}}
</script>\n";
$head .= "<style type='text/css'>
input[type=checkbox] {vertical-align: -2px;}
form {display: inline-block;}
html, body {height: 100%; font-family:Arial, Verdana, sans-serif; font-size:12pt; background-color:#eeffff; text-align: center; background-repeat: no-repeat; background-position: center;}
.page {min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -50px; position: relative;}
div.jst {color:red; font-weight: bold; font-size: 8; text-align: center; vertical-align: top;}
div.accwarn {color:red; font-weight: bold; font-size: 8; text-align: center; vertical-align: top;}
div.topd {background-color:#cff; border-color: #cff; border-style: solid; border-width: 9px;}
.topdes {color:blue; text-align: right;}
.topdesl {color:blue; text-align: left;}
.topwho {color:black; font-weight: bold; margin-right: 8px;}
.topdat {margin-left: 8px; margin-right: 24px; color:green; font-weight: bold;}
span.nb {white-space: pre;}
span.login {float: right; margin-left: 8px; margin-right: 24px;}
span.hil {color:blue;}
span.user {color:green;}
span.addr {color:brown;}
span.warn {color:orange; font-weight:bold;}
span.urg {color:red; font-weight:bold;}
span.err {color:red; font-weight:bold; font-size:120%;}
span.alert {color:red; font-weight:bold; font-size:250%;}
input.tiny {width: 0px; height: 0px; margin: 0px; padding: 0px; outline: none; border: 0px;}
#n42 {margin:0; position: relative; color:#ffffff; background:#0077ee;}
#n42 a {color:#fff; text-decoration:none; padding: 6px; display:block;}
#n42 td {min-width: 100px; float: left; vertical-align: top; padding: 0px 2px;}
#n42 td.navboxr {float: right;}
#n42 td.nav {position: relative;}
#n42 td.ts {border-width: 1px; border-color: #0022ee; border-style: solid none none none;}";
if (!$iCrap)
{
$head .= "
#n42 div.sub {left: 0px; z-index: 42; position: absolute; visibility: hidden;}
#n42 td.nav:hover {background:#0099ee;}
#n42 td.nav:hover div.sub {background:#0077ee; visibility: visible;}";
}
$head .= "
h1 {margin-top: 20px; float:middle; font-size: 20px;}
.foot, .push {height: 50px;}
.title {background-color: #909090;}
.even {background-color: #cccccc;}
.odd {background-color: #a8a8a8;}
.hid {display: none;}
.dl {text-align: left; padding: 2px 8px;}
.dr {text-align: right; padding: 2px 8px;}
.dc {text-align: center; padding: 2px 8px;}
.dls {text-align: left; padding: 2px 8px; text-decoration:line-through; font-weight:lighter; }
.drs {text-align: right; padding: 2px 8px; text-decoration:line-through; font-weight:lighter; }
.dcs {text-align: center; padding: 2px 8px; text-decoration:line-through; font-weight:lighter; }
.st0 {font-weight:bold; }
.st1 {color:red; font-weight:bold; }
.st2 {color:green; font-weight:bold; }
.st3 {color:blue; font-weight:bold; }
.fthi {color:red; font-size:7px; }
.ftlo {color:green; font-size:7px; }
.ft {color:blue; font-size:7px; }
.ftl {text-align: left; color:blue; font-size:7px; display:inline-block; width:20%; white-space: nowrap; }
.ftm {text-align: middle; font-size:10pt; display:inline-block; width:60%; white-space: nowrap; }
.ftr {text-align: rigth; color:blue; font-size:7px; display:inline-block; width:20%; white-space: nowrap; }
$css_marker
</style>\n";
$head .= '<meta name="robots" content="noindex">'; $head .= '<meta name="robots" content="noindex">';

1253
src/ckdb.c

File diff suppressed because it is too large Load Diff

142
src/ckdb.h

@ -55,7 +55,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.0" #define DB_VERSION "1.0.0"
#define CKDB_VERSION DB_VERSION"-1.079" #define CKDB_VERSION DB_VERSION"-1.090"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -699,25 +699,47 @@ typedef struct logqueue {
extern K_LIST *logqueue_free; extern K_LIST *logqueue_free;
extern K_STORE *logqueue_store; extern K_STORE *logqueue_store;
// WORKQUEUE // MSGLINE
typedef struct workqueue { typedef struct msgline {
char *buf;
int which_cmds; int which_cmds;
enum cmd_values cmdnum;
char cmd[CMD_SIZ+1];
char id[ID_SIZ+1];
tv_t now; tv_t now;
char by[TXT_SML+1];
char code[TXT_MED+1];
char inet[TXT_MED+1];
tv_t cd; tv_t cd;
char id[ID_SIZ+1];
char cmd[CMD_SIZ+1];
char *msg;
bool hasseq;
char *seqcmdnam;
uint64_t n_seqall;
uint64_t n_seqcmd;
uint64_t n_seqstt;
uint64_t n_seqpid;
int seqentryflags;
char *code;
K_TREE *trf_root; K_TREE *trf_root;
K_STORE *trf_store; K_STORE *trf_store;
} MSGLINE;
#define ALLOC_MSGLINE 8192
#define LIMIT_MSGLINE 0
#define CULL_MSGLINE 16
#define INIT_MSGLINE(_item) INIT_GENERIC(_item, msgline)
#define DATA_MSGLINE(_var, _item) DATA_GENERIC(_var, _item, msgline, true)
#define DATA_MSGLINE_NULL(_var, _item) DATA_GENERIC(_var, _item, msgline, false)
extern K_LIST *msgline_free;
extern K_STORE *msgline_store;
// WORKQUEUE
typedef struct workqueue {
K_ITEM *msgline_item;
char *by;
char *code;
char *inet;
} WORKQUEUE; } WORKQUEUE;
#define ALLOC_WORKQUEUE 1024 #define ALLOC_WORKQUEUE 1024
#define LIMIT_WORKQUEUE 0 #define LIMIT_WORKQUEUE 0
#define CULL_WORKQUEUE 16 #define CULL_WORKQUEUE 32
#define INIT_WORKQUEUE(_item) INIT_GENERIC(_item, workqueue) #define INIT_WORKQUEUE(_item) INIT_GENERIC(_item, workqueue)
#define DATA_WORKQUEUE(_var, _item) DATA_GENERIC(_var, _item, workqueue, true) #define DATA_WORKQUEUE(_var, _item) DATA_GENERIC(_var, _item, workqueue, true)
@ -795,28 +817,28 @@ extern tv_t missing_secuser_max;
* missing counters are incremented - maxseq will now be N+5 * missing counters are incremented - maxseq will now be N+5
* Once we reach N+size we need to discard N and use it as N+size * Once we reach N+size we need to discard N and use it as N+size
* and increment seqbase N * and increment seqbase N
* When we discard the oldest item due to needing more, if that oldest * When we discard the oldest entry due to needing more, if that oldest
* item was missing, it is now considered lost and the lost counters * entry was missing, it is now considered lost and the lost counters
* are incremented (and missing counters decremented) * are incremented (and missing counters decremented)
* If we receive an item N+x where N+x-maxseq>highlimit we reject it as high * If we receive an entry N+x where N+x-maxseq>highlimit we reject it as high
* and increment the high counters - this avoids creating a high bad sequence * and increment the high counters - this avoids creating a high bad sequence
* number and flagging any missing sequence numbers, most likely incorrectly, * number and flagging any missing sequence numbers, most likely incorrectly,
* as lost in the range N to N+x-size * as lost in the range N to N+x-size
* If we receive an item N-x i.e. less than seqbase N, then: * If we receive an entry N-x i.e. less than seqbase N, then:
* If maxseq-N = size then N-x is considered stale and the stale counters * If maxseq-N = size then N-x is considered stale and the stale counters
* are incremented since there's no unused items below N available * are incremented since there's no unused entries below N available
* This shouldn't normally happen after we've received size seq numbers * This shouldn't normally happen after we've received size seq numbers
* Else maxseq-N is less than size, that means there are unused items below N * Else maxseq-N is less than size, that means there are unused entries below N
* This will usually only be with a new sequence and the first seq was out * This will usually only be with a new sequence and the first seq was out
* of order, before lower sequence numbers, thus maxseq should be close to * of order, before lower sequence numbers, thus maxseq should be close to
* seqbase N and no where near N+size and there should be x unused below N * seqbase N and no where near N+size and there should be x unused below N
* If there are x unused items below N then we can move seqbase down to N-x * If there are x unused entries below N then we can move seqbase down to N-x
* after we flag all N-1,N-2,N-3..N-(x-1) as missing * after we flag all N-1,N-2,N-3..N-(x-1) as missing
* Else there aren't enough unused items below N, then N-x is considered * Else there aren't enough unused entries below N, then N-x is considered
* stale and the stale counters are incremented * stale and the stale counters are incremented
* *
* timelimit is an early limit to flag missing sequence numbers as 'transient' * timelimit is an early limit to flag missing sequence numbers as 'transient'
* Normally, if a missing item at N is later reused, it will be discarded and * Normally, if a missing entry at N is later reused, it will be discarded and
* reported as lost * reported as lost
* After the reload queue is complete, timelimit reports missing sequence * After the reload queue is complete, timelimit reports missing sequence
* numbers early, as transient, if they have been missing for 'timelimit' but * numbers early, as transient, if they have been missing for 'timelimit' but
@ -827,7 +849,29 @@ extern tv_t missing_secuser_max;
* reload queue has cleared after ckdb startup, it will report the transient * reload queue has cleared after ckdb startup, it will report the transient
* missing sequence numbers shortly after the timelimit * missing sequence numbers shortly after the timelimit
* When they are later found or lost they will again be reported, this time as * When they are later found or lost they will again be reported, this time as
* found or lost */ * found or lost
*
* The sequence fields are checked for validity when the message arrives
* Sequence order checking of reload lines are done immediately
* Checking of ckpool lines isn't done until after the reload completes
* This solves the problem of the overlap from reload to queue
* If we stop the reload when we first match the queue, there's the issue
* that data order in the reload file may not match the data order in the
* queue and thus we could lose a record that is late in the reload file
* but was before the queue start
* To solve this unlikely (but not impossible) issue we reload all reload
* files to the end and then sequence process the queued data after the
* reload completes
* This however produces another (solvable) problem that the queue start
* may be stale when we finally complete the reload
* To handle this we keep a list of all lost records in the reload and check
* the stale queue records against those to see if we found them
* If a queue line is lower than minseq then that's a sequence error
* If a queue line is stale but above minseq, we check if it is in the
* lost list and then report it as recovered (and process it)
* If it wasn't lost then it's an expected duplicate and ignored
* Once the queue exceeds the reload maxseq, the lost records are no longer
* needed and are discarded */
// ckpool sequence numbers // ckpool sequence numbers
#define SEQALL "seqall" #define SEQALL "seqall"
@ -860,30 +904,26 @@ enum seq_num {
// Ensure size is a (multiple of 8)-1 // Ensure size is a (multiple of 8)-1
#define SEQ_CODE 15 #define SEQ_CODE 15
#define SICHR(_sif) (((_sif) == SI_EARLYSOCK) ? 'E' : \ #define SECHR(_sif) (((_sif) == SE_EARLYSOCK) ? 'E' : \
(((_sif) == SI_RELOAD) ? 'R' : \ (((_sif) == SE_RELOAD) ? 'R' : \
(((_sif) == SI_SOCKET) ? 'S' : '?'))) (((_sif) == SE_SOCKET) ? 'S' : '?')))
// Msg from the socket before startup completed - ignore if it was a DUP // Msg from the socket before startup completed
#define SI_EARLYSOCK 1 #define SE_EARLYSOCK 1
// Msg was from reload // Msg was from reload
#define SI_RELOAD 2 #define SE_RELOAD 2
// Msg from the socket after startup completed // Msg from the socket after startup completed
#define SI_SOCKET 4 #define SE_SOCKET 4
/* An SI_EARLYSOCK item vs an SI_RELOAD item is not considered a DUP
* since the reload reads to the end of the reload file after
* the match between the queue and the reload has been found */
typedef struct seqitem { typedef struct seqentry {
int flags; int flags;
tv_t cd; // sec:0=missing, usec:0=miss !0=trans tv_t cd; // sec:0=missing, usec:0=miss !0=trans
tv_t time; tv_t time;
char code[SEQ_CODE+1]; char code[SEQ_CODE+1];
} SEQITEM; } SEQENTRY;
typedef struct seqdata { typedef struct seqdata {
size_t size; // item count - MUST be a power of 2 size_t size; // entry count - MUST be a power of 2
uint64_t highlimit; uint64_t highlimit;
int timelimit; int timelimit;
uint64_t minseq; uint64_t minseq;
@ -894,12 +934,15 @@ typedef struct seqdata {
uint64_t lost; uint64_t lost;
uint64_t stale; uint64_t stale;
uint64_t high; uint64_t high;
uint64_t recovered;
uint64_t ok; uint64_t ok;
uint64_t reloadmax;
tv_t firsttime; tv_t firsttime;
tv_t lasttime; tv_t lasttime;
tv_t firstcd; tv_t firstcd;
tv_t lastcd; tv_t lastcd;
SEQITEM *item; SEQENTRY *entry;
K_STORE *reload_lost;
} SEQDATA; } SEQDATA;
// SEQSET // SEQSET
@ -911,6 +954,7 @@ typedef struct seqset {
uint64_t lost; // total from seqdata uint64_t lost; // total from seqdata
uint64_t stale; // total from seqdata uint64_t stale; // total from seqdata
uint64_t high; // total from seqdata uint64_t high; // total from seqdata
uint64_t recovered; // total from seqdata
uint64_t ok; // total from seqdata uint64_t ok; // total from seqdata
SEQDATA seqdata[SEQ_MAX]; SEQDATA seqdata[SEQ_MAX];
} SEQSET; } SEQSET;
@ -920,15 +964,22 @@ typedef struct seqset {
* the first time it processes a record with sequences */ * the first time it processes a record with sequences */
// SEQALL and SHARES */ // SEQALL and SHARES */
#define SEQ_LARGE_LIM 64 #define SEQ_LARGE_TRANS_LIM 16
#define SEQ_LARGE_SIZ (65536*SEQ_LARGE_LIM) #define SEQ_LARGE_SIZ (65536*SEQ_LARGE_TRANS_LIM)
// WORKERSTATS, AUTH and ADDRAUTH // WORKERSTATS, AUTH and ADDRAUTH
#define SEQ_MEDIUM_LIM 128 #define SEQ_MEDIUM_TRANS_LIM 32
#define SEQ_MEDIUM_SIZ 65536 #define SEQ_MEDIUM_SIZ 65536
// The rest // The rest
#define SEQ_SMALL_LIM 128 #define SEQ_SMALL_TRANS_LIM 64
#define SEQ_SMALL_SIZ 16384 #define SEQ_SMALL_SIZ 16384
// highlimit ratio (shift down bits)
#define HIGH_SHIFT 8
// Smallest highlimit allowed
#define HIGH_MIN 32
// Smallest _SIZ allowed
#define BASE_SIZ (HIGH_MIN << HIGH_SHIFT)
#define ALLOC_SEQSET 1 #define ALLOC_SEQSET 1
#define LIMIT_SEQSET 16 #define LIMIT_SEQSET 16
#define INIT_SEQSET(_item) INIT_GENERIC(_item, seqset) #define INIT_SEQSET(_item) INIT_GENERIC(_item, seqset)
@ -941,11 +992,11 @@ extern K_STORE *seqset_store;
// Initialised when seqset_free is allocated // Initialised when seqset_free is allocated
extern char *seqnam[SEQ_MAX]; extern char *seqnam[SEQ_MAX];
// SEQTRANS // SEQTRANS also used for reload_lost
typedef struct seqtrans { typedef struct seqtrans {
int seq; int seq;
uint64_t seqnum; uint64_t seqnum;
SEQITEM item; SEQENTRY entry;
} SEQTRANS; } SEQTRANS;
// The stores are created and freed each time required // The stores are created and freed each time required
@ -953,9 +1004,10 @@ extern K_LIST *seqtrans_free;
#define ALLOC_SEQTRANS 1024 #define ALLOC_SEQTRANS 1024
#define LIMIT_SEQTRANS 0 #define LIMIT_SEQTRANS 0
#define CULL_SEQTRANS 65536 #define CULL_SEQTRANS 64
#define INIT_SEQTRANS(_item) INIT_GENERIC(_item, seqtrans) #define INIT_SEQTRANS(_item) INIT_GENERIC(_item, seqtrans)
#define DATA_SEQTRANS(_var, _item) DATA_GENERIC(_var, _item, seqtrans, true) #define DATA_SEQTRANS(_var, _item) DATA_GENERIC(_var, _item, seqtrans, true)
#define DATA_SEQTRANS_NULL(_var, _item) DATA_GENERIC(_var, _item, seqtrans, false)
// USERS // USERS
typedef struct users { typedef struct users {
@ -1902,13 +1954,15 @@ extern void sequence_report(bool lock);
#define PPLNSDIFFADD "pplns_diff_add" #define PPLNSDIFFADD "pplns_diff_add"
// Data free functions (first) // Data free functions (first)
extern void free_msgline_data(K_ITEM *item, bool t_lock, bool t_cull);
extern void free_workinfo_data(K_ITEM *item); extern void free_workinfo_data(K_ITEM *item);
extern void free_sharesummary_data(K_ITEM *item); extern void free_sharesummary_data(K_ITEM *item);
extern void free_optioncontrol_data(K_ITEM *item); extern void free_optioncontrol_data(K_ITEM *item);
extern void free_markersummary_data(K_ITEM *item); extern void free_markersummary_data(K_ITEM *item);
extern void free_workmarkers_data(K_ITEM *item); extern void free_workmarkers_data(K_ITEM *item);
extern void free_marks_data(K_ITEM *item); extern void free_marks_data(K_ITEM *item);
extern void free_seqset_data(K_ITEM *item); #define free_seqset_data(_item) _free_seqset_data(_item, false)
extern void _free_seqset_data(K_ITEM *item, bool lock);
#define safe_text(_txt) _safe_text(_txt, true) #define safe_text(_txt) _safe_text(_txt, true)
#define safe_text_nonull(_txt) _safe_text(_txt, false) #define safe_text_nonull(_txt) _safe_text(_txt, false)

1
src/ckdb_cmd.c

@ -5194,6 +5194,7 @@ static char *cmd_stats(__maybe_unused PGconn *conn, char *cmd, char *id,
USEINFO(poolstats, 1, 1); USEINFO(poolstats, 1, 1);
USEINFO(userstats, 2, 1); USEINFO(userstats, 2, 1);
USEINFO(workerstatus, 1, 1); USEINFO(workerstatus, 1, 1);
USEINFO(msgline, 1, 0);
USEINFO(workqueue, 1, 0); USEINFO(workqueue, 1, 0);
USEINFO(transfer, 0, 0); USEINFO(transfer, 0, 0);
USEINFO(heartbeatqueue, 1, 0); USEINFO(heartbeatqueue, 1, 0);

51
src/ckdb_data.c

@ -11,6 +11,39 @@
#include <math.h> #include <math.h>
// Data free functions (added here as needed) // Data free functions (added here as needed)
void free_msgline_data(K_ITEM *item, bool t_lock, bool t_cull)
{
K_ITEM *t_item = NULL;
TRANSFER *transfer;
MSGLINE *msgline;
DATA_MSGLINE(msgline, item);
if (msgline->trf_root)
msgline->trf_root = free_ktree(msgline->trf_root, NULL);
if (msgline->trf_store) {
t_item = msgline->trf_store->head;
while (t_item) {
DATA_TRANSFER(transfer, t_item);
if (transfer->mvalue != transfer->svalue)
FREENULL(transfer->mvalue);
t_item = t_item->next;
}
if (t_lock)
K_WLOCK(transfer_free);
k_list_transfer_to_head(msgline->trf_store, transfer_free);
if (t_cull) {
if (transfer_free->count == transfer_free->total &&
transfer_free->total >= ALLOC_TRANSFER * CULL_TRANSFER)
k_cull_list(transfer_free);
}
if (t_lock)
K_WUNLOCK(transfer_free);
msgline->trf_store = k_free_store(msgline->trf_store);
}
FREENULL(msgline->msg);
}
void free_workinfo_data(K_ITEM *item) void free_workinfo_data(K_ITEM *item)
{ {
WORKINFO *workinfo; WORKINFO *workinfo;
@ -87,15 +120,27 @@ void free_marks_data(K_ITEM *item)
FREENULL(marks->extra); FREENULL(marks->extra);
} }
void free_seqset_data(K_ITEM *item) void _free_seqset_data(K_ITEM *item, bool lock)
{ {
K_STORE *reload_lost;
SEQSET *seqset; SEQSET *seqset;
int i; int i;
DATA_SEQSET(seqset, item); DATA_SEQSET(seqset, item);
if (seqset->seqstt) { if (seqset->seqstt) {
for (i = 0; i < SEQ_MAX; i++) for (i = 0; i < SEQ_MAX; i++) {
FREENULL(seqset->seqdata[i].item); reload_lost = seqset->seqdata[i].reload_lost;
if (reload_lost) {
if (lock)
K_WLOCK(seqtrans_free);
k_list_transfer_to_head(reload_lost, seqtrans_free);
if (lock)
K_WUNLOCK(seqtrans_free);
k_free_store(reload_lost);
seqset->seqdata[i].reload_lost = NULL;
}
FREENULL(seqset->seqdata[i].entry);
}
seqset->seqstt = 0; seqset->seqstt = 0;
} }
} }

Loading…
Cancel
Save