VIRTDIR(3)

NAME
virtdir - Utility routines for virtual directories for refuse operations

SYNOPSIS
#include <virtdir.h>
int
virtdir_init(virtdir_t *tree, struct stat *dir, struct stat *file, struct stat *symlink);
int
virtdir_add(virtdir_t *tree, const char *name, size_t namesize, uint8_t type, char *target);
int
virtdir_del(virtdir_t *tree, const char *name, size_t namesize);
int
virtdir_find(virtdir_t *tree, const char *name, size_t namesize);
int
virtdir_find_tgt(virtdir_t *tree, const char *name, size_t namesize);
void
virtdir_drop(virtdir_t *tree);
VIRTDIR *
openvirtdir(virtdir_t *tree, const char *directory);
virt_dirent_t *
readvirtdir(VIRTDIR *dirp);
void
closevirtdir(VIRTDIR *dirp);

DESCRIPTION
virtdir provides virtual directory functionality for the benefit of refuse(3) file systems (and also for FUSE-based file systems).

It uses the framework provided by the puffs(3) subsystem, and, through that, the kernel interface provided by puffs(4).

The virtdir routines build up and manage a list of virtual directory entries. Each virtual directory entry is indexed by its full pathname within the file system. This is consistent with the way that refuse(3) locates directory entries - by full pathname.

The list of paths is sorted alphabetically. Each of these virtual directory entries has a distinct type - file (‘f’), directory (‘d’), or symbolic link (‘l’). Additionally, an entry can point to a target - this is useful when modeling virtual directory entries which are symbolic links. The list contains three basic stat(2) structures, which contain basic information for file, directory and symbolic link entries. This information can be specified at initialization time, and customized within the individual getattr operation routines as specified by the individual file systems. The virtdir functionality can also make virtual directory entries available on a per-directory basis to the caller by means of routines analogous to opendir(3), readdir(3), and closedir(3). These are openvirtdir(), readvirtdir(), and closevirtdir(), respectively.

SEE ALSO
puffs(3), refuse(3), puffs(4)

HISTORY
An unsupported experimental version of virtdir first appeared in NetBSD 5.0.

AUTHORS
Alistair Crooks <agc@NetBSD.org>