alloc_cdat(void);
struct odat*
alloc_odat(void);
-void
+struct vdat*
alloc_vdat(void);
struct link*
alloc_link(void);
curr_odat(void);
struct vdat*
curr_vdat(void);
+struct map*
+curr_map(void);
struct set*
curr_set(void);
struct ref*
void* dsp[MAX_CHUNKS]; //dat stack pointer (per chunk)
int chunk_size; //size of a chunk (including its forfeited page)
int max_dats; //number of dats per chunk for this stack
-} ocs, vcs, ccs, rcs, lcs, pcs; //odat, vdat, and cdat, ref, link, post stacks
+} ocs, vcs, ccs, rcs, lcs, pcs, mcs; //odat, vdat, cdat,map, ref, link, post stacks
//type safety handled by macro expansion (do not call these directly from code, make dependent macros for access to these)
#define CHUNKS_LEN(STACK) ((STACK).csp - (STACK).chunks)
#define CDAT_FULL() (DATA_FULL(ccs, struct cdat))
#define CDAT_ALLOC() (ALLOC_DAT(ccs, struct cdat))
#define CCS_FULL() (CHUNKS_FULL(ccs))
+#define INIT_MAP() (INIT_STACK(mcs, struct map))
+#define CURRENT_MAP() (CURRENT_DATP(mcs, struct map))
+#define MAP_FULL() (DATA_FULL(mcs, struct map))
+#define MAP_ALLOC() (ALLOC_DAT(mcs, struct map))
+#define MCS_FULL() (CHUNKS_FULL(mcs))
#define INIT_LINK() (INIT_STACK(lcs, struct link))
#define CURRENT_LINK() (CURRENT_DATP(lcs,struct link))
#define LDAT_FULL() (DATA_FULL(lcs, struct link))
#define RCS_FULL() (CHUNKS_FULL(rcs))
//Metadata
#define CURRENT_SET() (CURRENT_CDAT()->set_list[CURRENT_CDAT()->num_sets])
-#define CURRENT_MODEL() (CURRENT_VDAT()->model_list[CURRENT_VDAT()->num_models])
+//#define CURRENT_QUAD() (CURRENT_MAP()->quad_list[CURRENT_MAP()->num_quads])
+//#define CURRENT_MODEL() (CURRENT_VDAT()->model_list[CURRENT_VDAT()->num_models])
-#define CURR_QUAD (CURR_ODAT->quad_file)
long pagesize;
int num_vdats = 0;
+int num_maps = 0;
+
int num_refs = 0;
-uint64_t ss_ref_id = 0x00FFFFFF; /* system space for ref_ids */
+int ss_ref_id = 0x0FFFFFFF; /* system space for ref_ids */
int num_posts = 0;
INIT_CDAT();
*cdat_stackp = CURRENT_CDAT();
+
memmove((*cdat_stackp)->name, root, 32);
INIT_ODAT();
INIT_VDAT();
+ INIT_MAP();
INIT_LINK();
INIT_REF();
INIT_POST();
alloc_odat
()
{
- num_odats++;
+ num_odats++;
if(ODAT_FULL())
{ if(!OCS_FULL())
{ fprintf(stderr, "You have allocated to many (%d) odats ", num_odats);
return CURRENT_ODAT();
}
-void
+struct vdat*
alloc_vdat
()
{ num_vdats++;
}
else
VDAT_ALLOC();
+
+ return CURRENT_VDAT();
+}
+
+struct map*
+alloc_map
+()
+{ num_maps++;
+ if(MAP_FULL())
+ { if(!MCS_FULL())
+ { fprintf(stderr, "You have allocated to many (%d) maps ", num_maps);
+ exit(EXIT_FAILURE);
+ }
+ else
+ CSP_PUSH(mcs);
+ }
+ else
+ MAP_ALLOC();
+
+ return CURRENT_MAP();
}
+
struct link*
alloc_link
()
{
return CURRENT_REF();
}
-struct model*
-curr_model
+struct map*
+curr_map
()
{
- return &CURRENT_MODEL();
+ return CURRENT_MAP();
}
+/* struct quad* */
+/* curr_quad */
+/* () */
+/* { */
+/* return &CURRENT_QUAD(); */
+/* } */
+/* struct model* */
+/* curr_model */
+/* () */
+/* { */
+/* return &CURRENT_MODEL(); */
+/* } */