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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
byteswap.hendian.hfcntl.hlinux/firewire-constants.hpoll.hpopt.hsignal.hstdio.hstdlib.hstring.hsys/ioctl.hsys/time.htermios.hunistd.hlist.hnosy-dump.hnosy-user.h
Detected Declarations
struct protocol_decoderstruct packet_infostruct packet_fieldfunction sigint_handlerfunction subaction_createfunction subaction_destroyfunction link_transaction_lookupfunction list_for_each_entryfunction link_transaction_destroyfunction handle_transactionfunction clear_pending_transaction_listfunction handle_request_packetfunction handle_response_packetfunction handle_packetfunction get_bitsfunction dump_datafunction decode_link_packetfunction print_packetfunction print_statsfunction reset_input_modefunction set_input_modefunction main
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
- Immediate include surface: `byteswap.h`, `endian.h`, `fcntl.h`, `linux/firewire-constants.h`, `poll.h`, `popt.h`, `signal.h`, `stdio.h`.
- Detected declarations: `struct protocol_decoder`, `struct packet_info`, `struct packet_field`, `function sigint_handler`, `function subaction_create`, `function subaction_destroy`, `function link_transaction_lookup`, `function list_for_each_entry`, `function link_transaction_destroy`, `function handle_transaction`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.