/* adosfs_file.h 930819 Niklas Hallqvist <niklas@appli.se> */

/* Adapted from Frank J. Edwards' Amix AmigaDOS FS implementation.  */

#ifndef _ADOSFS_ADOSFS_FILE_H
#define _ADOSFS_ADOSFS_FILE_H

/***
Copyright (c) 1991, 1992 by Frank J. Edwards
See the file COPYRIGHT in this distribution for copyright details.
***/

/***********************************************************************
-  Software for the AmigaDOS filesystem implementation for use         -
-  on Amiga Unix 2.0 and later.                                        -
-                                                                      -
-  Copyright (c) 1991 by Frank J. Edwards                              -
-  All rights reserved.                                                -
***********************************************************************/

/*
 *	Many of the structures and define's in this file are derived from
 *	documentation located either in the AmigaDOS Manual, 3rd Edition,
 *	or from include file(s)/comments in /usr/amiga/src directory tree.
 */

struct a_file {
    ados_u_long	uf_type;	/* T.SHORT (2) */
    ados_u_long	uf_hkey;	/* Header key (pointer to self) */
    ados_u_long	uf_hiseq;	/* Total number of data blocks */
    ados_u_long	uf_hashsz;	/* Data block slots used (uf_data) */
    ados_u_long	uf_block0;	/* First data block */
    ados_u_long	uf_chksm;	/* Balance-to-zero checksum */
    ados_u_long	uf_data[NUMHASH];
    ados_u_long	uf_rsvp1[2];	/* Always 0 */
    ados_u_long	uf_prot;	/* Protection bits for this file */
    ados_u_long	uf_size;	/* Byte size */
    ados_u_long	uf_comment[23];	/* Comment as BCPL string */
    DateStamp	uf_cstmp;	/* Datestamp of last DIR-modified time */
    ados_u_char	uf_name[64];	/* File name (currently <= 30) */
    ados_u_long	uf_hashchn;	/* Pointer to next file in hash chain */
    ados_u_long	uf_parent;	/* Pointer to parent of this entry */
    ados_u_long	uf_exten;	/* Extension block */
    ados_long	uf_type2;	/* ST_FILE (-3) */
};

struct a_data {
    ados_u_long	fd_type;	/* T.DATA (x) */
    ados_u_long	fd_hkey;	/* Block number of file's keyblk */
    ados_u_long	fd_seqno;	/* Sequence number of this block */
    ados_u_long	fd_datasz;	/* Number of valid LONGs in this block */
    ados_u_long	fd_next;	/* Block number of next data block */
    ados_u_long	fd_chksm;	/* Balance-to-zero checksum */
};

#define AFILE(x)	((struct a_file *)(x))

#endif /* _ADOSFS_ADOSFS_FILE_H */
