diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-06 10:53:17 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-06 10:53:17 +0100 |
| commit | aa4977d8e549d9fff2b2946f03d304e435eb20f1 (patch) | |
| tree | bc7c7fe4ab64263a9f8356762cb8f7e77165de73 /include | |
| parent | 86350f8d5f5d5a1006cffe0bedccd625f012702f (diff) | |
| download | busybox-w32-aa4977d8e549d9fff2b2946f03d304e435eb20f1.tar.gz busybox-w32-aa4977d8e549d9fff2b2946f03d304e435eb20f1.tar.bz2 busybox-w32-aa4977d8e549d9fff2b2946f03d304e435eb20f1.zip | |
libunarchive: clean up dirty hacks. code shrank as a result
function old new delta
cpio_main 526 539 +13
init_handle 57 58 +1
init_archive_deb_ar 34 35 +1
get_header_ar 408 409 +1
dpkg_main 3900 3901 +1
unpack_package 516 515 -1
rpm_main 1673 1672 -1
tar_main 774 767 -7
get_header_cpio 990 972 -18
data_extract_all 750 727 -23
get_header_tar 1631 1576 -55
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/6 up/down: 17/-105) Total: -88 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/unarchive.h | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/include/unarchive.h b/include/unarchive.h index 68e83f01c..e3afb8af9 100644 --- a/include/unarchive.h +++ b/include/unarchive.h | |||
| @@ -8,8 +8,8 @@ typedef struct file_header_t { | |||
| 8 | char *name; | 8 | char *name; |
| 9 | char *link_target; | 9 | char *link_target; |
| 10 | #if ENABLE_FEATURE_TAR_UNAME_GNAME | 10 | #if ENABLE_FEATURE_TAR_UNAME_GNAME |
| 11 | char *uname; | 11 | char *tar__uname; |
| 12 | char *gname; | 12 | char *tar__gname; |
| 13 | #endif | 13 | #endif |
| 14 | off_t size; | 14 | off_t size; |
| 15 | uid_t uid; | 15 | uid_t uid; |
| @@ -19,16 +19,25 @@ typedef struct file_header_t { | |||
| 19 | dev_t device; | 19 | dev_t device; |
| 20 | } file_header_t; | 20 | } file_header_t; |
| 21 | 21 | ||
| 22 | struct hardlinks_t; | ||
| 23 | |||
| 22 | typedef struct archive_handle_t { | 24 | typedef struct archive_handle_t { |
| 25 | /* Flags. 1st since it is most used member */ | ||
| 26 | unsigned ah_flags; | ||
| 27 | |||
| 28 | /* The raw stream as read from disk or stdin */ | ||
| 29 | int src_fd; | ||
| 30 | |||
| 23 | /* Define if the header and data component should be processed */ | 31 | /* Define if the header and data component should be processed */ |
| 24 | char FAST_FUNC (*filter)(struct archive_handle_t *); | 32 | char FAST_FUNC (*filter)(struct archive_handle_t *); |
| 33 | /* List of files that have been accepted */ | ||
| 25 | llist_t *accept; | 34 | llist_t *accept; |
| 26 | /* List of files that have been rejected */ | 35 | /* List of files that have been rejected */ |
| 27 | llist_t *reject; | 36 | llist_t *reject; |
| 28 | /* List of files that have successfully been worked on */ | 37 | /* List of files that have successfully been worked on */ |
| 29 | llist_t *passed; | 38 | llist_t *passed; |
| 30 | 39 | ||
| 31 | /* Contains the processed header entry */ | 40 | /* Currently processed file's header */ |
| 32 | file_header_t *file_header; | 41 | file_header_t *file_header; |
| 33 | 42 | ||
| 34 | /* Process the header component, e.g. tar -t */ | 43 | /* Process the header component, e.g. tar -t */ |
| @@ -37,33 +46,33 @@ typedef struct archive_handle_t { | |||
| 37 | /* Process the data component, e.g. extract to filesystem */ | 46 | /* Process the data component, e.g. extract to filesystem */ |
| 38 | void FAST_FUNC (*action_data)(struct archive_handle_t *); | 47 | void FAST_FUNC (*action_data)(struct archive_handle_t *); |
| 39 | 48 | ||
| 40 | #if ENABLE_DPKG || ENABLE_DPKG_DEB | ||
| 41 | /* "subarchive" is used only by dpkg[-deb] applets */ | ||
| 42 | /* How to process any sub archive, e.g. get_header_tar_gz */ | ||
| 43 | char FAST_FUNC (*action_data_subarchive)(struct archive_handle_t *); | ||
| 44 | /* Contains the handle to a sub archive */ | ||
| 45 | struct archive_handle_t *sub_archive; | ||
| 46 | #endif | ||
| 47 | |||
| 48 | /* The raw stream as read from disk or stdin */ | ||
| 49 | int src_fd; | ||
| 50 | |||
| 51 | /* Count the number of bytes processed */ | ||
| 52 | off_t offset; | ||
| 53 | |||
| 54 | /* Function that skips data */ | 49 | /* Function that skips data */ |
| 55 | void FAST_FUNC (*seek)(int fd, off_t amount); | 50 | void FAST_FUNC (*seek)(int fd, off_t amount); |
| 56 | 51 | ||
| 57 | /* Temporary storage */ | 52 | /* Count processed bytes */ |
| 58 | char *ah_buffer; | 53 | off_t offset; |
| 59 | |||
| 60 | /* Flags and misc. stuff */ | ||
| 61 | unsigned ah_flags; | ||
| 62 | |||
| 63 | /* "Private" storage for archivers */ | ||
| 64 | // unsigned char ah_priv_inited; | ||
| 65 | void *ah_priv[8]; | ||
| 66 | 54 | ||
| 55 | /* Archiver specific. Can make it a union if it ever gets big */ | ||
| 56 | #if ENABLE_TAR | ||
| 57 | smallint tar__end; | ||
| 58 | # if ENABLE_FEATURE_TAR_GNU_EXTENSIONS | ||
| 59 | char* tar__longname; | ||
| 60 | char* tar__linkname; | ||
| 61 | # endif | ||
| 62 | #endif | ||
| 63 | #if ENABLE_CPIO | ||
| 64 | uoff_t cpio__blocks; | ||
| 65 | struct hardlinks_t *cpio__hardlinks_to_create; | ||
| 66 | struct hardlinks_t *cpio__created_hardlinks; | ||
| 67 | #endif | ||
| 68 | #if ENABLE_DPKG || ENABLE_DPKG_DEB | ||
| 69 | /* Temporary storage */ | ||
| 70 | char *dpkg__buffer; | ||
| 71 | /* How to process any sub archive, e.g. get_header_tar_gz */ | ||
| 72 | char FAST_FUNC (*dpkg__action_data_subarchive)(struct archive_handle_t *); | ||
| 73 | /* Contains the handle to a sub archive */ | ||
| 74 | struct archive_handle_t *dpkg__sub_archive; | ||
| 75 | #endif | ||
| 67 | } archive_handle_t; | 76 | } archive_handle_t; |
| 68 | /* bits in ah_flags */ | 77 | /* bits in ah_flags */ |
| 69 | #define ARCHIVE_RESTORE_DATE (1 << 0) | 78 | #define ARCHIVE_RESTORE_DATE (1 << 0) |
