Robert Shearman wrote:
Mike McCormack wrote:
I think this is a little ugly. I'd prefer to see this code do a switch on obj->ops and call the relevant function with the raw object instead of a handle.
I know it's ugly; I rewrote that bit three times, including once with an ops->signal() method. Implementing a object operation requires that the 3 operations are consistent. For example, the access flags required to perform must be consistent, so the get_handle_obj can be done only once. Unfortunately, semaphores and event flags require different permissions to execute ops->signal().
Ok, I see the problem now. The only alternative I can think of is to try to open the object with the GENERIC_WRITE access right and implement generic mappings for each object (these mappings are really needed anyway for other situaitons).
Actually, I just thought about one more solution. You could open the object with using an access right of 0, meaning that anything is accepted, then check the access right manually. Still a bit of a kludge, but I think it is better than the brute force chaining.
Rob