summaryrefslogtreecommitdiff
path: root/internal.h
AgeCommit message (Collapse)AuthorFilesLines
2011-11-03Replace global devname variable with a field in struct cmd_contextBen Hutchings1-0/+1
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-11-03Move argument parsing to sub-command functionsBen Hutchings1-1/+3
Instead of doing most of the argument parsing in parse_cmdline(), find the sub-command and (if required) the device name in main() and do the rest in the sub-command handler function. Pass argc and argp around in struct cmd_context. This also tightens up argument parsing slightly: extraneous or missing arguments will now result in an error in a few cases where they were previously ignored. All test cases now pass. Replace sub-command dispatch in doit() with a function pointer in struct option. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-11-03Add test cases for command-line parsingBen Hutchings1-0/+4
Preparation for refactoring command-line parsing. All these test cases pass. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-11-01Encapsulate command context in a structureBen Hutchings1-4/+12
Replace the fd and ifr arguments to each sub-command handler with struct cmd_context. Change send_ioctl() to take a pointer to this context and a pointer to the ethtool_cmd or other structure. Use send_ioctl() consistently. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-11-01Fix type of bit-number parameter to set_bit() and clear_bit()Ben Hutchings1-2/+2
The index must not be negative, so the parameter does not need to be signed. Division and modulus on signed operands generally cannot be optimised to right-shift and bitwise-and. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-11-01Combine ethtool-{bitops,util}.h into internal.hBen Hutchings1-0/+164
ethtool-util.h contains all kinds of declarations, not just utility functions or macros. ethtool-bitops.h contains just a few extra definitions, and its only user also includes ethtool-util.h. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>