Work on MEMFS

This commit is contained in:
Baudouin Raoult 2016-06-15 12:36:09 +00:00
parent ac97b10ad5
commit a6b8e3625e
2 changed files with 15 additions and 0 deletions

View File

@ -166,6 +166,7 @@ for n in NAMES:
""" % (n,), file=g)
print("""
/*printf("%s ===> %s\\n", path, start);*/
if(start == NULL) {
return NULL;
}

View File

@ -641,6 +641,20 @@ char *grib_context_full_defs_path(grib_context* c,const char* basename)
}
dir=dir->next;
}
#ifdef HAVE_MEMFS
sprintf(full,"/definitions/%s",basename);
printf("=====> %s\n", full);
if(codes_memfs_exists(full)) {
fullpath=(grib_string_list*)grib_context_malloc_clear_persistent(c,sizeof(grib_string_list));
Assert(fullpath);
fullpath->value=grib_context_strdup(c,full);
GRIB_MUTEX_LOCK(&mutex_c);
grib_trie_insert(c->def_files,basename,fullpath);
grib_context_log(c,GRIB_LOG_DEBUG,"Found def file %s in MEMFS",full);
GRIB_MUTEX_UNLOCK(&mutex_c);
return fullpath->value;
}
#endif
}
GRIB_MUTEX_LOCK(&mutex_c);