common.h File Reference

#include <sys/types.h>
#include <stdint.h>
#include <sys/uio.h>
#include <pthread.h>
#include "fiu-local.h"

Include dependency graph for common.h:

This graph shows which files directly or indirectly include this file:

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 Documentation

#define _F_READ   0x00001

Definition at line 16 of file common.h.

Referenced by plockf().

#define _F_WRITE   0x00010

Definition at line 17 of file common.h.

Referenced by plockf().

#define _F_LOCK   0x00100

Definition at line 18 of file common.h.

Referenced by plockf().

#define _F_TLOCK   0x01000

Definition at line 19 of file common.h.

Referenced by plockf().

#define _F_ULOCK   0x10000

Definition at line 20 of file common.h.

#define F_LOCKR   (_F_LOCK | _F_READ)

Definition at line 22 of file common.h.

Referenced by jpread(), jread(), and jreadv().

#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_TLOCKR   (_F_TLOCK | _F_READ)

Definition at line 24 of file common.h.

#define F_TLOCKW   (_F_TLOCK | _F_WRITE)

Definition at line 25 of file common.h.

Referenced by jfsck().

#define F_UNLOCK   (_F_ULOCK)

#define MAX_TSIZE   (SSIZE_MAX)

Definition at line 28 of file common.h.

Referenced by jtrans_add_common().


Function Documentation

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

ssize_t spwrite ( int  fd,
const void *  buf,
size_t  count,
off_t  offset 
)

Like spread() but for pwrite().

Definition at line 78 of file common.c.

Referenced by jfsck(), jopen(), and jtrans_commit().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

int get_jdir ( const char *  filename,
char *  jdir 
)

Store in jdir the default journal directory path of the given filename.

Definition at line 146 of file common.c.

Referenced by jfsck(), and jopen().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:


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