1.\" Copyright (c) 2003-2011 Tim Kientzle 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $FreeBSD$ 26.\" 27.Dd February 2, 2012 28.Dt ARCHIVE_WRITE_BLOCKSIZE 3 29.Os 30.Sh NAME 31.Nm archive_write_get_bytes_per_block , 32.Nm archive_write_set_bytes_per_block , 33.Nm archive_write_get_bytes_in_last_block , 34.Nm archive_write_set_bytes_in_last_block 35.Nd functions for creating archives 36.Sh LIBRARY 37Streaming Archive Library (libarchive, -larchive) 38.Sh SYNOPSIS 39.In archive.h 40.Ft int 41.Fn archive_write_get_bytes_per_block "struct archive *" 42.Ft int 43.Fn archive_write_set_bytes_per_block "struct archive *" "int bytes_per_block" 44.Ft int 45.Fn archive_write_get_bytes_in_last_block "struct archive *" 46.Ft int 47.Fn archive_write_set_bytes_in_last_block "struct archive *" "int" 48.Sh DESCRIPTION 49.Bl -tag -width indent 50.It Fn archive_write_set_bytes_per_block 51Sets the block size used for writing the archive data. 52Every call to the write callback function, except possibly the last one, will 53use this value for the length. 54The default is to use a block size of 10240 bytes. 55Note that a block size of zero will suppress internal blocking 56and cause writes to be sent directly to the write callback as they occur. 57.It Fn archive_write_get_bytes_per_block 58Retrieve the block size to be used for writing. 59A value of -1 here indicates that the library should use default values. 60A value of zero indicates that internal blocking is suppressed. 61.It Fn archive_write_set_bytes_in_last_block 62Sets the block size used for writing the last block. 63If this value is zero, the last block will be padded to the same size 64as the other blocks. 65Otherwise, the final block will be padded to a multiple of this size. 66In particular, setting it to 1 will cause the final block to not be padded. 67For compressed output, any padding generated by this option 68is applied only after the compression. 69The uncompressed data is always unpadded. 70The default is to pad the last block to the full block size (note that 71.Fn archive_write_open_filename 72will set this based on the file type). 73Unlike the other 74.Dq set 75functions, this function can be called after the archive is opened. 76.It Fn archive_write_get_bytes_in_last_block 77Retrieve the currently-set value for last block size. 78A value of -1 here indicates that the library should use default values. 79.El 80.\" .Sh EXAMPLE 81.Sh RETURN VALUES 82.Fn archive_write_set_bytes_per_block 83and 84.Fn archive_write_set_bytes_in_last_block 85return 86.Cm ARCHIVE_OK 87on success, or 88.Cm ARCHIVE_FATAL . 89.Pp 90.Fn archive_write_get_bytes_per_block 91and 92.Fn archive_write_get_bytes_in_last_block 93return currently configured block size 94.Po 95.Li -1 96indicates the default block size 97.Pc , 98or 99.Cm ARCHIVE_FATAL . 100.\" 101.Sh ERRORS 102Detailed error codes and textual descriptions are available from the 103.Fn archive_errno 104and 105.Fn archive_error_string 106functions. 107.\" 108.Sh SEE ALSO 109.Xr tar 1 , 110.Xr libarchive 3 , 111.Xr archive_write_set_options 3 , 112.Xr cpio 5 , 113.Xr mtree 5 , 114.Xr tar 5 115