maint: remove GLOBAL as per GCC 14
* src/common.h (GLOBAL): Remove this macro, and all its uses. It collides with GCC 14 and -Wmissing-variable-declarations. Change all uses of GLOBAL to use extern instead, and declare the variables in their respective .c files. Move .c file’s extern declarations here, so that they appear only once and are checked against definitions. * src/names.c (unconsumed_option_tail): Now static.
This commit is contained in:
22
src/buffer.c
22
src/buffer.c
@@ -52,18 +52,21 @@ static int record_index;
|
|||||||
/* FIXME: The following variables should ideally be static to this
|
/* FIXME: The following variables should ideally be static to this
|
||||||
module. However, this cannot be done yet. The cleanup continues! */
|
module. However, this cannot be done yet. The cleanup continues! */
|
||||||
|
|
||||||
extern union block *record_start;
|
int archive;
|
||||||
|
struct timespec start_time;
|
||||||
|
struct timespec volume_start_time;
|
||||||
|
struct timespec last_stat_time;
|
||||||
|
struct tar_stat_info current_stat_info;
|
||||||
|
struct stat archive_stat;
|
||||||
|
|
||||||
|
bool seekable_archive;
|
||||||
|
|
||||||
union block *record_start; /* start of record of archive */
|
union block *record_start; /* start of record of archive */
|
||||||
extern union block *record_end;
|
|
||||||
union block *record_end; /* last+1 block of archive record */
|
union block *record_end; /* last+1 block of archive record */
|
||||||
extern union block *current_block;
|
|
||||||
union block *current_block; /* current block of archive */
|
union block *current_block; /* current block of archive */
|
||||||
enum access_mode access_mode; /* how do we handle the archive */
|
enum access_mode access_mode; /* how do we handle the archive */
|
||||||
extern off_t records_read;
|
|
||||||
off_t records_read; /* number of records read from this archive */
|
off_t records_read; /* number of records read from this archive */
|
||||||
off_t records_written; /* likewise, for records written */
|
off_t records_written; /* likewise, for records written */
|
||||||
extern off_t records_skipped; /* number of records skipped at the start
|
|
||||||
of the archive, defined in delete.c */
|
|
||||||
|
|
||||||
static off_t record_start_block; /* block ordinal at record_start */
|
static off_t record_start_block; /* block ordinal at record_start */
|
||||||
|
|
||||||
@@ -83,13 +86,6 @@ static bool hit_eof;
|
|||||||
|
|
||||||
static bool read_full_records = false;
|
static bool read_full_records = false;
|
||||||
|
|
||||||
/* We're reading, but we just read the last block and it's time to update.
|
|
||||||
Declared in update.c
|
|
||||||
|
|
||||||
FIXME: Either eliminate it or move it to common.h.
|
|
||||||
*/
|
|
||||||
extern bool time_to_start_writing;
|
|
||||||
|
|
||||||
bool write_archive_to_stdout;
|
bool write_archive_to_stdout;
|
||||||
|
|
||||||
static void (*flush_write_ptr) (size_t);
|
static void (*flush_write_ptr) (size_t);
|
||||||
|
|||||||
246
src/common.h
246
src/common.h
@@ -33,16 +33,6 @@
|
|||||||
|
|
||||||
/* Some various global definitions. */
|
/* Some various global definitions. */
|
||||||
|
|
||||||
/* Name of file to use for interacting with user. */
|
|
||||||
|
|
||||||
/* GLOBAL is defined to empty in tar.c only, and left alone in other *.c
|
|
||||||
modules. Here, we merely set it to "extern" if it is not already set.
|
|
||||||
GNU tar does depend on the system loader to preset all GLOBAL variables to
|
|
||||||
neutral (or zero) values, explicit initialization is usually not done. */
|
|
||||||
#ifndef GLOBAL
|
|
||||||
# define GLOBAL extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TAREXIT_SUCCESS PAXEXIT_SUCCESS
|
#define TAREXIT_SUCCESS PAXEXIT_SUCCESS
|
||||||
#define TAREXIT_DIFFERS PAXEXIT_DIFFERS
|
#define TAREXIT_DIFFERS PAXEXIT_DIFFERS
|
||||||
#define TAREXIT_FAILURE PAXEXIT_FAILURE
|
#define TAREXIT_FAILURE PAXEXIT_FAILURE
|
||||||
@@ -97,30 +87,30 @@ enum subcommand
|
|||||||
TEST_LABEL_SUBCOMMAND, /* --test-label */
|
TEST_LABEL_SUBCOMMAND, /* --test-label */
|
||||||
};
|
};
|
||||||
|
|
||||||
GLOBAL enum subcommand subcommand_option;
|
extern enum subcommand subcommand_option;
|
||||||
|
|
||||||
/* Selected format for output archive. */
|
/* Selected format for output archive. */
|
||||||
GLOBAL enum archive_format archive_format;
|
extern enum archive_format archive_format;
|
||||||
|
|
||||||
/* Size of each record, once in blocks, once in bytes. Those two variables
|
/* Size of each record, once in blocks, once in bytes. Those two variables
|
||||||
are always related, the second being BLOCKSIZE times the first. They do
|
are always related, the second being BLOCKSIZE times the first. They do
|
||||||
not have _option in their name, even if their values is derived from
|
not have _option in their name, even if their values is derived from
|
||||||
option decoding, as these are especially important in tar. */
|
option decoding, as these are especially important in tar. */
|
||||||
GLOBAL int blocking_factor;
|
extern int blocking_factor;
|
||||||
GLOBAL size_t record_size;
|
extern size_t record_size;
|
||||||
|
|
||||||
GLOBAL bool absolute_names_option;
|
extern bool absolute_names_option;
|
||||||
|
|
||||||
/* Display file times in UTC */
|
/* Display file times in UTC */
|
||||||
GLOBAL bool utc_option;
|
extern bool utc_option;
|
||||||
/* Output file timestamps to the full resolution */
|
/* Output file timestamps to the full resolution */
|
||||||
GLOBAL bool full_time_option;
|
extern bool full_time_option;
|
||||||
|
|
||||||
/* This variable tells how to interpret newer_mtime_option, below. If zero,
|
/* This variable tells how to interpret newer_mtime_option, below. If zero,
|
||||||
files get archived if their mtime is not less than newer_mtime_option.
|
files get archived if their mtime is not less than newer_mtime_option.
|
||||||
If nonzero, files get archived if *either* their ctime or mtime is not less
|
If nonzero, files get archived if *either* their ctime or mtime is not less
|
||||||
than newer_mtime_option. */
|
than newer_mtime_option. */
|
||||||
GLOBAL int after_date_option;
|
extern int after_date_option;
|
||||||
|
|
||||||
enum atime_preserve
|
enum atime_preserve
|
||||||
{
|
{
|
||||||
@@ -128,26 +118,26 @@ enum atime_preserve
|
|||||||
replace_atime_preserve,
|
replace_atime_preserve,
|
||||||
system_atime_preserve
|
system_atime_preserve
|
||||||
};
|
};
|
||||||
GLOBAL enum atime_preserve atime_preserve_option;
|
extern enum atime_preserve atime_preserve_option;
|
||||||
|
|
||||||
GLOBAL bool backup_option;
|
extern bool backup_option;
|
||||||
|
|
||||||
/* Type of backups being made. */
|
/* Type of backups being made. */
|
||||||
GLOBAL enum backup_type backup_type;
|
extern enum backup_type backup_type;
|
||||||
|
|
||||||
GLOBAL bool block_number_option;
|
extern bool block_number_option;
|
||||||
|
|
||||||
GLOBAL unsigned checkpoint_option;
|
extern unsigned checkpoint_option;
|
||||||
#define DEFAULT_CHECKPOINT 10
|
#define DEFAULT_CHECKPOINT 10
|
||||||
|
|
||||||
/* Specified name of compression program, or "gzip" as implied by -z. */
|
/* Specified name of compression program, or "gzip" as implied by -z. */
|
||||||
GLOBAL const char *use_compress_program_option;
|
extern const char *use_compress_program_option;
|
||||||
|
|
||||||
GLOBAL bool dereference_option;
|
extern bool dereference_option;
|
||||||
GLOBAL bool hard_dereference_option;
|
extern bool hard_dereference_option;
|
||||||
|
|
||||||
/* Patterns that match file names to be excluded. */
|
/* Patterns that match file names to be excluded. */
|
||||||
GLOBAL struct exclude *excluded;
|
extern struct exclude *excluded;
|
||||||
|
|
||||||
enum exclusion_tag_type
|
enum exclusion_tag_type
|
||||||
{
|
{
|
||||||
@@ -164,22 +154,22 @@ enum exclusion_tag_type
|
|||||||
|
|
||||||
/* Specified value to be put into tar file in place of stat () results, or
|
/* Specified value to be put into tar file in place of stat () results, or
|
||||||
just null and -1 if such an override should not take place. */
|
just null and -1 if such an override should not take place. */
|
||||||
GLOBAL char const *group_name_option;
|
extern char const *group_name_option;
|
||||||
GLOBAL gid_t group_option;
|
extern gid_t group_option;
|
||||||
|
|
||||||
GLOBAL bool ignore_failed_read_option;
|
extern bool ignore_failed_read_option;
|
||||||
|
|
||||||
GLOBAL bool ignore_zeros_option;
|
extern bool ignore_zeros_option;
|
||||||
|
|
||||||
GLOBAL bool incremental_option;
|
extern bool incremental_option;
|
||||||
|
|
||||||
/* Specified name of script to run at end of each tape change. */
|
/* Specified name of script to run at end of each tape change. */
|
||||||
GLOBAL const char *info_script_option;
|
extern const char *info_script_option;
|
||||||
|
|
||||||
GLOBAL bool interactive_option;
|
extern bool interactive_option;
|
||||||
|
|
||||||
/* If nonzero, extract only Nth occurrence of each named file */
|
/* If nonzero, extract only Nth occurrence of each named file */
|
||||||
GLOBAL uintmax_t occurrence_option;
|
extern uintmax_t occurrence_option;
|
||||||
|
|
||||||
enum old_files
|
enum old_files
|
||||||
{
|
{
|
||||||
@@ -192,28 +182,28 @@ enum old_files
|
|||||||
KEEP_NEWER_FILES /* --keep-newer-files */
|
KEEP_NEWER_FILES /* --keep-newer-files */
|
||||||
};
|
};
|
||||||
#define MAX_OLD_FILES (KEEP_NEWER_FILES+1)
|
#define MAX_OLD_FILES (KEEP_NEWER_FILES+1)
|
||||||
GLOBAL enum old_files old_files_option;
|
extern enum old_files old_files_option;
|
||||||
|
|
||||||
GLOBAL bool keep_directory_symlink_option;
|
extern bool keep_directory_symlink_option;
|
||||||
|
|
||||||
/* Specified file name for incremental list. */
|
/* Specified file name for incremental list. */
|
||||||
GLOBAL const char *listed_incremental_option;
|
extern const char *listed_incremental_option;
|
||||||
/* Incremental dump level */
|
/* Incremental dump level */
|
||||||
GLOBAL int incremental_level;
|
extern int incremental_level;
|
||||||
/* Check device numbers when doing incremental dumps. */
|
/* Check device numbers when doing incremental dumps. */
|
||||||
GLOBAL bool check_device_option;
|
extern bool check_device_option;
|
||||||
|
|
||||||
/* Specified mode change string. */
|
/* Specified mode change string. */
|
||||||
GLOBAL struct mode_change *mode_option;
|
extern struct mode_change *mode_option;
|
||||||
|
|
||||||
/* Initial umask, if needed for mode change string. */
|
/* Initial umask, if needed for mode change string. */
|
||||||
GLOBAL mode_t initial_umask;
|
extern mode_t initial_umask;
|
||||||
|
|
||||||
GLOBAL bool multi_volume_option;
|
extern bool multi_volume_option;
|
||||||
|
|
||||||
/* Specified threshold date and time. Files having an older time stamp
|
/* Specified threshold date and time. Files having an older time stamp
|
||||||
do not get archived (also see after_date_option above). */
|
do not get archived (also see after_date_option above). */
|
||||||
GLOBAL struct timespec newer_mtime_option;
|
extern struct timespec newer_mtime_option;
|
||||||
|
|
||||||
enum set_mtime_option_mode
|
enum set_mtime_option_mode
|
||||||
{
|
{
|
||||||
@@ -224,16 +214,16 @@ enum set_mtime_option_mode
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Override actual mtime if set to FORCE_MTIME or CLAMP_MTIME */
|
/* Override actual mtime if set to FORCE_MTIME or CLAMP_MTIME */
|
||||||
GLOBAL enum set_mtime_option_mode set_mtime_option;
|
extern enum set_mtime_option_mode set_mtime_option;
|
||||||
/* Value to use when forcing or clamping the mtime header field. */
|
/* Value to use when forcing or clamping the mtime header field. */
|
||||||
GLOBAL struct timespec mtime_option;
|
extern struct timespec mtime_option;
|
||||||
|
|
||||||
/* Command to use to set mtime when archiving. */
|
/* Command to use to set mtime when archiving. */
|
||||||
GLOBAL char *set_mtime_command;
|
extern char *set_mtime_command;
|
||||||
|
|
||||||
/* Format (as per strptime(3)) of the output of the above command. If
|
/* Format (as per strptime(3)) of the output of the above command. If
|
||||||
not set, parse_datetime will be used. */
|
not set, parse_datetime will be used. */
|
||||||
GLOBAL char *set_mtime_format;
|
extern char *set_mtime_format;
|
||||||
|
|
||||||
/* Return true if mtime_option or newer_mtime_option is initialized. */
|
/* Return true if mtime_option or newer_mtime_option is initialized. */
|
||||||
#define TIME_OPTION_INITIALIZED(opt) (0 <= (opt).tv_nsec)
|
#define TIME_OPTION_INITIALIZED(opt) (0 <= (opt).tv_nsec)
|
||||||
@@ -248,56 +238,56 @@ GLOBAL char *set_mtime_format;
|
|||||||
(timespec_cmp ((st).m##time, newer_mtime_option) < 0)
|
(timespec_cmp ((st).m##time, newer_mtime_option) < 0)
|
||||||
|
|
||||||
/* Zero if there is no recursion, otherwise FNM_LEADING_DIR. */
|
/* Zero if there is no recursion, otherwise FNM_LEADING_DIR. */
|
||||||
GLOBAL int recursion_option;
|
extern int recursion_option;
|
||||||
|
|
||||||
GLOBAL bool numeric_owner_option;
|
extern bool numeric_owner_option;
|
||||||
|
|
||||||
GLOBAL bool one_file_system_option;
|
extern bool one_file_system_option;
|
||||||
|
|
||||||
/* Create a top-level directory for extracting based on the archive name. */
|
/* Create a top-level directory for extracting based on the archive name. */
|
||||||
GLOBAL bool one_top_level_option;
|
extern bool one_top_level_option;
|
||||||
GLOBAL char *one_top_level_dir;
|
extern char *one_top_level_dir;
|
||||||
|
|
||||||
/* Specified value to be put into tar file in place of stat () results, or
|
/* Specified value to be put into tar file in place of stat () results, or
|
||||||
just null and -1 if such an override should not take place. */
|
just null and -1 if such an override should not take place. */
|
||||||
GLOBAL char const *owner_name_option;
|
extern char const *owner_name_option;
|
||||||
GLOBAL uid_t owner_option;
|
extern uid_t owner_option;
|
||||||
|
|
||||||
GLOBAL bool recursive_unlink_option;
|
extern bool recursive_unlink_option;
|
||||||
|
|
||||||
GLOBAL bool read_full_records_option;
|
extern bool read_full_records_option;
|
||||||
|
|
||||||
GLOBAL bool remove_files_option;
|
extern bool remove_files_option;
|
||||||
|
|
||||||
/* Specified remote shell command. */
|
/* Specified remote shell command. */
|
||||||
GLOBAL const char *rsh_command_option;
|
extern const char *rsh_command_option;
|
||||||
|
|
||||||
GLOBAL bool same_order_option;
|
extern bool same_order_option;
|
||||||
|
|
||||||
/* If positive, preserve ownership when extracting. */
|
/* If positive, preserve ownership when extracting. */
|
||||||
GLOBAL int same_owner_option;
|
extern int same_owner_option;
|
||||||
|
|
||||||
/* If positive, preserve permissions when extracting. */
|
/* If positive, preserve permissions when extracting. */
|
||||||
GLOBAL int same_permissions_option;
|
extern int same_permissions_option;
|
||||||
|
|
||||||
/* If positive, save the SELinux context. */
|
/* If positive, save the SELinux context. */
|
||||||
GLOBAL int selinux_context_option;
|
extern int selinux_context_option;
|
||||||
|
|
||||||
/* If positive, save the ACLs. */
|
/* If positive, save the ACLs. */
|
||||||
GLOBAL int acls_option;
|
extern int acls_option;
|
||||||
|
|
||||||
/* If positive, save the user and root xattrs. */
|
/* If positive, save the user and root xattrs. */
|
||||||
GLOBAL int xattrs_option;
|
extern int xattrs_option;
|
||||||
|
|
||||||
/* When set, strip the given number of file name components from the file name
|
/* When set, strip the given number of file name components from the file name
|
||||||
before extracting */
|
before extracting */
|
||||||
GLOBAL size_t strip_name_components;
|
extern size_t strip_name_components;
|
||||||
|
|
||||||
GLOBAL bool show_omitted_dirs_option;
|
extern bool show_omitted_dirs_option;
|
||||||
|
|
||||||
GLOBAL bool sparse_option;
|
extern bool sparse_option;
|
||||||
GLOBAL unsigned tar_sparse_major;
|
extern unsigned tar_sparse_major;
|
||||||
GLOBAL unsigned tar_sparse_minor;
|
extern unsigned tar_sparse_minor;
|
||||||
|
|
||||||
enum hole_detection_method
|
enum hole_detection_method
|
||||||
{
|
{
|
||||||
@@ -306,28 +296,28 @@ enum hole_detection_method
|
|||||||
HOLE_DETECTION_SEEK
|
HOLE_DETECTION_SEEK
|
||||||
};
|
};
|
||||||
|
|
||||||
GLOBAL enum hole_detection_method hole_detection;
|
extern enum hole_detection_method hole_detection;
|
||||||
|
|
||||||
/* The first entry in names.c:namelist specifies the member name to
|
/* The first entry in names.c:namelist specifies the member name to
|
||||||
start extracting from. Set by add_starting_file() upon seeing the
|
start extracting from. Set by add_starting_file() upon seeing the
|
||||||
-K option.
|
-K option.
|
||||||
*/
|
*/
|
||||||
GLOBAL bool starting_file_option;
|
extern bool starting_file_option;
|
||||||
|
|
||||||
/* Specified maximum byte length of each tape volume (multiple of 1024). */
|
/* Specified maximum byte length of each tape volume (multiple of 1024). */
|
||||||
GLOBAL tarlong tape_length_option;
|
extern tarlong tape_length_option;
|
||||||
|
|
||||||
GLOBAL bool to_stdout_option;
|
extern bool to_stdout_option;
|
||||||
|
|
||||||
GLOBAL bool totals_option;
|
extern bool totals_option;
|
||||||
|
|
||||||
GLOBAL bool touch_option;
|
extern bool touch_option;
|
||||||
|
|
||||||
GLOBAL char *to_command_option;
|
extern char *to_command_option;
|
||||||
GLOBAL bool ignore_command_error_option;
|
extern bool ignore_command_error_option;
|
||||||
|
|
||||||
/* Restrict some potentially harmful tar options */
|
/* Restrict some potentially harmful tar options */
|
||||||
GLOBAL bool restrict_option;
|
extern bool restrict_option;
|
||||||
|
|
||||||
/* Return true if the extracted files are not being written to disk */
|
/* Return true if the extracted files are not being written to disk */
|
||||||
#define EXTRACT_OVER_PIPE (to_stdout_option || to_command_option)
|
#define EXTRACT_OVER_PIPE (to_stdout_option || to_command_option)
|
||||||
@@ -335,44 +325,29 @@ GLOBAL bool restrict_option;
|
|||||||
/* Count how many times the option has been set, multiple setting yields
|
/* Count how many times the option has been set, multiple setting yields
|
||||||
more verbose behavior. Value 0 means no verbosity, 1 means file name
|
more verbose behavior. Value 0 means no verbosity, 1 means file name
|
||||||
only, 2 means file name and all attributes. More than 2 is just like 2. */
|
only, 2 means file name and all attributes. More than 2 is just like 2. */
|
||||||
GLOBAL int verbose_option;
|
extern int verbose_option;
|
||||||
|
|
||||||
GLOBAL bool verify_option;
|
extern bool verify_option;
|
||||||
|
|
||||||
/* Specified name of file containing the volume number. */
|
/* Specified name of file containing the volume number. */
|
||||||
GLOBAL const char *volno_file_option;
|
extern const char *volno_file_option;
|
||||||
|
|
||||||
/* Specified value or pattern. */
|
/* Specified value or pattern. */
|
||||||
GLOBAL const char *volume_label_option;
|
extern const char *volume_label_option;
|
||||||
|
|
||||||
/* Other global variables. */
|
/* Other global variables. */
|
||||||
|
|
||||||
/* Force POSIX-compliance */
|
/* Force POSIX-compliance */
|
||||||
GLOBAL bool posixly_correct;
|
extern bool posixly_correct;
|
||||||
|
|
||||||
/* File descriptor for archive file. */
|
|
||||||
GLOBAL int archive;
|
|
||||||
|
|
||||||
/* Nonzero when outputting to /dev/null. */
|
|
||||||
GLOBAL bool dev_null_output;
|
|
||||||
|
|
||||||
/* Timestamps: */
|
|
||||||
GLOBAL struct timespec start_time; /* when we started execution */
|
|
||||||
GLOBAL struct timespec volume_start_time; /* when the current volume was
|
|
||||||
opened*/
|
|
||||||
GLOBAL struct timespec last_stat_time; /* when the statistics was last
|
|
||||||
computed */
|
|
||||||
|
|
||||||
GLOBAL struct tar_stat_info current_stat_info;
|
|
||||||
|
|
||||||
/* List of tape drive names, number of such tape drives,
|
/* List of tape drive names, number of such tape drives,
|
||||||
and current cursor in list. */
|
and current cursor in list. */
|
||||||
GLOBAL const char **archive_name_array;
|
extern const char **archive_name_array;
|
||||||
GLOBAL size_t archive_names;
|
extern size_t archive_names;
|
||||||
GLOBAL const char **archive_name_cursor;
|
extern const char **archive_name_cursor;
|
||||||
|
|
||||||
/* Output index file name. */
|
/* Output index file name. */
|
||||||
GLOBAL char const *index_file_name;
|
extern char const *index_file_name;
|
||||||
|
|
||||||
/* Opaque structure for keeping directory meta-data */
|
/* Opaque structure for keeping directory meta-data */
|
||||||
struct directory;
|
struct directory;
|
||||||
@@ -405,37 +380,28 @@ struct name
|
|||||||
char *caname; /* canonical name */
|
char *caname; /* canonical name */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Status of archive file, or all zeros if remote. */
|
|
||||||
GLOBAL struct stat archive_stat;
|
|
||||||
|
|
||||||
/* Flags for reading, searching, and fstatatting files. */
|
/* Flags for reading, searching, and fstatatting files. */
|
||||||
GLOBAL int open_read_flags;
|
extern int open_read_flags;
|
||||||
GLOBAL int open_searchdir_flags;
|
extern int open_searchdir_flags;
|
||||||
GLOBAL int fstatat_flags;
|
extern int fstatat_flags;
|
||||||
|
|
||||||
GLOBAL int seek_option;
|
extern int seek_option;
|
||||||
|
|
||||||
/* true if archive if lseek should be used on the archive, 0 if it
|
|
||||||
should not be used. */
|
|
||||||
GLOBAL bool seekable_archive;
|
|
||||||
|
|
||||||
GLOBAL dev_t root_device;
|
|
||||||
|
|
||||||
/* Unquote filenames */
|
/* Unquote filenames */
|
||||||
GLOBAL bool unquote_option;
|
extern bool unquote_option;
|
||||||
|
|
||||||
GLOBAL int savedir_sort_order;
|
extern int savedir_sort_order;
|
||||||
|
|
||||||
/* Show file or archive names after transformation.
|
/* Show file or archive names after transformation.
|
||||||
In particular, when creating archive in verbose mode, list member names
|
In particular, when creating archive in verbose mode, list member names
|
||||||
as stored in the archive */
|
as stored in the archive */
|
||||||
GLOBAL bool show_transformed_names_option;
|
extern bool show_transformed_names_option;
|
||||||
|
|
||||||
/* Delay setting modification times and permissions of extracted directories
|
/* Delay setting modification times and permissions of extracted directories
|
||||||
until the end of extraction. This variable helps correctly restore directory
|
until the end of extraction. This variable helps correctly restore directory
|
||||||
timestamps from archives with an unusual member order. It is automatically
|
timestamps from archives with an unusual member order. It is automatically
|
||||||
set for incremental archives. */
|
set for incremental archives. */
|
||||||
GLOBAL bool delay_directory_restore_option;
|
extern bool delay_directory_restore_option;
|
||||||
|
|
||||||
/* Declarations for each module. */
|
/* Declarations for each module. */
|
||||||
|
|
||||||
@@ -452,6 +418,25 @@ extern enum access_mode access_mode;
|
|||||||
|
|
||||||
/* Module buffer.c. */
|
/* Module buffer.c. */
|
||||||
|
|
||||||
|
/* File descriptor for archive file. */
|
||||||
|
extern int archive;
|
||||||
|
|
||||||
|
/* Timestamps: */
|
||||||
|
extern struct timespec start_time; /* when we started execution */
|
||||||
|
extern struct timespec volume_start_time; /* when the current volume was
|
||||||
|
opened*/
|
||||||
|
extern struct timespec last_stat_time; /* when the statistics was last
|
||||||
|
computed */
|
||||||
|
|
||||||
|
extern struct tar_stat_info current_stat_info;
|
||||||
|
|
||||||
|
/* Status of archive file, or all zeros if remote. */
|
||||||
|
extern struct stat archive_stat;
|
||||||
|
|
||||||
|
/* true if archive if lseek should be used on the archive, 0 if it
|
||||||
|
should not be used. */
|
||||||
|
extern bool seekable_archive;
|
||||||
|
|
||||||
extern FILE *stdlis;
|
extern FILE *stdlis;
|
||||||
extern bool write_archive_to_stdout;
|
extern bool write_archive_to_stdout;
|
||||||
extern char *volume_label;
|
extern char *volume_label;
|
||||||
@@ -460,6 +445,10 @@ extern char *continued_file_name;
|
|||||||
extern uintmax_t continued_file_size;
|
extern uintmax_t continued_file_size;
|
||||||
extern uintmax_t continued_file_offset;
|
extern uintmax_t continued_file_offset;
|
||||||
extern off_t records_written;
|
extern off_t records_written;
|
||||||
|
extern union block *record_start;
|
||||||
|
extern union block *record_end;
|
||||||
|
extern union block *current_block;
|
||||||
|
extern off_t records_read;
|
||||||
|
|
||||||
char *drop_volume_label_suffix (const char *label)
|
char *drop_volume_label_suffix (const char *label)
|
||||||
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
|
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
|
||||||
@@ -554,6 +543,8 @@ void verify_volume (void);
|
|||||||
|
|
||||||
/* Module extract.c. */
|
/* Module extract.c. */
|
||||||
|
|
||||||
|
extern dev_t root_device;
|
||||||
|
|
||||||
void extr_init (void);
|
void extr_init (void);
|
||||||
void extract_archive (void);
|
void extract_archive (void);
|
||||||
void extract_finish (void);
|
void extract_finish (void);
|
||||||
@@ -563,6 +554,9 @@ void remove_delayed_set_stat (const char *fname);
|
|||||||
|
|
||||||
/* Module delete.c. */
|
/* Module delete.c. */
|
||||||
|
|
||||||
|
/* number of records skipped at the start of the archive. */
|
||||||
|
extern off_t records_skipped;
|
||||||
|
|
||||||
void delete_archive_members (void);
|
void delete_archive_members (void);
|
||||||
|
|
||||||
/* Module incremen.c. */
|
/* Module incremen.c. */
|
||||||
@@ -612,6 +606,8 @@ enum read_header_mode
|
|||||||
};
|
};
|
||||||
extern union block *current_header;
|
extern union block *current_header;
|
||||||
extern enum archive_format current_format;
|
extern enum archive_format current_format;
|
||||||
|
extern union block *recent_long_name;
|
||||||
|
extern union block *recent_long_link;
|
||||||
extern size_t recent_long_name_blocks;
|
extern size_t recent_long_name_blocks;
|
||||||
extern size_t recent_long_link_blocks;
|
extern size_t recent_long_link_blocks;
|
||||||
|
|
||||||
@@ -768,6 +764,12 @@ enum files_count
|
|||||||
};
|
};
|
||||||
extern enum files_count filename_args;
|
extern enum files_count filename_args;
|
||||||
|
|
||||||
|
/* Declare only if argp.h has already been included,
|
||||||
|
as this declaration needs struct argp. */
|
||||||
|
#ifdef ARGP_ERR_UNKNOWN
|
||||||
|
extern struct argp names_argp;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Return true if there are file names in the list */
|
/* Return true if there are file names in the list */
|
||||||
COMMON_INLINE bool
|
COMMON_INLINE bool
|
||||||
name_more_files (void)
|
name_more_files (void)
|
||||||
@@ -873,6 +875,7 @@ void more_options (int argc, char **argv, struct option_locus *loc);
|
|||||||
|
|
||||||
/* Module update.c. */
|
/* Module update.c. */
|
||||||
|
|
||||||
|
extern bool time_to_start_writing;
|
||||||
extern char *output_start;
|
extern char *output_start;
|
||||||
|
|
||||||
void update_archive (void);
|
void update_archive (void);
|
||||||
@@ -914,6 +917,9 @@ void xattr_map_free (struct xattr_map *xattr_map);
|
|||||||
|
|
||||||
/* Module system.c */
|
/* Module system.c */
|
||||||
|
|
||||||
|
/* Nonzero when outputting to /dev/null. */
|
||||||
|
extern bool dev_null_output;
|
||||||
|
|
||||||
void sys_detect_dev_null_output (void);
|
void sys_detect_dev_null_output (void);
|
||||||
void sys_wait_for_child (pid_t, bool);
|
void sys_wait_for_child (pid_t, bool);
|
||||||
void sys_spawn_shell (void);
|
void sys_spawn_shell (void);
|
||||||
|
|||||||
10
src/delete.c
10
src/delete.c
@@ -26,18 +26,8 @@ static union block *new_record;
|
|||||||
static int new_blocks;
|
static int new_blocks;
|
||||||
static bool acting_as_filter;
|
static bool acting_as_filter;
|
||||||
|
|
||||||
/* FIXME: This module should not directly handle the following
|
|
||||||
variables, instead, the interface should be cleaned up. */
|
|
||||||
extern union block *record_start;
|
|
||||||
extern union block *record_end;
|
|
||||||
extern union block *current_block;
|
|
||||||
extern union block *recent_long_name;
|
|
||||||
extern union block *recent_long_link;
|
|
||||||
extern off_t records_read;
|
|
||||||
|
|
||||||
/* The number of records skipped at the start of the archive, when
|
/* The number of records skipped at the start of the archive, when
|
||||||
passing over members that are not deleted. */
|
passing over members that are not deleted. */
|
||||||
extern off_t records_skipped;
|
|
||||||
off_t records_skipped;
|
off_t records_skipped;
|
||||||
|
|
||||||
/* Move archive descriptor by COUNT records worth. If COUNT is
|
/* Move archive descriptor by COUNT records worth. If COUNT is
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
dev_t root_device;
|
||||||
|
|
||||||
static bool we_are_root; /* true if our effective uid == 0 */
|
static bool we_are_root; /* true if our effective uid == 0 */
|
||||||
static mode_t newdir_umask; /* umask when creating new directories */
|
static mode_t newdir_umask; /* umask when creating new directories */
|
||||||
static mode_t current_umask; /* current umask (which is set to 0 if -p) */
|
static mode_t current_umask; /* current umask (which is set to 0 if -p) */
|
||||||
|
|||||||
@@ -712,7 +712,7 @@ name_list_adjust (void)
|
|||||||
For simplicity, only a tail pointer of the list is maintained.
|
For simplicity, only a tail pointer of the list is maintained.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct name_elt *unconsumed_option_tail;
|
static struct name_elt *unconsumed_option_tail;
|
||||||
|
|
||||||
/* Push an option to the list */
|
/* Push an option to the list */
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <parse-datetime.h>
|
#include <parse-datetime.h>
|
||||||
|
|
||||||
|
bool dev_null_output;
|
||||||
|
|
||||||
static _Noreturn void
|
static _Noreturn void
|
||||||
xexec (const char *cmd)
|
xexec (const char *cmd)
|
||||||
{
|
{
|
||||||
@@ -166,8 +168,6 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern union block *record_start; /* FIXME */
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
sys_get_archive_stat (void)
|
sys_get_archive_stat (void)
|
||||||
{
|
{
|
||||||
|
|||||||
95
src/tar.c
95
src/tar.c
@@ -30,12 +30,94 @@
|
|||||||
# define SIGCHLD SIGCLD
|
# define SIGCHLD SIGCLD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The following causes "common.h" to produce definitions of all the global
|
|
||||||
variables, rather than just "extern" declarations of them. GNU tar does
|
|
||||||
depend on the system loader to preset all GLOBAL variables to neutral (or
|
|
||||||
zero) values; explicit initialization is usually not done. */
|
|
||||||
#define GLOBAL
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
/* Define variables declared in common.h that belong to tar.c. */
|
||||||
|
enum subcommand subcommand_option;
|
||||||
|
enum archive_format archive_format;
|
||||||
|
int blocking_factor;
|
||||||
|
size_t record_size;
|
||||||
|
bool absolute_names_option;
|
||||||
|
bool utc_option;
|
||||||
|
bool full_time_option;
|
||||||
|
int after_date_option;
|
||||||
|
enum atime_preserve atime_preserve_option;
|
||||||
|
bool backup_option;
|
||||||
|
enum backup_type backup_type;
|
||||||
|
bool block_number_option;
|
||||||
|
unsigned checkpoint_option;
|
||||||
|
const char *use_compress_program_option;
|
||||||
|
bool dereference_option;
|
||||||
|
bool hard_dereference_option;
|
||||||
|
struct exclude *excluded;
|
||||||
|
char const *group_name_option;
|
||||||
|
gid_t group_option;
|
||||||
|
bool ignore_failed_read_option;
|
||||||
|
bool ignore_zeros_option;
|
||||||
|
bool incremental_option;
|
||||||
|
const char *info_script_option;
|
||||||
|
bool interactive_option;
|
||||||
|
uintmax_t occurrence_option;
|
||||||
|
enum old_files old_files_option;
|
||||||
|
bool keep_directory_symlink_option;
|
||||||
|
const char *listed_incremental_option;
|
||||||
|
int incremental_level;
|
||||||
|
bool check_device_option;
|
||||||
|
struct mode_change *mode_option;
|
||||||
|
mode_t initial_umask;
|
||||||
|
bool multi_volume_option;
|
||||||
|
struct timespec newer_mtime_option;
|
||||||
|
enum set_mtime_option_mode set_mtime_option;
|
||||||
|
struct timespec mtime_option;
|
||||||
|
char *set_mtime_command;
|
||||||
|
char *set_mtime_format;
|
||||||
|
int recursion_option;
|
||||||
|
bool numeric_owner_option;
|
||||||
|
bool one_file_system_option;
|
||||||
|
bool one_top_level_option;
|
||||||
|
char *one_top_level_dir;
|
||||||
|
char const *owner_name_option;
|
||||||
|
uid_t owner_option;
|
||||||
|
bool recursive_unlink_option;
|
||||||
|
bool read_full_records_option;
|
||||||
|
bool remove_files_option;
|
||||||
|
const char *rsh_command_option;
|
||||||
|
bool same_order_option;
|
||||||
|
int same_owner_option;
|
||||||
|
int same_permissions_option;
|
||||||
|
int selinux_context_option;
|
||||||
|
int acls_option;
|
||||||
|
int xattrs_option;
|
||||||
|
size_t strip_name_components;
|
||||||
|
bool show_omitted_dirs_option;
|
||||||
|
bool sparse_option;
|
||||||
|
unsigned tar_sparse_major;
|
||||||
|
unsigned tar_sparse_minor;
|
||||||
|
enum hole_detection_method hole_detection;
|
||||||
|
bool starting_file_option;
|
||||||
|
tarlong tape_length_option;
|
||||||
|
bool to_stdout_option;
|
||||||
|
bool totals_option;
|
||||||
|
bool touch_option;
|
||||||
|
char *to_command_option;
|
||||||
|
bool ignore_command_error_option;
|
||||||
|
bool restrict_option;
|
||||||
|
int verbose_option;
|
||||||
|
bool verify_option;
|
||||||
|
const char *volno_file_option;
|
||||||
|
const char *volume_label_option;
|
||||||
|
bool posixly_correct;
|
||||||
|
const char **archive_name_array;
|
||||||
|
size_t archive_names;
|
||||||
|
const char **archive_name_cursor;
|
||||||
|
char const *index_file_name;
|
||||||
|
int open_read_flags;
|
||||||
|
int open_searchdir_flags;
|
||||||
|
int fstatat_flags;
|
||||||
|
int seek_option;
|
||||||
|
bool unquote_option;
|
||||||
|
int savedir_sort_order;
|
||||||
|
bool show_transformed_names_option;
|
||||||
|
bool delay_directory_restore_option;
|
||||||
|
|
||||||
#include <argmatch.h>
|
#include <argmatch.h>
|
||||||
#include <c-ctype.h>
|
#include <c-ctype.h>
|
||||||
@@ -92,8 +174,6 @@ request_stdin (const char *option)
|
|||||||
stdin_used_by = option;
|
stdin_used_by = option;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int rpmatch (char const *response);
|
|
||||||
|
|
||||||
/* Returns true if and only if the user typed an affirmative response. */
|
/* Returns true if and only if the user typed an affirmative response. */
|
||||||
int
|
int
|
||||||
confirm (const char *message_action, const char *message_name)
|
confirm (const char *message_action, const char *message_name)
|
||||||
@@ -2174,7 +2254,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern struct argp names_argp;
|
|
||||||
static struct argp_child argp_children[] = {
|
static struct argp_child argp_children[] = {
|
||||||
{ &names_argp, 0, NULL, GRID_FILE_NAME },
|
{ &names_argp, 0, NULL, GRID_FILE_NAME },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
|
|||||||
@@ -26,10 +26,6 @@
|
|||||||
#include <quotearg.h>
|
#include <quotearg.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
/* FIXME: This module should not directly handle the following variable,
|
|
||||||
instead, this should be done in buffer.c only. */
|
|
||||||
extern union block *current_block;
|
|
||||||
|
|
||||||
/* We've hit the end of the old stuff, and its time to start writing new
|
/* We've hit the end of the old stuff, and its time to start writing new
|
||||||
stuff to the tape. This involves seeking back one record and
|
stuff to the tape. This involves seeking back one record and
|
||||||
re-writing the current record (which has been changed).
|
re-writing the current record (which has been changed).
|
||||||
|
|||||||
Reference in New Issue
Block a user