diff options
Diffstat (limited to 'contrib/amd/amd/ops_ufs.c')
-rw-r--r-- | contrib/amd/amd/ops_ufs.c | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/contrib/amd/amd/ops_ufs.c b/contrib/amd/amd/ops_ufs.c index 999a669..fd82a5c 100644 --- a/contrib/amd/amd/ops_ufs.c +++ b/contrib/amd/amd/ops_ufs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2004 Erez Zadok + * Copyright (c) 1997-2006 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry * Copyright (c) 1990 Imperial College of Science, Technology & Medicine * Copyright (c) 1990 The Regents of the University of California. @@ -36,9 +36,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * %W% (Berkeley) %G% * - * $Id: ops_ufs.c,v 1.3.2.5 2004/01/06 03:15:16 ezk Exp $ + * File: am-utils/amd/ops_ufs.c * */ @@ -54,8 +53,8 @@ /* forward declarations */ static char *ufs_match(am_opts *fo); -static int ufs_fmount(mntfs *mf); -static int ufs_fumount(mntfs *mf); +static int ufs_mount(am_node *am, mntfs *mf); +static int ufs_umount(am_node *am, mntfs *mf); /* * Ops structure @@ -65,17 +64,20 @@ am_ops ufs_ops = "ufs", ufs_match, 0, /* ufs_init */ - amfs_auto_fmount, - ufs_fmount, - amfs_auto_fumount, - ufs_fumount, - amfs_error_lookuppn, + ufs_mount, + ufs_umount, + amfs_error_lookup_child, + amfs_error_mount_child, amfs_error_readdir, 0, /* ufs_readlink */ 0, /* ufs_mounted */ 0, /* ufs_umounted */ - find_amfs_auto_srvr, - FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO + amfs_generic_find_srvr, + 0, /* ufs_get_wchan */ + FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */ +#ifdef HAVE_FS_AUTOFS + AUTOFS_UFS_FS_FLAGS, +#endif /* HAVE_FS_AUTOFS */ }; @@ -91,9 +93,7 @@ ufs_match(am_opts *fo) return 0; } -#ifdef DEBUG dlog("UFS: mounting device \"%s\" on \"%s\"", fo->opt_dev, fo->opt_fs); -#endif /* DEBUG */ /* * Determine magic cookie to put in mtab @@ -103,7 +103,7 @@ ufs_match(am_opts *fo) static int -mount_ufs(char *dir, char *fs_name, char *opts) +mount_ufs(char *mntdir, char *fs_name, char *opts, int on_autofs) { ufs_args_t ufs_args; mntent_t mnt; @@ -120,12 +120,16 @@ mount_ufs(char *dir, char *fs_name, char *opts) * Fill in the mount structure */ memset((voidp) &mnt, 0, sizeof(mnt)); - mnt.mnt_dir = dir; + mnt.mnt_dir = mntdir; mnt.mnt_fsname = fs_name; mnt.mnt_type = MNTTAB_TYPE_UFS; mnt.mnt_opts = opts; genflags = compute_mount_flags(&mnt); +#ifdef HAVE_FS_AUTOFS + if (on_autofs) + genflags |= autofs_compute_mount_flags(&mnt); +#endif /* HAVE_FS_AUTOFS */ #ifdef HAVE_UFS_ARGS_T_FLAGS ufs_args.flags = genflags; /* XXX: is this correct? */ @@ -146,16 +150,17 @@ mount_ufs(char *dir, char *fs_name, char *opts) /* * Call generic mount routine */ - return mount_fs(&mnt, genflags, (caddr_t) &ufs_args, 0, type, 0, NULL, mnttab_file_name); + return mount_fs(&mnt, genflags, (caddr_t) &ufs_args, 0, type, 0, NULL, mnttab_file_name, on_autofs); } static int -ufs_fmount(mntfs *mf) +ufs_mount(am_node *am, mntfs *mf) { + int on_autofs = mf->mf_flags & MFF_ON_AUTOFS; int error; - error = mount_ufs(mf->mf_mount, mf->mf_info, mf->mf_mopts); + error = mount_ufs(mf->mf_mount, mf->mf_info, mf->mf_mopts, on_autofs); if (error) { errno = error; plog(XLOG_ERROR, "mount_ufs: %m"); @@ -167,7 +172,9 @@ ufs_fmount(mntfs *mf) static int -ufs_fumount(mntfs *mf) +ufs_umount(am_node *am, mntfs *mf) { - return UMOUNT_FS(mf->mf_mount, mnttab_file_name); + int unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0; + + return UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags); } |