Make (nearly all) argument values canonical by wrapping them in double
[AROS.git] / arch / all-hosted / filesys / emul_handler / emul_intern.h
blob13938d281ff8667d63436e7857c2049d0f08bcd0
1 #ifndef __EMUL_INTERN_H
2 #define __EMUL_INTERN_H
3 /*
4 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 $Id$
7 Desc: Internal header-file for emulation-handler.
8 Lang: english
9 */
11 #include <exec/libraries.h>
12 #include <exec/types.h>
13 #include <dos/dosextens.h>
14 #include <dos/exall.h>
16 #include <emul_host.h>
18 #include <sys/types.h>
20 /* Internal form of our handle */
21 struct filehandle
23 char * hostname; /* full host pathname (includes volume root prefix) */
24 char * name; /* full AROS name including pathname */
25 int type; /* type flags, see below */
26 char * volumename; /* volume name */
27 void * fd; /* Object itself */
28 struct DosList *dl; /* Volume node */
29 unsigned int locks; /* Number of open locks */
30 struct PlatformHandle ph; /* Platform-specific data */
33 /* type flags */
34 #define FHD_FILE 0x01
35 #define FHD_DIRECTORY 0x02
36 #define FHD_STDIO 0x80
38 struct emulbase
40 struct Node eb_Node;
41 APTR eb_stdin;
42 APTR eb_stdout;
43 APTR eb_stderr;
44 APTR mempool;
45 APTR ReadIRQ;
46 APTR HostLibBase;
47 APTR KernelBase;
48 struct Emul_PlatformData pdata; /* Platform-specific portion */
51 #define HostLibBase emulbase->HostLibBase
52 #define KernelBase emulbase->KernelBase
54 AROS_PROCP(EmulHandlerMain);
56 /* File name manipulation functions (filenames.c) */
57 BOOL shrink(char *filename);
58 ULONG validate(const char *filename);
59 char *append(char *c, const char *filename);
60 long startpos(char *name, long i);
61 void copyname(char *result, char *name, long i);
62 char *nextpart(char *sp);
64 extern const ULONG sizes[];
67 * Host OS file manipulation functions.
68 * Please do not use size_t, off_t, etc, here. They can be different between AROS
69 * and host OS, which will cause weird problems, which are hard to detect if you
70 * don't know about them. A nice example is Darwin, where off_t is 64-bit wide even
71 * on 32-bit machines. On AROS size off_t is 32-bit wide.
73 LONG DoOpen(struct emulbase *emulbase, struct filehandle *fh, LONG mode, LONG protect, BOOL AllowDir);
74 void DoClose(struct emulbase *emulbase, struct filehandle *fh);
75 LONG DoRewindDir(struct emulbase *emulbase, struct filehandle *fh);
76 LONG DoRead(struct emulbase *emulbase, struct filehandle *fh, APTR buff, ULONG len, SIPTR *err);
77 LONG DoWrite(struct emulbase *emulbase, struct filehandle *fh, CONST_APTR buff, ULONG len, SIPTR *err);
78 SIPTR DoSeek(struct emulbase *emulbase, struct filehandle *fh, SIPTR Offset, ULONG Mode, SIPTR *err);
79 LONG DoMkDir(struct emulbase *emulbase, struct filehandle *fh, ULONG protect);
80 LONG DoDelete(struct emulbase *emulbase, char *name);
81 LONG DoChMod(struct emulbase *emulbase, char *filename, ULONG prot);
82 LONG DoHardLink(struct emulbase *emulbase, char *fn, char *oldfile);
83 LONG DoSymLink(struct emulbase *emulbase, char *dest, char *src);
84 LONG DoRename(struct emulbase *emulbase, char *filename, char *newfilename);
85 int DoReadLink(struct emulbase *emulbase, char *filename, char *buffer, ULONG size, LONG *err);
86 LONG DoSetDate(struct emulbase *emulbase, char *fullname, struct DateStamp *date);
87 SIPTR DoSetSize(struct emulbase *emulbase, struct filehandle *fh, SIPTR offset, ULONG mode, SIPTR *err);
88 LONG DoStatFS(struct emulbase *emulbase, char *path, struct InfoData *id);
90 LONG DoExamineEntry(struct emulbase *emulbase, struct filehandle *fh, char *EntryName,
91 struct ExAllData *ead, ULONG size, ULONG type);
92 LONG DoExamineNext(struct emulbase *emulbase, struct filehandle *fh, struct FileInfoBlock *FIB);
93 LONG DoExamineAll(struct emulbase *emulbase, struct filehandle *fh, struct ExAllData *ead,
94 struct ExAllControl *eac, ULONG size, ULONG type, struct DosLibrary *DOSBase);
96 char *GetHomeDir(struct emulbase *emulbase, char *user);
97 ULONG GetCurrentDir(struct emulbase *emulbase, char *path, ULONG len);
98 BOOL CheckDir(struct emulbase *emulbase, char *name);
100 #endif /* __EMUL_INTERN_H */