# ifndef NO_WHAT
/*
 *      SCCS file type - Emulator Include File
 *
 *      What identification string:
 */
static char *_S_hEDI = "@(#)EDI.h	3.7";
# endif

/*
COPYRIGHT:  1980, by Ford Aerospace and Communications Corp.
ADDRESS:    Ford Aerospace and Communications Corp.
            Western Development Laboratories
            3939 Fabian Way
            Palo Alto, California 94303
            Attention: Software Technology Dept.
            Mail Stop: V02 

CPCI:  EMULATOR
	
CPC:   ER
CP:    EDI
TAG:   EDI
	
MODULE NAME:  C Directory Manager Interface include file

REFERENCES-
  A  Specs: N/A
  B5 Specs: N/A
  C5 Specs: 2.5.2

HISTORY:
  AUTHOR:   Strafford Wentworth
  VERSION:  3.7 of 8/18/83
  MODULE TYPE: Emulator Include File

SPECIAL NOTES:  
	This Interface is used by both the Emulator and NKSR.
*/


/* To be placed in KERcalls */
#define integer int

/* Path interpretation options are found in "EFI.h" */
/* They are (po_MKENTRY, po_REMOVE, po_LOCATE, po_CHDIR, po_EXEC) */

/* Note that the emulator refers to this var as pathOps */
#define pathOp chare

	/* Temporary constants */
#define cannot_do        1          /* XbdKcl  for testing purposes only */
#define bad_slot         20103      /* XnSgDes for testing purposes only */
#define not_file         10125      /* Temporary for XnoFile */
#define file_eof         10108      /* Temporary for XendOfFile */


#define SIZE_NAME         14                /* Longest allowable entry name             */
#define SIZE_ENTRY        SIZE_NAME + 4     /* Size of a directroy entry                */
#define PATH_SIZE         512               /* Longest allowable path name              */
#define NUM_ENTRIES       28                /* Number of direcory entries in 512 block  */

					    /* Seid of the root direcory "/"            */
					    /* Note root_nsp could not be used because of */
					    /* m4cc. DANGER.                              */
#define ROOT              (long) ((0201*NSP_offset)+5)

#ifdef  EMULATOR
#   define UDM_PATH       "/sysBin/UDM"         /* Path to executable directory manager     */
#   define PBB_PATH       "/sysBin/userPBB"     /* Path to process bootstrapper */
#else
#   define UDM_PATH       "/sys/sysbin/UDM"     /* Path to executable directory manager     */
#   define PBB_PATH       "/sys/sysbin/userPBB" /* Path to process bootstrapper */
#endif


#define EX_RETRY          100                 /* Exclusive use number of retries          */
#define EX_DELAY          10                /* Number of ticks to delay between retries */



/* Types of access mode. Used by permission_to */
#define Read        1
#define Write       2
#define Execute     3

   /* Read_flag  values */
#define  first_read   0
#define  normal_read  1
#define  no_read      2

/* Error returns for emulator calls */
#define  success      0
#define  failure     -1


       /*
	 * Directory entries are 18 bytes long. This is two bytes
	 * longer than UNIX directory entries.
	 */
	typedef struct
	{
	    seid     ESEID;
	    char     name[SIZE_NAME];

	} D_entry;


	/*
	 * Directories are built to fit on 512 boundaries. The reason for
	 * this restriction is so that path interprets will never read
	 * corrupted information.
	 * This structure for the directory is incorporated into the
	 * dir_buf structure
	 *
	 *      struct dir_struct
	 *      {
	 *          struct D_entry   dir_entry[NUM_ENTRIES];
	 *          char             fill[8];
	 *      }
	 */


	typedef struct
	{
	    openDescriptor   od;

	    /* These two entries must comprise 512 bytes */
	    D_entry        dir_entry[28];
	    char           fill[8];

	    seid           dir_SEID;
	    char           Read_flag;  /* (first_read, normal_read, no_read) */
	    fBlockNumber   block;

	} dir_buf;



	/* Error values visable at the top level of the directory manager */
#define UDM_error                         int
#define UDM_no_error                        0
#define UDM_cannot_do                       1
#define UDM_cannot_link                     2
#define UDM_cannot_unlink                   3
#define UDM_entry_exists                    4
#define UDM_entry_does_not_exist            5
#define UDM_cannot_open_directory           6
#define UDM_seid_refers_to_a_directory      7
#define UDM_cannot_create_directory         8
#define UDM_cannot_remove_directory         9
#define UDM_directory_not_empty             10
#define UDM_not_directory                   11
#define UDM_directory_not_writable          12
#define UDM_not_executable                  13
#define UDM_no_path                         14
#define UDM_not_found                       15
#define UDM_cannot_link_across_file_systems 16
#define UDM_cannot_mount                    17
#define UDM_cannot_unmount                  18
#define UDM_entry_not_writable              19


	/* udm entry points  */
#define udm_mkentry  0
#define udm_mkdir    1
#define udm_rm       2
#define udm_find     3
#define udm_mount    4
#define udm_unmount  5


#define udm_arg_block  Uab
#define udm_procedure  Uproc
#define udm_seid1      Us1
#define udm_seid2      Us2
#define udm_path_name  Upath
#define udm_path_op    Uop

	/* Entry points to EDI routines used only by NKSR routines: */
#define UDM_status        Ustat
#define UDM_status_wait   Ustatw
#define UDM_find          Ufind
#define UDM_find_wait     UFwait

	typedef struct
	{
	    int   udm_procedure;
	    seid  udm_seid1;
	    seid  udm_seid2;
	    char  udm_path_name[PATH_SIZE];
	    int   udm_path_op;

	}  udm_arg_block;


	/* A udm_status_block is returned in an IPC by the directory manager */
#define udm_status_block Usb
	typedef struct
	{
	    seid      udm_sender;      /* Seid of process that sent IPC */
	    char      udm_event;
	    char      udm_junk;
	    seid      udm_parent;
	    seid      udm_entry;
	    UDM_error udm_status;

	}  udm_status_block;


	struct pbb_info
	{
	    seid        s_image;
	    seid        u_image;
	    cardinal    s_arg_size;
	    cardinal    u_arg_size;
	    int         arg_data;
	};

