123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #ifndef _FILE
- #define _FILE
- #include <linkage.h>
- #define O_RDONLY (0x0000)
- #define O_WRONLY (0x0001)
- #define O_RDWR (0x0002)
- #define O_APPEND (0x0008)
- #define O_CREAT (0x0200)
- #define O_TRUNC (0x0400)
- #define O_BINARY (0x8000)
- #ifdef __cplusplus
- #define _DECL extern "C"
- #else
- #define _DECL extern
- #endif
- #ifndef _OFF_T
- #define _OFF_T
- typedef int off_t;
- #endif
- #ifndef SEEK_SET
- #define SEEK_SET (0x0000)
- #endif
- #ifndef SEEK_CUR
- #define SEEK_CUR (0x0001)
- #endif
- #ifndef SEEK_END
- #define SEEK_END (0x0002)
- #endif
- _DECL _CODE_ACCESS int open(const char *path, unsigned flags, int mode);
- _DECL _CODE_ACCESS int read(int fildes, char *bufptr, unsigned cnt);
- _DECL _CODE_ACCESS int write(int fildes, const char *bufptr, unsigned cnt);
- _DECL _CODE_ACCESS off_t lseek(int fildes, off_t offset, int origin);
- _DECL _CODE_ACCESS int close(int fildes);
- _DECL _CODE_ACCESS int unlink(const char *path);
- _DECL _CODE_ACCESS int rename(const char *old_name, const char *new_name);
- _DECL _CODE_ACCESS int add_device(
- char *name,
- unsigned flags,
- int (*dopen)(const char *path, unsigned flags, int llv_fd),
- int (*dclose)(int dev_fd),
- int (*dread)(int dev_fd, char *buf, unsigned count),
- int (*dwrite)(int dev_fd, const char *buf, unsigned count),
- off_t (*dlseek)(int dev_fd, off_t offset, int origin),
- int (*dunlink)(const char *path),
- int (*drename)(const char *old_name, const char *new_name));
- #define _NSTREAM 20
- #define _NDEVICE 3
- #define _SSA (0x0000)
- #define _BUSY (0x0001)
- #define _MSA (0x0002)
- #undef _DECL
- #endif
|