Lines Matching refs:textbuf
579 ocs_ddump_startfile(ocs_textbuf_t *textbuf) in ocs_ddump_startfile() argument
581 ocs_textbuf_printf(textbuf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"); in ocs_ddump_startfile()
595 ocs_ddump_endfile(ocs_textbuf_t *textbuf) in ocs_ddump_endfile() argument
612 ocs_ddump_section(ocs_textbuf_t *textbuf, const char *name, uint32_t instance) in ocs_ddump_section() argument
614 ocs_textbuf_printf(textbuf, "<%s type=\"section\" instance=\"%d\">\n", name, instance); in ocs_ddump_section()
630 ocs_ddump_endsection(ocs_textbuf_t *textbuf, const char *name, uint32_t instance) in ocs_ddump_endsection() argument
632 ocs_textbuf_printf(textbuf, "</%s>\n", name); in ocs_ddump_endsection()
648 ocs_ddump_value(ocs_textbuf_t *textbuf, const char *name, const char *fmt, ...) in ocs_ddump_value() argument
657 ocs_textbuf_printf(textbuf, "<%s>%s</%s>\n", name, valuebuf, name); in ocs_ddump_value()
675 ocs_ddump_buffer(ocs_textbuf_t *textbuf, const char *name, uint32_t instance, void *buffer, uint32_… in ocs_ddump_buffer() argument
687 ocs_textbuf_printf(textbuf, "<%s type=\"buffer\" instance=\"%d\">\n", name, instance); in ocs_ddump_buffer()
692 ocs_textbuf_printf(textbuf, "%08x ", *dword++); in ocs_ddump_buffer()
694 ocs_textbuf_printf(textbuf, "\n"); in ocs_ddump_buffer()
698 ocs_textbuf_printf(textbuf, "</%s>\n", name); in ocs_ddump_buffer()
717 ocs_ddump_queue_entries(ocs_textbuf_t *textbuf, void *q_addr, uint32_t size, in ocs_ddump_queue_entries() argument
740 ocs_textbuf_printf(textbuf, "<qentries>\n"); in ocs_ddump_queue_entries()
746 ocs_textbuf_printf(textbuf, "[%04x] ", index); in ocs_ddump_queue_entries()
748 ocs_textbuf_printf(textbuf, "%08x ", *dword++); in ocs_ddump_queue_entries()
751 ocs_textbuf_printf(textbuf, "\n"); in ocs_ddump_queue_entries()
753 ocs_textbuf_printf(textbuf, " "); in ocs_ddump_queue_entries()
763 ocs_textbuf_printf(textbuf, "</qentries>\n"); in ocs_ddump_queue_entries()
1215 ocs_display_sparams(const char *prelabel, const char *reqlabel, int dest, void *textbuf, void *spar… in ocs_display_sparams() argument
1234 ocs_ddump_buffer((ocs_textbuf_t*) textbuf, reqlabel, 0, sparams, sizeof(fc_plogi_payload_t)); in ocs_display_sparams()
1621 static ocs_textbuf_segment_t *ocs_textbuf_segment_alloc(ocs_textbuf_t *textbuf);
1623 static ocs_textbuf_segment_t *ocs_textbuf_get_segment(ocs_textbuf_t *textbuf, uint32_t idx);
1626 ocs_textbuf_get_buffer(ocs_textbuf_t *textbuf) in ocs_textbuf_get_buffer() argument
1628 return ocs_textbuf_ext_get_buffer(textbuf, 0); in ocs_textbuf_get_buffer()
1632 ocs_textbuf_get_length(ocs_textbuf_t *textbuf) in ocs_textbuf_get_length() argument
1634 return ocs_textbuf_ext_get_length(textbuf, 0); in ocs_textbuf_get_length()
1638 ocs_textbuf_get_written(ocs_textbuf_t *textbuf) in ocs_textbuf_get_written() argument
1644 for (idx = 0; (n = ocs_textbuf_ext_get_written(textbuf, idx)) >= 0; idx++) { in ocs_textbuf_get_written()
1650 uint8_t *ocs_textbuf_ext_get_buffer(ocs_textbuf_t *textbuf, uint32_t idx) in ocs_textbuf_ext_get_buffer() argument
1652 ocs_textbuf_segment_t *segment = ocs_textbuf_get_segment(textbuf, idx); in ocs_textbuf_ext_get_buffer()
1659 int32_t ocs_textbuf_ext_get_length(ocs_textbuf_t *textbuf, uint32_t idx) in ocs_textbuf_ext_get_length() argument
1661 ocs_textbuf_segment_t *segment = ocs_textbuf_get_segment(textbuf, idx); in ocs_textbuf_ext_get_length()
1668 int32_t ocs_textbuf_ext_get_written(ocs_textbuf_t *textbuf, uint32_t idx) in ocs_textbuf_ext_get_written() argument
1670 ocs_textbuf_segment_t *segment = ocs_textbuf_get_segment(textbuf, idx); in ocs_textbuf_ext_get_written()
1678 ocs_textbuf_initialized(ocs_textbuf_t *textbuf) in ocs_textbuf_initialized() argument
1680 return (textbuf->ocs != NULL); in ocs_textbuf_initialized()
1684 ocs_textbuf_alloc(ocs_t *ocs, ocs_textbuf_t *textbuf, uint32_t length) in ocs_textbuf_alloc() argument
1686 ocs_memset(textbuf, 0, sizeof(*textbuf)); in ocs_textbuf_alloc()
1688 textbuf->ocs = ocs; in ocs_textbuf_alloc()
1689 ocs_list_init(&textbuf->segment_list, ocs_textbuf_segment_t, link); in ocs_textbuf_alloc()
1692 textbuf->allocation_length = OCS_TEXTBUF_MAX_ALLOC_LEN; in ocs_textbuf_alloc()
1694 textbuf->allocation_length = length; in ocs_textbuf_alloc()
1698 textbuf->extendable = TRUE; in ocs_textbuf_alloc()
1701 textbuf->max_allocation_length = length; in ocs_textbuf_alloc()
1704 return (ocs_textbuf_segment_alloc(textbuf) == NULL) ? -1 : 0; in ocs_textbuf_alloc()
1708 ocs_textbuf_segment_alloc(ocs_textbuf_t *textbuf) in ocs_textbuf_segment_alloc() argument
1712 if (textbuf->extendable) { in ocs_textbuf_segment_alloc()
1713 segment = ocs_malloc(textbuf->ocs, sizeof(*segment), OCS_M_ZERO | OCS_M_NOWAIT); in ocs_textbuf_segment_alloc()
1715 … segment->buffer = ocs_malloc(textbuf->ocs, textbuf->allocation_length, OCS_M_ZERO | OCS_M_NOWAIT); in ocs_textbuf_segment_alloc()
1717 segment->buffer_length = textbuf->allocation_length; in ocs_textbuf_segment_alloc()
1719 ocs_list_add_tail(&textbuf->segment_list, segment); in ocs_textbuf_segment_alloc()
1720 textbuf->total_allocation_length += textbuf->allocation_length; in ocs_textbuf_segment_alloc()
1723 if (textbuf->total_allocation_length >= textbuf->max_allocation_length) { in ocs_textbuf_segment_alloc()
1724 textbuf->extendable = 0; in ocs_textbuf_segment_alloc()
1728 ocs_textbuf_segment_free(textbuf->ocs, segment); in ocs_textbuf_segment_alloc()
1748 ocs_textbuf_get_segment(ocs_textbuf_t *textbuf, uint32_t idx) in ocs_textbuf_get_segment() argument
1753 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_get_segment()
1755 ocs_list_foreach(&textbuf->segment_list, segment) { in ocs_textbuf_get_segment()
1766 ocs_textbuf_init(ocs_t *ocs, ocs_textbuf_t *textbuf, void *buffer, uint32_t length) in ocs_textbuf_init() argument
1771 ocs_memset(textbuf, 0, sizeof(*textbuf)); in ocs_textbuf_init()
1773 textbuf->ocs = ocs; in ocs_textbuf_init()
1774 ocs_list_init(&textbuf->segment_list, ocs_textbuf_segment_t, link); in ocs_textbuf_init()
1781 ocs_list_add_tail(&textbuf->segment_list, segment); in ocs_textbuf_init()
1789 ocs_textbuf_free(ocs_t *ocs, ocs_textbuf_t *textbuf) in ocs_textbuf_free() argument
1794 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_free()
1795 ocs_list_foreach_safe(&textbuf->segment_list, segment, n) { in ocs_textbuf_free()
1796 ocs_list_remove(&textbuf->segment_list, segment); in ocs_textbuf_free()
1800 ocs_memset(textbuf, 0, sizeof(*textbuf)); in ocs_textbuf_free()
1805 ocs_textbuf_printf(ocs_textbuf_t *textbuf, const char *fmt, ...) in ocs_textbuf_printf() argument
1809 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_printf()
1811 ocs_textbuf_vprintf(textbuf, fmt, ap); in ocs_textbuf_printf()
1817 ocs_textbuf_vprintf(ocs_textbuf_t *textbuf, const char *fmt, va_list ap) in ocs_textbuf_vprintf() argument
1824 if (!ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_vprintf()
1831 segment = ocs_list_get_tail(&textbuf->segment_list); in ocs_textbuf_vprintf()
1835 if ((segment = ocs_textbuf_segment_alloc(textbuf)) == NULL) { in ocs_textbuf_vprintf()
1847 if (textbuf->extendable) { in ocs_textbuf_vprintf()
1852 if ((segment = ocs_textbuf_segment_alloc(textbuf)) == NULL) { in ocs_textbuf_vprintf()
1853 ocs_log_err(textbuf->ocs, "alloc segment failed\n"); in ocs_textbuf_vprintf()
1869 ocs_textbuf_putc(ocs_textbuf_t *textbuf, uint8_t c) in ocs_textbuf_putc() argument
1873 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_putc()
1874 segment = ocs_list_get_tail(&textbuf->segment_list); in ocs_textbuf_putc()
1880 ocs_textbuf_segment_alloc(textbuf); in ocs_textbuf_putc()
1886 ocs_textbuf_puts(ocs_textbuf_t *textbuf, char *s) in ocs_textbuf_puts() argument
1888 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_puts()
1890 ocs_textbuf_putc(textbuf, *s++); in ocs_textbuf_puts()
1896 ocs_textbuf_buffer(ocs_textbuf_t *textbuf, uint8_t *buffer, uint32_t buffer_length) in ocs_textbuf_buffer() argument
1900 if (!ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_buffer()
1917 case '"': ocs_textbuf_puts(textbuf, """); break; in ocs_textbuf_buffer()
1918 case '\'': ocs_textbuf_puts(textbuf, "'"); break; in ocs_textbuf_buffer()
1919 case '<': ocs_textbuf_puts(textbuf, "<"); break; in ocs_textbuf_buffer()
1920 case '>': ocs_textbuf_puts(textbuf, ">"); break; in ocs_textbuf_buffer()
1921 case '&': ocs_textbuf_puts(textbuf, "&"); break; in ocs_textbuf_buffer()
1922 default: ocs_textbuf_putc(textbuf, *s); break; in ocs_textbuf_buffer()
1930 ocs_textbuf_copy(ocs_textbuf_t *textbuf, uint8_t *buffer, uint32_t buffer_length) in ocs_textbuf_copy() argument
1934 if (!ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_copy()
1940 ocs_textbuf_putc(textbuf, *s++); in ocs_textbuf_copy()
1946 ocs_textbuf_remaining(ocs_textbuf_t *textbuf) in ocs_textbuf_remaining() argument
1948 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_remaining()
1949 return ocs_segment_remaining(ocs_list_get_head(&textbuf->segment_list)); in ocs_textbuf_remaining()
1962 ocs_textbuf_reset(ocs_textbuf_t *textbuf) in ocs_textbuf_reset() argument
1968 if (ocs_textbuf_initialized(textbuf)) { in ocs_textbuf_reset()
1970 ocs_list_foreach_safe(&textbuf->segment_list, segment, n) { in ocs_textbuf_reset()
1974 ocs_list_remove(&textbuf->segment_list, segment); in ocs_textbuf_reset()
1975 ocs_textbuf_segment_free(textbuf->ocs, segment); in ocs_textbuf_reset()
2509 ocs_ddump_ramlog(ocs_textbuf_t *textbuf, ocs_ramlog_t *ramlog) in ocs_ddump_ramlog() argument
2519 ocs_ddump_section(textbuf, "driver-log", 0); in ocs_ddump_ramlog()
2522 ocs_ddump_section(textbuf, "startofday", 0); in ocs_ddump_ramlog()
2526 …ocs_textbuf_buffer(textbuf, ocs_textbuf_get_buffer(rltextbuf), ocs_textbuf_get_written(rltextbuf)); in ocs_ddump_ramlog()
2528 ocs_ddump_endsection(textbuf, "startofday", 0); in ocs_ddump_ramlog()
2531 ocs_ddump_section(textbuf, "recent", 0); in ocs_ddump_ramlog()
2538 …ocs_textbuf_buffer(textbuf, ocs_textbuf_get_buffer(rltextbuf), ocs_textbuf_get_written(rltextbuf)); in ocs_ddump_ramlog()
2541 ocs_ddump_endsection(textbuf, "recent", 0); in ocs_ddump_ramlog()
2542 ocs_ddump_endsection(textbuf, "driver-log", 0); in ocs_ddump_ramlog()