1caf54c4fSMartin Matuska /*- 2caf54c4fSMartin Matuska * Copyright (c) 2003-2009 Tim Kientzle 3caf54c4fSMartin Matuska * All rights reserved. 4caf54c4fSMartin Matuska * 5caf54c4fSMartin Matuska * Redistribution and use in source and binary forms, with or without 6caf54c4fSMartin Matuska * modification, are permitted provided that the following conditions 7caf54c4fSMartin Matuska * are met: 8caf54c4fSMartin Matuska * 1. Redistributions of source code must retain the above copyright 9caf54c4fSMartin Matuska * notice, this list of conditions and the following disclaimer 10caf54c4fSMartin Matuska * in this position and unchanged. 11caf54c4fSMartin Matuska * 2. Redistributions in binary form must reproduce the above copyright 12caf54c4fSMartin Matuska * notice, this list of conditions and the following disclaimer in the 13caf54c4fSMartin Matuska * documentation and/or other materials provided with the distribution. 14caf54c4fSMartin Matuska * 15caf54c4fSMartin Matuska * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16caf54c4fSMartin Matuska * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17caf54c4fSMartin Matuska * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18caf54c4fSMartin Matuska * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19caf54c4fSMartin Matuska * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20caf54c4fSMartin Matuska * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21caf54c4fSMartin Matuska * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22caf54c4fSMartin Matuska * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23caf54c4fSMartin Matuska * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24caf54c4fSMartin Matuska * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25caf54c4fSMartin Matuska */ 26caf54c4fSMartin Matuska 27f9762417SMartin Matuska #ifndef ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED 28f9762417SMartin Matuska #define ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED 29f9762417SMartin Matuska 30caf54c4fSMartin Matuska #ifndef __LIBARCHIVE_BUILD 31caf54c4fSMartin Matuska #error This header is only to be used internally to libarchive. 32caf54c4fSMartin Matuska #endif 33caf54c4fSMartin Matuska 344657548dSMartin Matuska #include "archive_platform_acl.h" 354657548dSMartin Matuska 366c95142eSMartin Matuska struct tree; 37fd082e96SMartin Matuska struct archive_entry; 386c95142eSMartin Matuska 39caf54c4fSMartin Matuska struct archive_read_disk { 40caf54c4fSMartin Matuska struct archive archive; 41caf54c4fSMartin Matuska 42cdf63a70SMartin Matuska /* Reused by archive_read_next_header() */ 43cdf63a70SMartin Matuska struct archive_entry *entry; 44cdf63a70SMartin Matuska 45caf54c4fSMartin Matuska /* 46caf54c4fSMartin Matuska * Symlink mode is one of 'L'ogical, 'P'hysical, or 'H'ybrid, 47caf54c4fSMartin Matuska * following an old BSD convention. 'L' follows all symlinks, 48caf54c4fSMartin Matuska * 'P' follows none, 'H' follows symlinks only for the first 49caf54c4fSMartin Matuska * item. 50caf54c4fSMartin Matuska */ 51caf54c4fSMartin Matuska char symlink_mode; 52caf54c4fSMartin Matuska 53caf54c4fSMartin Matuska /* 54caf54c4fSMartin Matuska * Since symlink interaction changes, we need to track whether 55caf54c4fSMartin Matuska * we're following symlinks for the current item. 'L' mode above 56caf54c4fSMartin Matuska * sets this true, 'P' sets it false, 'H' changes it as we traverse. 57caf54c4fSMartin Matuska */ 58caf54c4fSMartin Matuska char follow_symlinks; /* Either 'L' or 'P'. */ 59caf54c4fSMartin Matuska 606c95142eSMartin Matuska /* Directory traversals. */ 616c95142eSMartin Matuska struct tree *tree; 62fd082e96SMartin Matuska int (*open_on_current_dir)(struct tree*, const char *, int); 63fd082e96SMartin Matuska int (*tree_current_dir_fd)(struct tree*); 64fd082e96SMartin Matuska int (*tree_enter_working_dir)(struct tree*); 656c95142eSMartin Matuska 6664287048SMartin Matuska /* Bitfield with ARCHIVE_READDISK_* tunables */ 6764287048SMartin Matuska int flags; 686c95142eSMartin Matuska 696c95142eSMartin Matuska const char * (*lookup_gname)(void *private, int64_t gid); 70caf54c4fSMartin Matuska void (*cleanup_gname)(void *private); 71caf54c4fSMartin Matuska void *lookup_gname_data; 726c95142eSMartin Matuska const char * (*lookup_uname)(void *private, int64_t uid); 73caf54c4fSMartin Matuska void (*cleanup_uname)(void *private); 74caf54c4fSMartin Matuska void *lookup_uname_data; 75fd082e96SMartin Matuska 76fd082e96SMartin Matuska int (*metadata_filter_func)(struct archive *, void *, 77fd082e96SMartin Matuska struct archive_entry *); 78fd082e96SMartin Matuska void *metadata_filter_data; 79fd082e96SMartin Matuska 80fd082e96SMartin Matuska /* ARCHIVE_MATCH object. */ 81fd082e96SMartin Matuska struct archive *matching; 82fd082e96SMartin Matuska /* Callback function, this will be invoked when ARCHIVE_MATCH 83fd082e96SMartin Matuska * archive_match_*_excluded_ae return true. */ 84fd082e96SMartin Matuska void (*excluded_cb_func)(struct archive *, void *, 85fd082e96SMartin Matuska struct archive_entry *); 86fd082e96SMartin Matuska void *excluded_cb_data; 87caf54c4fSMartin Matuska }; 88caf54c4fSMartin Matuska 894657548dSMartin Matuska const char * 904657548dSMartin Matuska archive_read_disk_entry_setup_path(struct archive_read_disk *, 914657548dSMartin Matuska struct archive_entry *, int *); 924657548dSMartin Matuska 934657548dSMartin Matuska int 944657548dSMartin Matuska archive_read_disk_entry_setup_acls(struct archive_read_disk *, 954657548dSMartin Matuska struct archive_entry *, int *); 96caf54c4fSMartin Matuska #endif 97