libexplain  1.4.D001
libexplain/buffer/exdev.c
Go to the documentation of this file.
00001 /*
00002  * libexplain - Explain errno values returned by libc functions
00003  * Copyright (C) 2008-2010, 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 #include <libexplain/buffer/mount_point.h>
00021 #include <libexplain/buffer/exdev.h>
00022 #include <libexplain/option.h>
00023 #include <libexplain/same_dev.h>
00024 
00025 
00026 void
00027 explain_buffer_exdev(explain_string_buffer_t *sb, const char *oldpath,
00028     const char *newpath, const char *sys_call_name)
00029 {
00030     /* FIXME: i18n */
00031     explain_string_buffer_puts
00032     (
00033         sb,
00034         "oldpath"
00035     );
00036     explain_buffer_mount_point(sb, oldpath);
00037     explain_string_buffer_puts
00038     (
00039         sb,
00040         " and newpath"
00041     );
00042     explain_buffer_mount_point_dirname(sb, newpath);
00043     explain_string_buffer_puts
00044     (
00045         sb,
00046         " are not on the same mounted file system"
00047     );
00048 #ifdef __linux__
00049     if (explain_option_dialect_specific())
00050     {
00051         if (explain_same_dev(oldpath, newpath))
00052         {
00053             explain_string_buffer_puts(sb->footnotes, "; ");
00054             explain_string_buffer_printf_gettext
00055             (
00056                 sb->footnotes,
00057                 /*
00058                  * xgettext:  This error message is used, on Linux, when
00059                  * a "cross mount point" hard link should work, but it
00060                  * does not.
00061                  */
00062                 i18n("note that Linux permits a file system to be mounted at "
00063                     "multiple points, but the %s system call does not work "
00064                     "across different mount points, even if the same file "
00065                     "system is mounted on both"),
00066                 sys_call_name
00067             );
00068         }
00069     }
00070 #else
00071     (void)sys_call_name;
00072 #endif
00073 }
00074 
00075 
00076 /* vim: set ts=8 sw=4 et : */