logo.gif (6996 bytes)
Object

Up

The fsObject structure is used to store information about files and directories.   It contains information like the date when the object was last altered, its protection bits, its unique node number and specifically for files things like its size and the location of its data.

Objects are stored in ObjectContainers.  Each ObjectContainer holds a variable number of Objects which belong to a specific directory.

Field Type Description
owneruid UWORD Not used at the moment, and are set to zero.  This field, and the ownergid field will be used later on for multi-user support.
ownergid UWORD See owneruid.
objectnode NODE This field contains the node number which uniquely identifies this object.  The node number can be looked up to determine in which block an object is stored.
protection ULONG Contains the Object's protection bits. When creating a new object this fields is set to 0x0000000F, which means bits R, W, E and D are set (note that this is opposite to what is used by AmigaDOS).
data BLCK (files only).  The first block which contains data stored in this file.  The rest of the data can be located by looking up this block number in the B-Tree stored in the BNodeContainers.  If this field is zero then the file is empty and the size field must be zero as well. 
size ULONG (files only).  The size of the file in bytes.  Zero indicates an empty file, and in that case the data field must be zero as well.
hashtable BLCK (directories only).  Points to the HashTable block which belongs to this directory.  A directory always has a HashTable block associated with it, even if the directory is empty.
firstdirblock BLCK (directories only).  This points to the first ObjectContainer block which belongs to this directory.  If the directory is empty then this field is zero.
datemodified ULONG This field is used to hold the date of the last modification of an Object.  It holds the number of seconds elapsed since 1-1-1978, which is enough room for about 136 years.  The modification date is updated whenever a file is changed or, in the case of a directory, an object which is a direct descendant is added or removed from the directory.
bits UBYTE See the defines below.  At the moment this field can be checked to see if you're dealing with a directory or file Object.  Two bits are reserved for future use, one for links and one for deletion status.  These bits, and all other unused bits are always zero.
name String After the main structure the name of the Object is stored.  It is zero terminated.  The name can of course vary in length, which means this structure can differ in size depending on the length of the name and comment fields.
comment String Directly following the name of the Object is the comment field.   This fields is zero terminated, even if there is no comment.
struct fsObject {
    UWORD owneruid;
    UWORD ownergid;
    NODE objectnode;
    ULONG protection;

    union {
        struct {
            BLCK data;
            ULONG size;
        } file;

        struct {
            BLCK hashtable;
            BLCK firstdirblock;
        } dir;
    } object;

    ULONG datemodified;
    UBYTE bits;       /* see defines below */
    UBYTE name[0];
    UBYTE comment[0];
};
#define OTYPE_DELETED (32)
#define OTYPE_LINK    (64)
#define OTYPE_DIR     (128) 

All rights reserved.
For comments, problems or questions regarding this page contact John Hendrikx.
Last updated: 17 oktober 1998.