#include "tarfs_tar.h"
#include "tarfs_util.h"
#include "tarfs_common.h"
#include <linux/slab.h>
Go to the source code of this file.
Compounds | |
struct | posix_header |
Defines | |
#define | TMAGIC "ustar" |
#define | TMAGLEN 6 |
#define | TVERSION "00" |
#define | TVERSLEN 2 |
#define | REGTYPE '0' |
#define | AREGTYPE '\0' |
#define | LNKTYPE '1' |
#define | SYMTYPE '2' |
#define | CHRTYPE '3' |
#define | BLKTYPE '4' |
#define | DIRTYPE '5' |
#define | FIFOTYPE '6' |
#define | CONTTYPE '7' |
#define | TSUID 04000 |
#define | TSGID 02000 |
#define | TSVTX 01000 |
#define | TUREAD 00400 |
#define | TUWRITE 00200 |
#define | TUEXEC 00100 |
#define | TGREAD 00040 |
#define | TGWRITE 00020 |
#define | TGEXEC 00010 |
#define | TOREAD 00004 |
#define | TOWRITE 00002 |
#define | TOEXEC 00001 |
#define | OFFSET_BY_INO(X) ((X) - 1) |
For given inode number, returns offset of its header block. | |
Typedefs | |
typedef posix_header | posix_header |
Functions | |
int | is_tar (posix_header *blok) |
Controls if given block is a valid tar block. | |
int | tar_quick_validation (struct super_block *s) |
Performs quick valiadtion of tar. | |
unsigned long | get_root_ino_pom (posix_header *blok) |
Helper routine for tar_get_root_inode. | |
unsigned long | tar_get_root_ino (struct super_block *s) |
Returns number of root inode. | |
unsigned long | tar_length (struct super_block *s) |
Returns number of blocks in tar. | |
int | pom_read_name (struct super_block *s, char **file_name, unsigned long size, unsigned long offset) |
Helper routine, reads filename of file starting at given position. | |
unsigned long | offset_by_name (struct super_block *s, char *name) |
Searches for given file in tar. | |
unsigned long | offset_by_name2 (struct super_block *s, unsigned long pos, char *name, unsigned int fsize) |
Does the same thing as offset_by_name, with some changes. | |
unsigned long | skip_blocks (struct super_block *s, unsigned long whence) |
Returns position, where real datablock is stored. | |
int | get_type (posix_header *blok, unsigned *type) |
Converts from types of tar inodes to types defined in fs.h. | |
int | tar_fill_inode (struct super_block *s, struct inode *inode, int *rdev) |
Reads inode from tar. | |
unsigned long | find_nolink (struct super_block *s, unsigned long ino) |
Returns physical position of file of given inode. | |
char * | symlinkname (struct super_block *s, unsigned long ino) |
reads symlinks target | |
unsigned long | tar_read_page (struct super_block *s, struct inode *inode, loff_t offset, void *buffer) |
Fills buffer with data from given inode. | |
unsigned long | tar_readdir (struct file *filp, void *dirent, filldir_t filldir) |
Reads directory entries. | |
unsigned long | tar_lookup (struct super_block *s, unsigned long ino, const char *fname, unsigned int fsize) |
Searches for file in given directory. |
Petr Cermak <xgxg@seznam.cz>
Definition in file tarfs_tar.c.
|
regular file Definition at line 56 of file tarfs_tar.c. Referenced by find_nolink(), get_type(), offset_by_name(), offset_by_name2(), skip_blocks(), tar_fill_inode(), tar_get_root_ino(), and tar_readdir(). |
|
block special Definition at line 60 of file tarfs_tar.c. Referenced by find_nolink(), get_type(), offset_by_name(), offset_by_name2(), skip_blocks(), tar_fill_inode(), tar_get_root_ino(), and tar_readdir(). |
|
character special Definition at line 59 of file tarfs_tar.c. Referenced by find_nolink(), get_type(), offset_by_name(), offset_by_name2(), skip_blocks(), tar_fill_inode(), tar_get_root_ino(), and tar_readdir(). |
|
reserved Definition at line 63 of file tarfs_tar.c. |
|
directory Definition at line 61 of file tarfs_tar.c. Referenced by find_nolink(), get_root_ino_pom(), get_type(), offset_by_name(), offset_by_name2(), skip_blocks(), tar_fill_inode(), tar_get_root_ino(), tar_lookup(), and tar_readdir(). |
|
FIFO special Definition at line 62 of file tarfs_tar.c. Referenced by find_nolink(), get_type(), offset_by_name(), offset_by_name2(), skip_blocks(), tar_fill_inode(), tar_get_root_ino(), and tar_readdir(). |
|
link Definition at line 57 of file tarfs_tar.c. Referenced by find_nolink(), get_type(), offset_by_name(), offset_by_name2(), skip_blocks(), tar_fill_inode(), tar_get_root_ino(), and tar_readdir(). |
|
For given inode number, returns offset of its header block.
Definition at line 86 of file tarfs_tar.c. Referenced by symlinkname(), tar_fill_inode(), tar_lookup(), and tar_readdir(). |
|
regular file Definition at line 55 of file tarfs_tar.c. Referenced by find_nolink(), get_type(), offset_by_name(), offset_by_name2(), skip_blocks(), tar_fill_inode(), tar_get_root_ino(), and tar_readdir(). |
|
reserved Definition at line 58 of file tarfs_tar.c. Referenced by find_nolink(), get_type(), offset_by_name(), offset_by_name2(), skip_blocks(), symlinkname(), tar_fill_inode(), tar_get_root_ino(), and tar_readdir(). |
|
execute/search by group Definition at line 75 of file tarfs_tar.c. |
|
read by group Definition at line 73 of file tarfs_tar.c. |
|
write by group Definition at line 74 of file tarfs_tar.c. |
|
ustar and a null Definition at line 49 of file tarfs_tar.c. Referenced by is_tar(). |
|
Definition at line 50 of file tarfs_tar.c. Referenced by is_tar(). |
|
execute by other Definition at line 78 of file tarfs_tar.c. |
|
read by other Definition at line 76 of file tarfs_tar.c. |
|
write by other Definition at line 77 of file tarfs_tar.c. |
|
set GID on execution Definition at line 67 of file tarfs_tar.c. |
|
set UID on execution Definition at line 66 of file tarfs_tar.c. |
|
reserved Definition at line 68 of file tarfs_tar.c. |
|
execute/search by owner Definition at line 72 of file tarfs_tar.c. |
|
read by owner Definition at line 70 of file tarfs_tar.c. |
|
write by owner Definition at line 71 of file tarfs_tar.c. |
|
00 and no null Definition at line 51 of file tarfs_tar.c. |
|
Definition at line 52 of file tarfs_tar.c. |
|
One block of tar |
|
Returns physical position of file of given inode. If hardlink, it jumps to the linked position
Definition at line 915 of file tarfs_tar.c. References AREGTYPE, BLKTYPE, CHRTYPE, DIRTYPE, FIFOTYPE, is_tar(), posix_header::linkname, LNKTYPE, oct_to_dec(), offset_by_name(), pom_read_name(), read_block(), REGTYPE, short_name_size(), posix_header::size, skip_blocks(), SYMTYPE, TARFS_EVAL, TARFS_NUMLENGTH, and posix_header::typeflag. Referenced by tar_read_page(). |
|
Helper routine for tar_get_root_inode.
Definition at line 166 of file tarfs_tar.c. References DIRTYPE, posix_header::name, TARFS_EVAL, TARFS_ROOT_INO, and posix_header::typeflag. Referenced by tar_get_root_ino(). |
|
Converts from types of tar inodes to types defined in fs.h.
Definition at line 690 of file tarfs_tar.c. References AREGTYPE, BLKTYPE, CHRTYPE, DIRTYPE, FIFOTYPE, LNKTYPE, REGTYPE, SYMTYPE, and posix_header::typeflag. Referenced by tar_readdir(). |
|
Controls if given block is a valid tar block. Controls the magic and checksum fields
Definition at line 96 of file tarfs_tar.c. References posix_header::chksum, posix_header::magic, oct_to_dec(), TMAGIC, and TMAGLEN. Referenced by find_nolink(), offset_by_name(), offset_by_name2(), skip_blocks(), symlinkname(), tar_fill_inode(), tar_get_root_ino(), tar_length(), tar_lookup(), tar_quick_validation(), and tar_readdir(). |
|
Searches for given file in tar.
Definition at line 352 of file tarfs_tar.c. References AREGTYPE, BLKTYPE, CHRTYPE, DIRTYPE, FIFOTYPE, hcc(), is_tar(), LNKTYPE, name_comparator(), oct_to_dec(), pom_read_name(), read_block(), REGTYPE, posix_header::size, SYMTYPE, TARFS_BLKSIZE, TARFS_EVAL, TARFS_NUMLENGTH, and posix_header::typeflag. Referenced by find_nolink(), and tar_fill_inode(). |
|
Does the same thing as offset_by_name, with some changes. This function searches from the position pos and takes a bit different parameters
Definition at line 492 of file tarfs_tar.c. References AREGTYPE, BLKTYPE, CHRTYPE, DIRTYPE, FIFOTYPE, hcc(), is_tar(), LNKTYPE, posix_header::name, name_comparator2(), oct_to_dec(), pom_read_name(), read_block(), REGTYPE, short_name_size(), posix_header::size, SYMTYPE, TARFS_BLKSIZE, TARFS_EVAL, TARFS_NUMLENGTH, and posix_header::typeflag. Referenced by tar_lookup(). |
|
Helper routine, reads filename of file starting at given position.
Definition at line 301 of file tarfs_tar.c. References hcc(), read_block(), and TARFS_BLKSIZE. Referenced by find_nolink(), offset_by_name(), offset_by_name2(), symlinkname(), tar_fill_inode(), tar_lookup(), and tar_readdir(). |
|
Returns position, where real datablock is stored. This function has meaning only for skipping blocks with type 'K' or 'L'. Otherwise use find_nolink
Definition at line 631 of file tarfs_tar.c. References AREGTYPE, BLKTYPE, CHRTYPE, DIRTYPE, FIFOTYPE, hcc(), is_tar(), LNKTYPE, oct_to_dec(), read_block(), REGTYPE, posix_header::size, SYMTYPE, TARFS_BLKSIZE, TARFS_EVAL, TARFS_NUMLENGTH, and posix_header::typeflag. Referenced by find_nolink(), symlinkname(), tar_fill_inode(), and tar_readdir(). |
|
reads symlinks target
Definition at line 1030 of file tarfs_tar.c. References hcc(), is_tar(), posix_header::linkname, oct_to_dec(), OFFSET_BY_INO, pom_read_name(), read_block(), short_name_size(), posix_header::size, skip_blocks(), SYMTYPE, TARFS_BLKSIZE, TARFS_NUMLENGTH, and posix_header::typeflag. Referenced by tar_read_page(). |
|
Reads inode from tar. Fills inode data like times, acces rights, size of file
Definition at line 739 of file tarfs_tar.c. References AREGTYPE, BLKTYPE, CHRTYPE, posix_header::devmajor, posix_header::devminor, DIRTYPE, FIFOTYPE, posix_header::gid, is_tar(), posix_header::linkname, LNKTYPE, posix_header::mode, posix_header::mtime, oct_to_dec(), OFFSET_BY_INO, offset_by_name(), pom_read_name(), read_block(), REGTYPE, short_name_size(), posix_header::size, skip_blocks(), SYMTYPE, TARFS_EVAL, TARFS_NUMLENGTH, TARFS_ROOT_INO, posix_header::typeflag, and posix_header::uid. Referenced by tarfs_read_inode(). |
|
Returns number of root inode.
Definition at line 184 of file tarfs_tar.c. References AREGTYPE, BLKTYPE, CHRTYPE, DIRTYPE, FIFOTYPE, get_root_ino_pom(), hcc(), is_tar(), LNKTYPE, oct_to_dec(), read_block(), REGTYPE, posix_header::size, SYMTYPE, TARFS_BLKSIZE, TARFS_EVAL, TARFS_NUMLENGTH, and posix_header::typeflag. Referenced by tarfs_read_super(). |
|
Returns number of blocks in tar.
Definition at line 241 of file tarfs_tar.c. References hcc(), is_nullblock(), is_tar(), oct_to_dec(), read_block(), posix_header::size, tar_quick_validation(), TARFS_BLKSIZE, and TARFS_NUMLENGTH. Referenced by tarfs_statfs(). |
|
Searches for file in given directory.
Definition at line 1499 of file tarfs_tar.c. References DIRTYPE, hcc(), is_tar(), posix_header::name, oct_to_dec(), OFFSET_BY_INO, offset_by_name2(), pom_read_name(), read_block(), short_name_size(), posix_header::size, TARFS_BLKSIZE, TARFS_EVAL, TARFS_NUMLENGTH, TARFS_ROOT_INO, and posix_header::typeflag. Referenced by tarfs_lookup(). |
|
Performs quick valiadtion of tar. This function controls only the first block
Definition at line 137 of file tarfs_tar.c. References is_tar(), and read_block(). Referenced by tar_length(), and tarfs_read_super(). |
|
Fills buffer with data from given inode. Reads data from inode with given offset to the end of file or end of buffer (max PAGE_SIZE bytes)
Definition at line 1099 of file tarfs_tar.c. References find_nolink(), hcc(), read_block(), symlinkname(), TARFS_BLKSIZE, TARFS_EVAL, and TARFS_ROOT_INO. Referenced by tarfs_readpage(). |
|
Reads directory entries. Reads directory entries, until stopped by returning <0 from filldir function, after that, it stores last entry id read into filp->f_pos. When called again, it continues from the last f_pos stored.
Definition at line 1218 of file tarfs_tar.c. References AREGTYPE, BLKTYPE, CHRTYPE, DIRTYPE, FIFOTYPE, get_type(), hcc(), is_nullblock(), is_right_prefix(), is_tar(), LNKTYPE, posix_header::name, oct_to_dec(), OFFSET_BY_INO, pom_read_name(), read_block(), REGTYPE, short_name_size(), posix_header::size, skip_blocks(), SYMTYPE, TARFS_BLKSIZE, TARFS_EVAL, TARFS_NUMLENGTH, TARFS_PARENTDIR_FPOS, TARFS_ROOT_INO, TARFS_THISDIR_FPOS, and posix_header::typeflag. Referenced by tarfs_readdir(). |