]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r266814
authortruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Jul 2014 16:00:57 +0000 (16:00 +0000)
committertruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Jul 2014 16:00:57 +0000 (16:00 +0000)
commit4ec42b0410904a7d446e61259a7f52a55222706d
tree40110dc58f32c01cc887e1c6e81e32871c7c7ece
parentfc67decf2e6f1df4d517bbacd7b5ec3b64026326
MFC r266814

Initialize r_flags the same way in all cases using a sanitized copy of
flags that has several bits cleared. The RF_WANTED and RF_FIRSTSHARE
bits are invalid in this context, and we want to defer setting RF_ACTIVE
in r_flags until later.  This should make rman_get_flags() return
the correct answer in all cases.

Add a KASSERT() to catch callers which incorrectly pass the RF_WANTED
or RF_FIRSTSHARE flags.

Do a strict equality check on the share type bits of flags.  In
particular, do an equality check on RF_PREFETCHABLE.  The previous
code would allow one type of mismatch of RF_PREFETCHABLE but disallow
the other type of mismatch.  Also, ignore the the RF_ALIGNMENT_MASK
bits since alignment validity should be handled by the amask check.
This field contains an integer value, but previous code did a strange
bitwise comparison on it.

Leave the original value of flags unmolested as a minor debug aid.

Change the start+amask overflow check to a KASSERT() since it is just
meant to catch a highly unlikely programming error in the caller.

Reviewed by: jhb

git-svn-id: svn://svn.freebsd.org/base/stable/9@268217 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/kern/subr_rman.c