📄 am.h
字号:
extern void ops_showfstypes P((FILE*));extern int pickup_rpc_reply P((voidp, int, voidp, xdrproc_t));extern mntlist* read_mtab P((char*));extern mntfs* realloc_mntfs P((mntfs*, am_ops*, am_opts*, char*, char*, char*, char*, char*));extern void rem_que P((qelem*));extern void reschedule_timeout_mp(P_void);extern void restart(P_void);#ifdef UPDATE_MTABextern void rewrite_mtab P((mntlist *));#endif /* UPDATE_MTAB */extern void rmdirs P((char*));extern am_node* root_ap P((char*, int));extern int root_keyiter P((void (*)(char*,voidp), voidp));extern void root_newmap P((char*, char*, char*));extern void rpc_msg_init P((struct rpc_msg*, u_long, u_long, u_long));extern void run_task P((task_fun, voidp, cb_fun, voidp));extern void sched_task P((cb_fun, voidp, voidp));extern void show_rcs_info P((Const char*, char*));extern void sigchld P((int));extern void srvrlog P((fserver*, char*));extern char* str3cat P((char*, char*, char*, char*));extern char* strcat P((char*, Const char*)); /* C */extern int strcmp P((Const char*, Const char*)); /* C */extern char* strdup P((Const char*));extern int strlen P((Const char*)); /* C */extern char* strnsave P((Const char*, int));extern char* strrchr P((Const char*, int)); /* C */extern char* strealloc P((char*, char *));extern char** strsplit P((char*, int, int));extern int switch_option P((char*));extern int switch_to_logfile P((char*));extern void do_task_notify(P_void);extern int timeout P((unsigned int, void (*fn)(), voidp));extern void timeout_mp(P_void);extern void umount_exported(P_void);extern int umount_fs P((char*));/*extern int unmount_node P((am_node*));extern int unmount_node_wrap P((voidp));*/extern void unregister_amq(P_void);extern void untimeout P((int));extern int valid_key P((char*));extern void wakeup P((voidp));extern void wakeup_task P((int,int,voidp));extern void wakeup_srvr P((fserver*));extern void write_mntent P((struct mntent*));#ifdef UPDATE_MTABextern void unlock_mntlist P((void));#else#define unlock_mntlist()#endif /* UPDATE_MTAB */#define ALLOC(ty) ((struct ty *) xmalloc(sizeof(struct ty)))/* * Options */struct am_opts { char *fs_glob; /* Smashed copy of global options */ char *fs_local; /* Expanded copy of local options */ char *fs_mtab; /* Mount table entry */ /* Other options ... */ char *opt_dev; char *opt_delay; char *opt_dir; char *opt_fs; char *opt_group; char *opt_mount; char *opt_opts; char *opt_remopts; char *opt_pref; char *opt_cache; char *opt_rfs; char *opt_rhost; char *opt_sublink; char *opt_type; char *opt_unmount; char *opt_user;};/* * File Handle * * This is interpreted by indexing the exported array * by fhh_id. * * The whole structure is mapped onto a standard fhandle_t * when transmitted. */struct am_fh { int fhh_pid; /* process id */ int fhh_id; /* map id */ int fhh_gen; /* generation number */};extern am_node *fh_to_mp P((nfs_fh*));extern am_node *fh_to_mp3 P((nfs_fh*,int*,int));extern void mp_to_fh P((am_node*, nfs_fh*));#define fh_to_mp2(fhp, rp) fh_to_mp3(fhp, rp, VLOOK_CREATE)extern int auto_fmount P((am_node *mp));extern int auto_fumount P((am_node *mp));#define MAX_READDIR_ENTRIES 16typedef char* (*vfs_match)P((am_opts*));typedef int (*vfs_init)P((mntfs*));typedef int (*vmount_fs)P((am_node*));typedef int (*vfmount_fs)P((mntfs*));typedef int (*vumount_fs)P((am_node*));typedef int (*vfumount_fs)P((mntfs*));typedef am_node*(*vlookuppn)P((am_node*, char*, int*, int));typedef int (*vreaddir)P((am_node*, nfscookie, dirlist*, entry*, int));typedef am_node*(*vreadlink)P((am_node*, int*));typedef void (*vmounted)P((mntfs*));typedef void (*vumounted)P((am_node*));typedef fserver*(*vffserver)P((mntfs*));struct am_ops { char *fs_type; vfs_match fs_match; vfs_init fs_init; vmount_fs mount_fs; vfmount_fs fmount_fs; vumount_fs umount_fs; vfumount_fs fumount_fs; vlookuppn lookuppn; vreaddir readdir; vreadlink readlink; vmounted mounted; vumounted umounted; vffserver ffserver; int fs_flags;};extern am_node *efs_lookuppn P((am_node*, char*, int*, int));extern int efs_readdir P((am_node*, nfscookie, dirlist*, entry*, int));#define VLOOK_CREATE 0x1#define VLOOK_DELETE 0x2#define FS_DIRECTORY 0x0001 /* This looks like a dir, not a link */#define FS_MBACKGROUND 0x0002 /* Should background this mount */#define FS_NOTIMEOUT 0x0004 /* Don't bother with timeouts */#define FS_MKMNT 0x0008 /* Need to make the mount point */#define FS_UBACKGROUND 0x0010 /* Unmount in background */#define FS_BACKGROUND (FS_MBACKGROUND|FS_UBACKGROUND)#define FS_DISCARD 0x0020 /* Discard immediately on last reference */#define FS_AMQINFO 0x0040 /* Amq is interested in this fs type */#ifdef SUNOS4_COMPATextern am_ops *sunos4_match P((am_opts*, char*, char*, char*, char*, char*));#endif /* SUNOS4_COMPAT */extern am_ops *ops_match P((am_opts*, char*, char*, char*, char*, char*));#include "fstype.h"/* * Per-mountpoint statistics */struct am_stats { time_t s_mtime; /* Mount time */ u_short s_uid; /* Uid of mounter */ int s_getattr; /* Count of getattrs */ int s_lookup; /* Count of lookups */ int s_readdir; /* Count of readdirs */ int s_readlink; /* Count of readlinks */ int s_statfs; /* Count of statfs */};typedef struct am_stats am_stats;/* * System statistics */struct amd_stats { int d_drops; /* Dropped requests */ int d_stale; /* Stale NFS handles */ int d_mok; /* Succesful mounts */ int d_merr; /* Failed mounts */ int d_uerr; /* Failed unmounts */};extern struct amd_stats amd_stats;/* * List of fileservers */struct fserver { qelem fs_q; /* List of fileservers */ int fs_refc; /* Number of references to this node */ char *fs_host; /* Normalized hostname of server */ struct sockaddr_in *fs_ip; /* Network address of server */ int fs_cid; /* Callout id */ int fs_pinger; /* Ping (keepalive) interval */ int fs_flags; /* Flags */ char *fs_type; /* File server type */ voidp fs_private; /* Private data */ void (*fs_prfree)(); /* Free private data */};#define FSF_VALID 0x0001 /* Valid information available */#define FSF_DOWN 0x0002 /* This fileserver is thought to be down */#define FSF_ERROR 0x0004 /* Permanent error has occured */#define FSF_WANT 0x0008 /* Want a wakeup call */#define FSF_PINGING 0x0010 /* Already doing pings */#define FSRV_ISDOWN(fs) (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_DOWN|FSF_VALID))#define FSRV_ISUP(fs) (((fs)->fs_flags & (FSF_DOWN|FSF_VALID)) == (FSF_VALID))/* * List of mounted filesystems */struct mntfs { qelem mf_q; /* List of mounted filesystems */ am_ops *mf_ops; /* Operations on this mountpoint */ am_opts *mf_fo; /* File opts */ char *mf_mount; /* "/a/kiska/home/kiska" */ char *mf_info; /* Mount info */ char *mf_auto; /* Automount opts */ char *mf_mopts; /* FS mount opts */ char *mf_remopts; /* Remote FS mount opts */ fserver *mf_server; /* File server */ int mf_flags; /* Flags */ int mf_error; /* Error code from background mount */ int mf_refc; /* Number of references to this node */ int mf_cid; /* Callout id */ void (*mf_prfree)(); /* Free private space */ voidp mf_private; /* Private - per-fs data */};#define MFF_MOUNTED 0x0001 /* Node is mounted */#define MFF_MOUNTING 0x0002 /* Mount is in progress */#define MFF_UNMOUNTING 0x0004 /* Unmount is in progress */#define MFF_RESTART 0x0008 /* Restarted node */#define MFF_MKMNT 0x0010 /* Delete this node's am_mount */#define MFF_ERROR 0x0020 /* This node failed to mount */#define MFF_LOGDOWN 0x0040 /* Logged that this mount is down */#define MFF_RSTKEEP 0x0080 /* Don't timeout this filesystem - restarted */#define MFF_WANTTIMO 0x0100 /* Need a timeout call when not busy *//* * Map of auto-mount points. */struct am_node { int am_mapno; /* Map number */ mntfs *am_mnt; /* Mounted filesystem */ char *am_name; /* "kiska" Name of this node */ char *am_path; /* "/home/kiska" Path of this node's mount point */ char *am_link; /* "/a/kiska/home/kiska/this/that" Link to sub-directory */ am_node *am_parent, /* Parent of this node */ *am_ysib, /* Younger sibling of this node */ *am_osib, /* Older sibling of this node */ *am_child; /* First child of this node */ struct attrstat am_attr; /* File attributes */#define am_fattr am_attr.attrstat_u.attributes int am_flags; /* Boolean flags */ int am_error; /* Specific mount error */ time_t am_ttl; /* Time to live */ int am_timeo_w; /* Wait interval */ int am_timeo; /* Timeout interval */ unsigned int am_gen; /* Generation number */ char *am_pref; /* Mount info prefix */ am_stats am_stats; /* Statistics gathering */};#define AMF_NOTIMEOUT 0x0001 /* This node never times out */#define AMF_ROOT 0x0002 /* This is a root node */#define ONE_HOUR (60 * 60) /* One hour in seconds *//* * The following values can be tuned... */#define ALLOWED_MOUNT_TIME 40 /* 40s for a mount */#define AM_TTL (5 * 60) /* Default cache period */#define AM_TTL_W (2 * 60) /* Default unmount interval */#define AM_PINGER 30 /* NFS ping interval for live systems */#define AFS_TIMEO 8 /* Default afs timeout - .8s */#define AFS_RETRANS ((ALLOWED_MOUNT_TIME*10+5*afs_timeo)/afs_timeo * 2) /* Default afs retrans - 1/10th seconds */#define RPC_XID_PORTMAP 0#define RPC_XID_MOUNTD 1#define RPC_XID_NFSPING 2#define RPC_XID_MASK (0x0f) /* 16 id's for now */#define MK_RPC_XID(type_id, uniq) ((type_id) | ((uniq) << 4))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -