libexplain  1.4.D001
libexplain/buffer/serial_struct.c
Go to the documentation of this file.
00001 /*
00002  * libexplain - Explain errno values returned by libc functions
00003  * Copyright (C) 2009, 2011, 2013 Peter Miller
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU Lesser General Public License as
00007  * published by the Free Software Foundation; either version 3 of the
00008  * License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include <libexplain/ac/linux/serial.h>
00020 #include <libexplain/ac/termios.h>
00021 
00022 #include <libexplain/buffer/pointer.h>
00023 #include <libexplain/buffer/serial_struct.h>
00024 #include <libexplain/is_efault.h>
00025 
00026 
00027 void
00028 explain_buffer_serial_struct(explain_string_buffer_t *sb,
00029     const struct serial_struct *value)
00030 {
00031 #ifdef TIOCSSERIAL
00032     if (explain_is_efault_pointer(value, sizeof(*data)))
00033         explain_buffer_pointer(sb, value);
00034     else
00035     {
00036         explain_string_buffer_printf
00037         (
00038             sb,
00039             "{ "
00040                 "type = %d, "
00041                 "line = %d, "
00042                 "port = %u, "
00043                 "irq = %d, "
00044                 "flags = %d, "
00045                 "xmit_fifo_size = %d, "
00046                 "custom_divisor = %d, "
00047                 "baud_base = %d, "
00048                 "close_delay = %u, "
00049                 "io_type = %i, "
00050                 "reserved_char = { %d }, "
00051                 "hub6 = %d, "
00052                 "closing_wait = %u, "
00053                 "closing_wait2 = %u, "
00054                 "iomem_base = %p, "
00055                 "iomem_reg_shift = %u, "
00056                 "port_high = %u, "
00057                 "iomap_base = %lu "
00058             "}",
00059             value->type,
00060             value->line,
00061             value->port,
00062             value->irq,
00063             value->flags,
00064             value->xmit_fifo_size,
00065             value->custom_divisor,
00066             value->baud_base,
00067             value->close_delay,
00068             value->io_type,
00069             value->reserved_char[0],
00070             value->hub6,
00071             value->closing_wait,
00072             value->closing_wait2,
00073             value->iomem_base,
00074             value->iomem_reg_shift,
00075             value->port_high,
00076             value->iomap_base
00077         );
00078     }
00079 #else
00080     explain_buffer_pointer(sb, value);
00081 #endif
00082 }
00083 
00084 
00085 /* vim: set ts=8 sw=4 et : */