25 #include "copyright.h" 28 #ifdef FILESYS_STUB // Temporarily implement calls to 33 OpenFileTable(
int f) { file = f; currentOffset = 0; }
34 ~OpenFileTable() {
Close(file); }
36 int ReadAt(
char *into,
int numBytes,
int position) {
37 Lseek(file, position, 0);
40 int WriteAt(
const char *from,
int numBytes,
int position) {
41 Lseek(file, position, 0);
45 int Read(
char *into,
int numBytes) {
46 int numRead = ReadAt(into, numBytes, currentOffset);
47 currentOffset += numRead;
50 int Write(
const char *from,
int numBytes) {
51 int numWritten = WriteAt(from, numBytes, currentOffset);
52 currentOffset += numWritten;
56 int Length() {
Lseek(file, 0, 2);
return Tell(file); }
83 void Seek(
int position,
unsigned int tid = 0);
86 int Read(
char *into,
int numBytes,
unsigned int tid = 0);
90 int Write(
const char *from,
int numBytes,
unsigned int tid = 0);
92 int ReadAt(
char *into,
int numBytes,
int position);
96 int WriteAt(
const char *from,
int numBytes,
int position);
105 void add_seek(
unsigned int tid);
107 bool remove_seek(
unsigned int tid);
109 bool isOpenByOthers();
115 void set_seek_position(
unsigned int tid,
int seekPosition);
116 int get_seek_position(
unsigned int tid);
int Tell(int fd)
Tell Report the current location within an open file.
Definition: sysdep.cc:231
void WriteFile(int fd, const char *buffer, int nBytes)
WriteFile Write characters to an open file. Abort if write fails.
Definition: sysdep.cc:207
void Read(int fd, char *buffer, int nBytes)
Read Read characters from an open file. Abort if read fails.
Definition: sysdep.cc:182
void Close(int fd)
Close Close a file. Abort on error.
Definition: sysdep.cc:247
tuple Structure that allow multi-seek on one Openfile
Definition: openfile.h:71
Definition: openfile.h:77
Miscellaneous useful definitions, including debugging routines.
int ReadPartial(int fd, char *buffer, int nBytes)
ReadPartial Read characters from an open file, returning as many as are available.
Definition: sysdep.cc:195
struct tuple tuple_t
tuple Structure that allow multi-seek on one Openfile
void Lseek(int fd, int offset, int whence)
Lseek Change the location within an open file. Abort on error.
Definition: sysdep.cc:219