Skip to content

Implement binding for extended file attributes handling on Linux.#1018

Closed
wilx wants to merge 2 commits intojava-native-access:4.5.Xfrom
wilx:4.5.x-linux-xattrs
Closed

Implement binding for extended file attributes handling on Linux.#1018
wilx wants to merge 2 commits intojava-native-access:4.5.Xfrom
wilx:4.5.x-linux-xattrs

Conversation

@wilx
Copy link
Copy Markdown
Contributor

@wilx wilx commented Oct 1, 2018

No description provided.

Copy link
Copy Markdown
Member

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work. I did a first pass over the code and left comments inline.

You choose to base your work on 4.5.X. I left that branch as a pure bugfix branch. Feature work should go into master. I already checked - your changes apply cleanly onto master.

int lsetxattr(String path, String name, Pointer value, size_t size, int flags);
int fsetxattr(int fd, String name, Pointer value, size_t size, int flags);

ssize_t getxattr(String path, String name, Pointer value, size_t size);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In XAttrUtil you convert Memory <-> byte[]. You could add overloads here, that take byte[] in addition to pointer - I can see use-cases for both calls:

ssize_t getxattr(String path, String name, Pointer value, size_t size);
ssize_t getxattr(String path, String name, byte[] value, size_t size);

Copy link
Copy Markdown
Contributor Author

@wilx wilx Oct 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why it would be convenient to have such overload. But I do not understand if JNA will then apply the right conversion to handle the byte[] automatically. Does it?

Comment thread contrib/platform/src/com/sun/jna/platform/linux/XAttrUtil.java
Comment thread contrib/platform/src/com/sun/jna/platform/linux/XAttrUtil.java
Comment thread contrib/platform/src/com/sun/jna/platform/linux/XAttrUtil.java
Comment thread contrib/platform/src/com/sun/jna/platform/linux/XAttrUtil.java
@matthiasblaesing
Copy link
Copy Markdown
Member

Closing in favor of #1021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants