18029ab02SPeter Avalos /*-
28029ab02SPeter Avalos  * Copyright (c) 2003-2009 Tim Kientzle
38029ab02SPeter Avalos  * All rights reserved.
48029ab02SPeter Avalos  *
58029ab02SPeter Avalos  * Redistribution and use in source and binary forms, with or without
68029ab02SPeter Avalos  * modification, are permitted provided that the following conditions
78029ab02SPeter Avalos  * are met:
88029ab02SPeter Avalos  * 1. Redistributions of source code must retain the above copyright
98029ab02SPeter Avalos  *    notice, this list of conditions and the following disclaimer
108029ab02SPeter Avalos  *    in this position and unchanged.
118029ab02SPeter Avalos  * 2. Redistributions in binary form must reproduce the above copyright
128029ab02SPeter Avalos  *    notice, this list of conditions and the following disclaimer in the
138029ab02SPeter Avalos  *    documentation and/or other materials provided with the distribution.
148029ab02SPeter Avalos  *
158029ab02SPeter Avalos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
168029ab02SPeter Avalos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
178029ab02SPeter Avalos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
188029ab02SPeter Avalos  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
198029ab02SPeter Avalos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
208029ab02SPeter Avalos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
218029ab02SPeter Avalos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
228029ab02SPeter Avalos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
238029ab02SPeter Avalos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
248029ab02SPeter Avalos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
258029ab02SPeter Avalos  *
269c82a63eSPeter Avalos  * $FreeBSD: head/lib/libarchive/archive_read_disk_private.h 201105 2009-12-28 03:20:54Z kientzle $
278029ab02SPeter Avalos  */
288029ab02SPeter Avalos 
29085658deSDaniel Fojt #ifndef ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
30085658deSDaniel Fojt #define ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
31085658deSDaniel Fojt 
329c82a63eSPeter Avalos #ifndef __LIBARCHIVE_BUILD
339c82a63eSPeter Avalos #error This header is only to be used internally to libarchive.
349c82a63eSPeter Avalos #endif
359c82a63eSPeter Avalos 
36e95abc47Szrj #include "archive_platform_acl.h"
37e95abc47Szrj 
38c09f92d2SPeter Avalos struct tree;
3959bf7050SPeter Avalos struct archive_entry;
40c09f92d2SPeter Avalos 
418029ab02SPeter Avalos struct archive_read_disk {
428029ab02SPeter Avalos 	struct archive	archive;
438029ab02SPeter Avalos 
446b384f39SPeter Avalos 	/* Reused by archive_read_next_header() */
456b384f39SPeter Avalos 	struct archive_entry *entry;
466b384f39SPeter Avalos 
478029ab02SPeter Avalos 	/*
488029ab02SPeter Avalos 	 * Symlink mode is one of 'L'ogical, 'P'hysical, or 'H'ybrid,
498029ab02SPeter Avalos 	 * following an old BSD convention.  'L' follows all symlinks,
508029ab02SPeter Avalos 	 * 'P' follows none, 'H' follows symlinks only for the first
518029ab02SPeter Avalos 	 * item.
528029ab02SPeter Avalos 	 */
538029ab02SPeter Avalos 	char	symlink_mode;
548029ab02SPeter Avalos 
558029ab02SPeter Avalos 	/*
568029ab02SPeter Avalos 	 * Since symlink interaction changes, we need to track whether
578029ab02SPeter Avalos 	 * we're following symlinks for the current item.  'L' mode above
588029ab02SPeter Avalos 	 * sets this true, 'P' sets it false, 'H' changes it as we traverse.
598029ab02SPeter Avalos 	 */
608029ab02SPeter Avalos 	char	follow_symlinks;  /* Either 'L' or 'P'. */
618029ab02SPeter Avalos 
62c09f92d2SPeter Avalos 	/* Directory traversals. */
63c09f92d2SPeter Avalos 	struct tree *tree;
6459bf7050SPeter Avalos 	int	(*open_on_current_dir)(struct tree*, const char *, int);
6559bf7050SPeter Avalos 	int	(*tree_current_dir_fd)(struct tree*);
6659bf7050SPeter Avalos 	int	(*tree_enter_working_dir)(struct tree*);
67c09f92d2SPeter Avalos 
68e95abc47Szrj 	/* Bitfield with ARCHIVE_READDISK_* tunables */
69e95abc47Szrj 	int	flags;
70c09f92d2SPeter Avalos 
71c09f92d2SPeter Avalos 	const char * (*lookup_gname)(void *private, int64_t gid);
728029ab02SPeter Avalos 	void	(*cleanup_gname)(void *private);
738029ab02SPeter Avalos 	void	 *lookup_gname_data;
74c09f92d2SPeter Avalos 	const char * (*lookup_uname)(void *private, int64_t uid);
758029ab02SPeter Avalos 	void	(*cleanup_uname)(void *private);
768029ab02SPeter Avalos 	void	 *lookup_uname_data;
7759bf7050SPeter Avalos 
7859bf7050SPeter Avalos 	int	(*metadata_filter_func)(struct archive *, void *,
7959bf7050SPeter Avalos 			struct archive_entry *);
8059bf7050SPeter Avalos 	void	*metadata_filter_data;
8159bf7050SPeter Avalos 
8259bf7050SPeter Avalos 	/* ARCHIVE_MATCH object. */
8359bf7050SPeter Avalos 	struct archive	*matching;
8459bf7050SPeter Avalos 	/* Callback function, this will be invoked when ARCHIVE_MATCH
8559bf7050SPeter Avalos 	 * archive_match_*_excluded_ae return true. */
8659bf7050SPeter Avalos 	void	(*excluded_cb_func)(struct archive *, void *,
8759bf7050SPeter Avalos 			 struct archive_entry *);
8859bf7050SPeter Avalos 	void	*excluded_cb_data;
898029ab02SPeter Avalos };
908029ab02SPeter Avalos 
91e95abc47Szrj const char *
92e95abc47Szrj archive_read_disk_entry_setup_path(struct archive_read_disk *,
93e95abc47Szrj     struct archive_entry *, int *);
94e95abc47Szrj 
95e95abc47Szrj int
96e95abc47Szrj archive_read_disk_entry_setup_acls(struct archive_read_disk *,
97e95abc47Szrj     struct archive_entry *, int *);
988029ab02SPeter Avalos #endif
99