ar_io.c File Reference

#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/mtio.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "pax.h"
#include "options.h"
#include "extern.h"

Include dependency graph for ar_io.c:

Go to the source code of this file.

Defines

#define DMOD   0666
#define EXT_MODE   O_RDONLY
#define AR_MODE   (O_WRONLY | O_CREAT | O_TRUNC)
#define APP_MODE   O_RDWR

Functions

static int get_phys (void)
static void ar_start_gzip (int, const char *, int)
int ar_open (const char *name)
void ar_close (void)
void ar_drain (void)
int ar_set_wr (void)
int ar_app_ok (void)
int ar_read (char *buf, int cnt)
int ar_write (char *buf, int bsz)
int ar_rdsync (void)
int ar_fow (off_t sksz, off_t *skipped)
int ar_rev (off_t sksz)
int ar_next (void)

Variables

static char none [] = "<NONE>"
static char stdo [] = "<STDOUT>"
static char stdn [] = "<STDIN>"
static int arfd = -1
static int artyp = ISREG
static int arvol = 1
static int lstrval = -1
static int io_ok
static int did_io
static int done
static struct stat arsb
static int invld_rec
static int wr_trail = 1
static int can_unlnk = 0
const char * arcname
const char * gzip_program
static pid_t zpid = -1
sigset_t s_mask


Define Documentation

#define APP_MODE   O_RDWR
 

Definition at line 64 of file ar_io.c.

Referenced by ar_open().

#define AR_MODE   (O_WRONLY | O_CREAT | O_TRUNC)
 

Definition at line 63 of file ar_io.c.

Referenced by ar_open().

#define DMOD   0666
 

Definition at line 61 of file ar_io.c.

Referenced by ar_open().

#define EXT_MODE   O_RDONLY
 

Definition at line 62 of file ar_io.c.

Referenced by ar_open().


Function Documentation

int ar_app_ok void   ) 
 

Definition at line 494 of file ar_io.c.

References argv0, artyp, invld_rec, ISPIPE, paxwarn(), and rdblksz.

Referenced by appnd_start().

void ar_close void   ) 
 

Definition at line 301 of file ar_io.c.

References act, arcname, arfd, argv0, arsb, artyp, arvol, can_unlnk, close, did_io, EXTRACT, fflush(), flcnt, fprintf(), fputs(), frmt, fstat, io_ok, ISTAPE, kill, LIST, listf, fsub::name, nflag, NM_CPIO, NM_TAR, NULL, putc, rdcnt, S_ISREG, SIGINT, stat::st_mode, stat::st_size, status, strcmp, unlink, vflag, vfpart, waitpid, wrcnt, and zpid.

Referenced by ar_next(), copy(), extract(), list(), sig_cleanup(), and wr_archive().

void ar_drain void   ) 
 

Definition at line 424 of file ar_io.c.

References arfd, artyp, ISPIPE, lstrval, MAXBLK, and read.

int ar_fow off_t  sksz,
off_t skipped
 

Definition at line 812 of file ar_io.c.

References arfd, arsb, artyp, errno, ISREG, L, lseek, lstrval, SEEK_CUR, SEEK_SET, stat::st_size, and syswarn().

Referenced by rd_skip().

int ar_next void   ) 
 

Definition at line 1116 of file ar_io.c.

References act, APPND, ar_close(), ar_open(), ARCHIVE, arcname, argv0, artyp, arvol, done, errno, ISPIPE, ISREG, ISTAPE, lstrval, NM_TAR, NULL, PAXPATHLEN, s_mask, sigprocmask, stdn, stdo, strcmp, syswarn(), tty_prnt(), tty_read(), vfpart, and wr_trail.

Referenced by buf_flush(), rd_start(), rd_sync(), and wr_start().

int ar_open const char *  name  ) 
 

Definition at line 98 of file ar_io.c.

References act, APP_MODE, APPND, AR_MODE, ar_start_gzip(), ARCHIVE, arcname, arfd, arsb, artyp, BLKMULT, blksz, can_unlnk, chdir, chdname, close, COPY, DEVBLK, did_io, DMOD, errno, ESPIPE, EXT_MODE, EXTRACT, FILEBLK, flcnt, fstat, gzip_program, if(), invld_rec, io_ok, ioctl, ISBLK, ISCHR, ISPIPE, ISREG, ISTAPE, L, LIST, lseek, lstrval, MAXBLK, mb, MTIOCGET, none, NULL, open, paxwarn(), rdblksz, S_ISBLK, S_ISCHR, S_ISDIR, SEEK_CUR, stat::st_mode, stat::st_size, STDIN_FILENO, stdn, stdo, STDOUT_FILENO, syswarn(), and wrblksz.

Referenced by ar_next(), rd_start(), and wr_start().

int ar_rdsync void   ) 
 

Definition at line 723 of file ar_io.c.

References act, APPND, ARCHIVE, arfd, arsb, artyp, BLKMULT, did_io, done, io_ok, ioctl, ISBLK, ISCHR, ISPIPE, ISREG, ISTAPE, L, lseek, lstrval, mb, MTFSR, MTIOCTOP, paxwarn(), and SEEK_CUR.

Referenced by rd_sync().

int ar_read char *  buf,
int  cnt
 

Definition at line 518 of file ar_io.c.

References arfd, artyp, arvol, BLKMULT, errno, invld_rec, io_ok, ISBLK, ISCHR, ISPIPE, ISREG, ISTAPE, lstrval, paxwarn(), rdblksz, read, and syswarn().

Referenced by appnd_start(), buf_fill(), and rd_sync().

int ar_rev off_t  sksz  ) 
 

Definition at line 871 of file ar_io.c.

