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/fs.h> 00022 #include <libexplain/ac/sys/ioctl.h> 00023 00024 #include <libexplain/buffer/dac.h> 00025 #include <libexplain/buffer/gettext.h> 00026 #include <libexplain/iocontrol/blkflsbuf.h> 00027 #include <libexplain/iocontrol/generic.h> 00028 00029 00030 #ifdef BLKFLSBUF 00031 00032 static void 00033 print_explanation(const explain_iocontrol_t *p, explain_string_buffer_t *sb, 00034 int errnum, int fildes, int request, const void *data) 00035 { 00036 switch (errnum) 00037 { 00038 case EACCES: 00039 explain_buffer_gettext 00040 ( 00041 sb, 00042 /* 00043 * xgettext: This error message is issued to explain an 00044 * EACCES error reported by the BLKFLSBUF ioctl, in the case 00045 * where the process does not have permission to flush the 00046 * buffers. 00047 */ 00048 i18n("the process does not have permission to flush the buffers") 00049 ); 00050 explain_buffer_dac_sys_admin(sb); 00051 break; 00052 00053 default: 00054 explain_iocontrol_generic.print_explanation(p, sb, errnum, fildes, 00055 request, data); 00056 break; 00057 } 00058 } 00059 00060 00061 const explain_iocontrol_t explain_iocontrol_blkflsbuf = 00062 { 00063 "BLKFLSBUF", /* name */ 00064 BLKFLSBUF, /* value */ 00065 0, /* disambiguate */ 00066 0, /* print_name */ 00067 explain_iocontrol_generic_print_data_int, /* print_data */ 00068 print_explanation, 00069 0, /* print_data_returned */ 00070 NOT_A_POINTER, /* data_size */ 00071 "intptr_t", /* data_type */ 00072 0, /* flags */ 00073 __FILE__, 00074 __LINE__, 00075 }; 00076 00077 #else /* ndef BLKFLSBUF */ 00078 00079 const explain_iocontrol_t explain_iocontrol_blkflsbuf = 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 /* BLKFLSBUF */ 00096 00097 00098 /* vim: set ts=8 sw=4 et : */