block/partitions/acorn.c

Source file repositories/reference/linux-study-clean/block/partitions/acorn.c

File Facts

System
Linux kernel
Corpus path
block/partitions/acorn.c
Extension
.c
Size
12103 bytes
Lines
548
Domain
Representative Device Path
Bucket
PCIe NVMe Storage Path
Inferred role
Representative Device Path: implementation source
Status
source implementation candidate

Why This File Exists

Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.

Dependency Surface

Detected Declarations

Annotated Snippet

struct riscix_part {
	__le32	start;
	__le32	length;
	__le32	one;
	char	name[16];
};

struct riscix_record {
	__le32	magic;
#define RISCIX_MAGIC	cpu_to_le32(0x4a657320)
	__le32	date;
	struct riscix_part part[8];
};

#if defined(CONFIG_ACORN_PARTITION_CUMANA) || \
	defined(CONFIG_ACORN_PARTITION_ADFS)
static int riscix_partition(struct parsed_partitions *state,
			    unsigned long first_sect, int slot,
			    unsigned long nr_sects)
{
	Sector sect;
	struct riscix_record *rr;
	
	rr = read_part_sector(state, first_sect, &sect);
	if (!rr)
		return -1;

	seq_buf_puts(&state->pp_buf, " [RISCiX]");


	if (rr->magic == RISCIX_MAGIC) {
		unsigned long size = min(nr_sects, 2);
		int part;

		seq_buf_puts(&state->pp_buf, " <");

		put_partition(state, slot++, first_sect, size);
		for (part = 0; part < 8; part++) {
			if (rr->part[part].one &&
			    memcmp(rr->part[part].name, "All\0", 4)) {
				put_partition(state, slot++,
					le32_to_cpu(rr->part[part].start),
					le32_to_cpu(rr->part[part].length));
				seq_buf_printf(&state->pp_buf, "(%s)", rr->part[part].name);
			}
		}

		seq_buf_puts(&state->pp_buf, " >\n");
	} else {
		put_partition(state, slot++, first_sect, nr_sects);
	}

	put_dev_sector(sect);
	return slot;
}
#endif
#endif

#define LINUX_NATIVE_MAGIC 0xdeafa1de
#define LINUX_SWAP_MAGIC   0xdeafab1e

struct linux_part {
	__le32 magic;
	__le32 start_sect;
	__le32 nr_sects;
};

#if defined(CONFIG_ACORN_PARTITION_CUMANA) || \
	defined(CONFIG_ACORN_PARTITION_ADFS)
static int linux_partition(struct parsed_partitions *state,
			   unsigned long first_sect, int slot,
			   unsigned long nr_sects)
{
	Sector sect;
	struct linux_part *linuxp;
	unsigned long size = min(nr_sects, 2);

	seq_buf_puts(&state->pp_buf, " [Linux]");

	put_partition(state, slot++, first_sect, size);

	linuxp = read_part_sector(state, first_sect, &sect);
	if (!linuxp)
		return -1;

	seq_buf_puts(&state->pp_buf, " <");
	while (linuxp->magic == cpu_to_le32(LINUX_NATIVE_MAGIC) ||
	       linuxp->magic == cpu_to_le32(LINUX_SWAP_MAGIC)) {
		if (slot == state->limit)
			break;

Annotation

Implementation Notes