#include <sys/types.h>#include <fcntl.h>#include <unistd.h>#include <string.h>#include <libgen.h>#include <limits.h>#include <stdio.h>#include <stdlib.h>#include <arpa/inet.h>#include "libjio.h"#include "common.h"

Go to the source code of this file.
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. | |
| 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().

1.5.8