Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

tarfs_util.h File Reference

#include <linux/fs.h>
#include <linux/types.h>
#include <linux/errno.h>

Go to the source code of this file.

Functions

int read_block (struct super_block *s, unsigned long i, void *blok)
 Reads block from device.

int is_nullblock (void *blok, unsigned long size)
 Checks if given block is full of zeroes.

int name_comparator (void *a, void *b, int first_length)
 Compares two strings.

int name_comparator2 (void *a, void *b, unsigned int first_length, unsigned int second_length)
 Compares two strings, (except trailing '/').

int is_right_prefix (char *dname, unsigned int dsize, char *fname, unsigned int fsize)
 Compares two paths (strings).

unsigned long oct_to_dec (void *what, unsigned int length)
 Converts octal number into decimal integer.

int is_octal (char ch)
 Checks if given character is '0' - '7'.

unsigned long hcc (unsigned long co, unsigned long cim)
 Ceil value of nom / denom.

unsigned int short_name_size (char *name)
 Returns length of filename stored in one block.


Detailed Description

Header file for tarfs_util.c Contains declarations of helper functions for tarfs_tar.c

Author:
Jaroslav Drazan <jaroslavdrazan@seznam.cz>

Petr Cermak <xgxg@seznam.cz>

Definition in file tarfs_util.h.


Function Documentation

unsigned long hcc unsigned long  nom,
unsigned long  denom
 

Ceil value of nom / denom.

Parameters:
nom Nominator
denom Denominator
Returns:
Ceil value of nom / denom

Definition at line 29 of file tarfs_util.c.

Referenced by offset_by_name(), offset_by_name2(), pom_read_name(), skip_blocks(), symlinkname(), tar_get_root_ino(), tar_length(), tar_lookup(), tar_read_page(), and tar_readdir().

int is_nullblock void *  blok,
unsigned long  size
 

Checks if given block is full of zeroes.

Parameters:
blok Block of data to check
size Size of block
Returns:
1 - OK, 0 - some non-zero character found or error

Definition at line 68 of file tarfs_util.c.

Referenced by tar_length(), and tar_readdir().

int is_octal char  ch  ) 
 

Checks if given character is '0' - '7'.

Parameters:
ch Character
Returns:
0 - no, nonzero - yes

Definition at line 205 of file tarfs_util.c.

Referenced by oct_to_dec().

int is_right_prefix char *  dname,
unsigned int  dsize,
char *  fname,
unsigned int  fsize
 

Compares two paths (strings).

sais, whether the dname is right prefix of fname. It's equal to dname contains fname*

Parameters:
dname full path of directory (char*, but couldn't be NULL-terminated)
dsize size of dname
fname full file path (char*, but couldn't be NULL-terminated)
fsize size of fname
Returns:
1 - dname contains fname, 0 - dname is not ancestor of fname in dir tree
  • can be changed by makro TARFS_CAN_ADD-1 - dname is ancestor, but not father
See also:
TARFS_CAN_ADD

Definition at line 176 of file tarfs_util.c.

References TARFS_CAN_ADD.

Referenced by tar_readdir().

int name_comparator void *  a,
void *  b,
int  first_length
 

Compares two strings.

b must be zero-terminated.

Parameters:
a First string
b Second string
first_length maximum length of a
Returns:
1 - equal, 0 - nonequal
See also:
name_comparator2

Definition at line 96 of file tarfs_util.c.

Referenced by offset_by_name().

int name_comparator2 void *  a,
void *  b,
unsigned int  first_length,
unsigned int  second_length
 

Compares two strings, (except trailing '/').

b must be zero-terminated.

Parameters:
a First string
b Second string
first_length maximum length of a
second_length maximum length of b
Returns:
1 - equal, 0 - nonequal
See also:
name_comparator

Definition at line 139 of file tarfs_util.c.

Referenced by offset_by_name2().

unsigned long oct_to_dec void *  what,
unsigned int  length
 

Converts octal number into decimal integer.

Supposes that the number is in big endian format

Parameters:
what Number in octal format (string)
length Length of what - string
Returns:
Number in decimal format, TARFS_EVAL - error

Definition at line 219 of file tarfs_util.c.

References is_octal(), and TARFS_EVAL.

Referenced by find_nolink(), is_tar(), offset_by_name(), offset_by_name2(), skip_blocks(), symlinkname(), tar_fill_inode(), tar_get_root_ino(), tar_length(), tar_lookup(), and tar_readdir().

int read_block struct super_block *  s,
unsigned long  i,
void *  blok
 

Reads block from device.

Reads #i block from device specified in super block s

Parameters:
s Super block
i No. of block
blok Allocated buffer in which to store data (size TAFS_BLKSIZE)
Returns:
1 - OK, 0 - error

Definition at line 47 of file tarfs_util.c.

References TARFS_BLKSIZE.

Referenced by find_nolink(), offset_by_name(), offset_by_name2(), pom_read_name(), skip_blocks(), symlinkname(), tar_fill_inode(), tar_get_root_ino(), tar_length(), tar_lookup(), tar_quick_validation(), tar_read_page(), and tar_readdir().

unsigned int short_name_size char *  name  ) 
 

Returns length of filename stored in one block.

Parameters:
name Any zero-terminated string
Returns:
min(length of name, 100)

Definition at line 245 of file tarfs_util.c.

Referenced by find_nolink(), offset_by_name2(), symlinkname(), tar_fill_inode(), tar_lookup(), and tar_readdir().


Generated on Fri May 23 02:10:45 2003 for TarFS by doxygen1.3