Deleted Added
full compact
tables.c (36049) tables.c (46684)
1/*-
2 * Copyright (c) 1992 Keith Muller.
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Keith Muller of the University of California, San Diego.
8 *

--- 26 unchanged lines hidden (view full) ---

35 * SUCH DAMAGE.
36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93";
41#endif
42static const char rcsid[] =
1/*-
2 * Copyright (c) 1992 Keith Muller.
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Keith Muller of the University of California, San Diego.
8 *

--- 26 unchanged lines hidden (view full) ---

35 * SUCH DAMAGE.
36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93";
41#endif
42static const char rcsid[] =
43 "$Id$";
43 "$Id: tables.c,v 1.11 1998/05/15 06:27:46 charnier Exp $";
44#endif /* not lint */
45
46#include <sys/types.h>
47#include <sys/time.h>
48#include <sys/stat.h>
49#include <sys/fcntl.h>
50#include <errno.h>
51#include <stdio.h>

--- 4 unchanged lines hidden (view full) ---

56#include "tables.h"
57#include "extern.h"
58
59/*
60 * Routines for controlling the contents of all the different databases pax
61 * keeps. Tables are dynamically created only when they are needed. The
62 * goal was speed and the ability to work with HUGE archives. The databases
63 * were kept simple, but do have complex rules for when the contents change.
44#endif /* not lint */
45
46#include <sys/types.h>
47#include <sys/time.h>
48#include <sys/stat.h>
49#include <sys/fcntl.h>
50#include <errno.h>
51#include <stdio.h>

--- 4 unchanged lines hidden (view full) ---

56#include "tables.h"
57#include "extern.h"
58
59/*
60 * Routines for controlling the contents of all the different databases pax
61 * keeps. Tables are dynamically created only when they are needed. The
62 * goal was speed and the ability to work with HUGE archives. The databases
63 * were kept simple, but do have complex rules for when the contents change.
64 * As of this writing, the posix library functions were more complex than
64 * As of this writing, the POSIX library functions were more complex than
65 * needed for this application (pax databases have very short lifetimes and
66 * do not survive after pax is finished). Pax is required to handle very
67 * large archives. These database routines carefully combine memory usage and
68 * temporary file storage in ways which will not significantly impact runtime
69 * performance while allowing the largest possible archives to be handled.
65 * needed for this application (pax databases have very short lifetimes and
66 * do not survive after pax is finished). Pax is required to handle very
67 * large archives. These database routines carefully combine memory usage and
68 * temporary file storage in ways which will not significantly impact runtime
69 * performance while allowing the largest possible archives to be handled.
70 * Trying to force the fit to the posix databases routines was not considered
70 * Trying to force the fit to the POSIX databases routines was not considered
71 * time well spent.
72 */
73
74static HRDLNK **ltab = NULL; /* hard link table for detecting hard links */
75static FTM **ftab = NULL; /* file time table for updating arch */
76static NAMT **ntab = NULL; /* interactive rename storage table */
77static DEVT **dtab = NULL; /* device/inode mapping tables */
78static ATDIR **atab = NULL; /* file tree directory time reset table */

--- 424 unchanged lines hidden (view full) ---

503 (void)free((char *)pt);
504 return(-1);
505}
506
507/*
508 * Interactive rename table routines
509 *
510 * The interactive rename table keeps track of the new names that the user
71 * time well spent.
72 */
73
74static HRDLNK **ltab = NULL; /* hard link table for detecting hard links */
75static FTM **ftab = NULL; /* file time table for updating arch */
76static NAMT **ntab = NULL; /* interactive rename storage table */
77static DEVT **dtab = NULL; /* device/inode mapping tables */
78static ATDIR **atab = NULL; /* file tree directory time reset table */

--- 424 unchanged lines hidden (view full) ---

503 (void)free((char *)pt);
504 return(-1);
505}
506
507/*
508 * Interactive rename table routines
509 *
510 * The interactive rename table keeps track of the new names that the user
511 * assignes to files from tty input. Since this map is unique for each file
511 * assigns to files from tty input. Since this map is unique for each file
512 * we must store it in case there is a reference to the file later in archive
513 * (a link). Otherwise we will be unable to find the file we know was
514 * extracted. The remapping of these files is stored in a memory based hash
515 * table (it is assumed since input must come from /dev/tty, it is unlikely to
516 * be a very large table).
517 */
518
519/*

--- 237 unchanged lines hidden (view full) ---

757 return(0);
758}
759
760/*
761 * chk_dev()
762 * check for a device value in the device table. If not found and the add
763 * flag is set, it is added. This does NOT assign any mapping values, just
764 * adds the device number as one that need to be remapped. If this device
512 * we must store it in case there is a reference to the file later in archive
513 * (a link). Otherwise we will be unable to find the file we know was
514 * extracted. The remapping of these files is stored in a memory based hash
515 * table (it is assumed since input must come from /dev/tty, it is unlikely to
516 * be a very large table).
517 */
518
519/*

--- 237 unchanged lines hidden (view full) ---

757 return(0);
758}
759
760/*
761 * chk_dev()
762 * check for a device value in the device table. If not found and the add
763 * flag is set, it is added. This does NOT assign any mapping values, just
764 * adds the device number as one that need to be remapped. If this device
765 * is alread mapped, just return with a pointer to that entry.
765 * is already mapped, just return with a pointer to that entry.
766 * Return:
767 * pointer to the entry for this device in the device map table. Null
768 * if the add flag is not set and the device is not in the table (it is
769 * not been seen yet). If add is set and the device cannot be added, null
770 * is returned (indicates an error).
771 */
772
773#if __STDC__

--- 657 unchanged lines hidden ---
766 * Return:
767 * pointer to the entry for this device in the device map table. Null
768 * if the add flag is not set and the device is not in the table (it is
769 * not been seen yet). If add is set and the device cannot be added, null
770 * is returned (indicates an error).
771 */
772
773#if __STDC__

--- 657 unchanged lines hidden ---