libole2 Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# MsOle

## Name

MsOle -- Handle the filesystem.

## Synopsis

    #include <libole2/libole2.h>

    struct      MsOle;
    #define     ms_ole_open                     (fs,path)
    MsOleErr    ms_ole_open_vfs                 (MsOle **fs,
                                                 const char *path,
                                                 gboolean try_mmap,
                                                 MsOleSysWrappers *wrappers);
    #define     ms_ole_create                   (fs,path)
    MsOleErr    ms_ole_create_vfs               (MsOle **fs,
                                                 const char *path,
                                                 int try_mmap,
                                                 MsOleSysWrappers *wrappers);
    void        ms_ole_ref                      (MsOle *fs);
    void        ms_ole_unref                    (MsOle *fs);
    void        ms_ole_destroy                  (MsOle **fs);
    MsOleErr    ms_ole_unlink                   (MsOle *fs,
                                                 const char *path);
    MsOleErr    ms_ole_stat                     (MsOleStat *stat,
                                                 MsOle *fs,
                                                 const char *dirpath,
                                                 const char *name);
    MsOleErr    ms_ole_directory                (char ***names,
                                                 MsOle *fs,
                                                 const char *dirpath);
    void        ms_ole_debug                    (MsOle *fs,
                                                 int magic);

## Description

MsOle is a filesystem object and handles an open filesystem.

ms_ole_open() opens a filesystem. ms_ole_create() creates a new filesystem. ms_ole_destroy() closes a filesystem (therefore destroying the filesystem object). ms_ole_open_vfs() and ms_ole_create_vfs() allow more control on the way the filesystem-in-a-file is actualy accessed.

ms_ole_unlink() deletes a stream or a directory on a filesystem. ms_ole_stat() gets information about a stream or a directory. ms_ole_directory() returns the names of the streams and directories in a directory.

## Details

### struct MsOle

    struct MsOle;

MsOle is an opaque datatype. It handles an open filesystem.

### ms_ole_open()

    #define ms_ole_open(fs,path)     ms_ole_open_vfs ((fs), (path), TRUE, NULL)

Opens the filesystem-in-a-file `path` and creates the filesystem object `fs`. Returns a MsOleErr code.

This is a convenience macro for ms_ole_open_vfs().

`fs` : | filesystem object.
`path` : | path to the filesystem-in-a-file on the actual filesystem.

### ms_ole_open_vfs ()

    MsOleErr    ms_ole_open_vfs                 (MsOle **fs,
                                                 const char *path,
                                                 gboolean try_mmap,
                                                 MsOleSysWrappers *wrappers);

Opens the filesystem-in-the-file `path` and creates the filesystem object `fs`.

`fs` : | filesystem object.
`path` : | path to the filesystem-in-the file on the actual filesystem.
`try_mmap` : | TRUE if try to mmap(2) the filesystem-in-a-file, instead of opening.
`wrappers` : | system functions wrappers, `NULL` if standard functions are used.
Returns : | a MsOleErr code.

### ms_ole_create()

    #define ms_ole_create(fs,path)     ms_ole_create_vfs ((fs), (path), TRUE, NULL)

Creates the filesystem-in-a-file `path` and creates the filesystem object `fs`. Returns a MsOleErr code.

This is a convenience macro for ms_ole_create_vfs().

`fs` : | filesystem object.
`path` : | path to the filesystem-in-a-file on the actual filesystem.

### ms_ole_create_vfs ()

    MsOleErr    ms_ole_create_vfs               (MsOle **fs,
                                                 const char *path,
                                                 int try_mmap,
                                                 MsOleSysWrappers *wrappers);

Creates the filesystem-in-the-file `path` and creates the filesystem `fs`.

`fs` : | filesystem object.
`path` : | path to the filesystem-in-the file on the actual filesystem.
`try_mmap` : | TRUE if try to mmap(2) the filesystem-in-a-file, instead of opening.
`wrappers` : | system functions wrappers, `NULL` if standard functions are used.
Returns : | a MsOleErr code.

### ms_ole_ref ()

    void        ms_ole_ref                      (MsOle *fs);

Increment by one the count of references to the filesystem.

`fs` : | filesystem object.

### ms_ole_unref ()

    void        ms_ole_unref                    (MsOle *fs);

Decrement by one the count of references to the filesystem.

`fs` : | filesystem object.

### ms_ole_destroy ()

    void        ms_ole_destroy                  (MsOle **fs);

Closes the filesystem `fs` and truncates any free blocks.

`fs` : | filesystem object.

### ms_ole_unlink ()

    MsOleErr    ms_ole_unlink                   (MsOle *fs,
                                                 const char *path);

Delete the stream or directory `path` on the filesystem `fs`.

`fs` : | filesystem object.
`path` : | path of the stream or directory to delete.
Returns : | a MsOleErr code.

### ms_ole_stat ()

    MsOleErr    ms_ole_stat                     (MsOleStat *stat,
                                                 MsOle *fs,
                                                 const char *dirpath,
                                                 const char *name);

Gets information about the stream or the directory which is in the directory `dirpath` and its name is `file`.

`stat` : | stat information.
`fs` : | filesystem object.
`dirpath` : | directory path.
`name` : | stream or directory name.
Returns : | a MsOleErr code.

### ms_ole_directory ()

    MsOleErr    ms_ole_directory                (char ***names,
                                                 MsOle *fs,
                                                 const char *dirpath);

Gets the names of the streams and directories in the directory `dirpath`.

`names` : | array where the names are storesd, it's `NULL` ended.
`fs` : | filesystem object.
`dirpath` : | directory path.
Returns : | a MsOleErr code.

### ms_ole_debug ()

    void        ms_ole_debug                    (MsOle *fs,
                                                 int magic);

`fs` : |
`magic` : |

<<< Previous Page | Home | Up | Next Page >>>
API Reference | MsOleStream