[ 
https://issues.apache.org/jira/browse/HADOOP-7824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14635814#comment-14635814
 ] 

Colin Patrick McCabe commented on HADOOP-7824:
----------------------------------------------

Thanks for posting this, [~martinw].  It looks like a big improvement.

Rather than having stuff like this:
{code}
64      typedef enum {
65        CT_BOOL = 1,
66        CT_INT,
67        CT_LONG,
68      } const_type;
69      
70      struct field {
71        char *name;
72        const_type type;
73        union {
74          jboolean bool_val;
75          jint int_val;
76          jlong long_val;
77        } value;
78      };
{code}

Why not just have three functions:
{code}
jthrowable setIntConstant(const char *name, jint val);
jthrowable setLongConstant(const char *name, jlong val);
jthrowable setBooleanConstant(const char *name, jboolean val);
{code}

Then you could have:
{code}
jthr = setIntConstant("O_RDONLY", O_RDONLY);
if (jthr != null) {
  return;
}
jthr = setBooleanConstant("fadvisePossible", HAVE_POSIX_FADVISE);
if (jthr != null) {
  return;
}
...
{code}

This would be a lot simpler than coming up with all those structures.

> Native IO uses wrong constants almost everywhere
> ------------------------------------------------
>
>                 Key: HADOOP-7824
>                 URL: https://issues.apache.org/jira/browse/HADOOP-7824
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: native
>    Affects Versions: 0.20.204.0, 0.20.205.0, 1.0.3, 0.23.0, 2.0.0-alpha, 3.0.0
>         Environment: Mac OS X, Linux, Solaris, Windows, ... 
>            Reporter: Dmytro Shteflyuk
>            Assignee: Martin Walsh
>              Labels: hadoop
>         Attachments: HADOOP-7824.001.patch, HADOOP-7824.patch, 
> HADOOP-7824.patch, hadoop-7824.txt
>
>
> Constants like O_CREAT, O_EXCL, etc. have different values on OS X and many 
> other operating systems.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to