libexplain  1.4.D001
libexplain/buffer/floppy_fdc_state.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/fd.h>
00020 
00021 #include <libexplain/buffer/char_data.h>
00022 #include <libexplain/buffer/floppy_fdc_state.h>
00023 #include <libexplain/buffer/int.h>
00024 #include <libexplain/buffer/long.h>
00025 #include <libexplain/buffer/pointer.h>
00026 #include <libexplain/is_efault.h>
00027 
00028 
00029 #ifdef HAVE_LINUX_FD_H
00030 
00031 void
00032 explain_buffer_floppy_fdc_state(explain_string_buffer_t *sb,
00033     const struct floppy_fdc_state *data)
00034 {
00035     if (explain_is_efault_pointer(data, sizeof(*data)))
00036     {
00037         explain_buffer_pointer(sb, data);
00038         return;
00039     }
00040 
00041     explain_string_buffer_puts(sb, "{ spec1 = ");
00042     explain_buffer_int(sb, data->spec1);
00043     if (data->spec2)
00044     {
00045         explain_string_buffer_puts(sb, ", spec2 = ");
00046         explain_buffer_int(sb, data->spec2);
00047     }
00048     if (data->dtr)
00049     {
00050         explain_string_buffer_puts(sb, ", dtr = ");
00051         explain_buffer_int(sb, data->dtr);
00052     }
00053     if (data->version)
00054     {
00055         explain_string_buffer_puts(sb, ", version = ");
00056         explain_buffer_uint(sb, data->version);
00057     }
00058     if (data->dor)
00059     {
00060         explain_string_buffer_puts(sb, ", dor = ");
00061         explain_buffer_uint(sb, data->dor);
00062     }
00063     if (data->address)
00064     {
00065         explain_string_buffer_puts(sb, ", address = ");
00066         explain_buffer_ulong(sb, data->address);
00067     }
00068     if (data->rawcmd)
00069     {
00070         explain_string_buffer_puts(sb, ", rawcmd = ");
00071         explain_buffer_uint(sb, data->rawcmd);
00072     }
00073     if (data->reset)
00074     {
00075         explain_string_buffer_puts(sb, ", reset = ");
00076         explain_buffer_uint(sb, data->reset);
00077     }
00078     if (data->need_configure)
00079     {
00080         explain_string_buffer_puts(sb, ", need_configure = ");
00081         explain_buffer_uint(sb, data->need_configure);
00082     }
00083     if (data->perp_mode)
00084     {
00085         explain_string_buffer_puts(sb, ", perp_mode = ");
00086         explain_buffer_uint(sb, data->perp_mode);
00087     }
00088     if (data->has_fifo)
00089     {
00090         explain_string_buffer_puts(sb, ", has_fifo = ");
00091         explain_buffer_uint(sb, data->has_fifo);
00092     }
00093     if (data->driver_version)
00094     {
00095         explain_string_buffer_puts(sb, ", driver_version = ");
00096         explain_buffer_uint(sb, data->driver_version);
00097     }
00098     explain_string_buffer_puts(sb, ", track = ");
00099     explain_buffer_char_data(sb, data->track, sizeof(data->track));
00100     explain_string_buffer_puts(sb, " }");
00101 }
00102 
00103 #else
00104 
00105 void
00106 explain_buffer_floppy_fdc_state(explain_string_buffer_t *sb,
00107     const struct floppy_fdc_state *data)
00108 {
00109     explain_buffer_pointer(sb, data);
00110 }
00111 
00112 #endif
00113 
00114 
00115 /* vim: set ts=8 sw=4 et : */