Lines Matching refs:textbuf
582 ocs_ddump_startfile(ocs_textbuf_t *textbuf) in ocs_ddump_startfile() argument
584 ocs_textbuf_printf(textbuf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"); in ocs_ddump_startfile()
598 ocs_ddump_endfile(ocs_textbuf_t *textbuf) in ocs_ddump_endfile() argument
615 ocs_ddump_section(ocs_textbuf_t *textbuf, const char *name, uint32_t instance) in ocs_ddump_section() argument
617 ocs_textbuf_printf(textbuf, "<%s type=\"section\" instance=\"%d\">\n", name, instance); in ocs_ddump_section()
633 ocs_ddump_endsection(ocs_textbuf_t *textbuf, const char *name, uint32_t instance) in ocs_ddump_endsection() argument
635 ocs_textbuf_printf(textbuf, "</%s>\n", name); in ocs_ddump_endsection()
651 ocs_ddump_value(ocs_textbuf_t *textbuf, const char *name, const char *fmt, ...) in ocs_ddump_value() argument
660 ocs_textbuf_printf(textbuf, "<%s>%s</%s>\n", name, valuebuf, name); in ocs_ddump_value()
679 ocs_ddump_buffer(ocs_textbuf_t *textbuf, const char *name, uint32_t instance, void *buffer, uint32_… in ocs_ddump_buffer() argument
691 ocs_textbuf_printf(textbuf, "<%s type=\"buffer\" instance=\"%d\">\n", name, instance); in ocs_ddump_buffer()
696 ocs_textbuf_printf(textbuf, "%08x ", *dword++); in ocs_ddump_buffer()
698 ocs_textbuf_printf(textbuf, "\n"); in ocs_ddump_buffer()
702 ocs_textbuf_printf(textbuf, "</%s>\n", name); in ocs_ddump_buffer()
721 ocs_ddump_queue_entries(ocs_textbuf_t *textbuf, void *q_addr, uint32_t size, in ocs_ddump_queue_entries() argument
745 ocs_textbuf_printf(textbuf, "<qentries>\n"); in ocs_ddump_queue_entries()
751 ocs_textbuf_printf(textbuf, "[%04x] ", index); in ocs_ddump_queue_entries()
753 ocs_textbuf_printf(textbuf, "%08x ", *dword++); in ocs_ddump_queue_entries()
756 ocs_textbuf_printf(textbuf, "\n"); in ocs_ddump_queue_entries()
758 ocs_textbuf_printf(textbuf, " "); in ocs_ddump_queue_entries()
768 ocs_textbuf_printf(textbuf, "</qentries>\n"); in ocs_ddump_queue_entries()
1223 ocs_display_sparams(const char *prelabel, const char *reqlabel, int dest, void *textbuf, void *spar… in ocs_display_sparams() argument
1242 ocs_ddump_buffer((ocs_textbuf_t*) textbuf, reqlabel, 0, sparams, sizeof(fc_plogi_payload_t)); in ocs_display_sparams()
1631 static ocs_textbuf_segment_t *ocs_textbuf_segment_alloc(ocs_textbuf_t *textbuf);
1633 static ocs_textbuf_segment_t *ocs_textbuf_get_segment(ocs_textbuf_t *textbuf, uint32_t idx);
1636 ocs_textbuf_get_buffer(ocs_textbuf_t *textbuf) in ocs_textbuf_get_buffer() argument
1638 return ocs_textbuf_ext_get_buffer(textbuf, 0); in ocs_textbuf_get_buffer()
1642 ocs_textbuf_get_length(ocs_textbuf_t *textbuf) in ocs_textbuf_get_length() argument
1644 return ocs_textbuf_ext_get_length(textbuf, 0); in ocs_textbuf_get_length()
1648 ocs_textbuf_get_written(ocs_textbuf_t *textbuf) in ocs_textbuf_get_written() argument
1654 for (idx = 0; (n = ocs_textbuf_ext_get_written(textbuf, idx)) >= 0; idx++) { in ocs_textbuf_get_written()
1660 uint8_t *ocs_textbuf_ext_get_buffer(ocs_textbuf_t *textbuf, uint32_t idx) in ocs_textbuf_ext_get_buffer() argument
1662 ocs_textbuf_segment_t *segment = ocs_textbuf_get_segment(textbuf, idx); in ocs_textbuf_ext_get_buffer()
1669 int32_t ocs_textbuf_ext_get_length(ocs_textbuf_t *textbuf, uint32_t idx) in ocs_textbuf_ext_get_length() argument
1671 ocs_textbuf_segment_t *segment = ocs_textbuf_get_segment(textbuf, idx); in ocs_textbuf_ext_get_length()
1678 int32_t ocs_textbuf_ext_get_written(ocs_textbuf_t *textbuf, uint32_t idx) in ocs_textbuf_ext_get_written() argument
1680 ocs_textbuf_segment_t *segment = ocs_textbuf_get_segment(textbuf, idx); in ocs_textbuf_ext_get_written()
1688 ocs_textbuf_initialized(ocs_textbuf_t *textbuf) in ocs_textbuf_initialized() argument
1690 return (textbuf->ocs != NULL); in ocs_textbuf_initialized()
1694 ocs_textbuf_alloc(ocs_t *ocs, ocs_textbuf_t *textbuf, uint32_t length) in ocs_textbuf_alloc() argument
1696 ocs_memset(textbuf, 0, sizeof(*textbuf)); in ocs_textbuf_alloc()
1698 textbuf->ocs = ocs; in ocs_textbuf_alloc()
1699 ocs_list_init(&textbuf->segment_list, ocs_textbuf_segment_t, link); in ocs_textbuf_alloc()
1702 textbuf->allocation_length = OCS_TEXTBUF_MAX_ALLOC_LEN; in ocs_textbuf_alloc()
1704 textbuf->allocation_length = length; in ocs_textbuf_alloc()
1708 textbuf->extendable = TRUE; in ocs_textbuf_alloc()
1711 textbuf->max_allocation_length = length; in ocs_textbuf_alloc()
1714 return (ocs_textbuf_segment_alloc(textbuf) == NULL) ? -1 : 0; in ocs_textbuf_alloc()
1718 ocs_textbuf_segment_alloc(ocs_textbuf_t *textbuf) in ocs_textbuf_segment_alloc() argument
1722 if (textbuf->extendable) { in ocs_textbuf_segment_alloc()
1723 segment = ocs_malloc(textbuf->ocs, sizeof(*segment), OCS_M_ZERO | OCS_M_NOWAIT); in ocs_textbuf_segment_alloc()
1725 … segment->buffer = ocs_malloc(textbuf->ocs, textbuf->allocation_length, OCS_M_ZERO | OCS_M_NOWAIT); in ocs_textbuf_segment_alloc()
1727 segment->buffer_length = textbuf->allocation_length; in ocs_textbuf_segment_alloc()
1729 ocs_list_add_tail(&textbuf->segment_list, segment); in ocs_textbuf_segment_alloc()
1730 textbuf->total_allocation_length += textbuf->allocation_length; in ocs_textbuf_segment_alloc()
1733 if (textbuf->total_allocation_length >= textbuf->max_allocation_length) { in ocs_textbuf_segment_alloc()
1734 textbuf->extendable = 0; in ocs_textbuf_segment_alloc()
1738 ocs_textbuf_segment_free(textbuf->ocs, segment); in ocs_textbuf_segment_alloc()
1758 ocs_textbuf_get_segment(ocs_textbuf_t *textbuf, uint32_t idx) in ocs_textbuf_get_segment() argument
1763 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_get_segment()
1765 ocs_list_foreach(&textbuf->segment_list, segment) { in ocs_textbuf_get_segment()
1776 ocs_textbuf_init(ocs_t *ocs, ocs_textbuf_t *textbuf, void *buffer, uint32_t length) in ocs_textbuf_init() argument
1781 ocs_memset(textbuf, 0, sizeof(*textbuf)); in ocs_textbuf_init()
1783 textbuf->ocs = ocs; in ocs_textbuf_init()
1784 ocs_list_init(&textbuf->segment_list, ocs_textbuf_segment_t, link); in ocs_textbuf_init()
1791 ocs_list_add_tail(&textbuf->segment_list, segment); in ocs_textbuf_init()
1799 ocs_textbuf_free(ocs_t *ocs, ocs_textbuf_t *textbuf) in ocs_textbuf_free() argument
1804 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_free()
1805 ocs_list_foreach_safe(&textbuf->segment_list, segment, n) { in ocs_textbuf_free()
1806 ocs_list_remove(&textbuf->segment_list, segment); in ocs_textbuf_free()
1810 ocs_memset(textbuf, 0, sizeof(*textbuf)); in ocs_textbuf_free()
1815 ocs_textbuf_printf(ocs_textbuf_t *textbuf, const char *fmt, ...) in ocs_textbuf_printf() argument
1819 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_printf()
1821 ocs_textbuf_vprintf(textbuf, fmt, ap); in ocs_textbuf_printf()
1827 ocs_textbuf_vprintf(ocs_textbuf_t *textbuf, const char *fmt, va_list ap) in ocs_textbuf_vprintf() argument
1834 if (!ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_vprintf()
1841 segment = ocs_list_get_tail(&textbuf->segment_list); in ocs_textbuf_vprintf()
1845 if ((segment = ocs_textbuf_segment_alloc(textbuf)) == NULL) { in ocs_textbuf_vprintf()
1858 if (textbuf->extendable) { in ocs_textbuf_vprintf()
1864 if ((segment = ocs_textbuf_segment_alloc(textbuf)) == NULL) { in ocs_textbuf_vprintf()
1865 ocs_log_err(textbuf->ocs, "alloc segment failed\n"); in ocs_textbuf_vprintf()
1881 ocs_textbuf_putc(ocs_textbuf_t *textbuf, uint8_t c) in ocs_textbuf_putc() argument
1885 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_putc()
1886 segment = ocs_list_get_tail(&textbuf->segment_list); in ocs_textbuf_putc()
1892 ocs_textbuf_segment_alloc(textbuf); in ocs_textbuf_putc()
1898 ocs_textbuf_puts(ocs_textbuf_t *textbuf, char *s) in ocs_textbuf_puts() argument
1900 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_puts()
1902 ocs_textbuf_putc(textbuf, *s++); in ocs_textbuf_puts()
1908 ocs_textbuf_buffer(ocs_textbuf_t *textbuf, uint8_t *buffer, uint32_t buffer_length) in ocs_textbuf_buffer() argument
1912 if (!ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_buffer()
1930 case '"': ocs_textbuf_puts(textbuf, """); break; in ocs_textbuf_buffer()
1931 case '\'': ocs_textbuf_puts(textbuf, "'"); break; in ocs_textbuf_buffer()
1932 case '<': ocs_textbuf_puts(textbuf, "<"); break; in ocs_textbuf_buffer()
1933 case '>': ocs_textbuf_puts(textbuf, ">"); break; in ocs_textbuf_buffer()
1934 case '&': ocs_textbuf_puts(textbuf, "&"); break; in ocs_textbuf_buffer()
1935 default: ocs_textbuf_putc(textbuf, *s); break; in ocs_textbuf_buffer()
1943 ocs_textbuf_copy(ocs_textbuf_t *textbuf, uint8_t *buffer, uint32_t buffer_length) in ocs_textbuf_copy() argument
1947 if (!ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_copy()
1953 ocs_textbuf_putc(textbuf, *s++); in ocs_textbuf_copy()
1959 ocs_textbuf_remaining(ocs_textbuf_t *textbuf) in ocs_textbuf_remaining() argument
1961 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_remaining()
1962 return ocs_segment_remaining(ocs_list_get_head(&textbuf->segment_list)); in ocs_textbuf_remaining()
1975 ocs_textbuf_reset(ocs_textbuf_t *textbuf) in ocs_textbuf_reset() argument
1981 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_reset()
1983 ocs_list_foreach_safe(&textbuf->segment_list, segment, n) { in ocs_textbuf_reset()
1987 ocs_list_remove(&textbuf->segment_list, segment); in ocs_textbuf_reset()
1988 ocs_textbuf_segment_free(textbuf->ocs, segment); in ocs_textbuf_reset()
2527 ocs_ddump_ramlog(ocs_textbuf_t *textbuf, ocs_ramlog_t *ramlog) in ocs_ddump_ramlog() argument
2537 ocs_ddump_section(textbuf, "driver-log", 0); in ocs_ddump_ramlog()
2540 ocs_ddump_section(textbuf, "startofday", 0); in ocs_ddump_ramlog()
2544 …ocs_textbuf_buffer(textbuf, ocs_textbuf_get_buffer(rltextbuf), ocs_textbuf_get_written(rltextbuf)); in ocs_ddump_ramlog()
2546 ocs_ddump_endsection(textbuf, "startofday", 0); in ocs_ddump_ramlog()
2549 ocs_ddump_section(textbuf, "recent", 0); in ocs_ddump_ramlog()
2556 …ocs_textbuf_buffer(textbuf, ocs_textbuf_get_buffer(rltextbuf), ocs_textbuf_get_written(rltextbuf)); in ocs_ddump_ramlog()
2559 ocs_ddump_endsection(textbuf, "recent", 0); in ocs_ddump_ramlog()
2560 ocs_ddump_endsection(textbuf, "driver-log", 0); in ocs_ddump_ramlog()