⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 am.h

📁 早期freebsd实现
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 1990 Jan-Simon Pendry * Copyright (c) 1990 Imperial College of Science, Technology & Medicine * Copyright (c) 1990, 1993 *	The Regents of the University of California.  All rights reserved. * * This code is derived from software contributed to Berkeley by * Jan-Simon Pendry at Imperial College, London. * * 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. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *	This product includes software developed by the University of *	California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * *	@(#)am.h	5.6 (Berkeley) 6/6/93 * * $Id: am.h,v 5.2.2.1 1992/02/09 15:09:54 jsp beta $ * */#include "config.h"/* * Global declarations */#include <sys/param.h>#include <sys/socket.h>#include <rpc/rpc.h>#include "nfs_prot.h"#ifdef MNTENT_HDR#include MNTENT_HDR#endif /* MNTENT_HDR */#include <assert.h>#ifdef DEBUG_MEM#include <malloc.h>#endif /* DEBUG_MEM */#ifndef MAXHOSTNAMELEN#define MAXHOSTNAMELEN 64#endif /* MAXHOSTNAMELEN */#ifndef MNTTYPE_AUTO#define MNTTYPE_AUTO "auto"#endif /* MNTTYPE_AUTO */#ifndef FALSE#define FALSE 0#define TRUE 1#endif /* FALSE */#ifndef ROOT_MAP#define	ROOT_MAP "\"root\""#endif /* ROOT_MAP *//* * Flags from command line */extern int print_pid;		/* Print pid to stdout */extern int normalize_hosts;	/* Normalize host names before use */extern int restart_existing_mounts;#ifdef HAS_NIS_MAPSextern char *domain;		/* NIS domain to use */#endif /* HAS_NIS_MAPS */extern int am_timeo;		/* Cache period */extern int afs_timeo;		/* AFS timeout */extern int afs_retrans;		/* AFS retrans */extern int am_timeo_w;		/* Unmount timeout */extern char *mtab;		/* Mount table */typedef enum {	Start,	Run,	Finishing,	Quit,	Done} serv_state;extern serv_state amd_state;	/* Should we go now */extern int immediate_abort;	/* Should close-down unmounts be retried */extern time_t do_mapc_reload;	/* Flush & reload mount map cache *//* * Useful constants */extern char pid_fsname[];	/* kiska.southseas.nz:(pid%d) */extern char hostd[];		/* "kiska.southseas.nz" */extern char *hostdomain;	/* "southseas.nz" */extern char *op_sys;		/* "sos4" */extern char *arch;		/* "sun4" */extern char *karch;		/* "sun4c" */extern char *cluster;		/* "r+d-kluster" */extern char *endian;		/* "big" */extern char *auto_dir;		/* "/a" */extern char copyright[];	/* Copyright info */extern char version[];		/* Version info */typedef struct am_ops am_ops;typedef struct am_node am_node;typedef struct am_opts am_opts;typedef struct mntfs mntfs;typedef struct fserver fserver;typedef struct fsrvinfo fsrvinfo;/* * Debug defns. */#ifdef DEBUG#define	DEBUG_MTAB	"./mtab"extern int debug_flags;		/* Debug options */#define	D_DAEMON	0x0001	/* Enter daemon mode */#define	D_TRACE		0x0002	/* Do protocol trace */#define	D_FULL		0x0004	/* Do full trace */#define	D_MTAB		0x0008	/* Use local mtab */#define	D_AMQ		0x0010	/* Register amq program */#define	D_STR		0x0020	/* Debug string munging */#define	D_MEM		0x0040	/* Trace memory allocations *//* * Normally, don't enter daemon mode, and don't register amq */#define	D_TEST	(~(D_DAEMON|D_MEM|D_STR))#endif /* DEBUG *//* * Global variables. */extern unsigned short nfs_port;	/* Our NFS service port */extern struct in_addr myipaddr;	/* (An) IP address of this host */extern int foreground;		/* Foreground process */extern time_t next_softclock;	/* Time to call softclock() */extern int task_notify_todo;	/* Task notifier needs running */#ifdef HAS_TFSextern int nfs_server_code_available;#endif /* HAS_TFS */extern int last_used_map;	/* Last map being used for mounts */extern AUTH *nfs_auth;		/* Dummy uthorisation for remote servers */extern am_node **exported_ap;	/* List of nodes */extern int first_free_map;	/* First free node */extern am_node *root_node;	/* Node for "root" */extern char *wire;		/* Name of primary connected network */#define	NEXP_AP	(254)#define NEXP_AP_MARGIN (128)typedef int (*task_fun)P((voidp));typedef void (*cb_fun)P((int, int, voidp));typedef void (*fwd_fun)P((voidp, int, struct sockaddr_in *,				struct sockaddr_in *, voidp, int));/* * String comparison macros */#define STREQ(s1, s2) (strcmp((s1), (s2)) == 0)#define FSTREQ(s1, s2) ((*(s1) == *(s2)) && STREQ((s1),(s2)))/* * Linked list */typedef struct qelem qelem;struct qelem {	qelem *q_forw;	qelem *q_back;};#define	FIRST(ty, q)	((ty *) ((q)->q_forw))#define	LAST(ty, q)	((ty *) ((q)->q_back))#define	NEXT(ty, q)	((ty *) (((qelem *) q)->q_forw))#define	PREV(ty, q)	((ty *) (((qelem *) q)->q_back))#define	HEAD(ty, q)	((ty *) q)#define	ITER(v, ty, q) \	for ((v) = FIRST(ty,(q)); (v) != HEAD(ty,(q)); (v) = NEXT(ty,(v)))/* * List of mount table entries */typedef struct mntlist mntlist;struct mntlist {	struct mntlist *mnext;	struct mntent *mnt;};/* * Mount map */typedef struct mnt_map mnt_map;/* * Global routines */extern int atoi P((Const char *)); /* C */extern void am_mounted P((am_node*));extern void am_unmounted P((am_node*));extern int background(P_void);extern int bind_resv_port P((int, unsigned short*));extern int compute_mount_flags P((struct mntent *));extern int softclock(P_void);#ifdef DEBUGextern int debug_option P((char*));#endif /* DEBUG */extern void deslashify P((char*));/*extern void domain_strip P((char*, char*));*/extern mntfs* dup_mntfs P((mntfs*));extern fserver* dup_srvr P((fserver*));extern int eval_fs_opts P((am_opts*, char*, char*, char*, char*, char*));extern char* expand_key P((char*));extern am_node* exported_ap_alloc(P_void);extern am_node* find_ap P((char*));extern am_node* find_mf P((mntfs*));extern mntfs* find_mntfs P((am_ops*, am_opts*, char*, char*, char*, char*, char*));extern void flush_mntfs(P_void);extern void flush_nfs_fhandle_cache P((fserver*));extern void forcibly_timeout_mp P((am_node*));extern FREE_RETURN_TYPE free P((voidp)); /* C */extern void free_mntfs P((mntfs*));extern void free_opts P((am_opts*));extern void free_map P((am_node*));extern void free_mntlist P((mntlist*));extern void free_srvr P((fserver*));extern int fwd_init(P_void);extern int fwd_packet P((int, voidp, int, struct sockaddr_in *,		struct sockaddr_in *, voidp, fwd_fun));extern void fwd_reply(P_void);extern void get_args P((int, char*[]));extern char *getwire P((void));#ifdef NEED_MNTOPT_PARSERextern char *hasmntopt P((struct mntent*, char*));#endif /* NEED_MNTOPT_PARSER */extern int hasmntval P((struct mntent*, char*));extern void host_normalize P((char **));extern char *inet_dquad P((char*, unsigned long));extern void init_map P((am_node*, char*));extern void insert_am P((am_node*, am_node*));extern void ins_que P((qelem*, qelem*));extern int islocalnet P((unsigned long));extern int make_nfs_auth P((void));extern void make_root_node(P_void);extern int make_rpc_packet P((char*, int, u_long, struct rpc_msg*, voidp, xdrproc_t, AUTH*));extern void map_flush_srvr P((fserver*));extern void mapc_add_kv P((mnt_map*, char*, char*));extern mnt_map* mapc_find P((char*, char*));extern void mapc_free P((mnt_map*));extern int mapc_keyiter P((mnt_map*, void (*)(char*,voidp), voidp));extern int mapc_search P((mnt_map*, char*, char**));extern void mapc_reload(P_void);extern void mapc_showtypes P((FILE*));extern int mkdirs P((char*, int));extern void mk_fattr P((am_node*, enum ftype));extern void mnt_free P((struct mntent*));extern int mount_auto_node P((char*, voidp));extern int mount_automounter P((int));extern int mount_exported(P_void);extern int mount_fs P((struct mntent*, int, caddr_t, int, MTYPE_TYPE));/*extern int mount_nfs_fh P((struct fhstatus*, char*, char*, char*, mntfs*));*/extern int mount_node P((am_node*));extern mntfs* new_mntfs(P_void);extern void new_ttl P((am_node*));extern am_node* next_map P((int*));extern int nfs_srvr_port P((fserver*, u_short*, voidp));extern void normalize_slash P((char*));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -