/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* onc72L src/oncplus/usr/include/oncplus/nfs/nfs_load.h 1.10.2.2         */
/*                                                                        */
/*                                                                        */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1996,2017              */
/* All Rights Reserved                                                    */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

/*      @(#)nfs_misc.h  1.6 91/03/08 NFSSRC4.1 from 2.32 90/07/31 SMI   */


#ifndef __NFS_MISC_HEADER__
#define __NFS_MISC_HEADER__

/* For mid_t */
#include <sys/types.h>

/*
 * sysload, config but no load() to resolve the deferred bind 
 * this is generally not used
 */
#define NFSLOAD_NOBIND		0
					
/*
 * sysload, config, and load() to bind.
 * Commonly used.
 */
#define NFSLOAD_BIND		1 

/*
 * these defines are to be used in conjunction with the librpcsvc
 * load_nfs() call
 */

#define NFS_KLOAD_SERV  5       /* server extension nfs.ext     */
#define NFS_KLOAD_ACL   4       /* acl extension acl.ext        */
#define NFS_KLOAD_CLNT  3       /* client extension clnt.ext    */
#define NFS_KLOAD_KRPC  2       /* rpc extension krpc.ext       */
#define NFS_KLOAD_KDES  1       /* des extenstion kdes.ext      */
#define NFS_KLOAD_STAT  0       /* flag for laod_nfs to return 
                                 * stat on which extensions are
				 * loaded
				 */
/***
 ***  These are different values than the previous implementation
 ***  to ensure we do not get confused.
 ***
 ***/

/*
 * these defines are to be used in conjunction with the librpcsvc
 * load_onc() call
 */

#define ONC_KLOAD_AUTOFS   14  	/* AutoFS			*/
#define ONC_KLOAD_CFS   13	/* CacheFS			*/      
#define ONC_KLOAD_ONC   12      /* The all knowing ONCPLUS ext  */
#define ONC_KLOAD_KDES	11	/* des extenstion kdes.ext	*/
#define ONC_KLOAD_STAT	10	/* for laod_onc to return 
                                 * stat on which extensions are
				 * loaded
				 */
#define ONC_KLOAD_KRPC  9				

/*
 * sysload, config but no load() to resolve the deferred bind 
 * this is generally not used
 */
#define ONCLOAD_NOBIND		20
					
/*
 * sysload, config, and load() to bind.
 * Commonly used.
 */
#define ONCLOAD_BIND		21


struct oncload {
	int   id;
	char  *sym;
	char  *ext_path;
	int   exports_syscalls;
	char  *load_path;
};

typedef struct oncload oncload_t;

#define ONCEXT_HAS_SYSCALLS     1
#define ONCEXT_NO_SYSCALLS      0

/*
 * explicit pathnames to kernel extensions (the load ext
 * is used for deferred binding of system calls)
 */
#define AUTOFS_KERNEXT_PATH  "/usr/lib/drivers/autofs.ext"
#define NFS_KERNEXT_PATH  "/usr/lib/drivers/nfs.ext" 
#define KDES_KERNEXT_PATH "/usr/lib/drivers/nfs_kdes.ext" 
#define CFS_KERNEXT_PATH  "/usr/lib/drivers/cachefs.ext" 
#define KRPC_KERNEXT_PATH "/usr/lib/drivers/krpc.ext"

#ifndef __64BIT__
#define NFS_LOADEXT_PATH  "/usr/lib/drivers/nfs.load"
#define AUTOFS_LOADEXT_PATH  "/usr/lib/drivers/autofs.load"
#define CFS_LOADEXT_PATH  "/usr/lib/drivers/cachefs.load"
#define KRPC_LOADEXT_PATH "/usr/lib/drivers/krpc.load"
#else
#define NFS_LOADEXT_PATH  "/usr/lib/drivers/nfs.load64"
#define AUTOFS_LOADEXT_PATH  "/usr/lib/drivers/autofs.load64"
#define CFS_LOADEXT_PATH  "/usr/lib/drivers/cachefs.load64"
#define KRPC_LOADEXT_PATH "/usr/lib/drivers/krpc.load64"
#endif


/*
 * Structure of data to be passed to the oncplus extensions.
 * nfs, autofs, and cachefs are loaded in load_onc.c 
 *
 * stnfs is loaded in stnfsmnthelp.c, the stnfs structure is
 * defined in stnfs.h
 */
struct nfs_init_data {		/* version 2 of nfs_init_data structure */	
	mid_t kmid;		/* ID of extension */
	int vers;		/* Currently 2 */
	u_short tcp_min;	/* Min TCP local port for client */
	u_short tcp_max;	/* Max TCP local port for client */
	u_short udp_min;	/* Min UDP local port for client */
	u_short udp_max;	/* Max UDP local port for client */
	int	major;		/* Major no for nfs mounted FS */
};

struct nfs_init_data1 {		/* version 1 of nfs_init_data structure */
	mid_t kmid;		/* ID of extension */
	int vers;               /* version no of nfs_init_data structure */
	u_short tcp_min;        /* Min TCP local port for client */
	u_short tcp_max;        /* Max TCP local port for client */
	u_short udp_min;        /* Min UDP local port for client */
	u_short udp_max;        /* Max UDP local port for client */
};

struct nfs_init_data_header {
	mid_t kmid;
	int vers;
};

union nfs_init_data_com {
	struct nfs_init_data1 nid_v1;
	struct nfs_init_data  nid_v2;
	struct nfs_init_data_header nid_hdr;
};
typedef union nfs_init_data_com nfs_init_data_com_t;

#define NFS_INIT_DATA_VERS 2

struct autofs_init_data {
	mid_t   aid_kmid;
	int     aid_major;
};
typedef struct autofs_init_data autofs_init_data_t;

struct cachefs_init_data {
	mid_t   cid_kmid;
	int     cid_major;
};
typedef struct cachefs_init_data cachefs_init_data_t;

extern int load_onc(int, int);


#endif /*  !__NFS_MISC_HEADER__ */
