MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / f_flush

Function f_flush

dep/hfsutils/libhfs/file.c:494–520  ·  view source on GitHub ↗

* NAME: file->flush() * DESCRIPTION: flush all pending changes to an open file */

Source from the content-addressed store, hash-verified

492 * DESCRIPTION: flush all pending changes to an open file
493 */
494int f_flush(hfsfile *file)
495{
496 hfsvol *vol = file->vol;
497
498 if (vol->flags & HFS_VOL_READONLY)
499 goto done;
500
501 if (file->flags & HFS_FILE_UPDATE_CATREC)
502 {
503 node n;
504
505 file->cat.u.fil.filStBlk = file->cat.u.fil.filExtRec[0].xdrStABN;
506 file->cat.u.fil.filRStBlk = file->cat.u.fil.filRExtRec[0].xdrStABN;
507
508 if (v_catsearch(vol, file->parid, file->name, 0, 0, &n) <= 0 ||
509 v_putcatrec(&file->cat, &n) == -1)
510 goto fail;
511
512 file->flags &= ~HFS_FILE_UPDATE_CATREC;
513 }
514
515done:
516 return 0;
517
518fail:
519 return -1;
520}

Callers 2

hfs_flushFunction · 0.85
hfs_closeFunction · 0.85

Calls 2

v_catsearchFunction · 0.85
v_putcatrecFunction · 0.85

Tested by

no test coverage detected