Ignore:
Timestamp:
Aug 16, 2018, 8:00:56 AM (6 years ago)
Author:
djay
Message:

Fixes for supporting properly the memory=protect which force the ZOO-Kernel to not store any downloaded files in memory. Add footer to the HPC support. Fix the autotools to build service_json and sshapi only when required so, when HPC support is activated, this also avoid adding too much dependencies at compilation time. Store md5 of the downloaded files to avoid uploading on HPC server the same file more than once, in case the md5 correspond.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/service.c

    r873 r877  
    539539 */
    540540map* addToMapWithSize(map* m,const char* n,const char* v,int size){
     541  char sin[128];
     542  char sname[10]="size";
     543  map *tmp;
    541544  if(hasKey(m,n)==false){
    542545    map* _cursor=m;
     
    547550    }
    548551  }
    549   char sname[10]="size";
    550552  if(strlen(n)>5)
    551553    sprintf(sname,"size_%s",n+6);
    552   map *tmp=getMap(m,n);
     554  tmp=getMap(m,n);
    553555  if(tmp->value!=NULL)
    554556    free(tmp->value);
     
    557559    memmove(tmp->value,v,size*sizeof(char));
    558560  tmp->value[size]=0;
    559   char sin[128];
    560561  sprintf(sin,"%d",size);
    561562  addToMap(m,sname,sin);
     
    578579    }
    579580    else{
    580 #ifdef DEBUG
    581       fprintf(stderr,"_CURSOR\n");
    582       dumpMap(_cursor);
    583 #endif
    584       while(_cursor->next!=NULL)
    585         _cursor=_cursor->next;
    586581      map* tmp1=getMap(*mo,tmp->name);
    587582      if(tmp1==NULL){
     583        while(_cursor->next!=NULL)
     584          _cursor=_cursor->next;
    588585        _cursor->next=createMap(tmp->name,tmp->value);
    589586      }
     
    594591    _cursor=*mo;
    595592    tmp=tmp->next;
    596 #ifdef DEBUG
    597     fprintf(stderr,"MO\n");
    598     dumpMap(*mo);
    599 #endif
    600593  }
    601594}
     
    711704  map* size=getMap(in,"size");
    712705  map *lout=*out;
     706  map *tmpVin,*tmpVout;
    713707  if(size!=NULL && pos>0){
    714708    char tmp[11];
     
    716710    size=getMap(in,tmp);
    717711    sprintf(tmp,"value_%d",pos);
    718     map* tmpVin=getMap(in,tmp);
    719     map* tmpVout=getMap(lout,tmp);
     712    tmpVin=getMap(in,tmp);
     713    tmpVout=getMap(lout,tmp);
    720714    free(tmpVout->value);
    721715    tmpVout->value=(char*)malloc((atoi(size->value)+1)*sizeof(char));
     
    724718  }else{
    725719    if(size!=NULL){
    726       map* tmpVin=getMap(in,"value");
    727       map* tmpVout=getMap(lout,"value");
     720      tmpVin=getMap(in,"value");
     721      tmpVout=getMap(lout,"value");
    728722      free(tmpVout->value);
    729723      tmpVout->value=(char*)malloc((atoi(size->value)+1)*sizeof(char));
     
    745739  map* size=getMap(in,"size");
    746740  map* length=getMap(in,"length");
     741  map* toload=getMap(in,"to_load");
     742  if(toload!=NULL && strcasecmp(toload->value,"false")==0){
     743    fprintf(stderr,"NO LOAD %s %d \n",__FILE__,__LINE__);
     744    return ;
     745  }
    747746  if(length!=NULL){
    748747    int len=atoi(length->value);
     
    767766  maps* res=NULL;
    768767  if(_cursor!=NULL){
     768    map* mc=_cursor->content;
     769    maps* mcs=_cursor->child;
    769770    res=createMaps(_cursor->name);
    770     map* mc=_cursor->content;
    771771    if(mc!=NULL){
    772772      addMapToMap(&res->content,mc);
    773773      loadMapBinaries(&res->content,mc);
    774774    }
    775     maps* mcs=_cursor->child;
    776775    if(mcs!=NULL){
    777776      res->child=dupMaps(&mcs);
     
    797796    }
    798797    else{
     798      maps* tmp1=getMaps(*mo,tmp->name);
    799799      while(_cursor->next!=NULL)
    800800        _cursor=_cursor->next;
    801       maps* tmp1=getMaps(*mo,tmp->name);
    802801      if(tmp1==NULL){
    803802        _cursor->next=dupMaps(&tmp);
     
    830829map* getMapArray(map* m,const char* key,int index){
    831830  char tmp[1024];
     831  map* tmpMap;
    832832  if(index>0)
    833833    sprintf(tmp,"%s_%d",key,index);
     
    837837  fprintf(stderr,"** KEY %s\n",tmp);
    838838#endif
    839   map* tmpMap=getMap(m,tmp);
     839  tmpMap=getMap(m,tmp);
    840840#ifdef DEBUG
    841841  if(tmpMap!=NULL)
     
    856856void setMapArray(map* m,const char* key,int index,const char* value){
    857857  char tmp[1024];
     858  map* tmpSize;
    858859  if(index>0){
     860    map* len=getMap(m,"length");
    859861    sprintf(tmp,"%s_%d",key,index);
    860     map* len=getMap(m,"length");
    861862    if((len!=NULL && atoi(len->value)<index+1) || len==NULL){
    862863      char tmp0[5];
     
    869870    addToMap(m,"length","1");
    870871  }
    871   map* tmpSize=getMapArray(m,"size",index);
     872  tmpSize=getMapArray(m,"size",index);
    872873  if(tmpSize!=NULL && strncasecmp(key,"value",5)==0){
     874    map* ptr=getMapOrFill(&m,tmp,(char *)"");
    873875#ifdef DEBUG
    874876    fprintf(stderr,"%s\n",tmpSize->value);
    875877#endif
    876     map* ptr=getMapOrFill(&m,tmp,(char *)"");
    877878    free(ptr->value);
    878879    ptr->value=(char*)malloc((atoi(tmpSize->value)+1)*sizeof(char));
     
    930931  maps* tmp=mi;   
    931932  maps* _cursor=getMaps(*mo,tmp->name);
    932 
    933   if(_cursor==NULL)
    934     return -1;
    935 
    936   map* tmpLength=getMap(_cursor->content,"length");
    937933  char tmpLen[10];
    938934  int len=1;
    939   if(tmpLength!=NULL){
    940     len=atoi(tmpLength->value);
    941   }
    942 
    943935  char *tmpV[14]={
    944936    (char*)"size",
     
    957949    (char*)"UpperCorner"
    958950  };
     951  int i=0;
     952  map* tmpLength;
     953 
     954  if(_cursor==NULL)
     955    return -1;
     956
     957  tmpLength=getMap(_cursor->content,"length");
     958  if(tmpLength!=NULL){
     959    len=atoi(tmpLength->value);
     960  }
     961
    959962  sprintf(tmpLen,"%d",len+1);
    960963  addToMap(_cursor->content,"length",tmpLen);
    961   int i=0;
    962964  for(i=0;i<14;i++){
    963965    map* tmpVI=getMap(tmp->content,tmpV[i]);
     
    10711073  elements* tmp=e;
    10721074  while(tmp!=NULL){
     1075    iotype* tmpio=tmp->defaults;
     1076    int ioc=0;
    10731077    fprintf(stderr,"ELEMENT [%s]\n",tmp->name);
    10741078    fprintf(stderr," > CONTENT [%s]\n",tmp->name);
     
    10791083    dumpMap(tmp->additional_parameters);
    10801084    fprintf(stderr," > FORMAT [%s]\n",tmp->format);
    1081     iotype* tmpio=tmp->defaults;
    1082     int ioc=0;
    10831085    while(tmpio!=NULL){
    10841086      fprintf(stderr," > DEFAULTS [%s] (%i)\n",tmp->name,ioc);
     
    11131115  int i;
    11141116  while(tmp!=NULL){
     1117    map* mcurs=tmp->content;
     1118    int ioc=0;
     1119    iotype* tmpio;
    11151120    for(i=0;i<2+(4*level);i++)
    11161121      fprintf(stderr," ");
    11171122    fprintf(stderr,"%s:\n",tmp->name);
    1118     map* mcurs=tmp->content;
    11191123    while(mcurs!=NULL){
    11201124      for(i=0;i<4+(4*level);i++)
     
    11441148        dumpElementsAsYAML(tmp->child,level+1);
    11451149    }
    1146     iotype* tmpio=tmp->defaults;
    1147     int ioc=0;
     1150    tmpio=tmp->defaults;
    11481151    while(tmpio!=NULL){
    11491152      for(i=0;i<6+(4*level);i++)
     
    12251228      tmp->defaults=NULL;
    12261229    if(cursor->supported!=NULL && cursor->supported->content!=NULL){
     1230      iotype *tmp2=cursor->supported->next;
    12271231      tmp->supported=(iotype*)malloc(IOTYPE_SIZE);
    12281232      tmp->supported->content=NULL;
    12291233      addMapToMap(&tmp->supported->content,cursor->supported->content);
    12301234      tmp->supported->next=NULL;
    1231       iotype *tmp2=cursor->supported->next;
    1232       while(tmp2!=NULL){
     1235            while(tmp2!=NULL){
    12331236        addMapToIoType(&tmp->supported,tmp2->content);
    12341237#ifdef DEBUG
     
    13731376  registry* p=r;
    13741377  while(p!=NULL){
     1378    services* s=p->content;
    13751379    fprintf(stderr,"%s \n",p->name);
    1376     services* s=p->content;
    13771380    s=p->content;
    13781381    while(s!=NULL){
     
    15731576 */
    15741577void inheritance(registry *r,service** s){
     1578  service* ls=*s;
     1579  map *profile,*level;
    15751580  if(r==NULL)
    15761581    return;
    1577   service* ls=*s;
    1578   if(ls->content==NULL)
     1582  if(ls==NULL || ls->content==NULL)
    15791583    return;
    1580   map* profile=getMap(ls->content,"extend");
    1581   map* level=getMap(ls->content,"level");
     1584  profile=getMap(ls->content,"extend");
     1585  level=getMap(ls->content,"level");
    15821586  if(profile!=NULL&&level!=NULL){
    15831587    service* s1;
     
    16141618  memset(tmp,0,1024*10*10);
    16151619  while(tm!=NULL){
     1620    map* tc=tm->content;
    16161621    if(i>=10)
    16171622      break;
     
    16201625    strcpy(tmp[i][j],tm->name);
    16211626    j++;
    1622     map* tc=tm->content;
    16231627    while(tc!=NULL){
    16241628      if(j>=30)
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png