# 1 "<built-in>" 1
# 1 "../../../../openafs/src/tools/dumpscan/dumptool.c" 1
/*
 * $Id$
 *
 * dumptool - A tool to manage MR-AFS dump files
 *
 * The dump file format ought to be documented _somewhere_, and
 * this seems like a good as a place as any ...
 *
 * A AFS dump file is marked off into a series of sections.  Each
 * section marked by a dump tag.  A tag is a single byte who's value
 * corresponds with the next section.  The sections are (in order):
 *
 * DUMPHEADER (tag 0x01)
 * VOLUMEHEADER (tag 0x02)
 * VNODE (tag 0x03)
 * DUMPEND (tag 0x04)
 *
 * Descriptions of the sections follow.  Note that in all cases, data is
 * stored in the dump in network byte order.
 *
 * DUMPHEADER:
 *
 * DUMPHEADER contains two parts: the DUMPMAGIC magic number (32 bits)
 * and the dump header itself.
 *
 * The dump header itself consists of a series of tagged values,
 * each tag marking out members of the DumpHeader structure.  The
 * routine ReadDumpHeader explains the specifics of these tags.
 *
 * VOLUMEHEADER:
 *
 * VOLUMEHEADER is a series of tagged values corresponding to the elements
 * of the VolumeDiskData structure.  See ReadVolumeHeader for more
 * information
 *
 * VNODE:
 *
 * The VNODE section is all vnodes contained in the volume (each vnode
 * itself is marked with the VNODE tag, so it's really a sequence of
 * VNODE tags, unlike other sections).
 *
 * Each vnode consists of three parts: the vnode number (32 bits), the
 * uniqifier (32 bits), and a tagged list of elements corresponding to
 * the elements of the VnodeDiskData structure.  See ScanVnodes for
 * more information.  Note that if file data is associated with a vnode,
 * it will be contained here.
 *
 * DUMPEND:
 *
 * The DUMPEND section consists of one part: the DUMPENDMAGIC magic
 * number (32 bits).
 *
 * Notes:
 *
 * The tagged elements are all ASCII letters, as opposed to the section
 * headers (which are 0x01, 0x02, ...).  Thus, an easy way to tell when
 * you've reached the end of an element sequence is to check to see if
 * the next tag is a printable character (this code tests for < 20).
 *
 * "vos dump" dumps the large vnode index, then the small vnode index,
 * so directories will appear first in the VNODE section.
 */

#if 0 /* expanded by -frewrite-includes */
#include <afsconfig.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h" 1
/* src/config/afsconfig.h.  Generated from afsconfig.h.in by configure.  */
/* src/config/afsconfig.h.in.  Generated from configure.ac by autoheader.  */

/* define to activate cache bypassing Unix client */
/* #undef AFS_CACHE_BYPASS */

/* define if you want to want namei fileserver */
/* #undef AFS_NAMEI_ENV */

/* define to disable the nfs translator */
/* #undef AFS_NONFSTRANS */

/* define if aops.writepage takes a struct writeback_control */
/* #undef AOP_WRITEPAGE_TAKES_WRITEBACK_CONTROL */

/* define if target is big endian */
/* #undef AUTOCONF_FOUND_BIGENDIAN */

/* define if you want to salvager to check bitmasks later */
/* #undef BITMAP_LATER */

/* define if dentry_open takes a path argument */
/* #undef DENTRY_OPEN_TAKES_PATH */

/* define if dentry.d_op->d_delete takes a const argument */
/* #undef DOP_D_DELETE_TAKES_CONST */

/* define if your dops.d_revalidate takes a nameidata argument */
/* #undef DOP_REVALIDATE_TAKES_NAMEIDATA */

/* define if your dops.d_revalidate takes an unsigned int argument */
/* #undef DOP_REVALIDATE_TAKES_UNSIGNED */

/* define if dentry->d_alias is an hlist */
/* #undef D_ALIAS_IS_HLIST */

/* define if dentry->d_count is an int */
/* #undef D_COUNT_INT */

/* define if d_path() takes a struct path argument */
/* #undef D_PATH_TAKES_STRUCT_PATH */

/* define to enable syscall table probes */
/* #undef ENABLE_LINUX_SYSCALL_PROBING */

/* define if you have redhat buildsystem */
/* #undef ENABLE_REDHAT_BUILDSYS */

/* Build rxgk support into applications */
#define ENABLE_RXGK 1

/* define if sys/param.h defines the endiness */
#define ENDIANESS_IN_SYS_PARAM_H 1

/* define if your linux kernel exports ia32_sys_call_table */
/* #undef EXPORTED_IA32_SYS_CALL_TABLE */

/* define if your kernel exports init_mm */
/* #undef EXPORTED_INIT_MM */

/* define if your linux kernel exports kallsyms address */
/* #undef EXPORTED_KALLSYMS_ADDRESS */

/* define if your linux kernel exports kallsyms */
/* #undef EXPORTED_KALLSYMS_SYMBOL */

/* define if key_type_keyring is exported */
/* #undef EXPORTED_KEY_TYPE_KEYRING */

/* define if proc_root_fs is exported */
/* #undef EXPORTED_PROC_ROOT_FS */

/* define if your linux kernel exports sys_call_table */
/* #undef EXPORTED_SYS_CALL_TABLE */

/* define if your linux kernel exports sys_chdir */
/* #undef EXPORTED_SYS_CHDIR */

/* define if your linux kernel exports sys_open */
/* #undef EXPORTED_SYS_OPEN */

/* define if tasklist_lock exported */
/* #undef EXPORTED_TASKLIST_LOCK */

/* define if encode_fh export op takes inode arguments */
/* #undef EXPORT_OP_ENCODE_FH_TAKES_INODES */

/* define if your fops.flush takes an fl_owner_t argument */
/* #undef FOP_FLUSH_TAKES_FL_OWNER_T */

/* define if your fops.fsync takes an dentry argument */
/* #undef FOP_FSYNC_TAKES_DENTRY */

/* define if your fops.fsync takes range arguments */
/* #undef FOP_FSYNC_TAKES_RANGE */

/* define if your get_sb_nodev needs a struct vfsmount argument */
/* #undef GET_SB_HAS_STRUCT_VFSMOUNT */

/* Define to 1 if you have the `add_error_table' function. */
/* #undef HAVE_ADD_ERROR_TABLE */

/* Define to 1 if you have the `add_to_error_table' function. */
#define HAVE_ADD_TO_ERROR_TABLE 1

/* Define to 1 if you have the `arc4random' function. */
#define HAVE_ARC4RANDOM 1

/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1

/* define if arpa/nameser_compat.h exists */
#define HAVE_ARPA_NAMESER_COMPAT_H 1

/* Define to 1 if you have the <arpa/nameser.h> header file. */
#define HAVE_ARPA_NAMESER_H 1

/* Define to 1 if you have the `asnprintf' function. */
/* #undef HAVE_ASNPRINTF */

/* Define to 1 if you have the `asprintf' function. */
#define HAVE_ASPRINTF 1

/* Define to 1 if you have the bswap16 function */
/* #undef HAVE_BSWAP16 */

/* Define to 1 if you have the bswap32 function */
/* #undef HAVE_BSWAP32 */

/* Define to 1 if you have the `chown' function. */
#define HAVE_CHOWN 1

/* Define to 1 if you have the <com_err.h> header file. */
#define HAVE_COM_ERR_H 1

/* Define to 1 if you have the <crt_externs.h> header file. */
/* #undef HAVE_CRT_EXTERNS_H */

/* Define to 1 if you have the <curses.h> header file. */
#define HAVE_CURSES_H 1

/* Define to 1 if you have the `daemon' function. */
#define HAVE_DAEMON 1

/* define if dcache_lock exists */
/* #undef HAVE_DCACHE_LOCK */

/* Define to 1 if you have the declaration of `h_errno', and to 0 if you
   don't. */
#define HAVE_DECL_H_ERRNO 1

/* Define to 1 if you have the <direct.h> header file. */
/* #undef HAVE_DIRECT_H */

/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
   */
#define HAVE_DIRENT_H 1

/* have a dirfd function/macro */
#define HAVE_DIRFD 1

/* Define if DIR has field dd_fd. */
/* #undef HAVE_DIR_DD_FD */

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if you have the `ecalloc' function. */
/* #undef HAVE_ECALLOC */

/* Define to 1 if you have the `emalloc' function. */
/* #undef HAVE_EMALLOC */

/* Define to 1 if you have the `encode_krb5_enc_tkt_part' function. */
/* #undef HAVE_ENCODE_KRB5_ENC_TKT_PART */

/* Define to 1 if you have the `encode_krb5_ticket' function. */
/* #undef HAVE_ENCODE_KRB5_TICKET */

/* Define to 1 if you have the `erealloc' function. */
/* #undef HAVE_EREALLOC */

/* Define to 1 if you have the `err' function. */
#define HAVE_ERR 1

/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1

/* Define to 1 if you have the `errx' function. */
#define HAVE_ERRX 1

/* Define to 1 if you have the <err.h> header file. */
#define HAVE_ERR_H 1

/* Define to 1 if you have the <et/com_err.h> header file. */
/* #undef HAVE_ET_COM_ERR_H */

/* Define to 1 if you have the `fchown' function. */
#define HAVE_FCHOWN 1

/* Define to 1 if you have the `fcntl' function. */
#define HAVE_FCNTL 1

/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1

/* Define to 1 if you have the `flock' function. */
#define HAVE_FLOCK 1

/* Define to 1 if the system has the type `fsblkcnt_t'. */
#define HAVE_FSBLKCNT_T 1

/* Define to 1 if you have the `fseeko64' function. */
/* #undef HAVE_FSEEKO64 */

/* Define to 1 if you have the `ftello64' function. */
/* #undef HAVE_FTELLO64 */

/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1

/* Define to 1 if you have the `getdtablesize' function. */
#define HAVE_GETDTABLESIZE 1

/* Define to 1 if you have the `getegid' function. */
#define HAVE_GETEGID 1

/* Define to 1 if you have the `geteuid' function. */
#define HAVE_GETEUID 1

/* Define to 1 if you have the `getgid' function. */
#define HAVE_GETGID 1

/* Define to 1 if you have the `gethostname' function. */
#define HAVE_GETHOSTNAME 1

/* Define to 1 if you have the `getopt' function. */
#define HAVE_GETOPT 1

/* Define to 1 if you have the `getprogname' function. */
#define HAVE_GETPROGNAME 1

/* Define to 1 if you have the `getrlimit' function. */
#define HAVE_GETRLIMIT 1

/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1

/* Define to 1 if you have the `getuid' function. */
#define HAVE_GETUID 1

/* Define to 1 if you have the <grp.h> header file. */
#define HAVE_GRP_H 1

/* Define to 1 if you have the <gssapi/gssapi.h> header file. */
#define HAVE_GSSAPI_GSSAPI_H 1

/* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */
#define HAVE_GSSAPI_GSSAPI_KRB5_H 1

/* Define to 1 if you have the `gss_krb5_ccache_name' function. */
/* #undef HAVE_GSS_KRB5_CCACHE_NAME */

/* Define to 1 if you have the `gss_pseudo_random' function. */
#define HAVE_GSS_PSEUDO_RANDOM 1

/* Define to 1 if the GSS-API library uses RFC-compliant OIDs. */
/* #undef HAVE_GSS_RFC_OIDS */

/* Define to 1 if you have the <ibm_svc/krb5_svc.h> header file. */
/* #undef HAVE_IBM_SVC_KRB5_SVC_H */

/* Define to 1 if you have the `inet_aton' function. */
#define HAVE_INET_ATON 1

/* Define to 1 if you have the `inet_ntop' function. */
#define HAVE_INET_NTOP 1

/* Define to 1 if you have the `inet_pton' function. */
#define HAVE_INET_PTON 1

/* Define to 1 if the system has the type `intptr_t'. */
#define HAVE_INTPTR_T 1

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* define if you have in_systm.h header file */
/* #undef HAVE_IN_SYSTM_H */

/* Define to 1 if you have the `issetugid' function. */
#define HAVE_ISSETUGID 1

/* Define to enable Kerberos features. */
#define HAVE_KERBEROS 1

/* Define to 1 if you have the <kerberosIV/krb.h> header file. */
/* #undef HAVE_KERBEROSIV_KRB_H */

/* Define to 1 if you have the <kerberosV/heim_err.h> header file. */
/* #undef HAVE_KERBEROSV_HEIM_ERR_H */

/* define if kmem_cache_t exists */
/* #undef HAVE_KMEM_CACHE_T */

/* Define to 1 if you have the `krb524_convert_creds_kdc' function. */
#define HAVE_KRB524_CONVERT_CREDS_KDC 1

/* Define to 1 if you have the `krb5_524_convert_creds' function. */
/* #undef HAVE_KRB5_524_CONVERT_CREDS */

/* Define to 1 if you have the `krb5_524_conv_principal' function. */
/* #undef HAVE_KRB5_524_CONV_PRINCIPAL */

/* Define to 1 if you have the `krb5_allow_weak_crypto' function. */
#define HAVE_KRB5_ALLOW_WEAK_CRYPTO 1

/* Define to 1 if you have the <krb5/com_err.h> header file. */
/* #undef HAVE_KRB5_COM_ERR_H */

/* Define to 1 if `keyblock' is a member of `krb5_creds'. */
/* #undef HAVE_KRB5_CREDS_KEYBLOCK */

/* Define to 1 if `keyblock.enctype' is a member of `krb5_creds'. */
/* #undef HAVE_KRB5_CREDS_KEYBLOCK_ENCTYPE */

/* Define to 1 if `session' is a member of `krb5_creds'. */
#define HAVE_KRB5_CREDS_SESSION 1

/* Define to 1 if you have the `krb5_c_encrypt' function. */
#define HAVE_KRB5_C_ENCRYPT 1

/* Define to 1 if you have the `krb5_decode_ticket' function. */
/* #undef HAVE_KRB5_DECODE_TICKET */

/* Define to 1 if you have the `krb5_enctype_enable' function. */
#define HAVE_KRB5_ENCTYPE_ENABLE 1

/* Define to 1 if you have the `krb5_free_error_message' function. */
#define HAVE_KRB5_FREE_ERROR_MESSAGE 1

/* Define to 1 if you have the `krb5_get_error_message' function. */
#define HAVE_KRB5_GET_ERROR_MESSAGE 1

/* Define to 1 if you have the `krb5_get_error_string' function. */
/* #undef HAVE_KRB5_GET_ERROR_STRING */

/* Define to 1 if you have the `krb5_get_err_txt' function. */
/* #undef HAVE_KRB5_GET_ERR_TXT */

/* Define to 1 if you have the `krb5_get_init_creds_opt_alloc' function. */
#define HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC 1

/* Define to 1 if you have the `krb5_get_init_creds_opt_set_out_ccache'
   function. */
/* #undef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_OUT_CCACHE */

/* Define to 1 if you have the `krb5_get_prompt_types' function. */
/* #undef HAVE_KRB5_GET_PROMPT_TYPES */

/* Define to 1 if you have the `krb5_gss_register_acceptor_identity' function.
   */
/* #undef HAVE_KRB5_GSS_REGISTER_ACCEPTOR_IDENTITY */

/* Define to 1 if you have the <krb5.h> header file. */
#define HAVE_KRB5_H 1

/* Define to 1 if you have the <krb5/krb5.h> header file. */
/* #undef HAVE_KRB5_KRB5_H */

/* Define to 1 if you have the `krb5_principal_get_comp_string' function. */
#define HAVE_KRB5_PRINCIPAL_GET_COMP_STRING 1

/* Define to 1 if you have the `krb5_princ_size' function. */
/* #undef HAVE_KRB5_PRINC_SIZE */

/* Define to 1 if `type' is a member of `krb5_prompt'. */
#define HAVE_KRB5_PROMPT_TYPE 1

/* Define to 1 if you have the `krb5_svc_get_msg' function. */
/* #undef HAVE_KRB5_SVC_GET_MSG */

/* Define if you have the libintl package. */
/* #undef HAVE_LIBINTL */

/* Define if your kernel has the bdi_init function */
/* #undef HAVE_LINUX_BDI_INIT */

/* Define if your kernel has the clear_inode function */
/* #undef HAVE_LINUX_CLEAR_INODE */

/* Define if your kernel has linux/completion.h */
/* #undef HAVE_LINUX_COMPLETION_H */

/* Define if your kernel has linux/config.h */
/* #undef HAVE_LINUX_CONFIG_H */

/* Define if your kernel has the current_kernel_time function */
/* #undef HAVE_LINUX_CURRENT_KERNEL_TIME */

/* Define if your kernel has the do_sync_read function */
/* #undef HAVE_LINUX_DO_SYNC_READ */

/* Define if your kernel has the d_alloc_anon function */
/* #undef HAVE_LINUX_D_ALLOC_ANON */

/* Define if your kernel has the d_count function */
/* #undef HAVE_LINUX_D_COUNT */

/* Define if your kernel has the d_make_root function */
/* #undef HAVE_LINUX_D_MAKE_ROOT */

/* Define to 1 if you have the <linux/errqueue.h> header file. */
/* #undef HAVE_LINUX_ERRQUEUE_H */

/* Define if your kernel has linux/exportfs.h */
/* #undef HAVE_LINUX_EXPORTFS_H */

/* Define if your kernel has the find_task_by_pid function */
/* #undef HAVE_LINUX_FIND_TASK_BY_PID */

/* Define if your kernel has linux/freezer.h */
/* #undef HAVE_LINUX_FREEZER_H */

/* Define if your kernel has the generic_file_aio_read function */
/* #undef HAVE_LINUX_GENERIC_FILE_AIO_READ */

/* Define if your kernel has the grab_cache_page_write_begin function */
/* #undef HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN */

/* Define if your kernel has the hlist_unhashed function */
/* #undef HAVE_LINUX_HLIST_UNHASHED */

/* Define if your kernel has the inode_setattr function */
/* #undef HAVE_LINUX_INODE_SETATTR */

/* Define if your kernel has the i_size_read function */
/* #undef HAVE_LINUX_I_SIZE_READ */

/* Define if your kernel has the kernel_setsockopt function */
/* #undef HAVE_LINUX_KERNEL_SETSOCKOPT */

/* Define if your kernel has linux/key-type.h */
/* #undef HAVE_LINUX_KEY_TYPE_H */

/* Define if your kernel has the kthread_run function */
/* #undef HAVE_LINUX_KTHREAD_RUN */

/* Define if kernel defines kuid_t */
/* #undef HAVE_LINUX_KUID_T */

/* Define if your kernel has the noop_fsync function */
/* #undef HAVE_LINUX_NOOP_FSYNC */

/* Define if your kernel has the PageChecked function */
/* #undef HAVE_LINUX_PAGECHECKED */

/* Define if your kernel has the PageFsMisc function */
/* #undef HAVE_LINUX_PAGEFSMISC */

/* Define if your kernel has the pagevec_lru_add_file function */
/* #undef HAVE_LINUX_PAGEVEC_LRU_ADD_FILE */

/* Define if your kernel has the page_follow_link function */
/* #undef HAVE_LINUX_PAGE_FOLLOW_LINK */

/* Define if your kernel has the page_offset function */
/* #undef HAVE_LINUX_PAGE_OFFSET */

/* Define if your kernel has the path_lookup function */
/* #undef HAVE_LINUX_PATH_LOOKUP */

/* Define if your kernel has the proc_create function */
/* #undef HAVE_LINUX_PROC_CREATE */

/* Define if your kernel has the rcu_read_lock function */
/* #undef HAVE_LINUX_RCU_READ_LOCK */

/* Define if your kernel has linux/semaphore.h */
/* #undef HAVE_LINUX_SEMAPHORE_H */

/* Define if your kernel has linux/seq_file.h */
/* #undef HAVE_LINUX_SEQ_FILE_H */

/* Define if your kernel has the set_nlink function */
/* #undef HAVE_LINUX_SET_NLINK */

/* Define if your kernel has the sock_create_kern function */
/* #undef HAVE_LINUX_SOCK_CREATE_KERN */

/* Define if your kernel has the splice_direct_to_actor function */
/* #undef HAVE_LINUX_SPLICE_DIRECT_TO_ACTOR */

/* Define if kernel defines struct vfs_path */
/* #undef HAVE_LINUX_STRUCT_VFS_PATH */

/* Define if your kernel has the svc_addr_in function */
/* #undef HAVE_LINUX_SVC_ADDR_IN */

/* Define if your kernel has the zero_user_segments function */
/* #undef HAVE_LINUX_ZERO_USER_SEGMENTS */

/* Define to 1 if you have the `localtime_r' function. */
#define HAVE_LOCALTIME_R 1

/* Define to 1 if the system has the type `long long'. */
#define HAVE_LONG_LONG 1

/* Define to 1 if you have the `lstat' function. */
#define HAVE_LSTAT 1

/* Define to 1 if you have the <math.h> header file. */
#define HAVE_MATH_H 1

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the `mkstemp' function. */
#define HAVE_MKSTEMP 1

/* define if you have mm_inline.h header file */
/* #undef HAVE_MM_INLINE_H */

/* Define to 1 if you have the <mntent.h> header file. */
/* #undef HAVE_MNTENT_H */

/* Define to 1 if you have the <ncurses.h> header file. */
#define HAVE_NCURSES_H 1

/* Define to 1 if you have the <ncurses/ncurses.h> header file. */
/* #undef HAVE_NCURSES_NCURSES_H */

/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */

/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1

/* Define to 1 if you have the <netinet/if_ether.h> header file. */
#define HAVE_NETINET_IF_ETHER_H 1

/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1

/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1

/* Define to 1 if the system has the type `off64_t'. */
/* #undef HAVE_OFF64_T */

/* define if you have pread() and pwrite() */
#define HAVE_PIO 1

/* define if you have preadv() and pwritev() */
/* #undef HAVE_PIOV */

/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1

/* define if you have POSIX regex library */
#define HAVE_POSIX_REGEX 1

/* Define to 1 if you have the `pread' function. */
#define HAVE_PREAD 1

/* Define to 1 if you have the `preadv' function. */
#define HAVE_PREADV 1

/* Define to 1 if you have the `preadv64' function. */
/* #undef HAVE_PREADV64 */

/* Define to 1 if you have the <pthread_np.h> header file. */
#define HAVE_PTHREAD_NP_H 1

/* Define to 1 if you have the `pthread_setname_np' function. */
/* #undef HAVE_PTHREAD_SETNAME_NP */

/* Define to 1 if you have the `pthread_set_name_np' function. */
#define HAVE_PTHREAD_SET_NAME_NP 1

/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1

/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1

/* Define to 1 if you have the `pwrite' function. */
#define HAVE_PWRITE 1

/* Define to 1 if you have the `pwritev' function. */
#define HAVE_PWRITEV 1

/* Define to 1 if you have the `pwritev64' function. */
/* #undef HAVE_PWRITEV64 */

/* Define to 1 if you have the `readv' function. */
#define HAVE_READV 1

/* Define to 1 if you have the `regcomp' function. */
#define HAVE_REGCOMP 1

/* Define to 1 if you have the `regerror' function. */
#define HAVE_REGERROR 1

/* Define to 1 if you have the `regexec' function. */
#define HAVE_REGEXEC 1

/* Define to 1 if you have the <regex.h> header file. */
#define HAVE_REGEX_H 1

/* Define to 1 if you have the <resolv.h> header file. */
#define HAVE_RESOLV_H 1

/* Define if resolv.h's res_state has the fields retrans/retry */
#define HAVE_RES_RETRANSRETRY 1

/* Define to 1 if the system has the type `sa_family_t'. */
#define HAVE_SA_FAMILY_T 1

/* Define to 1 if you have the <search.h> header file. */
#define HAVE_SEARCH_H 1

/* Define to 1 if you have the <security/pam_appl.h> header file. */
#define HAVE_SECURITY_PAM_APPL_H 1

/* Define to 1 if you have the <security/pam_modules.h> header file. */
#define HAVE_SECURITY_PAM_MODULES_H 1

/* Define to 1 if you have the `setenv' function. */
#define HAVE_SETENV 1

/* Define to 1 if you have the `setitimer' function. */
#define HAVE_SETITIMER 1

/* Define to 1 if you have the `setprogname' function. */
#define HAVE_SETPROGNAME 1

/* define if we can receive socket errors via IP_RECVERR */
/* #undef HAVE_SETSOCKOPT_IP_RECVERR */

/* Define to 1 if you have the `setvbuf' function. */
#define HAVE_SETVBUF 1

/* Define to 1 if you have the `sigaction' function. */
#define HAVE_SIGACTION 1

/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1

/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1

/* Define to 1 if the system has the type `socklen_t'. */
#define HAVE_SOCKLEN_T 1

/* Define to 1 if the system has the type `ssize_t'. */
#define HAVE_SSIZE_T 1

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the <stdio_ext.h> header file. */
/* #undef HAVE_STDIO_EXT_H */

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1

/* Define to 1 if you have the `strcasestr' function. */
#define HAVE_STRCASESTR 1

/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1

/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1

/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1

/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the `strlcat' function. */
#define HAVE_STRLCAT 1

/* Define to 1 if you have the `strlcpy' function. */
#define HAVE_STRLCPY 1

/* Define to 1 if you have the `strndup' function. */
#define HAVE_STRNDUP 1

/* Define to 1 if you have the `strnlen' function. */
#define HAVE_STRNLEN 1

/* Define to 1 if you have the `strsep' function. */
#define HAVE_STRSEP 1

/* Define to 1 if the system has the type `struct addrinfo'. */
#define HAVE_STRUCT_ADDRINFO 1

/* Define to 1 if your compiler supports labels in structs. */
/* #undef HAVE_STRUCT_LABEL_SUPPORT */

/* Define if struct rusage has field ru_idrss. */
#define HAVE_STRUCT_RUSAGE_RU_IDRSS 1

/* Define to 1 if the system has the type `struct sockaddr'. */
#define HAVE_STRUCT_SOCKADDR 1

/* Define to 1 if the system has the type `struct sockaddr_storage'. */
#define HAVE_STRUCT_SOCKADDR_STORAGE 1

/* Define to 1 if `st_ctimensec' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_CTIMENSEC */

/* Define to 1 if `st_ctimespec' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_CTIMESPEC 1

/* Define to 1 if the system has the type `struct winsize'. */
#define HAVE_STRUCT_WINSIZE 1

/* define if your C compiler has __sync_add_and_fetch */
#define HAVE_SYNC_FETCH_AND_ADD 1

/* Define to 1 if you have the `sysconf' function. */
#define HAVE_SYSCONF 1

/* Define to 1 if you have the `sysctl' function. */
#define HAVE_SYSCTL 1

/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1

/* Define to 1 if you have the <sys/bitypes.h> header file. */
/* #undef HAVE_SYS_BITYPES_H */

/* Define to 1 if you have the <sys/bswap.h> header file. */
/* #undef HAVE_SYS_BSWAP_H */

/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
   */
/* #undef HAVE_SYS_DIR_H */

/* Define to 1 if you have the <sys/dk.h> header file. */
/* #undef HAVE_SYS_DK_H */

/* Define to 1 if you have the <sys/fcntl.h> header file. */
#define HAVE_SYS_FCNTL_H 1

/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1

/* Define to 1 if you have the <sys/fstyp.h> header file. */
/* #undef HAVE_SYS_FSTYP_H */

/* Define to 1 if you have the <sys/fs_types.h> header file. */
/* #undef HAVE_SYS_FS_TYPES_H */

/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1

/* Define to 1 if you have the <sys/ipc.h> header file. */
#define HAVE_SYS_IPC_H 1

/* Define to 1 if you have the <sys/lockf.h> header file. */
#define HAVE_SYS_LOCKF_H 1

/* Define to 1 if you have the <sys/map.h> header file. */
/* #undef HAVE_SYS_MAP_H */

/* Define to 1 if you have the <sys/mntent.h> header file. */
/* #undef HAVE_SYS_MNTENT_H */

/* Define to 1 if you have the <sys/mnttab.h> header file. */
/* #undef HAVE_SYS_MNTTAB_H */

/* Define to 1 if you have the <sys/mount.h> header file. */
#define HAVE_SYS_MOUNT_H 1

/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
   */
/* #undef HAVE_SYS_NDIR_H */

/* Define to 1 if you have the <sys/pag.h> header file. */
/* #undef HAVE_SYS_PAG_H */

/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1

/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1

/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1

/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1

/* Define to 1 if you have the <sys/statfs.h> header file. */
/* #undef HAVE_SYS_STATFS_H */

/* Define to 1 if you have the <sys/statvfs.h> header file. */
#define HAVE_SYS_STATVFS_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/sysctl.h> header file. */
#define HAVE_SYS_SYSCTL_H 1

/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1

/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1

/* Define to 1 if you have the <sys/vfs.h> header file. */
/* #undef HAVE_SYS_VFS_H */

/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1

/* Define to 1 if you have the `tdelete' function. */
#define HAVE_TDELETE 1

/* Define to 1 if you have the `tdestroy' function. */
/* #undef HAVE_TDESTROY */

/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1

/* Define to 1 if you have the `tfind' function. */
#define HAVE_TFIND 1

/* Define to 1 if you have the `timegm' function. */
#define HAVE_TIMEGM 1

/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1

/* define if your kernel has the try_to_freeze function */
/* #undef HAVE_TRY_TO_FREEZE */

/* Define to 1 if you have the `tsearch' function. */
#define HAVE_TSEARCH 1

/* Define to 1 if you have the `twalk' function. */
#define HAVE_TWALK 1

/* Define to 1 if you have the <ucontext.h> header file. */
#define HAVE_UCONTEXT_H 1

/* Define to 1 if the system has the type `uintptr_t'. */
#define HAVE_UINTPTR_T 1

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if you have the `unsetenv' function. */
#define HAVE_UNSETENV 1

/* define if you have old ndir.h */
/* #undef HAVE_USR_OLD_USR_INCLUDE_NDIR_H */

/* Define to 1 if you have the `uuid_generate' function. */
/* #undef HAVE_UUID_GENERATE */

/* Define to 1 if you have the <uuid/uuid.h> header file. */
/* #undef HAVE_UUID_UUID_H */

/* Define to 1 if you have the `vasnprintf' function. */
/* #undef HAVE_VASNPRINTF */

/* Define to 1 if you have the `vasprintf' function. */
#define HAVE_VASPRINTF 1

/* Define to 1 if you have the `verr' function. */
#define HAVE_VERR 1

/* Define to 1 if you have the `verrx' function. */
#define HAVE_VERRX 1

/* define if struct ufsvfs has vfs_dqrwlock */
/* #undef HAVE_VFS_DQRWLOCK */

/* define if the function vn_renamepath exists */
/* #undef HAVE_VN_RENAMEPATH */

/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1

/* Define to 1 if you have the `vsyslog' function. */
#define HAVE_VSYSLOG 1

/* Define to 1 if you have the `vwarn' function. */
#define HAVE_VWARN 1

/* Define to 1 if you have the `vwarnx' function. */
#define HAVE_VWARNX 1

/* Define to 1 if you have the `warn' function. */
#define HAVE_WARN 1

/* Define to 1 if you have the `warnx' function. */
#define HAVE_WARNX 1

/* Define to 1 if you have the <windows.h> header file. */
/* #undef HAVE_WINDOWS_H */

/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__ 1

/* define if hlist iterators don't need a node parameter */
/* #undef HLIST_ITERATOR_NO_NODE */

/* define to disable some gcc warnings in warnings-as-errors mode */
/* #undef IGNORE_SOME_GCC_WARNINGS */

/* define if INIT_WORK takes a data (3rd) argument */
/* #undef INIT_WORK_HAS_DATA */

/* define if your setattr return return non-void */
/* #undef INODE_SETATTR_NOT_VOID */

/* define if your iops.create takes a bool argument */
/* #undef IOP_CREATE_TAKES_BOOL */

/* define if your iops.create takes a nameidata argument */
/* #undef IOP_CREATE_TAKES_NAMEIDATA */

/* define if inode.i_op->create takes a umode_t argument */
/* #undef IOP_CREATE_TAKES_UMODE_T */

/* define if your iops.lookup takes a nameidata argument */
/* #undef IOP_LOOKUP_TAKES_NAMEIDATA */

/* define if your iops.lookup takes an unsigned int argument */
/* #undef IOP_LOOKUP_TAKES_UNSIGNED */

/* define if inode.i_op->mkdir takes a umode_t argument */
/* #undef IOP_MKDIR_TAKES_UMODE_T */

/* define if your iops.permission takes a flags argument */
/* #undef IOP_PERMISSION_TAKES_FLAGS */

/* define if your iops.permission takes a nameidata argument */
/* #undef IOP_PERMISSION_TAKES_NAMEIDATA */

/* define if your iops.put_link takes a cookie */
/* #undef IOP_PUT_LINK_TAKES_COOKIE */

/* define if irix has memcpy and friends */
/* #undef IRIX_HAS_MEM_FUNCS */

/* define if key_alloc takes credentials */
/* #undef KEY_ALLOC_NEEDS_CRED */

/* define if key_alloc takes a struct task * */
/* #undef KEY_ALLOC_NEEDS_STRUCT_TASK */

/* define if kmap_atomic takes no km_type argument */
/* #undef KMAP_ATOMIC_TAKES_NO_KM_TYPE */

/* define if kmem_cache_create constructor takes a single void ptr */
/* #undef KMEM_CACHE_CTOR_TAKES_VOID */

/* define for new kmem_cache init function parameters */
/* #undef KMEM_CACHE_INIT */

/* define if kmem_cache_create takes a destructor argument */
/* #undef KMEM_CACHE_TAKES_DTOR */

/* Define if you have the libintl package. */
/* #undef LIBINTL */

/* define if kernel functions like generic_file_aio_read use non-vectorized
   i/o */
/* #undef LINUX_HAS_NONVECTOR_AIO */

/* define if your linux kernel uses 5 arguments for sock_create */
/* #undef LINUX_KERNEL_SOCK_CREATE_V */

/* define if your kernel has keyring support */
/* #undef LINUX_KEYRING_SUPPORT */

/* define if your refrigerator takes PF_FREEZE */
/* #undef LINUX_REFRIGERATOR_TAKES_PF_FREEZE */

/* Define to the sub-directory in which libtool stores uninstalled libraries.
   */
#define LT_OBJDIR ".libs/"

/* define if kernel uses new export ops */
/* #undef NEW_EXPORT_OPS */

/* turn on lock debugging in opr */
/* #undef OPR_DEBUG_LOCKS */

/* Name of package */
#define PACKAGE "openafs"

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "openafs-bugs@openafs.org"

/* Define to the full name of this package. */
#define PACKAGE_NAME "OpenAFS"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "OpenAFS BP--1.6.x-4371-g69418e-dirty"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "openafs"

/* Define to the home page for this package. */
#define PACKAGE_URL "http://www.openafs.org/"

/* Define to the version of this package. */
#define PACKAGE_VERSION "BP--1.6.x-4371-g69418e-dirty"

/* Define to const if PAM uses const in pam_get_item, empty otherwise. */
#define PAM_CONST const

/* define if your kernel uses 3 arguments for posix_lock_file */
/* #undef POSIX_LOCK_FILE_WAIT_ARG */

/* define if posix_test_lock takes a conflict argument */
/* #undef POSIX_TEST_LOCK_CONFLICT_ARG */

/* define if posix_test_lock returns the conflicting lock */
/* #undef POSIX_TEST_LOCK_RETURNS_CONFLICT */

/* define if printf and friends understand the %z length modifier */
#define PRINTF_TAKES_Z_LEN 1

/* Number of arguments required by pthread_setname_np() function */
/* #undef PTHREAD_SETNAME_NP_ARGS */

/* Define if kernel read_descriptor_t has the buf element */
/* #undef READ_DESCRIPTOR_T_HAS_BUF */

/* define if your recalc_sigpending takes void */
/* #undef RECALC_SIGPENDING_TAKES_VOID */

/* define if register_sysctl_table has no insert_at head flag */
/* #undef REGISTER_SYSCTL_TABLE_NOFLAG */

/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void

/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 8

/* The size of `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4

/* The size of `unsigned long', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG 8

/* The size of `unsigned long long', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG_LONG 8

/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 8

/* define if solookup takes a sockparams** */
/* #undef SOLOOKUP_TAKES_SOCKPARAMS */

/* define if your statfs takes a dentry argument */
/* #undef STATFS_TAKES_DENTRY */

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

/* Define if kernel struct address_space_operations has the write_begin
   element */
/* #undef STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_WRITE_BEGIN */

/* Define if kernel struct backing_dev_info has the name element */
/* #undef STRUCT_BACKING_DEV_INFO_HAS_NAME */

/* Define if kernel struct cred has the session_keyring element */
/* #undef STRUCT_CRED_HAS_SESSION_KEYRING */

/* Define if kernel struct ctl_table has the ctl_name element */
/* #undef STRUCT_CTL_TABLE_HAS_CTL_NAME */

/* Define if kernel struct dentry_operations has the d_automount element */
/* #undef STRUCT_DENTRY_OPERATIONS_HAS_D_AUTOMOUNT */

/* Define if kernel struct file_operations has the flock element */
/* #undef STRUCT_FILE_OPERATIONS_HAS_FLOCK */

/* Define if kernel struct file_operations has the iterate element */
/* #undef STRUCT_FILE_OPERATIONS_HAS_ITERATE */

/* Define if kernel struct file_operations has the sendfile element */
/* #undef STRUCT_FILE_OPERATIONS_HAS_SENDFILE */

/* define if struct file_operations has splice functions */
/* #undef STRUCT_FILE_OPERATIONS_HAS_SPLICE */

/* Define if kernel struct file_system_type has the mount element */
/* #undef STRUCT_FILE_SYSTEM_TYPE_HAS_MOUNT */

/* define if struct fs has fs_rolled */
/* #undef STRUCT_FS_HAS_FS_ROLLED */

/* Define if kernel struct inode has the i_alloc_sem element */
/* #undef STRUCT_INODE_HAS_I_ALLOC_SEM */

/* Define if kernel struct inode has the i_blkbits element */
/* #undef STRUCT_INODE_HAS_I_BLKBITS */

/* Define if kernel struct inode has the i_blksize element */
/* #undef STRUCT_INODE_HAS_I_BLKSIZE */

/* Define if kernel struct inode has the i_mutex element */
/* #undef STRUCT_INODE_HAS_I_MUTEX */

/* Define if kernel struct inode has the i_security element */
/* #undef STRUCT_INODE_HAS_I_SECURITY */

/* Define if kernel struct inode_operations has the truncate element */
/* #undef STRUCT_INODE_OPERATIONS_HAS_TRUNCATE */

/* Define if kernel struct key_type has the instantiate_prep element */
/* #undef STRUCT_KEY_TYPE_HAS_INSTANTIATE_PREP */

/* Define if kernel struct key_type has the preparse element */
/* #undef STRUCT_KEY_TYPE_HAS_PREPARSE */

/* Define if kernel struct nameidata has the path element */
/* #undef STRUCT_NAMEIDATA_HAS_PATH */

/* Define if kernel struct proc_dir_entry has the owner element */
/* #undef STRUCT_PROC_DIR_ENTRY_HAS_OWNER */

/* define if you struct sockaddr sa_len */
#define STRUCT_SOCKADDR_HAS_SA_LEN 1

/* Define if kernel struct super_block has the s_bdi element */
/* #undef STRUCT_SUPER_BLOCK_HAS_S_BDI */

/* Define if kernel struct super_block has the s_d_op element */
/* #undef STRUCT_SUPER_BLOCK_HAS_S_D_OP */

/* Define if kernel struct super_operations has the alloc_inode element */
/* #undef STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE */

/* Define if kernel struct super_operations has the evict_inode element */
/* #undef STRUCT_SUPER_OPERATIONS_HAS_EVICT_INODE */

/* Define if kernel struct task_struct has the cred element */
/* #undef STRUCT_TASK_STRUCT_HAS_CRED */

/* Define if kernel struct task_struct has the exit_state element */
/* #undef STRUCT_TASK_STRUCT_HAS_EXIT_STATE */

/* Define if kernel struct task_struct has the parent element */
/* #undef STRUCT_TASK_STRUCT_HAS_PARENT */

/* Define if kernel struct task_struct has the real_parent element */
/* #undef STRUCT_TASK_STRUCT_HAS_REAL_PARENT */

/* Define if kernel struct task_struct has the rlim element */
/* #undef STRUCT_TASK_STRUCT_HAS_RLIM */

/* Define if kernel struct task_struct has the sig element */
/* #undef STRUCT_TASK_STRUCT_HAS_SIG */

/* Define if kernel struct task_struct has the sighand element */
/* #undef STRUCT_TASK_STRUCT_HAS_SIGHAND */

/* Define if kernel struct task_struct has the sigmask_lock element */
/* #undef STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK */

/* define if your struct task_struct has signal->rlim */
/* #undef STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM */

/* Define if kernel struct task_struct has the tgid element */
/* #undef STRUCT_TASK_STRUCT_HAS_TGID */

/* Define if kernel struct task_struct has the thread_info element */
/* #undef STRUCT_TASK_STRUCT_HAS_THREAD_INFO */

/* define if you want to have support for nested pts groups */
/* #undef SUPERGROUPS */

/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1

/* define if your kernel has a usable symlink cache API */
/* #undef USABLE_KERNEL_PAGE_SYMLINK_CACHE */

/* Enable extensions on AIX 3, Interix.  */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
# 1211 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
/* Enable GNU extensions on systems that have them.  */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
# 1215 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
/* Enable threading extensions on Solaris.  */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
# 1219 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
/* Enable extensions on HP NonStop.  */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
# 1223 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
/* Enable general extensions on Solaris.  */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
# 1227 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"


/* define if you want to use UNIX sockets for fssync. */
#define USE_UNIX_SOCKETS 1

/* Version number of package */
#define VERSION "BP--1.6.x-4371-g69418e-dirty"

/* Define if signal handlers return void. */
#define VOID_RETSIGTYPE 1

/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
   `char[]'. */
#define YYTEXT_POINTER 1

/* Define to 1 if on MINIX. */
/* #undef _MINIX */

/* Define to 2 if the system does not provide POSIX.1 features except with
   this defined. */
/* #undef _POSIX_1_SOURCE */

/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */

/* Define to the type of a signed integer type wide enough to hold a pointer,
   if such a type exists, and if the system does not define it. */
/* #undef intptr_t */

/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */

/* Define to int if <signal.h> does not define. */
/* #undef sig_atomic_t */

/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */

/* Define to int if <sys/socket.h> does not define. */
/* #undef socklen_t */

/* Define to `int' if <sys/types.h> does not define. */
/* #undef ssize_t */

/* Define to the type of an unsigned integer type wide enough to hold a
   pointer, if such a type exists, and if the system does not define it. */
/* #undef uintptr_t */


#define HAVE_RES_SEARCH 1
#define STRUCT_SOCKADDR_HAS_SA_LEN 1
#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
# if ENDIANESS_IN_SYS_PARAM_H
#  ifndef KERNEL
#if 0 /* expanded by -frewrite-includes */
#   include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 1282 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#if 0 /* expanded by -frewrite-includes */
#   include <sys/param.h>
#endif /* expanded by -frewrite-includes */
# 1283 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#   if BYTE_ORDER == BIG_ENDIAN
#   define WORDS_BIGENDIAN 1
#   endif
# 1286 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#  else
# 1287 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#   if defined(AUTOCONF_FOUND_BIGENDIAN)
#    define WORDS_BIGENDIAN 1
#   else
# 1290 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
/* #    undef WORDS_BIGENDIAN */
#   endif
# 1292 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#  endif
# 1293 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
# else
# 1294 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#  if defined(AUTOCONF_FOUND_BIGENDIAN)
#   define WORDS_BIGENDIAN 1
#  else
# 1297 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
/* #   undef WORDS_BIGENDIAN */
#  endif
# 1299 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
# endif
# 1300 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#else
# 1301 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
# if defined(__BIG_ENDIAN__)
#  define WORDS_BIGENDIAN 1
# else
# 1304 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
/* #  undef WORDS_BIGENDIAN */
# endif
# 1306 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#endif
# 1307 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#ifdef UKERNEL
/*
 * Always use 64-bit file offsets for UKERNEL code. Needed for UKERNEL stuff to
 * play nice with some other interfaces like FUSE. We technically only would
 * need to define this when building for such interfaces, but set it always to
 * try and reduce potential confusion. 
 */
#define _FILE_OFFSET_BITS 64
#define AFS_CACHE_VNODE_PATH
#endif
# 1317 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"

/* #undef AFS_NAMEI_ENV */
/* #undef BITMAP_LATER */
/* #undef FAST_RESTART */
/* #undef DEFINED_FOR_EACH_PROCESS */
/* #undef DEFINED_PREV_TASK */
/* #undef EXPORTED_SYS_CALL_TABLE */
/* #undef EXPORTED_IA32_SYS_CALL_TABLE */
/* #undef IRIX_HAS_MEM_FUNCS */
/* #undef RECALC_SIGPENDING_TAKES_VOID */
/* #undef STRUCT_FS_HAS_FS_ROLLED */
/* #undef ssize_t */
/* glue for RedHat kernel bug */
/* #undef ENABLE_REDHAT_BUILDSYS */
#if defined(ENABLE_REDHAT_BUILDSYS) && defined(KERNEL) && defined(REDHAT_FIX)
#if 0 /* expanded by -frewrite-includes */
#include "redhat-fix.h"
#endif /* expanded by -frewrite-includes */
# 1333 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#endif
# 1334 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"

#ifdef VOID_RETSIGTYPE
#define SIGRETURN(x) return
#else
# 1338 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
#define SIGRETURN(x) return (RETSIGTYPE)(x)
#endif
# 1340 "/usr/home/kaduk/openafs/build/src/config/afsconfig.h"
# 65 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/param.h" 1
#ifndef	AFS_PARAM_H
#define	AFS_PARAM_H

/* Machine / Operating system information */
#define SYS_NAME	"amd64_fbsd_110"
#define SYS_NAME_ID	SYS_NAME_ID_amd64_fbsd_110

#define AFSLITTLE_ENDIAN    1
#define AFS_HAVE_FFS        1	/* Use system's ffs. */
#define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
#define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */


#ifndef UKERNEL
/* This section for kernel libafs compiles only */

#ifndef IGNORE_STDS_H
#if 0 /* expanded by -frewrite-includes */
#include <sys/param.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/param.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1989, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)param.h	8.3 (Berkeley) 4/4/95
 * $FreeBSD: head/sys/sys/param.h 266904 2014-05-30 20:56:28Z pfg $
 */

#ifndef _SYS_PARAM_H_
#define _SYS_PARAM_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_null.h" 1 3 4
/*-
 * Copyright (c) 2003 Marcel Moolenaar
 * 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 ``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 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: head/sys/sys/_null.h 228918 2011-12-27 21:36:31Z theraven $
 */

#ifndef NULL

#if !defined(__cplusplus)
#define	NULL	((void *)0)
#else
# 34 "/usr/include/sys/_null.h" 3 4
#if __cplusplus >= 201103L
#define	NULL	nullptr
#elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
# 37 "/usr/include/sys/_null.h" 3 4
#define	NULL	__null
#else
# 39 "/usr/include/sys/_null.h" 3 4
#if defined(__LP64__)
#define	NULL	(0L)
#else
# 42 "/usr/include/sys/_null.h" 3 4
#define	NULL	0
#endif	/* __LP64__ */
# 44 "/usr/include/sys/_null.h" 3 4
#endif	/* __GNUG__ */
# 45 "/usr/include/sys/_null.h" 3 4
#endif	/* !__cplusplus */
# 46 "/usr/include/sys/_null.h" 3 4

#endif
# 48 "/usr/include/sys/_null.h" 3 4
# 42 "/usr/include/sys/param.h" 2 3 4

#define	BSD	199506		/* System version (year & month). */
#define BSD4_3	1
#define BSD4_4	1

/* 
 * __FreeBSD_version numbers are documented in the Porter's Handbook.
 * If you bump the version for any reason, you should update the documentation
 * there.
 * Currently this lives here in the doc/ repository:
 *
 *	head/en_US.ISO8859-1/books/porters-handbook/book.xml
 *
 * scheme is:  <major><two digit minor>Rxx
 *		'R' is in the range 0 to 4 if this is a release branch or
 *		x.0-CURRENT before RELENG_*_0 is created, otherwise 'R' is
 *		in the range 5 to 9.
 */
#undef __FreeBSD_version
#define __FreeBSD_version 1100022	/* Master, propagated to newvers */

/*
 * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
 * which by definition is always true on FreeBSD. This macro is also defined
 * on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD.
 *
 * It is tempting to use this macro in userland code when we want to enable
 * kernel-specific routines, and in fact it's fine to do this in code that
 * is part of FreeBSD itself.  However, be aware that as presence of this
 * macro is still not widespread (e.g. older FreeBSD versions, 3rd party
 * compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in
 * external applications without also checking for __FreeBSD__ as an
 * alternative.
 */
#undef __FreeBSD_kernel__
#define __FreeBSD_kernel__

#ifdef _KERNEL
#define	P_OSREL_SIGWAIT		700000
#define	P_OSREL_SIGSEGV		700004
#define	P_OSREL_MAP_ANON	800104

#define	P_OSREL_MAJOR(x)	((x) / 100000)
#endif
# 86 "/usr/include/sys/param.h" 3 4

#ifndef LOCORE
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/types.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1991, 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)types.h	8.6 (Berkeley) 2/19/95
 * $FreeBSD: head/sys/sys/types.h 255219 2013-09-05 00:09:56Z pjd $
 */

#ifndef _SYS_TYPES_H_
#define	_SYS_TYPES_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/cdefs.h" 1 3 4
/*-
 * Copyright (c) 1991, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * Berkeley Software Design, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 * $FreeBSD: head/sys/sys/cdefs.h 251804 2013-06-16 10:48:47Z ed $
 */

#ifndef	_SYS_CDEFS_H_
#define	_SYS_CDEFS_H_

/*
 * Testing against Clang-specific extensions.
 */

#ifndef	__has_extension
#define	__has_extension		__has_feature
#endif
# 46 "/usr/include/sys/cdefs.h" 3 4
#ifndef	__has_feature
#define	__has_feature(x)	0
#endif
# 49 "/usr/include/sys/cdefs.h" 3 4
#ifndef	__has_include
#define	__has_include(x)	0
#endif
# 52 "/usr/include/sys/cdefs.h" 3 4
#ifndef	__has_builtin
#define	__has_builtin(x)	0
#endif
# 55 "/usr/include/sys/cdefs.h" 3 4

#if defined(__cplusplus)
#define	__BEGIN_DECLS	extern "C" {
#define	__END_DECLS	}
#else
# 60 "/usr/include/sys/cdefs.h" 3 4
#define	__BEGIN_DECLS
#define	__END_DECLS
#endif
# 63 "/usr/include/sys/cdefs.h" 3 4

/*
 * This code has been put in place to help reduce the addition of
 * compiler specific defines in FreeBSD code.  It helps to aid in
 * having a compiler-agnostic source tree.
 */

#if defined(__GNUC__) || defined(__INTEL_COMPILER)

#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
#define __GNUCLIKE_ASM 3
#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
#else
# 76 "/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE_ASM 2
#endif
# 78 "/usr/include/sys/cdefs.h" 3 4
#define __GNUCLIKE___TYPEOF 1
#define __GNUCLIKE___OFFSETOF 1
#define __GNUCLIKE___SECTION 1

#ifndef __INTEL_COMPILER
# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
#endif
# 85 "/usr/include/sys/cdefs.h" 3 4

#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
    && __INTEL_COMPILER < 800
#  undef __GNUCLIKE_BUILTIN_CONSTANT_P
# endif
# 91 "/usr/include/sys/cdefs.h" 3 4

#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
# define __GNUCLIKE_BUILTIN_VARARGS 1
# define __GNUCLIKE_BUILTIN_STDARG 1
# define __GNUCLIKE_BUILTIN_VAALIST 1
#endif
# 97 "/usr/include/sys/cdefs.h" 3 4

#if defined(__GNUC__)
# define __GNUC_VA_LIST_COMPATIBILITY 1
#endif
# 101 "/usr/include/sys/cdefs.h" 3 4

/*
 * Compiler memory barriers, specific to gcc and clang.
 */
#if defined(__GNUC__)
#define	__compiler_membar()	__asm __volatile(" " : : : "memory")
#endif
# 108 "/usr/include/sys/cdefs.h" 3 4

#ifndef __INTEL_COMPILER
# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
# define __GNUCLIKE_MATH_BUILTIN_RELOPS
#endif
# 113 "/usr/include/sys/cdefs.h" 3 4

#define __GNUCLIKE_BUILTIN_MEMCPY 1

/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
#define __CC_SUPPORTS_INLINE 1
#define __CC_SUPPORTS___INLINE 1
#define __CC_SUPPORTS___INLINE__ 1

#define __CC_SUPPORTS___FUNC__ 1
#define __CC_SUPPORTS_WARNING 1

#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */

#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1

#endif /* __GNUC__ || __INTEL_COMPILER */
# 129 "/usr/include/sys/cdefs.h" 3 4

/*
 * Macro to test if we're using a specific version of gcc or later.
 */
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
#define	__GNUC_PREREQ__(ma, mi)	\
	(__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
#else
# 137 "/usr/include/sys/cdefs.h" 3 4
#define	__GNUC_PREREQ__(ma, mi)	0
#endif
# 139 "/usr/include/sys/cdefs.h" 3 4

/*
 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
 * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
 * mode -- there must be no spaces between its arguments, and for nested
 * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
 * concatenate double-quoted strings produced by the __STRING macro, but
 * this only works with ANSI C.
 *
 * __XSTRING is like __STRING, but it expands any macros in its argument
 * first.  It is only available with ANSI C.
 */
#if defined(__STDC__) || defined(__cplusplus)
#define	__P(protos)	protos		/* full-blown ANSI C */
#define	__CONCAT1(x,y)	x ## y
#define	__CONCAT(x,y)	__CONCAT1(x,y)
#define	__STRING(x)	#x		/* stringify without expanding x */
#define	__XSTRING(x)	__STRING(x)	/* expand x, then stringify */

#define	__const		const		/* define reserved names to standard */
#define	__signed	signed
#define	__volatile	volatile
#if defined(__cplusplus)
#define	__inline	inline		/* convert to C++ keyword */
#else
# 165 "/usr/include/sys/cdefs.h" 3 4
#if !(defined(__CC_SUPPORTS___INLINE))
#define	__inline			/* delete GCC keyword */
#endif /* ! __CC_SUPPORTS___INLINE */
# 168 "/usr/include/sys/cdefs.h" 3 4
#endif /* !__cplusplus */
# 169 "/usr/include/sys/cdefs.h" 3 4

#else	/* !(__STDC__ || __cplusplus) */
# 171 "/usr/include/sys/cdefs.h" 3 4
#define	__P(protos)	()		/* traditional C preprocessor */
#define	__CONCAT(x,y)	x/**/y
#define	__STRING(x)	"x"

#if !defined(__CC_SUPPORTS___INLINE)
#define	__const				/* delete pseudo-ANSI C keywords */
#define	__inline
#define	__signed
#define	__volatile
/*
 * In non-ANSI C environments, new programs will want ANSI-only C keywords
 * deleted from the program and old programs will want them left alone.
 * When using a compiler other than gcc, programs using the ANSI C keywords
 * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
 * When using "gcc -traditional", we assume that this is the intent; if
 * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
 */
#ifndef	NO_ANSI_KEYWORDS
#define	const				/* delete ANSI C keywords */
#define	inline
#define	signed
#define	volatile
#endif	/* !NO_ANSI_KEYWORDS */
# 194 "/usr/include/sys/cdefs.h" 3 4
#endif	/* !__CC_SUPPORTS___INLINE */
# 195 "/usr/include/sys/cdefs.h" 3 4
#endif	/* !(__STDC__ || __cplusplus) */
# 196 "/usr/include/sys/cdefs.h" 3 4

/*
 * Compiler-dependent macros to help declare dead (non-returning) and
 * pure (no side effects) functions, and unused variables.  They are
 * null except for versions of gcc that are known to support the features
 * properly (old versions of gcc-2 supported the dead and pure features
 * in a different (wrong) way).  If we do not provide an implementation
 * for a given compiler, let the compile fail if it is told to use
 * a feature that we cannot live without.
 */
#ifdef lint
#define	__dead2
#define	__pure2
#define	__unused
#define	__packed
#define	__aligned(x)
#define	__section(x)
#else
# 214 "/usr/include/sys/cdefs.h" 3 4
#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
#define	__dead2
#define	__pure2
#define	__unused
#endif
# 219 "/usr/include/sys/cdefs.h" 3 4
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
#define	__dead2		__attribute__((__noreturn__))
#define	__pure2		__attribute__((__const__))
#define	__unused
/* XXX Find out what to do for __packed, __aligned and __section */
#endif
# 225 "/usr/include/sys/cdefs.h" 3 4
#if __GNUC_PREREQ__(2, 7)
#define	__dead2		__attribute__((__noreturn__))
#define	__pure2		__attribute__((__const__))
#define	__unused	__attribute__((__unused__))
#define	__used		__attribute__((__used__))
#define	__packed	__attribute__((__packed__))
#define	__aligned(x)	__attribute__((__aligned__(x)))
#define	__section(x)	__attribute__((__section__(x)))
#endif
# 234 "/usr/include/sys/cdefs.h" 3 4
#if defined(__INTEL_COMPILER)
#define __dead2		__attribute__((__noreturn__))
#define __pure2		__attribute__((__const__))
#define __unused	__attribute__((__unused__))
#define __used		__attribute__((__used__))
#define __packed	__attribute__((__packed__))
#define __aligned(x)	__attribute__((__aligned__(x)))
#define __section(x)	__attribute__((__section__(x)))
#endif
# 243 "/usr/include/sys/cdefs.h" 3 4
#endif
# 244 "/usr/include/sys/cdefs.h" 3 4

#if !__GNUC_PREREQ__(2, 95)
#define	__alignof(x)	__offsetof(struct { char __a; x __b; }, __b)
#endif
# 248 "/usr/include/sys/cdefs.h" 3 4

/*
 * Keywords added in C11.
 */

#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L

#if !__has_extension(c_alignas)
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
    __has_extension(cxx_alignas)
#define	_Alignas(x)		alignas(x)
#else
# 260 "/usr/include/sys/cdefs.h" 3 4
/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */
#define	_Alignas(x)		__aligned(x)
#endif
# 263 "/usr/include/sys/cdefs.h" 3 4
#endif
# 264 "/usr/include/sys/cdefs.h" 3 4

#if defined(__cplusplus) && __cplusplus >= 201103L
#define	_Alignof(x)		alignof(x)
#else
# 268 "/usr/include/sys/cdefs.h" 3 4
#define	_Alignof(x)		__alignof(x)
#endif
# 270 "/usr/include/sys/cdefs.h" 3 4

#if !__has_extension(c_atomic) && !__has_extension(cxx_atomic)
/*
 * No native support for _Atomic(). Place object in structure to prevent
 * most forms of direct non-atomic access.
 */
#define	_Atomic(T)		struct { T volatile __val; }
#endif
# 278 "/usr/include/sys/cdefs.h" 3 4

#if defined(__cplusplus) && __cplusplus >= 201103L
#define	_Noreturn		[[noreturn]]
#else
# 282 "/usr/include/sys/cdefs.h" 3 4
#define	_Noreturn		__dead2
#endif
# 284 "/usr/include/sys/cdefs.h" 3 4

#if !__has_extension(c_static_assert)
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
    __has_extension(cxx_static_assert)
#define	_Static_assert(x, y)	static_assert(x, y)
#elif defined(__COUNTER__)
# 290 "/usr/include/sys/cdefs.h" 3 4
#define	_Static_assert(x, y)	__Static_assert(x, __COUNTER__)
#define	__Static_assert(x, y)	___Static_assert(x, y)
#define	___Static_assert(x, y)	typedef char __assert_ ## y[(x) ? 1 : -1]
#else
# 294 "/usr/include/sys/cdefs.h" 3 4
#define	_Static_assert(x, y)	struct __hack
#endif
# 296 "/usr/include/sys/cdefs.h" 3 4
#endif
# 297 "/usr/include/sys/cdefs.h" 3 4

#if !__has_extension(c_thread_local)
/* XXX: Change this to test against C++11 when clang in base supports it. */
#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \
    __has_extension(cxx_thread_local)
#define	_Thread_local		thread_local
#else
# 304 "/usr/include/sys/cdefs.h" 3 4
#define	_Thread_local		__thread
#endif
# 306 "/usr/include/sys/cdefs.h" 3 4
#endif
# 307 "/usr/include/sys/cdefs.h" 3 4

#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
# 309 "/usr/include/sys/cdefs.h" 3 4

/*
 * Emulation of C11 _Generic().  Unlike the previously defined C11
 * keywords, it is not possible to implement this using exactly the same
 * syntax.  Therefore implement something similar under the name
 * __generic().  Unlike _Generic(), this macro can only distinguish
 * between a single type, so it requires nested invocations to
 * distinguish multiple cases.
 */

#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define	__generic(expr, t, yes, no)					\
	_Generic(expr, t: yes, default: no)
#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
# 323 "/usr/include/sys/cdefs.h" 3 4
#define	__generic(expr, t, yes, no)					\
	__builtin_choose_expr(						\
	    __builtin_types_compatible_p(__typeof(expr), t), yes, no)
#endif
# 327 "/usr/include/sys/cdefs.h" 3 4

#if __GNUC_PREREQ__(2, 96)
#define	__malloc_like	__attribute__((__malloc__))
#define	__pure		__attribute__((__pure__))
#else
# 332 "/usr/include/sys/cdefs.h" 3 4
#define	__malloc_like
#define	__pure
#endif
# 335 "/usr/include/sys/cdefs.h" 3 4

#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
#define	__always_inline	__attribute__((__always_inline__))
#else
# 339 "/usr/include/sys/cdefs.h" 3 4
#define	__always_inline
#endif
# 341 "/usr/include/sys/cdefs.h" 3 4

#if __GNUC_PREREQ__(3, 1)
#define	__noinline	__attribute__ ((__noinline__))
#else
# 345 "/usr/include/sys/cdefs.h" 3 4
#define	__noinline
#endif
# 347 "/usr/include/sys/cdefs.h" 3 4

#if __GNUC_PREREQ__(3, 3)
#define __nonnull(x)	__attribute__((__nonnull__(x)))
#else
# 351 "/usr/include/sys/cdefs.h" 3 4
#define __nonnull(x)
#endif
# 353 "/usr/include/sys/cdefs.h" 3 4

#if __GNUC_PREREQ__(3, 4)
#define	__fastcall	__attribute__((__fastcall__))
#else
# 357 "/usr/include/sys/cdefs.h" 3 4
#define	__fastcall
#endif
# 359 "/usr/include/sys/cdefs.h" 3 4

#if __GNUC_PREREQ__(4, 1)
#define	__returns_twice	__attribute__((__returns_twice__))
#else
# 363 "/usr/include/sys/cdefs.h" 3 4
#define	__returns_twice
#endif
# 365 "/usr/include/sys/cdefs.h" 3 4

/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define	__func__	NULL
#endif
# 370 "/usr/include/sys/cdefs.h" 3 4

#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
#define	__LONG_LONG_SUPPORTED
#endif
# 374 "/usr/include/sys/cdefs.h" 3 4

/* C++11 exposes a load of C99 stuff */
#if defined(__cplusplus) && __cplusplus >= 201103L
#define	__LONG_LONG_SUPPORTED
#ifndef	__STDC_LIMIT_MACROS
#define	__STDC_LIMIT_MACROS
#endif
# 381 "/usr/include/sys/cdefs.h" 3 4
#ifndef	__STDC_CONSTANT_MACROS
#define	__STDC_CONSTANT_MACROS
#endif
# 384 "/usr/include/sys/cdefs.h" 3 4
#endif
# 385 "/usr/include/sys/cdefs.h" 3 4

/*
 * GCC 2.95 provides `__restrict' as an extension to C90 to support the
 * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
 * a way to define the `restrict' type qualifier without disturbing older
 * software that is unaware of C99 keywords.
 */
#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
#define	__restrict
#else
# 396 "/usr/include/sys/cdefs.h" 3 4
#define	__restrict	restrict
#endif
# 398 "/usr/include/sys/cdefs.h" 3 4
#endif
# 399 "/usr/include/sys/cdefs.h" 3 4

/*
 * GNU C version 2.96 adds explicit branch prediction so that
 * the CPU back-end can hint the processor and also so that
 * code blocks can be reordered such that the predicted path
 * sees a more linear flow, thus improving cache behavior, etc.
 *
 * The following two macros provide us with a way to utilize this
 * compiler feature.  Use __predict_true() if you expect the expression
 * to evaluate to true, and __predict_false() if you expect the
 * expression to evaluate to false.
 *
 * A few notes about usage:
 *
 *	* Generally, __predict_false() error condition checks (unless
 *	  you have some _strong_ reason to do otherwise, in which case
 *	  document it), and/or __predict_true() `no-error' condition
 *	  checks, assuming you want to optimize for the no-error case.
 *
 *	* Other than that, if you don't know the likelihood of a test
 *	  succeeding from empirical or other `hard' evidence, don't
 *	  make predictions.
 *
 *	* These are meant to be used in places that are run `a lot'.
 *	  It is wasteful to make predictions in code that is run
 *	  seldomly (e.g. at subsystem initialization time) as the
 *	  basic block reordering that this affects can often generate
 *	  larger code.
 */
#if __GNUC_PREREQ__(2, 96)
#define __predict_true(exp)     __builtin_expect((exp), 1)
#define __predict_false(exp)    __builtin_expect((exp), 0)
#else
# 432 "/usr/include/sys/cdefs.h" 3 4
#define __predict_true(exp)     (exp)
#define __predict_false(exp)    (exp)
#endif
# 435 "/usr/include/sys/cdefs.h" 3 4

#if __GNUC_PREREQ__(4, 2)
#define	__hidden	__attribute__((__visibility__("hidden")))
#define	__exported	__attribute__((__visibility__("default")))
#else
# 440 "/usr/include/sys/cdefs.h" 3 4
#define	__hidden
#define	__exported
#endif
# 443 "/usr/include/sys/cdefs.h" 3 4

/*
 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
 * require it.
 */
#if __GNUC_PREREQ__(4, 1)
#define __offsetof(type, field)	 __builtin_offsetof(type, field)
#else
# 451 "/usr/include/sys/cdefs.h" 3 4
#ifndef __cplusplus
#define	__offsetof(type, field) \
	((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field))
#else
# 455 "/usr/include/sys/cdefs.h" 3 4
#define __offsetof(type, field)					\
  (__offsetof__ (reinterpret_cast <__size_t>			\
                 (&reinterpret_cast <const volatile char &>	\
                  (static_cast<type *> (0)->field))))
#endif
# 460 "/usr/include/sys/cdefs.h" 3 4
#endif
# 461 "/usr/include/sys/cdefs.h" 3 4
#define	__rangeof(type, start, end) \
	(__offsetof(type, end) - __offsetof(type, start))

/*
 * Given the pointer x to the member m of the struct s, return
 * a pointer to the containing structure.  When using GCC, we first
 * assign pointer x to a local variable, to check that its type is
 * compatible with member m.
 */
#if __GNUC_PREREQ__(3, 1)
#define	__containerof(x, s, m) ({					\
	const volatile __typeof(((s *)0)->m) *__x = (x);		\
	__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
})
#else
# 476 "/usr/include/sys/cdefs.h" 3 4
#define	__containerof(x, s, m)						\
	__DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
#endif
# 479 "/usr/include/sys/cdefs.h" 3 4

/*
 * Compiler-dependent macros to declare that functions take printf-like
 * or scanf-like arguments.  They are null except for versions of gcc
 * that are known to support the features properly (old versions of gcc-2
 * didn't permit keeping the keywords out of the application namespace).
 */
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define	__printflike(fmtarg, firstvararg)
#define	__scanflike(fmtarg, firstvararg)
#define	__format_arg(fmtarg)
#define	__strfmonlike(fmtarg, firstvararg)
#define	__strftimelike(fmtarg, firstvararg)
#else
# 493 "/usr/include/sys/cdefs.h" 3 4
#define	__printflike(fmtarg, firstvararg) \
	    __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
#define	__scanflike(fmtarg, firstvararg) \
	    __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
#define	__format_arg(fmtarg)	__attribute__((__format_arg__ (fmtarg)))
#define	__strfmonlike(fmtarg, firstvararg) \
	    __attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
#define	__strftimelike(fmtarg, firstvararg) \
	    __attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
#endif
# 503 "/usr/include/sys/cdefs.h" 3 4

/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
    defined(__GNUC__) && !defined(__INTEL_COMPILER)
#define	__printf0like(fmtarg, firstvararg) \
	    __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
#else
# 510 "/usr/include/sys/cdefs.h" 3 4
#define	__printf0like(fmtarg, firstvararg)
#endif
# 512 "/usr/include/sys/cdefs.h" 3 4

#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifndef __INTEL_COMPILER
#define	__strong_reference(sym,aliassym)	\
	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
#endif
# 518 "/usr/include/sys/cdefs.h" 3 4
#ifdef __STDC__
#define	__weak_reference(sym,alias)	\
	__asm__(".weak " #alias);	\
	__asm__(".equ "  #alias ", " #sym)
#define	__warn_references(sym,msg)	\
	__asm__(".section .gnu.warning." #sym);	\
	__asm__(".asciz \"" msg "\"");	\
	__asm__(".previous")
#define	__sym_compat(sym,impl,verid)	\
	__asm__(".symver " #impl ", " #sym "@" #verid)
#define	__sym_default(sym,impl,verid)	\
	__asm__(".symver " #impl ", " #sym "@@" #verid)
#else
# 531 "/usr/include/sys/cdefs.h" 3 4
#define	__weak_reference(sym,alias)	\
	__asm__(".weak alias");		\
	__asm__(".equ alias, sym")
#define	__warn_references(sym,msg)	\
	__asm__(".section .gnu.warning.sym"); \
	__asm__(".asciz \"msg\"");	\
	__asm__(".previous")
#define	__sym_compat(sym,impl,verid)	\
	__asm__(".symver impl, sym@verid")
#define	__sym_default(impl,sym,verid)	\
	__asm__(".symver impl, sym@@verid")
#endif	/* __STDC__ */
# 543 "/usr/include/sys/cdefs.h" 3 4
#endif	/* __GNUC__ || __INTEL_COMPILER */
# 544 "/usr/include/sys/cdefs.h" 3 4

#define	__GLOBL1(sym)	__asm__(".globl " #sym)
#define	__GLOBL(sym)	__GLOBL1(sym)

#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#define	__IDSTRING(name,string)	__asm__(".ident\t\"" string "\"")
#else
# 551 "/usr/include/sys/cdefs.h" 3 4
/*
 * The following definition might not work well if used in header files,
 * but it should be better than nothing.  If you want a "do nothing"
 * version, then it should generate some harmless declaration, such as:
 *    #define __IDSTRING(name,string)	struct __hack
 */
#define	__IDSTRING(name,string)	static const char name[] __unused = string
#endif
# 559 "/usr/include/sys/cdefs.h" 3 4

/*
 * Embed the rcs id of a source file in the resulting library.  Note that in
 * more recent ELF binutils, we use .ident allowing the ID to be stripped.
 * Usage:
 *	__FBSDID("$FreeBSD: head/sys/sys/cdefs.h 251804 2013-06-16 10:48:47Z ed $");
 */
#ifndef	__FBSDID
#if !defined(lint) && !defined(STRIP_FBSDID)
#define	__FBSDID(s)	__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
#else
# 570 "/usr/include/sys/cdefs.h" 3 4
#define	__FBSDID(s)	struct __hack
#endif
# 572 "/usr/include/sys/cdefs.h" 3 4
#endif
# 573 "/usr/include/sys/cdefs.h" 3 4

#ifndef	__RCSID
#ifndef	NO__RCSID
#define	__RCSID(s)	__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
#else
# 578 "/usr/include/sys/cdefs.h" 3 4
#define	__RCSID(s)	struct __hack
#endif
# 580 "/usr/include/sys/cdefs.h" 3 4
#endif
# 581 "/usr/include/sys/cdefs.h" 3 4

#ifndef	__RCSID_SOURCE
#ifndef	NO__RCSID_SOURCE
#define	__RCSID_SOURCE(s)	__IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
#else
# 586 "/usr/include/sys/cdefs.h" 3 4
#define	__RCSID_SOURCE(s)	struct __hack
#endif
# 588 "/usr/include/sys/cdefs.h" 3 4
#endif
# 589 "/usr/include/sys/cdefs.h" 3 4

#ifndef	__SCCSID
#ifndef	NO__SCCSID
#define	__SCCSID(s)	__IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
#else
# 594 "/usr/include/sys/cdefs.h" 3 4
#define	__SCCSID(s)	struct __hack
#endif
# 596 "/usr/include/sys/cdefs.h" 3 4
#endif
# 597 "/usr/include/sys/cdefs.h" 3 4

#ifndef	__COPYRIGHT
#ifndef	NO__COPYRIGHT
#define	__COPYRIGHT(s)	__IDSTRING(__CONCAT(__copyright_,__LINE__),s)
#else
# 602 "/usr/include/sys/cdefs.h" 3 4
#define	__COPYRIGHT(s)	struct __hack
#endif
# 604 "/usr/include/sys/cdefs.h" 3 4
#endif
# 605 "/usr/include/sys/cdefs.h" 3 4

#ifndef	__DECONST
#define	__DECONST(type, var)	((type)(__uintptr_t)(const void *)(var))
#endif
# 609 "/usr/include/sys/cdefs.h" 3 4

#ifndef	__DEVOLATILE
#define	__DEVOLATILE(type, var)	((type)(__uintptr_t)(volatile void *)(var))
#endif
# 613 "/usr/include/sys/cdefs.h" 3 4

#ifndef	__DEQUALIFY
#define	__DEQUALIFY(type, var)	((type)(__uintptr_t)(const volatile void *)(var))
#endif
# 617 "/usr/include/sys/cdefs.h" 3 4

/*-
 * The following definitions are an extension of the behavior originally
 * implemented in <sys/_posix.h>, but with a different level of granularity.
 * POSIX.1 requires that the macros we test be defined before any standard
 * header file is included.
 *
 * Here's a quick run-down of the versions:
 *  defined(_POSIX_SOURCE)		1003.1-1988
 *  _POSIX_C_SOURCE == 1		1003.1-1990
 *  _POSIX_C_SOURCE == 2		1003.2-1992 C Language Binding Option
 *  _POSIX_C_SOURCE == 199309		1003.1b-1993
 *  _POSIX_C_SOURCE == 199506		1003.1c-1995, 1003.1i-1995,
 *					and the omnibus ISO/IEC 9945-1: 1996
 *  _POSIX_C_SOURCE == 200112		1003.1-2001
 *  _POSIX_C_SOURCE == 200809		1003.1-2008
 *
 * In addition, the X/Open Portability Guide, which is now the Single UNIX
 * Specification, defines a feature-test macro which indicates the version of
 * that specification, and which subsumes _POSIX_C_SOURCE.
 *
 * Our macros begin with two underscores to avoid namespace screwage.
 */

/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
#undef _POSIX_C_SOURCE		/* Probably illegal, but beyond caring now. */
#define	_POSIX_C_SOURCE		199009
#endif
# 646 "/usr/include/sys/cdefs.h" 3 4

/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
#undef _POSIX_C_SOURCE
#define	_POSIX_C_SOURCE		199209
#endif
# 652 "/usr/include/sys/cdefs.h" 3 4

/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
#ifdef _XOPEN_SOURCE
#if _XOPEN_SOURCE - 0 >= 700
#define	__XSI_VISIBLE		700
#undef _POSIX_C_SOURCE
#define	_POSIX_C_SOURCE		200809
#elif _XOPEN_SOURCE - 0 >= 600
# 660 "/usr/include/sys/cdefs.h" 3 4
#define	__XSI_VISIBLE		600
#undef _POSIX_C_SOURCE
#define	_POSIX_C_SOURCE		200112
#elif _XOPEN_SOURCE - 0 >= 500
# 664 "/usr/include/sys/cdefs.h" 3 4
#define	__XSI_VISIBLE		500
#undef _POSIX_C_SOURCE
#define	_POSIX_C_SOURCE		199506
#endif
# 668 "/usr/include/sys/cdefs.h" 3 4
#endif
# 669 "/usr/include/sys/cdefs.h" 3 4

/*
 * Deal with all versions of POSIX.  The ordering relative to the tests above is
 * important.
 */
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
#define	_POSIX_C_SOURCE		198808
#endif
# 677 "/usr/include/sys/cdefs.h" 3 4
#ifdef _POSIX_C_SOURCE
#if _POSIX_C_SOURCE >= 200809
#define	__POSIX_VISIBLE		200809
#define	__ISO_C_VISIBLE		1999
#elif _POSIX_C_SOURCE >= 200112
# 682 "/usr/include/sys/cdefs.h" 3 4
#define	__POSIX_VISIBLE		200112
#define	__ISO_C_VISIBLE		1999
#elif _POSIX_C_SOURCE >= 199506
# 685 "/usr/include/sys/cdefs.h" 3 4
#define	__POSIX_VISIBLE		199506
#define	__ISO_C_VISIBLE		1990
#elif _POSIX_C_SOURCE >= 199309
# 688 "/usr/include/sys/cdefs.h" 3 4
#define	__POSIX_VISIBLE		199309
#define	__ISO_C_VISIBLE		1990
#elif _POSIX_C_SOURCE >= 199209
# 691 "/usr/include/sys/cdefs.h" 3 4
#define	__POSIX_VISIBLE		199209
#define	__ISO_C_VISIBLE		1990
#elif _POSIX_C_SOURCE >= 199009
# 694 "/usr/include/sys/cdefs.h" 3 4
#define	__POSIX_VISIBLE		199009
#define	__ISO_C_VISIBLE		1990
#else
# 697 "/usr/include/sys/cdefs.h" 3 4
#define	__POSIX_VISIBLE		198808
#define	__ISO_C_VISIBLE		0
#endif /* _POSIX_C_SOURCE */
# 700 "/usr/include/sys/cdefs.h" 3 4
#else
# 701 "/usr/include/sys/cdefs.h" 3 4
/*-
 * Deal with _ANSI_SOURCE:
 * If it is defined, and no other compilation environment is explicitly
 * requested, then define our internal feature-test macros to zero.  This
 * makes no difference to the preprocessor (undefined symbols in preprocessing
 * expressions are defined to have value zero), but makes it more convenient for
 * a test program to print out the values.
 *
 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
 * environment (and in fact we will never get here).
 */
#if defined(_ANSI_SOURCE)	/* Hide almost everything. */
#define	__POSIX_VISIBLE		0
#define	__XSI_VISIBLE		0
#define	__BSD_VISIBLE		0
#define	__ISO_C_VISIBLE		1990
#elif defined(_C99_SOURCE)	/* Localism to specify strict C99 env. */
# 719 "/usr/include/sys/cdefs.h" 3 4
#define	__POSIX_VISIBLE		0
#define	__XSI_VISIBLE		0
#define	__BSD_VISIBLE		0
#define	__ISO_C_VISIBLE		1999
#elif defined(_C11_SOURCE)	/* Localism to specify strict C11 env. */
# 724 "/usr/include/sys/cdefs.h" 3 4
#define	__POSIX_VISIBLE		0
#define	__XSI_VISIBLE		0
#define	__BSD_VISIBLE		0
#define	__ISO_C_VISIBLE		2011
#else				/* Default environment: show everything. */
# 729 "/usr/include/sys/cdefs.h" 3 4
#define	__POSIX_VISIBLE		200809
#define	__XSI_VISIBLE		700
#define	__BSD_VISIBLE		1
#define	__ISO_C_VISIBLE		2011
#endif
# 734 "/usr/include/sys/cdefs.h" 3 4
#endif
# 735 "/usr/include/sys/cdefs.h" 3 4

#if defined(__mips) || defined(__powerpc64__)
#define __NO_TLS 1
#endif
# 739 "/usr/include/sys/cdefs.h" 3 4

#endif /* !_SYS_CDEFS_H_ */
# 741 "/usr/include/sys/cdefs.h" 3 4
# 42 "/usr/include/sys/types.h" 2 3 4

/* Machine type dependent parameters. */
#if 0 /* expanded by -frewrite-includes */
#include <machine/endian.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/endian.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/endian.h 232266 2012-02-28 19:39:54Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/endian.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/x86/endian.h" 1 3 4
/*-
 * Copyright (c) 1987, 1991 Regents of the University of California.
 * 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.
 * 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.
 *
 *	@(#)endian.h	7.8 (Berkeley) 4/3/91
 * $FreeBSD: head/sys/x86/include/endian.h 233684 2012-03-29 23:31:48Z dim $
 */

#ifndef _MACHINE_ENDIAN_H_
#define	_MACHINE_ENDIAN_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/x86/endian.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_types.h" 1 3 4
/*-
 * Copyright (c) 2002 Mike Barcroft <mike@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: head/sys/sys/_types.h 255219 2013-09-05 00:09:56Z pjd $
 */

#ifndef _SYS__TYPES_H_
#define _SYS__TYPES_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 33 "/usr/include/sys/_types.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_types.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/_types.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/_types.h 232261 2012-02-28 18:15:28Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/_types.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/x86/_types.h" 1 3 4
/*-
 * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 * Copyright (c) 1990, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94
 *	From: @(#)types.h	8.3 (Berkeley) 1/5/94
 * $FreeBSD: head/sys/x86/include/_types.h 263998 2014-04-01 14:46:11Z tijl $
 */

#ifndef _MACHINE__TYPES_H_
#define	_MACHINE__TYPES_H_

#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
# 45 "/usr/include/x86/_types.h" 3 4

#define __NO_STRICT_ALIGNMENT

/*
 * Basic types upon which most other types are built.
 */
typedef	signed char		__int8_t;
typedef	unsigned char		__uint8_t;
typedef	short			__int16_t;
typedef	unsigned short		__uint16_t;
typedef	int			__int32_t;
typedef	unsigned int		__uint32_t;
#ifdef	__LP64__
typedef	long			__int64_t;
typedef	unsigned long		__uint64_t;
#else
# 61 "/usr/include/x86/_types.h" 3 4
#ifndef lint
__extension__
#endif
# 64 "/usr/include/x86/_types.h" 3 4
/* LONGLONG */
typedef	long long		__int64_t;
#ifndef lint
__extension__
#endif
# 69 "/usr/include/x86/_types.h" 3 4
/* LONGLONG */
typedef	unsigned long long	__uint64_t;
#endif
# 72 "/usr/include/x86/_types.h" 3 4

/*
 * Standard type definitions.
 */
#ifdef	__LP64__
typedef	__int32_t	__clock_t;		/* clock()... */
typedef	__int64_t	__critical_t;
typedef	double		__double_t;
typedef	float		__float_t;
typedef	__int64_t	__intfptr_t;
typedef	__int64_t	__intptr_t;
#else
# 84 "/usr/include/x86/_types.h" 3 4
typedef	unsigned long	__clock_t;
typedef	__int32_t	__critical_t;
typedef	long double	__double_t;
typedef	long double	__float_t;
typedef	__int32_t	__intfptr_t;
typedef	__int32_t	__intptr_t;
#endif
# 91 "/usr/include/x86/_types.h" 3 4
typedef	__int64_t	__intmax_t;
typedef	__int32_t	__int_fast8_t;
typedef	__int32_t	__int_fast16_t;
typedef	__int32_t	__int_fast32_t;
typedef	__int64_t	__int_fast64_t;
typedef	__int8_t	__int_least8_t;
typedef	__int16_t	__int_least16_t;
typedef	__int32_t	__int_least32_t;
typedef	__int64_t	__int_least64_t;
#ifdef	__LP64__
typedef	__int64_t	__ptrdiff_t;		/* ptr1 - ptr2 */
typedef	__int64_t	__register_t;
typedef	__int64_t	__segsz_t;		/* segment size (in pages) */
typedef	__uint64_t	__size_t;		/* sizeof() */
typedef	__int64_t	__ssize_t;		/* byte count or error */
typedef	__int64_t	__time_t;		/* time()... */
typedef	__uint64_t	__uintfptr_t;
typedef	__uint64_t	__uintptr_t;
#else
# 110 "/usr/include/x86/_types.h" 3 4
typedef	__int32_t	__ptrdiff_t;
typedef	__int32_t	__register_t;
typedef	__int32_t	__segsz_t;
typedef	__uint32_t	__size_t;
typedef	__int32_t	__ssize_t;
typedef	__int32_t	__time_t;
typedef	__uint32_t	__uintfptr_t;
typedef	__uint32_t	__uintptr_t;
#endif
# 119 "/usr/include/x86/_types.h" 3 4
typedef	__uint64_t	__uintmax_t;
typedef	__uint32_t	__uint_fast8_t;
typedef	__uint32_t	__uint_fast16_t;
typedef	__uint32_t	__uint_fast32_t;
typedef	__uint64_t	__uint_fast64_t;
typedef	__uint8_t	__uint_least8_t;
typedef	__uint16_t	__uint_least16_t;
typedef	__uint32_t	__uint_least32_t;
typedef	__uint64_t	__uint_least64_t;
#ifdef	__LP64__
typedef	__uint64_t	__u_register_t;
typedef	__uint64_t	__vm_offset_t;
typedef	__uint64_t	__vm_paddr_t;
typedef	__uint64_t	__vm_size_t;
#else
# 134 "/usr/include/x86/_types.h" 3 4
typedef	__uint32_t	__u_register_t;
typedef	__uint32_t	__vm_offset_t;
#ifdef PAE
typedef	__uint64_t	__vm_paddr_t;
#else
# 139 "/usr/include/x86/_types.h" 3 4
typedef	__uint32_t	__vm_paddr_t;
#endif
# 141 "/usr/include/x86/_types.h" 3 4
typedef	__uint32_t	__vm_size_t;
#endif
# 143 "/usr/include/x86/_types.h" 3 4
typedef	__int64_t	__vm_ooffset_t;
typedef	__uint64_t	__vm_pindex_t;
typedef	int		___wchar_t;

#define	__WCHAR_MIN	__INT_MIN	/* min value for a wchar_t */
#define	__WCHAR_MAX	__INT_MAX	/* max value for a wchar_t */

/*
 * Unusual type definitions.
 */
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef	__builtin_va_list	__va_list;	/* internally known to gcc */
#elif defined(lint)
# 156 "/usr/include/x86/_types.h" 3 4
typedef	char *			__va_list;	/* pretend */
#endif
# 158 "/usr/include/x86/_types.h" 3 4
#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
    && !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list		__gnuc_va_list;	/* compatibility w/GNU headers*/
#endif
# 163 "/usr/include/x86/_types.h" 3 4

#endif /* !_MACHINE__TYPES_H_ */
# 165 "/usr/include/x86/_types.h" 3 4
# 7 "/usr/include/machine/_types.h" 2 3 4
# 34 "/usr/include/sys/_types.h" 2 3 4

/*
 * Standard type definitions.
 */
typedef	__uint32_t	__blksize_t;	/* file block size */
typedef	__int64_t	__blkcnt_t;	/* file block count */
typedef	__int32_t	__clockid_t;	/* clock_gettime()... */
typedef	__uint32_t	__fflags_t;	/* file flags */
typedef	__uint64_t	__fsblkcnt_t;
typedef	__uint64_t	__fsfilcnt_t;
typedef	__uint32_t	__gid_t;
typedef	__int64_t	__id_t;		/* can hold a gid_t, pid_t, or uid_t */
typedef	__uint32_t	__ino_t;	/* inode number */
typedef	long		__key_t;	/* IPC key (for Sys V IPC) */
typedef	__int32_t	__lwpid_t;	/* Thread ID (a.k.a. LWP) */
typedef	__uint16_t	__mode_t;	/* permissions */
typedef	int		__accmode_t;	/* access permissions */
typedef	int		__nl_item;
typedef	__uint16_t	__nlink_t;	/* link count */
typedef	__int64_t	__off_t;	/* file offset */
typedef	__int32_t	__pid_t;	/* process [group] */
typedef	__int64_t	__rlim_t;	/* resource limit - intentionally */
					/* signed, because of legacy code */
					/* that uses -1 for RLIM_INFINITY */
typedef	__uint8_t	__sa_family_t;
typedef	__uint32_t	__socklen_t;
typedef	long		__suseconds_t;	/* microseconds (signed) */
typedef	struct __timer	*__timer_t;	/* timer_gettime()... */
typedef	struct __mq	*__mqd_t;	/* mq_open()... */
typedef	__uint32_t	__uid_t;
typedef	unsigned int	__useconds_t;	/* microseconds (unsigned) */
typedef	int		__cpuwhich_t;	/* which parameter for cpuset. */
typedef	int		__cpulevel_t;	/* level parameter for cpuset. */
typedef int		__cpusetid_t;	/* cpuset identifier. */

/*
 * Unusual type definitions.
 */
/*
 * rune_t is declared to be an ``int'' instead of the more natural
 * ``unsigned long'' or ``long''.  Two things are happening here.  It is not
 * unsigned so that EOF (-1) can be naturally assigned to it and used.  Also,
 * it looks like 10646 will be a 31 bit standard.  This means that if your
 * ints cannot hold 32 bits, you will be in trouble.  The reason an int was
 * chosen over a long is that the is*() and to*() routines take ints (says
 * ANSI C), but they use __ct_rune_t instead of int.
 *
 * NOTE: rune_t is not covered by ANSI nor other standards, and should not
 * be instantiated outside of lib/libc/locale.  Use wchar_t.  wint_t and
 * rune_t must be the same type.  Also, wint_t should be able to hold all
 * members of the largest character set plus one extra value (WEOF), and
 * must be at least 16 bits.
 */
typedef	int		__ct_rune_t;	/* arg type for ctype funcs */
typedef	__ct_rune_t	__rune_t;	/* rune_t (see above) */
typedef	__ct_rune_t	__wint_t;	/* wint_t (see above) */

/* Clang already provides these types as built-ins, but only in C++ mode. */
#if !defined(__clang__) || !defined(__cplusplus)
typedef	__uint_least16_t __char16_t;
typedef	__uint_least32_t __char32_t;
#endif
# 96 "/usr/include/sys/_types.h" 3 4
/* In C++11, char16_t and char32_t are built-in types. */
#if defined(__cplusplus) && __cplusplus >= 201103L
#define	_CHAR16_T_DECLARED
#define	_CHAR32_T_DECLARED
#endif
# 101 "/usr/include/sys/_types.h" 3 4

typedef	__uint32_t	__dev_t;	/* device number */

typedef	__uint32_t	__fixpt_t;	/* fixed point number */

/*
 * mbstate_t is an opaque object to keep conversion state during multibyte
 * stream conversions.
 */
typedef union {
	char		__mbstate8[128];
	__int64_t	_mbstateL;	/* for alignment */
} __mbstate_t;

#endif /* !_SYS__TYPES_H_ */
# 116 "/usr/include/sys/_types.h" 3 4
# 38 "/usr/include/x86/endian.h" 2 3 4

/*
 * Define the order of 32-bit words in 64-bit words.
 */
#define	_QUAD_HIGHWORD 1
#define	_QUAD_LOWWORD 0

/*
 * Definitions for byte order, according to byte significance from low
 * address to high.
 */
#define	_LITTLE_ENDIAN	1234	/* LSB first: i386, vax */
#define	_BIG_ENDIAN	4321	/* MSB first: 68000, ibm, net */
#define	_PDP_ENDIAN	3412	/* LSB first in word, MSW first in long */

#define	_BYTE_ORDER	_LITTLE_ENDIAN

/*
 * Deprecated variants that don't have enough underscores to be useful in more
 * strict namespaces.
 */
#if __BSD_VISIBLE
#define	LITTLE_ENDIAN	_LITTLE_ENDIAN
#define	BIG_ENDIAN	_BIG_ENDIAN
#define	PDP_ENDIAN	_PDP_ENDIAN
#define	BYTE_ORDER	_BYTE_ORDER
#endif
# 65 "/usr/include/x86/endian.h" 3 4

#define	__bswap16_gen(x)	(__uint16_t)((x) << 8 | (x) >> 8)
#define	__bswap32_gen(x)		\
	(((__uint32_t)__bswap16((x) & 0xffff) << 16) | __bswap16((x) >> 16))
#define	__bswap64_gen(x)		\
	(((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32))

#ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
#define	__bswap16(x)				\
	((__uint16_t)(__builtin_constant_p(x) ?	\
	    __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x)))
#define	__bswap32(x)			\
	(__builtin_constant_p(x) ?	\
	    __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
#define	__bswap64(x)			\
	(__builtin_constant_p(x) ?	\
	    __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x))
#else
# 83 "/usr/include/x86/endian.h" 3 4
/* XXX these are broken for use in static initializers. */
#define	__bswap16(x)	__bswap16_var(x)
#define	__bswap32(x)	__bswap32_var(x)
#define	__bswap64(x)	__bswap64_var(x)
#endif
# 88 "/usr/include/x86/endian.h" 3 4

/* These are defined as functions to avoid multiple evaluation of x. */

static __inline __uint16_t
__bswap16_var(__uint16_t _x)
{

	return (__bswap16_gen(_x));
}

static __inline __uint32_t
__bswap32_var(__uint32_t _x)
{

#ifdef __GNUCLIKE_ASM
	__asm("bswap %0" : "+r" (_x));
	return (_x);
#else
# 106 "/usr/include/x86/endian.h" 3 4
	return (__bswap32_gen(_x));
#endif
# 108 "/usr/include/x86/endian.h" 3 4
}

static __inline __uint64_t
__bswap64_var(__uint64_t _x)
{

#if defined(__amd64__) && defined(__GNUCLIKE_ASM)
	__asm("bswap %0" : "+r" (_x));
	return (_x);
#else
# 118 "/usr/include/x86/endian.h" 3 4
	/*
	 * It is important for the optimizations that the following is not
	 * really generic, but expands to 2 __bswap32_var()'s.
	 */
	return (__bswap64_gen(_x));
#endif
# 124 "/usr/include/x86/endian.h" 3 4
}

#define	__htonl(x)	__bswap32(x)
#define	__htons(x)	__bswap16(x)
#define	__ntohl(x)	__bswap32(x)
#define	__ntohs(x)	__bswap16(x)

#endif /* !_MACHINE_ENDIAN_H_ */
# 132 "/usr/include/x86/endian.h" 3 4
# 7 "/usr/include/machine/endian.h" 2 3 4
# 45 "/usr/include/sys/types.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 46 "/usr/include/sys/types.h" 3 4

#if 0 /* expanded by -frewrite-includes */
#include <sys/_pthreadtypes.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_pthreadtypes.h" 1 3 4
/*
 * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu
 * Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au>
 * 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.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *  This product includes software developed by Chris Provenzano.
 * 4. The name of Chris Provenzano may not be used to endorse or promote 
 *	  products derived from this software without specific prior written
 *	  permission.
 *
 * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 CHRIS PROVENZANO 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: head/sys/sys/_pthreadtypes.h 189828 2009-03-14 20:10:14Z das $
 */

#ifndef _SYS__PTHREADTYPES_H_
#define _SYS__PTHREADTYPES_H_

/*
 * Forward structure definitions.
 *
 * These are mostly opaque to the user.
 */
struct pthread;
struct pthread_attr;
struct pthread_cond;
struct pthread_cond_attr;
struct pthread_mutex;
struct pthread_mutex_attr;
struct pthread_once;
struct pthread_rwlock;
struct pthread_rwlockattr;
struct pthread_barrier;
struct pthread_barrier_attr;
struct pthread_spinlock;

/*
 * Primitive system data type definitions required by P1003.1c.
 *
 * Note that P1003.1c specifies that there are no defined comparison
 * or assignment operators for the types pthread_attr_t, pthread_cond_t,
 * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
 */
#ifndef _PTHREAD_T_DECLARED
typedef struct	pthread			*pthread_t;
#define	_PTHREAD_T_DECLARED
#endif
# 68 "/usr/include/sys/_pthreadtypes.h" 3 4
typedef struct	pthread_attr		*pthread_attr_t;
typedef struct	pthread_mutex		*pthread_mutex_t;
typedef struct	pthread_mutex_attr	*pthread_mutexattr_t;
typedef struct	pthread_cond		*pthread_cond_t;
typedef struct	pthread_cond_attr	*pthread_condattr_t;
typedef int     			pthread_key_t;
typedef struct	pthread_once		pthread_once_t;
typedef struct	pthread_rwlock		*pthread_rwlock_t;
typedef struct	pthread_rwlockattr	*pthread_rwlockattr_t;
typedef struct	pthread_barrier		*pthread_barrier_t;
typedef struct	pthread_barrierattr	*pthread_barrierattr_t;
typedef struct	pthread_spinlock	*pthread_spinlock_t;

/*
 * Additional type definitions:
 *
 * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
 * use in header symbols.
 */
typedef void	*pthread_addr_t;
typedef void	*(*pthread_startroutine_t)(void *);

/*
 * Once definitions.
 */
struct pthread_once {
	int		state;
	pthread_mutex_t	mutex;
};

#endif /* ! _SYS__PTHREADTYPES_H_ */
# 99 "/usr/include/sys/_pthreadtypes.h" 3 4
# 48 "/usr/include/sys/types.h" 2 3 4

#if __BSD_VISIBLE
typedef	unsigned char	u_char;
typedef	unsigned short	u_short;
typedef	unsigned int	u_int;
typedef	unsigned long	u_long;
#ifndef _KERNEL
typedef	unsigned short	ushort;		/* Sys V compatibility */
typedef	unsigned int	uint;		/* Sys V compatibility */
#endif
# 58 "/usr/include/sys/types.h" 3 4
#endif
# 59 "/usr/include/sys/types.h" 3 4

/*
 * XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
 */
#if 0 /* expanded by -frewrite-includes */
#include <sys/_stdint.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_stdint.h" 1 3 4
/*-
 * Copyright (c) 2011 David E. O'Brien <obrien@FreeBSD.org>
 * Copyright (c) 2001 Mike Barcroft <mike@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: head/sys/sys/_stdint.h 222813 2011-06-07 08:46:13Z attilio $
 */

#ifndef _SYS__STDINT_H_
#define _SYS__STDINT_H_

#ifndef _INT8_T_DECLARED
typedef	__int8_t		int8_t;
#define	_INT8_T_DECLARED
#endif
# 37 "/usr/include/sys/_stdint.h" 3 4

#ifndef _INT16_T_DECLARED
typedef	__int16_t		int16_t;
#define	_INT16_T_DECLARED
#endif
# 42 "/usr/include/sys/_stdint.h" 3 4

#ifndef _INT32_T_DECLARED
typedef	__int32_t		int32_t;
#define	_INT32_T_DECLARED
#endif
# 47 "/usr/include/sys/_stdint.h" 3 4

#ifndef _INT64_T_DECLARED
typedef	__int64_t		int64_t;
#define	_INT64_T_DECLARED
#endif
# 52 "/usr/include/sys/_stdint.h" 3 4

#ifndef _UINT8_T_DECLARED
typedef	__uint8_t		uint8_t;
#define	_UINT8_T_DECLARED
#endif
# 57 "/usr/include/sys/_stdint.h" 3 4

#ifndef _UINT16_T_DECLARED
typedef	__uint16_t		uint16_t;
#define	_UINT16_T_DECLARED
#endif
# 62 "/usr/include/sys/_stdint.h" 3 4

#ifndef _UINT32_T_DECLARED
typedef	__uint32_t		uint32_t;
#define	_UINT32_T_DECLARED
#endif
# 67 "/usr/include/sys/_stdint.h" 3 4

#ifndef _UINT64_T_DECLARED
typedef	__uint64_t		uint64_t;
#define	_UINT64_T_DECLARED
#endif
# 72 "/usr/include/sys/_stdint.h" 3 4

#ifndef _INTPTR_T_DECLARED
typedef	__intptr_t		intptr_t;
#define	_INTPTR_T_DECLARED
#endif
# 77 "/usr/include/sys/_stdint.h" 3 4
#ifndef _UINTPTR_T_DECLARED
typedef	__uintptr_t		uintptr_t;
#define	_UINTPTR_T_DECLARED
#endif
# 81 "/usr/include/sys/_stdint.h" 3 4

#endif /* !_SYS__STDINT_H_ */
# 83 "/usr/include/sys/_stdint.h" 3 4
# 64 "/usr/include/sys/types.h" 2 3 4

typedef __uint8_t	u_int8_t;	/* unsigned integrals (deprecated) */
typedef __uint16_t	u_int16_t;
typedef __uint32_t	u_int32_t;
typedef __uint64_t	u_int64_t;

typedef	__uint64_t	u_quad_t;	/* quads (deprecated) */
typedef	__int64_t	quad_t;
typedef	quad_t *	qaddr_t;

typedef	char *		caddr_t;	/* core address */
typedef	const char *	c_caddr_t;	/* core address, pointer to const */

#ifndef _BLKSIZE_T_DECLARED
typedef	__blksize_t	blksize_t;
#define	_BLKSIZE_T_DECLARED
#endif
# 81 "/usr/include/sys/types.h" 3 4

typedef	__cpuwhich_t	cpuwhich_t;
typedef	__cpulevel_t	cpulevel_t;
typedef	__cpusetid_t	cpusetid_t;

#ifndef _BLKCNT_T_DECLARED
typedef	__blkcnt_t	blkcnt_t;
#define	_BLKCNT_T_DECLARED
#endif
# 90 "/usr/include/sys/types.h" 3 4

#ifndef _CLOCK_T_DECLARED
typedef	__clock_t	clock_t;
#define	_CLOCK_T_DECLARED
#endif
# 95 "/usr/include/sys/types.h" 3 4

#ifndef _CLOCKID_T_DECLARED
typedef	__clockid_t	clockid_t;
#define	_CLOCKID_T_DECLARED
#endif
# 100 "/usr/include/sys/types.h" 3 4

typedef	__critical_t	critical_t;	/* Critical section value */
typedef	__int64_t	daddr_t;	/* disk address */

#ifndef _DEV_T_DECLARED
typedef	__dev_t		dev_t;		/* device number or struct cdev */
#define	_DEV_T_DECLARED
#endif
# 108 "/usr/include/sys/types.h" 3 4

#ifndef _FFLAGS_T_DECLARED
typedef	__fflags_t	fflags_t;	/* file flags */
#define	_FFLAGS_T_DECLARED
#endif
# 113 "/usr/include/sys/types.h" 3 4

typedef	__fixpt_t	fixpt_t;	/* fixed point number */

#ifndef _FSBLKCNT_T_DECLARED		/* for statvfs() */
typedef	__fsblkcnt_t	fsblkcnt_t;
typedef	__fsfilcnt_t	fsfilcnt_t;
#define	_FSBLKCNT_T_DECLARED
#endif
# 121 "/usr/include/sys/types.h" 3 4

#ifndef _GID_T_DECLARED
typedef	__gid_t		gid_t;		/* group id */
#define	_GID_T_DECLARED
#endif
# 126 "/usr/include/sys/types.h" 3 4

#ifndef _IN_ADDR_T_DECLARED
typedef	__uint32_t	in_addr_t;	/* base type for internet address */
#define	_IN_ADDR_T_DECLARED
#endif
# 131 "/usr/include/sys/types.h" 3 4

#ifndef _IN_PORT_T_DECLARED
typedef	__uint16_t	in_port_t;
#define	_IN_PORT_T_DECLARED
#endif
# 136 "/usr/include/sys/types.h" 3 4

#ifndef _ID_T_DECLARED
typedef	__id_t		id_t;		/* can hold a uid_t or pid_t */
#define	_ID_T_DECLARED
#endif
# 141 "/usr/include/sys/types.h" 3 4

#ifndef _INO_T_DECLARED
typedef	__ino_t		ino_t;		/* inode number */
#define	_INO_T_DECLARED
#endif
# 146 "/usr/include/sys/types.h" 3 4

#ifndef _KEY_T_DECLARED
typedef	__key_t		key_t;		/* IPC key (for Sys V IPC) */
#define	_KEY_T_DECLARED
#endif
# 151 "/usr/include/sys/types.h" 3 4

#ifndef _LWPID_T_DECLARED
typedef	__lwpid_t	lwpid_t;	/* Thread ID (a.k.a. LWP) */
#define	_LWPID_T_DECLARED
#endif
# 156 "/usr/include/sys/types.h" 3 4

#ifndef _MODE_T_DECLARED
typedef	__mode_t	mode_t;		/* permissions */
#define	_MODE_T_DECLARED
#endif
# 161 "/usr/include/sys/types.h" 3 4

#ifndef _ACCMODE_T_DECLARED
typedef	__accmode_t	accmode_t;	/* access permissions */
#define	_ACCMODE_T_DECLARED
#endif
# 166 "/usr/include/sys/types.h" 3 4

#ifndef _NLINK_T_DECLARED
typedef	__nlink_t	nlink_t;	/* link count */
#define	_NLINK_T_DECLARED
#endif
# 171 "/usr/include/sys/types.h" 3 4

#ifndef _OFF_T_DECLARED
typedef	__off_t		off_t;		/* file offset */
#define	_OFF_T_DECLARED
#endif
# 176 "/usr/include/sys/types.h" 3 4

#ifndef _PID_T_DECLARED
typedef	__pid_t		pid_t;		/* process id */
#define	_PID_T_DECLARED
#endif
# 181 "/usr/include/sys/types.h" 3 4

typedef	__register_t	register_t;

#ifndef _RLIM_T_DECLARED
typedef	__rlim_t	rlim_t;		/* resource limit */
#define	_RLIM_T_DECLARED
#endif
# 188 "/usr/include/sys/types.h" 3 4

typedef	__int64_t	sbintime_t;

typedef	__segsz_t	segsz_t;	/* segment size (in pages) */

#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 197 "/usr/include/sys/types.h" 3 4

#ifndef _SSIZE_T_DECLARED
typedef	__ssize_t	ssize_t;
#define	_SSIZE_T_DECLARED
#endif
# 202 "/usr/include/sys/types.h" 3 4

#ifndef _SUSECONDS_T_DECLARED
typedef	__suseconds_t	suseconds_t;	/* microseconds (signed) */
#define	_SUSECONDS_T_DECLARED
#endif
# 207 "/usr/include/sys/types.h" 3 4

#ifndef _TIME_T_DECLARED
typedef	__time_t	time_t;
#define	_TIME_T_DECLARED
#endif
# 212 "/usr/include/sys/types.h" 3 4

#ifndef _TIMER_T_DECLARED
typedef	__timer_t	timer_t;
#define	_TIMER_T_DECLARED
#endif
# 217 "/usr/include/sys/types.h" 3 4

#ifndef _MQD_T_DECLARED
typedef	__mqd_t	mqd_t;
#define	_MQD_T_DECLARED
#endif
# 222 "/usr/include/sys/types.h" 3 4

typedef	__u_register_t	u_register_t;

#ifndef _UID_T_DECLARED
typedef	__uid_t		uid_t;		/* user id */
#define	_UID_T_DECLARED
#endif
# 229 "/usr/include/sys/types.h" 3 4

#ifndef _USECONDS_T_DECLARED
typedef	__useconds_t	useconds_t;	/* microseconds (unsigned) */
#define	_USECONDS_T_DECLARED
#endif
# 234 "/usr/include/sys/types.h" 3 4

#ifndef _CAP_RIGHTS_T_DECLARED
#define	_CAP_RIGHTS_T_DECLARED
struct cap_rights;

typedef	struct cap_rights	cap_rights_t;
#endif
# 241 "/usr/include/sys/types.h" 3 4

typedef	__vm_offset_t	vm_offset_t;
typedef	__vm_ooffset_t	vm_ooffset_t;
typedef	__vm_paddr_t	vm_paddr_t;
typedef	__vm_pindex_t	vm_pindex_t;
typedef	__vm_size_t	vm_size_t;

#ifdef _KERNEL
typedef	int		boolean_t;
typedef	struct device	*device_t;
typedef	__intfptr_t	intfptr_t;

/*
 * XXX this is fixed width for historical reasons.  It should have had type
 * __int_fast32_t.  Fixed-width types should not be used unless binary
 * compatibility is essential.  Least-width types should be used even less
 * since they provide smaller benefits.
 *
 * XXX should be MD.
 *
 * XXX this is bogus in -current, but still used for spl*().
 */
typedef	__uint32_t	intrmask_t;	/* Interrupt mask (spl, xxx_imask...) */

typedef	__uintfptr_t	uintfptr_t;
typedef	__uint64_t	uoff_t;
typedef	char		vm_memattr_t;	/* memory attribute codes */
typedef	struct vm_page	*vm_page_t;

#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
#define	__bool_true_false_are_defined	1
#define	false	0
#define	true	1
#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
typedef	int	_Bool;
#endif
# 277 "/usr/include/sys/types.h" 3 4
typedef	_Bool	bool;
#endif /* !__bool_true_false_are_defined && !__cplusplus */
# 279 "/usr/include/sys/types.h" 3 4

#define offsetof(type, field) __offsetof(type, field)

#endif /* !_KERNEL */
# 283 "/usr/include/sys/types.h" 3 4

/*
 * The following are all things that really shouldn't exist in this header,
 * since its purpose is to provide typedefs, not miscellaneous doodads.
 */
#if __BSD_VISIBLE

#if 0 /* expanded by -frewrite-includes */
#include <sys/select.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/select.h" 1 3 4
/*-
 * Copyright (c) 1992, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 * $FreeBSD: head/sys/sys/select.h 265051 2014-04-28 13:42:41Z emaste $
 */

#ifndef _SYS_SELECT_H_
#define	_SYS_SELECT_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/usr/include/sys/select.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/sys/select.h" 3 4

#if 0 /* expanded by -frewrite-includes */
#include <sys/_sigset.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_sigset.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1989, 1991, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)signal.h	8.4 (Berkeley) 5/4/95
 * $FreeBSD: head/sys/sys/_sigset.h 139825 2005-01-07 02:29:27Z imp $
 */

#ifndef _SYS__SIGSET_H_
#define	_SYS__SIGSET_H_

/*
 * sigset_t macros.
 */
#define	_SIG_WORDS	4
#define	_SIG_MAXSIG	128
#define	_SIG_IDX(sig)	((sig) - 1)
#define	_SIG_WORD(sig)	(_SIG_IDX(sig) >> 5)
#define	_SIG_BIT(sig)	(1 << (_SIG_IDX(sig) & 31))
#define	_SIG_VALID(sig)	((sig) <= _SIG_MAXSIG && (sig) > 0)

typedef struct __sigset {
	__uint32_t __bits[_SIG_WORDS];
} __sigset_t;

#if defined(_KERNEL) && defined(COMPAT_43)
typedef unsigned int osigset_t;
#endif
# 58 "/usr/include/sys/_sigset.h" 3 4

#endif /* !_SYS__SIGSET_H_ */
# 60 "/usr/include/sys/_sigset.h" 3 4
# 39 "/usr/include/sys/select.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_timeval.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_timeval.h" 1 3 4
/*-
 * Copyright (c) 2002 Mike Barcroft <mike@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: head/sys/sys/_timeval.h 158471 2006-05-12 05:04:46Z jhb $
 */

#ifndef _SYS__TIMEVAL_H_
#define _SYS__TIMEVAL_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 33 "/usr/include/sys/_timeval.h" 3 4

#ifndef _SUSECONDS_T_DECLARED
typedef	__suseconds_t	suseconds_t;
#define	_SUSECONDS_T_DECLARED
#endif
# 38 "/usr/include/sys/_timeval.h" 3 4

#ifndef _TIME_T_DECLARED
typedef	__time_t	time_t;
#define	_TIME_T_DECLARED
#endif
# 43 "/usr/include/sys/_timeval.h" 3 4

/*
 * Structure returned by gettimeofday(2) system call, and used in other calls.
 */
struct timeval {
	time_t		tv_sec;		/* seconds */
	suseconds_t	tv_usec;	/* and microseconds */
};

#endif /* !_SYS__TIMEVAL_H_ */
# 53 "/usr/include/sys/_timeval.h" 3 4
# 40 "/usr/include/sys/select.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/timespec.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/timespec.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)time.h	8.5 (Berkeley) 5/4/95
 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
 *	$FreeBSD: head/sys/sys/timespec.h 205792 2010-03-28 13:13:22Z ed $
 */

#ifndef _SYS_TIMESPEC_H_
#define _SYS_TIMESPEC_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/include/sys/timespec.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_timespec.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_timespec.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)time.h	8.5 (Berkeley) 5/4/95
 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
 *	$FreeBSD: head/sys/sys/_timespec.h 205792 2010-03-28 13:13:22Z ed $
 */

#ifndef _SYS__TIMESPEC_H_
#define	_SYS__TIMESPEC_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/include/sys/_timespec.h" 3 4

#ifndef _TIME_T_DECLARED
typedef	__time_t	time_t;
#define	_TIME_T_DECLARED
#endif
# 43 "/usr/include/sys/_timespec.h" 3 4

struct timespec {
	time_t	tv_sec;		/* seconds */
	long	tv_nsec;	/* and nanoseconds */
};

#endif /* !_SYS__TIMESPEC_H_ */
# 50 "/usr/include/sys/_timespec.h" 3 4
# 39 "/usr/include/sys/timespec.h" 2 3 4

#if __BSD_VISIBLE
#define	TIMEVAL_TO_TIMESPEC(tv, ts)					\
	do {								\
		(ts)->tv_sec = (tv)->tv_sec;				\
		(ts)->tv_nsec = (tv)->tv_usec * 1000;			\
	} while (0)
#define	TIMESPEC_TO_TIMEVAL(tv, ts)					\
	do {								\
		(tv)->tv_sec = (ts)->tv_sec;				\
		(tv)->tv_usec = (ts)->tv_nsec / 1000;			\
	} while (0)

#endif /* __BSD_VISIBLE */
# 53 "/usr/include/sys/timespec.h" 3 4

/*
 * Structure defined by POSIX.1b to be like a itimerval, but with
 * timespecs. Used in the timer_*() system calls.
 */
struct itimerspec {
	struct timespec  it_interval;
	struct timespec  it_value;
};

#endif /* _SYS_TIMESPEC_H_ */
# 64 "/usr/include/sys/timespec.h" 3 4
# 41 "/usr/include/sys/select.h" 2 3 4

typedef	unsigned long	__fd_mask;
#if __BSD_VISIBLE
typedef	__fd_mask	fd_mask;
#endif
# 46 "/usr/include/sys/select.h" 3 4

#ifndef _SIGSET_T_DECLARED
#define	_SIGSET_T_DECLARED
typedef	__sigset_t	sigset_t;
#endif
# 51 "/usr/include/sys/select.h" 3 4

/*
 * Select uses bit masks of file descriptors in longs.  These macros
 * manipulate such bit fields (the filesystem macros use chars).
 * FD_SETSIZE may be defined by the user, but the default here should
 * be enough for most uses.
 */
#ifndef	FD_SETSIZE
#define	FD_SETSIZE	1024
#endif
# 61 "/usr/include/sys/select.h" 3 4

#define	_NFDBITS	(sizeof(__fd_mask) * 8)	/* bits per mask */
#if __BSD_VISIBLE
#define	NFDBITS		_NFDBITS
#endif
# 66 "/usr/include/sys/select.h" 3 4

#ifndef _howmany
#define	_howmany(x, y)	(((x) + ((y) - 1)) / (y))
#endif
# 70 "/usr/include/sys/select.h" 3 4

typedef	struct fd_set {
	__fd_mask	__fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
} fd_set;
#if __BSD_VISIBLE
#define	fds_bits	__fds_bits
#endif
# 77 "/usr/include/sys/select.h" 3 4

#define	__fdset_mask(n)	((__fd_mask)1 << ((n) % _NFDBITS))
#define	FD_CLR(n, p)	((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n))
#if __BSD_VISIBLE
#define	FD_COPY(f, t)	(void)(*(t) = *(f))
#endif
# 83 "/usr/include/sys/select.h" 3 4
#define	FD_ISSET(n, p)	(((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0)
#define	FD_SET(n, p)	((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n))
#define	FD_ZERO(p) do {					\
	fd_set *_p;					\
	__size_t _n;					\
							\
	_p = (p);					\
	_n = _howmany(FD_SETSIZE, _NFDBITS);		\
	while (_n > 0)					\
		_p->__fds_bits[--_n] = 0;		\
} while (0)

#ifndef _KERNEL

__BEGIN_DECLS
int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict,
	const struct timespec *__restrict, const sigset_t *__restrict);
#ifndef _SELECT_DECLARED
#define	_SELECT_DECLARED
/* XXX missing restrict type-qualifier */
int	select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
#endif
# 105 "/usr/include/sys/select.h" 3 4
__END_DECLS
#endif /* !_KERNEL */
# 107 "/usr/include/sys/select.h" 3 4

#endif /* _SYS_SELECT_H_ */
# 109 "/usr/include/sys/select.h" 3 4
# 291 "/usr/include/sys/types.h" 2 3 4

/*
 * minor() gives a cookie instead of an index since we don't want to
 * change the meanings of bits 0-15 or waste time and space shifting
 * bits 16-31 for devices that don't use them.
 */
#define	major(x)	((int)(((u_int)(x) >> 8)&0xff))	/* major number */
#define	minor(x)	((int)((x)&0xffff00ff))		/* minor number */
#define	makedev(x,y)	((dev_t)(((x) << 8) | (y)))	/* create dev_t */

/*
 * These declarations belong elsewhere, but are repeated here and in
 * <stdio.h> to give broken programs a better chance of working with
 * 64-bit off_t's.
 */
#ifndef _KERNEL
__BEGIN_DECLS
#ifndef _FTRUNCATE_DECLARED
#define	_FTRUNCATE_DECLARED
int	 ftruncate(int, off_t);
#endif
# 312 "/usr/include/sys/types.h" 3 4
#ifndef _LSEEK_DECLARED
#define	_LSEEK_DECLARED
off_t	 lseek(int, off_t, int);
#endif
# 316 "/usr/include/sys/types.h" 3 4
#ifndef _MMAP_DECLARED
#define	_MMAP_DECLARED
void *	 mmap(void *, size_t, int, int, int, off_t);
#endif
# 320 "/usr/include/sys/types.h" 3 4
#ifndef _TRUNCATE_DECLARED
#define	_TRUNCATE_DECLARED
int	 truncate(const char *, off_t);
#endif
# 324 "/usr/include/sys/types.h" 3 4
__END_DECLS
#endif /* !_KERNEL */
# 326 "/usr/include/sys/types.h" 3 4

#endif /* __BSD_VISIBLE */
# 328 "/usr/include/sys/types.h" 3 4

#endif /* !_SYS_TYPES_H_ */
# 330 "/usr/include/sys/types.h" 3 4
# 89 "/usr/include/sys/param.h" 2 3 4
#endif
# 90 "/usr/include/sys/param.h" 3 4

/*
 * Machine-independent constants (some used in following include files).
 * Redefined constants are from POSIX 1003.1 limits file.
 *
 * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
 */
#if 0 /* expanded by -frewrite-includes */
#include <sys/syslimits.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/syslimits.h" 1 3 4
/*-
 * Copyright (c) 1988, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)syslimits.h	8.1 (Berkeley) 6/2/93
 * $FreeBSD: head/sys/sys/syslimits.h 194498 2009-06-19 17:10:35Z brooks $
 */

#ifndef _SYS_SYSLIMITS_H_
#define _SYS_SYSLIMITS_H_

#if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
# 40 "/usr/include/sys/syslimits.h" 3 4
#ifdef __CC_SUPPORTS_WARNING
#warning "No user-serviceable parts inside."
#endif
# 43 "/usr/include/sys/syslimits.h" 3 4
#endif
# 44 "/usr/include/sys/syslimits.h" 3 4

/*
 * Do not add any new variables here.  (See the comment at the end of
 * the file for why.)
 */
#define	ARG_MAX			262144	/* max bytes for an exec function */
#ifndef CHILD_MAX
#define	CHILD_MAX		   40	/* max simultaneous processes */
#endif
# 53 "/usr/include/sys/syslimits.h" 3 4
#define	LINK_MAX		32767	/* max file link count */
#define	MAX_CANON		  255	/* max bytes in term canon input line */
#define	MAX_INPUT		  255	/* max bytes in terminal input */
#define	NAME_MAX		  255	/* max bytes in a file name */
#ifndef NGROUPS_MAX
#define	NGROUPS_MAX	 	 1023	/* max supplemental group id's */
#endif
# 60 "/usr/include/sys/syslimits.h" 3 4
#ifndef OPEN_MAX
#define	OPEN_MAX		   64	/* max open files per process */
#endif
# 63 "/usr/include/sys/syslimits.h" 3 4
#define	PATH_MAX		 1024	/* max bytes in pathname */
#define	PIPE_BUF		  512	/* max bytes for atomic pipe writes */
#define	IOV_MAX			 1024	/* max elements in i/o vector */

/*
 * We leave the following values undefined to force applications to either
 * assume conservative values or call sysconf() to get the current value.
 *
 * HOST_NAME_MAX
 *
 * (We should do this for most of the values currently defined here,
 * but many programs are not prepared to deal with this yet.)
 */
#endif
# 77 "/usr/include/sys/syslimits.h" 3 4
# 98 "/usr/include/sys/param.h" 2 3 4

#define	MAXCOMLEN	19		/* max command name remembered */
#define	MAXINTERP	PATH_MAX	/* max interpreter file name length */
#define	MAXLOGNAME	33		/* max login name length (incl. NUL) */
#define	MAXUPRC		CHILD_MAX	/* max simultaneous processes */
#define	NCARGS		ARG_MAX		/* max bytes for an exec function */
#define	NGROUPS		(NGROUPS_MAX+1)	/* max number groups */
#define	NOFILE		OPEN_MAX	/* max open files per process */
#define	NOGROUP		65535		/* marker for empty group set member */
#define MAXHOSTNAMELEN	256		/* max hostname size */
#define SPECNAMELEN	63		/* max length of devicename */

/* More types and definitions used throughout the kernel. */
#ifdef _KERNEL
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 113 "/usr/include/sys/param.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/errno.h>
#endif /* expanded by -frewrite-includes */
# 114 "/usr/include/sys/param.h" 3 4
#ifndef LOCORE
#if 0 /* expanded by -frewrite-includes */
#include <sys/time.h>
#endif /* expanded by -frewrite-includes */
# 116 "/usr/include/sys/param.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/priority.h>
#endif /* expanded by -frewrite-includes */
# 117 "/usr/include/sys/param.h" 3 4
#endif
# 118 "/usr/include/sys/param.h" 3 4

#ifndef FALSE
#define	FALSE	0
#endif
# 122 "/usr/include/sys/param.h" 3 4
#ifndef TRUE
#define	TRUE	1
#endif
# 125 "/usr/include/sys/param.h" 3 4
#endif
# 126 "/usr/include/sys/param.h" 3 4

#ifndef _KERNEL
/* Signals. */
#if 0 /* expanded by -frewrite-includes */
#include <sys/signal.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/signal.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1989, 1991, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)signal.h	8.4 (Berkeley) 5/4/95
 * $FreeBSD: head/sys/sys/signal.h 233519 2012-03-26 19:12:09Z rmh $
 */

#ifndef _SYS_SIGNAL_H_
#define	_SYS_SIGNAL_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 42 "/usr/include/sys/signal.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 43 "/usr/include/sys/signal.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_sigset.h>
#endif /* expanded by -frewrite-includes */
# 44 "/usr/include/sys/signal.h" 3 4

#if 0 /* expanded by -frewrite-includes */
#include <machine/_limits.h>	/* __MINSIGSTKSZ */
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/_limits.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/_limits.h 232262 2012-02-28 18:24:28Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/_limits.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/x86/_limits.h" 1 3 4
/*-
 * Copyright (c) 1988, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)limits.h	8.3 (Berkeley) 1/4/94
 * $FreeBSD: head/sys/x86/include/_limits.h 235939 2012-05-24 21:44:46Z obrien $
 */

#ifndef	_MACHINE__LIMITS_H_
#define	_MACHINE__LIMITS_H_

/*
 * According to ANSI (section 2.2.4.2), the values below must be usable by
 * #if preprocessing directives.  Additionally, the expression must have the
 * same type as would an expression that is an object of the corresponding
 * type converted according to the integral promotions.  The subtraction for
 * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
 * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
 */

#define	__CHAR_BIT	8		/* number of bits in a char */

#define	__SCHAR_MAX	0x7f		/* max value for a signed char */
#define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */

#define	__UCHAR_MAX	0xff		/* max value for an unsigned char */

#define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
#define	__SHRT_MAX	0x7fff		/* max value for a short */
#define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */

#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
#define	__INT_MAX	0x7fffffff	/* max value for an int */
#define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */

#ifdef	__LP64__
#define	__ULONG_MAX	0xffffffffffffffff	/* max for an unsigned long */
#define	__LONG_MAX	0x7fffffffffffffff	/* max for a long */
#define	__LONG_MIN	(-0x7fffffffffffffff - 1) /* min for a long */
#else
# 65 "/usr/include/x86/_limits.h" 3 4
#define	__ULONG_MAX	0xffffffffUL
#define	__LONG_MAX	0x7fffffffL
#define	__LONG_MIN	(-0x7fffffffL - 1)
#endif
# 69 "/usr/include/x86/_limits.h" 3 4

			/* max value for an unsigned long long */
#define	__ULLONG_MAX	0xffffffffffffffffULL
#define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */
#define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1)  /* min for a long long */

#ifdef	__LP64__
#define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
#define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
#define	__OFF_MAX	__LONG_MAX	/* max value for an off_t */
#define	__OFF_MIN	__LONG_MIN	/* min value for an off_t */
/* Quads and longs are the same on the amd64.  Ensure they stay in sync. */
#define	__UQUAD_MAX	__ULONG_MAX	/* max value for a uquad_t */
#define	__QUAD_MAX	__LONG_MAX	/* max value for a quad_t */
#define	__QUAD_MIN	__LONG_MIN	/* min value for a quad_t */
#define	__LONG_BIT	64
#else
# 86 "/usr/include/x86/_limits.h" 3 4
#define	__SSIZE_MAX	__INT_MAX
#define	__SIZE_T_MAX	__UINT_MAX
#define	__OFF_MAX	__LLONG_MAX
#define	__OFF_MIN	__LLONG_MIN
#define	__UQUAD_MAX	__ULLONG_MAX
#define	__QUAD_MAX	__LLONG_MAX
#define	__QUAD_MIN	__LLONG_MIN
#define	__LONG_BIT	32
#endif
# 95 "/usr/include/x86/_limits.h" 3 4

#define	__WORD_BIT	32

/* Minimum signal stack size. */
#define	__MINSIGSTKSZ	(512 * 4)

#endif /* !_MACHINE__LIMITS_H_ */
# 102 "/usr/include/x86/_limits.h" 3 4
# 7 "/usr/include/machine/_limits.h" 2 3 4
# 46 "/usr/include/sys/signal.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/signal.h>	/* sig_atomic_t; trap codes; sigcontext */
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/signal.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/signal.h 247047 2013-02-20 17:39:52Z kib $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/signal.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/x86/signal.h" 1 3 4
/*-
 * Copyright (c) 1986, 1989, 1991, 1993
 *	The Regents of the University of California.  All rights reserved.
 * Copyright (c) 2003 Peter Wemm.
 *
 * 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.
 * 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.
 *
 *	@(#)signal.h	8.1 (Berkeley) 6/11/93
 * $FreeBSD: head/sys/x86/include/signal.h 247047 2013-02-20 17:39:52Z kib $
 */

#ifndef _X86_SIGNAL_H
#define	_X86_SIGNAL_H 1

/*
 * Machine-dependent signal definitions
 */

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 42 "/usr/include/x86/signal.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_sigset.h>
#endif /* expanded by -frewrite-includes */
# 43 "/usr/include/x86/signal.h" 3 4

#if __BSD_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <machine/trap.h>	/* codes for SIGILL, SIGFPE */
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/trap.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/trap.h 232492 2012-03-04 14:12:57Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/trap.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/x86/trap.h" 1 3 4
/*-
 * Copyright (c) 1990 The Regents of the University of California.
 * All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * William Jolitz.
 *
 * 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.
 * 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.
 *
 *	from: @(#)trap.h	5.4 (Berkeley) 5/9/91
 * $FreeBSD: head/sys/x86/include/trap.h 257417 2013-10-31 02:35:00Z markj $
 */

#ifndef _MACHINE_TRAP_H_
#define	_MACHINE_TRAP_H_

/*
 * Trap type values
 * also known in trap.c for name strings
 */

#define	T_PRIVINFLT	1	/* privileged instruction */
#define	T_BPTFLT	3	/* breakpoint instruction */
#define	T_ARITHTRAP	6	/* arithmetic trap */
#define	T_PROTFLT	9	/* protection fault */
#define	T_TRCTRAP	10	/* debug exception (sic) */
#define	T_PAGEFLT	12	/* page fault */
#define	T_ALIGNFLT	14	/* alignment fault */

#define	T_DIVIDE	18	/* integer divide fault */
#define	T_NMI		19	/* non-maskable trap */
#define	T_OFLOW		20	/* overflow trap */
#define	T_BOUND		21	/* bound instruction fault */
#define	T_DNA		22	/* device not available fault */
#define	T_DOUBLEFLT	23	/* double fault */
#define	T_FPOPFLT	24	/* fp coprocessor operand fetch fault */
#define	T_TSSFLT	25	/* invalid tss fault */
#define	T_SEGNPFLT	26	/* segment not present fault */
#define	T_STKFLT	27	/* stack fault */
#define	T_MCHK		28	/* machine check trap */
#define	T_XMMFLT	29	/* SIMD floating-point exception */
#define	T_RESERVED	30	/* reserved (unknown) */
#define	T_DTRACE_RET	32	/* DTrace pid return */

/* XXX most of the following codes aren't used, but could be. */

/* definitions for <sys/signal.h> */
#define	    ILL_RESAD_FAULT	T_RESADFLT
#define	    ILL_PRIVIN_FAULT	T_PRIVINFLT
#define	    ILL_RESOP_FAULT	T_RESOPFLT
#define	    ILL_ALIGN_FAULT	T_ALIGNFLT
#define	    ILL_FPOP_FAULT	T_FPOPFLT	/* coprocessor operand fault */

/* old FreeBSD macros, deprecated */
#define	FPE_INTOVF_TRAP	0x1	/* integer overflow */
#define	FPE_INTDIV_TRAP	0x2	/* integer divide by zero */
#define	FPE_FLTDIV_TRAP	0x3	/* floating/decimal divide by zero */
#define	FPE_FLTOVF_TRAP	0x4	/* floating overflow */
#define	FPE_FLTUND_TRAP	0x5	/* floating underflow */
#define	FPE_FPU_NP_TRAP	0x6	/* floating point unit not present  */
#define	FPE_SUBRNG_TRAP	0x7	/* subrange out of bounds */

/* codes for SIGBUS */
#define	    BUS_PAGE_FAULT	T_PAGEFLT	/* page fault protection base */
#define	    BUS_SEGNP_FAULT	T_SEGNPFLT	/* segment not present */
#define	    BUS_STK_FAULT	T_STKFLT	/* stack segment */
#define	    BUS_SEGM_FAULT	T_RESERVED	/* segment protection base */

/* Trap's coming from user mode */
#define	T_USER	0x100

#endif /* !_MACHINE_TRAP_H_ */
# 95 "/usr/include/x86/trap.h" 3 4
# 7 "/usr/include/machine/trap.h" 2 3 4
# 46 "/usr/include/x86/signal.h" 2 3 4
#endif
# 47 "/usr/include/x86/signal.h" 3 4

#ifdef __i386__
typedef int sig_atomic_t;

#if __BSD_VISIBLE
struct sigcontext {
	struct __sigset sc_mask;	/* signal mask to restore */
	int	sc_onstack;		/* sigstack state to restore */
	int	sc_gs;			/* machine state (struct trapframe) */
	int	sc_fs;
	int	sc_es;
	int	sc_ds;
	int	sc_edi;
	int	sc_esi;
	int	sc_ebp;
	int	sc_isp;
	int	sc_ebx;
	int	sc_edx;
	int	sc_ecx;
	int	sc_eax;
	int	sc_trapno;
	int	sc_err;
	int	sc_eip;
	int	sc_cs;
	int	sc_efl;
	int	sc_esp;
	int	sc_ss;
	int	sc_len;			/* sizeof(mcontext_t) */
	/*
	 * See <machine/ucontext.h> and <machine/npx.h> for
	 * the following fields.
	 */
	int	sc_fpformat;
	int	sc_ownedfp;
	int	sc_flags;
	int	sc_fpstate[128] __aligned(16);

	int	sc_fsbase;
	int	sc_gsbase;

	int	sc_xfpustate;
	int	sc_xfpustate_len;

	int	sc_spare2[4];
};

#define	sc_sp		sc_esp
#define	sc_fp		sc_ebp
#define	sc_pc		sc_eip
#define	sc_ps		sc_efl
#define	sc_eflags	sc_efl

#endif /* __BSD_VISIBLE */
# 100 "/usr/include/x86/signal.h" 3 4
#endif /* __i386__ */
# 101 "/usr/include/x86/signal.h" 3 4

#ifdef __amd64__
typedef long sig_atomic_t;

#if __BSD_VISIBLE
/*
 * Information pushed on stack when a signal is delivered.
 * This is used by the kernel to restore state following
 * execution of the signal handler.  It is also made available
 * to the handler to allow it to restore state properly if
 * a non-standard exit is performed.
 *
 * The sequence of the fields/registers after sc_mask in struct
 * sigcontext must match those in mcontext_t and struct trapframe.
 */
struct sigcontext {
	struct __sigset sc_mask;	/* signal mask to restore */
	long	sc_onstack;		/* sigstack state to restore */
	long	sc_rdi;		/* machine state (struct trapframe) */
	long	sc_rsi;
	long	sc_rdx;
	long	sc_rcx;
	long	sc_r8;
	long	sc_r9;
	long	sc_rax;
	long	sc_rbx;
	long	sc_rbp;
	long	sc_r10;
	long	sc_r11;
	long	sc_r12;
	long	sc_r13;
	long	sc_r14;
	long	sc_r15;
	int	sc_trapno;
	short	sc_fs;
	short	sc_gs;
	long	sc_addr;
	int	sc_flags;
	short	sc_es;
	short	sc_ds;
	long	sc_err;
	long	sc_rip;
	long	sc_cs;
	long	sc_rflags;
	long	sc_rsp;
	long	sc_ss;
	long	sc_len;			/* sizeof(mcontext_t) */
	/*
	 * See <machine/ucontext.h> and <machine/fpu.h> for the following
	 * fields.
	 */
	long	sc_fpformat;
	long	sc_ownedfp;
	long	sc_fpstate[64] __aligned(16);

	long	sc_fsbase;
	long	sc_gsbase;

	long	sc_xfpustate;
	long	sc_xfpustate_len;

	long	sc_spare[4];
};
#endif /* __BSD_VISIBLE */
# 165 "/usr/include/x86/signal.h" 3 4
#endif /* __amd64__ */
# 166 "/usr/include/x86/signal.h" 3 4

#endif
# 168 "/usr/include/x86/signal.h" 3 4
# 7 "/usr/include/machine/signal.h" 2 3 4
# 47 "/usr/include/sys/signal.h" 2 3 4

/*
 * System defined signals.
 */
#if __POSIX_VISIBLE || __XSI_VISIBLE
#define	SIGHUP		1	/* hangup */
#endif
# 54 "/usr/include/sys/signal.h" 3 4
#define	SIGINT		2	/* interrupt */
#if __POSIX_VISIBLE || __XSI_VISIBLE
#define	SIGQUIT		3	/* quit */
#endif
# 58 "/usr/include/sys/signal.h" 3 4
#define	SIGILL		4	/* illegal instr. (not reset when caught) */
#if __XSI_VISIBLE
#define	SIGTRAP		5	/* trace trap (not reset when caught) */
#endif
# 62 "/usr/include/sys/signal.h" 3 4
#define	SIGABRT		6	/* abort() */
#if __BSD_VISIBLE
#define	SIGIOT		SIGABRT	/* compatibility */
#define	SIGEMT		7	/* EMT instruction */
#endif
# 67 "/usr/include/sys/signal.h" 3 4
#define	SIGFPE		8	/* floating point exception */
#if __POSIX_VISIBLE || __XSI_VISIBLE
#define	SIGKILL		9	/* kill (cannot be caught or ignored) */
#endif
# 71 "/usr/include/sys/signal.h" 3 4
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#define	SIGBUS		10	/* bus error */
#endif
# 74 "/usr/include/sys/signal.h" 3 4
#define	SIGSEGV		11	/* segmentation violation */
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#define	SIGSYS		12	/* non-existent system call invoked */
#endif
# 78 "/usr/include/sys/signal.h" 3 4
#if __POSIX_VISIBLE || __XSI_VISIBLE
#define	SIGPIPE		13	/* write on a pipe with no one to read it */
#define	SIGALRM		14	/* alarm clock */
#endif
# 82 "/usr/include/sys/signal.h" 3 4
#define	SIGTERM		15	/* software termination signal from kill */
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#define	SIGURG		16	/* urgent condition on IO channel */
#endif
# 86 "/usr/include/sys/signal.h" 3 4
#if __POSIX_VISIBLE || __XSI_VISIBLE
#define	SIGSTOP		17	/* sendable stop signal not from tty */
#define	SIGTSTP		18	/* stop signal from tty */
#define	SIGCONT		19	/* continue a stopped process */
#define	SIGCHLD		20	/* to parent on child stop or exit */
#define	SIGTTIN		21	/* to readers pgrp upon background tty read */
#define	SIGTTOU		22	/* like TTIN if (tp->t_local&LTOSTOP) */
#endif
# 94 "/usr/include/sys/signal.h" 3 4
#if __BSD_VISIBLE
#define	SIGIO		23	/* input/output possible signal */
#endif
# 97 "/usr/include/sys/signal.h" 3 4
#if __XSI_VISIBLE
#define	SIGXCPU		24	/* exceeded CPU time limit */
#define	SIGXFSZ		25	/* exceeded file size limit */
#define	SIGVTALRM	26	/* virtual time alarm */
#define	SIGPROF		27	/* profiling time alarm */
#endif
# 103 "/usr/include/sys/signal.h" 3 4
#if __BSD_VISIBLE
#define	SIGWINCH	28	/* window size changes */
#define	SIGINFO		29	/* information request */
#endif
# 107 "/usr/include/sys/signal.h" 3 4
#if __POSIX_VISIBLE || __XSI_VISIBLE
#define	SIGUSR1		30	/* user defined signal 1 */
#define	SIGUSR2		31	/* user defined signal 2 */
#endif
# 111 "/usr/include/sys/signal.h" 3 4
#if __BSD_VISIBLE
#define	SIGTHR		32	/* reserved by thread library. */
#define	SIGLWP		SIGTHR
#define	SIGLIBRT	33	/* reserved by real-time library. */
#endif
# 116 "/usr/include/sys/signal.h" 3 4

#define	SIGRTMIN	65
#define	SIGRTMAX	126

#define	SIG_DFL		((__sighandler_t *)0)
#define	SIG_IGN		((__sighandler_t *)1)
#define	SIG_ERR		((__sighandler_t *)-1)
/* #define	SIG_CATCH	((__sighandler_t *)2) See signalvar.h */
#define SIG_HOLD        ((__sighandler_t *)3)

/*
 * Type of a signal handling function.
 *
 * Language spec sez signal handlers take exactly one arg, even though we
 * actually supply three.  Ugh!
 *
 * We don't try to hide the difference by leaving out the args because
 * that would cause warnings about conformant programs.  Nonconformant
 * programs can avoid the warnings by casting to (__sighandler_t *) or
 * sig_t before calling signal() or assigning to sa_handler or sv_handler.
 *
 * The kernel should reverse the cast before calling the function.  It
 * has no way to do this, but on most machines 1-arg and 3-arg functions
 * have the same calling protocol so there is no problem in practice.
 * A bit in sa_flags could be used to specify the number of args.
 */
typedef	void __sighandler_t(int);

#if __POSIX_VISIBLE || __XSI_VISIBLE
#ifndef _SIGSET_T_DECLARED
#define	_SIGSET_T_DECLARED
typedef	__sigset_t	sigset_t;
#endif
# 149 "/usr/include/sys/signal.h" 3 4
#endif
# 150 "/usr/include/sys/signal.h" 3 4

#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE >= 500
union sigval {
	/* Members as suggested by Annex C of POSIX 1003.1b. */
	int	sival_int;
	void	*sival_ptr;
	/* 6.0 compatibility */
	int     sigval_int;
	void    *sigval_ptr;
};
#endif
# 161 "/usr/include/sys/signal.h" 3 4

#if __POSIX_VISIBLE >= 199309
struct sigevent {
	int	sigev_notify;		/* Notification type */
	int	sigev_signo;		/* Signal number */
	union sigval sigev_value;	/* Signal value */
	union {
		__lwpid_t	_threadid;
		struct {
			void (*_function)(union sigval);
			void *_attribute; /* pthread_attr_t * */
		} _sigev_thread;
		unsigned short _kevent_flags;
		long __spare__[8];
	} _sigev_un;
};

#if __BSD_VISIBLE
#define	sigev_notify_kqueue		sigev_signo
#define	sigev_notify_kevent_flags	_sigev_un._kevent_flags
#define	sigev_notify_thread_id		_sigev_un._threadid
#endif
# 183 "/usr/include/sys/signal.h" 3 4
#define	sigev_notify_function		_sigev_un._sigev_thread._function
#define	sigev_notify_attributes		_sigev_un._sigev_thread._attribute

#define	SIGEV_NONE	0		/* No async notification. */
#define	SIGEV_SIGNAL	1		/* Generate a queued signal. */
#define	SIGEV_THREAD	2		/* Call back from another pthread. */
#if __BSD_VISIBLE
#define	SIGEV_KEVENT	3		/* Generate a kevent. */
#define	SIGEV_THREAD_ID	4		/* Send signal to a kernel thread. */
#endif
# 193 "/usr/include/sys/signal.h" 3 4
#endif /* __POSIX_VISIBLE >= 199309 */
# 194 "/usr/include/sys/signal.h" 3 4

#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE
typedef	struct __siginfo {
	int	si_signo;		/* signal number */
	int	si_errno;		/* errno association */
	/*
	 * Cause of signal, one of the SI_ macros or signal-specific
	 * values, i.e. one of the FPE_... values for SIGFPE.  This
	 * value is equivalent to the second argument to an old-style
	 * FreeBSD signal handler.
	 */
	int	si_code;		/* signal code */
	__pid_t	si_pid;			/* sending process */
	__uid_t	si_uid;			/* sender's ruid */
	int	si_status;		/* exit value */
	void	*si_addr;		/* faulting instruction */
	union sigval si_value;		/* signal value */
	union	{
		struct {
			int	_trapno;/* machine specific trap code */
		} _fault;
		struct {
			int	_timerid;
			int	_overrun;
		} _timer;
		struct {
			int	_mqd;
		} _mesgq;
		struct {
			long	_band;		/* band event for SIGPOLL */
		} _poll;			/* was this ever used ? */
		struct {
			long	__spare1__;
			int	__spare2__[7];
		} __spare__;
	} _reason;
} siginfo_t;

#define si_trapno	_reason._fault._trapno
#define si_timerid	_reason._timer._timerid
#define si_overrun	_reason._timer._overrun
#define si_mqd		_reason._mesgq._mqd
#define si_band		_reason._poll._band

/** si_code **/
/* codes for SIGILL */
#define ILL_ILLOPC 	1	/* Illegal opcode.			*/
#define ILL_ILLOPN 	2	/* Illegal operand.			*/
#define ILL_ILLADR 	3	/* Illegal addressing mode.		*/
#define ILL_ILLTRP 	4	/* Illegal trap.			*/
#define ILL_PRVOPC 	5	/* Privileged opcode.			*/
#define ILL_PRVREG 	6	/* Privileged register.			*/
#define ILL_COPROC 	7	/* Coprocessor error.			*/
#define ILL_BADSTK 	8	/* Internal stack error.		*/

/* codes for SIGBUS */
#define BUS_ADRALN	1	/* Invalid address alignment.		*/
#define BUS_ADRERR	2	/* Nonexistent physical address.	*/
#define BUS_OBJERR	3	/* Object-specific hardware error.	*/

/* codes for SIGSEGV */
#define SEGV_MAPERR	1	/* Address not mapped to object.	*/
#define SEGV_ACCERR	2	/* Invalid permissions for mapped	*/
				/* object.				*/

/* codes for SIGFPE */
#define FPE_INTOVF	1	/* Integer overflow.			*/
#define FPE_INTDIV	2	/* Integer divide by zero.		*/
#define FPE_FLTDIV	3	/* Floating point divide by zero.	*/
#define FPE_FLTOVF	4	/* Floating point overflow.		*/
#define FPE_FLTUND	5	/* Floating point underflow.		*/
#define FPE_FLTRES	6	/* Floating point inexact result.	*/
#define FPE_FLTINV	7	/* Invalid floating point operation.	*/
#define FPE_FLTSUB	8	/* Subscript out of range.		*/

/* codes for SIGTRAP */
#define TRAP_BRKPT	1	/* Process breakpoint.			*/
#define TRAP_TRACE	2	/* Process trace trap.			*/
#define	TRAP_DTRACE	3	/* DTrace induced trap.			*/

/* codes for SIGCHLD */
#define CLD_EXITED	1	/* Child has exited			*/
#define CLD_KILLED	2	/* Child has terminated abnormally but	*/
				/* did not create a core file		*/
#define CLD_DUMPED	3	/* Child has terminated abnormally and	*/
				/* created a core file			*/
#define CLD_TRAPPED	4	/* Traced child has trapped		*/
#define CLD_STOPPED	5	/* Child has stopped			*/
#define CLD_CONTINUED	6	/* Stopped child has continued		*/

/* codes for SIGPOLL */
#define POLL_IN		1	/* Data input available			*/
#define POLL_OUT	2	/* Output buffers available		*/
#define POLL_MSG	3	/* Input message available		*/
#define POLL_ERR	4	/* I/O Error				*/
#define POLL_PRI	5	/* High priority input available	*/
#define POLL_HUP	6	/* Device disconnected			*/

#endif
# 293 "/usr/include/sys/signal.h" 3 4

#if __POSIX_VISIBLE || __XSI_VISIBLE
struct __siginfo;

/*
 * Signal vector "template" used in sigaction call.
 */
struct sigaction {
	union {
		void    (*__sa_handler)(int);
		void    (*__sa_sigaction)(int, struct __siginfo *, void *);
	} __sigaction_u;		/* signal handler */
	int	sa_flags;		/* see signal options below */
	sigset_t sa_mask;		/* signal mask to apply */
};

#define	sa_handler	__sigaction_u.__sa_handler
#endif
# 311 "/usr/include/sys/signal.h" 3 4

#if __XSI_VISIBLE
/* If SA_SIGINFO is set, sa_sigaction must be used instead of sa_handler. */
#define	sa_sigaction	__sigaction_u.__sa_sigaction
#endif
# 316 "/usr/include/sys/signal.h" 3 4

#if __POSIX_VISIBLE || __XSI_VISIBLE
#define	SA_NOCLDSTOP	0x0008	/* do not generate SIGCHLD on child stop */
#endif /* __POSIX_VISIBLE || __XSI_VISIBLE */
# 320 "/usr/include/sys/signal.h" 3 4

#if __XSI_VISIBLE
#define	SA_ONSTACK	0x0001	/* take signal on signal stack */
#define	SA_RESTART	0x0002	/* restart system call on signal return */
#define	SA_RESETHAND	0x0004	/* reset to SIG_DFL when taking signal */
#define	SA_NODEFER	0x0010	/* don't mask the signal we're delivering */
#define	SA_NOCLDWAIT	0x0020	/* don't keep zombies around */
#define	SA_SIGINFO	0x0040	/* signal handler with SA_SIGINFO args */
#endif
# 329 "/usr/include/sys/signal.h" 3 4

#if __BSD_VISIBLE
#define	NSIG		32	/* number of old signals (counting 0) */
#endif
# 333 "/usr/include/sys/signal.h" 3 4

#if __POSIX_VISIBLE || __XSI_VISIBLE
#define	SI_NOINFO	0		/* No signal info besides si_signo. */
#define	SI_USER		0x10001		/* Signal sent by kill(). */
#define	SI_QUEUE	0x10002		/* Signal sent by the sigqueue(). */
#define	SI_TIMER	0x10003		/* Signal generated by expiration of */
					/* a timer set by timer_settime(). */
#define	SI_ASYNCIO	0x10004		/* Signal generated by completion of */
					/* an asynchronous I/O request.*/
#define	SI_MESGQ	0x10005		/* Signal generated by arrival of a */
					/* message on an empty message queue. */
#define	SI_KERNEL	0x10006
#define	SI_LWP		0x10007		/* Signal sent by thr_kill */
#endif
# 347 "/usr/include/sys/signal.h" 3 4
#if __BSD_VISIBLE
#define	SI_UNDEFINED	0
#endif
# 350 "/usr/include/sys/signal.h" 3 4

#if __BSD_VISIBLE
typedef	__sighandler_t	*sig_t;	/* type of pointer to a signal function */
typedef	void __siginfohandler_t(int, struct __siginfo *, void *);
#endif
# 355 "/usr/include/sys/signal.h" 3 4

#if __XSI_VISIBLE
/*
 * Structure used in sigaltstack call.
 */
#if __BSD_VISIBLE
typedef	struct sigaltstack {
#else
# 363 "/usr/include/sys/signal.h" 3 4
typedef	struct {
#endif
# 365 "/usr/include/sys/signal.h" 3 4
	char	*ss_sp;			/* signal stack base */
	__size_t ss_size;		/* signal stack length */
	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
} stack_t;

#define	SS_ONSTACK	0x0001	/* take signal on alternate stack */
#define	SS_DISABLE	0x0004	/* disable taking signals on alternate stack */
#define	MINSIGSTKSZ	__MINSIGSTKSZ		/* minimum stack size */
#define	SIGSTKSZ	(MINSIGSTKSZ + 32768)	/* recommended stack size */
#endif
# 375 "/usr/include/sys/signal.h" 3 4

#if __BSD_VISIBLE
/*
 * 4.3 compatibility:
 * Signal vector "template" used in sigvec call.
 */
struct sigvec {
	__sighandler_t *sv_handler;	/* signal handler */
	int	sv_mask;		/* signal mask to apply */
	int	sv_flags;		/* see signal options below */
};

#define	SV_ONSTACK	SA_ONSTACK
#define	SV_INTERRUPT	SA_RESTART	/* same bit, opposite sense */
#define	SV_RESETHAND	SA_RESETHAND
#define	SV_NODEFER	SA_NODEFER
#define	SV_NOCLDSTOP	SA_NOCLDSTOP
#define	SV_SIGINFO	SA_SIGINFO
#define	sv_onstack	sv_flags	/* isn't compatibility wonderful! */
#endif
# 395 "/usr/include/sys/signal.h" 3 4

/* Keep this in one place only */
#if defined(_KERNEL) && defined(COMPAT_43) && \
    !defined(__i386__)
struct osigcontext {
	int _not_used;
};
#endif
# 403 "/usr/include/sys/signal.h" 3 4

#if __XSI_VISIBLE
/*
 * Structure used in sigstack call.
 */
struct sigstack {
	/* XXX ss_sp's type should be `void *'. */
	char	*ss_sp;			/* signal stack pointer */
	int	ss_onstack;		/* current status */
};
#endif
# 414 "/usr/include/sys/signal.h" 3 4

#if __BSD_VISIBLE || __POSIX_VISIBLE > 0 && __POSIX_VISIBLE <= 200112
/*
 * Macro for converting signal number to a mask suitable for
 * sigblock().
 */
#define	sigmask(m)	(1 << ((m)-1))
#endif
# 422 "/usr/include/sys/signal.h" 3 4

#if __BSD_VISIBLE
#define	BADSIG		SIG_ERR
#endif
# 426 "/usr/include/sys/signal.h" 3 4

#if __POSIX_VISIBLE || __XSI_VISIBLE
/*
 * Flags for sigprocmask:
 */
#define	SIG_BLOCK	1	/* block specified signal set */
#define	SIG_UNBLOCK	2	/* unblock specified signal set */
#define	SIG_SETMASK	3	/* set specified signal set */
#endif
# 435 "/usr/include/sys/signal.h" 3 4

/*
 * For historical reasons; programs expect signal's return value to be
 * defined by <sys/signal.h>.
 */
__BEGIN_DECLS
__sighandler_t *signal(int, __sighandler_t *);
__END_DECLS

#endif /* !_SYS_SIGNAL_H_ */
# 445 "/usr/include/sys/signal.h" 3 4
# 130 "/usr/include/sys/param.h" 2 3 4
#endif
# 131 "/usr/include/sys/param.h" 3 4

/* Machine type dependent parameters. */
#if 0 /* expanded by -frewrite-includes */
#include <machine/param.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/param.h" 1 3 4
/*-
 * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
 * Copyright (c) 1992, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * the Systems Programming Group of the University of Utah Computer
 * Science Department and Ralph Campbell.
 *
 * 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.
 *
 *	@(#)param.h	8.1 (Berkeley) 6/10/93
 * $FreeBSD: head/sys/amd64/include/param.h 266093 2014-05-14 22:24:09Z neel $
 */


#ifndef _AMD64_INCLUDE_PARAM_H_
#define	_AMD64_INCLUDE_PARAM_H_

#if 0 /* expanded by -frewrite-includes */
#include <machine/_align.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/_align.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/_align.h 215856 2010-11-26 10:59:20Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/_align.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/x86/_align.h" 1 3 4
/*-
 * Copyright (c) 2001 David E. O'Brien
 * Copyright (c) 1990 The Regents of the University of California.
 * All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * William Jolitz.
 *
 * 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.
 *
 *	from: @(#)param.h	5.8 (Berkeley) 6/28/91
 * $FreeBSD: head/sys/x86/include/_align.h 215856 2010-11-26 10:59:20Z tijl $
 */

#ifndef _X86_INCLUDE__ALIGN_H_
#define	_X86_INCLUDE__ALIGN_H_

/*
 * Round p (pointer or byte index) up to a correctly-aligned value
 * for all data types (int, long, ...).   The result is unsigned int
 * and must be cast to any desired pointer type.
 */
#define	_ALIGNBYTES	(sizeof(register_t) - 1)
#define	_ALIGN(p)	(((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)

#endif /* !_X86_INCLUDE__ALIGN_H_ */
# 53 "/usr/include/x86/_align.h" 3 4
# 7 "/usr/include/machine/_align.h" 2 3 4
# 47 "/usr/include/machine/param.h" 2 3 4

/*
 * Machine dependent constants for AMD64.
 */


#define __HAVE_ACPI
#define __PCI_REROUTE_INTERRUPT

#ifndef MACHINE
#define	MACHINE		"amd64"
#endif
# 59 "/usr/include/machine/param.h" 3 4
#ifndef MACHINE_ARCH
#define	MACHINE_ARCH	"amd64"
#endif
# 62 "/usr/include/machine/param.h" 3 4
#ifndef MACHINE_ARCH32
#define	MACHINE_ARCH32	"i386"
#endif
# 65 "/usr/include/machine/param.h" 3 4

#if defined(SMP) || defined(KLD_MODULE)
#ifndef MAXCPU
#define MAXCPU		64
#endif
# 70 "/usr/include/machine/param.h" 3 4
#else
# 71 "/usr/include/machine/param.h" 3 4
#define MAXCPU		1
#endif
# 73 "/usr/include/machine/param.h" 3 4

#ifndef MAXMEMDOM
#define	MAXMEMDOM	1
#endif
# 77 "/usr/include/machine/param.h" 3 4

#define	ALIGNBYTES		_ALIGNBYTES
#define	ALIGN(p)		_ALIGN(p)
/*
 * ALIGNED_POINTER is a boolean macro that checks whether an address
 * is valid to fetch data elements of type t from on this architecture.
 * This does not reflect the optimal alignment, just the possibility
 * (within reasonable limits). 
 */
#define	ALIGNED_POINTER(p, t)	1

/*
 * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
 * architecture.  It should be used with appropriate caution.
 */
#define	CACHE_LINE_SHIFT	7
#define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT)

/* Size of the level 1 page table units */
#define NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
#define	NPTEPGSHIFT	9		/* LOG2(NPTEPG) */
#define PAGE_SHIFT	12		/* LOG2(PAGE_SIZE) */
#define PAGE_SIZE	(1<<PAGE_SHIFT)	/* bytes/page */
#define PAGE_MASK	(PAGE_SIZE-1)
/* Size of the level 2 page directory units */
#define	NPDEPG		(PAGE_SIZE/(sizeof (pd_entry_t)))
#define	NPDEPGSHIFT	9		/* LOG2(NPDEPG) */
#define	PDRSHIFT	21              /* LOG2(NBPDR) */
#define	NBPDR		(1<<PDRSHIFT)   /* bytes/page dir */
#define	PDRMASK		(NBPDR-1)
/* Size of the level 3 page directory pointer table units */
#define	NPDPEPG		(PAGE_SIZE/(sizeof (pdp_entry_t)))
#define	NPDPEPGSHIFT	9		/* LOG2(NPDPEPG) */
#define	PDPSHIFT	30		/* LOG2(NBPDP) */
#define	NBPDP		(1<<PDPSHIFT)	/* bytes/page dir ptr table */
#define	PDPMASK		(NBPDP-1)
/* Size of the level 4 page-map level-4 table units */
#define	NPML4EPG	(PAGE_SIZE/(sizeof (pml4_entry_t)))
#define	NPML4EPGSHIFT	9		/* LOG2(NPML4EPG) */
#define	PML4SHIFT	39		/* LOG2(NBPML4) */
#define	NBPML4		(1UL<<PML4SHIFT)/* bytes/page map lev4 table */
#define	PML4MASK	(NBPML4-1)

#define	MAXPAGESIZES	3	/* maximum number of supported page sizes */

#define IOPAGES	2		/* pages of i/o permission bitmap */
/*
 * I/O permission bitmap has a bit for each I/O port plus an additional
 * byte at the end with all bits set. See section "I/O Permission Bit Map"
 * in the Intel SDM for more details.
 */
#define	IOPERM_BITMAP_SIZE	(IOPAGES * PAGE_SIZE + 1)

#ifndef	KSTACK_PAGES
#define	KSTACK_PAGES	4	/* pages of kstack (with pcb) */
#endif
# 133 "/usr/include/machine/param.h" 3 4
#define	KSTACK_GUARD_PAGES 1	/* pages of kstack guard; 0 disables */

/*
 * Mach derived conversion macros
 */
#define	round_page(x)	((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
#define	trunc_page(x)	((unsigned long)(x) & ~(PAGE_MASK))
#define trunc_2mpage(x)	((unsigned long)(x) & ~PDRMASK)
#define round_2mpage(x)	((((unsigned long)(x)) + PDRMASK) & ~PDRMASK)
#define trunc_1gpage(x)	((unsigned long)(x) & ~PDPMASK)

#define	atop(x)		((unsigned long)(x) >> PAGE_SHIFT)
#define	ptoa(x)		((unsigned long)(x) << PAGE_SHIFT)

#define	amd64_btop(x)	((unsigned long)(x) >> PAGE_SHIFT)
#define	amd64_ptob(x)	((unsigned long)(x) << PAGE_SHIFT)

#define	pgtok(x)	((unsigned long)(x) * (PAGE_SIZE / 1024)) 

#endif /* !_AMD64_INCLUDE_PARAM_H_ */
# 153 "/usr/include/machine/param.h" 3 4
# 134 "/usr/include/sys/param.h" 2 3 4
#ifndef _KERNEL
#if 0 /* expanded by -frewrite-includes */
#include <sys/limits.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/limits.h" 1 3 4
/*-
 * Copyright (c) 1988, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 * $FreeBSD: head/sys/sys/limits.h 219271 2011-03-04 19:28:27Z jilles $
 */

#ifndef _SYS_LIMITS_H_
#define	_SYS_LIMITS_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/usr/include/sys/limits.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_limits.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/_limits.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/_limits.h 232262 2012-02-28 18:24:28Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/_limits.h>
#endif /* expanded by -frewrite-includes */
# 7 "/usr/include/machine/_limits.h" 3 4
# 37 "/usr/include/sys/limits.h" 2 3 4

#define	CHAR_BIT	__CHAR_BIT	/* number of bits in a char */

#define	SCHAR_MAX	__SCHAR_MAX	/* max value for a signed char */
#define	SCHAR_MIN	__SCHAR_MIN	/* min value for a signed char */

#define	UCHAR_MAX	__UCHAR_MAX	/* max value for an unsigned char */

#ifdef __CHAR_UNSIGNED__
#define	CHAR_MAX	UCHAR_MAX	/* max value for a char */
#define	CHAR_MIN	0		/* min value for a char */
#else
# 49 "/usr/include/sys/limits.h" 3 4
#define	CHAR_MAX	SCHAR_MAX
#define	CHAR_MIN	SCHAR_MIN
#endif
# 52 "/usr/include/sys/limits.h" 3 4

#define	USHRT_MAX	__USHRT_MAX	/* max value for an unsigned short */
#define	SHRT_MAX	__SHRT_MAX	/* max value for a short */
#define	SHRT_MIN	__SHRT_MIN	/* min value for a short */

#define	UINT_MAX	__UINT_MAX	/* max value for an unsigned int */
#define	INT_MAX		__INT_MAX	/* max value for an int */
#define	INT_MIN		__INT_MIN	/* min value for an int */

#define	ULONG_MAX	__ULONG_MAX	/* max for an unsigned long */
#define	LONG_MAX	__LONG_MAX	/* max for a long */
#define	LONG_MIN	__LONG_MIN	/* min for a long */

#ifdef __LONG_LONG_SUPPORTED
#define	ULLONG_MAX	__ULLONG_MAX	/* max for an unsigned long long */
#define	LLONG_MAX	__LLONG_MAX	/* max for a long long */
#define	LLONG_MIN	__LLONG_MIN	/* min for a long long */
#endif
# 70 "/usr/include/sys/limits.h" 3 4

#if __POSIX_VISIBLE || __XSI_VISIBLE
#define	SSIZE_MAX	__SSIZE_MAX	/* max value for an ssize_t */
#endif
# 74 "/usr/include/sys/limits.h" 3 4

#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#define	SIZE_T_MAX	__SIZE_T_MAX	/* max value for a size_t */

#define	OFF_MAX		__OFF_MAX	/* max value for an off_t */
#define	OFF_MIN		__OFF_MIN	/* min value for an off_t */
#endif
# 81 "/usr/include/sys/limits.h" 3 4

#if __BSD_VISIBLE
#define	GID_MAX		UINT_MAX	/* max value for a gid_t */
#define	UID_MAX		UINT_MAX	/* max value for a uid_t */

#define	UQUAD_MAX	(__UQUAD_MAX)	/* max value for a uquad_t */
#define	QUAD_MAX	(__QUAD_MAX)	/* max value for a quad_t */
#define	QUAD_MIN	(__QUAD_MIN)	/* min value for a quad_t */
#endif
# 90 "/usr/include/sys/limits.h" 3 4

#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
#define	LONG_BIT	__LONG_BIT
#define	WORD_BIT	__WORD_BIT
#endif
# 95 "/usr/include/sys/limits.h" 3 4

#if __POSIX_VISIBLE
#define	MQ_PRIO_MAX	64
#endif
# 99 "/usr/include/sys/limits.h" 3 4

#endif /* !_SYS_LIMITS_H_ */
# 101 "/usr/include/sys/limits.h" 3 4
# 136 "/usr/include/sys/param.h" 2 3 4
#endif
# 137 "/usr/include/sys/param.h" 3 4

#ifndef DEV_BSHIFT
#define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
#endif
# 141 "/usr/include/sys/param.h" 3 4
#define	DEV_BSIZE	(1<<DEV_BSHIFT)

#ifndef BLKDEV_IOSIZE
#define BLKDEV_IOSIZE  PAGE_SIZE	/* default block device I/O size */
#endif
# 146 "/usr/include/sys/param.h" 3 4
#ifndef DFLTPHYS
#define DFLTPHYS	(64 * 1024)	/* default max raw I/O transfer size */
#endif
# 149 "/usr/include/sys/param.h" 3 4
#ifndef MAXPHYS
#define MAXPHYS		(128 * 1024)	/* max raw I/O transfer size */
#endif
# 152 "/usr/include/sys/param.h" 3 4
#ifndef MAXDUMPPGS
#define MAXDUMPPGS	(DFLTPHYS/PAGE_SIZE)
#endif
# 155 "/usr/include/sys/param.h" 3 4

/*
 * Constants related to network buffer management.
 * MCLBYTES must be no larger than PAGE_SIZE.
 */
#ifndef	MSIZE
#define	MSIZE		256		/* size of an mbuf */
#endif
# 163 "/usr/include/sys/param.h" 3 4

#ifndef	MCLSHIFT
#define MCLSHIFT	11		/* convert bytes to mbuf clusters */
#endif	/* MCLSHIFT */
# 167 "/usr/include/sys/param.h" 3 4

#define MCLBYTES	(1 << MCLSHIFT)	/* size of an mbuf cluster */

#if PAGE_SIZE < 2048
#define	MJUMPAGESIZE	MCLBYTES
#elif PAGE_SIZE <= 8192
# 173 "/usr/include/sys/param.h" 3 4
#define	MJUMPAGESIZE	PAGE_SIZE
#else
# 175 "/usr/include/sys/param.h" 3 4
#define	MJUMPAGESIZE	(8 * 1024)
#endif
# 177 "/usr/include/sys/param.h" 3 4

#define	MJUM9BYTES	(9 * 1024)	/* jumbo cluster 9k */
#define	MJUM16BYTES	(16 * 1024)	/* jumbo cluster 16k */

/*
 * Some macros for units conversion
 */

/* clicks to bytes */
#ifndef ctob
#define ctob(x)	((x)<<PAGE_SHIFT)
#endif
# 189 "/usr/include/sys/param.h" 3 4

/* bytes to clicks */
#ifndef btoc
#define btoc(x)	(((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT)
#endif
# 194 "/usr/include/sys/param.h" 3 4

/*
 * btodb() is messy and perhaps slow because `bytes' may be an off_t.  We
 * want to shift an unsigned type to avoid sign extension and we don't
 * want to widen `bytes' unnecessarily.  Assume that the result fits in
 * a daddr_t.
 */
#ifndef btodb
#define btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
	(sizeof (bytes) > sizeof(long) \
	 ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
	 : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
#endif
# 207 "/usr/include/sys/param.h" 3 4

#ifndef dbtob
#define dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
	((off_t)(db) << DEV_BSHIFT)
#endif
# 212 "/usr/include/sys/param.h" 3 4

#define	PRIMASK	0x0ff
#define	PCATCH	0x100		/* OR'd with pri for tsleep to check signals */
#define	PDROP	0x200	/* OR'd with pri to stop re-entry of interlock mutex */

#define	NZERO	0		/* default "nice" */

#define	NBBY	8		/* number of bits in a byte */
#define	NBPW	sizeof(int)	/* number of bytes per word (integer) */

#define	CMASK	022		/* default file mask: S_IWGRP|S_IWOTH */

#define	NODEV	(dev_t)(-1)	/* non-existent device */

/*
 * File system parameters and macros.
 *
 * MAXBSIZE -	Filesystems are made out of blocks of at most MAXBSIZE bytes
 *		per block.  MAXBSIZE may be made larger without effecting
 *		any existing filesystems as long as it does not exceed MAXPHYS,
 *		and may be made smaller at the risk of not being able to use
 *		filesystems which require a block size exceeding MAXBSIZE.
 *
 * BKVASIZE -	Nominal buffer space per buffer, in bytes.  BKVASIZE is the
 *		minimum KVM memory reservation the kernel is willing to make.
 *		Filesystems can of course request smaller chunks.  Actual 
 *		backing memory uses a chunk size of a page (PAGE_SIZE).
 *
 *		If you make BKVASIZE too small you risk seriously fragmenting
 *		the buffer KVM map which may slow things down a bit.  If you
 *		make it too big the kernel will not be able to optimally use 
 *		the KVM memory reserved for the buffer cache and will wind 
 *		up with too-few buffers.
 *
 *		The default is 16384, roughly 2x the block size used by a
 *		normal UFS filesystem.
 */
#define MAXBSIZE	65536	/* must be power of 2 */
#define BKVASIZE	16384	/* must be power of 2 */
#define BKVAMASK	(BKVASIZE-1)

/*
 * MAXPATHLEN defines the longest permissible path length after expanding
 * symbolic links. It is used to allocate a temporary buffer from the buffer
 * pool in which to do the name expansion, hence should be a power of two,
 * and must be less than or equal to MAXBSIZE.  MAXSYMLINKS defines the
 * maximum number of symbolic links that may be expanded in a path name.
 * It should be set high enough to allow all legitimate uses, but halt
 * infinite loops reasonably quickly.
 */
#define	MAXPATHLEN	PATH_MAX
#define MAXSYMLINKS	32

/* Bit map related macros. */
#define	setbit(a,i)	(((unsigned char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY))
#define	clrbit(a,i)	(((unsigned char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY)))
#define	isset(a,i)							\
	(((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY)))
#define	isclr(a,i)							\
	((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0)

/* Macros for counting and rounding. */
#ifndef howmany
#define	howmany(x, y)	(((x)+((y)-1))/(y))
#endif
# 277 "/usr/include/sys/param.h" 3 4
#define	nitems(x)	(sizeof((x)) / sizeof((x)[0]))
#define	rounddown(x, y)	(((x)/(y))*(y))
#define	rounddown2(x, y) ((x)&(~((y)-1)))          /* if y is power of two */
#define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))  /* to any y */
#define	roundup2(x, y)	(((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#define powerof2(x)	((((x)-1)&(x))==0)

/* Macros for min/max. */
#define	MIN(a,b) (((a)<(b))?(a):(b))
#define	MAX(a,b) (((a)>(b))?(a):(b))

#ifdef _KERNEL
/*
 * Basic byte order function prototypes for non-inline functions.
 */
#ifndef LOCORE
#ifndef _BYTEORDER_PROTOTYPED
#define	_BYTEORDER_PROTOTYPED
__BEGIN_DECLS
__uint32_t	 htonl(__uint32_t);
__uint16_t	 htons(__uint16_t);
__uint32_t	 ntohl(__uint32_t);
__uint16_t	 ntohs(__uint16_t);
__END_DECLS
#endif
# 302 "/usr/include/sys/param.h" 3 4
#endif
# 303 "/usr/include/sys/param.h" 3 4

#ifndef lint
#ifndef _BYTEORDER_FUNC_DEFINED
#define	_BYTEORDER_FUNC_DEFINED
#define	htonl(x)	__htonl(x)
#define	htons(x)	__htons(x)
#define	ntohl(x)	__ntohl(x)
#define	ntohs(x)	__ntohs(x)
#endif /* !_BYTEORDER_FUNC_DEFINED */
# 312 "/usr/include/sys/param.h" 3 4
#endif /* lint */
# 313 "/usr/include/sys/param.h" 3 4
#endif /* _KERNEL */
# 314 "/usr/include/sys/param.h" 3 4

/*
 * Scale factor for scaled integers used to count %cpu time and load avgs.
 *
 * The number of CPU `tick's that map to a unique `%age' can be expressed
 * by the formula (1 / (2 ^ (FSHIFT - 11))).  The maximum load average that
 * can be calculated (assuming 32 bits) can be closely approximated using
 * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).
 *
 * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',
 * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.
 */
#define	FSHIFT	11		/* bits to right of fixed binary point */
#define FSCALE	(1<<FSHIFT)

#define dbtoc(db)			/* calculates devblks to pages */ \
	((db + (ctodb(1) - 1)) >> (PAGE_SHIFT - DEV_BSHIFT))
 
#define ctodb(db)			/* calculates pages to devblks */ \
	((db) << (PAGE_SHIFT - DEV_BSHIFT))

/*
 * Old spelling of __containerof().
 */
#define	member2struct(s, m, x)						\
	((struct s *)(void *)((char *)(x) - offsetof(struct s, m)))

/*
 * Access a variable length array that has been declared as a fixed
 * length array.
 */
#define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset])

#endif	/* _SYS_PARAM_H_ */
# 348 "/usr/include/sys/param.h" 3 4
# 19 "/usr/home/kaduk/openafs/build/include/afs/param.h" 2
#endif
# 20 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
#define AFS_X86_XBSD_ENV 1

#define AFS_NAMEI_ENV     1	/* User space interface to file system */
#define AFS_64BIT_CLIENT 1
#define AFS_64BITPOINTER_ENV 1
#define AFS_64BITUSERPOINTER_ENV	1
#define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
#define AFS_FBSD_ENV 1
#define AFS_FBSD50_ENV 1
#define AFS_FBSD51_ENV 1
#define AFS_FBSD52_ENV 1
#define AFS_FBSD53_ENV 1
#define AFS_FBSD60_ENV 1
#define AFS_FBSD61_ENV 1
#define AFS_FBSD62_ENV 1
#define AFS_FBSD70_ENV 1
#define AFS_FBSD71_ENV 1
#define AFS_FBSD80_ENV 1
#define AFS_FBSD81_ENV 1
#define AFS_FBSD90_ENV 1
#define AFS_FBSD91_ENV 1
#define AFS_FBSD100_ENV 1
#define AFS_FBSD110_ENV 1
#define AFS_X86_FBSD_ENV 1
#define AFS_X86_FBSD50_ENV 1
#define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
#define AFS_X86_FBSD62_ENV 1
#define AFS_X86_FBSD70_ENV 1
#define AFS_X86_FBSD71_ENV 1
#define AFS_X86_FBSD80_ENV 1
#define AFS_X86_FBSD81_ENV 1
#define AFS_X86_FBSD90_ENV 1
#define AFS_X86_FBSD91_ENV 1
#define AFS_X86_FBSD100_ENV 1
#define AFS_X86_FBSD110_ENV 1
#define AFS_X86_ENV 1
#undef  AFS_NONFSTRANS
#define AFS_NONFSTRANS 1
#define FTRUNC O_TRUNC

#define IUPD 0x0010
#define IACC 0x0020
#define ICHG 0x0040
#define IMOD 0x0080

#define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
                                NULL, curproc)
#define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
                                NULL, curproc)

#if 0 /* expanded by -frewrite-includes */
#include <afs/afs_sysnames.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/afs_sysnames.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 *
 * Portions Copyright (c) 2003 Apple Computer, Inc.
 */

/*
 * File: afs_sysnames.h
 *
 * Macros defining AFS systypes and their associated IDs, and generating
 * them from the value of SYS_NAME.
 *
 * Groups of 100 IDs have been allocated to each major system type.
 */

#ifndef __AFS_SYSNAMES_INCL_ENV_
#define __AFS_SYSNAMES_INCL_ENV_ 1

#ifndef	IGNORE_STDS_H
#if 0 /* expanded by -frewrite-includes */
#include "stds.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/stds.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*
 * Do not put anything in this file that relies on Autoconf defines, since
 * we're not guaranteed to have included afsconfig.h before this header file.
 * This is an installed header file, and afsconfig.h is not.
 */

#ifndef OPENAFS_AFS_CONFIG_STDS_H
#define OPENAFS_AFS_CONFIG_STDS_H	1

#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/param.h" 1
#ifndef	AFS_PARAM_H
#define	AFS_PARAM_H

/* Machine / Operating system information */
#define SYS_NAME	"amd64_fbsd_110"
#define SYS_NAME_ID	SYS_NAME_ID_amd64_fbsd_110

#define AFSLITTLE_ENDIAN    1
#define AFS_HAVE_FFS        1	/* Use system's ffs. */
#define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
#define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */


#ifndef UKERNEL
/* This section for kernel libafs compiles only */

#ifndef IGNORE_STDS_H
#if 0 /* expanded by -frewrite-includes */
#include <sys/param.h>
#endif /* expanded by -frewrite-includes */
# 19 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#endif
# 20 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
#define AFS_X86_XBSD_ENV 1

#define AFS_NAMEI_ENV     1	/* User space interface to file system */
#define AFS_64BIT_CLIENT 1
#define AFS_64BITPOINTER_ENV 1
#define AFS_64BITUSERPOINTER_ENV	1
#define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
#define AFS_FBSD_ENV 1
#define AFS_FBSD50_ENV 1
#define AFS_FBSD51_ENV 1
#define AFS_FBSD52_ENV 1
#define AFS_FBSD53_ENV 1
#define AFS_FBSD60_ENV 1
#define AFS_FBSD61_ENV 1
#define AFS_FBSD62_ENV 1
#define AFS_FBSD70_ENV 1
#define AFS_FBSD71_ENV 1
#define AFS_FBSD80_ENV 1
#define AFS_FBSD81_ENV 1
#define AFS_FBSD90_ENV 1
#define AFS_FBSD91_ENV 1
#define AFS_FBSD100_ENV 1
#define AFS_FBSD110_ENV 1
#define AFS_X86_FBSD_ENV 1
#define AFS_X86_FBSD50_ENV 1
#define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
#define AFS_X86_FBSD62_ENV 1
#define AFS_X86_FBSD70_ENV 1
#define AFS_X86_FBSD71_ENV 1
#define AFS_X86_FBSD80_ENV 1
#define AFS_X86_FBSD81_ENV 1
#define AFS_X86_FBSD90_ENV 1
#define AFS_X86_FBSD91_ENV 1
#define AFS_X86_FBSD100_ENV 1
#define AFS_X86_FBSD110_ENV 1
#define AFS_X86_ENV 1
#undef  AFS_NONFSTRANS
#define AFS_NONFSTRANS 1
#define FTRUNC O_TRUNC

#define IUPD 0x0010
#define IACC 0x0020
#define ICHG 0x0040
#define IMOD 0x0080

#define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
                                NULL, curproc)
#define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
                                NULL, curproc)

#if 0 /* expanded by -frewrite-includes */
#include <afs/afs_sysnames.h>
#endif /* expanded by -frewrite-includes */
# 73 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#define AFS_VFS_ENV	1
#define AFS_VFSINCL_ENV 1
#define AFS_GREEDY43_ENV	1
#define AFS_ENV  	1

#define AFS_SYSCALL	339
#define AFS_MOUNT_AFS	"afs"

#ifndef MOUNT_UFS
#define MOUNT_UFS "ufs"
#endif
# 85 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#ifndef	MOUNT_AFS
#define	MOUNT_AFS AFS_MOUNT_AFS
#endif
# 89 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#define RXK_LISTENER_ENV 1
#define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
#define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */

/* Extra kernel definitions (from kdefs file) */
#ifdef _KERNEL
#define AFS_GLOBAL_SUNLOCK        1
#define	AFS_VFS34	1	/* What is VFS34??? */
#define	AFS_SHORTGID	0	/* are group id's short? */
#define	afsio_iov	uio_iov
#define	afsio_iovcnt	uio_iovcnt
#define	afsio_offset	uio_offset
#define	afsio_seg	uio_segflg
#define	afsio_resid	uio_resid
#define	AFS_UIOSYS	UIO_SYSSPACE
#define	AFS_UIOUSER	UIO_USERSPACE
#define	AFS_CLBYTES	CLBYTES
#define	osi_GetTime(x)	microtime(x)
#define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
#undef	AFS_KALLOC_NOSLEEP
#define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
#define AFS_KFREE(x,y)  osi_fbsd_free((x))
#define	v_count		v_usecount
#define v_vfsp		v_mount
#define vfs_bsize	mnt_stat.f_bsize
#define vfs_fsid	mnt_stat.f_fsid
#define va_nodeid	va_fileid
#define vfs_vnodecovered mnt_vnodecovered
#define direct		dirent
#define vnode_t		struct vnode

#ifndef MUTEX_DEFAULT
#define MUTEX_DEFAULT   0
#endif /* MUTEX_DEFAULT */
# 124 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#ifndef SSYS
#define SSYS            0x00002
#endif /* SSYS */
# 128 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#define p_rcred         p_ucred

#if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
enum vcexcl { NONEXCL, EXCL };

#ifdef KERNEL
#ifndef MIN
#define MIN(A,B) ((A) < (B) ? (A) : (B))
#endif
# 138 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#ifndef MAX
#define MAX(A,B) ((A) > (B) ? (A) : (B))
#endif
# 141 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#endif /* KERNEL */
# 142 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
# 144 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#endif /* _KERNEL */
# 145 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#else /* !defined(UKERNEL) */
# 147 "/usr/home/kaduk/openafs/build/include/afs/param.h"

/* This section for user space compiles only */

#define UKERNEL			1	/* user space kernel */
#define AFS_ENV			1
#define AFS_VFSINCL_ENV         1
#define AFS_USR_FBSD50_ENV	1
#define AFS_USR_FBSD51_ENV	1
#define AFS_USR_FBSD52_ENV	1
#define AFS_USR_FBSD53_ENV	1
#define AFS_USR_FBSD60_ENV	1
#define AFS_USR_FBSD61_ENV	1
#define AFS_USR_FBSD70_ENV	1
#define AFS_USR_FBSD71_ENV	1
#define AFS_USR_FBSD80_ENV	1
#define AFS_USR_FBSD81_ENV	1
#define AFS_USR_FBSD90_ENV	1
#define AFS_USR_FBSD91_ENV	1
#define AFS_USR_FBSD100_ENV	1
#define AFS_USR_FBSD110_ENV	1
#define AFS_USR_FBSD_ENV	1
#undef  AFS_NONFSTRANS
#define AFS_NONFSTRANS 1

#define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
#define AFS_SYSCALL 339
#define AFS_NAMEI_ENV         1	/* User space interface to file system */
#define AFS_64BITPOINTER_ENV  1
#define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
#define AFS_USERSPACE_IP_ADDR 1
#define RXK_LISTENER_ENV      1
#define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */

#if 0 /* expanded by -frewrite-includes */
#include <afs/afs_sysnames.h>
#endif /* expanded by -frewrite-includes */
# 181 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#define	afsio_iov	uio_iov
#define	afsio_iovcnt	uio_iovcnt
#define	afsio_offset	uio_offset
#define	afsio_seg	uio_segflg
#define	afsio_fmode	uio_fmode
#define	afsio_resid	uio_resid
#define	AFS_UIOSYS	1
#define	AFS_UIOUSER	UIO_USERSPACE
#define	AFS_CLBYTES	MCLBYTES
#define	AFS_MINCHANGE	2
#define	VATTR_NULL	usr_vattr_null

#define AFS_DIRENT
#ifndef CMSERVERPREF
#define CMSERVERPREF
#endif
# 198 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#if 0 /* expanded by -frewrite-includes */
#include <sys/param.h>
#endif /* expanded by -frewrite-includes */
# 200 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 201 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/mount.h>
#endif /* expanded by -frewrite-includes */
# 202 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/fcntl.h>
#endif /* expanded by -frewrite-includes */
# 203 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/uio.h>
#endif /* expanded by -frewrite-includes */
# 204 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/socket.h>
#endif /* expanded by -frewrite-includes */
# 205 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <netinet/in.h>
#endif /* expanded by -frewrite-includes */
# 206 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <limits.h>
#endif /* expanded by -frewrite-includes */
# 207 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#endif /* !defined(UKERNEL) */
# 209 "/usr/home/kaduk/openafs/build/include/afs/param.h"

/* general user-space compiles */

#if defined(UKERNEL) || !defined(KERNEL)
#define STDLIB_HAS_MALLOC_PROTOS 1
#endif
# 215 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#endif /* AFS_PARAM_H */
# 217 "/usr/home/kaduk/openafs/build/include/afs/param.h"
# 20 "/usr/home/kaduk/openafs/build/include/afs/stds.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 21 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

#define IN			/* indicates a parameter is read in */
#define OUT			/* indicates a parameter is sent out (a ptr) */
#define INOUT			/* indicates a parameter is read in and sent out (a ptr) */

#ifndef	MACRO_BEGIN
#define MACRO_BEGIN	do {
#endif
# 29 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#ifndef	MACRO_END
#define MACRO_END	} while (0)
#endif
# 32 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

typedef void *opaque;

#ifndef _ATT4
#if defined(__HIGHC__)
/*
 * keep HC from complaining about the use of "old-style" function definitions
 * with prototypes
 */
pragma Off(Prototype_override_warnings);
#endif /* defined(__HIGHC__) */
# 43 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#endif
# 44 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

/* Now some types to enhance portability.  Always use these on the wire or when
 * laying out shared structures on disk. */

/* Imagine that this worked...
#if (sizeof(long) != 4) || (sizeof(short) != 2)
#error We require size of long and pointers to be equal
#endif */

#define MAX_AFS_INT32 0x7FFFFFFF
#define MIN_AFS_INT32 (-MAX_AFS_INT32 - 1)
#define MAX_AFS_UINT32 0xFFFFFFFF
#define MAX_AFS_INT64 0x7FFFFFFFFFFFFFFFL
#define MIN_AFS_INT64 (-MAX_AFS_INT64 - 1)
#define MAX_AFS_UINT64 0xFFFFFFFFFFFFFFFFL

typedef short afs_int16;
typedef unsigned short afs_uint16;
typedef int afs_int32;
typedef unsigned int afs_uint32;
#if defined(AFS_NT40_ENV) && defined(_MSC_VER)
typedef __int64 afs_int64;
typedef unsigned __int64 afs_uint64;
#else
# 68 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
typedef long long afs_int64;
typedef unsigned long long afs_uint64;
#endif
# 71 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define ZeroInt64(a)       (a = 0)
#define AssignInt64(a, b) *(b) = (a)
#define IncInt64(a) (*(a))++
#define IncUInt64(a) (*(a))++
#define DecInt64(a) (*(a))--
#define DecUInt64(a) (*(a))--
#define GTInt64(a,b) ((a) > (b))
#define GEInt64(a,b) ((a) >= (b))
#define LEInt64(a,b) ((a) <= (b))
#define LTInt64(a,b) ((a) < (b))
#define AddInt64(a,b,c) *(c) = (afs_int64)(a) + (afs_int64)(b)
#define AddUInt64(a,b,c) *(c) = (afs_uint64)(a) + (afs_uint64)(b)
#define SubtractInt64(a,b,c) *(c) = (afs_int64)(a) - (afs_int64)(b)
#define SubtractUInt64(a,b,c) *(c) = (afs_uint64)(a) - (afs_uint64)(b)
#define CompareInt64(a,b) (afs_int64)(a) - (afs_int64)(b)
#define CompareUInt64(a,b) (afs_uint64)(a) - (afs_uint64)(b)
#define NonZeroInt64(a)                (a)
#ifndef HAVE_INT64TOINT32
#define Int64ToInt32(a)    (a) & MAX_AFS_UINT32
#endif
# 91 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define FillInt64(t,h,l) (t) = ((afs_int64)(h) << 32) | (l)
#define SplitInt64(t,h,l) (h) = ((afs_int64)t) >> 32; (l) = (t) & MAX_AFS_UINT32
#define RoundInt64ToInt32(a)    (a > MAX_AFS_UINT32) ? MAX_AFS_UINT32 : a
#define RoundInt64ToInt31(a)    (a > MAX_AFS_INT32) ? MAX_AFS_INT32 : a

#ifdef AFS_64BIT_CLIENT
typedef afs_int64 afs_size_t;
typedef afs_uint64 afs_offs_t;
#else /* AFS_64BIT_CLIENT */
# 100 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
typedef afs_int32 afs_size_t;
typedef afs_uint32 afs_offs_t;
#endif /* AFS_64BIT_CLIENT */
# 103 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

typedef afs_int64 afs_foff_t;
typedef afs_uint64 afs_fsize_t;
typedef afs_int64 afs_sfsize_t;
#define SplitOffsetOrSize(t,h,l) SplitInt64(t,h,l)

/* Maximum integer sizes.  Also what is expected by %lld, %llu in
 * afs_snprintf. */
#ifdef AFS_64BIT_CLIENT
typedef afs_int64 afs_intmax_t;
typedef afs_uint64 afs_uintmax_t;
#else /* !AFS_64BIT_CLIENT */
# 115 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
typedef afs_int32 afs_intmax_t;
typedef afs_uint32 afs_uintmax_t;
#endif /* !AFS_64BIT_CLIENT */
# 118 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

/* you still have to include <netinet/in.h> to make these work */

#define hton32 htonl
#define hton16 htons
#define ntoh32 ntohl
#define ntoh16 ntohs


/* Since there is going to be considerable use of 64 bit integers we provide
 * some assistence in this matter.  The hyper type is supposed to be compatible
 * with the afsHyper type: the same macros will work on both. */

#if 0

typedef unsigned long afs_hyper_t;

#define	hcmp(a,b)	((a) < (b) ? -1 : ((a) > (b) ? 1 : 0))
#define	hsame(a,b)	((a) == (b))
#define	hiszero(a)	((a) == 0)
#define	hfitsin32(a)	((a) & 0xffffffff00000000) == 0)
#define	hset(a,b)	((a) = (b))
#define	hzero(a)	((a) = 0)
#define	hones(a)	((a) = ~((unsigned long)0))
#define	hget32(i,a)	((i) = (unsigned int)(a))
#define	hget64(hi,lo,a)	((lo) = ((unsigned int)(a)), (hi) = ((a) & (0xffffffff00000000)))
#define	hset32(a,i)	((a) = ((unsigned int)(i)))
#define	hset64(a,hi,lo)	((a) = (((hi) << 32) | (lo)))
#define hgetlo(a)	((a) & 0xffffffff)
#define hgethi(a)	(((unsigned int)(a)) >> 32)
#define	hadd(a,b)	((a) += (b))
/* XXX */
#define	hadd32(a,b)	((a) += (b))
#define hshlft(a,n)     ((a)<<(n))

#else /* 0*/
# 154 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

typedef struct afs_hyper_t {	/* unsigned 64 bit integers */
    unsigned int high;
    unsigned int low;
} afs_hyper_t;

#define hcmp(a,b) ((a).high<(b).high? -1 : ((a).high > (b).high? 1 : \
    ((a).low <(b).low? -1 : ((a).low > (b).low? 1 : 0))))
#define hsame(a,b) ((a).low == (b).low && (a).high == (b).high)
#define hiszero(a) ((a).low == 0 && (a).high == 0)
#define hfitsin32(a) ((a).high == 0)
#define hset(a,b) ((a) = (b))
#define hzero(a) ((a).low = 0, (a).high = 0)
#define hones(a) ((a).low = 0xffffffff, (a).high = 0xffffffff)
#define hget32(i,a) ((i) = (a).low)
#define hget64(hi,lo,a) ((lo) = (a).low, (hi) = (a).high)
#define hset32(a,i) ((a).high = 0, (a).low = (i))
#define hset64(a,hi,lo) ((a).high = (hi), (a).low = (lo))
#define hgetlo(a) ((a).low)
#define hgethi(a) ((a).high)
#define hshlft(a,n)                                                        \
     { /*Shift Left n bits*/                                               \
        int s = sizeof((a).low) * 8; /*#bits*/                             \
        if ((n) <= 0) { /*No shift*/                                       \
        } else if ((n) >= 2*s) { /*Shift off all bits*/                    \
           (a).high = (a).low = 0;                                         \
        } else if ((n) < s) { /*Part of low shifted into high*/            \
           (a).high = ((a).high<<(n)) | (((a).low>>(s-(n))) & (1<<(n))-1); \
           (a).low  = (a).low << (n);                                      \
        } else if ((n) >= s) { /*All of low shifted into high plus some*/  \
           (a).high = (a).low << ((n)-s);                                  \
           (a).low=0;                                                      \
        }                                                                  \
     }

/* The algorithm here is to check for two cases that cause a carry.  If the top
 * two bits are different then if the sum has the top bit off then there must
 * have been a carry.  If the top bits are both one then there is always a
 * carry.  We assume 32 bit ints and twos complement arithmetic. */

#define SIGN 0x80000000
#define hadd32(a,i) \
    ((void)((((a).low ^ (int)(i)) & SIGN) \
      ? (((((a).low + (int)(i)) & SIGN) == 0) && (a).high++) \
      : (((a).low & (int)(i) & SIGN) && (a).high++)), \
     (a).low += (int)(i))

#define hadd(a,b) (hadd32(a,(b).low), (a).high += (b).high)
#endif /* 0 */
# 203 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

#if !defined(KERNEL) || defined(UKERNEL)
#ifndef AFS_NT40_ENV
#define max(a, b)               ((a) < (b) ? (b) : (a))
#define min(a, b)               ((a) > (b) ? (b) : (a))
#endif
# 209 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
/*#define abs(x)                  ((x) >= 0 ? (x) : -(x))*/
#endif
# 211 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

/* minumum length of string to pass to int_to_base64 */
typedef char b64_string_t[8];
#ifndef AFS_NT40_ENV
#if defined(AFS_HPUX_ENV) || defined(AFS_USR_HPUX_ENV) || (defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV))
char *int_to_base64();
int base64_to_int();
#else
# 219 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
char *int_to_base64(b64_string_t s, int a);
int base64_to_int(char *s);
#endif
# 222 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#endif /* AFS_NT40_ENV */
# 223 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
/*
 * The afsUUID data type is built in to RX
 */
struct afsUUID {
    afs_uint32 time_low;
    afs_uint16 time_mid;
    afs_uint16 time_hi_and_version;
    char clock_seq_hi_and_reserved;
    char clock_seq_low;
    char node[6];
};
typedef struct afsUUID afsUUID;

/* for now, demand attach fileserver is only support on unix pthreads builds */
#if defined(DEMAND_ATTACH_ENABLE) && defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
#define AFS_DEMAND_ATTACH_FS 1
#endif
# 240 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

/* A macro that can be used when printf'ing 64 bit integers, as Unix and
 * windows use a different format string
 */
#ifdef AFS_NT40_ENV
# define AFS_INT64_FMT "I64d"
# define AFS_UINT64_FMT "I64u"
# define AFS_PTR_FMT   "p"
# define AFS_SIZET_FMT "Iu"
#else
# 250 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
# define AFS_INT64_FMT "lld"
# define AFS_UINT64_FMT "llu"
# define AFS_PTR_FMT   "p"
# ifdef PRINTF_TAKES_Z_LEN
#  define AFS_SIZET_FMT "zu"
# else
# 256 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#  define AFS_SIZET_FMT "lu"
# endif /* PRINTF_TAKES_Z_LEN */
# 258 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#endif /* AFS_NT40_ENV */
# 259 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define AFS_VOLID_FMT "lu"

/* Functions to safely cast afs_int32 and afs_uint32 so they can be used in
 * printf statemements with %ld and %lu
 */
#ifdef AFS_NT40_ENV
#define static_inline __inline static
#define hdr_static_inline(x) __inline static x
#elif defined(AFS_HPUX_ENV) || defined(AFS_USR_HPUX_ENV)
# 268 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
/* The HPUX compiler can segfault on 'static __inline', so fall back to
 * just 'static' so we can at least compile */
#define static_inline static
#define hdr_static_inline(x) static x
#elif defined(AFS_AIX_ENV) || defined(AFS_USR_AIX_ENV)
# 273 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define static_inline static
#define hdr_static_inline(x) static x
#elif defined(AFS_SGI_ENV) || defined(AFS_USR_SGI_ENV)
# 276 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define static_inline static
#define hdr_static_inline(x) x
#elif defined(AFS_NBSD_ENV) && !defined(AFS_NBSD50_ENV)
# 279 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define static_inline static __inline __attribute__((always_inline))
#define hdr_static_inline(x) static __inline __attribute__((always_inline)) x
#else
# 282 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define static_inline static inline
#define hdr_static_inline(x) static inline x
#endif
# 285 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

hdr_static_inline(long) afs_printable_int32_ld(afs_int32 d) { return (long) d; }

hdr_static_inline(unsigned long) afs_printable_uint32_lu(afs_uint32 d) { return (unsigned long) d; }

hdr_static_inline(long long) afs_printable_int64_ld(afs_int64 d) { return (long long) d; }

hdr_static_inline(unsigned long long) afs_printable_uint64_lu(afs_uint64 d) { return (unsigned long long) d; }

#ifdef AFS_64BITUSERPOINTER_ENV
#define afs_pointer_to_int(p)      ((afs_uint32)  (afs_uint64) (p))
#define afs_int_to_pointer(i)     ((void *) (afs_uint64) (i))
#else
# 298 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define afs_pointer_to_int(p)      ((afs_uint32)   (p))
#define afs_int_to_pointer(i)      ((void *)  (i))
#endif
# 301 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

#if defined(__GNUC__) && __GNUC__ > 2
#define AFS_UNUSED __attribute__((unused))
#define AFS_ATTRIBUTE_FORMAT(style,x,y) __attribute__((format(style, x, y)))
#define AFS_NORETURN __attribute__((__noreturn__))
#define AFS_NONNULL(x) __attribute__((__nonnull__ x))
#elif defined (__clang__)
# 308 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define AFS_UNUSED __attribute__((unused))
#define AFS_ATTRIBUTE_FORMAT(style,x,y) __attribute__((format(style, x, y)))
#define AFS_NORETURN __attribute__((__noreturn__))
#define AFS_NONNULL(x) __attribute__((__nonnull__ x))
#else
# 313 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
#define AFS_UNUSED
#define AFS_ATTRIBUTE_FORMAT(style,x,y)
#define AFS_NORETURN
#define AFS_NONNULL(x)
#endif
# 318 "/usr/home/kaduk/openafs/build/include/afs/stds.h"

#endif /* OPENAFS_CONFIG_AFS_STDS_H */
# 320 "/usr/home/kaduk/openafs/build/include/afs/stds.h"
# 26 "/usr/home/kaduk/openafs/build/include/afs/afs_sysnames.h" 2
#endif
# 27 "/usr/home/kaduk/openafs/build/include/afs/afs_sysnames.h"

#define	SYS_NAME_ID_UNDEFINED		   0


#define SYS_NAME_ID_aux_10		 200

#define SYS_NAME_ID_pmax_ul4		 305
#define SYS_NAME_ID_pmax_ul42		 307
#define SYS_NAME_ID_pmax_ul42a		 308
#define SYS_NAME_ID_pmax_ul43		 309
#define SYS_NAME_ID_pmax_ul43a		 310

#define SYS_NAME_ID_hp700_ux90		 407
#define SYS_NAME_ID_hp300_ux90		 408
#define SYS_NAME_ID_hp800_ux90		 409
#define SYS_NAME_ID_hp700_ux100	 	 410
#define SYS_NAME_ID_hp800_ux100	 	 411
#define SYS_NAME_ID_hp700_ux101	 	 412
#define SYS_NAME_ID_hp800_ux101	 	 413
#define SYS_NAME_ID_hp_ux102	 	 414
#define SYS_NAME_ID_hp_ux110	 	 415
#define SYS_NAME_ID_hp_ux11i             416
#define SYS_NAME_ID_ia64_hpux1122	 417
#define SYS_NAME_ID_ia64_hpux1123	 418
#define SYS_NAME_ID_hp_ux1123		 419

#define SYS_NAME_ID_mac2_51		 500
#define SYS_NAME_ID_mac_aux10		 501
#define SYS_NAME_ID_mac_mach51		 502
#define SYS_NAME_ID_ppc_darwin_12        503
#define SYS_NAME_ID_ppc_darwin_13        504
#define SYS_NAME_ID_ppc_darwin_14        505
#define SYS_NAME_ID_ppc_darwin_60        506
#define SYS_NAME_ID_ppc_darwin_70        507
#define SYS_NAME_ID_ppc_darwin_80        508
#define SYS_NAME_ID_x86_darwin_80        509
#define SYS_NAME_ID_ppc_darwin_90        510
#define SYS_NAME_ID_x86_darwin_90        511
#define SYS_NAME_ID_ppc_darwin_100       512
#define SYS_NAME_ID_ppc64_darwin_100     513
#define SYS_NAME_ID_x86_darwin_100       514
#define SYS_NAME_ID_amd64_darwin_100     515
#define SYS_NAME_ID_arm_darwin_100       516
#define SYS_NAME_ID_x86_darwin_110       517
#define SYS_NAME_ID_amd64_darwin_110     518
#define SYS_NAME_ID_arm_darwin_110       519
#define SYS_NAME_ID_x86_darwin_120       520
#define SYS_NAME_ID_amd64_darwin_120     521
#define SYS_NAME_ID_arm_darwin_120       522
#define SYS_NAME_ID_x86_darwin_130       523
#define SYS_NAME_ID_amd64_darwin_130     524
#define SYS_NAME_ID_arm_darwin_130       525

#define SYS_NAME_ID_next_mach20		 601
#define SYS_NAME_ID_next_mach30		 602

#define SYS_NAME_ID_rs_aix32		 701
#define SYS_NAME_ID_rs_aix41		 702
#define SYS_NAME_ID_rs_aix42		 703
#define SYS_NAME_ID_rs_aix51		 704
#define SYS_NAME_ID_rs_aix43		 705
#define SYS_NAME_ID_rs_aix52		 706
#define SYS_NAME_ID_rs_aix53		 707
#define SYS_NAME_ID_rs_aix61		 708

#define SYS_NAME_ID_sun3_411		 906
#define SYS_NAME_ID_sun3x_411		 912
#define SYS_NAME_ID_sun4_411		 917
#define SYS_NAME_ID_sun4c_411		 919
#define SYS_NAME_ID_sun4c_51		 920
#define SYS_NAME_ID_sun4m_51		 921
#define SYS_NAME_ID_sun4c_52		 923
#define SYS_NAME_ID_sun4m_52		 924
/* For sun4_52 */
#define SYS_NAME_ID_sun4c_53		 926
#define SYS_NAME_ID_sun4m_53		 927
#define SYS_NAME_ID_sun4_52		 928
#define SYS_NAME_ID_sun4_53		 929
#define SYS_NAME_ID_sun4_54		 930
#define SYS_NAME_ID_sun4m_54		 931
#define SYS_NAME_ID_sun4c_54		 932
#define SYS_NAME_ID_sunx86_54		 933
#define SYS_NAME_ID_sun4x_55           	 934
#define SYS_NAME_ID_sun4x_56           	 935
#define SYS_NAME_ID_sunx86_56          	 936
#define SYS_NAME_ID_sunx86_55          	 937
#define SYS_NAME_ID_sun4x_57		 938
#define SYS_NAME_ID_sun4x_58		 939
#define SYS_NAME_ID_sun4x_59		 940
#define SYS_NAME_ID_sun4x_510		 941
#define SYS_NAME_ID_sun4x_511		 942

/* Sigh. If I leave a gap here IBM will do this sequentially. If I don't
   they won't allocate sunx86 IDs at all. So leave a gap and pray. */
#define SYS_NAME_ID_sunx86_57		 950
#define SYS_NAME_ID_sunx86_58		 951
#define SYS_NAME_ID_sunx86_59		 952
#define SYS_NAME_ID_sunx86_510		 953
#define SYS_NAME_ID_sunx86_511		 954

#define SYS_NAME_ID_vax_ul4		1003
#define SYS_NAME_ID_vax_ul40		1004
#define SYS_NAME_ID_vax_ul43		1005

#define SYS_NAME_ID_sgi_50		1100
#define SYS_NAME_ID_sgi_51		1101
#define	SYS_NAME_ID_sgi_52		1102
#define	SYS_NAME_ID_sgi_53		1103
#define	SYS_NAME_ID_sgi_61		1104
#define	SYS_NAME_ID_sgi_62		1105
#define	SYS_NAME_ID_sgi_63		1106
#define	SYS_NAME_ID_sgi_64		1107
#define	SYS_NAME_ID_sgi_65		1108

#define SYS_NAME_ID_alpha_osf1		1200
#define SYS_NAME_ID_alpha_osf20		1201
#define SYS_NAME_ID_alpha_osf30		1202
#define SYS_NAME_ID_alpha_osf32		1203
#define SYS_NAME_ID_alpha_osf32c	1204
#define SYS_NAME_ID_alpha_dux40		1205
#define SYS_NAME_ID_alpha_dux50		1206
#define SYS_NAME_ID_alpha_dux51		1207

#define SYS_NAME_ID_ncrx86_20		1300
#define SYS_NAME_ID_ncrx86_30		1301

#define SYS_NAME_ID_i386_nt35		1400
#define SYS_NAME_ID_i386_win95	        1401
#define SYS_NAME_ID_i386_w2k            1402

#define SYS_NAME_ID_i386_linux2		1500
#define SYS_NAME_ID_i386_linux22	1501
#define SYS_NAME_ID_i386_linux24        1502
#define SYS_NAME_ID_i386_linux26        1503

#define SYS_NAME_ID_ppc_linux2          1600
#define SYS_NAME_ID_ppc_linux22         1601
#define SYS_NAME_ID_ppc_linux24         1602
#define SYS_NAME_ID_ppc_linux26         1603

#define SYS_NAME_ID_sparc_linux2	1700
#define SYS_NAME_ID_sparc_linux22	1701
#define SYS_NAME_ID_sparc_linux24	1702

#define SYS_NAME_ID_sparc64_linux2	1800
#define SYS_NAME_ID_sparc64_linux22	1801
#define SYS_NAME_ID_sparc64_linux24	1802
#define SYS_NAME_ID_sparc64_linux26	1803

#define SYS_NAME_ID_s390_linux2         1900
#define SYS_NAME_ID_s390_linux22        1901
#define SYS_NAME_ID_s390_linux24        1902
#define SYS_NAME_ID_s390_linux26        1907
#define SYS_NAME_ID_s390x_linux2         1903
#define SYS_NAME_ID_s390x_linux22        1904
#define SYS_NAME_ID_s390x_linux24        1905
#define SYS_NAME_ID_s390x_linux26        1906

#define SYS_NAME_ID_alpha_linux_2       2000
#define SYS_NAME_ID_alpha_linux_22      2001
#define SYS_NAME_ID_alpha_linux_24      2002
#define SYS_NAME_ID_alpha_linux_26      2003

#define SYS_NAME_ID_i386_fbsd_42        2100
#define SYS_NAME_ID_i386_fbsd_43        2101
#define SYS_NAME_ID_i386_fbsd_44        2102
#define SYS_NAME_ID_i386_fbsd_45        2103
#define SYS_NAME_ID_i386_fbsd_46        2103
#define SYS_NAME_ID_i386_fbsd_47        2104
#define SYS_NAME_ID_i386_fbsd_50        2105
#define SYS_NAME_ID_i386_fbsd_51        2106
#define SYS_NAME_ID_i386_fbsd_52        2107
#define SYS_NAME_ID_i386_fbsd_53        2108
#define SYS_NAME_ID_i386_fbsd_60        2112
#define SYS_NAME_ID_i386_fbsd_61        2113
#define SYS_NAME_ID_i386_fbsd_62        2114
#define SYS_NAME_ID_i386_fbsd_70        2115
#define SYS_NAME_ID_i386_fbsd_71        2116
#define SYS_NAME_ID_i386_fbsd_72        2130
#define SYS_NAME_ID_i386_fbsd_73        2131
#define SYS_NAME_ID_i386_fbsd_74        2132
#define SYS_NAME_ID_i386_fbsd_80        2117
#define SYS_NAME_ID_i386_fbsd_81        2118
#define SYS_NAME_ID_i386_fbsd_82        2119
#define SYS_NAME_ID_i386_fbsd_83        2121
#define SYS_NAME_ID_i386_fbsd_84        2123
#define SYS_NAME_ID_i386_fbsd_90        2120
#define SYS_NAME_ID_i386_fbsd_91        2122
#define SYS_NAME_ID_i386_fbsd_92        2124
#define SYS_NAME_ID_i386_fbsd_100      2130
#define SYS_NAME_ID_i386_fbsd_110      2140

#define SYS_NAME_ID_ia64_linux2		2200
#define SYS_NAME_ID_ia64_linux22	2201
#define SYS_NAME_ID_ia64_linux24	2202
#define SYS_NAME_ID_ia64_linux26	2203

#define SYS_NAME_ID_m68k_linux22        2301
#define SYS_NAME_ID_m68k_linux24        2302

#define SYS_NAME_ID_parisc_linux22      2401
#define SYS_NAME_ID_parisc_linux24      2402

#define SYS_NAME_ID_i386_nbsd15         2501
#define SYS_NAME_ID_alpha_nbsd15        2502
#define SYS_NAME_ID_sparc_nbsd15        2503
#define SYS_NAME_ID_sparc64_nbsd15      2504

#define SYS_NAME_ID_i386_nbsd16         2510
#define SYS_NAME_ID_alpha_nbsd16        2511
#define SYS_NAME_ID_sparc_nbsd16        2512
#define SYS_NAME_ID_sparc64_nbsd16      2513
#define SYS_NAME_ID_macppc_nbsd16       2514

#define SYS_NAME_ID_i386_nbsd20         2520
#define SYS_NAME_ID_alpha_nbsd20        2521
#define SYS_NAME_ID_sparc_nbsd20        2522
#define SYS_NAME_ID_sparc64_nbsd20      2523
#define SYS_NAME_ID_macppc_nbsd20       2524
#define SYS_NAME_ID_i386_nbsd21         2525
#define SYS_NAME_ID_i386_nbsd30         2526
#define SYS_NAME_ID_amd64_nbsd20        2527
#define SYS_NAME_ID_i386_nbsd40         2528
#define SYS_NAME_ID_i386_nbsd50         2529
#define SYS_NAME_ID_sparc64_nbsd30      2530
#define SYS_NAME_ID_sparc64_nbsd40      2531
#define SYS_NAME_ID_sparc64_nbsd50      2532
#define SYS_NAME_ID_amd64_nbsd30        2533
#define SYS_NAME_ID_amd64_nbsd40        2534
#define SYS_NAME_ID_amd64_nbsd50        2535
#define SYS_NAME_ID_alpha_nbsd30        2536
#define SYS_NAME_ID_alpha_nbsd40        2537
#define SYS_NAME_ID_alpha_nbsd50        2538
#define SYS_NAME_ID_macppc_nbsd30       2539
#define SYS_NAME_ID_macppc_nbsd40       2540
#define SYS_NAME_ID_macppc_nbsd50       2541
#define SYS_NAME_ID_amd64_nbsd60        2542
#define SYS_NAME_ID_i386_nbsd60         2543
#define SYS_NAME_ID_amd64_nbsd70        2544
#define SYS_NAME_ID_i386_nbsd70         2545

#define SYS_NAME_ID_i386_obsd31		2600
#define SYS_NAME_ID_i386_obsd32		2601
#define SYS_NAME_ID_i386_obsd33		2602
#define SYS_NAME_ID_i386_obsd34		2603
#define SYS_NAME_ID_i386_obsd35		2604
#define SYS_NAME_ID_i386_obsd36		2605
#define SYS_NAME_ID_i386_obsd37		2606
#define SYS_NAME_ID_i386_obsd38		2607
#define SYS_NAME_ID_i386_obsd39		2608
#define SYS_NAME_ID_i386_obsd40         2609
#define SYS_NAME_ID_i386_obsd41         2610
#define SYS_NAME_ID_i386_obsd42         2611
#define SYS_NAME_ID_i386_obsd43         2612
#define SYS_NAME_ID_i386_obsd44         2613
#define SYS_NAME_ID_i386_obsd45         2614
#define SYS_NAME_ID_i386_obsd46         2615
#define SYS_NAME_ID_i386_obsd47         2616
#define SYS_NAME_ID_i386_obsd48         2617
#define SYS_NAME_ID_i386_obsd49         2618
#define SYS_NAME_ID_i386_obsd50         2619
#define SYS_NAME_ID_i386_obsd51         2620
#define SYS_NAME_ID_i386_obsd52         2621
#define SYS_NAME_ID_i386_obsd53         2622
#define SYS_NAME_ID_i386_obsd54         2623

#define SYS_NAME_ID_amd64_linux2        2700
#define SYS_NAME_ID_amd64_linux22       2701
#define SYS_NAME_ID_amd64_linux24       2702
#define SYS_NAME_ID_amd64_linux26       2703

#define SYS_NAME_ID_i386_umlinux2	2800
#define SYS_NAME_ID_i386_umlinux22	2801
#define SYS_NAME_ID_i386_umlinux24	2802
#define SYS_NAME_ID_i386_umlinux26	2803

#define SYS_NAME_ID_ppc64_linux2	2900
#define SYS_NAME_ID_ppc64_linux22	2901
#define SYS_NAME_ID_ppc64_linux24	2902
#define SYS_NAME_ID_ppc64_linux26	2903

#define SYS_NAME_ID_amd64_fbsd_53       3008
#define SYS_NAME_ID_amd64_fbsd_70       3009
#define SYS_NAME_ID_amd64_fbsd_71       3010
#define SYS_NAME_ID_amd64_fbsd_72       3030
#define SYS_NAME_ID_amd64_fbsd_73       3031
#define SYS_NAME_ID_amd64_fbsd_74       3032
#define SYS_NAME_ID_amd64_fbsd_80       3011
#define SYS_NAME_ID_amd64_fbsd_81       3012
#define SYS_NAME_ID_amd64_fbsd_82       3013
#define SYS_NAME_ID_amd64_fbsd_83       3014
#define SYS_NAME_ID_amd64_fbsd_84       3015
#define SYS_NAME_ID_amd64_fbsd_90       3020
#define SYS_NAME_ID_amd64_fbsd_91       3022
#define SYS_NAME_ID_amd64_fbsd_92       3023
#define SYS_NAME_ID_amd64_fbsd_100     3030
#define SYS_NAME_ID_amd64_fbsd_110     3040

#define SYS_NAME_ID_amd64_w2k           3400

#define SYS_NAME_ID_i64_w2k             3500

#define SYS_NAME_ID_arm_linux2          3800
#define SYS_NAME_ID_arm_linux22         3801
#define SYS_NAME_ID_arm_linux24         3802
#define SYS_NAME_ID_arm_linux26         3803

#define SYS_NAME_ID_i386_dfbsd_22        3900
#define SYS_NAME_ID_i386_dfbsd_23        3901
#define SYS_NAME_ID_i386_dfbsd_24        3902
#define SYS_NAME_ID_i386_dfbsd_25        3903
#define SYS_NAME_ID_i386_dfbsd_26        3904
#define SYS_NAME_ID_i386_dfbsd_27        3905

#define SYS_NAME_ID_amd64_obsd36        4005
#define SYS_NAME_ID_amd64_obsd37        4006
#define SYS_NAME_ID_amd64_obsd38        4007
#define SYS_NAME_ID_amd64_obsd39        4008
#define SYS_NAME_ID_amd64_obsd40        4009
#define SYS_NAME_ID_amd64_obsd41        4010
#define SYS_NAME_ID_amd64_obsd42        4011
#define SYS_NAME_ID_amd64_obsd43        4012
#define SYS_NAME_ID_amd64_obsd44        4013
#define SYS_NAME_ID_amd64_obsd45        4014
#define SYS_NAME_ID_amd64_obsd46        4015
#define SYS_NAME_ID_amd64_obsd47        4016
#define SYS_NAME_ID_amd64_obsd48        4017
#define SYS_NAME_ID_amd64_obsd49        4018
#define SYS_NAME_ID_amd64_obsd50        4019
#define SYS_NAME_ID_amd64_obsd51        4020
#define SYS_NAME_ID_amd64_obsd52        4021
#define SYS_NAME_ID_amd64_obsd53        4022
#define SYS_NAME_ID_amd64_obsd54        4023


#define	AFS_REALM_SZ	64

/* Specifies the number of equivalent local realm names */
#define AFS_NUM_LREALMS 4

#endif /* __AFS_SYSNAMES_INCL_ENV_ */
# 368 "/usr/home/kaduk/openafs/build/include/afs/afs_sysnames.h"
# 73 "/usr/home/kaduk/openafs/build/include/afs/param.h" 2

#define AFS_VFS_ENV	1
#define AFS_VFSINCL_ENV 1
#define AFS_GREEDY43_ENV	1
#define AFS_ENV  	1

#define AFS_SYSCALL	339
#define AFS_MOUNT_AFS	"afs"

#ifndef MOUNT_UFS
#define MOUNT_UFS "ufs"
#endif
# 85 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#ifndef	MOUNT_AFS
#define	MOUNT_AFS AFS_MOUNT_AFS
#endif
# 89 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#define RXK_LISTENER_ENV 1
#define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
#define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */

/* Extra kernel definitions (from kdefs file) */
#ifdef _KERNEL
#define AFS_GLOBAL_SUNLOCK        1
#define	AFS_VFS34	1	/* What is VFS34??? */
#define	AFS_SHORTGID	0	/* are group id's short? */
#define	afsio_iov	uio_iov
#define	afsio_iovcnt	uio_iovcnt
#define	afsio_offset	uio_offset
#define	afsio_seg	uio_segflg
#define	afsio_resid	uio_resid
#define	AFS_UIOSYS	UIO_SYSSPACE
#define	AFS_UIOUSER	UIO_USERSPACE
#define	AFS_CLBYTES	CLBYTES
#define	osi_GetTime(x)	microtime(x)
#define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
#undef	AFS_KALLOC_NOSLEEP
#define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
#define AFS_KFREE(x,y)  osi_fbsd_free((x))
#define	v_count		v_usecount
#define v_vfsp		v_mount
#define vfs_bsize	mnt_stat.f_bsize
#define vfs_fsid	mnt_stat.f_fsid
#define va_nodeid	va_fileid
#define vfs_vnodecovered mnt_vnodecovered
#define direct		dirent
#define vnode_t		struct vnode

#ifndef MUTEX_DEFAULT
#define MUTEX_DEFAULT   0
#endif /* MUTEX_DEFAULT */
# 124 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#ifndef SSYS
#define SSYS            0x00002
#endif /* SSYS */
# 128 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#define p_rcred         p_ucred

#if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
enum vcexcl { NONEXCL, EXCL };

#ifdef KERNEL
#ifndef MIN
#define MIN(A,B) ((A) < (B) ? (A) : (B))
#endif
# 138 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#ifndef MAX
#define MAX(A,B) ((A) > (B) ? (A) : (B))
#endif
# 141 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#endif /* KERNEL */
# 142 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
# 144 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#endif /* _KERNEL */
# 145 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#else /* !defined(UKERNEL) */
# 147 "/usr/home/kaduk/openafs/build/include/afs/param.h"

/* This section for user space compiles only */

#define UKERNEL			1	/* user space kernel */
#define AFS_ENV			1
#define AFS_VFSINCL_ENV         1
#define AFS_USR_FBSD50_ENV	1
#define AFS_USR_FBSD51_ENV	1
#define AFS_USR_FBSD52_ENV	1
#define AFS_USR_FBSD53_ENV	1
#define AFS_USR_FBSD60_ENV	1
#define AFS_USR_FBSD61_ENV	1
#define AFS_USR_FBSD70_ENV	1
#define AFS_USR_FBSD71_ENV	1
#define AFS_USR_FBSD80_ENV	1
#define AFS_USR_FBSD81_ENV	1
#define AFS_USR_FBSD90_ENV	1
#define AFS_USR_FBSD91_ENV	1
#define AFS_USR_FBSD100_ENV	1
#define AFS_USR_FBSD110_ENV	1
#define AFS_USR_FBSD_ENV	1
#undef  AFS_NONFSTRANS
#define AFS_NONFSTRANS 1

#define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
#define AFS_SYSCALL 339
#define AFS_NAMEI_ENV         1	/* User space interface to file system */
#define AFS_64BITPOINTER_ENV  1
#define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
#define AFS_USERSPACE_IP_ADDR 1
#define RXK_LISTENER_ENV      1
#define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */

#if 0 /* expanded by -frewrite-includes */
#include <afs/afs_sysnames.h>
#endif /* expanded by -frewrite-includes */
# 181 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#define	afsio_iov	uio_iov
#define	afsio_iovcnt	uio_iovcnt
#define	afsio_offset	uio_offset
#define	afsio_seg	uio_segflg
#define	afsio_fmode	uio_fmode
#define	afsio_resid	uio_resid
#define	AFS_UIOSYS	1
#define	AFS_UIOUSER	UIO_USERSPACE
#define	AFS_CLBYTES	MCLBYTES
#define	AFS_MINCHANGE	2
#define	VATTR_NULL	usr_vattr_null

#define AFS_DIRENT
#ifndef CMSERVERPREF
#define CMSERVERPREF
#endif
# 198 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#if 0 /* expanded by -frewrite-includes */
#include <sys/param.h>
#endif /* expanded by -frewrite-includes */
# 200 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 201 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/mount.h>
#endif /* expanded by -frewrite-includes */
# 202 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/fcntl.h>
#endif /* expanded by -frewrite-includes */
# 203 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/uio.h>
#endif /* expanded by -frewrite-includes */
# 204 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/socket.h>
#endif /* expanded by -frewrite-includes */
# 205 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <netinet/in.h>
#endif /* expanded by -frewrite-includes */
# 206 "/usr/home/kaduk/openafs/build/include/afs/param.h"
#if 0 /* expanded by -frewrite-includes */
#include <limits.h>
#endif /* expanded by -frewrite-includes */
# 207 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#endif /* !defined(UKERNEL) */
# 209 "/usr/home/kaduk/openafs/build/include/afs/param.h"

/* general user-space compiles */

#if defined(UKERNEL) || !defined(KERNEL)
#define STDLIB_HAS_MALLOC_PROTOS 1
#endif
# 215 "/usr/home/kaduk/openafs/build/include/afs/param.h"

#endif /* AFS_PARAM_H */
# 217 "/usr/home/kaduk/openafs/build/include/afs/param.h"
# 66 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2

#if 0 /* expanded by -frewrite-includes */
#include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/stdio.h" 1 3 4
/*-
 * Copyright (c) 1990, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * Chris Torek.
 *
 * 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. 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.
 *
 *	@(#)stdio.h	8.5 (Berkeley) 4/29/95
 * $FreeBSD: head/include/stdio.h 265881 2014-05-11 16:34:17Z jilles $
 */

#ifndef	_STDIO_H_
#define	_STDIO_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 40 "/usr/include/stdio.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 41 "/usr/include/stdio.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 42 "/usr/include/stdio.h" 3 4

typedef	__off_t		fpos_t;

#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 49 "/usr/include/stdio.h" 3 4

#if __POSIX_VISIBLE >= 200809
#ifndef _OFF_T_DECLARED
#define	_OFF_T_DECLARED
typedef	__off_t		off_t;
#endif
# 55 "/usr/include/stdio.h" 3 4
#ifndef _SSIZE_T_DECLARED
#define	_SSIZE_T_DECLARED
typedef	__ssize_t	ssize_t;
#endif
# 59 "/usr/include/stdio.h" 3 4
#endif
# 60 "/usr/include/stdio.h" 3 4

#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#ifndef _VA_LIST_DECLARED
typedef	__va_list	va_list;
#define	_VA_LIST_DECLARED
#endif
# 66 "/usr/include/stdio.h" 3 4
#endif
# 67 "/usr/include/stdio.h" 3 4

#define	_FSTDIO			/* Define for new stdio with functions. */

/*
 * NB: to fit things in six character monocase externals, the stdio
 * code uses the prefix `__s' for stdio objects, typically followed
 * by a three-character attempt at a mnemonic.
 */

/* stdio buffers */
struct __sbuf {
	unsigned char *_base;
	int	_size;
};

/*
 * stdio state variables.
 *
 * The following always hold:
 *
 *	if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
 *		_lbfsize is -_bf._size, else _lbfsize is 0
 *	if _flags&__SRD, _w is 0
 *	if _flags&__SWR, _r is 0
 *
 * This ensures that the getc and putc macros (or inline functions) never
 * try to write or read from a file that is in `read' or `write' mode.
 * (Moreover, they can, and do, automatically switch from read mode to
 * write mode, and back, on "r+" and "w+" files.)
 *
 * _lbfsize is used only to make the inline line-buffered output stream
 * code as compact as possible.
 *
 * _ub, _up, and _ur are used when ungetc() pushes back more characters
 * than fit in the current _bf, or when ungetc() pushes back a character
 * that does not match the previous one in _bf.  When this happens,
 * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
 * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
 *
 * Certain members of __sFILE are accessed directly via macros or
 * inline functions.  To preserve ABI compat, these members must not
 * be disturbed.  These members are marked below with (*).
 */
struct __sFILE {
	unsigned char *_p;	/* (*) current position in (some) buffer */
	int	_r;		/* (*) read space left for getc() */
	int	_w;		/* (*) write space left for putc() */
	short	_flags;		/* (*) flags, below; this FILE is free if 0 */
	short	_file;		/* (*) fileno, if Unix descriptor, else -1 */
	struct	__sbuf _bf;	/* (*) the buffer (at least 1 byte, if !NULL) */
	int	_lbfsize;	/* (*) 0 or -_bf._size, for inline putc */

	/* operations */
	void	*_cookie;	/* (*) cookie passed to io functions */
	int	(*_close)(void *);
	int	(*_read)(void *, char *, int);
	fpos_t	(*_seek)(void *, fpos_t, int);
	int	(*_write)(void *, const char *, int);

	/* separate buffer for long sequences of ungetc() */
	struct	__sbuf _ub;	/* ungetc buffer */
	unsigned char	*_up;	/* saved _p when _p is doing ungetc data */
	int	_ur;		/* saved _r when _r is counting ungetc data */

	/* tricks to meet minimum requirements even when malloc() fails */
	unsigned char _ubuf[3];	/* guarantee an ungetc() buffer */
	unsigned char _nbuf[1];	/* guarantee a getc() buffer */

	/* separate buffer for fgetln() when line crosses buffer boundary */
	struct	__sbuf _lb;	/* buffer for fgetln() */

	/* Unix stdio files get aligned to block boundaries on fseek() */
	int	_blksize;	/* stat.st_blksize (may be != _bf._size) */
	fpos_t	_offset;	/* current lseek offset */

	struct pthread_mutex *_fl_mutex;	/* used for MT-safety */
	struct pthread *_fl_owner;	/* current owner */
	int	_fl_count;	/* recursive lock count */
	int	_orientation;	/* orientation for fwide() */
	__mbstate_t _mbstate;	/* multibyte conversion state */
};
#ifndef _STDFILE_DECLARED
#define _STDFILE_DECLARED
typedef struct __sFILE FILE;
#endif
# 152 "/usr/include/stdio.h" 3 4
#ifndef _STDSTREAM_DECLARED
__BEGIN_DECLS
extern FILE *__stdinp;
extern FILE *__stdoutp;
extern FILE *__stderrp;
__END_DECLS
#define	_STDSTREAM_DECLARED
#endif
# 160 "/usr/include/stdio.h" 3 4

#define	__SLBF	0x0001		/* line buffered */
#define	__SNBF	0x0002		/* unbuffered */
#define	__SRD	0x0004		/* OK to read */
#define	__SWR	0x0008		/* OK to write */
	/* RD and WR are never simultaneously asserted */
#define	__SRW	0x0010		/* open for reading & writing */
#define	__SEOF	0x0020		/* found EOF */
#define	__SERR	0x0040		/* found error */
#define	__SMBF	0x0080		/* _buf is from malloc */
#define	__SAPP	0x0100		/* fdopen()ed in append mode */
#define	__SSTR	0x0200		/* this is an sprintf/snprintf string */
#define	__SOPT	0x0400		/* do fseek() optimization */
#define	__SNPT	0x0800		/* do not do fseek() optimization */
#define	__SOFF	0x1000		/* set iff _offset is in fact correct */
#define	__SMOD	0x2000		/* true => fgetln modified _p text */
#define	__SALC	0x4000		/* allocate string space dynamically */
#define	__SIGN	0x8000		/* ignore this file in _fwalk */

/*
 * The following three definitions are for ANSI C, which took them
 * from System V, which brilliantly took internal interface macros and
 * made them official arguments to setvbuf(), without renaming them.
 * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
 *
 * Although numbered as their counterparts above, the implementation
 * does not rely on this.
 */
#define	_IOFBF	0		/* setvbuf should set fully buffered */
#define	_IOLBF	1		/* setvbuf should set line buffered */
#define	_IONBF	2		/* setvbuf should set unbuffered */

#define	BUFSIZ	1024		/* size of buffer used by setbuf */
#define	EOF	(-1)

/*
 * FOPEN_MAX is a minimum maximum, and is the number of streams that
 * stdio can provide without attempting to allocate further resources
 * (which could fail).  Do not use this for anything.
 */
				/* must be == _POSIX_STREAM_MAX <limits.h> */
#ifndef FOPEN_MAX
#define	FOPEN_MAX	20	/* must be <= OPEN_MAX <sys/syslimits.h> */
#endif
# 204 "/usr/include/stdio.h" 3 4
#define	FILENAME_MAX	1024	/* must be <= PATH_MAX <sys/syslimits.h> */

/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
#if __XSI_VISIBLE
#define	P_tmpdir	"/tmp/"
#endif
# 210 "/usr/include/stdio.h" 3 4
#define	L_tmpnam	1024	/* XXX must be == PATH_MAX */
#define	TMP_MAX		308915776

#ifndef SEEK_SET
#define	SEEK_SET	0	/* set file offset to offset */
#endif
# 216 "/usr/include/stdio.h" 3 4
#ifndef SEEK_CUR
#define	SEEK_CUR	1	/* set file offset to current plus offset */
#endif
# 219 "/usr/include/stdio.h" 3 4
#ifndef SEEK_END
#define	SEEK_END	2	/* set file offset to EOF plus offset */
#endif
# 222 "/usr/include/stdio.h" 3 4

#define	stdin	__stdinp
#define	stdout	__stdoutp
#define	stderr	__stderrp

__BEGIN_DECLS
#ifdef _XLOCALE_H_
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_stdio.h>
#endif /* expanded by -frewrite-includes */
# 230 "/usr/include/stdio.h" 3 4
#endif
# 231 "/usr/include/stdio.h" 3 4
/*
 * Functions defined in ANSI C standard.
 */
void	 clearerr(FILE *);
int	 fclose(FILE *);
int	 feof(FILE *);
int	 ferror(FILE *);
int	 fflush(FILE *);
int	 fgetc(FILE *);
int	 fgetpos(FILE * __restrict, fpos_t * __restrict);
char	*fgets(char * __restrict, int, FILE * __restrict);
FILE	*fopen(const char * __restrict, const char * __restrict);
int	 fprintf(FILE * __restrict, const char * __restrict, ...);
int	 fputc(int, FILE *);
int	 fputs(const char * __restrict, FILE * __restrict);
size_t	 fread(void * __restrict, size_t, size_t, FILE * __restrict);
FILE	*freopen(const char * __restrict, const char * __restrict, FILE * __restrict);
int	 fscanf(FILE * __restrict, const char * __restrict, ...);
int	 fseek(FILE *, long, int);
int	 fsetpos(FILE *, const fpos_t *);
long	 ftell(FILE *);
size_t	 fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
int	 getc(FILE *);
int	 getchar(void);
char	*gets(char *);
void	 perror(const char *);
int	 printf(const char * __restrict, ...);
int	 putc(int, FILE *);
int	 putchar(int);
int	 puts(const char *);
int	 remove(const char *);
int	 rename(const char *, const char *);
void	 rewind(FILE *);
int	 scanf(const char * __restrict, ...);
void	 setbuf(FILE * __restrict, char * __restrict);
int	 setvbuf(FILE * __restrict, char * __restrict, int, size_t);
int	 sprintf(char * __restrict, const char * __restrict, ...);
int	 sscanf(const char * __restrict, const char * __restrict, ...);
FILE	*tmpfile(void);
char	*tmpnam(char *);
int	 ungetc(int, FILE *);
int	 vfprintf(FILE * __restrict, const char * __restrict,
	    __va_list);
int	 vprintf(const char * __restrict, __va_list);
int	 vsprintf(char * __restrict, const char * __restrict,
	    __va_list);

#if __ISO_C_VISIBLE >= 1999
int	 snprintf(char * __restrict, size_t, const char * __restrict,
	    ...) __printflike(3, 4);
int	 vfscanf(FILE * __restrict, const char * __restrict, __va_list)
	    __scanflike(2, 0);
int	 vscanf(const char * __restrict, __va_list) __scanflike(1, 0);
int	 vsnprintf(char * __restrict, size_t, const char * __restrict,
	    __va_list) __printflike(3, 0);
int	 vsscanf(const char * __restrict, const char * __restrict, __va_list)
	    __scanflike(2, 0);
#endif
# 289 "/usr/include/stdio.h" 3 4

/*
 * Functions defined in all versions of POSIX 1003.1.
 */
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506)
#define	L_cuserid	17	/* size for cuserid(3); MAXLOGNAME, legacy */
#endif
# 296 "/usr/include/stdio.h" 3 4

#if __POSIX_VISIBLE
#define	L_ctermid	1024	/* size for ctermid(3); PATH_MAX */

char	*ctermid(char *);
FILE	*fdopen(int, const char *);
int	 fileno(FILE *);
#endif /* __POSIX_VISIBLE */
# 304 "/usr/include/stdio.h" 3 4

#if __POSIX_VISIBLE >= 199209
int	 pclose(FILE *);
FILE	*popen(const char *, const char *);
#endif
# 309 "/usr/include/stdio.h" 3 4

#if __POSIX_VISIBLE >= 199506
int	 ftrylockfile(FILE *);
void	 flockfile(FILE *);
void	 funlockfile(FILE *);

/*
 * These are normally used through macros as defined below, but POSIX
 * requires functions as well.
 */
int	 getc_unlocked(FILE *);
int	 getchar_unlocked(void);
int	 putc_unlocked(int, FILE *);
int	 putchar_unlocked(int);
#endif
# 324 "/usr/include/stdio.h" 3 4
#if __BSD_VISIBLE
void	 clearerr_unlocked(FILE *);
int	 feof_unlocked(FILE *);
int	 ferror_unlocked(FILE *);
int	 fileno_unlocked(FILE *);
#endif
# 330 "/usr/include/stdio.h" 3 4

#if __POSIX_VISIBLE >= 200112
int	 fseeko(FILE *, __off_t, int);
__off_t	 ftello(FILE *);
#endif
# 335 "/usr/include/stdio.h" 3 4

#if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600
int	 getw(FILE *);
int	 putw(int, FILE *);
#endif /* BSD or X/Open before issue 6 */
# 340 "/usr/include/stdio.h" 3 4

#if __XSI_VISIBLE
char	*tempnam(const char *, const char *);
#endif
# 344 "/usr/include/stdio.h" 3 4

#if __POSIX_VISIBLE >= 200809
FILE	*fmemopen(void * __restrict, size_t, const char * __restrict);
ssize_t	 getdelim(char ** __restrict, size_t * __restrict, int,
	    FILE * __restrict);
FILE	*open_memstream(char **, size_t *);
int	 renameat(int, const char *, int, const char *);
int	 vdprintf(int, const char * __restrict, __va_list);

/*
 * Every programmer and his dog wrote functions called getline() and dprintf()
 * before POSIX.1-2008 came along and decided to usurp the names, so we
 * don't prototype them by default unless one of the following is true:
 *   a) the app has requested them specifically by defining _WITH_GETLINE or
 *      _WITH_DPRINTF, respectively
 *   b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE
 *   c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE
 */
#ifndef _WITH_GETLINE
#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define	_WITH_GETLINE
#elif defined(_POSIX_C_SOURCE)
# 366 "/usr/include/stdio.h" 3 4
#if _POSIX_C_SOURCE >= 200809
#define	_WITH_GETLINE
#endif
# 369 "/usr/include/stdio.h" 3 4
#endif
# 370 "/usr/include/stdio.h" 3 4
#endif
# 371 "/usr/include/stdio.h" 3 4

#ifdef _WITH_GETLINE
ssize_t	 getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
#endif
# 375 "/usr/include/stdio.h" 3 4

#ifndef _WITH_DPRINTF
#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define	_WITH_DPRINTF
#elif defined(_POSIX_C_SOURCE)
# 380 "/usr/include/stdio.h" 3 4
#if _POSIX_C_SOURCE >= 200809
#define	_WITH_DPRINTF
#endif
# 383 "/usr/include/stdio.h" 3 4
#endif
# 384 "/usr/include/stdio.h" 3 4
#endif
# 385 "/usr/include/stdio.h" 3 4

#ifdef _WITH_DPRINTF
int	 (dprintf)(int, const char * __restrict, ...);
#endif
# 389 "/usr/include/stdio.h" 3 4

#endif /* __POSIX_VISIBLE >= 200809 */
# 391 "/usr/include/stdio.h" 3 4

/*
 * Routines that are purely local.
 */
#if __BSD_VISIBLE
int	 asprintf(char **, const char *, ...) __printflike(2, 3);
char	*ctermid_r(char *);
void	 fcloseall(void);
char	*fgetln(FILE *, size_t *);
const char *fmtcheck(const char *, const char *) __format_arg(2);
int	 fpurge(FILE *);
void	 setbuffer(FILE *, char *, int);
int	 setlinebuf(FILE *);
int	 vasprintf(char **, const char *, __va_list)
	    __printflike(2, 0);

/*
 * The system error table contains messages for the first sys_nerr
 * positive errno values.  Use strerror() or strerror_r() from <string.h>
 * instead.
 */
extern const int sys_nerr;
extern const char * const sys_errlist[];

/*
 * Stdio function-access interface.
 */
FILE	*funopen(const void *,
	    int (*)(void *, char *, int),
	    int (*)(void *, const char *, int),
	    fpos_t (*)(void *, fpos_t, int),
	    int (*)(void *));
#define	fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define	fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)

/*
 * Portability hacks.  See <sys/types.h>.
 */
#ifndef _FTRUNCATE_DECLARED
#define	_FTRUNCATE_DECLARED
int	 ftruncate(int, __off_t);
#endif
# 433 "/usr/include/stdio.h" 3 4
#ifndef _LSEEK_DECLARED
#define	_LSEEK_DECLARED
__off_t	 lseek(int, __off_t, int);
#endif
# 437 "/usr/include/stdio.h" 3 4
#ifndef _MMAP_DECLARED
#define	_MMAP_DECLARED
void	*mmap(void *, size_t, int, int, int, __off_t);
#endif
# 441 "/usr/include/stdio.h" 3 4
#ifndef _TRUNCATE_DECLARED
#define	_TRUNCATE_DECLARED
int	 truncate(const char *, __off_t);
#endif
# 445 "/usr/include/stdio.h" 3 4
#endif /* __BSD_VISIBLE */
# 446 "/usr/include/stdio.h" 3 4

/*
 * Functions internal to the implementation.
 */
int	__srget(FILE *);
int	__swbuf(int, FILE *);

/*
 * The __sfoo macros are here so that we can
 * define function versions in the C library.
 */
#define	__sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
#if defined(__GNUC__) && defined(__STDC__)
static __inline int __sputc(int _c, FILE *_p) {
	if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
		return (*_p->_p++ = _c);
	else
		return (__swbuf(_c, _p));
}
#else
# 466 "/usr/include/stdio.h" 3 4
/*
 * This has been tuned to generate reasonable code on the vax using pcc.
 */
#define	__sputc(c, p) \
	(--(p)->_w < 0 ? \
		(p)->_w >= (p)->_lbfsize ? \
			(*(p)->_p = (c)), *(p)->_p != '\n' ? \
				(int)*(p)->_p++ : \
				__swbuf('\n', p) : \
			__swbuf((int)(c), p) : \
		(*(p)->_p = (c), (int)*(p)->_p++))
#endif
# 478 "/usr/include/stdio.h" 3 4

extern int __isthreaded;

#ifndef __cplusplus

#define	__sfeof(p)	(((p)->_flags & __SEOF) != 0)
#define	__sferror(p)	(((p)->_flags & __SERR) != 0)
#define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
#define	__sfileno(p)	((p)->_file)


#define	feof(p)		(!__isthreaded ? __sfeof(p) : (feof)(p))
#define	ferror(p)	(!__isthreaded ? __sferror(p) : (ferror)(p))
#define	clearerr(p)	(!__isthreaded ? __sclearerr(p) : (clearerr)(p))

#if __POSIX_VISIBLE
#define	fileno(p)	(!__isthreaded ? __sfileno(p) : (fileno)(p))
#endif
# 496 "/usr/include/stdio.h" 3 4

#define	getc(fp)	(!__isthreaded ? __sgetc(fp) : (getc)(fp))
#define	putc(x, fp)	(!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))

#define	getchar()	getc(stdin)
#define	putchar(x)	putc(x, stdout)

#if __BSD_VISIBLE
/*
 * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
 * B.8.2.7 for the rationale behind the *_unlocked() macros.
 */
#define	feof_unlocked(p)	__sfeof(p)
#define	ferror_unlocked(p)	__sferror(p)
#define	clearerr_unlocked(p)	__sclearerr(p)
#define	fileno_unlocked(p)	__sfileno(p)
#endif
# 513 "/usr/include/stdio.h" 3 4
#if __POSIX_VISIBLE >= 199506
#define	getc_unlocked(fp)	__sgetc(fp)
#define	putc_unlocked(x, fp)	__sputc(x, fp)

#define	getchar_unlocked()	getc_unlocked(stdin)
#define	putchar_unlocked(x)	putc_unlocked(x, stdout)
#endif
# 520 "/usr/include/stdio.h" 3 4
#endif /* __cplusplus */
# 521 "/usr/include/stdio.h" 3 4

__END_DECLS
#endif /* !_STDIO_H_ */
# 524 "/usr/include/stdio.h" 3 4
# 68 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 69 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#if 0 /* expanded by -frewrite-includes */
#include <sys/param.h>
#endif /* expanded by -frewrite-includes */
# 70 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#if 0 /* expanded by -frewrite-includes */
#include <netinet/in.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/netinet/in.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1990, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)in.h	8.3 (Berkeley) 1/3/94
 * $FreeBSD: head/sys/netinet/in.h 266842 2014-05-29 15:23:37Z jilles $
 */

#ifndef _NETINET_IN_H_
#define	_NETINET_IN_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/netinet/in.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/include/netinet/in.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/endian.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/endian.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/endian.h 232266 2012-02-28 19:39:54Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/endian.h>
#endif /* expanded by -frewrite-includes */
# 7 "/usr/include/machine/endian.h" 3 4
# 39 "/usr/include/netinet/in.h" 2 3 4

/* Protocols common to RFC 1700, POSIX, and X/Open. */
#define	IPPROTO_IP		0		/* dummy for IP */
#define	IPPROTO_ICMP		1		/* control message protocol */
#define	IPPROTO_TCP		6		/* tcp */
#define	IPPROTO_UDP		17		/* user datagram protocol */

#define	INADDR_ANY		((in_addr_t)0x00000000)
#define	INADDR_BROADCAST	((in_addr_t)0xffffffff)	/* must be masked */

#ifndef _UINT8_T_DECLARED
typedef	__uint8_t		uint8_t;
#define	_UINT8_T_DECLARED
#endif
# 53 "/usr/include/netinet/in.h" 3 4

#ifndef _UINT16_T_DECLARED
typedef	__uint16_t		uint16_t;
#define	_UINT16_T_DECLARED
#endif
# 58 "/usr/include/netinet/in.h" 3 4

#ifndef _UINT32_T_DECLARED
typedef	__uint32_t		uint32_t;
#define	_UINT32_T_DECLARED
#endif
# 63 "/usr/include/netinet/in.h" 3 4

#ifndef _IN_ADDR_T_DECLARED
typedef	uint32_t		in_addr_t;
#define	_IN_ADDR_T_DECLARED
#endif
# 68 "/usr/include/netinet/in.h" 3 4

#ifndef _IN_PORT_T_DECLARED
typedef	uint16_t		in_port_t;
#define	_IN_PORT_T_DECLARED
#endif
# 73 "/usr/include/netinet/in.h" 3 4

#ifndef _SA_FAMILY_T_DECLARED
typedef	__sa_family_t		sa_family_t;
#define	_SA_FAMILY_T_DECLARED
#endif
# 78 "/usr/include/netinet/in.h" 3 4

/* Internet address (a structure for historical reasons). */
#ifndef	_STRUCT_IN_ADDR_DECLARED
struct in_addr {
	in_addr_t s_addr;
};
#define	_STRUCT_IN_ADDR_DECLARED
#endif
# 86 "/usr/include/netinet/in.h" 3 4

#ifndef	_SOCKLEN_T_DECLARED
typedef	__socklen_t	socklen_t;
#define	_SOCKLEN_T_DECLARED
#endif
# 91 "/usr/include/netinet/in.h" 3 4

#if 0 /* expanded by -frewrite-includes */
#include <sys/_sockaddr_storage.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_sockaddr_storage.h" 1 3 4
/*-
 * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)socket.h	8.4 (Berkeley) 2/21/94
 * $FreeBSD: head/sys/sys/_sockaddr_storage.h 196967 2009-09-08 10:39:38Z phk $
 */

#ifndef _SYS__SOCKADDR_STORAGE_H_
#define	_SYS__SOCKADDR_STORAGE_H_

/*
 * RFC 2553: protocol-independent placeholder for socket addresses
 */
#define	_SS_MAXSIZE	128U
#define	_SS_ALIGNSIZE	(sizeof(__int64_t))
#define	_SS_PAD1SIZE	(_SS_ALIGNSIZE - sizeof(unsigned char) - \
			    sizeof(sa_family_t))
#define	_SS_PAD2SIZE	(_SS_MAXSIZE - sizeof(unsigned char) - \
			    sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE)

struct sockaddr_storage {
	unsigned char	ss_len;		/* address length */
	sa_family_t	ss_family;	/* address family */
	char		__ss_pad1[_SS_PAD1SIZE];
	__int64_t	__ss_align;	/* force desired struct alignment */
	char		__ss_pad2[_SS_PAD2SIZE];
};

#endif /* !_SYS__SOCKADDR_STORAGE_H_ */
# 55 "/usr/include/sys/_sockaddr_storage.h" 3 4
# 93 "/usr/include/netinet/in.h" 2 3 4

/* Socket address, internet style. */
struct sockaddr_in {
	uint8_t	sin_len;
	sa_family_t	sin_family;
	in_port_t	sin_port;
	struct	in_addr sin_addr;
	char	sin_zero[8];
};

#if !defined(_KERNEL) && __POSIX_VISIBLE >= 200112

#ifndef _BYTEORDER_PROTOTYPED
#define	_BYTEORDER_PROTOTYPED
__BEGIN_DECLS
uint32_t	htonl(uint32_t);
uint16_t	htons(uint16_t);
uint32_t	ntohl(uint32_t);
uint16_t	ntohs(uint16_t);
__END_DECLS
#endif
# 114 "/usr/include/netinet/in.h" 3 4

#ifndef _BYTEORDER_FUNC_DEFINED
#define	_BYTEORDER_FUNC_DEFINED
#define	htonl(x)	__htonl(x)
#define	htons(x)	__htons(x)
#define	ntohl(x)	__ntohl(x)
#define	ntohs(x)	__ntohs(x)
#endif
# 122 "/usr/include/netinet/in.h" 3 4

#endif /* !_KERNEL && __POSIX_VISIBLE >= 200112 */
# 124 "/usr/include/netinet/in.h" 3 4

#if __POSIX_VISIBLE >= 200112
#define	IPPROTO_IPV6		41		/* IP6 header */
#define	IPPROTO_RAW		255		/* raw IP packet */
#define	INET_ADDRSTRLEN		16
#endif
# 130 "/usr/include/netinet/in.h" 3 4

#if __BSD_VISIBLE
/*
 * Constants and structures defined by the internet system,
 * Per RFC 790, September 1981, and numerous additions.
 */

/*
 * Protocols (RFC 1700)
 */
#define	IPPROTO_HOPOPTS		0		/* IP6 hop-by-hop options */
#define	IPPROTO_IGMP		2		/* group mgmt protocol */
#define	IPPROTO_GGP		3		/* gateway^2 (deprecated) */
#define	IPPROTO_IPV4		4		/* IPv4 encapsulation */
#define	IPPROTO_IPIP		IPPROTO_IPV4	/* for compatibility */
#define	IPPROTO_ST		7		/* Stream protocol II */
#define	IPPROTO_EGP		8		/* exterior gateway protocol */
#define	IPPROTO_PIGP		9		/* private interior gateway */
#define	IPPROTO_RCCMON		10		/* BBN RCC Monitoring */
#define	IPPROTO_NVPII		11		/* network voice protocol*/
#define	IPPROTO_PUP		12		/* pup */
#define	IPPROTO_ARGUS		13		/* Argus */
#define	IPPROTO_EMCON		14		/* EMCON */
#define	IPPROTO_XNET		15		/* Cross Net Debugger */
#define	IPPROTO_CHAOS		16		/* Chaos*/
#define	IPPROTO_MUX		18		/* Multiplexing */
#define	IPPROTO_MEAS		19		/* DCN Measurement Subsystems */
#define	IPPROTO_HMP		20		/* Host Monitoring */
#define	IPPROTO_PRM		21		/* Packet Radio Measurement */
#define	IPPROTO_IDP		22		/* xns idp */
#define	IPPROTO_TRUNK1		23		/* Trunk-1 */
#define	IPPROTO_TRUNK2		24		/* Trunk-2 */
#define	IPPROTO_LEAF1		25		/* Leaf-1 */
#define	IPPROTO_LEAF2		26		/* Leaf-2 */
#define	IPPROTO_RDP		27		/* Reliable Data */
#define	IPPROTO_IRTP		28		/* Reliable Transaction */
#define	IPPROTO_TP		29		/* tp-4 w/ class negotiation */
#define	IPPROTO_BLT		30		/* Bulk Data Transfer */
#define	IPPROTO_NSP		31		/* Network Services */
#define	IPPROTO_INP		32		/* Merit Internodal */
#define	IPPROTO_SEP		33		/* Sequential Exchange */
#define	IPPROTO_3PC		34		/* Third Party Connect */
#define	IPPROTO_IDPR		35		/* InterDomain Policy Routing */
#define	IPPROTO_XTP		36		/* XTP */
#define	IPPROTO_DDP		37		/* Datagram Delivery */
#define	IPPROTO_CMTP		38		/* Control Message Transport */
#define	IPPROTO_TPXX		39		/* TP++ Transport */
#define	IPPROTO_IL		40		/* IL transport protocol */
#define	IPPROTO_SDRP		42		/* Source Demand Routing */
#define	IPPROTO_ROUTING		43		/* IP6 routing header */
#define	IPPROTO_FRAGMENT	44		/* IP6 fragmentation header */
#define	IPPROTO_IDRP		45		/* InterDomain Routing*/
#define	IPPROTO_RSVP		46		/* resource reservation */
#define	IPPROTO_GRE		47		/* General Routing Encap. */
#define	IPPROTO_MHRP		48		/* Mobile Host Routing */
#define	IPPROTO_BHA		49		/* BHA */
#define	IPPROTO_ESP		50		/* IP6 Encap Sec. Payload */
#define	IPPROTO_AH		51		/* IP6 Auth Header */
#define	IPPROTO_INLSP		52		/* Integ. Net Layer Security */
#define	IPPROTO_SWIPE		53		/* IP with encryption */
#define	IPPROTO_NHRP		54		/* Next Hop Resolution */
#define	IPPROTO_MOBILE		55		/* IP Mobility */
#define	IPPROTO_TLSP		56		/* Transport Layer Security */
#define	IPPROTO_SKIP		57		/* SKIP */
#define	IPPROTO_ICMPV6		58		/* ICMP6 */
#define	IPPROTO_NONE		59		/* IP6 no next header */
#define	IPPROTO_DSTOPTS		60		/* IP6 destination option */
#define	IPPROTO_AHIP		61		/* any host internal protocol */
#define	IPPROTO_CFTP		62		/* CFTP */
#define	IPPROTO_HELLO		63		/* "hello" routing protocol */
#define	IPPROTO_SATEXPAK	64		/* SATNET/Backroom EXPAK */
#define	IPPROTO_KRYPTOLAN	65		/* Kryptolan */
#define	IPPROTO_RVD		66		/* Remote Virtual Disk */
#define	IPPROTO_IPPC		67		/* Pluribus Packet Core */
#define	IPPROTO_ADFS		68		/* Any distributed FS */
#define	IPPROTO_SATMON		69		/* Satnet Monitoring */
#define	IPPROTO_VISA		70		/* VISA Protocol */
#define	IPPROTO_IPCV		71		/* Packet Core Utility */
#define	IPPROTO_CPNX		72		/* Comp. Prot. Net. Executive */
#define	IPPROTO_CPHB		73		/* Comp. Prot. HeartBeat */
#define	IPPROTO_WSN		74		/* Wang Span Network */
#define	IPPROTO_PVP		75		/* Packet Video Protocol */
#define	IPPROTO_BRSATMON	76		/* BackRoom SATNET Monitoring */
#define	IPPROTO_ND		77		/* Sun net disk proto (temp.) */
#define	IPPROTO_WBMON		78		/* WIDEBAND Monitoring */
#define	IPPROTO_WBEXPAK		79		/* WIDEBAND EXPAK */
#define	IPPROTO_EON		80		/* ISO cnlp */
#define	IPPROTO_VMTP		81		/* VMTP */
#define	IPPROTO_SVMTP		82		/* Secure VMTP */
#define	IPPROTO_VINES		83		/* Banyon VINES */
#define	IPPROTO_TTP		84		/* TTP */
#define	IPPROTO_IGP		85		/* NSFNET-IGP */
#define	IPPROTO_DGP		86		/* dissimilar gateway prot. */
#define	IPPROTO_TCF		87		/* TCF */
#define	IPPROTO_IGRP		88		/* Cisco/GXS IGRP */
#define	IPPROTO_OSPFIGP		89		/* OSPFIGP */
#define	IPPROTO_SRPC		90		/* Strite RPC protocol */
#define	IPPROTO_LARP		91		/* Locus Address Resoloution */
#define	IPPROTO_MTP		92		/* Multicast Transport */
#define	IPPROTO_AX25		93		/* AX.25 Frames */
#define	IPPROTO_IPEIP		94		/* IP encapsulated in IP */
#define	IPPROTO_MICP		95		/* Mobile Int.ing control */
#define	IPPROTO_SCCSP		96		/* Semaphore Comm. security */
#define	IPPROTO_ETHERIP		97		/* Ethernet IP encapsulation */
#define	IPPROTO_ENCAP		98		/* encapsulation header */
#define	IPPROTO_APES		99		/* any private encr. scheme */
#define	IPPROTO_GMTP		100		/* GMTP*/
#define	IPPROTO_IPCOMP		108		/* payload compression (IPComp) */
#define	IPPROTO_SCTP		132		/* SCTP */
#define	IPPROTO_MH		135		/* IPv6 Mobility Header */
#define	IPPROTO_UDPLITE		136		/* UDP-Lite */
#define	IPPROTO_HIP		139		/* IP6 Host Identity Protocol */
#define	IPPROTO_SHIM6		140		/* IP6 Shim6 Protocol */
/* 101-254: Partly Unassigned */
#define	IPPROTO_PIM		103		/* Protocol Independent Mcast */
#define	IPPROTO_CARP		112		/* CARP */
#define	IPPROTO_PGM		113		/* PGM */
#define	IPPROTO_MPLS		137		/* MPLS-in-IP */
#define	IPPROTO_PFSYNC		240		/* PFSYNC */
#define	IPPROTO_RESERVED_253	253		/* Reserved */
#define	IPPROTO_RESERVED_254	254		/* Reserved */
/* 255: Reserved */
/* BSD Private, local use, namespace incursion, no longer used */
#define	IPPROTO_OLD_DIVERT	254		/* OLD divert pseudo-proto */
#define	IPPROTO_MAX		256

/* last return value of *_input(), meaning "all job for this pkt is done".  */
#define	IPPROTO_DONE		257

/* Only used internally, so can be outside the range of valid IP protocols. */
#define	IPPROTO_DIVERT		258		/* divert pseudo-protocol */
#define	IPPROTO_SEND		259		/* SeND pseudo-protocol */

/*
 * Defined to avoid confusion.  The master value is defined by
 * PROTO_SPACER in sys/protosw.h.
 */
#define	IPPROTO_SPACER		32767		/* spacer for loadable protos */

/*
 * Local port number conventions:
 *
 * When a user does a bind(2) or connect(2) with a port number of zero,
 * a non-conflicting local port address is chosen.
 * The default range is IPPORT_HIFIRSTAUTO through
 * IPPORT_HILASTAUTO, although that is settable by sysctl.
 *
 * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
 * default assignment range.
 *
 * The value IP_PORTRANGE_DEFAULT causes the default behavior.
 *
 * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
 * into the "high" range.  These are reserved for client outbound connections
 * which do not want to be filtered by any firewalls.
 *
 * The value IP_PORTRANGE_LOW changes the range to the "low" are
 * that is (by convention) restricted to privileged processes.  This
 * convention is based on "vouchsafe" principles only.  It is only secure
 * if you trust the remote host to restrict these ports.
 *
 * The default range of ports and the high range can be changed by
 * sysctl(3).  (net.inet.ip.port{hi,low}{first,last}_auto)
 *
 * Changing those values has bad security implications if you are
 * using a stateless firewall that is allowing packets outside of that
 * range in order to allow transparent outgoing connections.
 *
 * Such a firewall configuration will generally depend on the use of these
 * default values.  If you change them, you may find your Security
 * Administrator looking for you with a heavy object.
 *
 * For a slightly more orthodox text view on this:
 *
 *            ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
 *
 *    port numbers are divided into three ranges:
 *
 *                0 -  1023 Well Known Ports
 *             1024 - 49151 Registered Ports
 *            49152 - 65535 Dynamic and/or Private Ports
 *
 */

/*
 * Ports < IPPORT_RESERVED are reserved for
 * privileged processes (e.g. root).         (IP_PORTRANGE_LOW)
 */
#define	IPPORT_RESERVED		1024

/*
 * Default local port range, used by IP_PORTRANGE_DEFAULT
 */
#define IPPORT_EPHEMERALFIRST	10000
#define IPPORT_EPHEMERALLAST	65535 
 
/*
 * Dynamic port range, used by IP_PORTRANGE_HIGH.
 */
#define	IPPORT_HIFIRSTAUTO	49152
#define	IPPORT_HILASTAUTO	65535

/*
 * Scanning for a free reserved port return a value below IPPORT_RESERVED,
 * but higher than IPPORT_RESERVEDSTART.  Traditionally the start value was
 * 512, but that conflicts with some well-known-services that firewalls may
 * have a fit if we use.
 */
#define	IPPORT_RESERVEDSTART	600

#define	IPPORT_MAX		65535

/*
 * Definitions of bits in internet address integers.
 * On subnets, the decomposition of addresses to host and net parts
 * is done according to subnet mask, not the masks here.
 */
#define	IN_CLASSA(i)		(((in_addr_t)(i) & 0x80000000) == 0)
#define	IN_CLASSA_NET		0xff000000
#define	IN_CLASSA_NSHIFT	24
#define	IN_CLASSA_HOST		0x00ffffff
#define	IN_CLASSA_MAX		128

#define	IN_CLASSB(i)		(((in_addr_t)(i) & 0xc0000000) == 0x80000000)
#define	IN_CLASSB_NET		0xffff0000
#define	IN_CLASSB_NSHIFT	16
#define	IN_CLASSB_HOST		0x0000ffff
#define	IN_CLASSB_MAX		65536

#define	IN_CLASSC(i)		(((in_addr_t)(i) & 0xe0000000) == 0xc0000000)
#define	IN_CLASSC_NET		0xffffff00
#define	IN_CLASSC_NSHIFT	8
#define	IN_CLASSC_HOST		0x000000ff

#define	IN_CLASSD(i)		(((in_addr_t)(i) & 0xf0000000) == 0xe0000000)
#define	IN_CLASSD_NET		0xf0000000	/* These ones aren't really */
#define	IN_CLASSD_NSHIFT	28		/* net and host fields, but */
#define	IN_CLASSD_HOST		0x0fffffff	/* routing needn't know.    */
#define	IN_MULTICAST(i)		IN_CLASSD(i)

#define	IN_EXPERIMENTAL(i)	(((in_addr_t)(i) & 0xf0000000) == 0xf0000000)
#define	IN_BADCLASS(i)		(((in_addr_t)(i) & 0xf0000000) == 0xf0000000)

#define IN_LINKLOCAL(i)		(((in_addr_t)(i) & 0xffff0000) == 0xa9fe0000)
#define IN_LOOPBACK(i)		(((in_addr_t)(i) & 0xff000000) == 0x7f000000)
#define IN_ZERONET(i)		(((in_addr_t)(i) & 0xff000000) == 0)

#define	IN_PRIVATE(i)	((((in_addr_t)(i) & 0xff000000) == 0x0a000000) || \
			 (((in_addr_t)(i) & 0xfff00000) == 0xac100000) || \
			 (((in_addr_t)(i) & 0xffff0000) == 0xc0a80000))

#define	IN_LOCAL_GROUP(i)	(((in_addr_t)(i) & 0xffffff00) == 0xe0000000)
 
#define	IN_ANY_LOCAL(i)		(IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))

#define	INADDR_LOOPBACK		((in_addr_t)0x7f000001)
#ifndef _KERNEL
#define	INADDR_NONE		((in_addr_t)0xffffffff)	/* -1 return */
#endif
# 389 "/usr/include/netinet/in.h" 3 4

#define	INADDR_UNSPEC_GROUP	((in_addr_t)0xe0000000)	/* 224.0.0.0 */
#define	INADDR_ALLHOSTS_GROUP	((in_addr_t)0xe0000001)	/* 224.0.0.1 */
#define	INADDR_ALLRTRS_GROUP	((in_addr_t)0xe0000002)	/* 224.0.0.2 */
#define	INADDR_ALLRPTS_GROUP	((in_addr_t)0xe0000016)	/* 224.0.0.22, IGMPv3 */
#define	INADDR_CARP_GROUP	((in_addr_t)0xe0000012)	/* 224.0.0.18 */
#define	INADDR_PFSYNC_GROUP	((in_addr_t)0xe00000f0)	/* 224.0.0.240 */
#define	INADDR_ALLMDNS_GROUP	((in_addr_t)0xe00000fb)	/* 224.0.0.251 */
#define	INADDR_MAX_LOCAL_GROUP	((in_addr_t)0xe00000ff)	/* 224.0.0.255 */

#define	IN_LOOPBACKNET		127			/* official! */

#define	IN_RFC3021_MASK		((in_addr_t)0xfffffffe)

/*
 * Options for use with [gs]etsockopt at the IP level.
 * First word of comment is data type; bool is stored in int.
 */
#define	IP_OPTIONS		1    /* buf/ip_opts; set/get IP options */
#define	IP_HDRINCL		2    /* int; header is included with data */
#define	IP_TOS			3    /* int; IP type of service and preced. */
#define	IP_TTL			4    /* int; IP time to live */
#define	IP_RECVOPTS		5    /* bool; receive all IP opts w/dgram */
#define	IP_RECVRETOPTS		6    /* bool; receive IP opts for response */
#define	IP_RECVDSTADDR		7    /* bool; receive IP dst addr w/dgram */
#define	IP_SENDSRCADDR		IP_RECVDSTADDR /* cmsg_type to set src addr */
#define	IP_RETOPTS		8    /* ip_opts; set/get IP options */
#define	IP_MULTICAST_IF		9    /* struct in_addr *or* struct ip_mreqn;
				      * set/get IP multicast i/f  */
#define	IP_MULTICAST_TTL	10   /* u_char; set/get IP multicast ttl */
#define	IP_MULTICAST_LOOP	11   /* u_char; set/get IP multicast loopback */
#define	IP_ADD_MEMBERSHIP	12   /* ip_mreq; add an IP group membership */
#define	IP_DROP_MEMBERSHIP	13   /* ip_mreq; drop an IP group membership */
#define	IP_MULTICAST_VIF	14   /* set/get IP mcast virt. iface */
#define	IP_RSVP_ON		15   /* enable RSVP in kernel */
#define	IP_RSVP_OFF		16   /* disable RSVP in kernel */
#define	IP_RSVP_VIF_ON		17   /* set RSVP per-vif socket */
#define	IP_RSVP_VIF_OFF		18   /* unset RSVP per-vif socket */
#define	IP_PORTRANGE		19   /* int; range to choose for unspec port */
#define	IP_RECVIF		20   /* bool; receive reception if w/dgram */
/* for IPSEC */
#define	IP_IPSEC_POLICY		21   /* int; set/get security policy */
#define	IP_FAITH		22   /* bool; accept FAITH'ed connections */

#define	IP_ONESBCAST		23   /* bool: send all-ones broadcast */
#define	IP_BINDANY		24   /* bool: allow bind to any address */

/*
 * Options for controlling the firewall and dummynet.
 * Historical options (from 40 to 64) will eventually be
 * replaced by only two options, IP_FW3 and IP_DUMMYNET3.
 */
#define	IP_FW_TABLE_ADD		40   /* add entry */
#define	IP_FW_TABLE_DEL		41   /* delete entry */
#define	IP_FW_TABLE_FLUSH	42   /* flush table */
#define	IP_FW_TABLE_GETSIZE	43   /* get table size */
#define	IP_FW_TABLE_LIST	44   /* list table contents */

#define	IP_FW3			48   /* generic ipfw v.3 sockopts */
#define	IP_DUMMYNET3		49   /* generic dummynet v.3 sockopts */

#define	IP_FW_ADD		50   /* add a firewall rule to chain */
#define	IP_FW_DEL		51   /* delete a firewall rule from chain */
#define	IP_FW_FLUSH		52   /* flush firewall rule chain */
#define	IP_FW_ZERO		53   /* clear single/all firewall counter(s) */
#define	IP_FW_GET		54   /* get entire firewall rule chain */
#define	IP_FW_RESETLOG		55   /* reset logging counters */

#define IP_FW_NAT_CFG           56   /* add/config a nat rule */
#define IP_FW_NAT_DEL           57   /* delete a nat rule */
#define IP_FW_NAT_GET_CONFIG    58   /* get configuration of a nat rule */
#define IP_FW_NAT_GET_LOG       59   /* get log of a nat rule */

#define	IP_DUMMYNET_CONFIGURE	60   /* add/configure a dummynet pipe */
#define	IP_DUMMYNET_DEL		61   /* delete a dummynet pipe from chain */
#define	IP_DUMMYNET_FLUSH	62   /* flush dummynet */
#define	IP_DUMMYNET_GET		64   /* get entire dummynet pipes */

#define	IP_RECVTTL		65   /* bool; receive IP TTL w/dgram */
#define	IP_MINTTL		66   /* minimum TTL for packet or drop */
#define	IP_DONTFRAG		67   /* don't fragment packet */
#define	IP_RECVTOS		68   /* bool; receive IP TOS w/dgram */
#define	IP_FLOWID		69   /* flow id for the given socket/inp */
#define	IP_FLOWTYPE		70   /* flow type (M_HASHTYPE) */
#define	IP_RSSCPUID		71   /* RSS flowid -> CPU id mapping */

/* IPv4 Source Filter Multicast API [RFC3678] */
#define	IP_ADD_SOURCE_MEMBERSHIP	70   /* join a source-specific group */
#define	IP_DROP_SOURCE_MEMBERSHIP	71   /* drop a single source */
#define	IP_BLOCK_SOURCE			72   /* block a source */
#define	IP_UNBLOCK_SOURCE		73   /* unblock a source */

/* The following option is private; do not use it from user applications. */
#define	IP_MSFILTER			74   /* set/get filter list */

/* Protocol Independent Multicast API [RFC3678] */
#define	MCAST_JOIN_GROUP		80   /* join an any-source group */
#define	MCAST_LEAVE_GROUP		81   /* leave all sources for group */
#define	MCAST_JOIN_SOURCE_GROUP		82   /* join a source-specific group */
#define	MCAST_LEAVE_SOURCE_GROUP	83   /* leave a single source */
#define	MCAST_BLOCK_SOURCE		84   /* block a source */
#define	MCAST_UNBLOCK_SOURCE		85   /* unblock a source */

/*
 * Defaults and limits for options
 */
#define	IP_DEFAULT_MULTICAST_TTL  1	/* normally limit m'casts to 1 hop  */
#define	IP_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member  */

/*
 * The imo_membership vector for each socket is now dynamically allocated at
 * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
 * according to a power-of-two increment.
 */
#define	IP_MIN_MEMBERSHIPS	31
#define	IP_MAX_MEMBERSHIPS	4095
#define	IP_MAX_SOURCE_FILTER	1024	/* XXX to be unused */

/*
 * Default resource limits for IPv4 multicast source filtering.
 * These may be modified by sysctl.
 */
#define	IP_MAX_GROUP_SRC_FILTER		512	/* sources per group */
#define	IP_MAX_SOCK_SRC_FILTER		128	/* sources per socket/group */
#define	IP_MAX_SOCK_MUTE_FILTER		128	/* XXX no longer used */

/*
 * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
 */
struct ip_mreq {
	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
	struct	in_addr imr_interface;	/* local IP address of interface */
};

/*
 * Modified argument structure for IP_MULTICAST_IF, obtained from Linux.
 * This is used to specify an interface index for multicast sends, as
 * the IPv4 legacy APIs do not support this (unless IP_SENDIF is available).
 */
struct ip_mreqn {
	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
	struct	in_addr imr_address;	/* local IP address of interface */
	int		imr_ifindex;	/* Interface index; cast to uint32_t */
};

/*
 * Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678]
 */
struct ip_mreq_source {
	struct	in_addr imr_multiaddr;	/* IP multicast address of group */
	struct	in_addr imr_sourceaddr;	/* IP address of source */
	struct	in_addr imr_interface;	/* local IP address of interface */
};

/*
 * Argument structures for Protocol-Independent Multicast Source
 * Filter APIs. [RFC3678]
 */
struct group_req {
	uint32_t		gr_interface;	/* interface index */
	struct sockaddr_storage	gr_group;	/* group address */
};

struct group_source_req {
	uint32_t		gsr_interface;	/* interface index */
	struct sockaddr_storage	gsr_group;	/* group address */
	struct sockaddr_storage	gsr_source;	/* source address */
};

#ifndef __MSFILTERREQ_DEFINED
#define __MSFILTERREQ_DEFINED
/*
 * The following structure is private; do not use it from user applications.
 * It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between
 * the RFC 3678 libc functions and the kernel.
 */
struct __msfilterreq {
	uint32_t		 msfr_ifindex;	/* interface index */
	uint32_t		 msfr_fmode;	/* filter mode for group */
	uint32_t		 msfr_nsrcs;	/* # of sources in msfr_srcs */
	struct sockaddr_storage	 msfr_group;	/* group address */
	struct sockaddr_storage	*msfr_srcs;	/* pointer to the first member
						 * of a contiguous array of
						 * sources to filter in full.
						 */
};
#endif
# 576 "/usr/include/netinet/in.h" 3 4

struct sockaddr;

/*
 * Advanced (Full-state) APIs [RFC3678]
 * The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter().
 * We use uint32_t here to be consistent.
 */
int	setipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t,
	    uint32_t, struct in_addr *);
int	getipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t *,
	    uint32_t *, struct in_addr *);
int	setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
	    uint32_t, uint32_t, struct sockaddr_storage *);
int	getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
	    uint32_t *, uint32_t *, struct sockaddr_storage *);

/*
 * Filter modes; also used to represent per-socket filter mode internally.
 */
#define	MCAST_UNDEFINED	0	/* fmode: not yet defined */
#define	MCAST_INCLUDE	1	/* fmode: include these source(s) */
#define	MCAST_EXCLUDE	2	/* fmode: exclude these source(s) */

/*
 * Argument for IP_PORTRANGE:
 * - which range to search when port is unspecified at bind() or connect()
 */
#define	IP_PORTRANGE_DEFAULT	0	/* default range */
#define	IP_PORTRANGE_HIGH	1	/* "high" - request firewall bypass */
#define	IP_PORTRANGE_LOW	2	/* "low" - vouchsafe security */

/*
 * Identifiers for IP sysctl nodes
 */
#define	IPCTL_FORWARDING	1	/* act as router */
#define	IPCTL_SENDREDIRECTS	2	/* may send redirects when forwarding */
#define	IPCTL_DEFTTL		3	/* default TTL */
#ifdef notyet
#define	IPCTL_DEFMTU		4	/* default MTU */
#endif
# 617 "/usr/include/netinet/in.h" 3 4
#define	IPCTL_RTEXPIRE		5	/* cloned route expiration time */
#define	IPCTL_RTMINEXPIRE	6	/* min value for expiration time */
#define	IPCTL_RTMAXCACHE	7	/* trigger level for dynamic expire */
#define	IPCTL_SOURCEROUTE	8	/* may perform source routes */
#define	IPCTL_DIRECTEDBROADCAST	9	/* may re-broadcast received packets */
#define	IPCTL_INTRQMAXLEN	10	/* max length of netisr queue */
#define	IPCTL_INTRQDROPS	11	/* number of netisr q drops */
#define	IPCTL_STATS		12	/* ipstat structure */
#define	IPCTL_ACCEPTSOURCEROUTE	13	/* may accept source routed packets */
#define	IPCTL_FASTFORWARDING	14	/* use fast IP forwarding code */
#define	IPCTL_KEEPFAITH		15	/* FAITH IPv4->IPv6 translater ctl */
#define	IPCTL_GIF_TTL		16	/* default TTL for gif encap packet */

#endif /* __BSD_VISIBLE */
# 631 "/usr/include/netinet/in.h" 3 4

#ifdef _KERNEL

struct ifnet; struct mbuf;	/* forward declarations for Standard C */

int	 in_broadcast(struct in_addr, struct ifnet *);
int	 in_canforward(struct in_addr);
int	 in_localaddr(struct in_addr);
int	 in_localip(struct in_addr);
int	 inet_aton(const char *, struct in_addr *); /* in libkern */
char	*inet_ntoa(struct in_addr); /* in libkern */
char	*inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */
char	*inet_ntop(int, const void *, char *, socklen_t); /* in libkern */
int	 inet_pton(int af, const char *, void *); /* in libkern */
void	 in_ifdetach(struct ifnet *);

#define	in_hosteq(s, t)	((s).s_addr == (t).s_addr)
#define	in_nullhost(x)	((x).s_addr == INADDR_ANY)
#define	in_allhosts(x)	((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP))

#define	satosin(sa)	((struct sockaddr_in *)(sa))
#define	sintosa(sin)	((struct sockaddr *)(sin))
#define	ifatoia(ifa)	((struct in_ifaddr *)(ifa))
#endif /* _KERNEL */
# 655 "/usr/include/netinet/in.h" 3 4

/* INET6 stuff */
#if __POSIX_VISIBLE >= 200112
#define	__KAME_NETINET_IN_H_INCLUDED_
#if 0 /* expanded by -frewrite-includes */
#include <netinet6/in6.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/netinet6/in6.h" 1 3 4
/*-
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
 * 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.
 * 3. Neither the name of the project 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 PROJECT 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 PROJECT 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.
 *
 *	$KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $
 */

/*-
 * Copyright (c) 1982, 1986, 1990, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)in.h	8.3 (Berkeley) 1/3/94
 * $FreeBSD: head/sys/netinet6/in6.h 263091 2014-03-12 14:29:08Z glebius $
 */

#ifndef __KAME_NETINET_IN_H_INCLUDED_
#error "do not include netinet6/in6.h directly, include netinet/in.h.  see RFC2553"
#endif
# 67 "/usr/include/netinet6/in6.h" 3 4

#ifndef _NETINET6_IN6_H_
#define _NETINET6_IN6_H_

/*
 * Identification of the network protocol stack
 * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
 * has the table of implementation/integration differences.
 */
#define __KAME__
#define __KAME_VERSION		"FreeBSD"

/*
 * IPv6 port allocation rules should mirror the IPv4 rules and are controlled
 * by the net.inet.ip.portrange sysctl tree. The following defines exist
 * for compatibility with userland applications that need them.
 */
#if __BSD_VISIBLE
#define	IPV6PORT_RESERVED	1024
#define	IPV6PORT_ANONMIN	49152
#define	IPV6PORT_ANONMAX	65535
#define	IPV6PORT_RESERVEDMIN	600
#define	IPV6PORT_RESERVEDMAX	(IPV6PORT_RESERVED-1)
#endif
# 91 "/usr/include/netinet6/in6.h" 3 4

/*
 * IPv6 address
 */
struct in6_addr {
	union {
		uint8_t		__u6_addr8[16];
		uint16_t	__u6_addr16[8];
		uint32_t	__u6_addr32[4];
	} __u6_addr;			/* 128-bit IP6 address */
};

#define s6_addr   __u6_addr.__u6_addr8
#ifdef _KERNEL	/* XXX nonstandard */
#define s6_addr8  __u6_addr.__u6_addr8
#define s6_addr16 __u6_addr.__u6_addr16
#define s6_addr32 __u6_addr.__u6_addr32
#endif
# 109 "/usr/include/netinet6/in6.h" 3 4

#define INET6_ADDRSTRLEN	46

/*
 * XXX missing POSIX.1-2001 macro IPPROTO_IPV6.
 */

/*
 * Socket address for IPv6
 */
#if __BSD_VISIBLE
#define SIN6_LEN
#endif
# 122 "/usr/include/netinet6/in6.h" 3 4

struct sockaddr_in6 {
	uint8_t		sin6_len;	/* length of this struct */
	sa_family_t	sin6_family;	/* AF_INET6 */
	in_port_t	sin6_port;	/* Transport layer port # */
	uint32_t	sin6_flowinfo;	/* IP6 flow information */
	struct in6_addr	sin6_addr;	/* IP6 address */
	uint32_t	sin6_scope_id;	/* scope zone index */
};

/*
 * Local definition for masks
 */
#ifdef _KERNEL	/* XXX nonstandard */
#define IN6MASK0	{{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
#define IN6MASK32	{{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
			    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6MASK64	{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
			    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6MASK96	{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
			    0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6MASK128	{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
			    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
#endif
# 146 "/usr/include/netinet6/in6.h" 3 4

#ifdef _KERNEL
extern const struct sockaddr_in6 sa6_any;

extern const struct in6_addr in6mask0;
extern const struct in6_addr in6mask32;
extern const struct in6_addr in6mask64;
extern const struct in6_addr in6mask96;
extern const struct in6_addr in6mask128;
#endif /* _KERNEL */
# 156 "/usr/include/netinet6/in6.h" 3 4

/*
 * Macros started with IPV6_ADDR is KAME local
 */
#ifdef _KERNEL	/* XXX nonstandard */
#if _BYTE_ORDER == _BIG_ENDIAN
#define IPV6_ADDR_INT32_ONE	1
#define IPV6_ADDR_INT32_TWO	2
#define IPV6_ADDR_INT32_MNL	0xff010000
#define IPV6_ADDR_INT32_MLL	0xff020000
#define IPV6_ADDR_INT32_SMP	0x0000ffff
#define IPV6_ADDR_INT16_ULL	0xfe80
#define IPV6_ADDR_INT16_USL	0xfec0
#define IPV6_ADDR_INT16_MLL	0xff02
#elif _BYTE_ORDER == _LITTLE_ENDIAN
# 171 "/usr/include/netinet6/in6.h" 3 4
#define IPV6_ADDR_INT32_ONE	0x01000000
#define IPV6_ADDR_INT32_TWO	0x02000000
#define IPV6_ADDR_INT32_MNL	0x000001ff
#define IPV6_ADDR_INT32_MLL	0x000002ff
#define IPV6_ADDR_INT32_SMP	0xffff0000
#define IPV6_ADDR_INT16_ULL	0x80fe
#define IPV6_ADDR_INT16_USL	0xc0fe
#define IPV6_ADDR_INT16_MLL	0x02ff
#endif
# 180 "/usr/include/netinet6/in6.h" 3 4
#endif
# 181 "/usr/include/netinet6/in6.h" 3 4

/*
 * Definition of some useful macros to handle IP6 addresses
 */
#if __BSD_VISIBLE
#define IN6ADDR_ANY_INIT \
	{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6ADDR_LOOPBACK_INIT \
	{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
	{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \
	{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
	{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
	{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \
	{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}
#endif
# 208 "/usr/include/netinet6/in6.h" 3 4

extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
#if __BSD_VISIBLE
extern const struct in6_addr in6addr_nodelocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allrouters;
extern const struct in6_addr in6addr_linklocal_allv2routers;
#endif
# 217 "/usr/include/netinet6/in6.h" 3 4

/*
 * Equality
 * NOTE: Some of kernel programming environment (for example, openbsd/sparc)
 * does not supply memcmp().  For userland memcmp() is preferred as it is
 * in ANSI standard.
 */
#ifdef _KERNEL
#define IN6_ARE_ADDR_EQUAL(a, b)			\
    (bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
#else
# 228 "/usr/include/netinet6/in6.h" 3 4
#if __BSD_VISIBLE
#define IN6_ARE_ADDR_EQUAL(a, b)			\
    (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
#endif
# 232 "/usr/include/netinet6/in6.h" 3 4
#endif
# 233 "/usr/include/netinet6/in6.h" 3 4

/*
 * Unspecified
 */
#define IN6_IS_ADDR_UNSPECIFIED(a)	\
	((a)->__u6_addr.__u6_addr32[0] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[1] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[2] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[3] == 0)

/*
 * Loopback
 */
#define IN6_IS_ADDR_LOOPBACK(a)		\
	((a)->__u6_addr.__u6_addr32[0] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[1] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[2] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[3] == ntohl(1))

/*
 * IPv4 compatible
 */
#define IN6_IS_ADDR_V4COMPAT(a)		\
	((a)->__u6_addr.__u6_addr32[0] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[1] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[2] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[3] != 0 &&	\
	 (a)->__u6_addr.__u6_addr32[3] != ntohl(1))

/*
 * Mapped
 */
#define IN6_IS_ADDR_V4MAPPED(a)		      \
	((a)->__u6_addr.__u6_addr32[0] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[1] == 0 &&	\
	 (a)->__u6_addr.__u6_addr32[2] == ntohl(0x0000ffff))

/*
 * KAME Scope Values
 */

#ifdef _KERNEL	/* XXX nonstandard */
#define IPV6_ADDR_SCOPE_NODELOCAL	0x01
#define IPV6_ADDR_SCOPE_INTFACELOCAL	0x01
#define IPV6_ADDR_SCOPE_LINKLOCAL	0x02
#define IPV6_ADDR_SCOPE_SITELOCAL	0x05
#define IPV6_ADDR_SCOPE_ORGLOCAL	0x08	/* just used in this file */
#define IPV6_ADDR_SCOPE_GLOBAL		0x0e
#else
# 282 "/usr/include/netinet6/in6.h" 3 4
#define __IPV6_ADDR_SCOPE_NODELOCAL	0x01
#define __IPV6_ADDR_SCOPE_INTFACELOCAL	0x01
#define __IPV6_ADDR_SCOPE_LINKLOCAL	0x02
#define __IPV6_ADDR_SCOPE_SITELOCAL	0x05
#define __IPV6_ADDR_SCOPE_ORGLOCAL	0x08	/* just used in this file */
#define __IPV6_ADDR_SCOPE_GLOBAL	0x0e
#endif
# 289 "/usr/include/netinet6/in6.h" 3 4

/*
 * Unicast Scope
 * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
 */
#define IN6_IS_ADDR_LINKLOCAL(a)	\
	(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
#define IN6_IS_ADDR_SITELOCAL(a)	\
	(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))

/*
 * Multicast
 */
#define IN6_IS_ADDR_MULTICAST(a)	((a)->s6_addr[0] == 0xff)

#ifdef _KERNEL	/* XXX nonstandard */
#define IPV6_ADDR_MC_SCOPE(a)		((a)->s6_addr[1] & 0x0f)
#else
# 307 "/usr/include/netinet6/in6.h" 3 4
#define __IPV6_ADDR_MC_SCOPE(a)		((a)->s6_addr[1] & 0x0f)
#endif
# 309 "/usr/include/netinet6/in6.h" 3 4

/*
 * Multicast Scope
 */
#ifdef _KERNEL	/* refers nonstandard items */
#define IN6_IS_ADDR_MC_NODELOCAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_INTFACELOCAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
#define IN6_IS_ADDR_MC_ORGLOCAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
#define IN6_IS_ADDR_MC_GLOBAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
#else
# 333 "/usr/include/netinet6/in6.h" 3 4
#define IN6_IS_ADDR_MC_NODELOCAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
#define IN6_IS_ADDR_MC_ORGLOCAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
#define IN6_IS_ADDR_MC_GLOBAL(a)	\
	(IN6_IS_ADDR_MULTICAST(a) &&	\
	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
#endif
# 349 "/usr/include/netinet6/in6.h" 3 4

#ifdef _KERNEL	/* nonstandard */
/*
 * KAME Scope
 */
#define IN6_IS_SCOPE_LINKLOCAL(a)	\
	((IN6_IS_ADDR_LINKLOCAL(a)) ||	\
	 (IN6_IS_ADDR_MC_LINKLOCAL(a)))
#define	IN6_IS_SCOPE_EMBED(a)			\
	((IN6_IS_ADDR_LINKLOCAL(a)) ||		\
	 (IN6_IS_ADDR_MC_LINKLOCAL(a)) ||	\
	 (IN6_IS_ADDR_MC_INTFACELOCAL(a)))

#define IFA6_IS_DEPRECATED(a) \
	((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
	 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
	 (a)->ia6_lifetime.ia6t_pltime)
#define IFA6_IS_INVALID(a) \
	((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
	 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
	 (a)->ia6_lifetime.ia6t_vltime)
#endif /* _KERNEL */
# 371 "/usr/include/netinet6/in6.h" 3 4

/*
 * IP6 route structure
 */
#if __BSD_VISIBLE
struct route_in6 {
	struct	rtentry *ro_rt;
	struct	llentry *ro_lle;
	struct	in6_addr *ro_ia6;
	int		ro_flags;
	struct	sockaddr_in6 ro_dst;
};
#endif
# 384 "/usr/include/netinet6/in6.h" 3 4

/*
 * Options for use with [gs]etsockopt at the IPV6 level.
 * First word of comment is data type; bool is stored in int.
 */
/* no hdrincl */
#if 0 /* the followings are relic in IPv4 and hence are disabled */
#define IPV6_OPTIONS		1  /* buf/ip6_opts; set/get IP6 options */
#define IPV6_RECVOPTS		5  /* bool; receive all IP6 opts w/dgram */
#define IPV6_RECVRETOPTS	6  /* bool; receive IP6 opts for response */
#define IPV6_RECVDSTADDR	7  /* bool; receive IP6 dst addr w/dgram */
#define IPV6_RETOPTS		8  /* ip6_opts; set/get IP6 options */
#endif
# 397 "/usr/include/netinet6/in6.h" 3 4
#define IPV6_SOCKOPT_RESERVED1	3  /* reserved for future use */
#define IPV6_UNICAST_HOPS	4  /* int; IP6 hops */
#define IPV6_MULTICAST_IF	9  /* u_int; set/get IP6 multicast i/f  */
#define IPV6_MULTICAST_HOPS	10 /* int; set/get IP6 multicast hops */
#define IPV6_MULTICAST_LOOP	11 /* u_int; set/get IP6 multicast loopback */
#define IPV6_JOIN_GROUP		12 /* ipv6_mreq; join a group membership */
#define IPV6_LEAVE_GROUP	13 /* ipv6_mreq; leave a group membership */
#define IPV6_PORTRANGE		14 /* int; range to choose for unspec port */
#define ICMP6_FILTER		18 /* icmp6_filter; icmp6 filter */
/* RFC2292 options */
#ifdef _KERNEL
#define IPV6_2292PKTINFO	19 /* bool; send/recv if, src/dst addr */
#define IPV6_2292HOPLIMIT	20 /* bool; hop limit */
#define IPV6_2292NEXTHOP	21 /* bool; next hop addr */
#define IPV6_2292HOPOPTS	22 /* bool; hop-by-hop option */
#define IPV6_2292DSTOPTS	23 /* bool; destinaion option */
#define IPV6_2292RTHDR		24 /* bool; routing header */
#define IPV6_2292PKTOPTIONS	25 /* buf/cmsghdr; set/get IPv6 options */
#endif
# 416 "/usr/include/netinet6/in6.h" 3 4

#define IPV6_CHECKSUM		26 /* int; checksum offset for raw socket */
#define IPV6_V6ONLY		27 /* bool; make AF_INET6 sockets v6 only */
#ifndef _KERNEL
#define IPV6_BINDV6ONLY		IPV6_V6ONLY
#endif
# 422 "/usr/include/netinet6/in6.h" 3 4

#if 1 /* IPSEC */
#define IPV6_IPSEC_POLICY	28 /* struct; get/set security policy */
#endif /* IPSEC */
# 426 "/usr/include/netinet6/in6.h" 3 4

#define IPV6_FAITH		29 /* bool; accept FAITH'ed connections */

#if 1 /* IPV6FIREWALL */
#define IPV6_FW_ADD		30 /* add a firewall rule to chain */
#define IPV6_FW_DEL		31 /* delete a firewall rule from chain */
#define IPV6_FW_FLUSH		32 /* flush firewall rule chain */
#define IPV6_FW_ZERO		33 /* clear single/all firewall counter(s) */
#define IPV6_FW_GET		34 /* get entire firewall rule chain */
#endif
# 436 "/usr/include/netinet6/in6.h" 3 4

/* new socket options introduced in RFC3542 */
#define IPV6_RTHDRDSTOPTS	35 /* ip6_dest; send dst option before rthdr */

#define IPV6_RECVPKTINFO	36 /* bool; recv if, dst addr */
#define IPV6_RECVHOPLIMIT	37 /* bool; recv hop limit */
#define IPV6_RECVRTHDR		38 /* bool; recv routing header */
#define IPV6_RECVHOPOPTS	39 /* bool; recv hop-by-hop option */
#define IPV6_RECVDSTOPTS	40 /* bool; recv dst option after rthdr */
#ifdef _KERNEL
#define IPV6_RECVRTHDRDSTOPTS	41 /* bool; recv dst option before rthdr */
#endif
# 448 "/usr/include/netinet6/in6.h" 3 4

#define IPV6_USE_MIN_MTU	42 /* bool; send packets at the minimum MTU */
#define IPV6_RECVPATHMTU	43 /* bool; notify an according MTU */

#define IPV6_PATHMTU		44 /* mtuinfo; get the current path MTU (sopt),
				      4 bytes int; MTU notification (cmsg) */
#if 0 /*obsoleted during 2292bis -> 3542*/
#define IPV6_REACHCONF		45 /* no data; ND reachability confirm
				      (cmsg only/not in of RFC3542) */
#endif
# 458 "/usr/include/netinet6/in6.h" 3 4

/* more new socket options introduced in RFC3542 */
#define IPV6_PKTINFO		46 /* in6_pktinfo; send if, src addr */
#define IPV6_HOPLIMIT		47 /* int; send hop limit */
#define IPV6_NEXTHOP		48 /* sockaddr; next hop addr */
#define IPV6_HOPOPTS		49 /* ip6_hbh; send hop-by-hop option */
#define IPV6_DSTOPTS		50 /* ip6_dest; send dst option befor rthdr */
#define IPV6_RTHDR		51 /* ip6_rthdr; send routing header */
#if 0
#define IPV6_PKTOPTIONS		52 /* buf/cmsghdr; set/get IPv6 options */
				   /* obsoleted by RFC3542 */
#endif
# 470 "/usr/include/netinet6/in6.h" 3 4

#define IPV6_RECVTCLASS		57 /* bool; recv traffic class values */

#define IPV6_AUTOFLOWLABEL	59 /* bool; attach flowlabel automagically */

#define IPV6_TCLASS		61 /* int; send traffic class value */
#define IPV6_DONTFRAG		62 /* bool; disable IPv6 fragmentation */

#define IPV6_PREFER_TEMPADDR	63 /* int; prefer temporary addresses as
				    * the source address.
				    */

#define	IPV6_BINDANY		64 /* bool: allow bind to any address */

/*
 * The following option is private; do not use it from user applications.
 * It is deliberately defined to the same value as IP_MSFILTER.
 */
#define	IPV6_MSFILTER		74 /* struct __msfilterreq;
				    * set/get multicast source filter list.
				    */

/* to define items, should talk with KAME guys first, for *BSD compatibility */

#define IPV6_RTHDR_LOOSE     0 /* this hop need not be a neighbor. XXX old spec */
#define IPV6_RTHDR_STRICT    1 /* this hop must be a neighbor. XXX old spec */
#define IPV6_RTHDR_TYPE_0    0 /* IPv6 routing header type 0 */

/*
 * Defaults and limits for options
 */
#define IPV6_DEFAULT_MULTICAST_HOPS 1	/* normally limit m'casts to 1 hop */
#define IPV6_DEFAULT_MULTICAST_LOOP 1	/* normally hear sends if a member */

/*
 * The im6o_membership vector for each socket is now dynamically allocated at
 * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
 * according to a power-of-two increment.
 */
#define	IPV6_MIN_MEMBERSHIPS	31
#define	IPV6_MAX_MEMBERSHIPS	4095

/*
 * Default resource limits for IPv6 multicast source filtering.
 * These may be modified by sysctl.
 */
#define	IPV6_MAX_GROUP_SRC_FILTER	512	/* sources per group */
#define	IPV6_MAX_SOCK_SRC_FILTER	128	/* sources per socket/group */

/*
 * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
 */
struct ipv6_mreq {
	struct in6_addr	ipv6mr_multiaddr;
	unsigned int	ipv6mr_interface;
};

/*
 * IPV6_PKTINFO: Packet information(RFC2292 sec 5)
 */
struct in6_pktinfo {
	struct in6_addr	ipi6_addr;	/* src/dst IPv6 address */
	unsigned int	ipi6_ifindex;	/* send/recv interface index */
};

/*
 * Control structure for IPV6_RECVPATHMTU socket option.
 */
struct ip6_mtuinfo {
	struct sockaddr_in6 ip6m_addr;	/* or sockaddr_storage? */
	uint32_t ip6m_mtu;
};

/*
 * Argument for IPV6_PORTRANGE:
 * - which range to search when port is unspecified at bind() or connect()
 */
#define	IPV6_PORTRANGE_DEFAULT	0	/* default range */
#define	IPV6_PORTRANGE_HIGH	1	/* "high" - request firewall bypass */
#define	IPV6_PORTRANGE_LOW	2	/* "low" - vouchsafe security */

#if __BSD_VISIBLE
/*
 * Definitions for inet6 sysctl operations.
 *
 * Third level is protocol number.
 * Fourth level is desired variable within that protocol.
 */
#define IPV6PROTO_MAXID	(IPPROTO_PIM + 1)	/* don't list to IPV6PROTO_MAX */

/*
 * Names for IP sysctl objects
 */
#define IPV6CTL_FORWARDING	1	/* act as router */
#define IPV6CTL_SENDREDIRECTS	2	/* may send redirects when forwarding*/
#define IPV6CTL_DEFHLIM		3	/* default Hop-Limit */
#ifdef notyet
#define IPV6CTL_DEFMTU		4	/* default MTU */
#endif
# 569 "/usr/include/netinet6/in6.h" 3 4
#define IPV6CTL_FORWSRCRT	5	/* forward source-routed dgrams */
#define IPV6CTL_STATS		6	/* stats */
#define IPV6CTL_MRTSTATS	7	/* multicast forwarding stats */
#define IPV6CTL_MRTPROTO	8	/* multicast routing protocol */
#define IPV6CTL_MAXFRAGPACKETS	9	/* max packets reassembly queue */
#define IPV6CTL_SOURCECHECK	10	/* verify source route and intf */
#define IPV6CTL_SOURCECHECK_LOGINT 11	/* minimume logging interval */
#define IPV6CTL_ACCEPT_RTADV	12
#define IPV6CTL_KEEPFAITH	13
#define IPV6CTL_LOG_INTERVAL	14
#define IPV6CTL_HDRNESTLIMIT	15
#define IPV6CTL_DAD_COUNT	16
#define IPV6CTL_AUTO_FLOWLABEL	17
#define IPV6CTL_DEFMCASTHLIM	18
#define IPV6CTL_GIF_HLIM	19	/* default HLIM for gif encap packet */
#define IPV6CTL_KAME_VERSION	20
#define IPV6CTL_USE_DEPRECATED	21	/* use deprecated addr (RFC2462 5.5.4) */
#define IPV6CTL_RR_PRUNE	22	/* walk timer for router renumbering */
#if 0	/* obsolete */
#define IPV6CTL_MAPPED_ADDR	23
#endif
# 590 "/usr/include/netinet6/in6.h" 3 4
#define IPV6CTL_V6ONLY		24
#define IPV6CTL_RTEXPIRE	25	/* cloned route expiration time */
#define IPV6CTL_RTMINEXPIRE	26	/* min value for expiration time */
#define IPV6CTL_RTMAXCACHE	27	/* trigger level for dynamic expire */

#define IPV6CTL_USETEMPADDR	32	/* use temporary addresses (RFC3041) */
#define IPV6CTL_TEMPPLTIME	33	/* preferred lifetime for tmpaddrs */
#define IPV6CTL_TEMPVLTIME	34	/* valid lifetime for tmpaddrs */
#define IPV6CTL_AUTO_LINKLOCAL	35	/* automatic link-local addr assign */
#define IPV6CTL_RIP6STATS	36	/* raw_ip6 stats */
#define IPV6CTL_PREFER_TEMPADDR	37	/* prefer temporary addr as src */
#define IPV6CTL_ADDRCTLPOLICY	38	/* get/set address selection policy */
#define IPV6CTL_USE_DEFAULTZONE	39	/* use default scope zone */

#define IPV6CTL_MAXFRAGS	41	/* max fragments */
#if 0
#define IPV6CTL_IFQ		42	/* ip6intrq node */
#define IPV6CTL_ISATAPRTR	43	/* isatap router */
#endif
# 609 "/usr/include/netinet6/in6.h" 3 4
#define IPV6CTL_MCAST_PMTU	44	/* enable pMTU discovery for multicast? */

/* New entries should be added here from current IPV6CTL_MAXID value. */
/* to define items, should talk with KAME guys first, for *BSD compatibility */
#define IPV6CTL_STEALTH		45

#define	ICMPV6CTL_ND6_ONLINKNSRFC4861	47
#define	IPV6CTL_NO_RADR		48	/* No defroute from RA */
#define	IPV6CTL_NORBIT_RAIF	49	/* Disable R-bit in NA on RA
					 * receiving IF. */
#define	IPV6CTL_RFC6204W3	50	/* Accept defroute even when forwarding
					   enabled */
#define	IPV6CTL_MAXID		51
#endif /* __BSD_VISIBLE */
# 623 "/usr/include/netinet6/in6.h" 3 4

/*
 * Since both netinet/ and netinet6/ call into netipsec/ and netpfil/,
 * the protocol specific mbuf flags are shared between them.
 */
#define	M_FASTFWD_OURS		M_PROTO1	/* changed dst to local */
#define	M_IP6_NEXTHOP		M_PROTO2	/* explicit ip nexthop */
#define	M_IP_NEXTHOP		M_PROTO2	/* explicit ip nexthop */
#define	M_SKIP_FIREWALL		M_PROTO3	/* skip firewall processing */
#define	M_AUTHIPHDR		M_PROTO4
#define	M_DECRYPTED		M_PROTO5
#define	M_LOOP			M_PROTO6
#define	M_AUTHIPDGM		M_PROTO7
#define	M_RTALERT_MLD		M_PROTO8

#ifdef _KERNEL
struct cmsghdr;
struct ip6_hdr;

int	in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t);
int	in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t);
int	in6_localaddr(struct in6_addr *);
int	in6_localip(struct in6_addr *);
int	in6_addrscope(struct in6_addr *);
struct	in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *);
extern void in6_if_up(struct ifnet *);
struct sockaddr;
extern	u_char	ip6_protox[];

void	in6_sin6_2_sin(struct sockaddr_in *sin,
			    struct sockaddr_in6 *sin6);
void	in6_sin_2_v4mapsin6(struct sockaddr_in *sin,
				 struct sockaddr_in6 *sin6);
void	in6_sin6_2_sin_in_sock(struct sockaddr *nam);
void	in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam);
extern void addrsel_policy_init(void);

#define	satosin6(sa)	((struct sockaddr_in6 *)(sa))
#define	sin6tosa(sin6)	((struct sockaddr *)(sin6))
#define	ifatoia6(ifa)	((struct in6_ifaddr *)(ifa))

extern int	(*faithprefix_p)(struct in6_addr *);
#endif /* _KERNEL */
# 666 "/usr/include/netinet6/in6.h" 3 4

#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 671 "/usr/include/netinet6/in6.h" 3 4

#ifndef _SOCKLEN_T_DECLARED
typedef	__socklen_t	socklen_t;
#define	_SOCKLEN_T_DECLARED
#endif
# 676 "/usr/include/netinet6/in6.h" 3 4

#if __BSD_VISIBLE

__BEGIN_DECLS
struct cmsghdr;

extern int inet6_option_space(int);
extern int inet6_option_init(void *, struct cmsghdr **, int);
extern int inet6_option_append(struct cmsghdr *, const uint8_t *,
	int, int);
extern uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
extern int inet6_option_next(const struct cmsghdr *, uint8_t **);
extern int inet6_option_find(const struct cmsghdr *, uint8_t **, int);

extern size_t inet6_rthdr_space(int, int);
extern struct cmsghdr *inet6_rthdr_init(void *, int);
extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *,
	unsigned int);
extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int);
#if 0 /* not implemented yet */
extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *);
#endif
# 698 "/usr/include/netinet6/in6.h" 3 4
extern int inet6_rthdr_segments(const struct cmsghdr *);
extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int);
extern int inet6_rthdr_getflags(const struct cmsghdr *, int);

extern int inet6_opt_init(void *, socklen_t);
extern int inet6_opt_append(void *, socklen_t, int, uint8_t, socklen_t,
	uint8_t, void **);
extern int inet6_opt_finish(void *, socklen_t, int);
extern int inet6_opt_set_val(void *, int, void *, socklen_t);

extern int inet6_opt_next(void *, socklen_t, int, uint8_t *, socklen_t *,
	void **);
extern int inet6_opt_find(void *, socklen_t, int, uint8_t, socklen_t *,
	void **);
extern int inet6_opt_get_val(void *, int, void *, socklen_t);
extern socklen_t inet6_rth_space(int, int);
extern void *inet6_rth_init(void *, socklen_t, int, int);
extern int inet6_rth_add(void *, const struct in6_addr *);
extern int inet6_rth_reverse(const void *, void *);
extern int inet6_rth_segments(const void *);
extern struct in6_addr *inet6_rth_getaddr(const void *, int);
__END_DECLS

#endif /* __BSD_VISIBLE */
# 722 "/usr/include/netinet6/in6.h" 3 4

#endif /* !_NETINET6_IN6_H_ */
# 724 "/usr/include/netinet6/in6.h" 3 4
# 660 "/usr/include/netinet/in.h" 2 3 4
#undef __KAME_NETINET_IN_H_INCLUDED_
#endif
# 662 "/usr/include/netinet/in.h" 3 4

#endif /* !_NETINET_IN_H_*/
# 664 "/usr/include/netinet/in.h" 3 4
# 71 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <unistd.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/unistd.h" 1 3 4
/*-
 * Copyright (c) 1991, 1993, 1994
 *	The Regents of the University of California.  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.
 * 3. 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.
 *
 *	@(#)unistd.h	8.12 (Berkeley) 4/27/95
 * $FreeBSD: head/include/unistd.h 265878 2014-05-11 13:48:21Z jilles $
 */

#ifndef _UNISTD_H_
#define	_UNISTD_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/unistd.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>			/* XXX adds too much pollution. */
#endif /* expanded by -frewrite-includes */
# 38 "/usr/include/unistd.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/unistd.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/unistd.h" 1 3 4
/*-
 * Copyright (c) 1989, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)unistd.h	8.2 (Berkeley) 1/7/94
 * $FreeBSD: head/sys/sys/unistd.h 239347 2012-08-17 02:26:31Z davidxu $
 */

#ifndef _SYS_UNISTD_H_
#define	_SYS_UNISTD_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/sys/unistd.h" 3 4

/*
 * POSIX options and option groups we unconditionally do or don't
 * implement.  Those options which are implemented (or not) entirely
 * in user mode are defined in <unistd.h>.  Please keep this list in
 * alphabetical order.
 *
 * Anything which is defined as zero below **must** have an
 * implementation for the corresponding sysconf() which is able to
 * determine conclusively whether or not the feature is supported.
 * Anything which is defined as other than -1 below **must** have
 * complete headers, types, and function declarations as specified by
 * the POSIX standard; however, if the relevant sysconf() function
 * returns -1, the functions may be stubbed out.
 */
#define	_POSIX_ADVISORY_INFO		200112L
#define	_POSIX_ASYNCHRONOUS_IO		0
#define	_POSIX_CHOWN_RESTRICTED		1
#define	_POSIX_CLOCK_SELECTION		(-1)
#define	_POSIX_CPUTIME			200112L
#define	_POSIX_FSYNC			200112L
#define	_POSIX_IPV6			0
#define	_POSIX_JOB_CONTROL		1
#define	_POSIX_MAPPED_FILES		200112L
#define	_POSIX_MEMLOCK			(-1)
#define	_POSIX_MEMLOCK_RANGE		200112L
#define	_POSIX_MEMORY_PROTECTION	200112L
#define	_POSIX_MESSAGE_PASSING		200112L
#define	_POSIX_MONOTONIC_CLOCK		200112L
#define	_POSIX_NO_TRUNC			1
#define	_POSIX_PRIORITIZED_IO		(-1)
#define	_POSIX_PRIORITY_SCHEDULING	200112L
#define	_POSIX_RAW_SOCKETS		200112L
#define	_POSIX_REALTIME_SIGNALS		200112L
#define	_POSIX_SEMAPHORES		200112L
#define	_POSIX_SHARED_MEMORY_OBJECTS	200112L
#define	_POSIX_SPORADIC_SERVER		(-1)
#define	_POSIX_SYNCHRONIZED_IO		(-1)
#define	_POSIX_TIMEOUTS			200112L
#define	_POSIX_TIMERS			200112L
#define	_POSIX_TYPED_MEMORY_OBJECTS	(-1)
#define	_POSIX_VDISABLE			0xff

#if __XSI_VISIBLE
#define	_XOPEN_SHM			1
#define	_XOPEN_STREAMS			(-1)
#endif
# 84 "/usr/include/sys/unistd.h" 3 4

/*
 * Although we have saved user/group IDs, we do not use them in setuid
 * as described in POSIX 1003.1, because the feature does not work for
 * root.  We use the saved IDs in seteuid/setegid, which are not currently
 * part of the POSIX 1003.1 specification.  XXX revisit for 1003.1-2001
 * as this is now mandatory.
 */
#ifdef	_NOT_AVAILABLE
#define	_POSIX_SAVED_IDS	1 /* saved set-user-ID and set-group-ID */
#endif
# 95 "/usr/include/sys/unistd.h" 3 4

/* Define the POSIX.1 version we target for compliance. */
#define	_POSIX_VERSION		200112L

/* access function */
#define	F_OK		0	/* test for existence of file */
#define	X_OK		0x01	/* test for execute or search permission */
#define	W_OK		0x02	/* test for write permission */
#define	R_OK		0x04	/* test for read permission */

/* whence values for lseek(2) */
#ifndef SEEK_SET
#define	SEEK_SET	0	/* set file offset to offset */
#define	SEEK_CUR	1	/* set file offset to current plus offset */
#define	SEEK_END	2	/* set file offset to EOF plus offset */
#endif
# 111 "/usr/include/sys/unistd.h" 3 4
#if __BSD_VISIBLE
#define	SEEK_DATA	3	/* set file offset to next data past offset */
#define	SEEK_HOLE	4	/* set file offset to next hole past offset */
#endif
# 115 "/usr/include/sys/unistd.h" 3 4

#ifndef _POSIX_SOURCE
/* whence values for lseek(2); renamed by POSIX 1003.1 */
#define	L_SET		SEEK_SET
#define	L_INCR		SEEK_CUR
#define	L_XTND		SEEK_END
#endif
# 122 "/usr/include/sys/unistd.h" 3 4

/* configurable pathname variables */
#define	_PC_LINK_MAX		 1
#define	_PC_MAX_CANON		 2
#define	_PC_MAX_INPUT		 3
#define	_PC_NAME_MAX		 4
#define	_PC_PATH_MAX		 5
#define	_PC_PIPE_BUF		 6
#define	_PC_CHOWN_RESTRICTED	 7
#define	_PC_NO_TRUNC		 8
#define	_PC_VDISABLE		 9

#if __POSIX_VISIBLE >= 199309
#define	_PC_ASYNC_IO		53
#define	_PC_PRIO_IO		54
#define	_PC_SYNC_IO		55
#endif
# 139 "/usr/include/sys/unistd.h" 3 4

#if __POSIX_VISIBLE >= 200112
#define	_PC_ALLOC_SIZE_MIN	10
#define	_PC_FILESIZEBITS	12
#define	_PC_REC_INCR_XFER_SIZE	14
#define	_PC_REC_MAX_XFER_SIZE	15
#define	_PC_REC_MIN_XFER_SIZE	16
#define	_PC_REC_XFER_ALIGN	17
#define	_PC_SYMLINK_MAX		18
#endif
# 149 "/usr/include/sys/unistd.h" 3 4

#if __BSD_VISIBLE
#define	_PC_ACL_EXTENDED	59
#define	_PC_ACL_PATH_MAX	60
#define	_PC_CAP_PRESENT		61
#define	_PC_INF_PRESENT		62
#define	_PC_MAC_PRESENT		63
#define	_PC_ACL_NFS4		64
#endif
# 158 "/usr/include/sys/unistd.h" 3 4

/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */
#define	_PC_MIN_HOLE_SIZE	21

#if __BSD_VISIBLE
/*
 * rfork() options.
 *
 * XXX currently, some operations without RFPROC set are not supported.
 */
#define	RFNAMEG		(1<<0)	/* UNIMPL new plan9 `name space' */
#define	RFENVG		(1<<1)	/* UNIMPL copy plan9 `env space' */
#define	RFFDG		(1<<2)	/* copy fd table */
#define	RFNOTEG		(1<<3)	/* UNIMPL create new plan9 `note group' */
#define	RFPROC		(1<<4)	/* change child (else changes curproc) */
#define	RFMEM		(1<<5)	/* share `address space' */
#define	RFNOWAIT	(1<<6)	/* give child to init */
#define	RFCNAMEG	(1<<10)	/* UNIMPL zero plan9 `name space' */
#define	RFCENVG		(1<<11)	/* UNIMPL zero plan9 `env space' */
#define	RFCFDG		(1<<12)	/* close all fds, zero fd table */
#define	RFTHREAD	(1<<13)	/* enable kernel thread support */
#define	RFSIGSHARE	(1<<14)	/* share signal handlers */
#define	RFLINUXTHPN	(1<<16)	/* do linux clone exit parent notification */
#define	RFSTOPPED	(1<<17)	/* leave child in a stopped state */
#define	RFHIGHPID	(1<<18)	/* use a pid higher than 10 (idleproc) */
#define	RFTSIGZMB	(1<<19)	/* select signal for exit parent notification */
#define	RFTSIGSHIFT	20	/* selected signal number is in bits 20-27  */
#define	RFTSIGMASK	0xFF
#define	RFTSIGNUM(flags)	(((flags) >> RFTSIGSHIFT) & RFTSIGMASK)
#define	RFTSIGFLAGS(signum)	((signum) << RFTSIGSHIFT)
#define	RFPROCDESC	(1<<28)	/* return a process descriptor */
#define	RFPPWAIT	(1<<31)	/* parent sleeps until child exits (vfork) */
#define	RFFLAGS		(RFFDG | RFPROC | RFMEM | RFNOWAIT | RFCFDG | \
    RFTHREAD | RFSIGSHARE | RFLINUXTHPN | RFSTOPPED | RFHIGHPID | RFTSIGZMB | \
    RFPROCDESC | RFPPWAIT)
#define	RFKERNELONLY	(RFSTOPPED | RFHIGHPID | RFPPWAIT | RFPROCDESC)

#endif /* __BSD_VISIBLE */
# 196 "/usr/include/sys/unistd.h" 3 4

#endif /* !_SYS_UNISTD_H_ */
# 198 "/usr/include/sys/unistd.h" 3 4
# 39 "/usr/include/unistd.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 40 "/usr/include/unistd.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 41 "/usr/include/unistd.h" 3 4

#ifndef _GID_T_DECLARED
typedef	__gid_t		gid_t;
#define	_GID_T_DECLARED
#endif
# 46 "/usr/include/unistd.h" 3 4

#ifndef _OFF_T_DECLARED
typedef	__off_t		off_t;
#define	_OFF_T_DECLARED
#endif
# 51 "/usr/include/unistd.h" 3 4

#ifndef _PID_T_DECLARED
typedef	__pid_t		pid_t;
#define	_PID_T_DECLARED
#endif
# 56 "/usr/include/unistd.h" 3 4

#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 61 "/usr/include/unistd.h" 3 4

#ifndef _SSIZE_T_DECLARED
typedef	__ssize_t	ssize_t;
#define	_SSIZE_T_DECLARED
#endif
# 66 "/usr/include/unistd.h" 3 4

#ifndef _UID_T_DECLARED
typedef	__uid_t		uid_t;
#define	_UID_T_DECLARED
#endif
# 71 "/usr/include/unistd.h" 3 4

#ifndef _USECONDS_T_DECLARED
typedef	__useconds_t	useconds_t;
#define	_USECONDS_T_DECLARED
#endif
# 76 "/usr/include/unistd.h" 3 4

#define	STDIN_FILENO	0	/* standard input file descriptor */
#define	STDOUT_FILENO	1	/* standard output file descriptor */
#define	STDERR_FILENO	2	/* standard error file descriptor */

#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
#define	F_ULOCK		0	/* unlock locked section */
#define	F_LOCK		1	/* lock a section for exclusive use */
#define	F_TLOCK		2	/* test and lock a section for exclusive use */
#define	F_TEST		3	/* test a section for locks by other procs */
#endif
# 87 "/usr/include/unistd.h" 3 4

/*
 * POSIX options and option groups we unconditionally do or don't
 * implement.  This list includes those options which are exclusively
 * implemented (or not) in user mode.  Please keep this list in
 * alphabetical order.
 *
 * Anything which is defined as zero below **must** have an
 * implementation for the corresponding sysconf() which is able to
 * determine conclusively whether or not the feature is supported.
 * Anything which is defined as other than -1 below **must** have
 * complete headers, types, and function declarations as specified by
 * the POSIX standard; however, if the relevant sysconf() function
 * returns -1, the functions may be stubbed out.
 */
#define	_POSIX_BARRIERS			200112L
#define	_POSIX_CPUTIME			200112L
#define	_POSIX_READER_WRITER_LOCKS	200112L
#define	_POSIX_REGEXP			1
#define	_POSIX_SHELL			1
#define	_POSIX_SPAWN			200112L
#define	_POSIX_SPIN_LOCKS		200112L
#define	_POSIX_THREAD_ATTR_STACKADDR	200112L
#define	_POSIX_THREAD_ATTR_STACKSIZE	200112L
#define	_POSIX_THREAD_CPUTIME		200112L
#define	_POSIX_THREAD_PRIO_INHERIT	200112L
#define	_POSIX_THREAD_PRIO_PROTECT	200112L
#define	_POSIX_THREAD_PRIORITY_SCHEDULING 200112L
#define	_POSIX_THREAD_PROCESS_SHARED	-1
#define	_POSIX_THREAD_SAFE_FUNCTIONS	-1
#define	_POSIX_THREAD_SPORADIC_SERVER	-1
#define	_POSIX_THREADS			200112L
#define	_POSIX_TRACE			-1
#define	_POSIX_TRACE_EVENT_FILTER	-1
#define	_POSIX_TRACE_INHERIT		-1
#define	_POSIX_TRACE_LOG		-1
#define	_POSIX2_C_BIND			200112L	/* mandatory */
#define	_POSIX2_C_DEV			-1 /* need c99 utility */
#define	_POSIX2_CHAR_TERM		1
#define	_POSIX2_FORT_DEV		-1 /* need fort77 utility */
#define	_POSIX2_FORT_RUN		200112L
#define	_POSIX2_LOCALEDEF		-1
#define	_POSIX2_PBS			-1
#define	_POSIX2_PBS_ACCOUNTING		-1
#define	_POSIX2_PBS_CHECKPOINT		-1
#define	_POSIX2_PBS_LOCATE		-1
#define	_POSIX2_PBS_MESSAGE		-1
#define	_POSIX2_PBS_TRACK		-1
#define	_POSIX2_SW_DEV			-1 /* XXX ??? */
#define	_POSIX2_UPE			200112L
#define	_V6_ILP32_OFF32			-1
#define	_V6_ILP32_OFFBIG		0
#define	_V6_LP64_OFF64			0
#define	_V6_LPBIG_OFFBIG		-1

#if __XSI_VISIBLE
#define	_XOPEN_CRYPT			-1 /* XXX ??? */
#define	_XOPEN_ENH_I18N			-1 /* mandatory in XSI */
#define	_XOPEN_LEGACY			-1
#define	_XOPEN_REALTIME			-1
#define	_XOPEN_REALTIME_THREADS		-1
#define	_XOPEN_UNIX			-1
#endif
# 150 "/usr/include/unistd.h" 3 4

/* Define the POSIX.2 version we target for compliance. */
#define	_POSIX2_VERSION		199212L

/*
 * POSIX-style system configuration variable accessors (for the
 * sysconf function).  The kernel does not directly implement the
 * sysconf() interface; rather, a C library stub translates references
 * to sysconf() into calls to sysctl() using a giant switch statement.
 * Those that are marked `user' are implemented entirely in the C
 * library and never query the kernel.  pathconf() is implemented
 * directly by the kernel so those are not defined here.
 */
#define	_SC_ARG_MAX		 1
#define	_SC_CHILD_MAX		 2
#define	_SC_CLK_TCK		 3
#define	_SC_NGROUPS_MAX		 4
#define	_SC_OPEN_MAX		 5
#define	_SC_JOB_CONTROL		 6
#define	_SC_SAVED_IDS		 7
#define	_SC_VERSION		 8
#define	_SC_BC_BASE_MAX		 9 /* user */
#define	_SC_BC_DIM_MAX		10 /* user */
#define	_SC_BC_SCALE_MAX	11 /* user */
#define	_SC_BC_STRING_MAX	12 /* user */
#define	_SC_COLL_WEIGHTS_MAX	13 /* user */
#define	_SC_EXPR_NEST_MAX	14 /* user */
#define	_SC_LINE_MAX		15 /* user */
#define	_SC_RE_DUP_MAX		16 /* user */
#define	_SC_2_VERSION		17 /* user */
#define	_SC_2_C_BIND		18 /* user */
#define	_SC_2_C_DEV		19 /* user */
#define	_SC_2_CHAR_TERM		20 /* user */
#define	_SC_2_FORT_DEV		21 /* user */
#define	_SC_2_FORT_RUN		22 /* user */
#define	_SC_2_LOCALEDEF		23 /* user */
#define	_SC_2_SW_DEV		24 /* user */
#define	_SC_2_UPE		25 /* user */
#define	_SC_STREAM_MAX		26 /* user */
#define	_SC_TZNAME_MAX		27 /* user */

#if __POSIX_VISIBLE >= 199309
#define	_SC_ASYNCHRONOUS_IO	28
#define	_SC_MAPPED_FILES	29
#define	_SC_MEMLOCK		30
#define	_SC_MEMLOCK_RANGE	31
#define	_SC_MEMORY_PROTECTION	32
#define	_SC_MESSAGE_PASSING	33
#define	_SC_PRIORITIZED_IO	34
#define	_SC_PRIORITY_SCHEDULING	35
#define	_SC_REALTIME_SIGNALS	36
#define	_SC_SEMAPHORES		37
#define	_SC_FSYNC		38
#define	_SC_SHARED_MEMORY_OBJECTS 39
#define	_SC_SYNCHRONIZED_IO	40
#define	_SC_TIMERS		41
#define	_SC_AIO_LISTIO_MAX	42
#define	_SC_AIO_MAX		43
#define	_SC_AIO_PRIO_DELTA_MAX	44
#define	_SC_DELAYTIMER_MAX	45
#define	_SC_MQ_OPEN_MAX		46
#define	_SC_PAGESIZE		47
#define	_SC_RTSIG_MAX		48
#define	_SC_SEM_NSEMS_MAX	49
#define	_SC_SEM_VALUE_MAX	50
#define	_SC_SIGQUEUE_MAX	51
#define	_SC_TIMER_MAX		52
#endif
# 218 "/usr/include/unistd.h" 3 4

#if __POSIX_VISIBLE >= 200112
#define	_SC_2_PBS		59 /* user */
#define	_SC_2_PBS_ACCOUNTING	60 /* user */
#define	_SC_2_PBS_CHECKPOINT	61 /* user */
#define	_SC_2_PBS_LOCATE	62 /* user */
#define	_SC_2_PBS_MESSAGE	63 /* user */
#define	_SC_2_PBS_TRACK		64 /* user */
#define	_SC_ADVISORY_INFO	65
#define	_SC_BARRIERS		66 /* user */
#define	_SC_CLOCK_SELECTION	67
#define	_SC_CPUTIME		68
#define	_SC_FILE_LOCKING	69
#define	_SC_GETGR_R_SIZE_MAX	70 /* user */
#define	_SC_GETPW_R_SIZE_MAX	71 /* user */
#define	_SC_HOST_NAME_MAX	72
#define	_SC_LOGIN_NAME_MAX	73
#define	_SC_MONOTONIC_CLOCK	74
#define	_SC_MQ_PRIO_MAX		75
#define	_SC_READER_WRITER_LOCKS	76 /* user */
#define	_SC_REGEXP		77 /* user */
#define	_SC_SHELL		78 /* user */
#define	_SC_SPAWN		79 /* user */
#define	_SC_SPIN_LOCKS		80 /* user */
#define	_SC_SPORADIC_SERVER	81
#define	_SC_THREAD_ATTR_STACKADDR 82 /* user */
#define	_SC_THREAD_ATTR_STACKSIZE 83 /* user */
#define	_SC_THREAD_CPUTIME	84 /* user */
#define	_SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */
#define	_SC_THREAD_KEYS_MAX	86 /* user */
#define	_SC_THREAD_PRIO_INHERIT	87 /* user */
#define	_SC_THREAD_PRIO_PROTECT	88 /* user */
#define	_SC_THREAD_PRIORITY_SCHEDULING 89 /* user */
#define	_SC_THREAD_PROCESS_SHARED 90 /* user */
#define	_SC_THREAD_SAFE_FUNCTIONS 91 /* user */
#define	_SC_THREAD_SPORADIC_SERVER 92 /* user */
#define	_SC_THREAD_STACK_MIN	93 /* user */
#define	_SC_THREAD_THREADS_MAX	94 /* user */
#define	_SC_TIMEOUTS		95 /* user */
#define	_SC_THREADS		96 /* user */
#define	_SC_TRACE		97 /* user */
#define	_SC_TRACE_EVENT_FILTER	98 /* user */
#define	_SC_TRACE_INHERIT	99 /* user */
#define	_SC_TRACE_LOG		100 /* user */
#define	_SC_TTY_NAME_MAX	101 /* user */
#define	_SC_TYPED_MEMORY_OBJECTS 102
#define	_SC_V6_ILP32_OFF32	103 /* user */
#define	_SC_V6_ILP32_OFFBIG	104 /* user */
#define	_SC_V6_LP64_OFF64	105 /* user */
#define	_SC_V6_LPBIG_OFFBIG	106 /* user */
#define	_SC_IPV6		118
#define	_SC_RAW_SOCKETS		119
#define	_SC_SYMLOOP_MAX		120
#endif
# 272 "/usr/include/unistd.h" 3 4

#if __XSI_VISIBLE
#define	_SC_ATEXIT_MAX		107 /* user */
#define	_SC_IOV_MAX		56
#define	_SC_PAGE_SIZE		_SC_PAGESIZE
#define	_SC_XOPEN_CRYPT		108 /* user */
#define	_SC_XOPEN_ENH_I18N	109 /* user */
#define	_SC_XOPEN_LEGACY	110 /* user */
#define	_SC_XOPEN_REALTIME	111
#define	_SC_XOPEN_REALTIME_THREADS 112
#define	_SC_XOPEN_SHM		113
#define	_SC_XOPEN_STREAMS	114
#define	_SC_XOPEN_UNIX		115
#define	_SC_XOPEN_VERSION	116
#define	_SC_XOPEN_XCU_VERSION	117 /* user */
#endif
# 288 "/usr/include/unistd.h" 3 4

#if __BSD_VISIBLE
#define	_SC_NPROCESSORS_CONF	57
#define	_SC_NPROCESSORS_ONLN	58
#define	_SC_CPUSET_SIZE		122
#endif
# 294 "/usr/include/unistd.h" 3 4

/* Extensions found in Solaris and Linux. */
#define	_SC_PHYS_PAGES		121

/* Keys for the confstr(3) function. */
#if __POSIX_VISIBLE >= 199209
#define	_CS_PATH		1	/* default value of PATH */
#endif
# 302 "/usr/include/unistd.h" 3 4

#if __POSIX_VISIBLE >= 200112
#define	_CS_POSIX_V6_ILP32_OFF32_CFLAGS		2
#define	_CS_POSIX_V6_ILP32_OFF32_LDFLAGS	3
#define	_CS_POSIX_V6_ILP32_OFF32_LIBS		4
#define	_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS	5
#define	_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS	6
#define	_CS_POSIX_V6_ILP32_OFFBIG_LIBS		7
#define	_CS_POSIX_V6_LP64_OFF64_CFLAGS		8
#define	_CS_POSIX_V6_LP64_OFF64_LDFLAGS		9
#define	_CS_POSIX_V6_LP64_OFF64_LIBS		10
#define	_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS	11
#define	_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS	12
#define	_CS_POSIX_V6_LPBIG_OFFBIG_LIBS		13
#define	_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS	14
#endif
# 318 "/usr/include/unistd.h" 3 4

__BEGIN_DECLS
/* 1003.1-1990 */
void	 _exit(int) __dead2;
int	 access(const char *, int);
unsigned int	 alarm(unsigned int);
int	 chdir(const char *);
int	 chown(const char *, uid_t, gid_t);
int	 close(int);
void	 closefrom(int);
int	 dup(int);
int	 dup2(int, int);
int	 execl(const char *, const char *, ...);
int	 execle(const char *, const char *, ...);
int	 execlp(const char *, const char *, ...);
int	 execv(const char *, char * const *);
int	 execve(const char *, char * const *, char * const *);
int	 execvp(const char *, char * const *);
pid_t	 fork(void);
long	 fpathconf(int, int);
char	*getcwd(char *, size_t);
gid_t	 getegid(void);
uid_t	 geteuid(void);
gid_t	 getgid(void);
int	 getgroups(int, gid_t []);
char	*getlogin(void);
pid_t	 getpgrp(void);
pid_t	 getpid(void);
pid_t	 getppid(void);
uid_t	 getuid(void);
int	 isatty(int);
int	 link(const char *, const char *);
#ifndef _LSEEK_DECLARED
#define	_LSEEK_DECLARED
off_t	 lseek(int, off_t, int);
#endif
# 354 "/usr/include/unistd.h" 3 4
long	 pathconf(const char *, int);
int	 pause(void);
int	 pipe(int *);
ssize_t	 read(int, void *, size_t);
int	 rmdir(const char *);
int	 setgid(gid_t);
int	 setpgid(pid_t, pid_t);
pid_t	 setsid(void);
int	 setuid(uid_t);
unsigned int	 sleep(unsigned int);
long	 sysconf(int);
pid_t	 tcgetpgrp(int);
int	 tcsetpgrp(int, pid_t);
char	*ttyname(int);
int	ttyname_r(int, char *, size_t);
int	 unlink(const char *);
ssize_t	 write(int, const void *, size_t);

/* 1003.2-1992 */
#if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE
size_t	 confstr(int, char *, size_t);
#ifndef _GETOPT_DECLARED
#define	_GETOPT_DECLARED
int	 getopt(int, char * const [], const char *);

extern char *optarg;			/* getopt(3) external variables */
extern int optind, opterr, optopt;
#endif /* _GETOPT_DECLARED */
# 382 "/usr/include/unistd.h" 3 4
#endif
# 383 "/usr/include/unistd.h" 3 4

/* ISO/IEC 9945-1: 1996 */
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
int	 fsync(int);

/*
 * ftruncate() was in the POSIX Realtime Extension (it's used for shared
 * memory), but truncate() was not.
 */
#ifndef _FTRUNCATE_DECLARED
#define	_FTRUNCATE_DECLARED
int	 ftruncate(int, off_t);
#endif
# 396 "/usr/include/unistd.h" 3 4
#endif
# 397 "/usr/include/unistd.h" 3 4

#if __POSIX_VISIBLE >= 199506
int	 getlogin_r(char *, int);
#endif
# 401 "/usr/include/unistd.h" 3 4

/* 1003.1-2001 */
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
int	 fchown(int, uid_t, gid_t);
ssize_t	 readlink(const char * __restrict, char * __restrict, size_t);
#endif
# 407 "/usr/include/unistd.h" 3 4
#if __POSIX_VISIBLE >= 200112
int	 gethostname(char *, size_t);
int	 setegid(gid_t);
int	 seteuid(uid_t);
#endif
# 412 "/usr/include/unistd.h" 3 4

/* 1003.1-2008 */
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
int	 getsid(pid_t _pid);
int	 fchdir(int);
int	 getpgid(pid_t _pid);
int	 lchown(const char *, uid_t, gid_t);
ssize_t	 pread(int, void *, size_t, off_t);
ssize_t	 pwrite(int, const void *, size_t, off_t);

/* See comment at ftruncate() above. */
#ifndef _TRUNCATE_DECLARED
#define	_TRUNCATE_DECLARED
int	 truncate(const char *, off_t);
#endif
# 427 "/usr/include/unistd.h" 3 4
#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
# 428 "/usr/include/unistd.h" 3 4

#if __POSIX_VISIBLE >= 200809
int	faccessat(int, const char *, int, int);
int	fchownat(int, const char *, uid_t, gid_t, int);
int	fexecve(int, char *const [], char *const []);
int	linkat(int, const char *, int, const char *, int);
ssize_t	readlinkat(int, const char * __restrict, char * __restrict, size_t);
int	symlinkat(const char *, int, const char *);
int	unlinkat(int, const char *, int);
#endif /* __POSIX_VISIBLE >= 200809 */
# 438 "/usr/include/unistd.h" 3 4

/*
 * symlink() was originally in POSIX.1a, which was withdrawn after
 * being overtaken by events (1003.1-2001).  It was in XPG4.2, and of
 * course has been in BSD since 4.2.
 */
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402
int	 symlink(const char * __restrict, const char * __restrict);
#endif
# 447 "/usr/include/unistd.h" 3 4

/* X/Open System Interfaces */
#if __XSI_VISIBLE
char	*crypt(const char *, const char *);
/* char	*ctermid(char *); */		/* XXX ??? */
int	 encrypt(char *, int);
long	 gethostid(void);
int	 lockf(int, int, off_t);
int	 nice(int);
int	 setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
int	 setregid(gid_t, gid_t);
int	 setreuid(uid_t, uid_t);

#ifndef _SWAB_DECLARED
#define _SWAB_DECLARED
void	 swab(const void * __restrict, void * __restrict, ssize_t);
#endif /* _SWAB_DECLARED */
# 464 "/usr/include/unistd.h" 3 4

void	 sync(void);

#endif /* __XSI_VISIBLE */
# 468 "/usr/include/unistd.h" 3 4

#if (__XSI_VISIBLE && __XSI_VISIBLE <= 500) || __BSD_VISIBLE
int	 brk(const void *);
int	 chroot(const char *);
int	 getdtablesize(void);
int	 getpagesize(void) __pure2;
char	*getpass(const char *);
void	*sbrk(intptr_t);
#endif
# 477 "/usr/include/unistd.h" 3 4

#if (__XSI_VISIBLE && __XSI_VISIBLE <= 600) || __BSD_VISIBLE
char	*getwd(char *);			/* obsoleted by getcwd() */
useconds_t
	 ualarm(useconds_t, useconds_t);
int	 usleep(useconds_t);
pid_t	 vfork(void) __returns_twice;
#endif
# 485 "/usr/include/unistd.h" 3 4

#if __BSD_VISIBLE
struct timeval;				/* select(2) */
int	 acct(const char *);
int	 async_daemon(void);
int	 check_utility_compat(const char *);
const char *
	 crypt_get_format(void);
int	 crypt_set_format(const char *);
int	 des_cipher(const char *, char *, long, int);
int	 des_setkey(const char *key);
int	 dup3(int, int, int);
int	 eaccess(const char *, int);
void	 endusershell(void);
int	 exect(const char *, char * const *, char * const *);
int	 execvP(const char *, const char *, char * const *);
int	 feature_present(const char *);
char	*fflagstostr(u_long);
int	 getdomainname(char *, int);
int	 getgrouplist(const char *, gid_t, gid_t *, int *);
int	 getloginclass(char *, size_t);
mode_t	 getmode(const void *, mode_t);
int	 getosreldate(void);
int	 getpeereid(int, uid_t *, gid_t *);
int	 getresgid(gid_t *, gid_t *, gid_t *);
int	 getresuid(uid_t *, uid_t *, uid_t *);
char	*getusershell(void);
int	 initgroups(const char *, gid_t);
int	 iruserok(unsigned long, int, const char *, const char *);
int	 iruserok_sa(const void *, int, int, const char *, const char *);
int	 issetugid(void);
void	__FreeBSD_libc_enter_restricted_mode(void);
long	 lpathconf(const char *, int);
#ifndef _MKDTEMP_DECLARED
char	*mkdtemp(char *);
#define	_MKDTEMP_DECLARED
#endif
# 522 "/usr/include/unistd.h" 3 4
#ifndef	_MKNOD_DECLARED
int	 mknod(const char *, mode_t, dev_t);
#define	_MKNOD_DECLARED
#endif
# 526 "/usr/include/unistd.h" 3 4
#ifndef _MKSTEMP_DECLARED
int	 mkstemp(char *);
#define	_MKSTEMP_DECLARED
#endif
# 530 "/usr/include/unistd.h" 3 4
int	 mkstemps(char *, int);
#ifndef _MKTEMP_DECLARED
char	*mktemp(char *);
#define	_MKTEMP_DECLARED
#endif
# 535 "/usr/include/unistd.h" 3 4
int	 nfssvc(int, void *);
int	 nlm_syscall(int, int, int, char **);
int	 pipe2(int *, int);
int	 profil(char *, size_t, vm_offset_t, int);
int	 rcmd(char **, int, const char *, const char *, const char *, int *);
int	 rcmd_af(char **, int, const char *,
		const char *, const char *, int *, int);
int	 rcmdsh(char **, int, const char *,
		const char *, const char *, const char *);
char	*re_comp(const char *);
int	 re_exec(const char *);
int	 reboot(int);
int	 revoke(const char *);
pid_t	 rfork(int);
pid_t	 rfork_thread(int, void *, int (*)(void *), void *);
int	 rresvport(int *);
int	 rresvport_af(int *, int);
int	 ruserok(const char *, int, const char *, const char *);
#if __BSD_VISIBLE
#ifndef _SELECT_DECLARED
#define	_SELECT_DECLARED
int	 select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
#endif
# 558 "/usr/include/unistd.h" 3 4
#endif
# 559 "/usr/include/unistd.h" 3 4
int	 setdomainname(const char *, int);
int	 setgroups(int, const gid_t *);
void	 sethostid(long);
int	 sethostname(const char *, int);
#ifndef _SETKEY_DECLARED
int	 setkey(const char *);
#define	_SETKEY_DECLARED
#endif
# 567 "/usr/include/unistd.h" 3 4
int	 setlogin(const char *);
int	 setloginclass(const char *);
void	*setmode(const char *);
void	 setproctitle(const char *_fmt, ...) __printf0like(1, 2);
int	 setresgid(gid_t, gid_t, gid_t);
int	 setresuid(uid_t, uid_t, uid_t);
int	 setrgid(gid_t);
int	 setruid(uid_t);
void	 setusershell(void);
int	 strtofflags(char **, u_long *, u_long *);
int	 swapon(const char *);
int	 swapoff(const char *);
int	 syscall(int, ...);
off_t	 __syscall(quad_t, ...);
int	 undelete(const char *);
int	 unwhiteout(const char *);
void	*valloc(size_t);			/* obsoleted by malloc() */

#ifndef _OPTRESET_DECLARED
#define	_OPTRESET_DECLARED
extern int optreset;			/* getopt(3) external variable */
#endif
# 589 "/usr/include/unistd.h" 3 4
#endif /* __BSD_VISIBLE */
# 590 "/usr/include/unistd.h" 3 4
__END_DECLS

#endif /* !_UNISTD_H_ */
# 593 "/usr/include/unistd.h" 3 4
# 72 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <stdlib.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/stdlib.h" 1 3 4
/*-
 * Copyright (c) 1990, 1993
 *	The Regents of the University of California.  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.
 * 3. 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.
 *
 *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 * $FreeBSD: head/include/stdlib.h 264042 2014-04-02 16:07:48Z theraven $
 */

#ifndef _STDLIB_H_
#define	_STDLIB_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/stdlib.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/include/stdlib.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 39 "/usr/include/stdlib.h" 3 4

#if __BSD_VISIBLE
#ifndef _RUNE_T_DECLARED
typedef	__rune_t	rune_t;
#define	_RUNE_T_DECLARED
#endif
# 45 "/usr/include/stdlib.h" 3 4
#endif
# 46 "/usr/include/stdlib.h" 3 4

#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 51 "/usr/include/stdlib.h" 3 4

#ifndef	__cplusplus
#ifndef _WCHAR_T_DECLARED
typedef	___wchar_t	wchar_t;
#define	_WCHAR_T_DECLARED
#endif
# 57 "/usr/include/stdlib.h" 3 4
#endif
# 58 "/usr/include/stdlib.h" 3 4

typedef struct {
	int	quot;		/* quotient */
	int	rem;		/* remainder */
} div_t;

typedef struct {
	long	quot;
	long	rem;
} ldiv_t;

#define	EXIT_FAILURE	1
#define	EXIT_SUCCESS	0

#define	RAND_MAX	0x7ffffffd

__BEGIN_DECLS
#ifdef _XLOCALE_H_
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_stdlib.h>
#endif /* expanded by -frewrite-includes */
# 77 "/usr/include/stdlib.h" 3 4
#endif
# 78 "/usr/include/stdlib.h" 3 4
extern int __mb_cur_max;
extern int ___mb_cur_max(void);
#define	MB_CUR_MAX	(___mb_cur_max())

_Noreturn void	 abort(void);
int	 abs(int) __pure2;
int	 atexit(void (*)(void));
#ifdef __BLOCKS__
int	 atexit_b(void (^)(void));
#endif
# 88 "/usr/include/stdlib.h" 3 4
double	 atof(const char *);
int	 atoi(const char *);
long	 atol(const char *);
void	*bsearch(const void *, const void *, size_t,
	    size_t, int (*)(const void *, const void *));
void	*calloc(size_t, size_t) __malloc_like;
div_t	 div(int, int) __pure2;
_Noreturn void	 exit(int);
void	 free(void *);
char	*getenv(const char *);
long	 labs(long) __pure2;
ldiv_t	 ldiv(long, long) __pure2;
void	*malloc(size_t) __malloc_like;
int	 mblen(const char *, size_t);
size_t	 mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
int	 mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
void	 qsort(void *, size_t, size_t,
	    int (*)(const void *, const void *));
#ifdef __BLOCKS__
void	 qsort_b(void *, size_t, size_t,
	    int (^)(const void *, const void *));
#endif
# 110 "/usr/include/stdlib.h" 3 4
int	 rand(void);
void	*realloc(void *, size_t);
void	 srand(unsigned);
double	 strtod(const char * __restrict, char ** __restrict);
float	 strtof(const char * __restrict, char ** __restrict);
long	 strtol(const char * __restrict, char ** __restrict, int);
long double
	 strtold(const char * __restrict, char ** __restrict);
unsigned long
	 strtoul(const char * __restrict, char ** __restrict, int);
int	 system(const char *);
int	 wctomb(char *, wchar_t);
size_t	 wcstombs(char * __restrict, const wchar_t * __restrict, size_t);

/*
 * Functions added in C99 which we make conditionally available in the
 * BSD^C89 namespace if the compiler supports `long long'.
 * The #if test is more complicated than it ought to be because
 * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
 * is not supported in the compilation environment (which therefore means
 * that it can't really be ISO C99).
 *
 * (The only other extension made by C99 in thie header is _Exit().)
 */
#if __ISO_C_VISIBLE >= 1999
#ifdef __LONG_LONG_SUPPORTED
/* LONGLONG */
typedef struct {
	long long quot;
	long long rem;
} lldiv_t;

/* LONGLONG */
long long
	 atoll(const char *);
/* LONGLONG */
long long
	 llabs(long long) __pure2;
/* LONGLONG */
lldiv_t	 lldiv(long long, long long) __pure2;
/* LONGLONG */
long long
	 strtoll(const char * __restrict, char ** __restrict, int);
/* LONGLONG */
unsigned long long
	 strtoull(const char * __restrict, char ** __restrict, int);
#endif /* __LONG_LONG_SUPPORTED */
# 157 "/usr/include/stdlib.h" 3 4

_Noreturn void	 _Exit(int);
#endif /* __ISO_C_VISIBLE >= 1999 */
# 160 "/usr/include/stdlib.h" 3 4

/*
 * If we're in a mode greater than C99, expose C11 functions.
 */
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
void *	aligned_alloc(size_t, size_t) __malloc_like;
int	at_quick_exit(void (*)(void));
_Noreturn void
	quick_exit(int);
#endif /* __ISO_C_VISIBLE >= 2011 */
# 170 "/usr/include/stdlib.h" 3 4
/*
 * Extensions made by POSIX relative to C.
 */
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
char	*realpath(const char * __restrict, char * __restrict);
#endif
# 176 "/usr/include/stdlib.h" 3 4
#if __POSIX_VISIBLE >= 199506
int	 rand_r(unsigned *);			/* (TSF) */
#endif
# 179 "/usr/include/stdlib.h" 3 4
#if __POSIX_VISIBLE >= 200112
int	 posix_memalign(void **, size_t, size_t); /* (ADV) */
int	 setenv(const char *, const char *, int);
int	 unsetenv(const char *);
#endif
# 184 "/usr/include/stdlib.h" 3 4

#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
int	 getsubopt(char **, char *const *, char **);
#ifndef _MKDTEMP_DECLARED
char	*mkdtemp(char *);
#define	_MKDTEMP_DECLARED
#endif
# 191 "/usr/include/stdlib.h" 3 4
#ifndef _MKSTEMP_DECLARED
int	 mkstemp(char *);
#define	_MKSTEMP_DECLARED
#endif
# 195 "/usr/include/stdlib.h" 3 4
#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
# 196 "/usr/include/stdlib.h" 3 4

/*
 * The only changes to the XSI namespace in revision 6 were the deletion
 * of the ttyslot() and valloc() functions, which FreeBSD never declared
 * in this header.  For revision 7, ecvt(), fcvt(), and gcvt(), which
 * FreeBSD also does not have, and mktemp(), are to be deleted.
 */
#if __XSI_VISIBLE
/* XXX XSI requires pollution from <sys/wait.h> here.  We'd rather not. */
long	 a64l(const char *);
double	 drand48(void);
/* char	*ecvt(double, int, int * __restrict, int * __restrict); */
double	 erand48(unsigned short[3]);
/* char	*fcvt(double, int, int * __restrict, int * __restrict); */
/* char	*gcvt(double, int, int * __restrict, int * __restrict); */
int	 grantpt(int);
char	*initstate(unsigned long /* XSI requires u_int */, char *, long);
long	 jrand48(unsigned short[3]);
char	*l64a(long);
void	 lcong48(unsigned short[7]);
long	 lrand48(void);
#if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600)
char	*mktemp(char *);
#define	_MKTEMP_DECLARED
#endif
# 221 "/usr/include/stdlib.h" 3 4
long	 mrand48(void);
long	 nrand48(unsigned short[3]);
int	 posix_openpt(int);
char	*ptsname(int);
int	 putenv(char *);
long	 random(void);
unsigned short
	*seed48(unsigned short[3]);
#ifndef _SETKEY_DECLARED
int	 setkey(const char *);
#define	_SETKEY_DECLARED
#endif
# 233 "/usr/include/stdlib.h" 3 4
char	*setstate(/* const */ char *);
void	 srand48(long);
void	 srandom(unsigned long);
int	 unlockpt(int);
#endif /* __XSI_VISIBLE */
# 238 "/usr/include/stdlib.h" 3 4

#if __BSD_VISIBLE
extern const char *malloc_conf;
extern void (*malloc_message)(void *, const char *);

/*
 * The alloca() function can't be implemented in C, and on some
 * platforms it can't be implemented at all as a callable function.
 * The GNU C compiler provides a built-in alloca() which we can use;
 * in all other cases, provide a prototype, mainly to pacify various
 * incarnations of lint.  On platforms where alloca() is not in libc,
 * programs which use it will fail to link when compiled with non-GNU
 * compilers.
 */
#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
#undef  alloca	/* some GNU bits try to get cute and define this on their own */
#define alloca(sz) __builtin_alloca(sz)
#elif defined(lint)
# 256 "/usr/include/stdlib.h" 3 4
void	*alloca(size_t);
#endif
# 258 "/usr/include/stdlib.h" 3 4

void	 abort2(const char *, int, void **) __dead2;
__uint32_t
	 arc4random(void);
void	 arc4random_addrandom(unsigned char *, int);
void	 arc4random_buf(void *, size_t);
void	 arc4random_stir(void);
__uint32_t 
	 arc4random_uniform(__uint32_t);
char	*getbsize(int *, long *);
					/* getcap(3) functions */
char	*cgetcap(char *, const char *, int);
int	 cgetclose(void);
int	 cgetent(char **, char **, const char *);
int	 cgetfirst(char **, char **);
int	 cgetmatch(const char *, const char *);
int	 cgetnext(char **, char **);
int	 cgetnum(char *, const char *, long *);
int	 cgetset(const char *);
int	 cgetstr(char *, const char *, char **);
int	 cgetustr(char *, const char *, char **);

int	 daemon(int, int);
char	*devname(__dev_t, __mode_t);
char 	*devname_r(__dev_t, __mode_t, char *, int);
char	*fdevname(int);
char 	*fdevname_r(int, char *, int);
int	 getloadavg(double [], int);
const char *
	 getprogname(void);

int	 heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
#ifdef __BLOCKS__
int	 heapsort_b(void *, size_t, size_t, int (^)(const void *, const void *));
#endif
# 293 "/usr/include/stdlib.h" 3 4
int	 l64a_r(long, char *, int);
int	 mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
#ifdef __BLOCKS__
int	 mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *));
#endif
# 298 "/usr/include/stdlib.h" 3 4
int	 mkostemp(char *, int);
int	 mkostemps(char *, int, int);
void	 qsort_r(void *, size_t, size_t, void *,
	    int (*)(void *, const void *, const void *));
int	 radixsort(const unsigned char **, int, const unsigned char *,
	    unsigned);
void    *reallocf(void *, size_t);
int	 rpmatch(const char *);
void	 setprogname(const char *);
int	 sradixsort(const unsigned char **, int, const unsigned char *,
	    unsigned);
void	 sranddev(void);
void	 srandomdev(void);
long long
	strtonum(const char *, long long, long long, const char **);

/* Deprecated interfaces, to be removed in FreeBSD 6.0. */
__int64_t
	 strtoq(const char *, char **, int);
__uint64_t
	 strtouq(const char *, char **, int);

extern char *suboptarg;			/* getsubopt(3) external variable */
#endif /* __BSD_VISIBLE */
# 322 "/usr/include/stdlib.h" 3 4
__END_DECLS

#endif /* !_STDLIB_H_ */
# 325 "/usr/include/stdlib.h" 3 4
# 73 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <string.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/string.h" 1 3 4
/*-
 * Copyright (c) 1990, 1993
 *	The Regents of the University of California.  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.
 * 3. 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.
 *
 *	@(#)string.h	8.1 (Berkeley) 6/2/93
 * $FreeBSD: head/include/string.h 265878 2014-05-11 13:48:21Z jilles $
 */

#ifndef _STRING_H_
#define	_STRING_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/string.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/include/string.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 39 "/usr/include/string.h" 3 4

/*
 * Prototype functions which were historically defined in <string.h>, but
 * are required by POSIX to be prototyped in <strings.h>.
 */
#if __BSD_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <strings.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/strings.h" 1 3 4
/*-
 * Copyright (c) 2002 Mike Barcroft <mike@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: head/include/strings.h 266865 2014-05-30 01:09:07Z pfg $
 */

#ifndef _STRINGS_H_
#define	_STRINGS_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 33 "/usr/include/strings.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 34 "/usr/include/strings.h" 3 4

#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 39 "/usr/include/strings.h" 3 4

__BEGIN_DECLS
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
int	 bcmp(const void *, const void *, size_t) __pure;	/* LEGACY */
void	 bcopy(const void *, void *, size_t);			/* LEGACY */
void	 bzero(void *, size_t);					/* LEGACY */
#endif
# 46 "/usr/include/strings.h" 3 4
#if __XSI_VISIBLE
int	 ffs(int) __pure2;
#endif
# 49 "/usr/include/strings.h" 3 4
#if __BSD_VISIBLE
int	 ffsl(long) __pure2;
int	 ffsll(long long) __pure2;
int	 fls(int) __pure2;
int	 flsl(long) __pure2;
int	 flsll(long long) __pure2;
#endif
# 56 "/usr/include/strings.h" 3 4
#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
char	*index(const char *, int) __pure;			/* LEGACY */
char	*rindex(const char *, int) __pure;			/* LEGACY */
#endif
# 60 "/usr/include/strings.h" 3 4
int	 strcasecmp(const char *, const char *) __pure;
int	 strncasecmp(const char *, const char *, size_t) __pure;

#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_strings.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/xlocale/_strings.h" 1 3 4
/*-
 * Copyright (c) 2011, 2012 The FreeBSD Foundation
 * 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: head/include/xlocale/_strings.h 266865 2014-05-30 01:09:07Z pfg $
 */

#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct	_xlocale *locale_t;
#endif
# 33 "/usr/include/xlocale/_strings.h" 3 4

/*
 * This file is included from both strings.h and xlocale.h.  We need to expose
 * the declarations unconditionally if we are included from xlocale.h, but only
 * if we are in POSIX2008 mode if included from string.h.
 */

#ifndef _XLOCALE_STRINGS1_H
#define _XLOCALE_STRINGS1_H

/*
 * POSIX2008 functions
 */
int	 strcasecmp_l(const char *, const char *, locale_t);
int	 strncasecmp_l(const char *, const char *, size_t, locale_t);
#endif /* _XLOCALE_STRINGS1_H */
# 49 "/usr/include/xlocale/_strings.h" 3 4
# 65 "/usr/include/strings.h" 2 3 4
#endif
# 66 "/usr/include/strings.h" 3 4
__END_DECLS

#endif /* _STRINGS_H_ */
# 69 "/usr/include/strings.h" 3 4
# 46 "/usr/include/string.h" 2 3 4
#endif
# 47 "/usr/include/string.h" 3 4

#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 52 "/usr/include/string.h" 3 4

__BEGIN_DECLS
#if __XSI_VISIBLE >= 600
void	*memccpy(void * __restrict, const void * __restrict, int, size_t);
#endif
# 57 "/usr/include/string.h" 3 4
void	*memchr(const void *, int, size_t) __pure;
#if __BSD_VISIBLE
void	*memrchr(const void *, int, size_t) __pure;
#endif
# 61 "/usr/include/string.h" 3 4
int	 memcmp(const void *, const void *, size_t) __pure;
void	*memcpy(void * __restrict, const void * __restrict, size_t);
#if __BSD_VISIBLE
void	*memmem(const void *, size_t, const void *, size_t) __pure;
#endif
# 66 "/usr/include/string.h" 3 4
void	*memmove(void *, const void *, size_t);
void	*memset(void *, int, size_t);
#if __POSIX_VISIBLE >= 200809
char	*stpcpy(char * __restrict, const char * __restrict);
char	*stpncpy(char * __restrict, const char * __restrict, size_t);
#endif
# 72 "/usr/include/string.h" 3 4
#if __BSD_VISIBLE
char	*strcasestr(const char *, const char *) __pure;
#endif
# 75 "/usr/include/string.h" 3 4
char	*strcat(char * __restrict, const char * __restrict);
char	*strchr(const char *, int) __pure;
#if __BSD_VISIBLE
char	*strchrnul(const char*, int) __pure;
#endif
# 80 "/usr/include/string.h" 3 4
int	 strcmp(const char *, const char *) __pure;
int	 strcoll(const char *, const char *);
char	*strcpy(char * __restrict, const char * __restrict);
size_t	 strcspn(const char *, const char *) __pure;
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
char	*strdup(const char *) __malloc_like;
#endif
# 87 "/usr/include/string.h" 3 4
char	*strerror(int);
#if __POSIX_VISIBLE >= 200112
int	 strerror_r(int, char *, size_t);
#endif
# 91 "/usr/include/string.h" 3 4
#if __BSD_VISIBLE
size_t	 strlcat(char * __restrict, const char * __restrict, size_t);
size_t	 strlcpy(char * __restrict, const char * __restrict, size_t);
#endif
# 95 "/usr/include/string.h" 3 4
size_t	 strlen(const char *) __pure;
#if __BSD_VISIBLE
void	 strmode(int, char *);
#endif
# 99 "/usr/include/string.h" 3 4
char	*strncat(char * __restrict, const char * __restrict, size_t);
int	 strncmp(const char *, const char *, size_t) __pure;
char	*strncpy(char * __restrict, const char * __restrict, size_t);
#if __POSIX_VISIBLE >= 200809
char	*strndup(const char *, size_t) __malloc_like;
size_t	 strnlen(const char *, size_t) __pure;
#endif
# 106 "/usr/include/string.h" 3 4
#if __BSD_VISIBLE
char	*strnstr(const char *, const char *, size_t) __pure;
#endif
# 109 "/usr/include/string.h" 3 4
char	*strpbrk(const char *, const char *) __pure;
char	*strrchr(const char *, int) __pure;
#if __BSD_VISIBLE
char	*strsep(char **, const char *);
#endif
# 114 "/usr/include/string.h" 3 4
#if __POSIX_VISIBLE >= 200809
char	*strsignal(int);
#endif
# 117 "/usr/include/string.h" 3 4
size_t	 strspn(const char *, const char *) __pure;
char	*strstr(const char *, const char *) __pure;
char	*strtok(char * __restrict, const char * __restrict);
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
char	*strtok_r(char *, const char *, char **);
#endif
# 123 "/usr/include/string.h" 3 4
size_t	 strxfrm(char * __restrict, const char * __restrict, size_t);
#if __BSD_VISIBLE

#ifndef _SWAB_DECLARED
#define _SWAB_DECLARED

#ifndef _SSIZE_T_DECLARED
typedef	__ssize_t	ssize_t;
#define	_SSIZE_T_DECLARED
#endif /* _SIZE_T_DECLARED */
# 133 "/usr/include/string.h" 3 4

void	 swab(const void * __restrict, void * __restrict, ssize_t);
#endif /* _SWAB_DECLARED */
# 136 "/usr/include/string.h" 3 4

#endif /* __BSD_VISIBLE */
# 138 "/usr/include/string.h" 3 4

#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_string.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/xlocale/_string.h" 1 3 4
/*-
 * Copyright (c) 2011, 2012 The FreeBSD Foundation
 * 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: head/include/xlocale/_string.h 266865 2014-05-30 01:09:07Z pfg $
 */

#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct	_xlocale *locale_t;
#endif
# 33 "/usr/include/xlocale/_string.h" 3 4

/*
 * This file is included from both string.h and xlocale.h.  We need to expose
 * the declarations unconditionally if we are included from xlocale.h, but only
 * if we are in POSIX2008 mode if included from string.h.
 */

#ifndef _XLOCALE_STRING1_H
#define _XLOCALE_STRING1_H

/*
 * POSIX2008 functions
 */
int	 strcoll_l(const char *, const char *, locale_t);
size_t	 strxfrm_l(char *, const char *, size_t, locale_t);
#endif /* _XLOCALE_STRING1_H */
# 49 "/usr/include/xlocale/_string.h" 3 4

/*
 * xlocale extensions
 */
#ifdef _XLOCALE_H_
#ifndef _XLOCALE_STRING2_H
#define _XLOCALE_STRING2_H
char	*strcasestr_l(const char *, const char *, locale_t);

#endif /* _XLOCALE_STRING2_H */
# 59 "/usr/include/xlocale/_string.h" 3 4
#endif /* _XLOCALE_H_ */
# 60 "/usr/include/xlocale/_string.h" 3 4
# 141 "/usr/include/string.h" 2 3 4
#endif
# 142 "/usr/include/string.h" 3 4
__END_DECLS

#endif /* _STRING_H_ */
# 145 "/usr/include/string.h" 3 4
# 74 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <errno.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/errno.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1989, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)errno.h	8.5 (Berkeley) 1/21/94
 * $FreeBSD: head/sys/sys/errno.h 250250 2013-05-04 19:07:22Z pluknet $
 */

#ifndef _SYS_ERRNO_H_
#define _SYS_ERRNO_H_

#ifndef _KERNEL
#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 43 "/usr/include/errno.h" 3 4
__BEGIN_DECLS
int *	__error(void);
__END_DECLS
#define	errno		(* __error())
#endif
# 48 "/usr/include/errno.h" 3 4

#define	EPERM		1		/* Operation not permitted */
#define	ENOENT		2		/* No such file or directory */
#define	ESRCH		3		/* No such process */
#define	EINTR		4		/* Interrupted system call */
#define	EIO		5		/* Input/output error */
#define	ENXIO		6		/* Device not configured */
#define	E2BIG		7		/* Argument list too long */
#define	ENOEXEC		8		/* Exec format error */
#define	EBADF		9		/* Bad file descriptor */
#define	ECHILD		10		/* No child processes */
#define	EDEADLK		11		/* Resource deadlock avoided */
					/* 11 was EAGAIN */
#define	ENOMEM		12		/* Cannot allocate memory */
#define	EACCES		13		/* Permission denied */
#define	EFAULT		14		/* Bad address */
#ifndef _POSIX_SOURCE
#define	ENOTBLK		15		/* Block device required */
#endif
# 67 "/usr/include/errno.h" 3 4
#define	EBUSY		16		/* Device busy */
#define	EEXIST		17		/* File exists */
#define	EXDEV		18		/* Cross-device link */
#define	ENODEV		19		/* Operation not supported by device */
#define	ENOTDIR		20		/* Not a directory */
#define	EISDIR		21		/* Is a directory */
#define	EINVAL		22		/* Invalid argument */
#define	ENFILE		23		/* Too many open files in system */
#define	EMFILE		24		/* Too many open files */
#define	ENOTTY		25		/* Inappropriate ioctl for device */
#ifndef _POSIX_SOURCE
#define	ETXTBSY		26		/* Text file busy */
#endif
# 80 "/usr/include/errno.h" 3 4
#define	EFBIG		27		/* File too large */
#define	ENOSPC		28		/* No space left on device */
#define	ESPIPE		29		/* Illegal seek */
#define	EROFS		30		/* Read-only filesystem */
#define	EMLINK		31		/* Too many links */
#define	EPIPE		32		/* Broken pipe */

/* math software */
#define	EDOM		33		/* Numerical argument out of domain */
#define	ERANGE		34		/* Result too large */

/* non-blocking and interrupt i/o */
#define	EAGAIN		35		/* Resource temporarily unavailable */
#ifndef _POSIX_SOURCE
#define	EWOULDBLOCK	EAGAIN		/* Operation would block */
#define	EINPROGRESS	36		/* Operation now in progress */
#define	EALREADY	37		/* Operation already in progress */

/* ipc/network software -- argument errors */
#define	ENOTSOCK	38		/* Socket operation on non-socket */
#define	EDESTADDRREQ	39		/* Destination address required */
#define	EMSGSIZE	40		/* Message too long */
#define	EPROTOTYPE	41		/* Protocol wrong type for socket */
#define	ENOPROTOOPT	42		/* Protocol not available */
#define	EPROTONOSUPPORT	43		/* Protocol not supported */
#define	ESOCKTNOSUPPORT	44		/* Socket type not supported */
#define	EOPNOTSUPP	45		/* Operation not supported */
#define	ENOTSUP		EOPNOTSUPP	/* Operation not supported */
#define	EPFNOSUPPORT	46		/* Protocol family not supported */
#define	EAFNOSUPPORT	47		/* Address family not supported by protocol family */
#define	EADDRINUSE	48		/* Address already in use */
#define	EADDRNOTAVAIL	49		/* Can't assign requested address */

/* ipc/network software -- operational errors */
#define	ENETDOWN	50		/* Network is down */
#define	ENETUNREACH	51		/* Network is unreachable */
#define	ENETRESET	52		/* Network dropped connection on reset */
#define	ECONNABORTED	53		/* Software caused connection abort */
#define	ECONNRESET	54		/* Connection reset by peer */
#define	ENOBUFS		55		/* No buffer space available */
#define	EISCONN		56		/* Socket is already connected */
#define	ENOTCONN	57		/* Socket is not connected */
#define	ESHUTDOWN	58		/* Can't send after socket shutdown */
#define	ETOOMANYREFS	59		/* Too many references: can't splice */
#define	ETIMEDOUT	60		/* Operation timed out */
#define	ECONNREFUSED	61		/* Connection refused */

#define	ELOOP		62		/* Too many levels of symbolic links */
#endif /* _POSIX_SOURCE */
# 129 "/usr/include/errno.h" 3 4
#define	ENAMETOOLONG	63		/* File name too long */

/* should be rearranged */
#ifndef _POSIX_SOURCE
#define	EHOSTDOWN	64		/* Host is down */
#define	EHOSTUNREACH	65		/* No route to host */
#endif /* _POSIX_SOURCE */
# 136 "/usr/include/errno.h" 3 4
#define	ENOTEMPTY	66		/* Directory not empty */

/* quotas & mush */
#ifndef _POSIX_SOURCE
#define	EPROCLIM	67		/* Too many processes */
#define	EUSERS		68		/* Too many users */
#define	EDQUOT		69		/* Disc quota exceeded */

/* Network File System */
#define	ESTALE		70		/* Stale NFS file handle */
#define	EREMOTE		71		/* Too many levels of remote in path */
#define	EBADRPC		72		/* RPC struct is bad */
#define	ERPCMISMATCH	73		/* RPC version wrong */
#define	EPROGUNAVAIL	74		/* RPC prog. not avail */
#define	EPROGMISMATCH	75		/* Program version wrong */
#define	EPROCUNAVAIL	76		/* Bad procedure for program */
#endif /* _POSIX_SOURCE */
# 153 "/usr/include/errno.h" 3 4

#define	ENOLCK		77		/* No locks available */
#define	ENOSYS		78		/* Function not implemented */

#ifndef _POSIX_SOURCE
#define	EFTYPE		79		/* Inappropriate file type or format */
#define	EAUTH		80		/* Authentication error */
#define	ENEEDAUTH	81		/* Need authenticator */
#define	EIDRM		82		/* Identifier removed */
#define	ENOMSG		83		/* No message of desired type */
#define	EOVERFLOW	84		/* Value too large to be stored in data type */
#define	ECANCELED	85		/* Operation canceled */
#define	EILSEQ		86		/* Illegal byte sequence */
#define	ENOATTR		87		/* Attribute not found */

#define	EDOOFUS		88		/* Programming error */
#endif /* _POSIX_SOURCE */
# 170 "/usr/include/errno.h" 3 4

#define	EBADMSG		89		/* Bad message */
#define	EMULTIHOP	90		/* Multihop attempted */
#define	ENOLINK		91		/* Link has been severed */
#define	EPROTO		92		/* Protocol error */

#ifndef _POSIX_SOURCE
#define	ENOTCAPABLE	93		/* Capabilities insufficient */
#define	ECAPMODE	94		/* Not permitted in capability mode */
#define	ENOTRECOVERABLE	95		/* State not recoverable */
#define	EOWNERDEAD	96		/* Previous owner died */
#endif /* _POSIX_SOURCE */
# 182 "/usr/include/errno.h" 3 4

#ifndef _POSIX_SOURCE
#define	ELAST		96		/* Must be equal largest errno */
#endif /* _POSIX_SOURCE */
# 186 "/usr/include/errno.h" 3 4

#ifdef _KERNEL
/* pseudo-errors returned inside kernel to modify return to process */
#define	ERESTART	(-1)		/* restart syscall */
#define	EJUSTRETURN	(-2)		/* don't modify regs, just return */
#define	ENOIOCTL	(-3)		/* ioctl not handled by this layer */
#define	EDIRIOCTL	(-4)		/* do direct ioctl in GEOM */
#endif
# 194 "/usr/include/errno.h" 3 4

#endif
# 196 "/usr/include/errno.h" 3 4
# 75 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <termios.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/termios.h" 1 3 4
/*-
 * Copyright (c) 1988, 1989, 1993, 1994
 *	The Regents of the University of California.  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.
 * 3. 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.
 *
 *	@(#)termios.h	8.3 (Berkeley) 3/28/94
 * $FreeBSD: head/include/termios.h 265878 2014-05-11 13:48:21Z jilles $
 */

#ifndef _TERMIOS_H_
#define	_TERMIOS_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/termios.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_termios.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_termios.h" 1 3 4
/*-
 * Copyright (c) 1988, 1989, 1993, 1994
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)termios.h	8.3 (Berkeley) 3/28/94
 * $FreeBSD: head/sys/sys/_termios.h 199898 2009-11-28 23:50:48Z ed $
 */

#ifndef _SYS__TERMIOS_H_
#define	_SYS__TERMIOS_H_

/*
 * Special Control Characters
 *
 * Index into c_cc[] character array.
 *
 *	Name	     Subscript	Enabled by
 */
#define	VEOF		0	/* ICANON */
#define	VEOL		1	/* ICANON */
#ifndef _POSIX_SOURCE
#define	VEOL2		2	/* ICANON together with IEXTEN */
#endif
# 48 "/usr/include/sys/_termios.h" 3 4
#define	VERASE		3	/* ICANON */
#ifndef _POSIX_SOURCE
#define	VWERASE 	4	/* ICANON together with IEXTEN */
#endif
# 52 "/usr/include/sys/_termios.h" 3 4
#define	VKILL		5	/* ICANON */
#ifndef _POSIX_SOURCE
#define	VREPRINT 	6	/* ICANON together with IEXTEN */
#define	VERASE2 	7	/* ICANON */
#endif
# 57 "/usr/include/sys/_termios.h" 3 4
/*			7	   ex-spare 1 */
#define	VINTR		8	/* ISIG */
#define	VQUIT		9	/* ISIG */
#define	VSUSP		10	/* ISIG */
#ifndef _POSIX_SOURCE
#define	VDSUSP		11	/* ISIG together with IEXTEN */
#endif
# 64 "/usr/include/sys/_termios.h" 3 4
#define	VSTART		12	/* IXON, IXOFF */
#define	VSTOP		13	/* IXON, IXOFF */
#ifndef _POSIX_SOURCE
#define	VLNEXT		14	/* IEXTEN */
#define	VDISCARD	15	/* IEXTEN */
#endif
# 70 "/usr/include/sys/_termios.h" 3 4
#define	VMIN		16	/* !ICANON */
#define	VTIME		17	/* !ICANON */
#ifndef _POSIX_SOURCE
#define	VSTATUS		18	/* ICANON together with IEXTEN */
/*			19	   spare 2 */
#endif
# 76 "/usr/include/sys/_termios.h" 3 4
#define	NCCS		20

#define	_POSIX_VDISABLE	0xff

/*
 * Input flags - software input processing
 */
#define	IGNBRK		0x00000001	/* ignore BREAK condition */
#define	BRKINT		0x00000002	/* map BREAK to SIGINTR */
#define	IGNPAR		0x00000004	/* ignore (discard) parity errors */
#define	PARMRK		0x00000008	/* mark parity and framing errors */
#define	INPCK		0x00000010	/* enable checking of parity errors */
#define	ISTRIP		0x00000020	/* strip 8th bit off chars */
#define	INLCR		0x00000040	/* map NL into CR */
#define	IGNCR		0x00000080	/* ignore CR */
#define	ICRNL		0x00000100	/* map CR to NL (ala CRMOD) */
#define	IXON		0x00000200	/* enable output flow control */
#define	IXOFF		0x00000400	/* enable input flow control */
#ifndef _POSIX_SOURCE
#define	IXANY		0x00000800	/* any char will restart after stop */
#define	IMAXBEL		0x00002000	/* ring bell on input queue full */
#endif  /*_POSIX_SOURCE */
# 98 "/usr/include/sys/_termios.h" 3 4

/*
 * Output flags - software output processing
 */
#define	OPOST		0x00000001	/* enable following output processing */
#ifndef _POSIX_SOURCE
#define	ONLCR		0x00000002	/* map NL to CR-NL (ala CRMOD) */
#define	TABDLY		0x00000004	/* tab delay mask */
#define	    TAB0	    0x00000000	    /* no tab delay and expansion */
#define	    TAB3	    0x00000004	    /* expand tabs to spaces */
#define	ONOEOT		0x00000008	/* discard EOT's (^D) on output) */
#define	OCRNL		0x00000010	/* map CR to NL on output */
#define	ONOCR		0x00000020	/* no CR output at column 0 */
#define	ONLRET		0x00000040	/* NL performs CR function */
#endif  /*_POSIX_SOURCE */
# 113 "/usr/include/sys/_termios.h" 3 4

/*
 * Control flags - hardware control of terminal
 */
#ifndef _POSIX_SOURCE
#define	CIGNORE		0x00000001	/* ignore control flags */
#endif
# 120 "/usr/include/sys/_termios.h" 3 4
#define	CSIZE		0x00000300	/* character size mask */
#define	    CS5		    0x00000000	    /* 5 bits (pseudo) */
#define	    CS6		    0x00000100	    /* 6 bits */
#define	    CS7		    0x00000200	    /* 7 bits */
#define	    CS8		    0x00000300	    /* 8 bits */
#define	CSTOPB		0x00000400	/* send 2 stop bits */
#define	CREAD		0x00000800	/* enable receiver */
#define	PARENB		0x00001000	/* parity enable */
#define	PARODD		0x00002000	/* odd parity, else even */
#define	HUPCL		0x00004000	/* hang up on last close */
#define	CLOCAL		0x00008000	/* ignore modem status lines */
#ifndef _POSIX_SOURCE
#define	CCTS_OFLOW	0x00010000	/* CTS flow control of output */
#define	CRTSCTS		(CCTS_OFLOW | CRTS_IFLOW)
#define	CRTS_IFLOW	0x00020000	/* RTS flow control of input */
#define	CDTR_IFLOW	0x00040000	/* DTR flow control of input */
#define	CDSR_OFLOW	0x00080000	/* DSR flow control of output */
#define	CCAR_OFLOW	0x00100000	/* DCD flow control of output */
#endif
# 139 "/usr/include/sys/_termios.h" 3 4


/*
 * "Local" flags - dumping ground for other state
 *
 * Warning: some flags in this structure begin with
 * the letter "I" and look like they belong in the
 * input flag.
 */

#ifndef _POSIX_SOURCE
#define	ECHOKE		0x00000001	/* visual erase for line kill */
#endif  /*_POSIX_SOURCE */
# 152 "/usr/include/sys/_termios.h" 3 4
#define	ECHOE		0x00000002	/* visually erase chars */
#define	ECHOK		0x00000004	/* echo NL after line kill */
#define	ECHO		0x00000008	/* enable echoing */
#define	ECHONL		0x00000010	/* echo NL even if ECHO is off */
#ifndef _POSIX_SOURCE
#define	ECHOPRT		0x00000020	/* visual erase mode for hardcopy */
#define	ECHOCTL  	0x00000040	/* echo control chars as ^(Char) */
#endif  /*_POSIX_SOURCE */
# 160 "/usr/include/sys/_termios.h" 3 4
#define	ISIG		0x00000080	/* enable signals INTR, QUIT, [D]SUSP */
#define	ICANON		0x00000100	/* canonicalize input lines */
#ifndef _POSIX_SOURCE
#define	ALTWERASE	0x00000200	/* use alternate WERASE algorithm */
#endif  /*_POSIX_SOURCE */
# 165 "/usr/include/sys/_termios.h" 3 4
#define	IEXTEN		0x00000400	/* enable DISCARD and LNEXT */
#define	EXTPROC         0x00000800      /* external processing */
#define	TOSTOP		0x00400000	/* stop background jobs from output */
#ifndef _POSIX_SOURCE
#define	FLUSHO		0x00800000	/* output being flushed (state) */
#define	NOKERNINFO	0x02000000	/* no kernel output from VSTATUS */
#define	PENDIN		0x20000000	/* XXX retype pending input (state) */
#endif  /*_POSIX_SOURCE */
# 173 "/usr/include/sys/_termios.h" 3 4
#define	NOFLSH		0x80000000	/* don't flush after interrupt */

/*
 * Standard speeds
 */
#define	B0	0
#define	B50	50
#define	B75	75
#define	B110	110
#define	B134	134
#define	B150	150
#define	B200	200
#define	B300	300
#define	B600	600
#define	B1200	1200
#define	B1800	1800
#define	B2400	2400
#define	B4800	4800
#define	B9600	9600
#define	B19200	19200
#define	B38400	38400
#ifndef _POSIX_SOURCE
#define	B7200	7200
#define	B14400	14400
#define	B28800	28800
#define	B57600	57600
#define	B76800	76800
#define	B115200	115200
#define	B230400	230400
#define	B460800	460800
#define	B921600	921600
#define	EXTA	19200
#define	EXTB	38400
#endif  /* !_POSIX_SOURCE */
# 207 "/usr/include/sys/_termios.h" 3 4

typedef unsigned int	tcflag_t;
typedef unsigned char	cc_t;
typedef unsigned int	speed_t;

struct termios {
	tcflag_t	c_iflag;	/* input flags */
	tcflag_t	c_oflag;	/* output flags */
	tcflag_t	c_cflag;	/* control flags */
	tcflag_t	c_lflag;	/* local flags */
	cc_t		c_cc[NCCS];	/* control chars */
	speed_t		c_ispeed;	/* input speed */
	speed_t		c_ospeed;	/* output speed */
};

#endif /* !_SYS__TERMIOS_H_ */
# 223 "/usr/include/sys/_termios.h" 3 4
# 38 "/usr/include/termios.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 39 "/usr/include/termios.h" 3 4

#ifndef _PID_T_DECLARED
typedef	__pid_t		pid_t;
#define	_PID_T_DECLARED
#endif
# 44 "/usr/include/termios.h" 3 4

#ifndef _POSIX_SOURCE
#define	OXTABS		TAB3
#define	MDMBUF		CCAR_OFLOW
#endif 
# 49 "/usr/include/termios.h" 3 4

#ifndef _POSIX_SOURCE
#define	CCEQ(val, c)	((c) == (val) && (val) != _POSIX_VDISABLE)
#endif
# 53 "/usr/include/termios.h" 3 4

/*
 * Commands passed to tcsetattr() for setting the termios structure.
 */
#define	TCSANOW		0		/* make change immediate */
#define	TCSADRAIN	1		/* drain output, then change */
#define	TCSAFLUSH	2		/* drain output, flush input */
#ifndef _POSIX_SOURCE
#define	TCSASOFT	0x10		/* flag - don't alter h.w. state */
#endif
# 63 "/usr/include/termios.h" 3 4

#define	TCIFLUSH	1
#define	TCOFLUSH	2
#define	TCIOFLUSH	3
#define	TCOOFF		1
#define	TCOON		2
#define	TCIOFF		3
#define	TCION		4

__BEGIN_DECLS
speed_t	cfgetispeed(const struct termios *);
speed_t	cfgetospeed(const struct termios *);
int	cfsetispeed(struct termios *, speed_t);
int	cfsetospeed(struct termios *, speed_t);
int	tcgetattr(int, struct termios *);
int	tcsetattr(int, int, const struct termios *);
int	tcdrain(int);
int	tcflow(int, int);
int	tcflush(int, int);
int	tcsendbreak(int, int);

#if __POSIX_VISIBLE >= 200112
pid_t	tcgetsid(int);
#endif
# 87 "/usr/include/termios.h" 3 4
#if __BSD_VISIBLE
int	tcsetsid(int, pid_t);

void	cfmakeraw(struct termios *);
void	cfmakesane(struct termios *);
int	cfsetspeed(struct termios *, speed_t);
#endif
# 94 "/usr/include/termios.h" 3 4
__END_DECLS

#endif /* !_TERMIOS_H_ */
# 97 "/usr/include/termios.h" 3 4

#ifndef _POSIX_SOURCE
#if 0 /* expanded by -frewrite-includes */
#include <sys/ttycom.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/ttycom.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1990, 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)ttycom.h	8.1 (Berkeley) 3/28/94
 * $FreeBSD: head/sys/sys/ttycom.h 231095 2012-02-06 18:15:46Z ed $
 */

#ifndef	_SYS_TTYCOM_H_
#define	_SYS_TTYCOM_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/ioccom.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/ioccom.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1990, 1993, 1994
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)ioccom.h	8.2 (Berkeley) 3/28/94
 * $FreeBSD: head/sys/sys/ioccom.h 206051 2010-04-01 16:21:35Z pjd $
 */

#ifndef	_SYS_IOCCOM_H_
#define	_SYS_IOCCOM_H_

/*
 * Ioctl's have the command encoded in the lower word, and the size of
 * any in or out parameters in the upper word.  The high 3 bits of the
 * upper word are used to encode the in/out status of the parameter.
 */
#define	IOCPARM_SHIFT	13		/* number of bits for ioctl size */
#define	IOCPARM_MASK	((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */
#define	IOCPARM_LEN(x)	(((x) >> 16) & IOCPARM_MASK)
#define	IOCBASECMD(x)	((x) & ~(IOCPARM_MASK << 16))
#define	IOCGROUP(x)	(((x) >> 8) & 0xff)

#define	IOCPARM_MAX	(1 << IOCPARM_SHIFT) /* max size of ioctl */
#define	IOC_VOID	0x20000000	/* no parameters */
#define	IOC_OUT		0x40000000	/* copy out parameters */
#define	IOC_IN		0x80000000	/* copy in parameters */
#define	IOC_INOUT	(IOC_IN|IOC_OUT)
#define	IOC_DIRMASK	(IOC_VOID|IOC_OUT|IOC_IN)

#define	_IOC(inout,group,num,len)	((unsigned long) \
	((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))
#define	_IO(g,n)	_IOC(IOC_VOID,	(g), (n), 0)
#define	_IOWINT(g,n)	_IOC(IOC_VOID,	(g), (n), sizeof(int))
#define	_IOR(g,n,t)	_IOC(IOC_OUT,	(g), (n), sizeof(t))
#define	_IOW(g,n,t)	_IOC(IOC_IN,	(g), (n), sizeof(t))
/* this should be _IORW, but stdio got there first */
#define	_IOWR(g,n,t)	_IOC(IOC_INOUT,	(g), (n), sizeof(t))

#ifdef _KERNEL

#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
    defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
#define	IOCPARM_IVAL(x)	((int)(intptr_t)(void *)*(caddr_t *)(void *)(x))
#endif
# 69 "/usr/include/sys/ioccom.h" 3 4

#else
# 71 "/usr/include/sys/ioccom.h" 3 4

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 73 "/usr/include/sys/ioccom.h" 3 4

__BEGIN_DECLS
int	ioctl(int, unsigned long, ...);
__END_DECLS

#endif
# 79 "/usr/include/sys/ioccom.h" 3 4

#endif /* !_SYS_IOCCOM_H_ */
# 81 "/usr/include/sys/ioccom.h" 3 4
# 42 "/usr/include/sys/ttycom.h" 2 3 4

/*
 * Tty ioctl's except for those supported only for backwards compatibility
 * with the old tty driver.
 */

/*
 * Window/terminal size structure.  This information is stored by the kernel
 * in order to provide a consistent interface, but is not used by the kernel.
 */
struct winsize {
	unsigned short	ws_row;		/* rows, in characters */
	unsigned short	ws_col;		/* columns, in characters */
	unsigned short	ws_xpixel;	/* horizontal size, pixels */
	unsigned short	ws_ypixel;	/* vertical size, pixels */
};

						/* 0-2 compat */
						/* 3-7 unused */
						/* 8-10 compat */
						/* 11-12 unused */
#define	TIOCEXCL	 _IO('t', 13)		/* set exclusive use of tty */
#define	TIOCNXCL	 _IO('t', 14)		/* reset exclusive use of tty */
#define	TIOCGPTN	_IOR('t', 15, int)	/* Get pts number. */
#define	TIOCFLUSH	_IOW('t', 16, int)	/* flush buffers */
						/* 17-18 compat */
#define	TIOCGETA	_IOR('t', 19, struct termios) /* get termios struct */
#define	TIOCSETA	_IOW('t', 20, struct termios) /* set termios struct */
#define	TIOCSETAW	_IOW('t', 21, struct termios) /* drain output, set */
#define	TIOCSETAF	_IOW('t', 22, struct termios) /* drn out, fls in, set */
						/* 23-25 unused */
#define	TIOCGETD	_IOR('t', 26, int)	/* get line discipline */
#define	TIOCSETD	_IOW('t', 27, int)	/* set line discipline */
#define	TIOCPTMASTER	 _IO('t', 28)		/* pts master validation */
						/* 29-85 unused */
#define	TIOCGDRAINWAIT	_IOR('t', 86, int)	/* get ttywait timeout */
#define	TIOCSDRAINWAIT	_IOW('t', 87, int)	/* set ttywait timeout */
						/* 88 unused */
						/* 89-91 conflicts: tun and tap */
#define	TIOCTIMESTAMP	_IOR('t', 89, struct timeval)	/* enable/get timestamp
						 * of last input event */
#define	TIOCMGDTRWAIT	_IOR('t', 90, int)	/* modem: get wait on close */
#define	TIOCMSDTRWAIT	_IOW('t', 91, int)	/* modem: set wait on close */
						/* 92-93 tun and tap */
						/* 94-97 conflicts: tun and tap */
#define	TIOCDRAIN	 _IO('t', 94)		/* wait till output drained */
#define	TIOCSIG		_IOWINT('t', 95)	/* pty: generate signal */
#define	TIOCEXT		_IOW('t', 96, int)	/* pty: external processing */
#define	TIOCSCTTY	 _IO('t', 97)		/* become controlling tty */
#define	TIOCCONS	_IOW('t', 98, int)	/* become virtual console */
#define	TIOCGSID	_IOR('t', 99, int)	/* get session id */
						/* 100 unused */
#define	TIOCSTAT	 _IO('t', 101)		/* simulate ^T status message */
#define	TIOCUCNTL	_IOW('t', 102, int)	/* pty: set/clr usr cntl mode */
#define		UIOCCMD(n)	_IO('u', n)	/* usr cntl op "n" */
#define	TIOCSWINSZ	_IOW('t', 103, struct winsize)	/* set window size */
#define	TIOCGWINSZ	_IOR('t', 104, struct winsize)	/* get window size */
						/* 105 unused */
#define	TIOCMGET	_IOR('t', 106, int)	/* get all modem bits */
#define		TIOCM_LE	0001		/* line enable */
#define		TIOCM_DTR	0002		/* data terminal ready */
#define		TIOCM_RTS	0004		/* request to send */
#define		TIOCM_ST	0010		/* secondary transmit */
#define		TIOCM_SR	0020		/* secondary receive */
#define		TIOCM_CTS	0040		/* clear to send */
#define		TIOCM_DCD	0100		/* data carrier detect */
#define		TIOCM_RI	0200		/* ring indicate */
#define		TIOCM_DSR	0400		/* data set ready */
#define		TIOCM_CD	TIOCM_DCD
#define		TIOCM_CAR	TIOCM_DCD
#define		TIOCM_RNG	TIOCM_RI
#define	TIOCMBIC	_IOW('t', 107, int)	/* bic modem bits */
#define	TIOCMBIS	_IOW('t', 108, int)	/* bis modem bits */
#define	TIOCMSET	_IOW('t', 109, int)	/* set all modem bits */
#define	TIOCSTART	 _IO('t', 110)		/* start output, like ^Q */
#define	TIOCSTOP	 _IO('t', 111)		/* stop output, like ^S */
#define	TIOCPKT		_IOW('t', 112, int)	/* pty: set/clear packet mode */
#define		TIOCPKT_DATA		0x00	/* data packet */
#define		TIOCPKT_FLUSHREAD	0x01	/* flush packet */
#define		TIOCPKT_FLUSHWRITE	0x02	/* flush packet */
#define		TIOCPKT_STOP		0x04	/* stop output */
#define		TIOCPKT_START		0x08	/* start output */
#define		TIOCPKT_NOSTOP		0x10	/* no more ^S, ^Q */
#define		TIOCPKT_DOSTOP		0x20	/* now do ^S ^Q */
#define		TIOCPKT_IOCTL		0x40	/* state change of pty driver */
#define	TIOCNOTTY	 _IO('t', 113)		/* void tty association */
#define	TIOCSTI		_IOW('t', 114, char)	/* simulate terminal input */
#define	TIOCOUTQ	_IOR('t', 115, int)	/* output queue size */
						/* 116-117 compat */
#define	TIOCSPGRP	_IOW('t', 118, int)	/* set pgrp of tty */
#define	TIOCGPGRP	_IOR('t', 119, int)	/* get pgrp of tty */
#define	TIOCCDTR	 _IO('t', 120)		/* clear data terminal ready */
#define	TIOCSDTR	 _IO('t', 121)		/* set data terminal ready */
#define	TIOCCBRK	 _IO('t', 122)		/* clear break bit */
#define	TIOCSBRK	 _IO('t', 123)		/* set break bit */
						/* 124-127 compat */

#define	TTYDISC		0		/* termios tty line discipline */
#define	SLIPDISC	4		/* serial IP discipline */
#define	PPPDISC		5		/* PPP discipline */
#define	NETGRAPHDISC	6		/* Netgraph tty node discipline */
#define	H4DISC		7		/* Netgraph Bluetooth H4 discipline */

#endif /* !_SYS_TTYCOM_H_ */
# 146 "/usr/include/sys/ttycom.h" 3 4
# 100 "/usr/include/termios.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/ttydefaults.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/ttydefaults.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)ttydefaults.h	8.4 (Berkeley) 1/21/94
 * $FreeBSD: head/sys/sys/ttydefaults.h 249311 2013-04-09 16:16:34Z ed $
 */

/*
 * System wide defaults for terminal state.
 */
#ifndef _SYS_TTYDEFAULTS_H_
#define	_SYS_TTYDEFAULTS_H_

/*
 * Defaults on "first" open.
 */
#define	TTYDEF_IFLAG	(BRKINT	| ICRNL	| IMAXBEL | IXON | IXANY)
#define	TTYDEF_OFLAG	(OPOST | ONLCR)
#define	TTYDEF_LFLAG_NOECHO (ICANON | ISIG | IEXTEN)
#define	TTYDEF_LFLAG_ECHO (TTYDEF_LFLAG_NOECHO \
	| ECHO | ECHOE | ECHOKE | ECHOCTL)
#define	TTYDEF_LFLAG TTYDEF_LFLAG_ECHO
#define	TTYDEF_CFLAG	(CREAD | CS8 | HUPCL)
#define	TTYDEF_SPEED	(B9600)

/*
 * Control Character Defaults
 */
/*
 * XXX: A lot of code uses lowercase characters, but control-character
 * conversion is actually only valid when applied to uppercase
 * characters. We just treat lowercase characters as if they were
 * inserted as uppercase.
 */
#define	CTRL(x) ((x) >= 'a' && (x) <= 'z' ? \
	((x) - 'a' + 1) : (((x) - 'A' + 1) & 0x7f))
#define	CEOF		CTRL('D')
#define	CEOL		0xff		/* XXX avoid _POSIX_VDISABLE */
#define	CERASE		CTRL('?')
#define	CERASE2		CTRL('H')
#define	CINTR		CTRL('C')
#define	CSTATUS		CTRL('T')
#define	CKILL		CTRL('U')
#define	CMIN		1
#define	CQUIT		CTRL('\\')
#define	CSUSP		CTRL('Z')
#define	CTIME		0
#define	CDSUSP		CTRL('Y')
#define	CSTART		CTRL('Q')
#define	CSTOP		CTRL('S')
#define	CLNEXT		CTRL('V')
#define	CDISCARD	CTRL('O')
#define	CWERASE		CTRL('W')
#define	CREPRINT	CTRL('R')
#define	CEOT		CEOF
/* compat */
#define	CBRK		CEOL
#define	CRPRNT		CREPRINT
#define	CFLUSH		CDISCARD

/* PROTECTED INCLUSION ENDS HERE */
#endif /* !_SYS_TTYDEFAULTS_H_ */
# 93 "/usr/include/sys/ttydefaults.h" 3 4

/*
 * #define TTYDEFCHARS to include an array of default control characters.
 */
#ifdef TTYDEFCHARS

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 100 "/usr/include/sys/ttydefaults.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_termios.h>
#endif /* expanded by -frewrite-includes */
# 101 "/usr/include/sys/ttydefaults.h" 3 4

static const cc_t ttydefchars[] = {
	CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, CERASE2, CINTR,
	CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, CDISCARD, CMIN, CTIME,
	CSTATUS, _POSIX_VDISABLE
};
_Static_assert(sizeof(ttydefchars) / sizeof(cc_t) == NCCS,
    "Size of ttydefchars does not match NCCS");

#undef TTYDEFCHARS
#endif /* TTYDEFCHARS */
# 112 "/usr/include/sys/ttydefaults.h" 3 4
# 101 "/usr/include/termios.h" 2 3 4
#endif
# 102 "/usr/include/termios.h" 3 4
# 76 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <fnmatch.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/fnmatch.h" 1 3 4
/*-
 * Copyright (c) 1992, 1993
 *	The Regents of the University of California.  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.
 * 3. 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.
 *
 * $FreeBSD: head/include/fnmatch.h 203964 2010-02-16 19:39:50Z imp $
 *	@(#)fnmatch.h	8.1 (Berkeley) 6/2/93
 */

#ifndef	_FNMATCH_H_
#define	_FNMATCH_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/fnmatch.h" 3 4

#define	FNM_NOMATCH	1	/* Match failed. */

#define	FNM_NOESCAPE	0x01	/* Disable backslash escaping. */
#define	FNM_PATHNAME	0x02	/* Slash must be matched by slash. */
#define	FNM_PERIOD	0x04	/* Period must be matched by period. */

#if __XSI_VISIBLE
#define	FNM_NOSYS	(-1)	/* Reserved. */
#endif
# 47 "/usr/include/fnmatch.h" 3 4

#if __BSD_VISIBLE
#define	FNM_LEADING_DIR	0x08	/* Ignore /<tail> after Imatch. */
#define	FNM_CASEFOLD	0x10	/* Case insensitive search. */
#define	FNM_IGNORECASE	FNM_CASEFOLD
#define	FNM_FILE_NAME	FNM_PATHNAME
#endif
# 54 "/usr/include/fnmatch.h" 3 4

__BEGIN_DECLS
int	 fnmatch(const char *, const char *, int);
__END_DECLS

#endif /* !_FNMATCH_H_ */
# 60 "/usr/include/fnmatch.h" 3 4
# 77 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <fcntl.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/fcntl.h" 1 3 4
/*-
 * Copyright (c) 1983, 1990, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)fcntl.h	8.3 (Berkeley) 1/21/94
 * $FreeBSD: head/sys/sys/fcntl.h 264628 2014-04-17 21:29:22Z jilles $
 */

#ifndef _SYS_FCNTL_H_
#define	_SYS_FCNTL_H_

/*
 * This file includes the definitions for open and fcntl
 * described by POSIX for <fcntl.h>; it also includes
 * related kernel definitions.
 */

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 48 "/usr/include/fcntl.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 49 "/usr/include/fcntl.h" 3 4

#ifndef _MODE_T_DECLARED
typedef	__mode_t	mode_t;
#define	_MODE_T_DECLARED
#endif
# 54 "/usr/include/fcntl.h" 3 4

#ifndef _OFF_T_DECLARED
typedef	__off_t		off_t;
#define	_OFF_T_DECLARED
#endif
# 59 "/usr/include/fcntl.h" 3 4

#ifndef _PID_T_DECLARED
typedef	__pid_t		pid_t;
#define	_PID_T_DECLARED
#endif
# 64 "/usr/include/fcntl.h" 3 4

/*
 * File status flags: these are used by open(2), fcntl(2).
 * They are also used (indirectly) in the kernel file structure f_flags,
 * which is a superset of the open/fcntl flags.  Open flags and f_flags
 * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
 * Open/fcntl flags begin with O_; kernel-internal flags begin with F.
 */
/* open-only flags */
#define	O_RDONLY	0x0000		/* open for reading only */
#define	O_WRONLY	0x0001		/* open for writing only */
#define	O_RDWR		0x0002		/* open for reading and writing */
#define	O_ACCMODE	0x0003		/* mask for above modes */

/*
 * Kernel encoding of open mode; separate read and write bits that are
 * independently testable: 1 greater than the above.
 *
 * XXX
 * FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH,
 * which was documented to use FREAD/FWRITE, continues to work.
 */
#if __BSD_VISIBLE
#define	FREAD		0x0001
#define	FWRITE		0x0002
#endif
# 90 "/usr/include/fcntl.h" 3 4
#define	O_NONBLOCK	0x0004		/* no delay */
#define	O_APPEND	0x0008		/* set append mode */
#if __BSD_VISIBLE
#define	O_SHLOCK	0x0010		/* open with shared file lock */
#define	O_EXLOCK	0x0020		/* open with exclusive file lock */
#define	O_ASYNC		0x0040		/* signal pgrp when data ready */
#define	O_FSYNC		0x0080		/* synchronous writes */
#endif
# 98 "/usr/include/fcntl.h" 3 4
#define	O_SYNC		0x0080		/* POSIX synonym for O_FSYNC */
#if __POSIX_VISIBLE >= 200809
#define	O_NOFOLLOW	0x0100		/* don't follow symlinks */
#endif
# 102 "/usr/include/fcntl.h" 3 4
#define	O_CREAT		0x0200		/* create if nonexistent */
#define	O_TRUNC		0x0400		/* truncate to zero length */
#define	O_EXCL		0x0800		/* error if already exists */
#ifdef _KERNEL
#define	FHASLOCK	0x4000		/* descriptor holds advisory lock */
#endif
# 108 "/usr/include/fcntl.h" 3 4

/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */
#define	O_NOCTTY	0x8000		/* don't assign controlling terminal */

#if __BSD_VISIBLE
/* Attempt to bypass buffer cache */
#define	O_DIRECT	0x00010000
#endif
# 116 "/usr/include/fcntl.h" 3 4

#if __POSIX_VISIBLE >= 200809
#define	O_DIRECTORY	0x00020000	/* Fail if not directory */
#define	O_EXEC		0x00040000	/* Open for execute only */
#endif
# 121 "/usr/include/fcntl.h" 3 4
#ifdef	_KERNEL
#define	FEXEC		O_EXEC
#endif
# 124 "/usr/include/fcntl.h" 3 4

#if __POSIX_VISIBLE >= 200809
/* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */
#define	O_TTY_INIT	0x00080000	/* Restore default termios attributes */

#define	O_CLOEXEC	0x00100000
#endif
# 131 "/usr/include/fcntl.h" 3 4

/*
 * XXX missing O_DSYNC, O_RSYNC.
 */

#ifdef _KERNEL
/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
#define	FFLAGS(oflags)	((oflags) & O_EXEC ? (oflags) : (oflags) + 1)
#define	OFLAGS(fflags)	((fflags) & O_EXEC ? (fflags) : (fflags) - 1)

/* bits to save after open */
#define	FMASK	(FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC)
/* bits settable by fcntl(F_SETFL, ...) */
#define	FCNTLFLAGS	(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT)

#if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \
    defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4)
/*
 * Set by shm_open(3) in older libc's to get automatic MAP_ASYNC
 * behavior for POSIX shared memory objects (which are otherwise
 * implemented as plain files).
 */
#define	FPOSIXSHM	O_NOFOLLOW
#undef FCNTLFLAGS
#define	FCNTLFLAGS	(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \
			 O_DIRECT)
#endif
# 158 "/usr/include/fcntl.h" 3 4
#endif
# 159 "/usr/include/fcntl.h" 3 4

/*
 * The O_* flags used to have only F* names, which were used in the kernel
 * and by fcntl.  We retain the F* names for the kernel f_flag field
 * and for backward compatibility for fcntl.  These flags are deprecated.
 */
#if __BSD_VISIBLE
#define	FAPPEND		O_APPEND	/* kernel/compat */
#define	FASYNC		O_ASYNC		/* kernel/compat */
#define	FFSYNC		O_FSYNC		/* kernel */
#define	FNONBLOCK	O_NONBLOCK	/* kernel */
#define	FNDELAY		O_NONBLOCK	/* compat */
#define	O_NDELAY	O_NONBLOCK	/* compat */
#endif
# 173 "/usr/include/fcntl.h" 3 4

/*
 * We are out of bits in f_flag (which is a short).  However,
 * the flag bits not set in FMASK are only meaningful in the
 * initial open syscall.  Those bits can thus be given a
 * different meaning for fcntl(2).
 */
#if __BSD_VISIBLE
/* Read ahead */
#define	FRDAHEAD	O_CREAT
#endif
# 184 "/usr/include/fcntl.h" 3 4

#if __POSIX_VISIBLE >= 200809
/*
 * Magic value that specify the use of the current working directory
 * to determine the target of relative file paths in the openat() and
 * similar syscalls.
 */
#define	AT_FDCWD		-100

/*
 * Miscellaneous flags for the *at() syscalls.
 */
#define	AT_EACCESS		0x100	/* Check access using effective user and group ID */
#define	AT_SYMLINK_NOFOLLOW	0x200   /* Do not follow symbolic links */
#define	AT_SYMLINK_FOLLOW	0x400	/* Follow symbolic link */
#define	AT_REMOVEDIR		0x800	/* Remove directory instead of file */
#endif
# 201 "/usr/include/fcntl.h" 3 4

/*
 * Constants used for fcntl(2)
 */

/* command values */
#define	F_DUPFD		0		/* duplicate file descriptor */
#define	F_GETFD		1		/* get file descriptor flags */
#define	F_SETFD		2		/* set file descriptor flags */
#define	F_GETFL		3		/* get file status flags */
#define	F_SETFL		4		/* set file status flags */
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
#define	F_GETOWN	5		/* get SIGIO/SIGURG proc/pgrp */
#define	F_SETOWN	6		/* set SIGIO/SIGURG proc/pgrp */
#endif
# 216 "/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
#define	F_OGETLK	7		/* get record locking information */
#define	F_OSETLK	8		/* set record locking information */
#define	F_OSETLKW	9		/* F_SETLK; wait if blocked */
#define	F_DUP2FD	10		/* duplicate file descriptor to arg */
#endif
# 222 "/usr/include/fcntl.h" 3 4
#define	F_GETLK		11		/* get record locking information */
#define	F_SETLK		12		/* set record locking information */
#define	F_SETLKW	13		/* F_SETLK; wait if blocked */
#if __BSD_VISIBLE
#define	F_SETLK_REMOTE	14		/* debugging support for remote locks */
#define	F_READAHEAD	15		/* read ahead */
#define	F_RDAHEAD	16		/* Darwin compatible read ahead */
#endif
# 230 "/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
#define	F_DUPFD_CLOEXEC	17		/* Like F_DUPFD, but FD_CLOEXEC is set */
#endif
# 233 "/usr/include/fcntl.h" 3 4
#if __BSD_VISIBLE
#define	F_DUP2FD_CLOEXEC 18		/* Like F_DUP2FD, but FD_CLOEXEC is set */
#endif
# 236 "/usr/include/fcntl.h" 3 4

/* file descriptor flags (F_GETFD, F_SETFD) */
#define	FD_CLOEXEC	1		/* close-on-exec flag */

/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */
#define	F_RDLCK		1		/* shared or read lock */
#define	F_UNLCK		2		/* unlock */
#define	F_WRLCK		3		/* exclusive or write lock */
#if __BSD_VISIBLE
#define	F_UNLCKSYS	4		/* purge locks for a given system ID */ 
#define	F_CANCEL	5		/* cancel an async lock request */
#endif
# 248 "/usr/include/fcntl.h" 3 4
#ifdef _KERNEL
#define	F_WAIT		0x010		/* Wait until lock is granted */
#define	F_FLOCK		0x020	 	/* Use flock(2) semantics for lock */
#define	F_POSIX		0x040	 	/* Use POSIX semantics for lock */
#define	F_REMOTE	0x080		/* Lock owner is remote NFS client */
#define	F_NOINTR	0x100		/* Ignore signals when waiting */
#endif
# 255 "/usr/include/fcntl.h" 3 4

/*
 * Advisory file segment locking data type -
 * information passed to system by user
 */
struct flock {
	off_t	l_start;	/* starting offset */
	off_t	l_len;		/* len = 0 means until end of file */
	pid_t	l_pid;		/* lock owner */
	short	l_type;		/* lock type: read/write, etc. */
	short	l_whence;	/* type of l_start */
	int	l_sysid;	/* remote system id or zero for local */
};

#if __BSD_VISIBLE
/*
 * Old advisory file segment locking data type,
 * before adding l_sysid.
 */
struct __oflock {
	off_t	l_start;	/* starting offset */
	off_t	l_len;		/* len = 0 means until end of file */
	pid_t	l_pid;		/* lock owner */
	short	l_type;		/* lock type: read/write, etc. */
	short	l_whence;	/* type of l_start */
};
#endif
# 282 "/usr/include/fcntl.h" 3 4

#if __BSD_VISIBLE
/* lock operations for flock(2) */
#define	LOCK_SH		0x01		/* shared file lock */
#define	LOCK_EX		0x02		/* exclusive file lock */
#define	LOCK_NB		0x04		/* don't block when locking */
#define	LOCK_UN		0x08		/* unlock file */
#endif
# 290 "/usr/include/fcntl.h" 3 4

#if __POSIX_VISIBLE >= 200112
/*
 * Advice to posix_fadvise
 */
#define	POSIX_FADV_NORMAL	0	/* no special treatment */
#define	POSIX_FADV_RANDOM	1	/* expect random page references */
#define	POSIX_FADV_SEQUENTIAL	2	/* expect sequential page references */
#define	POSIX_FADV_WILLNEED	3	/* will need these pages */
#define	POSIX_FADV_DONTNEED	4	/* dont need these pages */
#define	POSIX_FADV_NOREUSE	5	/* access data only once */
#endif
# 302 "/usr/include/fcntl.h" 3 4

#ifndef _KERNEL
__BEGIN_DECLS
int	open(const char *, int, ...);
int	creat(const char *, mode_t);
int	fcntl(int, int, ...);
#if __BSD_VISIBLE
int	flock(int, int);
#endif
# 311 "/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200809
int	openat(int, const char *, int, ...);
#endif
# 314 "/usr/include/fcntl.h" 3 4
#if __POSIX_VISIBLE >= 200112
int	posix_fadvise(int, off_t, off_t, int);
int	posix_fallocate(int, off_t, off_t);
#endif
# 318 "/usr/include/fcntl.h" 3 4
__END_DECLS
#endif
# 320 "/usr/include/fcntl.h" 3 4

#endif /* !_SYS_FCNTL_H_ */
# 322 "/usr/include/fcntl.h" 3 4
# 78 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <sys/ioctl.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/ioctl.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1990, 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)ioctl.h	8.6 (Berkeley) 3/28/94
 * $FreeBSD: head/sys/sys/ioctl.h 191947 2009-05-09 19:01:24Z ed $
 */

#ifndef	_SYS_IOCTL_H_
#define	_SYS_IOCTL_H_

#ifdef _KERNEL
#error "Don't #include ioctl.h in the kernel.  Include xxxio.h instead."
#endif /* _KERNEL */
# 44 "/usr/include/sys/ioctl.h" 3 4

#if 0 /* expanded by -frewrite-includes */
#include <sys/ioccom.h>
#endif /* expanded by -frewrite-includes */
# 46 "/usr/include/sys/ioctl.h" 3 4

#if 0 /* expanded by -frewrite-includes */
#include <sys/filio.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/filio.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1990, 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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.
 * 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.
 *
 *	@(#)filio.h	8.1 (Berkeley) 3/28/94
 * $FreeBSD: head/sys/sys/filio.h 195191 2009-06-30 13:38:49Z emaste $
 */

#ifndef	_SYS_FILIO_H_
#define	_SYS_FILIO_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/ioccom.h>
#endif /* expanded by -frewrite-includes */
# 42 "/usr/include/sys/filio.h" 3 4

/* Generic file-descriptor ioctl's. */
#define	FIOCLEX		 _IO('f', 1)		/* set close on exec on fd */
#define	FIONCLEX	 _IO('f', 2)		/* remove close on exec */
#define	FIONREAD	_IOR('f', 127, int)	/* get # bytes to read */
#define	FIONBIO		_IOW('f', 126, int)	/* set/clear non-blocking i/o */
#define	FIOASYNC	_IOW('f', 125, int)	/* set/clear async i/o */
#define	FIOSETOWN	_IOW('f', 124, int)	/* set owner */
#define	FIOGETOWN	_IOR('f', 123, int)	/* get owner */
#define	FIODTYPE	_IOR('f', 122, int)	/* get d_flags type part */
#define	FIOGETLBA	_IOR('f', 121, int)	/* get start blk # */
struct fiodgname_arg {
	int	len;
	void	*buf;
};
#define	FIODGNAME	_IOW('f', 120, struct fiodgname_arg) /* get dev. name */
#define	FIONWRITE	_IOR('f', 119, int)	/* get # bytes (yet) to write */
#define	FIONSPACE	_IOR('f', 118, int)	/* get space in send queue */
/* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */
#define	FIOSEEKDATA	_IOWR('f', 97, off_t)	/* SEEK_DATA */
#define	FIOSEEKHOLE	_IOWR('f', 98, off_t)	/* SEEK_HOLE */

#endif /* !_SYS_FILIO_H_ */
# 65 "/usr/include/sys/filio.h" 3 4
# 48 "/usr/include/sys/ioctl.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/sockio.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/sockio.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1990, 1993, 1994
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)sockio.h	8.1 (Berkeley) 3/28/94
 * $FreeBSD: head/sys/sys/sockio.h 263203 2014-03-15 06:49:32Z glebius $
 */

#ifndef _SYS_SOCKIO_H_
#define	_SYS_SOCKIO_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/ioccom.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/sys/sockio.h" 3 4

/* Socket ioctl's. */
#define	SIOCSHIWAT	 _IOW('s',  0, int)		/* set high watermark */
#define	SIOCGHIWAT	 _IOR('s',  1, int)		/* get high watermark */
#define	SIOCSLOWAT	 _IOW('s',  2, int)		/* set low watermark */
#define	SIOCGLOWAT	 _IOR('s',  3, int)		/* get low watermark */
#define	SIOCATMARK	 _IOR('s',  7, int)		/* at oob mark? */
#define	SIOCSPGRP	 _IOW('s',  8, int)		/* set process group */
#define	SIOCGPGRP	 _IOR('s',  9, int)		/* get process group */

/*	SIOCADDRT	 _IOW('r', 10, struct ortentry)	4.3BSD */
/*	SIOCDELRT	 _IOW('r', 11, struct ortentry)	4.3BSD */
#define	SIOCGETVIFCNT	_IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */
#define	SIOCGETSGCNT	_IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */

#define	SIOCSIFADDR	 _IOW('i', 12, struct ifreq)	/* set ifnet address */
/*	OSIOCGIFADDR	_IOWR('i', 13, struct ifreq)	4.3BSD */
#define	SIOCGIFADDR	_IOWR('i', 33, struct ifreq)	/* get ifnet address */
#define	SIOCSIFDSTADDR	 _IOW('i', 14, struct ifreq)	/* set p-p address */
/*	OSIOCGIFDSTADDR	_IOWR('i', 15, struct ifreq)	4.3BSD */
#define	SIOCGIFDSTADDR	_IOWR('i', 34, struct ifreq)	/* get p-p address */
#define	SIOCSIFFLAGS	 _IOW('i', 16, struct ifreq)	/* set ifnet flags */
#define	SIOCGIFFLAGS	_IOWR('i', 17, struct ifreq)	/* get ifnet flags */
/*	OSIOCGIFBRDADDR	_IOWR('i', 18, struct ifreq)	4.3BSD */
#define	SIOCGIFBRDADDR	_IOWR('i', 35, struct ifreq)	/* get broadcast addr */
#define	SIOCSIFBRDADDR	 _IOW('i', 19, struct ifreq)	/* set broadcast addr */
/*	OSIOCGIFCONF	_IOWR('i', 20, struct ifconf)	4.3BSD */
#define	SIOCGIFCONF	_IOWR('i', 36, struct ifconf)	/* get ifnet list */
/*	OSIOCGIFNETMASK	_IOWR('i', 21, struct ifreq)	4.3BSD */
#define	SIOCGIFNETMASK	_IOWR('i', 37, struct ifreq)	/* get net addr mask */
#define	SIOCSIFNETMASK	 _IOW('i', 22, struct ifreq)	/* set net addr mask */
#define	SIOCGIFMETRIC	_IOWR('i', 23, struct ifreq)	/* get IF metric */
#define	SIOCSIFMETRIC	 _IOW('i', 24, struct ifreq)	/* set IF metric */
#define	SIOCDIFADDR	 _IOW('i', 25, struct ifreq)	/* delete IF addr */
#define	OSIOCAIFADDR	 _IOW('i', 26, struct oifaliasreq) /* FreeBSD 9.x */
/*	SIOCALIFADDR	 _IOW('i', 27, struct if_laddrreq) KAME */
/*	SIOCGLIFADDR	_IOWR('i', 28, struct if_laddrreq) KAME */
/*	SIOCDLIFADDR	 _IOW('i', 29, struct if_laddrreq) KAME */
#define	SIOCSIFCAP	 _IOW('i', 30, struct ifreq)	/* set IF features */
#define	SIOCGIFCAP	_IOWR('i', 31, struct ifreq)	/* get IF features */
#define	SIOCGIFINDEX	_IOWR('i', 32, struct ifreq)	/* get IF index */
#define	SIOCGIFMAC	_IOWR('i', 38, struct ifreq)	/* get IF MAC label */
#define	SIOCSIFMAC	 _IOW('i', 39, struct ifreq)	/* set IF MAC label */
#define	SIOCSIFNAME	 _IOW('i', 40, struct ifreq)	/* set IF name */
#define	SIOCSIFDESCR	 _IOW('i', 41, struct ifreq)	/* set ifnet descr */ 
#define	SIOCGIFDESCR	_IOWR('i', 42, struct ifreq)	/* get ifnet descr */ 
#define	SIOCAIFADDR	 _IOW('i', 43, struct ifaliasreq)/* add/chg IF alias */

#define	SIOCADDMULTI	 _IOW('i', 49, struct ifreq)	/* add m'cast addr */
#define	SIOCDELMULTI	 _IOW('i', 50, struct ifreq)	/* del m'cast addr */
#define	SIOCGIFMTU	_IOWR('i', 51, struct ifreq)	/* get IF mtu */
#define	SIOCSIFMTU	 _IOW('i', 52, struct ifreq)	/* set IF mtu */
#define	SIOCGIFPHYS	_IOWR('i', 53, struct ifreq)	/* get IF wire */
#define	SIOCSIFPHYS	 _IOW('i', 54, struct ifreq)	/* set IF wire */
#define	SIOCSIFMEDIA	_IOWR('i', 55, struct ifreq)	/* set net media */
#define	SIOCGIFMEDIA	_IOWR('i', 56, struct ifmediareq) /* get net media */

#define	SIOCSIFGENERIC	 _IOW('i', 57, struct ifreq)	/* generic IF set op */
#define	SIOCGIFGENERIC	_IOWR('i', 58, struct ifreq)	/* generic IF get op */

#define	SIOCGIFSTATUS	_IOWR('i', 59, struct ifstat)	/* get IF status */
#define	SIOCSIFLLADDR	 _IOW('i', 60, struct ifreq)	/* set linklevel addr */

#define	SIOCSIFPHYADDR	 _IOW('i', 70, struct ifaliasreq) /* set gif addres */
#define	SIOCGIFPSRCADDR	_IOWR('i', 71, struct ifreq)	/* get gif psrc addr */
#define	SIOCGIFPDSTADDR	_IOWR('i', 72, struct ifreq)	/* get gif pdst addr */
#define	SIOCDIFPHYADDR	 _IOW('i', 73, struct ifreq)	/* delete gif addrs */
/*	SIOCSLIFPHYADDR	 _IOW('i', 74, struct if_laddrreq) KAME */
/*	SIOCGLIFPHYADDR	_IOWR('i', 75, struct if_laddrreq) KAME */

#define	SIOCGPRIVATE_0	_IOWR('i', 80, struct ifreq)	/* device private 0 */
#define	SIOCGPRIVATE_1	_IOWR('i', 81, struct ifreq)	/* device private 1 */

#define	SIOCSIFVNET	_IOWR('i', 90, struct ifreq)	/* move IF jail/vnet */
#define	SIOCSIFRVNET	_IOWR('i', 91, struct ifreq)	/* reclaim vnet IF */

#define	SIOCGIFFIB	_IOWR('i', 92, struct ifreq)	/* get IF fib */
#define	SIOCSIFFIB	 _IOW('i', 93, struct ifreq)	/* set IF fib */

#define	SIOCSDRVSPEC	_IOW('i', 123, struct ifdrv)	/* set driver-specific
								  parameters */
#define	SIOCGDRVSPEC	_IOWR('i', 123, struct ifdrv)	/* get driver-specific
								  parameters */

#define	SIOCIFCREATE	_IOWR('i', 122, struct ifreq)	/* create clone if */
#define	SIOCIFCREATE2	_IOWR('i', 124, struct ifreq)	/* create clone if */
#define	SIOCIFDESTROY	 _IOW('i', 121, struct ifreq)	/* destroy clone if */
#define	SIOCIFGCLONERS	_IOWR('i', 120, struct if_clonereq) /* get cloners */

#define	SIOCAIFGROUP	 _IOW('i', 135, struct ifgroupreq) /* add an ifgroup */
#define	SIOCGIFGROUP	_IOWR('i', 136, struct ifgroupreq) /* get ifgroups */
#define	SIOCDIFGROUP	 _IOW('i', 137, struct ifgroupreq) /* delete ifgroup */
#define	SIOCGIFGMEMB	_IOWR('i', 138, struct ifgroupreq) /* get members */

#endif /* !_SYS_SOCKIO_H_ */
# 132 "/usr/include/sys/sockio.h" 3 4
# 49 "/usr/include/sys/ioctl.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/ttycom.h>
#endif /* expanded by -frewrite-includes */
# 50 "/usr/include/sys/ioctl.h" 3 4

#endif /* !_SYS_IOCTL_H_ */
# 52 "/usr/include/sys/ioctl.h" 3 4
# 79 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2

#if 0 /* expanded by -frewrite-includes */
#include <rx/rx_queue.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_queue.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/* queue.h:  Simple double linked queue package */

/* It's simple, but, I think, it's pretty nice to use, and it's *very* efficient (especially so with a good optimizing compiler).   WARNING:  Since these functions are implemented as macros, it is best to use only *VERY* simple expressions for all parameters.  Double warning:  this uses a lot of type coercion, so you have to be *REAL* careful.  But C doesn't give me a reasonable alternative (i.e.. in-line expanded functions). */

#ifndef _RX_QUEUE_
#define _RX_QUEUE_

/* A queue head is simply a queue element linked to itself (i.e. the null queue is a queue with exactly one element).  Queue elements can be prepended to any structure:  these macros assume that the structure passed is coercible to a (struct q).  Since all of these operations are implemented as macros, the user should beware of side-effects in macro parameters.  Also beware that implicit casting of queue types occurs, so be careful to supply the right parameters at the right times! */
#undef queue			/* Since some OS (ultrix, etc) have their own */
struct rx_queue {
    struct rx_queue *prev;
    struct rx_queue *next;
};

/* Sample usages:

(*A queue head:*)
struct rx_queue myqueue;

(*An element for my queue type:*)
struct myelement {
    struct rx_queue queue_header;
    int mydata;
};

(*Initialize the queue:*)
queue_Init(&myqueue);

(*Append a bunch of items to the queue:*)
for (i=0; i<20; i++) {
    struct myelement *item = (struct myelement *) malloc(sizeof *item);
    item->mydata = i;
    queue_Append(&myqueue, item);
}

(*Scan a queue, incrementing the mydata field in each element, and removing any entries for which mydata>MAX.  Nqe is used by the scan to hold the next queue element, so the current queue element may be removed safely. *)
struct myelement *qe, *nqe;
for (queue_Scan(&myqueue, qe, nqe, myelement)) {
    if (++qe->mydata > MAX)  queue_Remove(qe);
}

(* Count the number of elements in myqueue.  The queue_Scan macro specifies all three elements of the for loop, but an additional initializer and an additional incrementor can be added *)
struct myelement *qe, *nqe;
int n;
for (n=0, queue_Scan(&myqueue, qe, nqe, myelement), n++) {}

*/

/* INTERNAL macros */

/* This one coerces the user's structure to a queue element (or queue head) */
#define	_RXQ(x) ((struct rx_queue *)(x))

/* This one adds a queue element (i) before or after another queue element (or queue head) (q), doubly linking everything together.  It's called by the user usable macros, below.  If (a,b) is (next,prev) then the element i is linked after q; if it is (prev,next) then it is linked before q */
/* N.B.  I don't think it is possible to write this expression, correctly, with less than one comma (you can easily write an alternative expression with no commas that works with most or all compilers, but it's not clear that it really is un-ambiguous, legal C-code). */
#define _RXQA(q,i,a,b) (((i->a=q->a)->b=i)->b=q, q->a=i)

/* These ones splice two queues together.  If (a,b) is (next,prev) then (*q2) is prepended to (*q1), otherwise (*q2) is appended to (*q1). */
#define _RXQS(q1,q2,a,b) \
	do { \
	    if (!queue_IsEmpty(q2)) { \
		((q2->a->b=q1)->a->b=q2->b)->a=q1->a; \
		q1->a=q2->a; \
		queue_Init(q2); \
	    } \
	} while (0)

/* This one removes part of queue (*q1) and attaches it to queue (*q2).
 * If (a,b) is (next,prev) then the subchain is prepended to (*q2),
 * otherwise the subchain is appended to (*q2).
 * If (c,d) is (prev,next) then the subchain is the elements in (*q1) before (i),
 * otherwise the subchain is the elements in (*q1) after (i).
 * If (x,y) is (q1,i) then operation is either BeforePrepend of AfterAppend.
 * If (x,y) is (i,q1) then operation is either BeforeAppend or AfterPrepend. */
#define _RXQSP(q1,q2,i,a,b,c,d,x,y) \
	do { \
	    if (!queue_IsEnd(q1, i->c)) { \
		(y->b->a=q2->a)->b=y->b; \
		(x->a->b=q2)->a=x->a; \
		(i->c=q1)->d=i; \
	    } \
	} while (0)

/* This one moves a chain of elements from (s) to (e) from its
 * current position to either before or after element (i)
 * if (a,b,x,y) is (prev,next,s,e) then chain is moved before (i)
 * if (a,b,x,y) is (next,prev,e,s) then chain is moved after (i) */
#define _RXQMV(i, s, e, a, b, x, y) \
	do { \
	    if (i->a != y) { \
		(e->next->prev=s->prev)->next=e->next; \
		(i->a->b=x)->a=i->a; \
		(y->b=i)->a=y; \
	    } \
	} while (0)

/* Basic remove operation.  Doesn't update the queue item to indicate it's been removed */
#define _RXQR(i) \
	do { \
	    struct rx_queue *_qp = _RXQ(i); \
	    (_qp->prev->next = _qp->next)->prev = _qp->prev; \
	} while (0)

/* EXPORTED macros */

/* Initialize a queue head (*q).  A queue head is just a queue element */
#define queue_Init(q) \
	do { _RXQ(q)->prev = _RXQ(q)->next = _RXQ(q); } while (0)

/* initialize a node in the queue */
#define queue_NodeInit(q) \
	do { _RXQ(q)->prev = _RXQ(q)->next = NULL; } while (0)

/* Prepend a queue element (*i) to the head of the queue, after the queue head (*q).  The new queue element should not currently be on any list. */
#define queue_Prepend(q,i) _RXQA(_RXQ(q),_RXQ(i),next,prev)

/* Append a queue element (*i) to the end of the queue, before the queue head (*q).  The new queue element should not currently be on any list. */
#define queue_Append(q,i) _RXQA(_RXQ(q),_RXQ(i),prev,next)

/* Insert a queue element (*i2) before another element (*i1) in the queue.  The new queue element should not currently be on any list. */
#define queue_InsertBefore(i1,i2) _RXQA(_RXQ(i1),_RXQ(i2),prev,next)

/* Insert a queue element (*i2) after another element (*i1) in the queue.  The new queue element should not currently be on any list. */
#define queue_InsertAfter(i1,i2) _RXQA(_RXQ(i1),_RXQ(i2),next,prev)

/* Spice the members of (*q2) to the beginning of (*q1), re-initialize (*q2) */
#define queue_SplicePrepend(q1,q2) _RXQS(_RXQ(q1),_RXQ(q2),next,prev)

/* Splice the members of queue (*q2) to the end of (*q1), re-initialize (*q2) */
#define queue_SpliceAppend(q1,q2) _RXQS(_RXQ(q1),_RXQ(q2),prev,next)

/* split the members after i off of queue (*q1), and append them onto queue (*q2) */
#define queue_SplitAfterAppend(q1,q2,i) _RXQSP(_RXQ(q1),_RXQ(q2),_RXQ(i),prev,next,next,prev,_RXQ(q1),_RXQ(i))

/* split the members after i off of queue (*q1), and prepend them onto queue (*q2) */
#define queue_SplitAfterPrepend(q1,q2,i) _RXQSP(_RXQ(q1),_RXQ(q2),_RXQ(i),next,prev,next,prev,_RXQ(i),_RXQ(q1))

/* split the members before i off of queue (*q1), and append them onto queue (*q2) */
#define queue_SplitBeforeAppend(q1,q2,i) _RXQSP(_RXQ(q1),_RXQ(q2),_RXQ(i),prev,next,prev,next,_RXQ(i),_RXQ(q1))

/* split the members before i off of queue (*q1), and prepend them onto queue (*q2) */
#define queue_SplitBeforePrepend(q1,q2,i) _RXQSP(_RXQ(q1),_RXQ(q2),_RXQ(i),next,prev,prev,next,_RXQ(q1),_RXQ(i))

/* Replace the queue (*q1) with the contents of the queue (*q2), re-initialize (*q2) */
#define queue_Replace(q1,q2) \
	do { \
	    if (queue_IsEmpty(q2)) \
		queue_Init(q1); \
	    else { \
		*_RXQ(q1) = *_RXQ(q2); \
		_RXQ(q1)->next->prev = _RXQ(q1)->prev->next = _RXQ(q1); \
		queue_Init(q2); \
	    } \
	} while (0)

/* move a chain of elements beginning at (s) and ending at (e) before node (i) */
#define queue_MoveChainBefore(i, s, e) _RXQMV(_RXQ(i),_RXQ(s),_RXQ(e),prev,next,_RXQ(s),_RXQ(e))

/* move a chain of elements beginning at (s) and ending at (e) after node (i) */
#define queue_MoveChainAfter(i, s, e) _RXQMV(_RXQ(i),_RXQ(s),_RXQ(e),next,prev,_RXQ(e),_RXQ(s))

/* Remove a queue element (*i) from its queue.  The next field is 0'd, so that any further use of this q entry will hopefully cause a core dump.  Multiple removes of the same queue item are not supported */
#define queue_Remove(i) \
	do { \
	    _RXQR(i); \
	    _RXQ(i)->next = NULL; \
	} while (0)

/* Move the queue element (*i) from its queue to the end of the queue (*q) */
#define	queue_MoveAppend(q,i) \
	do { \
	    _RXQR(i); \
	    queue_Append(q, i); \
	} while (0)

/* Move the queue element (*i) from its queue to the head of the queue (*q) */
#define	queue_MovePrepend(q,i) \
	do { \
	    _RXQR(i); \
	    queue_Prepend(q, i); \
	} while (0)

/* Return the first element of a queue, coerced too the specified structure s */
/* Warning:  this returns the queue head, if the queue is empty */
#define queue_First(q,s) ((struct s *)_RXQ(q)->next)

/* Return the last element of a queue, coerced to the specified structure s */
/* Warning:  this returns the queue head, if the queue is empty */
#define queue_Last(q,s) ((struct s *)_RXQ(q)->prev)

/* Return the next element in a queue, beyond the specified item, coerced to the specified structure s */
/* Warning:  this returns the queue head, if the item specified is the last in the queue */
#define queue_Next(i,s) ((struct s *)_RXQ(i)->next)

/* Return the previous element to a specified element of a queue, coerced to the specified structure s */
/* Warning:  this returns the queue head, if the item specified is the first in the queue */
#define queue_Prev(i,s) ((struct s *)_RXQ(i)->prev)

/* Return true if the queue is empty, i.e. just consists of a queue head.  The queue head must have been initialized some time prior to this call */
#define queue_IsEmpty(q) (_RXQ(q)->next == _RXQ(q))

/* Return true if the queue is non-empty, i.e. consists of a queue head plus at least one queue item */
#define queue_IsNotEmpty(q) (_RXQ(q)->next != _RXQ(q))

/* Return true if the queue item is currently in a queue */
/* Returns false if the item was removed from a queue OR is uninitialized (zero) */
#define queue_IsOnQueue(i) (_RXQ(i)->next != 0)

/* Returns true if the item was removed from a queue OR is uninitialized (zero) */
/* Return false if the queue item is currently in a queue */
#define queue_IsNotOnQueue(i) (_RXQ(i)->next == 0)

/* Returns true if the queue item (i) is the first element of the queue (q) */
#define queue_IsFirst(q,i) (_RXQ(q)->first == _RXQ(i))

/* Returns true if the queue item (i) is the last element of the queue (q) */
#define queue_IsLast(q,i) (_RXQ(q)->prev == _RXQ(i))

/* Returns true if the queue item (i) is the end of the queue (q), that is, i is the head of the queue */
#define queue_IsEnd(q,i) (_RXQ(q) == _RXQ(i))

/* Returns false if the queue item (i) is the end of the queue (q), that is, i is the head of the queue */
#define queue_IsNotEnd(q,i) (_RXQ(q) != _RXQ(i))

/* Prototypical loop to scan an entire queue forwards.  q is the queue
 * head, qe is the loop variable, next is a variable used to store the
 * queue entry for the next iteration of the loop, s is the user's
 * queue structure name.  Called using "for (queue_Scan(...)) {...}".
 * Note that extra initializers can be added before the queue_Scan,
 * and additional expressions afterwards.  So "for (sum=0,
 * queue_Scan(...), sum += value) {value = qe->value}" is possible.
 * If the current queue entry is deleted, the loop will work
 * correctly.  Care must be taken if other elements are deleted or
 * inserted.  Next may be updated within the loop to alter the item
 * used in the next iteration. */
#define	queue_Scan(q, qe, next,	s)			\
    (qe) = queue_First(q, s), next = queue_Next(qe, s);	\
	!queue_IsEnd(q,	qe);				\
	(qe) = (next), next = queue_Next(qe, s)

/* similar to queue_Scan except start at element 'start' instead of the beginning */
#define        queue_ScanFrom(q, start, qe, next, s)      \
    (qe) = (struct s*)(start), next = queue_Next(qe, s);  \
       !queue_IsEnd(q, qe);                               \
       (qe) = (next), next = queue_Next(qe, s)

/* This is similar to queue_Scan, but scans from the end of the queue to the beginning.  Next is the previous queue entry.  */
#define	queue_ScanBackwards(q, qe, prev, s)		\
    (qe) = queue_Last(q, s), prev = queue_Prev(qe, s);	\
	!queue_IsEnd(q,	qe);				\
	(qe) = prev, prev = queue_Prev(qe, s)

/* This is similar to queue_ScanBackwards, but start at element 'start' instead of the end.  Next is the previous queue entry.  */
#define        queue_ScanBackwardsFrom(q, start, qe, prev, s)  \
    (qe) = (struct s*)(start), prev = queue_Prev(qe, s);       \
       !queue_IsEnd(q, qe);                                    \
       (qe) = prev, prev = queue_Prev(qe, s)

#define queue_Count(q, qe, nqe, s, n) 			\
    for (n=0, queue_Scan(q, qe, nqe, s), n++) {}
#endif /* _RX_QUEUE_ */
# 271 "/usr/home/kaduk/openafs/build/include/rx/rx_queue.h"
# 81 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <lock.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/lock.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*******************************************************************\
* 								    *
* 	Information Technology Center				    *
* 	Carnegie-Mellon University				    *
* 								    *
* 								    *
* 								    *
\*******************************************************************/

/*
	Include file for using Vice locking routines.
*/

#ifndef LOCK_H
#define LOCK_H

#ifdef KERNEL
#error Do not include lwp/lock.h for kernel code. Use afs/lock.h instead.
#endif
# 29 "/usr/home/kaduk/openafs/build/include/lock.h"


/* The following macros allow multi statement macros to be defined safely, i.e.
   - the multi statement macro can be the object of an if statement;
   - the call to the multi statement macro may be legally followed by a semi-colon.
   BEGINMAC and ENDMAC have been tested with both the portable C compiler and
   Hi-C.  Both compilers were from the Palo Alto 4.2BSD software releases, and
   both optimized out the constant loop code.  For an example of the use
   of BEGINMAC and ENDMAC, see the definition for ReleaseWriteLock, below.
   An alternative to this, using "if(1)" for BEGINMAC is not used because it
   may generate worse code with pcc, and may generate warning messages with hi-C.
*/

#define BEGINMAC do {
#define ENDMAC   } while (0)

#ifdef AFS_PTHREAD_ENV
#if 0 /* expanded by -frewrite-includes */
#include <afs/opr.h>
#endif /* expanded by -frewrite-includes */
# 47 "/usr/home/kaduk/openafs/build/include/lock.h"
#if 0 /* expanded by -frewrite-includes */
#include <opr/lock.h>
#endif /* expanded by -frewrite-includes */
# 48 "/usr/home/kaduk/openafs/build/include/lock.h"
#define LOCK_LOCK(A) opr_mutex_enter(&(A)->mutex)
#define LOCK_UNLOCK(A) opr_mutex_exit(&(A)->mutex)
#else /* AFS_PTHREAD_ENV */
# 51 "/usr/home/kaduk/openafs/build/include/lock.h"
#define LOCK_LOCK(A)
#define LOCK_UNLOCK(A)
#endif /* AFS_PTHREAD_ENV */
# 54 "/usr/home/kaduk/openafs/build/include/lock.h"

/* all locks wait on excl_locked except for READ_LOCK, which waits on readers_reading */
struct Lock {
    unsigned char wait_states;	/* type of lockers waiting */
    unsigned char excl_locked;	/* anyone have boosted, shared or write lock? */
    unsigned char readers_reading;	/* # readers actually with read locks */
    unsigned char num_waiting;	/* probably need this soon */
#ifdef AFS_PTHREAD_ENV
    pthread_mutex_t mutex;	/* protects this structure */
    pthread_cond_t read_cv;	/* wait for read locks */
    pthread_cond_t write_cv;	/* wait for write/shared locks */
#endif				/* AFS_PTHREAD_ENV */
# 66 "/usr/home/kaduk/openafs/build/include/lock.h"
};

extern void Afs_Lock_Obtain(struct Lock *lock, int how);
extern void Afs_Lock_ReleaseR(struct Lock *lock);
extern void Afs_Lock_ReleaseW(struct Lock *lock);
extern void Afs_Lock_WakeupR(struct Lock *lock);
void Lock_Init(struct Lock *lock);
void Lock_Destroy(struct Lock *lock);

#define READ_LOCK	1
#define WRITE_LOCK	2
#define SHARED_LOCK	4
/* this next is not a flag, but rather a parameter to Afs_Lock_Obtain */
#define BOOSTED_LOCK 6

/* next defines wait_states for which we wait on excl_locked */
#define EXCL_LOCKS (WRITE_LOCK|SHARED_LOCK)

#define ObtainReadLock(lock)\
	BEGINMAC \
	    LOCK_LOCK(lock); \
	    if (!((lock)->excl_locked & WRITE_LOCK) && !(lock)->wait_states)\
		(lock) -> readers_reading++;\
	    else\
		Afs_Lock_Obtain(lock, READ_LOCK); \
	    LOCK_UNLOCK(lock); \
	ENDMAC

#define ObtainReadLockNoBlock(lock, code)\
        BEGINMAC \
            LOCK_LOCK(lock); \
            if (!((lock)->excl_locked & WRITE_LOCK) && !(lock)->wait_states) {\
                (lock) -> readers_reading++;\
                code = 0;\
            }\
            else\
                code = -1; \
            LOCK_UNLOCK(lock); \
        ENDMAC

#define ObtainWriteLock(lock)\
	BEGINMAC \
	    LOCK_LOCK(lock); \
	    if (!(lock)->excl_locked && !(lock)->readers_reading)\
		(lock) -> excl_locked = WRITE_LOCK;\
	    else\
		Afs_Lock_Obtain(lock, WRITE_LOCK); \
	    LOCK_UNLOCK(lock); \
	ENDMAC

#define ObtainWriteLockNoBlock(lock, code)\
        BEGINMAC \
            LOCK_LOCK(lock); \
            if (!(lock)->excl_locked && !(lock)->readers_reading) {\
                (lock) -> excl_locked = WRITE_LOCK;\
                code = 0;\
            }\
            else\
                code = -1; \
            LOCK_UNLOCK(lock); \
        ENDMAC

#define ObtainSharedLock(lock)\
	BEGINMAC \
	    LOCK_LOCK(lock); \
	    if (!(lock)->excl_locked && !(lock)->wait_states)\
		(lock) -> excl_locked = SHARED_LOCK;\
	    else\
	        Afs_Lock_Obtain(lock, SHARED_LOCK); \
	    LOCK_UNLOCK(lock); \
	ENDMAC

#define ObtainSharedLockNoBlock(lock, code)\
        BEGINMAC \
            LOCK_LOCK(lock); \
            if (!(lock)->excl_locked && !(lock)->wait_states) {\
                (lock) -> excl_locked = SHARED_LOCK;\
                code = 0;\
            }\
            else\
                code = -1; \
            LOCK_UNLOCK(lock); \
        ENDMAC

#define BoostSharedLock(lock)\
	BEGINMAC \
	    LOCK_LOCK(lock); \
	    if (!(lock)->readers_reading)\
		(lock)->excl_locked = WRITE_LOCK;\
	    else\
		Afs_Lock_Obtain(lock, BOOSTED_LOCK); \
	    LOCK_UNLOCK(lock); \
	ENDMAC

/* this must only be called with a WRITE or boosted SHARED lock! */
#define UnboostSharedLock(lock)\
	BEGINMAC\
	    LOCK_LOCK(lock); \
	    (lock)->excl_locked = SHARED_LOCK; \
	    if((lock)->wait_states) \
		Afs_Lock_ReleaseR(lock); \
	    LOCK_UNLOCK(lock); \
	ENDMAC

#ifdef notdef
/* this is what UnboostSharedLock looked like before the hi-C compiler */
/* this must only be called with a WRITE or boosted SHARED lock! */
#define UnboostSharedLock(lock)\
	((lock)->excl_locked = SHARED_LOCK,\
	((lock)->wait_states ?\
		Afs_Lock_ReleaseR(lock) : 0))
#endif /* notdef */
# 178 "/usr/home/kaduk/openafs/build/include/lock.h"

#define ReleaseReadLock(lock)\
	BEGINMAC\
	    LOCK_LOCK(lock); \
	    if (!--(lock)->readers_reading && (lock)->wait_states)\
		Afs_Lock_ReleaseW(lock) ; \
	    LOCK_UNLOCK(lock); \
	ENDMAC


#ifdef notdef
/* This is what the previous definition should be, but the hi-C compiler generates
  a warning for each invocation */
#define ReleaseReadLock(lock)\
	(!--(lock)->readers_reading && (lock)->wait_states ?\
		Afs_Lock_ReleaseW(lock)    :\
		0)
#endif /* notdef */
# 196 "/usr/home/kaduk/openafs/build/include/lock.h"

#define ReleaseWriteLock(lock)\
	BEGINMAC\
	    LOCK_LOCK(lock); \
	    (lock)->excl_locked &= ~WRITE_LOCK;\
	    if ((lock)->wait_states) Afs_Lock_ReleaseR(lock);\
	    LOCK_UNLOCK(lock); \
	ENDMAC

#ifdef notdef
/* This is what the previous definition should be, but the hi-C compiler generates
   a warning for each invocation */
#define ReleaseWriteLock(lock)\
	((lock)->excl_locked &= ~WRITE_LOCK,\
	((lock)->wait_states ?\
		Afs_Lock_ReleaseR(lock) : 0))
#endif /* notdef */
# 213 "/usr/home/kaduk/openafs/build/include/lock.h"

/* can be used on shared or boosted (write) locks */
#define ReleaseSharedLock(lock)\
	BEGINMAC\
	    LOCK_LOCK(lock); \
	    (lock)->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK);\
	    if ((lock)->wait_states) Afs_Lock_ReleaseR(lock);\
	    LOCK_UNLOCK(lock); \
	ENDMAC

#ifdef notdef
/* This is what the previous definition should be, but the hi-C compiler generates
   a warning for each invocation */
/* can be used on shared or boosted (write) locks */
#define ReleaseSharedLock(lock)\
	((lock)->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK),\
	((lock)->wait_states ?\
		Afs_Lock_ReleaseR(lock) : 0))
#endif /* notdef */
# 232 "/usr/home/kaduk/openafs/build/include/lock.h"

/* convert a write lock to a read lock */
#define ConvertWriteToReadLock(lock)\
	BEGINMAC\
	    LOCK_LOCK(lock); \
	    (lock)->excl_locked &= ~WRITE_LOCK;\
	    (lock)->readers_reading++;\
	    if ((lock)->wait_states & READ_LOCK) \
		Afs_Lock_WakeupR(lock) ; \
	    LOCK_UNLOCK(lock); \
	ENDMAC

/* I added this next macro to make sure it is safe to nuke a lock -- Mike K. */
#define LockWaiters(lock)\
	((int) ((lock)->num_waiting))

#define CheckLock(lock)\
	((lock)->excl_locked? (int) -1 : (int) (lock)->readers_reading)

#define WriteLocked(lock)\
	((lock)->excl_locked & WRITE_LOCK)

#define SharedLocked(lock)\
	((lock)->excl_locked & SHARED_LOCK)

#endif /* LOCK_H */
# 258 "/usr/home/kaduk/openafs/build/include/lock.h"
# 82 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <afs/afsint.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/afsint.h" 1
/* Machine generated file -- Do NOT edit */

#ifndef	_RXGEN_AFSINT_
#define	_RXGEN_AFSINT_

#ifdef	KERNEL
/* The following 'ifndefs' are not a good solution to the vendor's omission of surrounding all system includes with 'ifndef's since it requires that this file is included after the system includes...*/
#if 0 /* expanded by -frewrite-includes */
#include <afsconfig.h>
#endif /* expanded by -frewrite-includes */
# 9 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "afs/param.h"
#endif /* expanded by -frewrite-includes */
# 10 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#ifdef	UKERNEL
#if 0 /* expanded by -frewrite-includes */
#include "afs/sysincludes.h"
#endif /* expanded by -frewrite-includes */
# 12 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/xdr.h"
#endif /* expanded by -frewrite-includes */
# 13 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx.h"
#endif /* expanded by -frewrite-includes */
# 14 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_globals.h"
#endif /* expanded by -frewrite-includes */
# 15 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#else	/* UKERNEL */
# 16 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "h/types.h"
#endif /* expanded by -frewrite-includes */
# 17 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#ifndef	SOCK_DGRAM  /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "h/socket.h"
#endif /* expanded by -frewrite-includes */
# 19 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif
# 20 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
struct ubik_client;
#ifndef	DTYPE_SOCKET  /* XXXXX */
#ifndef AFS_LINUX22_ENV
#if 0 /* expanded by -frewrite-includes */
#include "h/file.h"
#endif /* expanded by -frewrite-includes */
# 24 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif
# 25 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif
# 26 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#ifndef	S_IFMT  /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "h/stat.h"
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif
# 29 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if defined (AFS_OBSD_ENV) && !defined (MLEN)
#if 0 /* expanded by -frewrite-includes */
#include "sys/mbuf.h"
#endif /* expanded by -frewrite-includes */
# 31 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif
# 32 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#ifndef	IPPROTO_UDP /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "netinet/in.h"
#endif /* expanded by -frewrite-includes */
# 34 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif
# 35 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#ifndef	DST_USA  /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "h/time.h"
#endif /* expanded by -frewrite-includes */
# 37 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif
# 38 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#ifndef AFS_LINUX22_ENV
#if 0 /* expanded by -frewrite-includes */
#include "rpc/types.h"
#endif /* expanded by -frewrite-includes */
# 40 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif /* AFS_LINUX22_ENV */
# 41 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#ifndef	XDR_GETLONG /* XXXXX */
#ifdef AFS_LINUX22_ENV
#ifndef quad_t
#define quad_t __quad_t
#define u_quad_t __u_quad_t
#endif
# 47 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif
# 48 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/xdr.h"
#endif /* expanded by -frewrite-includes */
# 49 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif /* XDR_GETLONG */
# 50 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#endif   /* UKERNEL */
# 51 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "afs/rxgen_consts.h"
#endif /* expanded by -frewrite-includes */
# 52 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "afs_osi.h"
#endif /* expanded by -frewrite-includes */
# 53 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx.h"
#endif /* expanded by -frewrite-includes */
# 54 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_globals.h"
#endif /* expanded by -frewrite-includes */
# 55 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#else	/* KERNEL */
# 56 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 57 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include <afs/stds.h>
#endif /* expanded by -frewrite-includes */
# 58 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 59 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#if 0 /* expanded by -frewrite-includes */
#include <rx/xdr.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/xdr.h" 1
/*
 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
 * unrestricted use provided that this legend is included on all tape
 * media and as a part of the software program in whole or part.  Users
 * may copy or modify Sun RPC without charge, but are not authorized
 * to license or distribute it to anyone else except as part of a product or
 * program developed by the user.
 *
 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
 *
 * Sun RPC is provided with no support and without any obligation on the
 * part of Sun Microsystems, Inc. to assist in its use, correction,
 * modification or enhancement.
 *
 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
 * OR ANY PART THEREOF.
 *
 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
 * or profits or other special, indirect and consequential damages, even if
 * Sun has been advised of the possibility of such damages.
 *
 * Sun Microsystems, Inc.
 * 2550 Garcia Avenue
 * Mountain View, California  94043
 */

/* This file has the contents of Sun's orginal types.h file added. */

/*      @(#)types.h 1.1 86/02/03 SMI      */

/*
 * Rpc additions to <sys/types.h>
 */

#ifndef __XDR_INCLUDE__
#define __XDR_INCLUDE__
#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 41 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#ifdef AFS_NT40_ENV
#ifndef _MFC_VER
#if 0 /* expanded by -frewrite-includes */
#include <winsock2.h>
#endif /* expanded by -frewrite-includes */
# 44 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#endif /* _MFC_VER */
# 45 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#endif
# 46 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#ifndef bool_t
#define	bool_t	int
#define	enum_t	int
#endif
# 50 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#ifndef FALSE
#define	FALSE	0
#endif /* !FALSE */
# 53 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#ifndef TRUE
#define	TRUE	1
#endif /* !TRUE */
# 56 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#define __dontcare__	-1

#if defined(AFS_NBSD50_ENV)
# if !defined(DEF_CADDR_T)
typedef char * caddr_t;
#define DEF_CADDR_T
# endif
# 63 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#endif
# 64 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"

#ifndef mem_alloc
#define mem_alloc(bsize)	malloc(bsize)
#endif
# 68 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"

#ifndef mem_free
#define mem_free(ptr, bsize)	free(ptr)
#endif
# 72 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"

#if !defined(AFS_NT40_ENV)
#define xdr_alloc afs_xdr_alloc
#define xdr_free afs_xdr_free
#define xdr_void afs_xdr_void
#define xdr_int afs_xdr_int
#define xdr_u_int afs_xdr_u_int
#define xdr_short afs_xdr_short
#define xdr_u_short afs_xdr_u_short
#define xdr_long afs_xdr_long
#define xdr_u_long afs_xdr_u_long
#define xdr_char afs_xdr_char
#define xdr_u_char afs_xdr_u_char
#define xdr_bool afs_xdr_bool
#define xdr_enum afs_xdr_enum
#define xdr_array afs_xdr_array
#define xdr_arrayN afs_xdr_arrayN
#define xdr_bytes afs_xdr_bytes
#define xdr_opaque afs_xdr_opaque
#define xdr_string afs_xdr_string
#define xdr_union afs_xdr_union
#define xdr_float afs_xdr_float
#define xdr_double afs_xdr_double
#define xdr_reference afs_xdr_reference
#define xdr_wrapstring afs_xdr_wrapstring
#define xdr_vector afs_xdr_vector
#define xdr_int64 afs_xdr_int64
#define xdr_uint64 afs_xdr_uint64
#define xdr_pointer afs_xdr_pointer
#define xdrmem_create afs_xdrmem_create
#endif
# 103 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"

#ifdef	KERNEL
#define	osi_alloc		afs_osi_Alloc
#define	osi_free		afs_osi_Free

/* keep here for now, 64 bit issues */
#ifndef AFS_OBSD44_ENV
extern void *afs_osi_Alloc(size_t x);
extern void afs_osi_Free(void *x, size_t asize);
#endif
# 113 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"

#endif
# 115 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#ifndef major			/* ouch! */
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 117 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
#endif
# 118 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"

/*      @(#)xdr.h 1.1 86/02/03 SMI      */

/*
 * xdr.h, External Data Representation Serialization Routines.
 *
 * Copyright (C) 1984, Sun Microsystems, Inc.
 */

/*
 * XDR provides a conventional way for converting between C data
 * types and an external bit-string representation.  Library supplied
 * routines provide for the conversion on built-in C data types.  These
 * routines and utility routines defined here are used to help implement
 * a type encode/decode routine for each user-defined type.
 *
 * Each data type provides a single procedure which takes two arguments:
 *
 *	bool_t
 *	xdrproc(xdrs, argresp)
 *		XDR *xdrs;
 *		<type> *argresp;
 *
 * xdrs is an instance of a XDR handle, to which or from which the data
 * type is to be converted.  argresp is a pointer to the structure to be
 * converted.  The XDR handle contains an operation field which indicates
 * which of the operations (ENCODE, DECODE * or FREE) is to be performed.
 *
 * XDR_DECODE may allocate space if the pointer argresp is null.  This
 * data can be freed with the XDR_FREE operation.
 *
 * We write only one procedure per data type to make it easy
 * to keep the encode and decode procedures for a data type consistent.
 * In many cases the same code performs all operations on a user defined type,
 * because all the hard work is done in the component type routines.
 * decode as a series of calls on the nested data types.
 */

/*
 * Xdr operations.  XDR_ENCODE causes the type to be encoded into the
 * stream.  XDR_DECODE causes the type to be extracted from the stream.
 * XDR_FREE can be used to release the space allocated by an XDR_DECODE
 * request.
 */
enum xdr_op {
    XDR_ENCODE = 0,
    XDR_DECODE = 1,
    XDR_FREE = 2
};

/*
 * This is the number of bytes per unit of external data.
 */
#define BYTES_PER_XDR_UNIT	(4)

/*
 * A xdrproc_t exists for each data type which is to be encoded or decoded.
 *
 * The second argument to the xdrproc_t is a pointer to an opaque pointer.
 * The opaque pointer generally points to a structure of the data type
 * to be decoded.  If this pointer is 0, then the type routines should
 * allocate dynamic storage of the appropriate size and return it.
 * bool_t	(*xdrproc_t)(XDR *, caddr_t *);
 */

/* We need a different prototype for i386 Linux kernel code, because it
 * uses a register (rather than stack) based calling convention. The
 * normal va_args prototype results in the arguments being placed on the
 * stack, where they aren't accessible to the 'real' function.
 */
#if defined(AFS_I386_LINUX26_ENV) && defined(KERNEL) && !defined(UKERNEL)
typedef bool_t(*xdrproc_t) (void *, caddr_t, u_int);
#else
# 191 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
typedef bool_t(*xdrproc_t) (void *, ...);
#endif
# 193 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"

/*
 * The XDR handle.
 * Contains operation which is being applied to the stream,
 * an operations vector for the paticular implementation (e.g. see xdr_mem.c),
 * and two private fields for the use of the particular impelementation.
 */

typedef struct __afs_xdr {
    enum xdr_op x_op;		/* operation; fast additional param */
    struct xdr_ops {
	bool_t(*x_getint32) (struct __afs_xdr *xdrs, afs_int32 * lp);	/* get an afs_int32 from underlying stream */
	bool_t(*x_putint32) (struct __afs_xdr *xdrs, afs_int32 * lp);	/* put an afs_int32 to " */
	bool_t(*x_getbytes) (struct __afs_xdr *xdrs, caddr_t addr, u_int len);	/* get some bytes from " */
	bool_t(*x_putbytes) (struct __afs_xdr *xdrs, caddr_t addr, u_int len);	/* put some bytes to " */
	u_int(*x_getpostn) (struct __afs_xdr *xdrs);	/* returns bytes off from beginning */
	bool_t(*x_setpostn) (struct __afs_xdr *xdrs, u_int pos);	/* lets you reposition the stream */
	afs_int32 *(*x_inline) (struct __afs_xdr *xdrs, u_int len);	/* buf quick ptr to buffered data */
	void (*x_destroy) (struct __afs_xdr *xdrs);	/* free privates of this xdr_stream */
    } *x_ops;
    caddr_t x_public;		/* users' data */
    caddr_t x_private;		/* pointer to private data */
    caddr_t x_base;		/* private used for position info */
    int x_handy;		/* extra private word */
} XDR;

/*
 * Operations defined on a XDR handle
 *
 * XDR		*xdrs;
 * afs_int32		*int32p;
 * caddr_t	 addr;
 * u_int	 len;
 * u_int	 pos;
 */
#define XDR_GETINT32(xdrs, int32p)			\
	(*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
#define xdr_getint32(xdrs, int32p)			\
	(*(xdrs)->x_ops->x_getint32)(xdrs, int32p)

#define XDR_PUTINT32(xdrs, int32p)			\
	(*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
#define xdr_putint32(xdrs, int32p)			\
	(*(xdrs)->x_ops->x_putint32)(xdrs, int32p)

#define XDR_GETBYTES(xdrs, addr, len)			\
	(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
#define xdr_getbytes(xdrs, addr, len)			\
	(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)

#define XDR_PUTBYTES(xdrs, addr, len)			\
	(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
#define xdr_putbytes(xdrs, addr, len)			\
	(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)

#define XDR_GETPOS(xdrs)				\
	(*(xdrs)->x_ops->x_getpostn)(xdrs)
#define xdr_getpos(xdrs)				\
	(*(xdrs)->x_ops->x_getpostn)(xdrs)

#define XDR_SETPOS(xdrs, pos)				\
	(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
#define xdr_setpos(xdrs, pos)				\
	(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)

#define	XDR_INLINE(xdrs, len)				\
	(*(xdrs)->x_ops->x_inline)(xdrs, len)
#define	xdr_inline(xdrs, len)				\
	(*(xdrs)->x_ops->x_inline)(xdrs, len)

#define	XDR_DESTROY(xdrs)				\
	if ((xdrs)->x_ops->x_destroy) 			\
		(*(xdrs)->x_ops->x_destroy)(xdrs)
#define	xdr_destroy(xdrs)				\
	if ((xdrs)->x_ops->x_destroy) 			\
		(*(xdrs)->x_ops->x_destroy)(xdrs)

/*
 * Support struct for discriminated unions.
 * You create an array of xdrdiscrim structures, terminated with
 * a entry with a null procedure pointer.  The xdr_union routine gets
 * the discriminant value and then searches the array of structures
 * for a matching value.  If a match is found the associated xdr routine
 * is called to handle that part of the union.  If there is
 * no match, then a default routine may be called.
 * If there is no match and no default routine it is an error.
 */
#define NULL_xdrproc_t ((xdrproc_t)0)
struct xdr_discrim {
    int value;
    xdrproc_t proc;
};

/*
 * In-line routines for fast encode/decode of primitve data types.
 * Caveat emptor: these use single memory cycles to get the
 * data from the underlying buffer, and will fail to operate
 * properly if the data is not aligned.  The standard way to use these
 * is to say:
 *	if ((buf = XDR_INLINE(xdrs, count)) == NULL)
 *		return (FALSE);
 *	<<< macro calls >>>
 * where ``count'' is the number of bytes of data occupied
 * by the primitive data types.
 *
 * N.B. and frozen for all time: each data type here uses 4 bytes
 * of external representation.
 */
#define IXDR_GET_INT32(buf)		ntohl(*buf++)
#define IXDR_PUT_INT32(buf, v)		(*buf++ = htonl(v))

#define IXDR_GET_BOOL(buf)		((bool_t)IXDR_GET_INT32(buf))
#define IXDR_GET_ENUM(buf, t)		((t)IXDR_GET_INT32(buf))
#define IXDR_GET_U_INT32(buf)		((afs_uint32)IXDR_GET_INT32(buf))
#define IXDR_GET_SHORT(buf)		((short)IXDR_GET_INT32(buf))
#define IXDR_GET_U_SHORT(buf)		((u_short)IXDR_GET_INT32(buf))

#define IXDR_PUT_BOOL(buf, v)		IXDR_PUT_INT32((buf), ((afs_int32)(v)))
#define IXDR_PUT_ENUM(buf, v)		IXDR_PUT_INT32((buf), ((afs_int32)(v)))
#define IXDR_PUT_U_INT32(buf, v)	IXDR_PUT_INT32((buf), ((afs_int32)(v)))
#define IXDR_PUT_SHORT(buf, v)		IXDR_PUT_INT32((buf), ((afs_int32)(v)))
#define IXDR_PUT_U_SHORT(buf, v)	IXDR_PUT_INT32((buf), ((afs_int32)(v)))

#if 0 /* expanded by -frewrite-includes */
#include "xdr_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/xdr_prototypes.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef	_XDR_PROTOTYPES_H
#define _XDR_PROTOTYPES_H

struct rx_call;

/* xdr_afsuuid.c */
extern int xdr_afsUUID(XDR * xdrs, afsUUID * objp);

/* xdr_int32.c */
extern bool_t xdr_afs_int32(XDR * xdrs, afs_int32 * ip);
extern bool_t xdr_afs_uint32(XDR * xdrs, afs_uint32 * up);

/* xdr_int64.c */
extern bool_t xdr_int64(XDR * xdrs, afs_int64 * ulp);
extern bool_t xdr_afs_int64(XDR * xdrs, afs_int64 * ulp);
extern bool_t xdr_uint64(XDR * xdrs, afs_uint64 * ulp);
extern bool_t xdr_afs_uint64(XDR * xdrs, afs_uint64 * ulp);

/* xdr_rx.c */
extern void xdrrx_create(XDR * xdrs, struct rx_call *call,
			 enum xdr_op op);

#ifndef XDR_AFS_DECLS_ONLY

/* xdr_array.c */
extern bool_t xdr_array(XDR * xdrs, caddr_t * addrp, u_int * sizep,
			u_int maxsize, u_int elsize, xdrproc_t elproc);

/* xdr_arrayn.c */
extern bool_t xdr_arrayN(XDR * xdrs, caddr_t * addrp, u_int * sizep,
			 u_int maxsize, u_int elsize, xdrproc_t elproc);

/* xdr.c */
extern bool_t xdr_void(void);
extern bool_t xdr_long(XDR * xdrs, long *lp);
extern bool_t xdr_u_long(XDR * xdrs, u_long * ulp);
extern bool_t xdr_int(XDR * xdrs, int *ip);
extern bool_t xdr_u_int(XDR * xdrs, u_int * up);
extern bool_t xdr_char(XDR * xdrs, char *sp);
extern bool_t xdr_u_char(XDR * xdrs, u_char * usp);
extern bool_t xdr_short(XDR * xdrs, short *sp);
extern bool_t xdr_u_short(XDR * xdrs, u_short * usp);
extern bool_t xdr_bool(XDR * xdrs, bool_t * bp);
extern bool_t xdr_enum(XDR * xdrs, enum_t * ep);
extern bool_t xdr_opaque(XDR * xdrs, caddr_t cp, u_int cnt);
extern bool_t xdr_bytes(XDR * xdrs, char **cpp,
			u_int * sizep, u_int maxsize);
extern bool_t xdr_union(XDR * xdrs, enum_t * dscmp, caddr_t unp,
			struct xdr_discrim *choices, xdrproc_t dfault);
extern bool_t xdr_string(XDR * xdrs, char **cpp, u_int maxsize);
extern bool_t xdr_wrapstring(XDR * xdrs, char **cpp);
extern void * xdr_alloc(afs_int32 size);
extern void   xdr_free(xdrproc_t proc, void *obj);


/* xdr_float.c */
extern bool_t xdr_float(XDR * xdrs, float *fp);
extern bool_t xdr_double(XDR * xdrs, double *dp);

/* xdr_len.c */
extern void xdrlen_create(XDR *xdrs);

/* xdr_mem.c */
extern void xdrmem_create(XDR * xdrs, caddr_t addr, u_int size,
			  enum xdr_op op);


/* xdr_rec.c */
extern void xdrrec_create(XDR * xdrs, u_int sendsize, u_int recvsize,
			  caddr_t tcp_handle,
			  int (*readit) (caddr_t tcp_handle, caddr_t out_base,
					 int len),
			  int (*writeit) (caddr_t tcp_handle,
					  caddr_t out_base, int len));
extern bool_t xdrrec_skiprecord(XDR * xdrs);
extern bool_t xdrrec_eof(XDR * xdrs);
extern bool_t xdrrec_endofrecord(XDR * xdrs, bool_t sendnow);


/* xdr_refernce.c */

extern bool_t xdr_reference(XDR *xdrs, caddr_t *pp, u_int size,
			    xdrproc_t proc);

/* xdr_stdio.c */


/* xdr_update.c */
extern bool_t xdr_pointer(XDR * xdrs, char **objpp, u_int obj_size,
			  xdrproc_t xdr_obj);
extern bool_t xdr_vector(XDR * xdrs, char *basep,
			 u_int nelem, u_int elemsize,
			 xdrproc_t xdr_elem);


#endif
# 106 "/usr/home/kaduk/openafs/build/include/rx/xdr_prototypes.h"

#ifndef osi_alloc
extern char *osi_alloc(afs_int32 x);
#endif
# 110 "/usr/home/kaduk/openafs/build/include/rx/xdr_prototypes.h"
#ifndef osi_free
extern int osi_free(char *x, afs_int32 size);
#endif
# 113 "/usr/home/kaduk/openafs/build/include/rx/xdr_prototypes.h"
#endif /* _XDR_PROTOTYPES_H */
# 114 "/usr/home/kaduk/openafs/build/include/rx/xdr_prototypes.h"
# 317 "/usr/home/kaduk/openafs/build/include/rx/xdr.h" 2
#endif /* __XDR_INCLUDE__ */
# 318 "/usr/home/kaduk/openafs/build/include/rx/xdr.h"
# 60 "/usr/home/kaduk/openafs/build/include/afs/afsint.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <rx/rx.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifdef KDUMP_RX_LOCK
/* kdump for SGI needs MP and SP versions of rx_serverQueueEntry,
 * rx_peer, rx_connection and rx_call structs. rx.h gets included a
 * second time to pick up mp_ versions of those structs. Currently
 * the affected struct's have #ifdef's in them for the second pass.
 * This should change once we start using only ANSI compilers.
 * Actually, kdump does not use rx_serverQueueEntry, but I'm including
 * it for completeness.
 */
#undef _RX_
#endif
# 21 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef	_RX_
#define _RX_

#ifndef KDUMP_RX_LOCK
#ifdef	KERNEL
#if 0 /* expanded by -frewrite-includes */
#include "rx_kmutex.h"
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_kernel.h"
#endif /* expanded by -frewrite-includes */
# 29 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if defined (AFS_OBSD_ENV) && !defined (MLEN)
#if 0 /* expanded by -frewrite-includes */
#include "sys/mbuf.h"
#endif /* expanded by -frewrite-includes */
# 31 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 32 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "netinet/in.h"
#endif /* expanded by -frewrite-includes */
# 33 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "sys/socket.h"
#endif /* expanded by -frewrite-includes */
# 34 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else /* KERNEL */
# 35 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 36 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <string.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifdef AFS_PTHREAD_ENV
#if 0 /* expanded by -frewrite-includes */
# include "rx_pthread.h"
#endif /* expanded by -frewrite-includes */
# 40 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else
# 41 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include "rx_lwp.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_lwp.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*
 * rx_lwp.h - mutexes and condition variables do not exist for LWP.
 */

#ifndef _RX_LWP_H_
#define _RX_LWP_H_

/* KDUMP_KERNEL is defined when kdump includes this header. */
#ifndef KDUMP_KERNEL

typedef int afs_kmutex_t;
typedef int afs_kcondvar_t;

#define CALL_HOLD(call, type)
#define CALL_HOLD_R(call, type)
#define CALL_RELE(call, type)
#define CALL_RELE_R(call, type)

#define MUTEX_DESTROY(a)
#define MUTEX_ENTER(a)
#define MUTEX_TRYENTER(a) 1
#define MUTEX_EXIT(a)
#define MUTEX_INIT(a,b,c,d)
#define MUTEX_ASSERT(a)
#define CV_INIT(a,b,c,d)
#define CV_DESTROY(a)
#define CV_WAIT(cv, l)
#define CV_SIGNAL(cv)
#define CV_BROADCAST(cv)
#define CV_TIMEDWAIT(cv, l, t)

#endif /* KERNEL */
# 42 "/usr/home/kaduk/openafs/build/include/rx/rx_lwp.h"

#endif /* _RX_LWP_H_ */
# 44 "/usr/home/kaduk/openafs/build/include/rx/rx_lwp.h"
# 42 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2
#endif
# 43 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifdef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
#include <malloc.h>
#endif /* expanded by -frewrite-includes */
# 45 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include <winsock2.h>
#endif /* expanded by -frewrite-includes */
# 46 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include <ws2tcpip.h>
#endif /* expanded by -frewrite-includes */
# 47 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 48 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include "rx_user.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifdef	VALIDATE
error - foo error - foo error - foo
#endif /* VALIDATE */
# 13 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"
#ifndef RX_USER_INCLUDE
#define RX_USER_INCLUDE
/* rx_user.h:  definitions specific to the user-level implementation of Rx */
#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 17 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"
#if 0 /* expanded by -frewrite-includes */
#include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 18 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"
#if 0 /* expanded by -frewrite-includes */
#include <stdlib.h>		/* for malloc() */
#endif /* expanded by -frewrite-includes */
# 19 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"
#if 0 /* expanded by -frewrite-includes */
#include <lwp.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/lwp.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*******************************************************************\
* 								    *
* 	Information Technology Center				    *
* 	Carnegie-Mellon University				    *
* 								    *
* 								    *
\*******************************************************************/

#ifndef __LWP_INCLUDE_
#define	__LWP_INCLUDE_	1

#if !defined(KERNEL) && !defined(_KMEMUSER)
#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 23 "/usr/home/kaduk/openafs/build/include/lwp.h"

/* External function declarations. */
#ifdef AFS_NT40_ENV
#ifndef _MFC_VER		/*skip if doing Microsoft foundation class */
#if 0 /* expanded by -frewrite-includes */
#include <winsock2.h>
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/lwp.h"
#endif
# 29 "/usr/home/kaduk/openafs/build/include/lwp.h"
#elif defined(AFS_LINUX20_ENV)
# 30 "/usr/home/kaduk/openafs/build/include/lwp.h"
#if 0 /* expanded by -frewrite-includes */
#include <unistd.h>
#endif /* expanded by -frewrite-includes */
# 31 "/usr/home/kaduk/openafs/build/include/lwp.h"
#if 0 /* expanded by -frewrite-includes */
#include <time.h>
#endif /* expanded by -frewrite-includes */
# 32 "/usr/home/kaduk/openafs/build/include/lwp.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/time.h>
#endif /* expanded by -frewrite-includes */
# 33 "/usr/home/kaduk/openafs/build/include/lwp.h"
#else
# 34 "/usr/home/kaduk/openafs/build/include/lwp.h"
#if 0 /* expanded by -frewrite-includes */
# include <unistd.h>		/* select() prototype */
#endif /* expanded by -frewrite-includes */
# 35 "/usr/home/kaduk/openafs/build/include/lwp.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/types.h>		/* fd_set on older platforms */
#endif /* expanded by -frewrite-includes */
# 36 "/usr/home/kaduk/openafs/build/include/lwp.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/time.h>		/* struct timeval, select() prototype */
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/time.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)time.h	8.5 (Berkeley) 5/4/95
 * $FreeBSD: head/sys/sys/time.h 264388 2014-04-12 23:29:29Z davide $
 */

#ifndef _SYS_TIME_H_
#define	_SYS_TIME_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/_timeval.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/sys/time.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/include/sys/time.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/timespec.h>
#endif /* expanded by -frewrite-includes */
# 39 "/usr/include/sys/time.h" 3 4

struct timezone {
	int	tz_minuteswest;	/* minutes west of Greenwich */
	int	tz_dsttime;	/* type of dst correction */
};
#define	DST_NONE	0	/* not on dst */
#define	DST_USA		1	/* USA style dst */
#define	DST_AUST	2	/* Australian style dst */
#define	DST_WET		3	/* Western European dst */
#define	DST_MET		4	/* Middle European dst */
#define	DST_EET		5	/* Eastern European dst */
#define	DST_CAN		6	/* Canada */

#if __BSD_VISIBLE
struct bintime {
	time_t	sec;
	uint64_t frac;
};

static __inline void
bintime_addx(struct bintime *_bt, uint64_t _x)
{
	uint64_t _u;

	_u = _bt->frac;
	_bt->frac += _x;
	if (_u > _bt->frac)
		_bt->sec++;
}

static __inline void
bintime_add(struct bintime *_bt, const struct bintime *_bt2)
{
	uint64_t _u;

	_u = _bt->frac;
	_bt->frac += _bt2->frac;
	if (_u > _bt->frac)
		_bt->sec++;
	_bt->sec += _bt2->sec;
}

static __inline void
bintime_sub(struct bintime *_bt, const struct bintime *_bt2)
{
	uint64_t _u;

	_u = _bt->frac;
	_bt->frac -= _bt2->frac;
	if (_u < _bt->frac)
		_bt->sec--;
	_bt->sec -= _bt2->sec;
}

static __inline void
bintime_mul(struct bintime *_bt, u_int _x)
{
	uint64_t _p1, _p2;

	_p1 = (_bt->frac & 0xffffffffull) * _x;
	_p2 = (_bt->frac >> 32) * _x + (_p1 >> 32);
	_bt->sec *= _x;
	_bt->sec += (_p2 >> 32);
	_bt->frac = (_p2 << 32) | (_p1 & 0xffffffffull);
}

static __inline void
bintime_shift(struct bintime *_bt, int _exp)
{

	if (_exp > 0) {
		_bt->sec <<= _exp;
		_bt->sec |= _bt->frac >> (64 - _exp);
		_bt->frac <<= _exp;
	} else if (_exp < 0) {
		_bt->frac >>= -_exp;
		_bt->frac |= (uint64_t)_bt->sec << (64 + _exp);
		_bt->sec >>= -_exp;
	}
}

#define	bintime_clear(a)	((a)->sec = (a)->frac = 0)
#define	bintime_isset(a)	((a)->sec || (a)->frac)
#define	bintime_cmp(a, b, cmp)						\
	(((a)->sec == (b)->sec) ?					\
	    ((a)->frac cmp (b)->frac) :					\
	    ((a)->sec cmp (b)->sec))

#define	SBT_1S	((sbintime_t)1 << 32)
#define	SBT_1M	(SBT_1S * 60)
#define	SBT_1MS	(SBT_1S / 1000)
#define	SBT_1US	(SBT_1S / 1000000)
#define	SBT_1NS	(SBT_1S / 1000000000)
#define	SBT_MAX	INT64_MAX

static __inline int
sbintime_getsec(sbintime_t _sbt)
{

	return (_sbt >> 32);
}

static __inline sbintime_t
bttosbt(const struct bintime _bt)
{

	return (((sbintime_t)_bt.sec << 32) + (_bt.frac >> 32));
}

static __inline struct bintime
sbttobt(sbintime_t _sbt)
{
	struct bintime _bt;

	_bt.sec = _sbt >> 32;
	_bt.frac = _sbt << 32;
	return (_bt);
}

/*-
 * Background information:
 *
 * When converting between timestamps on parallel timescales of differing
 * resolutions it is historical and scientific practice to round down rather
 * than doing 4/5 rounding.
 *
 *   The date changes at midnight, not at noon.
 *
 *   Even at 15:59:59.999999999 it's not four'o'clock.
 *
 *   time_second ticks after N.999999999 not after N.4999999999
 */

static __inline void
bintime2timespec(const struct bintime *_bt, struct timespec *_ts)
{

	_ts->tv_sec = _bt->sec;
	_ts->tv_nsec = ((uint64_t)1000000000 *
	    (uint32_t)(_bt->frac >> 32)) >> 32;
}

static __inline void
timespec2bintime(const struct timespec *_ts, struct bintime *_bt)
{

	_bt->sec = _ts->tv_sec;
	/* 18446744073 = int(2^64 / 1000000000) */
	_bt->frac = _ts->tv_nsec * (uint64_t)18446744073LL;
}

static __inline void
bintime2timeval(const struct bintime *_bt, struct timeval *_tv)
{

	_tv->tv_sec = _bt->sec;
	_tv->tv_usec = ((uint64_t)1000000 * (uint32_t)(_bt->frac >> 32)) >> 32;
}

static __inline void
timeval2bintime(const struct timeval *_tv, struct bintime *_bt)
{

	_bt->sec = _tv->tv_sec;
	/* 18446744073709 = int(2^64 / 1000000) */
	_bt->frac = _tv->tv_usec * (uint64_t)18446744073709LL;
}

static __inline struct timespec
sbttots(sbintime_t _sbt)
{
	struct timespec _ts;

	_ts.tv_sec = _sbt >> 32;
	_ts.tv_nsec = ((uint64_t)1000000000 * (uint32_t)_sbt) >> 32;
	return (_ts);
}

static __inline sbintime_t
tstosbt(struct timespec _ts)
{

	return (((sbintime_t)_ts.tv_sec << 32) +
	    (_ts.tv_nsec * (((uint64_t)1 << 63) / 500000000) >> 32));
}

static __inline struct timeval
sbttotv(sbintime_t _sbt)
{
	struct timeval _tv;

	_tv.tv_sec = _sbt >> 32;
	_tv.tv_usec = ((uint64_t)1000000 * (uint32_t)_sbt) >> 32;
	return (_tv);
}

static __inline sbintime_t
tvtosbt(struct timeval _tv)
{

	return (((sbintime_t)_tv.tv_sec << 32) +
	    (_tv.tv_usec * (((uint64_t)1 << 63) / 500000) >> 32));
}
#endif /* __BSD_VISIBLE */
# 243 "/usr/include/sys/time.h" 3 4

#ifdef _KERNEL

/* Operations on timespecs */
#define	timespecclear(tvp)	((tvp)->tv_sec = (tvp)->tv_nsec = 0)
#define	timespecisset(tvp)	((tvp)->tv_sec || (tvp)->tv_nsec)
#define	timespeccmp(tvp, uvp, cmp)					\
	(((tvp)->tv_sec == (uvp)->tv_sec) ?				\
	    ((tvp)->tv_nsec cmp (uvp)->tv_nsec) :			\
	    ((tvp)->tv_sec cmp (uvp)->tv_sec))
#define	timespecadd(vvp, uvp)						\
	do {								\
		(vvp)->tv_sec += (uvp)->tv_sec;				\
		(vvp)->tv_nsec += (uvp)->tv_nsec;			\
		if ((vvp)->tv_nsec >= 1000000000) {			\
			(vvp)->tv_sec++;				\
			(vvp)->tv_nsec -= 1000000000;			\
		}							\
	} while (0)
#define	timespecsub(vvp, uvp)						\
	do {								\
		(vvp)->tv_sec -= (uvp)->tv_sec;				\
		(vvp)->tv_nsec -= (uvp)->tv_nsec;			\
		if ((vvp)->tv_nsec < 0) {				\
			(vvp)->tv_sec--;				\
			(vvp)->tv_nsec += 1000000000;			\
		}							\
	} while (0)

/* Operations on timevals. */

#define	timevalclear(tvp)		((tvp)->tv_sec = (tvp)->tv_usec = 0)
#define	timevalisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)
#define	timevalcmp(tvp, uvp, cmp)					\
	(((tvp)->tv_sec == (uvp)->tv_sec) ?				\
	    ((tvp)->tv_usec cmp (uvp)->tv_usec) :			\
	    ((tvp)->tv_sec cmp (uvp)->tv_sec))

/* timevaladd and timevalsub are not inlined */

#endif /* _KERNEL */
# 284 "/usr/include/sys/time.h" 3 4

#ifndef _KERNEL			/* NetBSD/OpenBSD compatible interfaces */

#define	timerclear(tvp)		((tvp)->tv_sec = (tvp)->tv_usec = 0)
#define	timerisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)
#define	timercmp(tvp, uvp, cmp)					\
	(((tvp)->tv_sec == (uvp)->tv_sec) ?				\
	    ((tvp)->tv_usec cmp (uvp)->tv_usec) :			\
	    ((tvp)->tv_sec cmp (uvp)->tv_sec))
#define	timeradd(tvp, uvp, vvp)						\
	do {								\
		(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;		\
		(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;	\
		if ((vvp)->tv_usec >= 1000000) {			\
			(vvp)->tv_sec++;				\
			(vvp)->tv_usec -= 1000000;			\
		}							\
	} while (0)
#define	timersub(tvp, uvp, vvp)						\
	do {								\
		(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;		\
		(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;	\
		if ((vvp)->tv_usec < 0) {				\
			(vvp)->tv_sec--;				\
			(vvp)->tv_usec += 1000000;			\
		}							\
	} while (0)
#endif
# 312 "/usr/include/sys/time.h" 3 4

/*
 * Names of the interval timers, and structure
 * defining a timer setting.
 */
#define	ITIMER_REAL	0
#define	ITIMER_VIRTUAL	1
#define	ITIMER_PROF	2

struct itimerval {
	struct	timeval it_interval;	/* timer interval */
	struct	timeval it_value;	/* current value */
};

/*
 * Getkerninfo clock information structure
 */
struct clockinfo {
	int	hz;		/* clock frequency */
	int	tick;		/* micro-seconds per hz tick */
	int	spare;
	int	stathz;		/* statistics clock frequency */
	int	profhz;		/* profiling clock frequency */
};

/* These macros are also in time.h. */
#ifndef CLOCK_REALTIME
#define	CLOCK_REALTIME	0
#define	CLOCK_VIRTUAL	1
#define	CLOCK_PROF	2
#define	CLOCK_MONOTONIC	4
#define	CLOCK_UPTIME	5		/* FreeBSD-specific. */
#define	CLOCK_UPTIME_PRECISE	7	/* FreeBSD-specific. */
#define	CLOCK_UPTIME_FAST	8	/* FreeBSD-specific. */
#define	CLOCK_REALTIME_PRECISE	9	/* FreeBSD-specific. */
#define	CLOCK_REALTIME_FAST	10	/* FreeBSD-specific. */
#define	CLOCK_MONOTONIC_PRECISE	11	/* FreeBSD-specific. */
#define	CLOCK_MONOTONIC_FAST	12	/* FreeBSD-specific. */
#define	CLOCK_SECOND	13		/* FreeBSD-specific. */
#define	CLOCK_THREAD_CPUTIME_ID	14
#define	CLOCK_PROCESS_CPUTIME_ID	15
#endif
# 354 "/usr/include/sys/time.h" 3 4

#ifndef TIMER_ABSTIME
#define	TIMER_RELTIME	0x0	/* relative timer */
#define	TIMER_ABSTIME	0x1	/* absolute timer */
#endif
# 359 "/usr/include/sys/time.h" 3 4

#if __BSD_VISIBLE
#define	CPUCLOCK_WHICH_PID	0
#define	CPUCLOCK_WHICH_TID	1
#endif
# 364 "/usr/include/sys/time.h" 3 4

#ifdef _KERNEL

/*
 * Kernel to clock driver interface.
 */
void	inittodr(time_t base);
void	resettodr(void);

extern volatile time_t	time_second;
extern volatile time_t	time_uptime;
extern struct bintime boottimebin;
extern struct timeval boottime;
extern struct bintime tc_tick_bt;
extern sbintime_t tc_tick_sbt;
extern struct bintime tick_bt;
extern sbintime_t tick_sbt;
extern int tc_precexp;
extern int tc_timepercentage;
extern struct bintime bt_timethreshold;
extern struct bintime bt_tickthreshold;
extern sbintime_t sbt_timethreshold;
extern sbintime_t sbt_tickthreshold;

/*
 * Functions for looking at our clock: [get]{bin,nano,micro}[up]time()
 *
 * Functions without the "get" prefix returns the best timestamp
 * we can produce in the given format.
 *
 * "bin"   == struct bintime  == seconds + 64 bit fraction of seconds.
 * "nano"  == struct timespec == seconds + nanoseconds.
 * "micro" == struct timeval  == seconds + microseconds.
 *
 * Functions containing "up" returns time relative to boot and
 * should be used for calculating time intervals.
 *
 * Functions without "up" returns GMT time.
 *
 * Functions with the "get" prefix returns a less precise result
 * much faster than the functions without "get" prefix and should
 * be used where a precision of 1/hz seconds is acceptable or where
 * performance is priority. (NB: "precision", _not_ "resolution" !)
 */

void	binuptime(struct bintime *bt);
void	nanouptime(struct timespec *tsp);
void	microuptime(struct timeval *tvp);

static __inline sbintime_t
sbinuptime(void)
{
	struct bintime _bt;

	binuptime(&_bt);
	return (bttosbt(_bt));
}

void	bintime(struct bintime *bt);
void	nanotime(struct timespec *tsp);
void	microtime(struct timeval *tvp);

void	getbinuptime(struct bintime *bt);
void	getnanouptime(struct timespec *tsp);
void	getmicrouptime(struct timeval *tvp);

static __inline sbintime_t
getsbinuptime(void)
{
	struct bintime _bt;

	getbinuptime(&_bt);
	return (bttosbt(_bt));
}

void	getbintime(struct bintime *bt);
void	getnanotime(struct timespec *tsp);
void	getmicrotime(struct timeval *tvp);

/* Other functions */
int	itimerdecr(struct itimerval *itp, int usec);
int	itimerfix(struct timeval *tv);
int	ppsratecheck(struct timeval *, int *, int);
int	ratecheck(struct timeval *, const struct timeval *);
void	timevaladd(struct timeval *t1, const struct timeval *t2);
void	timevalsub(struct timeval *t1, const struct timeval *t2);
int	tvtohz(struct timeval *tv);

#define	TC_DEFAULTPERC		5

#define	BT2FREQ(bt)                                                     \
	(((uint64_t)0x8000000000000000 + ((bt)->frac >> 2)) /           \
	    ((bt)->frac >> 1))

#define	SBT2FREQ(sbt)	((SBT_1S + ((sbt) >> 1)) / (sbt))

#define	FREQ2BT(freq, bt)                                               \
{									\
	(bt)->sec = 0;                                                  \
	(bt)->frac = ((uint64_t)0x8000000000000000  / (freq)) << 1;     \
}

#define	TIMESEL(sbt, sbt2)						\
	(((sbt2) >= sbt_timethreshold) ?				\
	    ((*(sbt) = getsbinuptime()), 1) : ((*(sbt) = sbinuptime()), 0))

#else /* !_KERNEL */
# 471 "/usr/include/sys/time.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <time.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/time.h" 1 3 4
/*
 * Copyright (c) 1989, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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. 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.
 *
 *	@(#)time.h	8.3 (Berkeley) 1/21/94
 */

/*
 * $FreeBSD: head/include/time.h 245428 2013-01-14 18:01:19Z dim $
 */

#ifndef _TIME_H_
#define	_TIME_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 45 "/usr/include/time.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_null.h>
#endif /* expanded by -frewrite-includes */
# 46 "/usr/include/time.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 47 "/usr/include/time.h" 3 4

#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
/*
 * Frequency of the clock ticks reported by times().  Deprecated - use
 * sysconf(_SC_CLK_TCK) instead.  (Removed in 1003.1-2001.)
 */
#define	CLK_TCK		128
#endif
# 55 "/usr/include/time.h" 3 4

/* Frequency of the clock ticks reported by clock().  */
#define	CLOCKS_PER_SEC	128

#ifndef _CLOCK_T_DECLARED
typedef	__clock_t	clock_t;
#define	_CLOCK_T_DECLARED
#endif
# 63 "/usr/include/time.h" 3 4

#ifndef _TIME_T_DECLARED
typedef	__time_t	time_t;
#define	_TIME_T_DECLARED
#endif
# 68 "/usr/include/time.h" 3 4

#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 73 "/usr/include/time.h" 3 4

#if __POSIX_VISIBLE >= 199309
/*
 * New in POSIX 1003.1b-1993.
 */
#ifndef _CLOCKID_T_DECLARED
typedef	__clockid_t	clockid_t;
#define	_CLOCKID_T_DECLARED
#endif
# 82 "/usr/include/time.h" 3 4

#ifndef _TIMER_T_DECLARED
typedef	__timer_t	timer_t;
#define	_TIMER_T_DECLARED
#endif
# 87 "/usr/include/time.h" 3 4

#if 0 /* expanded by -frewrite-includes */
#include <sys/timespec.h>
#endif /* expanded by -frewrite-includes */
# 89 "/usr/include/time.h" 3 4
#endif /* __POSIX_VISIBLE >= 199309 */
# 90 "/usr/include/time.h" 3 4

#if __POSIX_VISIBLE >= 200112
#ifndef _PID_T_DECLARED
typedef	__pid_t		pid_t;
#define	_PID_T_DECLARED
#endif
# 96 "/usr/include/time.h" 3 4
#endif
# 97 "/usr/include/time.h" 3 4

/* These macros are also in sys/time.h. */
#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112
#define CLOCK_REALTIME	0
#ifdef __BSD_VISIBLE
#define CLOCK_VIRTUAL	1
#define CLOCK_PROF	2
#endif
# 105 "/usr/include/time.h" 3 4
#define CLOCK_MONOTONIC	4
#define CLOCK_UPTIME	5		/* FreeBSD-specific. */
#define CLOCK_UPTIME_PRECISE	7	/* FreeBSD-specific. */
#define CLOCK_UPTIME_FAST	8	/* FreeBSD-specific. */
#define CLOCK_REALTIME_PRECISE	9	/* FreeBSD-specific. */
#define CLOCK_REALTIME_FAST	10	/* FreeBSD-specific. */
#define CLOCK_MONOTONIC_PRECISE	11	/* FreeBSD-specific. */
#define CLOCK_MONOTONIC_FAST	12	/* FreeBSD-specific. */
#define CLOCK_SECOND	13		/* FreeBSD-specific. */
#define CLOCK_THREAD_CPUTIME_ID	14
#define	CLOCK_PROCESS_CPUTIME_ID	15
#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */
# 117 "/usr/include/time.h" 3 4

#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112
#if __BSD_VISIBLE
#define TIMER_RELTIME	0x0	/* relative timer */
#endif
# 122 "/usr/include/time.h" 3 4
#define TIMER_ABSTIME	0x1	/* absolute timer */
#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */
# 124 "/usr/include/time.h" 3 4

struct tm {
	int	tm_sec;		/* seconds after the minute [0-60] */
	int	tm_min;		/* minutes after the hour [0-59] */
	int	tm_hour;	/* hours since midnight [0-23] */
	int	tm_mday;	/* day of the month [1-31] */
	int	tm_mon;		/* months since January [0-11] */
	int	tm_year;	/* years since 1900 */
	int	tm_wday;	/* days since Sunday [0-6] */
	int	tm_yday;	/* days since January 1 [0-365] */
	int	tm_isdst;	/* Daylight Savings Time flag */
	long	tm_gmtoff;	/* offset from UTC in seconds */
	char	*tm_zone;	/* timezone abbreviation */
};

#if __POSIX_VISIBLE
extern char *tzname[];
#endif
# 142 "/usr/include/time.h" 3 4

__BEGIN_DECLS
char *asctime(const struct tm *);
clock_t clock(void);
char *ctime(const time_t *);
double difftime(time_t, time_t);
/* XXX missing: getdate() */
struct tm *gmtime(const time_t *);
struct tm *localtime(const time_t *);
time_t mktime(struct tm *);
size_t strftime(char * __restrict, size_t, const char * __restrict,
    const struct tm * __restrict);
time_t time(time_t *);
#if __POSIX_VISIBLE >= 200112
struct sigevent;
int timer_create(clockid_t, struct sigevent *__restrict, timer_t *__restrict);
int timer_delete(timer_t);
int timer_gettime(timer_t, struct itimerspec *);
int timer_getoverrun(timer_t);
int timer_settime(timer_t, int, const struct itimerspec *__restrict,
	struct itimerspec *__restrict);
#endif
# 164 "/usr/include/time.h" 3 4
#if __POSIX_VISIBLE
void tzset(void);
#endif
# 167 "/usr/include/time.h" 3 4

#if __POSIX_VISIBLE >= 199309
int clock_getres(clockid_t, struct timespec *);
int clock_gettime(clockid_t, struct timespec *);
int clock_settime(clockid_t, const struct timespec *);
/* XXX missing: clock_nanosleep() */
int nanosleep(const struct timespec *, struct timespec *);
#endif /* __POSIX_VISIBLE >= 199309 */
# 175 "/usr/include/time.h" 3 4

#if __POSIX_VISIBLE >= 200112
int clock_getcpuclockid(pid_t, clockid_t *);
#endif
# 179 "/usr/include/time.h" 3 4

#if __POSIX_VISIBLE >= 199506
char *asctime_r(const struct tm *, char *);
char *ctime_r(const time_t *, char *);
struct tm *gmtime_r(const time_t *, struct tm *);
struct tm *localtime_r(const time_t *, struct tm *);
#endif
# 186 "/usr/include/time.h" 3 4

#if __XSI_VISIBLE
char *strptime(const char * __restrict, const char * __restrict,
    struct tm * __restrict);
#endif
# 191 "/usr/include/time.h" 3 4

#if __BSD_VISIBLE
char *timezone(int, int);	/* XXX XSI conflict */
void tzsetwall(void);
time_t timelocal(struct tm * const);
time_t timegm(struct tm * const);
#endif /* __BSD_VISIBLE */
# 198 "/usr/include/time.h" 3 4

#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#if 0 /* expanded by -frewrite-includes */
#include <xlocale/_time.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/xlocale/_time.h" 1 3 4
/*-
 * Copyright (c) 2011, 2012 The FreeBSD Foundation
 * All rights reserved.
 *
 * This software was developed by David Chisnall under sponsorship from
 * the FreeBSD Foundation.
 *
 * 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: head/include/xlocale/_time.h 231673 2012-02-14 12:03:23Z theraven $
 */

#ifndef _LOCALE_T_DEFINED
#define _LOCALE_T_DEFINED
typedef struct	_xlocale *locale_t;
#endif
# 36 "/usr/include/xlocale/_time.h" 3 4

/*
 * This file is included from both locale.h and xlocale.h.  We need to expose
 * the declarations unconditionally if we are included from xlocale.h, but only
 * if we are in POSIX2008 mode if included from locale.h.
 */
#ifndef _XLOCALE_LOCALE1_H
#define _XLOCALE_LOCALE1_H

size_t	 strftime_l(char * __restrict, size_t, const char * __restrict,
	    const struct tm * __restrict, locale_t) __strftimelike(3, 0);

#endif /* _XLOCALE_LOCALE1_H */
# 49 "/usr/include/xlocale/_time.h" 3 4

#ifdef _XLOCALE_H_
#ifndef _XLOCALE_LOCALE2_H
#define _XLOCALE_LOCALE2_H

char	*strptime_l(const char * __restrict, const char * __restrict,
           struct tm * __restrict, locale_t);

#endif /* _XLOCALE_LOCALE2_H */
# 58 "/usr/include/xlocale/_time.h" 3 4
#endif /* _XLOCALE_H_ */
# 59 "/usr/include/xlocale/_time.h" 3 4
# 201 "/usr/include/time.h" 2 3 4
#endif
# 202 "/usr/include/time.h" 3 4
__END_DECLS

#endif /* !_TIME_H_ */
# 205 "/usr/include/time.h" 3 4
# 472 "/usr/include/sys/time.h" 2 3 4

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 474 "/usr/include/sys/time.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/select.h>
#endif /* expanded by -frewrite-includes */
# 475 "/usr/include/sys/time.h" 3 4

__BEGIN_DECLS
int	setitimer(int, const struct itimerval *, struct itimerval *);
int	utimes(const char *, const struct timeval *);

#if __BSD_VISIBLE
int	adjtime(const struct timeval *, struct timeval *);
int	clock_getcpuclockid2(id_t, int, clockid_t *);
int	futimes(int, const struct timeval *);
int	futimesat(int, const char *, const struct timeval [2]);
int	lutimes(const char *, const struct timeval *);
int	settimeofday(const struct timeval *, const struct timezone *);
#endif
# 488 "/usr/include/sys/time.h" 3 4

#if __XSI_VISIBLE
int	getitimer(int, struct itimerval *);
int	gettimeofday(struct timeval *, struct timezone *);
#endif
# 493 "/usr/include/sys/time.h" 3 4

__END_DECLS

#endif /* !_KERNEL */
# 497 "/usr/include/sys/time.h" 3 4

#endif /* !_SYS_TIME_H_ */
# 499 "/usr/include/sys/time.h" 3 4
# 37 "/usr/home/kaduk/openafs/build/include/lwp.h" 2
# ifndef FD_SET
#if 0 /* expanded by -frewrite-includes */
#  include <sys/select.h>	/* fd_set on newer platforms */
#endif /* expanded by -frewrite-includes */
# 39 "/usr/home/kaduk/openafs/build/include/lwp.h"
# endif
# 40 "/usr/home/kaduk/openafs/build/include/lwp.h"
#endif
# 41 "/usr/home/kaduk/openafs/build/include/lwp.h"

/* fasttime.c */
extern int FT_GetTimeOfDay(struct timeval *tv, struct timezone *tz);
extern int FT_Init(int printErrors, int notReally);
extern int FT_AGetTimeOfDay(struct timeval *tv, struct timezone *tz);
extern unsigned int FT_ApproxTime(void);

#if !defined(AFS_PTHREAD_ENV)
# if defined(USE_UCONTEXT) && defined(HAVE_UCONTEXT_H)
#if 0 /* expanded by -frewrite-includes */
#  include <ucontext.h>
#endif /* expanded by -frewrite-includes */
# 51 "/usr/home/kaduk/openafs/build/include/lwp.h"
# else
# 52 "/usr/home/kaduk/openafs/build/include/lwp.h"
#if 0 /* expanded by -frewrite-includes */
#  include <setjmp.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/setjmp.h" 1 3 4
/*-
 * Copyright (c) 1990, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * 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. 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.
 *
 *	@(#)setjmp.h	8.2 (Berkeley) 1/21/94
 * $FreeBSD: head/include/setjmp.h 265878 2014-05-11 13:48:21Z jilles $
 */

#ifndef _SETJMP_H_
#define _SETJMP_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 42 "/usr/include/setjmp.h" 3 4

/* The size of the jmp_buf is machine dependent: */
#if 0 /* expanded by -frewrite-includes */
#include <machine/setjmp.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/setjmp.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/setjmp.h 232275 2012-02-28 22:17:52Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/setjmp.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/x86/setjmp.h" 1 3 4
/*-
 * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
 * 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.
 * 3. Neither the name of the author nor the names of any co-contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
 *
 * $FreeBSD: head/sys/x86/include/setjmp.h 232275 2012-02-28 22:17:52Z tijl $
 */

#ifndef _MACHINE_SETJMP_H_
#define	_MACHINE_SETJMP_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 36 "/usr/include/x86/setjmp.h" 3 4

#define	_JBLEN	12		/* Size of the jmp_buf on AMD64. */

/*
 * jmp_buf and sigjmp_buf are encapsulated in different structs to force
 * compile-time diagnostics for mismatches.  The structs are the same
 * internally to avoid some run-time errors for mismatches.
 */
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
typedef	struct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1];
#endif
# 47 "/usr/include/x86/setjmp.h" 3 4

typedef	struct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1];

#endif /* !_MACHINE_SETJMP_H_ */
# 51 "/usr/include/x86/setjmp.h" 3 4
# 7 "/usr/include/machine/setjmp.h" 2 3 4
# 45 "/usr/include/setjmp.h" 2 3 4

__BEGIN_DECLS
#if __XSI_VISIBLE >= 600
void	_longjmp(jmp_buf, int) __dead2;
int	_setjmp(jmp_buf) __returns_twice;
#endif
# 51 "/usr/include/setjmp.h" 3 4
void	longjmp(jmp_buf, int) __dead2;
#if __BSD_VISIBLE
void	longjmperror(void);
#endif
# 55 "/usr/include/setjmp.h" 3 4
int	setjmp(jmp_buf) __returns_twice;
#if __POSIX_VISIBLE || __XSI_VISIBLE
void	siglongjmp(sigjmp_buf, int) __dead2;
int	sigsetjmp(sigjmp_buf, int) __returns_twice;
#endif
# 60 "/usr/include/setjmp.h" 3 4
__END_DECLS

#endif /* !_SETJMP_H_ */
# 63 "/usr/include/setjmp.h" 3 4
# 53 "/usr/home/kaduk/openafs/build/include/lwp.h" 2
# endif
# 54 "/usr/home/kaduk/openafs/build/include/lwp.h"

#define LWP_SUCCESS	0
#define LWP_EBADPID	-1
#define LWP_EBLOCKED	-2
#define LWP_EINIT	-3
#define LWP_EMAXPROC	-4
#define LWP_ENOBLOCK	-5
#define LWP_ENOMEM	-6
#define LWP_ENOPROCESS	-7
#define LWP_ENOWAIT	-8
#define LWP_EBADCOUNT	-9
#define LWP_EBADEVENT	-10
#define LWP_EBADPRI	-11
#define LWP_NO_STACK	-12
/* These two are for the signal mechanism. */
#define LWP_EBADSIG	-13	/* bad signal number */
#define LWP_ESYSTEM	-14	/* system call failed */
/* These are for the rock mechanism */
#define LWP_ENOROCKS	-15	/* all rocks are in use */
#define LWP_EBADROCK	-16	/* the specified rock does not exist */

/* Maximum priority permissible (minimum is always 0) */
#define LWP_MAX_PRIORITY 4	/* changed from 1 */

/* Usual priority used by user LWPs */
#define LWP_NORMAL_PRIORITY (LWP_MAX_PRIORITY-2)

/* Initial size of eventlist in a PCB; grows dynamically  */
#define EVINITSIZE  5

typedef struct lwp_pcb *PROCESS;

#ifdef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
#include <windef.h>
#endif /* expanded by -frewrite-includes */
# 88 "/usr/home/kaduk/openafs/build/include/lwp.h"
typedef struct lwp_pcb {
    char name[32];		/* name of LWP */
    LPVOID fiber;
    int (*funP) ();		/* function to execute on this LWP */
    void *argP;			/* argument for function */
    int priority;		/* LWP priority */
    int stacksize;		/* Just for reference. */
    /* the following are used for scheduling */
    int status:8;
    int eventlistsize:8;
    int eventcnt:8;
    int padding:8;
    void **eventlist;
    int wakevent;
    int waitcnt;
    struct lwp_pcb *next, *prev;
    struct IoRequest *iomgrRequest;
    int index;			/* new number (++) for each process created. */
} lwp_pcb_t;

#else
# 109 "/usr/home/kaduk/openafs/build/include/lwp.h"
struct lwp_context {		/* saved context for dispatcher */
    char *topstack;		/* ptr to top of process stack */
#if defined(USE_UCONTEXT) && defined(HAVE_UCONTEXT_H)
    ucontext_t ucontext;
    int state;
#else				/* !HAVE_UCONTEXT_H */
# 115 "/usr/home/kaduk/openafs/build/include/lwp.h"
# if defined(sparc) && !defined(__linux__)
# ifdef	save_allregs
    int globals[7 + 1 + 32 + 2 + 32 + 2];	/* g1-g7, y reg, f0-f31, fsr, fq, c0-c31, csr, cq. */
# else
# 119 "/usr/home/kaduk/openafs/build/include/lwp.h"
    int globals[8];		/* g1-g7 and y registers. */
# endif
# 121 "/usr/home/kaduk/openafs/build/include/lwp.h"
# endif
# 122 "/usr/home/kaduk/openafs/build/include/lwp.h"
    jmp_buf setjmp_buffer;
#endif				/* HAVE_UCONTEXT_H */
# 124 "/usr/home/kaduk/openafs/build/include/lwp.h"
};

struct rock {			/* to hide things associated with this LWP under */
    int tag;			/* unique identifier for this rock */
    char *value;		/* pointer to some arbitrary data structure */
};

#define MAXROCKS	4	/* max no. of rocks per LWP */

struct lwp_pcb {		/* process control block */
    char name[32];		/* ASCII name */
    int rc;			/* most recent return code */
    char status;		/* status flags */
    char blockflag;		/* if (blockflag), process blocked */
    char eventlistsize;		/* size of eventlist array */
    char padding;		/* force 32-bit alignment */
    void **eventlist;		/* ptr to array of eventids */
    int eventcnt;		/* no. of events currently in eventlist array */
    int wakevent;		/* index of eventid causing wakeup */
    int waitcnt;		/* min number of events awaited */
    int priority;		/* dispatching priority */
    struct lwp_pcb *misc;	/* for LWP internal use only */
    char *stack;		/* ptr to process stack */
    int stacksize;		/* size of stack */
    int stackcheck;		/* first word of stack for overflow checking */
    void *(*ep)(void *);	/* initial entry point */
    char *parm;			/* initial parm for process */
    struct lwp_context
      context;			/* saved context for next dispatch */
    int lwp_rused;		/* no of rocks presently in use */
    struct rock lwp_rlist[MAXROCKS];	/* set of rocks to hide things under */
    struct lwp_pcb *next, *prev;	/* ptrs to next and previous pcb */
    int level;			/* nesting level of critical sections */
    struct IoRequest *iomgrRequest;	/* request we're waiting for */
    int index;			/* LWP index: should be small index; actually is
				 * incremented on each lwp_create_process */
};
#endif /* AFS_NT40_ENV */
# 162 "/usr/home/kaduk/openafs/build/include/lwp.h"

extern int lwp_nextindex;	/* Next lwp index to assign */


#ifndef LWP_KERNEL
#define LWP_ActiveProcess	(lwp_cpptr+0)
#define LWP_Index() (LWP_ActiveProcess->index)
#define LWP_HighestIndex() (lwp_nextindex - 1)
#ifndef	AFS_SUN5_ENV		/* Actual functions for solaris */
#define LWP_SignalProcess(event)	LWP_INTERNALSIGNAL(event, 1)
#define LWP_NoYieldSignal(event)	LWP_INTERNALSIGNAL(event, 0)
#endif
# 174 "/usr/home/kaduk/openafs/build/include/lwp.h"

extern
#endif
# 177 "/usr/home/kaduk/openafs/build/include/lwp.h"
struct lwp_pcb *lwp_cpptr;	/* pointer to current process pcb */

struct lwp_ctl {		/* LWP control structure */
    int processcnt;		/* number of lightweight processes */
    char *outersp;		/* outermost stack pointer */
    struct lwp_pcb *outerpid;	/* process carved by Initialize */
    struct lwp_pcb *first, last;	/* ptrs to first and last pcbs */
#ifdef __hp9000s800
    double dsptchstack[200];	/* stack for dispatcher use only */
    /* force 8 byte alignment        */
#else
# 188 "/usr/home/kaduk/openafs/build/include/lwp.h"
    char dsptchstack[800];	/* stack for dispatcher use only */
#endif
# 190 "/usr/home/kaduk/openafs/build/include/lwp.h"
};

#ifndef LWP_KERNEL
extern
#endif
# 195 "/usr/home/kaduk/openafs/build/include/lwp.h"
char lwp_debug;			/* ON = show LWP debugging trace */

/*
 * Under hpux, any stack size smaller than 16K seems prone to
 * overflow problems.
 *
 * On Solaris 2.5, gethostbyname() can use up to 21920 bytes of stack
 * space.  Note: when measuring this, it is important to check the
 * amount of stack space it uses for hosts that are known as well as
 * for hosts that are unknown; the stack usage can differ between these
 * cases, and also between machines apparently running the same OS
 * version.
 */
/*
 * On ia64 where the ucontext is used, it can be an extra 48K
 * Need to account for this.  There might be two of these on the
 * stack too. This needs to be checked.
 */
#if defined(USE_UCONTEXT) && defined(HAVE_UCONTEXT_H)
#define AFS_LWP_MINSTACKSIZE  (288 * 1024)
#elif defined(AFS_LINUX22_ENV)
# 216 "/usr/home/kaduk/openafs/build/include/lwp.h"
#define AFS_LWP_MINSTACKSIZE	(192 * 1024)
#else
# 218 "/usr/home/kaduk/openafs/build/include/lwp.h"
#define AFS_LWP_MINSTACKSIZE	(48 * 1024)
#endif
# 220 "/usr/home/kaduk/openafs/build/include/lwp.h"

/* Action to take on stack overflow. */
#define LWP_SOQUIET	1	/* do nothing */
#define LWP_SOABORT	2	/* abort the program */
#define LWP_SOMESSAGE	3	/* print a message and be quiet */
extern int lwp_overflowAction;

/* Tells if stack size counting is enabled. */
extern int lwp_stackUseEnabled;
extern int lwp_MaxStackSeen;

#ifndef	AFS_AIX32_ENV
#define	LWP_CreateProcess2(a, b, c, d, e, f)	\
	LWP_CreateProcess((a), (b), (c), (d), (e), (f))
#endif
# 235 "/usr/home/kaduk/openafs/build/include/lwp.h"

/* iomgr.c */
extern fd_set *IOMGR_AllocFDSet(void);
extern int IOMGR_Select(int nfds, fd_set * rfds, fd_set * wfds, fd_set * efds,
			struct timeval *tvp);
extern int IOMGR_Poll(void);
extern void IOMGR_Sleep(int seconds);
extern int IOMGR_Cancel(PROCESS pid);
extern int IOMGR_Initialize(void);
extern void IOMGR_FreeFDSet(fd_set * fds);
extern int IOMGR_SoftSig(void *(*aproc) (void *), void *arock);

#ifdef AFS_NT40_ENV
/* lwp.c */
extern int LWP_InitializeProcessSupport(int priority, PROCESS * pid);
extern int LWP_CreateProcess(int (*funP) (), int stacksize, int priority,
			     void *argP, char *name, PROCESS * pid);
extern int LWP_DestroyProcess(PROCESS pid);
extern int LWP_DispatchProcess(void);
extern int LWP_WaitProcess(void *event);
extern int LWP_INTERNALSIGNAL(void *event, int yield);
extern int LWP_QWait(void);
extern int LWP_QSignal(PROCESS pid);
#else
# 259 "/usr/home/kaduk/openafs/build/include/lwp.h"
extern int LWP_CurrentProcess(PROCESS * pid);
extern int LWP_INTERNALSIGNAL(void *event, int yield);
extern int LWP_InitializeProcessSupport(int priority, PROCESS * pid);
extern int LWP_CreateProcess(void *(*ep)(void *), int stacksize, int priority,
			     void *parm, char *name, PROCESS * pid);
extern int LWP_DestroyProcess(PROCESS pid);
extern int LWP_DispatchProcess(void);
extern int LWP_WaitProcess(void *event);
extern PROCESS LWP_ThreadId(void);
extern int LWP_QWait(void);
extern int LWP_QSignal(PROCESS pid);
#endif
# 271 "/usr/home/kaduk/openafs/build/include/lwp.h"

extern afs_int32 savecontext(void (*ep)(void),
			     struct lwp_context *savearea, char *sp);
extern void returnto(struct lwp_context *savearea);

#ifdef AFS_LINUX24_ENV
/* max time we are allowed to spend in a select call on Linux to avoid
 lost signal issues */
#define IOMGR_MAXWAITTIME        60	/* seconds */
#else
# 281 "/usr/home/kaduk/openafs/build/include/lwp.h"
/* max time we are allowed to spend in a select call on NT */
#define IOMGR_MAXWAITTIME        5	/* seconds */
#endif
# 284 "/usr/home/kaduk/openafs/build/include/lwp.h"

/* max time we spend on a select in a Win95 DOS box */
#define IOMGR_WIN95WAITTIME 5000	/* microseconds */

#endif /* !AFS_PTHREAD_ENV */
# 289 "/usr/home/kaduk/openafs/build/include/lwp.h"

extern int LWP_WaitForKeystroke(int seconds);	/* -1 => forever */
extern int LWP_GetResponseKey(int seconds, char *key);
extern int LWP_GetLine(char *linebuf, int len);

#endif /* !KERNEL && !_KMEMUSER */
# 295 "/usr/home/kaduk/openafs/build/include/lwp.h"
#endif /* __LWP_INCLUDE_ */
# 296 "/usr/home/kaduk/openafs/build/include/lwp.h"
# 20 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h" 2
/* These routines are no-ops in the user level implementation */
#define SPLVAR
#define NETPRI
#define USERPRI
#define AFS_GLOCK()
#define AFS_GUNLOCK()
#define AFS_ASSERT_GLOCK()
#ifndef UKERNEL
/* Defined in rx/UKERNEL/rx_kmutex.h */
#define ISAFS_GLOCK()
#endif
# 31 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"
/* Some "operating-system independent" stuff, for the user mode implementation */
#ifdef UAFS_CLIENT
typedef void *osi_socket;
#define	OSI_NULLSOCKET	((osi_socket) 0)
#else /* UAFS_CLIENT */
# 36 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"
#ifdef AFS_NT40_ENV
typedef SOCKET osi_socket;
#define OSI_NULLSOCKET INVALID_SOCKET
#else /* !AFS_NT40_ENV */
# 40 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"
typedef afs_int32 osi_socket;
#define	OSI_NULLSOCKET	((osi_socket) -1)
#endif /* !AFS_NT40_ENV */
# 43 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"
#endif /* UAFS_CLIENT */
# 44 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"

#define	osi_rxSleep(x)		    rxi_Sleep(x)
#define	osi_rxWakeup(x)		    rxi_Wakeup(x)

#ifndef	AFS_AIX32_ENV

#ifndef osi_Alloc
#define	osi_Alloc(size)		    malloc(size)
#endif
# 53 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"

#ifndef osi_Free
#define	osi_Free(ptr, size)	    free(ptr)
#endif
# 57 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"

#endif
# 59 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"

#define	osi_GetTime(timevalptr)	    gettimeofday(timevalptr, 0)

/* Just in case it's possible to distinguish between relatively long-lived stuff and stuff which will be freed very soon, but which needs quick allocation (e.g. dynamically allocated xdr things) */
#define	osi_QuickFree(ptr, size)    osi_Free(ptr, size)
#define	osi_QuickAlloc(size)	    osi_Alloc(size)

#define osi_Assert(e) opr_Assert(e)

#define	osi_Msg			    fprintf)(stderr,
#define osi_VMsg		    vfprintf)(stderr,

#endif /* RX_USER_INCLUDE */
# 72 "/usr/home/kaduk/openafs/build/include/rx/rx_user.h"
# 49 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2
#ifndef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
# include <netinet/in.h>
#endif /* expanded by -frewrite-includes */
# 51 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/socket.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/socket.h" 1 3 4
/*-
 * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)socket.h	8.4 (Berkeley) 2/21/94
 * $FreeBSD: head/sys/sys/socket.h 262489 2014-02-25 18:44:33Z jhb $
 */

#ifndef _SYS_SOCKET_H_
#define	_SYS_SOCKET_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/sys/socket.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/include/sys/socket.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_iovec.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/_iovec.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1993, 1994
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)uio.h	8.5 (Berkeley) 2/22/94
 * $FreeBSD: head/sys/sys/_iovec.h 139825 2005-01-07 02:29:27Z imp $
 */

#ifndef _SYS__IOVEC_H_
#define	_SYS__IOVEC_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/sys/_iovec.h" 3 4

#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 42 "/usr/include/sys/_iovec.h" 3 4

struct iovec {
	void	*iov_base;	/* Base address. */
	size_t	 iov_len;	/* Length. */
};

#endif /* !_SYS__IOVEC_H_ */
# 49 "/usr/include/sys/_iovec.h" 3 4
# 39 "/usr/include/sys/socket.h" 2 3 4
#if 0 /* expanded by -frewrite-includes */
#include <machine/_align.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/_align.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/_align.h 215856 2010-11-26 10:59:20Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/_align.h>
#endif /* expanded by -frewrite-includes */
# 7 "/usr/include/machine/_align.h" 3 4
# 40 "/usr/include/sys/socket.h" 2 3 4

/*
 * Definitions related to sockets: types, address families, options.
 */

/*
 * Data types.
 */
#if __BSD_VISIBLE
#ifndef _GID_T_DECLARED
typedef	__gid_t		gid_t;
#define	_GID_T_DECLARED
#endif
# 53 "/usr/include/sys/socket.h" 3 4

#ifndef _OFF_T_DECLARED
typedef	__off_t		off_t;
#define	_OFF_T_DECLARED
#endif
# 58 "/usr/include/sys/socket.h" 3 4

#ifndef _PID_T_DECLARED
typedef	__pid_t		pid_t;
#define	_PID_T_DECLARED
#endif
# 63 "/usr/include/sys/socket.h" 3 4
#endif
# 64 "/usr/include/sys/socket.h" 3 4

#ifndef _SA_FAMILY_T_DECLARED
typedef	__sa_family_t	sa_family_t;
#define	_SA_FAMILY_T_DECLARED
#endif
# 69 "/usr/include/sys/socket.h" 3 4

#ifndef _SOCKLEN_T_DECLARED
typedef	__socklen_t	socklen_t;
#define	_SOCKLEN_T_DECLARED
#endif
# 74 "/usr/include/sys/socket.h" 3 4
 
#ifndef _SSIZE_T_DECLARED
typedef	__ssize_t	ssize_t;
#define	_SSIZE_T_DECLARED
#endif
# 79 "/usr/include/sys/socket.h" 3 4

#if __BSD_VISIBLE 
#ifndef _UID_T_DECLARED
typedef	__uid_t		uid_t;
#define	_UID_T_DECLARED
#endif
# 85 "/usr/include/sys/socket.h" 3 4
#endif
# 86 "/usr/include/sys/socket.h" 3 4

#ifndef _UINT32_T_DECLARED
typedef	__uint32_t	uint32_t;
#define	_UINT32_T_DECLARED
#endif
# 91 "/usr/include/sys/socket.h" 3 4

#ifndef _UINTPTR_T_DECLARED
typedef	__uintptr_t	uintptr_t;
#define	_UINTPTR_T_DECLARED
#endif
# 96 "/usr/include/sys/socket.h" 3 4

/*
 * Types
 */
#define	SOCK_STREAM	1		/* stream socket */
#define	SOCK_DGRAM	2		/* datagram socket */
#define	SOCK_RAW	3		/* raw-protocol interface */
#if __BSD_VISIBLE
#define	SOCK_RDM	4		/* reliably-delivered message */
#endif
# 106 "/usr/include/sys/socket.h" 3 4
#define	SOCK_SEQPACKET	5		/* sequenced packet stream */

#if __BSD_VISIBLE
/*
 * Creation flags, OR'ed into socket() and socketpair() type argument.
 */
#define	SOCK_CLOEXEC	0x10000000
#define	SOCK_NONBLOCK	0x20000000
#endif
# 115 "/usr/include/sys/socket.h" 3 4

/*
 * Option flags per-socket.
 */
#define	SO_DEBUG	0x0001		/* turn on debugging info recording */
#define	SO_ACCEPTCONN	0x0002		/* socket has had listen() */
#define	SO_REUSEADDR	0x0004		/* allow local address reuse */
#define	SO_KEEPALIVE	0x0008		/* keep connections alive */
#define	SO_DONTROUTE	0x0010		/* just use interface addresses */
#define	SO_BROADCAST	0x0020		/* permit sending of broadcast msgs */
#if __BSD_VISIBLE
#define	SO_USELOOPBACK	0x0040		/* bypass hardware when possible */
#endif
# 128 "/usr/include/sys/socket.h" 3 4
#define	SO_LINGER	0x0080		/* linger on close if data present */
#define	SO_OOBINLINE	0x0100		/* leave received OOB data in line */
#if __BSD_VISIBLE
#define	SO_REUSEPORT	0x0200		/* allow local address & port reuse */
#define	SO_TIMESTAMP	0x0400		/* timestamp received dgram traffic */
#define	SO_NOSIGPIPE	0x0800		/* no SIGPIPE from EPIPE */
#define	SO_ACCEPTFILTER	0x1000		/* there is an accept filter */
#define	SO_BINTIME	0x2000		/* timestamp received dgram traffic */
#endif
# 137 "/usr/include/sys/socket.h" 3 4
#define	SO_NO_OFFLOAD	0x4000		/* socket cannot be offloaded */
#define	SO_NO_DDP	0x8000		/* disable direct data placement */

/*
 * Additional options, not kept in so_options.
 */
#define	SO_SNDBUF	0x1001		/* send buffer size */
#define	SO_RCVBUF	0x1002		/* receive buffer size */
#define	SO_SNDLOWAT	0x1003		/* send low-water mark */
#define	SO_RCVLOWAT	0x1004		/* receive low-water mark */
#define	SO_SNDTIMEO	0x1005		/* send timeout */
#define	SO_RCVTIMEO	0x1006		/* receive timeout */
#define	SO_ERROR	0x1007		/* get error status and clear */
#define	SO_TYPE		0x1008		/* get socket type */
#if __BSD_VISIBLE
#define	SO_LABEL	0x1009		/* socket's MAC label */
#define	SO_PEERLABEL	0x1010		/* socket's peer's MAC label */
#define	SO_LISTENQLIMIT	0x1011		/* socket's backlog limit */
#define	SO_LISTENQLEN	0x1012		/* socket's complete queue length */
#define	SO_LISTENINCQLEN	0x1013	/* socket's incomplete queue length */
#define	SO_SETFIB	0x1014		/* use this FIB to route */
#define	SO_USER_COOKIE	0x1015		/* user cookie (dummynet etc.) */
#define	SO_PROTOCOL	0x1016		/* get socket protocol (Linux name) */
#define	SO_PROTOTYPE	SO_PROTOCOL	/* alias for SO_PROTOCOL (SunOS name) */
#endif
# 162 "/usr/include/sys/socket.h" 3 4

/*
 * Space reserved for new socket options added by third-party vendors.
 * This range applies to all socket option levels.  New socket options
 * in FreeBSD should always use an option value less than SO_VENDOR.
 */
#if __BSD_VISIBLE
#define	SO_VENDOR	0x80000000
#endif
# 171 "/usr/include/sys/socket.h" 3 4

/*
 * Structure used for manipulating linger option.
 */
struct linger {
	int	l_onoff;		/* option on/off */
	int	l_linger;		/* linger time */
};

#if __BSD_VISIBLE
struct accept_filter_arg {
	char	af_name[16];
	char	af_arg[256-16];
};
#endif
# 186 "/usr/include/sys/socket.h" 3 4

/*
 * Level number for (get/set)sockopt() to apply to socket itself.
 */
#define	SOL_SOCKET	0xffff		/* options for socket level */

/*
 * Address families.
 */
#define	AF_UNSPEC	0		/* unspecified */
#if __BSD_VISIBLE
#define	AF_LOCAL	AF_UNIX		/* local to host (pipes, portals) */
#endif
# 199 "/usr/include/sys/socket.h" 3 4
#define	AF_UNIX		1		/* standardized name for AF_LOCAL */
#define	AF_INET		2		/* internetwork: UDP, TCP, etc. */
#if __BSD_VISIBLE
#define	AF_IMPLINK	3		/* arpanet imp addresses */
#define	AF_PUP		4		/* pup protocols: e.g. BSP */
#define	AF_CHAOS	5		/* mit CHAOS protocols */
#define	AF_NETBIOS	6		/* SMB protocols */
#define	AF_ISO		7		/* ISO protocols */
#define	AF_OSI		AF_ISO
#define	AF_ECMA		8		/* European computer manufacturers */
#define	AF_DATAKIT	9		/* datakit protocols */
#define	AF_CCITT	10		/* CCITT protocols, X.25 etc */
#define	AF_SNA		11		/* IBM SNA */
#define AF_DECnet	12		/* DECnet */
#define AF_DLI		13		/* DEC Direct data link interface */
#define AF_LAT		14		/* LAT */
#define	AF_HYLINK	15		/* NSC Hyperchannel */
#define	AF_APPLETALK	16		/* Apple Talk */
#define	AF_ROUTE	17		/* Internal Routing Protocol */
#define	AF_LINK		18		/* Link layer interface */
#define	pseudo_AF_XTP	19		/* eXpress Transfer Protocol (no AF) */
#define	AF_COIP		20		/* connection-oriented IP, aka ST II */
#define	AF_CNT		21		/* Computer Network Technology */
#define pseudo_AF_RTIP	22		/* Help Identify RTIP packets */
#define	AF_IPX		23		/* Novell Internet Protocol */
#define	AF_SIP		24		/* Simple Internet Protocol */
#define	pseudo_AF_PIP	25		/* Help Identify PIP packets */
#define	AF_ISDN		26		/* Integrated Services Digital Network*/
#define	AF_E164		AF_ISDN		/* CCITT E.164 recommendation */
#define	pseudo_AF_KEY	27		/* Internal key-management function */
#endif
# 230 "/usr/include/sys/socket.h" 3 4
#define	AF_INET6	28		/* IPv6 */
#if __BSD_VISIBLE
#define	AF_NATM		29		/* native ATM access */
#define	AF_ATM		30		/* ATM */
#define pseudo_AF_HDRCMPLT 31		/* Used by BPF to not rewrite headers
					 * in interface output routine
					 */
#define	AF_NETGRAPH	32		/* Netgraph sockets */
#define	AF_SLOW		33		/* 802.3ad slow protocol */
#define	AF_SCLUSTER	34		/* Sitara cluster protocol */
#define	AF_ARP		35
#define	AF_BLUETOOTH	36		/* Bluetooth sockets */
#define	AF_IEEE80211	37		/* IEEE 802.11 protocol */
#define	AF_INET_SDP	40		/* OFED Socket Direct Protocol ipv4 */
#define	AF_INET6_SDP	42		/* OFED Socket Direct Protocol ipv6 */
#define	AF_MAX		42
/*
 * When allocating a new AF_ constant, please only allocate
 * even numbered constants for FreeBSD until 134 as odd numbered AF_
 * constants 39-133 are now reserved for vendors.
 */
#define AF_VENDOR00 39
#define AF_VENDOR01 41
#define AF_VENDOR02 43
#define AF_VENDOR03 45
#define AF_VENDOR04 47
#define AF_VENDOR05 49
#define AF_VENDOR06 51
#define AF_VENDOR07 53
#define AF_VENDOR08 55
#define AF_VENDOR09 57
#define AF_VENDOR10 59
#define AF_VENDOR11 61
#define AF_VENDOR12 63
#define AF_VENDOR13 65
#define AF_VENDOR14 67
#define AF_VENDOR15 69
#define AF_VENDOR16 71
#define AF_VENDOR17 73
#define AF_VENDOR18 75
#define AF_VENDOR19 77
#define AF_VENDOR20 79
#define AF_VENDOR21 81
#define AF_VENDOR22 83
#define AF_VENDOR23 85
#define AF_VENDOR24 87
#define AF_VENDOR25 89
#define AF_VENDOR26 91
#define AF_VENDOR27 93
#define AF_VENDOR28 95
#define AF_VENDOR29 97
#define AF_VENDOR30 99
#define AF_VENDOR31 101
#define AF_VENDOR32 103
#define AF_VENDOR33 105
#define AF_VENDOR34 107
#define AF_VENDOR35 109
#define AF_VENDOR36 111
#define AF_VENDOR37 113
#define AF_VENDOR38 115
#define AF_VENDOR39 117
#define AF_VENDOR40 119
#define AF_VENDOR41 121
#define AF_VENDOR42 123
#define AF_VENDOR43 125
#define AF_VENDOR44 127
#define AF_VENDOR45 129
#define AF_VENDOR46 131
#define AF_VENDOR47 133
#endif
# 300 "/usr/include/sys/socket.h" 3 4

/*
 * Structure used by kernel to store most
 * addresses.
 */
struct sockaddr {
	unsigned char	sa_len;		/* total length */
	sa_family_t	sa_family;	/* address family */
	char		sa_data[14];	/* actually longer; address value */
};
#if __BSD_VISIBLE
#define	SOCK_MAXADDRLEN	255		/* longest possible addresses */

/*
 * Structure used by kernel to pass protocol
 * information in raw sockets.
 */
struct sockproto {
	unsigned short	sp_family;		/* address family */
	unsigned short	sp_protocol;		/* protocol */
};
#endif
# 322 "/usr/include/sys/socket.h" 3 4

#if 0 /* expanded by -frewrite-includes */
#include <sys/_sockaddr_storage.h>
#endif /* expanded by -frewrite-includes */
# 324 "/usr/include/sys/socket.h" 3 4

#if __BSD_VISIBLE
/*
 * Protocol families, same as address families for now.
 */
#define	PF_UNSPEC	AF_UNSPEC
#define	PF_LOCAL	AF_LOCAL
#define	PF_UNIX		PF_LOCAL	/* backward compatibility */
#define	PF_INET		AF_INET
#define	PF_IMPLINK	AF_IMPLINK
#define	PF_PUP		AF_PUP
#define	PF_CHAOS	AF_CHAOS
#define	PF_NETBIOS	AF_NETBIOS
#define	PF_ISO		AF_ISO
#define	PF_OSI		AF_ISO
#define	PF_ECMA		AF_ECMA
#define	PF_DATAKIT	AF_DATAKIT
#define	PF_CCITT	AF_CCITT
#define	PF_SNA		AF_SNA
#define PF_DECnet	AF_DECnet
#define PF_DLI		AF_DLI
#define PF_LAT		AF_LAT
#define	PF_HYLINK	AF_HYLINK
#define	PF_APPLETALK	AF_APPLETALK
#define	PF_ROUTE	AF_ROUTE
#define	PF_LINK		AF_LINK
#define	PF_XTP		pseudo_AF_XTP	/* really just proto family, no AF */
#define	PF_COIP		AF_COIP
#define	PF_CNT		AF_CNT
#define	PF_SIP		AF_SIP
#define	PF_IPX		AF_IPX
#define PF_RTIP		pseudo_AF_RTIP	/* same format as AF_INET */
#define PF_PIP		pseudo_AF_PIP
#define	PF_ISDN		AF_ISDN
#define	PF_KEY		pseudo_AF_KEY
#define	PF_INET6	AF_INET6
#define	PF_NATM		AF_NATM
#define	PF_ATM		AF_ATM
#define	PF_NETGRAPH	AF_NETGRAPH
#define	PF_SLOW		AF_SLOW
#define PF_SCLUSTER	AF_SCLUSTER
#define	PF_ARP		AF_ARP
#define	PF_BLUETOOTH	AF_BLUETOOTH
#define	PF_IEEE80211	AF_IEEE80211
#define	PF_INET_SDP	AF_INET_SDP
#define	PF_INET6_SDP	AF_INET6_SDP

#define	PF_MAX		AF_MAX

/*
 * Definitions for network related sysctl, CTL_NET.
 *
 * Second level is protocol family.
 * Third level is protocol number.
 *
 * Further levels are defined by the individual families.
 */

/*
 * PF_ROUTE - Routing table
 *
 * Three additional levels are defined:
 *	Fourth: address family, 0 is wildcard
 *	Fifth: type of info, defined below
 *	Sixth: flag(s) to mask with for NET_RT_FLAGS
 */
#define NET_RT_DUMP	1		/* dump; may limit to a.f. */
#define NET_RT_FLAGS	2		/* by flags, e.g. RESOLVING */
#define NET_RT_IFLIST	3		/* survey interface list */
#define	NET_RT_IFMALIST	4		/* return multicast address list */
#define	NET_RT_IFLISTL	5		/* Survey interface list, using 'l'en
					 * versions of msghdr structs. */
#endif /* __BSD_VISIBLE */
# 397 "/usr/include/sys/socket.h" 3 4

/*
 * Maximum queue length specifiable by listen.
 */
#define	SOMAXCONN	128

/*
 * Message header for recvmsg and sendmsg calls.
 * Used value-result for recvmsg, value only for sendmsg.
 */
struct msghdr {
	void		*msg_name;		/* optional address */
	socklen_t	 msg_namelen;		/* size of address */
	struct iovec	*msg_iov;		/* scatter/gather array */
	int		 msg_iovlen;		/* # elements in msg_iov */
	void		*msg_control;		/* ancillary data, see below */
	socklen_t	 msg_controllen;	/* ancillary data buffer len */
	int		 msg_flags;		/* flags on received message */
};

#define	MSG_OOB		0x1		/* process out-of-band data */
#define	MSG_PEEK	0x2		/* peek at incoming message */
#define	MSG_DONTROUTE	0x4		/* send without using routing tables */
#define	MSG_EOR		0x8		/* data completes record */
#define	MSG_TRUNC	0x10		/* data discarded before delivery */
#define	MSG_CTRUNC	0x20		/* control data lost before delivery */
#define	MSG_WAITALL	0x40		/* wait for full request or error */
#if __POSIX_VISIBLE >= 200809
#define	MSG_NOSIGNAL	0x20000		/* do not generate SIGPIPE on EOF */
#endif
# 427 "/usr/include/sys/socket.h" 3 4
#if __BSD_VISIBLE
#define	MSG_DONTWAIT	0x80		/* this message should be nonblocking */
#define	MSG_EOF		0x100		/* data completes connection */
#define	MSG_NOTIFICATION 0x2000         /* SCTP notification */
#define	MSG_NBIO	0x4000		/* FIONBIO mode, used by fifofs */
#define	MSG_COMPAT      0x8000		/* used in sendit() */
#define	MSG_CMSG_CLOEXEC 0x40000	/* make received fds close-on-exec */
#endif
# 435 "/usr/include/sys/socket.h" 3 4
#ifdef _KERNEL
#define	MSG_SOCALLBCK   0x10000		/* for use by socket callbacks - soreceive (TCP) */
#endif
# 438 "/usr/include/sys/socket.h" 3 4

/*
 * Header for ancillary data objects in msg_control buffer.
 * Used for additional information with/about a datagram
 * not expressible by flags.  The format is a sequence
 * of message elements headed by cmsghdr structures.
 */
struct cmsghdr {
	socklen_t	cmsg_len;		/* data byte count, including hdr */
	int		cmsg_level;		/* originating protocol */
	int		cmsg_type;		/* protocol-specific type */
/* followed by	u_char  cmsg_data[]; */
};

#if __BSD_VISIBLE
/*
 * While we may have more groups than this, the cmsgcred struct must
 * be able to fit in an mbuf and we have historically supported a
 * maximum of 16 groups.
*/
#define CMGROUP_MAX 16

/*
 * Credentials structure, used to verify the identity of a peer
 * process that has sent us a message. This is allocated by the
 * peer process but filled in by the kernel. This prevents the
 * peer from lying about its identity. (Note that cmcred_groups[0]
 * is the effective GID.)
 */
struct cmsgcred {
	pid_t	cmcred_pid;		/* PID of sending process */
	uid_t	cmcred_uid;		/* real UID of sending process */
	uid_t	cmcred_euid;		/* effective UID of sending process */
	gid_t	cmcred_gid;		/* real GID of sending process */
	short	cmcred_ngroups;		/* number or groups */
	gid_t	cmcred_groups[CMGROUP_MAX];	/* groups */
};

/*
 * Socket credentials.
 */
struct sockcred {
	uid_t	sc_uid;			/* real user id */
	uid_t	sc_euid;		/* effective user id */
	gid_t	sc_gid;			/* real group id */
	gid_t	sc_egid;		/* effective group id */
	int	sc_ngroups;		/* number of supplemental groups */
	gid_t	sc_groups[1];		/* variable length */
};

/*
 * Compute size of a sockcred structure with groups.
 */
#define	SOCKCREDSIZE(ngrps) \
	(sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1)))

#endif /* __BSD_VISIBLE */
# 495 "/usr/include/sys/socket.h" 3 4

/* given pointer to struct cmsghdr, return pointer to data */
#define	CMSG_DATA(cmsg)		((unsigned char *)(cmsg) + \
				 _ALIGN(sizeof(struct cmsghdr)))

/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
#define	CMSG_NXTHDR(mhdr, cmsg)	\
	((char *)(cmsg) == NULL ? CMSG_FIRSTHDR(mhdr) : \
	    ((char *)(cmsg) + _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len) + \
	  _ALIGN(sizeof(struct cmsghdr)) > \
	    (char *)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
	    (struct cmsghdr *)0 : \
	    (struct cmsghdr *)(void *)((char *)(cmsg) + \
	    _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len)))

/*
 * RFC 2292 requires to check msg_controllen, in case that the kernel returns
 * an empty list for some reasons.
 */
#define	CMSG_FIRSTHDR(mhdr) \
	((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
	 (struct cmsghdr *)(mhdr)->msg_control : \
	 (struct cmsghdr *)NULL)

#if __BSD_VISIBLE
/* RFC 2292 additions */
#define	CMSG_SPACE(l)		(_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l))
#define	CMSG_LEN(l)		(_ALIGN(sizeof(struct cmsghdr)) + (l))
#endif
# 524 "/usr/include/sys/socket.h" 3 4

#ifdef _KERNEL
#define	CMSG_ALIGN(n)	_ALIGN(n)
#endif
# 528 "/usr/include/sys/socket.h" 3 4

/* "Socket"-level control message types: */
#define	SCM_RIGHTS	0x01		/* access rights (array of int) */
#if __BSD_VISIBLE
#define	SCM_TIMESTAMP	0x02		/* timestamp (struct timeval) */
#define	SCM_CREDS	0x03		/* process creds (struct cmsgcred) */
#define	SCM_BINTIME	0x04		/* timestamp (struct bintime) */
#endif
# 536 "/usr/include/sys/socket.h" 3 4

#if __BSD_VISIBLE
/*
 * 4.3 compat sockaddr, move to compat file later
 */
struct osockaddr {
	unsigned short sa_family;	/* address family */
	char	sa_data[14];		/* up to 14 bytes of direct address */
};

/*
 * 4.3-compat message header (move to compat file later).
 */
struct omsghdr {
	char	*msg_name;		/* optional address */
	int	msg_namelen;		/* size of address */
	struct	iovec *msg_iov;		/* scatter/gather array */
	int	msg_iovlen;		/* # elements in msg_iov */
	char	*msg_accrights;		/* access rights sent/received */
	int	msg_accrightslen;
};
#endif
# 558 "/usr/include/sys/socket.h" 3 4

/*
 * howto arguments for shutdown(2), specified by Posix.1g.
 */
#define	SHUT_RD		0		/* shut down the reading side */
#define	SHUT_WR		1		/* shut down the writing side */
#define	SHUT_RDWR	2		/* shut down both sides */

#if __BSD_VISIBLE
/* for SCTP */
/* we cheat and use the SHUT_XX defines for these */
#define PRU_FLUSH_RD     SHUT_RD
#define PRU_FLUSH_WR     SHUT_WR
#define PRU_FLUSH_RDWR   SHUT_RDWR
#endif
# 573 "/usr/include/sys/socket.h" 3 4


#if __BSD_VISIBLE
/*
 * sendfile(2) header/trailer struct
 */
struct sf_hdtr {
	struct iovec *headers;	/* pointer to an array of header struct iovec's */
	int hdr_cnt;		/* number of header iovec's */
	struct iovec *trailers;	/* pointer to an array of trailer struct iovec's */
	int trl_cnt;		/* number of trailer iovec's */
};

/*
 * sendfile(2) kqueue information
 */
struct sf_hdtr_kq {
	uintptr_t kq_ident;	/* ident (from userland?) */
	void	*kq_udata;	/* user data pointer */
	uint32_t kq_flags;	/* extra flags to pass in */
	int	kq_fd;	/* kq fd to post completion events on */
};

struct sf_hdtr_all {
	struct sf_hdtr hdtr;
	struct sf_hdtr_kq kq;
};

/*
 * Sendfile-specific flag(s)
 */
#define	SF_NODISKIO     0x00000001
#define	SF_MNOWAIT	0x00000002
#define	SF_SYNC		0x00000004
#define	SF_KQUEUE	0x00000008

#ifdef _KERNEL
#define	SFK_COMPAT	0x00000001
#endif /* _KERNEL */
# 612 "/usr/include/sys/socket.h" 3 4
#endif /* __BSD_VISIBLE */
# 613 "/usr/include/sys/socket.h" 3 4

#ifndef	_KERNEL

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 617 "/usr/include/sys/socket.h" 3 4

__BEGIN_DECLS
int	accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
int	bind(int, const struct sockaddr *, socklen_t);
int	connect(int, const struct sockaddr *, socklen_t);
#if __BSD_VISIBLE
int	accept4(int, struct sockaddr * __restrict, socklen_t * __restrict, int);
int	bindat(int, int, const struct sockaddr *, socklen_t);
int	connectat(int, int, const struct sockaddr *, socklen_t);
#endif
# 627 "/usr/include/sys/socket.h" 3 4
int	getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
int	getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict);
int	getsockopt(int, int, int, void * __restrict, socklen_t * __restrict);
int	listen(int, int);
ssize_t	recv(int, void *, size_t, int);
ssize_t	recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
ssize_t	recvmsg(int, struct msghdr *, int);
ssize_t	send(int, const void *, size_t, int);
ssize_t	sendto(int, const void *,
	    size_t, int, const struct sockaddr *, socklen_t);
ssize_t	sendmsg(int, const struct msghdr *, int);
#if __BSD_VISIBLE
int	sendfile(int, int, off_t, size_t, struct sf_hdtr *, off_t *, int);
int	setfib(int);
#endif
# 642 "/usr/include/sys/socket.h" 3 4
int	setsockopt(int, int, int, const void *, socklen_t);
int	shutdown(int, int);
int	sockatmark(int);
int	socket(int, int, int);
int	socketpair(int, int, int, int *);
__END_DECLS

#endif /* !_KERNEL */
# 650 "/usr/include/sys/socket.h" 3 4

#ifdef _KERNEL
struct socket;

struct tcpcb *so_sototcpcb(struct socket *so);
struct inpcb *so_sotoinpcb(struct socket *so);
struct sockbuf *so_sockbuf_snd(struct socket *);
struct sockbuf *so_sockbuf_rcv(struct socket *);

int so_state_get(const struct socket *);
void so_state_set(struct socket *, int);

int so_options_get(const struct socket *);
void so_options_set(struct socket *, int);

int so_error_get(const struct socket *);
void so_error_set(struct socket *, int);

int so_linger_get(const struct socket *);
void so_linger_set(struct socket *, int);

struct protosw *so_protosw_get(const struct socket *);
void so_protosw_set(struct socket *, struct protosw *);

void so_sorwakeup_locked(struct socket *so);
void so_sowwakeup_locked(struct socket *so);

void so_sorwakeup(struct socket *so);
void so_sowwakeup(struct socket *so);

void so_lock(struct socket *so);
void so_unlock(struct socket *so);

void so_listeners_apply_all(struct socket *so, void (*func)(struct socket *, void *), void *arg);

#endif
# 686 "/usr/include/sys/socket.h" 3 4


#endif /* !_SYS_SOCKET_H_ */
# 689 "/usr/include/sys/socket.h" 3 4
# 52 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2
#endif
# 53 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif /* KERNEL */
# 54 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#if 0 /* expanded by -frewrite-includes */
#include <opr/queue.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/opr/queue.h" 1
/*
 * Copyright (c) 2010 Your File System Inc. 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 `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 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.
 */

/* A better queue implementation.
 *
 * This differs from the original queue implementation in that that would
 * only allow a structure to be threaded onto a single queue. This permits
 * a given object to be on multiple queues, providing that each queue has
 * a place in the structure definition.
 */

#ifndef OPENAFS_OPR_QUEUE_H
#define OPENAFS_OPR_QUEUE_H 1

#ifndef KERNEL
#if 0 /* expanded by -frewrite-includes */
#include <stdlib.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/home/kaduk/openafs/build/include/opr/queue.h"
#else
# 39 "/usr/home/kaduk/openafs/build/include/opr/queue.h"
#ifndef NULL
#define NULL (void *)0
#endif
# 42 "/usr/home/kaduk/openafs/build/include/opr/queue.h"
#endif
# 43 "/usr/home/kaduk/openafs/build/include/opr/queue.h"

struct opr_queue {
   struct opr_queue *next;
   struct opr_queue *prev;
};

#define opr_queue_Scan(head, cursor) \
    cursor = (head)->next; cursor != (head); cursor = cursor->next

#define opr_queue_ScanSafe(head, cursor, store) \
    cursor = (head)->next, store = cursor->next; \
    cursor != (head); \
    cursor = store, store = store->next

#define opr_queue_ScanBackwards(head, cursor) \
    cursor = (head)->prev; cursor != (head); cursor = cursor->prev

#define opr_queue_ScanBackwardsSafe(head, cursor, store) \
   cursor = (head)->prev, store = cursor->prev; \
   cursor != (head); \
   cursor = store, store = store->prev

static_inline void
opr_queue_Zero(struct opr_queue *q) {
    q->prev = q->next = NULL;
}

static_inline void
opr_queue_Init(struct opr_queue *q) {
    q->prev = q->next = q;
}

static_inline void
opr_queue_add(struct opr_queue *element,
	      struct opr_queue *before, struct opr_queue *after) {
   after->prev = element;
   element->next = after;
   element->prev = before;
   before->next = element;
}

static_inline void
opr_queue_Append(struct opr_queue *queue, struct opr_queue *element) {
    opr_queue_add(element, queue->prev, queue);
}

static_inline void
opr_queue_Prepend(struct opr_queue *queue, struct opr_queue *element) {
    opr_queue_add(element, queue, queue->next);
}

static_inline void
opr_queue_InsertBefore(struct opr_queue *exist, struct opr_queue *adding) {
    /* This may seem back to front, but take a list A, B, C where we want
     * to add 1 before B. So, we're adding 1 with A the element before,
     * and B the element after, hence the following: */
    opr_queue_add(adding, exist->prev, exist);
}

static_inline void
opr_queue_InsertAfter(struct opr_queue *exist, struct opr_queue *adding) {
    opr_queue_add(adding, exist, exist->next);
}

static_inline void
opr_queue_Remove(struct opr_queue *element) {
    element->next->prev = element->prev;
    element->prev->next = element->next;
    element->prev = NULL;
    element->next = NULL;
}

static_inline int
opr_queue_IsEmpty(struct opr_queue *q) {
    return (q->prev == q);
}

static_inline int
opr_queue_IsOnQueue(struct opr_queue *q) {
    return (q->prev != NULL);
}

static_inline int
opr_queue_IsEnd(struct opr_queue *q, struct opr_queue *cursor) {
    return (cursor == q);
}

static_inline int
opr_queue_IsLast(struct opr_queue *q, struct opr_queue *cursor) {
    return (cursor->next == q);
}

static_inline int
opr_queue_Count(struct opr_queue *q) {
    struct opr_queue *cursor;
    int n = 0;

    for (opr_queue_Scan(q, cursor)) {
	n++;
    }
    return n;
}

static_inline void
opr_queue_Swap(struct opr_queue *a, struct opr_queue *b)
{
    struct opr_queue tq = *b;

    if (a->prev == a) {
	b->prev = b->next = b;
    } else {
	*b = *a;
	b->prev->next = b;
	b->next->prev = b;
    }

    if (tq.prev == b) {
	a->prev = a->next = a;
    } else {
	*a = tq;
	a->prev->next = a;
	a->next->prev = a;
    }
}

/* Remove the members before pivot from Q1, and append them to Q2 */

static_inline void
opr_queue_SplitBeforeAppend(struct opr_queue *q1, struct opr_queue *q2,
			    struct opr_queue *pivot) {

    if (q1 == pivot->prev)
	return;
    /* Add ourselves to the end of list 2 */
    q2->prev->next = q1->next; /* end of list 2, is now the start of list 1 */
    q1->next->prev = q2->prev;
    pivot->prev->next = q2; /* entry before the pivot is it at end of q2 */
    q2->prev = pivot->prev;

    /* Pull ourselves out of list q1. */
    q1->next = pivot;
    pivot->prev = q1;
}

/* Remove the members after the pivot from Q1, and prepend them onto Q2 */
static_inline void
opr_queue_SplitAfterPrepend(struct opr_queue *q1, struct opr_queue *q2,
			    struct opr_queue *pivot) {

    if (q1 == pivot->next)
	return;

    /* start of q2 has last element of q1 before it */
    q2->next->prev = q1->prev;
    q1->prev->next = q2->next;
    /* item that we're breaking at (pivot->next) is at start of q2 */
    q2->next = pivot->next;
    pivot->next->prev = q2;

    /* Q1 now ends after pivot */
    pivot->next = q1;
    q1->prev = pivot;
}

static_inline void
opr_queue_SpliceAppend(struct opr_queue *target, struct opr_queue *source)
{

    if (source->next == source)
	return;

    /* Stick the contents of source onto the end of target */
    target->prev->next = source->next;
    source->next->prev = target->prev;
    source->prev->next = target;
    target->prev = source->prev;

    /* Reinitialise source */
    source->next = source->prev = source;
}

static_inline void
opr_queue_SplicePrepend(struct opr_queue *target, struct opr_queue *source)
{

    if (source->next == source)
	return;

    /* Contents of source go onto the beginning of target */
    target->next->prev = source->prev;
    source->prev->next = target->next;
    source->next->prev = target;
    target->next = source->next;

    /* Reinitialise source */
    source->next = source->prev = source;
}

#define opr_queue_Entry(queue, structure, member) \
    ((structure *)((char *)(queue)-(char *)(&((structure *)NULL)->member)))

#define opr_queue_First(queue, structure, member) \
    opr_queue_Entry((queue)->next, structure, member)

#define opr_queue_Last(queue, structure, member) \
    opr_queue_Entry((queue)->prev, structure, member)

#define opr_queue_Next(entry, structure, member) \
    opr_queue_Entry((entry)->next, structure, member)

#define opr_queue_Prev(entry, structure, member) \
    opr_queue_Entry((entry)->prev, structure, member)

#endif
# 257 "/usr/home/kaduk/openafs/build/include/opr/queue.h"
# 56 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2

#if 0 /* expanded by -frewrite-includes */
#include "rx_clock.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/* Elapsed time package */
/* This package maintains a clock which is independent of the time of day.  It uses the 4.3BSD interval timer (getitimer/setitimer) in TIMER_REAL mode.  Any other use of the timer voids this package's warranty. */

#ifndef _CLOCK_
#define _CLOCK_

#ifdef	KERNEL
#if defined(AFS_AIX_ENV) || defined(AFS_AUX_ENV) || defined(AFS_SUN5_ENV)
#if 0 /* expanded by -frewrite-includes */
#include "h/systm.h"
#endif /* expanded by -frewrite-includes */
# 19 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#if 0 /* expanded by -frewrite-includes */
#include "h/time.h"
#endif /* expanded by -frewrite-includes */
# 20 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#endif /* System V */
# 21 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#else /* KERNEL */
# 22 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#ifndef AFS_NT40_ENV
#ifndef ITIMER_REAL
#if 0 /* expanded by -frewrite-includes */
#include <sys/time.h>
#endif /* expanded by -frewrite-includes */
# 25 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#endif /* ITIMER_REAL */
# 26 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#else
# 27 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#if 0 /* expanded by -frewrite-includes */
#include <time.h>
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#if 0 /* expanded by -frewrite-includes */
#include <afs/afsutil.h>
#endif /* expanded by -frewrite-includes */
# 29 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#endif
# 30 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#endif /* KERNEL */
# 31 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"

/* Some macros to make macros more reasonable (this allows a block to be used within a macro which does not cause if statements to screw up).   That is, you can use "if (...) macro_name(); else ...;" without having things blow up on the semi-colon. */

#ifndef BEGIN
#define BEGIN do {
#define END } while(0)
#endif
# 38 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"

/* A clock value is the number of seconds and microseconds that have elapsed since calling clock_Init. */
struct clock {
    afs_int32 sec;		/* Seconds since clock_Init */
    afs_int32 usec;		/* Microseconds since clock_Init */
};

#if defined(KERNEL)
#if 0 /* expanded by -frewrite-includes */
#include "afs/afs_osi.h"
#endif /* expanded by -frewrite-includes */
# 47 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#endif
# 48 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#if !defined(KERNEL) || defined(UKERNEL)
#if defined(AFS_USE_GETTIMEOFDAY) || defined(AFS_PTHREAD_ENV) || defined(UKERNEL)
#define clock_Init()
#define clock_NewTime()
#define clock_UpdateTime()
#define clock_Sec() (time(NULL))
#define clock_haveCurrentTime 1

#define        clock_GetTime(cv)                               \
    BEGIN                                              \
       struct timeval tv;                              \
       gettimeofday(&tv, NULL);                        \
       (cv)->sec = (afs_int32)tv.tv_sec;               \
       (cv)->usec = (afs_int32)tv.tv_usec;             \
    END

#else /* AFS_USE_GETTIMEOFDAY || AFS_PTHREAD_ENV */
# 65 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"

/* For internal use.  The last value returned from clock_GetTime() */
extern struct clock clock_now;

/* For internal use:  this flag, if set, indicates a new time should be read by clock_getTime() */
extern int clock_haveCurrentTime;

/* For external use: the number of times the clock value is actually updated */
extern int clock_nUpdates;

/* Initialize the clock package */

#define	clock_NewTime()	(clock_haveCurrentTime = 0)

/* Return the current clock time.  If the clock value has not been updated since the last call to clock_NewTime, it is updated now */
#define        clock_GetTime(cv)                               \
    BEGIN                                              \
       if (!clock_haveCurrentTime) clock_UpdateTime(); \
       (cv)->sec = clock_now.sec;                      \
       (cv)->usec = clock_now.usec;                    \
    END

/* Current clock time, truncated to seconds */
#define	clock_Sec() ((!clock_haveCurrentTime)? clock_UpdateTime(), clock_now.sec:clock_now.sec)

extern void clock_Init(void);
extern int clock_UnInit(void);
extern void clock_UpdateTime(void);

#endif /* AFS_USE_GETTIMEOFDAY || AFS_PTHREAD_ENV */
# 95 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#else /* KERNEL */
# 96 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#define clock_Init()
#if defined(AFS_SGI61_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX_64BIT_KERNEL)
#define clock_GetTime(cv) osi_GetTime((osi_timeval_t *)cv)
#else
# 100 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#if (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || (defined(AFS_DARWIN100_ENV) && defined(__amd64__)) || defined(AFS_XBSD_ENV)
#define        clock_GetTime(cv)                               \
    BEGIN                                              \
       struct timeval tv;                              \
       osi_GetTime(&tv);                        \
       (cv)->sec = (afs_int32)tv.tv_sec;               \
       (cv)->usec = (afs_int32)tv.tv_usec;             \
    END
#else /* defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) */
# 109 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#define clock_GetTime(cv) osi_GetTime((osi_timeval_t *)(cv))
#endif /* defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) */
# 111 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#endif
# 112 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
#define clock_Sec() osi_Time()
#define	clock_NewTime()		/* don't do anything; clock is fast enough in kernel */
#endif /* KERNEL */
# 115 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"

/* Returns the elapsed time in milliseconds between clock values (*cv1) and (*cv2) */
#define clock_ElapsedTime(cv1, cv2) \
    (((cv2)->sec - (cv1)->sec)*1000 + ((cv2)->usec - (cv1)->usec)/1000)

/* Some comparison operators for clock values */
#define	clock_Gt(a, b)	((a)->sec>(b)->sec || ((a)->sec==(b)->sec && (a)->usec>(b)->usec))
#define	clock_Ge(a, b)	((a)->sec>(b)->sec || ((a)->sec==(b)->sec && (a)->usec>=(b)->usec))
#define	clock_Eq(a, b)	((a)->sec==(b)->sec && (a)->usec==(b)->usec)
#define	clock_Le(a, b)	((a)->sec<(b)->sec || ((a)->sec==(b)->sec && (a)->usec<=(b)->usec))
#define	clock_Lt(a, b)	((a)->sec<(b)->sec || ((a)->sec==(b)->sec && (a)->usec<(b)->usec))

/* Is the clock value zero? */
#define	clock_IsZero(c)	((c)->sec == 0 && (c)->usec == 0)

/* Set the clock value to zero */
#define	clock_Zero(c)	((c)->sec = (c)->usec = 0)

/* Add time c2 to time c1.  Both c2 and c1 must be positive times. */
#define	clock_Add(c1, c2)					\
    BEGIN							\
	(c1)->sec += (c2)->sec;					\
	if (((c1)->usec += (c2)->usec) >= 1000000) {		\
	    (c1)->usec -= 1000000;				\
	    (c1)->sec++;					\
	}							\
    END

#define USEC(cp)        (((cp)->sec * 1000000) + (cp)->usec)
#define MSEC(cp)	(((cp)->sec * 1000) + ((cp)->usec / 1000))
#define _4THMSEC(cp)    (((cp)->sec * 4000) + ((cp)->usec / 250))
#define _8THMSEC(cp)    (((cp)->sec * 8000) + ((cp)->usec / 125))

/* Add ms milliseconds to time c1.  Both ms and c1 must be positive */
#define	clock_Addmsec(c1, ms)					 \
    BEGIN							 \
	if ((ms) >= 1000) {					 \
	    (c1)->sec += (afs_int32)((ms) / 1000);			 \
	    (c1)->usec += (afs_int32)(((ms) % 1000) * 1000);	 \
	} else {						 \
	    (c1)->usec += (afs_int32)((ms) * 1000);			 \
	}							 \
        if ((c1)->usec >= 1000000) {		                 \
	    (c1)->usec -= 1000000;				 \
	    (c1)->sec++;					 \
	}							 \
    END

/* Subtract time c2 from time c1.  c2 should be less than c1 */
#define	clock_Sub(c1, c2)					\
    BEGIN							\
	if (((c1)->usec	-= (c2)->usec) < 0) {			\
	    (c1)->usec += 1000000;				\
	    (c1)->sec--;					\
	}							\
	(c1)->sec -= (c2)->sec;					\
    END

#define clock_Float(c) ((c)->sec + (c)->usec/1e6)

/* Add square of time c2 to time c1.  Both c2 and c1 must be positive times. */
#define	clock_AddSq(c1, c2)					              \
    BEGIN							              \
   if((c2)->sec > 0 )                                                         \
     {                                                                        \
       (c1)->sec += (c2)->sec * (c2)->sec                                     \
                    +  2 * (c2)->sec * (c2)->usec /1000000;                   \
       (c1)->usec += (2 * (c2)->sec * (c2)->usec) % 1000000                   \
                     + ((c2)->usec / 1000)*((c2)->usec / 1000)                \
                     + 2 * ((c2)->usec / 1000) * ((c2)->usec % 1000) / 1000   \
                     + ((((c2)->usec % 1000) > 707) ? 1 : 0);                 \
     }                                                                        \
   else                                                                       \
     {                                                                        \
       (c1)->usec += ((c2)->usec / 1000)*((c2)->usec / 1000)                  \
                     + 2 * ((c2)->usec / 1000) * ((c2)->usec % 1000) / 1000   \
                     + ((((c2)->usec % 1000) > 707) ? 1 : 0);                 \
     }                                                                        \
   if ((c1)->usec > 1000000) {                                                \
        (c1)->usec -= 1000000;                                                \
        (c1)->sec++;                                                          \
   }                                                                          \
    END

#endif /* _CLOCK_ */
# 200 "/usr/home/kaduk/openafs/build/include/rx/rx_clock.h"
# 58 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "rx_event.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_event.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/* Event package */

#ifndef OPENAFS_RX_EVENT_H
#define OPENAFS_RX_EVENT_H

/* This routine must be called to initialize the event package.
 * nEvents is the number of events to allocate in a batch whenever
 * more are needed.  If this is 0, a default number (10) will be
 * allocated. */
extern void rxevent_Init( int nEvents, void (*scheduler)(void) );

/* Arrange for the indicated event at the appointed time.  when is a
 * "struct clock", in the clock.c time base */
struct clock;
struct rxevent;
extern struct rxevent *rxevent_Post(struct clock *when, struct clock *now,
				    void (*func) (struct rxevent *, void *,
						  void *, int),
				    void *arg, void *arg1, int arg2);

/* Remove the indicated event from the event queue.  The event must be
 * pending.  Note that a currently executing event may not cancel itself.
 */
extern int rxevent_Cancel(struct rxevent **);

/* The actions specified for each event that has reached the current clock
 * time will be taken.  The current time returned by GetTime is used
 * (warning:  this may be an old time if the user has not called
 * clock_NewTime)
 */
extern int rxevent_RaiseEvents(struct clock *wait);

/* Acquire a reference to an event */
extern struct rxevent *rxevent_Get(struct rxevent *event);

/* Release a reference to an event */
extern void rxevent_Put(struct rxevent **event);

/* Shutdown the event package */
extern void shutdown_rxevent(void);

#endif /* _EVENT_ */
# 52 "/usr/home/kaduk/openafs/build/include/rx/rx_event.h"
# 59 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "rx_misc.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_misc.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*
 * rx_misc.h - Various RX configuration macros.
 */

#ifndef _RX_MISC_H_
#define _RX_MISC_H_

#if defined(AFS_SUN5_ENV)
#if 0 /* expanded by -frewrite-includes */
#include <sys/sockio.h>
#endif /* expanded by -frewrite-includes */
# 19 "/usr/home/kaduk/openafs/build/include/rx/rx_misc.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/fcntl.h>
#endif /* expanded by -frewrite-includes */
# 20 "/usr/home/kaduk/openafs/build/include/rx/rx_misc.h"
#endif
# 21 "/usr/home/kaduk/openafs/build/include/rx/rx_misc.h"

#if	defined(AFS_AIX41_ENV) && defined(KERNEL)
#define PIN(a, b) pin(a, b)
#define UNPIN(a, b) unpin(a, b)
#else
# 26 "/usr/home/kaduk/openafs/build/include/rx/rx_misc.h"
#define PIN(a, b)
#define UNPIN(a, b)
#endif
# 29 "/usr/home/kaduk/openafs/build/include/rx/rx_misc.h"



/* Include the following to use the lock data base. */
/* #define RX_LOCKS_DB 1 */
/* The lock database uses a file id number and the line number to identify
 * where in the code a lock was obtained. Each file containing locks
 * has a separate file id called: rxdb_fileID.
 */
#define RXDB_FILE_RX        1	/* rx.c */
#define RXDB_FILE_RX_EVENT  2	/* rx_event.c */
#define RXDB_FILE_RX_PACKET 3	/* rx_packet.c */
#define RXDB_FILE_RX_RDWR   4	/* rx_rdwr.c */

#endif /* _RX_MISC_H_ */
# 44 "/usr/home/kaduk/openafs/build/include/rx/rx_misc.h"
# 60 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "rx_null.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_null.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/* Remove this file */
# 61 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "rx_multi.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_multi.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef	_RX_MULTI_
#define _RX_MULTI_

struct multi_handle {
    int nConns;
    struct rx_call **calls;
    short *ready;
    short nReady;		/* XXX UNALIGNED */
    short *nextReady;
    short *firstNotReady;
#ifdef RX_ENABLE_LOCKS
    afs_kmutex_t lock;
    afs_kcondvar_t cv;
#endif				/* RX_ENABLE_LOCKS */
# 24 "/usr/home/kaduk/openafs/build/include/rx/rx_multi.h"
};

#define multi_Rx(conns, nConns) \
    do {\
	struct multi_handle *multi_h;\
	int multi_i;\
	int multi_i0;\
	afs_int32 multi_error;\
	struct rx_call *multi_call;\
	multi_h = multi_Init(conns, nConns);\
	for (multi_i0 = multi_i = 0; ; multi_i = multi_i0 )

#define multi_Body(startProc, endProc)\
	if (multi_h->nextReady == multi_h->firstNotReady && multi_i < multi_h->nConns) {\
	    multi_call = multi_h->calls[multi_i];\
            if (multi_call) {\
                startProc;\
	        rx_FlushWrite(multi_call);\
            }\
	    multi_i0++;  /* THIS is the loop variable!! */\
	    continue;\
	}\
	if ((multi_i = multi_Select(multi_h)) < 0) break;\
	multi_call = multi_h->calls[multi_i];\
	multi_error = rx_EndCall(multi_call, endProc);\
	multi_h->calls[multi_i] = (struct rx_call *) 0

#define	multi_Abort break

#define multi_End\
	multi_Finalize(multi_h);\
    } while (0)

/* Ignore remaining multi RPC's */
#define multi_End_Ignore\
	multi_Finalize_Ignore(multi_h);\
    } while (0)

#endif /* _RX_MULTI_     End of rx_multi.h */
# 63 "/usr/home/kaduk/openafs/build/include/rx/rx_multi.h"
# 62 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2

/* These items are part of the new RX API. They're living in this section
 * for now, to keep them separate from everything else... */

struct rx_connection;
struct rx_call;
struct rx_packet;

/* Connection management */

extern void rx_SetConnectionEpoch(struct rx_connection *conn, afs_uint32 epoch);
extern afs_uint32  rx_GetConnectionEpoch(struct rx_connection *conn);
extern void rx_SetConnectionId(struct rx_connection *conn, afs_uint32 id);
extern afs_uint32  rx_GetConnectionId(struct rx_connection *conn);
extern void *rx_GetSecurityData(struct rx_connection *conn);
extern void  rx_SetSecurityData(struct rx_connection *conn, void *data);
extern int  rx_IsUsingPktCksum(struct rx_connection *conn);
extern void rx_SetSecurityHeaderSize(struct rx_connection *conn, afs_uint32 size);
extern afs_uint32  rx_GetSecurityHeaderSize(struct rx_connection *conn);
extern void rx_SetSecurityMaxTrailerSize(struct rx_connection *conn, afs_uint32 size);
extern afs_uint32  rx_GetSecurityMaxTrailerSize(struct rx_connection *conn);
extern void rx_SetMsgsizeRetryErr(struct rx_connection *conn, int err);
extern int  rx_IsServerConn(struct rx_connection *conn);
extern int  rx_IsClientConn(struct rx_connection *conn);
extern struct rx_securityClass *rx_SecurityObjectOf(const struct rx_connection *);
extern struct rx_peer *rx_PeerOf(struct rx_connection *);
extern u_short rx_ServiceIdOf(struct rx_connection *);
extern int rx_SecurityClassOf(struct rx_connection *);
extern struct rx_service *rx_ServiceOf(struct rx_connection *);
extern int rx_ConnError(struct rx_connection *);

/* Call management */
extern struct rx_connection *rx_ConnectionOf(struct rx_call *call);
extern int rx_Error(struct rx_call *call);
extern int rx_GetRemoteStatus(struct rx_call *call);
extern void rx_SetLocalStatus(struct rx_call *call, int status);
extern int rx_GetCallAbortCode(struct rx_call *call);
extern void rx_SetCallAbortCode(struct rx_call *call, int code);

extern void rx_RecordCallStatistics(struct rx_call *call,
				    unsigned int rxInterface,
				    unsigned int currentFunc,
				    unsigned int totalFunc,
				    int isServer);

/* Peer management */
extern afs_uint32 rx_HostOf(struct rx_peer *peer);
extern u_short rx_PortOf(struct rx_peer *peer);

/* Packets */

/* Packet classes, for rx_AllocPacket and rx_packetQuota */
#define	RX_PACKET_CLASS_RECEIVE	    0
#define	RX_PACKET_CLASS_SEND	    1
#define	RX_PACKET_CLASS_SPECIAL	    2
#define	RX_PACKET_CLASS_RECV_CBUF   3
#define	RX_PACKET_CLASS_SEND_CBUF   4

#define	RX_N_PACKET_CLASSES	    5	/* Must agree with above list */

#define	RX_PACKET_TYPES	    {"data", "ack", "busy", "abort", "ackall", "challenge", "response", "debug", "params", "unused", "unused", "unused", "version"}
#define	RX_N_PACKET_TYPES	    13	/* Must agree with above list;
					 * counts 0
					 * WARNING: if this number ever
					 * grows past 13, rxdebug packets
					 * will need to be modified */


/* For most Unixes, maximum elements in an iovec is 16 */
#define RX_MAXIOVECS 16		        /* limit for ReadvProc/WritevProc */
#define RX_MAXWVECS (RX_MAXIOVECS-1)	/* need one iovec for packet header */

/* Debugging */

/* Call flags, states and modes are exposed by the debug interface */
#ifndef KDUMP_RX_LOCK
/* Major call states */
#define	RX_STATE_NOTINIT  0	/* Call structure has never been initialized */
#define	RX_STATE_PRECALL  1	/* Server-only:  call is not in progress, but packets have arrived */
#define	RX_STATE_ACTIVE	  2	/* An active call; a process is dealing with this call */
#define	RX_STATE_DALLY	  3	/* Dallying after process is done with call */
#define	RX_STATE_HOLD	  4	/* Waiting for acks on reply data packets */
#define RX_STATE_RESET    5     /* Call is being reset */

/* Call modes:  the modes of a call in RX_STATE_ACTIVE state (process attached) */
#define	RX_MODE_SENDING	  1	/* Sending or ready to send */
#define	RX_MODE_RECEIVING 2	/* Receiving or ready to receive */
#define	RX_MODE_ERROR	  3	/* Something in error for current conversation */
#define	RX_MODE_EOF	  4	/* Server has flushed (or client has read) last reply packet */

/* Flags */
#define	RX_CALL_READER_WAIT	   1	/* Reader is waiting for next packet */
#define	RX_CALL_WAIT_WINDOW_ALLOC  2	/* Sender is waiting for window to allocate buffers */
#define	RX_CALL_WAIT_WINDOW_SEND   4	/* Sender is waiting for window to send buffers */
#define	RX_CALL_WAIT_PACKETS	   8	/* Sender is waiting for packet buffers */
#define	RX_CALL_WAIT_PROC	  16	/* Waiting for a process to be assigned */
#define	RX_CALL_RECEIVE_DONE	  32	/* All packets received on this call */
#define	RX_CALL_CLEARED		  64	/* Receive queue cleared in precall state */
#define	RX_CALL_TQ_BUSY		 128	/* Call's Xmit Queue is busy; don't modify */
#define	RX_CALL_TQ_CLEARME	 256	/* Need to clear this call's TQ later */
#define RX_CALL_TQ_SOME_ACKED    512	/* rxi_Start needs to discard ack'd packets. */
#define RX_CALL_TQ_WAIT		1024	/* Reader is waiting for TQ_BUSY to be reset */
#define RX_CALL_FAST_RECOVER    2048	/* call is doing congestion recovery */
/* 4096 was RX_CALL_FAST_RECOVER_WAIT */
#define RX_CALL_SLOW_START_OK   8192	/* receiver acks every other packet */
#define RX_CALL_IOVEC_WAIT	16384	/* waiting thread is using an iovec */
#define RX_CALL_HAVE_LAST	32768	/* Last packet has been received */
#define RX_CALL_NEED_START	0x10000	/* tells rxi_Start to start again */
#define RX_CALL_PEER_BUSY	0x20000 /* the last packet we received on this call was a
                                         * BUSY packet; i.e. the channel for this call is busy */
#define RX_CALL_ACKALL_SENT     0x40000 /* ACKALL has been sent on the call */
#define RX_CALL_FLUSH		0x80000 /* Transmit queue should be flushed to peer */
#endif
# 175 "/usr/home/kaduk/openafs/build/include/rx/rx.h"


/* Configurable parameters */
#define	RX_IDLE_DEAD_TIME	60	/* default idle dead time */
#define	RX_MAX_SERVICES		20	/* Maximum number of services that may be installed */
#if defined(KERNEL) && defined(AFS_AIX51_ENV) && defined(__64__)
#define RX_DEFAULT_STACK_SIZE   24000
#else
# 183 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#define	RX_DEFAULT_STACK_SIZE	16000	/* Default process stack size; overriden by rx_SetStackSize */
#endif
# 185 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* This parameter should not normally be changed */
#define	RX_PROCESS_PRIORITY	LWP_NORMAL_PRIORITY

#define ADDRSPERSITE 16

#ifndef KDUMP_RX_LOCK
/* Bottom n-bits of the Call Identifier give the call number */
#define	RX_MAXCALLS 4		/* Power of 2; max async calls per connection */
#define	RX_CIDSHIFT 2		/* Log2(RX_MAXCALLS) */
#define	RX_CHANNELMASK (RX_MAXCALLS-1)
#define	RX_CIDMASK  (~RX_CHANNELMASK)
#endif /* !KDUMP_RX_LOCK */
# 198 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef KERNEL
typedef void (*rx_destructor_t) (void *);
int rx_KeyCreate(rx_destructor_t);
osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
osi_socket rxi_GetUDPSocket(u_short port);
#endif /* KERNEL */
# 205 "/usr/home/kaduk/openafs/build/include/rx/rx.h"


int ntoh_syserr_conv(int error);

#define	RX_WAIT	    1
#define	RX_DONTWAIT 0

#define rx_GetLocalStatus(call, status) ((call)->localStatus)


static_inline int
rx_IsLoopbackAddr(afs_uint32 addr)
{
    return ((addr & 0xffff0000) == 0x7f000000);
}

/*******************
 * Macros callable by the user to further define attributes of a
 * service.  Must be called before rx_StartServer
 */

/* Set the service stack size.  This currently just sets the stack
 * size for all processes to be the maximum seen, so far */
#define rx_SetStackSize(service, stackSize) \
  rx_stackSize = (((stackSize) > rx_stackSize)? stackSize: rx_stackSize)

/* Set minimum number of processes guaranteed to be available for this
 * service at all times */
#define rx_SetMinProcs(service, min) ((service)->minProcs = (min))

/* Set maximum number of processes that will be made available to this
 * service (also a guarantee that this number will be made available
 * if there is no competition) */
#define rx_SetMaxProcs(service, max) ((service)->maxProcs = (max))

/* Define a procedure to be called just before a server connection is destroyed */
#define rx_SetDestroyConnProc(service,proc) ((service)->destroyConnProc = (proc))

/* Define procedure to set service dead time */
#define rx_SetIdleDeadTime(service,time) ((service)->idleDeadTime = (time))

/*
 * Define error to return in server connections when failing to answer.
 * (server only) For example, AFS viced sends VNOSERVICE.
 */
#define rx_SetServerIdleDeadErr(service,err) ((service)->idleDeadErr = (err))

/* Define procedures for getting and setting before and after execute-request procs */
#define rx_SetAfterProc(service,proc) ((service)->afterProc = (proc))
#define rx_SetBeforeProc(service,proc) ((service)->beforeProc = (proc))
#define rx_GetAfterProc(service) ((service)->afterProc)
#define rx_GetBeforeProc(service) ((service)->beforeProc)
#define rx_SetPostProc(service,proc) ((service)->postProc = (proc))
#define rx_GetPostProc(service) ((service)->postProc)

/* Define a procedure to be called when a server connection is created */
#define rx_SetNewConnProc(service, proc) ((service)->newConnProc = (proc))

/* NOTE:  We'll probably redefine the following three routines, again, sometime. */

/* Set the connection dead time for any connections created for this service (server only) */
#define rx_SetServiceDeadTime(service, seconds) ((service)->secondsUntilDead = (seconds))

/* Enable or disable asymmetric client checking for a service */
#define rx_SetCheckReach(service, x) ((service)->checkReach = (x))

/* Set the overload threshold and the overload error */
#define rx_SetBusyThreshold(threshold, code) (rx_BusyThreshold=(threshold),rx_BusyError=(code))

/* If this flag is set,no new requests are processed by rx, all new requests are
returned with an error code of RX_CALL_DEAD ( transient error ) */
#define	rx_SetRxTranquil()   		(rx_tranquil = 1)
#define	rx_ClearRxTranquil()   		(rx_tranquil = 0)

/* Set the threshold and time to delay aborts for consecutive errors */
#define rx_SetCallAbortThreshold(A) (rxi_callAbortThreshhold = (A))
#define rx_SetCallAbortDelay(A) (rxi_callAbortDelay = (A))
#define rx_SetConnAbortThreshold(A) (rxi_connAbortThreshhold = (A))
#define rx_SetConnAbortDelay(A) (rxi_connAbortDelay = (A))



#define cpspace(call) ((call)->curlen)
#define cppos(call) ((call)->curpos)

#define	rx_Read(call, buf, nbytes)   rx_ReadProc(call, buf, nbytes)
#define	rx_Read32(call, value)   rx_ReadProc32(call, value)
#define	rx_Readv(call, iov, nio, maxio, nbytes) \
   rx_ReadvProc(call, iov, nio, maxio, nbytes)
#define	rx_Write(call, buf, nbytes) rx_WriteProc(call, buf, nbytes)
#define	rx_Write32(call, value) rx_WriteProc32(call, value)
#define	rx_Writev(call, iov, nio, nbytes) \
   rx_WritevProc(call, iov, nio, nbytes)

/* This is the maximum size data packet that can be sent on this connection, accounting for security module-specific overheads. */
#define	rx_MaxUserDataSize(call)		((call)->MTU - RX_HEADER_SIZE - (call)->conn->securityHeaderSize - (call)->conn->securityMaxTrailerSize)

/* Macros to turn the hot thread feature on and off. Enabling hot threads
 * allows the listener thread to trade places with an idle worker thread,
 * which moves the context switch from listener to worker out of the
 * critical path.
 */
#define rx_EnableHotThread()		(rx_enable_hot_thread = 1)
#define rx_DisableHotThread()		(rx_enable_hot_thread = 0)

#define rx_PutConnection(conn) rx_DestroyConnection(conn)

/* A service is installed by rx_NewService, and specifies a service type that
 * is exported by this process.  Incoming calls are stamped with the service
 * type, and must match an installed service for the call to be accepted.
 * Each service exported has a (port,serviceId) pair to uniquely identify it.
 * It is also named:  this is intended to allow a remote statistics gathering
 * program to retrieve per service statistics without having to know the local
 * service id's.  Each service has a number of
 */

/* security objects (instances of security classes) which implement
 * various types of end-to-end security protocols for connections made
 * to this service.  Finally, there are two parameters controlling the
 * number of requests which may be executed in parallel by this
 * service: minProcs is the number of requests to this service which
 * are guaranteed to be able to run in parallel at any time; maxProcs
 * has two meanings: it limits the total number of requests which may
 * execute in parallel and it also guarantees that that many requests
 * may be handled in parallel if no other service is handling any
 * requests. */

struct rx_service {
    u_short serviceId;		/* Service number */
    afs_uint32 serviceHost;	/* IP address for this service */
    u_short servicePort;	/* UDP port for this service */
    char *serviceName;		/* Name of the service */
    osi_socket socket;		/* socket structure or file descriptor */
    u_short nRequestsRunning;	/* Number of requests currently in progress */
    u_short nSecurityObjects;	/* Number of entries in security objects array */
    struct rx_securityClass **securityObjects;	/* Array of security class objects */
      afs_int32(*executeRequestProc) (struct rx_call * acall);	/* Routine to call when an rpc request is received */
    void (*destroyConnProc) (struct rx_connection * tcon);	/* Routine to call when a server connection is destroyed */
    void (*newConnProc) (struct rx_connection * tcon);	/* Routine to call when a server connection is created */
    void (*beforeProc) (struct rx_call * acall);	/* routine to call before a call is executed */
    void (*afterProc) (struct rx_call * acall, afs_int32 code);	/* routine to call after a call is executed */
    void (*postProc) (afs_int32 code);	/* routine to call after the call has ended */
    u_short maxProcs;		/* Maximum procs to be used for this service */
    u_short minProcs;		/* Minimum # of requests guaranteed executable simultaneously */
    u_short connDeadTime;	/* Seconds until a client of this service will be declared dead, if it is not responding */
    u_short idleDeadTime;	/* Time a server will wait for I/O to start up again */
    u_char checkReach;		/* Check for asymmetric clients? */
    afs_int32 idleDeadErr;
    int nSpecific;		/* number entries in specific data */
    void **specific;		/* pointer to connection specific data */
#ifdef	RX_ENABLE_LOCKS
    afs_kmutex_t svc_data_lock;	/* protect specific data */
#endif
# 358 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

};

#endif /* KDUMP_RX_LOCK */
# 362 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef KDUMP_RX_LOCK
/* Flag bits for connection structure */
#define	RX_CONN_MAKECALL_WAITING    1	/* rx_NewCall is waiting for a channel */
#define	RX_CONN_DESTROY_ME	    2	/* Destroy *client* connection after last call */
#define RX_CONN_USING_PACKET_CKSUM  4	/* non-zero header.spare field seen */
#define RX_CONN_KNOW_WINDOW         8	/* window size negotiation works */
#define RX_CONN_RESET		   16	/* connection is reset, remove */
#define RX_CONN_BUSY               32	/* connection is busy; don't delete */
#define RX_CONN_ATTACHWAIT	   64	/* attach waiting for peer->lastReach */
#define RX_CONN_MAKECALL_ACTIVE   128   /* a thread is actively in rx_NewCall */
#define RX_CONN_NAT_PING          256   /* nat ping requested */

/* Type of connection, client or server */
#define	RX_CLIENT_CONNECTION	0
#define	RX_SERVER_CONNECTION	1
#endif /* !KDUMP_RX_LOCK */
# 379 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* Maximum number of acknowledgements in an acknowledge packet */
#define	RX_MAXACKS	    255

#ifndef KDUMP_RX_LOCK

/* The structure of the data portion of an acknowledge packet: An acknowledge
 * packet is in network byte order at all times.  An acknowledgement is always
 * prompted for a specific reason by a specific incoming packet.  This reason
 * is reported in "reason" and the packet's sequence number in the packet
 * header.seq.  In addition to this information, all of the current
 * acknowledgement information about this call is placed in the packet.
 * "FirstPacket" is the sequence number of the first packet represented in an
 * array of bytes, "acks", containing acknowledgement information for a number
 * of consecutive packets.  All packets prior to FirstPacket are implicitly
 * acknowledged: the sender need no longer be concerned about them.  Packets
 * from firstPacket+nAcks and on are not acknowledged.  Packets in the range
 * [firstPacket,firstPacket+nAcks) are each acknowledged explicitly.  The
 * acknowledgement may be RX_NACK if the packet is not (currently) at the
 * receiver (it may have never been received, or received and then later
 * dropped), or it may be RX_ACK if the packet is queued up waiting to be read
 * by the upper level software.  RX_ACK does not imply that the packet may not
 * be dropped before it is read; it does imply that the sender should stop
 * retransmitting the packet until notified otherwise.  The field
 * previousPacket identifies the previous packet received by the peer.  This
 * was used in a previous version of this software, and could be used in the
 * future.  The serial number in the data part of the ack packet corresponds to
 * the serial number oof the packet which prompted the acknowledge.  Any
 * packets which are explicitly not acknowledged, and which were last
 * transmitted with a serial number less than the provided serial number,
 * should be retransmitted immediately.  Actually, this is slightly inaccurate:
 * packets are not necessarily received in order.  When packets are habitually
 * transmitted out of order, this is allowed for in the retransmission
 * algorithm by introducing the notion of maximum packet skew: the degree of
 * out-of-orderness of the packets received on the wire.  This number is
 * communicated from the receiver to the sender in ack packets. */

struct rx_ackPacket {
    u_short bufferSpace;	/* Number of packet buffers available.  That is:  the number of buffers that the sender of the ack packet is willing to provide for data, on this or subsequent calls.  Lying is permissable. */
    u_short maxSkew;		/* Maximum difference between serial# of packet acknowledged and highest packet yet received */
    afs_uint32 firstPacket;	/* The first packet in the list of acknowledged packets */
    afs_uint32 previousPacket;	/* The previous packet number received (obsolete?) */
    afs_uint32 serial;		/* Serial number of the packet which prompted the acknowledge */
    u_char reason;		/* Reason for the acknowledge of ackPacket, defined below */
    u_char nAcks;		/* Number of acknowledgements */
    u_char acks[RX_MAXACKS];	/* Up to RX_MAXACKS packet acknowledgements, defined below */
    /* Packets <firstPacket are implicitly acknowledged and may be discarded by the sender.  Packets >= firstPacket+nAcks are implicitly NOT acknowledged.  No packets with sequence numbers >= firstPacket should be discarded by the sender (they may thrown out at any time by the receiver) */
};

#define FIRSTACKOFFSET 4

/* Reason for acknowledge message */
#define	RX_ACK_REQUESTED	1	/* Peer requested an ack on this packet */
#define	RX_ACK_DUPLICATE	2	/* Duplicate packet */
#define	RX_ACK_OUT_OF_SEQUENCE	3	/* Packet out of sequence */
#define	RX_ACK_EXCEEDS_WINDOW	4	/* Packet sequence number higher than window; discarded */
#define	RX_ACK_NOSPACE		5	/* No buffer space at all */
#define	RX_ACK_PING		6	/* This is a keep-alive ack */
#define	RX_ACK_PING_RESPONSE	7	/* Ack'ing because we were pinged */
#define	RX_ACK_DELAY		8	/* Ack generated since nothing has happened since receiving packet */
#define RX_ACK_IDLE             9	/* Similar to RX_ACK_DELAY, but can
					 * be used to compute RTT */
#define RX_ACK_MTU             -1       /* will be rewritten to ACK_PING */

/* Packet acknowledgement type */
#define	RX_ACK_TYPE_NACK	0	/* I Don't have this packet */
#define	RX_ACK_TYPE_ACK		1	/* I have this packet, although I may discard it later */

/* The packet size transmitted for an acknowledge is adjusted to reflect the actual size of the acks array.  This macro defines the size */
#define rx_AckDataSize(nAcks) (3 + nAcks + offsetof(struct rx_ackPacket, acks[0]))

#define	RX_CHALLENGE_TIMEOUT	2	/* Number of seconds before another authentication request packet is generated */
#define RX_CHALLENGE_MAXTRIES	50	/* Max # of times we resend challenge */
#define	RX_CHECKREACH_TIMEOUT	2	/* Number of seconds before another ping is generated */
#define	RX_CHECKREACH_TTL	60	/* Re-check reachability this often */

/*
 * rx_GetNetworkError 'origin' constants. These define the meaning of the
 * 'type' and 'code' values returned by rx_GetNetworkError.
 */

/* Used for ICMP errors; the type and code are the ICMP type and code,
 * respectively */
#define RX_NETWORK_ERROR_ORIGIN_ICMP (0)

/*
 * RX error codes.  RX uses error codes from -1 to -64 and -100.
 * Rxgen uses other error codes < -64 (see src/rxgen/rpc_errors.h);
 * user programs are expected to return positive error codes
 */

/* Something bad happened to the connection; temporary loss of communication */
#define	RX_CALL_DEAD		    (-1)

/*
 * An invalid operation, such as a client attempting to send data
 * after having received the beginning of a reply from the server.
 */
#define	RX_INVALID_OPERATION	    (-2)

/* An optional timeout per call may be specified */
#define	RX_CALL_TIMEOUT		    (-3)

/* End of data on a read.  Not currently in use. */
#define	RX_EOF			    (-4)

/* Some sort of low-level protocol error. */
#define	RX_PROTOCOL_ERROR	    (-5)

/*
 * Generic user abort code; used when no more specific error code needs to be
 * communicated.  For example, multi rx clients use this code to abort a multi-
 * rx call.
 */
#define	RX_USER_ABORT		    (-6)

/* Port already in use (from rx_Init).  This error is never sent on the wire. */
#define RX_ADDRINUSE		    (-7)

/* EMSGSIZE returned from network.  Packet too big, must fragment */
#define RX_MSGSIZE		    (-8)

/*
 * Idle dead timeout error.  This error is never sent on the wire.
 * rxi_SendCallAbort() translates RX_CALL_IDLE to RX_CALL_TIMEOUT.
 */
#define RX_CALL_IDLE                (-9)

/*
 * Busy call channel error.  This error is never sent on the wire.
 * rxi_SendCallAbort() translates RX_CALL_BUSY to RX_CALL_TIMEOUT.
 */
#define RX_CALL_BUSY                (-10)

/* transient failure detected ( possibly the server is restarting ) */
/* this should be equal to VRESTARTING ( util/errors.h ) for old clients to work */
#define RX_RESTARTING		    (-100)

typedef enum {
    RX_SECIDX_NULL = 0,
    RX_SECIDX_KAD  = 2,
    RX_SECIDX_GK   = 4,
    RX_SECIDX_K5   = 5,
} rx_securityIndex;

struct rx_securityObjectStats {
    char type;			/* 0:unk 1:null,2:vab 3:kad */
    char level;
    char sparec[10];		/* force correct alignment */
    afs_int32 flags;		/* 1=>unalloc, 2=>auth, 4=>expired */
    afs_uint32 expires;
    afs_uint32 packetsReceived;
    afs_uint32 packetsSent;
    afs_uint32 bytesReceived;
    afs_uint32 bytesSent;
    short spares[4];
    afs_int32 sparel[8];
};

/* Configuration settings */

/* Enum for storing configuration variables which can be set via the
 * SetConfiguration method in the rx_securityClass, below
 */

typedef enum {
     RXS_CONFIG_FLAGS /* afs_uint32 set of bitwise flags */
} rx_securityConfigVariables;

/* For the RXS_CONFIG_FLAGS, the following bit values are defined */

/* Disable the principal name contains dot check in rxkad */
#define RXS_CONFIG_FLAGS_DISABLE_DOTCHECK	0x01

/* XXXX (rewrite this description) A security class object contains a set of
 * procedures and some private data to implement a security model for rx
 * connections.  These routines are called by rx as appropriate.  Rx knows
 * nothing about the internal details of any particular security model, or
 * about security state.  Rx does maintain state per connection on behalf of
 * the security class.  Each security class implementation is also expected to
 * provide routines to create these objects.  Rx provides a basic routine to
 * allocate one of these objects; this routine must be called by the class. */
struct rx_securityClass {
    struct rx_securityOps {
	int (*op_Close) (struct rx_securityClass * aobj);
	int (*op_NewConnection) (struct rx_securityClass * aobj,
				 struct rx_connection * aconn);
	int (*op_PreparePacket) (struct rx_securityClass * aobj,
				 struct rx_call * acall,
				 struct rx_packet * apacket);
	int (*op_SendPacket) (struct rx_securityClass * aobj,
			      struct rx_call * acall,
			      struct rx_packet * apacket);
	int (*op_CheckAuthentication) (struct rx_securityClass * aobj,
				       struct rx_connection * aconn);
	int (*op_CreateChallenge) (struct rx_securityClass * aobj,
				   struct rx_connection * aconn);
	int (*op_GetChallenge) (struct rx_securityClass * aobj,
				struct rx_connection * aconn,
				struct rx_packet * apacket);
	int (*op_GetResponse) (struct rx_securityClass * aobj,
			       struct rx_connection * aconn,
			       struct rx_packet * apacket);
	int (*op_CheckResponse) (struct rx_securityClass * aobj,
				 struct rx_connection * aconn,
				 struct rx_packet * apacket);
	int (*op_CheckPacket) (struct rx_securityClass * aobj,
			       struct rx_call * acall,
			       struct rx_packet * apacket);
	int (*op_DestroyConnection) (struct rx_securityClass * aobj,
				     struct rx_connection * aconn);
	int (*op_GetStats) (struct rx_securityClass * aobj,
			    struct rx_connection * aconn,
			    struct rx_securityObjectStats * astats);
	int (*op_SetConfiguration) (struct rx_securityClass * aobj,
				    struct rx_connection * aconn,
				    rx_securityConfigVariables atype,
				    void * avalue,
				    void ** acurrentValue);
	int (*op_Spare2) (void);
	int (*op_Spare3) (void);
    } *ops;
    void *privateData;
    int refCount;
};

#define RXS_OP(obj,op,args) ((obj && (obj->ops->op_ ## op)) ? (*(obj)->ops->op_ ## op)args : 0)

#define RXS_Close(obj) RXS_OP(obj,Close,(obj))
#define RXS_NewConnection(obj,conn) RXS_OP(obj,NewConnection,(obj,conn))
#define RXS_PreparePacket(obj,call,packet) RXS_OP(obj,PreparePacket,(obj,call,packet))
#define RXS_SendPacket(obj,call,packet) RXS_OP(obj,SendPacket,(obj,call,packet))
#define RXS_CheckAuthentication(obj,conn) RXS_OP(obj,CheckAuthentication,(obj,conn))
#define RXS_CreateChallenge(obj,conn) RXS_OP(obj,CreateChallenge,(obj,conn))
#define RXS_GetChallenge(obj,conn,packet) RXS_OP(obj,GetChallenge,(obj,conn,packet))
#define RXS_GetResponse(obj,conn,packet) RXS_OP(obj,GetResponse,(obj,conn,packet))
#define RXS_CheckResponse(obj,conn,packet) RXS_OP(obj,CheckResponse,(obj,conn,packet))
#define RXS_CheckPacket(obj,call,packet) RXS_OP(obj,CheckPacket,(obj,call,packet))
#define RXS_DestroyConnection(obj,conn) RXS_OP(obj,DestroyConnection,(obj,conn))
#define RXS_GetStats(obj,conn,stats) RXS_OP(obj,GetStats,(obj,conn,stats))
#define RXS_SetConfiguration(obj, conn, type, value, currentValue) RXS_OP(obj, SetConfiguration,(obj,conn,type,value,currentValue))



/* Structure for keeping rx statistics.  Note that this structure is returned
 * by rxdebug, so, for compatibility reasons, new fields should be appended (or
 * spares used), the rxdebug protocol checked, if necessary, and the PrintStats
 * code should be updated as well.
 *
 * Clearly we assume that ntohl will work on these structures so sizeof(int)
 * must equal sizeof(afs_int32). */

struct rx_statistics {		/* General rx statistics */
    int packetRequests;		/* Number of packet allocation requests */
    int receivePktAllocFailures;
    int sendPktAllocFailures;
    int specialPktAllocFailures;
    int socketGreedy;		/* Whether SO_GREEDY succeeded */
    int bogusPacketOnRead;	/* Number of inappropriately short packets received */
    int bogusHost;		/* Host address from bogus packets */
    int noPacketOnRead;		/* Number of read packets attempted when there was actually no packet to read off the wire */
    int noPacketBuffersOnRead;	/* Number of dropped data packets due to lack of packet buffers */
    int selects;		/* Number of selects waiting for packet or timeout */
    int sendSelects;		/* Number of selects forced when sending packet */
    int packetsRead[RX_N_PACKET_TYPES];	/* Total number of packets read, per type */
    int dataPacketsRead;	/* Number of unique data packets read off the wire */
    int ackPacketsRead;		/* Number of ack packets read */
    int dupPacketsRead;		/* Number of duplicate data packets read */
    int spuriousPacketsRead;	/* Number of inappropriate data packets */
    int packetsSent[RX_N_PACKET_TYPES];	/* Number of rxi_Sends: packets sent over the wire, per type */
    int ackPacketsSent;		/* Number of acks sent */
    int pingPacketsSent;	/* Total number of ping packets sent */
    int abortPacketsSent;	/* Total number of aborts */
    int busyPacketsSent;	/* Total number of busies sent received */
    int dataPacketsSent;	/* Number of unique data packets sent */
    int dataPacketsReSent;	/* Number of retransmissions */
    int dataPacketsPushed;	/* Number of retransmissions pushed early by a NACK */
    int ignoreAckedPacket;	/* Number of packets with acked flag, on rxi_Start */
    struct clock totalRtt;	/* Total round trip time measured (use to compute average) */
    struct clock minRtt;	/* Minimum round trip time measured */
    struct clock maxRtt;	/* Maximum round trip time measured */
    int nRttSamples;		/* Total number of round trip samples */
    int nServerConns;		/* Total number of server connections */
    int nClientConns;		/* Total number of client connections */
    int nPeerStructs;		/* Total number of peer structures */
    int nCallStructs;		/* Total number of call structures allocated */
    int nFreeCallStructs;	/* Total number of previously allocated free call structures */
    int netSendFailures;
    afs_int32 fatalErrors;
    int ignorePacketDally;	/* packets dropped because call is in dally state */
    int receiveCbufPktAllocFailures;
    int sendCbufPktAllocFailures;
    int nBusies;
    int spares[4];
};

/* structures for debug input and output packets */

/* debug input types */
struct rx_debugIn {
    afs_int32 type;
    afs_int32 index;
};

/* Invalid rx debug package type */
#define RX_DEBUGI_BADTYPE     (-8)

#define RX_DEBUGI_VERSION_MINIMUM ('L')	/* earliest real version */
#define RX_DEBUGI_VERSION     ('S')    /* Latest version */
    /* first version w/ secStats */
#define RX_DEBUGI_VERSION_W_SECSTATS ('L')
    /* version M is first supporting GETALLCONN and RXSTATS type */
#define RX_DEBUGI_VERSION_W_GETALLCONN ('M')
#define RX_DEBUGI_VERSION_W_RXSTATS ('M')
    /* last version with unaligned debugConn */
#define RX_DEBUGI_VERSION_W_UNALIGNED_CONN ('L')
#define RX_DEBUGI_VERSION_W_WAITERS ('N')
#define RX_DEBUGI_VERSION_W_IDLETHREADS ('O')
#define RX_DEBUGI_VERSION_W_NEWPACKETTYPES ('P')
#define RX_DEBUGI_VERSION_W_GETPEER ('Q')
#define RX_DEBUGI_VERSION_W_WAITED ('R')
#define RX_DEBUGI_VERSION_W_PACKETS ('S')

#define	RX_DEBUGI_GETSTATS	1	/* get basic rx stats */
#define	RX_DEBUGI_GETCONN	2	/* get connection info */
#define	RX_DEBUGI_GETALLCONN	3	/* get even uninteresting conns */
#define	RX_DEBUGI_RXSTATS	4	/* get all rx stats */
#define	RX_DEBUGI_GETPEER	5	/* get all peer structs */

struct rx_debugStats {
    afs_int32 nFreePackets;
    afs_int32 packetReclaims;
    afs_int32 callsExecuted;
    char waitingForPackets;
    char usedFDs;
    char version;
    char spare1;
    afs_int32 nWaiting;
    afs_int32 idleThreads;	/* Number of server threads that are idle */
    afs_int32 nWaited;
    afs_int32 nPackets;
    afs_int32 spare2[6];
};

struct rx_debugConn_vL {
    afs_uint32 host;
    afs_int32 cid;
    afs_int32 serial;
    afs_int32 callNumber[RX_MAXCALLS];
    afs_int32 error;
    short port;
    char flags;
    char type;
    char securityIndex;
    char callState[RX_MAXCALLS];
    char callMode[RX_MAXCALLS];
    char callFlags[RX_MAXCALLS];
    char callOther[RX_MAXCALLS];
    /* old style getconn stops here */
    struct rx_securityObjectStats secStats;
    afs_int32 sparel[10];
};

struct rx_debugConn {
    afs_uint32 host;
    afs_int32 cid;
    afs_int32 serial;
    afs_int32 callNumber[RX_MAXCALLS];
    afs_int32 error;
    short port;
    char flags;
    char type;
    char securityIndex;
    char sparec[3];		/* force correct alignment */
    char callState[RX_MAXCALLS];
    char callMode[RX_MAXCALLS];
    char callFlags[RX_MAXCALLS];
    char callOther[RX_MAXCALLS];
    /* old style getconn stops here */
    struct rx_securityObjectStats secStats;
    afs_int32 epoch;
    afs_int32 natMTU;
    afs_int32 sparel[9];
};

struct rx_debugPeer {
    afs_uint32 host;
    u_short port;
    u_short ifMTU;
    afs_uint32 idleWhen;
    short refCount;
    u_char burstSize;
    u_char burst;
    struct clock burstWait;
    afs_int32 rtt;
    afs_int32 rtt_dev;
    struct clock timeout;
    afs_int32 nSent;
    afs_int32 reSends;
    afs_int32 inPacketSkew;
    afs_int32 outPacketSkew;
    afs_int32 rateFlag;
    u_short natMTU;
    u_short maxMTU;
    u_short maxDgramPackets;
    u_short ifDgramPackets;
    u_short MTU;
    u_short cwind;
    u_short nDgramPackets;
    u_short congestSeq;
    afs_hyper_t bytesSent;
    afs_hyper_t bytesReceived;
    afs_int32 sparel[10];
};

#define	RX_OTHER_IN	1	/* packets avail in in queue */
#define	RX_OTHER_OUT	2	/* packets avail in out queue */

#define RX_SERVER_DEBUG_SEC_STATS		0x1
#define RX_SERVER_DEBUG_ALL_CONN		0x2
#define RX_SERVER_DEBUG_RX_STATS		0x4
#define RX_SERVER_DEBUG_WAITER_CNT		0x8
#define RX_SERVER_DEBUG_IDLE_THREADS		0x10
#define RX_SERVER_DEBUG_OLD_CONN		0x20
#define RX_SERVER_DEBUG_NEW_PACKETS		0x40
#define RX_SERVER_DEBUG_ALL_PEER		0x80
#define RX_SERVER_DEBUG_WAITED_CNT              0x100
#define RX_SERVER_DEBUG_PACKETS_CNT              0x200

#define AFS_RX_STATS_CLEAR_ALL			0xffffffff
#define AFS_RX_STATS_CLEAR_INVOCATIONS		0x1
#define AFS_RX_STATS_CLEAR_BYTES_SENT		0x2
#define AFS_RX_STATS_CLEAR_BYTES_RCVD		0x4
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_SUM	0x8
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_SQUARE	0x10
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_MIN	0x20
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_MAX	0x40
#define AFS_RX_STATS_CLEAR_EXEC_TIME_SUM	0x80
#define AFS_RX_STATS_CLEAR_EXEC_TIME_SQUARE	0x100
#define AFS_RX_STATS_CLEAR_EXEC_TIME_MIN	0x200
#define AFS_RX_STATS_CLEAR_EXEC_TIME_MAX	0x400

typedef struct rx_function_entry_v1 {
    afs_uint32 remote_peer;
    afs_uint32 remote_port;
    afs_uint32 remote_is_server;
    afs_uint32 interfaceId;
    afs_uint32 func_total;
    afs_uint32 func_index;
    afs_uint64 invocations;
    afs_uint64 bytes_sent;
    afs_uint64 bytes_rcvd;
    struct clock queue_time_sum;
    struct clock queue_time_sum_sqr;
    struct clock queue_time_min;
    struct clock queue_time_max;
    struct clock execution_time_sum;
    struct clock execution_time_sum_sqr;
    struct clock execution_time_min;
    struct clock execution_time_max;
} rx_function_entry_v1_t, *rx_function_entry_v1_p;

/*
 * If you need to change rx_function_entry, you should probably create a brand
 * new structure.  Keeping the old structure will allow backwards compatibility
 * with old clients (even if it is only used to calculate allocation size).
 * If you do change the size or the format, you'll need to bump
 * RX_STATS_RETRIEVAL_VERSION.  This allows some primitive form
 * of versioning a la rxdebug.
 */

#define RX_STATS_RETRIEVAL_VERSION 1	/* latest version */
#define RX_STATS_RETRIEVAL_FIRST_EDITION 1	/* first implementation */

typedef struct rx_interface_stat {
    struct opr_queue entry;
    struct opr_queue entryPeers;
    rx_function_entry_v1_t stats[1];	/* make sure this is aligned correctly */
} rx_interface_stat_t, *rx_interface_stat_p;

#define RX_STATS_SERVICE_ID 409

#ifdef AFS_NT40_ENV
extern int rx_DumpCalls(FILE *outputFile, char *cookie);
#endif
# 864 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#endif /* _RX_   End of rx.h */
# 866 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifdef	KERNEL
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 869 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else
# 870 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef	_RX_PROTOTYPES_H
#define _RX_PROTOTYPES_H

/* rx.c */
#ifndef KERNEL
#ifndef AFS_PTHREAD_ENV
extern int (*registerProgram) (PROCESS, char *);
extern int (*swapNameProgram) (PROCESS, const char *, char *);
#endif
# 19 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#endif
# 20 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern int (*rx_justReceived) (struct rx_packet *, struct sockaddr_in *);
extern int (*rx_almostSent) (struct rx_packet *, struct sockaddr_in *);

extern void rx_rto_setPeerTimeoutSecs(struct rx_peer *, int secs);

extern void rx_SetEpoch(afs_uint32 epoch);
extern int rx_Init(u_int port);
extern int rx_InitHost(u_int host, u_int port);
extern void rx_SetBusyChannelError(afs_int32 onoff);
#ifdef AFS_NT40_ENV
extern void rx_DebugOnOff(int on);
extern void rx_StatsOnOff(int on);
extern void rx_StartClientThread(void);
#endif
# 34 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern void rx_StartServer(int donateMe);
extern struct rx_connection *rx_NewConnection(afs_uint32 shost,
					      u_short sport, u_short sservice,
					      struct rx_securityClass
					      *securityObject,
					      int serviceSecurityIndex);
extern void rx_SetConnDeadTime(struct rx_connection *conn,
			       int seconds);
extern void rx_SetConnHardDeadTime(struct rx_connection *conn, int seconds);
extern void rx_SetConnIdleDeadTime(struct rx_connection *conn, int seconds);
extern void rxi_DestroyConnection(struct rx_connection *conn);
extern void rx_GetConnection(struct rx_connection *conn);
extern void rx_DestroyConnection(struct rx_connection *conn);
extern struct rx_call *rx_NewCall(struct rx_connection *conn);
extern int rxi_GetCallNumberVector(struct rx_connection *aconn,
				   afs_int32 * aint32s);
extern int rxi_SetCallNumberVector(struct rx_connection *aconn,
				   afs_int32 * aint32s);
extern struct rx_service *rx_NewService(u_short port, u_short serviceId,
					char *serviceName,
					struct rx_securityClass
					**securityObjects,
					int nSecurityObjects,
					afs_int32(*serviceProc) (struct
								 rx_call *
								 acall));
extern struct rx_service *rx_NewServiceHost(afs_uint32 host, u_short port,
					    u_short serviceId,
					    char *serviceName,
					    struct rx_securityClass
					    **securityObjects,
					    int nSecurityObjects,
					    afs_int32(*serviceProc) (struct
								     rx_call *
								     acall));
extern void rxi_ServerProc(int threadID, struct rx_call *newcall,
			   osi_socket * socketp);
extern void rx_WakeupServerProcs(void);
extern struct rx_call *rx_GetCall(int tno, struct rx_service *cur_service,
				  osi_socket * socketp);
extern void rx_SetArrivalProc(struct rx_call *call,
			      void (*proc) (struct rx_call *
						    call,
						    void * mh,
						    int index),
			      void * handle, int arg);
extern afs_int32 rx_EndCall(struct rx_call *call, afs_int32 rc);
extern void rx_InterruptCall(struct rx_call *call, afs_int32 error);
extern void rx_Finalize(void);
extern void *rxi_Alloc(size_t size);
extern void rxi_Free(void *addr, size_t size);
extern void rxi_CallError(struct rx_call *call, afs_int32 error);
extern void rx_SetConnSecondsUntilNatPing(struct rx_connection *conn,
					  afs_int32 seconds);
extern void rx_KeepAliveOn(struct rx_call *call);
extern void rx_KeepAliveOff(struct rx_call *call);
extern int rxs_Release(struct rx_securityClass *aobj);
#ifndef KERNEL
extern void rx_PrintTheseStats(FILE * file, struct rx_statistics *s, int size,
			       afs_int32 freePackets, char version);
extern void rx_PrintStats(FILE * file);
extern void rx_PrintPeerStats(FILE * file, struct rx_peer *peer);
#endif
# 97 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern afs_int32 rx_GetServerDebug(osi_socket socket, afs_uint32 remoteAddr,
				   afs_uint16 remotePort,
				   struct rx_debugStats *stat,
				   afs_uint32 * supportedValues);
extern afs_int32 rx_GetServerStats(osi_socket socket, afs_uint32 remoteAddr,
				   afs_uint16 remotePort,
				   struct rx_statistics *stat,
				   afs_uint32 * supportedValues);
extern afs_int32 rx_GetServerVersion(osi_socket socket, afs_uint32 remoteAddr,
				     afs_uint16 remotePort,
				     size_t version_length, char *version);
extern afs_int32 rx_GetServerConnections(osi_socket socket,
					 afs_uint32 remoteAddr,
					 afs_uint16 remotePort,
					 afs_int32 * nextConnection,
					 int allConnections,
					 afs_uint32 debugSupportedValues,
					 struct rx_debugConn *conn,
					 afs_uint32 * supportedValues);
extern afs_int32 rx_GetServerPeers(osi_socket socket, afs_uint32 remoteAddr,
				   afs_uint16 remotePort,
				   afs_int32 * nextPeer,
				   afs_uint32 debugSupportedValues,
				   struct rx_debugPeer *peer,
				   afs_uint32 * supportedValues);
extern afs_int32 rx_GetLocalPeers(afs_uint32 peerHost, afs_uint16 peerPort,
				      struct rx_debugPeer * peerStats);
extern void shutdown_rx(void);
#ifndef KERNEL
extern int rx_KeyCreate(rx_destructor_t rtn);
#endif
# 128 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern void rx_SetSpecific(struct rx_connection *conn, int key, void *ptr);
extern void *rx_GetSpecific(struct rx_connection *conn, int key);
extern void rx_SetServiceSpecific(struct rx_service *svc, int key, void *ptr);
extern void * rx_GetServiceSpecific(struct rx_service *svc, int key);
extern void rx_IncrementTimeAndCount(struct rx_peer *peer,
				     afs_uint32 rxInterface,
				     afs_uint32 currentFunc,
				     afs_uint32 totalFunc,
				     struct clock *queueTime,
				     struct clock *execTime,
				     afs_hyper_t * bytesSent,
				     afs_hyper_t * bytesRcvd, int isServer);
extern void rx_MarshallProcessRPCStats(afs_uint32 callerVersion, int count,
				       rx_function_entry_v1_t * stats,
				       afs_uint32 ** ptrP);
extern int rx_RetrieveProcessRPCStats(afs_uint32 callerVersion,
				      afs_uint32 * myVersion,
				      afs_uint32 * clock_sec,
				      afs_uint32 * clock_usec,
				      size_t * allocSize,
				      afs_uint32 * statCount,
				      afs_uint32 ** stats);
extern int rx_RetrievePeerRPCStats(afs_uint32 callerVersion,
				   afs_uint32 * myVersion,
				   afs_uint32 * clock_sec,
				   afs_uint32 * clock_usec,
				   size_t * allocSize, afs_uint32 * statCount,
				   afs_uint32 ** stats);
extern void rx_FreeRPCStats(afs_uint32 * stats, size_t allocSize);
extern int rx_queryProcessRPCStats(void);
extern int rx_queryPeerRPCStats(void);
extern void rx_enableProcessRPCStats(void);
extern void rx_enablePeerRPCStats(void);
extern void rx_disableProcessRPCStats(void);
extern void rx_disablePeerRPCStats(void);
extern void rx_clearProcessRPCStats(afs_uint32 clearFlag);
extern void rx_clearPeerRPCStats(afs_uint32 clearFlag);
extern void rx_SetRxStatUserOk(int (*proc) (struct rx_call * call));
extern int rx_RxStatUserOk(struct rx_call *call);
extern void rx_ClearProcessRPCStats(afs_int32 rxInterface);
extern void rx_ClearPeerRPCStats(afs_int32 rxInterface, afs_uint32 peerHost, afs_uint16 peerPort);
extern void *rx_CopyProcessRPCStats(afs_uint64 op);
extern void *rx_CopyPeerRPCStats(afs_uint64 op, afs_uint32 peerHost, afs_uint16 peerPort);
extern void rx_ReleaseRPCStats(void *stats);
extern afs_int32 rx_SetSecurityConfiguration(struct rx_service *service,
					     rx_securityConfigVariables type,
					     void *value);
extern int rx_GetThreadNum(void);
extern int rx_SetThreadNum(void);

void rxi_DebugInit(void);
void rxi_DebugPrint(char *format, ...)
    AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);

extern int rx_GetNetworkError(struct rx_connection *conn, int *err_origin,
                              int *err_type, int *err_code, const char **msg);

/* rx_clock.c */
#if !defined(clock_Init)
extern void clock_Init(void);
#endif
# 189 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#if !defined(clock_UnInit)
extern int clock_UnInit(void);
#endif
# 192 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#if !defined(clock_UpdateTime)
extern void clock_UpdateTime(void);
#endif
# 195 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#if defined(UKERNEL) && !defined(osi_GetTime)
extern int osi_GetTime(struct timeval *tv);
#endif
# 198 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"

/* rx_clock_nt.c */


/* rx_conncache.c */
extern void rxi_DeleteCachedConnections(void);
extern struct rx_connection *rx_GetCachedConnection(unsigned int remoteAddr,
						    unsigned short port,
						    unsigned short service,
						    struct rx_securityClass
						    *securityObject,
						    int securityIndex);
extern void rx_ReleaseCachedConnection(struct rx_connection *conn);


/* rxdebug.c */


/* rx_event.c */
extern int rxevent_nFree;
extern int rxevent_nPosted;
extern struct rxevent *rxevent_Post(struct clock *when, struct clock *now,
				     void (*func) (struct rxevent *, void *,
						   void *, int),
				     void *arg, void *arg1, int arg2);
extern void shutdown_rxevent(void);
extern struct rxepoch *rxepoch_Allocate(struct clock *when);
extern void rxevent_Init(int nEvents, void (*scheduler) (void));
extern int rxevent_RaiseEvents(struct clock *next);




/* rx_getaddr.c */
extern void rxi_setaddr(afs_uint32 x);
extern afs_uint32 rxi_getaddr(void);
extern int rx_getAllAddr(afs_uint32 * buffer, int maxSize);
extern int rx_getAllAddrMaskMtu(afs_uint32 addrBuffer[],
			  	 afs_uint32 maskBuffer[],
				 afs_uint32 mtuBuffer[],
				 int maxSize);

/* rx_globals.c */
extern int rx_GetMaxReceiveWindow(void);
extern int rx_GetMaxSendWindow(void);
extern void rx_SetMaxReceiveWindow(int packets);
extern void rx_SetMaxSendWindow(int packets);
extern int rx_GetMinPeerTimeout(void);
extern void rx_SetMinPeerTimeout(int msecs);

#ifdef KERNEL
/* rx_kcommon.c */
struct socket;
extern int (*rxk_PacketArrivalProc) (struct rx_packet * ahandle,
				     struct sockaddr_in * afrom,
				     struct socket *arock,
				     afs_int32 asize);
extern int (*rxk_GetPacketProc) (struct rx_packet **ahandle, int asize);
extern afs_int32 afs_termState;
extern int rxk_initDone;

extern int rxk_DelPort(u_short aport);
extern void rxk_shutdownPorts(void);
extern osi_socket rxi_GetUDPSocket(u_short port);
extern osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
extern int osi_utoa(char *buf, size_t len, unsigned long val);
extern void rxi_InitPeerParams(struct rx_peer *pp);
extern void shutdown_rxkernel(void);
# ifdef AFS_USERSPACE_IP_ADDR
extern int rxi_GetcbiInfo(void);
extern afs_int32 rxi_Findcbi(afs_uint32 addr);
# else
# 270 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern int rxi_GetIFInfo(void);
# endif
# 272 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
# ifndef UKERNEL
extern int rxk_FreeSocket(struct socket *asocket);
extern osi_socket *rxk_NewSocket(short aport);
# endif
# 276 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern int rxk_ReadPacket(osi_socket so, struct rx_packet *p, int *host,
			  int *port);
# ifdef UKERNEL
extern void *rx_ServerProc(void *);
# endif
# 281 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
# ifndef AFS_LINUX26_ENV
extern void osi_AssertFailK(const char *expr, const char *file, int line) AFS_NORETURN;
# endif
# 284 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern void rxk_ListenerProc(void);
extern void rxk_Listener(void);
# ifndef UKERNEL
extern void afs_rxevent_daemon(void);
# endif
# 289 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern rx_ifnet_t rxi_FindIfnet(afs_uint32 addr, afs_uint32 * maskp);
extern void osi_StopListener(void);

/* ARCH/rx_kmutex.c */
# if defined(AFS_LINUX20_ENV)
extern void afs_mutex_init(afs_kmutex_t * l);
extern void afs_mutex_enter(afs_kmutex_t * l);
extern int afs_mutex_tryenter(afs_kmutex_t * l);
extern void afs_mutex_exit(afs_kmutex_t * l);
extern int afs_cv_wait(afs_kcondvar_t * cv, afs_kmutex_t * l, int sigok);
extern void afs_cv_timedwait(afs_kcondvar_t * cv, afs_kmutex_t * l,
			     int waittime);
# endif
# 302 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"



/* ARCH/rx_knet.c */
# if !defined(AFS_SGI_ENV)
extern int osi_NetSend(osi_socket asocket, struct sockaddr_in *addr,
		       struct iovec *dvec, int nvecs, afs_int32 asize,
		       int istack);
# endif
# 311 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
# ifdef RXK_UPCALL_ENV
extern void rx_upcall(socket_t so, void *arg, __unused int waitflag);
# else
# 314 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern int osi_NetReceive(osi_socket so, struct sockaddr_in *addr,
			  struct iovec *dvec, int nvecs, int *lengthp);
# endif
# 317 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
# if defined(AFS_SUN510_ENV)
extern void osi_StartNetIfPoller(void);
extern void osi_NetIfPoller(void);
extern void osi_StopNetIfPoller(void);
extern struct afs_ifinfo afsifinfo[ADDRSPERSITE];
# endif
# 323 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern void osi_StopListener(void);
extern int rxi_FindIfMTU(afs_uint32 addr);
# if defined(UKERNEL)
extern void rxi_ListenerProc(osi_socket usockp, int *tnop,
			     struct rx_call **newcallp);
# endif
# 329 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"

# if !defined(RXK_LISTENER_ENV) && !defined(RXK_UPCALL_ENV)
extern void rxk_init(void);
# endif
# 333 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"

/* UKERNEL/rx_knet.c */
# ifdef UKERNEL
extern void afs_rxevent_daemon(void);
# endif
# 338 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#endif
# 339 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"

/* rx_lwp.c */
extern void rxi_Sleep(void *addr);
extern void rxi_Delay(int seconds);
extern void rxi_InitializeThreadSupport(void);
extern void rxi_Wakeup(void *addr);
extern void rxi_StopListener(void);
#ifndef KERNEL
extern void rxi_ReScheduleEvents(void);
#endif
# 349 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern void rxi_InitializeThreadSupport(void);
extern void rxi_StartServerProc(void *(*proc) (void *), int stacksize);
extern void rxi_StartListener(void);
extern void *rx_ServerProc(void *);
extern int rxi_Listen(osi_socket sock);
extern int rxi_Recvmsg(osi_socket socket, struct msghdr *msg_p, int flags);
extern int rxi_Sendmsg(osi_socket socket, struct msghdr *msg_p, int flags);


/* rx_misc.c */
#ifndef osi_alloc
extern char *osi_alloc(afs_int32 x);
#endif
# 362 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#ifndef osi_free
extern int osi_free(char *x, afs_int32 size);
#endif
# 365 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern int hton_syserr_conv(afs_int32 code);
extern int ntoh_syserr_conv(int code);


/* rx_multi.c */
extern struct multi_handle *multi_Init(struct rx_connection **conns,
				       int nConns);
extern int multi_Select(struct multi_handle *mh);
extern void multi_Ready(struct rx_call *call,
			void *mh, int index);
extern void multi_Finalize(struct multi_handle *mh);
extern void multi_Finalize_Ignore(struct multi_handle *mh);



/* rx_null.c */
extern struct rx_securityClass *rxnull_NewServerSecurityObject(void);
extern struct rx_securityClass *rxnull_NewClientSecurityObject(void);


/* rx_packet.c */
extern afs_int32 rx_SlowGetInt32(struct rx_packet *packet, size_t offset);
extern afs_int32 rx_SlowPutInt32(struct rx_packet *packet, size_t offset,
				 afs_int32 data);
extern afs_int32 rx_SlowReadPacket(struct rx_packet *packet,
				   unsigned int offset, int resid, char *out);
extern afs_int32 rx_SlowWritePacket(struct rx_packet *packet, int offset,
				    int resid, char *in);
extern int rxi_RoundUpPacket(struct rx_packet *p, unsigned int nb);
extern int rxi_AllocDataBuf(struct rx_packet *p, int nb, int cla_ss);
extern void rxi_MorePackets(int apackets);
#if defined(AFS_PTHREAD_ENV)
extern void rxi_MorePacketsTSFPQ(int apackets, int flush_global, int num_keep_local); /* more flexible packet alloc function */
extern void rxi_FlushLocalPacketsTSFPQ(void); /* flush all thread-local packets to global queue */
#endif
# 400 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern void rxi_FreeAllPackets(void);
extern void rx_CheckPackets(void);
extern void rxi_RestoreDataBufs(struct rx_packet *p);
extern int rxi_TrimDataBufs(struct rx_packet *p, int first);
extern void rxi_FreePacket(struct rx_packet *p);
extern struct rx_packet *rxi_AllocPacket(int cla_ss);
extern int rxi_AllocPackets(int cla_ss, int num_pkts, struct opr_queue *q);
extern int rxi_FreePackets(int num_pkts, struct opr_queue *q);
extern struct rx_packet *rxi_AllocSendPacket(struct rx_call *call,
					     int want);
extern int rxi_ReadPacket(osi_socket socket, struct rx_packet *p,
			  afs_uint32 * host, u_short * port);
extern struct rx_packet *rxi_SplitJumboPacket(struct rx_packet *p,
					      afs_uint32 host, short port,
					      int first);
#ifndef KERNEL
extern int osi_NetSend(osi_socket socket, void *addr, struct iovec *dvec,
		       int nvecs, int length, int istack);
#endif
# 419 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern struct rx_packet *rxi_ReceiveDebugPacket(struct rx_packet *ap,
						osi_socket asocket,
						afs_uint32 ahost, short aport,
						int istack);
extern struct rx_packet *rxi_ReceiveVersionPacket(struct rx_packet
						  *ap, osi_socket asocket,
						  afs_uint32 ahost,
						  short aport, int istack);
extern void rxi_SendPacket(struct rx_call *call, struct rx_connection *conn,
			   struct rx_packet *p, int istack);
extern void rxi_SendPacketList(struct rx_call *call,
			       struct rx_connection *conn,
			       struct rx_packet **list, int len, int istack);
extern void rxi_SendRawAbort(osi_socket socket, afs_uint32 host, u_short port,
			     afs_int32 error, struct rx_packet *source,
			     int istack);
extern struct rx_packet *rxi_SendSpecial(struct rx_call *call,
					 struct rx_connection *conn,
					 struct rx_packet *optionalPacket,
					 int type, char *data, int nbytes,
					 int istack);
extern void rxi_EncodePacketHeader(struct rx_packet *p);
extern void rxi_DecodePacketHeader(struct rx_packet *p);
extern void rxi_PrepareSendPacket(struct rx_call *call,
				  struct rx_packet *p,
				  int last);
extern int rxi_AdjustIfMTU(int mtu);
extern int rxi_AdjustMaxMTU(int mtu, int peerMaxMTU);
extern int rxi_AdjustDgramPackets(int frags, int mtu);

/* rxperf.c */


/* rx_pthread.c */
extern int rx_NewThreadId(void);
extern void rxi_Delay(int sec);
extern void rxi_InitializeThreadSupport(void);
extern void rxi_StartServerProc(void *(*proc) (void *), int stacksize);
#ifndef rxi_ReScheduleEvents
extern void rxi_ReScheduleEvents(void);
#endif
# 460 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern void *rx_ServerProc(void *);
extern void rxi_StartListener(void);
extern int rxi_Listen(osi_socket sock);
extern int rxi_Recvmsg(osi_socket socket, struct msghdr *msg_p, int flags);
extern int rxi_Sendmsg(osi_socket socket, struct msghdr *msg_p, int flags);

/* rx_rdwr.c */
extern int rxi_ReadProc(struct rx_call *call, char *buf,
			int nbytes);
extern int rx_ReadProc(struct rx_call *call, char *buf, int nbytes);
extern int rx_ReadProc32(struct rx_call *call, afs_int32 * value);
extern int rxi_FillReadVec(struct rx_call *call, afs_uint32 serial);
extern int rxi_ReadvProc(struct rx_call *call, struct iovec *iov, int *nio,
			 int maxio, int nbytes);
extern int rx_ReadvProc(struct rx_call *call, struct iovec *iov, int *nio,
			int maxio, int nbytes);
extern int rxi_WriteProc(struct rx_call *call, char *buf,
			 int nbytes);
extern int rx_WriteProc(struct rx_call *call, char *buf, int nbytes);
extern int rx_WriteProc32(struct rx_call *call,
			  afs_int32 * value);
extern int rx_WritevAlloc(struct rx_call *call, struct iovec *iov, int *nio,
			  int maxio, int nbytes);
extern int rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio,
			  int nbytes);
extern int rx_WritevProc(struct rx_call *call, struct iovec *iov, int nio,
			 int nbytes);
extern void rxi_FlushWrite(struct rx_call *call);
extern void rx_FlushWrite(struct rx_call *call);



/* rx_stats.c */
extern struct rx_statistics * rx_GetStatistics(void);
extern void rx_FreeStatistics(struct rx_statistics **);

/* rx_trace.c */


/* rx_user.c */
#ifdef AFS_PTHREAD_ENV
extern afs_kmutex_t rx_if_init_mutex;
extern afs_kmutex_t rx_if_mutex;
#endif
# 504 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern osi_socket rxi_GetUDPSocket(u_short port);
extern void rxi_InitPeerParams(struct rx_peer *pp);
extern int rxi_HandleSocketError(int socket);

#if defined(AFS_AIX32_ENV) && !defined(KERNEL)
#ifndef osi_Alloc
extern void *osi_Alloc(afs_int32 x);
#endif
# 512 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#ifndef osi_Free
extern void osi_Free(void *x, afs_int32 size);
#endif
# 515 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#endif /* defined(AFS_AIX32_ENV) && !defined(KERNEL) */
# 516 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#ifndef KERNEL
extern void osi_Panic(char *fmt, ...) AFS_NORETURN;
#endif
# 519 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"

extern void rx_GetIFInfo(void);
extern void rx_SetNoJumbo(void);
extern int rx_SetMaxMTU(int mtu);

/* rx_xmit_nt.c */


/* MISC PROTOTYPES - MOVE TO APPROPRIATE LOCATION LATER */

/* EXTERNAL PROTOTYPES - include here cause it causes too many issues to
   include the afs_prototypes.h file - just make sure they match */
#ifndef afs_osi_Alloc
extern void *afs_osi_Alloc(size_t x);
#endif
# 534 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#ifndef afs_osi_Free
extern void afs_osi_Free(void *x, size_t asize);
#endif
# 537 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#ifndef afs_osi_Wakeup
extern int afs_osi_Wakeup(void *event);
#endif
# 540 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
#ifndef afs_osi_Sleep
extern void afs_osi_Sleep(void *event);
#endif
# 543 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
extern unsigned int afs_random(void);
extern void osi_linux_rxkreg(void);

#endif /* _RX_PROTOTYPES_H */
# 547 "/usr/home/kaduk/openafs/build/include/rx/rx_prototypes.h"
# 871 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 2
#endif
# 872 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

static_inline afs_uint32
RPCOpStat_Peer(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_peer;
}

static_inline afs_uint32
RPCOpStat_Port(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_port;
}

static_inline afs_uint32
RPCOpStat_IsServer(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_is_server;
}

static_inline afs_uint32
RPCOpStat_InterfaceId(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->interfaceId;
}

static_inline afs_uint32
RPCOpStat_NumFuncs(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->func_total;
}

static_inline afs_uint32
RPCOpStat_CurFunc(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->func_index;
}

static_inline struct clock *
RPCOpStat_QTimeSum(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_sum);
}

static_inline struct clock *
RPCOpStat_QTimeSumSqr(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_sum_sqr);
}

static_inline struct clock *
RPCOpStat_QTimeSumMin(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_min);
}

static_inline struct clock *
RPCOpStat_QTimeSumMax(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_max);
}

static_inline struct clock *
RPCOpStat_ExecTimeSum(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_sum);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumSqr(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_sum_sqr);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumMin(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_min);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumMax(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_max);
}

static_inline afs_uint64
RPCOpStat_NumCalls(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->invocations;
}

static_inline afs_uint64
RPCOpStat_BytesSent(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->bytes_sent;
}

static_inline afs_uint64
RPCOpStat_BytesRcvd(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->bytes_rcvd;
}
#endif /* !KDUMP_RX_LOCK */
# 975 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
# 61 "/usr/home/kaduk/openafs/build/include/afs/afsint.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <rx/rx_globals.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/* RX:  Globals for internal use, basically */

#ifndef AFS_RX_GLOBALS_H
#define AFS_RX_GLOBALS_H


#ifdef	KERNEL
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx.h"
#endif /* expanded by -frewrite-includes */
# 18 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#else /* KERNEL */
# 19 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#if 0 /* expanded by -frewrite-includes */
# include "rx.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifdef KDUMP_RX_LOCK
/* kdump for SGI needs MP and SP versions of rx_serverQueueEntry,
 * rx_peer, rx_connection and rx_call structs. rx.h gets included a
 * second time to pick up mp_ versions of those structs. Currently
 * the affected struct's have #ifdef's in them for the second pass.
 * This should change once we start using only ANSI compilers.
 * Actually, kdump does not use rx_serverQueueEntry, but I'm including
 * it for completeness.
 */
#undef _RX_
#endif
# 21 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef	_RX_
#define _RX_

#ifndef KDUMP_RX_LOCK
#ifdef	KERNEL
#if 0 /* expanded by -frewrite-includes */
#include "rx_kmutex.h"
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_kernel.h"
#endif /* expanded by -frewrite-includes */
# 29 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if defined (AFS_OBSD_ENV) && !defined (MLEN)
#if 0 /* expanded by -frewrite-includes */
#include "sys/mbuf.h"
#endif /* expanded by -frewrite-includes */
# 31 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 32 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "netinet/in.h"
#endif /* expanded by -frewrite-includes */
# 33 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "sys/socket.h"
#endif /* expanded by -frewrite-includes */
# 34 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else /* KERNEL */
# 35 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 36 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <string.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifdef AFS_PTHREAD_ENV
#if 0 /* expanded by -frewrite-includes */
# include "rx_pthread.h"
#endif /* expanded by -frewrite-includes */
# 40 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else
# 41 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include "rx_lwp.h"
#endif /* expanded by -frewrite-includes */
# 42 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 43 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifdef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
#include <malloc.h>
#endif /* expanded by -frewrite-includes */
# 45 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include <winsock2.h>
#endif /* expanded by -frewrite-includes */
# 46 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include <ws2tcpip.h>
#endif /* expanded by -frewrite-includes */
# 47 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 48 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include "rx_user.h"
#endif /* expanded by -frewrite-includes */
# 49 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifndef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
# include <netinet/in.h>
#endif /* expanded by -frewrite-includes */
# 51 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/socket.h>
#endif /* expanded by -frewrite-includes */
# 52 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 53 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif /* KERNEL */
# 54 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#if 0 /* expanded by -frewrite-includes */
#include <opr/queue.h>
#endif /* expanded by -frewrite-includes */
# 56 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#if 0 /* expanded by -frewrite-includes */
#include "rx_clock.h"
#endif /* expanded by -frewrite-includes */
# 58 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_event.h"
#endif /* expanded by -frewrite-includes */
# 59 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_misc.h"
#endif /* expanded by -frewrite-includes */
# 60 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_null.h"
#endif /* expanded by -frewrite-includes */
# 61 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_multi.h"
#endif /* expanded by -frewrite-includes */
# 62 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* These items are part of the new RX API. They're living in this section
 * for now, to keep them separate from everything else... */

struct rx_connection;
struct rx_call;
struct rx_packet;

/* Connection management */

extern void rx_SetConnectionEpoch(struct rx_connection *conn, afs_uint32 epoch);
extern afs_uint32  rx_GetConnectionEpoch(struct rx_connection *conn);
extern void rx_SetConnectionId(struct rx_connection *conn, afs_uint32 id);
extern afs_uint32  rx_GetConnectionId(struct rx_connection *conn);
extern void *rx_GetSecurityData(struct rx_connection *conn);
extern void  rx_SetSecurityData(struct rx_connection *conn, void *data);
extern int  rx_IsUsingPktCksum(struct rx_connection *conn);
extern void rx_SetSecurityHeaderSize(struct rx_connection *conn, afs_uint32 size);
extern afs_uint32  rx_GetSecurityHeaderSize(struct rx_connection *conn);
extern void rx_SetSecurityMaxTrailerSize(struct rx_connection *conn, afs_uint32 size);
extern afs_uint32  rx_GetSecurityMaxTrailerSize(struct rx_connection *conn);
extern void rx_SetMsgsizeRetryErr(struct rx_connection *conn, int err);
extern int  rx_IsServerConn(struct rx_connection *conn);
extern int  rx_IsClientConn(struct rx_connection *conn);
extern struct rx_securityClass *rx_SecurityObjectOf(const struct rx_connection *);
extern struct rx_peer *rx_PeerOf(struct rx_connection *);
extern u_short rx_ServiceIdOf(struct rx_connection *);
extern int rx_SecurityClassOf(struct rx_connection *);
extern struct rx_service *rx_ServiceOf(struct rx_connection *);
extern int rx_ConnError(struct rx_connection *);

/* Call management */
extern struct rx_connection *rx_ConnectionOf(struct rx_call *call);
extern int rx_Error(struct rx_call *call);
extern int rx_GetRemoteStatus(struct rx_call *call);
extern void rx_SetLocalStatus(struct rx_call *call, int status);
extern int rx_GetCallAbortCode(struct rx_call *call);
extern void rx_SetCallAbortCode(struct rx_call *call, int code);

extern void rx_RecordCallStatistics(struct rx_call *call,
				    unsigned int rxInterface,
				    unsigned int currentFunc,
				    unsigned int totalFunc,
				    int isServer);

/* Peer management */
extern afs_uint32 rx_HostOf(struct rx_peer *peer);
extern u_short rx_PortOf(struct rx_peer *peer);

/* Packets */

/* Packet classes, for rx_AllocPacket and rx_packetQuota */
#define	RX_PACKET_CLASS_RECEIVE	    0
#define	RX_PACKET_CLASS_SEND	    1
#define	RX_PACKET_CLASS_SPECIAL	    2
#define	RX_PACKET_CLASS_RECV_CBUF   3
#define	RX_PACKET_CLASS_SEND_CBUF   4

#define	RX_N_PACKET_CLASSES	    5	/* Must agree with above list */

#define	RX_PACKET_TYPES	    {"data", "ack", "busy", "abort", "ackall", "challenge", "response", "debug", "params", "unused", "unused", "unused", "version"}
#define	RX_N_PACKET_TYPES	    13	/* Must agree with above list;
					 * counts 0
					 * WARNING: if this number ever
					 * grows past 13, rxdebug packets
					 * will need to be modified */


/* For most Unixes, maximum elements in an iovec is 16 */
#define RX_MAXIOVECS 16		        /* limit for ReadvProc/WritevProc */
#define RX_MAXWVECS (RX_MAXIOVECS-1)	/* need one iovec for packet header */

/* Debugging */

/* Call flags, states and modes are exposed by the debug interface */
#ifndef KDUMP_RX_LOCK
/* Major call states */
#define	RX_STATE_NOTINIT  0	/* Call structure has never been initialized */
#define	RX_STATE_PRECALL  1	/* Server-only:  call is not in progress, but packets have arrived */
#define	RX_STATE_ACTIVE	  2	/* An active call; a process is dealing with this call */
#define	RX_STATE_DALLY	  3	/* Dallying after process is done with call */
#define	RX_STATE_HOLD	  4	/* Waiting for acks on reply data packets */
#define RX_STATE_RESET    5     /* Call is being reset */

/* Call modes:  the modes of a call in RX_STATE_ACTIVE state (process attached) */
#define	RX_MODE_SENDING	  1	/* Sending or ready to send */
#define	RX_MODE_RECEIVING 2	/* Receiving or ready to receive */
#define	RX_MODE_ERROR	  3	/* Something in error for current conversation */
#define	RX_MODE_EOF	  4	/* Server has flushed (or client has read) last reply packet */

/* Flags */
#define	RX_CALL_READER_WAIT	   1	/* Reader is waiting for next packet */
#define	RX_CALL_WAIT_WINDOW_ALLOC  2	/* Sender is waiting for window to allocate buffers */
#define	RX_CALL_WAIT_WINDOW_SEND   4	/* Sender is waiting for window to send buffers */
#define	RX_CALL_WAIT_PACKETS	   8	/* Sender is waiting for packet buffers */
#define	RX_CALL_WAIT_PROC	  16	/* Waiting for a process to be assigned */
#define	RX_CALL_RECEIVE_DONE	  32	/* All packets received on this call */
#define	RX_CALL_CLEARED		  64	/* Receive queue cleared in precall state */
#define	RX_CALL_TQ_BUSY		 128	/* Call's Xmit Queue is busy; don't modify */
#define	RX_CALL_TQ_CLEARME	 256	/* Need to clear this call's TQ later */
#define RX_CALL_TQ_SOME_ACKED    512	/* rxi_Start needs to discard ack'd packets. */
#define RX_CALL_TQ_WAIT		1024	/* Reader is waiting for TQ_BUSY to be reset */
#define RX_CALL_FAST_RECOVER    2048	/* call is doing congestion recovery */
/* 4096 was RX_CALL_FAST_RECOVER_WAIT */
#define RX_CALL_SLOW_START_OK   8192	/* receiver acks every other packet */
#define RX_CALL_IOVEC_WAIT	16384	/* waiting thread is using an iovec */
#define RX_CALL_HAVE_LAST	32768	/* Last packet has been received */
#define RX_CALL_NEED_START	0x10000	/* tells rxi_Start to start again */
#define RX_CALL_PEER_BUSY	0x20000 /* the last packet we received on this call was a
                                         * BUSY packet; i.e. the channel for this call is busy */
#define RX_CALL_ACKALL_SENT     0x40000 /* ACKALL has been sent on the call */
#define RX_CALL_FLUSH		0x80000 /* Transmit queue should be flushed to peer */
#endif
# 175 "/usr/home/kaduk/openafs/build/include/rx/rx.h"


/* Configurable parameters */
#define	RX_IDLE_DEAD_TIME	60	/* default idle dead time */
#define	RX_MAX_SERVICES		20	/* Maximum number of services that may be installed */
#if defined(KERNEL) && defined(AFS_AIX51_ENV) && defined(__64__)
#define RX_DEFAULT_STACK_SIZE   24000
#else
# 183 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#define	RX_DEFAULT_STACK_SIZE	16000	/* Default process stack size; overriden by rx_SetStackSize */
#endif
# 185 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* This parameter should not normally be changed */
#define	RX_PROCESS_PRIORITY	LWP_NORMAL_PRIORITY

#define ADDRSPERSITE 16

#ifndef KDUMP_RX_LOCK
/* Bottom n-bits of the Call Identifier give the call number */
#define	RX_MAXCALLS 4		/* Power of 2; max async calls per connection */
#define	RX_CIDSHIFT 2		/* Log2(RX_MAXCALLS) */
#define	RX_CHANNELMASK (RX_MAXCALLS-1)
#define	RX_CIDMASK  (~RX_CHANNELMASK)
#endif /* !KDUMP_RX_LOCK */
# 198 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef KERNEL
typedef void (*rx_destructor_t) (void *);
int rx_KeyCreate(rx_destructor_t);
osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
osi_socket rxi_GetUDPSocket(u_short port);
#endif /* KERNEL */
# 205 "/usr/home/kaduk/openafs/build/include/rx/rx.h"


int ntoh_syserr_conv(int error);

#define	RX_WAIT	    1
#define	RX_DONTWAIT 0

#define rx_GetLocalStatus(call, status) ((call)->localStatus)


static_inline int
rx_IsLoopbackAddr(afs_uint32 addr)
{
    return ((addr & 0xffff0000) == 0x7f000000);
}

/*******************
 * Macros callable by the user to further define attributes of a
 * service.  Must be called before rx_StartServer
 */

/* Set the service stack size.  This currently just sets the stack
 * size for all processes to be the maximum seen, so far */
#define rx_SetStackSize(service, stackSize) \
  rx_stackSize = (((stackSize) > rx_stackSize)? stackSize: rx_stackSize)

/* Set minimum number of processes guaranteed to be available for this
 * service at all times */
#define rx_SetMinProcs(service, min) ((service)->minProcs = (min))

/* Set maximum number of processes that will be made available to this
 * service (also a guarantee that this number will be made available
 * if there is no competition) */
#define rx_SetMaxProcs(service, max) ((service)->maxProcs = (max))

/* Define a procedure to be called just before a server connection is destroyed */
#define rx_SetDestroyConnProc(service,proc) ((service)->destroyConnProc = (proc))

/* Define procedure to set service dead time */
#define rx_SetIdleDeadTime(service,time) ((service)->idleDeadTime = (time))

/*
 * Define error to return in server connections when failing to answer.
 * (server only) For example, AFS viced sends VNOSERVICE.
 */
#define rx_SetServerIdleDeadErr(service,err) ((service)->idleDeadErr = (err))

/* Define procedures for getting and setting before and after execute-request procs */
#define rx_SetAfterProc(service,proc) ((service)->afterProc = (proc))
#define rx_SetBeforeProc(service,proc) ((service)->beforeProc = (proc))
#define rx_GetAfterProc(service) ((service)->afterProc)
#define rx_GetBeforeProc(service) ((service)->beforeProc)
#define rx_SetPostProc(service,proc) ((service)->postProc = (proc))
#define rx_GetPostProc(service) ((service)->postProc)

/* Define a procedure to be called when a server connection is created */
#define rx_SetNewConnProc(service, proc) ((service)->newConnProc = (proc))

/* NOTE:  We'll probably redefine the following three routines, again, sometime. */

/* Set the connection dead time for any connections created for this service (server only) */
#define rx_SetServiceDeadTime(service, seconds) ((service)->secondsUntilDead = (seconds))

/* Enable or disable asymmetric client checking for a service */
#define rx_SetCheckReach(service, x) ((service)->checkReach = (x))

/* Set the overload threshold and the overload error */
#define rx_SetBusyThreshold(threshold, code) (rx_BusyThreshold=(threshold),rx_BusyError=(code))

/* If this flag is set,no new requests are processed by rx, all new requests are
returned with an error code of RX_CALL_DEAD ( transient error ) */
#define	rx_SetRxTranquil()   		(rx_tranquil = 1)
#define	rx_ClearRxTranquil()   		(rx_tranquil = 0)

/* Set the threshold and time to delay aborts for consecutive errors */
#define rx_SetCallAbortThreshold(A) (rxi_callAbortThreshhold = (A))
#define rx_SetCallAbortDelay(A) (rxi_callAbortDelay = (A))
#define rx_SetConnAbortThreshold(A) (rxi_connAbortThreshhold = (A))
#define rx_SetConnAbortDelay(A) (rxi_connAbortDelay = (A))



#define cpspace(call) ((call)->curlen)
#define cppos(call) ((call)->curpos)

#define	rx_Read(call, buf, nbytes)   rx_ReadProc(call, buf, nbytes)
#define	rx_Read32(call, value)   rx_ReadProc32(call, value)
#define	rx_Readv(call, iov, nio, maxio, nbytes) \
   rx_ReadvProc(call, iov, nio, maxio, nbytes)
#define	rx_Write(call, buf, nbytes) rx_WriteProc(call, buf, nbytes)
#define	rx_Write32(call, value) rx_WriteProc32(call, value)
#define	rx_Writev(call, iov, nio, nbytes) \
   rx_WritevProc(call, iov, nio, nbytes)

/* This is the maximum size data packet that can be sent on this connection, accounting for security module-specific overheads. */
#define	rx_MaxUserDataSize(call)		((call)->MTU - RX_HEADER_SIZE - (call)->conn->securityHeaderSize - (call)->conn->securityMaxTrailerSize)

/* Macros to turn the hot thread feature on and off. Enabling hot threads
 * allows the listener thread to trade places with an idle worker thread,
 * which moves the context switch from listener to worker out of the
 * critical path.
 */
#define rx_EnableHotThread()		(rx_enable_hot_thread = 1)
#define rx_DisableHotThread()		(rx_enable_hot_thread = 0)

#define rx_PutConnection(conn) rx_DestroyConnection(conn)

/* A service is installed by rx_NewService, and specifies a service type that
 * is exported by this process.  Incoming calls are stamped with the service
 * type, and must match an installed service for the call to be accepted.
 * Each service exported has a (port,serviceId) pair to uniquely identify it.
 * It is also named:  this is intended to allow a remote statistics gathering
 * program to retrieve per service statistics without having to know the local
 * service id's.  Each service has a number of
 */

/* security objects (instances of security classes) which implement
 * various types of end-to-end security protocols for connections made
 * to this service.  Finally, there are two parameters controlling the
 * number of requests which may be executed in parallel by this
 * service: minProcs is the number of requests to this service which
 * are guaranteed to be able to run in parallel at any time; maxProcs
 * has two meanings: it limits the total number of requests which may
 * execute in parallel and it also guarantees that that many requests
 * may be handled in parallel if no other service is handling any
 * requests. */

struct rx_service {
    u_short serviceId;		/* Service number */
    afs_uint32 serviceHost;	/* IP address for this service */
    u_short servicePort;	/* UDP port for this service */
    char *serviceName;		/* Name of the service */
    osi_socket socket;		/* socket structure or file descriptor */
    u_short nRequestsRunning;	/* Number of requests currently in progress */
    u_short nSecurityObjects;	/* Number of entries in security objects array */
    struct rx_securityClass **securityObjects;	/* Array of security class objects */
      afs_int32(*executeRequestProc) (struct rx_call * acall);	/* Routine to call when an rpc request is received */
    void (*destroyConnProc) (struct rx_connection * tcon);	/* Routine to call when a server connection is destroyed */
    void (*newConnProc) (struct rx_connection * tcon);	/* Routine to call when a server connection is created */
    void (*beforeProc) (struct rx_call * acall);	/* routine to call before a call is executed */
    void (*afterProc) (struct rx_call * acall, afs_int32 code);	/* routine to call after a call is executed */
    void (*postProc) (afs_int32 code);	/* routine to call after the call has ended */
    u_short maxProcs;		/* Maximum procs to be used for this service */
    u_short minProcs;		/* Minimum # of requests guaranteed executable simultaneously */
    u_short connDeadTime;	/* Seconds until a client of this service will be declared dead, if it is not responding */
    u_short idleDeadTime;	/* Time a server will wait for I/O to start up again */
    u_char checkReach;		/* Check for asymmetric clients? */
    afs_int32 idleDeadErr;
    int nSpecific;		/* number entries in specific data */
    void **specific;		/* pointer to connection specific data */
#ifdef	RX_ENABLE_LOCKS
    afs_kmutex_t svc_data_lock;	/* protect specific data */
#endif
# 358 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

};

#endif /* KDUMP_RX_LOCK */
# 362 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef KDUMP_RX_LOCK
/* Flag bits for connection structure */
#define	RX_CONN_MAKECALL_WAITING    1	/* rx_NewCall is waiting for a channel */
#define	RX_CONN_DESTROY_ME	    2	/* Destroy *client* connection after last call */
#define RX_CONN_USING_PACKET_CKSUM  4	/* non-zero header.spare field seen */
#define RX_CONN_KNOW_WINDOW         8	/* window size negotiation works */
#define RX_CONN_RESET		   16	/* connection is reset, remove */
#define RX_CONN_BUSY               32	/* connection is busy; don't delete */
#define RX_CONN_ATTACHWAIT	   64	/* attach waiting for peer->lastReach */
#define RX_CONN_MAKECALL_ACTIVE   128   /* a thread is actively in rx_NewCall */
#define RX_CONN_NAT_PING          256   /* nat ping requested */

/* Type of connection, client or server */
#define	RX_CLIENT_CONNECTION	0
#define	RX_SERVER_CONNECTION	1
#endif /* !KDUMP_RX_LOCK */
# 379 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* Maximum number of acknowledgements in an acknowledge packet */
#define	RX_MAXACKS	    255

#ifndef KDUMP_RX_LOCK

/* The structure of the data portion of an acknowledge packet: An acknowledge
 * packet is in network byte order at all times.  An acknowledgement is always
 * prompted for a specific reason by a specific incoming packet.  This reason
 * is reported in "reason" and the packet's sequence number in the packet
 * header.seq.  In addition to this information, all of the current
 * acknowledgement information about this call is placed in the packet.
 * "FirstPacket" is the sequence number of the first packet represented in an
 * array of bytes, "acks", containing acknowledgement information for a number
 * of consecutive packets.  All packets prior to FirstPacket are implicitly
 * acknowledged: the sender need no longer be concerned about them.  Packets
 * from firstPacket+nAcks and on are not acknowledged.  Packets in the range
 * [firstPacket,firstPacket+nAcks) are each acknowledged explicitly.  The
 * acknowledgement may be RX_NACK if the packet is not (currently) at the
 * receiver (it may have never been received, or received and then later
 * dropped), or it may be RX_ACK if the packet is queued up waiting to be read
 * by the upper level software.  RX_ACK does not imply that the packet may not
 * be dropped before it is read; it does imply that the sender should stop
 * retransmitting the packet until notified otherwise.  The field
 * previousPacket identifies the previous packet received by the peer.  This
 * was used in a previous version of this software, and could be used in the
 * future.  The serial number in the data part of the ack packet corresponds to
 * the serial number oof the packet which prompted the acknowledge.  Any
 * packets which are explicitly not acknowledged, and which were last
 * transmitted with a serial number less than the provided serial number,
 * should be retransmitted immediately.  Actually, this is slightly inaccurate:
 * packets are not necessarily received in order.  When packets are habitually
 * transmitted out of order, this is allowed for in the retransmission
 * algorithm by introducing the notion of maximum packet skew: the degree of
 * out-of-orderness of the packets received on the wire.  This number is
 * communicated from the receiver to the sender in ack packets. */

struct rx_ackPacket {
    u_short bufferSpace;	/* Number of packet buffers available.  That is:  the number of buffers that the sender of the ack packet is willing to provide for data, on this or subsequent calls.  Lying is permissable. */
    u_short maxSkew;		/* Maximum difference between serial# of packet acknowledged and highest packet yet received */
    afs_uint32 firstPacket;	/* The first packet in the list of acknowledged packets */
    afs_uint32 previousPacket;	/* The previous packet number received (obsolete?) */
    afs_uint32 serial;		/* Serial number of the packet which prompted the acknowledge */
    u_char reason;		/* Reason for the acknowledge of ackPacket, defined below */
    u_char nAcks;		/* Number of acknowledgements */
    u_char acks[RX_MAXACKS];	/* Up to RX_MAXACKS packet acknowledgements, defined below */
    /* Packets <firstPacket are implicitly acknowledged and may be discarded by the sender.  Packets >= firstPacket+nAcks are implicitly NOT acknowledged.  No packets with sequence numbers >= firstPacket should be discarded by the sender (they may thrown out at any time by the receiver) */
};

#define FIRSTACKOFFSET 4

/* Reason for acknowledge message */
#define	RX_ACK_REQUESTED	1	/* Peer requested an ack on this packet */
#define	RX_ACK_DUPLICATE	2	/* Duplicate packet */
#define	RX_ACK_OUT_OF_SEQUENCE	3	/* Packet out of sequence */
#define	RX_ACK_EXCEEDS_WINDOW	4	/* Packet sequence number higher than window; discarded */
#define	RX_ACK_NOSPACE		5	/* No buffer space at all */
#define	RX_ACK_PING		6	/* This is a keep-alive ack */
#define	RX_ACK_PING_RESPONSE	7	/* Ack'ing because we were pinged */
#define	RX_ACK_DELAY		8	/* Ack generated since nothing has happened since receiving packet */
#define RX_ACK_IDLE             9	/* Similar to RX_ACK_DELAY, but can
					 * be used to compute RTT */
#define RX_ACK_MTU             -1       /* will be rewritten to ACK_PING */

/* Packet acknowledgement type */
#define	RX_ACK_TYPE_NACK	0	/* I Don't have this packet */
#define	RX_ACK_TYPE_ACK		1	/* I have this packet, although I may discard it later */

/* The packet size transmitted for an acknowledge is adjusted to reflect the actual size of the acks array.  This macro defines the size */
#define rx_AckDataSize(nAcks) (3 + nAcks + offsetof(struct rx_ackPacket, acks[0]))

#define	RX_CHALLENGE_TIMEOUT	2	/* Number of seconds before another authentication request packet is generated */
#define RX_CHALLENGE_MAXTRIES	50	/* Max # of times we resend challenge */
#define	RX_CHECKREACH_TIMEOUT	2	/* Number of seconds before another ping is generated */
#define	RX_CHECKREACH_TTL	60	/* Re-check reachability this often */

/*
 * rx_GetNetworkError 'origin' constants. These define the meaning of the
 * 'type' and 'code' values returned by rx_GetNetworkError.
 */

/* Used for ICMP errors; the type and code are the ICMP type and code,
 * respectively */
#define RX_NETWORK_ERROR_ORIGIN_ICMP (0)

/*
 * RX error codes.  RX uses error codes from -1 to -64 and -100.
 * Rxgen uses other error codes < -64 (see src/rxgen/rpc_errors.h);
 * user programs are expected to return positive error codes
 */

/* Something bad happened to the connection; temporary loss of communication */
#define	RX_CALL_DEAD		    (-1)

/*
 * An invalid operation, such as a client attempting to send data
 * after having received the beginning of a reply from the server.
 */
#define	RX_INVALID_OPERATION	    (-2)

/* An optional timeout per call may be specified */
#define	RX_CALL_TIMEOUT		    (-3)

/* End of data on a read.  Not currently in use. */
#define	RX_EOF			    (-4)

/* Some sort of low-level protocol error. */
#define	RX_PROTOCOL_ERROR	    (-5)

/*
 * Generic user abort code; used when no more specific error code needs to be
 * communicated.  For example, multi rx clients use this code to abort a multi-
 * rx call.
 */
#define	RX_USER_ABORT		    (-6)

/* Port already in use (from rx_Init).  This error is never sent on the wire. */
#define RX_ADDRINUSE		    (-7)

/* EMSGSIZE returned from network.  Packet too big, must fragment */
#define RX_MSGSIZE		    (-8)

/*
 * Idle dead timeout error.  This error is never sent on the wire.
 * rxi_SendCallAbort() translates RX_CALL_IDLE to RX_CALL_TIMEOUT.
 */
#define RX_CALL_IDLE                (-9)

/*
 * Busy call channel error.  This error is never sent on the wire.
 * rxi_SendCallAbort() translates RX_CALL_BUSY to RX_CALL_TIMEOUT.
 */
#define RX_CALL_BUSY                (-10)

/* transient failure detected ( possibly the server is restarting ) */
/* this should be equal to VRESTARTING ( util/errors.h ) for old clients to work */
#define RX_RESTARTING		    (-100)

typedef enum {
    RX_SECIDX_NULL = 0,
    RX_SECIDX_KAD  = 2,
    RX_SECIDX_GK   = 4,
    RX_SECIDX_K5   = 5,
} rx_securityIndex;

struct rx_securityObjectStats {
    char type;			/* 0:unk 1:null,2:vab 3:kad */
    char level;
    char sparec[10];		/* force correct alignment */
    afs_int32 flags;		/* 1=>unalloc, 2=>auth, 4=>expired */
    afs_uint32 expires;
    afs_uint32 packetsReceived;
    afs_uint32 packetsSent;
    afs_uint32 bytesReceived;
    afs_uint32 bytesSent;
    short spares[4];
    afs_int32 sparel[8];
};

/* Configuration settings */

/* Enum for storing configuration variables which can be set via the
 * SetConfiguration method in the rx_securityClass, below
 */

typedef enum {
     RXS_CONFIG_FLAGS /* afs_uint32 set of bitwise flags */
} rx_securityConfigVariables;

/* For the RXS_CONFIG_FLAGS, the following bit values are defined */

/* Disable the principal name contains dot check in rxkad */
#define RXS_CONFIG_FLAGS_DISABLE_DOTCHECK	0x01

/* XXXX (rewrite this description) A security class object contains a set of
 * procedures and some private data to implement a security model for rx
 * connections.  These routines are called by rx as appropriate.  Rx knows
 * nothing about the internal details of any particular security model, or
 * about security state.  Rx does maintain state per connection on behalf of
 * the security class.  Each security class implementation is also expected to
 * provide routines to create these objects.  Rx provides a basic routine to
 * allocate one of these objects; this routine must be called by the class. */
struct rx_securityClass {
    struct rx_securityOps {
	int (*op_Close) (struct rx_securityClass * aobj);
	int (*op_NewConnection) (struct rx_securityClass * aobj,
				 struct rx_connection * aconn);
	int (*op_PreparePacket) (struct rx_securityClass * aobj,
				 struct rx_call * acall,
				 struct rx_packet * apacket);
	int (*op_SendPacket) (struct rx_securityClass * aobj,
			      struct rx_call * acall,
			      struct rx_packet * apacket);
	int (*op_CheckAuthentication) (struct rx_securityClass * aobj,
				       struct rx_connection * aconn);
	int (*op_CreateChallenge) (struct rx_securityClass * aobj,
				   struct rx_connection * aconn);
	int (*op_GetChallenge) (struct rx_securityClass * aobj,
				struct rx_connection * aconn,
				struct rx_packet * apacket);
	int (*op_GetResponse) (struct rx_securityClass * aobj,
			       struct rx_connection * aconn,
			       struct rx_packet * apacket);
	int (*op_CheckResponse) (struct rx_securityClass * aobj,
				 struct rx_connection * aconn,
				 struct rx_packet * apacket);
	int (*op_CheckPacket) (struct rx_securityClass * aobj,
			       struct rx_call * acall,
			       struct rx_packet * apacket);
	int (*op_DestroyConnection) (struct rx_securityClass * aobj,
				     struct rx_connection * aconn);
	int (*op_GetStats) (struct rx_securityClass * aobj,
			    struct rx_connection * aconn,
			    struct rx_securityObjectStats * astats);
	int (*op_SetConfiguration) (struct rx_securityClass * aobj,
				    struct rx_connection * aconn,
				    rx_securityConfigVariables atype,
				    void * avalue,
				    void ** acurrentValue);
	int (*op_Spare2) (void);
	int (*op_Spare3) (void);
    } *ops;
    void *privateData;
    int refCount;
};

#define RXS_OP(obj,op,args) ((obj && (obj->ops->op_ ## op)) ? (*(obj)->ops->op_ ## op)args : 0)

#define RXS_Close(obj) RXS_OP(obj,Close,(obj))
#define RXS_NewConnection(obj,conn) RXS_OP(obj,NewConnection,(obj,conn))
#define RXS_PreparePacket(obj,call,packet) RXS_OP(obj,PreparePacket,(obj,call,packet))
#define RXS_SendPacket(obj,call,packet) RXS_OP(obj,SendPacket,(obj,call,packet))
#define RXS_CheckAuthentication(obj,conn) RXS_OP(obj,CheckAuthentication,(obj,conn))
#define RXS_CreateChallenge(obj,conn) RXS_OP(obj,CreateChallenge,(obj,conn))
#define RXS_GetChallenge(obj,conn,packet) RXS_OP(obj,GetChallenge,(obj,conn,packet))
#define RXS_GetResponse(obj,conn,packet) RXS_OP(obj,GetResponse,(obj,conn,packet))
#define RXS_CheckResponse(obj,conn,packet) RXS_OP(obj,CheckResponse,(obj,conn,packet))
#define RXS_CheckPacket(obj,call,packet) RXS_OP(obj,CheckPacket,(obj,call,packet))
#define RXS_DestroyConnection(obj,conn) RXS_OP(obj,DestroyConnection,(obj,conn))
#define RXS_GetStats(obj,conn,stats) RXS_OP(obj,GetStats,(obj,conn,stats))
#define RXS_SetConfiguration(obj, conn, type, value, currentValue) RXS_OP(obj, SetConfiguration,(obj,conn,type,value,currentValue))



/* Structure for keeping rx statistics.  Note that this structure is returned
 * by rxdebug, so, for compatibility reasons, new fields should be appended (or
 * spares used), the rxdebug protocol checked, if necessary, and the PrintStats
 * code should be updated as well.
 *
 * Clearly we assume that ntohl will work on these structures so sizeof(int)
 * must equal sizeof(afs_int32). */

struct rx_statistics {		/* General rx statistics */
    int packetRequests;		/* Number of packet allocation requests */
    int receivePktAllocFailures;
    int sendPktAllocFailures;
    int specialPktAllocFailures;
    int socketGreedy;		/* Whether SO_GREEDY succeeded */
    int bogusPacketOnRead;	/* Number of inappropriately short packets received */
    int bogusHost;		/* Host address from bogus packets */
    int noPacketOnRead;		/* Number of read packets attempted when there was actually no packet to read off the wire */
    int noPacketBuffersOnRead;	/* Number of dropped data packets due to lack of packet buffers */
    int selects;		/* Number of selects waiting for packet or timeout */
    int sendSelects;		/* Number of selects forced when sending packet */
    int packetsRead[RX_N_PACKET_TYPES];	/* Total number of packets read, per type */
    int dataPacketsRead;	/* Number of unique data packets read off the wire */
    int ackPacketsRead;		/* Number of ack packets read */
    int dupPacketsRead;		/* Number of duplicate data packets read */
    int spuriousPacketsRead;	/* Number of inappropriate data packets */
    int packetsSent[RX_N_PACKET_TYPES];	/* Number of rxi_Sends: packets sent over the wire, per type */
    int ackPacketsSent;		/* Number of acks sent */
    int pingPacketsSent;	/* Total number of ping packets sent */
    int abortPacketsSent;	/* Total number of aborts */
    int busyPacketsSent;	/* Total number of busies sent received */
    int dataPacketsSent;	/* Number of unique data packets sent */
    int dataPacketsReSent;	/* Number of retransmissions */
    int dataPacketsPushed;	/* Number of retransmissions pushed early by a NACK */
    int ignoreAckedPacket;	/* Number of packets with acked flag, on rxi_Start */
    struct clock totalRtt;	/* Total round trip time measured (use to compute average) */
    struct clock minRtt;	/* Minimum round trip time measured */
    struct clock maxRtt;	/* Maximum round trip time measured */
    int nRttSamples;		/* Total number of round trip samples */
    int nServerConns;		/* Total number of server connections */
    int nClientConns;		/* Total number of client connections */
    int nPeerStructs;		/* Total number of peer structures */
    int nCallStructs;		/* Total number of call structures allocated */
    int nFreeCallStructs;	/* Total number of previously allocated free call structures */
    int netSendFailures;
    afs_int32 fatalErrors;
    int ignorePacketDally;	/* packets dropped because call is in dally state */
    int receiveCbufPktAllocFailures;
    int sendCbufPktAllocFailures;
    int nBusies;
    int spares[4];
};

/* structures for debug input and output packets */

/* debug input types */
struct rx_debugIn {
    afs_int32 type;
    afs_int32 index;
};

/* Invalid rx debug package type */
#define RX_DEBUGI_BADTYPE     (-8)

#define RX_DEBUGI_VERSION_MINIMUM ('L')	/* earliest real version */
#define RX_DEBUGI_VERSION     ('S')    /* Latest version */
    /* first version w/ secStats */
#define RX_DEBUGI_VERSION_W_SECSTATS ('L')
    /* version M is first supporting GETALLCONN and RXSTATS type */
#define RX_DEBUGI_VERSION_W_GETALLCONN ('M')
#define RX_DEBUGI_VERSION_W_RXSTATS ('M')
    /* last version with unaligned debugConn */
#define RX_DEBUGI_VERSION_W_UNALIGNED_CONN ('L')
#define RX_DEBUGI_VERSION_W_WAITERS ('N')
#define RX_DEBUGI_VERSION_W_IDLETHREADS ('O')
#define RX_DEBUGI_VERSION_W_NEWPACKETTYPES ('P')
#define RX_DEBUGI_VERSION_W_GETPEER ('Q')
#define RX_DEBUGI_VERSION_W_WAITED ('R')
#define RX_DEBUGI_VERSION_W_PACKETS ('S')

#define	RX_DEBUGI_GETSTATS	1	/* get basic rx stats */
#define	RX_DEBUGI_GETCONN	2	/* get connection info */
#define	RX_DEBUGI_GETALLCONN	3	/* get even uninteresting conns */
#define	RX_DEBUGI_RXSTATS	4	/* get all rx stats */
#define	RX_DEBUGI_GETPEER	5	/* get all peer structs */

struct rx_debugStats {
    afs_int32 nFreePackets;
    afs_int32 packetReclaims;
    afs_int32 callsExecuted;
    char waitingForPackets;
    char usedFDs;
    char version;
    char spare1;
    afs_int32 nWaiting;
    afs_int32 idleThreads;	/* Number of server threads that are idle */
    afs_int32 nWaited;
    afs_int32 nPackets;
    afs_int32 spare2[6];
};

struct rx_debugConn_vL {
    afs_uint32 host;
    afs_int32 cid;
    afs_int32 serial;
    afs_int32 callNumber[RX_MAXCALLS];
    afs_int32 error;
    short port;
    char flags;
    char type;
    char securityIndex;
    char callState[RX_MAXCALLS];
    char callMode[RX_MAXCALLS];
    char callFlags[RX_MAXCALLS];
    char callOther[RX_MAXCALLS];
    /* old style getconn stops here */
    struct rx_securityObjectStats secStats;
    afs_int32 sparel[10];
};

struct rx_debugConn {
    afs_uint32 host;
    afs_int32 cid;
    afs_int32 serial;
    afs_int32 callNumber[RX_MAXCALLS];
    afs_int32 error;
    short port;
    char flags;
    char type;
    char securityIndex;
    char sparec[3];		/* force correct alignment */
    char callState[RX_MAXCALLS];
    char callMode[RX_MAXCALLS];
    char callFlags[RX_MAXCALLS];
    char callOther[RX_MAXCALLS];
    /* old style getconn stops here */
    struct rx_securityObjectStats secStats;
    afs_int32 epoch;
    afs_int32 natMTU;
    afs_int32 sparel[9];
};

struct rx_debugPeer {
    afs_uint32 host;
    u_short port;
    u_short ifMTU;
    afs_uint32 idleWhen;
    short refCount;
    u_char burstSize;
    u_char burst;
    struct clock burstWait;
    afs_int32 rtt;
    afs_int32 rtt_dev;
    struct clock timeout;
    afs_int32 nSent;
    afs_int32 reSends;
    afs_int32 inPacketSkew;
    afs_int32 outPacketSkew;
    afs_int32 rateFlag;
    u_short natMTU;
    u_short maxMTU;
    u_short maxDgramPackets;
    u_short ifDgramPackets;
    u_short MTU;
    u_short cwind;
    u_short nDgramPackets;
    u_short congestSeq;
    afs_hyper_t bytesSent;
    afs_hyper_t bytesReceived;
    afs_int32 sparel[10];
};

#define	RX_OTHER_IN	1	/* packets avail in in queue */
#define	RX_OTHER_OUT	2	/* packets avail in out queue */

#define RX_SERVER_DEBUG_SEC_STATS		0x1
#define RX_SERVER_DEBUG_ALL_CONN		0x2
#define RX_SERVER_DEBUG_RX_STATS		0x4
#define RX_SERVER_DEBUG_WAITER_CNT		0x8
#define RX_SERVER_DEBUG_IDLE_THREADS		0x10
#define RX_SERVER_DEBUG_OLD_CONN		0x20
#define RX_SERVER_DEBUG_NEW_PACKETS		0x40
#define RX_SERVER_DEBUG_ALL_PEER		0x80
#define RX_SERVER_DEBUG_WAITED_CNT              0x100
#define RX_SERVER_DEBUG_PACKETS_CNT              0x200

#define AFS_RX_STATS_CLEAR_ALL			0xffffffff
#define AFS_RX_STATS_CLEAR_INVOCATIONS		0x1
#define AFS_RX_STATS_CLEAR_BYTES_SENT		0x2
#define AFS_RX_STATS_CLEAR_BYTES_RCVD		0x4
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_SUM	0x8
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_SQUARE	0x10
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_MIN	0x20
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_MAX	0x40
#define AFS_RX_STATS_CLEAR_EXEC_TIME_SUM	0x80
#define AFS_RX_STATS_CLEAR_EXEC_TIME_SQUARE	0x100
#define AFS_RX_STATS_CLEAR_EXEC_TIME_MIN	0x200
#define AFS_RX_STATS_CLEAR_EXEC_TIME_MAX	0x400

typedef struct rx_function_entry_v1 {
    afs_uint32 remote_peer;
    afs_uint32 remote_port;
    afs_uint32 remote_is_server;
    afs_uint32 interfaceId;
    afs_uint32 func_total;
    afs_uint32 func_index;
    afs_uint64 invocations;
    afs_uint64 bytes_sent;
    afs_uint64 bytes_rcvd;
    struct clock queue_time_sum;
    struct clock queue_time_sum_sqr;
    struct clock queue_time_min;
    struct clock queue_time_max;
    struct clock execution_time_sum;
    struct clock execution_time_sum_sqr;
    struct clock execution_time_min;
    struct clock execution_time_max;
} rx_function_entry_v1_t, *rx_function_entry_v1_p;

/*
 * If you need to change rx_function_entry, you should probably create a brand
 * new structure.  Keeping the old structure will allow backwards compatibility
 * with old clients (even if it is only used to calculate allocation size).
 * If you do change the size or the format, you'll need to bump
 * RX_STATS_RETRIEVAL_VERSION.  This allows some primitive form
 * of versioning a la rxdebug.
 */

#define RX_STATS_RETRIEVAL_VERSION 1	/* latest version */
#define RX_STATS_RETRIEVAL_FIRST_EDITION 1	/* first implementation */

typedef struct rx_interface_stat {
    struct opr_queue entry;
    struct opr_queue entryPeers;
    rx_function_entry_v1_t stats[1];	/* make sure this is aligned correctly */
} rx_interface_stat_t, *rx_interface_stat_p;

#define RX_STATS_SERVICE_ID 409

#ifdef AFS_NT40_ENV
extern int rx_DumpCalls(FILE *outputFile, char *cookie);
#endif
# 864 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#endif /* _RX_   End of rx.h */
# 866 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifdef	KERNEL
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 869 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else
# 870 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 871 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 872 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

static_inline afs_uint32
RPCOpStat_Peer(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_peer;
}

static_inline afs_uint32
RPCOpStat_Port(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_port;
}

static_inline afs_uint32
RPCOpStat_IsServer(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_is_server;
}

static_inline afs_uint32
RPCOpStat_InterfaceId(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->interfaceId;
}

static_inline afs_uint32
RPCOpStat_NumFuncs(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->func_total;
}

static_inline afs_uint32
RPCOpStat_CurFunc(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->func_index;
}

static_inline struct clock *
RPCOpStat_QTimeSum(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_sum);
}

static_inline struct clock *
RPCOpStat_QTimeSumSqr(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_sum_sqr);
}

static_inline struct clock *
RPCOpStat_QTimeSumMin(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_min);
}

static_inline struct clock *
RPCOpStat_QTimeSumMax(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_max);
}

static_inline struct clock *
RPCOpStat_ExecTimeSum(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_sum);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumSqr(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_sum_sqr);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumMin(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_min);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumMax(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_max);
}

static_inline afs_uint64
RPCOpStat_NumCalls(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->invocations;
}

static_inline afs_uint64
RPCOpStat_BytesSent(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->bytes_sent;
}

static_inline afs_uint64
RPCOpStat_BytesRcvd(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->bytes_rcvd;
}
#endif /* !KDUMP_RX_LOCK */
# 975 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
# 20 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h" 2
#endif /* KERNEL */
# 21 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

#ifndef GLOBALSINIT
#define GLOBALSINIT(x)
#define POSTAMBLE
#if defined(AFS_NT40_ENV)
#define RX_STATS_INTERLOCKED 1
#if defined(AFS_PTHREAD_ENV)
#define EXT __declspec(dllimport) extern
#else /* AFS_PTHREAD_ENV */
# 30 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#define	EXT extern
#endif /* AFS_PTHREAD_ENV */
# 32 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#else /* AFS_NT40_ENV */
# 33 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#define EXT extern
#endif /* AFS_NT40_ENV */
# 35 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#endif /* !GLOBALSINIT */
# 36 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

/* Basic socket for client requests; other sockets (for receiving server requests) are in the service structures */
EXT osi_socket rx_socket;

/* The array of installed services.  Null terminated. */
EXT struct rx_service *rx_services[RX_MAX_SERVICES + 1];
#ifdef RX_ENABLE_LOCKS
/* Protects nRequestsRunning as well as pool allocation variables. */
EXT afs_kmutex_t rx_serverPool_lock;
#endif /* RX_ENABLE_LOCKS */
# 46 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

/* Constant delay time before sending a hard ack if the receiver consumes
 * a packet while no delayed ack event is scheduled. Ensures that the
 * sender is able to advance its window when the receiver consumes a packet
 * after the sender has exhausted its transmit window.
 */
EXT struct clock rx_hardAckDelay;

#if defined(RXDEBUG) || defined(AFS_NT40_ENV)
/* Variable to allow introduction of network unreliability; exported from libafsrpc */
EXT int rx_intentionallyDroppedPacketsPer100 GLOBALSINIT(0);	/* Dropped on Send */
EXT int rx_intentionallyDroppedOnReadPer100  GLOBALSINIT(0);	/* Dropped on Read */
#endif
# 59 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

/* extra packets to add to the quota */
EXT int rx_extraQuota GLOBALSINIT(0);
/* extra packets to alloc (2 * maxWindowSize by default) */
EXT int rx_extraPackets GLOBALSINIT(256);

EXT int rx_stackSize GLOBALSINIT(RX_DEFAULT_STACK_SIZE);

/* Time until an unresponsive connection is declared dead */
EXT int rx_connDeadTime GLOBALSINIT(12);

/* Set rx default connection dead time; set on both services and connections at creation time */
#ifdef AFS_NT40_ENV
void rx_SetRxDeadTime(int seconds);
#else
# 74 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#define rx_SetRxDeadTime(seconds)   (rx_connDeadTime = (seconds))
#endif
# 76 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

/* Time until we toss an idle connection */
EXT int rx_idleConnectionTime GLOBALSINIT(700);
/* Time until we toss a peer structure, after all connections using are gone */
EXT int rx_idlePeerTime GLOBALSINIT(60);

/* The file server is temporarily salvaging */
EXT int rx_tranquil GLOBALSINIT(0);

/* UDP rcv buffer size */
EXT int rx_UdpBufSize GLOBALSINIT(64 * 1024);
#ifdef AFS_NT40_ENV
int   rx_GetMinUdpBufSize(void);
void  rx_SetUdpBufSize(int x);
#else
# 91 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#define rx_GetMinUdpBufSize()   (64*1024)
#define rx_SetUdpBufSize(x)     (((x)>rx_GetMinUdpBufSize()) ? (rx_UdpBufSize = (x)):0)
#endif
# 94 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
/*
 * Variables to control RX overload management. When the number of calls
 * waiting for a thread exceed the threshold, new calls are aborted
 * with the busy error.
 */
EXT int rx_BusyThreshold GLOBALSINIT(-1);	/* default is disabled */
EXT int rx_BusyError GLOBALSINIT(-1);

/* These definitions should be in one place */
#ifdef	AFS_SUN5_ENV
#define	RX_CBUF_TIME	180	/* Check for packet deficit */
#define	RX_REAP_TIME	90	/* Check for tossable connections every 90 seconds */
#else
# 107 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#define	RX_CBUF_TIME	120	/* Check for packet deficit */
#define	RX_REAP_TIME	60	/* Check for tossable connections every 60 seconds */
#endif
# 110 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

#define RX_FAST_ACK_RATE 1	/* as of 3.4, ask for an ack every
				 * other packet. */

EXT int rx_minPeerTimeout GLOBALSINIT(20);      /* in milliseconds */
EXT int rx_minWindow GLOBALSINIT(1);
EXT int rx_maxWindow GLOBALSINIT(RX_MAXACKS);   /* must ack what we receive */
EXT int rx_initReceiveWindow GLOBALSINIT(16);	/* how much to accept */
EXT int rx_maxReceiveWindow GLOBALSINIT(32);	/* how much to accept */
EXT int rx_initSendWindow GLOBALSINIT(16);
EXT int rx_maxSendWindow GLOBALSINIT(32);
EXT int rx_nackThreshold GLOBALSINIT(3);	/* Number NACKS to trigger congestion recovery */
EXT int rx_nDgramThreshold GLOBALSINIT(4);	/* Number of packets before increasing
                                                 * packets per datagram */
#define RX_MAX_FRAGS 4
EXT int rxi_nSendFrags GLOBALSINIT(RX_MAX_FRAGS);	/* max fragments in a datagram */
EXT int rxi_nRecvFrags GLOBALSINIT(RX_MAX_FRAGS);
EXT int rxi_OrphanFragSize GLOBALSINIT(512);

#define RX_MAX_DGRAM_PACKETS 6	/* max packets per jumbogram */

EXT int rxi_nDgramPackets GLOBALSINIT(RX_MAX_DGRAM_PACKETS);
/* allow n packets between soft acks */
EXT int rxi_SoftAckRate GLOBALSINIT(RX_FAST_ACK_RATE);
/* consume n packets before sending hard ack, should be larger than above,
   but not absolutely necessary.  If it's smaller, than fast receivers will
   send a soft ack, immediately followed by a hard ack. */
EXT int rxi_HardAckRate GLOBALSINIT(RX_FAST_ACK_RATE + 1);

EXT int rx_nPackets GLOBALSINIT(0);	/* preallocate packets with rx_extraPackets */

/*
 * pthreads thread-specific rx info support
 * the rx_ts_info_t struct is meant to support all kinds of
 * thread-specific rx data:
 *
 *  _FPQ member contains a thread-specific free packet queue
 */
#ifdef AFS_PTHREAD_ENV
EXT pthread_key_t rx_ts_info_key;
typedef struct rx_ts_info_t {
    struct {
        struct opr_queue queue;
        int len;                /* local queue length */
        int delta;              /* number of new packets alloc'd locally since last sync w/ global queue */

        /* FPQ stats */
        int checkin_ops;
        int checkin_xfer;
        int checkout_ops;
        int checkout_xfer;
        int gtol_ops;
        int gtol_xfer;
        int ltog_ops;
        int ltog_xfer;
        int lalloc_ops;
        int lalloc_xfer;
        int galloc_ops;
        int galloc_xfer;
    } _FPQ;
    struct rx_packet * local_special_packet;
} rx_ts_info_t;
EXT struct rx_ts_info_t * rx_ts_info_init(void);   /* init function for thread-specific data struct */
#define RX_TS_INFO_GET(ts_info_p) \
    do { \
        ts_info_p = (struct rx_ts_info_t*)pthread_getspecific(rx_ts_info_key); \
        if (ts_info_p == NULL) { \
            opr_Verify((ts_info_p = rx_ts_info_init()) != NULL); \
        } \
    } while(0)
#endif /* AFS_PTHREAD_ENV */
# 181 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"


/* List of free packets */
/* in pthreads rx, free packet queue is now a two-tiered queueing system
 * in which the first tier is thread-specific, and the second tier is
 * a global free packet queue */
EXT struct opr_queue rx_freePacketQueue;
#ifdef RX_TRACK_PACKETS
#define RX_FPQ_MARK_FREE(p) \
    do { \
        if ((p)->flags & RX_PKTFLAG_FREE) \
            osi_Panic("rx packet already free\n"); \
        (p)->flags |= RX_PKTFLAG_FREE; \
        (p)->flags &= ~(RX_PKTFLAG_TQ|RX_PKTFLAG_IOVQ|RX_PKTFLAG_RQ|RX_PKTFLAG_CP); \
        (p)->length = 0; \
        (p)->niovecs = 0; \
    } while(0)
#define RX_FPQ_MARK_USED(p) \
    do { \
        if (!((p)->flags & RX_PKTFLAG_FREE)) \
            osi_Panic("rx packet not free\n"); \
        (p)->flags = 0;		/* clear RX_PKTFLAG_FREE, initialize the rest */ \
        (p)->header.flags = 0; \
    } while(0)
#else
# 206 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#define RX_FPQ_MARK_FREE(p) \
    do { \
        (p)->length = 0; \
        (p)->niovecs = 0; \
    } while(0)
#define RX_FPQ_MARK_USED(p) \
    do { \
        (p)->flags = 0;		/* clear RX_PKTFLAG_FREE, initialize the rest */ \
        (p)->header.flags = 0; \
    } while(0)
#endif
# 217 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#define RX_PACKET_IOV_INIT(p) \
    do { \
	(p)->wirevec[0].iov_base = (char *)((p)->wirehead); \
	(p)->wirevec[0].iov_len = RX_HEADER_SIZE; \
	(p)->wirevec[1].iov_base = (char *)((p)->localdata); \
	(p)->wirevec[1].iov_len = RX_FIRSTBUFFERSIZE; \
    } while(0)
#define RX_PACKET_IOV_FULLINIT(p) \
    do { \
	(p)->wirevec[0].iov_base = (char *)((p)->wirehead); \
	(p)->wirevec[0].iov_len = RX_HEADER_SIZE; \
	(p)->wirevec[1].iov_base = (char *)((p)->localdata); \
	(p)->wirevec[1].iov_len = RX_FIRSTBUFFERSIZE; \
	(p)->niovecs = 2; \
	(p)->length = RX_FIRSTBUFFERSIZE; \
    } while(0)

#ifdef RX_ENABLE_LOCKS
EXT afs_kmutex_t rx_freePktQ_lock;
#endif /* RX_ENABLE_LOCKS */
# 237 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

#if defined(AFS_PTHREAD_ENV)
#define RX_ENABLE_TSFPQ
EXT int rx_TSFPQGlobSize GLOBALSINIT(3); /* number of packets to transfer between global and local queues in one op */
EXT int rx_TSFPQLocalMax GLOBALSINIT(15); /* max number of packets on local FPQ before returning a glob to the global pool */
EXT int rx_TSFPQMaxProcs GLOBALSINIT(0); /* max number of threads expected */
#define RX_TS_FPQ_FLUSH_GLOBAL 1
#define RX_TS_FPQ_PULL_GLOBAL 1
#define RX_TS_FPQ_ALLOW_OVERCOMMIT 1
/*
 * compute the localmax and globsize values from rx_TSFPQMaxProcs and rx_nPackets.
 * arbitarily set local max so that all threads consume 90% of packets, if all local queues are full.
 * arbitarily set transfer glob size to 20% of max local packet queue length.
 * also set minimum values of 15 and 3.  Given the algorithms, the number of buffers allocated
 * by each call to AllocPacketBufs() will increase indefinitely without a cap on the transfer
 * glob size.  A cap of 64 is selected because that will produce an allocation of greater than
 * three times that amount which is greater than half of ncalls * maxReceiveWindow.
 * Must be called under rx_packets_mutex.
 */
#define RX_TS_FPQ_COMPUTE_LIMITS \
    do { \
        int newmax, newglob; \
        newmax = (rx_nPackets * 9) / (10 * rx_TSFPQMaxProcs); \
        newmax = (newmax >= 15) ? newmax : 15; \
        newglob = newmax / 5; \
        newglob = (newglob >= 3) ? (newglob < 64 ? newglob : 64) : 3; \
        rx_TSFPQLocalMax = newmax; \
        rx_TSFPQGlobSize = newglob; \
    } while(0)
/* record the number of packets allocated by this thread
 * and stored in the thread local queue */
#define RX_TS_FPQ_LOCAL_ALLOC(rx_ts_info_p,num_alloc) \
    do { \
        (rx_ts_info_p)->_FPQ.lalloc_ops++; \
        (rx_ts_info_p)->_FPQ.lalloc_xfer += num_alloc; \
    } while (0)
/* record the number of packets allocated by this thread
 * and stored in the global queue */
#define RX_TS_FPQ_GLOBAL_ALLOC(rx_ts_info_p,num_alloc) \
    do { \
        (rx_ts_info_p)->_FPQ.galloc_ops++; \
        (rx_ts_info_p)->_FPQ.galloc_xfer += num_alloc; \
    } while (0)
/* move packets from local (thread-specific) to global free packet queue.
   rx_freePktQ_lock must be held. default is to reduce the queue size to 40% ofmax */
#define RX_TS_FPQ_LTOG(rx_ts_info_p) \
    do { \
        int i; \
        struct rx_packet * p; \
        int tsize = MIN((rx_ts_info_p)->_FPQ.len, (rx_ts_info_p)->_FPQ.len - rx_TSFPQLocalMax + 3 *  rx_TSFPQGlobSize); \
	if (tsize <= 0) break; \
        for (i=0,p=opr_queue_Last(&((rx_ts_info_p)->_FPQ.queue), \
				 struct rx_packet, entry); \
             i < tsize; i++,p=opr_queue_Prev(&p->entry, \
		     			    struct rx_packet, entry )); \
        opr_queue_SplitAfterPrepend(&((rx_ts_info_p)->_FPQ.queue), \
				   &rx_freePacketQueue, &p->entry); \
        (rx_ts_info_p)->_FPQ.len -= tsize; \
        rx_nFreePackets += tsize; \
        (rx_ts_info_p)->_FPQ.ltog_ops++; \
        (rx_ts_info_p)->_FPQ.ltog_xfer += tsize; \
        if ((rx_ts_info_p)->_FPQ.delta) { \
            MUTEX_ENTER(&rx_packets_mutex); \
            RX_TS_FPQ_COMPUTE_LIMITS; \
            MUTEX_EXIT(&rx_packets_mutex); \
           (rx_ts_info_p)->_FPQ.delta = 0; \
        } \
    } while(0)
/* same as above, except user has direct control over number to transfer */
#define RX_TS_FPQ_LTOG2(rx_ts_info_p,num_transfer) \
    do { \
        int i; \
        struct rx_packet * p; \
        if (num_transfer <= 0) break; \
        for (i=0,p=opr_queue_Last(&((rx_ts_info_p)->_FPQ.queue), \
				 struct rx_packet, entry ); \
	     i < (num_transfer); \
	     i++,p=opr_queue_Prev(&p->entry, struct rx_packet, entry )); \
        opr_queue_SplitAfterPrepend(&((rx_ts_info_p)->_FPQ.queue), \
				   &rx_freePacketQueue, &p->entry); \
        (rx_ts_info_p)->_FPQ.len -= (num_transfer); \
        rx_nFreePackets += (num_transfer); \
        (rx_ts_info_p)->_FPQ.ltog_ops++; \
        (rx_ts_info_p)->_FPQ.ltog_xfer += (num_transfer); \
        if ((rx_ts_info_p)->_FPQ.delta) { \
            MUTEX_ENTER(&rx_packets_mutex); \
            RX_TS_FPQ_COMPUTE_LIMITS; \
            MUTEX_EXIT(&rx_packets_mutex); \
            (rx_ts_info_p)->_FPQ.delta = 0; \
        } \
    } while(0)
/* move packets from global to local (thread-specific) free packet queue.
   rx_freePktQ_lock must be held. */
#define RX_TS_FPQ_GTOL(rx_ts_info_p) \
    do { \
        int i, tsize; \
        struct rx_packet * p; \
        tsize = (rx_TSFPQGlobSize <= rx_nFreePackets) ? \
                 rx_TSFPQGlobSize : rx_nFreePackets; \
        for (i=0, \
	       p=opr_queue_First(&rx_freePacketQueue, struct rx_packet, entry); \
             i < tsize; \
	     i++,p=opr_queue_Next(&p->entry, struct rx_packet, entry)); \
        opr_queue_SplitBeforeAppend(&rx_freePacketQueue, \
				   &((rx_ts_info_p)->_FPQ.queue), &p->entry); \
        (rx_ts_info_p)->_FPQ.len += i; \
        rx_nFreePackets -= i; \
        (rx_ts_info_p)->_FPQ.gtol_ops++; \
        (rx_ts_info_p)->_FPQ.gtol_xfer += i; \
    } while(0)
/* same as above, except user has direct control over number to transfer */
#define RX_TS_FPQ_GTOL2(rx_ts_info_p,num_transfer) \
    do { \
        int i, tsize; \
        struct rx_packet * p; \
        tsize = (num_transfer); \
        if (tsize > rx_nFreePackets) tsize = rx_nFreePackets; \
        for (i=0, \
	       p=opr_queue_First(&rx_freePacketQueue, struct rx_packet, entry); \
             i < tsize; \
	     i++, p=opr_queue_Next(&p->entry, struct rx_packet, entry)); \
        opr_queue_SplitBeforeAppend(&rx_freePacketQueue, \
				   &((rx_ts_info_p)->_FPQ.queue), &p->entry); \
        (rx_ts_info_p)->_FPQ.len += i; \
        rx_nFreePackets -= i; \
        (rx_ts_info_p)->_FPQ.gtol_ops++; \
        (rx_ts_info_p)->_FPQ.gtol_xfer += i; \
    } while(0)
/* checkout a packet from the thread-specific free packet queue */
#define RX_TS_FPQ_CHECKOUT(rx_ts_info_p,p) \
    do { \
        (p) = opr_queue_First(&((rx_ts_info_p)->_FPQ.queue), \
			     struct rx_packet, entry); \
        opr_queue_Remove(&p->entry); \
        RX_FPQ_MARK_USED(p); \
        (rx_ts_info_p)->_FPQ.len--; \
        (rx_ts_info_p)->_FPQ.checkout_ops++; \
        (rx_ts_info_p)->_FPQ.checkout_xfer++; \
    } while(0)
/* checkout multiple packets from the thread-specific free packet queue.
 * num_transfer must be a variable.
 */
#define RX_TS_FPQ_QCHECKOUT(rx_ts_info_p,num_transfer,q) \
    do { \
        int i; \
        struct rx_packet *p; \
        if (num_transfer > (rx_ts_info_p)->_FPQ.len) num_transfer = (rx_ts_info_p)->_FPQ.len; \
        for (i=0, p=opr_queue_First(&((rx_ts_info_p)->_FPQ.queue), \
				   struct rx_packet, entry); \
             i < num_transfer; \
             i++, p=opr_queue_Next(&p->entry, struct rx_packet, entry)) { \
            RX_FPQ_MARK_USED(p); \
        } \
        opr_queue_SplitBeforeAppend(&((rx_ts_info_p)->_FPQ.queue),(q), \
				   &((p)->entry)); \
        (rx_ts_info_p)->_FPQ.len -= num_transfer; \
        (rx_ts_info_p)->_FPQ.checkout_ops++; \
        (rx_ts_info_p)->_FPQ.checkout_xfer += num_transfer; \
    } while(0)
/* check a packet into the thread-specific free packet queue */
#define RX_TS_FPQ_CHECKIN(rx_ts_info_p,p) \
    do { \
        opr_queue_Prepend(&((rx_ts_info_p)->_FPQ.queue), &((p)->entry)); \
        RX_FPQ_MARK_FREE(p); \
        (rx_ts_info_p)->_FPQ.len++; \
        (rx_ts_info_p)->_FPQ.checkin_ops++; \
        (rx_ts_info_p)->_FPQ.checkin_xfer++; \
    } while(0)
/* check multiple packets into the thread-specific free packet queue */
/* num_transfer must equal length of (q); it is not a means of checking
 * in part of (q).  passing num_transfer just saves us instructions
 * since caller already knows length of (q) for other reasons */
#define RX_TS_FPQ_QCHECKIN(rx_ts_info_p,num_transfer,q) \
    do { \
	struct opr_queue *cur; \
        for (opr_queue_Scan((q), cur)) { \
            RX_FPQ_MARK_FREE(opr_queue_Entry(cur, struct rx_packet, entry)); \
        } \
        opr_queue_SplicePrepend(&((rx_ts_info_p)->_FPQ.queue),(q)); \
        (rx_ts_info_p)->_FPQ.len += (num_transfer); \
        (rx_ts_info_p)->_FPQ.checkin_ops++; \
        (rx_ts_info_p)->_FPQ.checkin_xfer += (num_transfer); \
    } while(0)
#endif /* AFS_PTHREAD_ENV */
# 421 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

/* Number of free packets */
EXT int rx_nFreePackets GLOBALSINIT(0);
EXT int rxi_NeedMorePackets GLOBALSINIT(0);
EXT int rx_packetReclaims GLOBALSINIT(0);

/* largest packet which we can safely receive, initialized to AFS 3.2 value
 * This is provided for backward compatibility with peers which may be unable
 * to swallow anything larger. THIS MUST NEVER DECREASE WHILE AN APPLICATION
 * IS RUNNING! */
EXT afs_uint32 rx_maxReceiveSize GLOBALSINIT(_OLD_MAX_PACKET_SIZE * RX_MAX_FRAGS +
				      UDP_HDR_SIZE * (RX_MAX_FRAGS - 1));

/* this is the maximum packet size that the user wants us to receive */
/* this is set by rxTune if required */
EXT afs_uint32 rx_maxReceiveSizeUser GLOBALSINIT(0xffffffff);

/* rx_MyMaxSendSize is the size of the largest packet we will send,
 * including the RX header. Just as rx_maxReceiveSize is the
 * max we will receive, including the rx header.
 */
EXT afs_uint32 rx_MyMaxSendSize GLOBALSINIT(8588);

/* Maximum size of a jumbo datagram we can receive */
EXT afs_uint32 rx_maxJumboRecvSize GLOBALSINIT(RX_MAX_PACKET_SIZE);

/* need this to permit progs to run on AIX systems */
EXT int (*rxi_syscallp) (afs_uint32 a3, afs_uint32 a4, void *a5)GLOBALSINIT(0);

/* List of free queue entries */
EXT struct rx_serverQueueEntry *rx_FreeSQEList GLOBALSINIT(0);
#ifdef	RX_ENABLE_LOCKS
EXT afs_kmutex_t freeSQEList_lock;
#endif
# 455 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

/* List of free call structures */
EXT struct opr_queue rx_freeCallQueue;
#ifdef	RX_ENABLE_LOCKS
EXT afs_kmutex_t rx_freeCallQueue_lock;
#endif
# 461 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
EXT afs_int32 rxi_nCalls GLOBALSINIT(0);

/* Port requested at rx_Init.  If this is zero, the actual port used will be different--but it will only be used for client operations.  If non-zero, server provided services may use the same port. */
EXT u_short rx_port;

#if !defined(KERNEL) && !defined(AFS_PTHREAD_ENV)
/* 32-bit select Mask for rx_Listener. */
EXT fd_set rx_selectMask;
EXT osi_socket rx_maxSocketNumber;	/* Maximum socket number in the select mask. */
/* Minumum socket number in the select mask. */
EXT osi_socket rx_minSocketNumber GLOBALSINIT(0x7fffffff);
#endif
# 473 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

/* This is actually the minimum number of packets that must remain free,
    overall, immediately after a packet of the requested class has been
    allocated.  *WARNING* These must be assigned with a great deal of care.
    In order, these are receive quota, send quota, special quota, receive
    continuation quota, and send continuation quota. */
#define	RX_PACKET_QUOTAS {1, 10, 0, 1, 10}
/* value large enough to guarantee that no allocation fails due to RX_PACKET_QUOTAS.
   Make it a little bigger, just for fun */
#define	RX_MAX_QUOTA	15	/* part of min packet computation */
EXT int rx_packetQuota[RX_N_PACKET_CLASSES] GLOBALSINIT(RX_PACKET_QUOTAS);
EXT int meltdown_1pkt GLOBALSINIT(1);	/* prefer to schedule single-packet calls */
EXT int rxi_md2cnt GLOBALSINIT(0);	/* counter of skipped calls */
EXT int rxi_2dchoice GLOBALSINIT(1);	/* keep track of another call to schedule */

/* quota system: each attached server process must be able to make
    progress to avoid system deadlock, so we ensure that we can always
    handle the arrival of the next unacknowledged data packet for an
    attached call.  rxi_dataQuota gives the max # of packets that must be
    reserved for active calls for them to be able to make progress, which is
    essentially enough to queue up a window-full of packets (the first packet
    may be missing, so these may not get read) + the # of packets the thread
    may use before reading all of its input (# free must be one more than send
    packet quota).  Thus, each thread allocates rx_maxReceiveWindow+1 (max
    queued packets) + an extra for sending data.  The system also reserves
    RX_MAX_QUOTA (must be more than RX_PACKET_QUOTA[i], which is 10), so that
    the extra packet can be sent (must be under the system-wide send packet
    quota to send any packets) */
/* # to reserve so that thread with input can still make calls (send packets)
   without blocking */
EXT int rxi_dataQuota GLOBALSINIT(RX_MAX_QUOTA);	/* packets to reserve for active threads */

EXT afs_int32 rxi_availProcs GLOBALSINIT(0);	/* number of threads in the pool */
EXT afs_int32 rxi_totalMin GLOBALSINIT(0);	/* Sum(minProcs) forall services */
EXT afs_int32 rxi_minDeficit GLOBALSINIT(0);	/* number of procs needed to handle all minProcs */

EXT afs_uint32 rx_nextCid;		/* Next connection call id */
EXT afs_uint32 rx_epoch;		/* Initialization time of rx */
#ifdef	RX_ENABLE_LOCKS
EXT afs_kcondvar_t rx_waitingForPackets_cv;
#endif
# 514 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
EXT char rx_waitingForPackets;	/* Processes set and wait on this variable when waiting for packet buffers */

EXT struct rx_peer **rx_peerHashTable;
EXT struct rx_connection **rx_connHashTable;
EXT struct rx_connection *rx_connCleanup_list GLOBALSINIT(0);
EXT afs_uint32 rx_hashTableSize GLOBALSINIT(257);	/* Prime number */
#ifdef RX_ENABLE_LOCKS
EXT afs_kmutex_t rx_peerHashTable_lock;
EXT afs_kmutex_t rx_connHashTable_lock;
#endif /* RX_ENABLE_LOCKS */
# 524 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

#define CONN_HASH(host, port, cid, epoch, type) ((((cid)>>RX_CIDSHIFT)%rx_hashTableSize))

#define PEER_HASH(host, port)  ((host ^ port) % rx_hashTableSize)

/* Forward definitions of internal procedures */
#define	rxi_ChallengeOff(conn)	\
	rxevent_Cancel(&(conn)->challengeEvent)
#define rxi_NatKeepAliveOff(conn) \
	rxevent_Cancel(&(conn)->natKeepAliveEvent)

#define rxi_AllocSecurityObject() rxi_Alloc(sizeof(struct rx_securityClass))
#define	rxi_FreeSecurityObject(obj) rxi_Free(obj, sizeof(struct rx_securityClass))
#define	rxi_AllocService()	rxi_Alloc(sizeof(struct rx_service))
#define	rxi_FreeService(obj) \
do { \
    MUTEX_DESTROY(&(obj)->svc_data_lock);  \
    rxi_Free((obj), sizeof(struct rx_service)); \
} while (0)
#define	rxi_AllocPeer()		rxi_Alloc(sizeof(struct rx_peer))
#define	rxi_FreePeer(peer)	rxi_Free(peer, sizeof(struct rx_peer))
#define	rxi_AllocConnection()	rxi_Alloc(sizeof(struct rx_connection))
#define rxi_FreeConnection(conn) (rxi_Free(conn, sizeof(struct rx_connection)))

EXT afs_int32 rx_stats_active GLOBALSINIT(1);	/* boolean - rx statistics gathering */

#ifndef KERNEL
/* Some debugging stuff */
EXT FILE *rx_debugFile;		/* Set by the user to a stdio file for debugging output */
EXT FILE *rxevent_debugFile;	/* Set to an stdio descriptor for event logging to that file */
#endif
# 555 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

#ifdef RXDEBUG
# define rx_Log rx_debugFile
# ifdef AFS_NT40_ENV
EXT int rxdebug_active;
#  define dpf(args) do { if (rxdebug_active) rxi_DebugPrint args; } while (0)
# else
# 562 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#  ifdef DPF_FSLOG
#if 0 /* expanded by -frewrite-includes */
#   include <afs/afsutil.h>
#endif /* expanded by -frewrite-includes */
# 564 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#   define dpf(args) FSLog args
#  else
# 566 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#   define dpf(args) do { if (rx_debugFile) rxi_DebugPrint args; } while (0)
#  endif
# 568 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
# endif
# 569 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
# define rx_Log_event rxevent_debugFile
#else
# 571 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
# define dpf(args)
#endif /* RXDEBUG */
# 573 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

EXT char *rx_packetTypes[RX_N_PACKET_TYPES] GLOBALSINIT(RX_PACKET_TYPES);	/* Strings defined in rx.h */

#ifndef KERNEL
/*
 * Counter used to implement connection specific data
 */
EXT int rxi_keyCreate_counter GLOBALSINIT(0);
/*
 * Array of function pointers used to destory connection specific data
 */
EXT rx_destructor_t *rxi_keyCreate_destructor GLOBALSINIT(NULL);
#ifdef RX_ENABLE_LOCKS
EXT afs_kmutex_t rxi_keyCreate_lock;
#endif /* RX_ENABLE_LOCKS */
# 588 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#endif /* !KERNEL */
# 589 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

/*
 * SERVER ONLY: Threshholds used to throttle error replies to looping
 * clients. When consecutive calls are aborting with the same error, the
 * server throttles the client by waiting before sending error messages.
 * Disabled if abort thresholds are zero.
 */
EXT int rxi_connAbortThreshhold GLOBALSINIT(0);
EXT int rxi_connAbortDelay GLOBALSINIT(3000);
EXT int rxi_callAbortThreshhold GLOBALSINIT(0);
EXT int rxi_callAbortDelay GLOBALSINIT(3000);

/*
 * Thread specific thread ID used to implement LWP_Index().
 */

#if defined(AFS_PTHREAD_ENV)
EXT int rxi_fcfs_thread_num GLOBALSINIT(0);
EXT pthread_key_t rx_thread_id_key;
#else
# 609 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
#define rxi_fcfs_thread_num (0)
#endif
# 611 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

#if defined(RX_ENABLE_LOCKS)
EXT afs_kmutex_t rx_waiting_mutex POSTAMBLE;	/* used to protect waiting counters */
EXT afs_kmutex_t rx_quota_mutex POSTAMBLE;	/* used to protect quota counters */
EXT afs_kmutex_t rx_pthread_mutex POSTAMBLE;	/* used to protect pthread counters */
EXT afs_kmutex_t rx_packets_mutex POSTAMBLE;	/* used to protect packet counters */
EXT afs_kmutex_t rx_refcnt_mutex POSTAMBLE;       /* used to protect conn/call ref counts */
#endif
# 619 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"

EXT int rx_enable_stats GLOBALSINIT(0);

/*
 * Set this flag to enable the listener thread to trade places with an idle
 * worker thread to move the context switch from listener to worker out of
 * the request path.
 */
EXT int rx_enable_hot_thread GLOBALSINIT(0);

EXT int RX_IPUDP_SIZE GLOBALSINIT(_RX_IPUDP_SIZE);
#endif /* AFS_RX_GLOBALS_H */
# 631 "/usr/home/kaduk/openafs/build/include/rx/rx_globals.h"
# 62 "/usr/home/kaduk/openafs/build/include/afs/afsint.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <afs/rxgen_consts.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/rxgen_consts.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef	_RXGEN_CONSTS_
#define	_RXGEN_CONSTS_

/* These are some rxgen-based (really arbitrary) error codes... */
#define	RXGEN_SUCCESS	    0
#define	RXGEN_CC_MARSHAL    -450
#define	RXGEN_CC_UNMARSHAL  -451
#define	RXGEN_SS_MARSHAL    -452
#define	RXGEN_SS_UNMARSHAL  -453
#define	RXGEN_DECODE	    -454
#define	RXGEN_OPCODE	    -455
#define	RXGEN_SS_XDRFREE    -456
#define	RXGEN_CC_XDRFREE    -457

/* These are some rxgen defines */
#define	RXGEN_MAKECALL_TIMEOUT	0
#define	RXGEN_WAIT		1
#define	RXGEN_DONTWAIT		0

#define MAX_PACKAGES    10
#define MAX_FUNCTION_NAME_LEN 200
#define MAX_FUNCTIONS_PER_PACKAGE 500
#define MAX_FUNCTIONS_PER_INTERFACE (MAX_FUNCTIONS_PER_PACKAGE * MAX_PACKAGES)

#endif /* _RXGEN_CONSTS_ */
# 35 "/usr/home/kaduk/openafs/build/include/afs/rxgen_consts.h"
# 63 "/usr/home/kaduk/openafs/build/include/afs/afsint.h" 2
#endif	/* KERNEL */
# 64 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"

#ifdef AFS_NT40_ENV
#ifndef AFS_RXGEN_EXPORT
#define AFS_RXGEN_EXPORT __declspec(dllimport)
#endif /* AFS_RXGEN_EXPORT */
# 69 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#else /* AFS_NT40_ENV */
# 70 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#define AFS_RXGEN_EXPORT
#endif /* AFS_NT40_ENV */
# 72 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"

#ifndef FSINT_COMMON_XG

struct AFSFid {
	afs_uint32 Volume;
	afs_uint32 Vnode;
	afs_uint32 Unique;
};
typedef struct AFSFid AFSFid;
bool_t xdr_AFSFid(XDR *xdrs, AFSFid *objp);


struct AFSCallBack {
	afs_uint32 CallBackVersion;
	afs_uint32 ExpirationTime;
	afs_uint32 CallBackType;
};
typedef struct AFSCallBack AFSCallBack;
bool_t xdr_AFSCallBack(XDR *xdrs, AFSCallBack *objp);


struct AFSDBLockDesc {
	char waitStates;
	char exclLocked;
	short readersReading;
	short numWaiting;
	short spare;
	int pid_last_reader;
	int pid_writer;
	int src_indicator;
};
typedef struct AFSDBLockDesc AFSDBLockDesc;
bool_t xdr_AFSDBLockDesc(XDR *xdrs, AFSDBLockDesc *objp);


struct AFSDBCacheEntry {
	afs_int32 addr;
	afs_int32 cell;
	AFSFid netFid;
	afs_int32 Length;
	afs_int32 DataVersion;
	struct AFSDBLockDesc lock;
	afs_int32 callback;
	afs_int32 cbExpires;
	short refCount;
	short opens;
	short writers;
	char mvstat;
	char states;
};
typedef struct AFSDBCacheEntry AFSDBCacheEntry;
bool_t xdr_AFSDBCacheEntry(XDR *xdrs, AFSDBCacheEntry *objp);


struct AFSDBCacheEntry64 {
	afs_int32 addr;
	afs_int32 cell;
	AFSFid netFid;
	afs_int64 Length;
	afs_int32 DataVersion;
	struct AFSDBLockDesc lock;
	afs_int32 callback;
	afs_int32 cbExpires;
	short refCount;
	short opens;
	short writers;
	char mvstat;
	char states;
};
typedef struct AFSDBCacheEntry64 AFSDBCacheEntry64;
bool_t xdr_AFSDBCacheEntry64(XDR *xdrs, AFSDBCacheEntry64 *objp);


struct AFSDBLock {
	char name[16];
	struct AFSDBLockDesc lock;
};
typedef struct AFSDBLock AFSDBLock;
bool_t xdr_AFSDBLock(XDR *xdrs, AFSDBLock *objp);


struct AFSDEntry {
	afs_int32 addr;
	afs_int32 cell;
	AFSFid netFid;
	afs_int32 Length;
	afs_int32 DataVersion;
	struct AFSDBLockDesc lock;
	afs_int32 callback;
	afs_int32 cbExpires;
	short refCount;
	short opens;
	short writers;
	char mvstat;
	char states;
};
typedef struct AFSDEntry AFSDEntry;
bool_t xdr_AFSDEntry(XDR *xdrs, AFSDEntry *objp);

#define CB_EXCLUSIVE 1
#define CB_SHARED 2
#define CB_DROPPED 3
#define AFSNAMEMAX 256
#define AFSPATHMAX 1024
#define AFSOPAQUEMAX 1024

typedef struct AFSOpaque {
	u_int AFSOpaque_len;
	char *AFSOpaque_val;
} AFSOpaque;
bool_t xdr_AFSOpaque(XDR *xdrs, AFSOpaque *objp);

#define AFSCBMAX 50

typedef struct AFSCBFids {
	u_int AFSCBFids_len;
	AFSFid *AFSCBFids_val;
} AFSCBFids;
bool_t xdr_AFSCBFids(XDR *xdrs, AFSCBFids *objp);


typedef struct AFSCBs {
	u_int AFSCBs_len;
	AFSCallBack *AFSCBs_val;
} AFSCBs;
bool_t xdr_AFSCBs(XDR *xdrs, AFSCBs *objp);

#define AFSCB_XSTAT_VERSION 2
#define AFS_XSTAT_VERSION 2
#define AFSCB_MAX_XSTAT_LONGS 2048
#define AFS_MAX_XSTAT_LONGS 1024

typedef struct AFSCB_CollData {
	u_int AFSCB_CollData_len;
	afs_int32 *AFSCB_CollData_val;
} AFSCB_CollData;
bool_t xdr_AFSCB_CollData(XDR *xdrs, AFSCB_CollData *objp);


typedef struct AFS_CollData {
	u_int AFS_CollData_len;
	afs_int32 *AFS_CollData_val;
} AFS_CollData;
bool_t xdr_AFS_CollData(XDR *xdrs, AFS_CollData *objp);

#define AFSCB_XSTATSCOLL_CALL_INFO 0
#define AFSCB_XSTATSCOLL_PERF_INFO 1
#define AFSCB_XSTATSCOLL_FULL_PERF_INFO 2
#define AFS_XSTATSCOLL_CALL_INFO 0
#define AFS_XSTATSCOLL_PERF_INFO 1
#define AFS_XSTATSCOLL_FULL_PERF_INFO 2
#define AFS_XSTATSCOLL_CBSTATS 3

typedef afs_uint32 VolumeId;
bool_t xdr_VolumeId(XDR *xdrs, VolumeId *objp);


typedef afs_uint32 VolId;
bool_t xdr_VolId(XDR *xdrs, VolId *objp);


typedef afs_uint32 VnodeId;
bool_t xdr_VnodeId(XDR *xdrs, VnodeId *objp);


typedef afs_uint32 Unique;
bool_t xdr_Unique(XDR *xdrs, Unique *objp);


typedef afs_uint32 UserId;
bool_t xdr_UserId(XDR *xdrs, UserId *objp);


typedef afs_uint32 FileVersion;
bool_t xdr_FileVersion(XDR *xdrs, FileVersion *objp);


typedef afs_int32 ErrorCode;
bool_t xdr_ErrorCode(XDR *xdrs, ErrorCode *objp);


typedef afs_int32 Rights;
bool_t xdr_Rights(XDR *xdrs, Rights *objp);

#define AFS_DISKNAMESIZE 32

typedef char DiskName[AFS_DISKNAMESIZE];
bool_t xdr_DiskName(XDR *xdrs, DiskName *objp);

#define CALLBACK_VERSION 1
#define AFS_MAX_INTERFACE_ADDR 32

struct interfaceAddr {
	int numberOfInterfaces;
	afsUUID uuid;
	afs_int32 addr_in[AFS_MAX_INTERFACE_ADDR];
	afs_int32 subnetmask[AFS_MAX_INTERFACE_ADDR];
	afs_int32 mtu[AFS_MAX_INTERFACE_ADDR];
};
typedef struct interfaceAddr interfaceAddr;
bool_t xdr_interfaceAddr(XDR *xdrs, interfaceAddr *objp);

#define AFSMAXCELLHOSTS 8

typedef struct serverList {
	u_int serverList_len;
	afs_int32 *serverList_val;
} serverList;
bool_t xdr_serverList(XDR *xdrs, serverList *objp);


typedef struct cacheConfig {
	u_int cacheConfig_len;
	afs_uint32 *cacheConfig_val;
} cacheConfig;
bool_t xdr_cacheConfig(XDR *xdrs, cacheConfig *objp);

#define AFSCAPABILITIESMAX 196

typedef struct Capabilities {
	u_int Capabilities_len;
	afs_uint32 *Capabilities_val;
} Capabilities;
bool_t xdr_Capabilities(XDR *xdrs, Capabilities *objp);

#define VICED_CAPABILITY_ERRORTRANS 0x0001
#define VICED_CAPABILITY_64BITFILES 0x0002
#define VICED_CAPABILITY_WRITELOCKACL 0x0004
#define VICED_CAPABILITY_SANEACLS 0x0008
#define CLIENT_CAPABILITY_ERRORTRANS 0x0001
#endif /* FSINT_COMMON_XG */
# 303 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#define VICECONNBAD 1234
#define VICETOKENDEAD 1235
#define AFS_LOCKWAIT (5*60)

struct CBS {
	afs_int32 SeqLen;
	char *SeqBody;
};
typedef struct CBS CBS;
bool_t xdr_CBS(XDR *xdrs, CBS *objp);


struct BBS {
	afs_int32 MaxSeqLen;
	afs_int32 SeqLen;
	char *SeqBody;
};
typedef struct BBS BBS;
bool_t xdr_BBS(XDR *xdrs, BBS *objp);


struct AFSAccessList {
	afs_int32 MaxSeqLen;
	afs_int32 SeqLen;
	char *SeqBody;
};
typedef struct AFSAccessList AFSAccessList;
bool_t xdr_AFSAccessList(XDR *xdrs, AFSAccessList *objp);


typedef afs_int32 ViceDataType;
bool_t xdr_ViceDataType(XDR *xdrs, ViceDataType *objp);

#define Invalid 0
#define File 1
#define Directory 2
#define SymbolicLink 3
#ifdef KERNEL
#define afs_xdr_array(a,b,c,d,e,f) afs_xdr_arrayN(a,b,c,d,e,f)
#endif
# 343 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"

struct BD {
	afs_int32 host;
	afs_int32 portal;
	afs_int32 session;
};
typedef struct BD BD;
bool_t xdr_BD(XDR *xdrs, BD *objp);


struct AFSVolSync {
	afs_uint32 spare1;
	afs_uint32 spare2;
	afs_uint32 spare3;
	afs_uint32 spare4;
	afs_uint32 spare5;
	afs_uint32 spare6;
};
typedef struct AFSVolSync AFSVolSync;
bool_t xdr_AFSVolSync(XDR *xdrs, AFSVolSync *objp);


struct AFSOldFetchStatus {
	afs_uint32 InterfaceVersion;
	afs_uint32 FileType;
	afs_uint32 LinkCount;
	afs_uint32 Length;
	afs_uint32 DataVersion;
	afs_uint32 Author;
	afs_uint32 Owner;
	afs_uint32 CallerAccess;
	afs_uint32 AnonymousAccess;
	afs_uint32 UnixModeBits;
	afs_uint32 ParentVnode;
	afs_uint32 ParentUnique;
	afs_uint32 SegSize;
	afs_uint32 ClientModTime;
	afs_uint32 ServerModTime;
	afs_uint32 Group;
};
typedef struct AFSOldFetchStatus AFSOldFetchStatus;
bool_t xdr_AFSOldFetchStatus(XDR *xdrs, AFSOldFetchStatus *objp);


struct AFSFetchStatus {
	afs_uint32 InterfaceVersion;
	afs_uint32 FileType;
	afs_uint32 LinkCount;
	afs_uint32 Length;
	afs_uint32 DataVersion;
	afs_uint32 Author;
	afs_uint32 Owner;
	afs_uint32 CallerAccess;
	afs_uint32 AnonymousAccess;
	afs_uint32 UnixModeBits;
	afs_uint32 ParentVnode;
	afs_uint32 ParentUnique;
	afs_uint32 ResidencyMask;
	afs_uint32 ClientModTime;
	afs_uint32 ServerModTime;
	afs_uint32 Group;
	afs_uint32 SyncCounter;
	afs_uint32 dataVersionHigh;
	afs_uint32 lockCount;
	afs_uint32 Length_hi;
	afs_uint32 errorCode;
};
typedef struct AFSFetchStatus AFSFetchStatus;
bool_t xdr_AFSFetchStatus(XDR *xdrs, AFSFetchStatus *objp);


struct AFSStoreStatus {
	afs_uint32 Mask;
	afs_uint32 ClientModTime;
	afs_uint32 Owner;
	afs_uint32 Group;
	afs_uint32 UnixModeBits;
	afs_uint32 SegSize;
};
typedef struct AFSStoreStatus AFSStoreStatus;
bool_t xdr_AFSStoreStatus(XDR *xdrs, AFSStoreStatus *objp);

#define AFS_SETMODTIME 1
#define AFS_SETOWNER 2
#define AFS_SETGROUP 4
#define AFS_SETMODE 8
#define AFS_SETSEGSIZE 16
#define AFS_FSYNC 1024

typedef afs_int32 ViceVolumeType;
bool_t xdr_ViceVolumeType(XDR *xdrs, ViceVolumeType *objp);

#define ReadOnly 0
#define ReadWrite 1

struct ViceDisk {
	afs_int32 BlocksAvailable;
	afs_int32 TotalBlocks;
	DiskName Name;
};
typedef struct ViceDisk ViceDisk;
bool_t xdr_ViceDisk(XDR *xdrs, ViceDisk *objp);


struct ViceStatistics {
	afs_uint32 CurrentMsgNumber;
	afs_uint32 OldestMsgNumber;
	afs_uint32 CurrentTime;
	afs_uint32 BootTime;
	afs_uint32 StartTime;
	afs_int32 CurrentConnections;
	afs_uint32 TotalViceCalls;
	afs_uint32 TotalFetchs;
	afs_uint32 FetchDatas;
	afs_uint32 FetchedBytes;
	afs_int32 FetchDataRate;
	afs_uint32 TotalStores;
	afs_uint32 StoreDatas;
	afs_uint32 StoredBytes;
	afs_int32 StoreDataRate;
	afs_uint32 TotalRPCBytesSent;
	afs_uint32 TotalRPCBytesReceived;
	afs_uint32 TotalRPCPacketsSent;
	afs_uint32 TotalRPCPacketsReceived;
	afs_uint32 TotalRPCPacketsLost;
	afs_uint32 TotalRPCBogusPackets;
	afs_int32 SystemCPU;
	afs_int32 UserCPU;
	afs_int32 NiceCPU;
	afs_int32 IdleCPU;
	afs_int32 TotalIO;
	afs_int32 ActiveVM;
	afs_int32 TotalVM;
	afs_int32 EtherNetTotalErrors;
	afs_int32 EtherNetTotalWrites;
	afs_int32 EtherNetTotalInterupts;
	afs_int32 EtherNetGoodReads;
	afs_int32 EtherNetTotalBytesWritten;
	afs_int32 EtherNetTotalBytesRead;
	afs_int32 ProcessSize;
	afs_int32 WorkStations;
	afs_int32 ActiveWorkStations;
	afs_int32 Spare1;
	afs_int32 Spare2;
	afs_int32 Spare3;
	afs_int32 Spare4;
	afs_int32 Spare5;
	afs_int32 Spare6;
	afs_int32 Spare7;
	afs_int32 Spare8;
	ViceDisk Disk1;
	ViceDisk Disk2;
	ViceDisk Disk3;
	ViceDisk Disk4;
	ViceDisk Disk5;
	ViceDisk Disk6;
	ViceDisk Disk7;
	ViceDisk Disk8;
	ViceDisk Disk9;
	ViceDisk Disk10;
};
typedef struct ViceStatistics ViceStatistics;
bool_t xdr_ViceStatistics(XDR *xdrs, ViceStatistics *objp);


struct VolumeStatus {
	afs_int32 Vid;
	afs_int32 ParentId;
	char Online;
	char InService;
	char Blessed;
	char NeedsSalvage;
	afs_int32 Type;
	afs_int32 MinQuota;
	afs_int32 MaxQuota;
	afs_int32 BlocksInUse;
	afs_int32 PartBlocksAvail;
	afs_int32 PartMaxBlocks;
};
typedef struct VolumeStatus VolumeStatus;
bool_t xdr_VolumeStatus(XDR *xdrs, VolumeStatus *objp);


struct AFSFetchVolumeStatus {
	afs_int32 Vid;
	afs_int32 ParentId;
	char Online;
	char InService;
	char Blessed;
	char NeedsSalvage;
	afs_int32 Type;
	afs_int32 MinQuota;
	afs_int32 MaxQuota;
	afs_int32 BlocksInUse;
	afs_int32 PartBlocksAvail;
	afs_int32 PartMaxBlocks;
};
typedef struct AFSFetchVolumeStatus AFSFetchVolumeStatus;
bool_t xdr_AFSFetchVolumeStatus(XDR *xdrs, AFSFetchVolumeStatus *objp);


struct AFSStoreVolumeStatus {
	afs_int32 Mask;
	afs_int32 MinQuota;
	afs_int32 MaxQuota;
};
typedef struct AFSStoreVolumeStatus AFSStoreVolumeStatus;
bool_t xdr_AFSStoreVolumeStatus(XDR *xdrs, AFSStoreVolumeStatus *objp);

#define AFS_SETMINQUOTA 1
#define AFS_SETMAXQUOTA 2

struct AFSVolumeInfo {
	afs_uint32 Vid;
	afs_int32 Type;
	afs_uint32 Type0;
	afs_uint32 Type1;
	afs_uint32 Type2;
	afs_uint32 Type3;
	afs_uint32 Type4;
	afs_uint32 ServerCount;
	afs_uint32 Server0;
	afs_uint32 Server1;
	afs_uint32 Server2;
	afs_uint32 Server3;
	afs_uint32 Server4;
	afs_uint32 Server5;
	afs_uint32 Server6;
	afs_uint32 Server7;
	u_short Port0;
	u_short Port1;
	u_short Port2;
	u_short Port3;
	u_short Port4;
	u_short Port5;
	u_short Port6;
	u_short Port7;
};
typedef struct AFSVolumeInfo AFSVolumeInfo;
bool_t xdr_AFSVolumeInfo(XDR *xdrs, AFSVolumeInfo *objp);


struct VolumeInfo {
	afs_uint32 Vid;
	afs_int32 Type;
	afs_uint32 Type0;
	afs_uint32 Type1;
	afs_uint32 Type2;
	afs_uint32 Type3;
	afs_uint32 Type4;
	afs_uint32 ServerCount;
	afs_uint32 Server0;
	afs_uint32 Server1;
	afs_uint32 Server2;
	afs_uint32 Server3;
	afs_uint32 Server4;
	afs_uint32 Server5;
	afs_uint32 Server6;
	afs_uint32 Server7;
};
typedef struct VolumeInfo VolumeInfo;
bool_t xdr_VolumeInfo(XDR *xdrs, VolumeInfo *objp);


typedef afs_int32 ViceLockType;
bool_t xdr_ViceLockType(XDR *xdrs, ViceLockType *objp);


typedef struct AFSBulkStats {
	u_int AFSBulkStats_len;
	AFSFetchStatus *AFSBulkStats_val;
} AFSBulkStats;
bool_t xdr_AFSBulkStats(XDR *xdrs, AFSBulkStats *objp);

#define LockRead 0
#define LockWrite 1
#define LockExtend 2
#define LockRelease 3

typedef afs_int32 ViceOfflineType;
bool_t xdr_ViceOfflineType(XDR *xdrs, ViceOfflineType *objp);

#define NoSalvage 0
#define Salvage 1
#define MAXCMDINT64S 3
#define MAXCMDINT32S 200
#define MAXCMDCHARS 256
#define CMD_GETRESIDENCIES 1
#define CMD_CHANGERESIDENCIES 2
#define CMD_IMPORTRESIDENCIES 3
#define CMD_GETEXTVOLATTR 4
#define CMD_SETEXTVOLATTR 5
#define CMD_GETACCESSHISTORY 6
#define CMD_MIGRATEFILE 7
#define CMD_CHECKHSMMETADATA 8
#define CMD_FETCHSTATUS 9
#define VOLATTR_DESIREDRESIDENCYMASK 1
#define VOLATTR_UNDESIREDRESIDENCYMASK 2
#define VOLATTR_SETSPECIALACCESSFLAG 4

struct ExtendedVolAttrInputs {
	afs_uint32 Mask;
	afs_uint32 Volume;
	afs_uint32 DesiredResidencyMask;
	afs_uint32 Spare1[10];
	afs_uint32 UnDesiredResidencyMask;
	afs_uint32 Spare2[9];
	afs_uint32 SpecialAccessFlag;
};
typedef struct ExtendedVolAttrInputs ExtendedVolAttrInputs;
bool_t xdr_ExtendedVolAttrInputs(XDR *xdrs, ExtendedVolAttrInputs *objp);


struct ExtendedVolAttrOutputs {
	afs_uint32 DesiredResidencyMask;
	afs_uint32 Spare1[10];
	afs_uint32 UnDesiredResidencyMask;
	afs_uint32 Spare2[9];
	afs_uint32 SpecialAccessFlag;
};
typedef struct ExtendedVolAttrOutputs ExtendedVolAttrOutputs;
bool_t xdr_ExtendedVolAttrOutputs(XDR *xdrs, ExtendedVolAttrOutputs *objp);


struct TagsArray {
	afs_uint32 TagsArray_len;
	afs_uint32 TagsArray_val[184];
};
typedef struct TagsArray TagsArray;
bool_t xdr_TagsArray(XDR *xdrs, TagsArray *objp);


struct AccessHistory {
	afs_uint64 Size;
	afs_uint32 ModTime;
	afs_uint32 NonSpoolingFetches;
	afs_uint32 UserSpoolingFetches;
	afs_uint32 MigratorSpoolingFetches;
	afs_uint32 LastUserMigrationEvent;
	afs_uint32 MigrateMe;
	afs_uint32 Time0;
	afs_uint32 Type0;
	afs_uint32 LocalAccess0;
	afs_uint32 Residency0;
	afs_uint32 Time1;
	afs_uint32 Type1;
	afs_uint32 LocalAccess1;
	afs_uint32 Residency1;
	afs_uint32 Time2;
	afs_uint32 Type2;
	afs_uint32 LocalAccess2;
	afs_uint32 Residency2;
	afs_uint32 Time3;
	afs_uint32 Type3;
	afs_uint32 LocalAccess3;
	afs_uint32 Residency3;
	afs_uint32 Time4;
	afs_uint32 Type4;
	afs_uint32 LocalAccess4;
	afs_uint32 Residency4;
};
typedef struct AccessHistory AccessHistory;
bool_t xdr_AccessHistory(XDR *xdrs, AccessHistory *objp);


struct AccessHistoryOld {
	afs_uint32 Size;
	afs_uint32 ModTime;
	afs_uint32 NonSpoolingFetches;
	afs_uint32 UserSpoolingFetches;
	afs_uint32 MigratorSpoolingFetches;
	afs_uint32 LastUserMigrationEvent;
	afs_uint32 MigrateMe;
	afs_uint32 Time0;
	afs_uint32 Type0;
	afs_uint32 LocalAccess0;
	afs_uint32 Residency0;
	afs_uint32 Time1;
	afs_uint32 Type1;
	afs_uint32 LocalAccess1;
	afs_uint32 Residency1;
	afs_uint32 Time2;
	afs_uint32 Type2;
	afs_uint32 LocalAccess2;
	afs_uint32 Residency2;
	afs_uint32 Time3;
	afs_uint32 Type3;
	afs_uint32 LocalAccess3;
	afs_uint32 Residency3;
	afs_uint32 Time4;
	afs_uint32 Type4;
	afs_uint32 LocalAccess4;
	afs_uint32 Residency4;
};
typedef struct AccessHistoryOld AccessHistoryOld;
bool_t xdr_AccessHistoryOld(XDR *xdrs, AccessHistoryOld *objp);


struct FsCmdInputs {
	afs_int32 command;
	struct AFSFid fid;
	afs_int64 int64s[MAXCMDINT64S];
	afs_uint32 int32s[MAXCMDINT32S];
	char chars[MAXCMDCHARS];
};
typedef struct FsCmdInputs FsCmdInputs;
bool_t xdr_FsCmdInputs(XDR *xdrs, FsCmdInputs *objp);


struct FsCmdOutputs {
	afs_int32 code;
	struct AFSFetchStatus status;
	afs_int64 int64s[MAXCMDINT64S];
	afs_uint32 int32s[MAXCMDINT32S];
	char chars[MAXCMDCHARS];
};
typedef struct FsCmdOutputs FsCmdOutputs;
bool_t xdr_FsCmdOutputs(XDR *xdrs, FsCmdOutputs *objp);

#define ResidencyCmdInputs FsCmdInputs
#define ResidencyCmdOutputs FsCmdOutputs
#define FLUSHMAX 10

typedef struct ViceIds {
	u_int ViceIds_len;
	afs_int32 *ViceIds_val;
} ViceIds;
bool_t xdr_ViceIds(XDR *xdrs, ViceIds *objp);


typedef struct IPAddrs {
	u_int IPAddrs_len;
	afs_int32 *IPAddrs_val;
} IPAddrs;
bool_t xdr_IPAddrs(XDR *xdrs, IPAddrs *objp);

#define RXAFS_STATINDEX 7

extern int StartRXAFS_FetchData(
	/*IN */ struct rx_call *z_call,
	/*IN 1*/ AFSFid * Fid,
	/*IN 1*/ afs_int32 Pos,
	/*IN 1*/ afs_int32 Length);

extern int EndRXAFS_FetchData(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_FetchData(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ afs_int32 Pos,
	/*IN 3*/ afs_int32 Length,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_FetchACL(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*OUT*/ AFSOpaque * AccessList,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_FetchACL(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*OUT*/ AFSOpaque * AccessList,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_FetchStatus(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_FetchStatus(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern int StartRXAFS_StoreData(
	/*IN */ struct rx_call *z_call,
	/*IN 1*/ AFSFid * Fid,
	/*IN 1*/ AFSStoreStatus * InStatus,
	/*IN 1*/ afs_uint32 Pos,
	/*IN 1*/ afs_uint32 Length,
	/*IN 1*/ afs_uint32 FileLength);

extern int EndRXAFS_StoreData(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_StoreData(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ AFSStoreStatus * InStatus,
	/*IN 3*/ afs_uint32 Pos,
	/*IN 3*/ afs_uint32 Length,
	/*IN 3*/ afs_uint32 FileLength,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_StoreACL(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*IN 0*/ AFSOpaque * AccessList,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_StoreACL(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ AFSOpaque * AccessList,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_StoreStatus(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*IN 0*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_StoreStatus(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_RemoveFile(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * DirFid,
	/*IN 0*/ const char * Name,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_RemoveFile(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * DirFid,
	/*IN 3*/ char * Name,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_CreateFile(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * DirFid,
	/*IN 0*/ const char * Name,
	/*IN 0*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_CreateFile(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * DirFid,
	/*IN 3*/ char * Name,
	/*IN 3*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_Rename(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * OldDirFid,
	/*IN 0*/ const char * OldName,
	/*IN 0*/ AFSFid * NewDirFid,
	/*IN 0*/ const char * NewName,
	/*OUT*/ AFSFetchStatus * OutOldDirStatus,
	/*OUT*/ AFSFetchStatus * OutNewDirStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_Rename(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * OldDirFid,
	/*IN 3*/ char * OldName,
	/*IN 3*/ AFSFid * NewDirFid,
	/*IN 3*/ char * NewName,
	/*OUT*/ AFSFetchStatus * OutOldDirStatus,
	/*OUT*/ AFSFetchStatus * OutNewDirStatus,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_Symlink(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * DirFid,
	/*IN 0*/ const char * Name,
	/*IN 0*/ const char * LinkContents,
	/*IN 0*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_Symlink(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * DirFid,
	/*IN 3*/ char * Name,
	/*IN 3*/ char * LinkContents,
	/*IN 3*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_Link(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * DirFid,
	/*IN 0*/ const char * Name,
	/*IN 0*/ AFSFid * ExistingFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_Link(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * DirFid,
	/*IN 3*/ char * Name,
	/*IN 3*/ AFSFid * ExistingFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_MakeDir(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * DirFid,
	/*IN 0*/ const char * Name,
	/*IN 0*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_MakeDir(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * DirFid,
	/*IN 3*/ char * Name,
	/*IN 3*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_RemoveDir(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * DirFid,
	/*IN 0*/ const char * Name,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_RemoveDir(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * DirFid,
	/*IN 3*/ char * Name,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_OldSetLock(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*IN 0*/ ViceLockType Type,
	/*IN 0*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_OldSetLock(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ ViceLockType Type,
	/*IN 3*/ AFSVolSync * Sync);

extern int RXAFS_OldExtendLock(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*IN 0*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_OldExtendLock(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ AFSVolSync * Sync);

extern int RXAFS_OldReleaseLock(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*IN 0*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_OldReleaseLock(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ AFSVolSync * Sync);

extern int RXAFS_GetStatistics(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ ViceStatistics * Statistics);

extern afs_int32 SRXAFS_GetStatistics(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ ViceStatistics * Statistics);

extern int RXAFS_GiveUpCallBacks(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSCBFids * Fids_Array,
	/*IN 0*/ AFSCBs * CallBacks_Array);

extern afs_int32 SRXAFS_GiveUpCallBacks(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSCBFids * Fids_Array,
	/*IN 3*/ AFSCBs * CallBacks_Array);

extern int RXAFS_GetVolumeInfo(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ const char * VolumeName,
	/*OUT*/ VolumeInfo * Volumeinfo);

extern afs_int32 SRXAFS_GetVolumeInfo(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ char * VolumeName,
	/*OUT*/ VolumeInfo * Volumeinfo);

extern int RXAFS_GetVolumeStatus(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 Volumeid,
	/*OUT*/ AFSFetchVolumeStatus * Volumestatus,
	/*OUT*/ char * *Name,
	/*OUT*/ char * *OfflineMsg,
	/*OUT*/ char * *Motd);

extern afs_int32 SRXAFS_GetVolumeStatus(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 Volumeid,
	/*OUT*/ AFSFetchVolumeStatus * Volumestatus,
	/*OUT*/ char * *Name,
	/*OUT*/ char * *OfflineMsg,
	/*OUT*/ char * *Motd);

extern int RXAFS_SetVolumeStatus(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 Volumeid,
	/*IN 0*/ AFSStoreVolumeStatus * Volumestatus,
	/*IN 0*/ const char * Name,
	/*IN 0*/ const char * OfflineMsg,
	/*IN 0*/ const char * Motd);

extern afs_int32 SRXAFS_SetVolumeStatus(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 Volumeid,
	/*IN 3*/ AFSStoreVolumeStatus * Volumestatus,
	/*IN 3*/ char * Name,
	/*IN 3*/ char * OfflineMsg,
	/*IN 3*/ char * Motd);

extern int RXAFS_GetRootVolume(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ char * *VolumeName);

extern afs_int32 SRXAFS_GetRootVolume(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ char * *VolumeName);

extern int RXAFS_CheckToken(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 ViceId,
	/*IN 0*/ AFSOpaque * token);

extern afs_int32 SRXAFS_CheckToken(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 ViceId,
	/*IN 3*/ AFSOpaque * token);

#if 0 /* expanded by -frewrite-includes */
#include <rx/rx_multi.h>
#endif /* expanded by -frewrite-includes */
# 1124 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
#define multi_RXAFS_GetTime(Seconds, USeconds) \
	multi_Body(StartRXAFS_GetTime(multi_call), EndRXAFS_GetTime(multi_call, Seconds, USeconds))


extern int StartRXAFS_GetTime(
	/*IN */ struct rx_call *z_call);

extern int EndRXAFS_GetTime(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ afs_uint32 * Seconds,
	/*OUT*/ afs_uint32 * USeconds);

extern int RXAFS_GetTime(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ afs_uint32 * Seconds,
	/*OUT*/ afs_uint32 * USeconds);

extern afs_int32 SRXAFS_GetTime(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ afs_uint32 * Seconds,
	/*OUT*/ afs_uint32 * USeconds);

extern int RXAFS_NGetVolumeInfo(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ const char * VolumeName,
	/*OUT*/ AFSVolumeInfo * stuff);

extern afs_int32 SRXAFS_NGetVolumeInfo(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ char * VolumeName,
	/*OUT*/ AFSVolumeInfo * stuff);

extern int RXAFS_BulkStatus(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSCBFids * FidsArray,
	/*OUT*/ AFSBulkStats * StatArray,
	/*OUT*/ AFSCBs * CBArray,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_BulkStatus(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSCBFids * FidsArray,
	/*OUT*/ AFSBulkStats * StatArray,
	/*OUT*/ AFSCBs * CBArray,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_SetLock(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*IN 0*/ ViceLockType Type,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_SetLock(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ ViceLockType Type,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_ExtendLock(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_ExtendLock(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_ReleaseLock(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_ReleaseLock(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_XStatsVersion(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ afs_int32 * versionNumberP);

extern afs_int32 SRXAFS_XStatsVersion(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ afs_int32 * versionNumberP);

extern int RXAFS_GetXStats(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 clientVersionNumber,
	/*IN 0*/ afs_int32 collectionNumber,
	/*OUT*/ afs_int32 * srvVersionNumberP,
	/*OUT*/ afs_int32 * timeP,
	/*OUT*/ AFS_CollData * dataP);

extern afs_int32 SRXAFS_GetXStats(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 clientVersionNumber,
	/*IN 3*/ afs_int32 collectionNumber,
	/*OUT*/ afs_int32 * srvVersionNumberP,
	/*OUT*/ afs_int32 * timeP,
	/*OUT*/ AFS_CollData * dataP);

extern int RXAFS_Lookup(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * DirFid,
	/*IN 0*/ const char * Name,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_Lookup(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * DirFid,
	/*IN 3*/ char * Name,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_FlushCPS(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ViceIds * IdsArray,
	/*IN 0*/ IPAddrs * AddrsArray,
	/*IN 0*/ afs_int32 spare1,
	/*OUT*/ afs_int32 * spare2,
	/*OUT*/ afs_int32 * spare3);

extern afs_int32 SRXAFS_FlushCPS(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ViceIds * IdsArray,
	/*IN 3*/ IPAddrs * AddrsArray,
	/*IN 3*/ afs_int32 spare1,
	/*OUT*/ afs_int32 * spare2,
	/*OUT*/ afs_int32 * spare3);

extern int RXAFS_DFSSymlink(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * DirFid,
	/*IN 0*/ const char * Name,
	/*IN 0*/ const char * LinkContents,
	/*IN 0*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_DFSSymlink(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * DirFid,
	/*IN 3*/ char * Name,
	/*IN 3*/ char * LinkContents,
	/*IN 3*/ AFSStoreStatus * InStatus,
	/*OUT*/ AFSFid * OutFid,
	/*OUT*/ AFSFetchStatus * OutFidStatus,
	/*OUT*/ AFSFetchStatus * OutDirStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern int RXAFS_FsCmd(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSFid * Fid,
	/*IN 0*/ struct FsCmdInputs * Inputs,
	/*OUT*/ struct FsCmdOutputs * Outputs);

extern afs_int32 SRXAFS_FsCmd(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ struct FsCmdInputs * Inputs,
	/*OUT*/ struct FsCmdOutputs * Outputs);

extern int RXAFS_InlineBulkStatus(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ AFSCBFids * FidsArray,
	/*OUT*/ AFSBulkStats * StatArray,
	/*OUT*/ AFSCBs * CBArray,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_InlineBulkStatus(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSCBFids * FidsArray,
	/*OUT*/ AFSBulkStats * StatArray,
	/*OUT*/ AFSCBs * CBArray,
	/*OUT*/ AFSVolSync * Sync);

extern int StartRXAFS_FetchData64(
	/*IN */ struct rx_call *z_call,
	/*IN 1*/ AFSFid * Fid,
	/*IN 1*/ afs_int64 Pos,
	/*IN 1*/ afs_int64 Length);

extern int EndRXAFS_FetchData64(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_FetchData64(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ afs_int64 Pos,
	/*IN 3*/ afs_int64 Length,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSCallBack * CallBack,
	/*OUT*/ AFSVolSync * Sync);

extern int StartRXAFS_StoreData64(
	/*IN */ struct rx_call *z_call,
	/*IN 1*/ AFSFid * Fid,
	/*IN 1*/ AFSStoreStatus * InStatus,
	/*IN 1*/ afs_uint64 Pos,
	/*IN 1*/ afs_uint64 Length,
	/*IN 1*/ afs_uint64 FileLength);

extern int EndRXAFS_StoreData64(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

extern afs_int32 SRXAFS_StoreData64(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ AFSFid * Fid,
	/*IN 3*/ AFSStoreStatus * InStatus,
	/*IN 3*/ afs_uint64 Pos,
	/*IN 3*/ afs_uint64 Length,
	/*IN 3*/ afs_uint64 FileLength,
	/*OUT*/ AFSFetchStatus * OutStatus,
	/*OUT*/ AFSVolSync * Sync);

#define multi_RXAFS_GiveUpAllCallBacks() \
	multi_Body(StartRXAFS_GiveUpAllCallBacks(multi_call), EndRXAFS_GiveUpAllCallBacks(multi_call))


extern int StartRXAFS_GiveUpAllCallBacks(
	/*IN */ struct rx_call *z_call);

extern int EndRXAFS_GiveUpAllCallBacks(
	/*IN */ struct rx_call *z_call);

extern int RXAFS_GiveUpAllCallBacks(
	/*IN */ struct rx_connection *z_conn);

extern afs_int32 SRXAFS_GiveUpAllCallBacks(
	/*IN */ struct rx_call *z_call);

#define multi_RXAFS_GetCapabilities(capabilities) \
	multi_Body(StartRXAFS_GetCapabilities(multi_call), EndRXAFS_GetCapabilities(multi_call, capabilities))


extern int StartRXAFS_GetCapabilities(
	/*IN */ struct rx_call *z_call);

extern int EndRXAFS_GetCapabilities(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ Capabilities * capabilities);

extern int RXAFS_GetCapabilities(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ Capabilities * capabilities);

extern afs_int32 SRXAFS_GetCapabilities(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ Capabilities * capabilities);

extern int RXAFS_CallBackRxConnAddr(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 * addr);

extern afs_int32 SRXAFS_CallBackRxConnAddr(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 * addr);
#define STATS64_CURRENTTIME 0
#define STATS64_BOOTTIME 1
#define STATS64_STARTTIME 2
#define STATS64_CURRENTCONNECTIONS 3
#define STATS64_TOTALFETCHES 4
#define STATS64_FETCHDATAS 5
#define STATS64_FETCHEDBYTES 6
#define STATS64_FETCHDATARATE 7
#define STATS64_TOTALSTORES 8
#define STATS64_STOREDATAS 9
#define STATS64_STOREDBYTES 10
#define STATS64_STOREDATARATE 11
#define STATS64_TOTALVICECALLS 12
#define STATS64_WORKSTATIONS 13
#define STATS64_ACTIVEWORKSTATIONS 14
#define STATS64_PROCESSSIZE 15
#define STATS64_VERSION 16

typedef struct ViceStatistics64 {
	u_int ViceStatistics64_len;
	afs_uint64 *ViceStatistics64_val;
} ViceStatistics64;
bool_t xdr_ViceStatistics64(XDR *xdrs, ViceStatistics64 *objp);


extern int RXAFS_GetStatistics64(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 statsVersion,
	/*OUT*/ ViceStatistics64 * Statistics);

extern afs_int32 SRXAFS_GetStatistics64(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 statsVersion,
	/*OUT*/ ViceStatistics64 * Statistics);

struct RXAFS_stats{
	int statsver;
};
extern int RXAFS_ExecuteRequest(struct rx_call *);

extern int RXAFS_OpCodeIndex(int op);

/* Opcode-related useful stats for package: RXAFS_ */
#define RXAFS_LOWEST_OPCODE   130
#define RXAFS_HIGHEST_OPCODE     65542
#define RXAFS_NUMBER_OPCODES     42

#define opcode_RXAFS_FetchData 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(130)))
#define opcode_RXAFS_FetchACL 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(131)))
#define opcode_RXAFS_FetchStatus 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(132)))
#define opcode_RXAFS_StoreData 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(133)))
#define opcode_RXAFS_StoreACL 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(134)))
#define opcode_RXAFS_StoreStatus 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(135)))
#define opcode_RXAFS_RemoveFile 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(136)))
#define opcode_RXAFS_CreateFile 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(137)))
#define opcode_RXAFS_Rename 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(138)))
#define opcode_RXAFS_Symlink 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(139)))
#define opcode_RXAFS_Link 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(140)))
#define opcode_RXAFS_MakeDir 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(141)))
#define opcode_RXAFS_RemoveDir 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(142)))
#define opcode_RXAFS_OldSetLock 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(143)))
#define opcode_RXAFS_OldExtendLock 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(144)))
#define opcode_RXAFS_OldReleaseLock 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(145)))
#define opcode_RXAFS_GetStatistics 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(146)))
#define opcode_RXAFS_GiveUpCallBacks 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(147)))
#define opcode_RXAFS_GetVolumeInfo 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(148)))
#define opcode_RXAFS_GetVolumeStatus 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(149)))
#define opcode_RXAFS_SetVolumeStatus 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(150)))
#define opcode_RXAFS_GetRootVolume 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(151)))
#define opcode_RXAFS_CheckToken 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(152)))
#define opcode_RXAFS_GetTime 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(153)))
#define opcode_RXAFS_NGetVolumeInfo 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(154)))
#define opcode_RXAFS_BulkStatus 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(155)))
#define opcode_RXAFS_SetLock 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(156)))
#define opcode_RXAFS_ExtendLock 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(157)))
#define opcode_RXAFS_ReleaseLock 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(158)))
#define opcode_RXAFS_XStatsVersion 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(159)))
#define opcode_RXAFS_GetXStats 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(160)))
#define opcode_RXAFS_Lookup 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(161)))
#define opcode_RXAFS_FlushCPS 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(162)))
#define opcode_RXAFS_DFSSymlink 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(163)))
#define opcode_RXAFS_FsCmd 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(220)))
#define opcode_RXAFS_InlineBulkStatus 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(65536)))
#define opcode_RXAFS_FetchData64 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(65537)))
#define opcode_RXAFS_StoreData64 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(65538)))
#define opcode_RXAFS_GiveUpAllCallBacks 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(65539)))
#define opcode_RXAFS_GetCapabilities 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(65540)))
#define opcode_RXAFS_CallBackRxConnAddr 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(65541)))
#define opcode_RXAFS_GetStatistics64 	((afs_uint64)((7LL << 32) + RXAFS_OpCodeIndex(65542)))
#define RXAFS_NO_OF_STAT_FUNCS	42

AFS_RXGEN_EXPORT
extern const char *RXAFS_function_names[];

#endif	/* _RXGEN_AFSINT_ */
# 1493 "/usr/home/kaduk/openafs/build/include/afs/afsint.h"
# 83 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <afs/nfs.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/nfs.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#if 0 /* expanded by -frewrite-includes */
#include <errno.h>
#endif /* expanded by -frewrite-includes */
# 11 "/usr/home/kaduk/openafs/build/include/afs/nfs.h"

#ifndef	AFS_VOL_NFS_H
#define	AFS_VOL_NFS_H 1
/*
 * (C) COPYRIGHT IBM CORPORATION 1987
 * LICENSED MATERIALS - PROPERTY OF IBM
 */
/*

	System:		VICE-TWO
	Module:		nfs.h
	Institution:	The Information Technology Center, Carnegie-Mellon University

 */
#define private static
#ifndef NULL
#define NULL	0
#endif
# 29 "/usr/home/kaduk/openafs/build/include/afs/nfs.h"
#define TRUE	1
#define FALSE	0
typedef afs_uint32 bit32;	/* Unsigned, 32 bits */
typedef unsigned short bit16;	/* Unsigned, 16 bits */
typedef unsigned char byte;	/* Unsigned, 8 bits */

typedef bit32 Device;		/* Unix device number */
#ifndef	Error
#define	Error	bit32
#endif
# 39 "/usr/home/kaduk/openafs/build/include/afs/nfs.h"
#endif /* AFS_VOL_NFS_H */
# 40 "/usr/home/kaduk/openafs/build/include/afs/nfs.h"
# 84 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <afs/acl.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/acl.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*
	Information Technology Center
	Carnegie-Mellon University
*/

#ifndef _ACL_
#define _ACL_


#if 0 /* expanded by -frewrite-includes */
#include "afs/ptint.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/ptint.h" 1
/* Machine generated file -- Do NOT edit */

#ifndef	_RXGEN_PTINT_
#define	_RXGEN_PTINT_

#ifdef	KERNEL
/* The following 'ifndefs' are not a good solution to the vendor's omission of surrounding all system includes with 'ifndef's since it requires that this file is included after the system includes...*/
#if 0 /* expanded by -frewrite-includes */
#include <afsconfig.h>
#endif /* expanded by -frewrite-includes */
# 9 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "afs/param.h"
#endif /* expanded by -frewrite-includes */
# 10 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#ifdef	UKERNEL
#if 0 /* expanded by -frewrite-includes */
#include "afs/sysincludes.h"
#endif /* expanded by -frewrite-includes */
# 12 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/xdr.h"
#endif /* expanded by -frewrite-includes */
# 13 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx.h"
#endif /* expanded by -frewrite-includes */
# 14 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_globals.h"
#endif /* expanded by -frewrite-includes */
# 15 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include <ubik.h>
#endif /* expanded by -frewrite-includes */
# 16 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#else	/* UKERNEL */
# 17 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "h/types.h"
#endif /* expanded by -frewrite-includes */
# 18 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#ifndef	SOCK_DGRAM  /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "h/socket.h"
#endif /* expanded by -frewrite-includes */
# 20 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif
# 21 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
struct ubik_client;
#ifndef	DTYPE_SOCKET  /* XXXXX */
#ifndef AFS_LINUX22_ENV
#if 0 /* expanded by -frewrite-includes */
#include "h/file.h"
#endif /* expanded by -frewrite-includes */
# 25 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif
# 26 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif
# 27 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#ifndef	S_IFMT  /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "h/stat.h"
#endif /* expanded by -frewrite-includes */
# 29 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif
# 30 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if defined (AFS_OBSD_ENV) && !defined (MLEN)
#if 0 /* expanded by -frewrite-includes */
#include "sys/mbuf.h"
#endif /* expanded by -frewrite-includes */
# 32 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif
# 33 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#ifndef	IPPROTO_UDP /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "netinet/in.h"
#endif /* expanded by -frewrite-includes */
# 35 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif
# 36 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#ifndef	DST_USA  /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "h/time.h"
#endif /* expanded by -frewrite-includes */
# 38 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif
# 39 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#ifndef AFS_LINUX22_ENV
#if 0 /* expanded by -frewrite-includes */
#include "rpc/types.h"
#endif /* expanded by -frewrite-includes */
# 41 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif /* AFS_LINUX22_ENV */
# 42 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#ifndef	XDR_GETLONG /* XXXXX */
#ifdef AFS_LINUX22_ENV
#ifndef quad_t
#define quad_t __quad_t
#define u_quad_t __u_quad_t
#endif
# 48 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif
# 49 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/xdr.h"
#endif /* expanded by -frewrite-includes */
# 50 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif /* XDR_GETLONG */
# 51 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#endif   /* UKERNEL */
# 52 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "afs/rxgen_consts.h"
#endif /* expanded by -frewrite-includes */
# 53 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "afs_osi.h"
#endif /* expanded by -frewrite-includes */
# 54 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx.h"
#endif /* expanded by -frewrite-includes */
# 55 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_globals.h"
#endif /* expanded by -frewrite-includes */
# 56 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#else	/* KERNEL */
# 57 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 58 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include <afs/stds.h>
#endif /* expanded by -frewrite-includes */
# 59 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 60 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include <rx/xdr.h>
#endif /* expanded by -frewrite-includes */
# 61 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include <rx/rx.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifdef KDUMP_RX_LOCK
/* kdump for SGI needs MP and SP versions of rx_serverQueueEntry,
 * rx_peer, rx_connection and rx_call structs. rx.h gets included a
 * second time to pick up mp_ versions of those structs. Currently
 * the affected struct's have #ifdef's in them for the second pass.
 * This should change once we start using only ANSI compilers.
 * Actually, kdump does not use rx_serverQueueEntry, but I'm including
 * it for completeness.
 */
#undef _RX_
#endif
# 21 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef	_RX_
#define _RX_

#ifndef KDUMP_RX_LOCK
#ifdef	KERNEL
#if 0 /* expanded by -frewrite-includes */
#include "rx_kmutex.h"
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_kernel.h"
#endif /* expanded by -frewrite-includes */
# 29 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if defined (AFS_OBSD_ENV) && !defined (MLEN)
#if 0 /* expanded by -frewrite-includes */
#include "sys/mbuf.h"
#endif /* expanded by -frewrite-includes */
# 31 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 32 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "netinet/in.h"
#endif /* expanded by -frewrite-includes */
# 33 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "sys/socket.h"
#endif /* expanded by -frewrite-includes */
# 34 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else /* KERNEL */
# 35 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 36 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <string.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifdef AFS_PTHREAD_ENV
#if 0 /* expanded by -frewrite-includes */
# include "rx_pthread.h"
#endif /* expanded by -frewrite-includes */
# 40 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else
# 41 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include "rx_lwp.h"
#endif /* expanded by -frewrite-includes */
# 42 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 43 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifdef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
#include <malloc.h>
#endif /* expanded by -frewrite-includes */
# 45 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include <winsock2.h>
#endif /* expanded by -frewrite-includes */
# 46 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include <ws2tcpip.h>
#endif /* expanded by -frewrite-includes */
# 47 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 48 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include "rx_user.h"
#endif /* expanded by -frewrite-includes */
# 49 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifndef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
# include <netinet/in.h>
#endif /* expanded by -frewrite-includes */
# 51 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/socket.h>
#endif /* expanded by -frewrite-includes */
# 52 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 53 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif /* KERNEL */
# 54 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#if 0 /* expanded by -frewrite-includes */
#include <opr/queue.h>
#endif /* expanded by -frewrite-includes */
# 56 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#if 0 /* expanded by -frewrite-includes */
#include "rx_clock.h"
#endif /* expanded by -frewrite-includes */
# 58 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_event.h"
#endif /* expanded by -frewrite-includes */
# 59 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_misc.h"
#endif /* expanded by -frewrite-includes */
# 60 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_null.h"
#endif /* expanded by -frewrite-includes */
# 61 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_multi.h"
#endif /* expanded by -frewrite-includes */
# 62 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* These items are part of the new RX API. They're living in this section
 * for now, to keep them separate from everything else... */

struct rx_connection;
struct rx_call;
struct rx_packet;

/* Connection management */

extern void rx_SetConnectionEpoch(struct rx_connection *conn, afs_uint32 epoch);
extern afs_uint32  rx_GetConnectionEpoch(struct rx_connection *conn);
extern void rx_SetConnectionId(struct rx_connection *conn, afs_uint32 id);
extern afs_uint32  rx_GetConnectionId(struct rx_connection *conn);
extern void *rx_GetSecurityData(struct rx_connection *conn);
extern void  rx_SetSecurityData(struct rx_connection *conn, void *data);
extern int  rx_IsUsingPktCksum(struct rx_connection *conn);
extern void rx_SetSecurityHeaderSize(struct rx_connection *conn, afs_uint32 size);
extern afs_uint32  rx_GetSecurityHeaderSize(struct rx_connection *conn);
extern void rx_SetSecurityMaxTrailerSize(struct rx_connection *conn, afs_uint32 size);
extern afs_uint32  rx_GetSecurityMaxTrailerSize(struct rx_connection *conn);
extern void rx_SetMsgsizeRetryErr(struct rx_connection *conn, int err);
extern int  rx_IsServerConn(struct rx_connection *conn);
extern int  rx_IsClientConn(struct rx_connection *conn);
extern struct rx_securityClass *rx_SecurityObjectOf(const struct rx_connection *);
extern struct rx_peer *rx_PeerOf(struct rx_connection *);
extern u_short rx_ServiceIdOf(struct rx_connection *);
extern int rx_SecurityClassOf(struct rx_connection *);
extern struct rx_service *rx_ServiceOf(struct rx_connection *);
extern int rx_ConnError(struct rx_connection *);

/* Call management */
extern struct rx_connection *rx_ConnectionOf(struct rx_call *call);
extern int rx_Error(struct rx_call *call);
extern int rx_GetRemoteStatus(struct rx_call *call);
extern void rx_SetLocalStatus(struct rx_call *call, int status);
extern int rx_GetCallAbortCode(struct rx_call *call);
extern void rx_SetCallAbortCode(struct rx_call *call, int code);

extern void rx_RecordCallStatistics(struct rx_call *call,
				    unsigned int rxInterface,
				    unsigned int currentFunc,
				    unsigned int totalFunc,
				    int isServer);

/* Peer management */
extern afs_uint32 rx_HostOf(struct rx_peer *peer);
extern u_short rx_PortOf(struct rx_peer *peer);

/* Packets */

/* Packet classes, for rx_AllocPacket and rx_packetQuota */
#define	RX_PACKET_CLASS_RECEIVE	    0
#define	RX_PACKET_CLASS_SEND	    1
#define	RX_PACKET_CLASS_SPECIAL	    2
#define	RX_PACKET_CLASS_RECV_CBUF   3
#define	RX_PACKET_CLASS_SEND_CBUF   4

#define	RX_N_PACKET_CLASSES	    5	/* Must agree with above list */

#define	RX_PACKET_TYPES	    {"data", "ack", "busy", "abort", "ackall", "challenge", "response", "debug", "params", "unused", "unused", "unused", "version"}
#define	RX_N_PACKET_TYPES	    13	/* Must agree with above list;
					 * counts 0
					 * WARNING: if this number ever
					 * grows past 13, rxdebug packets
					 * will need to be modified */


/* For most Unixes, maximum elements in an iovec is 16 */
#define RX_MAXIOVECS 16		        /* limit for ReadvProc/WritevProc */
#define RX_MAXWVECS (RX_MAXIOVECS-1)	/* need one iovec for packet header */

/* Debugging */

/* Call flags, states and modes are exposed by the debug interface */
#ifndef KDUMP_RX_LOCK
/* Major call states */
#define	RX_STATE_NOTINIT  0	/* Call structure has never been initialized */
#define	RX_STATE_PRECALL  1	/* Server-only:  call is not in progress, but packets have arrived */
#define	RX_STATE_ACTIVE	  2	/* An active call; a process is dealing with this call */
#define	RX_STATE_DALLY	  3	/* Dallying after process is done with call */
#define	RX_STATE_HOLD	  4	/* Waiting for acks on reply data packets */
#define RX_STATE_RESET    5     /* Call is being reset */

/* Call modes:  the modes of a call in RX_STATE_ACTIVE state (process attached) */
#define	RX_MODE_SENDING	  1	/* Sending or ready to send */
#define	RX_MODE_RECEIVING 2	/* Receiving or ready to receive */
#define	RX_MODE_ERROR	  3	/* Something in error for current conversation */
#define	RX_MODE_EOF	  4	/* Server has flushed (or client has read) last reply packet */

/* Flags */
#define	RX_CALL_READER_WAIT	   1	/* Reader is waiting for next packet */
#define	RX_CALL_WAIT_WINDOW_ALLOC  2	/* Sender is waiting for window to allocate buffers */
#define	RX_CALL_WAIT_WINDOW_SEND   4	/* Sender is waiting for window to send buffers */
#define	RX_CALL_WAIT_PACKETS	   8	/* Sender is waiting for packet buffers */
#define	RX_CALL_WAIT_PROC	  16	/* Waiting for a process to be assigned */
#define	RX_CALL_RECEIVE_DONE	  32	/* All packets received on this call */
#define	RX_CALL_CLEARED		  64	/* Receive queue cleared in precall state */
#define	RX_CALL_TQ_BUSY		 128	/* Call's Xmit Queue is busy; don't modify */
#define	RX_CALL_TQ_CLEARME	 256	/* Need to clear this call's TQ later */
#define RX_CALL_TQ_SOME_ACKED    512	/* rxi_Start needs to discard ack'd packets. */
#define RX_CALL_TQ_WAIT		1024	/* Reader is waiting for TQ_BUSY to be reset */
#define RX_CALL_FAST_RECOVER    2048	/* call is doing congestion recovery */
/* 4096 was RX_CALL_FAST_RECOVER_WAIT */
#define RX_CALL_SLOW_START_OK   8192	/* receiver acks every other packet */
#define RX_CALL_IOVEC_WAIT	16384	/* waiting thread is using an iovec */
#define RX_CALL_HAVE_LAST	32768	/* Last packet has been received */
#define RX_CALL_NEED_START	0x10000	/* tells rxi_Start to start again */
#define RX_CALL_PEER_BUSY	0x20000 /* the last packet we received on this call was a
                                         * BUSY packet; i.e. the channel for this call is busy */
#define RX_CALL_ACKALL_SENT     0x40000 /* ACKALL has been sent on the call */
#define RX_CALL_FLUSH		0x80000 /* Transmit queue should be flushed to peer */
#endif
# 175 "/usr/home/kaduk/openafs/build/include/rx/rx.h"


/* Configurable parameters */
#define	RX_IDLE_DEAD_TIME	60	/* default idle dead time */
#define	RX_MAX_SERVICES		20	/* Maximum number of services that may be installed */
#if defined(KERNEL) && defined(AFS_AIX51_ENV) && defined(__64__)
#define RX_DEFAULT_STACK_SIZE   24000
#else
# 183 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#define	RX_DEFAULT_STACK_SIZE	16000	/* Default process stack size; overriden by rx_SetStackSize */
#endif
# 185 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* This parameter should not normally be changed */
#define	RX_PROCESS_PRIORITY	LWP_NORMAL_PRIORITY

#define ADDRSPERSITE 16

#ifndef KDUMP_RX_LOCK
/* Bottom n-bits of the Call Identifier give the call number */
#define	RX_MAXCALLS 4		/* Power of 2; max async calls per connection */
#define	RX_CIDSHIFT 2		/* Log2(RX_MAXCALLS) */
#define	RX_CHANNELMASK (RX_MAXCALLS-1)
#define	RX_CIDMASK  (~RX_CHANNELMASK)
#endif /* !KDUMP_RX_LOCK */
# 198 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef KERNEL
typedef void (*rx_destructor_t) (void *);
int rx_KeyCreate(rx_destructor_t);
osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
osi_socket rxi_GetUDPSocket(u_short port);
#endif /* KERNEL */
# 205 "/usr/home/kaduk/openafs/build/include/rx/rx.h"


int ntoh_syserr_conv(int error);

#define	RX_WAIT	    1
#define	RX_DONTWAIT 0

#define rx_GetLocalStatus(call, status) ((call)->localStatus)


static_inline int
rx_IsLoopbackAddr(afs_uint32 addr)
{
    return ((addr & 0xffff0000) == 0x7f000000);
}

/*******************
 * Macros callable by the user to further define attributes of a
 * service.  Must be called before rx_StartServer
 */

/* Set the service stack size.  This currently just sets the stack
 * size for all processes to be the maximum seen, so far */
#define rx_SetStackSize(service, stackSize) \
  rx_stackSize = (((stackSize) > rx_stackSize)? stackSize: rx_stackSize)

/* Set minimum number of processes guaranteed to be available for this
 * service at all times */
#define rx_SetMinProcs(service, min) ((service)->minProcs = (min))

/* Set maximum number of processes that will be made available to this
 * service (also a guarantee that this number will be made available
 * if there is no competition) */
#define rx_SetMaxProcs(service, max) ((service)->maxProcs = (max))

/* Define a procedure to be called just before a server connection is destroyed */
#define rx_SetDestroyConnProc(service,proc) ((service)->destroyConnProc = (proc))

/* Define procedure to set service dead time */
#define rx_SetIdleDeadTime(service,time) ((service)->idleDeadTime = (time))

/*
 * Define error to return in server connections when failing to answer.
 * (server only) For example, AFS viced sends VNOSERVICE.
 */
#define rx_SetServerIdleDeadErr(service,err) ((service)->idleDeadErr = (err))

/* Define procedures for getting and setting before and after execute-request procs */
#define rx_SetAfterProc(service,proc) ((service)->afterProc = (proc))
#define rx_SetBeforeProc(service,proc) ((service)->beforeProc = (proc))
#define rx_GetAfterProc(service) ((service)->afterProc)
#define rx_GetBeforeProc(service) ((service)->beforeProc)
#define rx_SetPostProc(service,proc) ((service)->postProc = (proc))
#define rx_GetPostProc(service) ((service)->postProc)

/* Define a procedure to be called when a server connection is created */
#define rx_SetNewConnProc(service, proc) ((service)->newConnProc = (proc))

/* NOTE:  We'll probably redefine the following three routines, again, sometime. */

/* Set the connection dead time for any connections created for this service (server only) */
#define rx_SetServiceDeadTime(service, seconds) ((service)->secondsUntilDead = (seconds))

/* Enable or disable asymmetric client checking for a service */
#define rx_SetCheckReach(service, x) ((service)->checkReach = (x))

/* Set the overload threshold and the overload error */
#define rx_SetBusyThreshold(threshold, code) (rx_BusyThreshold=(threshold),rx_BusyError=(code))

/* If this flag is set,no new requests are processed by rx, all new requests are
returned with an error code of RX_CALL_DEAD ( transient error ) */
#define	rx_SetRxTranquil()   		(rx_tranquil = 1)
#define	rx_ClearRxTranquil()   		(rx_tranquil = 0)

/* Set the threshold and time to delay aborts for consecutive errors */
#define rx_SetCallAbortThreshold(A) (rxi_callAbortThreshhold = (A))
#define rx_SetCallAbortDelay(A) (rxi_callAbortDelay = (A))
#define rx_SetConnAbortThreshold(A) (rxi_connAbortThreshhold = (A))
#define rx_SetConnAbortDelay(A) (rxi_connAbortDelay = (A))



#define cpspace(call) ((call)->curlen)
#define cppos(call) ((call)->curpos)

#define	rx_Read(call, buf, nbytes)   rx_ReadProc(call, buf, nbytes)
#define	rx_Read32(call, value)   rx_ReadProc32(call, value)
#define	rx_Readv(call, iov, nio, maxio, nbytes) \
   rx_ReadvProc(call, iov, nio, maxio, nbytes)
#define	rx_Write(call, buf, nbytes) rx_WriteProc(call, buf, nbytes)
#define	rx_Write32(call, value) rx_WriteProc32(call, value)
#define	rx_Writev(call, iov, nio, nbytes) \
   rx_WritevProc(call, iov, nio, nbytes)

/* This is the maximum size data packet that can be sent on this connection, accounting for security module-specific overheads. */
#define	rx_MaxUserDataSize(call)		((call)->MTU - RX_HEADER_SIZE - (call)->conn->securityHeaderSize - (call)->conn->securityMaxTrailerSize)

/* Macros to turn the hot thread feature on and off. Enabling hot threads
 * allows the listener thread to trade places with an idle worker thread,
 * which moves the context switch from listener to worker out of the
 * critical path.
 */
#define rx_EnableHotThread()		(rx_enable_hot_thread = 1)
#define rx_DisableHotThread()		(rx_enable_hot_thread = 0)

#define rx_PutConnection(conn) rx_DestroyConnection(conn)

/* A service is installed by rx_NewService, and specifies a service type that
 * is exported by this process.  Incoming calls are stamped with the service
 * type, and must match an installed service for the call to be accepted.
 * Each service exported has a (port,serviceId) pair to uniquely identify it.
 * It is also named:  this is intended to allow a remote statistics gathering
 * program to retrieve per service statistics without having to know the local
 * service id's.  Each service has a number of
 */

/* security objects (instances of security classes) which implement
 * various types of end-to-end security protocols for connections made
 * to this service.  Finally, there are two parameters controlling the
 * number of requests which may be executed in parallel by this
 * service: minProcs is the number of requests to this service which
 * are guaranteed to be able to run in parallel at any time; maxProcs
 * has two meanings: it limits the total number of requests which may
 * execute in parallel and it also guarantees that that many requests
 * may be handled in parallel if no other service is handling any
 * requests. */

struct rx_service {
    u_short serviceId;		/* Service number */
    afs_uint32 serviceHost;	/* IP address for this service */
    u_short servicePort;	/* UDP port for this service */
    char *serviceName;		/* Name of the service */
    osi_socket socket;		/* socket structure or file descriptor */
    u_short nRequestsRunning;	/* Number of requests currently in progress */
    u_short nSecurityObjects;	/* Number of entries in security objects array */
    struct rx_securityClass **securityObjects;	/* Array of security class objects */
      afs_int32(*executeRequestProc) (struct rx_call * acall);	/* Routine to call when an rpc request is received */
    void (*destroyConnProc) (struct rx_connection * tcon);	/* Routine to call when a server connection is destroyed */
    void (*newConnProc) (struct rx_connection * tcon);	/* Routine to call when a server connection is created */
    void (*beforeProc) (struct rx_call * acall);	/* routine to call before a call is executed */
    void (*afterProc) (struct rx_call * acall, afs_int32 code);	/* routine to call after a call is executed */
    void (*postProc) (afs_int32 code);	/* routine to call after the call has ended */
    u_short maxProcs;		/* Maximum procs to be used for this service */
    u_short minProcs;		/* Minimum # of requests guaranteed executable simultaneously */
    u_short connDeadTime;	/* Seconds until a client of this service will be declared dead, if it is not responding */
    u_short idleDeadTime;	/* Time a server will wait for I/O to start up again */
    u_char checkReach;		/* Check for asymmetric clients? */
    afs_int32 idleDeadErr;
    int nSpecific;		/* number entries in specific data */
    void **specific;		/* pointer to connection specific data */
#ifdef	RX_ENABLE_LOCKS
    afs_kmutex_t svc_data_lock;	/* protect specific data */
#endif
# 358 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

};

#endif /* KDUMP_RX_LOCK */
# 362 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef KDUMP_RX_LOCK
/* Flag bits for connection structure */
#define	RX_CONN_MAKECALL_WAITING    1	/* rx_NewCall is waiting for a channel */
#define	RX_CONN_DESTROY_ME	    2	/* Destroy *client* connection after last call */
#define RX_CONN_USING_PACKET_CKSUM  4	/* non-zero header.spare field seen */
#define RX_CONN_KNOW_WINDOW         8	/* window size negotiation works */
#define RX_CONN_RESET		   16	/* connection is reset, remove */
#define RX_CONN_BUSY               32	/* connection is busy; don't delete */
#define RX_CONN_ATTACHWAIT	   64	/* attach waiting for peer->lastReach */
#define RX_CONN_MAKECALL_ACTIVE   128   /* a thread is actively in rx_NewCall */
#define RX_CONN_NAT_PING          256   /* nat ping requested */

/* Type of connection, client or server */
#define	RX_CLIENT_CONNECTION	0
#define	RX_SERVER_CONNECTION	1
#endif /* !KDUMP_RX_LOCK */
# 379 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* Maximum number of acknowledgements in an acknowledge packet */
#define	RX_MAXACKS	    255

#ifndef KDUMP_RX_LOCK

/* The structure of the data portion of an acknowledge packet: An acknowledge
 * packet is in network byte order at all times.  An acknowledgement is always
 * prompted for a specific reason by a specific incoming packet.  This reason
 * is reported in "reason" and the packet's sequence number in the packet
 * header.seq.  In addition to this information, all of the current
 * acknowledgement information about this call is placed in the packet.
 * "FirstPacket" is the sequence number of the first packet represented in an
 * array of bytes, "acks", containing acknowledgement information for a number
 * of consecutive packets.  All packets prior to FirstPacket are implicitly
 * acknowledged: the sender need no longer be concerned about them.  Packets
 * from firstPacket+nAcks and on are not acknowledged.  Packets in the range
 * [firstPacket,firstPacket+nAcks) are each acknowledged explicitly.  The
 * acknowledgement may be RX_NACK if the packet is not (currently) at the
 * receiver (it may have never been received, or received and then later
 * dropped), or it may be RX_ACK if the packet is queued up waiting to be read
 * by the upper level software.  RX_ACK does not imply that the packet may not
 * be dropped before it is read; it does imply that the sender should stop
 * retransmitting the packet until notified otherwise.  The field
 * previousPacket identifies the previous packet received by the peer.  This
 * was used in a previous version of this software, and could be used in the
 * future.  The serial number in the data part of the ack packet corresponds to
 * the serial number oof the packet which prompted the acknowledge.  Any
 * packets which are explicitly not acknowledged, and which were last
 * transmitted with a serial number less than the provided serial number,
 * should be retransmitted immediately.  Actually, this is slightly inaccurate:
 * packets are not necessarily received in order.  When packets are habitually
 * transmitted out of order, this is allowed for in the retransmission
 * algorithm by introducing the notion of maximum packet skew: the degree of
 * out-of-orderness of the packets received on the wire.  This number is
 * communicated from the receiver to the sender in ack packets. */

struct rx_ackPacket {
    u_short bufferSpace;	/* Number of packet buffers available.  That is:  the number of buffers that the sender of the ack packet is willing to provide for data, on this or subsequent calls.  Lying is permissable. */
    u_short maxSkew;		/* Maximum difference between serial# of packet acknowledged and highest packet yet received */
    afs_uint32 firstPacket;	/* The first packet in the list of acknowledged packets */
    afs_uint32 previousPacket;	/* The previous packet number received (obsolete?) */
    afs_uint32 serial;		/* Serial number of the packet which prompted the acknowledge */
    u_char reason;		/* Reason for the acknowledge of ackPacket, defined below */
    u_char nAcks;		/* Number of acknowledgements */
    u_char acks[RX_MAXACKS];	/* Up to RX_MAXACKS packet acknowledgements, defined below */
    /* Packets <firstPacket are implicitly acknowledged and may be discarded by the sender.  Packets >= firstPacket+nAcks are implicitly NOT acknowledged.  No packets with sequence numbers >= firstPacket should be discarded by the sender (they may thrown out at any time by the receiver) */
};

#define FIRSTACKOFFSET 4

/* Reason for acknowledge message */
#define	RX_ACK_REQUESTED	1	/* Peer requested an ack on this packet */
#define	RX_ACK_DUPLICATE	2	/* Duplicate packet */
#define	RX_ACK_OUT_OF_SEQUENCE	3	/* Packet out of sequence */
#define	RX_ACK_EXCEEDS_WINDOW	4	/* Packet sequence number higher than window; discarded */
#define	RX_ACK_NOSPACE		5	/* No buffer space at all */
#define	RX_ACK_PING		6	/* This is a keep-alive ack */
#define	RX_ACK_PING_RESPONSE	7	/* Ack'ing because we were pinged */
#define	RX_ACK_DELAY		8	/* Ack generated since nothing has happened since receiving packet */
#define RX_ACK_IDLE             9	/* Similar to RX_ACK_DELAY, but can
					 * be used to compute RTT */
#define RX_ACK_MTU             -1       /* will be rewritten to ACK_PING */

/* Packet acknowledgement type */
#define	RX_ACK_TYPE_NACK	0	/* I Don't have this packet */
#define	RX_ACK_TYPE_ACK		1	/* I have this packet, although I may discard it later */

/* The packet size transmitted for an acknowledge is adjusted to reflect the actual size of the acks array.  This macro defines the size */
#define rx_AckDataSize(nAcks) (3 + nAcks + offsetof(struct rx_ackPacket, acks[0]))

#define	RX_CHALLENGE_TIMEOUT	2	/* Number of seconds before another authentication request packet is generated */
#define RX_CHALLENGE_MAXTRIES	50	/* Max # of times we resend challenge */
#define	RX_CHECKREACH_TIMEOUT	2	/* Number of seconds before another ping is generated */
#define	RX_CHECKREACH_TTL	60	/* Re-check reachability this often */

/*
 * rx_GetNetworkError 'origin' constants. These define the meaning of the
 * 'type' and 'code' values returned by rx_GetNetworkError.
 */

/* Used for ICMP errors; the type and code are the ICMP type and code,
 * respectively */
#define RX_NETWORK_ERROR_ORIGIN_ICMP (0)

/*
 * RX error codes.  RX uses error codes from -1 to -64 and -100.
 * Rxgen uses other error codes < -64 (see src/rxgen/rpc_errors.h);
 * user programs are expected to return positive error codes
 */

/* Something bad happened to the connection; temporary loss of communication */
#define	RX_CALL_DEAD		    (-1)

/*
 * An invalid operation, such as a client attempting to send data
 * after having received the beginning of a reply from the server.
 */
#define	RX_INVALID_OPERATION	    (-2)

/* An optional timeout per call may be specified */
#define	RX_CALL_TIMEOUT		    (-3)

/* End of data on a read.  Not currently in use. */
#define	RX_EOF			    (-4)

/* Some sort of low-level protocol error. */
#define	RX_PROTOCOL_ERROR	    (-5)

/*
 * Generic user abort code; used when no more specific error code needs to be
 * communicated.  For example, multi rx clients use this code to abort a multi-
 * rx call.
 */
#define	RX_USER_ABORT		    (-6)

/* Port already in use (from rx_Init).  This error is never sent on the wire. */
#define RX_ADDRINUSE		    (-7)

/* EMSGSIZE returned from network.  Packet too big, must fragment */
#define RX_MSGSIZE		    (-8)

/*
 * Idle dead timeout error.  This error is never sent on the wire.
 * rxi_SendCallAbort() translates RX_CALL_IDLE to RX_CALL_TIMEOUT.
 */
#define RX_CALL_IDLE                (-9)

/*
 * Busy call channel error.  This error is never sent on the wire.
 * rxi_SendCallAbort() translates RX_CALL_BUSY to RX_CALL_TIMEOUT.
 */
#define RX_CALL_BUSY                (-10)

/* transient failure detected ( possibly the server is restarting ) */
/* this should be equal to VRESTARTING ( util/errors.h ) for old clients to work */
#define RX_RESTARTING		    (-100)

typedef enum {
    RX_SECIDX_NULL = 0,
    RX_SECIDX_KAD  = 2,
    RX_SECIDX_GK   = 4,
    RX_SECIDX_K5   = 5,
} rx_securityIndex;

struct rx_securityObjectStats {
    char type;			/* 0:unk 1:null,2:vab 3:kad */
    char level;
    char sparec[10];		/* force correct alignment */
    afs_int32 flags;		/* 1=>unalloc, 2=>auth, 4=>expired */
    afs_uint32 expires;
    afs_uint32 packetsReceived;
    afs_uint32 packetsSent;
    afs_uint32 bytesReceived;
    afs_uint32 bytesSent;
    short spares[4];
    afs_int32 sparel[8];
};

/* Configuration settings */

/* Enum for storing configuration variables which can be set via the
 * SetConfiguration method in the rx_securityClass, below
 */

typedef enum {
     RXS_CONFIG_FLAGS /* afs_uint32 set of bitwise flags */
} rx_securityConfigVariables;

/* For the RXS_CONFIG_FLAGS, the following bit values are defined */

/* Disable the principal name contains dot check in rxkad */
#define RXS_CONFIG_FLAGS_DISABLE_DOTCHECK	0x01

/* XXXX (rewrite this description) A security class object contains a set of
 * procedures and some private data to implement a security model for rx
 * connections.  These routines are called by rx as appropriate.  Rx knows
 * nothing about the internal details of any particular security model, or
 * about security state.  Rx does maintain state per connection on behalf of
 * the security class.  Each security class implementation is also expected to
 * provide routines to create these objects.  Rx provides a basic routine to
 * allocate one of these objects; this routine must be called by the class. */
struct rx_securityClass {
    struct rx_securityOps {
	int (*op_Close) (struct rx_securityClass * aobj);
	int (*op_NewConnection) (struct rx_securityClass * aobj,
				 struct rx_connection * aconn);
	int (*op_PreparePacket) (struct rx_securityClass * aobj,
				 struct rx_call * acall,
				 struct rx_packet * apacket);
	int (*op_SendPacket) (struct rx_securityClass * aobj,
			      struct rx_call * acall,
			      struct rx_packet * apacket);
	int (*op_CheckAuthentication) (struct rx_securityClass * aobj,
				       struct rx_connection * aconn);
	int (*op_CreateChallenge) (struct rx_securityClass * aobj,
				   struct rx_connection * aconn);
	int (*op_GetChallenge) (struct rx_securityClass * aobj,
				struct rx_connection * aconn,
				struct rx_packet * apacket);
	int (*op_GetResponse) (struct rx_securityClass * aobj,
			       struct rx_connection * aconn,
			       struct rx_packet * apacket);
	int (*op_CheckResponse) (struct rx_securityClass * aobj,
				 struct rx_connection * aconn,
				 struct rx_packet * apacket);
	int (*op_CheckPacket) (struct rx_securityClass * aobj,
			       struct rx_call * acall,
			       struct rx_packet * apacket);
	int (*op_DestroyConnection) (struct rx_securityClass * aobj,
				     struct rx_connection * aconn);
	int (*op_GetStats) (struct rx_securityClass * aobj,
			    struct rx_connection * aconn,
			    struct rx_securityObjectStats * astats);
	int (*op_SetConfiguration) (struct rx_securityClass * aobj,
				    struct rx_connection * aconn,
				    rx_securityConfigVariables atype,
				    void * avalue,
				    void ** acurrentValue);
	int (*op_Spare2) (void);
	int (*op_Spare3) (void);
    } *ops;
    void *privateData;
    int refCount;
};

#define RXS_OP(obj,op,args) ((obj && (obj->ops->op_ ## op)) ? (*(obj)->ops->op_ ## op)args : 0)

#define RXS_Close(obj) RXS_OP(obj,Close,(obj))
#define RXS_NewConnection(obj,conn) RXS_OP(obj,NewConnection,(obj,conn))
#define RXS_PreparePacket(obj,call,packet) RXS_OP(obj,PreparePacket,(obj,call,packet))
#define RXS_SendPacket(obj,call,packet) RXS_OP(obj,SendPacket,(obj,call,packet))
#define RXS_CheckAuthentication(obj,conn) RXS_OP(obj,CheckAuthentication,(obj,conn))
#define RXS_CreateChallenge(obj,conn) RXS_OP(obj,CreateChallenge,(obj,conn))
#define RXS_GetChallenge(obj,conn,packet) RXS_OP(obj,GetChallenge,(obj,conn,packet))
#define RXS_GetResponse(obj,conn,packet) RXS_OP(obj,GetResponse,(obj,conn,packet))
#define RXS_CheckResponse(obj,conn,packet) RXS_OP(obj,CheckResponse,(obj,conn,packet))
#define RXS_CheckPacket(obj,call,packet) RXS_OP(obj,CheckPacket,(obj,call,packet))
#define RXS_DestroyConnection(obj,conn) RXS_OP(obj,DestroyConnection,(obj,conn))
#define RXS_GetStats(obj,conn,stats) RXS_OP(obj,GetStats,(obj,conn,stats))
#define RXS_SetConfiguration(obj, conn, type, value, currentValue) RXS_OP(obj, SetConfiguration,(obj,conn,type,value,currentValue))



/* Structure for keeping rx statistics.  Note that this structure is returned
 * by rxdebug, so, for compatibility reasons, new fields should be appended (or
 * spares used), the rxdebug protocol checked, if necessary, and the PrintStats
 * code should be updated as well.
 *
 * Clearly we assume that ntohl will work on these structures so sizeof(int)
 * must equal sizeof(afs_int32). */

struct rx_statistics {		/* General rx statistics */
    int packetRequests;		/* Number of packet allocation requests */
    int receivePktAllocFailures;
    int sendPktAllocFailures;
    int specialPktAllocFailures;
    int socketGreedy;		/* Whether SO_GREEDY succeeded */
    int bogusPacketOnRead;	/* Number of inappropriately short packets received */
    int bogusHost;		/* Host address from bogus packets */
    int noPacketOnRead;		/* Number of read packets attempted when there was actually no packet to read off the wire */
    int noPacketBuffersOnRead;	/* Number of dropped data packets due to lack of packet buffers */
    int selects;		/* Number of selects waiting for packet or timeout */
    int sendSelects;		/* Number of selects forced when sending packet */
    int packetsRead[RX_N_PACKET_TYPES];	/* Total number of packets read, per type */
    int dataPacketsRead;	/* Number of unique data packets read off the wire */
    int ackPacketsRead;		/* Number of ack packets read */
    int dupPacketsRead;		/* Number of duplicate data packets read */
    int spuriousPacketsRead;	/* Number of inappropriate data packets */
    int packetsSent[RX_N_PACKET_TYPES];	/* Number of rxi_Sends: packets sent over the wire, per type */
    int ackPacketsSent;		/* Number of acks sent */
    int pingPacketsSent;	/* Total number of ping packets sent */
    int abortPacketsSent;	/* Total number of aborts */
    int busyPacketsSent;	/* Total number of busies sent received */
    int dataPacketsSent;	/* Number of unique data packets sent */
    int dataPacketsReSent;	/* Number of retransmissions */
    int dataPacketsPushed;	/* Number of retransmissions pushed early by a NACK */
    int ignoreAckedPacket;	/* Number of packets with acked flag, on rxi_Start */
    struct clock totalRtt;	/* Total round trip time measured (use to compute average) */
    struct clock minRtt;	/* Minimum round trip time measured */
    struct clock maxRtt;	/* Maximum round trip time measured */
    int nRttSamples;		/* Total number of round trip samples */
    int nServerConns;		/* Total number of server connections */
    int nClientConns;		/* Total number of client connections */
    int nPeerStructs;		/* Total number of peer structures */
    int nCallStructs;		/* Total number of call structures allocated */
    int nFreeCallStructs;	/* Total number of previously allocated free call structures */
    int netSendFailures;
    afs_int32 fatalErrors;
    int ignorePacketDally;	/* packets dropped because call is in dally state */
    int receiveCbufPktAllocFailures;
    int sendCbufPktAllocFailures;
    int nBusies;
    int spares[4];
};

/* structures for debug input and output packets */

/* debug input types */
struct rx_debugIn {
    afs_int32 type;
    afs_int32 index;
};

/* Invalid rx debug package type */
#define RX_DEBUGI_BADTYPE     (-8)

#define RX_DEBUGI_VERSION_MINIMUM ('L')	/* earliest real version */
#define RX_DEBUGI_VERSION     ('S')    /* Latest version */
    /* first version w/ secStats */
#define RX_DEBUGI_VERSION_W_SECSTATS ('L')
    /* version M is first supporting GETALLCONN and RXSTATS type */
#define RX_DEBUGI_VERSION_W_GETALLCONN ('M')
#define RX_DEBUGI_VERSION_W_RXSTATS ('M')
    /* last version with unaligned debugConn */
#define RX_DEBUGI_VERSION_W_UNALIGNED_CONN ('L')
#define RX_DEBUGI_VERSION_W_WAITERS ('N')
#define RX_DEBUGI_VERSION_W_IDLETHREADS ('O')
#define RX_DEBUGI_VERSION_W_NEWPACKETTYPES ('P')
#define RX_DEBUGI_VERSION_W_GETPEER ('Q')
#define RX_DEBUGI_VERSION_W_WAITED ('R')
#define RX_DEBUGI_VERSION_W_PACKETS ('S')

#define	RX_DEBUGI_GETSTATS	1	/* get basic rx stats */
#define	RX_DEBUGI_GETCONN	2	/* get connection info */
#define	RX_DEBUGI_GETALLCONN	3	/* get even uninteresting conns */
#define	RX_DEBUGI_RXSTATS	4	/* get all rx stats */
#define	RX_DEBUGI_GETPEER	5	/* get all peer structs */

struct rx_debugStats {
    afs_int32 nFreePackets;
    afs_int32 packetReclaims;
    afs_int32 callsExecuted;
    char waitingForPackets;
    char usedFDs;
    char version;
    char spare1;
    afs_int32 nWaiting;
    afs_int32 idleThreads;	/* Number of server threads that are idle */
    afs_int32 nWaited;
    afs_int32 nPackets;
    afs_int32 spare2[6];
};

struct rx_debugConn_vL {
    afs_uint32 host;
    afs_int32 cid;
    afs_int32 serial;
    afs_int32 callNumber[RX_MAXCALLS];
    afs_int32 error;
    short port;
    char flags;
    char type;
    char securityIndex;
    char callState[RX_MAXCALLS];
    char callMode[RX_MAXCALLS];
    char callFlags[RX_MAXCALLS];
    char callOther[RX_MAXCALLS];
    /* old style getconn stops here */
    struct rx_securityObjectStats secStats;
    afs_int32 sparel[10];
};

struct rx_debugConn {
    afs_uint32 host;
    afs_int32 cid;
    afs_int32 serial;
    afs_int32 callNumber[RX_MAXCALLS];
    afs_int32 error;
    short port;
    char flags;
    char type;
    char securityIndex;
    char sparec[3];		/* force correct alignment */
    char callState[RX_MAXCALLS];
    char callMode[RX_MAXCALLS];
    char callFlags[RX_MAXCALLS];
    char callOther[RX_MAXCALLS];
    /* old style getconn stops here */
    struct rx_securityObjectStats secStats;
    afs_int32 epoch;
    afs_int32 natMTU;
    afs_int32 sparel[9];
};

struct rx_debugPeer {
    afs_uint32 host;
    u_short port;
    u_short ifMTU;
    afs_uint32 idleWhen;
    short refCount;
    u_char burstSize;
    u_char burst;
    struct clock burstWait;
    afs_int32 rtt;
    afs_int32 rtt_dev;
    struct clock timeout;
    afs_int32 nSent;
    afs_int32 reSends;
    afs_int32 inPacketSkew;
    afs_int32 outPacketSkew;
    afs_int32 rateFlag;
    u_short natMTU;
    u_short maxMTU;
    u_short maxDgramPackets;
    u_short ifDgramPackets;
    u_short MTU;
    u_short cwind;
    u_short nDgramPackets;
    u_short congestSeq;
    afs_hyper_t bytesSent;
    afs_hyper_t bytesReceived;
    afs_int32 sparel[10];
};

#define	RX_OTHER_IN	1	/* packets avail in in queue */
#define	RX_OTHER_OUT	2	/* packets avail in out queue */

#define RX_SERVER_DEBUG_SEC_STATS		0x1
#define RX_SERVER_DEBUG_ALL_CONN		0x2
#define RX_SERVER_DEBUG_RX_STATS		0x4
#define RX_SERVER_DEBUG_WAITER_CNT		0x8
#define RX_SERVER_DEBUG_IDLE_THREADS		0x10
#define RX_SERVER_DEBUG_OLD_CONN		0x20
#define RX_SERVER_DEBUG_NEW_PACKETS		0x40
#define RX_SERVER_DEBUG_ALL_PEER		0x80
#define RX_SERVER_DEBUG_WAITED_CNT              0x100
#define RX_SERVER_DEBUG_PACKETS_CNT              0x200

#define AFS_RX_STATS_CLEAR_ALL			0xffffffff
#define AFS_RX_STATS_CLEAR_INVOCATIONS		0x1
#define AFS_RX_STATS_CLEAR_BYTES_SENT		0x2
#define AFS_RX_STATS_CLEAR_BYTES_RCVD		0x4
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_SUM	0x8
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_SQUARE	0x10
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_MIN	0x20
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_MAX	0x40
#define AFS_RX_STATS_CLEAR_EXEC_TIME_SUM	0x80
#define AFS_RX_STATS_CLEAR_EXEC_TIME_SQUARE	0x100
#define AFS_RX_STATS_CLEAR_EXEC_TIME_MIN	0x200
#define AFS_RX_STATS_CLEAR_EXEC_TIME_MAX	0x400

typedef struct rx_function_entry_v1 {
    afs_uint32 remote_peer;
    afs_uint32 remote_port;
    afs_uint32 remote_is_server;
    afs_uint32 interfaceId;
    afs_uint32 func_total;
    afs_uint32 func_index;
    afs_uint64 invocations;
    afs_uint64 bytes_sent;
    afs_uint64 bytes_rcvd;
    struct clock queue_time_sum;
    struct clock queue_time_sum_sqr;
    struct clock queue_time_min;
    struct clock queue_time_max;
    struct clock execution_time_sum;
    struct clock execution_time_sum_sqr;
    struct clock execution_time_min;
    struct clock execution_time_max;
} rx_function_entry_v1_t, *rx_function_entry_v1_p;

/*
 * If you need to change rx_function_entry, you should probably create a brand
 * new structure.  Keeping the old structure will allow backwards compatibility
 * with old clients (even if it is only used to calculate allocation size).
 * If you do change the size or the format, you'll need to bump
 * RX_STATS_RETRIEVAL_VERSION.  This allows some primitive form
 * of versioning a la rxdebug.
 */

#define RX_STATS_RETRIEVAL_VERSION 1	/* latest version */
#define RX_STATS_RETRIEVAL_FIRST_EDITION 1	/* first implementation */

typedef struct rx_interface_stat {
    struct opr_queue entry;
    struct opr_queue entryPeers;
    rx_function_entry_v1_t stats[1];	/* make sure this is aligned correctly */
} rx_interface_stat_t, *rx_interface_stat_p;

#define RX_STATS_SERVICE_ID 409

#ifdef AFS_NT40_ENV
extern int rx_DumpCalls(FILE *outputFile, char *cookie);
#endif
# 864 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#endif /* _RX_   End of rx.h */
# 866 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifdef	KERNEL
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 869 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else
# 870 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 871 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 872 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

static_inline afs_uint32
RPCOpStat_Peer(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_peer;
}

static_inline afs_uint32
RPCOpStat_Port(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_port;
}

static_inline afs_uint32
RPCOpStat_IsServer(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_is_server;
}

static_inline afs_uint32
RPCOpStat_InterfaceId(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->interfaceId;
}

static_inline afs_uint32
RPCOpStat_NumFuncs(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->func_total;
}

static_inline afs_uint32
RPCOpStat_CurFunc(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->func_index;
}

static_inline struct clock *
RPCOpStat_QTimeSum(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_sum);
}

static_inline struct clock *
RPCOpStat_QTimeSumSqr(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_sum_sqr);
}

static_inline struct clock *
RPCOpStat_QTimeSumMin(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_min);
}

static_inline struct clock *
RPCOpStat_QTimeSumMax(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_max);
}

static_inline struct clock *
RPCOpStat_ExecTimeSum(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_sum);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumSqr(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_sum_sqr);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumMin(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_min);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumMax(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_max);
}

static_inline afs_uint64
RPCOpStat_NumCalls(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->invocations;
}

static_inline afs_uint64
RPCOpStat_BytesSent(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->bytes_sent;
}

static_inline afs_uint64
RPCOpStat_BytesRcvd(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->bytes_rcvd;
}
#endif /* !KDUMP_RX_LOCK */
# 975 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
# 62 "/usr/home/kaduk/openafs/build/include/afs/ptint.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <rx/rx_globals.h>
#endif /* expanded by -frewrite-includes */
# 63 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include <afs/rxgen_consts.h>
#endif /* expanded by -frewrite-includes */
# 64 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#if 0 /* expanded by -frewrite-includes */
#include <ubik.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/ubik.h" 1
/*
 * ubik.h:
 * This file is automatically generated; please do not edit it.
 */
/* Including ../../../openafs/src/ubik/ubik.p.h at beginning of ubik.h file. */

/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef UBIK_H
#define UBIK_H

#if 0 /* expanded by -frewrite-includes */
#include <stdarg.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/stdarg.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/stdarg.h 232276 2012-02-28 22:30:58Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/stdarg.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/x86/stdarg.h" 1 3 4
/*-
 * Copyright (c) 2002 David E. O'Brien.  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.
 * 3. 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 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: head/sys/x86/include/stdarg.h 256105 2013-10-07 10:01:23Z phk $
 */

#ifndef _MACHINE_STDARG_H_
#define	_MACHINE_STDARG_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 35 "/usr/include/x86/stdarg.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 36 "/usr/include/x86/stdarg.h" 3 4

#ifndef _VA_LIST_DECLARED
#define	_VA_LIST_DECLARED
typedef	__va_list	va_list;
#endif
# 41 "/usr/include/x86/stdarg.h" 3 4

#ifdef __GNUCLIKE_BUILTIN_STDARG

#define	va_start(ap, last) \
	__builtin_va_start((ap), (last))

#define	va_arg(ap, type) \
	__builtin_va_arg((ap), type)

#define	__va_copy(dest, src) \
	__builtin_va_copy((dest), (src))

#if __ISO_C_VISIBLE >= 1999
#define	va_copy(dest, src) \
	__va_copy(dest, src)
#endif
# 57 "/usr/include/x86/stdarg.h" 3 4

#define	va_end(ap) \
	__builtin_va_end(ap)

#elif defined(lint)
# 62 "/usr/include/x86/stdarg.h" 3 4
/* Provide a fake implementation for lint's benefit */
#define	__va_size(type) \
	(((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
#define	va_start(ap, last) \
	((ap) = (va_list)&(last) + __va_size(last))
#define va_copy(dst, src) \
	((dst) = (src))
#define	va_arg(ap, type) \
	(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
#define	va_end(ap)

#else
# 74 "/usr/include/x86/stdarg.h" 3 4
#error this file needs to be ported to your compiler
#endif
# 76 "/usr/include/x86/stdarg.h" 3 4

#endif /* !_MACHINE_STDARG_H_ */
# 78 "/usr/include/x86/stdarg.h" 3 4
# 7 "/usr/include/stdarg.h" 2 3 4
# 20 "/usr/home/kaduk/openafs/build/include/ubik.h" 2

#if 0 /* expanded by -frewrite-includes */
#include <ubik_int.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/ubik_int.h" 1
/* Machine generated file -- Do NOT edit */

#ifndef	_RXGEN_UBIK_INT_
#define	_RXGEN_UBIK_INT_

#ifdef	KERNEL
/* The following 'ifndefs' are not a good solution to the vendor's omission of surrounding all system includes with 'ifndef's since it requires that this file is included after the system includes...*/
#if 0 /* expanded by -frewrite-includes */
#include <afsconfig.h>
#endif /* expanded by -frewrite-includes */
# 9 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "afs/param.h"
#endif /* expanded by -frewrite-includes */
# 10 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#ifdef	UKERNEL
#if 0 /* expanded by -frewrite-includes */
#include "afs/sysincludes.h"
#endif /* expanded by -frewrite-includes */
# 12 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/xdr.h"
#endif /* expanded by -frewrite-includes */
# 13 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx.h"
#endif /* expanded by -frewrite-includes */
# 14 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_globals.h"
#endif /* expanded by -frewrite-includes */
# 15 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#else	/* UKERNEL */
# 16 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "h/types.h"
#endif /* expanded by -frewrite-includes */
# 17 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#ifndef	SOCK_DGRAM  /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "h/socket.h"
#endif /* expanded by -frewrite-includes */
# 19 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif
# 20 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
struct ubik_client;
#ifndef	DTYPE_SOCKET  /* XXXXX */
#ifndef AFS_LINUX22_ENV
#if 0 /* expanded by -frewrite-includes */
#include "h/file.h"
#endif /* expanded by -frewrite-includes */
# 24 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif
# 25 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif
# 26 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#ifndef	S_IFMT  /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "h/stat.h"
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif
# 29 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if defined (AFS_OBSD_ENV) && !defined (MLEN)
#if 0 /* expanded by -frewrite-includes */
#include "sys/mbuf.h"
#endif /* expanded by -frewrite-includes */
# 31 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif
# 32 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#ifndef	IPPROTO_UDP /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "netinet/in.h"
#endif /* expanded by -frewrite-includes */
# 34 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif
# 35 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#ifndef	DST_USA  /* XXXXX */
#if 0 /* expanded by -frewrite-includes */
#include "h/time.h"
#endif /* expanded by -frewrite-includes */
# 37 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif
# 38 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#ifndef AFS_LINUX22_ENV
#if 0 /* expanded by -frewrite-includes */
#include "rpc/types.h"
#endif /* expanded by -frewrite-includes */
# 40 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif /* AFS_LINUX22_ENV */
# 41 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#ifndef	XDR_GETLONG /* XXXXX */
#ifdef AFS_LINUX22_ENV
#ifndef quad_t
#define quad_t __quad_t
#define u_quad_t __u_quad_t
#endif
# 47 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif
# 48 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/xdr.h"
#endif /* expanded by -frewrite-includes */
# 49 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif /* XDR_GETLONG */
# 50 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif   /* UKERNEL */
# 51 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "afs/rxgen_consts.h"
#endif /* expanded by -frewrite-includes */
# 52 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "afs_osi.h"
#endif /* expanded by -frewrite-includes */
# 53 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx.h"
#endif /* expanded by -frewrite-includes */
# 54 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_globals.h"
#endif /* expanded by -frewrite-includes */
# 55 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#else	/* KERNEL */
# 56 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 57 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include <afs/stds.h>
#endif /* expanded by -frewrite-includes */
# 58 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 59 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include <rx/xdr.h>
#endif /* expanded by -frewrite-includes */
# 60 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include <rx/rx.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/rx/rx.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifdef KDUMP_RX_LOCK
/* kdump for SGI needs MP and SP versions of rx_serverQueueEntry,
 * rx_peer, rx_connection and rx_call structs. rx.h gets included a
 * second time to pick up mp_ versions of those structs. Currently
 * the affected struct's have #ifdef's in them for the second pass.
 * This should change once we start using only ANSI compilers.
 * Actually, kdump does not use rx_serverQueueEntry, but I'm including
 * it for completeness.
 */
#undef _RX_
#endif
# 21 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef	_RX_
#define _RX_

#ifndef KDUMP_RX_LOCK
#ifdef	KERNEL
#if 0 /* expanded by -frewrite-includes */
#include "rx_kmutex.h"
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_kernel.h"
#endif /* expanded by -frewrite-includes */
# 29 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if defined (AFS_OBSD_ENV) && !defined (MLEN)
#if 0 /* expanded by -frewrite-includes */
#include "sys/mbuf.h"
#endif /* expanded by -frewrite-includes */
# 31 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 32 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "netinet/in.h"
#endif /* expanded by -frewrite-includes */
# 33 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "sys/socket.h"
#endif /* expanded by -frewrite-includes */
# 34 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else /* KERNEL */
# 35 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 36 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <string.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifdef AFS_PTHREAD_ENV
#if 0 /* expanded by -frewrite-includes */
# include "rx_pthread.h"
#endif /* expanded by -frewrite-includes */
# 40 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else
# 41 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include "rx_lwp.h"
#endif /* expanded by -frewrite-includes */
# 42 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 43 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifdef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
#include <malloc.h>
#endif /* expanded by -frewrite-includes */
# 45 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include <winsock2.h>
#endif /* expanded by -frewrite-includes */
# 46 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include <ws2tcpip.h>
#endif /* expanded by -frewrite-includes */
# 47 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 48 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include "rx_user.h"
#endif /* expanded by -frewrite-includes */
# 49 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#ifndef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
# include <netinet/in.h>
#endif /* expanded by -frewrite-includes */
# 51 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
# include <sys/socket.h>
#endif /* expanded by -frewrite-includes */
# 52 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 53 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif /* KERNEL */
# 54 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#if 0 /* expanded by -frewrite-includes */
#include <opr/queue.h>
#endif /* expanded by -frewrite-includes */
# 56 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#if 0 /* expanded by -frewrite-includes */
#include "rx_clock.h"
#endif /* expanded by -frewrite-includes */
# 58 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_event.h"
#endif /* expanded by -frewrite-includes */
# 59 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_misc.h"
#endif /* expanded by -frewrite-includes */
# 60 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_null.h"
#endif /* expanded by -frewrite-includes */
# 61 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_multi.h"
#endif /* expanded by -frewrite-includes */
# 62 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* These items are part of the new RX API. They're living in this section
 * for now, to keep them separate from everything else... */

struct rx_connection;
struct rx_call;
struct rx_packet;

/* Connection management */

extern void rx_SetConnectionEpoch(struct rx_connection *conn, afs_uint32 epoch);
extern afs_uint32  rx_GetConnectionEpoch(struct rx_connection *conn);
extern void rx_SetConnectionId(struct rx_connection *conn, afs_uint32 id);
extern afs_uint32  rx_GetConnectionId(struct rx_connection *conn);
extern void *rx_GetSecurityData(struct rx_connection *conn);
extern void  rx_SetSecurityData(struct rx_connection *conn, void *data);
extern int  rx_IsUsingPktCksum(struct rx_connection *conn);
extern void rx_SetSecurityHeaderSize(struct rx_connection *conn, afs_uint32 size);
extern afs_uint32  rx_GetSecurityHeaderSize(struct rx_connection *conn);
extern void rx_SetSecurityMaxTrailerSize(struct rx_connection *conn, afs_uint32 size);
extern afs_uint32  rx_GetSecurityMaxTrailerSize(struct rx_connection *conn);
extern void rx_SetMsgsizeRetryErr(struct rx_connection *conn, int err);
extern int  rx_IsServerConn(struct rx_connection *conn);
extern int  rx_IsClientConn(struct rx_connection *conn);
extern struct rx_securityClass *rx_SecurityObjectOf(const struct rx_connection *);
extern struct rx_peer *rx_PeerOf(struct rx_connection *);
extern u_short rx_ServiceIdOf(struct rx_connection *);
extern int rx_SecurityClassOf(struct rx_connection *);
extern struct rx_service *rx_ServiceOf(struct rx_connection *);
extern int rx_ConnError(struct rx_connection *);

/* Call management */
extern struct rx_connection *rx_ConnectionOf(struct rx_call *call);
extern int rx_Error(struct rx_call *call);
extern int rx_GetRemoteStatus(struct rx_call *call);
extern void rx_SetLocalStatus(struct rx_call *call, int status);
extern int rx_GetCallAbortCode(struct rx_call *call);
extern void rx_SetCallAbortCode(struct rx_call *call, int code);

extern void rx_RecordCallStatistics(struct rx_call *call,
				    unsigned int rxInterface,
				    unsigned int currentFunc,
				    unsigned int totalFunc,
				    int isServer);

/* Peer management */
extern afs_uint32 rx_HostOf(struct rx_peer *peer);
extern u_short rx_PortOf(struct rx_peer *peer);

/* Packets */

/* Packet classes, for rx_AllocPacket and rx_packetQuota */
#define	RX_PACKET_CLASS_RECEIVE	    0
#define	RX_PACKET_CLASS_SEND	    1
#define	RX_PACKET_CLASS_SPECIAL	    2
#define	RX_PACKET_CLASS_RECV_CBUF   3
#define	RX_PACKET_CLASS_SEND_CBUF   4

#define	RX_N_PACKET_CLASSES	    5	/* Must agree with above list */

#define	RX_PACKET_TYPES	    {"data", "ack", "busy", "abort", "ackall", "challenge", "response", "debug", "params", "unused", "unused", "unused", "version"}
#define	RX_N_PACKET_TYPES	    13	/* Must agree with above list;
					 * counts 0
					 * WARNING: if this number ever
					 * grows past 13, rxdebug packets
					 * will need to be modified */


/* For most Unixes, maximum elements in an iovec is 16 */
#define RX_MAXIOVECS 16		        /* limit for ReadvProc/WritevProc */
#define RX_MAXWVECS (RX_MAXIOVECS-1)	/* need one iovec for packet header */

/* Debugging */

/* Call flags, states and modes are exposed by the debug interface */
#ifndef KDUMP_RX_LOCK
/* Major call states */
#define	RX_STATE_NOTINIT  0	/* Call structure has never been initialized */
#define	RX_STATE_PRECALL  1	/* Server-only:  call is not in progress, but packets have arrived */
#define	RX_STATE_ACTIVE	  2	/* An active call; a process is dealing with this call */
#define	RX_STATE_DALLY	  3	/* Dallying after process is done with call */
#define	RX_STATE_HOLD	  4	/* Waiting for acks on reply data packets */
#define RX_STATE_RESET    5     /* Call is being reset */

/* Call modes:  the modes of a call in RX_STATE_ACTIVE state (process attached) */
#define	RX_MODE_SENDING	  1	/* Sending or ready to send */
#define	RX_MODE_RECEIVING 2	/* Receiving or ready to receive */
#define	RX_MODE_ERROR	  3	/* Something in error for current conversation */
#define	RX_MODE_EOF	  4	/* Server has flushed (or client has read) last reply packet */

/* Flags */
#define	RX_CALL_READER_WAIT	   1	/* Reader is waiting for next packet */
#define	RX_CALL_WAIT_WINDOW_ALLOC  2	/* Sender is waiting for window to allocate buffers */
#define	RX_CALL_WAIT_WINDOW_SEND   4	/* Sender is waiting for window to send buffers */
#define	RX_CALL_WAIT_PACKETS	   8	/* Sender is waiting for packet buffers */
#define	RX_CALL_WAIT_PROC	  16	/* Waiting for a process to be assigned */
#define	RX_CALL_RECEIVE_DONE	  32	/* All packets received on this call */
#define	RX_CALL_CLEARED		  64	/* Receive queue cleared in precall state */
#define	RX_CALL_TQ_BUSY		 128	/* Call's Xmit Queue is busy; don't modify */
#define	RX_CALL_TQ_CLEARME	 256	/* Need to clear this call's TQ later */
#define RX_CALL_TQ_SOME_ACKED    512	/* rxi_Start needs to discard ack'd packets. */
#define RX_CALL_TQ_WAIT		1024	/* Reader is waiting for TQ_BUSY to be reset */
#define RX_CALL_FAST_RECOVER    2048	/* call is doing congestion recovery */
/* 4096 was RX_CALL_FAST_RECOVER_WAIT */
#define RX_CALL_SLOW_START_OK   8192	/* receiver acks every other packet */
#define RX_CALL_IOVEC_WAIT	16384	/* waiting thread is using an iovec */
#define RX_CALL_HAVE_LAST	32768	/* Last packet has been received */
#define RX_CALL_NEED_START	0x10000	/* tells rxi_Start to start again */
#define RX_CALL_PEER_BUSY	0x20000 /* the last packet we received on this call was a
                                         * BUSY packet; i.e. the channel for this call is busy */
#define RX_CALL_ACKALL_SENT     0x40000 /* ACKALL has been sent on the call */
#define RX_CALL_FLUSH		0x80000 /* Transmit queue should be flushed to peer */
#endif
# 175 "/usr/home/kaduk/openafs/build/include/rx/rx.h"


/* Configurable parameters */
#define	RX_IDLE_DEAD_TIME	60	/* default idle dead time */
#define	RX_MAX_SERVICES		20	/* Maximum number of services that may be installed */
#if defined(KERNEL) && defined(AFS_AIX51_ENV) && defined(__64__)
#define RX_DEFAULT_STACK_SIZE   24000
#else
# 183 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#define	RX_DEFAULT_STACK_SIZE	16000	/* Default process stack size; overriden by rx_SetStackSize */
#endif
# 185 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* This parameter should not normally be changed */
#define	RX_PROCESS_PRIORITY	LWP_NORMAL_PRIORITY

#define ADDRSPERSITE 16

#ifndef KDUMP_RX_LOCK
/* Bottom n-bits of the Call Identifier give the call number */
#define	RX_MAXCALLS 4		/* Power of 2; max async calls per connection */
#define	RX_CIDSHIFT 2		/* Log2(RX_MAXCALLS) */
#define	RX_CHANNELMASK (RX_MAXCALLS-1)
#define	RX_CIDMASK  (~RX_CHANNELMASK)
#endif /* !KDUMP_RX_LOCK */
# 198 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef KERNEL
typedef void (*rx_destructor_t) (void *);
int rx_KeyCreate(rx_destructor_t);
osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
osi_socket rxi_GetUDPSocket(u_short port);
#endif /* KERNEL */
# 205 "/usr/home/kaduk/openafs/build/include/rx/rx.h"


int ntoh_syserr_conv(int error);

#define	RX_WAIT	    1
#define	RX_DONTWAIT 0

#define rx_GetLocalStatus(call, status) ((call)->localStatus)


static_inline int
rx_IsLoopbackAddr(afs_uint32 addr)
{
    return ((addr & 0xffff0000) == 0x7f000000);
}

/*******************
 * Macros callable by the user to further define attributes of a
 * service.  Must be called before rx_StartServer
 */

/* Set the service stack size.  This currently just sets the stack
 * size for all processes to be the maximum seen, so far */
#define rx_SetStackSize(service, stackSize) \
  rx_stackSize = (((stackSize) > rx_stackSize)? stackSize: rx_stackSize)

/* Set minimum number of processes guaranteed to be available for this
 * service at all times */
#define rx_SetMinProcs(service, min) ((service)->minProcs = (min))

/* Set maximum number of processes that will be made available to this
 * service (also a guarantee that this number will be made available
 * if there is no competition) */
#define rx_SetMaxProcs(service, max) ((service)->maxProcs = (max))

/* Define a procedure to be called just before a server connection is destroyed */
#define rx_SetDestroyConnProc(service,proc) ((service)->destroyConnProc = (proc))

/* Define procedure to set service dead time */
#define rx_SetIdleDeadTime(service,time) ((service)->idleDeadTime = (time))

/*
 * Define error to return in server connections when failing to answer.
 * (server only) For example, AFS viced sends VNOSERVICE.
 */
#define rx_SetServerIdleDeadErr(service,err) ((service)->idleDeadErr = (err))

/* Define procedures for getting and setting before and after execute-request procs */
#define rx_SetAfterProc(service,proc) ((service)->afterProc = (proc))
#define rx_SetBeforeProc(service,proc) ((service)->beforeProc = (proc))
#define rx_GetAfterProc(service) ((service)->afterProc)
#define rx_GetBeforeProc(service) ((service)->beforeProc)
#define rx_SetPostProc(service,proc) ((service)->postProc = (proc))
#define rx_GetPostProc(service) ((service)->postProc)

/* Define a procedure to be called when a server connection is created */
#define rx_SetNewConnProc(service, proc) ((service)->newConnProc = (proc))

/* NOTE:  We'll probably redefine the following three routines, again, sometime. */

/* Set the connection dead time for any connections created for this service (server only) */
#define rx_SetServiceDeadTime(service, seconds) ((service)->secondsUntilDead = (seconds))

/* Enable or disable asymmetric client checking for a service */
#define rx_SetCheckReach(service, x) ((service)->checkReach = (x))

/* Set the overload threshold and the overload error */
#define rx_SetBusyThreshold(threshold, code) (rx_BusyThreshold=(threshold),rx_BusyError=(code))

/* If this flag is set,no new requests are processed by rx, all new requests are
returned with an error code of RX_CALL_DEAD ( transient error ) */
#define	rx_SetRxTranquil()   		(rx_tranquil = 1)
#define	rx_ClearRxTranquil()   		(rx_tranquil = 0)

/* Set the threshold and time to delay aborts for consecutive errors */
#define rx_SetCallAbortThreshold(A) (rxi_callAbortThreshhold = (A))
#define rx_SetCallAbortDelay(A) (rxi_callAbortDelay = (A))
#define rx_SetConnAbortThreshold(A) (rxi_connAbortThreshhold = (A))
#define rx_SetConnAbortDelay(A) (rxi_connAbortDelay = (A))



#define cpspace(call) ((call)->curlen)
#define cppos(call) ((call)->curpos)

#define	rx_Read(call, buf, nbytes)   rx_ReadProc(call, buf, nbytes)
#define	rx_Read32(call, value)   rx_ReadProc32(call, value)
#define	rx_Readv(call, iov, nio, maxio, nbytes) \
   rx_ReadvProc(call, iov, nio, maxio, nbytes)
#define	rx_Write(call, buf, nbytes) rx_WriteProc(call, buf, nbytes)
#define	rx_Write32(call, value) rx_WriteProc32(call, value)
#define	rx_Writev(call, iov, nio, nbytes) \
   rx_WritevProc(call, iov, nio, nbytes)

/* This is the maximum size data packet that can be sent on this connection, accounting for security module-specific overheads. */
#define	rx_MaxUserDataSize(call)		((call)->MTU - RX_HEADER_SIZE - (call)->conn->securityHeaderSize - (call)->conn->securityMaxTrailerSize)

/* Macros to turn the hot thread feature on and off. Enabling hot threads
 * allows the listener thread to trade places with an idle worker thread,
 * which moves the context switch from listener to worker out of the
 * critical path.
 */
#define rx_EnableHotThread()		(rx_enable_hot_thread = 1)
#define rx_DisableHotThread()		(rx_enable_hot_thread = 0)

#define rx_PutConnection(conn) rx_DestroyConnection(conn)

/* A service is installed by rx_NewService, and specifies a service type that
 * is exported by this process.  Incoming calls are stamped with the service
 * type, and must match an installed service for the call to be accepted.
 * Each service exported has a (port,serviceId) pair to uniquely identify it.
 * It is also named:  this is intended to allow a remote statistics gathering
 * program to retrieve per service statistics without having to know the local
 * service id's.  Each service has a number of
 */

/* security objects (instances of security classes) which implement
 * various types of end-to-end security protocols for connections made
 * to this service.  Finally, there are two parameters controlling the
 * number of requests which may be executed in parallel by this
 * service: minProcs is the number of requests to this service which
 * are guaranteed to be able to run in parallel at any time; maxProcs
 * has two meanings: it limits the total number of requests which may
 * execute in parallel and it also guarantees that that many requests
 * may be handled in parallel if no other service is handling any
 * requests. */

struct rx_service {
    u_short serviceId;		/* Service number */
    afs_uint32 serviceHost;	/* IP address for this service */
    u_short servicePort;	/* UDP port for this service */
    char *serviceName;		/* Name of the service */
    osi_socket socket;		/* socket structure or file descriptor */
    u_short nRequestsRunning;	/* Number of requests currently in progress */
    u_short nSecurityObjects;	/* Number of entries in security objects array */
    struct rx_securityClass **securityObjects;	/* Array of security class objects */
      afs_int32(*executeRequestProc) (struct rx_call * acall);	/* Routine to call when an rpc request is received */
    void (*destroyConnProc) (struct rx_connection * tcon);	/* Routine to call when a server connection is destroyed */
    void (*newConnProc) (struct rx_connection * tcon);	/* Routine to call when a server connection is created */
    void (*beforeProc) (struct rx_call * acall);	/* routine to call before a call is executed */
    void (*afterProc) (struct rx_call * acall, afs_int32 code);	/* routine to call after a call is executed */
    void (*postProc) (afs_int32 code);	/* routine to call after the call has ended */
    u_short maxProcs;		/* Maximum procs to be used for this service */
    u_short minProcs;		/* Minimum # of requests guaranteed executable simultaneously */
    u_short connDeadTime;	/* Seconds until a client of this service will be declared dead, if it is not responding */
    u_short idleDeadTime;	/* Time a server will wait for I/O to start up again */
    u_char checkReach;		/* Check for asymmetric clients? */
    afs_int32 idleDeadErr;
    int nSpecific;		/* number entries in specific data */
    void **specific;		/* pointer to connection specific data */
#ifdef	RX_ENABLE_LOCKS
    afs_kmutex_t svc_data_lock;	/* protect specific data */
#endif
# 358 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

};

#endif /* KDUMP_RX_LOCK */
# 362 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifndef KDUMP_RX_LOCK
/* Flag bits for connection structure */
#define	RX_CONN_MAKECALL_WAITING    1	/* rx_NewCall is waiting for a channel */
#define	RX_CONN_DESTROY_ME	    2	/* Destroy *client* connection after last call */
#define RX_CONN_USING_PACKET_CKSUM  4	/* non-zero header.spare field seen */
#define RX_CONN_KNOW_WINDOW         8	/* window size negotiation works */
#define RX_CONN_RESET		   16	/* connection is reset, remove */
#define RX_CONN_BUSY               32	/* connection is busy; don't delete */
#define RX_CONN_ATTACHWAIT	   64	/* attach waiting for peer->lastReach */
#define RX_CONN_MAKECALL_ACTIVE   128   /* a thread is actively in rx_NewCall */
#define RX_CONN_NAT_PING          256   /* nat ping requested */

/* Type of connection, client or server */
#define	RX_CLIENT_CONNECTION	0
#define	RX_SERVER_CONNECTION	1
#endif /* !KDUMP_RX_LOCK */
# 379 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

/* Maximum number of acknowledgements in an acknowledge packet */
#define	RX_MAXACKS	    255

#ifndef KDUMP_RX_LOCK

/* The structure of the data portion of an acknowledge packet: An acknowledge
 * packet is in network byte order at all times.  An acknowledgement is always
 * prompted for a specific reason by a specific incoming packet.  This reason
 * is reported in "reason" and the packet's sequence number in the packet
 * header.seq.  In addition to this information, all of the current
 * acknowledgement information about this call is placed in the packet.
 * "FirstPacket" is the sequence number of the first packet represented in an
 * array of bytes, "acks", containing acknowledgement information for a number
 * of consecutive packets.  All packets prior to FirstPacket are implicitly
 * acknowledged: the sender need no longer be concerned about them.  Packets
 * from firstPacket+nAcks and on are not acknowledged.  Packets in the range
 * [firstPacket,firstPacket+nAcks) are each acknowledged explicitly.  The
 * acknowledgement may be RX_NACK if the packet is not (currently) at the
 * receiver (it may have never been received, or received and then later
 * dropped), or it may be RX_ACK if the packet is queued up waiting to be read
 * by the upper level software.  RX_ACK does not imply that the packet may not
 * be dropped before it is read; it does imply that the sender should stop
 * retransmitting the packet until notified otherwise.  The field
 * previousPacket identifies the previous packet received by the peer.  This
 * was used in a previous version of this software, and could be used in the
 * future.  The serial number in the data part of the ack packet corresponds to
 * the serial number oof the packet which prompted the acknowledge.  Any
 * packets which are explicitly not acknowledged, and which were last
 * transmitted with a serial number less than the provided serial number,
 * should be retransmitted immediately.  Actually, this is slightly inaccurate:
 * packets are not necessarily received in order.  When packets are habitually
 * transmitted out of order, this is allowed for in the retransmission
 * algorithm by introducing the notion of maximum packet skew: the degree of
 * out-of-orderness of the packets received on the wire.  This number is
 * communicated from the receiver to the sender in ack packets. */

struct rx_ackPacket {
    u_short bufferSpace;	/* Number of packet buffers available.  That is:  the number of buffers that the sender of the ack packet is willing to provide for data, on this or subsequent calls.  Lying is permissable. */
    u_short maxSkew;		/* Maximum difference between serial# of packet acknowledged and highest packet yet received */
    afs_uint32 firstPacket;	/* The first packet in the list of acknowledged packets */
    afs_uint32 previousPacket;	/* The previous packet number received (obsolete?) */
    afs_uint32 serial;		/* Serial number of the packet which prompted the acknowledge */
    u_char reason;		/* Reason for the acknowledge of ackPacket, defined below */
    u_char nAcks;		/* Number of acknowledgements */
    u_char acks[RX_MAXACKS];	/* Up to RX_MAXACKS packet acknowledgements, defined below */
    /* Packets <firstPacket are implicitly acknowledged and may be discarded by the sender.  Packets >= firstPacket+nAcks are implicitly NOT acknowledged.  No packets with sequence numbers >= firstPacket should be discarded by the sender (they may thrown out at any time by the receiver) */
};

#define FIRSTACKOFFSET 4

/* Reason for acknowledge message */
#define	RX_ACK_REQUESTED	1	/* Peer requested an ack on this packet */
#define	RX_ACK_DUPLICATE	2	/* Duplicate packet */
#define	RX_ACK_OUT_OF_SEQUENCE	3	/* Packet out of sequence */
#define	RX_ACK_EXCEEDS_WINDOW	4	/* Packet sequence number higher than window; discarded */
#define	RX_ACK_NOSPACE		5	/* No buffer space at all */
#define	RX_ACK_PING		6	/* This is a keep-alive ack */
#define	RX_ACK_PING_RESPONSE	7	/* Ack'ing because we were pinged */
#define	RX_ACK_DELAY		8	/* Ack generated since nothing has happened since receiving packet */
#define RX_ACK_IDLE             9	/* Similar to RX_ACK_DELAY, but can
					 * be used to compute RTT */
#define RX_ACK_MTU             -1       /* will be rewritten to ACK_PING */

/* Packet acknowledgement type */
#define	RX_ACK_TYPE_NACK	0	/* I Don't have this packet */
#define	RX_ACK_TYPE_ACK		1	/* I have this packet, although I may discard it later */

/* The packet size transmitted for an acknowledge is adjusted to reflect the actual size of the acks array.  This macro defines the size */
#define rx_AckDataSize(nAcks) (3 + nAcks + offsetof(struct rx_ackPacket, acks[0]))

#define	RX_CHALLENGE_TIMEOUT	2	/* Number of seconds before another authentication request packet is generated */
#define RX_CHALLENGE_MAXTRIES	50	/* Max # of times we resend challenge */
#define	RX_CHECKREACH_TIMEOUT	2	/* Number of seconds before another ping is generated */
#define	RX_CHECKREACH_TTL	60	/* Re-check reachability this often */

/*
 * rx_GetNetworkError 'origin' constants. These define the meaning of the
 * 'type' and 'code' values returned by rx_GetNetworkError.
 */

/* Used for ICMP errors; the type and code are the ICMP type and code,
 * respectively */
#define RX_NETWORK_ERROR_ORIGIN_ICMP (0)

/*
 * RX error codes.  RX uses error codes from -1 to -64 and -100.
 * Rxgen uses other error codes < -64 (see src/rxgen/rpc_errors.h);
 * user programs are expected to return positive error codes
 */

/* Something bad happened to the connection; temporary loss of communication */
#define	RX_CALL_DEAD		    (-1)

/*
 * An invalid operation, such as a client attempting to send data
 * after having received the beginning of a reply from the server.
 */
#define	RX_INVALID_OPERATION	    (-2)

/* An optional timeout per call may be specified */
#define	RX_CALL_TIMEOUT		    (-3)

/* End of data on a read.  Not currently in use. */
#define	RX_EOF			    (-4)

/* Some sort of low-level protocol error. */
#define	RX_PROTOCOL_ERROR	    (-5)

/*
 * Generic user abort code; used when no more specific error code needs to be
 * communicated.  For example, multi rx clients use this code to abort a multi-
 * rx call.
 */
#define	RX_USER_ABORT		    (-6)

/* Port already in use (from rx_Init).  This error is never sent on the wire. */
#define RX_ADDRINUSE		    (-7)

/* EMSGSIZE returned from network.  Packet too big, must fragment */
#define RX_MSGSIZE		    (-8)

/*
 * Idle dead timeout error.  This error is never sent on the wire.
 * rxi_SendCallAbort() translates RX_CALL_IDLE to RX_CALL_TIMEOUT.
 */
#define RX_CALL_IDLE                (-9)

/*
 * Busy call channel error.  This error is never sent on the wire.
 * rxi_SendCallAbort() translates RX_CALL_BUSY to RX_CALL_TIMEOUT.
 */
#define RX_CALL_BUSY                (-10)

/* transient failure detected ( possibly the server is restarting ) */
/* this should be equal to VRESTARTING ( util/errors.h ) for old clients to work */
#define RX_RESTARTING		    (-100)

typedef enum {
    RX_SECIDX_NULL = 0,
    RX_SECIDX_KAD  = 2,
    RX_SECIDX_GK   = 4,
    RX_SECIDX_K5   = 5,
} rx_securityIndex;

struct rx_securityObjectStats {
    char type;			/* 0:unk 1:null,2:vab 3:kad */
    char level;
    char sparec[10];		/* force correct alignment */
    afs_int32 flags;		/* 1=>unalloc, 2=>auth, 4=>expired */
    afs_uint32 expires;
    afs_uint32 packetsReceived;
    afs_uint32 packetsSent;
    afs_uint32 bytesReceived;
    afs_uint32 bytesSent;
    short spares[4];
    afs_int32 sparel[8];
};

/* Configuration settings */

/* Enum for storing configuration variables which can be set via the
 * SetConfiguration method in the rx_securityClass, below
 */

typedef enum {
     RXS_CONFIG_FLAGS /* afs_uint32 set of bitwise flags */
} rx_securityConfigVariables;

/* For the RXS_CONFIG_FLAGS, the following bit values are defined */

/* Disable the principal name contains dot check in rxkad */
#define RXS_CONFIG_FLAGS_DISABLE_DOTCHECK	0x01

/* XXXX (rewrite this description) A security class object contains a set of
 * procedures and some private data to implement a security model for rx
 * connections.  These routines are called by rx as appropriate.  Rx knows
 * nothing about the internal details of any particular security model, or
 * about security state.  Rx does maintain state per connection on behalf of
 * the security class.  Each security class implementation is also expected to
 * provide routines to create these objects.  Rx provides a basic routine to
 * allocate one of these objects; this routine must be called by the class. */
struct rx_securityClass {
    struct rx_securityOps {
	int (*op_Close) (struct rx_securityClass * aobj);
	int (*op_NewConnection) (struct rx_securityClass * aobj,
				 struct rx_connection * aconn);
	int (*op_PreparePacket) (struct rx_securityClass * aobj,
				 struct rx_call * acall,
				 struct rx_packet * apacket);
	int (*op_SendPacket) (struct rx_securityClass * aobj,
			      struct rx_call * acall,
			      struct rx_packet * apacket);
	int (*op_CheckAuthentication) (struct rx_securityClass * aobj,
				       struct rx_connection * aconn);
	int (*op_CreateChallenge) (struct rx_securityClass * aobj,
				   struct rx_connection * aconn);
	int (*op_GetChallenge) (struct rx_securityClass * aobj,
				struct rx_connection * aconn,
				struct rx_packet * apacket);
	int (*op_GetResponse) (struct rx_securityClass * aobj,
			       struct rx_connection * aconn,
			       struct rx_packet * apacket);
	int (*op_CheckResponse) (struct rx_securityClass * aobj,
				 struct rx_connection * aconn,
				 struct rx_packet * apacket);
	int (*op_CheckPacket) (struct rx_securityClass * aobj,
			       struct rx_call * acall,
			       struct rx_packet * apacket);
	int (*op_DestroyConnection) (struct rx_securityClass * aobj,
				     struct rx_connection * aconn);
	int (*op_GetStats) (struct rx_securityClass * aobj,
			    struct rx_connection * aconn,
			    struct rx_securityObjectStats * astats);
	int (*op_SetConfiguration) (struct rx_securityClass * aobj,
				    struct rx_connection * aconn,
				    rx_securityConfigVariables atype,
				    void * avalue,
				    void ** acurrentValue);
	int (*op_Spare2) (void);
	int (*op_Spare3) (void);
    } *ops;
    void *privateData;
    int refCount;
};

#define RXS_OP(obj,op,args) ((obj && (obj->ops->op_ ## op)) ? (*(obj)->ops->op_ ## op)args : 0)

#define RXS_Close(obj) RXS_OP(obj,Close,(obj))
#define RXS_NewConnection(obj,conn) RXS_OP(obj,NewConnection,(obj,conn))
#define RXS_PreparePacket(obj,call,packet) RXS_OP(obj,PreparePacket,(obj,call,packet))
#define RXS_SendPacket(obj,call,packet) RXS_OP(obj,SendPacket,(obj,call,packet))
#define RXS_CheckAuthentication(obj,conn) RXS_OP(obj,CheckAuthentication,(obj,conn))
#define RXS_CreateChallenge(obj,conn) RXS_OP(obj,CreateChallenge,(obj,conn))
#define RXS_GetChallenge(obj,conn,packet) RXS_OP(obj,GetChallenge,(obj,conn,packet))
#define RXS_GetResponse(obj,conn,packet) RXS_OP(obj,GetResponse,(obj,conn,packet))
#define RXS_CheckResponse(obj,conn,packet) RXS_OP(obj,CheckResponse,(obj,conn,packet))
#define RXS_CheckPacket(obj,call,packet) RXS_OP(obj,CheckPacket,(obj,call,packet))
#define RXS_DestroyConnection(obj,conn) RXS_OP(obj,DestroyConnection,(obj,conn))
#define RXS_GetStats(obj,conn,stats) RXS_OP(obj,GetStats,(obj,conn,stats))
#define RXS_SetConfiguration(obj, conn, type, value, currentValue) RXS_OP(obj, SetConfiguration,(obj,conn,type,value,currentValue))



/* Structure for keeping rx statistics.  Note that this structure is returned
 * by rxdebug, so, for compatibility reasons, new fields should be appended (or
 * spares used), the rxdebug protocol checked, if necessary, and the PrintStats
 * code should be updated as well.
 *
 * Clearly we assume that ntohl will work on these structures so sizeof(int)
 * must equal sizeof(afs_int32). */

struct rx_statistics {		/* General rx statistics */
    int packetRequests;		/* Number of packet allocation requests */
    int receivePktAllocFailures;
    int sendPktAllocFailures;
    int specialPktAllocFailures;
    int socketGreedy;		/* Whether SO_GREEDY succeeded */
    int bogusPacketOnRead;	/* Number of inappropriately short packets received */
    int bogusHost;		/* Host address from bogus packets */
    int noPacketOnRead;		/* Number of read packets attempted when there was actually no packet to read off the wire */
    int noPacketBuffersOnRead;	/* Number of dropped data packets due to lack of packet buffers */
    int selects;		/* Number of selects waiting for packet or timeout */
    int sendSelects;		/* Number of selects forced when sending packet */
    int packetsRead[RX_N_PACKET_TYPES];	/* Total number of packets read, per type */
    int dataPacketsRead;	/* Number of unique data packets read off the wire */
    int ackPacketsRead;		/* Number of ack packets read */
    int dupPacketsRead;		/* Number of duplicate data packets read */
    int spuriousPacketsRead;	/* Number of inappropriate data packets */
    int packetsSent[RX_N_PACKET_TYPES];	/* Number of rxi_Sends: packets sent over the wire, per type */
    int ackPacketsSent;		/* Number of acks sent */
    int pingPacketsSent;	/* Total number of ping packets sent */
    int abortPacketsSent;	/* Total number of aborts */
    int busyPacketsSent;	/* Total number of busies sent received */
    int dataPacketsSent;	/* Number of unique data packets sent */
    int dataPacketsReSent;	/* Number of retransmissions */
    int dataPacketsPushed;	/* Number of retransmissions pushed early by a NACK */
    int ignoreAckedPacket;	/* Number of packets with acked flag, on rxi_Start */
    struct clock totalRtt;	/* Total round trip time measured (use to compute average) */
    struct clock minRtt;	/* Minimum round trip time measured */
    struct clock maxRtt;	/* Maximum round trip time measured */
    int nRttSamples;		/* Total number of round trip samples */
    int nServerConns;		/* Total number of server connections */
    int nClientConns;		/* Total number of client connections */
    int nPeerStructs;		/* Total number of peer structures */
    int nCallStructs;		/* Total number of call structures allocated */
    int nFreeCallStructs;	/* Total number of previously allocated free call structures */
    int netSendFailures;
    afs_int32 fatalErrors;
    int ignorePacketDally;	/* packets dropped because call is in dally state */
    int receiveCbufPktAllocFailures;
    int sendCbufPktAllocFailures;
    int nBusies;
    int spares[4];
};

/* structures for debug input and output packets */

/* debug input types */
struct rx_debugIn {
    afs_int32 type;
    afs_int32 index;
};

/* Invalid rx debug package type */
#define RX_DEBUGI_BADTYPE     (-8)

#define RX_DEBUGI_VERSION_MINIMUM ('L')	/* earliest real version */
#define RX_DEBUGI_VERSION     ('S')    /* Latest version */
    /* first version w/ secStats */
#define RX_DEBUGI_VERSION_W_SECSTATS ('L')
    /* version M is first supporting GETALLCONN and RXSTATS type */
#define RX_DEBUGI_VERSION_W_GETALLCONN ('M')
#define RX_DEBUGI_VERSION_W_RXSTATS ('M')
    /* last version with unaligned debugConn */
#define RX_DEBUGI_VERSION_W_UNALIGNED_CONN ('L')
#define RX_DEBUGI_VERSION_W_WAITERS ('N')
#define RX_DEBUGI_VERSION_W_IDLETHREADS ('O')
#define RX_DEBUGI_VERSION_W_NEWPACKETTYPES ('P')
#define RX_DEBUGI_VERSION_W_GETPEER ('Q')
#define RX_DEBUGI_VERSION_W_WAITED ('R')
#define RX_DEBUGI_VERSION_W_PACKETS ('S')

#define	RX_DEBUGI_GETSTATS	1	/* get basic rx stats */
#define	RX_DEBUGI_GETCONN	2	/* get connection info */
#define	RX_DEBUGI_GETALLCONN	3	/* get even uninteresting conns */
#define	RX_DEBUGI_RXSTATS	4	/* get all rx stats */
#define	RX_DEBUGI_GETPEER	5	/* get all peer structs */

struct rx_debugStats {
    afs_int32 nFreePackets;
    afs_int32 packetReclaims;
    afs_int32 callsExecuted;
    char waitingForPackets;
    char usedFDs;
    char version;
    char spare1;
    afs_int32 nWaiting;
    afs_int32 idleThreads;	/* Number of server threads that are idle */
    afs_int32 nWaited;
    afs_int32 nPackets;
    afs_int32 spare2[6];
};

struct rx_debugConn_vL {
    afs_uint32 host;
    afs_int32 cid;
    afs_int32 serial;
    afs_int32 callNumber[RX_MAXCALLS];
    afs_int32 error;
    short port;
    char flags;
    char type;
    char securityIndex;
    char callState[RX_MAXCALLS];
    char callMode[RX_MAXCALLS];
    char callFlags[RX_MAXCALLS];
    char callOther[RX_MAXCALLS];
    /* old style getconn stops here */
    struct rx_securityObjectStats secStats;
    afs_int32 sparel[10];
};

struct rx_debugConn {
    afs_uint32 host;
    afs_int32 cid;
    afs_int32 serial;
    afs_int32 callNumber[RX_MAXCALLS];
    afs_int32 error;
    short port;
    char flags;
    char type;
    char securityIndex;
    char sparec[3];		/* force correct alignment */
    char callState[RX_MAXCALLS];
    char callMode[RX_MAXCALLS];
    char callFlags[RX_MAXCALLS];
    char callOther[RX_MAXCALLS];
    /* old style getconn stops here */
    struct rx_securityObjectStats secStats;
    afs_int32 epoch;
    afs_int32 natMTU;
    afs_int32 sparel[9];
};

struct rx_debugPeer {
    afs_uint32 host;
    u_short port;
    u_short ifMTU;
    afs_uint32 idleWhen;
    short refCount;
    u_char burstSize;
    u_char burst;
    struct clock burstWait;
    afs_int32 rtt;
    afs_int32 rtt_dev;
    struct clock timeout;
    afs_int32 nSent;
    afs_int32 reSends;
    afs_int32 inPacketSkew;
    afs_int32 outPacketSkew;
    afs_int32 rateFlag;
    u_short natMTU;
    u_short maxMTU;
    u_short maxDgramPackets;
    u_short ifDgramPackets;
    u_short MTU;
    u_short cwind;
    u_short nDgramPackets;
    u_short congestSeq;
    afs_hyper_t bytesSent;
    afs_hyper_t bytesReceived;
    afs_int32 sparel[10];
};

#define	RX_OTHER_IN	1	/* packets avail in in queue */
#define	RX_OTHER_OUT	2	/* packets avail in out queue */

#define RX_SERVER_DEBUG_SEC_STATS		0x1
#define RX_SERVER_DEBUG_ALL_CONN		0x2
#define RX_SERVER_DEBUG_RX_STATS		0x4
#define RX_SERVER_DEBUG_WAITER_CNT		0x8
#define RX_SERVER_DEBUG_IDLE_THREADS		0x10
#define RX_SERVER_DEBUG_OLD_CONN		0x20
#define RX_SERVER_DEBUG_NEW_PACKETS		0x40
#define RX_SERVER_DEBUG_ALL_PEER		0x80
#define RX_SERVER_DEBUG_WAITED_CNT              0x100
#define RX_SERVER_DEBUG_PACKETS_CNT              0x200

#define AFS_RX_STATS_CLEAR_ALL			0xffffffff
#define AFS_RX_STATS_CLEAR_INVOCATIONS		0x1
#define AFS_RX_STATS_CLEAR_BYTES_SENT		0x2
#define AFS_RX_STATS_CLEAR_BYTES_RCVD		0x4
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_SUM	0x8
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_SQUARE	0x10
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_MIN	0x20
#define AFS_RX_STATS_CLEAR_QUEUE_TIME_MAX	0x40
#define AFS_RX_STATS_CLEAR_EXEC_TIME_SUM	0x80
#define AFS_RX_STATS_CLEAR_EXEC_TIME_SQUARE	0x100
#define AFS_RX_STATS_CLEAR_EXEC_TIME_MIN	0x200
#define AFS_RX_STATS_CLEAR_EXEC_TIME_MAX	0x400

typedef struct rx_function_entry_v1 {
    afs_uint32 remote_peer;
    afs_uint32 remote_port;
    afs_uint32 remote_is_server;
    afs_uint32 interfaceId;
    afs_uint32 func_total;
    afs_uint32 func_index;
    afs_uint64 invocations;
    afs_uint64 bytes_sent;
    afs_uint64 bytes_rcvd;
    struct clock queue_time_sum;
    struct clock queue_time_sum_sqr;
    struct clock queue_time_min;
    struct clock queue_time_max;
    struct clock execution_time_sum;
    struct clock execution_time_sum_sqr;
    struct clock execution_time_min;
    struct clock execution_time_max;
} rx_function_entry_v1_t, *rx_function_entry_v1_p;

/*
 * If you need to change rx_function_entry, you should probably create a brand
 * new structure.  Keeping the old structure will allow backwards compatibility
 * with old clients (even if it is only used to calculate allocation size).
 * If you do change the size or the format, you'll need to bump
 * RX_STATS_RETRIEVAL_VERSION.  This allows some primitive form
 * of versioning a la rxdebug.
 */

#define RX_STATS_RETRIEVAL_VERSION 1	/* latest version */
#define RX_STATS_RETRIEVAL_FIRST_EDITION 1	/* first implementation */

typedef struct rx_interface_stat {
    struct opr_queue entry;
    struct opr_queue entryPeers;
    rx_function_entry_v1_t stats[1];	/* make sure this is aligned correctly */
} rx_interface_stat_t, *rx_interface_stat_p;

#define RX_STATS_SERVICE_ID 409

#ifdef AFS_NT40_ENV
extern int rx_DumpCalls(FILE *outputFile, char *cookie);
#endif
# 864 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#endif /* _RX_   End of rx.h */
# 866 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

#ifdef	KERNEL
#if 0 /* expanded by -frewrite-includes */
#include "rx/rx_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 869 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#else
# 870 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#if 0 /* expanded by -frewrite-includes */
#include "rx_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 871 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
#endif
# 872 "/usr/home/kaduk/openafs/build/include/rx/rx.h"

static_inline afs_uint32
RPCOpStat_Peer(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_peer;
}

static_inline afs_uint32
RPCOpStat_Port(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_port;
}

static_inline afs_uint32
RPCOpStat_IsServer(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->remote_is_server;
}

static_inline afs_uint32
RPCOpStat_InterfaceId(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->interfaceId;
}

static_inline afs_uint32
RPCOpStat_NumFuncs(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->func_total;
}

static_inline afs_uint32
RPCOpStat_CurFunc(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->func_index;
}

static_inline struct clock *
RPCOpStat_QTimeSum(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_sum);
}

static_inline struct clock *
RPCOpStat_QTimeSumSqr(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_sum_sqr);
}

static_inline struct clock *
RPCOpStat_QTimeSumMin(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_min);
}

static_inline struct clock *
RPCOpStat_QTimeSumMax(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->queue_time_max);
}

static_inline struct clock *
RPCOpStat_ExecTimeSum(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_sum);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumSqr(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_sum_sqr);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumMin(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_min);
}

static_inline struct clock *
RPCOpStat_ExecTimeSumMax(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return &(rpcop_stat->execution_time_max);
}

static_inline afs_uint64
RPCOpStat_NumCalls(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->invocations;
}

static_inline afs_uint64
RPCOpStat_BytesSent(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->bytes_sent;
}

static_inline afs_uint64
RPCOpStat_BytesRcvd(void *blob) {
    rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
    return rpcop_stat->bytes_rcvd;
}
#endif /* !KDUMP_RX_LOCK */
# 975 "/usr/home/kaduk/openafs/build/include/rx/rx.h"
# 61 "/usr/home/kaduk/openafs/build/include/ubik_int.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <rx/rx_globals.h>
#endif /* expanded by -frewrite-includes */
# 62 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#if 0 /* expanded by -frewrite-includes */
#include <afs/rxgen_consts.h>
#endif /* expanded by -frewrite-includes */
# 63 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#endif	/* KERNEL */
# 64 "/usr/home/kaduk/openafs/build/include/ubik_int.h"

#ifdef AFS_NT40_ENV
#ifndef AFS_RXGEN_EXPORT
#define AFS_RXGEN_EXPORT __declspec(dllimport)
#endif /* AFS_RXGEN_EXPORT */
# 69 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#else /* AFS_NT40_ENV */
# 70 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#define AFS_RXGEN_EXPORT
#endif /* AFS_NT40_ENV */
# 72 "/usr/home/kaduk/openafs/build/include/ubik_int.h"


struct BDesc {
	afs_int32 host;
	short portal;
	afs_int32 session;
};
typedef struct BDesc BDesc;
bool_t xdr_BDesc(XDR *xdrs, BDesc *objp);


struct ubik_version {
	afs_int32 epoch;
	afs_int32 counter;
};
typedef struct ubik_version ubik_version;
bool_t xdr_ubik_version(XDR *xdrs, ubik_version *objp);


struct ubik_tid {
	afs_int32 epoch;
	afs_int32 counter;
};
typedef struct ubik_tid ubik_tid;
bool_t xdr_ubik_tid(XDR *xdrs, ubik_tid *objp);

#define UBIK_MAX_INTERFACE_ADDR 256

struct ubik_debug {
	afs_int32 now;
	afs_int32 lastYesTime;
	afs_int32 lastYesHost;
	afs_int32 lastYesState;
	afs_int32 lastYesClaim;
	afs_int32 lowestHost;
	afs_int32 lowestTime;
	afs_int32 syncHost;
	afs_int32 syncTime;
	struct ubik_version syncVersion;
	struct ubik_tid syncTid;
	afs_int32 amSyncSite;
	afs_int32 syncSiteUntil;
	afs_int32 nServers;
	afs_int32 lockedPages;
	afs_int32 writeLockedPages;
	struct ubik_version localVersion;
	afs_int32 activeWrite;
	afs_int32 tidCounter;
	afs_int32 anyReadLocks;
	afs_int32 anyWriteLocks;
	afs_int32 recoveryState;
	afs_int32 currentTrans;
	afs_int32 writeTrans;
	afs_int32 epochTime;
	afs_int32 interfaceAddr[UBIK_MAX_INTERFACE_ADDR];
};
typedef struct ubik_debug ubik_debug;
bool_t xdr_ubik_debug(XDR *xdrs, ubik_debug *objp);


struct ubik_sdebug {
	afs_int32 addr;
	afs_int32 lastVoteTime;
	afs_int32 lastBeaconSent;
	afs_int32 lastVote;
	struct ubik_version remoteVersion;
	afs_int32 currentDB;
	afs_int32 beaconSinceDown;
	afs_int32 up;
	afs_int32 altAddr[255];
};
typedef struct ubik_sdebug ubik_sdebug;
bool_t xdr_ubik_sdebug(XDR *xdrs, ubik_sdebug *objp);


struct ubik_debug_old {
	afs_int32 now;
	afs_int32 lastYesTime;
	afs_int32 lastYesHost;
	afs_int32 lastYesState;
	afs_int32 lastYesClaim;
	afs_int32 lowestHost;
	afs_int32 lowestTime;
	afs_int32 syncHost;
	afs_int32 syncTime;
	struct ubik_version syncVersion;
	struct ubik_tid syncTid;
	afs_int32 amSyncSite;
	afs_int32 syncSiteUntil;
	afs_int32 nServers;
	afs_int32 lockedPages;
	afs_int32 writeLockedPages;
	struct ubik_version localVersion;
	afs_int32 activeWrite;
	afs_int32 tidCounter;
	afs_int32 anyReadLocks;
	afs_int32 anyWriteLocks;
	afs_int32 recoveryState;
	afs_int32 currentTrans;
	afs_int32 writeTrans;
	afs_int32 epochTime;
};
typedef struct ubik_debug_old ubik_debug_old;
bool_t xdr_ubik_debug_old(XDR *xdrs, ubik_debug_old *objp);


struct ubik_sdebug_old {
	afs_int32 addr;
	afs_int32 lastVoteTime;
	afs_int32 lastBeaconSent;
	afs_int32 lastVote;
	struct ubik_version remoteVersion;
	afs_int32 currentDB;
	afs_int32 beaconSinceDown;
	afs_int32 up;
};
typedef struct ubik_sdebug_old ubik_sdebug_old;
bool_t xdr_ubik_sdebug_old(XDR *xdrs, ubik_sdebug_old *objp);


struct UbikInterfaceAddr {
	afs_int32 hostAddr[UBIK_MAX_INTERFACE_ADDR];
};
typedef struct UbikInterfaceAddr UbikInterfaceAddr;
bool_t xdr_UbikInterfaceAddr(XDR *xdrs, UbikInterfaceAddr *objp);

#define BULK_ERROR 1

typedef struct bulkdata {
	u_int bulkdata_len;
	char *bulkdata_val;
} bulkdata;
bool_t xdr_bulkdata(XDR *xdrs, bulkdata *objp);

#define IOVEC_MAXBUF 65536
#define IOVEC_MAXWRT 64

typedef struct iovec_buf {
	u_int iovec_buf_len;
	char *iovec_buf_val;
} iovec_buf;
bool_t xdr_iovec_buf(XDR *xdrs, iovec_buf *objp);


struct ubik_iovec {
	afs_int32 file;
	afs_int32 position;
	afs_int32 length;
};
typedef struct ubik_iovec ubik_iovec;
bool_t xdr_ubik_iovec(XDR *xdrs, ubik_iovec *objp);


typedef struct iovec_wrt {
	u_int iovec_wrt_len;
	ubik_iovec *iovec_wrt_val;
} iovec_wrt;
bool_t xdr_iovec_wrt(XDR *xdrs, iovec_wrt *objp);

#define VOTE_STATINDEX 11

#if 0 /* expanded by -frewrite-includes */
#include <rx/rx_multi.h>
#endif /* expanded by -frewrite-includes */
# 234 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
#define multi_VOTE_Beacon(state, voteStart, Version, tid) \
	multi_Body(StartVOTE_Beacon(multi_call, state, voteStart, Version, tid), EndVOTE_Beacon(multi_call))


extern int StartVOTE_Beacon(
	/*IN */ struct rx_call *z_call,
	/*IN 1*/ afs_int32 state,
	/*IN 1*/ afs_int32 voteStart,
	/*IN 1*/ ubik_version * Version,
	/*IN 1*/ ubik_tid * tid);

extern int EndVOTE_Beacon(
	/*IN */ struct rx_call *z_call);

extern int VOTE_Beacon(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 state,
	/*IN 0*/ afs_int32 voteStart,
	/*IN 0*/ ubik_version * Version,
	/*IN 0*/ ubik_tid * tid);

extern afs_int32 SVOTE_Beacon(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 state,
	/*IN 3*/ afs_int32 voteStart,
	/*IN 3*/ ubik_version * Version,
	/*IN 3*/ ubik_tid * tid);

extern int VOTE_DebugOld(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ ubik_debug_old * db);

extern afs_int32 SVOTE_DebugOld(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ ubik_debug_old * db);

extern int VOTE_SDebugOld(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 which,
	/*OUT*/ ubik_sdebug_old * db);

extern afs_int32 SVOTE_SDebugOld(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 which,
	/*OUT*/ ubik_sdebug_old * db);

extern int VOTE_GetSyncSite(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 * site);

extern afs_int32 SVOTE_GetSyncSite(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 * site);

extern int VOTE_Debug(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ ubik_debug * db);

extern afs_int32 SVOTE_Debug(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ ubik_debug * db);

extern int VOTE_SDebug(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 which,
	/*OUT*/ ubik_sdebug * db);

extern afs_int32 SVOTE_SDebug(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 which,
	/*OUT*/ ubik_sdebug * db);

extern int VOTE_XDebug(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ ubik_debug * db,
	/*OUT*/ afs_int32 * isClone);

extern afs_int32 SVOTE_XDebug(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ ubik_debug * db,
	/*OUT*/ afs_int32 * isClone);

extern int VOTE_XSDebug(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 which,
	/*OUT*/ ubik_sdebug * db,
	/*OUT*/ afs_int32 * isClone);

extern afs_int32 SVOTE_XSDebug(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 which,
	/*OUT*/ ubik_sdebug * db,
	/*OUT*/ afs_int32 * isClone);
#define DISK_STATINDEX 12

extern int DISK_Begin(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ubik_tid * tid);

extern afs_int32 SDISK_Begin(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ubik_tid * tid);

extern int DISK_Commit(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ubik_tid * tid);

extern afs_int32 SDISK_Commit(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ubik_tid * tid);

extern int DISK_Lock(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ubik_tid * tid,
	/*IN 0*/ afs_int32 file,
	/*IN 0*/ afs_int32 position,
	/*IN 0*/ afs_int32 length,
	/*IN 0*/ afs_int32 type);

extern afs_int32 SDISK_Lock(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ubik_tid * tid,
	/*IN 3*/ afs_int32 file,
	/*IN 3*/ afs_int32 position,
	/*IN 3*/ afs_int32 length,
	/*IN 3*/ afs_int32 type);

extern int DISK_Write(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ubik_tid * tid,
	/*IN 0*/ afs_int32 file,
	/*IN 0*/ afs_int32 position,
	/*IN 0*/ bulkdata * data);

extern afs_int32 SDISK_Write(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ubik_tid * tid,
	/*IN 3*/ afs_int32 file,
	/*IN 3*/ afs_int32 position,
	/*IN 3*/ bulkdata * data);

extern int DISK_GetVersion(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ ubik_version * Version);

extern afs_int32 SDISK_GetVersion(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ ubik_version * Version);

extern int StartDISK_GetFile(
	/*IN */ struct rx_call *z_call,
	/*IN 1*/ afs_int32 file);

extern int EndDISK_GetFile(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ ubik_version * Version);

extern afs_int32 SDISK_GetFile(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 file,
	/*OUT*/ ubik_version * Version);

extern int StartDISK_SendFile(
	/*IN */ struct rx_call *z_call,
	/*IN 1*/ afs_int32 file,
	/*IN 1*/ afs_int32 length,
	/*IN 1*/ ubik_version * Version);

extern int EndDISK_SendFile(
	/*IN */ struct rx_call *z_call);

extern afs_int32 SDISK_SendFile(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 file,
	/*IN 3*/ afs_int32 length,
	/*IN 3*/ ubik_version * Version);

extern int DISK_Abort(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ubik_tid * tid);

extern afs_int32 SDISK_Abort(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ubik_tid * tid);

extern int DISK_ReleaseLocks(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ubik_tid * tid);

extern afs_int32 SDISK_ReleaseLocks(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ubik_tid * tid);

extern int DISK_Truncate(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ubik_tid * tid,
	/*IN 0*/ afs_int32 file,
	/*IN 0*/ afs_int32 length);

extern afs_int32 SDISK_Truncate(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ubik_tid * tid,
	/*IN 3*/ afs_int32 file,
	/*IN 3*/ afs_int32 length);

#define multi_DISK_Probe() \
	multi_Body(StartDISK_Probe(multi_call), EndDISK_Probe(multi_call))


extern int StartDISK_Probe(
	/*IN */ struct rx_call *z_call);

extern int EndDISK_Probe(
	/*IN */ struct rx_call *z_call);

extern int DISK_Probe(
	/*IN */ struct rx_connection *z_conn);

extern afs_int32 SDISK_Probe(
	/*IN */ struct rx_call *z_call);

extern int DISK_WriteV(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ubik_tid * tid,
	/*IN 0*/ iovec_wrt * io_vector,
	/*IN 0*/ iovec_buf * io_buffer);

extern afs_int32 SDISK_WriteV(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ubik_tid * tid,
	/*IN 3*/ iovec_wrt * io_vector,
	/*IN 3*/ iovec_buf * io_buffer);

#define multi_DISK_UpdateInterfaceAddr(inAddr, outAddr) \
	multi_Body(StartDISK_UpdateInterfaceAddr(multi_call, inAddr), EndDISK_UpdateInterfaceAddr(multi_call, outAddr))


extern int StartDISK_UpdateInterfaceAddr(
	/*IN */ struct rx_call *z_call,
	/*IN 1*/ UbikInterfaceAddr * inAddr);

extern int EndDISK_UpdateInterfaceAddr(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ UbikInterfaceAddr * outAddr);

extern int DISK_UpdateInterfaceAddr(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ UbikInterfaceAddr * inAddr,
	/*OUT*/ UbikInterfaceAddr * outAddr);

extern afs_int32 SDISK_UpdateInterfaceAddr(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ UbikInterfaceAddr * inAddr,
	/*OUT*/ UbikInterfaceAddr * outAddr);

extern int DISK_SetVersion(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ ubik_tid * tid,
	/*IN 0*/ ubik_version * OldVersion,
	/*IN 0*/ ubik_version * NewVersion);

extern afs_int32 SDISK_SetVersion(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ ubik_tid * tid,
	/*IN 3*/ ubik_version * OldVersion,
	/*IN 3*/ ubik_version * NewVersion);

extern int VOTE_ExecuteRequest(struct rx_call *);

extern int DISK_ExecuteRequest(struct rx_call *);

/* Opcode-related useful stats for package: VOTE_ */
#define VOTE_LOWEST_OPCODE   10000
#define VOTE_HIGHEST_OPCODE     10007
#define VOTE_NUMBER_OPCODES     8

#define opcode_VOTE_Beacon 	((afs_uint64)((12LL << 32) + VOTE_OpCodeIndex(10000)))
#define opcode_VOTE_DebugOld 	((afs_uint64)((12LL << 32) + VOTE_OpCodeIndex(10001)))
#define opcode_VOTE_SDebugOld 	((afs_uint64)((12LL << 32) + VOTE_OpCodeIndex(10002)))
#define opcode_VOTE_GetSyncSite 	((afs_uint64)((12LL << 32) + VOTE_OpCodeIndex(10003)))
#define opcode_VOTE_Debug 	((afs_uint64)((12LL << 32) + VOTE_OpCodeIndex(10004)))
#define opcode_VOTE_SDebug 	((afs_uint64)((12LL << 32) + VOTE_OpCodeIndex(10005)))
#define opcode_VOTE_XDebug 	((afs_uint64)((12LL << 32) + VOTE_OpCodeIndex(10006)))
#define opcode_VOTE_XSDebug 	((afs_uint64)((12LL << 32) + VOTE_OpCodeIndex(10007)))
#define VOTE_NO_OF_STAT_FUNCS	8

AFS_RXGEN_EXPORT
extern const char *VOTE_function_names[];


/* Opcode-related useful stats for package: DISK_ */
#define DISK_LOWEST_OPCODE   20000
#define DISK_HIGHEST_OPCODE     20013
#define DISK_NUMBER_OPCODES     14

#define opcode_DISK_Begin 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20000)))
#define opcode_DISK_Commit 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20001)))
#define opcode_DISK_Lock 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20002)))
#define opcode_DISK_Write 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20003)))
#define opcode_DISK_GetVersion 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20004)))
#define opcode_DISK_GetFile 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20005)))
#define opcode_DISK_SendFile 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20006)))
#define opcode_DISK_Abort 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20007)))
#define opcode_DISK_ReleaseLocks 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20008)))
#define opcode_DISK_Truncate 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20009)))
#define opcode_DISK_Probe 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20010)))
#define opcode_DISK_WriteV 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20011)))
#define opcode_DISK_UpdateInterfaceAddr 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20012)))
#define opcode_DISK_SetVersion 	((afs_uint64)((12LL << 32) + DISK_OpCodeIndex(20013)))
#define DISK_NO_OF_STAT_FUNCS	14

AFS_RXGEN_EXPORT
extern const char *DISK_function_names[];

#endif	/* _RXGEN_UBIK_INT_ */
# 549 "/usr/home/kaduk/openafs/build/include/ubik_int.h"
# 22 "/usr/home/kaduk/openafs/build/include/ubik.h" 2

/*! \name ubik_trans types */
#define	UBIK_READTRANS	    0
#define	UBIK_WRITETRANS	    1
/*\}*/

/*! \name ubik_lock types */
#define	LOCKREAD	    1
#define	LOCKWRITE	    2
#define	LOCKWAIT	    3
/*\}*/

/*! \name ubik client flags */
#define UPUBIKONLY 	    1	/*!< only check servers presumed functional */
#define UBIK_CALL_NEW 	    2	/*!< use the semantics of ubik_Call_New */
/*\}*/

/*! \name RX services types */
#define	VOTE_SERVICE_ID	    50
#define	DISK_SERVICE_ID	    51
#define	USER_SERVICE_ID	    52	/*!< Since most applications use same port! */
/*\}*/

#define	UBIK_MAGIC	0x354545

/*! \name global ubik parameters */
#define	MAXSERVERS	    20	/*!< max number of servers */
/*\}*/

/*! version comparison macro */
#define vcmp(a,b) ((a).epoch == (b).epoch? ((a).counter - (b).counter) : ((a).epoch - (b).epoch))

/*! \name ubik_client state bits */
#define	CFLastFailed	    1	/*!< last call failed to this guy (to detect down hosts) */
/*\}*/

#ifdef AFS_PTHREAD_ENV
#if 0 /* expanded by -frewrite-includes */
#include <pthread.h>
#endif /* expanded by -frewrite-includes */
# 60 "/usr/home/kaduk/openafs/build/include/ubik.h"
#else
# 61 "/usr/home/kaduk/openafs/build/include/ubik.h"
#if 0 /* expanded by -frewrite-includes */
#include <lwp.h>
#endif /* expanded by -frewrite-includes */
# 62 "/usr/home/kaduk/openafs/build/include/ubik.h"
#endif
# 63 "/usr/home/kaduk/openafs/build/include/ubik.h"

/*!
 * \brief per-client structure for ubik
 */
struct ubik_client {
    short initializationState;	/*!< ubik client init state */
    short states[MAXSERVERS];	/*!< state bits */
    struct rx_connection *conns[MAXSERVERS];
    afs_int32 syncSite;
#ifdef AFS_PTHREAD_ENV
    pthread_mutex_t cm;
#endif
# 75 "/usr/home/kaduk/openafs/build/include/ubik.h"
};

#ifdef AFS_PTHREAD_ENV
#define LOCK_UBIK_CLIENT(client) opr_mutex_enter(&client->cm)
#define UNLOCK_UBIK_CLIENT(client) opr_mutex_exit(&client->cm)
#else
# 81 "/usr/home/kaduk/openafs/build/include/ubik.h"
#define LOCK_UBIK_CLIENT(client)
#define UNLOCK_UBIK_CLIENT(client)
#endif
# 84 "/usr/home/kaduk/openafs/build/include/ubik.h"

#define	ubik_GetRPCConn(astr,aindex)	((aindex) >= MAXSERVERS? 0 : (astr)->conns[aindex])
#define	ubik_GetRPCHost(astr,aindex)	((aindex) >= MAXSERVERS? 0 : (astr)->hosts[aindex])

/*!
 * \brief ubik header file structure
 */
struct ubik_hdr {
    afs_int32 magic;		/*!< magic number */
    short pad1;			/*!< some 0-initd padding */
    short size;			/*!< header allocation size */
    struct ubik_version version;	/*!< the version for this file */
};

/*!
 * \brief representation of a ubik transaction
 */
struct ubik_trans {
    struct ubik_dbase *dbase;	/*!< corresponding database */
    struct ubik_trans *next;	/*!< in the list */
    afs_int32 locktype;		/*!< transaction lock */
    struct ubik_trunc *activeTruncs;	/*!< queued truncates */
    struct ubik_tid tid;	/*!< transaction id of this trans (if write trans.) */
    afs_int32 minCommitTime;	/*!< time before which this trans can't commit */
    afs_int32 seekFile;		/*!< seek ptr: file number */
    afs_int32 seekPos;		/*!< seek ptr: offset therein */
    short flags;		/*!< trans flag bits */
    char type;			/*!< type of trans */
    iovec_wrt iovec_info;
    iovec_buf iovec_data;
};

/*!
 * \brief representation of a truncation operation
 */
struct ubik_trunc {
    struct ubik_trunc *next;
    afs_int32 file;		/*!< file to truncate */
    afs_int32 length;		/*!< new size */
};

struct ubik_stat {
    afs_int32 size;
    afs_int32 mtime;
};

#if defined(UKERNEL)
#if 0 /* expanded by -frewrite-includes */
#include "afs/lock.h"
#endif /* expanded by -frewrite-includes */
# 132 "/usr/home/kaduk/openafs/build/include/ubik.h"
#else /* defined(UKERNEL) */
# 133 "/usr/home/kaduk/openafs/build/include/ubik.h"
#if 0 /* expanded by -frewrite-includes */
#include <lock.h>		/* just to make sure we've got this */
#endif /* expanded by -frewrite-includes */
# 134 "/usr/home/kaduk/openafs/build/include/ubik.h"
#endif /* defined(UKERNEL) */
# 135 "/usr/home/kaduk/openafs/build/include/ubik.h"

/*!
 * \brief representation of a ubik database.
 *
 * Contains info on low-level disk access routines
 * for use by disk transaction module.
 */
struct ubik_dbase {
    char *pathName;		/*!< root name for dbase */
    struct ubik_trans *activeTrans;	/*!< active transaction list */
    struct ubik_version version;	/*!< version number */
#ifdef AFS_PTHREAD_ENV
    pthread_mutex_t versionLock;	/*!< lock on version number */
#elif defined(UKERNEL)
# 149 "/usr/home/kaduk/openafs/build/include/ubik.h"
    struct afs_lock versionLock;	/*!< lock on version number */
#else				/* defined(UKERNEL) */
# 151 "/usr/home/kaduk/openafs/build/include/ubik.h"
    struct Lock versionLock;	/*!< lock on version number */
#endif				/* defined(UKERNEL) */
# 153 "/usr/home/kaduk/openafs/build/include/ubik.h"
    afs_int32 tidCounter;	/*!< last RW or RO trans tid counter */
    afs_int32 writeTidCounter;	/*!< last write trans tid counter */
    afs_int32 flags;		/*!< flags */
    /* physio procedures */
    int (*read) (struct ubik_dbase * adbase, afs_int32 afile, void *abuffer,
		 afs_int32 apos, afs_int32 alength);
    int (*write) (struct ubik_dbase * adbase, afs_int32 afile, void *abuffer,
		  afs_int32 apos, afs_int32 alength);
    int (*truncate) (struct ubik_dbase * adbase, afs_int32 afile,
		     afs_int32 asize);
    int (*sync) (struct ubik_dbase * adbase, afs_int32 afile);
    int (*stat) (struct ubik_dbase * adbase, afs_int32 afid,
		 struct ubik_stat * astat);
    void (*open) (struct ubik_dbase * adbase, afs_int32 afid);
    int (*setlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/*!< set the version label */
    int (*getlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/*!< retrieve the version label */
    int (*getnfiles) (struct ubik_dbase * adbase);	/*!< find out number of files */
    short readers;		/*!< number of current read transactions */
    struct ubik_version cachedVersion;	/*!< version of caller's cached data */
#ifdef UKERNEL
    struct afs_lock cache_lock;
#else
# 175 "/usr/home/kaduk/openafs/build/include/ubik.h"
    struct Lock cache_lock; /*!< protects cached application data */
#endif
# 177 "/usr/home/kaduk/openafs/build/include/ubik.h"
#ifdef AFS_PTHREAD_ENV
    pthread_cond_t version_cond;    /*!< condition variable to manage changes to version */
    pthread_cond_t flags_cond;      /*!< condition variable to manage changes to flags */
#endif
# 181 "/usr/home/kaduk/openafs/build/include/ubik.h"
};

/**
 * ubik_CheckCache callback function.
 *
 * @param[in] atrans  ubik transaction
 * @param[in] rock    rock passed to ubik_CheckCache
 *
 * @return operation status
 *   @retval 0        cache was read properly
 */
typedef int (*ubik_updatecache_func) (struct ubik_trans *atrans, void *rock);

/*! \name procedures for automatically authenticating ubik connections */
extern int (*ubik_CRXSecurityProc) (void *, struct rx_securityClass **,
				    afs_int32 *);
extern void *ubik_CRXSecurityRock;
extern int (*ubik_SRXSecurityProc) (void *, struct rx_securityClass **,
				    afs_int32 *);
extern void *ubik_SRXSecurityRock;
extern int (*ubik_CheckRXSecurityProc) (void *, struct rx_call *);
extern void *ubik_CheckRXSecurityRock;

extern void ubik_SetClientSecurityProcs(int (*scproc)(void *,
						      struct rx_securityClass **,
						      afs_int32 *),
					int (*checkproc) (void *),
					void *rock);
extern void ubik_SetServerSecurityProcs
		(void (*buildproc) (void *,
                                    struct rx_securityClass ***,
                                    afs_int32 *),
                 int (*checkproc) (void *, struct rx_call *),
                 void *rock);

/*\}*/

/*
 * For applications that make use of ubik_BeginTransReadAnyWrite, writing
 * processes must not update the application-level cache as they write,
 * or else readers can read the new cache before the data is committed to
 * the db. So, when a commit occurs, the cache must be updated right then.
 * If set, this function will be called during commits of write transactions,
 * to update the application-level cache after a write. This will be called
 * immediately after the local disk commit succeeds, and it will be called
 * with a lock held that prevents other threads from reading from the cache
 * or the db in general.
 *
 * Note that this function MUST be set in order to make use of
 * ubik_BeginTransReadAnyWrite.
 */
extern int (*ubik_SyncWriterCacheProc) (void);

/****************INTERNALS BELOW ****************/

#ifdef UBIK_INTERNALS
/*! \name some ubik parameters */
#define	UBIK_PAGESIZE	    1024	/*!< fits in current r packet */
#define	UBIK_LOGPAGESIZE    10	/*!< base 2 log thereof */
#define	NBUFFERS	    20	/*!< number of 1K buffers */
#define	HDRSIZE		    64	/*!< bytes of header per dbfile */
/*\}*/

/*! \name ubik_dbase flags */
#define	DBWRITING	    1	/*!< are any write trans. in progress */
/*\}*/

/*!\name ubik trans flags */
#define	TRDONE		    1	/*!< commit or abort done */
#define	TRABORT		    2	/*!< if #TRDONE, tells if aborted */
#define TRREADANY	    4	/*!< read any data available in trans */
#define TRCACHELOCKED       32  /*!< this trans has locked dbase->cache_lock
                                 *   (meaning, this trans has called
                                 *   ubik_CheckCache at some point */
#define TRREADWRITE         64  /*!< read even if there's a conflicting ubik-
                                 *   level write lock */
/*\}*/

/*! \name ubik_lock flags */
#define	LWANT		    1
/*\}*/

/*! \name ubik system database numbers */
#define	LOGFILE		    (-1)
/*\}*/

/*! \name define log opcodes */
#define	LOGNEW		    100	/*!< start transaction */
#define	LOGEND		    101	/*!< commit (good) end transaction */
#define	LOGABORT	    102	/*!< abort (fail) transaction */
#define	LOGDATA		    103	/*!< data */
#define	LOGTRUNCATE	    104	/*!< truncate operation */
/*\}*/

/*!
 * \name timer constants
 * time constant for replication algorithms: the R time period is 20 seconds.  Both
 * #SMALLTIME and #BIGTIME must be larger than #RPCTIMEOUT+max(#RPCTIMEOUT, #POLLTIME),
 * so that timeouts do not prevent us from getting through to our servers in time.
 *
 * We use multi-R to time out multiple down hosts concurrently.
 * The only other restrictions:  #BIGTIME > #SMALLTIME and
 * #BIGTIME-#SMALLTIME > #MAXSKEW (the clock skew).
 */
#define MAXSKEW	10
#define POLLTIME 15
#define RPCTIMEOUT 20
#define BIGTIME 75
#define SMALLTIME 60
/*\}*/

/*!
 * \brief the per-server state, used by the sync site to keep track of its charges
 */
struct ubik_server {
    struct ubik_server *next;	/*!< next ptr */
    afs_uint32 addr[UBIK_MAX_INTERFACE_ADDR];	/*!< network order, addr[0] is primary */
    afs_int32 lastVoteTime;	/*!< last time yes vote received */
    afs_int32 lastBeaconSent;	/*!< last time beacon attempted */
    struct ubik_version version;	/*!< version, only used during recovery */
    struct rx_connection *vote_rxcid;	/*!< cid to use to contact dude for votes */
    struct rx_connection *disk_rxcid;	/*!< cid to use to contact dude for disk reqs */
    char lastVote;		/*!< true if last vote was yes */
    char up;			/*!< is it up? */
    char beaconSinceDown;	/*!< did beacon get through since last crash? */
    char currentDB;		/*!< is dbase up-to-date */
    char magic;			/*!< the one whose vote counts twice */
    char isClone;		/*!< is only a clone, doesn't vote */
};

/*! \name hold and release functions on a database */
#ifdef AFS_PTHREAD_ENV
# define	DBHOLD(a)	opr_mutex_enter(&((a)->versionLock))
# define	DBRELE(a)	opr_mutex_exit(&((a)->versionLock))
#else /* !AFS_PTHREAD_ENV */
# 316 "/usr/home/kaduk/openafs/build/include/ubik.h"
# define	DBHOLD(a)	ObtainWriteLock(&((a)->versionLock))
# define	DBRELE(a)	ReleaseWriteLock(&((a)->versionLock))
#endif /* !AFS_PTHREAD_ENV */
# 319 "/usr/home/kaduk/openafs/build/include/ubik.h"
/*\}*/

/* globals */

/*!name list of all servers in the system */
extern struct ubik_server *ubik_servers;
extern char amIClone;
/*\}*/

/*! \name network port info */
extern short ubik_callPortal;
/*\}*/

/*! \name urecovery state bits for sync site */
#define	UBIK_RECSYNCSITE	1	/* am sync site */
#define	UBIK_RECFOUNDDB		2	/* found acceptable dbase from quorum */
#define	UBIK_RECHAVEDB		4	/* fetched best dbase */
#define	UBIK_RECLABELDB		8	/* relabelled dbase */
#define	UBIK_RECSENTDB		0x10	/* sent best db to *everyone* */
#define	UBIK_RECSBETTER		UBIK_RECLABELDB	/* last state */
/*\}*/

extern afs_int32 ubik_quorum;	/* min hosts in quorum */
extern struct ubik_dbase *ubik_dbase;	/* the database handled by this server */
extern afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR];	/* this host addr, in net order */
extern int ubik_amSyncSite;	/* sleep on this waiting to be sync site */
extern struct ubik_stats {	/* random stats */
    afs_int32 escapes;
} ubik_stats;
extern afs_int32 urecovery_state;	/* sync site recovery process state */
extern struct ubik_trans *ubik_currentTrans;	/* current trans */
extern afs_int32 ubik_debugFlag;	/* ubik debug flag */
extern int ubikPrimaryAddrOnly;	/* use only primary address */

/*
 * Lock ordering
 *
 * Any of the locks may be acquired singly; when acquiring multiple locks, they
 * should be acquired in the listed order:
 * 	application cache lock	(dbase->cache_lock)
 * 	database lock		DBHOLD/DBRELE
 * 	beacon lock		UBIK_BEACON_LOCK/UNLOCK
 * 	vote lock		UBIK_VOTE_LOCK/UNLOCK
 * 	version lock		UBIK_VERSION_LOCK/UNLOCK
 * 	server address lock	UBIK_ADDR_LOCK/UNLOCK
 */

/*!
 * \brief Global beacon data.  All values are protected by beacon_lock
 * This lock also protects some values in the ubik_server structures:
 * 	lastVoteTime
 * 	lastBeaconSent
 * 	lastVote
 * 	up
 * 	beaconSinceDown
 */
struct beacon_data {
#ifdef AFS_PTHREAD_ENV
    pthread_mutex_t beacon_lock;
#endif
# 379 "/usr/home/kaduk/openafs/build/include/ubik.h"
    int ubik_amSyncSite;		/*!< flag telling if I'm sync site */
    afs_int32 syncSiteUntil;		/*!< valid only if amSyncSite */
};

#define UBIK_BEACON_LOCK opr_mutex_enter(&beacon_globals.beacon_lock)
#define UBIK_BEACON_UNLOCK opr_mutex_exit(&beacon_globals.beacon_lock)

/*!
 * \brief Global vote data.  All values are protected by vote_lock
 */
struct vote_data {
#ifdef AFS_PTHREAD_ENV
    pthread_mutex_t vote_lock;
#endif
# 393 "/usr/home/kaduk/openafs/build/include/ubik.h"
    struct ubik_version ubik_dbVersion;	/* sync site's dbase version */
    struct ubik_tid ubik_dbTid;		/* sync site's tid, or 0 if none */
    /* Used by all sites in nominating new sync sites */
    afs_int32 ubik_lastYesTime;		/* time we sent the last yes vote */
    afs_uint32 lastYesHost;		/* host to which we sent yes vote */
    /* Next is time sync site began this vote: guarantees sync site until this + SMALLTIME */
    afs_int32 lastYesClaim;
    int lastYesState;			/* did last site we voted for claim to be sync site? */
    /* Used to guarantee that nomination process doesn't loop */
    afs_int32 lowestTime;
    afs_uint32 lowestHost;
    afs_int32 syncTime;
    afs_int32 syncHost;
};

#define UBIK_VOTE_LOCK opr_mutex_enter(&vote_globals.vote_lock)
#define UBIK_VOTE_UNLOCK opr_mutex_exit(&vote_globals.vote_lock)

/*!
 * \brief Server address data.  All values are protected by addr_lock
 *
 * This lock also protects:
 *     ubik_server: addr[], vote_rxcid, disk_rxcid
 *
 */
struct addr_data {
#ifdef AFS_PTHREAD_ENV
    pthread_mutex_t addr_lock;
#endif
# 422 "/usr/home/kaduk/openafs/build/include/ubik.h"
    afs_int32 ubikSecIndex;
    struct rx_securityClass *ubikSecClass;
};

#define UBIK_ADDR_LOCK opr_mutex_enter(&addr_globals.addr_lock)
#define UBIK_ADDR_UNLOCK opr_mutex_exit(&addr_globals.addr_lock)

/*!
 * \brief The version lock protects the structure member, as well as
 * the database version, flags, tidCounter, writeTidCounter
 */
struct version_data {
#ifdef AFS_PTHREAD_ENV
    pthread_mutex_t version_lock;
#endif
# 437 "/usr/home/kaduk/openafs/build/include/ubik.h"
    afs_int32 ubik_epochTime;	/* time when this site started */
};

#define UBIK_VERSION_LOCK opr_mutex_enter(&version_globals.version_lock)
#define UBIK_VERSION_UNLOCK opr_mutex_exit(&version_globals.version_lock)

/* phys.c */
extern int uphys_stat(struct ubik_dbase *adbase, afs_int32 afid,
		      struct ubik_stat *astat);
extern int uphys_read(struct ubik_dbase *adbase, afs_int32 afile,
		      void *abuffer, afs_int32 apos,
		      afs_int32 alength);
extern int uphys_write(struct ubik_dbase *adbase, afs_int32 afile,
		       void *abuffer, afs_int32 apos,
		       afs_int32 alength);
extern int uphys_truncate(struct ubik_dbase *adbase, afs_int32 afile,
			  afs_int32 asize);
extern int uphys_getnfiles(struct ubik_dbase *adbase);
extern int uphys_getlabel(struct ubik_dbase *adbase, afs_int32 afile,
			  struct ubik_version *aversion);
extern int uphys_setlabel(struct ubik_dbase *adbase, afs_int32 afile,
			  struct ubik_version *aversion);
extern int uphys_sync(struct ubik_dbase *adbase, afs_int32 afile);
extern void uphys_invalidate(struct ubik_dbase *adbase,
			     afs_int32 afid);

/*! \name recovery.c */
extern int urecovery_ResetState(void);
extern int urecovery_LostServer(struct ubik_server *server);
extern int urecovery_AllBetter(struct ubik_dbase *adbase,
			       int areadAny);
extern int urecovery_AbortAll(struct ubik_dbase *adbase);
extern int urecovery_CheckTid(struct ubik_tid *atid, int abortalways);
extern int urecovery_Initialize(struct ubik_dbase *adbase);
extern void *urecovery_Interact(void *);
extern int DoProbe(struct ubik_server *server);
/*\}*/

/*! \name ubik.c */
extern afs_int32 ContactQuorum_NoArguments(afs_int32 (*proc)
						       (struct rx_connection *,
							ubik_tid *),
					   struct ubik_trans *atrans,
					   int aflags);

extern afs_int32 ContactQuorum_DISK_Lock(struct ubik_trans *atrans,
					 int aflags,
					 afs_int32 file, afs_int32 position,
					 afs_int32 length, afs_int32 type);

extern afs_int32 ContactQuorum_DISK_Write(struct ubik_trans *atrans,
					  int aflags,
					  afs_int32 file, afs_int32 position,
					  bulkdata *data);

extern afs_int32 ContactQuorum_DISK_Truncate(struct ubik_trans *atrans,
					     int aflags,
					     afs_int32 file, afs_int32 length);

extern afs_int32 ContactQuorum_DISK_WriteV(struct ubik_trans *atrans,
					   int aflags,
					   iovec_wrt * io_vector,
					   iovec_buf *io_buffer);

extern afs_int32 ContactQuorum_DISK_SetVersion(struct ubik_trans *atrans,
					       int aflags,
					       ubik_version *OldVersion,
					       ubik_version *NewVersion);

extern void panic(char *format, ...)
    AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);

extern afs_uint32 ubikGetPrimaryInterfaceAddr(afs_uint32 addr);

extern int ubik_CheckAuth(struct rx_call *);

/*\}*/

/*! \name beacon.c */
struct afsconf_cell;
extern void ubeacon_InitSecurityClass(void);
extern void ubeacon_ReinitServer(struct ubik_server *ts);
extern void ubeacon_Debug(struct ubik_debug *aparm);
extern int ubeacon_AmSyncSite(void);
extern int ubeacon_InitServerListByInfo(afs_uint32 ame,
					struct afsconf_cell *info,
					char clones[]);
extern int ubeacon_InitServerList(afs_uint32 ame, afs_uint32 aservers[]);
extern void *ubeacon_Interact(void *);
extern int ubeacon_updateUbikNetworkAddress(afs_uint32 ubik_host[]);
extern struct beacon_data beacon_globals;
extern struct addr_data addr_globals;

/*\}*/

/*! \name disk.c */
extern int udisk_Init(int nBUffers);
extern void udisk_Debug(struct ubik_debug *aparm);
extern int udisk_Invalidate(struct ubik_dbase *adbase, afs_int32 afid);
extern int udisk_read(struct ubik_trans *atrans, afs_int32 afile,
		      void *abuffer, afs_int32 apos, afs_int32 alen);
extern int udisk_truncate(struct ubik_trans *atrans, afs_int32 afile,
			  afs_int32 alength);
extern int udisk_write(struct ubik_trans *atrans, afs_int32 afile,
		       void *abuffer, afs_int32 apos, afs_int32 alen);
extern int udisk_begin(struct ubik_dbase *adbase, int atype,
		       struct ubik_trans **atrans);
extern int udisk_commit(struct ubik_trans *atrans);
extern int udisk_abort(struct ubik_trans *atrans);
extern int udisk_end(struct ubik_trans *atrans);
/*\}*/

/*! \name lock.c */
extern void ulock_Init(void);
extern int  ulock_getLock(struct ubik_trans *atrans, int atype, int await);
extern void ulock_relLock(struct ubik_trans *atrans);
extern void ulock_Debug(struct ubik_debug *aparm);
/*\}*/

/*! \name vote.c */
extern int uvote_ShouldIRun(void);
extern afs_int32 uvote_GetSyncSite(void);
extern int uvote_Init(void);
extern void ubik_vprint(const char *format, va_list ap)
    AFS_ATTRIBUTE_FORMAT(__printf__, 1, 0);

extern void ubik_print(const char *format, ...)
    AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);

extern void ubik_dprint(const char *format, ...)
    AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);

extern void ubik_dprint_25(const char *format, ...)
    AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
extern struct vote_data vote_globals;
extern void uvote_set_dbVersion(struct ubik_version);
extern int uvote_eq_dbVersion(struct ubik_version);
extern int uvote_HaveSyncAndVersion(struct ubik_version);
/*\}*/

#endif /* UBIK_INTERNALS */
# 578 "/usr/home/kaduk/openafs/build/include/ubik.h"

extern afs_int32 ubik_nBuffers;

/*!
 * \name Public function prototypes
 */

/*! \name ubik.c */
struct afsconf_cell;
extern int ubik_ServerInitByInfo(afs_uint32 myHost, short myPort,
				 struct afsconf_cell *info, char clones[],
				 const char *pathName,
				 struct ubik_dbase **dbase);
extern int ubik_ServerInit(afs_uint32 myHost, short myPort,
			   afs_uint32 serverList[],
			   const char *pathName, struct ubik_dbase **dbase);
extern int ubik_BeginTrans(struct ubik_dbase *dbase,
			   afs_int32 transMode, struct ubik_trans **transPtr);
extern int ubik_BeginTransReadAny(struct ubik_dbase *dbase,
				  afs_int32 transMode,
				  struct ubik_trans **transPtr);
extern int ubik_BeginTransReadAnyWrite(struct ubik_dbase *dbase,
                                       afs_int32 transMode,
                                       struct ubik_trans **transPtr);
extern int ubik_AbortTrans(struct ubik_trans *transPtr);

extern int ubik_EndTrans(struct ubik_trans *transPtr);
extern int ubik_Read(struct ubik_trans *transPtr, void *buffer,
		     afs_int32 length);
extern int ubik_Flush(struct ubik_trans *transPtr);
extern int ubik_Write(struct ubik_trans *transPtr, void *buffer,
		      afs_int32 length);
extern int ubik_Seek(struct ubik_trans *transPtr, afs_int32 fileid,
		     afs_int32 position);
extern int ubik_Tell(struct ubik_trans *transPtr, afs_int32 * fileid,
		     afs_int32 * position);
extern int ubik_Truncate(struct ubik_trans *transPtr,
			 afs_int32 length);
extern int ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos,
			afs_int32 alen, int atype);
extern int ubik_WaitVersion(struct ubik_dbase *adatabase,
			    struct ubik_version *aversion);
extern int ubik_GetVersion(struct ubik_trans *atrans,
			   struct ubik_version *avers);
extern int ubik_CheckCache(struct ubik_trans *atrans,
                           ubik_updatecache_func check,
                           void *rock);
extern struct version_data version_globals;
/*\}*/

/*! \name ubikclient.c */

extern int ubik_ParseClientList(int argc, char **argv, afs_uint32 * aothers);
extern unsigned int afs_random(void);
extern int ubik_ClientInit(struct rx_connection **serverconns,
			   struct ubik_client **aclient);
extern afs_int32 ubik_ClientDestroy(struct ubik_client *aclient);
extern struct rx_connection *ubik_RefreshConn(struct rx_connection *tc);
#ifdef UBIK_LEGACY_CALLITER
extern afs_int32 ubik_CallIter(int (*aproc) (), struct ubik_client *aclient,
			       afs_int32 aflags, int *apos, long p1, long p2,
			       long p3, long p4, long p5, long p6, long p7,
			       long p8, long p9, long p10, long p11, long p12,
			       long p13, long p14, long p15, long p16);
extern afs_int32 ubik_Call_New(int (*aproc) (), struct ubik_client
			       *aclient, afs_int32 aflags, long p1, long p2,
			       long p3, long p4, long p5, long p6, long p7,
			       long p8, long p9, long p10, long p11, long p12,
			       long p13, long p14, long p15, long p16);
#endif
# 648 "/usr/home/kaduk/openafs/build/include/ubik.h"
/*\}*/

/* \name ubikcmd.c */
extern int ubik_ParseServerList(int argc, char **argv, afs_uint32 *ahost,
				afs_uint32 *aothers);
/*\}*/

/* \name uinit.c */

struct rx_securityClass;
struct afsconf_dir;
extern int ugen_ClientInitCell(struct afsconf_dir *dir,
			       struct afsconf_cell *info,
			       int secFlags,
			       struct ubik_client **uclientp,
			       int maxservers, const char *serviceid,
			       int deadtime);
extern int ugen_ClientInitServer(const char *confDir, char *cellName,
				 int secFlags, struct ubik_client **uclientp,
				 int maxservers, char *serviceid,
				 int deadtime, afs_uint32 server,
			         afs_uint32 port);
extern int ugen_ClientInitFlags(const char *confDir, char *cellName,
				int secFlags, struct ubik_client **uclientp,
				int (*secproc) (struct rx_securityClass *,
						afs_int32),
				int maxservers, char *serviceid,
				int deadtime);
extern afs_int32 ugen_ClientInit(int noAuthFlag, const char *confDir,
				 char *cellName, afs_int32 sauth,
				 struct ubik_client **uclientp,
				 int (*secproc) (struct rx_securityClass *sc,
					 	 afs_int32 scIndex),
				 char *funcName,
				 afs_int32 gen_rxkad_level,
				 afs_int32 maxservers, char *serviceid,
				 afs_int32 deadtime, afs_uint32 server,
				 afs_uint32 port, afs_int32 usrvid);

#endif /* UBIK_H */
# 688 "/usr/home/kaduk/openafs/build/include/ubik.h"

/* End of prolog file ../../../openafs/src/ubik/ubik.p.h. */

#define UNOQUORUM                                (5376L)
#define UNOTSYNC                                 (5377L)
#define UNHOSTS                                  (5378L)
#define UIOERROR                                 (5379L)
#define UINTERNAL                                (5380L)
#define USYNC                                    (5381L)
#define UNOENT                                   (5382L)
#define UBADLOCK                                 (5383L)
#define UBADLOG                                  (5384L)
#define UBADHOST                                 (5385L)
#define UBADTYPE                                 (5386L)
#define UTWOENDS                                 (5387L)
#define UDONE                                    (5388L)
#define UNOSERVERS                               (5389L)
#define UEOF                                     (5390L)
#define ULOGIO                                   (5391L)
#define UBADFAM                                  (5392L)
#define UBADCELL                                 (5393L)
#define UBADSECGRP                               (5394L)
#define UBADGROUP                                (5395L)
#define UBADUUID                                 (5396L)
#define UNOMEM                                   (5397L)
#define UNOTMEMBER                               (5398L)
#define UNBINDINGS                               (5399L)
#define UBADPRINNAME                             (5400L)
#define UPIPE                                    (5401L)
#define UDEADLOCK                                (5402L)
#define UEXCEPTION                               (5403L)
#define UTPQFAIL                                 (5404L)
#define USKEWED                                  (5405L)
#define UNOLOCK                                  (5406L)
#define UNOACCESS                                (5407L)
#define UNOSPC                                   (5408L)
#define UBADPATH                                 (5409L)
#define UBADF                                    (5410L)
#define UREINITIALIZE                            (5411L)
#define UMUTEXINIT                               (5412L)
#define UMUTEXDESTROY                            (5413L)
extern void initialize_U_error_table(void);
#define ERROR_TABLE_BASE_U (5376L)

/* for compatibility with older versions... */
#define init_U_err_tbl initialize_U_error_table
#define U_err_base ERROR_TABLE_BASE_U

/* for compatibility with other users... */
#define ERROR_TABLE_BASE_u (5376L)
#define init_u_err_tbl initialize_U_error_table
#define initialize_u_error_table initialize_U_error_table
#define u_err_base ERROR_TABLE_BASE_u
# 65 "/usr/home/kaduk/openafs/build/include/afs/ptint.h" 2
#endif	/* KERNEL */
# 66 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"

#ifdef AFS_NT40_ENV
#ifndef AFS_RXGEN_EXPORT
#define AFS_RXGEN_EXPORT __declspec(dllimport)
#endif /* AFS_RXGEN_EXPORT */
# 71 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#else /* AFS_NT40_ENV */
# 72 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#define AFS_RXGEN_EXPORT
#endif /* AFS_NT40_ENV */
# 74 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"

#define PR_STATINDEX 8
#define PRSUCCESS 0
#define PR_MAXNAMELEN 64
#define PR_MAXGROUPS 5000
#define PR_MAXLIST 5000
#define PRSIZE 10
#define COSIZE 39

struct prdebugentry {
	afs_int32 flags;
	afs_int32 id;
	afs_int32 cellid;
	afs_int32 next;
	afs_int32 reserved[5];
	afs_int32 entries[PRSIZE];
	afs_int32 nextID;
	afs_int32 nextname;
	afs_int32 owner;
	afs_int32 creator;
	afs_int32 ngroups;
	afs_int32 nusers;
	afs_int32 count;
	afs_int32 instance;
	afs_int32 owned;
	afs_int32 nextOwned;
	afs_int32 parent;
	afs_int32 sibling;
	afs_int32 child;
	char name[PR_MAXNAMELEN];
};
typedef struct prdebugentry prdebugentry;
bool_t xdr_prdebugentry(XDR *xdrs, prdebugentry *objp);


struct prcheckentry {
	afs_int32 flags;
	afs_int32 id;
	afs_int32 owner;
	afs_int32 creator;
	afs_int32 ngroups;
	afs_int32 nusers;
	afs_int32 count;
	afs_int32 reserved[5];
	char name[PR_MAXNAMELEN];
};
typedef struct prcheckentry prcheckentry;
bool_t xdr_prcheckentry(XDR *xdrs, prcheckentry *objp);


struct prlistentries {
	afs_int32 flags;
	afs_int32 id;
	afs_int32 owner;
	afs_int32 creator;
	afs_int32 ngroups;
	afs_int32 nusers;
	afs_int32 count;
	afs_int32 reserved[5];
	char name[PR_MAXNAMELEN];
};
typedef struct prlistentries prlistentries;
bool_t xdr_prlistentries(XDR *xdrs, prlistentries *objp);


struct PrUpdateEntry {
	afs_uint32 Mask;
	afs_int32 flags;
	afs_int32 id;
	afs_int32 owner;
	afs_int32 creator;
	afs_int32 ngroups;
	afs_int32 nusers;
	afs_int32 count;
	afs_int32 reserved[5];
	char name[PR_MAXNAMELEN];
};
typedef struct PrUpdateEntry PrUpdateEntry;
bool_t xdr_PrUpdateEntry(XDR *xdrs, PrUpdateEntry *objp);

#define PRUPDATE_NAME 0x0001
#define PRUPDATE_ID 0x0002
#define PRUPDATE_FLAGS 0x0004
#define PRUPDATE_NAMEHASH 0x0008
#define PRUPDATE_IDHASH 0x0010
#define PR_SF_ALLBITS 0xff /* set all access bits */
#define PR_SF_NGROUPS (1u<<31) /* set field limiting group creation */
#define PR_SF_NUSERS (1u<<30) /*  "  "  foreign users  "  */

typedef char prname[PR_MAXNAMELEN];
bool_t xdr_prname(XDR *xdrs, prname *objp);


typedef struct namelist {
	u_int namelist_len;
	prname *namelist_val;
} namelist;
bool_t xdr_namelist(XDR *xdrs, namelist *objp);


typedef struct idlist {
	u_int idlist_len;
	afs_int32 *idlist_val;
} idlist;
bool_t xdr_idlist(XDR *xdrs, idlist *objp);


typedef struct prlist {
	u_int prlist_len;
	afs_int32 *prlist_val;
} prlist;
bool_t xdr_prlist(XDR *xdrs, prlist *objp);


typedef struct prentries {
	u_int prentries_len;
	prlistentries *prentries_val;
} prentries;
bool_t xdr_prentries(XDR *xdrs, prentries *objp);


extern int PR_INewEntry(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ const char * name,
	/*IN 0*/ afs_int32 id,
	/*IN 0*/ afs_int32 oid);

extern int ubik_PR_INewEntry(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ const char * name,
	/*IN 2*/ afs_int32 id,
	/*IN 2*/ afs_int32 oid);

extern afs_int32 SPR_INewEntry(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ char * name,
	/*IN 3*/ afs_int32 id,
	/*IN 3*/ afs_int32 oid);

extern int PR_WhereIsIt(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*OUT*/ afs_int32 * ps);

extern int ubik_PR_WhereIsIt(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*OUT*/ afs_int32 * ps);

extern afs_int32 SPR_WhereIsIt(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*OUT*/ afs_int32 * ps);

extern int PR_DumpEntry(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 pos,
	/*OUT*/ struct prdebugentry * entry);

extern int ubik_PR_DumpEntry(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 pos,
	/*OUT*/ struct prdebugentry * entry);

extern afs_int32 SPR_DumpEntry(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 pos,
	/*OUT*/ struct prdebugentry * entry);

extern int PR_AddToGroup(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 uid,
	/*IN 0*/ afs_int32 gid);

extern int ubik_PR_AddToGroup(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 uid,
	/*IN 2*/ afs_int32 gid);

extern afs_int32 SPR_AddToGroup(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 uid,
	/*IN 3*/ afs_int32 gid);

extern int PR_NameToID(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ namelist * nlist,
	/*OUT*/ idlist * ilist);

extern int ubik_PR_NameToID(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ namelist * nlist,
	/*OUT*/ idlist * ilist);

extern afs_int32 SPR_NameToID(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ namelist * nlist,
	/*OUT*/ idlist * ilist);

extern int PR_IDToName(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ idlist * ilist,
	/*OUT*/ namelist * nlist);

extern int ubik_PR_IDToName(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ idlist * ilist,
	/*OUT*/ namelist * nlist);

extern afs_int32 SPR_IDToName(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ idlist * ilist,
	/*OUT*/ namelist * nlist);

extern int PR_Delete(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id);

extern int ubik_PR_Delete(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id);

extern afs_int32 SPR_Delete(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id);

extern int PR_RemoveFromGroup(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*IN 0*/ afs_int32 gid);

extern int ubik_PR_RemoveFromGroup(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*IN 2*/ afs_int32 gid);

extern afs_int32 SPR_RemoveFromGroup(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*IN 3*/ afs_int32 gid);

extern int PR_GetCPS(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern int ubik_PR_GetCPS(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern afs_int32 SPR_GetCPS(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern int PR_NewEntry(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ const char * name,
	/*IN 0*/ afs_int32 flag,
	/*IN 0*/ afs_int32 oid,
	/*OUT*/ afs_int32 * id);

extern int ubik_PR_NewEntry(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ const char * name,
	/*IN 2*/ afs_int32 flag,
	/*IN 2*/ afs_int32 oid,
	/*OUT*/ afs_int32 * id);

extern afs_int32 SPR_NewEntry(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ char * name,
	/*IN 3*/ afs_int32 flag,
	/*IN 3*/ afs_int32 oid,
	/*OUT*/ afs_int32 * id);

extern int PR_ListMax(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ afs_int32 * uid,
	/*OUT*/ afs_int32 * gid);

extern int ubik_PR_ListMax(
	struct ubik_client *aclient, afs_int32 aflags,
	/*OUT*/ afs_int32 * uid,
	/*OUT*/ afs_int32 * gid);

extern afs_int32 SPR_ListMax(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ afs_int32 * uid,
	/*OUT*/ afs_int32 * gid);

extern int PR_SetMax(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*IN 0*/ afs_int32 gflag);

extern int ubik_PR_SetMax(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*IN 2*/ afs_int32 gflag);

extern afs_int32 SPR_SetMax(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*IN 3*/ afs_int32 gflag);

extern int PR_ListEntry(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*OUT*/ struct prcheckentry * entry);

extern int ubik_PR_ListEntry(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*OUT*/ struct prcheckentry * entry);

extern afs_int32 SPR_ListEntry(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*OUT*/ struct prcheckentry * entry);

extern int PR_ChangeEntry(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*IN 0*/ const char * name,
	/*IN 0*/ afs_int32 oid,
	/*IN 0*/ afs_int32 newid);

extern int ubik_PR_ChangeEntry(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*IN 2*/ const char * name,
	/*IN 2*/ afs_int32 oid,
	/*IN 2*/ afs_int32 newid);

extern afs_int32 SPR_ChangeEntry(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*IN 3*/ char * name,
	/*IN 3*/ afs_int32 oid,
	/*IN 3*/ afs_int32 newid);

extern int PR_ListElements(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern int ubik_PR_ListElements(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern afs_int32 SPR_ListElements(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern int PR_IsAMemberOf(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 uid,
	/*IN 0*/ afs_int32 gid,
	/*OUT*/ afs_int32 * flag);

extern int ubik_PR_IsAMemberOf(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 uid,
	/*IN 2*/ afs_int32 gid,
	/*OUT*/ afs_int32 * flag);

extern afs_int32 SPR_IsAMemberOf(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 uid,
	/*IN 3*/ afs_int32 gid,
	/*OUT*/ afs_int32 * flag);

extern int PR_SetFieldsEntry(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*IN 0*/ afs_int32 mask,
	/*IN 0*/ afs_int32 flags,
	/*IN 0*/ afs_int32 ngroups,
	/*IN 0*/ afs_int32 nusers,
	/*IN 0*/ afs_int32 spare1,
	/*IN 0*/ afs_int32 spare2);

extern int ubik_PR_SetFieldsEntry(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*IN 2*/ afs_int32 mask,
	/*IN 2*/ afs_int32 flags,
	/*IN 2*/ afs_int32 ngroups,
	/*IN 2*/ afs_int32 nusers,
	/*IN 2*/ afs_int32 spare1,
	/*IN 2*/ afs_int32 spare2);

extern afs_int32 SPR_SetFieldsEntry(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*IN 3*/ afs_int32 mask,
	/*IN 3*/ afs_int32 flags,
	/*IN 3*/ afs_int32 ngroups,
	/*IN 3*/ afs_int32 nusers,
	/*IN 3*/ afs_int32 spare1,
	/*IN 3*/ afs_int32 spare2);

extern int PR_ListOwned(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*I/O*/ afs_int32 * lastp);

extern int ubik_PR_ListOwned(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*I/O*/ afs_int32 * lastp);

extern afs_int32 SPR_ListOwned(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*I/O*/ afs_int32 * lastp);

extern int PR_GetCPS2(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*IN 0*/ afs_int32 host,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern int ubik_PR_GetCPS2(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*IN 2*/ afs_int32 host,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern afs_int32 SPR_GetCPS2(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*IN 3*/ afs_int32 host,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern int PR_GetHostCPS(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 host,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern int ubik_PR_GetHostCPS(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 host,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern afs_int32 SPR_GetHostCPS(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 host,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern int PR_UpdateEntry(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*IN 0*/ const char * name,
	/*IN 0*/ PrUpdateEntry * uentry);

extern int ubik_PR_UpdateEntry(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*IN 2*/ const char * name,
	/*IN 2*/ PrUpdateEntry * uentry);

extern afs_int32 SPR_UpdateEntry(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*IN 3*/ char * name,
	/*IN 3*/ PrUpdateEntry * uentry);

extern int PR_ListEntries(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 flags,
	/*IN 0*/ afs_int32 startindex,
	/*OUT*/ prentries * bulkentries,
	/*OUT*/ afs_int32 * nextstartindex);

extern int ubik_PR_ListEntries(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 flags,
	/*IN 2*/ afs_int32 startindex,
	/*OUT*/ prentries * bulkentries,
	/*OUT*/ afs_int32 * nextstartindex);

extern afs_int32 SPR_ListEntries(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 flags,
	/*IN 3*/ afs_int32 startindex,
	/*OUT*/ prentries * bulkentries,
	/*OUT*/ afs_int32 * nextstartindex);

extern int PR_ListSuperGroups(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern int ubik_PR_ListSuperGroups(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);

extern afs_int32 SPR_ListSuperGroups(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int32 id,
	/*OUT*/ prlist * elist,
	/*OUT*/ afs_int32 * over);
#define ANONYMOUSID 32766

typedef struct nidlist {
	u_int nidlist_len;
	afs_int64 *nidlist_val;
} nidlist;
bool_t xdr_nidlist(XDR *xdrs, nidlist *objp);

#define AUTHDATAMAX 2048
#define AUTHPRINTABLEMAX 2048

struct PRAuthName {
	afs_int32 kind;
	struct data {
		u_int data_len;
		char *data_val;
	} data;
	struct display {
		u_int display_len;
		char *display_val;
	} display;
};
typedef struct PRAuthName PRAuthName;
bool_t xdr_PRAuthName(XDR *xdrs, PRAuthName *objp);


typedef struct authnamelist {
	u_int authnamelist_len;
	PRAuthName *authnamelist_val;
} authnamelist;
bool_t xdr_authnamelist(XDR *xdrs, authnamelist *objp);

#define PRAUTHTYPE_KRB4 1
#define PRAUTHTYPE_GSS 2
#define PTSCAPABILITIESMAX 196

typedef struct PrCapabilities {
	u_int PrCapabilities_len;
	afs_uint32 *PrCapabilities_val;
} PrCapabilities;
bool_t xdr_PrCapabilities(XDR *xdrs, PrCapabilities *objp);

#define PTS_CAPABILITY_AUTHNAMEMAPPING 1

#if 0 /* expanded by -frewrite-includes */
#include <rx/rx_multi.h>
#endif /* expanded by -frewrite-includes */
# 644 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
#define multi_PR_GetCapabilities(prcapabilities) \
	multi_Body(StartPR_GetCapabilities(multi_call), EndPR_GetCapabilities(multi_call, prcapabilities))


extern int StartPR_GetCapabilities(
	/*IN */ struct rx_call *z_call);

extern int EndPR_GetCapabilities(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ PrCapabilities * prcapabilities);

extern int PR_GetCapabilities(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ PrCapabilities * prcapabilities);

extern int ubik_PR_GetCapabilities(
	struct ubik_client *aclient, afs_int32 aflags,
	/*OUT*/ PrCapabilities * prcapabilities);

extern afs_int32 SPR_GetCapabilities(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ PrCapabilities * prcapabilities);

extern int PR_AuthNameToID(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ authnamelist * alist,
	/*OUT*/ nidlist * ilist);

extern int ubik_PR_AuthNameToID(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ authnamelist * alist,
	/*OUT*/ nidlist * ilist);

extern afs_int32 SPR_AuthNameToID(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ authnamelist * alist,
	/*OUT*/ nidlist * ilist);

extern int PR_AuthNameToIDFallback(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ authnamelist * alist,
	/*OUT*/ nidlist * ilist);

extern int ubik_PR_AuthNameToIDFallback(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ authnamelist * alist,
	/*OUT*/ nidlist * ilist);

extern afs_int32 SPR_AuthNameToIDFallback(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ authnamelist * alist,
	/*OUT*/ nidlist * ilist);

extern int PR_ListAuthNames(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int64 id,
	/*OUT*/ authnamelist * alist);

extern int ubik_PR_ListAuthNames(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int64 id,
	/*OUT*/ authnamelist * alist);

extern afs_int32 SPR_ListAuthNames(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int64 id,
	/*OUT*/ authnamelist * alist);

extern int PR_WhoAmI(
	/*IN */ struct rx_connection *z_conn,
	/*OUT*/ afs_int64 * id,
	/*OUT*/ struct PRAuthName * alist);

extern int ubik_PR_WhoAmI(
	struct ubik_client *aclient, afs_int32 aflags,
	/*OUT*/ afs_int64 * id,
	/*OUT*/ struct PRAuthName * alist);

extern afs_int32 SPR_WhoAmI(
	/*IN */ struct rx_call *z_call,
	/*OUT*/ afs_int64 * id,
	/*OUT*/ struct PRAuthName * alist);

extern int PR_AddAuthName(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ afs_int64 id,
	/*IN 0*/ PRAuthName * aname);

extern int ubik_PR_AddAuthName(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ afs_int64 id,
	/*IN 2*/ PRAuthName * aname);

extern afs_int32 SPR_AddAuthName(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ afs_int64 id,
	/*IN 3*/ PRAuthName * aname);

extern int PR_RemoveAuthName(
	/*IN */ struct rx_connection *z_conn,
	/*IN 0*/ PRAuthName * aname);

extern int ubik_PR_RemoveAuthName(
	struct ubik_client *aclient, afs_int32 aflags,
	/*IN 2*/ PRAuthName * aname);

extern afs_int32 SPR_RemoveAuthName(
	/*IN */ struct rx_call *z_call,
	/*IN 3*/ PRAuthName * aname);

struct PR_stats{
	int statsver;
};
extern int PR_ExecuteRequest(struct rx_call *);

extern int PR_OpCodeIndex(int op);

/* Opcode-related useful stats for package: PR_ */
#define PR_LOWEST_OPCODE   500
#define PR_HIGHEST_OPCODE     65542
#define PR_NUMBER_OPCODES     30

#define opcode_PR_INewEntry 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(500)))
#define opcode_PR_WhereIsIt 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(501)))
#define opcode_PR_DumpEntry 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(502)))
#define opcode_PR_AddToGroup 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(503)))
#define opcode_PR_NameToID 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(504)))
#define opcode_PR_IDToName 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(505)))
#define opcode_PR_Delete 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(506)))
#define opcode_PR_RemoveFromGroup 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(507)))
#define opcode_PR_GetCPS 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(508)))
#define opcode_PR_NewEntry 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(509)))
#define opcode_PR_ListMax 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(510)))
#define opcode_PR_SetMax 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(511)))
#define opcode_PR_ListEntry 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(512)))
#define opcode_PR_ChangeEntry 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(513)))
#define opcode_PR_ListElements 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(514)))
#define opcode_PR_IsAMemberOf 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(515)))
#define opcode_PR_SetFieldsEntry 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(516)))
#define opcode_PR_ListOwned 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(517)))
#define opcode_PR_GetCPS2 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(518)))
#define opcode_PR_GetHostCPS 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(519)))
#define opcode_PR_UpdateEntry 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(520)))
#define opcode_PR_ListEntries 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(521)))
#define opcode_PR_ListSuperGroups 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(530)))
#define opcode_PR_GetCapabilities 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(65536)))
#define opcode_PR_AuthNameToID 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(65537)))
#define opcode_PR_AuthNameToIDFallback 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(65538)))
#define opcode_PR_ListAuthNames 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(65539)))
#define opcode_PR_WhoAmI 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(65540)))
#define opcode_PR_AddAuthName 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(65541)))
#define opcode_PR_RemoveAuthName 	((afs_uint64)((8LL << 32) + PR_OpCodeIndex(65542)))
#define PR_NO_OF_STAT_FUNCS	30

AFS_RXGEN_EXPORT
extern const char *PR_function_names[];

#endif	/* _RXGEN_PTINT_ */
# 802 "/usr/home/kaduk/openafs/build/include/afs/ptint.h"
# 20 "/usr/home/kaduk/openafs/build/include/afs/acl.h" 2

#define ACL_VERSION "Version 1"

struct acl_accessEntry {
    int id;			/*internally-used ID of user or group */
    int rights;			/*mask */
};

/*
The above access list entry format is used in VICE
*/


#define ACL_ACLVERSION  1	/*Identifies current format of access lists */

struct acl_accessList {
    int size;			/*size of this access list in bytes, including MySize itself */
    int version;		/*to deal with upward compatibility ; <= ACL_ACLVERSION */
    int total;
    int positive;		/* number of positive entries */
    int negative;		/* number of minus entries */
    struct acl_accessEntry entries[1];	/* negative entries are stored backwards from end */
};

/*
Used in VICE. This is how acccess lists are stored on secondary storage.
*/


#define ACL_MAXENTRIES	20

/*
 * External access lists are just char *'s, with the following format:
 *
 * Begins with a decimal integer in format "%d\n%d\n" specifying the
 * number of positive entries and negative entries that follow.  This is
 * followed by the list of entries.  Each entry consists of a username or
 * groupname followed by a decimal number representing the rights mask for
 * that name.  Each entry in the list looks as if it had been produced by
 * printf() using a format list of "%s\t%d\n".
 *
 * Note that the number of entries must be less than or equal to ACL_MAXENTRIES
 */

/* This is temporary hack to get around changing the volume package for now */

typedef struct acl_accessList AL_AccessList;

extern int acl_NewACL(int nEntries, struct acl_accessList **acl);
extern int acl_FreeACL(struct acl_accessList **acl);
extern int acl_NewExternalACL(int nEntries, char **r);
extern int acl_FreeExternalACL(char **r);
extern int acl_Externalize(struct acl_accessList *acl, char **elist);
extern int acl_Internalize(char *elist, struct acl_accessList **acl);
extern int acl_Externalize_pr(int (*func)(idlist *ids, namelist *names), struct acl_accessList *acl, char **elist);
extern int acl_Internalize_pr(int (*func)(namelist *names, idlist *ids), char *elist, struct acl_accessList **acl);
extern int acl_Initialize(char *version);
#ifdef	_RXGEN_PTINT_
extern int acl_CheckRights(struct acl_accessList *acl, prlist *groups, int *rights);
extern int acl_IsAMember(afs_int32 aid, prlist *cps);
#endif
# 81 "/usr/home/kaduk/openafs/build/include/afs/acl.h"

extern int acl_HtonACL(struct acl_accessList *);
extern int acl_NtohACL(struct acl_accessList *);

#endif
# 86 "/usr/home/kaduk/openafs/build/include/afs/acl.h"
# 85 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if !defined(PRE_AFS_36) && !defined(RESIDENCY)
#if 0 /* expanded by -frewrite-includes */
#include <afs/ihandle.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/* An IHandle_t is an abstraction allowing the file and volume operations to
 * pass the elements required to identify a file to the underlying file
 * systen. For the usual Vice inode operations, this is no more than the
 * usual device and inode numbers. For the user space file system used on NT
 * we also need the volume id to identify the file.
 *
 * An FdHandle_t is an abstraction used to associate file descroptors
 * with Inode handles. IH_OPEN is used to get a file descriptor that
 * can be used in subsequent I/O operations. File descriptor handles are
 * cached by IO_CLOSE. To make sure a file descriptor is really closed call
 * IH_REALLYCLOSE.
 *
 * The IHandle_t also provides a place to do other optimizations. In the
 * NT user space file system, we keep a separate special file for the
 * link counts and using the IHandle_t allows keeping the details of
 * that at a lower level than the IDEC and IINC calls.
 *
 * To use the IHandle_t there are a new set of IH_xxxx/FDH_XXXX operations.
 * Each takes a pointer to an IHandle_t or an FdHandle_t as the first
 * argument. This pointer is  considered an in/out variable. In particular,
 * the open file descriptors for a given Inode are stored in a linked list
 * of FdHandle_t hanging off of each IHandle_t. IH_OPEN returns NULL on error,
 * and a valid FdHandle_t otherwise. All other IH_xxxx/FDH_xxxx macros return
 * -1 on error and 0 on success.
 *
 * Inode handle operations:
 * IH_INIT - Initialize the Inode handle with the device, volume id, and ino
 * IH_COPY - Copy Inode handle info to a new handle with no open descriptors.
 * IH_REALLYCLOSE - Close all cached file descriptors for Inode handle
 * IH_RELEASE - release a Inode handle, close all cached file descriptors
 * IH_CONDSYNC -  snyc the Inode if it has any open file descriptors
 *
 * Inode operation replacements:
 * IH_CREATE - create a file in the underlying filesystem and setup the
 *	information needed to reference this file in the IHandle_t.
 * IH_OPEN - open the file belonging to the associated inode and set the
 *	file descriptor.
 * IH_IREAD/IH_IWRITE - read/write an Inode.
 * IH_INC/IH_DEC - increment/decrement the link count.
 *
 * Replacements for C runtime file operations
 * FDH_READ/FDH_WRITE - read/write using the file descriptor.
 * FDH_READV/FDH_WRITEV - readv/writev (Unix only)
 * FDH_SEEK - set file handle's read/write position
 * FDH_CLOSE - return a file descriptor to the cache
 * FDH_REALLYCLOSE - Close a file descriptor, do not return to the cache
 * FDH_SYNC - Unconditionally sync an open file.
 * FDH_TRUNC - Truncate a file
 * FDH_LOCKFILE - Lock a whole file
 * FDH_UNLOCKFILE - Unlock a whole file
 *
 * status information:
 * FDH_SIZE - returns the size of the file.
 * FDH_NLINK - returns the link count of the file.
 * FDH_ISUNLINKED - returns if the file has been unlinked out from under us
 *
 * Miscellaneous:
 * FDH_FDOPEN - create a descriptor for buffered I/O
 * STREAM_READ/STREAM_WRITE - buffered file I/O
 */

#ifndef _IHANDLE_H_
#define _IHANDLE_H_

#ifdef AFS_PTHREAD_ENV
#if 0 /* expanded by -frewrite-includes */
# include <pthread.h>
#endif /* expanded by -frewrite-includes */
# 76 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
extern pthread_once_t ih_glock_once;
extern pthread_mutex_t ih_glock_mutex;
extern void ih_glock_init(void);
# define IH_LOCK \
    do { opr_Verify(pthread_once(&ih_glock_once, ih_glock_init) == 0);	\
	opr_mutex_enter(&ih_glock_mutex); \
    } while (0)
# define IH_UNLOCK opr_mutex_exit(&ih_glock_mutex)
#else /* AFS_PTHREAD_ENV */
# 85 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# define IH_LOCK
# define IH_UNLOCK
#endif /* AFS_PTHREAD_ENV */
# 88 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#ifndef DLL_INIT_LIST
/*
 * Macro to initialize a doubly linked list, lifted from Encina
 */
# define DLL_INIT_LIST(head, tail)	\
    do {			 	\
	(head) = NULL;			\
	(tail) = NULL;			\
    } while(0)

/*
 * Macro to remove an element from a doubly linked list
 */
# define DLL_DELETE(ptr,head,tail,next,prev)	\
    do {					\
	if ((ptr)->next) 			\
	    (ptr)->next->prev = (ptr)->prev;	\
	else					\
	    (tail) = (ptr)->prev;		\
	if ((ptr)->prev) 			\
	    (ptr)->prev->next = (ptr)->next;	\
	else 					\
	    (head) = (ptr)->next;		\
	(ptr)->next = (ptr)->prev = NULL;	\
	opr_Assert(!(head) || !((head)->prev)); \
    } while(0)

/*
 * Macro to insert an element at the tail of a doubly linked list
 */
# define DLL_INSERT_TAIL(ptr,head,tail,next,prev) \
    do {					 \
	(ptr)->next = NULL;			 \
        (ptr)->prev = (tail);			 \
	(tail) = (ptr);				 \
	if ((ptr)->prev) 			 \
	    (ptr)->prev->next = (ptr);		 \
	else					 \
	    (head) = (ptr);			 \
	opr_Assert((head) && ((head)->prev == NULL));	\
    } while(0)

#endif /* DLL_INIT_LIST */
# 132 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#ifdef AFS_NT40_ENV
typedef __int64 Inode;
#else
# 136 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#if 0 /* expanded by -frewrite-includes */
# include <afs/afssyscalls.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef AFS_AFSSYSCALLS_H
#define AFS_AFSSYSCALLS_H

#ifndef AFS_NT40_ENV

/* Declare Inode type. */
#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 17 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#ifdef AFS_NAMEI_ENV
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 19 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

typedef afs_uint64 Inode;

#else /* AFS_NAMEI_ENV */
# 23 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#ifdef AFS_64BIT_IOPS_ENV
#ifdef AFS_SGI62_ENV
typedef uint64_t Inode;
#else
# 27 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
typedef afs_uint64 Inode;
#endif				/* AFS_SGI62_ENV */
# 30 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#else /* AFS_64BIT_IOPS_ENV */
# 31 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
typedef unsigned int Inode;
#endif
# 33 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

#ifdef AFS_DEBUG_IOPS
extern FILE *inode_debug_log;
#define AFS_DEBUG_IOPS_LOG(F) (inode_debug_log = (F))
#else
# 38 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#define AFS_DEBUG_IOPS_LOG(F)
#endif
# 40 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

/* Glue layer. */
#ifdef AFS_LINUX20_ENV
int proc_afs_syscall(long syscall, long param1, long param2, long param3,
		     long param4, int *rval);
#endif
# 46 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

/* Declarations for inode system calls. */
#ifdef AFS_SGI_XFS_IOPS_ENV
extern uint64_t icreatename64(int dev, char *partname, int p0, int p1, int p2,
			      int p3);
extern int iopen64(int dev, uint64_t inode, int usrmod);
extern int iinc64(int dev, uint64_t inode, int inode_p1);
extern int idec64(int dev, uint64_t inode, int inode_p1);
extern int ilistinode64(int dev, uint64_t inode, void *data, int *datalen);

#ifdef AFS_DEBUG_IOPS
extern uint64_t debug_icreatename64(int dev, char *partname, int p0, int p1,
				    int p2, int p3, char *file, int line);
extern int debug_iopen64(int dev, uint64_t inode, int usrmod, char *file,
			 int line);
extern int debug_iinc64(int dev, uint64_t inode, int inode_p1, char *file,
			int line);
extern int debug_idec64(int dev, uint64_t inode, int inode_p1, char *file,
			int line);

#endif /* AFS_DEBUG_IOPS */
# 67 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#endif /* AFS_SGI_XFS_IOPS_ENV */
# 68 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

#ifdef AFS_64BIT_IOPS_ENV
extern int inode_read(int dev, Inode inode, int inode_p1, uint32_t offset,
		      char *cbuf, uint32_t count);
extern int inode_write(int dev, Inode inode, int inode_p1, uint32_t offset,
		       char *cbuf, uint32_t count);
#else
# 75 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
extern int inode_read();
extern int inode_write();
#endif
# 78 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

#ifdef AFS_SGI_VNODE_GLUE
/* flag: 1 = has NUMA, 0 = no NUMA, -1 = kernel decides. */
extern int afs_init_kernel_config(int flag);
#endif /* AFS_SGI_VNODE_GLUE */
# 83 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

#endif /* AFS_NAMEI_ENV */
# 85 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"


/* minimum size of string to hand to PrintInode */
#define AFS_INO_STR_LENGTH 32
typedef char afs_ino_str_t[AFS_INO_STR_LENGTH];

/* Print either 32 or 64 bit inode numbers. char * may be NULL. In which case
 * a local statis is returned.
 */
#ifdef AFS_64BIT_IOPS_ENV
extern char *PrintInode(afs_ino_str_t, Inode);
#else
# 97 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
extern char *PrintInode();
#endif
# 99 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

/* Some places in the code assume icreate can return 0 when there's
 * an error.
 */
#define VALID_INO(I) ((I) != (Inode)-1 && (I) != (Inode)0)

#ifndef AFS_NAMEI_ENV

/* Definitions of inode macros. */
#ifdef AFS_SGI_XFS_IOPS_ENV
#ifdef AFS_DEBUG_IOPS
#define ICREATE(DEV, NAME, NI, P0, P1, P2, P3) \
	 debug_icreatename64(DEV, NAME, P0, P1, P2, P3, __FILE__, __LINE__)
#define IDEC(DEV, INO, VID)	debug_idec64(DEV, INO, VID, __FILE__, __LINE__)
#define IINC(DEV, INO, VID)	debug_iinc64(DEV, INO, VID, __FILE__, __LINE__)
#define IOPEN(DEV, INO, MODE) debug_iopen64(DEV, INO, MODE, __FILE__, __LINE__)
#else
# 116 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#define ICREATE(DEV, NAME, NI, P0, P1, P2, P3) \
		icreatename64(DEV, NAME, P0, P1, P2, P3)
#define IDEC(DEV, INO, VID)	idec64(DEV, INO, VID)
#define IINC(DEV, INO, VID)	iinc64(DEV, INO, VID)
#define IOPEN(DEV, INO, MODE)	iopen64(DEV, INO, MODE)
#endif
# 122 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#define AFS_IOPS_DEFINED 1
#endif /* AFS_SGI_IOPS_ENV */
# 124 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"


#ifndef AFS_IOPS_DEFINED
#ifdef AFS_DEBUG_IOPS
#else
# 129 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#define ICREATE(DEV, NAME, NI, P0, P1, P2, P3) \
	icreate(DEV, NI, P0, P1, P2, P3)
#define IDEC(DEV, INO, VID)	idec(DEV, INO, VID)
#define IINC(DEV, INO, VID)	iinc(DEV, INO, VID)
#define IOPEN(DEV, INO, MODE)	iopen(DEV, INO, MODE)
#endif
# 135 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
#endif /* AFS_IOPS_DEFINED */
# 136 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"


#endif /* AFS_NAMEI_ENV */
# 139 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

/* Declarations for lsetpag and lpioctl */
int     lsetpag(void);
int     lpioctl(char *path, int cmd, void *cmarg, int follow);

#endif /* AFS_NT40_ENV */
# 145 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"

#endif /* AFS_AFSSYSCALLS_H */
# 147 "/usr/home/kaduk/openafs/build/include/afs/afssyscalls.h"
# 137 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h" 2
#endif
# 138 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

/* The dir package's page hashing function is dependent upon the layout of
 * IHandle_t as well as the containing DirHandle in viced/viced.h. Make
 * Sure the volume id is still used as the hash after any changes to either
 * structure.
 */

/* forward declaration */
struct IHandle_s;

/* File descriptors are HANDLE's on NT. The following typedef helps catch
 * type errors. duplicated in libadmin/vos/afs_vosAdmin.c
 */
#ifdef AFS_NT40_ENV
typedef HANDLE FD_t;
# define INVALID_FD INVALID_HANDLE_VALUE
#else
# 155 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
typedef int FD_t;
# define INVALID_FD ((FD_t)-1)
#endif
# 158 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

/* file descriptor handle */
typedef struct FdHandle_s {
    int fd_status;		/* status flags */
    int fd_refcnt;		/* refcnt */
    FD_t fd_fd;			/* file descriptor */
    struct IHandle_s *fd_ih;	/* Pointer to Inode handle */
    struct FdHandle_s *fd_next;	/* LRU/Avail list pointers */
    struct FdHandle_s *fd_prev;
    struct FdHandle_s *fd_ihnext;	/* Inode handle's list of file descriptors */
    struct FdHandle_s *fd_ihprev;
} FdHandle_t;

/* File descriptor status values */
#define FD_HANDLE_AVAIL		1	/* handle is not open and available */
#define FD_HANDLE_OPEN		2	/* handle is open and not in use */
#define FD_HANDLE_INUSE		3	/* handle is open and in use */
#define FD_HANDLE_CLOSING	4	/* handle is open, in use, and has been
					 * IH_REALLYCLOSE'd. It should not be
					 * used for subsequent opens. */

/* buffered file descriptor handle */
#define STREAM_HANDLE_BUFSIZE	2048	/* buffer size for STR_READ/STR_WRITE */
typedef struct StreamHandle_s {
    FD_t str_fd;		/* file descriptor */
    int str_direction;		/* current read/write direction */
    afs_sfsize_t str_buflen;	/* bytes remaining in buffer */
    afs_foff_t str_bufoff;	/* current offset into buffer */
    afs_foff_t str_fdoff;	/* current offset into file */
    int str_error;		/* error code */
    int str_eof;		/* end of file flag */
    struct StreamHandle_s *str_next;	/* Avail list pointers */
    struct StreamHandle_s *str_prev;
    char str_buffer[STREAM_HANDLE_BUFSIZE];	/* data buffer */
} StreamHandle_t;

#define STREAM_DIRECTION_NONE	1	/* stream is in initial mode */
#define STREAM_DIRECTION_READ	2	/* stream is in input mode */
#define STREAM_DIRECTION_WRITE	3	/* stream is in output mode */

/* number handles allocated at a shot */
#define I_HANDLE_MALLOCSIZE	((size_t)((4096/sizeof(IHandle_t))))
#define FD_HANDLE_MALLOCSIZE	((size_t)((4096/sizeof(FdHandle_t))))
#define STREAM_HANDLE_MALLOCSIZE 1

/* Possible values for the vol_io_params.sync_behavior option.
 * These dictate what actually happens when you call FDH_SYNC or IH_CONDSYNC. */
#define IH_SYNC_ALWAYS  (1) /* This makes FDH_SYNCs do what you'd probably
                             * expect: a synchronous fsync() */
#define IH_SYNC_ONCLOSE (2) /* This makes FDH_SYNCs just flag the ih as "I
                             * need to sync", and does not perform the actual
                             * fsync() until we IH_REALLYCLOSE. This provides a
                             * little assurance over IH_SYNC_NEVER when a volume
                             * has gone offline, and a few other situations. */
#define IH_SYNC_NEVER   (3) /* This makes FDH_SYNCs do nothing. Faster, but
                             * obviously less durable. The OS may ensure that
                             * our data hits the disk eventually, depending on
                             * the platform and various OS-specific tuning
                             * parameters. */


/* READ THIS.
 *
 * On modern platforms tuned for I/O intensive workloads, there may be
 * thousands of file descriptors available (64K on 32-bit Solaris 7,
 * for example), and threading in Solaris 9 and Linux 2.6 (NPTL) are
 * tuned for (many) thousands of concurrent threads at peak.
 *
 * On these platforms, it makes sense to allow administrators to set
 * appropriate limits for their hardware.  Clients may now set desired
 * values in the exported vol_io_params, of type ih_init_params.
 */

typedef struct ih_init_params
{
    afs_uint32 fd_handle_setaside; /* for non-cached i/o, trad. was 128 */
    afs_uint32 fd_initial_cachesize; /* what was 'default' */
    afs_uint32 fd_max_cachesize; /* max open files if large-cache activated */

    int sync_behavior; /* one of the IH_SYNC_* constants */
} ih_init_params;

/* Number of file descriptors needed for non-cached I/O */
#define FD_HANDLE_SETASIDE	128 /* Match to MAX_FILESERVER_THREAD */

/* Which systems have 8-bit fileno?  On GNU/Linux systems, the
 * fileno member of FILE is an int.  On NetBSD 5, it's a short.
 * Ditto for OpenBSD 4.5. Through Solaris 10 8/07 it's unsigned char.
 */

/* Don't try to have more than 256 files open at once if you are planning
 * to use fopen or fdopen. The FILE structure has an eight bit field for
 * the file descriptor.  */
#define FD_DEFAULT_CACHESIZE (255-FD_HANDLE_SETASIDE)

/* We need some limit on the number of files open at once. Some systems
 * say we can open lots of files, but when we do they run out of slots
 * in the file table.
 */
#define FD_MAX_CACHESIZE (2000 - FD_HANDLE_SETASIDE)

/* On modern platforms, this is sized higher than the note implies.
 * For HP, see http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1242508538748+28353475&threadId=302950
 * On AIX, it's said to be self-tuning (sar -v)
 * On Solaris, http://www.princeton.edu/~unix/Solaris/troubleshoot/kerntune.html
 * says stdio limit (FILE) may exist, but then backtracks and says the 64bit
 * solaris and POLL (rather than select) io avoid the issue.  Solaris Internals
 * states that Solaris 7 and above deal with up to 64K on 32bit.
 * However, extended FILE must be enabled to use this. See
 * enable_extended_FILE_stdio(3C)
 */

/* Inode handle */
typedef struct IHandle_s {
    VolumeId ih_vid;		/* Parent volume id. */
    int ih_dev;			/* device id. */
    int ih_flags;		/* Flags */
    int ih_synced;		/* should be synced next time */
    Inode ih_ino;		/* Inode number */
    int ih_refcnt;		/* reference count */
    struct FdHandle_s *ih_fdhead;	/* List of open file desciptors */
    struct FdHandle_s *ih_fdtail;
    struct IHandle_s *ih_next;	/* Links for avail list/hash chains */
    struct IHandle_s *ih_prev;
} IHandle_t;

/* Flags for the Inode handle */
#define IH_REALLY_CLOSED		1

/* Hash function for inode handles */
#define I_HANDLE_HASH_SIZE	2048	/* power of 2 */

/* The casts to int's ensure NT gets the xor operation correct. */
#define IH_HASH(D, V, I) ((int)(((D)^(V)^((int)(I)))&(I_HANDLE_HASH_SIZE-1)))

/*
 * Hash buckets for inode handles
 */
typedef struct IHashBucket_s {
    IHandle_t *ihash_head;
    IHandle_t *ihash_tail;
} IHashBucket_t;

/* Prototypes for handle support routines. */
#ifdef AFS_NAMEI_ENV
# ifdef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
#  include "ntops.h"
#endif /* expanded by -frewrite-includes */
# 305 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# endif
# 306 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#if 0 /* expanded by -frewrite-includes */
# include "namei_ops.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/namei_ops.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/* User space file system operations for Unix platforms. */

#ifndef _AFS_NAMEI_OPS_H_H_
#define _AFS_NAMEI_OPS_H_H_

#ifdef AFS_NAMEI_ENV

/* Basic file operations */
extern FD_t namei_fdopen(IHandle_t * h, char *fdperms);
extern int namei_unlink(char *name);

/* Inode operations */
extern Inode namei_MakeSpecIno(VolumeId volid, int type);
extern Inode namei_icreate(IHandle_t * lh, char *part, afs_uint32 p1,
			   afs_uint32 p2, afs_uint32 p3, afs_uint32 p4);
extern IHandle_t *namei_icreate_init(IHandle_t *lh, int dev, char *part,
                                     afs_uint32 p1, afs_uint32 p2,
                                     afs_uint32 p3, afs_uint32 p4);
extern FD_t namei_iopen(IHandle_t * h);
extern int namei_irelease(IHandle_t * h);
afs_sfsize_t namei_iread(IHandle_t * h, afs_foff_t offset, char *buf,
			 afs_fsize_t size);
afs_sfsize_t namei_iwrite(IHandle_t * h, afs_foff_t offset, char *buf,
			  afs_fsize_t size);
extern int namei_dec(IHandle_t * h, Inode ino, int p1);
extern int namei_inc(IHandle_t * h, Inode ino, int p1);
extern int namei_GetLinkCount(FdHandle_t * h, Inode ino, int lockit, int fixup, int nowrite);
extern int namei_SetLinkCount(FdHandle_t * h, Inode ino, int count, int locked);
extern int namei_ViceREADME(char *partition);
extern int namei_FixSpecialOGM(FdHandle_t *h, int check);
#if 0 /* expanded by -frewrite-includes */
#include "nfs.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/nfs.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#if 0 /* expanded by -frewrite-includes */
#include <errno.h>
#endif /* expanded by -frewrite-includes */
# 11 "/usr/home/kaduk/openafs/build/include/afs/nfs.h"

#ifndef	AFS_VOL_NFS_H
#define	AFS_VOL_NFS_H 1
/*
 * (C) COPYRIGHT IBM CORPORATION 1987
 * LICENSED MATERIALS - PROPERTY OF IBM
 */
/*

	System:		VICE-TWO
	Module:		nfs.h
	Institution:	The Information Technology Center, Carnegie-Mellon University

 */
#define private static
#ifndef NULL
#define NULL	0
#endif
# 29 "/usr/home/kaduk/openafs/build/include/afs/nfs.h"
#define TRUE	1
#define FALSE	0
typedef afs_uint32 bit32;	/* Unsigned, 32 bits */
typedef unsigned short bit16;	/* Unsigned, 16 bits */
typedef unsigned char byte;	/* Unsigned, 8 bits */

typedef bit32 Device;		/* Unix device number */
#ifndef	Error
#define	Error	bit32
#endif
# 39 "/usr/home/kaduk/openafs/build/include/afs/nfs.h"
#endif /* AFS_VOL_NFS_H */
# 40 "/usr/home/kaduk/openafs/build/include/afs/nfs.h"
# 41 "/usr/home/kaduk/openafs/build/include/afs/namei_ops.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "viceinode.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/viceinode.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*
	System:		VICE-TWO
	Module:		viceinode.h
	Institution:	The Information Technology Center, Carnegie-Mellon University

 */

#ifndef _VICEINODE_H_
#define _VICEINODE_H_

/* The four inode parameters for most inodes (files, directories,
   symbolic links) */
struct InodeParams {
    VolumeId volumeId;
    VnodeId vnodeNumber;
    Unique vnodeUniquifier;
    FileVersion inodeDataVersion;
};

/* The four inode parameters for special inodes, i.e. the descriptive
   inodes for a volume */
struct SpecialInodeParams {
    VolumeId volumeId;
    VnodeId vnodeNumber;	/* this must be INODESPECIAL */
#ifdef	AFS_3DISPARES
    VolumeId parentId;
    int type;
#else
# 38 "/usr/home/kaduk/openafs/build/include/afs/viceinode.h"
    int type;
    VolumeId parentId;
#endif
# 41 "/usr/home/kaduk/openafs/build/include/afs/viceinode.h"
};

/* Structure of individual records output by fsck.
   When VICEMAGIC inodes are created, they are given four parameters;
   these correspond to the params.fsck array of this record.
 */
struct ViceInodeInfo {
    Inode inodeNumber;
    afs_fsize_t byteCount;
    int linkCount;
    union {
	bit32 param[4];
	struct InodeParams vnode;
	struct SpecialInodeParams special;
    } u;
};

#ifdef	AFS_3DISPARES
#define INODESPECIAL	0x1fffffff
#else
# 61 "/usr/home/kaduk/openafs/build/include/afs/viceinode.h"
#define INODESPECIAL	0xffffffff
#endif
# 63 "/usr/home/kaduk/openafs/build/include/afs/viceinode.h"
/* Special inode types.  Be careful of the ordering.  Must start at 1.
   See vutil.h */
#define VI_VOLINFO	1	/* The basic volume information file */
#define VI_SMALLINDEX	2	/* The index of small vnodes */
#define VI_LARGEINDEX	3	/* The index of large vnodes */
#define VI_ACL		4	/* The volume's access control list */
#define	VI_MOUNTTABLE	5	/* The volume's mount table */
#define VI_LINKTABLE	6	/* The volume's link counts */

#endif /* _VICEINODE_H_ */
# 73 "/usr/home/kaduk/openafs/build/include/afs/viceinode.h"
# 42 "/usr/home/kaduk/openafs/build/include/afs/namei_ops.h" 2
int namei_ListAFSFiles(char *dev,
		       int (*write_fun) (FD_t fp,
					 struct ViceInodeInfo * info,
					 char *dir, char *file), FD_t fp,
		       int (*judge_fun) (struct ViceInodeInfo * info,
					 VolumeId vid, void *rock),
		       VolumeId singleVolumeNumber, void *rock);
int ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile,
		   int (*judgeInode) (struct ViceInodeInfo * info, VolumeId vid,
				      void *rock),
		   VolumeId singleVolumeNumber, int *forcep, int forceR,
		   char *wpath, void *rock);

#define NAMEI_LCOMP_LEN 32
#define NAMEI_PATH_LEN 256

#ifdef AFS_NT40_ENV
#define NAMEI_DRIVE_LEN 3
#define NAMEI_HASH_LEN 2
#define NAMEI_COMP_LEN 18
typedef struct {
    char n_drive[NAMEI_DRIVE_LEN];
    char n_voldir[NAMEI_COMP_LEN];
    char n_dir[NAMEI_HASH_LEN];
    char n_inode[NAMEI_COMP_LEN];
    char n_path[NAMEI_PATH_LEN];
} namei_t;
#else
# 70 "/usr/home/kaduk/openafs/build/include/afs/namei_ops.h"
#define NAMEI_SCOMP_LEN 12
typedef struct {
    char n_base[NAMEI_LCOMP_LEN];
    char n_voldir1[NAMEI_SCOMP_LEN];
    char n_voldir2[NAMEI_LCOMP_LEN];
    char n_dir1[NAMEI_SCOMP_LEN];
    char n_dir2[NAMEI_SCOMP_LEN];
    char n_inode[NAMEI_LCOMP_LEN];
    char n_path[NAMEI_PATH_LEN];
} namei_t;
#endif
# 81 "/usr/home/kaduk/openafs/build/include/afs/namei_ops.h"

void namei_HandleToName(namei_t * name, IHandle_t * h);
int namei_ConvertROtoRWvolume(char *pname, VolumeId volumeId);
int namei_replace_file_by_hardlink(IHandle_t *hLink, IHandle_t *hTarget);

# ifdef AFS_SALSRV_ENV
#if 0 /* expanded by -frewrite-includes */
#  include <afs/work_queue.h>
#endif /* expanded by -frewrite-includes */
# 88 "/usr/home/kaduk/openafs/build/include/afs/namei_ops.h"
extern void namei_SetWorkQueue(struct afs_work_queue *wq);
# endif
# 90 "/usr/home/kaduk/openafs/build/include/afs/namei_ops.h"

#endif /* AFS_NAMEI_ENV */
# 92 "/usr/home/kaduk/openafs/build/include/afs/namei_ops.h"

#endif /* _AFS_NAMEI_OPS_H_H_ */
# 94 "/usr/home/kaduk/openafs/build/include/afs/namei_ops.h"
# 307 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h" 2

extern void ih_clear(IHandle_t * h);
extern Inode ih_create(IHandle_t * h, int dev, char *part, Inode nI, int p1,
		       int p2, int p3, int p4);
extern FD_t *ih_fdopen(FdHandle_t * h, char *fdperms);
#endif /* AFS_NAMEI_ENV */
# 313 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

/*
 * Prototypes for file descriptor cache routines
 */
extern void ih_PkgDefaults(void);
extern void ih_Initialize(void);
extern void ih_UseLargeCache(void);
extern int ih_SetSyncBehavior(const char *behavior);
extern IHandle_t *ih_init(int /*@alt Device@ */ dev, int /*@alt VolId@ */ vid,
			  Inode ino);
extern IHandle_t *ih_copy(IHandle_t * ihP);
extern FdHandle_t *ih_open(IHandle_t * ihP);
extern int fd_close(FdHandle_t * fdP);
extern int fd_reallyclose(FdHandle_t * fdP);
extern StreamHandle_t *stream_fdopen(FD_t fd);
extern StreamHandle_t *stream_open(const char *file, const char *mode);
extern afs_sfsize_t stream_read(void *ptr, afs_fsize_t size,
				afs_fsize_t nitems, StreamHandle_t * streamP);
extern afs_sfsize_t stream_write(void *ptr, afs_fsize_t size,
				 afs_fsize_t nitems,
				 StreamHandle_t * streamP);
extern int stream_aseek(StreamHandle_t * streamP, afs_foff_t offset);
extern int stream_flush(StreamHandle_t * streamP);
extern int stream_close(StreamHandle_t * streamP, int reallyClose);
extern int ih_reallyclose(IHandle_t * ihP);
extern int ih_release(IHandle_t * ihP);
extern int ih_condsync(IHandle_t * ihP);
extern FdHandle_t *ih_attachfd(IHandle_t * ihP, FD_t fd);

/* Macros common to user space and inode API's. */
#define IH_INIT(H, D, V, I) ((H) = ih_init((D), (V), (I)))

#define IH_COPY(D, S) ((D) = ih_copy(S))

#define IH_NLINK(H) ih_nlink(H)

#define IH_OPEN(H) ih_open(H)

#define FDH_CLOSE(H) (fd_close(H), (H)=NULL)

#define FDH_REALLYCLOSE(H) (fd_reallyclose(H), (H)=NULL)

#define FDH_FDOPEN(H, A) stream_fdopen((H)->fd_fd)

#define STREAM_FDOPEN(A, B) stream_fdopen(A)

#define STREAM_OPEN(A, B) stream_open(A, B)

#define STREAM_READ(A, B, C, H) stream_read(A, B, C, H)

#define STREAM_WRITE(A, B, C, H) stream_write(A, B, C, H)

#define STREAM_ASEEK(H, A) stream_aseek(H, A)

#define STREAM_FLUSH(H) stream_flush(H)

#define STREAM_ERROR(H) ((H)->str_error)

#define STREAM_EOF(H) ((H)->str_eof)

#define STREAM_CLOSE(H) stream_close(H, 0)

#define STREAM_REALLYCLOSE(H) stream_close(H, 1)

#define IH_RELEASE(H) (ih_release(H), (H)=NULL)

#define IH_REALLYCLOSE(H) ih_reallyclose(H)

#define IH_CONDSYNC(H) ih_condsync(H)

#ifdef HAVE_PIO
# ifdef AFS_NT40_ENV
#  define OS_PREAD(FD, B, S, O) nt_pread(FD, B, S, O)
#  define OS_PWRITE(FD, B, S, O) nt_pwrite(FD, B, S, O)
# else
# 388 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  ifdef O_LARGEFILE
#   define OS_PREAD(FD, B, S, O) pread64(FD, B, S, O)
#   define OS_PWRITE(FD, B, S, O) pwrite64(FD, B, S, O)
#  else /* !O_LARGEFILE */
# 392 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#   define OS_PREAD(FD, B, S, O) pread(FD, B, S, O)
#   define OS_PWRITE(FD, B, S, O) pwrite(FD, B, S, O)
#  endif /* !O_LARGEFILE */
# 395 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# endif /* AFS_NT40_ENV */
# 396 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#else /* !HAVE_PIO */
# 397 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
extern ssize_t ih_pread(FD_t fd, void * buf, size_t count, afs_foff_t offset);
extern ssize_t ih_pwrite(FD_t fd, const void * buf, size_t count, afs_foff_t offset);
# define OS_PREAD(FD, B, S, O) ih_pread(FD, B, S, O)
# define OS_PWRITE(FD, B, S, O) ih_pwrite(FD, B, S, O)
#endif /* !HAVE_PIO */
# 402 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#ifdef AFS_NT40_ENV
# define OS_LOCKFILE(FD, O) (!LockFile(FD, (DWORD)((O) & 0xFFFFFFFF), (DWORD)((O) >> 32), 2, 0))
# define OS_UNLOCKFILE(FD, O) (!UnlockFile(FD, (DWORD)((O) & 0xFFFFFFFF), (DWORD)((O) >> 32), 2, 0))
# define OS_ERROR(X) nterr_nt2unix(GetLastError(), X)
# define OS_UNLINK(X) nt_unlink(X)
/* we can't have a file unlinked out from under us on NT */
# define OS_ISUNLINKED(X) (0)
# define OS_DIRSEP "\\"
# define OS_DIRSEPC '\\'
#else
# 413 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# define OS_LOCKFILE(FD, O) flock(FD, LOCK_EX)
# define OS_UNLOCKFILE(FD, O) flock(FD, LOCK_UN)
# define OS_ERROR(X) X
# define OS_UNLINK(X) unlink(X)
# define OS_ISUNLINKED(X) ih_isunlinked(X)
extern int ih_isunlinked(FD_t fd);
# define OS_DIRSEP "/"
# define OS_DIRSEPC '/'
#endif
# 422 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#if defined(AFS_NT40_ENV) || !defined(AFS_NAMEI_ENV)
# define  IH_CREATE_INIT(H, D, P, N, P1, P2, P3, P4) \
         ih_icreate_init(H, D, P, N, P1, P2, P3, P4)
#endif
# 427 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#ifdef AFS_NAMEI_ENV

# ifdef AFS_NT40_ENV
#  define OS_OPEN(F, M, P) nt_open(F, M, P)
#  define OS_CLOSE(FD) nt_close(FD)

#  define OS_READ(FD, B, S) nt_read(FD, B, S)
#  define OS_WRITE(FD, B, S) nt_write(FD, B, S)
#  define OS_SEEK(FD, O, F) nt_seek(FD, O, F)

#  define OS_SYNC(FD) nt_fsync(FD)
#  define OS_TRUNC(FD, L) nt_ftruncate(FD, L)

# else /* AFS_NT40_ENV */
# 442 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

/*@+fcnmacros +macrofcndecl@*/
#  ifdef S_SPLINT_S
extern Inode IH_CREATE(IHandle_t * H, int /*@alt Device @ */ D,
		       char *P, Inode N, int /*@alt VolumeId @ */ P1,
		       int /*@alt VnodeId @ */ P2,
		       int /*@alt Unique @ */ P3,
		       int /*@alt unsigned @ */ P4);
extern FD_t OS_IOPEN(IHandle_t * H);
extern int OS_OPEN(const char *F, int M, mode_t P);
extern int OS_CLOSE(FD_t FD);
extern ssize_t OS_READ(FD_t FD, void *B, size_t S);
extern ssize_t OS_WRITE(FD_t FD, void *B, size_t S);
extern ssize_t OS_PREAD(FD_t FD, void *B, size_t S, afs_foff_t O);
extern ssize_t OS_PWRITE(FD_t FD, void *B, size_t S, afs_foff_t O);
extern int OS_SYNC(FD_t FD);
extern afs_sfsize_t OS_SIZE(FD_t FD);
extern int IH_INC(IHandle_t * H, Inode I, int /*@alt VolId, VolumeId @ */ P);
extern int IH_DEC(IHandle_t * H, Inode I, int /*@alt VolId, VolumeId @ */ P);
extern afs_sfsize_t IH_IREAD(IHandle_t * H, afs_foff_t O, void *B,
			     afs_fsize_t S);
extern afs_sfsize_t IH_IWRITE(IHandle_t * H, afs_foff_t O, void *B,
			      afs_fsize_t S);
#   ifdef O_LARGEFILE
#    define OFFT off64_t
#   else
# 468 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#    define OFFT off_t
#   endif
# 470 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

extern OFFT OS_SEEK(FD_t FD, OFFT O, int F);
extern int OS_TRUNC(FD_t FD, OFFT L);
#  endif /*S_SPLINT_S */
# 474 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#  ifdef O_LARGEFILE
#   define OS_OPEN(F, M, P) open64(F, M, P)
#  else /* !O_LARGEFILE */
# 478 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#   define OS_OPEN(F, M, P) open(F, M, P)
#  endif /* !O_LARGEFILE */
# 480 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  define OS_CLOSE(FD) close(FD)

#  define OS_READ(FD, B, S) read(FD, B, S)
#  define OS_WRITE(FD, B, S) write(FD, B, S)
#  ifdef O_LARGEFILE
#   define OS_SEEK(FD, O, F) lseek64(FD, (off64_t) (O), F)
#   define OS_TRUNC(FD, L) ftruncate64(FD, (off64_t) (L))
#  else /* !O_LARGEFILE */
# 488 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#   define OS_SEEK(FD, O, F) lseek(FD, (off_t) (O), F)
#   define OS_TRUNC(FD, L) ftruncate(FD, (off_t) (L))
#  endif /* !O_LARGEFILE */
# 491 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#  define OS_SYNC(FD) fsync(FD)
#  define IH_CREATE_INIT(H, D, P, N, P1, P2, P3, P4) \
          namei_icreate_init(H, D, P, P1, P2, P3, P4)

/*@=fcnmacros =macrofcndecl@*/
# endif /* AFS_NT40_ENV */
# 498 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# define IH_INC(H, I, P) namei_inc(H, I, P)
# define IH_DEC(H, I, P) namei_dec(H, I, P)
# define IH_IREAD(H, O, B, S) namei_iread(H, O, B, S)
# define IH_IWRITE(H, O, B, S) namei_iwrite(H, O, B, S)
# define IH_CREATE(H, D, P, N, P1, P2, P3, P4) \
         namei_icreate(H, P, P1, P2, P3, P4)
# define OS_IOPEN(H) namei_iopen(H)


#else /* AFS_NAMEI_ENV */
# 508 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
extern Inode ih_icreate(IHandle_t * ih, int dev, char *part, Inode nI, int p1,
			int p2, int p3, int p4);

# define IH_CREATE(H, D, P, N, P1, P2, P3, P4) \
        ih_icreate(H, D, P, N, P1, P2, P3, P4)

# ifdef AFS_LINUX22_ENV
#  define OS_IOPEN(H) -1
# else
# 517 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  ifdef O_LARGEFILE
#   define OS_IOPEN(H) (IOPEN((H)->ih_dev, (H)->ih_ino, O_RDWR|O_LARGEFILE))
#  else
# 520 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#   define OS_IOPEN(H) (IOPEN((H)->ih_dev, (H)->ih_ino, O_RDWR))
#  endif
# 522 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# endif
# 523 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# define OS_OPEN(F, M, P) open(F, M, P)
# define OS_CLOSE(FD) close(FD)

# define OS_READ(FD, B, S) read(FD, B, S)
# define OS_WRITE(FD, B, S) write(FD, B, S)
# ifdef O_LARGEFILE
#  define OS_SEEK(FD, O, F) lseek64(FD, (off64_t) (O), F)
#  define OS_TRUNC(FD, L) ftruncate64(FD, (off64_t) (L))
# else /* !O_LARGEFILE */
# 532 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  define OS_SEEK(FD, O, F) lseek(FD, (off_t) (O), F)
#  define OS_TRUNC(FD, L) ftruncate(FD, (off_t) (L))
# endif /* !O_LARGEFILE */
# 535 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

# define OS_SYNC(FD) fsync(FD)

# ifdef AFS_LINUX22_ENV
#  define IH_INC(H, I, P) -1
#  define IH_DEC(H, I, P) -1
#  define IH_IREAD(H, O, B, S) -1
#  define IH_IWRITE(H, O, B, S) -1
# else
# 544 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  define IH_INC(H, I, P) IINC((H)->ih_dev, I, P)
#  define IH_DEC(H, I, P) IDEC((H)->ih_dev, I, P)
#  define IH_IREAD(H, O, B, S) inode_read((H)->ih_dev, (H)->ih_ino, (H)->ih_vid,\
                                          O, B, S)
#  define IH_IWRITE(H, O, B, S) \
          inode_write((H)->ih_dev, (H)->ih_ino, (H)->ih_vid, O, B, S)
# endif /* AFS_LINUX22_ENV */
# 551 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#endif /* AFS_NAMEI_ENV */
# 553 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#define OS_SIZE(FD) ih_size(FD)
extern afs_sfsize_t ih_size(FD_t);

#ifndef AFS_NT40_ENV
# define FDH_READV(H, I, N) readv((H)->fd_fd, I, N)
# define FDH_WRITEV(H, I, N) writev((H)->fd_fd, I, N)
#endif
# 561 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#ifdef HAVE_PIOV
# ifdef O_LARGEFILE
#  define FDH_PREADV(H, I, N, O) preadv64((H)->fd_fd, I, N, O)
#  define FDH_PWRITEV(H, I, N, O) pwritev64((H)->fd_fd, I, N, O)
# else /* !O_LARGEFILE */
# 567 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  define FDH_PREADV(H, I, N, O) preadv((H)->fd_fd, I, N, O)
#  define FDH_PWRITEV(H, I, N, O) pwritev((H)->fd_fd, I, N, O)
# endif /* !O_LARGEFILE */
# 570 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#endif
# 571 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#define FDH_PREAD(H, B, S, O) OS_PREAD((H)->fd_fd, B, S, O)
#define FDH_PWRITE(H, B, S, O) OS_PWRITE((H)->fd_fd, B, S, O)
#define FDH_READ(H, B, S) OS_READ((H)->fd_fd, B, S)
#define FDH_WRITE(H, B, S) OS_WRITE((H)->fd_fd, B, S)
#define FDH_SEEK(H, O, F) OS_SEEK((H)->fd_fd, O, F)

#define FDH_SYNC(H) ih_fdsync(H)
#define FDH_TRUNC(H, L) OS_TRUNC((H)->fd_fd, L)
#define FDH_SIZE(H) OS_SIZE((H)->fd_fd)
#define FDH_LOCKFILE(H, O) OS_LOCKFILE((H)->fd_fd, O)
#define FDH_UNLOCKFILE(H, O) OS_UNLOCKFILE((H)->fd_fd, O)
#define FDH_ISUNLINKED(H) OS_ISUNLINKED((H)->fd_fd)

extern int ih_fdsync(FdHandle_t *fdP);

#ifdef AFS_NT40_ENV
# define afs_stat_st     __stat64
# define afs_stat	_stat64
# define afs_fstat	_fstat64
# define afs_fopen	fopen
# define afs_open	open
# define afs_lseek(FD, O, F)	_lseeki64(FD, O, F)
#else /* AFS_NT40_ENV */
# 595 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# ifdef O_LARGEFILE
#  define afs_stat_st     stat64
#  define afs_stat	stat64
#  define afs_fstat	fstat64
#  define afs_fopen	fopen64
#  define afs_open	open64
#  ifdef S_SPLINT_S
extern off64_t afs_lseek(int FD, off64_t O, int F);
#  endif /*S_SPLINT_S */
# 604 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  define afs_lseek(FD, O, F)	lseek64(FD, (off64_t) (O), F)
#  define afs_ftruncate           ftruncate64
#  define afs_mmap                mmap64
#  ifdef AFS_AIX_ENV
extern void * mmap64();  /* ugly hack since aix build env appears to be somewhat broken */
#  endif
# 610 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# else /* !O_LARGEFILE */
# 611 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  define afs_stat_st     stat
#  define	afs_stat	stat
#  define	afs_fstat	fstat
#  define afs_fopen	fopen
#  define afs_open	open
#  ifdef S_SPLINT_S
extern off_t afs_lseek(int FD, off_t O, int F);
#  endif /*S_SPLINT_S */
# 619 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  define afs_lseek(FD, O, F)	lseek(FD, (off_t) (O), F)
#  define afs_ftruncate           ftruncate
#  define afs_mmap                mmap
# endif /* !O_LARGEFILE */
# 623 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# if AFS_HAVE_STATVFS64
#  define afs_statvfs	statvfs64
# else
# 626 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  if AFS_HAVE_STATFS64
#   define afs_statfs	statfs64
#  else
# 629 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#   if AFS_HAVE_STATVFS
#    define afs_statvfs	statvfs
#   else
# 632 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#    define afs_statfs	statfs
#   endif /* !AFS_HAVE_STATVFS */
# 634 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#  endif /* !AFS_HAVE_STATFS64 */
# 635 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# endif /* !AFS_HAVE_STATVFS64 */
# 636 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
#endif /* !AFS_NT40_ENV */
# 637 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"

#endif /* _IHANDLE_H_ */
# 639 "/usr/home/kaduk/openafs/build/include/afs/ihandle.h"
# 87 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#endif /* !defined(PRE_AFS_36) && !defined(RESIDENCY) */
# 88 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#if 0 /* expanded by -frewrite-includes */
#include <afs/vnode.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/vnode.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 *
 * Portions Copyright (c) 2007-2008 Sine Nomine Associates
 */

/*
	System:		VICE-TWO
	Module:		vnode.h
	Institution:	The Information Technology Center, Carnegie-Mellon University

 */

#ifndef _AFS_VOL_VNODE_H
#define _AFS_VOL_VNODE_H 1

#define Date afs_uint32

struct Volume;			/* Potentially forward definition. */

typedef struct ViceLock {
    int lockCount;
    int lockTime;
} ViceLock;

#define ViceLockCheckLocked(vptr) ((vptr)->lockTime == 0)
#define ViceLockClear(vptr) ((vptr)->lockCount = (vptr)->lockTime = 0)

#define ROOTVNODE 1

/*typedef enum {vNull=0, vFile=1, vDirectory=2, vSymlink=3} VnodeType;*/
typedef unsigned int VnodeType;
#define vNull 0
#define vFile 1
#define vDirectory 2
#define vSymlink 3

/*typedef enum {vLarge=0,vSmall=1} VnodeClass;*/
#define vLarge	0
#define vSmall	1
typedef int VnodeClass;
#define VNODECLASSWIDTH 1
#define VNODECLASSMASK	((1<<VNODECLASSWIDTH)-1)
#define nVNODECLASSES	(VNODECLASSMASK+1)

struct VnodeClassInfo {
    struct Vnode *lruHead;	/* Head of list of vnodes of this class */
    int diskSize;		/* size of vnode disk object, power of 2 */
    int logSize;		/* log 2 diskSize */
    int residentSize;		/* resident size of vnode */
    int cacheSize;		/* Vnode cache size */
    bit32 magic;		/* Magic number for this type of vnode,
				 * for as long as we're using vnode magic
				 * numbers */
    int allocs;			/* Total number of successful allocation
				 * requests; this is the same as the number
				 * of sanity checks on the vnode index */
    int gets, reads;		/* Number of VGetVnodes and corresponding
				 * reads */
    int writes;			/* Number of vnode writes */
};

extern struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES];

#define vnodeTypeToClass(type)  ((type) == vDirectory? vLarge: vSmall)
#define vnodeIdToClass(vnodeId) ((vnodeId-1)&VNODECLASSMASK)
#define vnodeIdToBitNumber(v) (((v)-1)>>VNODECLASSWIDTH)
/* The following calculation allows for a header record at the beginning
   of the index.  The header record is the same size as a vnode */
#define vnodeIndexOffset(vcp,vnodeNumber) \
    ((vnodeIdToBitNumber(vnodeNumber)+1)<<(vcp)->logSize)
#define bitNumberToVnodeNumber(b,class) ((VnodeId)(((b)<<VNODECLASSWIDTH)+(class)+1))
#define vnodeIsDirectory(vnodeNumber) (vnodeIdToClass(vnodeNumber) == vLarge)

typedef struct VnodeDiskObject {
    unsigned int type:3;	/* Vnode is file, directory, symbolic link
				 * or not allocated */
    unsigned int cloned:1;	/* This vnode was cloned--therefore the inode
				 * is copy-on-write; only set for directories */
    unsigned int modeBits:12;	/* Unix mode bits */
    signed int linkCount:16;	/* Number of directory references to vnode
				 * (from single directory only!) */
    bit32 length;		/* Number of bytes in this file */
    Unique uniquifier;		/* Uniquifier for the vnode; assigned
				 * from the volume uniquifier (actually
				 * from nextVnodeUnique in the Volume
				 * structure) */
    FileVersion dataVersion;	/* version number of the data */
    afs_int32 vn_ino_lo;	/* inode number of the data attached to
				 * this vnode - entire ino for standard */
    Date unixModifyTime;	/* set by user */
    UserId author;		/* Userid of the last user storing the file */
    UserId owner;		/* Userid of the user who created the file */
    VnodeId parent;		/* Parent directory vnode */
    bit32 vnodeMagic;		/* Magic number--mainly for file server
				 * paranoia checks */
#   define	  SMALLVNODEMAGIC	0xda8c041F
#   define	  LARGEVNODEMAGIC	0xad8765fe
    /* Vnode magic can be removed, someday, if we run need the room.  Simply
     * have to be sure that the thing we replace can be VNODEMAGIC, rather
     * than 0 (in an old file system).  Or go through and zero the fields,
     * when we notice a version change (the index version number) */
    ViceLock lock;		/* Advisory lock */
    Date serverModifyTime;	/* Used only by the server; for incremental
				 * backup purposes */
    afs_int32 group;		/* unix group */
    afs_int32 vn_ino_hi;	/* high part of 64 bit inode. */
    bit32 vn_length_hi;         /* high part of 64 bit length */
    /* Missing:
     * archiving/migration
     * encryption key
     */
} VnodeDiskObject;

#define SIZEOF_SMALLDISKVNODE	64
#define CHECKSIZE_SMALLVNODE\
	(sizeof(VnodeDiskObject) == SIZEOF_SMALLDISKVNODE)
#define SIZEOF_LARGEDISKVNODE	256



#ifdef AFS_DEMAND_ATTACH_FS
/**
 * demand attach vnode state enumeration.
 *
 * @note values must be contiguous for VnIsValidState() to work
 */
typedef enum {
    VN_STATE_INVALID            = 0,    /**< vnode does not contain valid cache data */
    VN_STATE_RELEASING          = 1,    /**< vnode is busy releasing its ihandle ref */
    VN_STATE_CLOSING            = 2,    /**< vnode is busy closing its ihandle ref */
    VN_STATE_ALLOC              = 3,    /**< vnode is busy allocating disk entry */
    VN_STATE_ONLINE             = 4,    /**< vnode is ready for use */
    VN_STATE_LOAD               = 5,    /**< vnode is busy being loaded from disk */
    VN_STATE_EXCLUSIVE          = 6,    /**< something external to the vnode package
					 *   is operating exclusively on this vnode */
    VN_STATE_STORE              = 7,    /**< vnode is busy being stored to disk */
    VN_STATE_READ               = 8,    /**< a non-zero number of threads are executing
					 *   code external to the vnode package which
					 *   requires shared access */
    VN_STATE_ERROR              = 10,   /**< vnode hard error state */
    VN_STATE_COUNT
} VnState;
#endif /* AFS_DEMAND_ATTACH_FS */
# 150 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"

/**
 * DAFS vnode state flags.
 */
enum VnFlags {
    VN_ON_HASH            = 0x1,        /**< vnode is on hash table */
    VN_ON_LRU             = 0x2,        /**< vnode is on lru list */
    VN_ON_VVN             = 0x4,        /**< vnode is on volume vnode list */
    VN_FLAGS_END
};


typedef struct Vnode {
    struct rx_queue vid_hash;   /* for vnode by volume id hash */
    struct Vnode *hashNext;	/* Next vnode on hash conflict chain */
    struct Vnode *lruNext;	/* Less recently used vnode than this one */
    struct Vnode *lruPrev;	/* More recently used vnode than this one */
    /* The lruNext, lruPrev fields are not
     * meaningful if the vnode is in use */
    bit16 hashIndex;		/* Hash table index */
#ifdef	AFS_AIX_ENV
    unsigned changed_newTime:1;	/* 1 if vnode changed, write time */
    unsigned changed_oldTime:1;	/* 1 changed, don't update time. */
    unsigned delete:1;		/* 1 if the vnode should be deleted; in
				 * this case, changed must also be 1 */
#else
# 176 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"
    byte changed_newTime:1;	/* 1 if vnode changed, write time */
    byte changed_oldTime:1;	/* 1 changed, don't update time. */
    byte delete:1;		/* 1 if the vnode should be deleted; in
				 * this case, changed must also be 1 */
#endif
# 181 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"
    VnodeId vnodeNumber;
    struct Volume
     *volumePtr;		/* Pointer to the volume containing this file */
    bit32 nUsers;		/* Number of lwp's who have done a VGetVnode */
    bit32 cacheCheck;		/* Must equal the value in the volume Header
				 * for the cache entry to be valid */
    bit32 vn_state_flags;       /**< vnode state flags */
#ifdef AFS_DEMAND_ATTACH_FS
    bit32 nReaders;             /**< number of read locks held */
    VnState vn_state;           /**< vnode state */
    pthread_cond_t vn_state_cv; /**< state change notification cv */
#else /* !AFS_DEMAND_ATTACH_FS */
# 193 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"
    struct Lock lock;		/* Internal lock */
#endif /* !AFS_DEMAND_ATTACH_FS */
# 195 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"
#ifdef AFS_PTHREAD_ENV
    pthread_t writer;		/* thread holding write lock */
#else				/* AFS_PTHREAD_ENV */
# 198 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"
    PROCESS writer;		/* Process id having write lock */
#endif				/* AFS_PTHREAD_ENV */
# 200 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"
    struct VnodeClassInfo * vcp; /**< our vnode class */
    IHandle_t *handle;
    VnodeDiskObject disk;	/* The actual disk data for the vnode */
} Vnode;

#define SIZEOF_LARGEVNODE \
	(sizeof(struct Vnode) - sizeof(VnodeDiskObject) + SIZEOF_LARGEDISKVNODE)
#define SIZEOF_SMALLVNODE	(sizeof (struct Vnode))


/*
 * struct Vnode accessor abstraction
 */
#define Vn_refcount(vnp)      ((vnp)->nUsers)
#define Vn_state(vnp)         ((vnp)->vn_state)
#define Vn_stateFlags(vnp)    ((vnp)->vn_state_flags)
#define Vn_stateCV(vnp)       ((vnp)->vn_state_cv)
#define Vn_volume(vnp)        ((vnp)->volumePtr)
#define Vn_cacheCheck(vnp)    ((vnp)->cacheCheck)
#define Vn_class(vnp)         ((vnp)->vcp)
#define Vn_readers(vnp)       ((vnp)->nReaders)
#define Vn_id(vnp)            ((vnp)->vnodeNumber)


#define VN_GET_LEN(N, V) FillInt64(N, (V)->disk.vn_length_hi, (V)->disk.length)
#define VNDISK_GET_LEN(N, V) FillInt64(N, (V)->vn_length_hi, (V)->length)
#define VN_SET_LEN(V, N) SplitInt64(N, (V)->disk.vn_length_hi, (V)->disk.length)
#define VNDISK_SET_LEN(V, N) SplitInt64(N, (V)->vn_length_hi, (V)->length)

#ifdef AFS_64BIT_IOPS_ENV
#define VN_GET_INO(V) ((Inode)((V)->disk.vn_ino_lo | \
			       ((V)->disk.vn_ino_hi ? \
				(((Inode)(V)->disk.vn_ino_hi)<<32) : 0)))

#define VN_SET_INO(V, I) ((V)->disk.vn_ino_lo = (int)((I)&0xffffffff), \
			   ((V)->disk.vn_ino_hi = (I) ? \
			    (int)(((I)>>32)&0xffffffff) : 0))

#define VNDISK_GET_INO(V) ((Inode)((V)->vn_ino_lo | \
				   ((V)->vn_ino_hi ? \
				    (((Inode)(V)->vn_ino_hi)<<32) : 0)))

#define VNDISK_SET_INO(V, I) ((V)->vn_ino_lo = (int)(I&0xffffffff), \
			      ((V)->vn_ino_hi = (I) ? \
			       (int)(((I)>>32)&0xffffffff) : 0))
#else
# 246 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"
#define VN_GET_INO(V) ((V)->disk.vn_ino_lo)
#define VN_SET_INO(V, I) ((V)->disk.vn_ino_lo = (I))
#define VNDISK_GET_INO(V) ((V)->vn_ino_lo)
#define VNDISK_SET_INO(V, I) ((V)->vn_ino_lo = (I))
#endif
# 251 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"

#define VVnodeDiskACL(v)     /* Only call this with large (dir) vnode!! */ \
	((AL_AccessList *) (((byte *)(v))+SIZEOF_SMALLDISKVNODE))
#define  VVnodeACL(vnp) (VVnodeDiskACL(&(vnp)->disk))
/* VAclSize is defined this way to allow information in the vnode header
   to grow, in a POSSIBLY upward compatible manner.  SIZEOF_SMALLDISKVNODE
   is the maximum size of the basic vnode.  The vnode header of either type
   can actually grow to this size without conflicting with the ACL on larger
   vnodes */
#define VAclSize(vnp)		(SIZEOF_LARGEDISKVNODE - SIZEOF_SMALLDISKVNODE)
#define VAclDiskSize(v)		(SIZEOF_LARGEDISKVNODE - SIZEOF_SMALLDISKVNODE)
/*extern int VolumeHashOffset(); */
extern int VolumeHashOffset_r(void);
extern int VInitVnodes(VnodeClass class, int nVnodes);
/*extern VInitVnodes_r();*/
extern Vnode *VGetVnode(Error * ec, struct Volume *vp, VnodeId vnodeNumber,
			int locktype);
extern Vnode *VGetVnode_r(Error * ec, struct Volume *vp, VnodeId vnodeNumber,
			  int locktype);
extern void VPutVnode(Error * ec, Vnode * vnp);
extern void VPutVnode_r(Error * ec, Vnode * vnp);
extern int VVnodeWriteToRead(Error * ec, Vnode * vnp);
extern int VVnodeWriteToRead_r(Error * ec, Vnode * vnp);
extern Vnode *VAllocVnode(Error * ec, struct Volume *vp, VnodeType type,
	VnodeId in_vnode, Unique in_unique);
extern Vnode *VAllocVnode_r(Error * ec, struct Volume *vp, VnodeType type,
	VnodeId in_vnode, Unique in_unique);

/*extern VFreeVnode();*/
extern Vnode *VGetFreeVnode_r(struct VnodeClassInfo *vcp, struct Volume *vp,
                              VnodeId vnodeNumber);
extern Vnode *VLookupVnode(struct Volume * vp, VnodeId vnodeId);

extern void AddToVVnList(struct Volume * vp, Vnode * vnp);
extern void DeleteFromVVnList(Vnode * vnp);
extern void AddToVnLRU(struct VnodeClassInfo * vcp, Vnode * vnp);
extern void DeleteFromVnLRU(struct VnodeClassInfo * vcp, Vnode * vnp);
extern void AddToVnHash(Vnode * vnp);
extern void DeleteFromVnHash(Vnode * vnp);

#endif /* _AFS_VOL_VNODE_H */
# 292 "/usr/home/kaduk/openafs/build/include/afs/vnode.h"
# 89 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2
#if 0 /* expanded by -frewrite-includes */
#include <afs/volume.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/volume.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 *
 * Portions Copyright (c) 2006-2008 Sine Nomine Associates
 */

/*
	System:		VICE-TWO
	Module:		volume.h
	Institution:	The Information Technology Center, Carnegie-Mellon University

 */

#ifndef __volume_h
#define	__volume_h  1

#if 0 /* expanded by -frewrite-includes */
#include <afs/afssyscalls.h>
#endif /* expanded by -frewrite-includes */
# 23 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
#if 0 /* expanded by -frewrite-includes */
#include "voldefs.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/voldefs.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*
	System:		VICE-TWO
	Module:		voldefs.h
	Institution:	The Information Technology Center, Carnegie-Mellon University

 */

/* If you add volume types here, be sure to check the definition of
   volumeWriteable in volume.h */

#define readwriteVolume		RWVOL
#define readonlyVolume		ROVOL
#define backupVolume		BACKVOL
#define rwreplicaVolume		RWREPL

#define RWVOL			0
#define ROVOL			1
#define BACKVOL			2
#define RWREPL			3

#define VOLMAXTYPES             4   /* _current_ max number of types */

/* the maximum number of volumes in a volume group that we can handle */
#define VOL_VG_MAX_VOLS 20

/* how many times to retry if we raced the fileserver restarting, when trying
 * to checkout/lock a volume */
#define VOL_MAX_CHECKOUT_RETRIES 10

/* maximum numbe of Vice partitions */
#define	VOLMAXPARTS	255

#define VFORMATDIGITS 10

/* All volumes will have a volume header name in this format */
#if	defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV)
/* Note that <afs/param.h> must have been included before we get here... */
#define	VFORMAT	"V%010" AFS_VOLID_FMT ".vl"	/* Sys5's filename length limitation hits us again */
#define	VHDREXT	".vl"
#else
# 50 "/usr/home/kaduk/openafs/build/include/afs/voldefs.h"
#define VFORMAT "V%010" AFS_VOLID_FMT ".vol"
#define	VHDREXT	".vol"
#endif
# 53 "/usr/home/kaduk/openafs/build/include/afs/voldefs.h"
#define	VHDRNAMELEN (VFORMATDIGITS + 1 + sizeof(VHDREXT) - 1) /* must match VFORMAT */
#define VMAXPATHLEN 64		/* Maximum length (including null) of a volume
				 * external path name */

#if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
/* INODEDIR holds all the inodes. Since it's name does not begin with "V"
 * and it's created when the first volume is created, linear directory
 * searches will find the directory early. If only I had needed this before
 * the NT server went beta, it could be used there as well.
 */
#define INODEDIR "AFSIDat"
#define INODEDIRLEN (sizeof(INODEDIR)-1)
#endif
# 66 "/usr/home/kaduk/openafs/build/include/afs/voldefs.h"

/* Pathname for the maximum volume id ever created by this server */
#define MAXVOLIDPATH	"/vice/vol/maxvolid"

/* Pathname for server id definitions--the server id is used to allocate volume numbers */
#define SERVERLISTPATH	"/vice/db/servers"
# 24 "/usr/home/kaduk/openafs/build/include/afs/volume.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "ihandle.h"
#endif /* expanded by -frewrite-includes */
# 25 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
#define VolumeWriteable(vp)		(V_type(vp)==readwriteVolume)
#define VolumeWriteable2(vol)		(vol.type == readwriteVolume)
typedef bit32 FileOffset;	/* Offset in this file */
#define Date afs_uint32
#if 0 /* expanded by -frewrite-includes */
#include "daemon_com.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/daemon_com.h" 1
/*
 * Copyright 2006-2008, Sine Nomine Associates and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef _AFS_VOL_DAEMON_COM_H
#define _AFS_VOL_DAEMON_COM_H 1

/*
 * SYNC protocol constants
 */

/* SYNC protocol command codes
 *
 * command codes 0-65535 are reserved for
 * global SYNC package command codes
 */
#define SYNC_COM_CODE_USER_BASE 65536
#define SYNC_COM_CODE_DECL(code) (SYNC_COM_CODE_USER_BASE+(code))

/**
 * general command codes.
 */
enum SYNCOpCode {
    SYNC_COM_CHANNEL_CLOSE    = 0,      /**< request sync channel shutdown */
    SYNC_OP_CODE_END
};


/* SYNC protocol response codes
 *
 * response codes 0-65535 are reserved for
 * global SYNC package response codes
 */
#define SYNC_RES_CODE_USER_BASE 65536
#define SYNC_RES_CODE_DECL(code) (SYNC_RES_CODE_USER_BASE+(code))

/**
 * general response codes.
 */
enum SYNCReasonCode {
    SYNC_OK                   = 0,  /**< sync call returned ok */
    SYNC_DENIED               = 1,  /**< sync request denied by server */
    SYNC_COM_ERROR            = 2,  /**< sync protocol communicaions error */
    SYNC_BAD_COMMAND          = 3,  /**< sync command code not implemented by server */
    SYNC_FAILED               = 4,  /**< sync server-side procedure failed */
    SYNC_RESPONSE_CODE_END
};

/* SYNC protocol reason codes
 *
 * reason codes 0-65535 are reserved for
 * global SYNC package reason codes
 */
#define SYNC_REASON_CODE_USER_BASE 65536
#define SYNC_REASON_CODE_DECL(code) (SYNC_REASON_CODE_USER_BASE+(code))

/* general reason codes */
#define SYNC_REASON_NONE                 0
#define SYNC_REASON_MALFORMED_PACKET     1   /**< command packet was malformed */
#define SYNC_REASON_NOMEM                2   /**< sync server out of memory */
#define SYNC_REASON_ENCODING_ERROR       3
#define SYNC_REASON_PAYLOAD_TOO_BIG      4   /**< payload too big for response packet buffer */

/* SYNC protocol flags
 *
 * flag bits 0-7 are reserved for
 * global SYNC package flags
 */
#define SYNC_FLAG_CODE_USER_BASE 8
#define SYNC_FLAG_CODE_DECL(code) (1 << (SYNC_FLAG_CODE_USER_BASE+(code)))

/* general flag codes */
#define SYNC_FLAG_CHANNEL_SHUTDOWN   0x1
#define SYNC_FLAG_DAFS_EXTENSIONS    0x2   /* signal that other end of socket is compiled
					    * with demand attach extensions */

/* SYNC protocol response buffers */
#define SYNC_PROTO_MAX_LEN     768  /* maximum size of sync protocol message */

/* use a large type to get proper buffer alignment so we can safely cast the pointer */
#define SYNC_PROTO_BUF_DECL(buf) \
    afs_int64 _##buf##_l[SYNC_PROTO_MAX_LEN/sizeof(afs_int64)]; \
    char * buf = (char *)(_##buf##_l)

#ifdef AFS_LINUX26_ENV
/* Some Linux kernels have a bug where we are not woken up immediately from a
 * select() when data is available. Work around this by having a low select()
 * timeout, so we don't hang in those situations. */
# define SYNC_SELECT_TIMEOUT 10
#else
# 96 "/usr/home/kaduk/openafs/build/include/afs/daemon_com.h"
# define SYNC_SELECT_TIMEOUT 86400
#endif
# 98 "/usr/home/kaduk/openafs/build/include/afs/daemon_com.h"

#ifdef USE_UNIX_SOCKETS
#if 0 /* expanded by -frewrite-includes */
#include <afs/afsutil.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef _AFSUTIL_H_
#define _AFSUTIL_H_

#if 0 /* expanded by -frewrite-includes */
#include <time.h>
#endif /* expanded by -frewrite-includes */
# 14 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"
/* Include afs installation dir retrieval routines */
#if 0 /* expanded by -frewrite-includes */
#include <afs/dirpath.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/dirpath.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 * 
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef _DIRPATH_H
#define _DIRPATH_H

/* Dirpath package: Rationale and Usage
 *
 * With the port of AFS to Windows NT, it becomes necessary to support
 * storing AFS system files (binaries, logs, etc.) in a user-specified
 * installation directory.  This breaks from the traditional notion of
 * all AFS system files being stored under /usr/afs or /usr/vice.
 * In addition, now that OpenAFs supports configure, it is desirable
 * to support the configure options for manipulating directories and
  * setting the compilation prefix.
 * For NT, the core concept is that there is a dynamically determined installation
 * directory that is the prefix to a well-known AFS tree.  The structure
 * of this well-known AFS tree remains unchanged.  For example, AFS server
 * binaries reside in <install dir>/usr/afs/bin, server configuration files
 * reside in <install dir>/usr/afs/etc, etcetera.  This scheme allows the
 * flexibility required by NT.
 * On UNIX, this header file is generated by configure.  Directory
 * paths are substituted in based on options passed to configure.
 * While  the server and client roots are maintained in the dirpath
 * array,  they should never be used by the code as they tend to be 
 * meaningless.
 * Thus file paths can no longer be hard-coded; rather, all file paths are
 * specified via the macros provided by this package.
 *
 * Utilizing a dynamically determined installation directory forces the
 * notion of local versus canonical (wire-format) paths.  A local path is
 * fully qualified (with a syntax determined by the native filesystem type)
 * whereas a canonical path specifies location only within the well-known AFS
 * tree.  Supporting the notion of canonical paths allows the same path to
 * be sent to servers on different machines, having different installation
 * directories, with the desired result.
 *
 * For example, 'bos create <mach> kaserver simple /usr/afs/bin/kasever' will
 * work both on a Unix machine, where the kaserver executable actually resides
 * in /usr/afs/bin, and on a NT machine, where the kaserver may reside in
 * C:/Program Files/Transarc/AFS Server/usr/afs/bin.
 *
 * Conversion functions are provided that translate canonical (wire-format)
 * paths to fully qualified local paths; see the documentation in dirpath.c
 * for details.  Note that these conversion functions also try to 
 * accomodate fully qualified paths on the wire, for exceptional 
 * cases where this feature may be required.    Unfortunately there is 
 * no way to distinguish between canonical and fully qualified paths
 * so if for example /usr/afs/bin is both a valid canonical and local 
 * path and they do not both map to the same place, then the canonical
 * path  is used.
 *
 * The path macros provided here are divided into local (AFSDIR_*) and
 * canonical (AFSDIR_CANONICAL_*).  The canonical macros MUST be used by
 * commands that send a non-user-specified path to a server (i.e., over
 * the wire).  The local macros MUST be used in all other cases.
 */



#if 0 /* expanded by -frewrite-includes */
#include <afs/param.h>
#endif /* expanded by -frewrite-includes */
# 68 "/usr/home/kaduk/openafs/build/include/afs/dirpath.h"

#ifdef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
#include <windef.h>
#endif /* expanded by -frewrite-includes */
# 71 "/usr/home/kaduk/openafs/build/include/afs/dirpath.h"
#endif
# 72 "/usr/home/kaduk/openafs/build/include/afs/dirpath.h"
#if 0 /* expanded by -frewrite-includes */
#include <limits.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/limits.h" 1 3 4
/*-
 * Copyright (c) 1988, 1993
 *	The Regents of the University of California.  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.
 * 3. 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.
 *
 *	@(#)limits.h	8.2 (Berkeley) 1/4/94
 * $FreeBSD: head/include/limits.h 219271 2011-03-04 19:28:27Z jilles $
 */

#ifndef _LIMITS_H_
#define	_LIMITS_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/limits.h" 3 4

#if __POSIX_VISIBLE
#define	_POSIX_ARG_MAX		4096
#define	_POSIX_LINK_MAX		8
#define	_POSIX_MAX_CANON	255
#define	_POSIX_MAX_INPUT	255
#define	_POSIX_NAME_MAX		14
#define	_POSIX_PIPE_BUF		512
#define	_POSIX_SSIZE_MAX	32767
#define	_POSIX_STREAM_MAX	8

#if __POSIX_VISIBLE >= 200112
#define	_POSIX_CHILD_MAX	25
#define	_POSIX_NGROUPS_MAX	8
#define	_POSIX_OPEN_MAX		20
#define	_POSIX_PATH_MAX		256
#define	_POSIX_TZNAME_MAX	6
#else
# 55 "/usr/include/limits.h" 3 4
#define	_POSIX_CHILD_MAX	6
#define	_POSIX_NGROUPS_MAX	0
#define	_POSIX_OPEN_MAX		16
#define	_POSIX_PATH_MAX		255
#define	_POSIX_TZNAME_MAX	3
#endif
# 61 "/usr/include/limits.h" 3 4

#define	BC_BASE_MAX		   99	/* max ibase/obase values in bc(1) */
#define	BC_DIM_MAX		 2048	/* max array elements in bc(1) */
#define	BC_SCALE_MAX		   99	/* max scale value in bc(1) */
#define	BC_STRING_MAX		 1000	/* max const string length in bc(1) */
#define	COLL_WEIGHTS_MAX	    0	/* max weights for order keyword */
#define	EXPR_NEST_MAX		   32	/* max expressions nested in expr(1) */
#define	LINE_MAX		 2048	/* max bytes in an input line */
#define	RE_DUP_MAX		  255	/* max RE's in interval notation */

#define	_POSIX2_BC_BASE_MAX	99
#define	_POSIX2_BC_DIM_MAX	2048
#define	_POSIX2_BC_SCALE_MAX	99
#define	_POSIX2_BC_STRING_MAX	1000
#define	_POSIX2_EQUIV_CLASS_MAX	2
#define	_POSIX2_EXPR_NEST_MAX	32
#define	_POSIX2_LINE_MAX	2048
#define	_POSIX2_RE_DUP_MAX	255
#endif
# 80 "/usr/include/limits.h" 3 4

#if __POSIX_VISIBLE >= 199309
#define	_POSIX_AIO_LISTIO_MAX	2
#define	_POSIX_AIO_MAX		1
#define	_POSIX_DELAYTIMER_MAX	32
#define	_POSIX_MQ_OPEN_MAX	8
#define	_POSIX_MQ_PRIO_MAX	32
#define	_POSIX_RTSIG_MAX	8
#define	_POSIX_SEM_NSEMS_MAX	256
#define	_POSIX_SEM_VALUE_MAX	32767
#define	_POSIX_SIGQUEUE_MAX	32
#define	_POSIX_TIMER_MAX	32

#define	_POSIX_CLOCKRES_MIN	20000000
#endif
# 95 "/usr/include/limits.h" 3 4

#if __POSIX_VISIBLE >= 199506
#define	_POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
#define	_POSIX_THREAD_KEYS_MAX	128
#define	_POSIX_THREAD_THREADS_MAX 64
#endif
# 101 "/usr/include/limits.h" 3 4

#if __POSIX_VISIBLE >= 200112
#define	_POSIX_HOST_NAME_MAX	255
#define	_POSIX_LOGIN_NAME_MAX	9
#define	_POSIX_SS_REPL_MAX	4
#define	_POSIX_SYMLINK_MAX	255
#define	_POSIX_SYMLOOP_MAX	8
#define	_POSIX_TRACE_EVENT_NAME_MAX 30
#define	_POSIX_TRACE_NAME_MAX	8
#define	_POSIX_TRACE_SYS_MAX	8
#define	_POSIX_TRACE_USER_EVENT_MAX 32
#define	_POSIX_TTY_NAME_MAX	9
#define	_POSIX2_CHARCLASS_NAME_MAX 14
#define	_POSIX2_COLL_WEIGHTS_MAX 2

#define	_POSIX_RE_DUP_MAX	_POSIX2_RE_DUP_MAX
#endif
# 118 "/usr/include/limits.h" 3 4

#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
#define	NL_ARGMAX		99	/* max # of position args for printf */
#define	NL_MSGMAX		32767
#define	NL_SETMAX		255
#define	NL_TEXTMAX		2048
#endif
# 125 "/usr/include/limits.h" 3 4

#if __XSI_VISIBLE
#define	_XOPEN_IOV_MAX		16
#define	_XOPEN_NAME_MAX		255
#define	_XOPEN_PATH_MAX		1024
#define	PASS_MAX		128	/* _PASSWORD_LEN from <pwd.h> */

#define	NL_LANGMAX		31	/* max LANG name length */
#define	NL_NMAX			1
#endif
# 135 "/usr/include/limits.h" 3 4

#define	MB_LEN_MAX		6	/* 31-bit UTF-8 */

#if 0 /* expanded by -frewrite-includes */
#include <sys/limits.h>
#endif /* expanded by -frewrite-includes */
# 139 "/usr/include/limits.h" 3 4

#if __POSIX_VISIBLE
#if 0 /* expanded by -frewrite-includes */
#include <sys/syslimits.h>
#endif /* expanded by -frewrite-includes */
# 142 "/usr/include/limits.h" 3 4
#endif
# 143 "/usr/include/limits.h" 3 4

#endif /* !_LIMITS_H_ */
# 145 "/usr/include/limits.h" 3 4
# 73 "/usr/home/kaduk/openafs/build/include/afs/dirpath.h" 2

/* Max dir path size for afs install dirs */
#ifdef AFS_NT40_ENV
#define AFSDIR_PATH_MAX MAX_PATH
#else /* unices */
# 78 "/usr/home/kaduk/openafs/build/include/afs/dirpath.h"
#define AFSDIR_PATH_MAX    _POSIX_PATH_MAX
#endif
# 80 "/usr/home/kaduk/openafs/build/include/afs/dirpath.h"
 

/* ---------------------  Exported functions ---------------------- */


#define AFSDIR_CLIENT_PATHS_OK 0x1   /* client paths initialized correctly */
#define AFSDIR_SERVER_PATHS_OK 0x2   /* server paths initialized correctly */
extern unsigned int initAFSDirPath(void);

extern int
ConstructLocalPath(const char *cpath,
		   const char *relativeTo,
		   char **fullPathBufp);
extern int
ConstructLocalBinPath(const char *cpath,
		      char **fullPathBufp);
extern int
ConstructLocalLogPath(const char *cpath,
		      char **fullPathBufp);



/* -----------------  Directory/file name macros ------------------ */

/* afs installation dir names */
#define AFSDIR_SERVER_ETC_DIR   "/opt/etc/openafs/server"
#define AFSDIR_CLIENT_ETC_DIR "/opt/etc/openafs/"
#define AFSDIR_SERVER_BIN_DIR   "/opt/libexec/openafs"
#define AFSDIR_CORES_DIR "cores"
#define AFSDIR_DB_DIR    "/opt/var/openafs/db"
#define AFSDIR_LOGS_DIR  "/opt/var/openafs/logs"
#define AFSDIR_LOCAL_DIR "/opt/var/openafs"
#define AFSDIR_BACKUP_DIR "/opt/var/openafs/backup"
#define AFSDIR_MIGR_DIR  "/opt/var/openafs/migrate"
#define AFSDIR_BIN_FILE_DIR  "/opt/var/openafs/migrate/bin_files"
#define AFSDIR_BOSCONFIG_DIR "/opt/etc/openafs"
#define AFSDIR_BOSSERVER_DIR "/opt/sbin"
#define AFSDIR_DATA_DIR      "/opt/share/openafs"

/* file names */ 
#define AFSDIR_THISCELL_FILE    "ThisCell"
#define AFSDIR_CELLSERVDB_FILE  "CellServDB"
#define AFSDIR_CELLALIAS_FILE   "CellAlias"
#define AFSDIR_KEY_FILE         "KeyFile"
#define AFSDIR_EXT_KEY_FILE	"KeyFileExt"
#define AFSDIR_ULIST_FILE       "UserList"
#define AFSDIR_NOAUTH_FILE      "NoAuth"
#define AFSDIR_BUDBLOG_FILE     "BackupLog"
#define AFSDIR_TAPECONFIG_FILE  "tapeconfig"
#define AFSDIR_KALOGDB_FILE    	"AuthLog"
#define AFSDIR_KALOG_FILE       "AuthLog"
#define AFSDIR_KADB_FILE        "kaserver"
#define AFSDIR_NTPD_FILE        "ntpd"
#define AFSDIR_PRDB_FILE        "prdb"
#define AFSDIR_PTLOG_FILE       "PtLog"
#define AFSDIR_KCONF_FILE       "krb.conf"
#define AFSDIR_VLDB_FILE        "vldb"
#define AFSDIR_VLOG_FILE        "VLLog"
#define AFSDIR_CORE_FILE        "core"
#define AFSDIR_SLVGLOG_FILE     "SalvageLog"
#define AFSDIR_SALSRVLOG_FILE   "SalsrvLog"
#define AFSDIR_SALVAGER_FILE    "salvager"
#define AFSDIR_SALSRV_FILE      "salvageserver"
#define AFSDIR_SLVGLOCK_FILE    "salvage.lock"
#define AFSDIR_BOZCONF_FILE     "BosConfig"
#define AFSDIR_BOZCONFNEW_FILE  "BosConfig.new"
#define AFSDIR_BOZINIT_FILE     "BozoInit"
#define AFSDIR_BOZLOG_FILE      "BosLog"
#define AFSDIR_BOZRXBIND_FILE   "bosserver.rxbind"
#define AFSDIR_BOSVR_FILE       "bosserver"
#define AFSDIR_VOLSERLOG_FILE   "VolserLog"
#define AFSDIR_AUDIT_FILE       "Audit"
#define AFSDIR_KRB_EXCL_FILE    "krb.excl"

#define AFSDIR_ROOTVOL_FILE     "RootVolume"
#define AFSDIR_HOSTDUMP_FILE    "hosts.dump"
#define AFSDIR_CLNTDUMP_FILE    "client.dump"
#define AFSDIR_CBKDUMP_FILE     "callback.dump"
#define AFSDIR_OLDSYSID_FILE    "sysid.old"
#define AFSDIR_SYSID_FILE       "sysid"
#define AFSDIR_FILELOG_FILE     "FileLog"
#define AFSDIR_MIGRATE_LOGNAME  "wtlog."

#define AFSDIR_FSSTATE_FILE     "fsstate.dat"

#define AFSDIR_CELLSERVDB_FILE_NTCLIENT  "afsdcell.ini"
#define AFSDIR_CLIENT_CONFIG_FILE  "openafs-client.conf"
#define AFSDIR_SERVER_CONFIG_FILE  "openafs-server.conf"

#define AFSDIR_NETINFO_FILE     "NetInfo"
#define AFSDIR_NETRESTRICT_FILE "NetRestrict"

#define AFSDIR_LOCALRESIDENCY_FILE "LocalResidency"
#define AFSDIR_WEIGHTINGCONST_FILE "Weight.LocalConstants"
#define AFSDIR_THRESHOLDCONST_FILE "Thershold.LocalConstants"

/* -------------- Canonical (wire-format) path macros -------------- */

/* Each of the following is a canonical form of the corresponding
 * local (AFSDIR_*) path macro.
 */

#define AFSDIR_CANONICAL_USR_DIRPATH            "/usr"
#define AFSDIR_CANONICAL_SERVER_AFS_DIRPATH     "/usr/afs"
#define AFSDIR_CANONICAL_CLIENT_VICE_DIRPATH    "/usr/vice"
#ifdef AFS_DARWIN_ENV
#define AFSDIR_ALTERNATE_CLIENT_VICE_DIRPATH    "/var/db/openafs"
#define AFSDIR_ALTERNATE_CLIENT_ETC_DIR         "/var/db/openafs/etc"
#define AFSDIR_ALTERNATE_CLIENT_DATA_DIR         "/var/db/openafs/etc"
#endif
# 190 "/usr/home/kaduk/openafs/build/include/afs/dirpath.h"

#define AFSDIR_CANONICAL_SERVER_BIN_DIRPATH \
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/bin"

#define AFSDIR_CANONICAL_SERVER_ETC_DIRPATH \
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/etc"

#define AFSDIR_CANONICAL_SERVER_LOGS_DIRPATH \
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/logs"

#define AFSDIR_CANONICAL_SERVER_LOCAL_DIRPATH \
AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/local"


#define AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH \
AFSDIR_CANONICAL_SERVER_BIN_DIRPATH "/" AFSDIR_SALVAGER_FILE

#define AFSDIR_CANONICAL_SERVER_SALSRV_FILEPATH \
AFSDIR_CANONICAL_SERVER_BIN_DIRPATH "/" AFSDIR_SALSRV_FILE

#define AFSDIR_CANONICAL_SERVER_SLVGLOG_FILEPATH \
AFSDIR_CANONICAL_SERVER_LOGS_DIRPATH "/" AFSDIR_SLVGLOG_FILE

#define AFSDIR_CANONICAL_SERVER_SALSRVLOG_FILEPATH \
AFSDIR_CANONICAL_SERVER_LOGS_DIRPATH "/" AFSDIR_SALSRVLOG_FILE


/* ---------------------  Local path macros ---------------------- */

/* Note: On NT, these should be used only after calling initAFSDirPath().
 *       On Unix, the paths are implicitly initialized.
 */

/* enums for indexes into the pathname array */
typedef enum afsdir_id { 
      AFSDIR_USR_DIRPATH_ID,
      AFSDIR_SERVER_AFS_DIRPATH_ID,
      AFSDIR_SERVER_ETC_DIRPATH_ID,
      AFSDIR_SERVER_BIN_DIRPATH_ID,
      AFSDIR_SERVER_CORES_DIRPATH_ID,
      AFSDIR_SERVER_DB_DIRPATH_ID,
      AFSDIR_SERVER_LOGS_DIRPATH_ID,
      AFSDIR_SERVER_LOCAL_DIRPATH_ID,
      AFSDIR_SERVER_BACKUP_DIRPATH_ID,
      AFSDIR_CLIENT_VICE_DIRPATH_ID,
      AFSDIR_CLIENT_ETC_DIRPATH_ID,
      AFSDIR_CLIENT_DATA_DIRPATH_ID,
      AFSDIR_SERVER_THISCELL_FILEPATH_ID,
      AFSDIR_SERVER_CELLSERVDB_FILEPATH_ID,
      AFSDIR_SERVER_NOAUTH_FILEPATH_ID,
      AFSDIR_SERVER_KEY_FILEPATH_ID,
      AFSDIR_SERVER_ULIST_FILEPATH_ID,
      AFSDIR_SERVER_BUDBLOG_FILEPATH_ID,
      AFSDIR_SERVER_TAPECONFIG_FILEPATH_ID,
      AFSDIR_SERVER_KALOGDB_FILEPATH_ID,
      AFSDIR_SERVER_KALOG_FILEPATH_ID,
      AFSDIR_SERVER_KADB_FILEPATH_ID,
      AFSDIR_SERVER_NTPD_FILEPATH_ID,
      AFSDIR_SERVER_PRDB_FILEPATH_ID,
      AFSDIR_SERVER_PTLOG_FILEPATH_ID,
      AFSDIR_SERVER_KCONF_FILEPATH_ID,
      AFSDIR_SERVER_VLDB_FILEPATH_ID,
      AFSDIR_SERVER_VLOG_FILEPATH_ID,
      AFSDIR_SERVER_CORELOG_FILEPATH_ID,
      AFSDIR_SERVER_SLVGLOG_FILEPATH_ID,
      AFSDIR_SERVER_SALVAGER_FILEPATH_ID,
      AFSDIR_SERVER_BOZCONF_FILEPATH_ID,
      AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID,
      AFSDIR_SERVER_BOZINIT_FILEPATH_ID,
      AFSDIR_SERVER_BOZLOG_FILEPATH_ID,
      AFSDIR_SERVER_BOZRXBIND_FILEPATH_ID,
      AFSDIR_SERVER_BOSVR_FILEPATH_ID,
      AFSDIR_SERVER_SLVGLOCK_FILEPATH_ID,
      AFSDIR_SERVER_VOLSERLOG_FILEPATH_ID,
      AFSDIR_SERVER_ROOTVOL_FILEPATH_ID,
      AFSDIR_SERVER_HOSTDUMP_FILEPATH_ID,
      AFSDIR_SERVER_CLNTDUMP_FILEPATH_ID,
      AFSDIR_SERVER_CBKDUMP_FILEPATH_ID,
      AFSDIR_SERVER_OLDSYSID_FILEPATH_ID,
      AFSDIR_SERVER_SYSID_FILEPATH_ID,
      AFSDIR_SERVER_FILELOG_FILEPATH_ID,
      AFSDIR_SERVER_AUDIT_FILEPATH_ID,
      AFSDIR_CLIENT_THISCELL_FILEPATH_ID,
      AFSDIR_CLIENT_CELLSERVDB_FILEPATH_ID,
      AFSDIR_CLIENT_NETINFO_FILEPATH_ID,
      AFSDIR_CLIENT_NETRESTRICT_FILEPATH_ID,
      AFSDIR_SERVER_NETINFO_FILEPATH_ID,
      AFSDIR_SERVER_NETRESTRICT_FILEPATH_ID,
      AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH_ID,
      AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH_ID,
      AFSDIR_SERVER_MIGRATE_DIRPATH_ID,
      AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID,
      AFSDIR_SERVER_BIN_FILE_DIRPATH_ID,
      AFSDIR_CLIENT_CELLALIAS_FILEPATH_ID,
      AFSDIR_SERVER_KRB_EXCL_FILEPATH_ID,
      AFSDIR_SERVER_SALSRV_FILEPATH_ID,
      AFSDIR_SERVER_SALSRVLOG_FILEPATH_ID,
      AFSDIR_SERVER_FSSTATE_FILEPATH_ID,
      AFSDIR_CLIENT_CONFIG_FILE_FILEPATH_ID,
      AFSDIR_SERVER_CONFIG_FILE_FILEPATH_ID,
      AFSDIR_PATHSTRING_MAX } afsdir_id_t;

/* getDirPath() returns a pointer to a string from an internal array of path strings 
 */
const char *getDirPath(afsdir_id_t string_id);

/* Top level usr dir */
#define AFSDIR_USR_DIRPATH getDirPath(AFSDIR_USR_DIRPATH_ID)

/* server subdir paths */
#define AFSDIR_SERVER_AFS_DIRPATH getDirPath(AFSDIR_SERVER_AFS_DIRPATH_ID)
#define AFSDIR_SERVER_ETC_DIRPATH getDirPath(AFSDIR_SERVER_ETC_DIRPATH_ID)
#define AFSDIR_SERVER_BIN_DIRPATH getDirPath(AFSDIR_SERVER_BIN_DIRPATH_ID)
#define AFSDIR_SERVER_CORES_DIRPATH getDirPath(AFSDIR_SERVER_CORES_DIRPATH_ID)
#define AFSDIR_SERVER_DB_DIRPATH getDirPath(AFSDIR_SERVER_DB_DIRPATH_ID)
#define AFSDIR_SERVER_LOGS_DIRPATH getDirPath(AFSDIR_SERVER_LOGS_DIRPATH_ID)
#define AFSDIR_SERVER_LOCAL_DIRPATH getDirPath(AFSDIR_SERVER_LOCAL_DIRPATH_ID)
#define AFSDIR_SERVER_BACKUP_DIRPATH getDirPath(AFSDIR_SERVER_BACKUP_DIRPATH_ID)
#define AFSDIR_SERVER_LOCAL_DIRPATH getDirPath(AFSDIR_SERVER_LOCAL_DIRPATH_ID)
#define AFSDIR_SERVER_MIGRATE_DIRPATH getDirPath(AFSDIR_SERVER_MIGRATE_DIRPATH_ID)
#define AFSDIR_SERVER_MIGRATE_DIRPATH getDirPath(AFSDIR_SERVER_MIGRATE_DIRPATH_ID)

/* client subdir paths */
#define AFSDIR_CLIENT_VICE_DIRPATH getDirPath(AFSDIR_CLIENT_VICE_DIRPATH_ID)
#define AFSDIR_CLIENT_ETC_DIRPATH getDirPath(AFSDIR_CLIENT_ETC_DIRPATH_ID)
#define AFSDIR_CLIENT_DATA_DIRPATH getDirPath(AFSDIR_CLIENT_DATA_DIRPATH_ID)
#define AFSDIR_SERVER_BIN_FILE_DIRPATH getDirPath(AFSDIR_SERVER_BIN_FILE_DIRPATH_ID)

/* server file paths */
#define AFSDIR_SERVER_THISCELL_FILEPATH getDirPath(AFSDIR_SERVER_THISCELL_FILEPATH_ID)
#define AFSDIR_SERVER_CELLSERVDB_FILEPATH getDirPath(AFSDIR_SERVER_CELLSERVDB_FILEPATH_ID)
#define AFSDIR_SERVER_NOAUTH_FILEPATH getDirPath(AFSDIR_SERVER_NOAUTH_FILEPATH_ID)
#define AFSDIR_SERVER_KEY_FILEPATH getDirPath(AFSDIR_SERVER_KEY_FILEPATH_ID)
#define AFSDIR_SERVER_ULIST_FILEPATH getDirPath(AFSDIR_SERVER_ULIST_FILEPATH_ID)
#define AFSDIR_SERVER_BUDBLOG_FILEPATH getDirPath(AFSDIR_SERVER_BUDBLOG_FILEPATH_ID)
#define AFSDIR_SERVER_TAPECONFIG_FILEPATH getDirPath(AFSDIR_SERVER_TAPECONFIG_FILEPATH_ID)
#define AFSDIR_SERVER_KALOGDB_FILEPATH getDirPath(AFSDIR_SERVER_KALOGDB_FILEPATH_ID)
#define AFSDIR_SERVER_KALOG_FILEPATH getDirPath(AFSDIR_SERVER_KALOG_FILEPATH_ID)
#define AFSDIR_SERVER_KADB_FILEPATH getDirPath(AFSDIR_SERVER_KADB_FILEPATH_ID)
#define AFSDIR_SERVER_NTPD_FILEPATH getDirPath(AFSDIR_SERVER_NTPD_FILEPATH_ID)
#define AFSDIR_SERVER_PRDB_FILEPATH getDirPath(AFSDIR_SERVER_PRDB_FILEPATH_ID)
#define AFSDIR_SERVER_PTLOG_FILEPATH getDirPath(AFSDIR_SERVER_PTLOG_FILEPATH_ID)
#define AFSDIR_SERVER_KCONF_FILEPATH getDirPath(AFSDIR_SERVER_KCONF_FILEPATH_ID)
#define AFSDIR_SERVER_VLDB_FILEPATH getDirPath(AFSDIR_SERVER_VLDB_FILEPATH_ID)
#define AFSDIR_SERVER_VLOG_FILEPATH getDirPath(AFSDIR_SERVER_VLOG_FILEPATH_ID)
#define AFSDIR_SERVER_CORELOG_FILEPATH getDirPath(AFSDIR_SERVER_CORELOG_FILEPATH_ID)
#define AFSDIR_SERVER_SLVGLOG_FILEPATH getDirPath(AFSDIR_SERVER_SLVGLOG_FILEPATH_ID)
#define AFSDIR_SERVER_SALSRVLOG_FILEPATH getDirPath(AFSDIR_SERVER_SALSRVLOG_FILEPATH_ID)
#define AFSDIR_SERVER_SALVAGER_FILEPATH getDirPath(AFSDIR_SERVER_SALVAGER_FILEPATH_ID)
#define AFSDIR_SERVER_SALSRV_FILEPATH getDirPath(AFSDIR_SERVER_SALSRV_FILEPATH_ID)
#define AFSDIR_SERVER_BOZCONF_FILEPATH getDirPath(AFSDIR_SERVER_BOZCONF_FILEPATH_ID)
#define AFSDIR_SERVER_BOZCONFNEW_FILEPATH getDirPath(AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID)
#define AFSDIR_SERVER_BOZINIT_FILEPATH getDirPath(AFSDIR_SERVER_BOZINIT_FILEPATH_ID)
#define AFSDIR_SERVER_BOZLOG_FILEPATH getDirPath(AFSDIR_SERVER_BOZLOG_FILEPATH_ID)
#define AFSDIR_SERVER_BOZRXBIND_FILEPATH getDirPath(AFSDIR_SERVER_BOZRXBIND_FILEPATH_ID)
#define AFSDIR_SERVER_BOSVR_FILEPATH getDirPath(AFSDIR_SERVER_BOSVR_FILEPATH_ID)
#define AFSDIR_SERVER_SLVGLOCK_FILEPATH getDirPath(AFSDIR_SERVER_SLVGLOCK_FILEPATH_ID)
#define AFSDIR_SERVER_VOLSERLOG_FILEPATH getDirPath(AFSDIR_SERVER_VOLSERLOG_FILEPATH_ID)
#define AFSDIR_SERVER_ROOTVOL_FILEPATH getDirPath(AFSDIR_SERVER_ROOTVOL_FILEPATH_ID)
#define AFSDIR_SERVER_HOSTDUMP_FILEPATH getDirPath(AFSDIR_SERVER_HOSTDUMP_FILEPATH_ID)
#define AFSDIR_SERVER_CLNTDUMP_FILEPATH getDirPath(AFSDIR_SERVER_CLNTDUMP_FILEPATH_ID)
#define AFSDIR_SERVER_CBKDUMP_FILEPATH getDirPath(AFSDIR_SERVER_CBKDUMP_FILEPATH_ID)
#define AFSDIR_SERVER_OLDSYSID_FILEPATH getDirPath(AFSDIR_SERVER_OLDSYSID_FILEPATH_ID)
#define AFSDIR_SERVER_SYSID_FILEPATH getDirPath(AFSDIR_SERVER_SYSID_FILEPATH_ID)
#define AFSDIR_SERVER_FILELOG_FILEPATH getDirPath(AFSDIR_SERVER_FILELOG_FILEPATH_ID)
#define AFSDIR_SERVER_AUDIT_FILEPATH getDirPath(AFSDIR_SERVER_AUDIT_FILEPATH_ID)
#define AFSDIR_SERVER_NETINFO_FILEPATH getDirPath(AFSDIR_SERVER_NETINFO_FILEPATH_ID)
#define AFSDIR_SERVER_NETRESTRICT_FILEPATH getDirPath(AFSDIR_SERVER_NETRESTRICT_FILEPATH_ID)
#define AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH_ID)
#define AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH_ID)
#define AFSDIR_SERVER_MIGRATELOG_FILEPATH getDirPath(AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID)
#define AFSDIR_SERVER_KRB_EXCL_FILEPATH getDirPath(AFSDIR_SERVER_KRB_EXCL_FILEPATH_ID)
#define AFSDIR_SERVER_FSSTATE_FILEPATH getDirPath(AFSDIR_SERVER_FSSTATE_FILEPATH_ID)
#define AFSDIR_SERVER_CONFIG_FILE_FILEPATH getDirPath(AFSDIR_SERVER_CONFIG_FILE_FILEPATH_ID)

/* client file paths */
#define AFSDIR_CLIENT_CONFIG_FILE_FILEPATH getDirPath(AFSDIR_CLIENT_CONFIG_FILE_FILEPATH_ID)
#define AFSDIR_CLIENT_THISCELL_FILEPATH getDirPath(AFSDIR_CLIENT_THISCELL_FILEPATH_ID)
#define AFSDIR_CLIENT_CELLSERVDB_FILEPATH getDirPath(AFSDIR_CLIENT_CELLSERVDB_FILEPATH_ID)  
#define AFSDIR_CLIENT_CELLALIAS_FILEPATH getDirPath(AFSDIR_CLIENT_CELLALIAS_FILEPATH_ID)  
#define AFSDIR_CLIENT_NETINFO_FILEPATH getDirPath(AFSDIR_CLIENT_NETINFO_FILEPATH_ID)
#define AFSDIR_CLIENT_NETRESTRICT_FILEPATH getDirPath(AFSDIR_CLIENT_NETRESTRICT_FILEPATH_ID)

#endif /* _DIRPATH_H */
# 374 "/usr/home/kaduk/openafs/build/include/afs/dirpath.h"
# 16 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h" 2

/* These macros are return values from extractAddr. They do not represent
 * any valid IP address and so can indicate a failure.
 */
#define	AFS_IPINVALID 		0xffffffff	/* invalid IP address */
#define AFS_IPINVALIDIGNORE	0xfffffffe	/* no input given to extractAddr */

/* logging defines
 */
#ifndef AFS_NT40_ENV
#if 0 /* expanded by -frewrite-includes */
#include <sys/types.h>
#endif /* expanded by -frewrite-includes */
# 27 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"
#if 0 /* expanded by -frewrite-includes */
#include <sys/socket.h>
#endif /* expanded by -frewrite-includes */
# 28 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"
#if 0 /* expanded by -frewrite-includes */
#include <netinet/in.h>
#endif /* expanded by -frewrite-includes */
# 29 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"
#if 0 /* expanded by -frewrite-includes */
#include <arpa/inet.h> /* for inet_ntoa() */
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/arpa/inet.h" 1 3 4
/*
 * ++Copyright++ 1983, 1993
 * -
 * Copyright (c) 1983, 1993
 *    The Regents of the University of California.  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.
 * 3. 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.
 * -
 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
 * 
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies, and that
 * the name of Digital Equipment Corporation not be used in advertising or
 * publicity pertaining to distribution of the document or software without
 * specific, written prior permission.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 * SOFTWARE.
 * -
 * --Copyright--
 */

/*%
 *	@(#)inet.h	8.1 (Berkeley) 6/2/93
 *	$Id: inet.h,v 1.2.18.1 2005/04/27 05:00:50 sra Exp $
 * $FreeBSD: head/include/arpa/inet.h 209715 2010-07-06 03:48:46Z maxim $
 */

#ifndef _ARPA_INET_H_
#define	_ARPA_INET_H_

/* External definitions for functions in inet(3). */

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 64 "/usr/include/arpa/inet.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 65 "/usr/include/arpa/inet.h" 3 4

/* Required for byteorder(3) functions. */
#if 0 /* expanded by -frewrite-includes */
#include <machine/endian.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/machine/endian.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/endian.h 232266 2012-02-28 19:39:54Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/endian.h>
#endif /* expanded by -frewrite-includes */
# 7 "/usr/include/machine/endian.h" 3 4
# 68 "/usr/include/arpa/inet.h" 2 3 4

#define	INET_ADDRSTRLEN		16
#define	INET6_ADDRSTRLEN	46

#ifndef _UINT16_T_DECLARED
typedef	__uint16_t	uint16_t;
#define	_UINT16_T_DECLARED
#endif
# 76 "/usr/include/arpa/inet.h" 3 4

#ifndef _UINT32_T_DECLARED
typedef	__uint32_t	uint32_t;
#define	_UINT32_T_DECLARED
#endif
# 81 "/usr/include/arpa/inet.h" 3 4

#ifndef _IN_ADDR_T_DECLARED
typedef	uint32_t	in_addr_t;
#define	_IN_ADDR_T_DECLARED
#endif
# 86 "/usr/include/arpa/inet.h" 3 4

#ifndef _IN_PORT_T_DECLARED
typedef	uint16_t	in_port_t;
#define	_IN_PORT_T_DECLARED
#endif
# 91 "/usr/include/arpa/inet.h" 3 4

#if __BSD_VISIBLE
#ifndef _SIZE_T_DECLARED
typedef	__size_t	size_t;
#define	_SIZE_T_DECLARED
#endif
# 97 "/usr/include/arpa/inet.h" 3 4
#endif
# 98 "/usr/include/arpa/inet.h" 3 4

/*
 * XXX socklen_t is used by a POSIX.1-2001 interface, but not required by
 * POSIX.1-2001.
 */
#ifndef _SOCKLEN_T_DECLARED
typedef	__socklen_t	socklen_t;
#define	_SOCKLEN_T_DECLARED
#endif
# 107 "/usr/include/arpa/inet.h" 3 4

#ifndef _STRUCT_IN_ADDR_DECLARED
struct in_addr {
	in_addr_t s_addr;
};
#define	_STRUCT_IN_ADDR_DECLARED
#endif
# 114 "/usr/include/arpa/inet.h" 3 4

/* XXX all new diversions!! argh!! */
#if __BSD_VISIBLE
#define	inet_addr		__inet_addr
#define	inet_aton		__inet_aton
#define	inet_lnaof		__inet_lnaof
#define	inet_makeaddr		__inet_makeaddr
#define	inet_neta		__inet_neta
#define	inet_netof		__inet_netof
#define	inet_network		__inet_network
#define	inet_net_ntop		__inet_net_ntop
#define	inet_net_pton		__inet_net_pton
#define	inet_cidr_ntop		__inet_cidr_ntop
#define	inet_cidr_pton		__inet_cidr_pton
#define	inet_ntoa		__inet_ntoa
#define	inet_ntoa_r		__inet_ntoa_r
#define	inet_pton		__inet_pton
#define	inet_ntop		__inet_ntop
#define	inet_nsap_addr		__inet_nsap_addr
#define	inet_nsap_ntoa		__inet_nsap_ntoa
#endif /* __BSD_VISIBLE */
# 135 "/usr/include/arpa/inet.h" 3 4

__BEGIN_DECLS
#ifndef _BYTEORDER_PROTOTYPED
#define	_BYTEORDER_PROTOTYPED
uint32_t	 htonl(uint32_t);
uint16_t	 htons(uint16_t);
uint32_t	 ntohl(uint32_t);
uint16_t	 ntohs(uint16_t);
#endif
# 144 "/usr/include/arpa/inet.h" 3 4

in_addr_t	 inet_addr(const char *);
/*const*/ char	*inet_ntoa(struct in_addr);
const char	*inet_ntop(int, const void * __restrict, char * __restrict,
		    socklen_t);
int		 inet_pton(int, const char * __restrict, void * __restrict);

#if __BSD_VISIBLE
int		 inet_aton(const char *, struct in_addr *);
in_addr_t	 inet_lnaof(struct in_addr);
struct in_addr	 inet_makeaddr(in_addr_t, in_addr_t);
char *		 inet_neta(in_addr_t, char *, size_t);
in_addr_t	 inet_netof(struct in_addr);
in_addr_t	 inet_network(const char *);
char		*inet_net_ntop(int, const void *, int, char *, size_t);
int		 inet_net_pton(int, const char *, void *, size_t);
char		*inet_ntoa_r(struct in_addr, char *buf, socklen_t size);
char		*inet_cidr_ntop(int, const void *, int, char *, size_t);
int		 inet_cidr_pton(int, const char *, void *, int *);
unsigned	 inet_nsap_addr(const char *, unsigned char *, int);
char		*inet_nsap_ntoa(int, const unsigned char *, char *);
#endif /* __BSD_VISIBLE */
# 166 "/usr/include/arpa/inet.h" 3 4
__END_DECLS

#ifndef _BYTEORDER_FUNC_DEFINED
#define	_BYTEORDER_FUNC_DEFINED
#define	htonl(x)	__htonl(x)
#define	htons(x)	__htons(x)
#define	ntohl(x)	__ntohl(x)
#define	ntohs(x)	__ntohs(x)
#endif
# 175 "/usr/include/arpa/inet.h" 3 4

#endif /* !_ARPA_INET_H_ */
# 177 "/usr/include/arpa/inet.h" 3 4

/*! \file */
# 30 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h" 2
#endif
# 31 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"

#if 0 /* expanded by -frewrite-includes */
#include <stdio.h>
#endif /* expanded by -frewrite-includes */
# 33 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"
#if 0 /* expanded by -frewrite-includes */
#include <stdarg.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/stdarg.h" 1 3 4
/*-
 * This file is in the public domain.
 */
/* $FreeBSD: head/sys/amd64/include/stdarg.h 232276 2012-02-28 22:30:58Z tijl $ */

#if 0 /* expanded by -frewrite-includes */
#include <x86/stdarg.h>
#endif /* expanded by -frewrite-includes */
# 7 "/usr/include/stdarg.h" 3 4
# 34 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <string.h>
#endif /* expanded by -frewrite-includes */
# 35 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"

extern int LogLevel;
extern int mrafsStyleLogs;
#ifndef AFS_NT40_ENV
extern int serverLogSyslog;
extern int serverLogSyslogFacility;
extern char *serverLogSyslogTag;
#endif
# 43 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"
extern void vFSLog(const char *format, va_list args)
	AFS_ATTRIBUTE_FORMAT(__printf__, 1, 0);

extern void SetLogThreadNumProgram(int (*func) (void) );

extern void FSLog(const char *format, ...)
	AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);

#define ViceLog(level, str)  do { if ((level) <= LogLevel) (FSLog str); } while (0)
#define vViceLog(level, str) do { if ((level) <= LogLevel) (vFSLog str); } while (0)
#define ViceLogThenPanic(level, str) \
    do { ViceLog(level, str); osi_Panic str; } while(0);

extern int OpenLog(const char *filename);
extern int ReOpenLog(const char *fileName);
extern void SetupLogSignals(void);

#ifdef AFS_NT40_ENV
#ifndef _MFC_VER
#if 0 /* expanded by -frewrite-includes */
#include <winsock2.h>
#endif /* expanded by -frewrite-includes */
# 63 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"
#endif /* _MFC_VER */
# 64 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"

/* Initialize the windows sockets before calling networking routines. */
     extern int afs_winsockInit(void);
     extern void afs_winsockCleanup(void);

/* Unbuffer output when Un*x would do line buffering. */
#define setlinebuf(S) setvbuf(S, NULL, _IONBF, 0)

#endif /* AFS_NT40_ENV */
# 73 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"

#ifndef HAVE_POSIX_REGEX
extern char *re_comp(const char *sp);
extern int re_exec(const char *p1);
#endif
# 78 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"

     typedef char b32_string_t[8];
/* b64_string_t is 8 bytes, in stds.h */
     typedef char lb64_string_t[12];

#if 0 /* expanded by -frewrite-includes */
#include <afs/ktime.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/ktime.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef __INCL_KTIME_
#define __INCL_KTIME_ 1

#undef min			/* redefined at end of file */
struct ktime_date {
    afs_int32 mask;		/* mask of valid fields */
    short year;
    short month;
    short day;
    short hour;
    short min;
    short sec;
};

/* could we make these bits the same? */

#define KTIMEDATE_YEAR		1
#define KTIMEDATE_MONTH		2
#define KTIMEDATE_DAY		4
#define KTIMEDATE_HOUR		8
#define KTIMEDATE_MIN		0x10
#define KTIMEDATE_SEC		0x20
#define KTIMEDATE_NEVER		0x1000	/* special case for never */
#define KTIMEDATE_NOW		0x2000	/* special case for now */

/* note that this if different from the value used by ParcePeriodic (sigh). */
#define KTIMEDATE_NEVERDATE	0xffffffff

struct ktime {
    int mask;
    short hour;			/* 0 - 23 */
    short min;			/* 0 - 60 */
    short sec;			/* 0 - 60 */
    short day;			/* 0 is sunday */
};

#define	KTIME_HOUR	1	/* hour should match */
#define	KTIME_MIN	2
#define	KTIME_SEC	4
#define	KTIME_TIME	7	/* all times should match */
#define	KTIME_DAY	8	/* day should match */
#define	KTIME_NEVER	0x10	/* special case: never */
#define	KTIME_NOW	0x20	/* special case: right now */

#define	ktime_DateToLong	ktime_DateToInt32	/* XXX */
#define	ktimeRelDate_ToLong	ktimeRelDate_ToInt32	/* XXX */
#define	LongTo_ktimeRelDate     Int32To_ktimeRelDate	/* XXX */

afs_int32 ktime_InterpretDate(struct ktime_date *akdate);

#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif /* __INCL_KTIME_ */
# 62 "/usr/home/kaduk/openafs/build/include/afs/ktime.h"
# 84 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "afsutil_prototypes.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#ifndef	_AFSUTIL_PROTOTYPES_H
#define _AFSUTIL_PROTOTYPES_H

#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
#if 0 /* expanded by -frewrite-includes */
# include <pthread.h>
#endif /* expanded by -frewrite-includes */
# 15 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"
#endif
# 16 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"

/* afs_atomlist.c */


/* afs_lhash.c */

/* base32.c */
extern char *int_to_base32(b32_string_t s, int a);
extern int base32_to_int(char *s);

/* base64.c */
extern char *int_to_base64(b64_string_t s, int a);
extern int base64_to_int(char *s);

/* dirpath.c */
extern unsigned int initAFSDirPath(void);
extern const char *getDirPath(afsdir_id_t string_id);
extern int ConstructLocalPath(const char *cpath, const char *relativeTo,
			      char **fullPathBufp);
extern int ConstructLocalBinPath(const char *cpath, char **fullPathBufp);
extern int ConstructLocalLogPath(const char *cpath, char **fullPathBufp);

/* errmap_nt.c */
extern int nterr_nt2unix(long ntErr, int defaultErr);

/* exec.c */
extern char* afs_exec_alt(int argc, char **argv, const char *prefix,
                          const char *suffix);

/* fileutil.c */
extern void FilepathNormalizeEx(char *path, int slashType);
extern void FilepathNormalize(char *path);

/* flipbase64.c */
extern char *int_to_base32(b32_string_t s, int a);
extern int base32_to_int(char *s);
#if !defined(AFS_NT40_ENV)
/* base 64 converters for namei interface. Flip bits to differences are
 * early in name.
 */
#define int32_to_flipbase64(S, A) int64_to_flipbase64(S, (afs_uint64)(A))
extern char *int64_to_flipbase64(lb64_string_t s, afs_uint64 a);
extern afs_int64 flipbase64_to_int64(char *s);
#endif
# 60 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"

/* hostparse.c */
extern struct hostent *hostutil_GetHostByName(char *ahost);
extern char *hostutil_GetNameByINet(afs_uint32 addr);
extern afs_uint32 extractAddr(char *line, int maxSize);
extern char *afs_inet_ntoa_r(afs_uint32 addr, char *buf);
extern char *gettmpdir(void);

/* hputil.c */
#ifdef AFS_HPUX_ENV
#ifndef AFS_HPUX102_ENV
extern int utimes(char *file, struct timeval tvp[2]);
#endif
# 73 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"
#if !defined(AFS_HPUX110_ENV)
extern int random(void);
extern void srandom(int seed);
#endif
# 77 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"
extern int getdtablesize(void);
extern void setlinebuf(FILE * file);
extern void psignal(unsigned int sig, char *s);
#endif
# 81 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"

/* kreltime.c */
struct ktime;
struct ktime_date;
extern afs_int32 ktimeRelDate_ToInt32(struct ktime_date *kdptr);
extern int Int32To_ktimeRelDate(afs_int32 int32Date,
				struct ktime_date *kdptr);
extern int ktimeDate_FromInt32(afs_int32 timeSecs,
			       struct ktime_date *ktimePtr);
extern afs_int32 ParseRelDate(char *dateStr, struct ktime_date *relDatePtr);
extern char *RelDatetoString(struct ktime_date *datePtr);
extern afs_int32 Add_RelDate_to_Time(struct ktime_date *relDatePtr,
				     afs_int32 atime);

/* ktime.c */
extern char *ktime_DateOf(afs_int32 atime);
extern afs_int32 ktime_Str2int32(char *astr);
extern int ktime_ParsePeriodic(char *adate, struct ktime *ak);
extern int ktime_DisplayString(struct ktime *aparm, char *astring);
extern afs_int32 ktime_next(struct ktime *aktime, afs_int32 afrom);
extern afs_int32 ktime_DateToInt32(char *adate, afs_int32 * aint32);
extern char *ktime_GetDateUsage(void);
extern afs_int32 ktime_InterpretDate(struct ktime_date *akdate);

/* pthread_glock.c */


/* pthread_threadname.c */
#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
extern void afs_pthread_setname_self(const char *threadname);
#else
# 112 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"
/* Allow unconditional references to afs_pthread_setname_self to
 * reduce #ifdef spaghetti.
 */
#define afs_pthread_setname_self(threadname) (void)0
#endif
# 117 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"

/* readdir_nt.c */


/* regex.c */


/* secutil_nt.c */


/* serverLog.c */
extern void WriteLogBuffer(char *buf, afs_uint32 len);
extern void SetDebug_Signal(int signo);
extern void ResetDebug_Signal(int signo);
extern void SetupLogSignals(void);
extern int OpenLog(const char *fileName);
extern int ReOpenLog(const char *fileName);
extern int LogThreadNum(void);
extern void LogCommandLine(int argc, char **argv, const char *progname,
			   const char *version, const char *logstring,
			   void (*log) (const char *format, ...));
extern void LogDesWarning(void);

/* snprintf.c */


/* sys.c */

/* tabular_output.c */
struct util_Table;
extern struct util_Table* util_newTable(int Type, int numColumns,
		char **ColumnHeaders, int *ColumnContentTypes,
		int *ColumnWidths, int sortByColumn);
extern char ** util_newCellContents(struct util_Table*);
extern int util_printTableHeader(struct util_Table *Table);
extern int util_printTableBody(struct util_Table *Table);
extern int util_printTableFooter(struct util_Table *Table);
extern int util_printTable(struct util_Table *Table);
extern int util_addTableBodyRow(struct util_Table *Table, char **Contents);
extern int util_setTableBodyRow(struct util_Table *Table, int RowIndex,
				char **Contents);
extern int util_setTableHeader(struct util_Table *Table, char **Contents);
extern int util_setTableFooter(struct util_Table *Table, char **Contents);
extern int util_freeTable(struct util_Table* Table);

/* uuid.c */
extern afs_int32 afs_uuid_equal(afsUUID * u1, afsUUID * u2);
extern afs_int32 afs_uuid_is_nil(afsUUID * u1);
extern void afs_htonuuid(afsUUID * uuidp);
extern void afs_ntohuuid(afsUUID * uuidp);
extern afs_int32 afs_uuid_create(afsUUID * uuid);
extern u_short afs_uuid_hash(afsUUID * uuid);
#if !defined(KERNEL) && !defined(UKERNEL)
extern int afsUUID_from_string(const char *str, afsUUID * uuid);
extern int afsUUID_to_string(const afsUUID * uuid, char *str, size_t strsz);
#endif
# 173 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"

/* volparse.c */
extern afs_int32 volutil_GetPartitionID(char *aname);
extern char *volutil_PartitionName_r(int avalue, char *tbuffer, int buflen);
extern afs_int32 volutil_PartitionName2_r(afs_int32 part, char *tbuffer, size_t buflen);
extern char *volutil_PartitionName(int avalue);
extern afs_int32 util_GetInt32(char *as, afs_int32 * aval);
extern afs_uint32 util_GetUInt32(char *as, afs_uint32 * aval);
extern afs_int32 util_GetInt64(char *as, afs_int64 * aval);
extern afs_uint32 util_GetUInt64(char *as, afs_uint64 * aval);
extern afs_int32 util_GetHumanInt32(char *as, afs_int32 * aval);

/* winsock_nt.c */


#endif /* _AFSUTIL_PROTOTYPES_H */
# 189 "/usr/home/kaduk/openafs/build/include/afs/afsutil_prototypes.h"
# 85 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h" 2

#endif /* _AFSUTIL_H_ */
# 87 "/usr/home/kaduk/openafs/build/include/afs/afsutil.h"
# 101 "/usr/home/kaduk/openafs/build/include/afs/daemon_com.h" 2
#if 0 /* expanded by -frewrite-includes */
#include <sys/un.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/include/sys/un.h" 1 3 4
/*-
 * Copyright (c) 1982, 1986, 1993
 *	The Regents of the University of California.  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.
 * 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.
 *
 *	@(#)un.h	8.3 (Berkeley) 2/19/95
 * $FreeBSD: head/sys/sys/un.h 246210 2013-02-01 15:32:20Z jhb $
 */

#ifndef _SYS_UN_H_
#define _SYS_UN_H_

#if 0 /* expanded by -frewrite-includes */
#include <sys/cdefs.h>
#endif /* expanded by -frewrite-includes */
# 37 "/usr/include/sys/un.h" 3 4
#if 0 /* expanded by -frewrite-includes */
#include <sys/_types.h>
#endif /* expanded by -frewrite-includes */
# 38 "/usr/include/sys/un.h" 3 4

#ifndef _SA_FAMILY_T_DECLARED
typedef	__sa_family_t	sa_family_t;
#define	_SA_FAMILY_T_DECLARED
#endif
# 43 "/usr/include/sys/un.h" 3 4

/*
 * Definitions for UNIX IPC domain.
 */
struct sockaddr_un {
	unsigned char	sun_len;	/* sockaddr len including null */
	sa_family_t	sun_family;	/* AF_UNIX */
	char	sun_path[104];		/* path name (gag) */
};

#if __BSD_VISIBLE

/* Socket options. */
#define	LOCAL_PEERCRED		1	/* retrieve peer credentials */
#define	LOCAL_CREDS		2	/* pass credentials to receiver */
#define	LOCAL_CONNWAIT		4	/* connects block until accepted */

/* Start of reserved space for third-party socket options. */
#define	LOCAL_VENDOR		SO_VENDOR

#ifndef _KERNEL

/* actual length of an initialized sockaddr_un */
#define SUN_LEN(su) \
	(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))

#endif /* !_KERNEL */
# 70 "/usr/include/sys/un.h" 3 4

#endif /* __BSD_VISIBLE */
# 72 "/usr/include/sys/un.h" 3 4

#endif /* !_SYS_UN_H_ */
# 74 "/usr/include/sys/un.h" 3 4
# 102 "/usr/home/kaduk/openafs/build/include/afs/daemon_com.h" 2
#define SYNC_SOCK_DOMAIN AF_UNIX
typedef struct sockaddr_un SYNC_sockaddr_t;
#else  /* USE_UNIX_SOCKETS */
# 105 "/usr/home/kaduk/openafs/build/include/afs/daemon_com.h"
#define SYNC_SOCK_DOMAIN AF_INET
typedef struct sockaddr_in SYNC_sockaddr_t;
#endif /* USE_UNIX_SOCKETS */
# 108 "/usr/home/kaduk/openafs/build/include/afs/daemon_com.h"

/**
 * sync server endpoint address.
 */
typedef struct SYNC_endpoint {
    int domain;     /**< socket domain */
    afs_uint16 in;  /**< localhost ipv4 tcp port number */
    char * un;      /**< unix domain socket filename (not a full path) */
} SYNC_endpoint_t;

#define SYNC_ENDPOINT_DECL(in_port, un_path) \
    { SYNC_SOCK_DOMAIN, in_port, un_path }


/**
 * SYNC server state structure.
 */
typedef struct SYNC_server_state {
    osi_socket fd;              /**< listening socket descriptor */
    SYNC_endpoint_t endpoint;   /**< server endpoint address */
    afs_uint32 proto_version;   /**< our protocol version */
    int bind_retry_limit;       /**< upper limit on times to retry socket bind() */
    int listen_depth;           /**< socket listen queue depth */
    char * proto_name;          /**< sync protocol associated with this conn */
    SYNC_sockaddr_t addr;       /**< server listen socket sockaddr */
    afs_uint32 pkt_seq;         /**< packet xmit sequence counter */
    afs_uint32 res_seq;         /**< response xmit sequence counter */
} SYNC_server_state_t;

/**
 * SYNC client state structure.
 */
typedef struct SYNC_client_state {
    osi_socket fd;              /**< client socket descriptor */
    SYNC_endpoint_t endpoint;   /**< address of sync server */
    afs_uint32 proto_version;   /**< our protocol version */
    int retry_limit;            /**< max number of times for SYNC_ask to retry */
    afs_int32 hard_timeout;     /**< upper limit on time to keep trying */
    char * proto_name;          /**< sync protocol associated with this conn */
    afs_uint32 pkt_seq;         /**< packet xmit sequence counter */
    afs_uint32 com_seq;         /**< command xmit sequence counter */
} SYNC_client_state;

/* wire types */
/**
 * on-wire command packet header.
 */
typedef struct SYNC_command_hdr {
    afs_uint32 proto_version;   /**< sync protocol version */
    afs_uint32 pkt_seq;         /**< packet sequence number */
    afs_uint32 com_seq;         /**< command sequence number */
    afs_int32 programType;      /**< type of program issuing the request */
    afs_int32 pid;              /**< pid of requestor */
    afs_int32 tid;              /**< thread id of requestor */
    afs_int32 command;          /**< request type */
    afs_int32 reason;           /**< reason for request */
    afs_uint32 command_len;     /**< entire length of command */
    afs_uint32 flags;           /**< miscellanous control flags */
} SYNC_command_hdr;

/**
 * on-wire response packet header.
 */
typedef struct SYNC_response_hdr {
    afs_uint32 proto_version;   /**< sync protocol version */
    afs_uint32 pkt_seq;         /**< packet sequence number */
    afs_uint32 com_seq;         /**< in response to com_seq... */
    afs_uint32 res_seq;         /**< response sequence number */
    afs_uint32 response_len;    /**< entire length of response */
    afs_int32 response;         /**< response code */
    afs_int32 reason;           /**< reason for response */
    afs_uint32 flags;           /**< miscellanous control flags */
} SYNC_response_hdr;


/* user-visible types */
typedef struct SYNC_command {
    SYNC_command_hdr hdr;
    struct {
	afs_uint32 len;
	void * buf;
    } payload;
    afs_int32 recv_len;
} SYNC_command;

typedef struct SYNC_response {
    SYNC_response_hdr hdr;
    struct {
	afs_uint32 len;
	void * buf;
    } payload;
    afs_int32 recv_len;
} SYNC_response;

/* general prototypes */
extern osi_socket SYNC_getSock(SYNC_endpoint_t * endpoint);
extern void SYNC_getAddr(SYNC_endpoint_t * endpoint, SYNC_sockaddr_t * addr);

/* client-side prototypes */
extern afs_int32 SYNC_ask(SYNC_client_state *, SYNC_command * com, SYNC_response * res);
extern int SYNC_connect(SYNC_client_state *);             /* setup the channel */
extern int SYNC_disconnect(SYNC_client_state *);          /* just close the socket */
extern afs_int32 SYNC_closeChannel(SYNC_client_state *);  /* do a graceful channel close */
extern int SYNC_reconnect(SYNC_client_state *);           /* do a reconnect after a protocol error, or from a forked child */

/* server-side prototypes */
extern int SYNC_getCom(SYNC_server_state_t *, osi_socket fd, SYNC_command * com);
extern int SYNC_putRes(SYNC_server_state_t *, osi_socket fd, SYNC_response * res);
extern int SYNC_verifyProtocolString(char * buf, size_t len);
extern void SYNC_cleanupSock(SYNC_server_state_t * state);
extern int SYNC_bindSock(SYNC_server_state_t * state);

#endif /* _AFS_VOL_DAEMON_COM_H */
# 221 "/usr/home/kaduk/openafs/build/include/afs/daemon_com.h"
# 30 "/usr/home/kaduk/openafs/build/include/afs/volume.h" 2
#if 0 /* expanded by -frewrite-includes */
#include "fssync.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/fssync.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 *
 * Portions Copyright (c) 2006-2010 Sine Nomine Associates
 */

/*
	System:		VICE-TWO
	Module:		fssync.h
	Institution:	The Information Technology Center, Carnegie-Mellon University

 */

#ifndef __fssync_h_
#define __fssync_h_

#define FSYNC_PROTO_VERSION     3

#if 0 /* expanded by -frewrite-includes */
#include "voldefs.h"
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/voldefs.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*
	System:		VICE-TWO
	Module:		voldefs.h
	Institution:	The Information Technology Center, Carnegie-Mellon University

 */

/* If you add volume types here, be sure to check the definition of
   volumeWriteable in volume.h */

#define readwriteVolume		RWVOL
#define readonlyVolume		ROVOL
#define backupVolume		BACKVOL
#define rwreplicaVolume		RWREPL

#define RWVOL			0
#define ROVOL			1
#define BACKVOL			2
#define RWREPL			3

#define VOLMAXTYPES             4   /* _current_ max number of types */

/* the maximum number of volumes in a volume group that we can handle */
#define VOL_VG_MAX_VOLS 20

/* how many times to retry if we raced the fileserver restarting, when trying
 * to checkout/lock a volume */
#define VOL_MAX_CHECKOUT_RETRIES 10

/* maximum numbe of Vice partitions */
#define	VOLMAXPARTS	255

#define VFORMATDIGITS 10

/* All volumes will have a volume header name in this format */
#if	defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV)
/* Note that <afs/param.h> must have been included before we get here... */
#define	VFORMAT	"V%010" AFS_VOLID_FMT ".vl"	/* Sys5's filename length limitation hits us again */
#define	VHDREXT	".vl"
#else
# 50 "/usr/home/kaduk/openafs/build/include/afs/voldefs.h"
#define VFORMAT "V%010" AFS_VOLID_FMT ".vol"
#define	VHDREXT	".vol"
#endif
# 53 "/usr/home/kaduk/openafs/build/include/afs/voldefs.h"
#define	VHDRNAMELEN (VFORMATDIGITS + 1 + sizeof(VHDREXT) - 1) /* must match VFORMAT */
#define VMAXPATHLEN 64		/* Maximum length (including null) of a volume
				 * external path name */

#if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
/* INODEDIR holds all the inodes. Since it's name does not begin with "V"
 * and it's created when the first volume is created, linear directory
 * searches will find the directory early. If only I had needed this before
 * the NT server went beta, it could be used there as well.
 */
#define INODEDIR "AFSIDat"
#define INODEDIRLEN (sizeof(INODEDIR)-1)
#endif
# 66 "/usr/home/kaduk/openafs/build/include/afs/voldefs.h"

/* Pathname for the maximum volume id ever created by this server */
#define MAXVOLIDPATH	"/vice/vol/maxvolid"

/* Pathname for server id definitions--the server id is used to allocate volume numbers */
#define SERVERLISTPATH	"/vice/db/servers"
# 25 "/usr/home/kaduk/openafs/build/include/afs/fssync.h" 2

/**
 * FSYNC command codes.
 *
 * If you add more command codes here, be sure to add some documentation
 * in doc/arch/fssync.txt.
 */
enum FSYNCOpCode {
    FSYNC_VOL_ON              = SYNC_COM_CODE_DECL(0),	/**< bring Volume online */
    FSYNC_VOL_OFF             = SYNC_COM_CODE_DECL(1),	/**< take Volume offline */
    FSYNC_VOL_LISTVOLUMES     = SYNC_COM_CODE_DECL(2),	/**< Update local volume list */
    FSYNC_VOL_NEEDVOLUME      = SYNC_COM_CODE_DECL(3),	/**< Put volume in whatever mode (offline, or whatever)
							 *   best fits the attachment mode provided in reason */
    FSYNC_VOL_MOVE            = SYNC_COM_CODE_DECL(4),	/**< Generate temporary relocation information
							 *   for this volume to another site, to be used
							 *   if this volume disappears */
    FSYNC_VOL_BREAKCBKS       = SYNC_COM_CODE_DECL(5),	/**< Break all the callbacks on this volume */
    FSYNC_VOL_DONE            = SYNC_COM_CODE_DECL(6),	/**< Done with this volume (used after a delete).
							 *   Don't put online, but remove from list */
    FSYNC_VOL_QUERY           = SYNC_COM_CODE_DECL(7),  /**< query the volume state */
    FSYNC_VOL_QUERY_HDR       = SYNC_COM_CODE_DECL(8),  /**< query the volume disk data structure */
    FSYNC_VOL_QUERY_VOP       = SYNC_COM_CODE_DECL(9),  /**< query the volume for pending vol op info */
    FSYNC_VOL_STATS_GENERAL   = SYNC_COM_CODE_DECL(10), /**< query the general volume package statistics */
    FSYNC_VOL_STATS_VICEP     = SYNC_COM_CODE_DECL(11), /**< query the per-partition volume package stats */
    FSYNC_VOL_STATS_HASH      = SYNC_COM_CODE_DECL(12), /**< query the per hash-chain volume package stats */
    FSYNC_VOL_STATS_HDR       = SYNC_COM_CODE_DECL(13), /**< query the volume header cache statistics */
    FSYNC_VOL_STATS_VLRU      = SYNC_COM_CODE_DECL(14), /**< query the VLRU statistics */
    FSYNC_VOL_ATTACH          = SYNC_COM_CODE_DECL(15),	/**< Force volume online */
    FSYNC_VOL_FORCE_ERROR     = SYNC_COM_CODE_DECL(16), /**< force volume into error state */
    FSYNC_VOL_LEAVE_OFF       = SYNC_COM_CODE_DECL(17), /**< end vol op, but leave volume offline */
    FSYNC_VOL_QUERY_VNODE     = SYNC_COM_CODE_DECL(18), /**< query vnode state */
    FSYNC_VG_QUERY            = SYNC_COM_CODE_DECL(19), /**< Query volume group membership for a given volume id */
    FSYNC_VG_ADD              = SYNC_COM_CODE_DECL(20), /**< add a volume id to a vg */
    FSYNC_VG_DEL              = SYNC_COM_CODE_DECL(21), /**< delete a volume id from a vg */
    FSYNC_VG_SCAN             = SYNC_COM_CODE_DECL(22), /**< force a re-scan of a given partition */
    FSYNC_VG_SCAN_ALL         = SYNC_COM_CODE_DECL(23), /**< force a re-scan of all vice partitions */
    FSYNC_OP_CODE_END
};

/**
 * FSYNC reason codes.
 */
enum FSYNCReasonCode {
    FSYNC_WHATEVER            = SYNC_REASON_CODE_DECL(0), /**< XXXX */
    FSYNC_SALVAGE             = SYNC_REASON_CODE_DECL(1), /**< volume is being salvaged */
    FSYNC_MOVE                = SYNC_REASON_CODE_DECL(2), /**< volume is being moved */
    FSYNC_OPERATOR            = SYNC_REASON_CODE_DECL(3), /**< operator forced volume offline */
    FSYNC_EXCLUSIVE           = SYNC_REASON_CODE_DECL(4), /**< somebody else has the volume offline */
    FSYNC_UNKNOWN_VOLID       = SYNC_REASON_CODE_DECL(5), /**< volume id not known by fileserver */
    FSYNC_HDR_NOT_ATTACHED    = SYNC_REASON_CODE_DECL(6), /**< volume header not currently attached */
    FSYNC_NO_PENDING_VOL_OP   = SYNC_REASON_CODE_DECL(7), /**< no volume operation pending */
    FSYNC_VOL_PKG_ERROR       = SYNC_REASON_CODE_DECL(8), /**< error in the volume package */
    FSYNC_UNKNOWN_VNID        = SYNC_REASON_CODE_DECL(9), /**< vnode id not known by fileserver */
    FSYNC_WRONG_PART          = SYNC_REASON_CODE_DECL(10),/**< volume attached on different partition */
    FSYNC_BAD_STATE           = SYNC_REASON_CODE_DECL(11),/**< current volume state does not allow this operation */
    FSYNC_BAD_PART            = SYNC_REASON_CODE_DECL(12),/**< invalid disk partition */
    FSYNC_PART_SCANNING       = SYNC_REASON_CODE_DECL(13),/**< partition is busy scanning VGs */
    FSYNC_REASON_CODE_END
};

/* FSYNC response codes */

/* FSYNC flag codes */

struct offlineInfo {
    VolumeId volumeID;
    char partName[16];
};

/**
 * fssync protocol volume operation request message.
 */
typedef struct FSSYNC_VolOp_hdr {
    VolumeId volume;          /**< volume id associated with request */
    char partName[16];		/**< partition name, e.g. /vicepa */
} FSSYNC_VolOp_hdr;

typedef struct FSSYNC_VolOp_command {
    SYNC_command_hdr * hdr;
    FSSYNC_VolOp_hdr * vop;
    SYNC_command * com;
    struct offlineInfo * v;
    struct offlineInfo * volumes;
} FSSYNC_VolOp_command;


/**
 * volume operation processing state.
 */
enum FSSYNC_VolOpState {
    FSSYNC_VolOpPending        = 0, /**< volume operation request received */
    FSSYNC_VolOpDenied         = 1, /**< volume operation request denied */
    FSSYNC_VolOpRunningOnline  = 2, /**< volume operation is running while volume is online */
    FSSYNC_VolOpRunningOffline = 3, /**< volume operation is running while volume is offline */
    FSSYNC_VolOpRunningUnknown = 4 /**< volume operation is running; VVolOpLeaveOnline_r resolution unknown */
};

/**
 * volume operation information node.
 *
 * @note this structure is attached to a struct Volume to signify that
 *       a volume operation is in-progress.
 *
 * @see Volume
 * @see VRegisterVolOp_r
 * @see VDeregisterVolOp_r
 */
typedef struct FSSYNC_VolOp_info {
    SYNC_command_hdr com;
    FSSYNC_VolOp_hdr vop;
    enum FSSYNC_VolOpState vol_op_state;
} FSSYNC_VolOp_info;


/**
 * fssync protocol volume package statistics request node.
 */
typedef struct FSSYNC_StatsOp_hdr {
    union {
	afs_uint32 vlru_generation;     /**< vlru generation id */
	afs_uint32 hash_bucket;         /**< volume hash bucket */
	char partName[16];              /**< partition name */
    } args;
} FSSYNC_StatsOp_hdr;

typedef struct FSSYNC_StatsOp_command {
    SYNC_command_hdr * hdr;
    FSSYNC_StatsOp_hdr * sop;
    SYNC_command * com;
} FSSYNC_StatsOp_command;

/**
 * fssync protocol vnode query request message.
 */
typedef struct FSSYNC_VnQry_hdr {
    VolumeId volume;          /**< volume id */
    afs_uint32 vnode;           /**< vnode id */
    afs_uint32 unique;          /**< uniqifier */
    afs_uint32 spare;           /**< reserved for future use */
    char partName[16];          /**< partition name */
} FSSYNC_VnQry_hdr;

/**
 * fssync protocol volume group query response message.
 */
typedef struct FSSYNC_VGQry_response {
    afs_uint32 rw;                        /**< rw volume id */
    afs_uint32 children[VOL_VG_MAX_VOLS]; /**< vector of children */
} FSSYNC_VGQry_response_t;

/**
 * fssync protocol volume group update command message.
 */
typedef struct FSSYNC_VGUpdate_command {
    afs_uint32 parent;          /**< rw volume id */
    afs_uint32 child;           /**< volume id to associate with parent
				 *   (can legally be the parent itself) */
    char partName[16];          /**< name of vice partition on which this
				 *   volume group resides */
} FSSYNC_VGUpdate_command_t;

#define FSSYNC_IN_PORT 2040
#define FSSYNC_UN_PATH "fssync.sock"
#define FSSYNC_ENDPOINT_DECL    SYNC_ENDPOINT_DECL(FSSYNC_IN_PORT, FSSYNC_UN_PATH)

/*
 * common interfaces
 */
extern void FSYNC_Init(void);

/*
 * fsync client interfaces
 */
extern void FSYNC_clientFinis(void);
extern int FSYNC_clientInit(void);
extern int FSYNC_clientChildProcReconnect(void);

/* generic low-level interface */
extern afs_int32 FSYNC_askfs(SYNC_command * com, SYNC_response * res);

/* generic higher-level interface */
extern afs_int32 FSYNC_GenericOp(void * ext_hdr, size_t ext_len,
				 int command, int reason,
				 SYNC_response * res);

/*
 * volume operations control interface
 *
 * FSYNC_VolOp must be called with the partition name and not the partition path.
 */
extern afs_int32 FSYNC_VolOp(VolumeId volume, char *partName, int com, int reason,
			     SYNC_response * res);

/* statistics query interface */
extern afs_int32 FSYNC_StatsOp(FSSYNC_StatsOp_hdr * scom, int command, int reason,
			       SYNC_response * res_in);

extern void FSYNC_fsInit(void);

/* volume group cache coherence interfaces */
extern afs_int32 FSYNC_VGCQuery(char * part, VolumeId parent,
				FSSYNC_VGQry_response_t *, SYNC_response *res);
extern afs_int32 FSYNC_VGCAdd(char *part, VolumeId parent, VolumeId child,
			      int reason, SYNC_response *res);
extern afs_int32 FSYNC_VGCDel(char *part, VolumeId parent, VolumeId child,
			      int reason, SYNC_response *res);
extern afs_int32 FSYNC_VGCScan(char *part, int reason);

extern afs_int32 FSYNC_VerifyCheckout(VolumeId volume, char *partition,
                                      afs_int32 command, afs_int32 reason);

#endif /* __fssync_h_ */
# 237 "/usr/home/kaduk/openafs/build/include/afs/fssync.h"
# 31 "/usr/home/kaduk/openafs/build/include/afs/volume.h" 2

#if 0
/** turn this on if you suspect a volume package locking bug */
#define VOL_LOCK_DEBUG 1
#endif
# 36 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

#ifdef VOL_LOCK_DEBUG
#define VOL_LOCK_ASSERT_HELD \
    opr_Assert(vol_glock_holder == pthread_self())
#define VOL_LOCK_ASSERT_UNHELD \
    opr_Assert(vol_glock_holder == 0)
#define _VOL_LOCK_SET_HELD \
    vol_glock_holder = pthread_self()
#define _VOL_LOCK_SET_UNHELD \
    vol_glock_holder = 0
#define VOL_LOCK_DBG_CV_WAIT_END \
    do { \
        VOL_LOCK_ASSERT_UNHELD; \
        _VOL_LOCK_SET_HELD; \
    } while(0)
#define VOL_LOCK_DBG_CV_WAIT_BEGIN \
    do { \
         VOL_LOCK_ASSERT_HELD; \
         _VOL_LOCK_SET_UNHELD; \
    } while(0)
#else
# 57 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
#define VOL_LOCK_ASSERT_HELD
#define VOL_LOCK_ASSERT_UNHELD
#define VOL_LOCK_DBG_CV_WAIT_BEGIN
#define VOL_LOCK_DBG_CV_WAIT_END
#endif
# 62 "/usr/home/kaduk/openafs/build/include/afs/volume.h"


#ifdef AFS_PTHREAD_ENV
#if 0 /* expanded by -frewrite-includes */
#include <pthread.h>
#endif /* expanded by -frewrite-includes */
# 66 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
extern pthread_mutex_t vol_glock_mutex;
extern pthread_mutex_t vol_trans_mutex;
extern pthread_cond_t vol_put_volume_cond;
extern pthread_cond_t vol_sleep_cond;
extern pthread_cond_t vol_vinit_cond;
extern ih_init_params vol_io_params;
extern int vol_attach_threads;
#ifdef VOL_LOCK_DEBUG
extern pthread_t vol_glock_holder;
#define VOL_LOCK \
    do { \
	opr_mutex_enter(&vol_glock_mutex); \
	VOL_LOCK_ASSERT_UNHELD; \
	_VOL_LOCK_SET_HELD; \
    } while (0)
#define VOL_UNLOCK \
    do { \
        VOL_LOCK_ASSERT_HELD; \
	_VOL_LOCK_SET_UNHELD; \
	opr_mutex_exit(&vol_glock_mutex); \
    } while (0)
#define VOL_CV_WAIT(cv) \
    do { \
        VOL_LOCK_DBG_CV_WAIT_BEGIN; \
	opr_cv_wait((cv), &vol_glock_mutex); \
        VOL_LOCK_DBG_CV_WAIT_END; \
    } while (0)
#else /* !VOL_LOCK_DEBUG */
# 94 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
#define VOL_LOCK opr_mutex_enter(&vol_glock_mutex)
#define VOL_UNLOCK opr_mutex_exit(&vol_glock_mutex)
#define VOL_CV_WAIT(cv) opr_cv_wait((cv), &vol_glock_mutex)
#endif /* !VOL_LOCK_DEBUG */
# 98 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

#define VSALVSYNC_LOCK opr_mutex_enter(&vol_salvsync_mutex)
#define VSALVSYNC_UNLOCK opr_mutex_exit(&vol_salvsync_mutex)
#define VTRANS_LOCK opr_mutex_enter(&vol_trans_mutex)
#define VTRANS_UNLOCK opr_mutex_exit(&vol_trans_mutex)
#else /* AFS_PTHREAD_ENV */
# 104 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
#define VOL_LOCK
#define VOL_UNLOCK
#define VSALVSYNC_LOCK
#define VSALVSYNC_UNLOCK
#define VTRANS_LOCK
#define VTRANS_UNLOCK
#endif /* AFS_PTHREAD_ENV */
# 111 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

/**
 * volume package program type enumeration.
 */
typedef enum {
    fileServer          = 1,    /**< the fileserver process */
    volumeUtility       = 2,    /**< any miscellaneous volume utility */
    salvager            = 3,    /**< standalone whole-partition salvager */
    salvageServer       = 4,    /**< dafs online salvager */
    debugUtility        = 5,    /**< fssync-debug or similar utility */
    volumeServer        = 6,    /**< the volserver process */
    volumeSalvager      = 7     /**< the standalone single-volume salvager */
} ProgramType;
extern ProgramType programType;	/* The type of program using the package */

/* Some initialization parameters for the volume package */
/* Add new initialization parameters here */
extern int (*V_BreakVolumeCallbacks) (VolumeId);
extern int (*vol_PollProc) (void);

#define	DOPOLL	((vol_PollProc)? (*vol_PollProc)() : 0)

#ifdef AFS_DEMAND_ATTACH_FS
/**
 * variable error return code based upon programType and DAFS presence
 */
#define DAFS_VSALVAGE   ((programType == fileServer) ? VSALVAGING : VSALVAGE)
#else
# 139 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
#define DAFS_VSALVAGE   (VSALVAGE)
#endif
# 141 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

struct versionStamp {		/* Version stamp for critical volume files */
    bit32 magic;		/* Magic number */
    bit32 version;		/* Version number of this file, or software
				 * that created this file */
};

#ifdef AFS_DEMAND_ATTACH_FS
/**
 * demand attach volume state enumeration.
 *
 * @note values must be contiguous in order for VIsValidState() to work correctly
 */
typedef enum {
    VOL_STATE_UNATTACHED        = 0,    /**< volume is unattached */
    VOL_STATE_PREATTACHED       = 1,    /**< volume has been pre-attached */
    VOL_STATE_ATTACHING         = 2,    /**< volume is transitioning to fully attached */
    VOL_STATE_ATTACHED          = 3,    /**< volume has been fully attached */
    VOL_STATE_UPDATING          = 4,    /**< volume is updating on-disk structures */
    VOL_STATE_GET_BITMAP        = 5,    /**< volume is getting bitmap entries */
    VOL_STATE_HDR_LOADING       = 6,    /**< volume is loading disk header */
    VOL_STATE_HDR_ATTACHING     = 7,    /**< volume is getting a header from the LRU */
    VOL_STATE_SHUTTING_DOWN     = 8,    /**< volume is shutting down */
    VOL_STATE_GOING_OFFLINE     = 9,    /**< volume is going offline */
    VOL_STATE_OFFLINING         = 10,   /**< volume is transitioning to offline */
    VOL_STATE_DETACHING         = 11,   /**< volume is transitioning to detached */
    VOL_STATE_SALVSYNC_REQ      = 12,   /**< volume is blocked on a salvsync request */
    VOL_STATE_SALVAGING         = 13,   /**< volume is being salvaged */
    VOL_STATE_ERROR             = 14,   /**< volume is in an error state */
    VOL_STATE_VNODE_ALLOC       = 15,   /**< volume is busy allocating a new vnode */
    VOL_STATE_VNODE_GET         = 16,   /**< volume is busy getting vnode disk data */
    VOL_STATE_VNODE_CLOSE       = 17,   /**< volume is busy closing vnodes */
    VOL_STATE_VNODE_RELEASE     = 18,   /**< volume is busy releasing vnodes */
    VOL_STATE_VLRU_ADD          = 19,   /**< volume is busy being added to a VLRU queue */
    VOL_STATE_DELETED           = 20,   /**< volume has been deleted by the volserver */
    VOL_STATE_SALVAGE_REQ       = 21,   /**< volume has been requested to be salvaged,
                                         *   but is waiting for other users to go away
                                         *   so it can be offlined */
    VOL_STATE_SCANNING_RXCALLS  = 22,   /**< volume is scanning vp->rx_call_list
                                         *   to interrupt RX calls */
    /* please add new states directly above this line */
    VOL_STATE_FREED             = 23,   /**< debugging aid */
    VOL_STATE_COUNT             = 24    /**< total number of valid states */
} VolState;

/**
 * V_attachFlags bits.
 */
enum VolFlags {
    VOL_HDR_ATTACHED      = 0x1,     /**< volume header is attached to Volume struct */
    VOL_HDR_LOADED        = 0x2,     /**< volume header contents are valid */
    VOL_HDR_IN_LRU        = 0x4,     /**< volume header is in LRU */
    VOL_IN_HASH           = 0x8,     /**< volume is in hash table */
    VOL_ON_VBYP_LIST      = 0x10,    /**< volume is on VByP list */
    VOL_IS_BUSY           = 0x20,    /**< volume is not to be free()d */
    VOL_ON_VLRU           = 0x40,    /**< volume is on the VLRU */
    VOL_HDR_DONTSALV      = 0x80,    /**< volume header DONTSALVAGE flag is set */
    VOL_LOCKED            = 0x100    /**< volume is disk-locked (@see VLockVolumeNB) */
};

/* VPrintExtendedCacheStats flags */
#define VOL_STATS_PER_CHAIN   0x1  /**< compute simple per-chain stats */
#define VOL_STATS_PER_CHAIN2  0x2  /**< compute per-chain stats that require scanning
				    *   every element of the chain */

/* VLRU_SetOptions options */
#define VLRU_SET_THRESH       1
#define VLRU_SET_INTERVAL     2
#define VLRU_SET_MAX          3
#define VLRU_SET_ENABLED      4

/**
 * VLRU queue names.
 */
typedef enum {
    VLRU_QUEUE_NEW        = 0,  /**< LRU queue for new volumes */
    VLRU_QUEUE_MID        = 1,  /**< survivor generation */
    VLRU_QUEUE_OLD        = 2,  /**< old generation */
    VLRU_QUEUE_CANDIDATE  = 3,  /**< soft detach candidate pool */
    VLRU_QUEUE_HELD       = 4,  /*   volumes which are not allowed
				 *   to be soft detached */
    VLRU_QUEUE_INVALID    = 5   /**< invalid queue id */
} VLRUQueueName;

/* default scanner timing parameters */
#define VLRU_DEFAULT_OFFLINE_THRESH (60*60*2) /* 2 hours */
#define VLRU_DEFAULT_OFFLINE_INTERVAL (60*2) /* 2 minutes */
#define VLRU_DEFAULT_OFFLINE_MAX 8 /* 8 volumes */


/**
 * DAFS thread-specific options structure
 */
typedef struct VThreadOptions {
     int disallow_salvsync;     /**< whether or not salvsync calls are allowed
				 *   on this thread (deadlock prevention). */
} VThreadOptions_t;
extern pthread_key_t VThread_key;
extern VThreadOptions_t VThread_defaults;

#endif /* AFS_DEMAND_ATTACH_FS */
# 242 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

typedef struct VolumePackageOptions {
    afs_uint32 nLargeVnodes;      /**< size of large vnode cache */
    afs_uint32 nSmallVnodes;      /**< size of small vnode cache */
    afs_uint32 volcache;          /**< size of volume header cache */

    afs_int32 canScheduleSalvage; /**< can we schedule salvages? (DAFS) */
				  /* (if 'no', we will just error out if we
                                   * find a bad vol) */
    afs_int32 canUseFSSYNC;       /**< can we use the FSSYNC channel? */
    afs_int32 canUseSALVSYNC;     /**< can we use the SALVSYNC channel? (DAFS) */
    afs_int32 unsafe_attach;      /**< can we bypass checking the inUse vol
                                   *   header on attach? */
    void (*interrupt_rxcall) (struct rx_call *call, afs_int32 error);
                                  /**< callback to interrupt RX calls accessing
                                   *   a going-offline volume */
    afs_int32 offline_timeout;    /**< how long (in seconds) to wait before
                                   *   interrupting RX calls accessing a
                                   *   going-offline volume. -1 disables,
                                   *   0 means immediately. */
    afs_int32 offline_shutdown_timeout;
                                  /**< how long (in seconds) to wait before
                                   *   interrupting RX calls accessing a
                                   *   going-offline volume during shutdown.
                                   *   -1 disables, 0 means immediately.
                                   *   Note that the timeout time is calculated
                                   *   once, when we encounter the first going-
                                   *   offline volume during shutdown. So if we
                                   *   encounter multiple going-offline volumes
                                   *   during shutdown, we will still only wait
                                   *   for this amount of time in total, not e.g.
                                   *   for each going-offline volume encountered. */
    afs_int32 usage_threshold;    /*< number of accesses before writing volume header */
    afs_int32 usage_rate_limit;   /*< minimum number of seconds before writing volume
                                   *  header, after usage_threshold is exceeded */
} VolumePackageOptions;

/* Magic numbers and version stamps for each type of file */
#define VOLUMEHEADERMAGIC	((bit32)0x88a1bb3c)
#define VOLUMEINFOMAGIC		((bit32)0x78a1b2c5)
#define	SMALLINDEXMAGIC		0x99776655
#define LARGEINDEXMAGIC		0x88664433
#define	MOUNTMAGIC		0x9a8b7c6d
#define ACLMAGIC		0x88877712
#define LINKTABLEMAGIC		0x99877712

#define VOLUMEHEADERVERSION	1
#define VOLUMEINFOVERSION	1
#define	SMALLINDEXVERSION	1
#define	LARGEINDEXVERSION	1
#define	MOUNTVERSION		1
#define ACLVERSION		1
#define LINKTABLEVERSION	1


/*
 * Define various indices and counts used in keeping volume-level statistics.
 */
#define VOL_STATS_NUM_RWINFO_FIELDS 4

#define VOL_STATS_SAME_NET	0	/*Within same site (total) */
#define VOL_STATS_SAME_NET_AUTH 1	/*Within same site (authenticated);
					 * (must be 1 more than above) */
#define VOL_STATS_DIFF_NET	2	/*From external site (total) */
#define VOL_STATS_DIFF_NET_AUTH 3	/*From external site (authenticated)
					 * (must be 1 more than above) */

#define VOL_STATS_NUM_TIME_RANGES 6

#define VOL_STATS_TIME_CAP_0	    60	/*60 seconds */
#define VOL_STATS_TIME_CAP_1	   600	/*10 minutes, in seconds */
#define VOL_STATS_TIME_CAP_2	  3600	/*1 hour, in seconds */
#define VOL_STATS_TIME_CAP_3	 86400	/*1 day, in seconds */
#define VOL_STATS_TIME_CAP_4	604800	/*1 week, in seconds */

#define VOL_STATS_NUM_TIME_FIELDS 6

#define VOL_STATS_TIME_IDX_0	0	/*0 secs to 60 secs */
#define VOL_STATS_TIME_IDX_1	1	/*1 min to 10 mins */
#define VOL_STATS_TIME_IDX_2	2	/*10 mins to 60 mins */
#define VOL_STATS_TIME_IDX_3	3	/*1 hr to 24 hrs */
#define VOL_STATS_TIME_IDX_4	4	/*1 day to 7 days */
#define VOL_STATS_TIME_IDX_5	5	/*Greater than 1 week */

/* Volume header.  This is the contents of the named file representing
 * the volume.  Read-only by the file server!
 */
typedef struct VolumeHeader {
    struct versionStamp stamp;	/* Must be first field */
    VolumeId id;		/* Volume number */
    VolumeId parent;		/* Read-write volume number (or this volume
				 * number if this is a read-write volume) */
    Inode volumeInfo;
    Inode smallVnodeIndex;
    Inode largeVnodeIndex;
    Inode volumeAcl;
    Inode volumeMountTable;
    Inode linkTable;
} VolumeHeader_t;


typedef struct VolumeDiskHeader {
    struct versionStamp stamp;	/* Must be first field */
    VolumeId id;		/* Volume number */
    VolumeId parent;		/* Read-write volume number (or this volume
				 * number if this is a read-write volume) */
    afs_int32 volumeInfo_lo;
    afs_int32 smallVnodeIndex_lo;
    afs_int32 largeVnodeIndex_lo;
    afs_int32 volumeAcl_lo;
    afs_int32 volumeMountTable_lo;
    afs_int32 volumeInfo_hi;
    afs_int32 smallVnodeIndex_hi;
    afs_int32 largeVnodeIndex_hi;
    afs_int32 volumeAcl_hi;
    afs_int32 volumeMountTable_hi;
    afs_int32 linkTable_lo;
    afs_int32 linkTable_hi;
    /* If you add fields, add them before here and reduce the size of  array */
    bit32 reserved[3];
} VolumeDiskHeader_t;

/* A vnode index file header */
struct IndexFileHeader {
    struct versionStamp stamp;
};


/******************************************************************************/
/* Volume Data which is stored on disk and can also be maintained in memory.  */
/******************************************************************************/
typedef struct VolumeDiskData {
    struct versionStamp stamp;	/* Must be first field */
    VolumeId id;		/* Volume id--unique over all systems */
#define VNAMESIZE 32		/* including 0 byte */
    char name[VNAMESIZE];	/* Unofficial name for the volume */
    byte inUse;			/* Volume is being used (perhaps it is online),
				 * or the system crashed while it was used */
    byte inService;		/* Volume in service, not necessarily on line
				 * This bit is set by an operator/system
				 * programmer.  Manually taking a volume offline
				 * always clears the inService bit. Taking
				 * it out of service also takes it offline */
    byte blessed;		/* Volume is administratively blessed with
				 * the ability to go on line.  Set by a system
				 * administrator. Clearing this bit will
				 * take the volume offline */
    byte needsSalvaged;		/* Volume needs salvaged--an unrecoverable
				 * error occured to the volume.  Note:  a volume
				 * may still require salvage even if this
				 * flag isn't set--e.g. if a system crash
				 * occurred while the volume was on line. */
    bit32 uniquifier;		/* Next vnode uniquifier for this volume */
    int type;			/* */
    VolumeId parentId;		/* Id of parent, if type==readonly */
    VolumeId cloneId;		/* Latest read-only clone, if type==readwrite,
				 * 0 if the volume has never been cloned.  Note: the
				 * indicated volume does not necessarily exist (it
				 * may have been deleted since cloning). */
    VolumeId backupId;	/* Latest backup copy of this read write volume */
    VolumeId restoredFromId;	/* The id in the dump this volume was restored from--used simply
				 * to make sure that an incremental dump is not restored on top
				 * of something inappropriate:  Note:  this field itself is NEVER
				 * dumped!!! */
    byte needsCallback;		/* Set by the salvager if anything was changed
				 * about the volume.  Note:  this is not set by
				 * clone/makebackups when setting the copy-on-write
				 * flag in directories; this flag is not seen by
				 * the clients. */
#define DESTROY_ME	0xD3
    byte destroyMe;		/* If this is set to DESTROY_ME, then the salvager should destroy
				 * this volume; it is bogus (left over from an aborted  volume move,
				 * for example).  Note:  if this flag is on, then inService should
				 * be OFF--only the salvager checks this flag */
#ifdef ALPHA_DUX40_ENV
#define DONT_SALVAGE	0xE6
#else				/* ALPHA_DUX40_ENV */
# 419 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
#define DONT_SALVAGE	0xE5
#endif				/* ALPHA_DUX40_ENV */
# 421 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
    byte dontSalvage;		/* If this is on, then don't bother salvaging this volume */
    byte reserveb3;

    bit32 reserved1[6];


    /* Administrative stuff */
    int maxquota;		/* Quota maximum, 1K blocks */
    int minquota;		/* Quota minimum, 1K blocks */
    int maxfiles;		/* Maximum number of files (i.e. inodes) */
    bit32 accountNumber;	/* Uninterpreted account number */
    bit32 owner;		/* The person administratively responsible
				 * for this volume */
    int reserved2[8];		/* Other administrative constraints */

    /* Resource usage & statistics */
    int filecount;		/* Actual number of files */
    int diskused;		/* Actual disk space used, 1K blocks */
    int dayUse;			/* Metric for today's usage of this volume so far */
    int weekUse[7];		/* Usage of the volume for the last week.
				 * weekUse[0] is for most recent complete 24 hour period
				 * of measurement; week[6] is 7 days ago */
    Date dayUseDate;		/* Date the dayUse statistics refer to; the week use stats
				 * are the preceding 7 days */
    unsigned int volUpdateCounter; /*incremented at every update of volume*/
    int reserved3[10];		/* Other stats here */

    /* Server supplied dates */
    Date creationDate;		/* Creation date for a read/write
				 * volume; cloning date for original copy of
				 * a readonly volume (replicated volumes have
				 * the same creation date) */
    Date accessDate;		/* Last access time by a user, large granularity */
    Date updateDate;		/* Last modification by user */
    Date expirationDate;	/* 0 if it never expires */
    Date backupDate;		/* last time a backup clone was taken */

    /* Time that this copy of this volume was made.  NEVER backed up.  This field is only
     * set when the copy is created */
    Date copyDate;

    bit32 stat_initialized;	/*Are the stat fields below set up? */
    bit32 reserved4[7];

    /* messages */
#define VMSGSIZE 128
    char offlineMessage[VMSGSIZE];	/* Why the volume is offline */
#define VOL_STATS_BYTES 128
    /*
     * Keep per-volume aggregate statistics on type and distance of access,
     * along with authorship info.
     */
    bit32 stat_reads[VOL_STATS_NUM_RWINFO_FIELDS];
    bit32 stat_writes[VOL_STATS_NUM_RWINFO_FIELDS];
    bit32 stat_fileSameAuthor[VOL_STATS_NUM_TIME_FIELDS];
    bit32 stat_fileDiffAuthor[VOL_STATS_NUM_TIME_FIELDS];
    bit32 stat_dirSameAuthor[VOL_STATS_NUM_TIME_FIELDS];
    bit32 stat_dirDiffAuthor[VOL_STATS_NUM_TIME_FIELDS];

} VolumeDiskData;


/**************************************/
/* Memory resident volume information */
/**************************************/

/**
 * global volume package stats.
 */
typedef struct VolPkgStats {
#ifdef AFS_DEMAND_ATTACH_FS
    /*
     * demand attach fs
     * extended volume package statistics
     */

    /* levels */
    afs_uint32 state_levels[VOL_STATE_COUNT]; /**< volume state transition counters */

    /* counters */
    afs_uint64 hash_looks;           /**< number of hash chain element traversals */
    afs_uint64 hash_reorders;        /**< number of hash chain reorders */
    afs_uint64 salvages;             /**< online salvages since fileserver start */
    afs_uint64 vol_ops;              /**< volume operations since fileserver start */
#endif /* AFS_DEMAND_ATTACH_FS */
# 506 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

    afs_uint64 hdr_loads;            /**< header loads from disk */
    afs_uint64 hdr_gets;             /**< header pulls out of LRU */
    afs_uint64 attaches;             /**< volume attaches since fileserver start */
    afs_uint64 soft_detaches;        /**< soft detach ops since fileserver start */

    /* configuration parameters */
    afs_uint32 hdr_cache_size;       /**< size of volume header cache */
} VolPkgStats;
extern VolPkgStats VStats;

/*
 * volume header cache supporting structures
 */
struct volume_hdr_LRU_stats {
    afs_uint32 free;
    afs_uint32 used;
    afs_uint32 attached;
};

struct volume_hdr_LRU_t {
    struct rx_queue lru;
    struct volume_hdr_LRU_stats stats;
};
extern struct volume_hdr_LRU_t volume_hdr_LRU;

/*
 * volume hash chain supporting structures
 */
typedef struct VolumeHashChainHead {
    struct rx_queue queue;
    int len;
    /* someday we could put a per-chain lock here... */
#ifdef AFS_DEMAND_ATTACH_FS
    int busy;
    int cacheCheck;

    /* per-chain statistics */
    afs_uint64 looks;
    afs_uint64 gets;
    afs_uint64 reorders;

    pthread_cond_t chain_busy_cv;
#endif /* AFS_DEMAND_ATTACH_FS */
# 550 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
} VolumeHashChainHead;

typedef struct VolumeHashTable {
    int Size;
    int Mask;
    VolumeHashChainHead * Table;
} VolumeHashTable_t;
extern VolumeHashTable_t VolumeHashTable;

struct VolumeHashChainStats {
    afs_int32 table_size;
    afs_int32 chain_len;
#ifdef AFS_DEMAND_ATTACH_FS
    afs_int32 chain_cacheCheck;
    afs_int32 chain_busy;
    afs_uint64 chain_looks;
    afs_uint64 chain_gets;
    afs_uint64 chain_reorders;
#endif
# 569 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
};


#ifdef AFS_DEMAND_ATTACH_FS
/**
 * DAFS extended per-volume statistics.
 *
 * @note this data lives across the entire
 *       lifetime of the fileserver process
 */
typedef struct VolumeStats {
    /* counters */
    afs_uint64 hash_lookups;         /**< hash table lookups */
    afs_uint64 hash_short_circuits;  /**< short circuited hash lookups (due to cacheCheck) */
    afs_uint64 hdr_loads;            /**< header loads from disk */
    afs_uint64 hdr_gets;             /**< header pulls out of LRU */
    afs_uint16 attaches;             /**< attaches of this volume since fileserver start */
    afs_uint16 soft_detaches;        /**< soft detaches of this volume */
    afs_uint16 salvages;             /**< online salvages since fileserver start */
    afs_uint16 vol_ops;              /**< volume operations since fileserver start */

    /* timestamps */
    afs_uint32 last_attach;      /**< unix timestamp of last VAttach */
    afs_uint32 last_get;         /**< unix timestamp of last VGet/VHold */
    afs_uint32 last_promote;     /**< unix timestamp of last VLRU promote/demote */
    afs_uint32 last_hdr_get;     /**< unix timestamp of last GetVolumeHeader() */
    afs_uint32 last_hdr_load;    /**< unix timestamp of last LoadVolumeHeader() */
    afs_uint32 last_salvage;     /**< unix timestamp of last initiation of an online salvage */
    afs_uint32 last_salvage_req; /**< unix timestamp of last SALVSYNC request */
    afs_uint32 last_vol_op;      /**< unix timestamp of last volume operation */
} VolumeStats;


#define SALVAGE_PRIO_UPDATE_INTERVAL 3      /**< number of seconds between prio updates */
#define SALVAGE_COUNT_MAX 16                /**< number of online salvages we
					     *   allow before moving the volume
					     *   into a permanent error state
					     *
					     *   once this threshold is reached,
					     *   the operator will have to manually
					     *   issue a 'bos salvage' to bring
					     *   the volume back online
					     */

/**
 * DAFS online salvager state.
 */
typedef struct VolumeOnlineSalvage {
    afs_uint32 prio;            /**< number of VGetVolume's since salvage requested */
    int reason;                 /**< reason for requesting online salvage */
    byte requested;             /**< flag specifying that salvage should be scheduled */
    byte scheduled;             /**< flag specifying whether online salvage scheduled */
    byte scheduling;            /**< if nonzero, this volume has entered
                                 *   VCheckSalvage(), so if we recurse into
                                 *   VCheckSalvage() with this set, exit immediately
                                 *   to avoid recursing forever */
    byte reserved[1];           /**< padding */
} VolumeOnlineSalvage;

/**
 * DAFS Volume LRU state.
 */
typedef struct VolumeVLRUState {
    struct rx_queue lru;        /**< VLRU queue for this generation */
    VLRUQueueName idx;          /**< VLRU generation index */
} VolumeVLRUState;
#endif /* AFS_DEMAND_ATTACH_FS */
# 636 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

/**
 * node for a volume's rx_call_list.
 */
struct VCallByVol {
    struct rx_queue q;
    struct rx_call *call;
};

typedef struct Volume {
    struct rx_queue q;          /* Volume hash chain pointers */
    VolumeId hashid;		/* Volume number -- for hash table lookup */
    struct volHeader *header;	/* Cached disk data */
    Device device;		/* Unix device for the volume */
    struct DiskPartition64
     *partition;		/* Information about the Unix partition */
    struct vnodeIndex {
	IHandle_t *handle;	/* Unix inode holding this index */
	byte *bitmap;		/* Index bitmap */
	afs_uint32 bitmapSize;	/* length of bitmap, in bytes */
	afs_uint32 bitmapOffset;	/* Which byte address of the first long to
					 * start search from in bitmap */
    } vnodeIndex[nVNODECLASSES];
    IHandle_t *linkHandle;
    Unique nextVnodeUnique;	/* Derived originally from volume uniquifier.
				 * This is the actual next version number to
				 * assign; the uniquifier is bumped by 200 and
				 * and written to disk every 200 file creates
				 * If the volume is shutdown gracefully, the
				 * uniquifier should be rewritten with the
				 * value nextVnodeVersion */
    IHandle_t *diskDataHandle;	/* Unix inode holding general volume info */
    bit16 vnodeHashOffset;	/* Computed by HashOffset function in vnode.h.
				 * Assigned to the volume when initialized.
				 * Added to vnode number for hash table index */
    byte shuttingDown;		/* This volume is going to be detached */
    byte goingOffline;		/* This volume is going offline */
    bit32 cacheCheck;		/* Online sequence number to be used to invalidate vnode cache entries
				 * that stayed around while a volume was offline */
    short nUsers;		/* Number of users of this volume header */
#define VOL_PUTBACK 1
#define VOL_PUTBACK_DELETE 2
    byte needsPutBack;		/* For a volume utility, this flag is set to VOL_PUTBACK if we
				 * need to give the volume back when we detach it.  The server has
				 * certain modes where it doesn't detach the volume, and
				 * if we give it back spuriously, the server aborts. If set to
				 * VOL_PUTBACK_DELETE, it indicates that we need to tell the
				 * fileserver that the volume is gone entirely, instead of just
				 * giving the volume back to the fileserver. This field
				 * is meaningless on the file server */
    byte specialStatus;		/* An error code to return on VGetVolume: the
				 * volume is unavailable for the reason quoted,
				 * currently VBUSY or VMOVED */
    afs_uint32 checkoutMode;    /* for volume utilities, mode number for current checkout */
    afs_uint32 updateTime;	/* Time that this volume was put on the updated
				 * volume list--the list of volumes that will be
				 * salvaged should the file server crash */
    struct rx_queue vnode_list; /**< linked list of cached vnodes for this volume */
    struct rx_queue rx_call_list; /**< linked list of split RX calls using this
                                   *   volume (fileserver only) */
#ifdef AFS_DEMAND_ATTACH_FS
    VolState attach_state;      /* what stage of attachment has been completed */
    afs_uint32 attach_flags;    /* flags related to attachment state */
    pthread_cond_t attach_cv;   /* state change condition variable */
    short nWaiters;             /* volume package internal ref count */
    int chainCacheCheck;        /* Volume hash chain cache check */
    struct rx_queue vol_list;   /* per-partition volume list (VByPList) */

    VolumeOnlineSalvage salvage;  /* online salvager state */
    VolumeStats stats;            /* per-volume statistics */
    VolumeVLRUState vlru;         /* state specific to the VLRU */
    FSSYNC_VolOp_info * pending_vol_op;  /* fssync command info for any pending vol ops */
#endif /* AFS_DEMAND_ATTACH_FS */
# 709 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
    int usage_bumps_outstanding; /**< to rate limit the usage update i/o by accesses */
    int usage_bumps_next_write;  /**< to rate limit the usage update i/o by time */
} Volume;

struct volHeader {
    struct rx_queue lru;
    VolumeDiskData diskstuff;	/* General volume info read from disk */
    Volume *back;		/* back pointer to current volume structure */
};

/* These macros are used to export fields within the volume header.  This was added
   to facilitate changing the actual representation */

#define V_device(vp)		((vp)->device)
#define V_partition(vp)		((vp)->partition)
#define V_diskDataHandle(vp)	((vp)->diskDataHandle)
#define V_vnodeIndex(vp)	((vp)->vnodeIndex)
#define V_nextVnodeUnique(vp)	((vp)->nextVnodeUnique)
#define V_linkHandle(vp)	((vp)->linkHandle)
#define V_checkoutMode(vp)      ((vp)->checkoutMode)
#ifdef AFS_DEMAND_ATTACH_FS
#define V_attachState(vp)       ((vp)->attach_state)
#define V_attachFlags(vp)       ((vp)->attach_flags)
#define V_attachCV(vp)          ((vp)->attach_cv)
#endif /* AFS_DEMAND_ATTACH_FS */
# 734 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

/* N.B. V_id must be this, rather than vp->id, or some programs will break, probably */
#define V_stamp(vp)		((vp)->header->diskstuff.stamp)
#define V_id(vp)		((vp)->header->diskstuff.id)
#define V_name(vp)		((vp)->header->diskstuff.name)
#define V_inUse(vp)		((vp)->header->diskstuff.inUse)
#define V_inService(vp)		((vp)->header->diskstuff.inService)
#define V_blessed(vp)		((vp)->header->diskstuff.blessed)
#define V_needsSalvaged(vp)	((vp)->header->diskstuff.needsSalvaged)
#define V_uniquifier(vp)	((vp)->header->diskstuff.uniquifier)
#define V_type(vp)		((vp)->header->diskstuff.type)
#define V_parentId(vp)		((vp)->header->diskstuff.parentId)
#define V_cloneId(vp)		((vp)->header->diskstuff.cloneId)
#define V_backupId(vp)		((vp)->header->diskstuff.backupId)
#define V_restoredFromId(vp)	((vp)->header->diskstuff.restoredFromId)
#define V_needsCallback(vp)	((vp)->header->diskstuff.needsCallback)
#define V_destroyMe(vp)		((vp)->header->diskstuff.destroyMe)
#define V_dontSalvage(vp)	((vp)->header->diskstuff.dontSalvage)
#define V_maxquota(vp)		((vp)->header->diskstuff.maxquota)
#define V_minquota(vp)		((vp)->header->diskstuff.minquota)
#define V_maxfiles(vp)		((vp)->header->diskstuff.maxfiles)
#define V_accountNumber(vp)	((vp)->header->diskstuff.accountNumber)
#define V_owner(vp)		((vp)->header->diskstuff.owner)
#define V_filecount(vp)		((vp)->header->diskstuff.filecount)
#define V_diskused(vp)		((vp)->header->diskstuff.diskused)
#define V_dayUse(vp)		((vp)->header->diskstuff.dayUse)
#define V_weekUse(vp)		((vp)->header->diskstuff.weekUse)
#define V_dayUseDate(vp)	((vp)->header->diskstuff.dayUseDate)
#define V_creationDate(vp)	((vp)->header->diskstuff.creationDate)
#define V_accessDate(vp)	((vp)->header->diskstuff.accessDate)
#define V_updateDate(vp)	((vp)->header->diskstuff.updateDate)
#define V_expirationDate(vp)	((vp)->header->diskstuff.expirationDate)
#define V_backupDate(vp)	((vp)->header->diskstuff.backupDate)
#define V_copyDate(vp)		((vp)->header->diskstuff.copyDate)
#define V_offlineMessage(vp)	((vp)->header->diskstuff.offlineMessage)
#define V_disk(vp)		((vp)->header->diskstuff)
#define V_motd(vp)		((vp)->header->diskstuff.motd)
#define V_stat_initialized(vp)	((vp)->header->diskstuff.stat_initialized)
#define V_stat_area(vp)		(((vp)->header->diskstuff.stat_reads))
#define V_stat_reads(vp, idx)	(((vp)->header->diskstuff.stat_reads)[idx])
#define V_stat_writes(vp, idx)	(((vp)->header->diskstuff.stat_writes)[idx])
#define V_stat_fileSameAuthor(vp, idx) (((vp)->header->diskstuff.stat_fileSameAuthor)[idx])
#define V_stat_fileDiffAuthor(vp, idx) (((vp)->header->diskstuff.stat_fileDiffAuthor)[idx])
#define V_stat_dirSameAuthor(vp, idx)  (((vp)->header->diskstuff.stat_dirSameAuthor)[idx])
#define V_stat_dirDiffAuthor(vp, idx)  (((vp)->header->diskstuff.stat_dirDiffAuthor)[idx])
#define V_volUpCounter(vp)		((vp)->header->diskstuff.volUpdateCounter)

/* File offset computations.  The offset values in the volume header are
   computed with these macros -- when the file is written only!! */
#define VOLUME_MOUNT_TABLE_OFFSET(Volume)	(sizeof (VolumeDiskData))
#define VOLUME_BITMAP_OFFSET(Volume)	\
	(sizeof (VolumeDiskData) + (Volume)->disk.mountTableSize)


extern char *VSalvageMessage;	/* Canonical message when a volume is forced
				 * offline */
extern Volume *VGetVolume(Error * ec, Error * client_ec, VolumeId volumeId);
extern Volume *VGetVolumeWithCall(Error * ec, Error * client_ec, VolumeId volumeId,
                                  const struct timespec *ts, struct VCallByVol *cbv);
extern Volume *VGetVolume_r(Error * ec, VolumeId volumeId);
extern void VPutVolume(Volume *);
extern void VPutVolumeWithCall(Volume *vp, struct VCallByVol *cbv);
extern void VPutVolume_r(Volume *);
extern void VOffline(Volume * vp, char *message);
extern void VOffline_r(Volume * vp, char *message);
extern int VConnectFS(void);
extern int VConnectFS_r(void);
extern void VDisconnectFS(void);
extern void VDisconnectFS_r(void);
extern int VChildProcReconnectFS(void);
extern Volume *VAttachVolume(Error * ec, VolumeId volumeId, int mode);
extern Volume *VAttachVolume_r(Error * ec, VolumeId volumeId, int mode);
extern Volume *VCreateVolume(Error * ec, char *partname, VolumeId volumeId,
			     VolumeId parentId);
extern Volume *VCreateVolume_r(Error * ec, char *partname, VolumeId volumeId,
			       VolumeId parentId);
extern void VGrowBitmap(struct vnodeIndex *index);
extern int VAllocBitmapEntry(Error * ec, Volume * vp,
			     struct vnodeIndex *index);
extern int VAllocBitmapEntry_r(Error * ec, Volume * vp,
			       struct vnodeIndex *index, int flags);
extern void VFreeBitMapEntry(Error * ec, Volume *vp, struct vnodeIndex *index,
			     unsigned bitNumber);
extern void VFreeBitMapEntry_r(Error * ec, Volume *vp, struct vnodeIndex *index,
			       unsigned bitNumber, int flags);
extern int VolumeNumber(char *name);
extern char *VolumeExternalName(VolumeId volumeId);
extern int VolumeExternalName_r(VolumeId volumeId, char *name, size_t len);
extern Volume *VAttachVolumeByName(Error * ec, char *partition, char *name,
				   int mode);
extern Volume *VAttachVolumeByName_r(Error * ec, char *partition, char *name,
				     int mode);
extern void VShutdown(void);
extern void VSetTranquil(void);
extern void VUpdateVolume(Error * ec, Volume * vp);
extern void VUpdateVolume_r(Error * ec, Volume * vp, int flags);
extern void VAddToVolumeUpdateList(Error * ec, Volume * vp);
extern void VAddToVolumeUpdateList_r(Error * ec, Volume * vp);
extern void VDetachVolume(Error * ec, Volume * vp);
extern void VDetachVolume_r(Error * ec, Volume * vp);
extern void VForceOffline(Volume * vp);
extern void VForceOffline_r(Volume * vp, int flags);
extern void VBumpVolumeUsage(Volume * vp);
extern void VBumpVolumeUsage_r(Volume * vp);
extern void VSetDiskUsage(void);
extern void VPrintCacheStats(void);
extern void VReleaseVnodeFiles_r(Volume * vp);
extern void VCloseVnodeFiles_r(Volume * vp);
extern struct DiskPartition64 *VGetPartition(char *name, int abortp);
extern struct DiskPartition64 *VGetPartition_r(char *name, int abortp);
extern void VOptDefaults(ProgramType pt, VolumePackageOptions * opts);
extern int VInitVolumePackage2(ProgramType pt, VolumePackageOptions * opts);
extern int VInitAttachVolumes(ProgramType pt);
extern void DiskToVolumeHeader(VolumeHeader_t * h, VolumeDiskHeader_t * dh);
extern void VolumeHeaderToDisk(VolumeDiskHeader_t * dh, VolumeHeader_t * h);
extern void AssignVolumeName(VolumeDiskData * vol, char *name, char *ext);
extern void VTakeOffline_r(Volume * vp);
extern void VTakeOffline(Volume * vp);
extern Volume * VLookupVolume_r(Error * ec, VolumeId volumeId, Volume * hint);
extern void VGetVolumePath(Error * ec, VolumeId volumeId, char **partitionp,
			   char **namep);
extern char *vol_DevName(dev_t adev, char *wpath);
extern afs_int32 VIsGoingOffline(struct Volume *vp);

struct VLockFile;
extern void VLockFileInit(struct VLockFile *lf, const char *path);
extern void VLockFileReinit(struct VLockFile *lf);
extern int VLockFileLock(struct VLockFile *lf, afs_uint32 offset,
                         int locktype, int nonblock);
extern void VLockFileUnlock(struct VLockFile *lf, afs_uint32 offset);

#ifdef AFS_DEMAND_ATTACH_FS
extern Volume *VPreAttachVolumeByName(Error * ec, char *partition, char *name);
extern Volume *VPreAttachVolumeByName_r(Error * ec, char *partition, char *name);
extern Volume *VPreAttachVolumeById_r(Error * ec, char * partition,
				      VolumeId volumeId);
extern Volume *VPreAttachVolumeByVp_r(Error * ec, struct DiskPartition64 * partp,
				      Volume * vp, VolumeId volume_id);
extern Volume *VGetVolumeByVp_r(Error * ec, Volume * vp);
extern int VShutdownByPartition_r(struct DiskPartition64 * dp);
extern int VShutdownVolume_r(Volume * vp);
extern int VConnectSALV(void);
extern int VConnectSALV_r(void);
extern int VReconnectSALV(void);
extern int VReconnectSALV_r(void);
extern int VDisconnectSALV(void);
extern int VDisconnectSALV_r(void);
extern void VPrintExtendedCacheStats(int flags);
extern void VPrintExtendedCacheStats_r(int flags);
extern void VLRU_SetOptions(int option, afs_uint32 val);
extern int VSetVolHashSize(int logsize);
extern int VRequestSalvage_r(Error * ec, Volume * vp, int reason, int flags);
extern int VUpdateSalvagePriority_r(Volume * vp);
extern int VRegisterVolOp_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);
extern int VDeregisterVolOp_r(Volume * vp);
extern void VCancelReservation_r(Volume * vp);
extern int VChildProcReconnectFS_r(void);
extern void VOfflineForVolOp_r(Error *ec, Volume *vp, char *message);
#endif /* AFS_DEMAND_ATTACH_FS */
# 893 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

#ifdef AFS_DEMAND_ATTACH_FS
struct VDiskLock;
extern void VDiskLockInit(struct VDiskLock *dl, struct VLockFile *lf,
                          afs_uint32 offset);
extern int VGetDiskLock(struct VDiskLock *dl, int locktype, int nonblock);
extern void VReleaseDiskLock(struct VDiskLock *dl, int locktype);
#endif /* AFS_DEMAND_ATTACH_FS */
# 901 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
extern int VVolOpLeaveOnline_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);
extern int VVolOpLeaveOnlineNoHeader_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);
extern int VVolOpSetVBusy_r(Volume * vp, FSSYNC_VolOp_info * vopinfo);

extern void VPurgeVolume(Error * ec, Volume * vp);

extern afs_int32 VCanScheduleSalvage(void);
extern afs_int32 VCanUseFSSYNC(void);
extern afs_int32 VCanUseSALVSYNC(void);
extern afs_int32 VCanUnsafeAttach(void);
extern afs_int32 VReadVolumeDiskHeader(VolumeId volid,
				       struct DiskPartition64 * dp,
				       VolumeDiskHeader_t * hdr);
extern afs_int32 VWriteVolumeDiskHeader(VolumeDiskHeader_t * hdr,
					struct DiskPartition64 * dp);
extern afs_int32 VCreateVolumeDiskHeader(VolumeDiskHeader_t * hdr,
					 struct DiskPartition64 * dp);
extern afs_int32 VDestroyVolumeDiskHeader(struct DiskPartition64 * dp,
					  VolumeId volid, VolumeId parent);

/**
 * VWalkVolumeHeaders header callback.
 *
 * @param[in] dp   disk partition
 * @param[in] name full path to the .vol header file
 * @param[in] hdr  the header data that was read from the .vol header
 * @param[in] last 1 if this is the last attempt to read the vol header, 0
 *                 otherwise. DAFS VWalkVolumeHeaders will retry reading the
 *                 header once, if a non-fatal error occurs when reading the
 *                 header, or if this function returns a positive error code.
 *                 So, if there is a problem, this function will be called
 *                 first with last=0, then with last=1, then the error function
 *                 callback will be called. For non-DAFS, this is always 1.
 * @param[in] rock the rock passed to VWalkVolumeHeaders
 *
 * @return operation status
 *  @retval 0 success
 *  @retval negative a fatal error that should stop the walk immediately
 *  @retval positive an error with the volume header was encountered; the walk
 *          should continue, but the error function should be called on this
 *          header
 *
 * @see VWalkVolumeHeaders
 */
typedef int (*VWalkVolFunc)(struct DiskPartition64 *dp, const char *name,
                            struct VolumeDiskHeader *hdr, int last,
                            void *rock);
/**
 * VWalkVolumeHeaders error callback.
 *
 * This is called from VWalkVolumeHeaders when an invalid or otherwise
 * problematic volume header is encountered. It is typically implemented as a
 * wrapper to unlink the .vol file.
 *
 * @param[in] dp   disk partition
 * @param[in] name full path to the .vol header file
 * @param[in] hdr  header read in from the .vol file, or NULL if it could not
 *                 be read
 * @param[in] rock rock passed to VWalkVolumeHeaders
 *
 * @see VWalkVolumeHeaders
 */
typedef void (*VWalkErrFunc)(struct DiskPartition64 *dp, const char *name,
                             struct VolumeDiskHeader *hdr, void *rock);
extern int VWalkVolumeHeaders(struct DiskPartition64 *dp, const char *partpath,
                              VWalkVolFunc volfunc, VWalkErrFunc errfunc,
                              void *rock);

/* Naive formula relating number of file size to number of 1K blocks in file */
/* Note:  we charge 1 block for 0 length files so the user can't store
   an inifite number of them; for most files, we give him the inode, vnode,
   and indirect block overhead, for FREE! */
#define nBlocks(bytes) ((afs_sfsize_t)((bytes) == 0? 1: (((afs_sfsize_t)(bytes))+1023)/1024))

/* Client process id -- file server sends a Check volumes signal back to the client at this pid */
#define CLIENTPID	"/vice/vol/clientpid"

/* Modes of attachment, for VAttachVolume[ByName] to convey to the file server */
#define	V_READONLY 1		/* Absolutely no updates will be done to the volume */
#define V_CLONE	   2		/* Cloning the volume:  if it is read/write, then directory
				 * version numbers will change.  Header will be updated.  If
				 * the volume is read-only, the file server may continue to
				 * server it; it may also continue to server it in read/write
				 * mode if the writes are deferred */
#define V_VOLUPD   3		/* General update or volume purge is possible.  Volume must
				 * go offline */
#define V_DUMP	   4		/* A dump of the volume is requested; the volume can be served
				 * read-only during this time */
#define V_SECRETLY 5		/* Secret attach of the volume.  This is used to attach a volume
				 * which the file server doesn't know about--and which it shouldn't
				 * know about yet, since the volume has just been created and
				 * is somewhat bogus.  Required to make sure that a file server
				 * never knows about more than one copy of the same volume--when
				 * a volume is moved from one partition to another on a single
				 * server */
#define V_PEEK     6		/* "Peek" at the volume without telling the fileserver.  This is
				 * similar to V_SECRETLY, but read-only.  It is used in cases where
				 * not impacting fileserver performance is more important than
				 * getting the most recent data. */



/* VUpdateVolume_r flags */
#define VOL_UPDATE_WAIT          0x1  /* for demand attach, wait for other exclusive ops to end */
#define VOL_UPDATE_NOFORCEOFF    0x2  /* don't force offline on failure. this is to prevent
				       * infinite recursion between vupdate and vforceoff */

/* VForceOffline_r flags */
#define VOL_FORCEOFF_NOUPDATE    0x1  /* don't force update on forceoff. this is to prevent
				       * infinite recursion between vupdate and vforceoff */

/* VSyncVolume_r flags */
#define VOL_SYNC_WAIT            0x1  /* for demand attach, wait for other exclusive ops to end */

/* VAllocBitmapEntry_r flags */
#define VOL_ALLOC_BITMAP_WAIT    0x1  /* for demand attach, wait for other exclusive ops to end */

/* VFreeBitMapEntry_r flags */
#define VOL_FREE_BITMAP_WAIT     0x1  /* for demand attach, wait for other exclusive ops to end */

/* VRequestSalvage_r flags */
#define VOL_SALVAGE_NO_OFFLINE        0x1 /* we do not need to wait to offline the volume; it has
                                           * not been fully attached */

#define VOLUME_BITMAP_GROWSIZE  16	/* bytes, => 128vnodes */
					/* Must be a multiple of 4 (1 word) !! */

#if	defined(NEARINODE_HINT)
#define V_pref(vp,nearInode)  nearInodeHash(V_id(vp),(nearInode)); (nearInode) %= V_partition(vp)->f_files
#else
# 1031 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
#define V_pref(vp,nearInode)   nearInode = 0
#endif /* NEARINODE_HINT */
# 1033 "/usr/home/kaduk/openafs/build/include/afs/volume.h"

hdr_static_inline(unsigned long)
afs_printable_VolumeId_lu(VolumeId d) { return (unsigned long) (d); }

hdr_static_inline(unsigned int)
afs_printable_VnodeId_u(VnodeId d) { return (unsigned int) d; }

#endif /* __volume_h */
# 1041 "/usr/home/kaduk/openafs/build/include/afs/volume.h"
# 90 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2

#ifdef AFS_LINUX24_ENV
#define _LARGEFILE64_SOURCE 1
#endif
# 94 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#ifdef RESIDENCY
#if 0 /* expanded by -frewrite-includes */
#include <afs/rsdefs.h>
#endif /* expanded by -frewrite-includes */
# 96 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#if 0 /* expanded by -frewrite-includes */
#include <afs/remioint.h>
#endif /* expanded by -frewrite-includes */
# 97 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#endif /* RESIDENCY */
# 98 "../../../../openafs/src/tools/dumpscan/dumptool.c"

#if 0 /* expanded by -frewrite-includes */
#include <afs/dir.h>
#endif /* expanded by -frewrite-includes */
# 1 "/usr/home/kaduk/openafs/build/include/afs/dir.h" 1
/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

#if	!defined(__AFS_DIR_H)

#define __AFS_DIR_H

#define AFS_PAGESIZE 2048	/* bytes per page */
#define NHASHENT 128		/* entries in the hash tbl */
#define MAXPAGES 128		/* max pages in a dir */
#define	BIGMAXPAGES 1023	/* new big max pages */
#define EPP 64			/* dir entries per page */
#define LEPP 6			/* log above */
/* When this next field changs, it is crucial to modify MakeDir, since the
 * latter is responsible for marking these entries as allocated.  Also
 * change the salvager. */
#define DHE 12			/* entries in a dir header above a pages header alone. */

#define FFIRST 1
#define FNEXT 2

struct MKFid {			/* A file identifier. */
    afs_int32 vnode;		/* file's vnode slot */
    afs_int32 vunique;		/* the slot incarnation number */
};

struct PageHeader {
    /* A page header entry. */
    unsigned short pgcount;	/* number of pages, or 0 if old-style */
    unsigned short tag;		/* 1234 in network byte order */
    char freecount;		/* unused, info in dirHeader structure */
    char freebitmap[EPP / 8];
    char padding[32 - (5 + EPP / 8)];
};

struct DirBuffer {
    void *buffer;
    void *data;
};

struct DirHeader {
    /* A directory header object. */
    struct PageHeader header;
    char alloMap[MAXPAGES];	/* one byte per 2K page */
    unsigned short hashTable[NHASHENT];
};

struct DirEntry {
    /* A directory entry */
    char flag;
    char length;		/* currently unused */
    unsigned short next;
    struct MKFid fid;
    char name[16];
};

struct DirXEntry {
    /* A directory extension entry. */
    char name[32];
};

struct DirPage0 {
    /* A page in a directory. */
    struct DirHeader header;
    struct DirEntry entry[1];
};

struct DirPage1 {
    /* A page in a directory. */
    struct PageHeader header;
    struct DirEntry entry[1];
};

/* Prototypes */
#ifdef KERNEL
struct dcache;
typedef struct dcache * dir_file_t;
#else
# 85 "/usr/home/kaduk/openafs/build/include/afs/dir.h"
struct DirHandle;
typedef struct DirHandle * dir_file_t;
extern void Die(const char *msg) AFS_NORETURN;
#endif
# 89 "/usr/home/kaduk/openafs/build/include/afs/dir.h"

extern int afs_dir_NameBlobs(char *name);
extern int afs_dir_Create(dir_file_t dir, char *entry, void *vfid);
extern int afs_dir_Length(dir_file_t dir);
extern int afs_dir_Delete(dir_file_t dir, char *entry);
extern int afs_dir_MakeDir(dir_file_t dir, afs_int32 * me,
			   afs_int32 * parent);
extern int afs_dir_Lookup(dir_file_t dir, char *entry, void *fid);
extern int afs_dir_LookupOffset(dir_file_t dir, char *entry, void *fid,
				long *offsetp);
extern int afs_dir_EnumerateDir(dir_file_t dir,
				int (*hookproc) (void *, char *name,
						 afs_int32 vnode, 
						 afs_int32 unique),
				void *hook);
extern int afs_dir_IsEmpty(dir_file_t dir);
extern int afs_dir_GetBlob(dir_file_t dir, afs_int32 blobno,
			   struct DirBuffer *);
extern int afs_dir_GetVerifiedBlob(dir_file_t dir, afs_int32 blobno,
				   struct DirBuffer *);
extern int afs_dir_DirHash(char *string);

extern int afs_dir_InverseLookup (void *dir, afs_uint32 vnode,
				  afs_uint32 unique, char *name,
				  afs_uint32 length);

extern int afs_dir_ChangeFid(dir_file_t dir, char *entry,
		             afs_uint32 *old_fid, afs_uint32 *new_fid);

/* buffer operations */

extern void DInit(int abuffers);
extern int DRead(dir_file_t fid, int page, struct DirBuffer *);
extern int DFlush(void);
extern int DFlushVolume(afs_int32);
extern int DNew(dir_file_t fid, int page, struct DirBuffer *);
extern void DZap(dir_file_t fid);
extern void DRelease(struct DirBuffer *loc, int flag);
extern int DStat(int *abuffers, int *acalls, int *aios);
extern int DFlushVolume(afs_int32 vid);
extern int DFlushEntry(dir_file_t fid);
extern int DVOffset(struct DirBuffer *);

/* salvage.c */

#ifndef KERNEL
extern int DirOK(void *);
extern int DirSalvage(void *, void *, afs_int32, afs_int32,
                      afs_int32, afs_int32);

#endif
# 140 "/usr/home/kaduk/openafs/build/include/afs/dir.h"

#endif /*       !defined(__AFS_DIR_H) */
# 142 "/usr/home/kaduk/openafs/build/include/afs/dir.h"
# 100 "../../../../openafs/src/tools/dumpscan/dumptool.c" 2

#ifndef HAVE_OFF64_T
typedef off_t off64_t;
#endif /* !HAVE_OFF64_T */
# 104 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#ifndef HAVE_FSEEKO64
#define fseeko64 fseeko
#endif /* HAVE_FSEEKO64 */
# 107 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#ifndef HAVE_FTELLO64
#define ftello64 ftello
#endif /* HAVE_FTELLO64 */
# 110 "../../../../openafs/src/tools/dumpscan/dumptool.c"

/*
 * Sigh.  Linux blows it again
 */

#ifdef linux
#if 0 /* expanded by -frewrite-includes */
#include <pty.h>
#endif /* expanded by -frewrite-includes */
# 117 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#endif
# 118 "../../../../openafs/src/tools/dumpscan/dumptool.c"

/*
 * Stuff that is in private AFS header files, unfortunately
 */

#define DUMPVERSION	1
#define DUMPENDMAGIC	0x3A214B6E
#define DUMPBEGINMAGIC	0xB3A11322
#define D_DUMPHEADER	1
#define D_VOLUMEHEADER	2
#define D_VNODE		3
#define D_DUMPEND	4
#define D_MAX		20

#define MAXDUMPTIMES	50

struct DumpHeader {
    int32_t version;
    VolumeId volumeId;
    char volumeName[VNAMESIZE];
    int nDumpTimes;		/* Number of pairs */
    struct {
	int32_t from, to;
    } dumpTimes[MAXDUMPTIMES];
};

/*
 * Our command-line arguments
 */

#ifdef RESIDENCY
struct {
    int Algorithm;		/* Conversion algorithm */
    int Size;			/* Directory hierarchy size */
    int FSType;			/* File system type */
    int DeviceTag;		/* Device Tag */
} rscmdlineinfo[RS_MAXRESIDENCIES];

/*
 * This stuff comes from ufsname.c (which itself takes it from
 * ufs_interfaces.c)
 */

/* There is an assumption that all of the prefixes will have exactly one '/' */
static char *Ufs_Prefixes[] = { "/ufs", "/slowufs", "/cdmf", "/sdmf" };

#define MAX_ITERATIONS 10
#define UFS_SUMMARYTREENAME "Summaries"
#define UFS_STAGINGTREENAME "Staging"
#define UFS_VOLUMEHEADERTREENAME "VolHeaders"
#define UFS_VOLUMETREENAME "Volumes"
#define UFS_ALGORITHMBASE 'A'
#define UFS_MOUNTPOINTBASE 'a'
#define UFS_ALGORITHMS 3
#define UFS_LINK_MAX 64		/* Arbitrary. */
#define HARD_LINKED_FILE -2
#define TAGSTONAME(FileName, MountPoint, Sections, Level1, RWVolume, Vnode, Uniquifier, Algorithm) \
{ \
    if (Level1) \
        sprintf(FileName,"%s/%lu/%lu/%c%lu.%lu.%lu.%lu.%lu", MountPoint, \
                (Sections)[0], (Sections)[1], UFS_ALGORITHMBASE + Algorithm, \
                (Sections)[2], (Sections)[3], RWVolume, Vnode, Uniquifier); \
    else \
        sprintf(FileName,"%s/%lu/%c%lu.%lu.%lu.%lu.%lu", MountPoint, \
                (Sections)[0], UFS_ALGORITHMBASE + Algorithm, \
                (Sections)[1], (Sections)[2], RWVolume, Vnode, Uniquifier); \
}
#define TAGSTOSTAGINGNAME(FileName, MountPoint, RWVolume, Vnode, Uniquifier) \
    sprintf(FileName,"%s/%s/%lu.%lu.%lu", MountPoint, \
	    UFS_STAGINGTREENAME, RWVolume, Vnode, Uniquifier)
#define TAGSTOVOLUMEHEADERNAME(FileName, MountPoint, FileTag1, FileTag2) \
    sprintf(FileName,"%s/%s/%lu", MountPoint, UFS_VOLUMEHEADERTREENAME, \
	    FileTag1)
#define TAGSTOVOLUMEINFONAME(FileName, MountPoint, FileTag1, FileTag2) \
    sprintf(FileName,"%s/%s/%lu/%lu", MountPoint, \
	    UFS_VOLUMETREENAME, FileTag2, FileTag1)
#define TAGSTOVOLUMENAME(FileName, MountPoint, FileTag1, FileTag2, RWVolume) \
    sprintf(FileName,"%s/%s/%lu/%lu.%lu", MountPoint, \
	    UFS_VOLUMETREENAME, FileTag2, FileTag1, RWVolume)
#define TAGSTOSUMMARYNAME(FileName, MountPoint, FileTag1, FileTag2, SummaryRequestor, Residency) \
    sprintf(FileName,"%s/%s/%lu.%lu.%lu.%lu", MountPoint, \
	    UFS_SUMMARYTREENAME, FileTag1, FileTag2, SummaryRequestor, \
	    Residency)
#define DEVICETAGNUMBERTOMOUNTPOINT(MountPoint, DeviceTagNumber, FSType) \
    sprintf(MountPoint,"%s%c", Ufs_Prefixes[FSType], UFS_MOUNTPOINTBASE + \
	    DeviceTagNumber)
#define MOUNTPOINTTODEVICETAGNUMBER(MountPoint) \
    MountPoint[strlen(MountPoint) - 1] - UFS_MOUNTPOINTBASE
#define DEVICETAGNUMBERTOVOLUMEHEADERTREE(TreeName, MountPoint) \
    sprintf(TreeName,"%s/%s", MountPoint, UFS_VOLUMEHEADERTREENAME)
#define UFS_RESIDENCIES_FILE "Residencies"

/* We don't ever want to map to uid/gid -1.  fchown() takes that as a
   don't change flag.  We know however that volume number range from
   0x2000000 to 0x20FFFFFF (see VAllocateVolumeId() in vol/vutil.c)
   so we will use that to insure that -1 never appears. */
#define RWVolumeToUid(RWVolume) ((RWVolume >> 12) & 0xFFFF)
#define RWVolumeToGid(RWVolume) ((RWVolume & 0xFFF) | \
				 (((RWVolume >> 28) & 0xF) << 12))
#define UidGidToRWVolume(Uid, Gid) ((Gid & 0xFFF) | ((Uid & 0xFFFF) << 12) | \
				    ((Gid & 0xF000) << 16))


/* These routines generate a file name to correspond to the given tag
   numbers. */

/* The following entropy array contains the order of bits from highest entropy
   to lowest in the numbers FileTag1 and FileTag2.  Bit numbers 32 and above
   correspond to FileTag2.  This ordering was determined by examining all read-
   write volumes in the psc.edu cell. */
char UfsEntropy[1][64] = {
    {1, 2, 3, 4, 33, 5, 6, 7, 44, 45, 46, 36, 8, 34, 42, 35,
     9, 40, 38, 32, 43, 10, 39, 37, 11, 41, 12, 13, 14, 0,
     15, 16, 61, 17, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51,
     50, 49, 48, 47, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22,
     21, 20, 19, 18, 62, 63},
};

uint32_t Directories[3][2] = { {256, 0}, {256, 16}, {256, 256}, };
#endif /* RESIDENCY */
# 238 "../../../../openafs/src/tools/dumpscan/dumptool.c"

static int verbose = 0;
static int numNoDirData = 0;
static int termsize = 0;
int Testing = 0;
#ifdef RESIDENCY
extern resid ServerRequestorId;
#endif /* RESIDENCY */
# 246 "../../../../openafs/src/tools/dumpscan/dumptool.c"

/*
 * We use this structure to hold vnode data in our hash table.
 * It's indexed by vnode number.
 */

struct vnodeData {
    struct VnodeDiskObject *vnode;	/* A pointer to the disk vnode */
    int vnodeNumber;		/* The vnode number */
    off64_t dumpdata;		/* File offset of dump data (if
				 * available */
    unsigned char *filedata;	/* A pointer to the actual file
				 * data itself (if available) */
    unsigned int datalength;	/* The length of the data */
};

/*
 * This contains the current location when we're doing a scan of a
 * directory.
 */

struct DirCursor {
    int hashbucket;		/* Current hash bucket */
    int entry;			/* Entry within hash bucket */
};

/*
 * Arrays to hold vnode data
 */

struct vnodeData **LargeVnodeIndex;
struct vnodeData **SmallVnodeIndex;
int numLargeVnodes = 0;
int numSmallVnodes = 0;

/*
 * Crap for the libraries
 */

int ShutdownInProgress = 0;

/*
 * Our local function prototypes
 */

static int DirHash(char *string);
static int ReadDumpHeader(FILE *, struct DumpHeader *);
static int ReadVolumeHeader(FILE *, VolumeDiskData *);
static int ScanVnodes(FILE *, VolumeDiskData *, int);
static struct vnodeData *InsertVnode(unsigned int, struct VnodeDiskObject *);
static struct vnodeData *GetVnode(unsigned int);
static int CompareVnode(const void *, const void *);
static void InteractiveRestore(FILE *, VolumeDiskData *);
static void DirectoryList(int, char **, struct vnodeData *, VolumeDiskData *);
static void DirListInternal(struct vnodeData *, char *[], int, int, int, int,
			    int, int, VolumeDiskData *, char *);
static int CompareDirEntry(const void *, const void *);
static struct vnodeData *ChangeDirectory(int, char **, struct vnodeData *);
static void CopyFile(int, char **, struct vnodeData *, FILE *);
static void CopyVnode(int, char **, FILE *);
static void DumpAllFiles(int, char **, struct vnodeData *, VolumeDiskData *);
static struct vnodeData *FindFile(struct vnodeData *, char *);
static void ResetDirCursor(struct DirCursor *, struct vnodeData *);
static struct DirEntry *ReadNextDir(struct DirCursor *, struct vnodeData *);
static void MakeArgv(char *, int *, char ***);
static char *GetToken(char *, char **, char *, char *[]);
static int ReadInt16(FILE *, uint16_t *);
static int ReadInt32(FILE *, uint32_t *);
static int ReadString(FILE *, char *, int);
static int ReadByteString(FILE *, void *, int);

#ifdef RESIDENCY
static int DumpVnodeFile(FILE *, struct VnodeDiskObject *, VolumeDiskData *);
static void DumpAllResidencies(FILE *, struct vnodeData *, VolumeDiskData *);
#endif
# 321 "../../../../openafs/src/tools/dumpscan/dumptool.c"

int
main(int argc, char *argv[])
{
    int c, errflg = 0, force = 0, inode = 0;
    unsigned int magic;
    struct DumpHeader dheader;
    VolumeDiskData vol;
    off64_t offset;
#ifdef RESIDENCY
    int Res, Arg1, Arg2, Arg3, i;
    int dumpvnodes = 0;
#endif
# 334 "../../../../openafs/src/tools/dumpscan/dumptool.c"
    char *p;
    struct winsize win;
    FILE *f;
    int fd;
    time_t tmv;

#ifdef RESIDENCY
    for (i = 0; i < RS_MAXRESIDENCIES; i++) {
	rscmdlineinfo[i].Algorithm = -1;
	rscmdlineinfo[i].Size = -1;
	rscmdlineinfo[i].DeviceTag = -1;
	rscmdlineinfo[i].FSType = -1;
    }
#endif /* RESIDENCY */
# 348 "../../../../openafs/src/tools/dumpscan/dumptool.c"

    /*
     * Sigh, this is dumb, but we need the terminal window size
     * to do intelligent things with "ls" later on.
     */

    if (isatty(STDOUT_FILENO)) {
	if ((p = getenv("COLUMNS")) != NULL)
	    termsize = atoi(p);
	else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0
		 && win.ws_col > 0)
	    termsize = win.ws_col;
    }

    while ((c = getopt(argc, argv, "difr:t:v")) != EOF)
	switch (c) {
	case 't':
#ifdef RESIDENCY
	    if (sscanf(optarg, "%d/%d", &Res, &Arg1) != 2) {
		errflg++;
		break;
	    }

	    if (1 << (ffs(Res) - 1) != Res) {
		fprintf(stderr, "Invalid residency %d\n", Res);
		errflg++;
		break;
	    }

	    if (Arg1 < 0 || Arg1 > 26) {
		fprintf(stderr, "Invalid device tag: %d\n", Arg1);
		errflg++;
		break;
	    }
	    rscmdlineinfo[ffs(Res) - 1].DeviceTag = Arg1;
#else /* RESIDENCY */
# 384 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	    fprintf(stderr, "-t not supported in non-MRAFS " "dumptool.\n");
	    errflg++;
#endif /* RESIDENCY */
# 387 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	    break;

	case 'r':
#ifdef RESIDENCY
	    if (sscanf(optarg, "%d/%d/%d/%d", &Res, &Arg1, &Arg2, &Arg3) != 4) {
		errflg++;
		break;
	    }

	    if (Arg1 < 0 || Arg1 > 3) {
		fprintf(stderr, "Invalid fstype: %d\n", Arg1);
		errflg++;
		break;
	    }

	    if (Arg2 < 0 || Arg2 > 2) {
		fprintf(stderr, "Invalid size: %d\n", Arg2);
		errflg++;
		break;
	    }

	    if (Arg3 <= 0 || Arg3 > UFS_ALGORITHMS) {
		fprintf(stderr, "Invalid algorithm: %d\n", Arg3);
		errflg++;
		break;
	    }
	    rscmdlineinfo[ffs(Res) - 1].FSType = Arg1;
	    rscmdlineinfo[ffs(Res) - 1].Size = Arg2;
	    rscmdlineinfo[ffs(Res) - 1].Algorithm = Arg3;
#else /* RESIDENCY */
# 417 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	    fprintf(stderr, "-r not supported in non-MRAFS " "dumptool.\n");
	    errflg++;
#endif /* RESIDENCY */
# 420 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	    break;
	case 'd':
#ifdef RESIDENCY
	    dumpvnodes++;
#else /* RESIDENCY */
# 425 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	    fprintf(stderr, "-d not supported in non-MRAFS " "dumptool.\n");
	    errflg++;
#endif /* RESIDENCY */
# 428 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	    break;
	case 'v':
	    verbose++;
	    break;
	case 'f':
	    force++;
	    break;
	case 'i':
	    inode++;
	    break;
	case '?':
	default:
	    errflg++;
	}

    if (errflg || optind == argc) {
	fprintf(stderr, "Usage: %s\n\t[-v] [-f]\n\t"
#ifdef RESIDENCY
		"[-t Residency/Tag]\n\t"
		"[-r Residency/Type/Size/Algorithm]\n\t"
		"[-d] filename [file_in_dump [file in dump ...]]\n",
#else /* RESIDENCY */
# 450 "../../../../openafs/src/tools/dumpscan/dumptool.c"
		"filename\n",
#endif /* RESIDENCY */
# 452 "../../../../openafs/src/tools/dumpscan/dumptool.c"
		argv[0]);
	exit(1);
    }

    /*
     * Try opening the dump file
     */

#ifdef O_LARGEFILE
    if ((fd = open(argv[optind], O_RDONLY | O_LARGEFILE)) < 0) {
#else
# 463 "../../../../openafs/src/tools/dumpscan/dumptool.c"
    if ((fd = open(argv[optind], O_RDONLY)) < 0) {
#endif
# 465 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	fprintf(stderr, "open of dumpfile %s failed: %s\n", argv[optind],
		strerror(errno));
	exit(1);
    }

    if ((f = fdopen(fd, "rb")) == NULL) {
        fprintf(stderr, "fdopen of dumpfile %s failed: %s\n", argv[optind],
		strerror(errno));
	exit(1);
    }

    if (ReadDumpHeader(f, &dheader)) {
	fprintf(stderr, "Failed to read dump header!\n");
	exit(1);
    }

    if (verbose)
	printf("Dump is for volume %lu (%s)\n",
	       (unsigned long) dheader.volumeId, dheader.volumeName);

    if (getc(f) != D_VOLUMEHEADER) {
	fprintf(stderr, "Volume header is missing from dump, aborting\n");
	exit(1);
    }

    if (ReadVolumeHeader(f, &vol)) {
	fprintf(stderr, "Unable to read volume header\n");
	exit(1);
    }

    if (verbose) {
	printf("Volume information:\n");
	printf("\tid = %lu\n", (unsigned long) vol.id);
	printf("\tparent id = %lu\n", (unsigned long) vol.parentId);
	printf("\tname = %s\n", vol.name);
	printf("\tflags =");
	if (vol.inUse)
	    printf(" inUse");
	if (vol.inService)
	    printf(" inService");
	if (vol.blessed)
	    printf(" blessed");
	if (vol.needsSalvaged)
	    printf(" needsSalvaged");
	printf("\n");
	printf("\tuniquifier = %lu\n", (unsigned long) vol.uniquifier);
	tmv = vol.creationDate;
	printf("\tCreation date = %s", ctime(&tmv));
	tmv = vol.accessDate;
	printf("\tLast access date = %s", ctime(&tmv));
	tmv = vol.updateDate;
	printf("\tLast update date = %s", ctime(&tmv));
	printf("\tVolume owner = %lu\n", (unsigned long) vol.owner);
    }

    if (verbose)
	printf("Scanning vnodes (this may take a while)\n");

    /*
     * We need to do two vnode scans; one to get the number of
     * vnodes, the other to actually build the index.
     */

    offset = ftello64(f);

    if (ScanVnodes(f, &vol, 1)) {
	fprintf(stderr, "First vnode scan failed, aborting\n");
	exit(1);
    }

    fseeko64(f, offset, SEEK_SET);

    if (ScanVnodes(f, &vol, 0)) {
	fprintf(stderr, "Second vnode scan failed, aborting\n");
	exit(1);
    }

    if (getc(f) != D_DUMPEND || ReadInt32(f, &magic) || magic != DUMPENDMAGIC) {
	fprintf(stderr, "Couldn't find dump postamble, ");
	if (!force) {
	    fprintf(stderr, "aborting (use -f to override)\n");
	    exit(1);
	} else {
	    fprintf(stderr, "continuing anyway\n");
	    fprintf(stderr, "WARNING: Dump may not be complete!\n");
	}
    }

    /*
     * If we wanted to simply dump all vnodes, do it now
     */

#ifdef RESIDENCY
    if (dumpvnodes) {
	struct vnodeData *vdata;

	for (i = 0; i < numLargeVnodes; i++) {

	    vdata = LargeVnodeIndex[i];

	    if (vdata->vnode->type == vFidLookup)
		if (DumpVnodeFile(stdout, vdata->vnode, &vol)) {
		    fprintf(stderr, "DumpVnodeFile failed, " "aborting\n");
		    exit(1);
		}
	}

	for (i = 0; i < numSmallVnodes; i++) {

	    vdata = SmallVnodeIndex[i];

	    if (vdata->vnode->type == vFidLookup)
		if (DumpVnodeFile(stdout, vdata->vnode, &vol)) {
		    fprintf(stderr, "DumpVnodeFile failed, " "aborting\n");
		    exit(1);
		}
	}

    } else
#endif /* RESIDENCY */
# 585 "../../../../openafs/src/tools/dumpscan/dumptool.c"
    if (inode) {
	/*
	 * Dump out all filenames with their corresponding FID
	 */

	struct vnodeData *rootvdata;

	if ((rootvdata = GetVnode(1)) == NULL) {
	    fprintf(stderr,
		    "Can't get vnode data for root " "vnode!  Aborting\n");
	    exit(1);
	}

	DirListInternal(rootvdata, NULL, 0, 0, 1, 0, 1, 0, &vol, "");

    } else if (argc > optind + 1) {
#ifdef RESIDENCY
	/*
	 * Dump out residencies of files given on the command line.
	 */

	struct vnodeData *vdata, *rootvdata;

	if ((rootvdata = GetVnode(1)) == NULL) {
	    fprintf(stderr,
		    "Can't get vnode data for root " "vnode!  Aborting\n");
	    exit(1);
	}

	for (i = optind + 1; i < argc; i++) {

	    if ((vdata = FindFile(rootvdata, argv[i])) == NULL) {
		fprintf(stderr, "Skipping file %s\n", argv[i]);
		continue;
	    }

	    if (verbose)
		printf("Residency locations for %s:\n", argv[i]);

	    while (vdata->vnode->NextVnodeId != 0) {

		vdata = GetVnode(vdata->vnode->NextVnodeId);

		if (vdata == NULL) {
		    fprintf(stderr,
			    "We had a vnode chain " "pointer to a vnode that "
			    "doesn't exist, aborting!\n");
		    exit(1);
		}
		if (vdata->vnode->type == vFidLookup)
		    DumpVnodeFile(stdout, vdata->vnode, &vol);
	    }
	}
#else /* RESIDENCY */
# 639 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	fprintf(stderr, "Extra arguments after dump filename: %s\n",
		argv[optind]);
	exit(1);
#endif /* RESIDENCY */
# 643 "../../../../openafs/src/tools/dumpscan/dumptool.c"
    } else {
	/*
	 * Perform an interactive restore
	 */

	InteractiveRestore(f, &vol);
    }

    exit(0);
}

/*
 * Read the dump header, which is at the beginning of every dump
 */

static int
ReadDumpHeader(FILE * f, struct DumpHeader *header)
{
    unsigned int magic;
    int tag, i;

    if (getc(f) != D_DUMPHEADER || ReadInt32(f, &magic)
	|| ReadInt32(f, (unsigned int *)
		     &header->version) || magic != DUMPBEGINMAGIC) {
	if (verbose)
	    fprintf(stderr, "Couldn't find dump magic numbers\n");
	return -1;
    }

    header->volumeId = 0;
    header->nDumpTimes = 0;

    while ((tag = getc(f)) > D_MAX && tag != EOF) {
	unsigned short length;
	switch (tag) {
	case 'v':
	    if (ReadInt32(f, &header->volumeId)) {
		if (verbose)
		    fprintf(stderr, "Failed to read " "volumeId\n");
		return -1;
	    }
	    break;
	case 'n':
	    if (ReadString(f, header->volumeName, sizeof(header->volumeName))) {
		if (verbose)
		    fprintf(stderr, "Failed to read " "volume name\n");
		return -1;
	    }
	    break;
	case 't':
	    if (ReadInt16(f, &length)) {
		if (verbose)
		    fprintf(stderr,
			    "Failed to read " "dump time array length\n");
		return -1;
	    }
	    header->nDumpTimes = (length >> 1);
	    for (i = 0; i < header->nDumpTimes; i++)
		if (ReadInt32(f, (unsigned int *)
			      &header->dumpTimes[i].from)
		    || ReadInt32(f, (unsigned int *)
				 &header->dumpTimes[i].to)) {
		    if (verbose)
			fprintf(stderr, "Failed to " "read dump times\n");
		    return -1;
		}
	    break;
	default:
	    if (verbose)
		fprintf(stderr, "Unknown dump tag \"%c\"\n", tag);
	    return -1;
	}
    }

    if (!header->volumeId || !header->nDumpTimes) {
	if (verbose)
	    fprintf(stderr,
		    "We didn't get a volume Id or " "dump times listing\n");
	return 1;
    }

    ungetc(tag, f);
    return 0;
}

/*
 * Read the volume header; this is the information stored in VolumeDiskData.
 *
 * I'm not sure we need all of this, but read it in just in case.
 */

static int
ReadVolumeHeader(FILE * f, VolumeDiskData * vol)
{
    int tag;
    unsigned int trash;
    memset((void *)vol, 0, sizeof(*vol));

    while ((tag = getc(f)) > D_MAX && tag != EOF) {
	switch (tag) {
	case 'i':
	    if (ReadInt32(f, &vol->id))
		return -1;
	    break;
	case 'v':
	    if (ReadInt32(f, &trash))
		return -1;
	    break;
	case 'n':
	    if (ReadString(f, vol->name, sizeof(vol->name)))
		return -1;
	    break;
	case 's':
	    vol->inService = getc(f);
	    break;
	case 'b':
	    vol->blessed = getc(f);
	    break;
	case 'u':
	    if (ReadInt32(f, &vol->uniquifier))
		return -1;
	    break;
	case 't':
	    vol->type = getc(f);
	    break;
	case 'p':
	    if (ReadInt32(f, &vol->parentId))
		return -1;
	    break;
	case 'c':
	    if (ReadInt32(f, &vol->cloneId))
		return -1;
	    break;
	case 'q':
	    if (ReadInt32(f, (uint32_t *) & vol->maxquota))
		return -1;
	    break;
	case 'm':
	    if (ReadInt32(f, (uint32_t *) & vol->minquota))
		return -1;
	    break;
	case 'd':
	    if (ReadInt32(f, (uint32_t *) & vol->diskused))
		return -1;
	    break;
	case 'f':
	    if (ReadInt32(f, (uint32_t *) & vol->filecount))
		return -1;
	    break;
	case 'a':
	    if (ReadInt32(f, &vol->accountNumber))
		return -1;
	    break;
	case 'o':
	    if (ReadInt32(f, &vol->owner))
		return -1;
	    break;
	case 'C':
	    if (ReadInt32(f, &vol->creationDate))
		return -1;
	    break;
	case 'A':
	    if (ReadInt32(f, &vol->accessDate))
		return -1;
	    break;
	case 'U':
	    if (ReadInt32(f, &vol->updateDate))
		return -1;
	    break;
	case 'E':
	    if (ReadInt32(f, &vol->expirationDate))
		return -1;
	    break;
	case 'B':
	    if (ReadInt32(f, &vol->backupDate))
		return -1;
	    break;
	case 'O':
	    if (ReadString
		(f, vol->offlineMessage, sizeof(vol->offlineMessage)))
		return -1;
	    break;
	case 'M':
	    if (ReadString(f, (char *)vol->stat_reads, VMSGSIZE))
		return -1;
	    break;
	case 'W':{
		unsigned short length;
		int i;
		unsigned int data;
		if (ReadInt16(f, &length))
		    return -1;
		for (i = 0; i < length; i++) {
		    if (ReadInt32(f, &data))
			return -1;
		    if (i < sizeof(vol->weekUse) / sizeof(vol->weekUse[0]))
			vol->weekUse[i] = data;
		}
		break;
	    }
	case 'D':
	    if (ReadInt32(f, &vol->dayUseDate))
		return -1;
	    break;
	case 'Z':
	    if (ReadInt32(f, (uint32_t *) & vol->dayUse))
		return -1;
	    break;
#ifdef RESIDENCY
	case 'R':{
		unsigned short length;
		int i;
		unsigned int data;

		if (ReadInt16(f, &length))
		    return -1;
		for (i = 0; i < length; i++) {
		    if (ReadInt32(f, &data))
			return -1;
		    if (i <
			sizeof(vol->DesiredInfo.DesiredResidencyWords) /
			sizeof(vol->DesiredInfo.DesiredResidencyWords[0]))
			vol->DesiredInfo.DesiredResidencyWords[i] = data;
		}
		break;
	    }
	case 'S':{
		unsigned short length;
		int i;
		unsigned int data;

		if (ReadInt16(f, &length))
		    return -1;
		for (i = 0; i < length; i++) {
		    if (ReadInt32(f, &data))
			return -1;
		    if (i <
			sizeof(vol->UnDesiredInfo.UnDesiredResidencyWords) /
			sizeof(vol->UnDesiredInfo.UnDesiredResidencyWords[0]))
			vol->UnDesiredInfo.UnDesiredResidencyWords[i] = data;
		}
		break;
	    }
#endif
# 887 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	default:
	    if (verbose)
		fprintf(stderr, "Unknown dump tag \"%c\"\n", tag);
	    return -1;
	}
    }

    ungetc(tag, f);
    return 0;
}

/*
 * Scan all our vnode entries, and build indexing information.
 */

static int
ScanVnodes(FILE * f, VolumeDiskData * vol, int sizescan)
{
    int vnodeNumber;
    int tag;
    int numFileVnodes = 0;
    int numDirVnodes = 0;
    unsigned char buf[SIZEOF_LARGEDISKVNODE];
    struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
    off64_t offset, oldoffset;
    struct vnodeData *vdata;
    unsigned int length;

    tag = getc(f);

    while (tag == D_VNODE) {

	offset = 0;
	length = 0;
	vnode->type = vNull;
	vnode->length = -1;

	if (ReadInt32(f, (uint32_t *) & vnodeNumber)) {
	    fprintf(stderr, "failed int32 for 'vnodenum'\n");
	    return -1;
	}

	if (ReadInt32(f, &vnode->uniquifier)) {
	    fprintf(stderr, "failed int32 for 'uniquifier'\n");
	    return -1;
	}

	if (verbose > 1 && !sizescan)
	    printf("Got vnode %d\n", vnodeNumber);

	while ((tag = getc(f)) > D_MAX && tag != EOF)
	    switch (tag) {
	    case 't':
		vnode->type = (VnodeType) getc(f);
		break;
	    case 'l':
		{
		    unsigned short tmp;
		    if (ReadInt16(f, &tmp)) {
			fprintf(stderr, "failed int16 for 'l'\n");
			return -1;
		    }
		    vnode->linkCount = tmp;
		}
		break;
	    case 'v':
		if (ReadInt32(f, &vnode->dataVersion)) {
		    fprintf(stderr, "failed int32 for 'v'\n");
		    return -1;
		}
		break;
	    case 'm':
		if (ReadInt32(f, (uint32_t *) & vnode->unixModifyTime)) {
		    fprintf(stderr, "failed int32 for 'm'\n");
		    return -1;
		}
		break;
	    case 's':
		if (ReadInt32(f, (uint32_t *) & vnode->serverModifyTime)) {
		    fprintf(stderr, "failed int32 for 's'\n");
		    return -1;
		}
		break;
	    case 'a':
		if (ReadInt32(f, &vnode->author)) {
		    fprintf(stderr, "failed int32 for 'a'\n");
		    return -1;
		}
		break;
	    case 'o':
		if (ReadInt32(f, &vnode->owner)) {
		    fprintf(stderr, "failed int32 for 'o'\n");
		    return -1;
		}
		break;
	    case 'g':
		if (ReadInt32(f, (uint32_t *) & vnode->group)) {
		    fprintf(stderr, "failed int32 for 'g'\n");
		    return -1;
		}
		break;
	    case 'b':{
		    unsigned short modeBits;
		    if (ReadInt16(f, &modeBits))
			return -1;
		    vnode->modeBits = modeBits;
		    break;
		}
	    case 'p':
		if (ReadInt32(f, &vnode->parent)) {
		    fprintf(stderr, "failed int32 for 'p'\n");
		    return -1;
		}
		break;
#ifdef RESIDENCY
	    case 'N':
		if (ReadInt32(f, &vnode->NextVnodeId)) {
		    fprintf(stderr, "failed int32 for 'N'\n");
		    return -1;
		}
		break;
	    case 'R':
		if (ReadInt32(f, &VLkp_Residencies(vnode))) {
		    fprintf(stderr, "failed int32 for 'R'\n");
		    return -1;
		}
		break;
#endif
# 1015 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	    case 'S':
		if (ReadInt32(f, &vnode->length)) {
		    fprintf(stderr, "failed int32 for 'S'\n");
		    return -1;
		}
		break;
	    case 'F':
		if (ReadInt32(f, (uint32_t *) & vnode->vn_ino_lo))
		    return -1;
		break;
	    case 'A':
		if (ReadByteString
		    (f, (void *)VVnodeDiskACL(vnode), VAclDiskSize(vnode))) {
		    fprintf(stderr, "failed readbystring for 'A'\n");
		    return -1;
		}
#if 0
		acl_NtohACL(VVnodeDiskACL(vnode));
#endif
# 1034 "../../../../openafs/src/tools/dumpscan/dumptool.c"
		break;
#ifdef RESIDENCY
	    case 'h':
		if (ReadInt32(f, &vnode->length_hi)) {
		    fprintf(stderr, "failed int32 for 'h'\n");
		    return -1;
		}
#endif
# 1042 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	    case 'f':
		if (verbose > 1 && !sizescan)
		    printf("We have file data!\n");
		if (ReadInt32(f, &length)) {
		    fprintf(stderr, "failed int32 for 'f'\n");
		    return -1;
		}
		vnode->length = length;
		offset = ftello64(f);
		fseeko64(f, length, SEEK_CUR);
		break;
	    default:
		if (verbose)
		    fprintf(stderr, "Unknown dump tag \"%c\"\n", tag);
		return -1;
	    }

	/*
	 * If we're doing an incremental restore, then vnodes
	 * will be listed in the dump, but won't contain any
	 * vnode information at all (I don't know why they're
	 * included _at all_).  If we get one of these vnodes, then
	 * just skip it (because we can't do anything with it.
	 */

	if (vnode->type == vNull)
	    continue;

#ifdef RESIDENCY
	if (verbose > 1 && vnode->type == vFidLookup && !sizescan) {
	    printf
		("This is an auxiliary vnode (lookup) for vnode %d, residency %d\n",
		 VLkp_ParentVnodeId(vnode), VLkp_Residencies(vnode));
	    if (DumpVnodeFile(stdout, vnode, vol))
		return -1;
	}

	if (verbose > 1 && vnode->type == vAccessHistory && !sizescan)
	    printf("This is an auxiliary vnode (history) for vnode %d\n",
		   VLkp_ParentVnodeId(vnode));
#endif
# 1083 "../../../../openafs/src/tools/dumpscan/dumptool.c"

	if (vnode->type == vDirectory)
	    numDirVnodes++;
	else
	    numFileVnodes++;

	/*
	 * We know now all we would ever know about the vnode;
	 * insert it into our hash table (but only if we're not
	 * doing a vnode scan).
	 */

	if (!sizescan) {

	    vdata = InsertVnode(vnodeNumber, vnode);

	    if (vdata == NULL) {
		if (verbose)
		    fprintf(stderr,
			    "Failed to insert " "vnode into hash table");
		return -1;
	    }

	    vdata->dumpdata = offset;
	    vdata->datalength = length;

	    /*
	     * Save directory data, since we'll need it later.
	     */

	    if (vnode->type == vDirectory && length) {

		vdata->filedata = malloc(length);

		if (!vdata->filedata) {
		    if (verbose)
			fprintf(stderr,
				"Unable to " "allocate space for "
				"file data (%d)\n", length);
		    return -1;
		}

		oldoffset = ftello64(f);
		fseeko64(f, offset, SEEK_SET);

		if (fread(vdata->filedata, length, 1, f) != 1) {
		    if (verbose)
			fprintf(stderr, "Unable to " "read in file data!\n");
		    return -1;
		}

		fseeko64(f, oldoffset, SEEK_SET);
	    } else if (vnode->type == vDirectory)
		/*
		 * Warn the user we may not have all directory
		 * vnodes
		 */
		numNoDirData++;
	}
    }

    ungetc(tag, f);

    if (!sizescan) {

	numLargeVnodes = numDirVnodes;
	numSmallVnodes = numFileVnodes;

    } else {
	if (numDirVnodes == 0)
	    LargeVnodeIndex = NULL;
	else
	    LargeVnodeIndex = malloc(numDirVnodes
				      * sizeof(struct vnodeData *));
	if (numFileVnodes == 0)
	    SmallVnodeIndex = NULL;
	else
	    SmallVnodeIndex = malloc(numFileVnodes
				      * sizeof(struct vnodeData *));

	if ((numDirVnodes != 0 && LargeVnodeIndex == NULL) ||
	    (numFileVnodes != 0 && SmallVnodeIndex == NULL)) {
	    if (verbose)
		fprintf(stderr,
			"Unable to allocate space " "for vnode tables\n");
	    return -1;
	}
    }

    if (verbose)
	fprintf(stderr, "%s vnode scan completed\n",
		sizescan ? "Primary" : "Secondary");

    return 0;
}

/*
 * Perform an interactive restore
 *
 * Parsing the directory information is a pain, but other than that
 * we just use the other tools we already have in here.
 */
#define CMDBUFSIZE 	(AFSPATHMAX * 2)
static void
InteractiveRestore(FILE * f, VolumeDiskData * vol)
{
    struct vnodeData *vdatacwd;	/* Vnode data for our current dir */
    char cmdbuf[CMDBUFSIZE];
    int argc;
    char **argv;

    /*
     * Let's see if we can at least get the data for our root directory.
     * If we can't, there's no way we can do an interactive restore.
     */

    if ((vdatacwd = GetVnode(1)) == NULL) {
	fprintf(stderr, "No entry for our root vnode!  Aborting\n");
	return;
    }

    if (!vdatacwd->filedata) {
	fprintf(stderr,
		"There is no directory data for the root "
		"vnode (1.1).  An interactive\nrestore is not "
		"possible.\n");
	return;
    }

    /*
     * If you're doing a selective dump correctly, then you should get all
     * directory vnode data.  But just in case you didn't, let the user
     * know there may be a problem.
     */

    if (numNoDirData)
	fprintf(stderr,
		"WARNING: %d directory vnodes had no file "
		"data.  An interactive restore\nmay not be possible\n",
		numNoDirData);

    printf("> ");
    while (fgets(cmdbuf, CMDBUFSIZE, stdin)) {

	if (strlen(cmdbuf) > 0 && cmdbuf[strlen(cmdbuf) - 1] == '\n')
	    cmdbuf[strlen(cmdbuf) - 1] = '\0';

	if (strlen(cmdbuf) == 0) {
	    printf("> ");
	    continue;
	}

	MakeArgv(cmdbuf, &argc, &argv);

	if (strcmp(argv[0], "ls") == 0) {
	    DirectoryList(argc, argv, vdatacwd, vol);
	} else if (strcmp(argv[0], "cd") == 0) {
	    struct vnodeData *newvdata;

	    newvdata = ChangeDirectory(argc, argv, vdatacwd);

	    if (newvdata)
		vdatacwd = newvdata;
	} else if (strcmp(argv[0], "file") == 0) {
	    DumpAllFiles(argc, argv, vdatacwd, vol);
	} else if (strcmp(argv[0], "cp") == 0) {
	    CopyFile(argc, argv, vdatacwd, f);
	} else if (strcmp(argv[0], "vcp") == 0) {
	    CopyVnode(argc, argv, f);
	} else if (strcmp(argv[0], "quit") == 0
		   || strcmp(argv[0], "exit") == 0)
	    break;
	else if (strcmp(argv[0], "?") == 0 || strcmp(argv[0], "help") == 0) {
	    printf("Valid commands are:\n");
	    printf("\tls\t\tList current directory\n");
	    printf("\tcd\t\tChange current directory\n");
	    printf("\tcp\t\tCopy file from dump\n");
	    printf("\tvcp\t\tCopy file from dump (via vnode)\n");
#ifdef RESIDENCY
	    printf("\tfile\t\tList residency filenames\n");
#endif /* RESIDENCY */
# 1264 "../../../../openafs/src/tools/dumpscan/dumptool.c"
	    printf("\tquit | exit\tExit program\n");
	    printf("\thelp | ?\tBrief help\n");
	} else
	    fprintf(stderr,
		    "Unknown command, \"%s\", enter "
		    "\"help\" for a list of commands.\n", argv[0]);

	printf("> ");
    }

    return;
}

/*
 * Do a listing of all files in a directory.  Sigh, I wish this wasn't
 * so complicated.
 *
 * With the reorganizing, this is just a front-end to DirListInternal()
 */

static void
DirectoryList(int argc, char **argv, struct vnodeData *vdata,
	      VolumeDiskData * vol)
{
    int errflg = 0, lflag = 0, iflag = 0, Fflag = 0, sflag = 0, Rflag = 0;
    int c;

    optind = 1;

    while ((c = getopt(argc, argv, "liFRs")) != EOF)
	switch (c) {
	case 'l':
	    lflag++;
	    break;
	case 'i':
	    iflag++;
	    break;
	case 'F':
	    Fflag++;
	    break;
	case 'R':
	    Rflag++;
	case 's':
	    sflag++;
	    break;
	case '?':
	default:
	    errflg++;
	}

    if (errflg) {
	fprintf(stderr, "Usage: %s [-liFs] filename [filename ...]\n",
		argv[0]);
	return;
    }

    DirListInternal(vdata, &(argv[optind]), argc - optind, lflag, iflag,
		    Fflag, Rflag, 1, vol, NULL);

    return;
}

/*
 * Function that does the REAL work in terms of directory listing
 */

static void
DirListInternal(struct vnodeData *vdata, char *pathnames[], int numpathnames,
		int lflag, int iflag, int Fflag, int Rflag, int verbose,
		VolumeDiskData * vol, char *path)
{
    struct DirEntry *ep, **eplist = NULL, **eprecurse = NULL;
    struct DirCursor cursor;
    struct vnodeData *lvdata;

    int i, j, numentries = 0, longestname = 0, numcols, col, numrows;
    int numrecurse = 0;

    if (!vdata->filedata) {
	fprintf(stderr, "There is no vnode data for this " "directory!\n");
	return;
    }

    ResetDirCursor(&cursor, vdata);

    /*
     * Scan through the whole directory
     */

    while ((ep = ReadNextDir(&cursor, vdata)) != NULL) {

	/*
	 * If we didn't get any filenames on the command line,
	 * get them all.
	 */

	if (numpathnames == 0) {
	    eplist =
		realloc(eplist, sizeof(struct DirEntry *) * ++numentries);
	    eplist[numentries - 1] = ep;
	    if (strlen(ep->name) > longestname)
		longestname = strlen(ep->name);
	    if (Rflag)
		if ((lvdata = GetVnode(ntohl(ep->fid.vnode)))
		    && lvdata->vnode->type == vDirectory
		    && !(strcmp(ep->name, ".") == 0
			 || strcmp(ep->name, "..") == 0)) {
		    eprecurse =
			realloc(eprecurse,
				sizeof(struct DirEntry *) * ++numrecurse);
		    eprecurse[numrecurse - 1] = ep;
		}

	} else {
	    /*
	     * Do glob matching via fnmatch()
	     */

	    for (i = 0; i < numpathnames; i++)
		if (fnmatch(pathnames[i], ep->name, FNM_PATHNAME) == 0) {
		    eplist =
			realloc(eplist,
				sizeof(struct DirEntry *) * ++numentries);
		    eplist[numentries - 1] = ep;
		    if (strlen(ep->name) > longestname)
			longestname = strlen(ep->name);
		    if (Rflag)
			if ((lvdata = GetVnode(ntohl(ep->fid.vnode)))
			    && lvdata->vnode->type == vDirectory
			    && !(strcmp(ep->name, ".") == 0
				 || strcmp(ep->name, "..") == 0)) {
			    eprecurse =
				realloc(eprecurse,
					sizeof(struct DirEntry *) *
					++numrecurse);
			    eprecurse[numrecurse - 1] = ep;
			}
		    break;
		}
	}
    }

    qsort((void *)eplist, numentries, sizeof(struct DirEntry *),
	  CompareDirEntry);

    if (Rflag && eprecurse)
	qsort((void *)eprecurse, numrecurse, sizeof(struct DirEntry *),
	      CompareDirEntry);
    /*
     * We don't have to do column printing if we have the -l or the -i
     * options.  Sigh, column printing is WAY TOO FUCKING COMPLICATED!
     */

    if (!lflag && !iflag) {
	char c;

	if (Fflag)
	    longestname++;

	longestname++;

	numcols = termsize / longestname ? termsize / longestname : 1;
	numrows = numentries / numcols + (numentries % numcols ? 1 : 0);

	for (i = 0; i < numrows; i++) {
	    col = 0;
	    while (col < numcols && (i + col * numrows) < numentries) {
		ep = eplist[i + col++ * numrows];
		if (Fflag) {
		    if (!(lvdata = GetVnode(ntohl(ep->fid.vnode))))
			c = ' ';
		    else if (lvdata->vnode->type == vDirectory)
			c = '/';
		    else if (lvdata->vnode->type == vSymlink)
			c = '@';
		    else if ((lvdata->vnode->modeBits & 0111) != 0)
			c = '*';
		    else
			c = ' ';
		    printf("%s%-*c", ep->name, (int)(longestname -
						     strlen(ep->name)), c);
		} else
		    printf("%-*s", longestname, ep->name);
	    }

	    printf("\n");
	}
    } else if (iflag)
	for (i = 0; i < numentries; i++)
	    if (!(lvdata = GetVnode(ntohl(eplist[i]->fid.vnode))))
		printf("%" AFS_VOLID_FMT ".0.0\t%s\n",
		       vol->parentId ? afs_printable_VolumeId_lu(vol->parentId)
		       : afs_printable_VolumeId_lu(vol->id),
		       eplist[i]->name);
	    else if (path)
		printf("%" AFS_VOLID_FMT ".%d.%d\t%s/%s\n",
		       afs_printable_VolumeId_lu(vol->id),
		       ntohl(eplist[i]->fid.vnode),
		       ntohl(eplist[i]->fid.vunique), path, eplist[i]->name);
	    else
		printf("%" AFS_VOLID_FMT ".%d.%d\t%s\n",
		       afs_printable_VolumeId_lu(vol->id),
		       ntohl(eplist[i]->fid.vnode),
		       ntohl(eplist[i]->fid.vunique), eplist[i]->name);
    else if (lflag) {
	for (i = 0; i < numentries; i++)
	    if (!(lvdata = GetVnode(ntohl(eplist[i]->fid.vnode))))
		printf("----------   0 0        " "0                 0 %s\n",
		       eplist[i]->name);
	    else {
		switch (lvdata->vnode->type) {
		case vDirectory:
		    printf("d");
		    break;
		case vSymlink:
		    printf("l");
		    break;
		default:
		    printf("-");
		}

		for (j = 8; j >= 0; j--) {
		    if (lvdata->vnode->modeBits & (1 << j))
			switch (j % 3) {
			case 2:
			    printf("r");
			    break;
			case 1:
			    printf("w");
			    break;
			case 0:
			    printf("x");
		    } else
			printf("-");
		}

		printf(" %-3d %-8d %-8d %10d %s\n", lvdata->vnode->linkCount,
		       lvdata->vnode->owner, lvdata->vnode->group,
		       lvdata->vnode->length, eplist[i]->name);
	    }
    }

    free(eplist);

    if (Rflag && eprecurse) {
	char *lpath;
	lpath = NULL;
	for (i = 0; i < numrecurse; i++) {
	    if (verbose)
		printf("\n%s:\n", eprecurse[i]->name);
	    if (path) {
		lpath = malloc(strlen(path) + strlen(eprecurse[i]->name) + 2);
		if (lpath)
		    sprintf(lpath, "%s/%s", path, eprecurse[i]->name);
	    }
	    DirListInternal(GetVnode(ntohl(eprecurse[i]->fid.vnode)), NULL, 0,
			    lflag, iflag, Fflag, Rflag, verbose, vol, lpath);
	    if (lpath) {
		free(lpath);
		lpath = NULL;
	    }
	}
    }

    if (eprecurse)
	free(eprecurse);

    return;
}


/*
 * Directory name comparison function, used by qsort
 */

static int
CompareDirEntry(const void *e1, const void *e2)
{
    struct DirEntry **ep1 = (struct DirEntry **)e1;
    struct DirEntry **ep2 = (struct DirEntry **)e2;

    return strcmp((*ep1)->name, (*ep2)->name);
}

/*
 * Change a directory.  Return a pointer to our new vdata structure for
 * this directory.
 */

static struct vnodeData *
ChangeDirectory(int argc, char **argv, struct vnodeData *vdatacwd)
{
    struct vnodeData *newvdatacwd;

    if (argc != 2) {
	fprintf(stderr, "Usage: %s directory\n", argv[0]);
	return NULL;
    }

    if ((newvdatacwd = FindFile(vdatacwd, argv[1])) == NULL)
	return NULL;

    if (newvdatacwd->vnode->type != vDirectory) {
	fprintf(stderr, "%s: Not a directory\n", argv[1]);
	return NULL;
    }

    if (newvdatacwd->filedata == NULL) {
	fprintf(stderr, "%s: No directory data found.\n", argv[1]);
	return NULL;
    }

    return newvdatacwd;
}

/*
 * Copy a file from out of the dump file
 */

#define COPYBUFSIZE 8192

static void
CopyFile(int argc, char **argv, struct vnodeData *vdatacwd, FILE * f)
{
    struct vnodeData *vdata;
    FILE *out;
    off64_t cur = 0;
    int bytes, ret;
    char buffer[COPYBUFSIZE];

    if (argc != 3) {
	fprintf(stderr, "Usage: %s dumpfile destfile\n", argv[0]);
	return;
    }

    if ((vdata = FindFile(vdatacwd, argv[1])) == NULL)
	return;

    if (vdata->dumpdata == 0) {
	fprintf(stderr, "File %s has no data in dump file\n", argv[1]);
	return;
    }

    if ((out = fopen(argv[2], "wb")) == NULL) {
	fprintf(stderr, "Open of %s failed: %s\n", argv[2], strerror(errno));
	return;
    }

    if (fseeko64(f, vdata->dumpdata, SEEK_SET)) {
	fprintf(stderr, "Seek failed: %s\n", strerror(errno));
	fclose(out);
	return;
    }

    while (cur < vdata->datalength) {

	bytes =
	    cur + COPYBUFSIZE <
	    vdata->datalength ? COPYBUFSIZE : vdata->datalength - cur;

	ret = fread(buffer, sizeof(char), bytes, f);
	if (ret != bytes) {
	    if (ret != 0)
		fprintf(stderr, "Short read (expected %d, " "got %d)\n",
			bytes, ret);
	    else
		fprintf(stderr, "Error during read: %s\n", strerror(errno));
	    fclose(out);
	    return;
	}

	ret = fwrite(buffer, sizeof(char), bytes, out);
	if (ret != bytes) {
	    if (ret != 0)
		fprintf(stderr, "Short write (expected %d, " "got %d)\n",
			bytes, ret);
	    else
		fprintf(stderr, "Error during write: %s\n", strerror(errno));
	    fclose(out);
	    return;
	}

	cur += bytes;
    }

    fclose(out);
}

/*
 * Copy a file from out of the dump file, by using the vnode
 */

static void
CopyVnode(int argc, char *argv[], FILE * f)
{
    struct vnodeData *vdata;
    FILE *out;
    off64_t cur = 0;
    int bytes, ret;
    char buffer[COPYBUFSIZE];
    unsigned int vnode, uniquifier = 0;

    if (argc != 3) {
	fprintf(stderr, "Usage: %s vnode[.uniqifier] destfile\n", argv[0]);
	return;
    }

    ret = sscanf(argv[1], "%d.%d", &vnode, &uniquifier);

    if (ret < 1) {
	fprintf(stderr, "Invalid file identifier: %s\n", argv[1]);
	return;
    }

    if (!(vdata = GetVnode(vnode))) {
	fprintf(stderr, "Vnode %d not in dump file\n", vnode);
	return;
    }

    if (ret == 2 && vdata->vnode->uniquifier != uniquifier) {
	fprintf(stderr,
		"Specified uniquifier %d did not match "
		"uniquifier %d found in dump file!\n", uniquifier,
		vdata->vnode->uniquifier);
	return;
    }

    if (vdata->dumpdata == 0) {
	fprintf(stderr, "File %s has no data in dump file\n", argv[1]);
	return;
    }

    if ((out = fopen(argv[2], "wb")) == NULL) {
	fprintf(stderr, "Open of %s failed: %s\n", argv[2], strerror(errno));
	return;
    }

    if (fseeko64(f, vdata->dumpdata, SEEK_SET)) {
	fprintf(stderr, "Seek failed: %s\n", strerror(errno));
	fclose(out);
	return;
    }

    while (cur < vdata->datalength) {

	bytes =
	    cur + COPYBUFSIZE <
	    vdata->datalength ? COPYBUFSIZE : vdata->datalength - cur;

	ret = fread(buffer, sizeof(char), bytes, f);
	if (ret != bytes) {
	    if (ret != 0)
		fprintf(stderr, "Short read (expected %d, " "got %d)\n",
			bytes, ret);
	    else
		fprintf(stderr, "Error during read: %s\n", strerror(errno));
	    fclose(out);
	    return;
	}

	ret = fwrite(buffer, sizeof(char), bytes, out);
	if (ret != bytes) {
	    if (ret != 0)
		fprintf(stderr, "Short write (expected %d, " "got %d)\n",
			bytes, ret);
	    else
		fprintf(stderr, "Error during write: %s\n", strerror(errno));
	    fclose(out);
	    return;
	}

	cur += bytes;
    }

    fclose(out);
}

/*
 * Dump all residency filenames associated with a file, or all files
 * within a directory.
 */

static void
DumpAllFiles(int argc, char **argv, struct vnodeData *vdatacwd,
	     VolumeDiskData * vol)
{
#ifdef RESIDENCY
    struct vnodeData *vdata, *nvdata;
    struct DirCursor cursor;
    struct DirEntry *ep;
    FILE *f = stdout;
    int c, i;
    int dflag = 0, fflag = 0, errflg = 0;

    optind = 1;

    while ((c = getopt(argc, argv, "df:")) != EOF)
	switch (c) {
	case 'd':
	    dflag++;
	    break;
	case 'f':
	    if ((f = fopen(optarg, "a")) == NULL) {
		fprintf(stderr, "Cannot open \"%s\": %s\n", optarg,
			strerror(errno));
		return;
	    }
	    fflag++;
	    break;
	case 'h':
	case '?':
	default:
	    errflg++;
	}

    if (errflg || argc == optind) {
	fprintf(stderr, "Usage: %s [-d] [-f filename] file " "[file ...]\n",
		argv[0]);
	if (fflag)
	    fclose(f);
	return;
    }

    for (i = optind; i < argc; i++) {

	if ((vdata = FindFile(vdatacwd, argv[i])) == NULL)
	    continue;

	if (vdata->vnode->type == vDirectory && !dflag) {

	    ResetDirCursor(&cursor, vdata);

	    while ((ep = ReadNextDir(&cursor, vdata)) != NULL) {

		if (!(nvdata = GetVnode(ntohl(ep->fid.vnode)))) {
		    fprintf(stderr,
			    "Cannot find vnode " "entry for %s (%d)\n",
			    ep->name, ntohl(ep->fid.vnode));
		    continue;
		}


		if (!fflag) {
		    printf("Residency locations for %s:\n", ep->name);

		    if (nvdata->dumpdata)
			printf("Local disk (in dump " "file)\n");
		}

		DumpAllResidencies(f, nvdata, vol);

	    }

	} else {
	    if (!fflag) {
		printf("Residency locations for %s:\n", argv[i]);

		if (vdata->dumpdata)
		    printf("Local disk (in dump file)\n");
	    }

	    DumpAllResidencies(f, vdata, vol);
	}
    }

    if (fflag)
	fclose(f);
#else /* RESIDENCY */
# 1832 "../../../../openafs/src/tools/dumpscan/dumptool.c"
    fprintf(stderr,
	    "The \"file\" command is not available in the non-"
	    "MRAFS version of dumptool.\n");
#endif /* RESIDENCY */
# 1836 "../../../../openafs/src/tools/dumpscan/dumptool.c"
    return;
}

/*
 * Take a vnode, traverse the vnode chain, and dump out all files on
 * all residencies corresponding to that parent vnode.
 */

#ifdef RESIDENCY
static void
DumpAllResidencies(FILE * f, struct vnodeData *vdata,
		   struct VolumeDiskData *vol)
{
    unsigned int nextVnodeNum;

    while (nextVnodeNum = vdata->vnode->NextVnodeId) {
	if ((vdata = GetVnode(nextVnodeNum)) == NULL) {
	    fprintf(stderr,
		    "We had a pointer to %lu in it's "
		    "vnode chain, but there\nisn't a record of "
		    "it!  The dump might be corrupt.\n", nextVnodeNum);
	    return;
	}

	if (vdata->vnode->type == vFidLookup)
	    DumpVnodeFile(f, vdata->vnode, vol);
    }

    return;
}
#endif
# 1867 "../../../../openafs/src/tools/dumpscan/dumptool.c"


/*
 * Given a directory vnode and a filename, return the vnode corresponding
 * to the file in that directory.
 *
 * We now handle pathnames with directories in them.
 */

static struct vnodeData *
FindFile(struct vnodeData *vdatacwd, char *filename)
{
    struct DirHeader *dhp;
    struct DirEntry *ep;
    int i, num;
    struct vnodeData *vdata;
    char *c, newstr[MAXPATHLEN];

    if (!vdatacwd->filedata) {
	fprintf(stderr, "There is no vnode data for this " "directory!\n");
	return NULL;
    }

    /*
     * If we have a "/" in here, look up the vnode data for the
     * directory (everything before the "/") and use that as our
     * current directory.  We automagically handle multiple directories
     * by using FindFile recursively.
     */

    if ((c = strrchr(filename, '/')) != NULL) {

	strncpy(newstr, filename, c - filename);
	newstr[c - filename] = '\0';

	if ((vdatacwd = FindFile(vdatacwd, newstr)) == NULL)
	    return NULL;

	if (vdatacwd->vnode->type != vDirectory) {
	    fprintf(stderr, "%s: Not a directory\n", newstr);
	    return NULL;
	}

	filename = c + 1;
    }

    dhp = (struct DirHeader *)vdatacwd->filedata;

    i = DirHash(filename);

    num = ntohs(dhp->hashTable[i]);

    while (num) {
	ep = (struct DirEntry *)(vdatacwd->filedata + (num * 32));
	if (strcmp(ep->name, filename) == 0)
	    break;
	num = ntohs(ep->next);
    }

    if (!num) {
	fprintf(stderr, "%s: No such file or directory\n", filename);
	return NULL;
    }

    if ((vdata = GetVnode(ntohl(ep->fid.vnode))) == NULL) {
	fprintf(stderr, "%s: No vnode information for %u found\n", filename,
		ntohl(ep->fid.vnode));
	return NULL;
    }

    return vdata;
}

/*
 * Reset a structure containing the current directory scan location
 */

static void
ResetDirCursor(struct DirCursor *cursor, struct vnodeData *vdata)
{
    struct DirHeader *dhp;

    cursor->hashbucket = 0;

    dhp = (struct DirHeader *)vdata->filedata;

    cursor->entry = ntohs(dhp->hashTable[0]);
}

/*
 * Given a cursor and a directory entry, return the next entry in the
 * directory.
 */

static struct DirEntry *
ReadNextDir(struct DirCursor *cursor, struct vnodeData *vdata)
{
    struct DirHeader *dhp;
    struct DirEntry *ep;

    dhp = (struct DirHeader *)vdata->filedata;

    if (cursor->entry) {
	ep = (struct DirEntry *)(vdata->filedata + (cursor->entry * 32));
	cursor->entry = ntohs(ep->next);
	return ep;
    } else {
	while (++(cursor->hashbucket) < NHASHENT) {
	    cursor->entry = ntohs(dhp->hashTable[cursor->hashbucket]);
	    if (cursor->entry) {
		ep = (struct DirEntry *)(vdata->filedata +
					 (cursor->entry * 32));
		cursor->entry = ntohs(ep->next);
		return ep;
	    }
	}
    }

    return NULL;
}

/*
 * Given a string, split it up into components a la Unix argc/argv.
 *
 * This code is most stolen from ftp.
 */

static void
MakeArgv(char *string, int *argc, char ***argv)
{
    static char *largv[64];
    char **la = largv;
    char *s = string;
    static char argbuf[CMDBUFSIZE];
    char *ap = argbuf;

    *argc = 0;
    *argv = largv;

    while ((*la++ = GetToken(s, &s, ap, &ap)) != NULL)
	(*argc)++;
}

/*
 * Return a pointer to the next token, and update the current string
 * position.
 */

static char *
GetToken(char *string, char **nexttoken, char argbuf[], char *nextargbuf[])
{
    char *sp = string;
    char *ap = argbuf;
    int got_one = 0;

  S0:
    switch (*sp) {

    case '\0':
	goto OUTTOKEN;

    case ' ':
    case '\t':
	sp++;
	goto S0;

    default:
	goto S1;
    }

  S1:
    switch (*sp) {

    case ' ':
    case '\t':
    case '\0':
	goto OUTTOKEN;		/* End of our token */

    case '\\':
	sp++;
	goto S2;		/* Get next character */

    case '"':
	sp++;
	goto S3;		/* Get quoted string */

    default:
	*ap++ = *sp++;		/* Add a character to our token */
	got_one = 1;
	goto S1;
    }

  S2:
    switch (*sp) {

    case '\0':
	goto OUTTOKEN;

    default:
	*ap++ = *sp++;
	got_one = 1;
	goto S1;
    }

  S3:
    switch (*sp) {

    case '\0':
	goto OUTTOKEN;

    case '"':
	sp++;
	goto S1;

    default:
	*ap++ = *sp++;
	got_one = 1;
	goto S3;
    }

  OUTTOKEN:
    if (got_one)
	*ap++ = '\0';
    *nextargbuf = ap;		/* Update storage pointer */
    *nexttoken = sp;		/* Update token pointer */

    return got_one ? argbuf : NULL;
}

/*
 * Insert vnodes into our hash table.
 */

static struct vnodeData *
InsertVnode(unsigned int vnodeNumber, struct VnodeDiskObject *vnode)
{
    struct VnodeDiskObject *nvnode;
    struct vnodeData *vdata;
    static int curSmallVnodeIndex = 0;
    static int curLargeVnodeIndex = 0;
    struct vnodeData ***vnodeIndex;
    int *curIndex;

    nvnode = (struct VnodeDiskObject *)malloc(sizeof(struct VnodeDiskObject));

    if (!nvnode) {
	if (verbose)
	    fprintf(stderr, "Unable to allocate space for vnode\n");
	return NULL;
    }

    memcpy((void *)nvnode, (void *)vnode, sizeof(struct VnodeDiskObject));

    if (vnodeNumber & 1) {
	vnodeIndex = &LargeVnodeIndex;
	curIndex = &curLargeVnodeIndex;
    } else {
	vnodeIndex = &SmallVnodeIndex;
	curIndex = &curSmallVnodeIndex;
    }

    vdata = (struct vnodeData *)malloc(sizeof(struct vnodeData));

    vdata->vnode = nvnode;
    vdata->vnodeNumber = vnodeNumber;
    vdata->dumpdata = 0;
    vdata->filedata = 0;
    vdata->datalength = 0;

    (*vnodeIndex)[(*curIndex)++] = vdata;

    return vdata;
}

/*
 * Routine to retrieve a vnode from the hash table.
 */

static struct vnodeData *
GetVnode(unsigned int vnodeNumber)
{
    struct vnodeData vnode, *vnodep, **tmp;

    vnode.vnodeNumber = vnodeNumber;
    vnodep = &vnode;

    tmp = (struct vnodeData **)
	bsearch((void *)&vnodep,
		vnodeNumber & 1 ? LargeVnodeIndex : SmallVnodeIndex,
		vnodeNumber & 1 ? numLargeVnodes : numSmallVnodes,
		sizeof(struct vnodeData *), CompareVnode);

    return tmp ? *tmp : NULL;
}

/*
 * Our comparator function for bsearch
 */

static int
CompareVnode(const void *node1, const void *node2)
{
    struct vnodeData **vnode1 = (struct vnodeData **)node1;
    struct vnodeData **vnode2 = (struct vnodeData **)node2;

    if ((*vnode1)->vnodeNumber == (*vnode2)->vnodeNumber)
	return 0;
    else if ((*vnode1)->vnodeNumber > (*vnode2)->vnodeNumber)
	return 1;
    else
	return -1;
}

#ifdef RESIDENCY
/*
 * Dump out the filename corresponding to a particular vnode.
 *
 * This routine has the following dependancies:
 *
 * - Only will work on UFS filesystems at this point
 * - Has to talk to the rsserver.
 * - Can only determine UFS algorithm type when run on the same machine
 *   as the residency (unless you manually specify algorithm information)
 */

static int
DumpVnodeFile(FILE * f, struct VnodeDiskObject *vnode, VolumeDiskData * vol)
{
    static int rscache = 0;
    static rsaccessinfoList rsnlist = { 0, 0 };
    char MountPoint[MAXPATHLEN + 1];
    char FileName[MAXPATHLEN + 1];
    unsigned int Size, Level[4];
    unsigned int DeviceTag, Algorithm;
    FileSystems *FSInfo;
    int i, found, FSType, rsindex;

    /*
     * Maybe we found out something about this residency via the
     * command-line; check that first.
     */

    rsindex = ffs(VLkp_Residencies(vnode)) - 1;

    /*
     * We need to get information from the rsserver (so we can
     * find out the device tag for a given residency).  If we
     * haven't cached that, talk to the rsserver to get it.
     * If we have info about this already, then don't talk to
     * the rsserver (this lets us still do disaster recovery if
     * MR-AFS is completely hosed).
     */

    if (!rscache && rscmdlineinfo[rsindex].DeviceTag == -1) {
	int code;

	code = ServerInitResidencyConnection();

	if (code) {
	    fprintf(stderr,
		    "ServerInitResidencyConnection failed " "with code %d\n",
		    code);
	    return -1;
	}

	code = rs_GetResidencySummary(ServerRequestorId, &rsnlist);

	if (code) {
	    fprintf(stderr, "rs_GetResidencySummary failed " "with code %d\n",
		    code);
	    return -1;
	}

	rscache = 1;
    }

    /*
     * For a given residency (as specified in the vnode),
     * find out it's device tag number, either via the rsserver
     * or via the command line.
     */

    if (rscmdlineinfo[rsindex].DeviceTag != -1) {
	DeviceTag = rscmdlineinfo[rsindex].DeviceTag;
	found = 1;
    } else
	for (i = 0, found = 0; (i < rsnlist.rsaccessinfoList_len) && (!found);
	     i++) {
	    if (rsnlist.rsaccessinfoList_val[i].id.residency ==
		VLkp_Residencies(vnode)) {
		found = 1;
		DeviceTag = rsnlist.rsaccessinfoList_val[i].devicetagnumber;
		break;
	    }
	}

    if (!found) {
	if (verbose)
	    fprintf(stderr,
		    "Unable to find residency %d in "
		    "rsserver database, aborting\n", VLkp_Residencies(vnode));
	return -1;
    }

    /*
     * Okay, now we've got the DeviceTag ... which we can use to
     * lookup the on-disk configuration information (which we
     * assume is locally stored).  We also need the DeviceTag to
     * print out which partition we're using (but that comes later).
     *
     * We lookup the on-disk configuration information by calling
     * Ufs_GetFSInfo() to get the configuration information on the
     * filesystems specified by the given DeviceTag.
     *
     * Before we call Ufs_GetFSInfo, check the command-line cache;
     * if we got something via the command-line, don't go to disk.
     */

    if (rscmdlineinfo[rsindex].FSType == -1
	&& Ufs_GetFSInfo(&FSInfo, DeviceTag)) {
	if (verbose)
	    fprintf(stderr,
		    "Ufs_GetFSInfo failed for DeviceTag "
		    "%d, Residency %d\n", DeviceTag, VLkp_Residencies(vnode));
	return -1;
    }

    /*
     * The FSInfo structure has the last two things we need: the
     * FSType (ufs, slowufs, etc etc), and the usage algorithm (which
     * ends up being how many directories are being used on the
     * residency filesystem).
     *
     * With these last two parameters, use routines stolen from
     * ufsname to generate the filename.
     *
     * (Actually, I lied - we also need the "Size" parameter, which
     * we can also get from FSInfo);
     */

    if (rscmdlineinfo[rsindex].FSType != -1) {
	FSType = rscmdlineinfo[rsindex].FSType;
	Algorithm = rscmdlineinfo[rsindex].Algorithm;
	Size = rscmdlineinfo[rsindex].Size;
    } else {
	FSType = FSInfo->FileSystems_u.UfsInterface.FSType;
	Algorithm = FSInfo->FileSystems_u.UfsInterface.Algorithm;
	if (FSInfo->FileSystems_u.UfsInterface.Directories[1] == 0)
	    Size = 0;
	else if (FSInfo->FileSystems_u.UfsInterface.Directories[1] == 16)
	    Size = 1;
	else if (FSInfo->FileSystems_u.UfsInterface.Directories[1] == 256)
	    Size = 2;
	else {
	    if (verbose)
		fprintf(stderr, "Unknown directory size %d, " "aborting\n",
			FSInfo->FileSystems_u.UfsInterface.Directories[1]);
	    return -1;
	}
    }

    /*
     * First, generate our mount point from the DeviceTag and
     * FSType.
     */

    DEVICETAGNUMBERTOMOUNTPOINT(MountPoint, DeviceTag, FSType);

    /*
     * Then, generate the "level" (directory bitmasks) from the
     * file tags, size, and algorithm
     */

    UfsTagsToLevel(VLkp_FileTag1(vnode), VLkp_FileTag2(vnode), Algorithm,
		   Size, Level, VLkp_ParentVnodeId(vnode),
		   VLkp_ParentUniquifierId(vnode));

    /*
     * Finally, take the above information and generate the
     * corresponding filename (this macro ends up being a
     * sprintf() call)
     */

    TAGSTONAME(FileName, MountPoint, Level, Directories[Size][1],
	       vol->parentId, VLkp_ParentVnodeId(vnode),
	       VLkp_ParentUniquifierId(vnode), Algorithm);

    fprintf(f, "%s\n", FileName);

    return 0;
}
#endif
# 2359 "../../../../openafs/src/tools/dumpscan/dumptool.c"

/*
 * Read a 16 bit integer in network order
 */

static int
ReadInt16(FILE * f, unsigned short *s)
{
    unsigned short in;

    if (fread((void *)&in, sizeof(in), 1, f) != 1) {
	if (verbose)
	    fprintf(stderr, "ReadInt16 failed!\n");
	return -1;
    }

    *s = ntohs(in);

    return 0;
}


/*
 * Read a 32 bit integer in network order
 */

static int
ReadInt32(FILE * f, unsigned int *i)
{
    unsigned int in;

    if (fread((void *)&in, sizeof(in), 1, f) != 1) {
	if (verbose)
	    fprintf(stderr, "ReadInt32 failed!\n");
	return -1;
    }

    *i = ntohl((unsigned long)in);

    return 0;
}

/*
 * Read a string from a dump file
 */

static int
ReadString(FILE * f, char *string, int maxlen)
{
    int c;

    while (maxlen--) {
	if ((*string++ = getc(f)) == 0)
	    break;
    }

    /*
     * I'm not sure what the _hell_ this is supposed to do ...
     * but it was in the original dump code
     */

    if (string[-1]) {
	while ((c = getc(f)) && c != EOF);
	string[-1] = 0;
    }

    return 0;
}

static int
ReadByteString(FILE * f, void *s, int size)
{
    unsigned char *c = (unsigned char *)s;

    while (size--)
	*c++ = getc(f);

    return 0;
}

/*
 * The directory hashing algorithm used by AFS
 */

static int
DirHash(char *string)
{
    /* Hash a string to a number between 0 and NHASHENT. */
    unsigned char tc;
    int hval;
    int tval;
    hval = 0;
    while ((tc = (*string++)) != '\0') {
	hval *= 173;
	hval += tc;
    }
    tval = hval & (NHASHENT - 1);
#ifdef AFS_CRAY_ENV		/* actually, any > 32 bit environment */
    if (tval == 0)
	return tval;
    else if (hval & 0x80000000)
	tval = NHASHENT - tval;
#else /* AFS_CRAY_ENV */
# 2462 "../../../../openafs/src/tools/dumpscan/dumptool.c"
    if (tval == 0)
	return tval;
    else if (hval < 0)
	tval = NHASHENT - tval;
#endif /* AFS_CRAY_ENV */
# 2467 "../../../../openafs/src/tools/dumpscan/dumptool.c"
    return tval;
}

#ifdef RESIDENCY
/*
 * Sigh, we need this for the AFS libraries
 */

int
LogErrors(int level, char *a, char *b, char *c, char *d, char *e, char *f,
	  char *g, char *h, char *i, char *j, char *k)
{
    if (level <= 0) {
	fprintf(stderr, a, b, c, d, e, f, g, h, i, j, k);
    }
    return 0;
}

/*
 * These are routines taken from AFS libraries and programs.  Most of
 * them are from ufsname.c, but a few are from the dir library (the dir
 * library has a bunch of hidden dependancies, so it's not suitable to
 * include it outright).
 */

UfsEntropiesToTags(HighEntropy, LowEntropy, Algorithm, FileTag1, FileTag2)
     uint32_t HighEntropy;
     uint32_t LowEntropy;
     uint32_t Algorithm;
     uint32_t *FileTag1;
     uint32_t *FileTag2;
{
    int i;

    if ((Algorithm > UFS_ALGORITHMS) || (Algorithm <= 0))
	return -1;
    *FileTag1 = 0;
    *FileTag2 = 0;
    for (i = 0; i < 32; ++i) {
	if (UfsEntropy[Algorithm - 1][i] < 32)
	    *FileTag1 |=
		((HighEntropy & (1 << i)) ==
		 0) ? 0 : 1 << UfsEntropy[Algorithm - 1][i];
	else
	    *FileTag2 |=
		((HighEntropy & (1 << i)) ==
		 0) ? 0 : 1 << (UfsEntropy[Algorithm - 1][i] - 32);
    }
    for (i = 32; i < 64; ++i) {
	if (UfsEntropy[Algorithm - 1][i] < 32)
	    *FileTag1 |=
		((LowEntropy & (1 << (i - 32))) ==
		 0) ? 0 : 1 << UfsEntropy[Algorithm - 1][i];
	else
	    *FileTag2 |=
		((LowEntropy & (1 << (i - 32))) ==
		 0) ? 0 : 1 << (UfsEntropy[Algorithm - 1][i] - 32);
    }
    return 0;
}

uint32_t
UfsTagsToHighEntropy(FileTag1, FileTag2, Algorithm)
     uint32_t FileTag1;
     uint32_t FileTag2;
     uint32_t Algorithm;
{
    int i;
    uint32_t Value;

    Value = 0;
    for (i = 0; i < 32; ++i) {
	if (UfsEntropy[Algorithm - 1][i] < 32)
	    Value |= ((FileTag1 & (1 << UfsEntropy[Algorithm - 1][i]))
		      == 0) ? 0 : 1 << i;
	else
	    Value |=
		((FileTag2 & (1 << (UfsEntropy[Algorithm - 1][i] - 32))) ==
		 0) ? 0 : 1 << i;
    }
    return Value;
}

uint32_t
UfsTagsToLowEntropy(FileTag1, FileTag2, Algorithm)
     uint32_t FileTag1;
     uint32_t FileTag2;
     uint32_t Algorithm;
{
    int i;
    uint32_t Value;

    Value = 0;
    for (i = 32; i < 64; ++i) {
	if (UfsEntropy[Algorithm - 1][i] < 32)
	    Value |= ((FileTag1 & (1 << UfsEntropy[Algorithm - 1][i]))
		      == 0) ? 0 : 1 << (i - 32);
	else
	    Value |=
		((FileTag2 & (1 << (UfsEntropy[Algorithm - 1][i] - 32))) ==
		 0) ? 0 : 1 << (i - 32);
    }
    return Value;
}

UfsTagsToLevel(FileTag1, FileTag2, Algorithm, Size, Sections, vnode,
	       Uniquifier)
     uint32_t FileTag1;
     uint32_t FileTag2;
     uint32_t Algorithm;
     uint32_t Size;
     uint32_t Sections[4];
     uint32_t vnode;
     uint32_t Uniquifier;
{
    uint32_t HighEntropy;
    uint32_t LowEntropy;

    switch (Algorithm) {
    case 1:
	LowEntropy = UfsTagsToLowEntropy(FileTag1, FileTag2, Algorithm);
	HighEntropy = UfsTagsToHighEntropy(FileTag1, FileTag2, Algorithm);
	Sections[0] = HighEntropy % Directories[Size][0];
	HighEntropy /= Directories[Size][0];
	if (Directories[Size][1]) {
	    Sections[1] = HighEntropy % Directories[Size][1];
	    HighEntropy /= Directories[Size][1];
	    Sections[2] = HighEntropy;
	    Sections[3] = LowEntropy;
	} else {
	    Sections[1] = HighEntropy;
	    Sections[2] = LowEntropy;
	}
	break;
    case 2:
	Sections[0] = FileTag1 & 0xff;
	if (Directories[Size][1]) {
	    Sections[1] = Uniquifier & 0xff;
	    if (Directories[Size][1] == 16)
		Sections[1] &= 0xf;
	    Sections[2] = FileTag1;
	    Sections[3] = FileTag2;
	} else {
	    Sections[1] = FileTag1;
	    Sections[2] = FileTag2;
	}
	break;
    case 3:
	Sections[0] = FileTag1 & 0xff;
	if (Directories[Size][1]) {
	    Sections[1] = (vnode >> 1) & 0xff;
	    if (Directories[Size][1] == 16)
		Sections[1] &= 0xf;
	    Sections[2] = FileTag1;
	    Sections[3] = FileTag2;
	} else {
	    Sections[1] = FileTag1;
	    Sections[2] = FileTag2;
	}
	break;
    default:
	fprintf(stderr, "UfsTagsToLevel: bad algorithm %lu!\n", Algorithm);
	return -1;
    }
    return 0;
}

#if 0 /* expanded by -frewrite-includes */
#include <afs/afscbdummies.h>
#endif /* expanded by -frewrite-includes */
# 2635 "../../../../openafs/src/tools/dumpscan/dumptool.c"
#endif /* RESIDENCY */
# 2636 "../../../../openafs/src/tools/dumpscan/dumptool.c"
