[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH hurd 7/9] boot: support ds_device_get_status with flavor DEV_GET_
From: |
Justus Winter |
Subject: |
[PATCH hurd 7/9] boot: support ds_device_get_status with flavor DEV_GET_RECORDS |
Date: |
Fri, 7 Nov 2014 17:32:00 +0100 |
* boot/boot.c (ds_device_get_status): Support flavor DEV_GET_RECORDS.
---
boot/boot.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/boot/boot.c b/boot/boot.c
index a655107..d35ce50 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;
}
--
2.1.1
- [PATCH hurd 2/9] proc: gracefully handle failure to increase priority, (continued)
- [PATCH hurd 2/9] proc: gracefully handle failure to increase priority, Justus Winter, 2014/11/07
- [PATCH hurd 3/9] startup: also open `console' for reading, Justus Winter, 2014/11/07
- [PATCH hurd 4/9] boot: drop bootstrap compat code, Justus Winter, 2014/11/07
- [PATCH hurd 5/9] boot: remove unused function `boot_script_read_file', Justus Winter, 2014/11/07
- [PATCH hurd 6/9] boot: drop obsolete device procedures, Justus Winter, 2014/11/07
- [PATCH hurd 7/9] boot: support ds_device_get_status with flavor DEV_GET_RECORDS,
Justus Winter <=
- [PATCH hurd 8/9] boot: implement pseudo-time device, Justus Winter, 2014/11/07
- [PATCH hurd 9/9] boot: improve the demuxer, Justus Winter, 2014/11/07
- Re: [PATCH hurd 1/9] Makeconf: handle the gnumach protocol, Samuel Thibault, 2014/11/20