libexplain  1.4.D001
libexplain/buffer/serial_multiport_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_multiport_struct.h>
00024 #include <libexplain/is_efault.h>
00025 
00026 
00027 void
00028 explain_buffer_serial_multiport_struct(explain_string_buffer_t *sb,
00029     const struct serial_multiport_struct *value)
00030 {
00031 #ifdef TIOCSERSETMULTI
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                 "irq = %d, "
00041                 "port1 = %d, "
00042                 "mask1 = %u, "
00043                 "match1 = %u, "
00044                 "port2 = %d, "
00045                 "mask2 = %u, "
00046                 "match2 = %u, "
00047                 "port3 = %d, "
00048                 "mask3 = %u, "
00049                 "match3 = %u, "
00050                 "port4 = %d, "
00051                 "mask4 = %u, "
00052                 "match4 = %u, "
00053                 "port_monitor = %d "
00054             "}",
00055             value->irq,
00056             value->port1,
00057             value->mask1,
00058             value->match1,
00059             value->port2,
00060             value->mask2,
00061             value->match2,
00062             value->port3,
00063             value->mask3,
00064             value->match3,
00065             value->port4,
00066             value->mask4,
00067             value->match4,
00068             value->port_monitor
00069         );
00070     }
00071 #else
00072     explain_buffer_pointer(sb, value);
00073 #endif
00074 }
00075 
00076 
00077 /* vim: set ts=8 sw=4 et : */