Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

puffs_path(3) [netbsd man page]

PUFFS_PATH(3)						   BSD Library Functions Manual 					     PUFFS_PATH(3)

NAME
puffs_path -- puffs pathbuilding routines LIBRARY
puffs Convenience Library (libpuffs, -lpuffs) SYNOPSIS
#include <puffs.h> int pu_pathbuild_fn(struct puffs_usermount *pu, const struct puffs_pathobj *po_dir, const struct puffs_pathobj *po_comp, size_t offset, struct puffs_pathobj *po_new); int pu_pathtransform_fn(struct puffs_usermount *pu, const struct puffs_pathobj *po_base, const struct puffs_cn *pcn, struct puffs_pathobj *po_new); int pu_pathcmp_fn(struct puffs_usermount *pu, struct puffs_pathobj *po1, struct puffs_pathobj *po2, size_t checklen, int checkprefix); void pu_pathfree_fn(struct puffs_usermount *pu, struct puffs_pathobj *po); int pu_namemod_fn(struct puffs_usermount *pu, struct puffs_pathobj *po_dir, struct puffs_cn *pcn); struct puffs_pathobj * puffs_getrootpathobj(struct puffs_usermount *pu); DESCRIPTION
The puffs library has the ability to provide full pathnames for backends which require them. Normal file systems should be constructed with- out the file system node tied to a file name and should not used routines described herein. An example of a file system where the backend requires filenames is mount_psshfs(8). The features described here are enabled by passing PUFFS_FLAG_BUILDPATH to puffs_init(). This facility requires to use puffs nodes to store the contents of the pathname. Either the address of the operation cookie must directly be that of the puffs node, or puffs_set_cmap() must be used to set a mapping function from the cookie to the puffs node associated with the cookie. Finally, the root node for the file system must be set using puffs_setroot() and the root path object retrieved using puffs_getrootpathobj() and initialized. There are two different places a filename can be retrieved from. It is available for each puffs node after the node has been registered with the framework, i.e. after the routine creating the node returns. In other words, there is a window between the node is created and when the pathname is available and multithreaded file systems must take this into account. The second place where a pathname is available is from the componentname struct puffs_pcn in operations which are passed one. These can be retrieved using the convenience macros PNPATH() and PCNPATH() for node and componentname, respectively. The type of object they return is void *. By default the framework manages "regular" filenames, which consist of directory names separated by "/" and a final component. If the file system wishes to use pathnames of this format, all it has to do it enable the feature. Everything else, including bookkeeping for node and directory renames, is done by the library. The callback routines described next provide the ability to build non-standard pathnames. A pu_foo_fn() callback is set using the puffs_set_foo() routine. This manual page is still unfinished. Please take a number and wait in line. SEE ALSO
puffs(3), puffs_node(3), mount_psshfs(8), mount_sysctlfs(8) BSD
December 27, 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