UNIX-alike API

This is the UNIX-alike API, built on top of the basic API. More...


Functions

ssize_t jread (jfs_t *fs, void *buf, size_t count)
 Read from the file.
ssize_t jpread (jfs_t *fs, void *buf, size_t count, off_t offset)
 Read from the file at the given offset.
ssize_t jreadv (jfs_t *fs, const struct iovec *vector, int count)
 Read from the file into multiple buffers.
ssize_t jwrite (jfs_t *fs, const void *buf, size_t count)
 Write to the file.
ssize_t jpwrite (jfs_t *fs, const void *buf, size_t count, off_t offset)
 Write to the file at the given offset.
ssize_t jwritev (jfs_t *fs, const struct iovec *vector, int count)
 Write to the file from multiple buffers.
int jtruncate (jfs_t *fs, off_t length)
 Truncates the file to the given length.
off_t jlseek (jfs_t *fs, off_t offset, int whence)
 Reposition read/write file offset.


Detailed Description

This is the UNIX-alike API, built on top of the basic API.

Function Documentation

ssize_t jread ( jfs_t fs,
void *  buf,
size_t  count 
)

Read from the file.

Works just like UNIX read(2).

Parameters:
fs file to read from
buf buffer used to store the data
count maximum number of bytes to read
Returns:
number of bytes read on success, or -1 on error
See also:
read(2)

ssize_t jpread ( jfs_t fs,
void *  buf,
size_t  count,
off_t  offset 
)

Read from the file at the given offset.

Works just like UNIX pread(2).

Parameters:
fs file to read from
buf buffer used to store the data
count maximum number of bytes to read
offset offset to read at
Returns:
number of bytes read on success, or -1 on error
See also:
pread(2)

ssize_t jreadv ( jfs_t fs,
const struct iovec *  vector,
int  count 
)

Read from the file into multiple buffers.

Works just like UNIX readv(2).

Parameters:
fs file to read from
vector buffers used to store the data
count maximum number of bytes to read
Returns:
number of bytes read on success, or -1 on error
See also:
readv(2)

ssize_t jwrite ( jfs_t fs,
const void *  buf,
size_t  count 
)

Write to the file.

Works just like UNIX write(2).

Parameters:
fs file to write to
buf buffer used to read the data from
count maximum number of bytes to write
Returns:
number of bytes written on success, or -1 on error
See also:
write(2)

ssize_t jpwrite ( jfs_t fs,
const void *  buf,
size_t  count,
off_t  offset 
)

Write to the file at the given offset.

Works just like UNIX pwrite(2).

Parameters:
fs file to write to
buf buffer used to read the data from
count maximum number of bytes to write
offset offset to write at
Returns:
number of bytes written on success, or -1 on error
See also:
pwrite(2)

ssize_t jwritev ( jfs_t fs,
const struct iovec *  vector,
int  count 
)

Write to the file from multiple buffers.

Works just like UNIX writev(2).

Parameters:
fs file to write to
vector buffers used to read the data from
count maximum number of bytes to write
Returns:
number of bytes written on success, or -1 on error
See also:
writev(2)

int jtruncate ( jfs_t fs,
off_t  length 
)

Truncates the file to the given length.

Works just like UNIX ftruncate(2).

Parameters:
fs file to truncate
length lenght to truncate to
Returns:
0 on success, -1 on error
See also:
ftruncate(2)

off_t jlseek ( jfs_t fs,
off_t  offset,
int  whence 
)

Reposition read/write file offset.

Works just like UNIX lseek(2).

Parameters:
fs file to change the offset to
offset offset to set
whence where to count offset from, can be SEEK_SET to count from the beginning of the file, SEEK_CUR to count from the current position, or SEEK_END to count from the end.
Returns:
the new offset counted from the beginning of the file, or -1 on error.


Generated on Sat Sep 12 13:33:29 2009 for libjio (public) by  doxygen 1.5.8