libexplain  1.4.D001
libexplain/iocontrol/hdio_set_dma.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/errno.h>
00021 #include <libexplain/ac/linux/hdreg.h>
00022 #include <libexplain/ac/stdint.h>
00023 
00024 #include <libexplain/buffer/dac.h>
00025 #include <libexplain/capability.h>
00026 #include <libexplain/iocontrol/generic.h>
00027 #include <libexplain/iocontrol/hdio_set_dma.h>
00028 
00029 #ifdef HDIO_SET_DMA
00030 
00031 static void
00032 print_explanation(const explain_iocontrol_t *p, explain_string_buffer_t *sb,
00033     int errnum, int fildes, int request, const void *data)
00034 {
00035     switch (errnum)
00036     {
00037     case EACCES:
00038         if (!explain_capability_sys_admin())
00039         {
00040             explain_buffer_dac_sys_admin(sb);
00041             break;
00042         }
00043         /* fall through... */
00044 
00045     default:
00046         explain_iocontrol_generic_print_explanation
00047         (
00048             p,
00049             sb,
00050             errnum,
00051             fildes,
00052             request,
00053             data
00054         );
00055         break;
00056     }
00057 }
00058 
00059 
00060 const explain_iocontrol_t explain_iocontrol_hdio_set_dma =
00061 {
00062     "HDIO_SET_DMA", /* name */
00063     HDIO_SET_DMA, /* value */
00064     0, /* disambiguate */
00065     0, /* print_name */
00066     explain_iocontrol_generic_print_data_long, /* print_data */
00067     print_explanation,
00068     0, /* print_data_returned */
00069     NOT_A_POINTER, /* data_size */
00070     "intptr_t", /* data_type */
00071     0, /* flags */
00072     __FILE__,
00073     __LINE__,
00074 };
00075 
00076 #else /* ndef HDIO_SET_DMA */
00077 
00078 
00079 const explain_iocontrol_t explain_iocontrol_hdio_set_dma =
00080 {
00081     0, /* name */
00082     0, /* value */
00083     0, /* disambiguate */
00084     0, /* print_name */
00085     0, /* print_data */
00086     0, /* print_explanation */
00087     0, /* print_data_returned */
00088     0, /* data_size */
00089     0, /* data_type */
00090     0, /* flags */
00091     __FILE__,
00092     __LINE__,
00093 };
00094 
00095 #endif /* HDIO_SET_DMA */
00096 
00097 
00098 /* vim: set ts=8 sw=4 et : */