Name
Stat -- examine a file system object (V6.0)
Synopsis
int ok = Stat(STRPTR name, ULONG flags, struct hwos_StatStruct *st,
                 struct hwTagList *tags);
Function
This function has to examine the file system object specified in parameter 1 and write information about it to the structure pointer passed in parameter 3. struct hwos_StatStruct looks like this:

 
struct hwos_StatStruct
{
    int Type;                               // [out]
    DOSINT64 Size;                          // [out]
    ULONG Flags;                            // [out]
    struct hwos_DateStruct Time;            // [out]
    struct hwos_DateStruct LastAccessTime;  // [out]
    struct hwos_DateStruct CreationTime;    // [out]
    STRPTR FullPath;                        // [out]
    STRPTR Comment;                         // [out]
    int LinkMode;                           // [out]
    STRPTR Container;                       // [out]
};

Your Stat() implementation needs to write the following information to the individual structure members:

Type:
This must be set to one of the following types:

HWSTATTYPE_FILE:
The file system object examined is a file.

HWSTATTYPE_DIRECTORY:
The file system object examined is a directory.

Size:
Size of object in bytes if it is a file, 0 for directories. Note that this can also be set to -1 in case the file size isn't know, for example because the file is being streamed from a network source.

Flags:
Combination of flags describing the file system object attributes. See File attributes for a list of supported attributes.

Time:
Time stamp indicating when this file system object was last modified. This information is optional. Do not touch this member if you don't have this time information.

LastAccessTime:
Time stamp indicating when this file system object was last accessed. This information is optional. Do not touch this member if you don't have this time information.

CreationTime:
Time stamp indicating when this file system object was created. This information is optional. Do not touch this member if you don't have this time information.

FullPath:
Fully qualified path to the file system object. This must be provided. If the HWSTATFLAGS_ALLOCSTRINGS flag is not set, you can set this to a static string buffer which must stay valid until the next call to Stat(). If HWSTATFLAGS_ALLOCSTRINGS has been set, you need to allocate a string buffer using hw_TrackedAlloc().

Comment:
Comment stored for this object in the file system. Set this to NULL if you do not have this information or the file system doesn't support storage of comments. If the HWSTATFLAGS_ALLOCSTRINGS flag is not set, you can set this to a static string buffer which must stay valid until the next call to Stat(). If HWSTATFLAGS_ALLOCSTRINGS has been set, you need to allocate a string buffer using hw_TrackedAlloc().

LinkMode:
Currently unused. Set to 0.

Container:
Currently unused. Set to NULL.

The following flags are supported by Stat():

HWSTATFLAGS_ALLOCSTRINGS:
If this flag is set, Stat() must not use static string buffers for the FullPath and Comment structure members but allocate new private string buffers for them. Hollywood will then call hw_TrackedFree() on these buffers once it is done with them. This flag is often set when Stat() is used in a multithreaded setup.

Stat() has to return True on success or False on failure.

Stat() is often used by Hollywood to find out whether a certain file system object is a file or a directory. It is also used to resolve relative file name specifications into absolute, fully-qualified paths. So make sure your implementation provides this information in the FullPath structure member above.

This function must be implemented in a thread-safe manner if the HWSTATFLAGS_ALLOCSTRINGS flag is set.

Inputs
name
name of file system object to examine
flags
additional flags (see above)
st
pointer to a struct hwos_StatStruct for storing information about the file system object
tags
reserved for future use (currently NULL)
Results
ok
True to indicate success, False on failure

Show TOC