def print_table(self, ioctls):
     print "%-10s | %-10s | %-42s | %-10s | %-22s | %s" % ("Address", "IOCTL Code", "Device", "Function", "Method", "Access")
     for addr, ioctl_code in ioctls:
         function = ioctl_decoder.get_function(ioctl_code)
         device_name, device_code = ioctl_decoder.get_device(ioctl_code)
         method_name, method_code = ioctl_decoder.get_method(ioctl_code)
         access_name, access_code = ioctl_decoder.get_access(ioctl_code)
         all_vars = (addr, ioctl_code, device_name, device_code, function, method_name, method_code, access_name, access_code)
         print "0x%-8X | 0x%-8X | %-31s 0x%-8X | 0x%-8X | %-17s %-4d | %s (%d)" % all_vars
def get_all_defines():
    """Returns the C defines for all ICOTL codes which have been marked during the current session"""

    global ioctl_tracker
    defines = []
    for (addr, value) in ioctl_tracker.ioctls:
        function = ioctl_decoder.get_function(value)
        device_name, device_code = ioctl_decoder.get_device(value)
        method_name, method_code = ioctl_decoder.get_method(value)
        access_name, access_code = ioctl_decoder.get_access(value)
        define = ioctl_decoder.get_define(value)
        defines.append([
            "0x%X" % (addr, ),
            "0x%X" % (function, ),
            "%s (0x%X)" % (device_name, device_code),
            "%s (0x%X)" % (method_name, method_code),
            "%s (0x%X)" % (access_name, access_code), define
        ])
    return defines