libexplain
1.4.D001
|
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/if_eql.h> 00020 #include <libexplain/ac/net/if.h> 00021 00022 #include <libexplain/buffer/ifreq/master_config.h> 00023 #include <libexplain/buffer/int.h> 00024 #include <libexplain/buffer/pointer.h> 00025 #include <libexplain/is_efault.h> 00026 00027 00028 #if defined(EQL_GETMASTRCFG) || defined(EQL_SETMASTRCFG) 00029 00030 void 00031 explain_buffer_ifreq_master_config(explain_string_buffer_t *sb, 00032 const struct ifreq *data, int extended_form) 00033 { 00034 const struct master_config *m; 00035 00036 if (explain_is_efault_pointer(data, sizeof(*data))) 00037 { 00038 explain_buffer_pointer(sb, data); 00039 return; 00040 } 00041 00042 explain_string_buffer_puts(sb, "{ ifr_data = "); 00043 m = (const struct master_config *)data->ifr_data; 00044 if (!extended_form || explain_is_efault_pointer(m, sizeof(*m))) 00045 { 00046 explain_buffer_pointer(sb, m); 00047 } 00048 else 00049 { 00050 explain_string_buffer_puts(sb, "{ master_name = "); 00051 explain_string_buffer_puts_quoted_n(sb, m->master_name, 00052 sizeof(m->master_name)); 00053 if (m->max_slaves) 00054 { 00055 explain_string_buffer_puts(sb, ", max_slaves = "); 00056 explain_buffer_int(sb, m->max_slaves); 00057 } 00058 if (m->min_slaves) 00059 { 00060 explain_string_buffer_puts(sb, ", min_slaves = "); 00061 explain_buffer_int(sb, m->min_slaves); 00062 } 00063 explain_string_buffer_puts(sb, " }"); 00064 } 00065 explain_string_buffer_puts(sb, " }"); 00066 } 00067 00068 #else 00069 00070 void 00071 explain_buffer_ifreq_master_config(explain_string_buffer_t *sb, 00072 const struct ifreq *data, int extended_form) 00073 { 00074 (void)extended_form; 00075 explain_buffer_pointer(sb, data); 00076 } 00077 00078 #endif 00079 00080 00081 /* vim: set ts=8 sw=4 et : */