Native Files

Parent Previous Next

Native Files


Files on the UOSFS are tracked via a file header, which contains a pointer to an allocation cluster chain.  The header holds five extent pointers so that small files don't use extra space for allocation clusters.  Further, the number of allocation clusters required can be reduced by increasing the file's cluster size to some multiple of the store's cluster size.


The native file header is a structure matching the following definition:


type TData_Stream = packed record

                       Name : int64 ;

                       Pointer : int64 ;

                   end ;


    TUOS_File_Header = packed record

                               Name : longint ;

                               Size : int64 ;

                               EOF : int64 ;

                               Uncompressed_Size : int64 ;

                               Clustersize : cardinal ;

                               Record_Size : cardinal ;


                               // Dates...

                               Creation : int64 ;

                               Last_Modified : int64 ;

                               Last_Backup : int64 ;

                               Last_Access : int64 ;

                               Expiration : int64 ;


                               Creator : cardinal ;

                               Owner : cardinal ;

                               ACL : int64 ;


                               Flags : int64 ;

                               Version_Limit : longint ;

                               Extension : int64 ;


                               Streams : array[ 0..4 ] of TData_Stream ;

                               Data_Stream : int64 ;

                               Clusters : array[ 0..4 ] of int64 ;


                               Parent : int64 ;

                               File_System : int64 ;

                       end ;


The contents of the file header are described in the following table:


Header item

Description

Name

File name index

Size

File size on disk

EOF

Logical end of file offset

Uncompressed_Size

The size of the file when uncompressed

Record_Size

Size for record in record-oriented files

Creation

Creation date

Last_Modified

Date last modified

Last_Backup

Date last backed up

Last_Access

Date last accessed (read or write)

Expiration

Date of file expiration

Creator

ID of the user who created the file

Owner

ID of the user who owns the file

ACL

Pointer to Access Control List

Flags

A set of bit flags.
General:
FAF_DSM_MASK = Mask for data security mode

FAF_PLACED = Placed at a specific location

FAF_CONTIGUOUS = Contiguous file data

FAF_DELETED = Deleted file

FAF_READONLY = Read-only data

FAF_LINK = Link to another file

FAF_SYSTEM = System file

FAF_HIDDEN = Hidden file

FAF_DIRECTORY = Directory file

FAF_PERMANENT = Non-deletable file

FAF_COPYING = In the process of copying

Protections:

FAF_PROTECTION_OWNER_READ - Owner can read

FAF_PROTECTION_OWNER_WRITE - Owner can write

FAF_PROTECTION_OWNER_DELETE - Owner can delete

FAF_PROTECTION_OWNER_EXECUTE - Owner can execute

FAF_PROTECTION_GROUP_READ - Group members can read

FAF_PROTECTION_GROUP_WRITE - Group members can write

FAF_PROTECTION_GROUP_DELETE - Group members can delete

FAF_PROTECTION_GROUP_EXECUTE - Group members can execute

FAF_PROTECTION_SYSTEM_READ - System accounts can read

FAF_PROTECTION_SYSTEM_WRITE - System accounts can write

FAF_PROTECTION_SYSTEM_DELETE - System accounts can delete

FAF_PROTECTION_SYSTEM_EXECUTE - System accounts can execute.

FAF_PROTECTION_WORLD_READ - Everyone can read

FAF_PROTECTION_WORLD_WRITE - Everyone can write

FAF_PROTECTION_WORLD_DELETE - Everyone can delete

FAF_PROTECTION_WORLD_EXECUTE - Everyone can execute

Version_Limit

Maximum version limit (0=no limit)

Extension

Pointer to header extension (reserved)

Streams

Meta-data stream pointers and names

Data_Stream

Data stream pointer

Clusters

Pointers to first 5 extents

Parent

Parent directory pointer

File_System

Parent directory offset


Data Streams

Files contain data.  UOS file can contain meta-data in addition to data.  Some meta data is in the file header, but UOSFS allows additional information to be stored in the file, but kept separate from the file's actual data. This is accomplished via "streams".  A file can have any number of data streams.  Data stream 0 is unnamed and reserved  for the file's actual data.  All other data streams can be assigned names that indicate what data is being stored in each stream.


Contiguous Files

Contiguous files (FAF_CONTIGUOUS flag) are stored in contiguous clusters.  Therefore, allocation chains are not required.  Instead, the first extent in Clusters points to the first cluster of the contiguous data.