------------------------------------------------------------------------ August 1998 Data Storage & Retrieval Systems Division, Hitachi, LTD ------------------------------------------------------------------------ 1.Introduction -------------- We i.e. Data Storage & Retrieval Systems Division, Hitachi, Ltd. utilize the gzip, that is free software of GNU, as a tool in the booting process of the controlware for the disk-subsystems which we produce. We will explain below in this file the outline of "the gzip" utilized in the disk-subsystems which we produce. 2.GNU and the gzip ------------------ GNU is the common name of the GNU Project, that is organized by the Free Software Foundation, Inc. It is developing and distributing many free softwares. The gzip is one of the free softwares developed and distributed by the GNU Project. It is the program for data compression and uncompression. If you need more information about the gzip, see following URLs. http://www.gzip.org/ (The gzip home page) http://w3.teaser.fr/~jlgailly/ (Jean-loup's home page) You ordinary can get the gzip as an archive which contains the source files in it. Our controlware is based on gzip-1.2.4. In this file, we call it the "original archive" or the "original source file". You can download the original archive from many FTP sites including followings. ftp://prep.ai.mit.edu:/pub/gnu/ ftp://ftp.iij.ad.jp/pub/GNU/ 3.Role of the gzip in the controlware for the disk-subsystems ------------------------------------------------------------- The disk-subsystems which we produce, in their booting process, utilize a function of uncompressing in the gzip. This function is implemented as an executable module called externally. The loader that loads the main part of the controlware utilizes the function. The main part of the controlware does not utilize the gzip, and that module is replaceable as a whole with any other file which has an equal function and same interface. 4.Files in the Diskette ----------------------- This diskette is one of the installation disks of controlware for the disk-subsystems, and contains all that relate to the gzip in our controlware. This diskette contains following files. \ --+-- DKC200 ----- MP ----- DKC --+-- DKA ----- 1inflodd.prg | +-- CHA ----- 1inflodc.prg | +-- CHS ----- 1inflods.prg | +-- CHF ----- 1inflodf.prg | +--- GZIP --+-- SRC --+-- inflate.c | +-- inflate.h | +-- makefile | +-- COPYING +-- readme.txt +-- readme_j.txt 1inflodx.prg (x expresses any one letter) These files are the executable modules, that are capable of data uncompression, extracted from the gzip. Some of these files may be missing, or there may be otherwise named files besides above 4 files. It depends on the hardware constitutions of the disk-subsystems. The loader loads these files and utilizes them. inflate.c This is the source file. We selected the capable parts of data uncompression out of the original source file, and modified them to include an interface as a function, which resulted in this file. We deleted some parts needless for uncompression in original source file "inflate.c", and import some needful codes from the original source file "util.c". This file contains our modification parts. inflate.h This is the header file that defines the interface which the function for uncompression in inflate.c has. It is required when you compile inflate.c or other modules which utilize the function. We have originally programmed the whole of this file. makefile This is a sample makefile to make 1inflodx.prg from inflate.c and inflate.h. We have originally programmed this file, too. COPYING GNU GENERAL PUBLIC LICENCE ( that is known as GPL ) This is the file which describes copyrights and license terms of GNU free softwares to use, to modify the original files, and to redistribute modified ones. readme.txt, readme_j.txt This file ( described in English and in Japanese ). Attention: As long as you use this diskette as an installation disk for the disk-subsystems, do not change the name of these files and directories, their paths, and do not modify these files. 5.Copyrights ------------ Copyright of the original gzip belongs to GNU and authors of the gzip. Although there is a description of "Not copyrighted" in the source file inflate.c, the copyright still belongs to them in certain countries and locations, including Japan, where any copyrights are legally restricted to be renounced. In this diskette, copyrights of the codes of our modification in inflate.c and that of the inflate.h and the makefile which we have programmed belong to us. You can recognize what are the modified parts in the source files by comparing those files simply with the ones in the original archives. 6.Licensing, Modifying, Distributing ------------------------------------ Original of the gzip is a free software. The license terms to use, to modify its files and to redistribute them are stipulated in GPL. According to GPL, we have made files in this diskette as free software and we will apply GPL to these files. We will not charge any fee for the contents of this diskette without actual cost for its medium itself and its delivery. You are free to use, to modify, to redistribute the contents of this diskette, as long as you accept following terms. - You need to understand the contents of next chapter "Warranties and Exoneration" and accept it. - If you redistribute files, you must include this README file ( both of the files in English and in Japanese ) and GPL whether you modified files or not. You must neither modify these files nor change their names (readme.txt, readmej.txt and COPYING). - You must not transfer this diskette itself ( Because this diskette is attached to our products - the disk-subsystems). You must make its copy in another medium and state that that diskette is copied one explicitly. - If you redistribute files which you modified, you must state that you modified files and state the date of modification explicitly. - You must observe GPL. 7.Warranties and Disclaimers ---------------------------- If you use the contents of this diskette except for the purpose of installation of the disk-subsystems, there is no warranty by us nor by any vendor of our products as to any damages caused by such uses. Moreover we are not liable to reply to any inquiry about such uses. The gzip, including our modification, is free software.They are not our products. No representation or warranty has been or is made by GNU that the gzip does not infringe any intellectual property rights of others, although we can find in above URLs that the authors of the gzip made a detailed search of them. 8.Requirements -------------- Source files in this diskette are designed to be compiled and linked on the following environment. C Compiler gcc gcc960 version cygnus-2.0.2 Linkage Editor ld gld version BFD 1.95 Make make GNU make version 3.62 Environment SunOS4.1.3-JLE, 4.1.4-JLE (JLE: Japanese Language Edition) 9.Program Interfaces -------------------- Functions to uncompress compressed data on memory are available with inflate.c and inflate.h. Here are specifications of the functions and a program sample using them. SYNOPSIS & DESCRIPTION ---------------------- #include "inflate.h" void gzip_clear_bufs( ZFILE* zfile ) unsigned long gzip_updcrc( unsigned char *window, unsigned outcnt ) int gzip_get_method( void ); int gzip_copy_code( char *dest, int size ) int gzip_get_outbytes( void ); unsigned char gzip_get_byte( void ); gzip_clear_bufs() executes some initializations including the clearing of temporary memory area to uncompress the compressed data. ZFILE is the structure defined in inflate.h. Compressed data on the memory is operated like the FILE structure (namely this ZFILE structure). zfile is a pointer to the structure. gzip_updcrc() returns CRC of uncompressed data. Second parameter outcnt should be always assigned 0. When the first parameter window is NULL, gzip_updcrc() initializes for calculation of CRC. And when the window is not NULL, CRC of uncompressed data is returned. gzip_get_method() returns method code of the compressed data. gzip_copy_code() uncompresses data of no longer than "size" (in bytes) and writes the data to the memory pointed to by dest. Then it returns the length of the uncompressed data (in bytes). gzip_get_outbytes() returns total length (in bytes) of the uncompressed data. gzip_get_byte() is used to get CRC and length (in bytes) of the uncompressed data byte by byte at the tail of the compressed data. SAMPLE CODE ----------- /* set the compressed data to zfile */ zfile->file_ptr = ... ; zfile->zfile_size = ... ; .... /* set the size of uncompressed data to size */ size = ... ; gzip_clear_bufs( zfile ); gzip_updcrc( NULL, 0 ); if( gzip_get_method() < 0 ) { /* Error */ } for( s = size ; s > 0 ; s -= n ) { n = gzip_copy_code( dest, size ); dest += n; } crc = gzip_get_byte(); crc *= 256; crc += gzip_get_byte(); crc *= 256; crc += gzip_get_byte(); crc *= 256; crc += gzip_get_byte(); len = gzip_get_byte(); len *= 256; len += gzip_get_byte(); len *= 256; len += gzip_get_byte(); len *= 256; len += gzip_get_byte(); /* check the length of uncompressed data */ if( len != gzip_get_outbytes() ) { /* Error */ } /* check the CRC of uncompressed data */ if( crc != gzip_updcrc( (unsigned char*)(!NULL), 0 ) { /* Error */ } ------------------------------------------------------------------------ Data Storage & Retrieval Systems Division. Hitachi, Ltd. 2880 Kozu,Odawara-shi, Kanagawa-ken, Japan Tel: +81-465-48-1111