Lines Matching refs:vfp

45  * to use the various "vfp" operations to access a file, with a resulting
53 * vfpClose - close file associated with vfp
60 * vfpGetModifiedLen - get highest modified byte (length) contained in vfp
61 * vfpGetPath - get the path associated with the vfp
64 * vfpGets - get a string from the vfp into a fixed size buffer
67 * vfpOpen - open file on vfp
80 * vfpWriteToFile - write data contained in vfp to specified file
102 * flags element of the vfp. These flags may only occupy the high order order
103 * 16 bits of the 32-bit unsigned vfp "flags" object.
112 /* path name given to "anonymous" (string) vfp */
128 * Description: Open file on vfp, allocate storage, return pointer to VFP_T
147 * Side Effects: r_vfp -- filled in with a pointer to a newly allocated vfp
148 * which can be used with the various vfp functions.
156 VFP_T *vfp;
165 /* allocate pre-zeroed vfp object */
167 vfp = (VFP_T *)calloc(sizeof (VFP_T), 1);
168 if (vfp == (VFP_T *)NULL) {
172 /* create "string" vfp if no path specified */
176 * no path specified - no open file associated with vfp
177 * The vfp is initialized to all zeros - initialize just those
181 vfp->_vfpFlags = _VFP_MALLOC;
182 vfp->_vfpPath = strdup(VFP_ANONYMOUS_PATH);
183 (*r_vfp) = vfp;
188 * path specified - associate open file with vfp;
194 (void) free(vfp);
202 (void) free(vfp);
211 (void) free(vfp);
221 (void) free(vfp);
234 vfp->_vfpStart = MAP_FAILED; /* assume map failed if not allowed */
246 vfp->_vfpMapSize = statbuf.st_size;
256 vfp->_vfpSize = (statbuf.st_size + pagesize +
270 p = (char *)memalign(pagesize, vfp->_vfpSize);
272 vfp->_vfpStart = MAP_FAILED;
276 p[vfp->_vfpMapSize] = '\0';
280 vfp->_vfpStart = mmap(p, vfp->_vfpMapSize, PROT_READ,
283 /* if mmap succeeded set mmap used flag in vfp */
285 if (vfp->_vfpStart != MAP_FAILED) {
286 vfp->_vfpFlags |= _VFP_MMAP;
293 if ((vfp->_vfpStart == MAP_FAILED) && (!(a_flags & VFP_NOMALLOC))) {
305 vfp->_vfpSize = statbuf.st_size+pagesize;
309 vfp->_vfpStart = memalign((size_t)pagesize, vfp->_vfpSize);
310 if (vfp->_vfpStart == (char *)NULL) {
313 (void) free(vfp);
321 rlen = read(fileno(fp), vfp->_vfpStart,
328 (void) free(vfp->_vfpStart);
330 (void) free(vfp);
337 ((char *)vfp->_vfpStart)[statbuf.st_size] = '\0';
340 /* set malloc used flag in vfp */
342 vfp->_vfpFlags |= _VFP_MALLOC;
347 if (vfp->_vfpStart == MAP_FAILED) {
350 (void) free(vfp);
356 * initialize vfp contents
360 vfp->_vfpCurr = (char *)vfp->_vfpStart;
363 vfp->_vfpEnd = (((char *)vfp->_vfpStart) + statbuf.st_size)-1;
366 vfp->_vfpHighWater = (char *)vfp->_vfpEnd;
369 vfp->_vfpFile = fp;
373 (void) vfpSetFlags(vfp, a_flags);
377 vfp->_vfpPath = strdup(a_path ? a_path : "");
382 vfp->_vfpFlags |= _VFP_WRITE;
386 vfp->_vfpFlags |= _VFP_READ;
389 /* set return vfp pointer */
391 (*r_vfp) = vfp;
400 * Description: Close an open vfp, causing any modified data to be written out
401 * to the file associated with the vfp.
413 VFP_T *vfp;
424 vfp = *r_vfp;
428 if (vfp == (VFP_T *)NULL) {
442 if (vfp->_vfpFlags & _VFP_WRITE) {
443 if ((vfp->_vfpFlags & _VFP_MALLOC) &&
444 (vfp->_vfpFile != (FILE *)NULL)) {
448 len = vfpGetModifiedLen(vfp);
452 (void) vfpSafePwrite(fileno(vfp->_vfpFile),
453 vfp->_vfpStart, len, (off_t)0);
460 if (vfp->_vfpFlags & _VFP_MALLOC) {
461 (void) free(vfp->_vfpStart);
462 } else if (vfp->_vfpFlags & _VFP_MMAP) {
465 (void) munmap(vfp->_vfpStart, vfp->_vfpMapSize);
469 (void) free(vfp->_vfpStart);
474 (void) free(vfp->_vfpPath);
479 if (vfp->_vfpFile != (FILE *)NULL) {
480 ret = fclose(vfp->_vfpFile);
484 /* deallocate the vfp itself */
486 (void) free(vfp);
514 /* return if no vfp specified */
556 /* return if no vfp specified */
603 /* return if no vfp specified */
686 /* return if no vfp specified */
732 /* return if no vfp specified */
818 VFP_T *vfp; /* newly allocated checkpointed VFP */
887 vfp = (VFP_T *)malloc(sizeof (VFP_T));
888 if (vfp == (VFP_T *)NULL) {
914 (void) memcpy(vfp, avfp, sizeof (VFP_T));
926 vfp->_vfpPath = strdup(a_path);
930 vfp->_vfpCkDev = statbuf.st_dev; /* devid holding st_ino inode */
931 vfp->_vfpCkIno = statbuf.st_ino; /* backing store inode */
932 vfp->_vfpCkMtime = statbuf.st_mtime; /* last data modification */
933 vfp->_vfpCkSize = statbuf.st_size; /* backing store size (bytes) */
934 vfp->_vfpCkStBlocks = statbuf.st_blocks; /* blocks allocated to file */
938 (*r_cpVfp) = vfp;
947 * Description: Open file on vfp, allocate storage, return pointer to VFP_T
973 * Side Effects: r_vfp -- filled in with a pointer to a newly allocated vfp
985 VFP_T *vfp; /* new VFP open on checkpointed backing store */
1060 vfp = (VFP_T *)malloc(sizeof (VFP_T));
1061 if (vfp == (VFP_T *)NULL) {
1068 (void) memcpy(vfp, cpVfp, sizeof (VFP_T));
1076 vfp->_vfpFile = fp;
1080 if (vfp->_vfpPath != (char *)NULL) {
1081 (void) free(vfp->_vfpPath);
1086 vfp->_vfpPath = strdup(a_path);
1092 * store as was checkpointed in cpVfp that is pointed to by vfp.
1096 vfp->_vfpCurr = (char *)vfp->_vfpStart;
1098 /* free checkpointed VFP as it is now open on "vfp" */
1108 (*r_vfp) = vfp;