linux/fs/reiserfs/item_ops.c

/*
 * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
 */

#include <linux/time.h>
#include "reiserfs.h"

/*
 * this contains item handlers for old item types: sd, direct,
 * indirect, directory
 */

/*
 * and where are the comments? how about saying where we can find an
 * explanation of each item handler method? -Hans
 */

/* stat data functions */
static int sd_bytes_number(struct item_head *ih, int block_size)
{}

static void sd_decrement_key(struct cpu_key *key)
{}

static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize)
{}

static void sd_print_item(struct item_head *ih, char *item)
{}

static void sd_check_item(struct item_head *ih, char *item)
{}

static int sd_create_vi(struct virtual_node *vn,
			struct virtual_item *vi,
			int is_affected, int insert_size)
{}

static int sd_check_left(struct virtual_item *vi, int free,
			 int start_skip, int end_skip)
{}

static int sd_check_right(struct virtual_item *vi, int free)
{}

static int sd_part_size(struct virtual_item *vi, int first, int count)
{}

static int sd_unit_num(struct virtual_item *vi)
{}

static void sd_print_vi(struct virtual_item *vi)
{}

static struct item_operations stat_data_ops =;

/* direct item functions */
static int direct_bytes_number(struct item_head *ih, int block_size)
{}

/* FIXME: this should probably switch to indirect as well */
static void direct_decrement_key(struct cpu_key *key)
{}

static int direct_is_left_mergeable(struct reiserfs_key *key,
				    unsigned long bsize)
{}

static void direct_print_item(struct item_head *ih, char *item)
{}

static void direct_check_item(struct item_head *ih, char *item)
{}

static int direct_create_vi(struct virtual_node *vn,
			    struct virtual_item *vi,
			    int is_affected, int insert_size)
{}

static int direct_check_left(struct virtual_item *vi, int free,
			     int start_skip, int end_skip)
{}

static int direct_check_right(struct virtual_item *vi, int free)
{}

static int direct_part_size(struct virtual_item *vi, int first, int count)
{}

static int direct_unit_num(struct virtual_item *vi)
{}

static void direct_print_vi(struct virtual_item *vi)
{}

static struct item_operations direct_ops =;

/* indirect item functions */
static int indirect_bytes_number(struct item_head *ih, int block_size)
{}

/* decrease offset, if it becomes 0, change type to stat data */
static void indirect_decrement_key(struct cpu_key *key)
{}

/* if it is not first item of the body, then it is mergeable */
static int indirect_is_left_mergeable(struct reiserfs_key *key,
				      unsigned long bsize)
{}

/* printing of indirect item */
static void start_new_sequence(__u32 * start, int *len, __u32 new)
{}

static int sequence_finished(__u32 start, int *len, __u32 new)
{}

static void print_sequence(__u32 start, int len)
{}

static void indirect_print_item(struct item_head *ih, char *item)
{}

static void indirect_check_item(struct item_head *ih, char *item)
{}

static int indirect_create_vi(struct virtual_node *vn,
			      struct virtual_item *vi,
			      int is_affected, int insert_size)
{}

static int indirect_check_left(struct virtual_item *vi, int free,
			       int start_skip, int end_skip)
{}

static int indirect_check_right(struct virtual_item *vi, int free)
{}

/*
 * return size in bytes of 'units' units. If first == 0 - calculate
 * from the head (left), otherwise - from tail (right)
 */
static int indirect_part_size(struct virtual_item *vi, int first, int units)
{}

static int indirect_unit_num(struct virtual_item *vi)
{}

static void indirect_print_vi(struct virtual_item *vi)
{}

static struct item_operations indirect_ops =;

/* direntry functions */
static int direntry_bytes_number(struct item_head *ih, int block_size)
{}

static void direntry_decrement_key(struct cpu_key *key)
{}

static int direntry_is_left_mergeable(struct reiserfs_key *key,
				      unsigned long bsize)
{}

static void direntry_print_item(struct item_head *ih, char *item)
{}

static void direntry_check_item(struct item_head *ih, char *item)
{}

#define DIRENTRY_VI_FIRST_DIRENTRY_ITEM

/*
 * function returns old entry number in directory item in real node
 * using new entry number in virtual item in virtual node
 */
static inline int old_entry_num(int is_affected, int virtual_entry_num,
				int pos_in_item, int mode)
{}

/*
 * Create an array of sizes of directory entries for virtual
 * item. Return space used by an item. FIXME: no control over
 * consuming of space used by this item handler
 */
static int direntry_create_vi(struct virtual_node *vn,
			      struct virtual_item *vi,
			      int is_affected, int insert_size)
{}

/*
 * return number of entries which may fit into specified amount of
 * free space, or -1 if free space is not enough even for 1 entry
 */
static int direntry_check_left(struct virtual_item *vi, int free,
			       int start_skip, int end_skip)
{}

static int direntry_check_right(struct virtual_item *vi, int free)
{}

/* sum of entry sizes between from-th and to-th entries including both edges */
static int direntry_part_size(struct virtual_item *vi, int first, int count)
{}

static int direntry_unit_num(struct virtual_item *vi)
{}

static void direntry_print_vi(struct virtual_item *vi)
{}

static struct item_operations direntry_ops =;

/* Error catching functions to catch errors caused by incorrect item types. */
static int errcatch_bytes_number(struct item_head *ih, int block_size)
{}

static void errcatch_decrement_key(struct cpu_key *key)
{}

static int errcatch_is_left_mergeable(struct reiserfs_key *key,
				      unsigned long bsize)
{}

static void errcatch_print_item(struct item_head *ih, char *item)
{}

static void errcatch_check_item(struct item_head *ih, char *item)
{}

static int errcatch_create_vi(struct virtual_node *vn,
			      struct virtual_item *vi,
			      int is_affected, int insert_size)
{}

static int errcatch_check_left(struct virtual_item *vi, int free,
			       int start_skip, int end_skip)
{}

static int errcatch_check_right(struct virtual_item *vi, int free)
{}

static int errcatch_part_size(struct virtual_item *vi, int first, int count)
{}

static int errcatch_unit_num(struct virtual_item *vi)
{}

static void errcatch_print_vi(struct virtual_item *vi)
{}

static struct item_operations errcatch_ops =;

#if ! (TYPE_STAT_DATA == 0 && TYPE_INDIRECT == 1 && TYPE_DIRECT == 2 && TYPE_DIRENTRY == 3)
#error Item types must use disk-format assigned values.
#endif

struct item_operations *item_ops[TYPE_ANY + 1] =;