2
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of version 2 of the GNU General Public License as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it would be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* Further, this software is distributed without any warranty that it is
13
* free of the rightful claim of any third person regarding infringement
14
* or the like. Any license provided herein, whether implied or
15
* otherwise, applies only to this software file. Patent licenses, if
16
* any, provided herein do not apply to combinations of this program with
17
* other software, or any other product whatsoever.
19
* You should have received a copy of the GNU General Public License along
20
* with this program; if not, write the Free Software Foundation, Inc., 59
21
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
* Mountain View, CA 94043, or:
28
* For further information regarding this notice, see:
30
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33
#include <xfs/libxfs.h>
36
extern char *fname; /* mount point name */
37
extern char *datadev; /* data device name */
38
extern char *logdev; /* log device name */
39
extern char *rtdev; /* RT device name */
42
explore_mtab(char *mtab, char *mntpoint)
45
struct stat64 statuser;
46
struct stat64 statmtab_dir;
47
struct stat64 statmtab_dev;
56
if ((mtp = setmntent(mtab, "r")) == NULL) {
57
fprintf(stderr, _("%s: cannot access mount list %s: %s\n"),
58
progname, MOUNTED, strerror(errno));
61
if (stat64(mntpoint, &statuser) < 0) {
62
fprintf(stderr, _("%s: cannot access mount point %s: %s\n"),
63
progname, mntpoint, strerror(errno));
67
while ((mnt = getmntent(mtp)) != NULL) {
68
if (stat64(mnt->mnt_dir, &statmtab_dir) < 0) {
69
fprintf(stderr, _("%s: ignoring entry %s in %s: %s\n"),
70
progname, mnt->mnt_dir, mtab, strerror(errno));
73
havedev = (stat64(mnt->mnt_fsname, &statmtab_dev) != -1);
74
if ( !((statuser.st_ino == statmtab_dir.st_ino &&
75
statuser.st_dev == statmtab_dir.st_dev) ||
76
(statuser.st_ino == statmtab_dev.st_ino &&
77
statuser.st_dev == statmtab_dev.st_dev &&
80
else if (strcmp(mnt->mnt_type, "xfs") != 0) {
81
fprintf(stderr, _("%s: %s is not an XFS filesystem\n"),
85
break; /* we've found it */
90
_("%s: %s is not a mounted XFS filesystem, according to %s\n"),
91
progname, mntpoint, MOUNTED);
95
/* find the data, log (logdev=), and realtime (rtdev=) devices */
96
rtend = logend = NULL;
98
datadev = mnt->mnt_fsname;
99
if ((logdev = hasmntopt(mnt, "logdev="))) {
101
logend = strtok(logdev, " ,");
103
if ((rtdev = hasmntopt(mnt, "rtdev="))) {
105
rtend = strtok(rtdev, " ,");
108
/* Do this only after we've finished processing mount options */
109
if (logdev && logend != logdev)
110
*logend = '\0'; /* terminate end of log device name */
111
if (rtdev && rtend != rtdev)
112
*rtend = '\0'; /* terminate end of rt device name */