tools/firewire/nosy-dump.c

Source file repositories/reference/linux-study-clean/tools/firewire/nosy-dump.c

File Facts

System
Linux kernel
Corpus path
tools/firewire/nosy-dump.c
Extension
.c
Size
25064 bytes
Lines
1023
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct protocol_decoder {
	const char *name;
	int (*decode)(struct link_transaction *t);
};

static const struct protocol_decoder protocol_decoders[] = {
	{ "FCP", decode_fcp }
};

static void
handle_transaction(struct link_transaction *t)
{
	struct subaction *sa;
	int i;

	if (!t->request) {
		printf("BUG in handle_transaction\n");
		return;
	}

	for (i = 0; i < array_length(protocol_decoders); i++)
		if (protocol_decoders[i].decode(t))
			break;

	/* HACK: decode only fcp right now. */
	return;

	decode_link_packet(&t->request->packet, t->request->length,
			   PACKET_FIELD_TRANSACTION, 0);
	if (t->response)
		decode_link_packet(&t->response->packet, t->request->length,
				   PACKET_FIELD_TRANSACTION, 0);
	else
		printf("[no response]");

	if (option_verbose) {
		list_for_each_entry(sa, &t->request_list, link)
			print_packet((uint32_t *) &sa->packet, sa->length);
		list_for_each_entry(sa, &t->response_list, link)
			print_packet((uint32_t *) &sa->packet, sa->length);
	}
	printf("\r\n");

	link_transaction_destroy(t);
}

static void
clear_pending_transaction_list(void)
{
	struct link_transaction *t;

	while (!list_empty(&pending_transaction_list)) {
		t = list_head(&pending_transaction_list,
			      struct link_transaction, link);
		list_remove(&t->link);
		link_transaction_destroy(t);
		/* print unfinished transactions */
	}
}

static const char * const tcode_names[] = {
	[0x0] = "write_quadlet_request",	[0x6] = "read_quadlet_response",
	[0x1] = "write_block_request",		[0x7] = "read_block_response",
	[0x2] = "write_response",		[0x8] = "cycle_start",
	[0x3] = "reserved",			[0x9] = "lock_request",
	[0x4] = "read_quadlet_request",		[0xa] = "iso_data",
	[0x5] = "read_block_request",		[0xb] = "lock_response",
};

static const char * const ack_names[] = {
	[0x0] = "no ack",			[0x8] = "reserved (0x08)",
	[0x1] = "ack_complete",			[0x9] = "reserved (0x09)",
	[0x2] = "ack_pending",			[0xa] = "reserved (0x0a)",
	[0x3] = "reserved (0x03)",		[0xb] = "reserved (0x0b)",
	[0x4] = "ack_busy_x",			[0xc] = "reserved (0x0c)",
	[0x5] = "ack_busy_a",			[0xd] = "ack_data_error",
	[0x6] = "ack_busy_b",			[0xe] = "ack_type_error",
	[0x7] = "reserved (0x07)",		[0xf] = "reserved (0x0f)",
};

static const char * const rcode_names[] = {
	[0x0] = "complete",			[0x4] = "conflict_error",
	[0x1] = "reserved (0x01)",		[0x5] = "data_error",
	[0x2] = "reserved (0x02)",		[0x6] = "type_error",
	[0x3] = "reserved (0x03)",		[0x7] = "address_error",
};

static const char * const retry_names[] = {
	[0x0] = "retry_1",
	[0x1] = "retry_x",

Annotation

Implementation Notes