为什么在使用 os.setxattr() 设置文件的 xattr 时必须在名称前加上 'user.'?
Why must a 'user.' be prepended to the name when setting a file's xattr with os.setxattr()?
我正在保存我认为可以被视为 JSON 序列化文件中的元数据的数据:
os.setxattr('/var/tmp/test.json', 'user.keyname', b'value')
我可以通过以下方式取回字节值:
os.getxattr('/var/tmp/test.json', 'user.keyname')
唯一能让它工作的方法是将 user.
放在我想使用的 key/name 前面。这是为什么?
https://www.tuxera.com/community/ntfs-3g-advanced/extended-attributes/
On Linux, specifically, four categories of extended attributes have been defined :
- trusted: to record properties which should only be accessed by the kernel,
- security: to record security properties of a file,
- system: to record other system related properties on which the file owner has some control,
- user: to record properties defined by applications.
The names of the extended attributes must be prefixed by the name of the category and a dot, hence these categories are generally qualified as name spaces.
我正在保存我认为可以被视为 JSON 序列化文件中的元数据的数据:
os.setxattr('/var/tmp/test.json', 'user.keyname', b'value')
我可以通过以下方式取回字节值:
os.getxattr('/var/tmp/test.json', 'user.keyname')
唯一能让它工作的方法是将 user.
放在我想使用的 key/name 前面。这是为什么?
https://www.tuxera.com/community/ntfs-3g-advanced/extended-attributes/
On Linux, specifically, four categories of extended attributes have been defined :
- trusted: to record properties which should only be accessed by the kernel,
- security: to record security properties of a file,
- system: to record other system related properties on which the file owner has some control,
- user: to record properties defined by applications.
The names of the extended attributes must be prefixed by the name of the category and a dot, hence these categories are generally qualified as name spaces.