ECP-VELOC Components
User documentation for all components
redset_io.h File Reference

I/O functions. More...

Go to the source code of this file.

Functions

Basic File I/O
mode_t redset_getmode (int read, int write, int execute)
 
int redset_open (const char *file, int flags,...)
 
int redset_close (const char *file, int fd)
 
int redset_file_lock_read (const char *file, int fd)
 
int redset_file_lock_write (const char *file, int fd)
 
int redset_file_unlock (const char *file, int fd)
 
int redset_open_with_lock (const char *file, int flags, mode_t mode)
 
int redset_close_with_unlock (const char *file, int fd)
 
int redset_lseek (const char *file, int fd, off_t pos, int whence)
 
ssize_t redset_read (const char *file, int fd, void *buf, size_t size)
 
ssize_t redset_write (const char *file, int fd, const void *buf, size_t size)
 
ssize_t redset_read_attempt (const char *file, int fd, void *buf, size_t size)
 
ssize_t redset_write_attempt (const char *file, int fd, const void *buf, size_t size)
 
ssize_t redset_read_line (const char *file, int fd, char *buf, size_t size)
 
ssize_t redset_writef (const char *file, int fd, const char *format,...)
 
int redset_stat (const char *file, struct stat *statbuf)
 
unsigned long redset_file_size (const char *file)
 
int redset_file_exists (const char *file)
 
int redset_file_is_readable (const char *file)
 
int redset_file_is_writeable (const char *file)
 
int redset_file_unlink (const char *file)
 
int redset_crc32 (const char *filename, uLong *crc)
 
Directory functions
int redset_mkdir (const char *dir, mode_t mode)
 
int redset_rmdir (const char *dir)
 
int redset_getcwd (char *buf, size_t size)
 
File Copy Functions
int redset_file_copy (const char *src_file, const char *dst_file, unsigned long buf_size, uLong *crc)
 
File compression functions
int redset_compress_in_place (const char *file_src, const char *file_dst, unsigned long block_size, int level)
 
int redset_uncompress_in_place (const char *file_src, const char *file_dst)
 
int redset_compress (const char *file_src, const char *file_dst, unsigned long block_size, int level)
 
int redset_uncompress (const char *file_src, const char *file_dst)
 

Function Documentation

◆ redset_close()

int redset_close ( const char *  file,
int  fd 
)

close file with an fsync

◆ redset_close_with_unlock()

int redset_close_with_unlock ( const char *  file,
int  fd 
)

unlocks the specified file descriptor and then closes the file

◆ redset_compress()

int redset_compress ( const char *  file_src,
const char *  file_dst,
unsigned long  block_size,
int  level 
)

compress the specified file using blocks of size block_size and store as file_dst

◆ redset_compress_in_place()

int redset_compress_in_place ( const char *  file_src,
const char *  file_dst,
unsigned long  block_size,
int  level 
)

compress the specified file using blocks of size block_size and store as file_dst

◆ redset_crc32()

int redset_crc32 ( const char *  filename,
uLong *  crc 
)

opens, reads, and computes the crc32 value for the given filename

◆ redset_file_copy()

int redset_file_copy ( const char *  src_file,
const char *  dst_file,
unsigned long  buf_size,
uLong *  crc 
)

◆ redset_file_exists()

int redset_file_exists ( const char *  file)

tests whether the file or directory exists

◆ redset_file_is_readable()

int redset_file_is_readable ( const char *  file)

tests whether the file or directory is readable

◆ redset_file_is_writeable()

int redset_file_is_writeable ( const char *  file)

tests whether the file or directory is writeable

◆ redset_file_lock_read()

int redset_file_lock_read ( const char *  file,
int  fd 
)

get and release file locks

◆ redset_file_lock_write()

int redset_file_lock_write ( const char *  file,
int  fd 
)

◆ redset_file_size()

unsigned long redset_file_size ( const char *  file)

given a filename, return number of bytes in file

◆ redset_file_unlink()

int redset_file_unlink ( const char *  file)

delete a file

◆ redset_file_unlock()

int redset_file_unlock ( const char *  file,
int  fd 
)

◆ redset_getcwd()

int redset_getcwd ( char *  buf,
size_t  size 
)

write current working directory to buf

◆ redset_getmode()

mode_t redset_getmode ( int  read,
int  write,
int  execute 
)

returns user's current mode as determine by his umask

◆ redset_lseek()

int redset_lseek ( const char *  file,
int  fd,
off_t  pos,
int  whence 
)

seek file descriptor to specified position

◆ redset_mkdir()

int redset_mkdir ( const char *  dir,
mode_t  mode 
)

recursively create directory and subdirectories

◆ redset_open()

int redset_open ( const char *  file,
int  flags,
  ... 
)

open file with specified flags and mode, retry open a few times on failure

◆ redset_open_with_lock()

int redset_open_with_lock ( const char *  file,
int  flags,
mode_t  mode 
)

opens specified file and waits on for an exclusive lock before returning the file descriptor

◆ redset_read()

ssize_t redset_read ( const char *  file,
int  fd,
void *  buf,
size_t  size 
)

reliable read from opened file descriptor (retries, if necessary, until hard error)

◆ redset_read_attempt()

ssize_t redset_read_attempt ( const char *  file,
int  fd,
void *  buf,
size_t  size 
)

make a good attempt to read from file (retries, if necessary, return error if fail)

◆ redset_read_line()

ssize_t redset_read_line ( const char *  file,
int  fd,
char *  buf,
size_t  size 
)

read line from file into buf with given size

◆ redset_rmdir()

int redset_rmdir ( const char *  dir)

remove directory

◆ redset_stat()

int redset_stat ( const char *  file,
struct stat *  statbuf 
)

given a filename, return stat info

◆ redset_uncompress()

int redset_uncompress ( const char *  file_src,
const char *  file_dst 
)

uncompress the specified file and store as file_dst

◆ redset_uncompress_in_place()

int redset_uncompress_in_place ( const char *  file_src,
const char *  file_dst 
)

uncompress the specified file and store as file_dst

◆ redset_write()

ssize_t redset_write ( const char *  file,
int  fd,
const void *  buf,
size_t  size 
)

reliable write to opened file descriptor (retries, if necessary, until hard error)

◆ redset_write_attempt()

ssize_t redset_write_attempt ( const char *  file,
int  fd,
const void *  buf,
size_t  size 
)

make a good attempt to write to file (retries, if necessary, return error if fail)

◆ redset_writef()

ssize_t redset_writef ( const char *  file,
int  fd,
const char *  format,
  ... 
)

write a formatted string to specified file descriptor