PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
file.h File Reference
#include <stdint.h>
#include <stdio.h>
#include <sys/list.h>
#include <threads.h>
Include dependency graph for file.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fpos_t
 
struct  FILE
 

Macros

#define _UNGETC_MAX   64
 
#define _FILE_GETC(stream)
 
#define _FILE_CHECK_AVAIL(fh)   (((fh->bufIndex == fh->bufEnd) && (fh->ungetIndex == 0)) ? _file_fill_buffer(fh) : 0)
 

Enumerations

enum  _file_flags_t {
  _FILE_READ = (1 << 0) , _FILE_WRITE = (1 << 2) , _FILE_RW = (1 << 3) , _FILE_APPEND = (1 << 4) ,
  _FILE_BIN = (1 << 5) , _FILE_OWNS_BUFFER = (1 << 6) , _FILE_FULLY_BUFFERED = (1 << 7) , _FILE_LINE_BUFFERED = (1 << 8) ,
  _FILE_UNBUFFERED = (1 << 9) , _FILE_ERROR = (1 << 10) , _FILE_WIDESTREAM = (1 << 11) , _FILE_BYTESTREAM = (1 << 12) ,
  _FILE_DELETE_ON_CLOSE = (1 << 13) , _FILE_EOF = (1 << 14)
}
 

Functions

_file_flags_t _file_flags_parse (const char *mode)
 
FILE_file_new (void)
 
void _file_free (FILE *stream)
 
uint64_t _file_init (FILE *stream, fd_t fd, _file_flags_t flags, void *buffer, uint64_t bufferSize)
 
void _file_deinit (FILE *stream)
 
uint64_t _file_flush_buffer (FILE *stream)
 
uint64_t _file_fill_buffer (FILE *stream)
 
uint64_t _file_seek (FILE *stream, int64_t offset, int whence)
 
uint64_t _file_prepare_read (FILE *stream)
 
uint64_t _file_prepare_write (FILE *stream)
 
void _files_init (void)
 
void _files_push (FILE *file)
 
void _files_remove (FILE *file)
 
void _files_close (void)
 
uint64_t _files_flush (void)
 

Macro Definition Documentation

◆ _UNGETC_MAX

#define _UNGETC_MAX   64

Definition at line 32 of file file.h.

◆ _FILE_GETC

#define _FILE_GETC (   stream)
Value:
(((stream)->ungetIndex == 0) ? (unsigned char)(stream)->buf[(stream)->bufIndex++] \
: (unsigned char)(stream)->ungetBuf[--(stream)->ungetIndex])

Definition at line 49 of file file.h.

◆ _FILE_CHECK_AVAIL

#define _FILE_CHECK_AVAIL (   fh)    (((fh->bufIndex == fh->bufEnd) && (fh->ungetIndex == 0)) ? _file_fill_buffer(fh) : 0)

Definition at line 53 of file file.h.

Enumeration Type Documentation

◆ _file_flags_t

Enumerator
_FILE_READ 
_FILE_WRITE 
_FILE_RW 
_FILE_APPEND 
_FILE_BIN 
_FILE_OWNS_BUFFER 
_FILE_FULLY_BUFFERED 
_FILE_LINE_BUFFERED 
_FILE_UNBUFFERED 
_FILE_ERROR 
_FILE_WIDESTREAM 
_FILE_BYTESTREAM 
_FILE_DELETE_ON_CLOSE 
_FILE_EOF 

Definition at line 8 of file file.h.

Function Documentation

◆ _file_flags_parse()

_file_flags_t _file_flags_parse ( const char *  mode)

Definition at line 12 of file file.c.

Here is the caller graph for this function:

◆ _file_new()

FILE * _file_new ( void  )

Definition at line 80 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _file_free()

void _file_free ( FILE stream)

Definition at line 92 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _file_init()

uint64_t _file_init ( FILE stream,
fd_t  fd,
_file_flags_t  flags,
void *  buffer,
uint64_t  bufferSize 
)

Definition at line 100 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _file_deinit()

void _file_deinit ( FILE stream)

Definition at line 146 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _file_flush_buffer()

uint64_t _file_flush_buffer ( FILE stream)
Todo:
Text stream conversion here

Definition at line 158 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _file_fill_buffer()

uint64_t _file_fill_buffer ( FILE stream)

Definition at line 177 of file file.c.

Here is the call graph for this function:

◆ _file_seek()

uint64_t _file_seek ( FILE stream,
int64_t  offset,
int  whence 
)

Definition at line 202 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _file_prepare_read()

uint64_t _file_prepare_read ( FILE stream)

Definition at line 224 of file file.c.

Here is the caller graph for this function:

◆ _file_prepare_write()

uint64_t _file_prepare_write ( FILE stream)

Definition at line 239 of file file.c.

Here is the caller graph for this function:

◆ _files_init()

void _files_init ( void  )

Definition at line 254 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _files_push()

void _files_push ( FILE file)

Definition at line 264 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _files_remove()

void _files_remove ( FILE file)

Definition at line 271 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _files_close()

void _files_close ( void  )

Definition at line 278 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _files_flush()

uint64_t _files_flush ( void  )

Definition at line 292 of file file.c.

Here is the call graph for this function:
Here is the caller graph for this function: