Lines Matching defs:fp
483 kfile_t *fp;
488 fp = kmem_alloc(sizeof (kfile_t), KM_SLEEP);
490 fp->kf_vnflags = FCREAT | FWRITE | FTRUNC;
491 fp->kf_fname = filename;
492 fp->kf_fpos = 0;
493 fp->kf_state = 0;
496 filename, fp->kf_vnflags));
497 rval = vn_open(filename, UIO_SYSSPACE, fp->kf_vnflags,
498 0444, &fp->kf_vp, CRCREAT, 0);
500 kmem_free(fp, sizeof (kfile_t));
506 *kfilep = fp;
525 kfread(kfile_t *fp, char *buf, ssize_t bufsiz, ssize_t *ret_n)
533 if (fp->kf_state != 0)
534 return (fp->kf_state);
536 err = vn_rdwr(UIO_READ, fp->kf_vp, buf, bufsiz, fp->kf_fpos,
540 fp->kf_fname, err));
541 fp->kf_state = err;
549 fp->kf_fname, n, bufsiz, resid));
551 fp->kf_fpos += n;
557 kfwrite(kfile_t *fp, char *buf, ssize_t bufsiz, ssize_t *ret_n)
567 if (fp->kf_state != 0)
568 return (fp->kf_state);
573 err = vn_rdwr(UIO_WRITE, fp->kf_vp, buf, len, fp->kf_fpos,
577 fp->kf_fname, err));
578 fp->kf_state = err;
583 fp->kf_fname, len-resid, resid));
593 fp->kf_fname));
594 fp->kf_state = ENOSPC;
600 fp->kf_fpos += len;
605 KFDEBUG1((CE_CONT, "%s: wrote %ld bytes ok\n", fp->kf_fname, n));
613 kfclose(kfile_t *fp)
617 KFDEBUG((CE_CONT, "close: %s\n", fp->kf_fname));
619 if ((fp->kf_vnflags & FWRITE) && fp->kf_state == 0) {
620 rval = VOP_FSYNC(fp->kf_vp, FSYNC, kcred, NULL);
623 fp->kf_fname, rval);
625 KFDEBUG((CE_CONT, "%s: sync ok\n", fp->kf_fname));
628 rval = VOP_CLOSE(fp->kf_vp, fp->kf_vnflags, 1,
631 if (fp->kf_state == 0) {
633 fp->kf_fname, rval);
636 if (fp->kf_state == 0)
637 KFDEBUG((CE_CONT, "%s: close ok\n", fp->kf_fname));
640 VN_RELE(fp->kf_vp);
641 kmem_free(fp, sizeof (kfile_t));
667 kfile_t *fp;
710 if ((err = kfcreate(newname, &fp)) == 0) {
711 err = kfwrite(fp, buf, buflen, &n);
725 if ((err1 = kfclose(fp)) != 0) {