138494Sobrien/* 2310490Scy * Copyright (c) 1997-2014 Erez Zadok 338494Sobrien * Copyright (c) 1990 Jan-Simon Pendry 438494Sobrien * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 538494Sobrien * Copyright (c) 1990 The Regents of the University of California. 638494Sobrien * All rights reserved. 738494Sobrien * 838494Sobrien * This code is derived from software contributed to Berkeley by 938494Sobrien * Jan-Simon Pendry at Imperial College, London. 1038494Sobrien * 1138494Sobrien * Redistribution and use in source and binary forms, with or without 1238494Sobrien * modification, are permitted provided that the following conditions 1338494Sobrien * are met: 1438494Sobrien * 1. Redistributions of source code must retain the above copyright 1538494Sobrien * notice, this list of conditions and the following disclaimer. 1638494Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1738494Sobrien * notice, this list of conditions and the following disclaimer in the 1838494Sobrien * documentation and/or other materials provided with the distribution. 19310490Scy * 3. Neither the name of the University nor the names of its contributors 2038494Sobrien * may be used to endorse or promote products derived from this software 2138494Sobrien * without specific prior written permission. 2238494Sobrien * 2338494Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2438494Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2538494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2638494Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2738494Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2838494Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2938494Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3038494Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3138494Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3238494Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3338494Sobrien * SUCH DAMAGE. 3438494Sobrien * 3538494Sobrien * 36174294Sobrien * File: am-utils/amd/amd.h 3738494Sobrien * 3838494Sobrien */ 3938494Sobrien 4038494Sobrien#ifndef _AMD_H 4138494Sobrien#define _AMD_H 4238494Sobrien 4338494Sobrien 4438494Sobrien/* 4538494Sobrien * MACROS: 4638494Sobrien */ 4738494Sobrien 48174294Sobrien/* 49174294Sobrien * Define a default debug mtab path for systems 50174294Sobrien * that support mtab on file. 51174294Sobrien */ 52174294Sobrien#ifdef MOUNT_TABLE_ON_FILE 53310490Scy# define DEBUG_MNTTAB_FILE "/tmp/mtab" 54174294Sobrien#endif /* MOUNT_TABLE_ON_FILE */ 55174294Sobrien 56310490Scy/* Max line length that info services can handle */ 57310490Scy#define INFO_MAX_LINE_LEN 1500 58310490Scy 5938494Sobrien/* options for amd.conf */ 60174294Sobrien#define CFM_BROWSABLE_DIRS 0x00000001 61174294Sobrien#define CFM_MOUNT_TYPE_AUTOFS 0x00000002 /* use kernel autofs support */ 62174294Sobrien#define CFM_SELECTORS_IN_DEFAULTS 0x00000004 63174294Sobrien#define CFM_NORMALIZE_HOSTNAMES 0x00000008 64174294Sobrien#define CFM_PROCESS_LOCK 0x00000010 65174294Sobrien#define CFM_PRINT_PID 0x00000020 66174294Sobrien#define CFM_RESTART_EXISTING_MOUNTS 0x00000040 67174294Sobrien#define CFM_SHOW_STATFS_ENTRIES 0x00000080 68174294Sobrien#define CFM_FULLY_QUALIFIED_HOSTS 0x00000100 69174294Sobrien#define CFM_BROWSABLE_DIRS_FULL 0x00000200 /* allow '/' in readdir() */ 70174294Sobrien#define CFM_UNMOUNT_ON_EXIT 0x00000400 /* when amd finishing */ 71174294Sobrien#define CFM_USE_TCPWRAPPERS 0x00000800 72174294Sobrien#define CFM_AUTOFS_USE_LOFS 0x00001000 73174294Sobrien#define CFM_NFS_INSECURE_PORT 0x00002000 74174294Sobrien#define CFM_DOMAIN_STRIP 0x00004000 75174294Sobrien#define CFM_NORMALIZE_SLASHES 0x00008000 /* normalize slashes? */ 76174294Sobrien#define CFM_FORCED_UNMOUNTS 0x00010000 /* forced unmounts? */ 77174294Sobrien#define CFM_TRUNCATE_LOG 0x00020000 /* truncate log file? */ 78174294Sobrien#define CFM_SUN_MAP_SYNTAX 0x00040000 /* Sun map syntax? */ 79174294Sobrien#define CFM_NFS_ANY_INTERFACE 0x00080000 /* all interfaces are acceptable */ 8038494Sobrien 81174294Sobrien/* defaults global flags: plock, tcpwrappers, and autofs/lofs */ 82174294Sobrien#define CFM_DEFAULT_FLAGS (CFM_PROCESS_LOCK|CFM_USE_TCPWRAPPERS|CFM_AUTOFS_USE_LOFS|CFM_DOMAIN_STRIP|CFM_NORMALIZE_SLASHES) 83174294Sobrien 84174294Sobrien/* 85174294Sobrien * macro definitions for automounter vfs/vnode operations. 86174294Sobrien */ 87174294Sobrien#define VLOOK_CREATE 0x1 88174294Sobrien#define VLOOK_DELETE 0x2 89174294Sobrien#define VLOOK_LOOKUP 0x3 90174294Sobrien 91174294Sobrien/* 92174294Sobrien * macro definitions for automounter vfs capabilities 93174294Sobrien */ 94174294Sobrien#define FS_DIRECTORY 0x0001 /* This looks like a dir, not a link */ 95174294Sobrien#define FS_MBACKGROUND 0x0002 /* Should background this mount */ 96174294Sobrien#define FS_NOTIMEOUT 0x0004 /* Don't bother with timeouts */ 97174294Sobrien#define FS_MKMNT 0x0008 /* Need to make the mount point */ 98174294Sobrien#define FS_UBACKGROUND 0x0010 /* Unmount in background */ 99174294Sobrien#define FS_BACKGROUND (FS_MBACKGROUND|FS_UBACKGROUND) 100174294Sobrien#define FS_DISCARD 0x0020 /* Discard immediately on last reference */ 101174294Sobrien#define FS_AMQINFO 0x0040 /* Amq is interested in this fs type */ 102174294Sobrien#define FS_AUTOFS 0x0080 /* This filesystem can be an autofs f/s */ 103174294Sobrien#define FS_DIRECT 0x0100 /* Direct mount */ 104174294Sobrien#define FS_ON_AUTOFS 0x0200 /* This filesystem can be mounted directly 105174294Sobrien onto an autofs mountpoint */ 106174294Sobrien 107174294Sobrien/* 108174294Sobrien * macros for struct am_node (map of auto-mount points). 109174294Sobrien */ 110174294Sobrien#define AMF_NOTIMEOUT 0x0001 /* This node never times out */ 111174294Sobrien#define AMF_ROOT 0x0002 /* This is a root node */ 112174294Sobrien#define AMF_AUTOFS 0x0004 /* This node is part of an autofs filesystem */ 113174294Sobrien#define AMF_REMOUNT 0x0008 /* This node needs to be remounted */ 114174294Sobrien#define AMF_SOFTLOOKUP 0x0010 /* This node returns EIO if server is down */ 115174294Sobrien 116174294Sobrien/* 117174294Sobrien * macros for struct mntfs (list of mounted filesystems) 118174294Sobrien */ 119174294Sobrien#define MFF_MOUNTED 0x0001 /* Node is mounted */ 120174294Sobrien#define MFF_MOUNTING 0x0002 /* Mount is in progress */ 121174294Sobrien#define MFF_UNMOUNTING 0x0004 /* Unmount is in progress */ 122174294Sobrien#define MFF_RESTART 0x0008 /* Restarted node */ 123174294Sobrien#define MFF_MKMNT 0x0010 /* Delete this node's am_mount */ 124174294Sobrien#define MFF_ERROR 0x0020 /* This node failed to mount */ 125174294Sobrien#define MFF_LOGDOWN 0x0040 /* Logged that this mount is down */ 126174294Sobrien#define MFF_RSTKEEP 0x0080 /* Don't timeout this filesystem - restarted */ 127174294Sobrien#define MFF_WANTTIMO 0x0100 /* Need a timeout call when not busy */ 128174294Sobrien#define MFF_NFSLINK 0x0200 /* nfsl type, and deemed a link */ 129174294Sobrien#define MFF_IS_AUTOFS 0x0400 /* this filesystem is of type autofs */ 130174294Sobrien#define MFF_NFS_SCALEDOWN 0x0800 /* the mount failed, retry with v2/UDP */ 131174294Sobrien#define MFF_ON_AUTOFS 0x1000 /* autofs has a lofs/link to this f/s */ 132174294Sobrien#define MFF_WEBNFS 0x2000 /* use public filehandle */ 133174294Sobrien 134174294Sobrien/* 135174294Sobrien * macros for struct fserver. 136174294Sobrien */ 137174294Sobrien#define FSF_VALID 0x0001 /* Valid information available */ 138174294Sobrien#define FSF_DOWN 0x0002 /* This fileserver is thought to be down */ 139174294Sobrien#define FSF_ERROR 0x0004 /* Permanent error has occurred */ 140174294Sobrien#define FSF_WANT 0x0008 /* Want a wakeup call */ 141174294Sobrien#define FSF_PINGING 0x0010 /* Already doing pings */ 142174294Sobrien#define FSF_WEBNFS 0x0020 /* Don't try to contact portmapper */ 143174294Sobrien#define FSF_PING_UNINIT 0x0040 /* ping values have not been initilized */ 144174294Sobrien#define FSF_FORCE_UNMOUNT 0x0080 /* force umount of this fserver */ 145174294Sobrien#define FSRV_ERROR(fs) ((fs) && (((fs)->fs_flags & FSF_ERROR) == FSF_ERROR)) 146174294Sobrien#define FSRV_ISDOWN(fs) ((fs) && (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_DOWN|FSF_VALID))) 147174294Sobrien#define FSRV_ISUP(fs) (!(fs) || (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_VALID))) 148174294Sobrien 14938494Sobrien/* some systems (SunOS 4.x) neglect to define the mount null message */ 15038494Sobrien#ifndef MOUNTPROC_NULL 15138494Sobrien# define MOUNTPROC_NULL ((u_long)(0)) 15238494Sobrien#endif /* not MOUNTPROC_NULL */ 15338494Sobrien 154174294Sobrien/* 155174294Sobrien * Error to return if remote host is not available. 156174294Sobrien * Try, in order, "host down", "host unreachable", "invalid argument". 157174294Sobrien */ 158174294Sobrien#ifdef EHOSTDOWN 159174294Sobrien# define AM_ERRNO_HOST_DOWN EHOSTDOWN 160174294Sobrien#else /* not EHOSTDOWN */ 161174294Sobrien# ifdef EHOSTUNREACH 162174294Sobrien# define AM_ERRNO_HOST_DOWN EHOSTUNREACH 163174294Sobrien# else /* not EHOSTUNREACH */ 164174294Sobrien# define AM_ERRNO_HOST_DOWN EINVAL 165174294Sobrien# endif /* not EHOSTUNREACH */ 166174294Sobrien#endif /* not EHOSTDOWN */ 167174294Sobrien 16838494Sobrien/* Hash table size */ 16938494Sobrien#define NKVHASH (1 << 2) /* Power of two */ 17038494Sobrien 171174294Sobrien/* Max entries to return in one call */ 172174294Sobrien#define MAX_READDIR_ENTRIES 16 173174294Sobrien 174174294Sobrien/* 175174294Sobrien * default amfs_auto retrans - 1/10th seconds 176174294Sobrien */ 177174294Sobrien#define AMFS_AUTO_RETRANS(x) ((ALLOWED_MOUNT_TIME*10+5*gopt.amfs_auto_timeo[(x)])/gopt.amfs_auto_timeo[(x)] * 2) 178174294Sobrien 179174294Sobrien/* 180174294Sobrien * The following values can be tuned... 181174294Sobrien */ 182174294Sobrien#define AM_TTL (300) /* Default cache period (5 min) */ 183174294Sobrien#define AM_TTL_W (120) /* Default unmount interval (2 min) */ 184174294Sobrien#define AM_PINGER 30 /* NFS ping interval for live systems */ 185174294Sobrien#define AMFS_AUTO_TIMEO 8 /* Default amfs_auto timeout - .8s */ 186174294Sobrien#define AMFS_EXEC_MAP_TIMEOUT 10 /* default 10sec exec map timeout */ 187174294Sobrien 18838494Sobrien/* interval between forced retries of a mount */ 18938494Sobrien#define RETRY_INTERVAL 2 19038494Sobrien 191174294Sobrien#ifndef ROOT_MAP 192174294Sobrien# define ROOT_MAP "\"root\"" 193174294Sobrien#endif /* not ROOT_MAP */ 19438494Sobrien 195174294Sobrien#define ereturn(x) do { *error_return = x; return 0; } while (0) 19638494Sobrien 197174294Sobrien#define NEVER (time_t) 0 198174294Sobrien 199174294Sobrien#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) 200174294Sobrien# define AMD_SERVICE_NAME "amd" /* for tcpwrappers */ 201174294Sobrien#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */ 202174294Sobrien 20338494Sobrien/* 20438494Sobrien * TYPEDEFS: 20538494Sobrien */ 20638494Sobrien 20738494Sobrientypedef struct cf_map cf_map_t; 20838494Sobrientypedef struct kv kv; 209174294Sobrientypedef struct am_node am_node; 210174294Sobrientypedef struct mntfs mntfs; 211310490Scytypedef struct am_loc am_loc; 212174294Sobrientypedef struct am_opts am_opts; 213174294Sobrientypedef struct am_ops am_ops; 214174294Sobrientypedef struct am_stats am_stats; 215174294Sobrientypedef struct fserver fserver; 216174294Sobrien 217174294Sobrientypedef voidp wchan_t; 218174294Sobrientypedef voidp opaque_t; 219174294Sobrien 22038494Sobrien/* 22138494Sobrien * Cache map operations 22238494Sobrien */ 22338494Sobrientypedef void add_fn(mnt_map *, char *, char *); 22438494Sobrientypedef int init_fn(mnt_map *, char *, time_t *); 22538494Sobrientypedef int mtime_fn(mnt_map *, char *, time_t *); 22638494Sobrientypedef int isup_fn(mnt_map *, char *); 22738494Sobrientypedef int reload_fn(mnt_map *, char *, add_fn *); 22838494Sobrientypedef int search_fn(mnt_map *, char *, char *, char **, time_t *); 229174294Sobrientypedef int task_fun(opaque_t); 230174294Sobrientypedef void cb_fun(int, int, opaque_t); 231174294Sobrientypedef void fwd_fun(voidp, int, struct sockaddr_in *, 232174294Sobrien struct sockaddr_in *, opaque_t, int); 233174294Sobrientypedef int key_fun(char *, opaque_t); 234174294Sobrientypedef void callout_fun(opaque_t); 23538494Sobrien 236174294Sobrien/* 237174294Sobrien * automounter vfs/vnode operations. 238174294Sobrien */ 239174294Sobrientypedef char *(*vfs_match) (am_opts *); 240174294Sobrientypedef int (*vfs_init) (mntfs *); 241174294Sobrientypedef int (*vmount_fs) (am_node *, mntfs *); 242174294Sobrientypedef int (*vumount_fs) (am_node *, mntfs *); 243174294Sobrientypedef am_node *(*vlookup_child) (am_node *, char *, int *, int); 244174294Sobrientypedef am_node *(*vmount_child) (am_node *, int *); 245310490Scytypedef int (*vreaddir) (am_node *, voidp, voidp, voidp, u_int); 246174294Sobrientypedef am_node *(*vreadlink) (am_node *, int *); 247174294Sobrientypedef void (*vmounted) (mntfs *); 248174294Sobrientypedef void (*vumounted) (mntfs *); 249174294Sobrientypedef fserver *(*vffserver) (mntfs *); 250174294Sobrientypedef wchan_t (*vget_wchan) (mntfs *); 25138494Sobrien 252310490Scy/* 253310490Scy * NFS progran dispatcher 254310490Scy */ 255310490Scytypedef void (*dispatcher_t)(struct svc_req *rqstp, SVCXPRT *transp); 25638494Sobrien 257174294Sobrien 25838494Sobrien/* 25938494Sobrien * STRUCTURES: 26038494Sobrien */ 26138494Sobrien 26238494Sobrien/* global amd options that are manipulated by conf.c */ 26338494Sobrienstruct amu_global_options { 26438494Sobrien char *arch; /* name of current architecture */ 26538494Sobrien char *auto_dir; /* automounter temp dir */ 266174294Sobrien int auto_attrcache; /* attribute cache timeout for auto dirs */ 26738494Sobrien char *cluster; /* cluster name */ 26838494Sobrien char *karch; /* kernel architecture */ 26938494Sobrien char *logfile; /* amd log file */ 27052894Sobrien char *op_sys; /* operating system name ${os} */ 27152894Sobrien char *op_sys_ver; /* OS version ${osver} */ 27252894Sobrien char *op_sys_full; /* full OS name ${full_os} */ 27352894Sobrien char *op_sys_vendor; /* name of OS vendor ${vendor} */ 27438494Sobrien char *pid_file; /* PID file */ 27538494Sobrien char *sub_domain; /* local domain */ 276174294Sobrien char *localhost_address; /* localhost address (NULL means use 127.0.0.1) */ 277174294Sobrien char *map_defaults; /* global map /default options */ 27838494Sobrien char *map_options; /* global map options */ 279174294Sobrien int map_reload_interval; /* map reload interval */ 28038494Sobrien char *map_type; /* global map type */ 28138494Sobrien char *search_path; /* search path for maps */ 28238494Sobrien char *mount_type; /* mount type for map */ 283174294Sobrien char *debug_mtab_file; /* path for the mtab file during debug mode */ 28438494Sobrien u_int flags; /* various CFM_* flags */ 285174294Sobrien 286174294Sobrien#define AMU_TYPE_NONE -1 /* for amfs_auto_{timeo,retrans,toplvl} */ 287174294Sobrien#define AMU_TYPE_UDP 0 /* for amfs_auto_{timeo,retrans,toplvl} */ 288174294Sobrien#define AMU_TYPE_TCP 1 /* for amfs_auto_{timeo,retrans,toplvl} */ 289174294Sobrien /* 290174294Sobrien * Note: toplvl is only UDP, but we want to separate it from regular 291174294Sobrien * NFS mounts which Amd makes, because the toplvl mount is a localhost 292174294Sobrien * mount for which different timeo/retrans parameters may be desired. 293174294Sobrien */ 294174294Sobrien#define AMU_TYPE_TOPLVL 2 /* for amfs_auto_{timeo,retrans,toplvl} */ 295174294Sobrien#define AMU_TYPE_MAX 3 /* for amfs_auto_{timeo,retrans,toplvl} */ 296174294Sobrien int amfs_auto_retrans[AMU_TYPE_MAX]; /* NFS retransmit counter */ 297174294Sobrien int amfs_auto_timeo[AMU_TYPE_MAX]; /* NFS retry interval */ 298174294Sobrien 29938494Sobrien int am_timeo; /* cache duration */ 30038494Sobrien int am_timeo_w; /* dismount interval */ 301174294Sobrien u_long portmap_program; /* amd RPC program number */ 302174294Sobrien u_short preferred_amq_port; /* preferred amq service RPC port number (0 means "any") */ 30338494Sobrien#ifdef HAVE_MAP_HESIOD 30438494Sobrien char *hesiod_base; /* Hesiod rhs */ 30538494Sobrien#endif /* HAVE_MAP_HESIOD */ 30638494Sobrien#ifdef HAVE_MAP_LDAP 30738494Sobrien char *ldap_base; /* LDAP base */ 30838494Sobrien char *ldap_hostports; /* LDAP host ports */ 30938494Sobrien long ldap_cache_seconds; /* LDAP internal cache - keep seconds */ 31038494Sobrien long ldap_cache_maxmem; /* LDAP internal cache - max memory (bytes) */ 311174294Sobrien long ldap_proto_version; /* LDAP protocol version */ 31238494Sobrien#endif /* HAVE_MAP_LDAP */ 31338494Sobrien#ifdef HAVE_MAP_NIS 31438494Sobrien char *nis_domain; /* YP domain name */ 31538494Sobrien#endif /* HAVE_MAP_NIS */ 31682794Sobrien char *nfs_proto; /* NFS protocol (NULL, udp, tcp) */ 31782794Sobrien int nfs_vers; /* NFS version (0, 2, 3, 4) */ 318310490Scy int nfs_vers_ping; /* NFS rpc ping version (0, 2, 3, 4) */ 319174294Sobrien u_int exec_map_timeout; /* timeout (seconds) for executable maps */ 32038494Sobrien}; 32138494Sobrien 32238494Sobrien/* if you add anything here, update conf.c:reset_cf_map() */ 32338494Sobrienstruct cf_map { 32438494Sobrien char *cfm_dir; /* /home, /u, /src */ 32538494Sobrien char *cfm_name; /* amd.home, /etc/amd.home ... */ 32638494Sobrien char *cfm_type; /* file, hesiod, ndbm, nis ... */ 327174294Sobrien char *cfm_defaults; /* map /defaults options in amd.conf */ 32838494Sobrien char *cfm_opts; /* -cache:=all, etc. */ 32938494Sobrien char *cfm_search_path; /* /etc/local:/etc/amdmaps:/misc/yp */ 33038494Sobrien char *cfm_tag; /* optional map tag for amd -T */ 33138494Sobrien u_int cfm_flags; /* browsable_dirs? mount_type? */ 332174294Sobrien struct cf_map *cfm_next; /* pointer to next in list (if any) */ 33338494Sobrien}; 33438494Sobrien 33538494Sobrien/* 33638494Sobrien * Key-value pair 33738494Sobrien */ 33838494Sobrienstruct kv { 33938494Sobrien kv *next; 34038494Sobrien char *key; 34138494Sobrien#ifdef HAVE_REGEXEC 34238494Sobrien regex_t re; /* store the regexp from regcomp() */ 34338494Sobrien#endif /* HAVE_REGEXEC */ 34438494Sobrien char *val; 34538494Sobrien}; 34638494Sobrien 34738494Sobrienstruct mnt_map { 34838494Sobrien qelem hdr; 34938494Sobrien int refc; /* Reference count */ 35038494Sobrien short flags; /* Allocation flags */ 35138494Sobrien short alloc; /* Allocation mode */ 35238494Sobrien time_t modify; /* Modify time of map */ 35352894Sobrien u_int reloads; /* Number of times map was reloaded */ 354310490Scy u_int nentries; /* Number of entries in the map */ 35538494Sobrien char *map_name; /* Name of this map */ 35638494Sobrien char *wildcard; /* Wildcard value */ 35738494Sobrien reload_fn *reload; /* Function to be used for reloads */ 35838494Sobrien isup_fn *isup; /* Is service up or not? (1=up, 0=down) */ 35938494Sobrien search_fn *search; /* Function to be used for searching */ 36038494Sobrien mtime_fn *mtime; /* Modify time function */ 36138494Sobrien kv *kvhash[NKVHASH]; /* Cached data */ 362174294Sobrien cf_map_t *cfm; /* pointer to per-map amd.conf opts, if any */ 36338494Sobrien void *map_data; /* Map data black box */ 36438494Sobrien}; 36538494Sobrien 36638494Sobrien/* 367174294Sobrien * Options 36838494Sobrien */ 369174294Sobrienstruct am_opts { 370174294Sobrien char *fs_glob; /* Smashed copy of global options */ 371174294Sobrien char *fs_local; /* Expanded copy of local options */ 372174294Sobrien char *fs_mtab; /* Mount table entry */ 373174294Sobrien /* Other options ... */ 374174294Sobrien char *opt_dev; 375174294Sobrien char *opt_delay; 376174294Sobrien char *opt_dir; 377174294Sobrien char *opt_fs; 378174294Sobrien char *opt_group; 379174294Sobrien char *opt_mount; 380174294Sobrien char *opt_opts; 381174294Sobrien char *opt_remopts; 382174294Sobrien char *opt_pref; 383174294Sobrien char *opt_cache; 384174294Sobrien char *opt_rfs; 385174294Sobrien char *opt_rhost; 386174294Sobrien char *opt_sublink; 387174294Sobrien char *opt_type; 388174294Sobrien char *opt_mount_type; /* "nfs" or "autofs" */ 389174294Sobrien char *opt_unmount; 390174294Sobrien char *opt_umount; /* an "alias" for opt_unmount (type:=program) */ 391174294Sobrien char *opt_user; 392174294Sobrien char *opt_maptype; /* map type: file, nis, hesiod, etc. */ 393174294Sobrien char *opt_cachedir; /* cache directory */ 394174294Sobrien char *opt_addopts; /* options to add to opt_opts */ 39538494Sobrien}; 39638494Sobrien 397174294Sobrienstruct am_ops { 398174294Sobrien char *fs_type; /* type of filesystems e.g. "nfsx" */ 399174294Sobrien vfs_match fs_match; /* fxn: match */ 400174294Sobrien vfs_init fs_init; /* fxn: initialization */ 401174294Sobrien vmount_fs mount_fs; /* fxn: mount my own vnode */ 402174294Sobrien vumount_fs umount_fs; /* fxn: unmount my own vnode */ 403174294Sobrien vlookup_child lookup_child; /* fxn: lookup path-name */ 404174294Sobrien vmount_child mount_child; /* fxn: mount path-name */ 405174294Sobrien vreaddir readdir; /* fxn: read directory */ 406174294Sobrien vreadlink readlink; /* fxn: read link */ 407174294Sobrien vmounted mounted; /* fxn: after-mount extra actions */ 408174294Sobrien vumounted umounted; /* fxn: after-umount extra actions */ 409174294Sobrien vffserver ffserver; /* fxn: find a file server */ 410174294Sobrien vget_wchan get_wchan; /* fxn: get the waiting channel */ 411174294Sobrien int nfs_fs_flags; /* filesystem flags FS_* for nfs mounts */ 412174294Sobrien#ifdef HAVE_FS_AUTOFS 413174294Sobrien int autofs_fs_flags;/* filesystem flags FS_* for autofs mounts */ 414174294Sobrien#endif /* HAVE_FS_AUTOFS */ 415174294Sobrien}; 41638494Sobrien 41738494Sobrien/* 418174294Sobrien * List of mounted filesystems 419174294Sobrien */ 420174294Sobrienstruct mntfs { 421174294Sobrien qelem mf_q; /* List of mounted filesystems */ 422174294Sobrien am_ops *mf_ops; /* Operations on this mountpoint */ 423174294Sobrien am_opts *mf_fo; /* File opts */ 424174294Sobrien char *mf_mount; /* "/a/kiska/home/kiska" */ 425174294Sobrien char *mf_info; /* Mount info */ 426310490Scy char *mf_auto; /* Mount info */ 427174294Sobrien char *mf_mopts; /* FS mount opts */ 428174294Sobrien char *mf_remopts; /* Remote FS mount opts */ 429174294Sobrien char *mf_loopdev; /* loop device name for /dev/loop mounts */ 430174294Sobrien fserver *mf_server; /* File server */ 431174294Sobrien int mf_fsflags; /* Flags FS_* copied from mf_ops->*_fs_flags */ 432174294Sobrien int mf_flags; /* Flags MFF_* */ 433174294Sobrien int mf_error; /* Error code from background mount */ 434174294Sobrien int mf_refc; /* Number of references to this node */ 435174294Sobrien int mf_cid; /* Callout id */ 436174294Sobrien void (*mf_prfree) (opaque_t); /* Free private space */ 437174294Sobrien opaque_t mf_private; /* Private - per-fs data */ 438174294Sobrien}; 439174294Sobrien 440174294Sobrien/* 441310490Scy * Locations: bindings between keys and mntfs 442310490Scy */ 443310490Scystruct am_loc { 444310490Scy am_opts *al_fo; 445310490Scy mntfs *al_mnt; 446310490Scy int al_refc; 447310490Scy}; 448310490Scy 449310490Scy 450310490Scy/* 451174294Sobrien * List of fileservers 452174294Sobrien */ 453174294Sobrienstruct fserver { 454174294Sobrien qelem fs_q; /* List of fileservers */ 455174294Sobrien int fs_refc; /* Number of references to this server */ 456174294Sobrien char *fs_host; /* Normalized hostname of server */ 457174294Sobrien struct sockaddr_in *fs_ip; /* Network address of server */ 458174294Sobrien int fs_cid; /* Callout id */ 459174294Sobrien int fs_pinger; /* Ping (keepalive) interval */ 460174294Sobrien int fs_flags; /* Flags */ 461174294Sobrien char *fs_type; /* File server type */ 462174294Sobrien u_long fs_version; /* NFS version of server (2, 3, etc.)*/ 463174294Sobrien char *fs_proto; /* NFS protocol of server (tcp, udp, etc.) */ 464174294Sobrien opaque_t fs_private; /* Private data */ 465174294Sobrien void (*fs_prfree) (opaque_t); /* Free private data */ 466174294Sobrien}; 467174294Sobrien 468174294Sobrien/* 469174294Sobrien * Per-mountpoint statistics 470174294Sobrien */ 471174294Sobrienstruct am_stats { 472174294Sobrien time_t s_mtime; /* Mount time */ 473174294Sobrien u_short s_uid; /* Uid of mounter */ 474174294Sobrien int s_getattr; /* Count of getattrs */ 475174294Sobrien int s_lookup; /* Count of lookups */ 476174294Sobrien int s_readdir; /* Count of readdirs */ 477174294Sobrien int s_readlink; /* Count of readlinks */ 478174294Sobrien int s_statfs; /* Count of statfs */ 479310490Scy int s_fsinfo; /* Count of fsinfo */ 480310490Scy int s_pathconf; /* Count of pathconf */ 481174294Sobrien}; 482174294Sobrien 483174294Sobrien/* 484174294Sobrien * System statistics 485174294Sobrien */ 486174294Sobrienstruct amd_stats { 487174294Sobrien int d_drops; /* Dropped requests */ 488174294Sobrien int d_stale; /* Stale NFS handles */ 489174294Sobrien int d_mok; /* Successful mounts */ 490174294Sobrien int d_merr; /* Failed mounts */ 491174294Sobrien int d_uerr; /* Failed unmounts */ 492174294Sobrien}; 493174294Sobrienextern struct amd_stats amd_stats; 494174294Sobrien 495174294Sobrien/* 496174294Sobrien * Map of auto-mount points. 497174294Sobrien */ 498174294Sobrienstruct am_node { 499174294Sobrien int am_mapno; /* Map number */ 500310490Scy am_loc *am_al; /* Mounted filesystem */ 501310490Scy am_loc **am_alarray; /* Filesystem sources to try to mount */ 502174294Sobrien char *am_name; /* "kiska": name of this node */ 503174294Sobrien char *am_path; /* "/home/kiska": path of this node's mount point */ 504174294Sobrien char *am_link; /* "/a/kiska/home/kiska/this/that": link to sub-dir */ 505174294Sobrien am_node *am_parent; /* Parent of this node */ 506174294Sobrien am_node *am_ysib; /* Younger sibling of this node */ 507174294Sobrien am_node *am_osib; /* Older sibling of this node */ 508174294Sobrien am_node *am_child; /* First child of this node */ 509174294Sobrien nfsattrstat am_attr; /* File attributes */ 510174294Sobrien#define am_fattr am_attr.ns_u.ns_attr_u 511174294Sobrien int am_flags; /* Boolean flags AMF_* */ 512174294Sobrien int am_error; /* Specific mount error */ 513174294Sobrien time_t am_ttl; /* Time to live */ 514174294Sobrien int am_timeo_w; /* Dismount wait interval */ 515174294Sobrien int am_timeo; /* Cache timeout interval */ 516174294Sobrien u_int am_gen; /* Generation number */ 517174294Sobrien char *am_pref; /* Mount info prefix */ 518174294Sobrien am_stats am_stats; /* Statistics gathering */ 519174294Sobrien SVCXPRT *am_transp; /* Info for quick reply */ 520174294Sobrien dev_t am_dev; /* Device number */ 521174294Sobrien dev_t am_rdev; /* Remote/real device number */ 522174294Sobrien#ifdef HAVE_FS_AUTOFS 523174294Sobrien autofs_fh_t *am_autofs_fh; 524174294Sobrien time_t am_autofs_ttl; /* Time to expire autofs nodes */ 525174294Sobrien#endif /* HAVE_FS_AUTOFS */ 526310490Scy int am_fd[2]; /* parent child pipe fd's for sync umount */ 527174294Sobrien}; 528174294Sobrien 529174294Sobrien/* 53038494Sobrien * EXTERNALS: 53138494Sobrien */ 53238494Sobrien 533174294Sobrien/* 534174294Sobrien * Amq server global functions 535174294Sobrien */ 53638494Sobrienextern amq_mount_info_list *amqproc_getmntfs_1_svc(voidp argp, struct svc_req *rqstp); 53738494Sobrienextern amq_mount_stats *amqproc_stats_1_svc(voidp argp, struct svc_req *rqstp); 53838494Sobrienextern amq_mount_tree_list *amqproc_export_1_svc(voidp argp, struct svc_req *rqstp); 53938494Sobrienextern amq_mount_tree_p *amqproc_mnttree_1_svc(voidp argp, struct svc_req *rqstp); 54038494Sobrienextern amq_string *amqproc_getvers_1_svc(voidp argp, struct svc_req *rqstp); 541174294Sobrienextern amq_string *amqproc_pawd_1_svc(voidp argp, struct svc_req *rqstp); 54238494Sobrienextern int *amqproc_getpid_1_svc(voidp argp, struct svc_req *rqstp); 54338494Sobrienextern int *amqproc_mount_1_svc(voidp argp, struct svc_req *rqstp); 54438494Sobrienextern int *amqproc_setopt_1_svc(voidp argp, struct svc_req *rqstp); 54538494Sobrienextern voidp amqproc_null_1_svc(voidp argp, struct svc_req *rqstp); 546310490Scyextern int *amqproc_umnt_1_svc(voidp argp, struct svc_req *rqstp); 547310490Scyextern int *amqproc_sync_umnt_1_svc_parent(voidp argp, struct svc_req *rqstp); 548310490Scyextern amq_sync_umnt *amqproc_sync_umnt_1_svc_child(voidp argp, struct svc_req *rqstp); 549310490Scyextern amq_sync_umnt *amqproc_sync_umnt_1_svc_async(voidp argp, struct svc_req *rqstp); 550310490Scyextern amq_map_info_list *amqproc_getmapinfo_1_svc(voidp argp, struct svc_req *rqstp); 55138494Sobrien 55238494Sobrien/* other external definitions */ 553310490Scyextern am_nfs_handle_t *get_root_nfs_fh(char *dir, am_nfs_handle_t *nfh); 55438494Sobrienextern am_node *find_ap(char *); 555174294Sobrienextern am_node *get_ap_child(am_node *, char *); 55638494Sobrienextern bool_t xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead); 557310490Scyextern bool_t xdr_amq_map_info_qelem(XDR *xdrs, qelem *qhead); 55838494Sobrienextern fserver *find_nfs_srvr(mntfs *mf); 559174294Sobrienextern int mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf); 560174294Sobrienextern int process_all_regular_maps(void); 561174294Sobrienextern cf_map_t *find_cf_map(const char *name); 56238494Sobrienextern int set_conf_kv(const char *section, const char *k, const char *v); 563174294Sobrienextern int mount_node(opaque_t arg); 564174294Sobrienextern int unmount_mp(am_node *mp); 565310490Scyextern int conf_parse(void); /* "yyparse" renamed */ 566310490Scyextern FILE *conf_in; /* "yyin" renamed */ 567174294Sobrien 568174294Sobrienextern void amfs_mkcacheref(mntfs *mf); 569174294Sobrienextern int amfs_mount(am_node *mp, mntfs *mf, char *opts); 57038494Sobrienextern void assign_error_mntfs(am_node *mp); 571174294Sobrienextern am_node *next_nonerror_node(am_node *xp); 572174294Sobrienextern void flush_srvr_nfs_cache(fserver *fs); 573174294Sobrienextern void am_mounted(am_node *); 574174294Sobrienextern void mf_mounted(mntfs *mf, bool_t call_free_opts); 575174294Sobrienextern void am_unmounted(am_node *); 576174294Sobrienextern am_node *get_exported_ap(int index); 577174294Sobrienextern am_node *get_first_exported_ap(int *index); 578174294Sobrienextern am_node *get_next_exported_ap(int *index); 579174294Sobrienextern am_node *path_to_exported_ap(char *path); 580174294Sobrienextern am_node *exported_ap_alloc(void); 581174294Sobrienextern am_node *find_mf(mntfs *); 582174294Sobrienextern am_node *next_map(int *); 583174294Sobrienextern am_ops *ops_match(am_opts *, char *, char *, char *, char *, char *); 584174294Sobrienextern am_ops *ops_search(char *); 585174294Sobrienextern fserver *dup_srvr(fserver *); 586174294Sobrienextern void srvrlog(fserver *, char *); 587174294Sobrienextern int get_mountd_port(fserver *, u_short *, wchan_t); 588174294Sobrienextern void flush_nfs_fhandle_cache(fserver *); 589174294Sobrien 590174294Sobrienextern mntfs *dup_mntfs(mntfs *); 591310490Scyextern am_loc *dup_loc(am_loc *); 592174294Sobrienextern mntfs *find_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *); 593174294Sobrienextern mntfs *locate_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *); 594310490Scyextern am_loc *new_loc(void); 595174294Sobrienextern mntfs *new_mntfs(void); 596174294Sobrienextern mntfs *realloc_mntfs(mntfs *, am_ops *, am_opts *, char *, char *, char *, char *, char *); 597174294Sobrienextern void flush_mntfs(void); 598174294Sobrienextern void free_mntfs(voidp); 599310490Scyextern void free_loc(voidp); 600174294Sobrien 601174294Sobrien 602174294Sobrienextern void amq_program_1(struct svc_req *rqstp, SVCXPRT *transp); 603174294Sobrienextern int background(void); 604174294Sobrienextern void deslashify(char *); 605174294Sobrienextern void do_task_notify(void); 606174294Sobrienextern int eval_fs_opts(am_opts *, char *, char *, char *, char *, char *); 607310490Scyextern int file_read_line(char *, int, FILE *); 608174294Sobrienextern void forcibly_timeout_mp(am_node *); 609174294Sobrienextern void free_map(am_node *); 610174294Sobrienextern void free_opts(am_opts *); 611310490Scyextern am_opts *copy_opts(am_opts *); 612174294Sobrienextern void free_srvr(fserver *); 613174294Sobrienextern int fwd_init(void); 614174294Sobrienextern int fwd_packet(int, char *, int, struct sockaddr_in *, struct sockaddr_in *, opaque_t, fwd_fun *); 615174294Sobrienextern void fwd_reply(void); 616174294Sobrienextern void get_args(int argc, char *argv[]); 617174294Sobrienextern wchan_t get_mntfs_wchan(mntfs *mf); 618174294Sobrienextern void host_normalize(char **); 619174294Sobrienextern void init_map(am_node *, char *); 620174294Sobrienextern void ins_que(qelem *, qelem *); 621174294Sobrienextern void insert_am(am_node *, am_node *); 622174294Sobrienextern int make_nfs_auth(void); 623174294Sobrienextern void make_root_node(void); 624174294Sobrienextern void map_flush_srvr(fserver *); 625174294Sobrienextern void mapc_add_kv(mnt_map *, char *, char *); 626310490Scyextern mnt_map *mapc_find(char *, char *, const char *, const char *); 627174294Sobrienextern void mapc_free(opaque_t); 628174294Sobrienextern int mapc_keyiter(mnt_map *, key_fun, opaque_t); 629174294Sobrienextern void mapc_reload(void); 630174294Sobrienextern int mapc_search(mnt_map *, char *, char **); 631174294Sobrienextern void mapc_showtypes(char *buf, size_t l); 632174294Sobrienextern int mapc_type_exists(const char *type); 633174294Sobrienextern void mk_fattr(nfsfattr *, nfsftype); 634174294Sobrienextern int mount_auto_node(char *, opaque_t); 635174294Sobrienextern int mount_automounter(int); 636174294Sobrienextern int mount_exported(void); 637174294Sobrienextern void mp_to_fh(am_node *, am_nfs_fh *); 638310490Scyextern void mp_to_fh3(am_node *mp, am_nfs_fh3 *fhp); 639174294Sobrienextern void new_ttl(am_node *); 640174294Sobrienextern void nfs_quick_reply(am_node *mp, int error); 641174294Sobrienextern void normalize_slash(char *); 642310490Scyextern void notify_child(am_node *, au_etype, int, int); 643174294Sobrienextern void ops_showamfstypes(char *buf, size_t l); 644174294Sobrienextern void ops_showfstypes(char *outbuf, size_t l); 645174294Sobrienextern void rem_que(qelem *); 646174294Sobrienextern void reschedule_timeout_mp(void); 647174294Sobrienextern void restart(void); 648174294Sobrienextern void restart_automounter_nodes(void); 649174294Sobrienextern int root_keyiter(key_fun *, opaque_t); 65038494Sobrienextern void root_newmap(const char *, const char *, const char *, const cf_map_t *); 651174294Sobrienextern void run_task(task_fun *, opaque_t, cb_fun *, opaque_t); 652174294Sobrienextern void sched_task(cb_fun *, opaque_t, wchan_t); 653174294Sobrienextern int softclock(void); 654174294Sobrienextern int timeout(u_int, void (*fn)(opaque_t), opaque_t); 655174294Sobrienextern void timeout_mp(opaque_t); 656174294Sobrienextern void untimeout(int); 657174294Sobrienextern void umount_exported(void); 658174294Sobrienextern int valid_key(char *); 659174294Sobrienextern void wakeup(wchan_t); 660174294Sobrienextern void wakeup_srvr(fserver *); 661174294Sobrienextern void wakeup_task(int, int, wchan_t); 662174294Sobrien#define SIZEOF_PID_FSNAME (16 + MAXHOSTNAMELEN) 663174294Sobrienextern char pid_fsname[SIZEOF_PID_FSNAME]; /* "kiska.southseas.nz:(pid%d)" */ 664174294Sobrien#define SIZEOF_HOSTD (2 * MAXHOSTNAMELEN + 1) 665174294Sobrienextern char hostd[SIZEOF_HOSTD]; /* Host+domain */ 666174294Sobrien#define SIZEOF_OPTS 256 /* used for char opts[] and preopts[] */ 66738494Sobrien 668174294Sobrien/* 669174294Sobrien * Global variables. 670174294Sobrien */ 671174294Sobrienextern SVCXPRT *current_transp; /* For nfs_quick_reply() */ 672310490Scyextern dispatcher_t nfs_dispatcher; 67338494Sobrienextern char *conf_tag; 674174294Sobrien#define SIZEOF_UID_STR 12 675174294Sobrien#define SIZEOF_GID_STR 12 676174294Sobrienextern char *opt_gid, gid_str[SIZEOF_GID_STR]; 677174294Sobrienextern char *opt_uid, uid_str[SIZEOF_UID_STR]; 678174294Sobrienextern int NumChildren; 67938494Sobrienextern int fwd_sock; 68038494Sobrienextern int select_intr_valid; 681174294Sobrienextern int immediate_abort; /* Should close-down unmounts be retried */ 68238494Sobrienextern int usage; 68338494Sobrienextern int use_conf_file; /* use amd configuration file */ 684174294Sobrienextern int task_notify_todo; /* Task notifier needs running */ 68538494Sobrienextern jmp_buf select_intr; 68638494Sobrienextern qelem mfhead; 68782794Sobrienextern struct amu_global_options gopt; /* where global options are stored */ 688174294Sobrienextern time_t do_mapc_reload; /* Flush & reload mount map cache */ 689174294Sobrienextern time_t next_softclock; /* Time to call softclock() */ 69038494Sobrien 69138494Sobrien#ifdef HAVE_SIGACTION 69238494Sobrienextern sigset_t masked_sigs; 69338494Sobrien#endif /* HAVE_SIGACTION */ 69438494Sobrien 69582794Sobrien#if defined(HAVE_AMU_FS_LINK) || defined(HAVE_AMU_FS_LINKX) 69638494Sobrienextern char *amfs_link_match(am_opts *fo); 69782794Sobrien#endif /* defined(HAVE_AMU_FS_LINK) || defined(HAVE_AMU_FS_LINKX) */ 69838494Sobrien 699174294Sobrien#ifdef HAVE_FS_AUTOFS 700174294Sobrienextern int amd_use_autofs; 70138494Sobrien 702174294Sobrienextern int autofs_get_fh(am_node *mp); 703174294Sobrienextern void autofs_release_fh(am_node *mp); 704174294Sobrienextern void autofs_get_mp(am_node *mp); 705174294Sobrienextern void autofs_release_mp(am_node *mp); 706174294Sobrienextern void autofs_add_fdset(fd_set *readfds); 707174294Sobrienextern int autofs_handle_fdset(fd_set *readfds, int nsel); 708174294Sobrienextern void autofs_mounted(am_node *mp); 709174294Sobrienextern void autofs_mount_succeeded(am_node *mp); 710174294Sobrienextern void autofs_mount_failed(am_node *mp); 711174294Sobrienextern int autofs_umount_succeeded(am_node *mp); 712174294Sobrienextern int autofs_umount_failed(am_node *mp); 713174294Sobrienextern int autofs_mount_fs(am_node *mp, mntfs *mf); 714174294Sobrienextern int autofs_umount_fs(am_node *mp, mntfs *mf); 715174294Sobrienextern void autofs_get_opts(char *opts, size_t l, autofs_fh_t *fh); 716174294Sobrienextern int autofs_compute_mount_flags(mntent_t *); 717174294Sobrienextern void autofs_timeout_mp(am_node *); 718174294Sobrienextern int create_autofs_service(void); 719174294Sobrienextern int destroy_autofs_service(void); 720174294Sobrien#endif /* HAVE_FS_AUTOFS */ 72138494Sobrien 722174294Sobrien/**************************************************************************/ 723174294Sobrien/*** Generic file-system types, implemented as part of the native O/S. ***/ 724174294Sobrien/**************************************************************************/ 725174294Sobrien 726174294Sobrien/* 727174294Sobrien * Loopback File System 728174294Sobrien * Many systems can't support this, and in any case most of the 729174294Sobrien * functionality is available with Symlink FS. 730174294Sobrien */ 731174294Sobrien#ifdef HAVE_FS_LOFS 732174294Sobrienextern am_ops lofs_ops; 733174294Sobrienextern int mount_lofs(char *mntdir, char *fs_name, char *opts, int on_autofs); 734174294Sobrien#endif /* HAVE_FS_LOFS */ 735174294Sobrien 736174294Sobrien/* 737174294Sobrien * CD-ROM File System (CD-ROM) 738174294Sobrien * (HSFS: High Sierra F/S on some machines) 739174294Sobrien * Many systems can't support this, and in any case most of the 740174294Sobrien * functionality is available with program FS. 741174294Sobrien */ 742174294Sobrien#ifdef HAVE_FS_CDFS 743174294Sobrienextern am_ops cdfs_ops; 744174294Sobrien#endif /* HAVE_FS_CDFS */ 745174294Sobrien 746174294Sobrien/* 747174294Sobrien * PC File System (MS-DOS) 748174294Sobrien * Many systems can't support this, and in any case most of the 749174294Sobrien * functionality is available with program FS. 750174294Sobrien */ 751174294Sobrien#ifdef HAVE_FS_PCFS 752174294Sobrienextern am_ops pcfs_ops; 753174294Sobrien#endif /* HAVE_FS_PCFS */ 754174294Sobrien 755174294Sobrien/* 756310490Scy * UDF File System 757310490Scy * Many systems can't support this, and in any case most of the 758310490Scy * functionality is available with program FS. 759310490Scy */ 760310490Scy#ifdef HAVE_FS_UDF 761310490Scyextern am_ops udf_ops; 762310490Scy#endif /* HAVE_FS_UDF */ 763310490Scy 764310490Scy#ifdef HAVE_FS_LUSTRE 765310490Scyextern am_ops lustre_ops; 766310490Scy#endif /* HAVE_FS_LUSTRE */ 767310490Scy 768310490Scy/* 769174294Sobrien * Caching File System (Solaris) 770174294Sobrien */ 771174294Sobrien#ifdef HAVE_FS_CACHEFS 772174294Sobrienextern am_ops cachefs_ops; 773174294Sobrien#endif /* HAVE_FS_CACHEFS */ 774174294Sobrien 775174294Sobrien/* 776310490Scy * In memory /tmp filesystem (Linux, NetBSD) 777310490Scy */ 778310490Scy#ifdef HAVE_FS_TMPFS 779310490Scyextern am_ops tmpfs_ops; 780310490Scy#endif /* HAVE_FS_TMPFS */ 781310490Scy/* 782174294Sobrien * Network File System 783174294Sobrien * Good, slow, NFS V.2. 784174294Sobrien */ 785174294Sobrien#ifdef HAVE_FS_NFS 786174294Sobrienextern am_ops nfs_ops; /* NFS */ 787174294Sobrienextern fserver *find_nfs_srvr (mntfs *); 788174294Sobrienextern qelem nfs_srvr_list; 789174294Sobrien#endif /* HAVE_FS_NFS */ 790174294Sobrien 791174294Sobrien/* 792174294Sobrien * Un*x File System 793174294Sobrien * Normal local disk file system. 794174294Sobrien */ 795174294Sobrien#ifdef HAVE_FS_UFS 796174294Sobrienextern am_ops ufs_ops; /* Un*x file system */ 797174294Sobrien#endif /* HAVE_FS_UFS */ 798174294Sobrien 79938494Sobrien/* Unix file system (irix) */ 80038494Sobrien#ifdef HAVE_FS_XFS 80138494Sobrienextern am_ops xfs_ops; /* Un*x file system */ 80238494Sobrien#endif /* HAVE_FS_XFS */ 80338494Sobrien 804310490Scy/* Unix file system (ext*) */ 805310490Scy#ifdef HAVE_FS_EXT 806310490Scyextern am_ops ext2_ops; /* Un*x file system */ 807310490Scyextern am_ops ext3_ops; /* Un*x file system */ 808310490Scyextern am_ops ext4_ops; /* Un*x file system */ 809310490Scy#endif /* HAVE_FS_EXT */ 810310490Scy 81138494Sobrien/* Unix file system (irix) */ 81238494Sobrien#ifdef HAVE_FS_EFS 81338494Sobrienextern am_ops efs_ops; /* Un*x file system */ 81438494Sobrien#endif /* HAVE_FS_EFS */ 81538494Sobrien 816174294Sobrien/**************************************************************************/ 817174294Sobrien/*** Automounter file-system types, implemented by amd. ***/ 818174294Sobrien/**************************************************************************/ 819174294Sobrien 820174294Sobrien/* 821174294Sobrien * Root AMD File System 822174294Sobrien */ 823174294Sobrienextern am_ops amfs_root_ops; /* Root file system */ 824174294Sobrien 825174294Sobrien/* 826174294Sobrien * Generic amfs helper methods 827174294Sobrien */ 828174294Sobrienextern am_node *amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op); 829174294Sobrienextern am_node *amfs_generic_mount_child(am_node *ap, int *error_return); 830310490Scyextern int amfs_generic_readdir(am_node *mp, voidp cookie, voidp dp, voidp ep, u_int count); 831174294Sobrienextern int amfs_generic_umount(am_node *mp, mntfs *mf); 832174294Sobrienextern void amfs_generic_mounted(mntfs *mf); 833174294Sobrienextern char *amfs_generic_match(am_opts *fo); 834174294Sobrienextern fserver *amfs_generic_find_srvr(mntfs *); 835174294Sobrien 836174294Sobrien/* 837174294Sobrien * Automount File System 838174294Sobrien */ 839174294Sobrien#ifdef HAVE_AMU_FS_AUTO 840174294Sobrienextern am_ops amfs_auto_ops; /* Automount file system (this!) */ 841174294Sobrien#endif /* HAVE_AMU_FS_AUTO */ 842174294Sobrien 843174294Sobrien/* 844174294Sobrien * Toplvl Automount File System 845174294Sobrien */ 846174294Sobrien#ifdef HAVE_AMU_FS_TOPLVL 847174294Sobrienextern am_ops amfs_toplvl_ops; /* Toplvl Automount file system */ 848174294Sobrienextern int amfs_toplvl_mount(am_node *mp, mntfs *mf); 849174294Sobrienextern int amfs_toplvl_umount(am_node *mp, mntfs *mf); 850174294Sobrien#endif /* HAVE_AMU_FS_TOPLVL */ 851174294Sobrien 852174294Sobrien/* 853174294Sobrien * Direct Automount File System 854174294Sobrien */ 855174294Sobrien#ifdef HAVE_AMU_FS_DIRECT 856174294Sobrienextern am_ops amfs_direct_ops; /* Direct Automount file system (this too) */ 857174294Sobrien#endif /* HAVE_AMU_FS_DIRECT */ 858174294Sobrien 859174294Sobrien/* 860174294Sobrien * Error File System 861174294Sobrien */ 862174294Sobrien#ifdef HAVE_AMU_FS_ERROR 863174294Sobrienextern am_ops amfs_error_ops; /* Error file system */ 864174294Sobrienextern am_node *amfs_error_lookup_child(am_node *mp, char *fname, int *error_return, int op); 865174294Sobrienextern am_node *amfs_error_mount_child(am_node *ap, int *error_return); 866310490Scyextern int amfs_error_readdir(am_node *mp, voidp cookie, voidp dp, voidp ep, u_int count); 867310490Scy 868174294Sobrien#endif /* HAVE_AMU_FS_ERROR */ 869174294Sobrien 870174294Sobrien/* 871174294Sobrien * NFS mounts with local existence check. 872174294Sobrien */ 873174294Sobrien#ifdef HAVE_AMU_FS_NFSL 874174294Sobrienextern am_ops amfs_nfsl_ops; /* NFSL */ 875174294Sobrien#endif /* HAVE_AMU_FS_NFSL */ 876174294Sobrien 877174294Sobrien/* 878174294Sobrien * Multi-nfs mounts. 879174294Sobrien */ 880174294Sobrien#ifdef HAVE_AMU_FS_NFSX 881174294Sobrienextern am_ops amfs_nfsx_ops; /* NFSX */ 882174294Sobrien#endif /* HAVE_AMU_FS_NFSX */ 883174294Sobrien 884174294Sobrien/* 885174294Sobrien * NFS host - a whole tree. 886174294Sobrien */ 887174294Sobrien#ifdef HAVE_AMU_FS_HOST 888174294Sobrienextern am_ops amfs_host_ops; /* NFS host */ 889174294Sobrien#endif /* HAVE_AMU_FS_HOST */ 890174294Sobrien 891174294Sobrien/* 892174294Sobrien * Program File System 893174294Sobrien * This is useful for things like RVD. 894174294Sobrien */ 895174294Sobrien#ifdef HAVE_AMU_FS_PROGRAM 896174294Sobrienextern am_ops amfs_program_ops; /* Program File System */ 897174294Sobrien#endif /* HAVE_AMU_FS_PROGRAM */ 898174294Sobrien 899174294Sobrien/* 900174294Sobrien * Symbolic-link file system. 901174294Sobrien * A "filesystem" which is just a symbol link. 902174294Sobrien */ 903174294Sobrien#ifdef HAVE_AMU_FS_LINK 904174294Sobrienextern am_ops amfs_link_ops; /* Symlink FS */ 905174294Sobrien#endif /* HAVE_AMU_FS_LINK */ 906174294Sobrien 907174294Sobrien/* 908174294Sobrien * Symbolic-link file system, which also checks that the target of 909174294Sobrien * the symlink exists. 910174294Sobrien * A "filesystem" which is just a symbol link. 911174294Sobrien */ 912174294Sobrien#ifdef HAVE_AMU_FS_LINKX 913174294Sobrienextern am_ops amfs_linkx_ops; /* Symlink FS with existence check */ 914174294Sobrien#endif /* HAVE_AMU_FS_LINKX */ 915174294Sobrien 916174294Sobrien/* 917174294Sobrien * Union file system 918174294Sobrien */ 919174294Sobrien#ifdef HAVE_AMU_FS_UNION 920174294Sobrienextern am_ops amfs_union_ops; /* Union FS */ 921174294Sobrien#endif /* HAVE_AMU_FS_UNION */ 922174294Sobrien 92338494Sobrien#endif /* not _AMD_H */ 924