libexplain  1.4.D001
libexplain/iocontrol/vidioc_log_status.c
Go to the documentation of this file.
00001 /*
00002  * libexplain - a library of system-call-specific strerror replacements
00003  * Copyright (C) 2011, 2013 Peter Miller
00004  * Written by Peter Miller <pmiller@opensource.org.au>
00005  *
00006  * This program is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU Lesser General Public License as published by
00008  * the Free Software Foundation; either version 3 of the License, or (at your
00009  * option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00014  * License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #include <libexplain/ac/errno.h>
00021 #include <libexplain/ac/linux/videodev2.h>
00022 #include <libexplain/ac/sys/ioctl.h>
00023 
00024 #include <libexplain/iocontrol/generic.h>
00025 #include <libexplain/iocontrol/vidioc_log_status.h>
00026 #include <libexplain/string_buffer.h>
00027 
00028 #ifdef VIDIOC_LOG_STATUS
00029 
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 EINVAL:
00038         errnum = ENOTTY;
00039         /* Fall through... */
00040 
00041     default:
00042         explain_iocontrol_generic_print_explanation
00043         (
00044             p,
00045             sb,
00046             errnum,
00047             fildes,
00048             request,
00049             data
00050         );
00051         break;
00052     }
00053 }
00054 
00055 
00056 const explain_iocontrol_t explain_iocontrol_vidioc_log_status =
00057 {
00058     "VIDIOC_LOG_STATUS", /* name */
00059     VIDIOC_LOG_STATUS, /* value */
00060     0, /* disambiguate */
00061     0, /* print_name */
00062     explain_iocontrol_generic_print_data_int, /* print_data */
00063     print_explanation,
00064     0, /* print_data_returned */
00065     NOT_A_POINTER, /* data_size */
00066     "intptr_t", /* data_type */
00067     0, /* flags */
00068     __FILE__,
00069     __LINE__,
00070 };
00071 
00072 #else /* ndef VIDIOC_LOG_STATUS */
00073 
00074 const explain_iocontrol_t explain_iocontrol_vidioc_log_status =
00075 {
00076     0, /* name */
00077     0, /* value */
00078     0, /* disambiguate */
00079     0, /* print_name */
00080     0, /* print_data */
00081     0, /* print_explanation */
00082     0, /* print_data_returned */
00083     0, /* data_size */
00084     0, /* data_type */
00085     0, /* flags */
00086     __FILE__,
00087     __LINE__,
00088 };
00089 
00090 #endif /* VIDIOC_LOG_STATUS */
00091 
00092 /* vim: set ts=8 sw=4 et : */