common.c File Reference

#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"

Include dependency graph for common.c:

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.


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:


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