summaryrefslogtreecommitdiffstats
path: root/tarlz.h
diff options
context:
space:
mode:
Diffstat (limited to 'tarlz.h')
-rw-r--r--tarlz.h49
1 files changed, 10 insertions, 39 deletions
diff --git a/tarlz.h b/tarlz.h
index 6baa1d8..18a078d 100644
--- a/tarlz.h
+++ b/tarlz.h
@@ -62,7 +62,7 @@ inline unsigned long long round_up( const unsigned long long size )
}
-enum { initial_line_length = 1000 }; // must be >= 77 for 'mode user/group'
+enum { initial_line_length = 1000 }; // must be >= 87 for format_member_name
class Resizable_buffer
{
@@ -309,7 +309,7 @@ bool block_is_full( const Extended & extended,
const unsigned long long file_size,
unsigned long long & partial_data_size );
void set_error_status( const int retval );
-int final_exit_status( int retval );
+int final_exit_status( int retval, const bool show_msg = true );
unsigned ustar_chksum( const uint8_t * const header );
bool verify_ustar_chksum( const uint8_t * const header );
class Arg_parser;
@@ -325,6 +325,8 @@ int encode_lz( const char * const archive_name, const Arg_parser & parser,
const int num_workers, const int outfd, const int debug_level );
// defined in extract.cc
+enum Program_mode { m_none, m_append, m_concatenate, m_create, m_diff,
+ m_extract, m_list };
bool block_is_zero( const uint8_t * const buf, const int size );
void format_member_name( const Extended & extended, const Tar_header header,
Resizable_buffer & rbuf, const bool long_format );
@@ -335,7 +337,8 @@ int writeblock( const int fd, const uint8_t * const buf, const int size );
unsigned long long parse_octal( const uint8_t * const ptr, const int size );
int decode( const std::string & archive_name, const Arg_parser & parser,
const int filenames, const int num_workers, const int debug_level,
- const bool keep_damaged, const bool listing, const bool missing_crc,
+ const Program_mode program_mode, const bool ignore_ids,
+ const bool keep_damaged, const bool missing_crc,
const bool permissive );
// defined in list_lz.cc
@@ -354,6 +357,10 @@ int list_lz( const Arg_parser & parser, std::vector< char > & name_pending,
const int debug_level, const int infd, const int num_workers,
const bool missing_crc, const bool permissive );
+// defined in lzip_index.cc
+int seek_read( const int fd, uint8_t * const buf, const int size,
+ const long long pos );
+
// defined in main.cc
extern int verbosity;
int open_instream( const std::string & name );
@@ -364,39 +371,3 @@ void show_error( const char * const msg, const int errcode = 0,
void show_file_error( const char * const filename, const char * const msg,
const int errcode = 0 );
void internal_error( const char * const msg );
-
-
-class Slot_tally
- {
- const int num_slots; // total slots
- int num_free; // remaining free slots
- pthread_mutex_t mutex;
- pthread_cond_t slot_av; // slot available
-
- Slot_tally( const Slot_tally & ); // declared as private
- void operator=( const Slot_tally & ); // declared as private
-
-public:
- explicit Slot_tally( const int slots )
- : num_slots( slots ), num_free( slots )
- { xinit_mutex( &mutex ); xinit_cond( &slot_av ); }
-
- ~Slot_tally() { xdestroy_cond( &slot_av ); xdestroy_mutex( &mutex ); }
-
- bool all_free() { return ( num_free == num_slots ); }
-
- void get_slot() // wait for a free slot
- {
- xlock( &mutex );
- while( num_free <= 0 ) xwait( &slot_av, &mutex );
- --num_free;
- xunlock( &mutex );
- }
-
- void leave_slot() // return a slot to the tally
- {
- xlock( &mutex );
- if( ++num_free == 1 ) xsignal( &slot_av ); // num_free was 0
- xunlock( &mutex );
- }
- };