Page MenuHomeFreeBSD

ctl: Add CTL_IO_ASSERT wrapper macro
Needs ReviewPublic

Authored by jhb on Thu, Apr 18, 5:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 27, 8:22 AM
Unknown Object (File)
Fri, Apr 26, 9:53 AM
Unknown Object (File)
Fri, Apr 26, 9:45 AM
Unknown Object (File)
Fri, Apr 26, 6:07 AM
Unknown Object (File)
Fri, Apr 26, 2:29 AM
Unknown Object (File)
Sat, Apr 20, 6:02 PM
Unknown Object (File)
Sat, Apr 20, 12:04 AM
Unknown Object (File)
Fri, Apr 19, 4:49 PM
Subscribers
None

Details

Reviewers
imp
ken
Group Reviewers
cam
Summary

Currently, this pattern is commonly used to assert that a union ctl_io
is a SCSI request. In the future it will be used to assert other
types.

Suggested by: imp
Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 57504
Build 54392: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Thu, Apr 18, 5:45 PM
sys/cam/ctl/ctl_io.h
595

I also added a CTL_IO_ASSERT_NVME(io) that I use later in this series.

However, I still end up with a few places that want to assert the io_type is 2 different types (e.g. NVME or NVME_ADMIN, or NVME or SCSI). I wonder if it makes sense to get a bit fancy and instead add a couple of helper macros that take a VA_ARGS number of types so you can say something like:

CTL_IO_ASSERT_TYPE(SCSI);
CTL_IO_ASSERT_TYPE(NVME);
CTL_IO_ASSERT_TYPE(SCSI, NVME);

Where the last one asserts that the type is either SCSI or NVME. Under the hood there would be a CTL_IO_ASSERT_TYPE_1 and CTL_IO_ASSERT_TYPE_2 and CTL_IO_ASSERT would pick the right backing macro based on the number of arguments passed similar to how CTR maps to CTRn.

imp added inline comments.
sys/cam/ctl/ctl_io.h
595

It would be cool if we could...

This revision is now accepted and ready to land.Fri, Apr 19, 2:10 AM
jhb retitled this revision from ctl: Add CTL_IO_ASSERT_SCSI wrapper macro to ctl: Add CTL_IO_ASSERT wrapper macro.Wed, May 1, 8:27 PM
jhb edited the summary of this revision. (Show Details)

Rework macro to allow for one or more types as var-args

This revision now requires review to proceed.Wed, May 1, 8:28 PM