From 923aa48126259c13de95131203f1d28bfa5cb889 Mon Sep 17 00:00:00 2001 From: Rafal Jaworowski Date: Fri, 23 Jan 2009 13:27:18 +0100 Subject: API: Improve glue mid-layer of the API demo application. - Extend ub_dev_read() and ub_dev_recv() so they return the length actually read, which allows for better control and error handling (this introduces additional error code API_ESYSC returned by the glue mid-layer). - Clean up definitions naming and usage. - Other minor cosmetics. Note these changes do not touch the API proper, so the interface between U-Boot and standalone applications remains unchanged. Signed-off-by: Rafal Jaworowski --- api_examples/demo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'api_examples/demo.c') diff --git a/api_examples/demo.c b/api_examples/demo.c index 2510ed8866..df9c4bd8bc 100644 --- a/api_examples/demo.c +++ b/api_examples/demo.c @@ -43,12 +43,11 @@ static char buf[BUF_SZ]; int main(int argc, char *argv[]) { - int rv = 0; - int h, i, j; - int devs_no; + int rv = 0, h, i, j, devs_no; struct api_signature *sig = NULL; ulong start, now; struct device_info *di; + lbasize_t rlen; if (!api_search_sig(&sig)) return -1; @@ -96,7 +95,6 @@ int main(int argc, char *argv[]) if (devs_no == 0) return -1; - printf("\n*** Show devices ***\n"); for (i = 0; i < devs_no; i++) { test_dump_di(i); @@ -133,7 +131,7 @@ int main(int argc, char *argv[]) if ((rv = ub_dev_open(i)) != 0) errf("open device %d error %d\n", i, rv); - else if ((rv = ub_dev_read(i, buf, 1, 0)) != 0) + else if ((rv = ub_dev_read(i, buf, 1, 0, &rlen)) != 0) errf("could not read from device %d, error %d\n", i, rv); else { printf("Sector 0 dump (512B):\n"); -- cgit v1.2.3