/* * ======== Log_Module_startup ======== */ Int LoggerBuf_Module_startup(Int phase) { Int i; /* loop over all "permanent" instances and initialize them */ for (i = 0; i < LoggerBuf_Object_count(); i++) { LoggerBuf_instanceStartup(LoggerBuf_Object_get(NULL, i)); } return (Startup_DONE); }
/* * ======== Instance_init ========= */ Int LoggerBuf_Instance_init() { loggerObj = (LoggerBuf_Object*)(malloc(sizeof(LoggerBuf_Object))); printf("Entered\n"); loggerObj->entryArr = (LoggerBuf_Entry*)(malloc(0x40*sizeof(LoggerBuf_Entry))); if (loggerObj->entryArr != NULL) { loggerObj->flush = 0; loggerObj->numEntries = 0x40; loggerObj->endEntry = loggerObj->entryArr + (0x40-1); loggerObj->type = LoggerBuf_BufType_CIRCULAR; loggerObj->advance = 1; /* * The following are set in instanceStartup(): * obj->serial = 1; * obj->curEntry = obj->entryArr; * obj->readEntry = obj->entryArr; * obj->enabled = TRUE; */ LoggerBuf_instanceStartup(loggerObj); } return (0); /* status passed to finalize on error */ }
/* * ======== Instance_init ========= */ Int LoggerBuf_Instance_init(LoggerBuf_Object *obj, const LoggerBuf_Params *prms, Error_Block *eb) { obj->entryArr = Memory_alloc(prms->bufHeap, prms->numEntries * sizeof (LoggerBuf_Entry), 0, eb); if (obj->entryArr != NULL) { obj->flush = prms->exitFlush; obj->bufHeap = prms->bufHeap; obj->numEntries = prms->numEntries; obj->endEntry = obj->entryArr + (prms->numEntries - 1); /* * The following are set in instanceStartup(): * obj->serial = 1; * obj->curEntry = obj->entryArr; * obj->readEntry = obj->entryArr; * obj->enabled = TRUE; */ LoggerBuf_instanceStartup(obj); } return (0); /* status passed to finalize on error */ }