Lines Matching defs:cfp
64 get_bsize(cfp_t *cfp, char *name)
101 cfp->cf_flag |= CFG_NOWRVTOC;
148 localcf_close(cfp_t *cfp)
150 fsync(cfp->cf_fd);
151 cfp_unlock(cfp);
152 close(cfp->cf_fd);
159 * Sets file descriptor in cfp->cf_fd for use by other routines
162 localcf_open(cfp_t *cfp, char *name)
175 cfp->cf_fd = open(name, O_RDWR|O_CREAT|O_DSYNC|O_RSYNC, 0640);
176 if (cfp->cf_fd == -1) {
177 if ((cfp->cf_fd = open(name, O_RDONLY, 0640)) == -1) {
183 cfp->cf_flag |= CFG_RDONLY;
186 if (fstat(cfp->cf_fd, &sb) == -1) {
187 close(cfp->cf_fd);
196 cfp->cf_size = get_bsize(cfp, name);
199 if (cfp->cf_flag & CFG_NOWRVTOC) {
201 rc = lseek(cfp->cf_fd, CFG_VTOC_SKIP, SEEK_SET);
208 close(cfp->cf_fd);
214 cfp->cf_flag |= CFG_FILE;
215 cfp->cf_size = FBA_NUM(FBA_SIZE(1) - 1 + sb.st_size);
219 close(cfp->cf_fd);
220 cfp->cf_fd = NULL;
223 return (cfp);
227 localcf_seekblk(cfp_t *cfp, int off, int mode)
232 rc = lseek(cfp->cf_fd, off, mode);
239 localcf_readblk(cfp_t *cfp, void *buf, int size)
244 rc = read(cfp->cf_fd, buf, size);
251 localcf_writeblk(cfp_t *cfp, void *buf, int size)
256 rc = write(cfp->cf_fd, buf, size);
263 localcf_seek(cfp_t *cfp, int off, int mode)
270 if ((mode == SEEK_SET) && (cfp->cf_flag & CFG_NOWRVTOC)) {
275 rc = lseek(cfp->cf_fd, offset, mode);
282 localcf_read(cfp_t *cfp, void *buf, int size)
293 rc = read(cfp->cf_fd, blk_buf, blk_size);
303 localcf_write(cfp_t *cfp, void *buf, int size)
316 rc = write(cfp->cf_fd, blk_buf, blk_size);
332 addcfline(cfp_t *cfp, char *line, int table_index)
343 cfp->cf_head->h_cfgs[table_index].l_size, table_index,
344 cfp->cf_head->h_cfgsizes[table_index],
345 cfp->cf_head->h_cfgs[table_index].l_free, len);
348 hd = cfp->cf_head;
349 cfl = &cfp->cf_head->h_cfgs[table_index];
401 cfp->cf_head->h_csize += len;
406 cfp->cf_head->h_cfgs[table_index].l_size,
407 table_index, cfp->cf_head->h_cfgsizes[table_index],
408 cfp->cf_head->h_cfgs[table_index].l_free, cfp->cf_head->h_csize);
418 remcfline(cfp_t *cfp, int table_offset, int setnum)
426 ch = cfp->cf_head;
428 cfl = &cfp->cf_head->h_cfgs[table_offset];
503 readcfline(cfp_t *cfp, char *buf, int table_offset, int num)
515 ch = cfp->cf_head;
537 replacecfline(cfp_t *cfp, char *line, int table_offset, int num)
556 ch = cfp->cf_head;
604 cfp->cf_head->h_csize += diff;
605 cfp->cf_head->h_cfgsizes[table_offset] = cfl->l_size; /* disk */