Extended file attributes

From Wikipedia, the free encyclopedia
  (Redirected from OS/2 EA)
Jump to: navigation, search

Extended file attributes are file system features that enable users to associate computer files with metadata not interpreted by the filesystem, whereas regular attributes have a purpose strictly defined by the filesystem (such as permissions or records of creation and modification times). Unlike forks, which can usually be as large as the maximum file size, extended attributes are usually limited in size to a value significantly smaller than the maximum file size. Typical uses include storing the author of a document, the character encoding of a plain-text document, or a checksum, cryptographic hash or digital certificate, and discretionary access control information.

Implementations[edit]

AIX[edit]

In AIX, the JFS2 v2 filesystem supports extended attributes, which are accessible using the getea command.[1] The getea,[2] setea,[3] listea,[4] statea,[5] and removeea[6] APIs support fetching, setting, listing, getting information about, and removing extended attributes.

FreeBSD[edit]

In FreeBSD 5.0 and later, the UFS1 and UFS2 filesystems support extended attributes, using the extattr_[7] family of system calls. Any regular file may have a list of extended attributes. Each attribute consists of a name and the associated data. The name must be a null-terminated string, and exists in a namespace identified by a small-integer namespace identifier. Currently, two namespaces exist: user and system. The user namespace has no restrictions with regard to naming or contents. The system namespace is primarily used by the kernel for access control lists and mandatory access control.

Linux[edit]

In Linux, the ext2, ext3, ext4, JFS, Squashfs, Yaffs2, ReiserFS, XFS, Btrfs, OrangeFS, Lustre, OCFS2 1.6 and F2FS[8] filesystems support extended attributes (abbreviated xattr) when enabled in the kernel configuration. Any regular file or directory may have extended attributes consisting of a name and associated data. The name must be a null-terminated string prefixed by a namespace identifier and a dot character. Currently, four namespaces exist: user, trusted, security and system. The user namespace has no restrictions with regard to naming or contents. The system namespace is primarily used by the kernel for access control lists. The security namespace is used by SELinux, for example.

Support for the extended attribute concept from a POSIX.1e draft that has been withdrawn in 1997 was added to Linux around 2003.[9][10] As of 2016, they are not yet in widespread use by user-space Linux programs, but are used by Beagle, OpenStack Swift, Dropbox, KDE's semantic metadata framework (Baloo), Chromium, and cURL. A set of recommendations for using them is available at freedesktop.org.[11]

The Linux kernel allows extended attribute to have names of up to 255 bytes and values of up to 64KiB,[12] as do XFS and ReiserFS, but ext2/3/4 and btrfs impose much smaller limits, requiring all the attributes (names and values) of one file to fit in one 'filesystem block' (usually 4 KiB).

Extended attributes can be accessed and modified using the attr, getfattr and setfattr commands[13] from the attr package,[14] or the lsattr command from e2fsprogs package[15] on most distributions.

macOS[edit]

Mac OS X 10.4 and later support extended attributes by making use of the HFS+ filesystem Attributes file B*-tree feature which allows for named forks. Although the named forks in HFS+ support arbitrarily large amounts of data through extents, the OS support for extended attributes only supports inline attributes, limiting their size to that which can fit within a single B*-tree node.[citation needed] Any regular file may have a list of extended attributes. HFS+ supports an arbitrary number of named forks, and it is unknown if macOS imposes any limit on the number of extended attributes. Each attribute consists of a name and the associated data. The name is a null-terminated Unicode string. The macOS APIs support listing,[16] getting,[17] setting,[18] and removing[19] extended attributes from files or directories. The xattr utility may be used from the Terminal as well.[20] In some older versions of macOS (such as Mac OS X 10.6), user space extended attributes were not preserved on save in common Cocoa applications (TextEdit, Preview etc.).[citation needed]

OS/2[edit]

In OS/2 version 1.2 and later, the High Performance File System was designed with extended attributes in mind, but support for them was also retro-fitted on the FAT filesystem of DOS. For compatibility with other operating systems using a FAT partition, OS/2 attributes are stored inside a single file "EA DATA. SF" located in the root directory. This file is normally inaccessible when an operating system supporting extended attributes manages the disk, but can be freely manipulated under, for example, DOS. Files and directories having extended attributes use one or more clusters inside this file. The logical cluster number of the first used cluster is stored inside the owning file's or directory's directory entry.[21] These two bytes are used for other purposes on the FAT32 filesystem, and hence OS/2 extended attributes cannot be stored on this filesystem.

