libexplain
1.4.D001
|
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 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/cdrom.h> 00022 #include <libexplain/ac/stdint.h> 00023 #include <libexplain/ac/sys/ioctl.h> 00024 00025 #include <libexplain/buffer/dac.h> 00026 #include <libexplain/buffer/gettext.h> 00027 #include <libexplain/buffer/long.h> 00028 #include <libexplain/iocontrol/cdrom_debug.h> 00029 #include <libexplain/iocontrol/generic.h> 00030 00031 00032 #ifdef CDROM_DEBUG 00033 00034 static void 00035 print_explanation(const explain_iocontrol_t *p, 00036 explain_string_buffer_t *sb, int errnum, int fildes, int request, 00037 const void *data) 00038 { 00039 switch (errnum) 00040 { 00041 case EACCES: 00042 /* FIXME: it could be a DVD */ 00043 explain_buffer_gettext 00044 ( 00045 sb, 00046 /* 00047 * xgettext: This error message is issued to explain and 00048 * EACCES error reported by a CDROM_DEBUG ioctl. 00049 */ 00050 i18n("the process does not have permission to change the " 00051 "CD-ROM debugging flag") 00052 ); 00053 explain_buffer_dac_sys_admin(sb); 00054 break; 00055 00056 default: 00057 explain_iocontrol_generic.print_explanation 00058 ( 00059 p, 00060 sb, 00061 errnum, 00062 fildes, 00063 request, 00064 data 00065 ); 00066 break; 00067 } 00068 } 00069 00070 00071 const explain_iocontrol_t explain_iocontrol_cdrom_debug = 00072 { 00073 "CDROM_DEBUG", /* name */ 00074 CDROM_DEBUG, /* value */ 00075 0, /* disambiguate */ 00076 0, /* print_name */ 00077 explain_iocontrol_generic_print_data_long, 00078 print_explanation, 00079 0, /* print_data_returned */ 00080 NOT_A_POINTER, /* data_size */ 00081 "intptr_t", /* data_type */ 00082 0, /* flags */ 00083 __FILE__, 00084 __LINE__, 00085 }; 00086 00087 #else /* ndef CDROM_DEBUG */ 00088 00089 const explain_iocontrol_t explain_iocontrol_cdrom_debug = 00090 { 00091 0, /* name */ 00092 0, /* value */ 00093 0, /* disambiguate */ 00094 0, /* print_name */ 00095 0, /* print_data */ 00096 0, /* print_explanation */ 00097 0, /* print_data_returned */ 00098 0, /* data_size */ 00099 0, /* data_type */ 00100 0, /* flags */ 00101 __FILE__, 00102 __LINE__, 00103 }; 00104 00105 #endif /* CDROM_DEBUG */ 00106 00107 00108 /* vim: set ts=8 sw=4 et : */