automount.h revision 6a6d3e5e4dba4c7f8db69274358a28e1adf3fe67
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _AUTOMOUNT_H
#define _AUTOMOUNT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <fslib.h> /* needed for mntlist_t declaration */
#include <thread.h>
#include <synch.h> /* needed for mutex_t declaration */
#ifdef MALLOC_DEBUG
#include <debug_alloc.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _REENTRANT
#define rpc_control(a, b) 1
#endif
#define DOMOUNT_USER 1
#define DOMOUNT_KERNEL 2
/*
* Solaris autofs configuration file location
*/
#define AUTOFSADMIN "/etc/default/autofs"
#define MXHOSTNAMELEN 64
#define MAXNETNAMELEN 255
#define MAXFILENAMELEN 255
#define LINESZ 4096
#define MAXOPTSLEN 1024
/* remain mounted (in seconds) */
/* automountd's reply before */
/* retransmitting */
/* stack ops */
#define ERASE 0
#define PUSH 1
#define POP 2
#define INIT 3
#define STACKSIZ 30
#define DIST_SELF 1
#define DIST_MYSUB 2
#define DIST_MYNET 3
#define DIST_OTHER 4
#define MAXIFS 32
/*
* Retry operation related definitions.
*/
#define RET_OK 0
#define RET_RETRY 32
#define RET_ERR 33
#define INITDELAY 5
#define DELAY_BACKOFF 2
#define MAXDELAY 120
delay *= DELAY_BACKOFF; \
}
struct mapline {
};
/*
* Structure describing a host/filesystem/dir tuple in a NIS map entry
*/
struct mapfs {
int mfs_ignore; /* ignore this entry */
char *mfs_host; /* host name */
char *mfs_dir; /* dir to mount */
int mfs_penalty; /* mount penalty for this host */
int mfs_distance; /* distance hint */
/* buffer */
};
/*
* NIS entry - lookup of name in DIR gets us this
*/
struct mapent {
char *map_fstype; /* file system type e.g. "nfs" */
char *map_mounter; /* base fs e.g. "cachefs" */
char *map_root; /* path to mount root */
char *map_mntpnt; /* path from mount root */
char *map_mntopts; /* mount options */
char *map_fsw; /* mount fs information */
char *map_fswq; /* quoted mountfs information */
int map_mntlevel; /* mapentry hierarchy level */
int map_err; /* flags any bad entries in the map */
};
/*
* Descriptor for each directory served by the automounter
*/
struct autodir {
char *dir_name; /* mount point */
char *dir_map; /* name of map for dir */
char *dir_opts; /* default mount options */
int dir_direct; /* direct mountpoint ? */
int dir_remount; /* a remount */
};
/*
* This structure is used to build an array of
* hostnames with associated penalties to be
* passed to the nfs_cast procedure
*/
struct host_names {
char *host;
int penalty;
};
/*
* structure used to build list of contents for a map on
* a readdir request
*/
struct dir_entry {
char *name; /* name of entry */
};
/*
* offset index table
*/
struct off_tbl {
};
#ifndef NO_RDDIR_CACHE
/*
* directory cache for 'map'
*/
struct autofs_rddir_cache {
char *map;
int in_use; /* # threads referencing it */
int full; /* full == 1 when cache full */
struct autofs_rddir_cache *next;
};
#endif /* NO_RDDIR_CACHE */
/*
* structure used to maintain address list for localhost
*/
struct myaddrs {
struct sockaddr_in sin;
struct myaddrs *myaddrs_next;
};
extern char self[];
extern int verbose;
extern int trace;
extern int automountd_nobrowse;
extern struct mntlist *current_mounts;
extern struct myaddrs *myaddrs_head;
extern rwlock_t cache_lock;
extern rwlock_t portmap_cache_lock;
extern rwlock_t autofs_rddir_cache_lock;
extern mutex_t cleanup_lock;
extern cond_t cleanup_start_cv;
extern cond_t cleanup_done_cv;
/*
* mnttab handling routines
*/
extern void free_mapent(struct mapent *);
extern struct mntlist *getmntlist(void);
/*
* utilities
*/
extern int macro_expand(char *, char *, char *, int);
extern void unquote(char *, char *);
extern void unbracket(char **);
extern void trim(char *);
extern int getword(char *, char *, char **, char **, char, int);
extern int get_retry(char *);
extern void put_automountd_env(void);
extern void dirinit(char *, char *, char *, int, char **, char ***);
extern void pr_msg(const char *, ...);
extern void trace_prt(int, char *, ...);
extern void free_autofs_args(autofs_args *);
extern void free_nfs_args(struct nfs_args *);
extern void free_mounta(struct mounta *);
extern void *autofs_get_buffer(size_t);
extern int self_check(char *);
action_list **, int);
autofs_action_t *, struct linka *);
extern int do_unmount1(umntrequest *);
extern int nfsunmount(struct mnttab *);
extern int loopbackmount(char *, char *, char *, int);
action_list **);
extern int mount_generic(char *, char *, char *, char *, int);
extern bool_t hasrestrictopt(char *);
#ifndef NO_RDDIR_CACHE
/*
* readdir handling routines
*/
extern char *auto_rddir_malloc(unsigned);
extern char *auto_rddir_strdup(const char *);
extern void cache_cleanup(void);
extern int autofs_rddir_cache_lookup(char *, struct autofs_rddir_cache **);
#endif /* NO_RDDIR_CACHE */
/*
* generic interface to specific name service functions
*/
extern void ns_setup(char **, char ***);
extern int getmapkeys(char *, struct dir_entry **, int *, int *, char **,
char ***, uid_t);
extern int loadmaster_map(char *, char *, char **, char ***);
extern int loaddirect_map(char *, char *, char *, char **, char ***);
/*
* these name service specific functions should not be
* accessed directly, use the generic functions.
*/
extern void init_files(char **, char ***);
extern int getmapent_files(char *, char *, struct mapline *, char **, char ***,
extern int loadmaster_files(char *, char *, char **, char ***);
extern int loaddirect_files(char *, char *, char *, char **, char ***);
extern int getmapkeys_files(char *, struct dir_entry **, int *, int *,
char **, char ***);
extern int stack_op(int, char *, char **, char ***);
extern void init_nisplus(char **, char ***);
extern int getmapent_nisplus(char *, char *, struct mapline *, char **,
extern int loadmaster_nisplus(char *, char *, char **, char ***);
extern int loaddirect_nisplus(char *, char *, char *, char **, char ***);
extern int getmapkeys_nisplus(char *, struct dir_entry **, int *, int *,
char **, char ***);
extern void init_nis(char **, char ***);
extern int getmapent_nis(char *, char *, struct mapline *, char **, char ***,
extern int loadmaster_nis(char *, char *, char **, char ***);
extern int loaddirect_nis(char *, char *, char *, char **, char ***);
extern int getmapkeys_nis(char *, struct dir_entry **, int *, int *,
char **, char ***);
extern void init_ldap(char **, char ***);
extern int getmapent_ldap(char *, char *, struct mapline *, char **, char ***,
extern int loadmaster_ldap(char *, char *, char **, char ***);
extern int loaddirect_ldap(char *, char *, char *, char **, char ***);
extern int getmapkeys_ldap(char *, struct dir_entry **, int *, int *,
char **, char ***);
/*
* end of name service specific functions
*/
/*
* not defined in any header file
*/
extern int __clnt_bindresvport(CLIENT *);
/*
* Hidden rpc functions
*/
extern int __nis_reset_state();
extern int __rpc_negotiate_uid(int);
#ifdef __cplusplus
}
#endif
#endif /* _AUTOMOUNT_H */