Back to index

avfs  1.0.1
serialfile.h
Go to the documentation of this file.
00001 /*
00002     AVFS: A Virtual File System Library
00003     Copyright (C) 1998-2001  Miklos Szeredi <miklos@szeredi.hu>
00004 
00005     This program can be distributed under the terms of the GNU GPL.
00006     See the file COPYING.
00007 */
00008 
00009 #include "avfs.h"
00010 
00011 #define SFILE_NOCACHE (1 << 0)
00012 
00013 struct sfilefuncs {
00014     int       (*startget) (void *data, void **resp);
00015     avssize_t (*read)     (void *data, char *buf, avsize_t nbyte);
00016     int       (*startput) (void *data, void **resp);
00017     avssize_t (*write)    (void *data, const char *buf, avsize_t nbyte);
00018     int       (*endput)   (void *data);
00019 };
00020 
00021 struct sfile;
00022 
00023 struct sfile *av_sfile_new(const struct sfilefuncs *func, void *data,
00024                         int flags);
00025 avssize_t av_sfile_pread(struct sfile *fil, char *buf, avsize_t nbyte,
00026                       avoff_t offset);
00027 avssize_t av_sfile_pwrite(struct sfile *fil, const char *buf, avsize_t nbyte,
00028                        avoff_t offset);
00029 avoff_t av_sfile_size(struct sfile *fil);
00030 int av_sfile_truncate(struct sfile *fil, avoff_t length);
00031 int av_sfile_startget(struct sfile *fil);
00032 int av_sfile_flush(struct sfile *fil);
00033 void *av_sfile_getdata(struct sfile *fil);
00034 avoff_t av_sfile_diskusage(struct sfile *fil);