Lines Matching refs:ramlog
2313 static uint32_t ocs_ramlog_next_idx(ocs_ramlog_t *ramlog, uint32_t idx);
2331 ocs_ramlog_t *ramlog; in ocs_ramlog_init() local
2333 ramlog = ocs_malloc(ocs, sizeof(*ramlog), OCS_M_ZERO | OCS_M_NOWAIT); in ocs_ramlog_init()
2334 if (ramlog == NULL) { in ocs_ramlog_init()
2339 ramlog->textbuf_count = buffer_count; in ocs_ramlog_init()
2341 …ramlog->textbufs = ocs_malloc(ocs, sizeof(*ramlog->textbufs)*buffer_count, OCS_M_ZERO | OCS_M_NOWA… in ocs_ramlog_init()
2342 if (ramlog->textbufs == NULL) { in ocs_ramlog_init()
2344 ocs_ramlog_free(ocs, ramlog); in ocs_ramlog_init()
2349 rc = ocs_textbuf_alloc(ocs, &ramlog->textbufs[i], buffer_len); in ocs_ramlog_init()
2352 ocs_ramlog_free(ocs, ramlog); in ocs_ramlog_init()
2357 ramlog->cur_textbuf_idx = 0; in ocs_ramlog_init()
2358 ramlog->textbuf_base = 1; in ocs_ramlog_init()
2359 ramlog->cur_textbuf = &ramlog->textbufs[0]; in ocs_ramlog_init()
2360 ramlog->initialized = TRUE; in ocs_ramlog_init()
2361 ocs_lock_init(ocs, &ramlog->lock, "ramlog_lock[%d]", ocs_instance(ocs)); in ocs_ramlog_init()
2362 return ramlog; in ocs_ramlog_init()
2377 ocs_ramlog_free(ocs_t *ocs, ocs_ramlog_t *ramlog) in ocs_ramlog_free() argument
2381 if (ramlog != NULL) { in ocs_ramlog_free()
2382 ocs_lock_free(&ramlog->lock); in ocs_ramlog_free()
2383 if (ramlog->textbufs) { in ocs_ramlog_free()
2384 for (i = 0; i < ramlog->textbuf_count; i ++) { in ocs_ramlog_free()
2385 ocs_textbuf_free(ocs, &ramlog->textbufs[i]); in ocs_ramlog_free()
2388 ocs_free(ocs, ramlog->textbufs, ramlog->textbuf_count*sizeof(*ramlog->textbufs)); in ocs_ramlog_free()
2389 ramlog->textbufs = NULL; in ocs_ramlog_free()
2391 ocs_free(ocs, ramlog, sizeof(*ramlog)); in ocs_ramlog_free()
2409 ocs_ramlog_clear(ocs_t *ocs, ocs_ramlog_t *ramlog, int clear_start_of_day, int clear_recent) in ocs_ramlog_clear() argument
2414 for (i = ramlog->textbuf_base; i < ramlog->textbuf_count; i ++) { in ocs_ramlog_clear()
2415 ocs_textbuf_reset(&ramlog->textbufs[i]); in ocs_ramlog_clear()
2417 ramlog->cur_textbuf_idx = 1; in ocs_ramlog_clear()
2419 if (clear_start_of_day && ramlog->textbuf_base) { in ocs_ramlog_clear()
2420 ocs_textbuf_reset(&ramlog->textbufs[0]); in ocs_ramlog_clear()
2424 ramlog->textbuf_base = 0; in ocs_ramlog_clear()
2446 if (ocs == NULL || ocs->ramlog == NULL) { in ocs_ramlog_printf()
2451 res = ocs_ramlog_vprintf(ocs->ramlog, fmt, ap); in ocs_ramlog_printf()
2470 ocs_ramlog_vprintf(ocs_ramlog_t *ramlog, const char *fmt, va_list ap) in ocs_ramlog_vprintf() argument
2472 if (ramlog == NULL || !ramlog->initialized) { in ocs_ramlog_vprintf()
2479 ocs_lock(&ramlog->lock); in ocs_ramlog_vprintf()
2480 if (ocs_textbuf_remaining(ramlog->cur_textbuf) < 120) { in ocs_ramlog_vprintf()
2481 ramlog->cur_textbuf_idx = ocs_ramlog_next_idx(ramlog, ramlog->cur_textbuf_idx); in ocs_ramlog_vprintf()
2482 ramlog->cur_textbuf = &ramlog->textbufs[ramlog->cur_textbuf_idx]; in ocs_ramlog_vprintf()
2483 ocs_textbuf_reset(ramlog->cur_textbuf); in ocs_ramlog_vprintf()
2486 ocs_textbuf_vprintf(ramlog->cur_textbuf, fmt, ap); in ocs_ramlog_vprintf()
2487 ocs_unlock(&ramlog->lock); in ocs_ramlog_vprintf()
2504 ocs_ramlog_next_idx(ocs_ramlog_t *ramlog, uint32_t idx) in ocs_ramlog_next_idx() argument
2508 if (idx >= ramlog->textbuf_count) { in ocs_ramlog_next_idx()
2509 idx = ramlog->textbuf_base; in ocs_ramlog_next_idx()
2527 ocs_ddump_ramlog(ocs_textbuf_t *textbuf, ocs_ramlog_t *ramlog) in ocs_ddump_ramlog() argument
2533 if ((ramlog == NULL) || (ramlog->textbufs == NULL)) { in ocs_ddump_ramlog()
2542 if (ramlog->textbuf_base) { in ocs_ddump_ramlog()
2543 rltextbuf = &ramlog->textbufs[0]; in ocs_ddump_ramlog()
2552 idx = ocs_ramlog_next_idx(ramlog, ramlog->textbuf_count); in ocs_ddump_ramlog()
2554 for (i = ramlog->textbuf_base; i < ramlog->textbuf_count; i ++) { in ocs_ddump_ramlog()
2555 rltextbuf = &ramlog->textbufs[idx]; in ocs_ddump_ramlog()
2557 idx = ocs_ramlog_next_idx(ramlog, idx); in ocs_ddump_ramlog()