libexplain  1.4.D001
libexplain/iocontrol/hdio_getgeo.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 it
00006  * under the terms of the GNU Lesser General Public License as published by
00007  * the Free Software Foundation; either version 3 of the License, or (at your
00008  * option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,but WITHOUT
00011  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00013  * 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/sys/ioctl.h>
00020 #include <libexplain/ac/linux/hdreg.h>
00021 
00022 #include <libexplain/buffer/dac.h>
00023 #include <libexplain/buffer/hd_geometry.h>
00024 #include <libexplain/buffer/pointer.h>
00025 #include <libexplain/capability.h>
00026 #include <libexplain/iocontrol/generic.h>
00027 #include <libexplain/iocontrol/hdio_getgeo.h>
00028 
00029 #ifdef HDIO_GETGEO
00030 
00031 
00032 static void
00033 print_data(const explain_iocontrol_t *p, explain_string_buffer_t *sb,
00034     int errnum, int fildes, int request, const void *data)
00035 {
00036     (void)p;
00037     (void)errnum;
00038     (void)fildes;
00039     (void)request;
00040     explain_buffer_pointer(sb, data);
00041 }
00042 
00043 
00044 static void
00045 print_explanation(const explain_iocontrol_t *p, explain_string_buffer_t *sb, int
00046     errnum, int fildes, int request, const void *data)
00047 {
00048     switch (errnum)
00049     {
00050     default:
00051         explain_iocontrol_generic_print_explanation
00052         (
00053             p,
00054             sb,
00055             errnum,
00056             fildes,
00057             request,
00058             data
00059         );
00060         break;
00061     }
00062 }
00063 
00064 
00065 static void
00066 print_data_returned(const explain_iocontrol_t *p, explain_string_buffer_t *sb,
00067     int errnum, int fildes, int request, const void *data)
00068 {
00069     (void)p;
00070     (void)errnum;
00071     (void)fildes;
00072     (void)request;
00073     explain_buffer_hd_geometry(sb, data);
00074 }
00075 
00076 
00077 const explain_iocontrol_t explain_iocontrol_hdio_getgeo =
00078 {
00079     "HDIO_GETGEO", /* name */
00080     HDIO_GETGEO, /* value */
00081     0, /* disambiguate */
00082     0, /* print_name */
00083     print_data,
00084     print_explanation,
00085     print_data_returned,
00086     sizeof(struct hd_geometry), /* data_size */
00087     "struct hd_geometry *", /* data_type */
00088     IOCONTROL_FLAG_NON_META, /* flags */
00089     __FILE__,
00090     __LINE__,
00091 };
00092 
00093 #else /* ndef HDIO_GETGEO */
00094 
00095 const explain_iocontrol_t explain_iocontrol_hdio_getgeo =
00096 {
00097     0, /* name */
00098     0, /* value */
00099     0, /* disambiguate */
00100     0, /* print_name */
00101     0, /* print_data */
00102     0, /* print_explanation */
00103     0, /* print_data_returned */
00104     0, /* data_size */
00105     0, /* data_type */
00106     0, /* flags */
00107     __FILE__,
00108     __LINE__,
00109 };
00110 
00111 #endif /* HDIO_GETGEO */
00112 
00113 
00114 /* vim: set ts=8 sw=4 et : */