Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
cow_user.c File Reference
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <arpa/inet.h>
#include <endian.h>
#include "cow.h"
#include "cow_sys.h"

Go to the source code of this file.

Data Structures

struct  cow_header_v1
 
struct  cow_header_v2
 
struct  cow_header_v3
 
struct  cow_header_v3_broken
 
union  cow_header
 

Macros

#define PATH_LEN_V1   256
 
#define PATH_LEN_V3   4096
 
#define PATH_LEN_V2   PATH_LEN_V3
 
#define COW_BITMAP   0
 
#define COW_MAGIC   0x4f4f4f4d /* MOOO */
 
#define COW_VERSION   3
 
#define DIV_ROUND(x, len)   (((x) + (len) - 1) / (len))
 
#define ROUND_UP(x, align)   DIV_ROUND(x, align) * (align)
 

Typedefs

typedef __u32 time32_t
 

Functions

struct cow_header_v1 __attribute__ ((packed))
 
void cow_sizes (int version, __u64 size, int sectorsize, int align, int bitmap_offset, unsigned long *bitmap_len_out, int *data_offset_out)
 
int write_cow_header (char *cow_file, int fd, char *backing_file, int sectorsize, int alignment, unsigned long long *size)
 
int file_reader (__u64 offset, char *buf, int len, void *arg)
 
int read_cow_header (int(*reader)(__u64, char *, int, void *), void *arg, __u32 *version_out, char **backing_file_out, time_t *mtime_out, unsigned long long *size_out, int *sectorsize_out, __u32 *align_out, int *bitmap_offset_out)
 
int init_cow_file (int fd, char *cow_file, char *backing_file, int sectorsize, int alignment, int *bitmap_offset_out, unsigned long *bitmap_len_out, int *data_offset_out)
 

Variables

__s32 magic
 
__s32 version
 
char backing_file [PATH_LEN_V1]
 
time32_t mtime
 
__u64 size
 
__s32 sectorsize
 
__u32 alignment
 
__u32 cow_format
 
struct cow_header_v3_broken __attribute__
 

Macro Definition Documentation

#define COW_BITMAP   0

Definition at line 109 of file cow_user.c.

#define COW_MAGIC   0x4f4f4f4d /* MOOO */

Definition at line 118 of file cow_user.c.

#define COW_VERSION   3

Definition at line 119 of file cow_user.c.

#define DIV_ROUND (   x,
  len 
)    (((x) + (len) - 1) / (len))

Definition at line 121 of file cow_user.c.

#define PATH_LEN_V1   256

Definition at line 18 of file cow_user.c.

#define PATH_LEN_V2   PATH_LEN_V3

Definition at line 39 of file cow_user.c.

#define PATH_LEN_V3   4096

Definition at line 38 of file cow_user.c.

#define ROUND_UP (   x,
  align 
)    DIV_ROUND(x, align) * (align)

Definition at line 122 of file cow_user.c.

Typedef Documentation

typedef __u32 time32_t

Definition at line 20 of file cow_user.c.

Function Documentation

struct cow_header_v1 __attribute__ ( (packed)  )
read

Definition at line 171 of file esd_usb2.c.

void cow_sizes ( int  version,
__u64  size,
int  sectorsize,
int  align,
int  bitmap_offset,
unsigned long bitmap_len_out,
int data_offset_out 
)

Definition at line 124 of file cow_user.c.

int file_reader ( __u64  offset,
char buf,
int  len,
void arg 
)

Definition at line 268 of file cow_user.c.

int init_cow_file ( int  fd,
char cow_file,
char backing_file,
int  sectorsize,
int  alignment,
int bitmap_offset_out,
unsigned long bitmap_len_out,
int data_offset_out 
)

Definition at line 402 of file cow_user.c.

int read_cow_header ( int(*)(__u64, char *, int, void *)  reader,
void arg,
__u32 version_out,
char **  backing_file_out,
time_t mtime_out,
unsigned long long size_out,
int sectorsize_out,
__u32 align_out,
int bitmap_offset_out 
)

Definition at line 277 of file cow_user.c.

int write_cow_header ( char cow_file,
int  fd,
char backing_file,
int  sectorsize,
int  alignment,
unsigned long long size 
)

Definition at line 196 of file cow_user.c.

Variable Documentation

__u32 alignment

Definition at line 100 of file cow_user.c.

char backing_file

Definition at line 32 of file cow_user.c.

__u32 cow_format

Definition at line 101 of file cow_user.c.

__u32 magic

Definition at line 30 of file cow_user.c.

Definition at line 33 of file cow_user.c.

__u32 sectorsize

Definition at line 35 of file cow_user.c.

__u64 size

Definition at line 34 of file cow_user.c.

__u32 version

Definition at line 31 of file cow_user.c.