References arfd, artyp, arvol, errno, get_phys(), ioctl, ISBLK, ISCHR, ISPIPE, ISREG, ISTAPE, L, lseek, lstrval, mb, MTBSR, MTIOCTOP, paxwarn(), rdblksz, SEEK_CUR, SEEK_SET, and syswarn().

Referenced by appnd_start().

int ar_set_wr void   ) 
 

Definition at line 456 of file ar_io.c.

References arfd, artyp, errno, ftruncate, ISREG, L, lseek, SEEK_CUR, syswarn(), and wr_trail.

Referenced by appnd_start().

static void ar_start_gzip int  ,
const char *  ,
int 
[static]
 

Definition at line 1262 of file ar_io.c.

References close, dup2, err, execlp, fds, fork, NULL, pipe, STDIN_FILENO, STDOUT_FILENO, and zpid.

Referenced by ar_open().

int ar_write char *  buf,
int  bsz
 

Definition at line 601 of file ar_io.c.

References arfd, artyp, arvol, fsub::blkalgn, BLKMULT, EACCES, EFBIG, EIO, ENOSPC, ENXIO, errno, frmt, ftruncate, io_ok, ISBLK, ISCHR, ISPIPE, ISREG, ISTAPE, L, lseek, lstrval, paxwarn(), SEEK_CUR, syswarn(), wr_trail, and write.

Referenced by buf_flush().

static int get_phys void   )  [static]
 

Definition at line 1003 of file ar_io.c.

References arfd, errno, ioctl, lstrval, MAXBLK, mb, MTBSF, MTBSR, MTIOCTOP, paxwarn(), read, and syswarn().

Referenced by ar_rev().


Variable Documentation

const char* arcname
 

Definition at line 80 of file ar_io.c.

Referenced by ar_close(), ar_next(), ar_open(), cpio_options(), pax_options(), rd_start(), tar_options(), and wr_start().

int arfd = -1 [static]
 

Definition at line 69 of file ar_io.c.

Referenced by ar_close(), ar_drain(), ar_fow(), ar_open(), ar_rdsync(), ar_read(), ar_rev(), ar_set_wr(), ar_write(), and get_phys().

struct stat arsb [static]
 

Definition at line 76 of file ar_io.c.

Referenced by ar_close(), ar_fow(), ar_open(), and ar_rdsync().

int artyp = ISREG [static]
 

Definition at line 70 of file ar_io.c.

Referenced by ar_app_ok(), ar_close(), ar_drain(), ar_fow(), ar_next(), ar_open(), ar_rdsync(), ar_read(), ar_rev(), ar_set_wr(), and ar_write().

int arvol = 1 [static]
 

Definition at line 71 of file ar_io.c.

Referenced by ar_close(), ar_next(), ar_read(), ar_rev(), and ar_write().

int can_unlnk = 0 [static]
 

Definition at line 79 of file ar_io.c.

Referenced by ar_close(), and ar_open().

int did_io [static]
 

Definition at line 74 of file ar_io.c.

Referenced by ar_close(), ar_open(), and ar_rdsync().

int done [static]
 

Definition at line 75 of file ar_io.c.

Referenced by _doscan(), ar_next(), ar_rdsync(), askerr(), bc_sqrt(), blk_ok(), build_relations(), catch_child(), cfi(), cfu(), copy(), do_flush(), doit(), dollar_error(), dotrap(), dowait(), down_line(), ed_dorep(), ed_fill(), fatal(), force_io(), get_mem_chunks(), get_super(), illegal_character(), illegal_tag(), lostpeer(), main(), make_file(), makerewindable(), mkpath(), no_grammar(), no_space(), onintr(), open_error(), over_unionized(), rw_inode(), rw_super(), select_disk(), select_region(), set_bit(), set_nullable(), sig_handler(), slave(), syntax_error(), talk(), terminal_lhs(), terminal_start(), timeout(), tokenized_start(), undefined_goal(), unexpected_EOF(), unknown_rhs(), unterminated_action(), unterminated_comment(), unterminated_string(), unterminated_text(), unterminated_union(), untyped_lhs(), untyped_rhs(), upd_line(), and used_reserved().

const char* gzip_program
 

Definition at line 81 of file ar_io.c.

Referenced by ar_open(), cpio_options(), main(), pax_options(), and tar_options().

int invld_rec [static]
 

Definition at line 77 of file ar_io.c.

Referenced by ar_app_ok(), ar_open(), and ar_read().

int io_ok [static]
 

Definition at line 73 of file ar_io.c.

Referenced by ar_close(), ar_open(), ar_rdsync(), ar_read(), and ar_write().

int lstrval = -1 [static]
 

Definition at line 72 of file ar_io.c.

Referenced by ar_drain(), ar_fow(), ar_next(), ar_open(), ar_rdsync(), ar_read(), ar_rev(), ar_write(), and get_phys().

char none[] = "<NONE>" [static]
 

Definition at line 66 of file ar_io.c.

Referenced by ar_open(), and main().

sigset_t s_mask
 

Definition at line 99 of file pax.c.

Referenced by ar_next(), copy(), extract(), gen_init(), list(), and wr_archive().

char stdn[] = "<STDIN>" [static]
 

Definition at line 68 of file ar_io.c.

Referenced by ar_next(), and ar_open().

char stdo[] = "<STDOUT>" [static]
 

Definition at line 67 of file ar_io.c.

Referenced by ar_next(), ar_open(), and main().

int wr_trail = 1 [static]
 

Definition at line 78 of file ar_io.c.

Referenced by ar_next(), ar_set_wr(), and ar_write().

pid_t zpid = -1 [static]
 

Definition at line 82 of file ar_io.c.

Referenced by ar_close(), and ar_start_gzip().


Generated on Fri Apr 14 23:05:38 2006 for minix by  doxygen 1.4.6