archive_write_blocksize.3 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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
  37. Streaming 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
  51. Sets the block size used for writing the archive data.
  52. Every call to the write callback function, except possibly the last one, will
  53. use this value for the length.
  54. The default is to use a block size of 10240 bytes.
  55. Note that a block size of zero will suppress internal blocking
  56. and cause writes to be sent directly to the write callback as they occur.
  57. .It Fn archive_write_get_bytes_per_block
  58. Retrieve the block size to be used for writing.
  59. A value of -1 here indicates that the library should use default values.
  60. A value of zero indicates that internal blocking is suppressed.
  61. .It Fn archive_write_set_bytes_in_last_block
  62. Sets the block size used for writing the last block.
  63. If this value is zero, the last block will be padded to the same size
  64. as the other blocks.
  65. Otherwise, the final block will be padded to a multiple of this size.
  66. In particular, setting it to 1 will cause the final block to not be padded.
  67. For compressed output, any padding generated by this option
  68. is applied only after the compression.
  69. The uncompressed data is always unpadded.
  70. The default is to pad the last block to the full block size (note that
  71. .Fn archive_write_open_filename
  72. will set this based on the file type).
  73. Unlike the other
  74. .Dq set
  75. functions, this function can be called after the archive is opened.
  76. .It Fn archive_write_get_bytes_in_last_block
  77. Retrieve the currently-set value for last block size.
  78. A 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
  83. and
  84. .Fn archive_write_set_bytes_in_last_block
  85. return
  86. .Cm ARCHIVE_OK
  87. on success, or
  88. .Cm ARCHIVE_FATAL .
  89. .Pp
  90. .Fn archive_write_get_bytes_per_block
  91. and
  92. .Fn archive_write_get_bytes_in_last_block
  93. return currently configured block size
  94. .Po
  95. .Li -1
  96. indicates the default block size
  97. .Pc ,
  98. or
  99. .Cm ARCHIVE_FATAL .
  100. .\"
  101. .Sh ERRORS
  102. Detailed error codes and textual descriptions are available from the
  103. .Fn archive_errno
  104. and
  105. .Fn archive_error_string
  106. functions.
  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