/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Decompression module for stand alone file systems.
*/
#include <sys/sysmacros.h>
#ifdef _BOOT
#else
#endif
extern void prom_printf(const char *fmt, ...);
#ifdef _BOOT
#else
#endif
extern int bootrd_debug;
extern void *bkmem_alloc(size_t);
extern void bkmem_free(void *, size_t);
void *
{
unsigned int nbytes;
} else {
}
return (ptr);
}
/*
* Decompression scratch memory free routine, does nothing since we free
* the entire scratch area all at once on file close.
*/
/* ARGSUSED */
void
{
}
/*
* Read the first block of the file described by filep and determine if
* the file is gzip-compressed. If so, the compressed flag will be set
* in the fileid_t struct pointed to by filep and it will be initialized
* for doing decompression on reads to the file.
*/
int
{
unsigned char *filebytes;
/*
* checking for a dcfs compressed file first would involve:
*
* if (filep->fi_inode->i_cflags & ICOMPRESS)
* filep->fi_flags |= FI_COMPRESSED;
*/
/*
* If the file is not long enough to check for a
* decompression header then return not compressed.
*/
return (0);
return (-1);
if (filebytes[0] != GZIP_ID_BYTE_1 ||
return (0); /* not compressed */
/*
* Allocate decompress scratch buffer
*/
if (free_dcomp_bufs) {
} else {
}
filep->fi_dcscrused = 0;
/*
* Initialize the decompression stream. Adding 16 to the window size
* indicates that zlib should expect a gzip header.
*/
dprintf("inflateInit2() failed\n");
return (-1);
}
return (0);
}
/*
* If the file described by fileid_t struct at *filep is compressed
* free any resources associated with the decompression. (decompression
* buffer, etc.).
*/
void
{
return;
if (free_dcomp_bufs == MAX_DECOMP_BUFS) {
} else {
}
}
void
{
(void) inflateReset(zsp);
}
/*
* Read at the current uncompressed offset from the compressed file described
* by *filep. Will return decompressed data.
*/
int
{
int infbytes;
/*
* read a block of the file to inflate
*/
return (-1);
}
dprintf("attempting inflate of %x bytes to buf at: %lx\n",
/*
* break out if we hit end of the compressed file
* or the end of the compressed byte stream
*/
break;
}
}
/*
* Seek to the location specified by addr
*/
void
{
int readsz;
/*
* To seek backwards, must rewind and seek forwards
*/
} else {
}
while (addr > 0) {
}
}