Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/tmpfs/tmpfs_vnops.c
Show First 20 Lines • Show All 1,700 Lines • ▼ Show 20 Lines | |||||
tmpfs_vptofh(struct vop_vptofh_args *ap) | tmpfs_vptofh(struct vop_vptofh_args *ap) | ||||
/* | /* | ||||
vop_vptofh { | vop_vptofh { | ||||
IN struct vnode *a_vp; | IN struct vnode *a_vp; | ||||
IN struct fid *a_fhp; | IN struct fid *a_fhp; | ||||
}; | }; | ||||
*/ | */ | ||||
{ | { | ||||
struct tmpfs_fid_data tfd; | struct tmpfs_fid_data *const tfd = (struct tmpfs_fid_data *)ap->a_fhp; | ||||
struct tmpfs_node *node; | struct tmpfs_node *node; | ||||
struct fid *fhp; | _Static_assert(sizeof(*tfd) <= sizeof(struct fid), | ||||
_Static_assert(sizeof(struct tmpfs_fid_data) <= sizeof(struct fid), | |||||
"struct tmpfs_fid_data cannot be larger than struct fid"); | "struct tmpfs_fid_data cannot be larger than struct fid"); | ||||
node = VP_TO_TMPFS_NODE(ap->a_vp); | node = VP_TO_TMPFS_NODE(ap->a_vp); | ||||
fhp = ap->a_fhp; | tfd->tfd_len = sizeof(*tfd); | ||||
fhp->fid_len = sizeof(tfd); | tfd->tfd_gen = node->tn_gen; | ||||
tfd->tfd_id = node->tn_id; | |||||
/* | |||||
* Copy into fid_data from the stack to avoid unaligned pointer use. | |||||
* See the comment in sys/mount.h on struct fid for details. | |||||
*/ | |||||
tfd.tfd_id = node->tn_id; | |||||
tfd.tfd_gen = node->tn_gen; | |||||
memcpy(fhp->fid_data, &tfd, fhp->fid_len); | |||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
tmpfs_whiteout(struct vop_whiteout_args *ap) | tmpfs_whiteout(struct vop_whiteout_args *ap) | ||||
{ | { | ||||
struct vnode *dvp = ap->a_dvp; | struct vnode *dvp = ap->a_dvp; | ||||
▲ Show 20 Lines • Show All 501 Lines • Show Last 20 Lines |