Page MenuHomeFreeBSD

ffs_vnops: Simplify extattr access
ClosedPublic

Authored by cem on Jan 17 2017, 7:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 28, 10:26 AM
Unknown Object (File)
Mon, Oct 28, 10:26 AM
Unknown Object (File)
Mon, Oct 28, 10:26 AM
Unknown Object (File)
Mon, Oct 28, 10:26 AM
Unknown Object (File)
Mon, Oct 28, 10:26 AM
Unknown Object (File)
Mon, Oct 28, 10:05 AM
Unknown Object (File)
Thu, Oct 24, 8:04 PM
Unknown Object (File)
Thu, Oct 24, 3:00 PM
Subscribers
None

Details

Summary

As suggested in r167010, use the structure type and macros to access and
modify UFS2 extended attributes.

PR: 216127
Reported by: dewayne at heuristicsystems.com.au
Sponsored by: Dell EMC Isilon

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

cem retitled this revision from to ffs_vnops: Simplify extattr access.
cem updated this object.
cem edited the test plan for this revision. (Show Details)
cem added reviewers: kib, mckusick.

This is fine, but I have one suggestion.

In each place which casts char * into the structure, verify the alignment. This might be not strictly needed right now, since from what I see the pointers are malloced, but might help if the code starts mutating in future. I am not sure whether the checks should be asserts or silently return error.

In D9225#190692, @kib wrote:

This is fine, but I have one suggestion.

In each place which casts char * into the structure, verify the alignment. This might be not strictly needed right now, since from what I see the pointers are malloced, but might help if the code starts mutating in future. I am not sure whether the checks should be asserts or silently return error.

Sure, that seems like a good idea. I wasn't too concerned about it because the code takes care to keep struct extattrs (and contents) 8-byte aligned -- and I don't think we require greater alignment outside of e.g. SSE/AVX values.

cem edited edge metadata.

Add correct alignment asserts when casting u_char * to struct extattr *.

sys/ufs/ffs/ffs_vnops.c
1110 ↗(On Diff #24139)

I have some doubts that the expression is the correct C. In particular, the logical ops with the pointers are not defined, AFAIR. Did you compiled the code with INVARIANTS enabled ?

cem marked an inline comment as done.

Correct alignment checks by casting through uintptr_t.

kib edited edge metadata.
This revision is now accepted and ready to land.Jan 18 2017, 5:58 PM
This revision was automatically updated to reflect the committed changes.