]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - libdisk/mountinfo.c
a639447dae97a1b57e22f0082ca77972c30c17d7
2 * Copyright (c) 2000-2001 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/
40 #include <sys/param.h>
41 #include "mountinfo.h"
44 mnt_check_init(mnt_check_state_t
**check_state
)
50 mnt_find_mount_conflicts(mnt_check_state_t
*check_state
, char *devname
)
52 #define PROC_MOUNTED "/proc/mounts"
57 char mounts
[MAXPATHLEN
];
59 if (stat64(devname
, &ns
) < 0)
62 strcpy(mounts
, access(PROC_MOUNTED
, R_OK
)? PROC_MOUNTED
: MOUNTED
);
63 if ((f
= setmntent(mounts
, "r")) == NULL
)
65 while ((mnt
= getmntent(f
)) != NULL
) {
66 if (stat64(mnt
->mnt_fsname
, &ms
) < 0)
68 if (S_ISBLK(ms
.st_mode
) && ns
.st_rdev
== ms
.st_rdev
)
70 if (!S_ISBLK(ms
.st_mode
) && !strcmp(devname
, mnt
->mnt_fsname
))
80 mnt_find_mounted_partitions(mnt_check_state_t
*check_state
, char *devname
)
86 mnt_causes_test(mnt_check_state_t
*check_state
, int cause
)
89 case MNT_CAUSE_MOUNTED
:
93 fprintf(stderr
, "mnt_causes_test: unknown cause %d\n", cause
);
99 mnt_causes_show(mnt_check_state_t
*check_state
, FILE *fp
, char *prefix
)
101 fprintf(fp
, "mnt_causes_show: not implemented. Called with %s\n",
107 mnt_plist_show(mnt_check_state_t
*check_state
, FILE *fp
, char *prefix
)
110 * Need to do some work for volume mgmt.
115 mnt_check_end(mnt_check_state_t
*check_state
)