Unix File Attributes

The Unix File Attributes packet consists of the following:

File-Index Type Filename@File-Attributes@Link @Extended-Attributes@ where

@
represents a byte containing a binary zero.

FileIndex
is the sequential file index starting from one assigned by the File daemon.

Type
is one of the following:

#define FT_LNKSAVED   1    /* hard link to file already saved */
#define FT_REGE       2    /* Regular file but empty */
#define FT_REG        3    /* Regular file */
#define FT_LNK        4    /* Soft Link */
#define FT_DIR        5    /* Directory */
#define FT_SPEC       6    /* Special file -- chr, blk, fifo, sock */
#define FT_NOACCESS   7    /* Not able to access */
#define FT_NOFOLLOW   8    /* Could not follow link */
#define FT_NOSTAT     9    /* Could not stat file */
#define FT_NOCHG     10    /* Incremental option, file not changed */
#define FT_DIRNOCHG  11    /* Incremental option, directory not changed */
#define FT_ISARCH    12    /* Trying to save archive file */
#define FT_NORECURSE 13    /* No recursion into directory */
#define FT_NOFSCHG   14    /* Different file system, prohibited */
#define FT_NOOPEN    15    /* Could not open directory */
#define FT_RAW       16    /* Raw block device */
#define FT_FIFO      17    /* Raw fifo device */

Filename
is the fully qualified filename.

File-Attributes
consists of the 13 fields of the stat() buffer in ASCII base64 format separated by spaces. These fields and their meanings are shown below. This stat() packet is in Unix format, and MUST be provided (constructed) for ALL systems.

Link
when the FT code is FT_LNK or FT_LNKSAVED, the item in question is a Unix link, and this field contains the fully qualified link name. When the FT code is not FT_LNK or FT_LNKSAVED, this field is null.

Extended-Attributes
The exact format of this field is operating system dependent. It contains additional or extended attributes of a system dependent nature. Currently, this field is used only on WIN32 systems where it contains a ASCII base64 representation of the WIN32_FILE_ATTRIBUTE_DATA structure as defined by Windows. The fields in the base64 representation of this structure are like the File-Attributes separated by spaces.

The File-attributes consist of the following:

Field No. Stat Name Unix Win98/NT MacOS
1 st_dev Device number of filesystem Drive number vRefNum
2 st_ino Inode number Always 0 fileID/dirID
3 st_mode File mode File mode 777 dirs/apps; 666 docs; 444 locked docs
4 st_nlink Number of links to the file Number of link (only on NTFS) Always 1
5 st_uid Owner ID Always 0 Always 0
6 st_gid Group ID Always 0 Always 0
7 st_rdev Device ID for special files Drive No. Always 0
8 st_size File size in bytes File size in bytes Data fork file size in bytes
9 st_blksize Preferred block size Always 0 Preferred block size
10 st_blocks Number of blocks allocated Always 0 Number of blocks allocated
11 st_atime Last access time since epoch Last access time since epoch Last access time -66 years
12 st_mtime Last modify time since epoch Last modify time since epoch Last access time -66 years
13 st_ctime Inode change time since epoch File create time since epoch File create time -66 years

Kern Sibbald 2013-08-18