+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2005-2006 Silicon Graphics, Inc.
* All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <paths.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include "path.h"
+#include "paths.h"
#include "input.h"
-#include "project.h"
+#include "projects.h"
#include <limits.h>
extern char *progname;
return error;
}
-#elif defined(HAVE_GETMNTINFO)
-#include <sys/mount.h>
-
-/*
- * If *path is NULL, initialize the fs table with all xfs mount points in mtab
- * If *path is specified, search for that path in mtab
- *
- * Everything - path, devices, and mountpoints - are boiled down to realpath()
- * for comparison, but fs_table is populated with what comes from getmntinfo.
- */
-static int
-fs_table_initialise_mounts(
- char *path)
-{
- struct statfs *stats;
- int i, count, error, found;
- char rpath[PATH_MAX], rmntfromname[PATH_MAX], rmntonname[PATH_MAX];
-
- error = found = 0;
- if ((count = getmntinfo(&stats, 0)) < 0) {
- fprintf(stderr, _("%s: getmntinfo() failed: %s\n"),
- progname, strerror(errno));
- return 0;
- }
-
- /* Use realpath to resolve symlinks, relative paths, etc */
- if (path)
- if (!realpath(path, rpath))
- return errno;
-
- for (i = 0; i < count; i++) {
- if (!realpath(stats[i].f_mntfromname, rmntfromname))
- continue;
- if (!realpath(stats[i].f_mntonname, rmntonname))
- continue;
-
- if (path &&
- ((strcmp(rpath, rmntonname) != 0) &&
- (strcmp(rpath, rmntfromname) != 0)))
- continue;
- /* TODO: external log and realtime device? */
- (void) fs_table_insert(stats[i].f_mntonname, 0,
- FS_MOUNT_POINT, stats[i].f_mntfromname,
- NULL, NULL);
- if (path) {
- found = 1;
- break;
- }
- }
- if (path && !found)
- error = ENXIO;
-
- return error;
-}
-
#else
# error "How do I extract info about mounted filesystems on this platform?"
#endif