libexplain
1.4.D001
|
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/char_data.h> 00023 #include <libexplain/buffer/pointer.h> 00024 #include <libexplain/iocontrol/generic.h> 00025 #include <libexplain/iocontrol/hdio_obsolete_identity.h> 00026 00027 #ifdef HDIO_OBSOLETE_IDENTITY 00028 00029 00030 static void 00031 print_data(const explain_iocontrol_t *p, explain_string_buffer_t *sb, int 00032 errnum, int fildes, int request, const void *data) 00033 { 00034 (void)p; 00035 (void)errnum; 00036 (void)fildes; 00037 (void)request; 00038 explain_buffer_pointer(sb, data); 00039 } 00040 00041 00042 static void 00043 print_explanation(const explain_iocontrol_t *p, explain_string_buffer_t *sb, int 00044 errnum, int fildes, int request, const void *data) 00045 { 00046 switch (errnum) 00047 { 00048 default: 00049 explain_iocontrol_generic_print_explanation 00050 ( 00051 p, 00052 sb, 00053 errnum, 00054 fildes, 00055 request, 00056 data 00057 ); 00058 break; 00059 } 00060 } 00061 00062 00063 static void 00064 print_data_returned(const explain_iocontrol_t *p, explain_string_buffer_t *sb, 00065 int errnum, int fildes, int request, const void *data) 00066 { 00067 (void)p; 00068 (void)errnum; 00069 (void)fildes; 00070 (void)request; 00071 explain_buffer_char_data(sb, data, 142); 00072 } 00073 00074 00075 const explain_iocontrol_t explain_iocontrol_hdio_obsolete_identity = 00076 { 00077 "HDIO_OBSOLETE_IDENTITY", /* name */ 00078 HDIO_OBSOLETE_IDENTITY, /* value */ 00079 0, /* disambiguate */ 00080 0, /* print_name */ 00081 print_data, 00082 print_explanation, 00083 print_data_returned, 00084 sizeof(char[142]), /* data_size */ 00085 "char[142]", /* data_type */ 00086 IOCONTROL_FLAG_NON_META, /* flags */ 00087 __FILE__, 00088 __LINE__, 00089 }; 00090 00091 #else /* ndef HDIO_OBSOLETE_IDENTITY */ 00092 00093 const explain_iocontrol_t explain_iocontrol_hdio_obsolete_identity = 00094 { 00095 0, /* name */ 00096 0, /* value */ 00097 0, /* disambiguate */ 00098 0, /* print_name */ 00099 0, /* print_data */ 00100 0, /* print_explanation */ 00101 0, /* print_data_returned */ 00102 0, /* data_size */ 00103 0, /* data_type */ 00104 0, /* flags */ 00105 __FILE__, 00106 __LINE__, 00107 }; 00108 00109 #endif /* HDIO_OBSOLETE_IDENTITY */ 00110 00111 00112 /* vim: set ts=8 sw=4 et : */