Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/tmpfs/tmpfs.h
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | |||||
* Below is the key of locks used to protected the fields in the following | * Below is the key of locks used to protected the fields in the following | ||||
* structures. | * structures. | ||||
* (v) vnode lock in exclusive mode | * (v) vnode lock in exclusive mode | ||||
* (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and | * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and | ||||
* tn_interlock | * tn_interlock | ||||
* (i) tn_interlock | * (i) tn_interlock | ||||
* (m) tmpfs_mount tm_allnode_lock | * (m) tmpfs_mount tm_allnode_lock | ||||
* (c) stable after creation | * (c) stable after creation | ||||
* (v) tn_reg.tn_aobj vm_object lock | |||||
*/ | */ | ||||
struct tmpfs_node { | struct tmpfs_node { | ||||
/* | /* | ||||
* Doubly-linked list entry which links all existing nodes for | * Doubly-linked list entry which links all existing nodes for | ||||
* a single file system. This is provided to ease the removal | * a single file system. This is provided to ease the removal | ||||
* of all nodes during the unmount operation, and to support | * of all nodes during the unmount operation, and to support | ||||
* the implementation of VOP_VNTOCNP(). tn_attached is false | * the implementation of VOP_VNTOCNP(). tn_attached is false | ||||
* when the node is removed from list and unlocked. | * when the node is removed from list and unlocked. | ||||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | struct tn_reg { | ||||
* short). The aobj provides direct access to | * short). The aobj provides direct access to | ||||
* any position within the file. It is a task | * any position within the file. It is a task | ||||
* of the memory management subsystem to issue | * of the memory management subsystem to issue | ||||
* the required page ins or page outs whenever | * the required page ins or page outs whenever | ||||
* a position within the file is accessed. | * a position within the file is accessed. | ||||
*/ | */ | ||||
vm_object_t tn_aobj; /* (c) */ | vm_object_t tn_aobj; /* (c) */ | ||||
struct tmpfs_mount *tn_tmp; /* (c) */ | struct tmpfs_mount *tn_tmp; /* (c) */ | ||||
vm_pindex_t tn_pages; /* (v) */ | |||||
} tn_reg; | } tn_reg; | ||||
} tn_spec; /* (v) */ | } tn_spec; /* (v) */ | ||||
}; | }; | ||||
LIST_HEAD(tmpfs_node_list, tmpfs_node); | LIST_HEAD(tmpfs_node_list, tmpfs_node); | ||||
#define tn_rdev tn_spec.tn_rdev | #define tn_rdev tn_spec.tn_rdev | ||||
#define tn_dir tn_spec.tn_dir | #define tn_dir tn_spec.tn_dir | ||||
#define tn_link_target tn_spec.tn_link.tn_link_target | #define tn_link_target tn_spec.tn_link.tn_link_target | ||||
▲ Show 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | |||||
void tmpfs_subr_uninit(void); | void tmpfs_subr_uninit(void); | ||||
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; | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |