hpc / mpifileutils

File utilities designed for scalability and performance.
https://hpc.github.io/mpifileutils
BSD 3-Clause "New" or "Revised" License
168 stars 66 forks source link

add cmake check for libattr #511

Closed adammoody closed 2 years ago

adammoody commented 2 years ago

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 commented 2 years ago

@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

daltonbohning commented 2 years ago

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

adammoody commented 2 years ago

@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 commented 2 years ago

@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.