kfile.c File Reference
Virtual KFile I/O interface.
More...
#include "kfile.h"
#include <cfg/compiler.h>
#include <cfg/debug.h>
#include <cfg/macros.h>
#include "cfg/cfg_kfile.h"
#include <cfg/log.h>
#include <drv/timer.h>
#include <mware/formatwr.h>
#include <string.h>
Go to the source code of this file.
Functions |
| int | kfile_putc (int _c, struct KFile *fd) |
| | Generic putc() implementation using fd->write.
|
| int | kfile_getc (struct KFile *fd) |
| | Generic getc() implementation using fd->read.
|
|
int | kfile_printf (struct KFile *fd, const char *format,...) |
| | Formatted write.
|
| int | kfile_print (struct KFile *fd, const char *s) |
| | Write a string to kfile fd.
|
| int | kfile_gets (struct KFile *fd, char *buf, int size) |
| | Read a line long at most as size and put it in buf.
|
| int | kfile_gets_echo (struct KFile *fd, char *buf, int size, bool echo) |
| | Read a line long at most as size and put it in buf, with optional echo.
|
| kfile_off_t | kfile_genericSeek (struct KFile *fd, kfile_off_t offset, KSeekMode whence) |
| | Move fd file seek position of offset bytes from whence.
|
| struct KFile * | kfile_genericReopen (struct KFile *fd) |
| | Reopen file fd.
|
| int | kfile_genericClose (UNUSED_ARG(struct KFile *, fd)) |
| | Close file fd.
|
| void | kfile_resync (KFile *fd, mtime_t delay) |
| | Discard input to resynchronize with remote end.
|
| static int | kfile_generic (UNUSED_ARG(struct KFile *, fd)) |
| | Stub function that does nothing.
|
|
void | kfile_init (struct KFile *fd) |
| | Base class KFile constructor.
|
Detailed Description
Virtual KFile I/O interface.
This module implements some generic I/O interfaces for kfile.
- Version:
- Id
- kfile.c 2975 2009-09-27 13:21:27Z batt
- Author:
- Francesco Sacchi <batt@develer.com>
-
Daniele Basile <asterix@develer.com>
Definition in file kfile.c.
Function Documentation
| static int kfile_generic |
( |
UNUSED_ARG(struct KFile *, fd) |
|
) |
[static] |
Stub function that does nothing.
This is a generic implementation that only return 0.
Definition at line 262 of file kfile.c.
| int kfile_genericClose |
( |
UNUSED_ARG(struct KFile *, fd) |
|
) |
|
Close file fd.
This is a generic implementation that only return 0.
Definition at line 226 of file kfile.c.
| struct KFile* kfile_genericReopen |
( |
struct KFile * |
fd |
) |
[read] |
Reopen file fd.
Generic implementation of kfile_reopen.
This is a generic implementation that only flush file and reset seek_pos to 0.
Definition at line 215 of file kfile.c.
Move fd file seek position of offset bytes from whence.
Generic implementation of kfile_seek.
This is a generic implementation of seek function, you can redefine it in your local module if needed.
Definition at line 177 of file kfile.c.
| int kfile_getc |
( |
struct KFile * |
fd |
) |
|
Generic getc() implementation using fd->read.
Generic getc implementation using kfile_read.
Definition at line 79 of file kfile.c.
| int kfile_gets |
( |
struct KFile * |
fd, |
|
|
char * |
buf, |
|
|
int |
size | |
|
) |
| | |
Read a line long at most as size and put it in buf.
- Returns:
- number of chars read or EOF in case of error.
Definition at line 127 of file kfile.c.
| int kfile_gets_echo |
( |
struct KFile * |
fd, |
|
|
char * |
buf, |
|
|
int |
size, |
|
|
bool |
echo | |
|
) |
| | |
Read a line long at most as size and put it in buf, with optional echo.
- Returns:
- number of chars read, or EOF in case of error.
Definition at line 140 of file kfile.c.
| int kfile_print |
( |
struct KFile * |
fd, |
|
|
const char * |
s | |
|
) |
| | |
Write a string to kfile fd.
- Returns:
- 0 if OK, EOF in case of error.
Definition at line 110 of file kfile.c.
| int kfile_putc |
( |
int |
_c, |
|
|
struct KFile * |
fd | |
|
) |
| | |
Generic putc() implementation using fd->write.
Generic putc implementation using kfile_write.
Definition at line 66 of file kfile.c.
Discard input to resynchronize with remote end.
Discard incoming data until the kfile_getc stops receiving characters for at least delay milliseconds.
- Note:
- If the timeout occur, we reset the error before to quit.
Definition at line 241 of file kfile.c.