drivers/hv/hv_debugfs.c

Source file repositories/reference/linux-study-clean/drivers/hv/hv_debugfs.c

File Facts

System
Linux kernel
Corpus path
drivers/hv/hv_debugfs.c
Extension
.c
Size
4487 bytes
Lines
179
Domain
Driver Families
Bucket
drivers/hv
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (IS_ERR(dev_root)) {
			pr_debug("debugfs_hyperv: hyperv/%s/ not created\n",
				 device);
			return PTR_ERR(dev_root);
		}
		hv_debug_set_test_state(dev, dev_root);
		hv_debug_set_dir_dentry(dev, dev_root);
		delay = debugfs_create_dir(delay_name, dev_root);

		if (IS_ERR(delay)) {
			pr_debug("debugfs_hyperv: hyperv/%s/%s/ not created\n",
				 device, delay_name);
			return PTR_ERR(delay);
		}
		ret = hv_debug_delay_files(dev, delay);

		return ret;
	}
	pr_debug("debugfs_hyperv: hyperv/ not in root debugfs path\n");
	return PTR_ERR(hv_debug_root);
}

/* Remove dentry associated with released hv device */
void hv_debug_rm_dev_dir(struct hv_device *dev)
{
	if (!IS_ERR(hv_debug_root))
		debugfs_remove_recursive(dev->debug_dir);
}

/* Remove all dentrys associated with vmbus testing */
void hv_debug_rm_all_dir(void)
{
	debugfs_remove_recursive(hv_debug_root);
}

/* Delay buffer/message reads on a vmbus channel */
void hv_debug_delay_test(struct vmbus_channel *channel, enum delay delay_type)
{
	struct vmbus_channel *test_channel =    channel->primary_channel ?
						channel->primary_channel :
						channel;
	bool state = test_channel->fuzz_testing_state;

	if (state) {
		if (delay_type == 0)
			udelay(test_channel->fuzz_testing_interrupt_delay);
		else
			udelay(test_channel->fuzz_testing_message_delay);
	}
}

/* Initialize top dentry for vmbus testing */
int hv_debug_init(void)
{
	hv_debug_root = debugfs_create_dir("hyperv", NULL);
	if (IS_ERR(hv_debug_root)) {
		pr_debug("debugfs_hyperv: hyperv/ not created\n");
		return PTR_ERR(hv_debug_root);
	}
	return 0;
}

Annotation

Implementation Notes