Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

puffs_flush(3) [netbsd man page]

PUFFS_FLUSH(3)						   BSD Library Functions Manual 					    PUFFS_FLUSH(3)

NAME
puffs_flush -- puffs kernel cache flushing and invalidation routines LIBRARY
puffs Convenience Library (libpuffs, -lpuffs) SYNOPSIS
#include <puffs.h> int puffs_inval_namecache_dir(struct puffs_usermount *pu, puffs_cookie_t cookie); int puffs_inval_namecache_all(struct puffs_usermount *pu); int puffs_inval_pagecache_node(struct puffs_usermount *pu, puffs_cookie_t cookie); int puffs_inval_pagecache_node_range(struct puffs_usermount *pu, puffs_cookie_t cookie, off_t start, off_t end); int puffs_flush_pagecache_node(struct puffs_usermount *pu, puffs_cookie_t cookie); int puffs_flush_pagecache_node_range(struct puffs_usermount *pu, puffs_cookie_t cookie, off_t start, off_t end); DESCRIPTION
These routines are used inform the kernel that any information it might have cached is no longer valid. puffs_inval_namecache_dir() invali- dates the name cache for a given directory. The argument cookie should describe an existing and valid directory cookie for the file system. Similarly, puffs_inval_namecache_all() invalidates the name cache for the entire file system (this routine might go away). The cached pages (file contents) for a regular file described by cookie are invalidated using puffs_inval_pagecache_node(). A specific range can be invalidated using puffs_inval_pagecache_node_range() for a platform specific page level granularity. The offset start will be truncated to a page boundary while end will be rounded up to the next page boundary. As a special case, specifying 0 as end will invalidate all contents from start to the end of the file. It is especially important to note that these routines will not only invalidate data in the "read cache", but also data in the "write back" cache (conceptually speaking; in reality they are the same cache), which has not yet been flushed to the file server. Therefore any unflushed data will be lost. The counterparts of the invalidation routines are the flushing routines puffs_flush_pagecache_node() and puffs_flush_pagecache_node_range(), which force unwritten data from the kernel page cache to be written. For the flush range version, the same range rules as with the invalida- tion routine apply. The data is flushed asynchronously, i.e. if the routine returns successfully, all the caller knows is that the data has been queued for writing. SEE ALSO
puffs(3) BSD
April 7, 2007 BSD

Check Out this Related Man Page

PUFFS_CRED(3)						   BSD Library Functions Manual 					     PUFFS_CRED(3)

NAME
puffs_cred -- puffs credential and access control routines LIBRARY
puffs Convenience Library (libpuffs, -lpuffs) SYNOPSIS
#include <puffs.h> int puffs_cred_getuid(const struct puffs_cred *pcr, uid_t *uid); int puffs_cred_getgid(const struct puffs_cred *pcr, gid_t *gid); int puffs_cred_getgroups(const struct puffs_cred *pcr, gid_t *gids, short *ngids); bool puffs_cred_isuid(const struct puffs_cred *pcr, uid_t uid); bool puffs_cred_hasgroup(const struct puffs_cred *pcr, gid_t gid); bool puffs_cred_iskernel(const struct puffs_cred *pcr); bool puffs_cred_isfs(const struct puffs_cred *pcr); bool puffs_cred_isjuggernaut(const struct puffs_cred *pcr); int puffs_access(enum vtype type, mode_t file_mode, uid_t owner, gid_t group, mode_t access_mode, const struct puffs_cred *pcr); int puffs_access_chown(uid_t owner, gid_t group, uid_t newowner, gid_t newgroup, const struct puffs_cred *pcr); int puffs_access_chmod(uid_t owner, gid_t group, enum vtype type, mode_t newmode, const struct puffs_cred *pcr); int puffs_access_times(uid_t owner, gid_t group, mode_t file_mode, int va_utimes_null, const struct puffs_cred *pcr); DESCRIPTION
These functions can be used to check operation credentials and perform access control. The structure struct puffs_cred can contain two types of credentials: ones belonging to users and ones belonging to the kernel. The latter is further divided into generic kernel credentials and file system credentials. The general rule is that these should be treated as more powerful than superuser credentials, but the file system is free to treat them as it sees fit. Credentials The puffs_cred_get() family of functions fetch the uid or gid(s) from the given credential cookie. They return 0 for success or -1 for an error and set errno. An error happens when the credentials represent kernel or file system credentials and do not contain an uid or gid(s). For puffs_cred_getgroups(), the argument gids should point to an array with room for *ngids elements. The puffs_cred_is() family of functions return 1 if the truth value of the function for pcr is true and 0 if it is false. The function puffs_cred_isjuggernaut() is true if pcr describes superuser, kernel or file system credentials. Access Control To help the programmers task of emulating normal kernel file system access control semantics, several helper functions are provided to check if access is allowed. They return 0 if access should be permitted or an errno value to indicate that access should be denied with the returned value. puffs_access() is equivalent to the kernel vaccess() function. The arguments specify current information of the file to be tested with the exception of access_mode, which is a combination of PUFFS_VREAD, PUFFS_VWRITE and PUFFS_VEXEC indicating the desired file access mode. The rest of the functions provide UFS semantics for operations. puffs_access_chown() checks if it is permissible to chown a file with the current uid and gid to the new uid and gid with the credentials of pcr. puffs_access_chmod() checks against permission to chmod a file of type type to the mode newmode. Finally, puffs_access_times() checks if it is allowable to update the timestamps of a file. The argument va_utimes_null signals if the flags VA_UTIMES_NULL was set in va_vaflags of struct vattr. If coming from a path where this information is unavailable, passing 0 as this argu- ment restricts the permission of modification to the owner and superuser. Otherwise the function checks for write permissions to the node and returns success if the caller has write permissions. SEE ALSO
puffs(3), vnode(9) BSD
October 18, 2007 BSD
Man Page