#include <sys/types.h>
#include <stdint.h>
#include <sys/uio.h>
#include <pthread.h>
#include "fiu-local.h"
Go to the source code of this file.
Data Structures | |
struct | jfs |
The main file structure. More... | |
Defines | |
#define | _F_READ 0x00001 |
#define | _F_WRITE 0x00010 |
#define | _F_LOCK 0x00100 |
#define | _F_TLOCK 0x01000 |
#define | _F_ULOCK 0x10000 |
#define | F_LOCKR (_F_LOCK | _F_READ) |
#define | F_LOCKW (_F_LOCK | _F_WRITE) |
#define | F_TLOCKR (_F_TLOCK | _F_READ) |
#define | F_TLOCKW (_F_TLOCK | _F_WRITE) |
#define | F_UNLOCK (_F_ULOCK) |
#define | MAX_TSIZE (SSIZE_MAX) |
Functions | |
off_t | plockf (int fd, int cmd, off_t offset, off_t len) |
Like lockf(), but lock always from the given offset. | |
ssize_t | spread (int fd, void *buf, size_t count, off_t offset) |
Like pread() but either fails, or return a complete read. | |
ssize_t | spwrite (int fd, const void *buf, size_t count, off_t offset) |
Like spread() but for pwrite(). | |
ssize_t | swritev (int fd, struct iovec *iov, int iovcnt) |
Like writev() but either fails, or return a complete write. | |
int | get_jdir (const char *filename, char *jdir) |
Store in jdir the default journal directory path of the given filename. | |
void | get_jtfile (struct jfs *fs, unsigned int tid, char *jtfile) |
Build the filename of a given transaction. | |
uint64_t | ntohll (uint64_t x) |
Convert a 64-bit value between network byte order and host byte order. | |
uint64_t | htonll (uint64_t x) |
Convert a 64-bit value between host byte order and network byte order. | |
uint32_t | checksum_buf (uint32_t sum, const unsigned char *buf, size_t count) |
Calculates the checksum of the given buffer, up to count bytes. | |
void | autosync_check (struct jfs *fs) |
Notify the autosync thread that it should check the number of bytes written. |
#define F_LOCKR (_F_LOCK | _F_READ) |
#define F_LOCKW (_F_LOCK | _F_WRITE) |
Definition at line 23 of file common.h.
Referenced by free_tid(), get_tid(), jopen(), journal_new(), jtrans_commit(), jtruncate(), and lock_file_ranges().
#define F_TLOCKW (_F_TLOCK | _F_WRITE) |
#define F_UNLOCK (_F_ULOCK) |
Definition at line 26 of file common.h.
Referenced by free_tid(), get_tid(), jopen(), jpread(), jread(), jreadv(), jtrans_commit(), jtruncate(), lock_file_ranges(), and plockf().
#define MAX_TSIZE (SSIZE_MAX) |
off_t plockf | ( | int | fd, | |
int | cmd, | |||
off_t | offset, | |||
off_t | len | |||
) |
Like lockf(), but lock always from the given offset.
Definition at line 21 of file common.c.
Referenced by free_tid(), get_tid(), jfsck(), jopen(), journal_new(), jpread(), jread(), jreadv(), jtruncate(), and lock_file_ranges().
ssize_t spread | ( | int | fd, | |
void * | buf, | |||
size_t | count, | |||
off_t | offset | |||
) |
Like pread() but either fails, or return a complete read.
If it returns less than count it's because EOF was reached
Definition at line 53 of file common.c.
Referenced by jpread(), jread(), jtrans_commit(), and operation_read_prev().
ssize_t spwrite | ( | int | fd, | |
const void * | buf, | |||
size_t | count, | |||
off_t | offset | |||
) |
ssize_t swritev | ( | int | fd, | |
struct iovec * | iov, | |||
int | iovcnt | |||
) |
Like writev() but either fails, or return a complete write.
Note that, as opposed to writev() it WILL MODIFY iov, in particular the iov_len fields.
Definition at line 101 of file common.c.
Referenced by journal_add_op(), journal_commit(), and journal_new().
int get_jdir | ( | const char * | filename, | |
char * | jdir | |||
) |
void get_jtfile | ( | struct jfs * | fs, | |
unsigned int | tid, | |||
char * | jtfile | |||
) |
Build the filename of a given transaction.
Assumes jtfile can hold at least PATH_MAX bytes.
Definition at line 173 of file common.c.
Referenced by free_tid(), jfsck(), and journal_new().
uint64_t ntohll | ( | uint64_t | x | ) |
Convert a 64-bit value between network byte order and host byte order.
Definition at line 184 of file common.c.
Referenced by ophdr_ntoh().
uint64_t htonll | ( | uint64_t | x | ) |
Convert a 64-bit value between host byte order and network byte order.
Definition at line 208 of file common.c.
Referenced by ophdr_hton().
uint32_t checksum_buf | ( | uint32_t | crc32, | |
const unsigned char * | buf, | |||
size_t | count | |||
) |
Calculates the checksum of the given buffer, up to count bytes.
Returns the checksum. The initial crc32 must be 0.
Definition at line 82 of file checksum.c.
Referenced by fill_trans(), journal_add_op(), journal_commit(), and journal_new().
void autosync_check | ( | struct jfs * | fs | ) |
Notify the autosync thread that it should check the number of bytes written.
Must be called with fs' ltlock held.
Definition at line 134 of file autosync.c.
Referenced by jtrans_commit().