2 * Copyright (c) 1980, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 4. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #include <afsconfig.h>
31 #include <afs/param.h>
35 #if defined(AFS_DARWIN_ENV)
37 * Reworked from FreeBSD umount
40 #include <sys/mount.h>
44 mntinfo(struct statfs **mntbuffer)
46 static struct statfs *origbuf;
50 mntsize = getfsstat(NULL, 0, MNT_NOWAIT);
53 bufsize = (mntsize + 1) * sizeof(struct statfs);
54 if ((origbuf = malloc(bufsize)) == NULL)
56 mntsize = getfsstat(origbuf, (long)bufsize, MNT_NOWAIT);
61 static struct statfs *mntbuf = NULL;
62 static struct statfs *mntent;
64 static struct fstab fstabent;
69 if (((!mntbuf) && !setfsent()) || mntcnt == 0)
71 fstabent.fs_file = mntent->f_mntonname;
72 fstabent.fs_freq = fstabent.fs_passno = 0;
73 fstabent.fs_mntops = mntent->f_fstypename;
74 fstabent.fs_spec = mntent->f_mntfromname;
75 if (mntent->f_flags & MNT_RDONLY)
76 fstabent.fs_type = FSTAB_RO;
78 fstabent.fs_type = FSTAB_RW;
79 fstabent.fs_vfstype = mntent->f_fstypename;
93 if ((mntcnt = mntinfo(&mntbuf)) <= 0) {