Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136122051
D25077.id72455.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D25077.id72455.diff
View Options
Index: sys/fs/tmpfs/tmpfs.h
===================================================================
--- sys/fs/tmpfs/tmpfs.h
+++ sys/fs/tmpfs/tmpfs.h
@@ -393,12 +393,11 @@
* This structure maps a file identifier to a tmpfs node. Used by the
* NFS code.
*/
-struct tmpfs_fid {
- uint16_t tf_len;
- uint16_t tf_pad;
- ino_t tf_id;
- unsigned long tf_gen;
+struct tmpfs_fid_data {
+ ino_t tfd_id;
+ unsigned long tfd_gen;
};
+CTASSERT(sizeof(struct tmpfs_fid_data) <= MAXFIDSZ);
struct tmpfs_dir_cursor {
struct tmpfs_dirent *tdc_current;
Index: sys/fs/tmpfs/tmpfs_vfsops.c
===================================================================
--- sys/fs/tmpfs/tmpfs_vfsops.c
+++ sys/fs/tmpfs/tmpfs_vfsops.c
@@ -566,24 +566,24 @@
tmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
struct vnode **vpp)
{
- struct tmpfs_fid *tfhp;
+ struct tmpfs_fid_data *tfhp;
struct tmpfs_mount *tmp;
struct tmpfs_node *node;
int error;
+ if (fhp->fid_len != sizeof(struct tmpfs_fid_data))
+ return (EINVAL);
+
+ tfhp = (struct tmpfs_fid_data *)&fhp->fid_data[0];
tmp = VFS_TO_TMPFS(mp);
- tfhp = (struct tmpfs_fid *)fhp;
- if (tfhp->tf_len != sizeof(struct tmpfs_fid))
+ if (tfhp->tfd_id >= tmp->tm_nodes_max)
return (EINVAL);
- if (tfhp->tf_id >= tmp->tm_nodes_max)
- return (EINVAL);
-
TMPFS_LOCK(tmp);
LIST_FOREACH(node, &tmp->tm_nodes_used, tn_entries) {
- if (node->tn_id == tfhp->tf_id &&
- node->tn_gen == tfhp->tf_gen) {
+ if (node->tn_id == tfhp->tfd_id &&
+ node->tn_gen == tfhp->tfd_gen) {
tmpfs_ref_node(node);
break;
}
Index: sys/fs/tmpfs/tmpfs_vnops.c
===================================================================
--- sys/fs/tmpfs/tmpfs_vnops.c
+++ sys/fs/tmpfs/tmpfs_vnops.c
@@ -1435,16 +1435,25 @@
static int
tmpfs_vptofh(struct vop_vptofh_args *ap)
+/*
+vop_vptofh {
+ IN struct vnode *a_vp;
+ IN struct fid *a_fhp;
+};
+*/
{
- struct tmpfs_fid *tfhp;
struct tmpfs_node *node;
+ struct fid *fhp;
+ struct tmpfs_fid_data *tfhp;
- tfhp = (struct tmpfs_fid *)ap->a_fhp;
node = VP_TO_TMPFS_NODE(ap->a_vp);
- tfhp->tf_len = sizeof(struct tmpfs_fid);
- tfhp->tf_id = node->tn_id;
- tfhp->tf_gen = node->tn_gen;
+ fhp = ap->a_fhp;
+ fhp->fid_len = sizeof(struct tmpfs_fid_data);
+
+ tfhp = (struct tmpfs_fid_data *)&fhp->fid_data[0];
+ tfhp->tfd_id = node->tn_id;
+ tfhp->tfd_gen = node->tn_gen;
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 16, 11:11 PM (17 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25395125
Default Alt Text
D25077.id72455.diff (2 KB)
Attached To
Mode
D25077: tmpfs: Preserve alignment of struct fid fields
Attached
Detach File
Event Timeline
Log In to Comment