Lines Matching refs:ramlog
2295 static uint32_t ocs_ramlog_next_idx(ocs_ramlog_t *ramlog, uint32_t idx);
2313 ocs_ramlog_t *ramlog; in ocs_ramlog_init() local
2315 ramlog = ocs_malloc(ocs, sizeof(*ramlog), OCS_M_ZERO | OCS_M_NOWAIT); in ocs_ramlog_init()
2316 if (ramlog == NULL) { in ocs_ramlog_init()
2321 ramlog->textbuf_count = buffer_count; in ocs_ramlog_init()
2323 …ramlog->textbufs = ocs_malloc(ocs, sizeof(*ramlog->textbufs)*buffer_count, OCS_M_ZERO | OCS_M_NOWA… in ocs_ramlog_init()
2324 if (ramlog->textbufs == NULL) { in ocs_ramlog_init()
2326 ocs_ramlog_free(ocs, ramlog); in ocs_ramlog_init()
2331 rc = ocs_textbuf_alloc(ocs, &ramlog->textbufs[i], buffer_len); in ocs_ramlog_init()
2334 ocs_ramlog_free(ocs, ramlog); in ocs_ramlog_init()
2339 ramlog->cur_textbuf_idx = 0; in ocs_ramlog_init()
2340 ramlog->textbuf_base = 1; in ocs_ramlog_init()
2341 ramlog->cur_textbuf = &ramlog->textbufs[0]; in ocs_ramlog_init()
2342 ramlog->initialized = TRUE; in ocs_ramlog_init()
2343 ocs_lock_init(ocs, &ramlog->lock, "ramlog_lock[%d]", ocs_instance(ocs)); in ocs_ramlog_init()
2344 return ramlog; in ocs_ramlog_init()
2359 ocs_ramlog_free(ocs_t *ocs, ocs_ramlog_t *ramlog) in ocs_ramlog_free() argument
2363 if (ramlog != NULL) { in ocs_ramlog_free()
2364 ocs_lock_free(&ramlog->lock); in ocs_ramlog_free()
2365 if (ramlog->textbufs) { in ocs_ramlog_free()
2366 for (i = 0; i < ramlog->textbuf_count; i ++) { in ocs_ramlog_free()
2367 ocs_textbuf_free(ocs, &ramlog->textbufs[i]); in ocs_ramlog_free()
2370 ocs_free(ocs, ramlog->textbufs, ramlog->textbuf_count*sizeof(*ramlog->textbufs)); in ocs_ramlog_free()
2371 ramlog->textbufs = NULL; in ocs_ramlog_free()
2373 ocs_free(ocs, ramlog, sizeof(*ramlog)); in ocs_ramlog_free()
2391 ocs_ramlog_clear(ocs_t *ocs, ocs_ramlog_t *ramlog, int clear_start_of_day, int clear_recent) in ocs_ramlog_clear() argument
2396 for (i = ramlog->textbuf_base; i < ramlog->textbuf_count; i ++) { in ocs_ramlog_clear()
2397 ocs_textbuf_reset(&ramlog->textbufs[i]); in ocs_ramlog_clear()
2399 ramlog->cur_textbuf_idx = 1; in ocs_ramlog_clear()
2401 if (clear_start_of_day && ramlog->textbuf_base) { in ocs_ramlog_clear()
2402 ocs_textbuf_reset(&ramlog->textbufs[0]); in ocs_ramlog_clear()
2406 ramlog->textbuf_base = 0; in ocs_ramlog_clear()
2428 if (ocs == NULL || ocs->ramlog == NULL) { in ocs_ramlog_printf()
2433 res = ocs_ramlog_vprintf(ocs->ramlog, fmt, ap); in ocs_ramlog_printf()
2452 ocs_ramlog_vprintf(ocs_ramlog_t *ramlog, const char *fmt, va_list ap) in ocs_ramlog_vprintf() argument
2454 if (ramlog == NULL || !ramlog->initialized) { in ocs_ramlog_vprintf()
2461 ocs_lock(&ramlog->lock); in ocs_ramlog_vprintf()
2462 if (ocs_textbuf_remaining(ramlog->cur_textbuf) < 120) { in ocs_ramlog_vprintf()
2463 ramlog->cur_textbuf_idx = ocs_ramlog_next_idx(ramlog, ramlog->cur_textbuf_idx); in ocs_ramlog_vprintf()
2464 ramlog->cur_textbuf = &ramlog->textbufs[ramlog->cur_textbuf_idx]; in ocs_ramlog_vprintf()
2465 ocs_textbuf_reset(ramlog->cur_textbuf); in ocs_ramlog_vprintf()
2468 ocs_textbuf_vprintf(ramlog->cur_textbuf, fmt, ap); in ocs_ramlog_vprintf()
2469 ocs_unlock(&ramlog->lock); in ocs_ramlog_vprintf()
2486 ocs_ramlog_next_idx(ocs_ramlog_t *ramlog, uint32_t idx) in ocs_ramlog_next_idx() argument
2490 if (idx >= ramlog->textbuf_count) { in ocs_ramlog_next_idx()
2491 idx = ramlog->textbuf_base; in ocs_ramlog_next_idx()
2509 ocs_ddump_ramlog(ocs_textbuf_t *textbuf, ocs_ramlog_t *ramlog) in ocs_ddump_ramlog() argument
2515 if ((ramlog == NULL) || (ramlog->textbufs == NULL)) { in ocs_ddump_ramlog()
2524 if (ramlog->textbuf_base) { in ocs_ddump_ramlog()
2525 rltextbuf = &ramlog->textbufs[0]; in ocs_ddump_ramlog()
2534 idx = ocs_ramlog_next_idx(ramlog, ramlog->textbuf_count); in ocs_ddump_ramlog()
2536 for (i = ramlog->textbuf_base; i < ramlog->textbuf_count; i ++) { in ocs_ddump_ramlog()
2537 rltextbuf = &ramlog->textbufs[idx]; in ocs_ddump_ramlog()
2539 idx = ocs_ramlog_next_idx(ramlog, idx); in ocs_ddump_ramlog()