I have a nice kernel programming assignment involving a novel kernel locking method, and my group and I have chosen to implement it as a wrapper around a completion. However, the specification requires that we return the number of processes notified by our method, which involved returning the number of processes awoken by complete_all in our implementation.
How do we get that number? It would seem that it is enough to lock the completion with its internal spinlock, count the number of elements, and then unlock it. This method is preempt-safe because our functions are the only ones to have access to the particular completion in question.
So then, the question is: is struct completion opaque? If it is, would it be acceptable to, for the sake of getting our homework done in time for midterm season, ignore that opaqueness? Or, is there a means of doing this without hacks?