On 25/04/14 17:57, Steven Rostedt wrote:
- KDB_ENABLE_ALL_NO_ARGS = KDB_ENABLE_ALL << 16,
- KDB_ENABLE_MEM_READ_NO_ARGS = KDB_ENABLE_MEM_READ << 16,
- KDB_ENABLE_MEM_WRITE_NO_ARGS = KDB_ENABLE_MEM_WRITE << 16,
- KDB_ENABLE_REG_READ_NO_ARGS = KDB_ENABLE_REG_READ << 16,
- KDB_ENABLE_REG_WRITE_NO_ARGS = KDB_ENABLE_REG_WRITE << 16,
- KDB_ENABLE_INSPECT_NO_ARGS = KDB_ENABLE_INSPECT << 16,
- KDB_ENABLE_FLOW_CTRL_NO_ARGS = KDB_ENABLE_FLOW_CTRL << 16,
- KDB_ENABLE_SIGNAL_NO_ARGS = KDB_ENABLE_SIGNAL << 16,
- KDB_ENABLE_REBOOT_NO_ARGS = KDB_ENABLE_REBOOT << 16,
- KDB_ENABLE_ALWAYS_SAFE_NO_ARGS = KDB_ENABLE_ALWAYS_SAFE << 16,
- KDB_ENABLE_MASK_NO_ARGS = KDB_ENABLE_MASK << 16,
I would recommend defining a KDB_NO_ARGS_SHIFT to be 16 and use that instead of having a magic number 16 to deal with. This also makes it easier if you need to shift a bit more in the future.
KDB_ENABLE_ALL_NO_ARGS = KDB_ENABLE_ALL << KDB_NO_ARGS_SHIFT,
Good point. I will fix this (and reduce KDB_NO_ARGS_SHIFT to the proper value).
Although, I'm not sure why you just didn't have a KDB_ENABLE_ARGS flag, and then you don't need to repeat all the flags again. Seems rather silly.
KDB_ENABLE_ALL_NO_ARGS would then be just KDB_ENABLE_ALL|KDB_ENABLE_NO_ARGS.
Or can you have multiple settings? That is, MEM_READ and MEM_WRITE_NO_ARGS both set such that you can't just have a simple args or no args command for the entire flags?
That's basically it. Some commands change classification if they have an argument ('go' is the best example; it changes from always-safe to register-write because if an argument is given it gets copied to the PC).
Actually only two of the _NO_ARGS values are currently used, however having a shift relationship between the flags makes it much simpler to do the permissions check.
Daniel.