Lines Matching refs:ramlog

2297 static uint32_t ocs_ramlog_next_idx(ocs_ramlog_t *ramlog, uint32_t idx);
2315 ocs_ramlog_t *ramlog; in ocs_ramlog_init() local
2317 ramlog = ocs_malloc(ocs, sizeof(*ramlog), OCS_M_ZERO | OCS_M_NOWAIT); in ocs_ramlog_init()
2318 if (ramlog == NULL) { in ocs_ramlog_init()
2323 ramlog->textbuf_count = buffer_count; in ocs_ramlog_init()
2325 …ramlog->textbufs = ocs_malloc(ocs, sizeof(*ramlog->textbufs)*buffer_count, OCS_M_ZERO | OCS_M_NOWA… in ocs_ramlog_init()
2326 if (ramlog->textbufs == NULL) { in ocs_ramlog_init()
2328 ocs_ramlog_free(ocs, ramlog); in ocs_ramlog_init()
2333 rc = ocs_textbuf_alloc(ocs, &ramlog->textbufs[i], buffer_len); in ocs_ramlog_init()
2336 ocs_ramlog_free(ocs, ramlog); in ocs_ramlog_init()
2341 ramlog->cur_textbuf_idx = 0; in ocs_ramlog_init()
2342 ramlog->textbuf_base = 1; in ocs_ramlog_init()
2343 ramlog->cur_textbuf = &ramlog->textbufs[0]; in ocs_ramlog_init()
2344 ramlog->initialized = TRUE; in ocs_ramlog_init()
2345 ocs_lock_init(ocs, &ramlog->lock, "ramlog_lock[%d]", ocs_instance(ocs)); in ocs_ramlog_init()
2346 return ramlog; in ocs_ramlog_init()
2361 ocs_ramlog_free(ocs_t *ocs, ocs_ramlog_t *ramlog) in ocs_ramlog_free() argument
2365 if (ramlog != NULL) { in ocs_ramlog_free()
2366 ocs_lock_free(&ramlog->lock); in ocs_ramlog_free()
2367 if (ramlog->textbufs) { in ocs_ramlog_free()
2368 for (i = 0; i < ramlog->textbuf_count; i ++) { in ocs_ramlog_free()
2369 ocs_textbuf_free(ocs, &ramlog->textbufs[i]); in ocs_ramlog_free()
2372 ocs_free(ocs, ramlog->textbufs, ramlog->textbuf_count*sizeof(*ramlog->textbufs)); in ocs_ramlog_free()
2373 ramlog->textbufs = NULL; in ocs_ramlog_free()
2375 ocs_free(ocs, ramlog, sizeof(*ramlog)); in ocs_ramlog_free()
2393 ocs_ramlog_clear(ocs_t *ocs, ocs_ramlog_t *ramlog, int clear_start_of_day, int clear_recent) in ocs_ramlog_clear() argument
2398 for (i = ramlog->textbuf_base; i < ramlog->textbuf_count; i ++) { in ocs_ramlog_clear()
2399 ocs_textbuf_reset(&ramlog->textbufs[i]); in ocs_ramlog_clear()
2401 ramlog->cur_textbuf_idx = 1; in ocs_ramlog_clear()
2403 if (clear_start_of_day && ramlog->textbuf_base) { in ocs_ramlog_clear()
2404 ocs_textbuf_reset(&ramlog->textbufs[0]); in ocs_ramlog_clear()
2408 ramlog->textbuf_base = 0; in ocs_ramlog_clear()
2430 if (ocs == NULL || ocs->ramlog == NULL) { in ocs_ramlog_printf()
2435 res = ocs_ramlog_vprintf(ocs->ramlog, fmt, ap); in ocs_ramlog_printf()
2454 ocs_ramlog_vprintf(ocs_ramlog_t *ramlog, const char *fmt, va_list ap) in ocs_ramlog_vprintf() argument
2456 if (ramlog == NULL || !ramlog->initialized) { in ocs_ramlog_vprintf()
2463 ocs_lock(&ramlog->lock); in ocs_ramlog_vprintf()
2464 if (ocs_textbuf_remaining(ramlog->cur_textbuf) < 120) { in ocs_ramlog_vprintf()
2465 ramlog->cur_textbuf_idx = ocs_ramlog_next_idx(ramlog, ramlog->cur_textbuf_idx); in ocs_ramlog_vprintf()
2466 ramlog->cur_textbuf = &ramlog->textbufs[ramlog->cur_textbuf_idx]; in ocs_ramlog_vprintf()
2467 ocs_textbuf_reset(ramlog->cur_textbuf); in ocs_ramlog_vprintf()
2470 ocs_textbuf_vprintf(ramlog->cur_textbuf, fmt, ap); in ocs_ramlog_vprintf()
2471 ocs_unlock(&ramlog->lock); in ocs_ramlog_vprintf()
2488 ocs_ramlog_next_idx(ocs_ramlog_t *ramlog, uint32_t idx) in ocs_ramlog_next_idx() argument
2492 if (idx >= ramlog->textbuf_count) { in ocs_ramlog_next_idx()
2493 idx = ramlog->textbuf_base; in ocs_ramlog_next_idx()
2511 ocs_ddump_ramlog(ocs_textbuf_t *textbuf, ocs_ramlog_t *ramlog) in ocs_ddump_ramlog() argument
2517 if ((ramlog == NULL) || (ramlog->textbufs == NULL)) { in ocs_ddump_ramlog()
2526 if (ramlog->textbuf_base) { in ocs_ddump_ramlog()
2527 rltextbuf = &ramlog->textbufs[0]; in ocs_ddump_ramlog()
2536 idx = ocs_ramlog_next_idx(ramlog, ramlog->textbuf_count); in ocs_ddump_ramlog()
2538 for (i = ramlog->textbuf_base; i < ramlog->textbuf_count; i ++) { in ocs_ddump_ramlog()
2539 rltextbuf = &ramlog->textbufs[idx]; in ocs_ddump_ramlog()
2541 idx = ocs_ramlog_next_idx(ramlog, idx); in ocs_ddump_ramlog()