libexplain  1.4.D001
libexplain/iocontrol.h
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  * Written by Peter Miller <pmiller@opensource.org.au>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as
00008  * published by the Free Software Foundation; either version 3 of the
00009  * License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public 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 #ifndef LIBEXPLAIN_IOCONTROL_H
00021 #define LIBEXPLAIN_IOCONTROL_H
00022 
00023 struct explain_string_buffer_t; /* forward */
00024 typedef struct explain_iocontrol_t explain_iocontrol_t;
00025 
00046 typedef void (*expain_iocontrol_print_func_t)(const explain_iocontrol_t *p,
00047     struct explain_string_buffer_t *sb, int errnum, int fildes, int request,
00048     const void *data);
00049 
00060 struct explain_iocontrol_t
00061 {
00067     const char *name;
00068 
00074     int number;
00075 
00088     int (*disambiguate)(int fildes, int request, const void *data);
00089 
00098     expain_iocontrol_print_func_t print_name;
00099 
00105     expain_iocontrol_print_func_t print_data;
00106 
00112     expain_iocontrol_print_func_t print_explanation;
00113 
00133     void (*print_data_returned)(const explain_iocontrol_t *p,
00134         struct explain_string_buffer_t *sb, int errnum, int fildes,
00135         int request, const void *data);
00136 
00145     unsigned data_size;
00146 
00152     const char *data_type;
00153 
00159     unsigned flags;
00160 
00167     const char *file;
00168 
00175     int line;
00176 };
00177 
00193 const explain_iocontrol_t *explain_iocontrol_find_by_number(int fildes,
00194     int request, const void *data);
00195 
00206 const explain_iocontrol_t *explain_iocontrol_request_by_name(const char *name);
00207 
00227 void explain_iocontrol_print_name(const explain_iocontrol_t *p,
00228     struct explain_string_buffer_t *sb, int errnum, int fildes,
00229     int request, const void *data);
00230 
00251 void explain_iocontrol_print_data(const explain_iocontrol_t *p,
00252     struct explain_string_buffer_t *sb, int errnum, int fildes,
00253     int request, const void *data);
00254 
00274 void explain_iocontrol_print_explanation(const explain_iocontrol_t *p,
00275     struct explain_string_buffer_t *sb, int errnum, int fildes,
00276     int request, const void *data);
00277 
00289 int explain_parse_ioctl_request_or_die(const char *text);
00290 
00301 void explain_iocontrol_statistics(int *total, int *active);
00302 
00308 void explain_iocontrol_check_conflicts(void);
00309 
00314 int explain_iocontrol_disambiguate_true(int fildes, int request,
00315     const void *data);
00316 
00321 int explain_iocontrol_disambiguate_false(int fildes, int request,
00322     const void *data);
00323 
00328 int explain_iocontrol_disambiguate_is_a_socket(int fildes, int request,
00329     const void *data);
00330 
00335 int explain_iocontrol_disambiguate_is_not_a_socket(int fildes, int request,
00336     const void *data);
00337 
00343 int explain_iocontrol_disambiguate_is_if_eql(int fildes, int request,
00344     const void *data);
00345 
00351 int explain_iocontrol_disambiguate_is_v4l2(int fildes, int request,
00352     const void *data);
00353 
00367 int explain_iocontrol_disambiguate_scc(int fildes, int request,
00368     const void *data);
00369 
00385 int explain_iocontrol_disambiguate_net_dev_name(int fildes, const char *name);
00386 
00392 void explain_iocontrol_check_conflicts(void);
00393 
00399 #define NOT_A_POINTER (unsigned)(-1)
00400 
00401 #define VOID_STAR (unsigned)(-2)
00402 
00408 #define IOCONTROL_FLAG_SIZE_DOES_NOT_AGREE  0x0001
00409 
00416 #define IOCONTROL_FLAG_NON_META             0x0002
00417 
00422 #define IOCONTROL_FLAG_RW                   0x0004
00423 
00428 #define DISAMBIGUATE_USE 0
00429 
00435 #define DISAMBIGUATE_DO_NOT_USE -1
00436 
00437 #endif /* LIBEXPLAIN_IOCONTROL_H */
00438 /* vim: set ts=8 sw=4 et : */