Commit 7e26fe1f authored by Juan Castillo's avatar Juan Castillo Committed by Juan Castillo
Browse files

IO Framework: use standard errno codes as return values

This patch redefines the values of IO_FAIL, IO_NOT_SUPPORTED and
IO_RESOURCES_EXHAUSTED to match the corresponding definitions in
errno.h:

    #define IO_FAIL                     (-ENOENT)
    #define IO_NOT_SUPPORTED            (-ENODEV)
    #define IO_RESOURCES_EXHAUSTED      (-ENOMEM)

NOTE: please note that the IO_FAIL, IO_NOT_SUPPORTED and
IO_RESOURCES_EXHAUSTED definitions are considered deprecated
and their usage should be avoided. Callers should rely on errno.h
definitions when checking the return values of IO functions.

Change-Id: Ic8491aa43384b6ee44951ebfc053a3ded16a80be
Showing with 9 additions and 7 deletions
+9 -7
...@@ -358,13 +358,12 @@ must also be defined: ...@@ -358,13 +358,12 @@ must also be defined:
Defines the maximum number of registered IO devices. Attempting to register Defines the maximum number of registered IO devices. Attempting to register
more devices than this value using `io_register_device()` will fail with more devices than this value using `io_register_device()` will fail with
IO_RESOURCES_EXHAUSTED. -ENOMEM.
* **#define : MAX_IO_HANDLES** * **#define : MAX_IO_HANDLES**
Defines the maximum number of open IO handles. Attempting to open more IO Defines the maximum number of open IO handles. Attempting to open more IO
entities than this value using `io_open()` will fail with entities than this value using `io_open()` will fail with -ENOMEM.
IO_RESOURCES_EXHAUSTED.
If the platform needs to allocate data within the per-cpu data framework in If the platform needs to allocate data within the per-cpu data framework in
BL3-1, it should define the following macro. Currently this is only required if BL3-1, it should define the following macro. Currently this is only required if
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#ifndef __IO_H__ #ifndef __IO_H__
#define __IO_H__ #define __IO_H__
#include <errno.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> /* For ssize_t */ #include <stdio.h> /* For ssize_t */
#include <uuid.h> #include <uuid.h>
...@@ -88,11 +89,13 @@ typedef struct io_block_spec { ...@@ -88,11 +89,13 @@ typedef struct io_block_spec {
#define IO_MODE_RW (1 << 1) #define IO_MODE_RW (1 << 1)
/* Return codes reported by 'io_*' APIs */ /* Return codes reported by 'io_*' APIs.
* IMPORTANT: these definitions are deprecated. Callers should use standard
* errno definitions when checking the return value of io_* APIs. */
#define IO_SUCCESS (0) #define IO_SUCCESS (0)
#define IO_FAIL (-1) #define IO_FAIL (-ENOENT)
#define IO_NOT_SUPPORTED (-2) #define IO_NOT_SUPPORTED (-ENODEV)
#define IO_RESOURCES_EXHAUSTED (-3) #define IO_RESOURCES_EXHAUSTED (-ENOMEM)
/* Open a connection to a device */ /* Open a connection to a device */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment