Lines Matching defs:filep

35 #include <sys/filep.h>
72 fileid_t *filep;
76 filep = (fileid_t *)opaque;
78 if (nbytes > (DECOMP_BUFSIZE - filep->fi_dcscrused)) {
81 ptr = &filep->fi_dcscrbuf[filep->fi_dcscrused];
82 filep->fi_dcscrused += nbytes;
99 * Read the first block of the file described by filep and determine if
101 * in the fileid_t struct pointed to by filep and it will be initialized
105 cf_check_compressed(fileid_t *filep)
113 * if (filep->fi_inode->i_cflags & ICOMPRESS)
114 * filep->fi_flags |= FI_COMPRESSED;
121 if (filep->fi_inode->i_size < 3)
123 filep->fi_offset = 0;
124 if ((filep->fi_getblock)(filep) == -1)
126 filep->fi_offset = 0;
127 filep->fi_count = 0;
128 filep->fi_cfoff = 0;
129 filebytes = (unsigned char *)filep->fi_memp;
134 filep->fi_flags |= FI_COMPRESSED;
136 dprintf("file %s is compressed\n", filep->fi_path);
142 filep->fi_dcscrbuf = scratch_bufs[--free_dcomp_bufs];
144 filep->fi_dcscrbuf = bkmem_alloc(DECOMP_BUFSIZE);
147 filep->fi_dcscrused = 0;
149 filep->fi_dcstream = zsp;
155 zsp->opaque = filep;
170 * If the file described by fileid_t struct at *filep is compressed
175 cf_close(fileid_t *filep)
177 if ((filep->fi_flags & FI_COMPRESSED) == 0)
179 dprintf("cf_close: %s\n", filep->fi_path);
180 (void) inflateEnd(filep->fi_dcstream);
181 bkmem_free(filep->fi_dcstream, sizeof (z_stream));
183 bkmem_free(filep->fi_dcscrbuf, DECOMP_BUFSIZE);
185 scratch_bufs[free_dcomp_bufs++] = filep->fi_dcscrbuf;
190 cf_rewind(fileid_t *filep)
194 dprintf("cf_rewind: %s\n", filep->fi_path);
195 zsp = filep->fi_dcstream;
199 filep->fi_cfoff = 0;
209 * by *filep. Will return decompressed data.
212 cf_read(fileid_t *filep, caddr_t buf, size_t count)
221 dprintf("cf_read: %s ", filep->fi_path);
223 zsp = filep->fi_dcstream;
224 ip = filep->fi_inode;
229 if (zsp->avail_in == 0 && filep->fi_cfoff < ip->i_size) {
233 soff = filep->fi_offset;
234 smemp = filep->fi_memp;
235 filep->fi_memp = NULL;
236 filep->fi_offset = filep->fi_cfoff;
237 filep->fi_count = 0;
238 if ((*filep->fi_getblock)(filep) == -1)
240 filep->fi_offset = soff;
241 zsp->next_in = (unsigned char *)filep->fi_memp;
242 zsp->avail_in = filep->fi_count;
243 filep->fi_memp = smemp;
244 filep->fi_cfoff += filep->fi_count;
256 if (filep->fi_cfoff >= ip->i_size || err == Z_STREAM_END)
267 cf_seek(fileid_t *filep, off_t addr, int whence)
272 dprintf("cf_seek: %s ", filep->fi_path);
274 zsp = filep->fi_dcstream;
281 cf_rewind(filep);
282 filep->fi_offset = 0;
288 (void) cf_read(filep, seek_scrbuf, readsz);