diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-11-07 09:56:29 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-11-21 05:55:41 +0100 |
commit | e4429ebed2924fd75b23248719a6e0ef4f8b53c3 (patch) | |
tree | 6fe00e02584d253a6a7580ad95bd29985ff91b59 | |
parent | eece795b00d83c9816a2cc7ebb7b8aad7a37bc17 (diff) |
boot: support ds_device_get_status with flavor DEV_GET_RECORDS
* boot/boot.c (ds_device_get_status): Support flavor DEV_GET_RECORDS.
-rw-r--r-- | boot/boot.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/boot/boot.c b/boot/boot.c index a6551077..d35ce501 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -1150,18 +1150,27 @@ ds_device_get_status (device_t device, if (device == pseudo_console) return D_INVALID_OPERATION; else if (device == pseudo_root) - if (flavor == DEV_GET_SIZE) - if (*statuslen < DEV_GET_SIZE_COUNT) - return D_INVALID_SIZE; - else - { - status[DEV_GET_SIZE_DEVICE_SIZE] = root_store->size; - status[DEV_GET_SIZE_RECORD_SIZE] = root_store->block_size; - *statuslen = DEV_GET_SIZE_COUNT; - return D_SUCCESS; - } - else - return D_INVALID_OPERATION; + switch (flavor) + { + case DEV_GET_SIZE: + if (*statuslen < DEV_GET_SIZE_COUNT) + return D_INVALID_SIZE; + status[DEV_GET_SIZE_DEVICE_SIZE] = root_store->size; + status[DEV_GET_SIZE_RECORD_SIZE] = root_store->block_size; + *statuslen = DEV_GET_SIZE_COUNT; + return D_SUCCESS; + + case DEV_GET_RECORDS: + if (*statuslen < DEV_GET_RECORDS_COUNT) + return D_INVALID_SIZE; + status[DEV_GET_RECORDS_DEVICE_RECORDS] = root_store->blocks; + status[DEV_GET_RECORDS_RECORD_SIZE] = root_store->block_size; + *statuslen = DEV_GET_RECORDS_COUNT; + return D_SUCCESS; + + default: + return D_INVALID_OPERATION; + } else return D_NO_SUCH_DEVICE; } |