1 /*
2  * This file belongs to FreeMiNT. It's not in the original MiNT 1.12
3  * distribution. See the file CHANGES for a detailed log of changes.
4  *
5  *
6  * Copyright 2000 Frank Naumann <fnaumann@freemint.de>
7  * All rights reserved.
8  *
9  * This file is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * This file is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  *
24  * Author: Frank Naumann <fnaumann@freemint.de>
25  * Started: 2000-10-30
26  *
27  * Please send suggestions, patches or bug reports to me or
28  * the MiNT mailing list.
29  *
30  */
31 
32 # ifndef _mint_filedesc_h
33 # define _mint_filedesc_h
34 
35 #include "mint/emu_tos.h"
36 
37 # define NDFILE		1024
38 # define NDEXTENT	50
39 
40 struct filedesc
41 {
42 	struct file	**ofiles;	/* file structures for open files */
43 	uchar		*ofileflags;	/* per-process open file flags */
44 	short		nfiles;		/* number of open files allocated */
45 	short		pad2;
46 #if 0 /* XXX */
47 	short		lastfile;	/* high-water mark of ofiles */
48 	short		freefile;	/* approx. next free file */
49 #endif
50 	long		links;		/* reference count */
51 
52 
53 	DIR		*searches;	/* open directory searches	*/
54 
55 	/* TOS emulation */
56 
57 	DTABUF	*dta;			/* current DTA			*/
58 # define NUM_SEARCH	10		/* max. number of searches	*/
59 	DTABUF *srchdta[NUM_SEARCH];	/* for Fsfirst/next		*/
60 	DIR	srchdir[NUM_SEARCH];	/* for Fsfirst/next		*/
61 	long	srchtim[NUM_SEARCH];	/* for Fsfirst/next		*/
62 
63 	/* XXX total crap
64 	 * there are something like this "ofiles[-3]" over the src
65 	 * before we dynamically alloc the ofiles we have
66 	 * to fix all the places
67 	 */
68 	short		pad1;
69 	short		bconmap;	/* Bconmap mapping */
70 	struct file	*midiout;	/* MIDI output */
71 	struct file	*midiin;	/* MIDI input */
72 	struct file	*prn;		/* printer */
73 	struct file	*aux;		/* auxiliary tty */
74 	struct file	*control;	/* control tty */
75 
76 	struct file	*dfiles [NDFILE];
77 	uchar		dfileflags [NDFILE];
78 };
79 
80 struct cwd
81 {
82 	long		links;		/* reference count */
83 	ushort		cmask;		/* mask for file creation */
84 	ushort		pad;
85 
86 	fcookie		currdir;	/* current directory */
87 	fcookie		rootdir;	/* root directory */
88 	char		*root_dir;	/* XXX chroot emulation */
89 
90 	/* DOS emulation
91 	 */
92 	ushort		curdrv;		/* current drive */
93 	ushort		pad2;
94 	fcookie 	root[NDRIVES];	/* root directories */
95 	fcookie		curdir[NDRIVES];/* current directory */
96 };
97 
98 
99 # endif /* _mint_filedesc_h */
100