Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cmake check for libattr #511

Merged
merged 2 commits into from
Jan 8, 2022
Merged

add cmake check for libattr #511

merged 2 commits into from
Jan 8, 2022

Conversation

adammoody
Copy link
Member

@adammoody adammoody commented Dec 30, 2021

This adds a cmake find_package check for libattr, which is used for attr_copy_action when copying extended attributes. When xattr support is enabled, libattr is marked as required. However, this also adds compile-time checks in the code to disable libattr code if is was not found so that it could be optional rather than required.

@adammoody
Copy link
Member Author

@ofaaland , would you please review this when you get a chance? If you have suggestions, please let me know.

In case someone doesn't have libattr installed, I protected the libattr-related lines with a HAVE_LIBATTR check. For now, I've left the cmake check as required, but we could likely back that off to make it optional.

I also dropped the input ctx variable and replaced it with NULL since we weren't using it anyway. To use, I think we'd want to fill in the fields of the struct with pointers to functions, as in the example here:

https://github.com/philips/attr/blob/1cc88bd4c17ef99ace22c8be362d513f155b1387/examples/copyattr.c#L89

Copy link
Collaborator

@ofaaland ofaaland left a comment

Choose a reason for hiding this comment

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

LGTM
I think we should leave LibAttr as "REQUIRED" for the moment since there is no easy way for the user to tell whether libattr support was built (if they don't know about tools like ldd)

src/common/mfu_flist_copy.c Outdated Show resolved Hide resolved
Signed-off-by: Adam Moody <moody20@llnl.gov>
Signed-off-by: Adam Moody <moody20@llnl.gov>
@daltonbohning
Copy link
Collaborator

@adammoody To be clear, the current (and intended) behavior is that libattr is required when ENABLE_XATTRS=ON?

@adammoody
Copy link
Member Author

@daltonbohning , yes, that's the goal, but we're assuming that one has libattr available. If we find common setups that use xattrs but do not have libattr installed, I think we could do more work to make libattr optional.

@daltonbohning
Copy link
Collaborator

@daltonbohning , yes, that's the goal, but we're assuming that one has libattr available. If we find common setups that use xattrs but do not have libattr installed, I think we could do more work to make libattr optional.

@adammoody Thanks. Luckily, so far it seems our (DAOS) setups do have libattr installed/available.

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.

3 participants