    typedef unsigned uint16;
    typedef int int16;

typedef struct time_s {
    uint16 t_date;
    uint16 t_time;
} time_t;


typedef struct off_t {
    uint16 o_blkno;  /* Block number */
    int16 o_offset;	/* Offset within block 0-511 */
} off_t;


typedef uint16 blkno_t;  /* Can have 65536 512-byte blocks in filesystem */

typedef struct dinode {
    uint16 i_mode;
    uint16 i_nlink;
    uint16 i_uid;
    uint16 i_gid;
    off_t    i_size;
    time_t   i_atime;
    time_t   i_mtime;
    time_t   i_ctime;
    blkno_t  i_addr[20];
} dinode;		/* Exactly 64 bytes long! */


struct	stat
{
	int16	st_dev;
	uint16	st_ino;
	uint16  st_mode;
	uint16	st_nlink;
	uint16	st_uid;
	uint16	st_gid;
	uint16	st_rdev;
	off_t	st_size;
	time_t	st_atime;
	time_t	st_mtime;
	time_t	st_ctime;
};

/* Bit masks for i_mode and st_mode */

#define	OTH_EX	0001
#define	OTH_WR	0002
#define OTH_RD	0004
#define	GRP_EX	0010
#define	GRP_WR	0020
#define GRP_RD	0040
#define	OWN_EX	0100
#define	OWN_WR	0200
#define OWN_RD	0400

#define SAV_TXT	01000
#define	SET_GID	02000
#define	SET_UID	04000

#define MODE_MASK 07777

#define	F_REG  0100000
#define	F_DIR	040000
#define F_PIPE  010000
#define	F_BDEV	060000
#define	F_CDEV	020000

#define	F_MASK	0170000



typedef struct cinode {
    int16    c_dev;		/* Inode's device */
    uint16   c_num;		/* Inode # */
    dinode   c_node;
    char     c_refs;		/* In-core reference count */
    char     c_dirty;           /* Modified flag. */
} cinode, *inoptr;

#define NULLINODE ((inoptr)NULL)


typedef struct direct {
    uint16 d_ino;
    char     d_name[14];
} direct;



typedef struct filesys {
    int16	s_mounted;
    uint16 	s_isize;
    uint16 	s_fsize;
    int16 	s_nfree;
    blkno_t	s_free[50];
    int16	s_ninode;
    uint16	s_inode[50];
    int16	s_fmod;
    time_t	s_time;
    blkno_t	s_tfree;
    uint16	s_tinode;
} filesys;

