---
title: vfs_iterate
framework: Kernel
role: symbol
role_heading: Function
platforms: [macOS 10.4+]
path: kernel/1523233-vfs_iterate
---

# vfs_iterate

Iterate over all mountpoints with a callback. Used, for example, by sync().

## Declaration

```occ
int vfs_iterate(int flags, int (*callout)(struct mount *, void *), void *arg);
```

## Parameters

- `flags`: Unused.
- `callback`: Function which takes a mount and arbitrary passed-in "arg," and returns one of VFS_RETURNED_DONE or VFS_CLAIMED_DONE: end iteration and return success. VFS_RETURNED or VFS_CLAIMED: continue iterating. Anything else: continue iterating.
- `arg`: Arbitrary data to pass to callback.

## Return Value

Return Value 0 for success, else an error code.
