/* <vms/lib/dirdef.h>
 *
 *	F11DEF - directory record definitions		[not in Starlet]
 */
#ifndef _DIRDEF_H
#define _DIRDEF_H

/*
   Directory entry structure for Files-11 Structure Level 2
 */
/* directory entry type codes */
#define DIR$C_FID	0	/* normal file ID */
#define DIR$C_LINKNAME	1	/* symbolic name */

#define DIR$S_NAME	80	/* maximum length of name string */
#define DIR$S_TYPE	3
#define DIR$S_FID	6

#define DIR$K_LENGTH	6	/* length of directory entry overhead */
#define DIR$C_LENGTH	6
#define DIR$K_VERSION	8	/* size of each version entry */
#define DIR$C_VERSION	8
#define DIR$S_DIRDEF	6
struct dirdef {
    unsigned short dir$w_size;		/* size of directory record in bytes */
    unsigned short dir$w_verlimit;	/* maximum number of versions */
    union {
	unsigned char dir$b_flags;	/* status flags */
	struct {
	    unsigned dir$v_type    : 3; /* directory entry type */
	    unsigned		   : 3; /* reserved */
	    unsigned dir$v_nextrec : 1; /* another record of same name follows */
	    unsigned dir$v_prevrec : 1; /* another record of same name precedes */
	} dir$r_flags_bits;
    } dir$r_flags_overlay;
    unsigned char dir$b_namecount;	/* byte count of name string */
    char dir$t_name[1];			/* name string (variable length) */
	/* the version numbers and file ID's follow the */
	/* variable length name area in the form of a	*/
	/* blockvector.  Each entry is as follows:	*/
};
#define DIR$S_DIRDEF1	8
struct dirdef1 {
    short dir$w_version;			/* version number */
    union {
	unsigned short dir$w_fid[3];		/* file ID */
	struct {
	    unsigned short dir$w_fid_num;	/* file number */
	    unsigned short dir$w_fid_seq;	/* file sequence number */
	    union {
		unsigned short dir$w_fid_rvn;	/* relative volume number */
		struct {
		    unsigned char dir$b_fid_rvn; /* alternate format RVN */
		    unsigned char dir$b_fid_nmx; /* alternate format file number extension */
		} dir$r_fid_rvn_fields;
	    } dir$r_fid_rvn_overlay;
	} dir$r_fid_fields;
    } dir$r_fid_overlay;
};
#define DIR$S_DIRDEF2	1
struct dirdef2 {
    char dir$t_linkname[1];	/* symbolic link name (counted string) */
};

#endif	/*_DIRDEF_H*/
