static void dasd_stats_all_block_reset(void)
{
	int i;
	struct dasd_device *device;

	for (i = 0; i < dasd_max_devindex; ++i) {
		device = dasd_device_from_devindex(i);
		if (IS_ERR(device))
			continue;
		if (device->block)
			dasd_profile_reset(&device->block->profile);
		dasd_put_device(device);
	}
}
static int dasd_stats_all_block_on(void)
{
	int i, rc;
	struct dasd_device *device;

	rc = 0;
	for (i = 0; i < dasd_max_devindex; ++i) {
		device = dasd_device_from_devindex(i);
		if (IS_ERR(device))
			continue;
		if (device->block)
			rc = dasd_profile_on(&device->block->profile);
		dasd_put_device(device);
		if (rc)
			return rc;
	}
	return 0;
}
Esempio n. 3
0
static int
dasd_devices_show(struct seq_file *m, void *v)
{
    struct dasd_device *device;
    struct dasd_block *block;
    char *substr;

    device = dasd_device_from_devindex((unsigned long) v - 1);
    if (IS_ERR(device))
        return 0;
    if (device->block)
        block = device->block;
    else {
        dasd_put_device(device);
        return 0;
    }
    /* Print device number. */
    seq_printf(m, "%s", dev_name(&device->cdev->dev));
    /* Print discipline string. */
    if (device != NULL && device->discipline != NULL)
        seq_printf(m, "(%s)", device->discipline->name);
    else
        seq_printf(m, "(none)");
    /* Print kdev. */
    if (block->gdp)
        seq_printf(m, " at (%3d:%6d)",
                   MAJOR(disk_devt(block->gdp)),
                   MINOR(disk_devt(block->gdp)));
    else
        seq_printf(m, "  at (???:??????)");
    /* Print device name. */
    if (block->gdp)
        seq_printf(m, " is %-8s", block->gdp->disk_name);
    else
        seq_printf(m, " is ????????");
    /* Print devices features. */
    substr = (device->features & DASD_FEATURE_READONLY) ? "(ro)" : " ";
    seq_printf(m, "%4s: ", substr);
    /* Print device status information. */
    switch ((device != NULL) ? device->state : -1) {
    case -1:
        seq_printf(m, "unknown");
        break;
    case DASD_STATE_NEW:
        seq_printf(m, "new");
        break;
    case DASD_STATE_KNOWN:
        seq_printf(m, "detected");
        break;
    case DASD_STATE_BASIC:
        seq_printf(m, "basic");
        break;
    case DASD_STATE_UNFMT:
        seq_printf(m, "unformatted");
        break;
    case DASD_STATE_READY:
    case DASD_STATE_ONLINE:
        seq_printf(m, "active ");
        if (dasd_check_blocksize(block->bp_block))
            seq_printf(m, "n/f	 ");
        else
            seq_printf(m,
                       "at blocksize: %d, %ld blocks, %ld MB",
                       block->bp_block, block->blocks,
                       ((block->bp_block >> 9) *
                        block->blocks) >> 11);
        break;
    default:
        seq_printf(m, "no stat");
        break;
    }
    dasd_put_device(device);
    if (dasd_probeonly)
        seq_printf(m, "(probeonly)");
    seq_printf(m, "\n");
    return 0;
}
Esempio n. 4
0
static int
dasd_devices_show(struct seq_file *m, void *v)
{
	struct dasd_device *device;
	char *substr;

	device = dasd_device_from_devindex((unsigned long) v - 1);
	if (IS_ERR(device))
		return 0;
	/* Print device number. */
	seq_printf(m, "%s", device->cdev->dev.bus_id);
	/* Print discipline string. */
	if (device != NULL && device->discipline != NULL)
		seq_printf(m, "(%s)", device->discipline->name);
	else
		seq_printf(m, "(none)");
	/* Print kdev. */
	if (device->gdp)
		seq_printf(m, " at (%3d:%6d)",
			   device->gdp->major, device->gdp->first_minor);
	else
		seq_printf(m, "  at (???:??????)");
	/* Print device name. */
	if (device->gdp)
		seq_printf(m, " is %-8s", device->gdp->disk_name);
	else
		seq_printf(m, " is ????????");
	/* Print devices features. */
	substr = test_bit(DASD_FLAG_RO, &device->flags) ? "(ro)" : " ";
	seq_printf(m, "%4s: ", substr);
	/* Print device status information. */
	switch ((device != NULL) ? device->state : -1) {
	case -1:
		seq_printf(m, "unknown");
		break;
	case DASD_STATE_NEW:
		seq_printf(m, "new");
		break;
	case DASD_STATE_KNOWN:
		seq_printf(m, "detected");
		break;
	case DASD_STATE_BASIC:
		seq_printf(m, "basic");
		break;
	case DASD_STATE_READY:
	case DASD_STATE_ONLINE:
		seq_printf(m, "active ");
		if (dasd_check_blocksize(device->bp_block))
			seq_printf(m, "n/f	 ");
		else
			seq_printf(m,
				   "at blocksize: %d, %ld blocks, %ld MB",
				   device->bp_block, device->blocks,
				   ((device->bp_block >> 9) *
				    device->blocks) >> 11);
		break;
	default:
		seq_printf(m, "no stat");
		break;
	}
	dasd_put_device(device);
	if (dasd_probeonly)
		seq_printf(m, "(probeonly)");
	seq_printf(m, "\n");
	return 0;
}