syncvfs Subroutine

Purpose

Updates a filesystem.

Syntax

#include <fscntl.h>

int syncvfs (vfsName, command)
char *vfsName;
int command;

Description

The syncvfs subroutine behaves in 3 different manners depending on the granularity specified. In each case the GFS_SYNCVFS flag is checked and VFS_SYNCVFS or VFS_SYNC is called on the GFS and/or VFS specified. In each case the the command parameter is passed untouched. The cases are:
  • If a NULL pointer is passed through the vfsName parameter, the FS_SYNCVFS_ALL level is assumed, and the call loops through each GFS in a similar manner to the sync call.
  • If FS_SYNCVFS_FSTYPE is passed, the GFS is scanned and the names compared. The GFS with the correct name (if one exists) is called with its own GFS pointer and a null VFS pointer.
  • If FS_SYNCVFS_FS is passed, the mount point is looked up and, if it exists, VFS_SYNCVFS is called with the GFS pointer and the VFS pointer of the filesystem found.

Parameters

Item Description
vfsName Depending on the value of the command parameter, this can either be NULL, the name of a filesystem type (for example, "jfs", "j2") or the name of a filesystem, specified by mount point (for example, "/testj2").
command Command is the mask of two options, a level and a granularity. The granularity can be one of:
FS_SYNCVFS_ALL
sync every filesystem
FS_SYNCVFS_FSTYPE
sync every filesystem of VFS type corresponding to vfsName
FS_SYNCVFS_FS
sync specific filesystem at vfsName
The level can be one of:
FS_SYNCVFS_TRY
daemon heurstics
FS_SYNCVFS_FORCE
user requested sync
FS_SYNCVFS_QUIESCE
full filesystem quiesce

Return Values

Upon successful completion, the syncvfs subroutine returns 0. If unsuccessful, -1 is returned and the errno global variable is set.