poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ios: Synch IOD error values with IOS error values.


From: Egeyar Bagcioglu
Subject: Re: [PATCH] ios: Synch IOD error values with IOS error values.
Date: Mon, 26 Oct 2020 21:57:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

Hello!

On 10/26/20 5:15 PM, Jose E. Marchesi wrote:
Hi Ege.
Thanks for the patch.

Please review the attached patch. The ChangeLog is within the patch.

Regards,
Ege

commit 68f48fecfdb132ecf9f993c25b35a384f236fc9c
Author: Egeyar Bagcioglu <egeyar@gmail.com>
Date:   Sun Oct 25 22:18:51 2020 +0100

     ios: Synch IOD error values with IOS error values.
2020-10-25 Egeyar Bagcioglu <egeyar@gmail.com> * libpoke/ios-dev.h: Add IOD_OK, IOD_EIOFF, IOD_EFLAGS and IOD_ENOMEM.
             Change the values of IOD_EOF and IOD_EINVAL.
             * libpoke/ios.h: Add IOS_EOF and IOS_EINVAL. Define
             IOD_ERROR_TO_IOS_ERROR.

diff --git a/ChangeLog b/ChangeLog
index 92a4cd25..95da9548 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-10-25  Egeyar Bagcioglu  <egeyar@gmail.com>
+
+       * libpoke/ios-dev.h: Add IOD_OK, IOD_EIOFF, IOD_EFLAGS and IOD_ENOMEM.
+       Change the values of IOD_EOF and IOD_EINVAL.
+       * libpoke/ios.h: Add IOS_EOF and IOS_EINVAL. Define
+       IOD_ERROR_TO_IOS_ERROR.
+
  2020-10-25  Jose E. Marchesi  <jemarch@gnu.org>
* libpoke/pvm.h: Rename pvm_type_equal to pvm_type_equal_p.
diff --git a/libpoke/ios-dev.h b/libpoke/ios-dev.h
index 722571ee..2a7cc1b5 100644
--- a/libpoke/ios-dev.h
+++ b/libpoke/ios-dev.h
@@ -34,9 +34,14 @@ typedef uint64_t ios_dev_off;
/* Error codes to be used in the interface below. */ -#define IOD_ERROR -1 /* Generic error. */
-#define IOD_EOF    -2
-#define IOD_EINVAL -3 /* Invalid argument.  */
+#define IOD_OK      0 /* The operation was performed to completion,
+                         in the expected way.  */
+#define IOD_ERROR  -1 /* Generic error.  */
+#define IOD_EIOFF  -2 /* The provided offset is invalid.  */

+#define IOD_EFLAGS -3 /* Invalid flags specified.  */
+#define IOD_ENOMEM -4 /* Memory allocation failure.  */
+#define IOD_EOF    -5 /* End of file / input.  */
+#define IOD_EINVAL -6 /* Invalid argument.  */
Do we need both IOD_EIOFF and IOD_EOF?

We want to keep EIOFF. We do not want to use EOF for past indices of write streams, for example.
Do you prefer to use EIOFF for end of file as well?

A similar question is "do we keep both EINVAL and EFLAGS?" Wdyt?

  /* Each IO backend should implement a device interface, by filling an
     instance of the struct defined below.  */
diff --git a/libpoke/ios.h b/libpoke/ios.h
index 2f5973bf..f58c082e 100644
--- a/libpoke/ios.h
+++ b/libpoke/ios.h
@@ -89,13 +89,19 @@ typedef int64_t ios_off;
  /* The following status codes are used in the several APIs defined
     below in the file.  */
-#define IOS_OK 0 /* The operation was performed to completion, in
-                          the expected way.  */
+#define IOS_OK      0  /* The operation was performed to completion,
+                          in the expected way.  */
Weird indentation there..

It looks pretty good to me. What's your preferred indentation? Or do you prefer no indentation?


-#define IOS_ERROR -1   /* An unspecified error condition happened.  */
+#define IOS_ERROR  -1  /* An unspecified error condition happened.  */
#define IOS_ENOMEM -4 /* Memory allocation failure. */ +#define IOS_EOF -5 /* End of file / input. */
+
+#define IOS_EINVAL -6  /* Invalid argument.  */
+
+#define IOD_ERROR_TO_IOS_ERROR(error_no) (error_no)
+
  /* **************** IOS flags ******************************
The 64-bit unsigned flags associated with IO spaces have the




reply via email to

[Prev in Thread] Current Thread [Next in Thread]