mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
fbfd0476ba
git-svn-id: file:///svn/toku/tokudb.1032b@7779 c7de825b-a66e-492c-adef-691d508d4ae1
25 lines
923 B
C
25 lines
923 B
C
#ifndef BREAD_H
|
|
#define BREAD_H
|
|
|
|
// A BREAD reads a file backwards using buffered I/O. BREAD stands for Buffered Read or Backwards Read.
|
|
// Conceivably, we could read forward too.
|
|
// The buffered I/O is buffered using a large buffer (e.g., something like a megabyte).
|
|
// If not for the large-buffer requirement, we could have used a FILE.
|
|
|
|
#include <sys/types.h>
|
|
typedef struct bread *BREAD;
|
|
|
|
BREAD create_bread_from_fd_initialize_at(int fd, toku_off_t filesize, size_t bufsize);
|
|
// Effect: Given a file descriptor, fd, that points at a file of size filesize, create a BREAD.
|
|
// Requires: The filesize must be correct. The fd must be an open fd.
|
|
|
|
int close_bread_without_closing_fd(BREAD);
|
|
// Effect: Close the BREAD, but don't close the underlying fd.
|
|
|
|
ssize_t bread_backwards(BREAD, void *buf, size_t nbytes);
|
|
// Read nbytes into buf, reading backwards.
|
|
|
|
int bread_has_more(BREAD);
|
|
// Is there more to read?
|
|
|
|
#endif
|