diff options
author | Marcus Brinkmann <marcus@gnu.org> | 2001-01-09 03:20:39 +0000 |
---|---|---|
committer | Marcus Brinkmann <marcus@gnu.org> | 2001-01-09 03:20:39 +0000 |
commit | fc67fa5f1239e49d5c86cc1bed3b53f1ef4a6f74 (patch) | |
tree | e06e022c9010078c645e4149ec796eff58115709 /linux/dev | |
parent | cadc821bbcdfb11bf7e1148727ad77485ad16372 (diff) |
2001-01-09 Marcus Brinkmann <marcus@gnu.org>
* include/device/device_types.h: New get_status call
DEV_GET_RECORDS to get the number of records of a device (rather
than the number of bytes). Accordingly define
DEV_GET_RECORDS_DEVICE_RECORDS, DEV_GET_RECORDS_RECORD_SIZE and
DEV_GET_RECORDS_COUNT.
* linux/dev/glue/block.c (device_get_status): Handle
DEV_GET_RECORDS.
Diffstat (limited to 'linux/dev')
-rw-r--r-- | linux/dev/glue/block.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/linux/dev/glue/block.c b/linux/dev/glue/block.c index c450ea4..f6506ee 100644 --- a/linux/dev/glue/block.c +++ b/linux/dev/glue/block.c @@ -1632,6 +1632,42 @@ device_get_status (void *d, dev_flavor_t flavor, dev_status_t status, *status_count = DEV_GET_SIZE_COUNT; break; + case DEV_GET_RECORDS: + if (disk_major (MAJOR (bd->dev))) + { + assert (bd->ds->gd); + + if (bd->part >= 0) + { + struct disklabel *lp; + + assert (bd->ds->labels); + lp = bd->ds->labels[MINOR (bd->dev)]; + assert (lp); + (status[DEV_GET_RECORDS_DEVICE_RECORDS] + = lp->d_partitions[bd->part].p_size); + } + else + (status[DEV_GET_RECORDS_DEVICE_RECORDS] + = bd->ds->gd->part[MINOR (bd->dev)].nr_sects); + + status[DEV_GET_RECORDS_RECORD_SIZE] = 512; + } + else + { + assert (blk_size[MAJOR (bd->dev)]); + (status[DEV_GET_RECORDS_DEVICE_RECORDS] + = blk_size[MAJOR (bd->dev)][MINOR (bd->dev)]); + status[DEV_GET_RECORDS_RECORD_SIZE] = BLOCK_SIZE; + } + /* Always return DEV_GET_RECORDS_COUNT. This is what all native + Mach drivers do, and makes it possible to detect the absence + of the call by setting it to a different value on input. MiG + makes sure that we will never return more integers than the + user asked for. */ + *status_count = DEV_GET_RECORDS_COUNT; + break; + case V_GETPARMS: if (*status_count < (sizeof (struct disk_parms) / sizeof (int))) return D_INVALID_OPERATION; |