MFC r1.27:
[dragonfly.git] / contrib / libarchive-2 / libarchive / archive_write_private.h
blob55c24ad96cade9857796d02041e4e29ce875a0b3
1 /*-
2 * Copyright (c) 2003-2007 Tim Kientzle
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * $FreeBSD: src/lib/libarchive/archive_write_private.h,v 1.3 2008/03/15 11:04:45 kientzle Exp $
28 #ifndef ARCHIVE_WRITE_PRIVATE_H_INCLUDED
29 #define ARCHIVE_WRITE_PRIVATE_H_INCLUDED
31 #include "archive.h"
32 #include "archive_string.h"
33 #include "archive_private.h"
35 struct archive_write {
36 struct archive archive;
38 /* Dev/ino of the archive being written. */
39 dev_t skip_file_dev;
40 ino_t skip_file_ino;
42 /* Utility: Pointer to a block of nulls. */
43 const unsigned char *nulls;
44 size_t null_length;
46 /* Callbacks to open/read/write/close archive stream. */
47 archive_open_callback *client_opener;
48 archive_write_callback *client_writer;
49 archive_close_callback *client_closer;
50 void *client_data;
53 * Blocking information. Note that bytes_in_last_block is
54 * misleadingly named; I should find a better name. These
55 * control the final output from all compressors, including
56 * compression_none.
58 int bytes_per_block;
59 int bytes_in_last_block;
62 * These control whether data within a gzip/bzip2 compressed
63 * stream gets padded or not. If pad_uncompressed is set,
64 * the data will be padded to a full block before being
65 * compressed. The pad_uncompressed_byte determines the value
66 * that will be used for padding. Note that these have no
67 * effect on compression "none."
69 int pad_uncompressed;
70 int pad_uncompressed_byte; /* TODO: Support this. */
73 * On write, the client just invokes an archive_write_set function
74 * which sets up the data here directly.
76 struct {
77 void *data;
78 void *config;
79 int (*init)(struct archive_write *);
80 int (*finish)(struct archive_write *);
81 int (*write)(struct archive_write *, const void *, size_t);
82 } compressor;
85 * Pointers to format-specific functions for writing. They're
86 * initialized by archive_write_set_format_XXX() calls.
88 void *format_data;
89 int (*format_init)(struct archive_write *);
90 int (*format_finish)(struct archive_write *);
91 int (*format_destroy)(struct archive_write *);
92 int (*format_finish_entry)(struct archive_write *);
93 int (*format_write_header)(struct archive_write *,
94 struct archive_entry *);
95 ssize_t (*format_write_data)(struct archive_write *,
96 const void *buff, size_t);
100 * Utility function to format a USTAR header into a buffer. If
101 * "strict" is set, this tries to create the absolutely most portable
102 * version of a ustar header. If "strict" is set to 0, then it will
103 * relax certain requirements.
105 * Generally, format-specific declarations don't belong in this
106 * header; this is a rare example of a function that is shared by
107 * two very similar formats (ustar and pax).
110 __archive_write_format_header_ustar(struct archive_write *, char buff[512],
111 struct archive_entry *, int tartype, int strict);
113 #endif