Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/tmpfs/tmpfs.h
Show First 20 Lines • Show All 522 Lines • ▼ Show 20 Lines | |||||
extern int tmpfs_pager_type; | extern int tmpfs_pager_type; | ||||
/* | /* | ||||
* Macros/functions to convert from generic data structures to tmpfs | * Macros/functions to convert from generic data structures to tmpfs | ||||
* specific ones. | * specific ones. | ||||
*/ | */ | ||||
static inline struct vnode * | |||||
VM_TO_TMPFS_VP(vm_object_t obj) | |||||
{ | |||||
struct tmpfs_node *node; | |||||
if ((obj->flags & OBJ_TMPFS) == 0) | |||||
return (NULL); | |||||
/* | |||||
* swp_priv is the back-pointer to the tmpfs node, if any, | |||||
* which uses the vm object as backing store. The object | |||||
* handle is not used to avoid locking sw_alloc_sx on tmpfs | |||||
* node instantiation/destroy. | |||||
*/ | |||||
node = obj->un_pager.swp.swp_priv; | |||||
return (node->tn_vnode); | |||||
} | |||||
static inline struct tmpfs_mount * | |||||
VM_TO_TMPFS_MP(vm_object_t obj) | |||||
{ | |||||
struct tmpfs_node *node; | |||||
if ((obj->flags & OBJ_TMPFS) == 0) | |||||
return (NULL); | |||||
node = obj->un_pager.swp.swp_priv; | |||||
MPASS(node->tn_type == VREG); | |||||
return (node->tn_reg.tn_tmp); | |||||
} | |||||
static inline struct tmpfs_mount * | static inline struct tmpfs_mount * | ||||
VFS_TO_TMPFS(struct mount *mp) | VFS_TO_TMPFS(struct mount *mp) | ||||
{ | { | ||||
struct tmpfs_mount *tmp; | struct tmpfs_mount *tmp; | ||||
MPASS(mp != NULL && mp->mnt_data != NULL); | MPASS(mp != NULL && mp->mnt_data != NULL); | ||||
tmp = (struct tmpfs_mount *)mp->mnt_data; | tmp = (struct tmpfs_mount *)mp->mnt_data; | ||||
return (tmp); | return (tmp); | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |