mkpaqfs(8): allow setting compression level
This commit is contained in:
parent
33682347b9
commit
d168b89ab1
2 changed files with 15 additions and 2 deletions
|
@ -6,6 +6,8 @@ mkpaqfs \- make a compressed read-only file system
|
||||||
[
|
[
|
||||||
.B -u
|
.B -u
|
||||||
] [
|
] [
|
||||||
|
.B -1-9
|
||||||
|
] [
|
||||||
.B -b
|
.B -b
|
||||||
.I blocksize
|
.I blocksize
|
||||||
] [
|
] [
|
||||||
|
@ -42,6 +44,12 @@ option is set, the blocks are not compressed.
|
||||||
Otherwise each block is compressed using the
|
Otherwise each block is compressed using the
|
||||||
.IR flate (2)
|
.IR flate (2)
|
||||||
compression algorithm.
|
compression algorithm.
|
||||||
|
The compression level can be set using the flags
|
||||||
|
.B -1
|
||||||
|
to
|
||||||
|
.B -9
|
||||||
|
(defaults to
|
||||||
|
.BR -6 ).
|
||||||
The
|
The
|
||||||
.B -l
|
.B -l
|
||||||
option embeds a label of up to 32 bytes within the file header and may be
|
option embeds a label of up to 32 bytes within the file header and may be
|
||||||
|
|
|
@ -33,6 +33,7 @@ void warn(char *fmt, ...);
|
||||||
|
|
||||||
int uflag=0; /* uncompressed */
|
int uflag=0; /* uncompressed */
|
||||||
long blocksize = 4*1024;
|
long blocksize = 4*1024;
|
||||||
|
int level = 6;
|
||||||
|
|
||||||
Biobuf *out;
|
Biobuf *out;
|
||||||
DigestState *outdg;
|
DigestState *outdg;
|
||||||
|
@ -57,6 +58,10 @@ main(int argc, char *argv[])
|
||||||
if(label == nil)
|
if(label == nil)
|
||||||
usage();
|
usage();
|
||||||
break;
|
break;
|
||||||
|
case '1': case '2': case '3': case '4':
|
||||||
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
level = ARGC() - '0';
|
||||||
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
s = ARGF();
|
s = ARGF();
|
||||||
if(s) {
|
if(s) {
|
||||||
|
@ -105,7 +110,7 @@ main(int argc, char *argv[])
|
||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "usage: %s [-u] [-b blocksize] -o output [root]\n", argv0);
|
fprint(2, "usage: %s [-u] [-1-9] [-b blocksize] -o output [root]\n", argv0);
|
||||||
exits("usage");
|
exits("usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +375,7 @@ writeBlock(uchar *b, int type)
|
||||||
|
|
||||||
if(!uflag) {
|
if(!uflag) {
|
||||||
cb = emallocz(blocksize);
|
cb = emallocz(blocksize);
|
||||||
n = deflateblock(cb, blocksize, b, blocksize, 6, 0);
|
n = deflateblock(cb, blocksize, b, blocksize, level, 0);
|
||||||
if(n > 0 && n < blocksize) {
|
if(n > 0 && n < blocksize) {
|
||||||
bh.encoding = DeflateEnc;
|
bh.encoding = DeflateEnc;
|
||||||
bh.size = n;
|
bh.size = n;
|
||||||
|
|
Loading…
Reference in a new issue