diff options
author | jhb <jhb@FreeBSD.org> | 2010-11-17 15:42:47 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-11-17 15:42:47 +0000 |
commit | 5c07657c6b8851989d47328889c79ddc4c6c746d (patch) | |
tree | 8b4192cb7df837e44e4ed54ac16ba8f93b1f0b9c | |
parent | 32a58110d0f0bf2f7b478c11079ac75f273aff5a (diff) | |
download | FreeBSD-src-5c07657c6b8851989d47328889c79ddc4c6c746d.zip FreeBSD-src-5c07657c6b8851989d47328889c79ddc4c6c746d.tar.gz |
Remove unused autofs userland bits.
Approved by: core
-rw-r--r-- | lib/libautofs/Makefile | 11 | ||||
-rw-r--r-- | lib/libautofs/libautofs.3 | 265 | ||||
-rw-r--r-- | lib/libautofs/libautofs.c | 479 | ||||
-rw-r--r-- | lib/libautofs/libautofs.h | 104 | ||||
-rw-r--r-- | sbin/mount_autofs/Makefile | 9 | ||||
-rw-r--r-- | sbin/mount_autofs/mount_autofs.8 | 71 | ||||
-rw-r--r-- | sbin/mount_autofs/mount_autofs.c | 113 |
7 files changed, 0 insertions, 1052 deletions
diff --git a/lib/libautofs/Makefile b/lib/libautofs/Makefile deleted file mode 100644 index 1975856..0000000 --- a/lib/libautofs/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $Id: Makefile,v 1.5 2004/09/08 08:12:21 bright Exp $ -# $FreeBSD$ - -LIB= autofs -SHLIB_MAJOR= 3 - -SRCS= libautofs.c -INCS= libautofs.h -MAN= libautofs.3 - -.include <bsd.lib.mk> diff --git a/lib/libautofs/libautofs.3 b/lib/libautofs/libautofs.3 deleted file mode 100644 index f4e07a9..0000000 --- a/lib/libautofs/libautofs.3 +++ /dev/null @@ -1,265 +0,0 @@ -.\" Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: libautofs.3,v 1.4 2004/09/08 08:12:21 bright Exp $ -.\" $FreeBSD$ -.Dd September 9, 2004 -.Dt LIBAUTOFS 3 -.Os -.Sh NAME -.Nm libautofs -.Nd "procedural interface to managing an autofs file system" -.Sh SYNOPSIS -.In libautofs.h -.Ft int -.Fn autoh_get "const char *path" "autoh_t *hndlp" -.Ft void -.Fn autoh_free "autoh_t hndl" -.Ft int -.Fn autoh_getall "autoh_t **hndlpp" "int *cnt" -.Ft void -.Fn autoh_freeall "autoh_t *hndlep" -.Ft int -.Fn autoh_fd "autoh_t hndl" -.Ft const char * -.Fn autoh_mp "autoh_t hndl" -.Ft int -.Fn autoreq_get "autoh_t hndl" "autoreq_t **reqpp" "int *cntp" -.Ft void -.Fn autoreq_free "autoh_t hndl" "autoreq_t *reqp" -.Ft int -.Fn autoreq_serv "autoh_t hndl" "autoreq_t req" -.Ft enum autoreq_op -.Fn autoreq_getop "autoreq_t req" -.Ft const char * -.Fn autoreq_getpath "autoreq_t req" -.Ft autoino_t -.Fn autoreq_getino "autoreq_t req" -.Ft autoino_t -.Fn autoreq_getdirino "autoreq_t req" -.Ft void -.Fn autoreq_getaux "autoreq_t req" "void **auxdatap" "size_t *auxsizep" -.Ft void -.Fn autoreq_getoffset "autoreq_t req" "off_t *offp" -.Ft void -.Fn autoreq_getxid "autoreq_t req" "int *xidp" -.Ft void -.Fn autoreq_setino "autoreq_t req" "autoino_t ino" -.Ft void -.Fn autoreq_seterrno "autoreq_t req" "int errno" -.Ft void -.Fn autoreq_setaux "autoreq_t req" "void *auxdata" "size_t auxsize" -.Ft void -.Fn autoreq_seteof "autoreq_t req" "int eof" -.Ft int -.Fn autoh_togglepath "autoh_t hndl" "int toggle" "pid_t pid" "const char *path" -.Ft int -.Fn autoh_togglefd "autoh_t hndl" "int toggle" "pid_t pid" "int fd" -.Sh DESCRIPTION -The -.Nm libautofs -library provides a "mostly" stable interface to the -.Xr autofs 9 -file system. -.Pp -The interface to -.Xr autofs 9 -is managed via handles of type -.Fa autoh_t -and -.Fa autoreq_t -which refer to handles to -.Xr autofs 9 -mount points and requests respectively. -.Pp -The -.Fn autoh_get -function returns a handle to an -.Xr autofs 9 -file system based on the -.Fa path -parameter. -The handle returned should be freed via the -.Fn autoh_free -function. -.Pp -The -.Fn autoh_getall -function returns an array of handles to all mounted -.Xr autofs 9 -file systems, each of which should be released via the -.Fn autoh_free -function or released en-mass via the -.Fn autoh_freeall -function. -.Pp -The -.Fn autoh_fd -function returns a file descriptor that can be used with -.Xr select 2 -or -.Xr poll 2 -to check for "exceptional" data to detect an -.Xr autofs 9 -event. -Users of -.Xr select 2 -should set the fd in the -.Fa exceptfds -fd_set. -Users of -.Xr poll 2 -should set POLLPRI in the pollfd -.Fa fds -argument. -.Pp -The -.Fn autoh_mp -function returns the path to the autofs file system that the -.Fa hndl -is derived from. -.Pp -The -.Fn autoreq_get -function returns an array of autofs requests in -.Fa reqpp , -the number of requests is stored into -.Fa cntp . -Each request should be released using the -.Fn autoreq_free -function. -.Pp -Requests that are retrieved via the -.Fn autoreq_get -are served via the "autoreq_" functions. -.Pp -The following functions returns information about the request. -.Bl -tag -width indent -.It Fn autoreq_getop -return the operation type of the request, that would be one of -AUTOREQ_OP_UNKNOWN, AUTOREQ_OP_LOOKUP, AUTOREQ_OP_STAT, AUTOREQ_OP_READDIR -depending on the type of request that -.Xr autofs 9 -requires service from. -.It Fn autoreq_getpath -return the path of the mountpoint associated with the request -.Fa req . -.It Fn autoreq_getino -return the inode associated with the request -.Fa req . -.It Fn autoreq_getdirno -return the directory inode associated with the request -.Fa req . -.It Fn autoreq_getaux -return the auxiliary data associated with the request -.Fa req . -.It Fn autoreq_getoffset -return the offset request associated with the request -.Fa req . -(used for readdir request) -.It Fn autoreq_getxid -return the transaction id associated with an autofs request, these -are unique per mount point, but not system wide. -They can be used -for debugging to ensure requests are being accepted by the kernel. -.El -.Pp -The following functions allow one to set the response sent to -.Xr autofs 9 -to the requesting userland application. -.Bl -tag -width indent -.It Fn autoreq_setino -Set the request -.Fa req -inode to -.Fa ino , -this is typically unused. -.It Fn autoreq_seterrno -set the error returned to the application sending the request, typically -this is left alone, or set to ENOENT if the request is for a non-existent -name. -The default error is no error. -Meaning the application will see -a successful return. -.It Fn autoreq_setaux -used to set the auxiliary data for a request, currently used to set -the dirent structures for serving a readdir request. -Default is no -auxiliary data. -.It Fn autoreq_seteof -used to set the eof flag for readdir requests (default is not eof.) -.El -.Pp -The functions -.Fn autoh_togglepath -and -.Fn autoh_togglefd -are used to set options on an -.Xr autofs 9 -directory via -.Fa path -and -.Fa fd -respectively. -The -.Fa pid -argument should be set to the pid of the process serving -.Xr autofs 9 -requests, or -1 to disable the option. -The options are -.Bl -tag -width AUTO_INDIRECT -.It Fa AUTO_MOUNTER -set this process as the one responsible for the -.Xr autofs 9 -node, if this process exits, then requests into the autofs will begin to fail. -.It Fa AUTO_BROWSE -dispatch directory read requests for this node to the process identified by -.Fa pid . -Specifically, calls to -.Xr getdirentries 2 -and -.Xr getdents 2 -will be routed to userland after the current actual directory contents -are read into userland. -.It Fa AUTO_DIRECT -Set the directory as a mount trigger. -Any request to enter the directory -will trigger a callback into the process -.Fa pid . -.It Fa AUTO_INDIRECT -Set the directory as an indirect trigger. -Any request for an entry inside -the directory will be routed to the process identified by -.Fa pid . -.El -.Sh EXAMPLES -See /usr/share/examples/autofs/driver/ -.Sh HISTORY -The -.Nm -utility first appeared in -.Fx 6.0 . -.Sh AUTHORS -This manual page and the autofs file system suite were written by -.An Alfred Perlstein . diff --git a/lib/libautofs/libautofs.c b/lib/libautofs/libautofs.c deleted file mode 100644 index 459b32d..0000000 --- a/lib/libautofs/libautofs.c +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - * $Id: libautofs.c,v 1.5 2004/09/08 08:44:12 bright Exp $ - */ -#include <err.h> -#include <ctype.h> -#include <err.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/mount.h> -#include <sys/poll.h> -#include <sys/stat.h> -#include <sys/sysctl.h> - -#ifdef AUTOFSSTANDALONE -#include "../autofs/autofs.h" -#else -#include <fs/autofs/autofs.h> -#endif - -#include "libautofs.h" - -struct auto_handle { - char ah_mp[MNAMELEN]; - fsid_t ah_fsid; - int ah_fd; -}; - -static int autofs_sysctl(int, fsid_t *, void *, size_t *, void *, size_t); -static void safe_free(void *ptr); -static int getmntlst(struct statfs **sfsp, int *cntp); - -static void -safe_free(void *ptr) -{ - int saved_errno; - - saved_errno = errno; - free(ptr); - errno = saved_errno; -} - -int -getmntlst(struct statfs **sfsp, int *cntp) -{ - int cnt; - long bufsize; - - *sfsp = NULL; - cnt = getfsstat(NULL, 0, MNT_NOWAIT); - bufsize = cnt * sizeof(**sfsp); - /*fprintf(stderr, "getmntlst bufsize %ld, cnt %d\n", bufsize, cnt);*/ - *sfsp = malloc(bufsize); - if (sfsp == NULL) - goto err; - cnt = getfsstat(*sfsp, bufsize, MNT_NOWAIT); - if (cnt == -1) - goto err; - *cntp = cnt; - /*fprintf(stderr, "getmntlst ok, cnt %d\n", cnt);*/ - return (0); -err: - safe_free(sfsp); - *sfsp = NULL; - /*fprintf(stderr, "getmntlst bad\n");*/ - return (-1); -} - -/* get a handle based on a path. */ -int -autoh_get(const char *path, autoh_t *ahp) -{ - struct statfs *sfsp, *sp; - int cnt, fd, i; - autoh_t ret; - - ret = NULL; - /* - * We use getfsstat to prevent avoid the lookups on the mountpoints - * that statfs(2) would do. - */ - if (getmntlst(&sfsp, &cnt)) - goto err; - for (i = 0; i < cnt; i++) { - if (strcmp(sfsp[i].f_mntonname, path) == 0) - break; - } - if (i == cnt) { - /*fprintf(stderr, "autoh_get bad %d %d\n", i, cnt);*/ - errno = ENOENT; - goto err; - } - sp = &sfsp[i]; - if (strcmp(sp->f_fstypename, "autofs")) { - errno = ENOTTY; - goto err; - } - fd = open(sp->f_mntonname, O_RDONLY); - if (fd == -1) - goto err; - ret = malloc(sizeof(*ret)); - if (ret == NULL) - goto err; - - ret->ah_fsid = sp->f_fsid; - ret->ah_fd = fd; - strlcpy(ret->ah_mp, sp->f_mntonname, sizeof(ret->ah_mp)); - safe_free(sfsp); - *ahp = ret; - return (0); -err: - safe_free(ret); - safe_free(sfsp); - return (-1); -} - -/* release. */ -void -autoh_free(autoh_t ah) -{ - int saved_errno; - - saved_errno = errno; - close(ah->ah_fd); - free(ah); - errno = saved_errno; -} - -/* - * Get an array of pointers to all the currently mounted autofs - * instances. - */ -int -autoh_getall(autoh_t **arrayp, int *cntp) -{ - struct statfs *sfsp; - int cnt, i, pos; - autoh_t *array; - - array = NULL; - /* - * We use getfsstat to prevent avoid the lookups on the mountpoints - * that statfs(2) would do. - */ - if (getmntlst(&sfsp, &cnt)) - goto err; - array = *arrayp = calloc(cnt + 1, sizeof(**arrayp)); - if (array == NULL) - goto err; - for (i = 0, pos = 0; i < cnt; i++) { - if (autoh_get(sfsp[i].f_mntonname, &array[pos]) == -1) { - /* not an autofs entry, that's ok, otherwise bail */ - if (errno == ENOTTY) - continue; - goto err; - } - pos++; - } - if (pos == 0) { - errno = ENOENT; - goto err; - } - *arrayp = array; - *cntp = pos; - safe_free(sfsp); - return (0); -err: - safe_free(sfsp); - if (array) - autoh_freeall(array); - return (-1); -} - -/* release. */ -void -autoh_freeall(autoh_t *ah) -{ - autoh_t *ahp; - - ahp = ah; - - while (*ahp != NULL) { - autoh_free(*ahp); - ahp++; - } - safe_free(ah); -} - -/* return fd to select on. */ -int -autoh_fd(autoh_t ah) -{ - - return (ah->ah_fd); -} - -const char * -autoh_mp(autoh_t ah) -{ - - return (ah->ah_mp); -} - -static int do_autoreq_get(autoh_t ah, autoreq_t *reqp, int *cntp); - -/* get an array of pending requests */ -int -autoreq_get(autoh_t ah, autoreq_t **reqpp, int *cntp) -{ - int cnt, i; - autoreq_t req, *reqp; - - if (do_autoreq_get(ah, &req, &cnt)) - return (-1); - - reqp = calloc(cnt + 1, sizeof(*reqp)); - if (reqp == NULL) { - safe_free(req); - return (-1); - } - for (i = 0; i < cnt; i++) - reqp[i] = &req[i]; - *reqpp = reqp; - *cntp = cnt; - return (0); -} - -int -do_autoreq_get(autoh_t ah, autoreq_t *reqp, int *cntp) -{ - size_t olen; - struct autofs_userreq *reqs; - int cnt, error; - int vers; - - vers = AUTOFS_PROTOVERS; - - error = 0; - reqs = NULL; - olen = 0; - cnt = 0; - error = autofs_sysctl(AUTOFS_CTL_GETREQS, &ah->ah_fsid, NULL, &olen, - &vers, sizeof(vers)); - if (error == -1) - goto out; - if (olen == 0) - goto out; - - reqs = malloc(olen); - if (reqs == NULL) - goto out; - error = autofs_sysctl(AUTOFS_CTL_GETREQS, &ah->ah_fsid, reqs, &olen, - &vers, sizeof(vers)); - if (error == -1) - goto out; -out: - if (error) { - safe_free(reqs); - return (-1); - } - cnt = olen / sizeof(*reqs); - *cntp = cnt; - *reqp = reqs; - return (0); -} - -/* free an array of requests */ -void -autoreq_free(autoh_t ah __unused, autoreq_t *req) -{ - - free(*req); - free(req); -} - -/* serve a request */ -int -autoreq_serv(autoh_t ah, autoreq_t req) -{ - int error; - - error = autofs_sysctl(AUTOFS_CTL_SERVREQ, &ah->ah_fsid, NULL, NULL, - req, sizeof(*req)); - return (error); -} - -enum autoreq_op -autoreq_getop(autoreq_t req) -{ - - switch (req->au_op) { - case AREQ_LOOKUP: - return (AUTOREQ_OP_LOOKUP); - case AREQ_STAT: - return (AUTOREQ_OP_STAT); - case AREQ_READDIR: - return (AUTOREQ_OP_READDIR); - default: - return (AUTOREQ_OP_UNKNOWN); - } -} - -/* get a request's file name. */ -const char * -autoreq_getpath(autoreq_t req) -{ - - return (req->au_name); -} - -/* get a request's inode. a indirect mount may return AUTO_INODE_NONE. */ -autoino_t -autoreq_getino(autoreq_t req) -{ - - return (req->au_ino); -} - -void -autoreq_setino(autoreq_t req, autoino_t ino) -{ - - req->au_ino = ino; -} - -/* get a request's directory inode. */ -autoino_t -autoreq_getdirino(autoreq_t req) -{ - - return (req->au_dino); -} - -void -autoreq_seterrno(autoreq_t req, int error) -{ - - req->au_errno = error; -} - -void -autoreq_setaux(autoreq_t req, void *auxdata, size_t auxlen) -{ - - req->au_auxdata = auxdata; - req->au_auxlen = auxlen; -} - -void -autoreq_getaux(autoreq_t req, void **auxdatap, size_t *auxlenp) -{ - - *auxdatap = req->au_auxdata; - *auxlenp = req->au_auxlen; -} - -void -autoreq_seteof(autoreq_t req, int eof) -{ - - req->au_eofflag = eof; -} - -void -autoreq_getoffset(autoreq_t req, off_t *offp) -{ - - *offp = req->au_offset - AUTOFS_USEROFF; -} - -void -autoreq_getxid(autoreq_t req, int *xid) -{ - - *xid = req->au_xid; -} - -/* toggle by path. args = handle, AUTO_?, pid (-1 to disable), path. */ -int -autoh_togglepath(autoh_t ah, int op, pid_t pid, const char *path) -{ - int fd, ret; - - fd = open(path, O_RDONLY); - if (fd == -1) - return (-1); - ret = autoh_togglefd(ah, op, pid, fd); - close(fd); - return (ret); -} - -/* toggle by fd. args = handle, AUTO_?, pid (-1 to disable), fd. */ -int -autoh_togglefd(autoh_t ah, int op, pid_t pid, int fd) -{ - struct stat sb; - struct autofs_mounterreq mr; - int error, realop; - - switch (op) { - case AUTO_DIRECT: - realop = AUTOFS_CTL_TRIGGER; - break; - case AUTO_INDIRECT: - realop = AUTOFS_CTL_SUBTRIGGER; - break; - case AUTO_MOUNTER: - realop = AUTOFS_CTL_MOUNTER; - break; - case AUTO_BROWSE: - realop = AUTOFS_CTL_BROWSE; - break; - default: - errno = ENOTTY; - return (-1); - } - - if (fstat(fd, &sb)) - return (-1); - bzero(&mr, sizeof(mr)); - mr.amu_ino = sb.st_ino; - mr.amu_pid = pid; - error = autofs_sysctl(realop, &ah->ah_fsid, NULL, NULL, - &mr, sizeof(mr)); - return (error); -} - -int -autofs_sysctl(op, fsid, oldp, oldlenp, newp, newlen) - int op; - fsid_t *fsid; - void *oldp; - size_t *oldlenp; - void *newp; - size_t newlen; -{ - struct vfsidctl vc; - - bzero(&vc, sizeof(vc)); - vc.vc_op = op; - strcpy(vc.vc_fstypename, "*"); - vc.vc_vers = VFS_CTL_VERS1; - vc.vc_fsid = *fsid; - vc.vc_ptr = newp; - vc.vc_len = newlen; - return (sysctlbyname("vfs.autofs.ctl", oldp, oldlenp, &vc, sizeof(vc))); -} - diff --git a/lib/libautofs/libautofs.h b/lib/libautofs/libautofs.h deleted file mode 100644 index f391bad..0000000 --- a/lib/libautofs/libautofs.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - * $Id: libautofs.h,v 1.4 2004/09/08 08:12:21 bright Exp $ - */ -#ifndef _LIBAUTOFS_H -#define _LIBAUTOFS_H - -struct auto_handle; -typedef struct auto_handle * autoh_t; -struct autofs_userreq; -typedef struct autofs_userreq * autoreq_t; -typedef uint64_t autoino_t; - -#define AUTO_INODE_NONE 0 - -#define AUTO_DIRECT 1 -#define AUTO_INDIRECT 2 -#define AUTO_MOUNTER 3 -#define AUTO_BROWSE 4 - -enum autoreq_op { - AUTOREQ_OP_UNKNOWN = 0, - AUTOREQ_OP_LOOKUP, - AUTOREQ_OP_STAT, - AUTOREQ_OP_READDIR -}; - -/* get a handle based on a path. */ -int autoh_get(const char *, autoh_t *); -/* release. */ -void autoh_free(autoh_t); - -/* - * Get an array of pointers to handles for all autofs mounts, returns count - * or -1 - */ -int autoh_getall(autoh_t **, int *cnt); -/* free the array of pointers */ -void autoh_freeall(autoh_t *); - -/* return fd to select on. */ -int autoh_fd(autoh_t); - -/* returns the mount point of the autofs instance. */ -const char *autoh_mp(autoh_t); - -/* get an array of pending requests */ -int autoreq_get(autoh_t, autoreq_t **, int *); -/* free an array of requests */ -void autoreq_free(autoh_t, autoreq_t *); -/* serve a request */ -int autoreq_serv(autoh_t, autoreq_t); - -/* get the operation requested */ -enum autoreq_op autoreq_getop(autoreq_t); - -/* get a request's file name. */ -const char *autoreq_getpath(autoreq_t); -/* get a request's inode. a indirect mount may return AUTO_INODE_NONE. */ -autoino_t autoreq_getino(autoreq_t); -/* - * set a request's inode. an indirect mount may return AUTO_INODE_NONE, - * this is a fixup for indirect mounts. - */ -void autoreq_setino(autoreq_t, autoino_t); -/* get a request's directory inode. */ -autoino_t autoreq_getdirino(autoreq_t); -void autoreq_seterrno(autoreq_t, int); -void autoreq_setaux(autoreq_t, void *, size_t); -void autoreq_getaux(autoreq_t, void **, size_t *); -void autoreq_seteof(autoreq_t, int); -void autoreq_getoffset(autoreq_t, off_t *); -void autoreq_getxid(autoreq_t, int *); - -/* toggle by path. args = handle, AUTO_?, pid (-1 to disable), path. */ -int autoh_togglepath(autoh_t, int, pid_t, const char *); -/* toggle by fd. args = handle, AUTO_?, pid (-1 to disable), fd. */ -int autoh_togglefd(autoh_t, int, pid_t, int); - -#endif diff --git a/sbin/mount_autofs/Makefile b/sbin/mount_autofs/Makefile deleted file mode 100644 index b05d961..0000000 --- a/sbin/mount_autofs/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $Id: Makefile,v 1.6 2004/09/08 08:27:12 bright Exp $ -# $FreeBSD$ - -PROG=mount_autofs -MAN=mount_autofs.8 -BINDIR?=/sbin -WARNS?= 2 - -.include <bsd.prog.mk> diff --git a/sbin/mount_autofs/mount_autofs.8 b/sbin/mount_autofs/mount_autofs.8 deleted file mode 100644 index 5f10ea7..0000000 --- a/sbin/mount_autofs/mount_autofs.8 +++ /dev/null @@ -1,71 +0,0 @@ -.\" Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: mount_autofs.8,v 1.3 2004/09/08 08:12:21 bright Exp $ -.\" $FreeBSD$ -.Dd August 30, 2004 -.Dt MOUNT_AUTOFS 8 -.Os -.Sh NAME -.Nm mount_autofs -.Nd mount an autofs file system -.Sh SYNOPSIS -.Nm -.Op Fl o Ar options -.Ar dummy -.Ar node -.Sh DESCRIPTION -The -.Nm -utility attaches an autofs file system -device on to the file system tree at the point -.Ar node . -.Pp -This command is normally executed by -.Xr mount 8 -at boot time. -.Pp -The options are as follows: -.Bl -tag -width indent -.It Fl o -Options are specified with a -.Fl o -flag followed by a comma separated string of options. -See the -.Xr mount 8 -man page for possible options and their meanings. -.El -.Sh SEE ALSO -.Xr mount 2 , -.Xr unmount 2 , -.Xr fstab 5 , -.Xr mount 8 -.Sh HISTORY -The -.Nm -utility first appeared in -.Fx 6.0 . -.Sh AUTHORS -This manual page and the autofs file system suite were written by -.An Alfred Perlstein . diff --git a/sbin/mount_autofs/mount_autofs.c b/sbin/mount_autofs/mount_autofs.c deleted file mode 100644 index 17fbb5b..0000000 --- a/sbin/mount_autofs/mount_autofs.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: mount_autofs.c,v 1.5 2004/09/08 08:12:21 bright Exp $ - * $FreeBSD$ - */ -#include <err.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <sys/param.h> -#include <sys/mount.h> -#include <sys/uio.h> - -void usage(void); - -const char *progname; - -void -usage(void) { - - errx(1, "usage: %s node", progname); -} -int mymount(const char *type, const char *dir, int flags, void *data); - -#if __FreeBSD_version < 600000 -int -mymount(const char *type, const char *dir, int flags, void *data) -{ - - return (mount(type, dir, flags, data)); -} -#else -void ioset(struct iovec *iovp, const char *str); - -void -ioset(struct iovec *iovp, const char *str) -{ - - iovp->iov_base = __DECONST(char *, str); - iovp->iov_len = strlen(str) + 1; -} - -int -mymount( - const char *type, - const char *dir, - int flags __unused, - void *data __unused -) -{ - struct iovec iov[4], *iovp; - - iovp = &iov[0]; - ioset(iovp++, "fstype"); - ioset(iovp++, type); - ioset(iovp++, "fspath"); - ioset(iovp++, dir); - return (nmount(iov, 4, 0)); -} -#endif - -int -main(int argc, char **argv) -{ - int error; - int ch; - - progname = argv[0]; - - while ((ch = getopt(argc, argv, "o:")) != -1) { - /* just eat opts for now */ - switch (ch) { - case '?': - usage(); - } - } - argc -= optind; - argv += optind; - - if (argc < 2) { - usage(); - } - - error = mymount("autofs", argv[1], 0, NULL); - if (error) - perror("mount"); - return (error == 0 ? EXIT_SUCCESS : EXIT_FAILURE); -} |