Parts of OS/2 version 2.0 and later such as the Workplace Shell uses several standardized extended attributes (also called EAs) for purposes like identifying the filetype, comments, computer icons and keywords about the file. Programs written in the interpreted language Rexx store an already parsed version of the code as an extended attribute, to allow faster execution.

Solaris[edit]

Solaris version 9 and later allows files to have "extended attributes", which are actually forks; the maximum size of an "extended attribute" is the same as the maximum size of a file, and they are read and written in the same fashion as files. Internally, they are actually stored and accessed like normal files, so their names cannot contain "/" characters[22] and their ownership and permissions can differ from those of the parent file.

Version 4 of the Network File System supports extended attributes in much the same way as Solaris.

Windows NT[edit]

On Windows NT, limited-length extended attributes are supported by FAT,[21] HPFS, and NTFS. This was implemented as part of the OS/2 subsystem. They are notably used by the NFS server of the Interix POSIX subsystem in order to implement Unix-like permissions. The Windows Subsystem for Linux added in the Windows 10 Anniversary Update uses them for similar purposes, storing the Linux file mode, owner, device ID (if applicable), and file times in the extended attributes.[23]

Additionally, NTFS can store infinite-length extended attributes in the form of Alternate Data Streams (ADS), a type of resource fork. The Windows Subsystem for Linux uses these to store Linux file capabilities.[23]

See also[edit]

References[edit]

  1. ^ getea CommandAIX 7.1 Commands
  2. ^ getea SubroutineAIX 7.1 Technical Reference: Base Operating System and Extensions, Volume 1
  3. ^ setea SubroutineAIX 7.1 Technical Reference: Base Operating System and Extensions, Volume 2
  4. ^ listea SubroutineAIX 7.1 Technical Reference: Base Operating System and Extensions, Volume 1
  5. ^ statea SubroutineAIX 7.1 Technical Reference: Base Operating System and Extensions, Volume 2
  6. ^ removeea SubroutineAIX 7.1 Technical Reference: Base Operating System and Extensions, Volume 2
  7. ^ extattr(2) – FreeBSD System Calls Manual
  8. ^ http://lkml.iu.edu/hypermail/linux/kernel/1210.0/03190.html
  9. ^ "v2.5.3 git commit log". git.kernel.org. Retrieved 26 November 2015. 
  10. ^ "Red Hat Enterprise Linux AS 3 Release Notes (x86 Edition)". Red Hat. 2003. Retrieved 2013-04-08. EA (Extended Attributes) and ACL (Access Control Lists) functionality is now available for ext3 file systems. In addition, ACL functionality is available for NFS. 
  11. ^ "Guidelines for extended attributes". 2009-08-21. Archived from the original on 2012-02-04. Retrieved 2013-04-08. 
  12. ^ "File include/uapi/linux/limits.h, from Torvald's GitHub clone of the Linux kernel tree". Retrieved 2015-03-06. 
  13. ^ "Introduction to attr". Beyond Linux From Scratch. 2013-03-04. Retrieved 2013-04-08. 
  14. ^ "Commands for Manipulating Filesystem Extended Attributes". savannah.nongnu.org. Retrieved 26 November 2015. 
  15. ^ "E2fsprogs: Ext2/3/4 Filesystem Utilities". sourceforge.net. Retrieved 26 November 2015. 
  16. ^ listxattr(2) – Darwin and OS X System Calls Manual
  17. ^ getxattr(2) – Darwin and OS X System Calls Manual
  18. ^ setxattr(2) – Darwin and OS X System Calls Manual
  19. ^ removexattr(2) – Darwin and OS X System Calls Manual
  20. ^ xattr(1) – Darwin and OS X General Commands Manual
  21. ^ a b Bob Eager (October 28, 2000). "Implementation of extended attributes on the FAT file system". 
  22. ^ fsattr(5) – Solaris 10 Standards, Environments and Macros Reference Manual
  23. ^ a b Hammons, Jack (2016-06-15). "WSL File System Support". MSDN. Retrieved 2016-10-20. 

External links[edit]