From d8602953474b131e35b1cc3fbec543e3988c7af8 Mon Sep 17 00:00:00 2001 From: bernie Date: Wed, 4 Aug 2004 02:40:25 +0000 Subject: [PATCH] Add virtual file I/O interface. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@104 38d2e660-2303-0410-9eaa-f027e97ec537 --- mware/kfile.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 mware/kfile.h diff --git a/mware/kfile.h b/mware/kfile.h new file mode 100755 index 00000000..a752830c --- /dev/null +++ b/mware/kfile.h @@ -0,0 +1,52 @@ +/*! + * \file + * + * + * \brief Virtual KFile I/O interface. + * + * \version $Id$ + * \author Bernardo Innocenti + */ + +/* + * $Log$ + * Revision 1.1 2004/08/04 02:40:25 bernie + * Add virtual file I/O interface. + * + */ +#ifndef MWARE_KFILE_H +#define MWARE_KFILE_H + +#include + +/* fwd decl */ +struct _KFile; + +typedef size_t (*ReadFunc_t) (struct _KFile *fd, char *buf, size_t size); +typedef size_t (*WriteFunc_t) (struct _KFile *fd, const char *buf, size_t size); +typedef bool (*SeekFunc_t) (struct _KFile *fd, int32_t offset); +typedef bool (*OpenFunc_t) (struct _KFile *fd, const char *name, int mode); +typedef bool (*CloseFunc_t) (struct _KFile *fd); + + +/* Context data for callback functions which operate on + * pseudo files. + */ +typedef struct _KFile +{ + ReadFunc_t read; + WriteFunc_t write; + SeekFunc_t seek; + OpenFunc_t open; + CloseFunc_t close; + + /* NOTE: these must _NOT_ be size_t on 16bit CPUs! */ + uint32_t SeekPos; + uint32_t Size; +} KFile; + +#endif /* MWARE_KFILE_H */ -- 2.25.1