Skip to content

Refactor some Xattr and Acl internals#1893

Merged
BareosBot merged 14 commits intobareos:masterfrom
arogge:dev/arogge/master/refactor-xattr-acl
Feb 11, 2025
Merged

Refactor some Xattr and Acl internals#1893
BareosBot merged 14 commits intobareos:masterfrom
arogge:dev/arogge/master/refactor-xattr-acl

Conversation

@arogge
Copy link
Member

@arogge arogge commented Jul 12, 2024

This is my approach to use proper C++ types instead of pointer-connected C structs for XattrData (and maybe AclData).
This will also fix a crash when running bextract to extract a job with xattr onto a filesystem without xattr support (and presumably the same for acl data).

Thank you for contributing to the Bareos Project!

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
    Required backport PRs have been created
  • Correct milestone is set
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR

@arogge arogge requested a review from sebsura July 12, 2024 11:05
@arogge arogge self-assigned this Jul 16, 2024
Copy link
Contributor

@sebsura sebsura left a comment

Choose a reason for hiding this comment

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

Looks like a very good change to me. I just found one typo that needs fixing.

@arogge arogge force-pushed the dev/arogge/master/refactor-xattr-acl branch 2 times, most recently from febc5da to 922899c Compare September 3, 2024 11:50
@arogge arogge force-pushed the dev/arogge/master/refactor-xattr-acl branch from b0e547b to bf0d587 Compare September 16, 2024 10:52
@arogge arogge force-pushed the dev/arogge/master/refactor-xattr-acl branch 2 times, most recently from fe9d184 to 7af9f60 Compare December 18, 2024 13:27
@arogge arogge force-pushed the dev/arogge/master/refactor-xattr-acl branch from 7af9f60 to 1393b4e Compare December 20, 2024 11:01
@arogge
Copy link
Member Author

arogge commented Dec 20, 2024

I also added two small changes for things that bugged my in the windows build.

@arogge arogge marked this pull request as ready for review December 20, 2024 13:56
@arogge arogge force-pushed the dev/arogge/master/refactor-xattr-acl branch 2 times, most recently from 328552e to 7ee6b4f Compare December 20, 2024 15:52
Copy link
Contributor

@sebsura sebsura left a comment

Choose a reason for hiding this comment

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

The new changes are really great!

I added some small remarks, but this is basically good to go!

@sebsura sebsura added this to the 25.0.0 milestone Jan 6, 2025
@arogge arogge requested a review from sebsura January 7, 2025 09:40
@arogge arogge force-pushed the dev/arogge/master/refactor-xattr-acl branch from 385af86 to 45078b4 Compare January 7, 2025 09:42
@arogge arogge force-pushed the dev/arogge/master/refactor-xattr-acl branch 2 times, most recently from 3daa1c6 to 356a9b9 Compare January 14, 2025 08:33
@arogge arogge force-pushed the dev/arogge/master/refactor-xattr-acl branch from 356a9b9 to 50d26fd Compare February 10, 2025 13:36
inside `XattrData` there was
```
union {
  xattr_build_data_t* build;
  xattr_parse_data_t* parse;
};
```
both of these types contained a `uint32_t nr_errors` that was moved into
`XattrData`, leaving `xattr_parse_data_t` empty, so it could be removed.
instead of keeping a ptr to `xattr_build_data_t` in `XattrData`, we now
have to distinct types `XattrData` and `XattrBuildData` with the latter
inheriting from the former and providing all members of
xattr_build_data_t (and proper ctor/dtor).

The downside is that some of the functions in xattr.cc that were passed
a `XattrData*` before will now need a `XattrBuildData*` so we need to
downcast when calling these.
use a PoolMem instead of a POOLMEM*
this also refactors some duplicated code into a common function.
arogge and others added 8 commits February 11, 2025 08:30
this adds AclBuildData as a child class to AclData. The members
previously in acl_build_data_t were moved into that class.
some compilers (i.e. MSVC) don't support -fdebug-prefix-map, so ccache
will not automatically do the right thing when base_dir is set.
Therefore, we disable hash_dir unless -fdebug-prefix-map was added.
* class -> struct
* static_cast -> dynamic_cast
* improve interface of SerializeXattrStream()
* better error reporting
@BareosBot BareosBot force-pushed the dev/arogge/master/refactor-xattr-acl branch from bd60166 to d99ff00 Compare February 11, 2025 08:30
@BareosBot BareosBot merged commit f6021bd into bareos:master Feb 11, 2025
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