My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sw_filelib.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  */
25 
26 /* This Header file for libc functions that needed by storage-api apps */
27 
28 #include "sw_types.h"
29 
30 #define SW_READ 0x001
31 #define SW_WRITE 0x002
32 #define SW_RDWR (SW_READ | SW_WRITE)
33 #define SW_CREATE_NEW 0x004
34 #define SW_CREATE_ALWAYS 0x008
35 #define SW_APPEND 0x010
36 
37 #define SW_UNBUF 0x004
38 #define SW_EOF 0x010
39 #define SW_ERROR 0x020
40 #define SW_IOFIFO 0x40
41 #define SW_MYBUF 0x008
42 #define SW_IOLBF 0x040
43 #define L(n) ((long) (n))
44 
45 #define SW_FILEOPEN_MAX 20
46 #define SIZE_BUF 1024
47 #define EOF (-1)
48 
52 struct _FILE_CON {
54  int _fdesp;
55  int _flags;
56  int _buf_size;
57  unsigned char *_buf_base;
58  unsigned char *_chr_ptr;
59 };
60 
61 #ifndef _ERROR_NO_H_
62 #define _ERROR_NO_H_
63 extern int errno;
64 #define ENOENT 2 /* No such file or directory */
65 #define ENOMEM 12 /* Out of memory */
66 #define EACCES 13 /* Permission denied */
67 #define ENOSPC 28 /* No space on device*/
68 #endif
69 
70 #ifndef _STDIO_H_
71 
74 typedef struct _FILE_CON FILE;
76 
77 #define stdin (&BUF_IO[0])
78 #define stdout (&BUF_IO[1])
79 #define stderr (&BUF_IO[2])
80 
91 int (feof)(FILE *file_stream);
92 
93 
105 FILE *fopen(const unsigned char *name,const unsigned char *mode);
106 
121 unsigned int fread(void *out_buf, unsigned int size, unsigned int count,
122  FILE *inputstream);
135 unsigned int fwrite(const void *content, unsigned int size, unsigned int count,
136  FILE* pfile);
150 int fseek(FILE *seekstream, long offset, int whence);
151 
161 int fclose(FILE* pfile);
162 
172 int remove(const char *r_pth);
173 
174 #endif
int _fdesp
Definition: sw_filelib.h:54
unsigned char * _buf_base
Definition: sw_filelib.h:57
int fseek(FILE *seekstream, long offset, int whence)
fseek - Sets the position indicator associated with the stream to a new position
Definition: sw_filelib.c:698
Definition: sw_filelib.h:52
int _buf_size
Definition: sw_filelib.h:56
int errno
Definition: sw_filelib.c:45
int() feof(FILE *file_stream)
feof - Checks whether the end-of-File indicator associated with stream is set
Definition: sw_filelib.c:680
#define SW_FILEOPEN_MAX
Definition: sw_filelib.h:45
unsigned char * _chr_ptr
Definition: sw_filelib.h:58
int _chr_count
Definition: sw_filelib.h:53
Definition: syscalls.c:54
FILE * fopen(const unsigned char *name, const unsigned char *mode)
function shall open the file whose pathname is the string pointed to by filename, and associates a st...
Definition: sw_filelib.c:367
int _flags
Definition: sw_filelib.h:55
s32int count
Definition: virtual_keyboard.c:40
int fclose(FILE *pfile)
fclose - function will flushes the stream pointed to by filepointer
Definition: sw_filelib.c:606
unsigned int fread(void *out_buf, unsigned int size, unsigned int count, FILE *inputstream)
Reads an array of count elements from an inputstream.
Definition: sw_filelib.c:473
unsigned int fwrite(const void *content, unsigned int size, unsigned int count, FILE *pfile)
fwrite - Writes an array of count elements to an outputstream
Definition: sw_filelib.c:519
FILE BUF_IO[SW_FILEOPEN_MAX]
Definition: sw_filelib.c:38