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

Colin Patrick McCabe commented on HDFS-7047:
--------------------------------------------

This is a more challenging JIRA than what you were probably bargaining for, 
since the {{hdfsFileInfo}} struct has a fixed size that can't be changed.  Here 
is its definition:
{code}
    /** 
     * hdfsFileInfo - Information about a file/directory.
     */
    typedef struct  {
        tObjectKind mKind;   /* file or directory */
        char *mName;         /* the name of the file */
        tTime mLastMod;      /* the last modification time for the file in 
seconds */
        tOffset mSize;       /* the size of the file in bytes */
        short mReplication;    /* the count of replicas */
        tOffset mBlockSize;  /* the block size for the file */
        char *mOwner;        /* the owner of the file */
        char *mGroup;        /* the group associated with the file */
        short mPermissions;  /* the permissions associated with the file */
        tTime mLastAccess;    /* the last access time for the file in seconds */
    } hdfsFileInfo;
{code}

Unfortunately, it is not possible to add fields to the end, because we return a 
packed array of these structures from {{hdfsListDirectory}}.  It was a bad 
design choice (if we returned an array of pointers to structures instead, we 
could easily extend the structures without causing incompatibility).

One way around this problem would be to create an accessor function which takes 
an hdfsFileInfo structure and returns a 0 or 1 based on the FileStatus.  Then 
we could encode that information somewhere in an implementation-defined 
fashion.  One idea would be to put it after the null in the null terminated 
string 'mName'.  Since the memory after the null will not normally be accessed, 
we can put whatever we want there.

> Expose FileStatus#isEncrypted in libhdfs
> ----------------------------------------
>
>                 Key: HDFS-7047
>                 URL: https://issues.apache.org/jira/browse/HDFS-7047
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: encryption
>    Affects Versions: 2.6.0
>            Reporter: Andrew Wang
>            Assignee: Andrew Wang
>




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

Reply via email to