Add more robust generic attribute emulation variant
The new configure option "--use-xattr-ref" enables an xattr assisted variant of the generic attribute emulation. Instead of using the inode ID of a node to identify its attribute directory, we use a reasonably unique random 128 bit number, which we generate and attach as an attribute to the node. This way, when a node changes its inode ID (defragmentation?) or the inode ID of a removed node with a left-over attribute directory is reused, attributes won't get mixed up. The old method is still used for symlinks (since on Linux only priviledged users can write attributes on symlinks), but those usually only have a rather boring BEOS:TYPE attribute, so mix-ups wouldn't be that problematic anyway.
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
|
||||
|
||||
// exported by the generic attribute support in libroot_build.so
|
||||
extern "C" bool __get_attribute_dir_path(const struct stat* st, char* buffer);
|
||||
extern "C" bool __get_attribute_dir_path(const struct stat* st,
|
||||
const char* path, char* buffer);
|
||||
|
||||
|
||||
class Path {
|
||||
@@ -143,7 +144,8 @@ remove_entry(Path& path, bool recursive, bool force, bool removeAttributes)
|
||||
// remove the file's attributes
|
||||
if (removeAttributes) {
|
||||
Path attrDirPath;
|
||||
if (__get_attribute_dir_path(&st, attrDirPath.Buffer())) {
|
||||
if (__get_attribute_dir_path(&st, path.GetPath(),
|
||||
attrDirPath.Buffer())) {
|
||||
attrDirPath.BufferChanged();
|
||||
remove_entry(attrDirPath, true, true, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user