Пример #1
0
int
dskdv_init(void *self)
{
    struct pcidev *pci = self;
    struct dskdv *dv;
    unsigned tag;
    int n;

    tag = pci->bdf;
    for (n = 0; n < ndskdv; n++) {
        dv = &ldskdv[n];
        if ((*dv->match)(tag, NULL) > 0)
            goto found;
    }
    return 0;
found:
    pci->drv = (*dv->init)(tag, NULL);
    if (pci->drv == NULL)
        return 0;
    disk_scan(pci->drv);
    return 1;
}
Пример #2
0
int diskscan_cli(int argc, char **argv)
{
	int ret;
	options_t opts;
	memset(&opts, 0, sizeof(opts));
	opts.mode = SCAN_MODE_SEQ;

	if (parse_args(argc, argv, &opts))
		return 1;
	verbose = opts.verbose;

	print_header();

	setup_signals();

	if (disk_open(&disk, opts.disk_path, opts.fix, 70))
		return 1;

	/*
	if (print_disk_info(&disk))
		return 1;
	*/

	if (opts.data_log_raw_name)
		data_log_raw_start(&disk.data_raw, opts.data_log_raw_name, &disk);
	if (opts.data_log_name)
		data_log_start(&disk.data_log, opts.data_log_name, &disk);
	ret = 0;
	if (disk_scan(&disk, opts.mode, opts.scan_size))
		ret = 1;
	if (opts.data_log_raw_name)
		data_log_raw_end(&disk.data_raw);
	if (opts.data_log_name)
		data_log_end(&disk.data_log, &disk);

	disk_close(&disk);
	return ret;
}