IO Interface And Operations

fml 8 tutorial
Prev |  | Next

# Chapter 45. IO Interface And Operations

We need IO abstraction layer for porting and extension. See Vnode/VFS interface (vnode(9)) on IO abstraction.

    struct vnode {
    		...
            voff_t          v_size;                 /* size of file */
            int             v_numoutput;            /* num pending writes */
            long            v_writecount;           /* ref count of writers */
    		...
            int             (**v_op)(void *);       /* vnode ops vector */
    		...
            void            *v_data;                /* private data for fs */
    };

vop_open(), vop_read(), vop_getattr(), ... are defined over v_op.

**v_op (vnode operation vector) corresponds to a method of object oriented programming. fml8 provides IO::Adapter class as IO abstraction layer.

# Fundamentals Of IO::Adapter

IO::Adapter is most fundamental in fml8 architecture. It is well considered and implemented. It provides enough primitive methods.

IO::Adapter class abstracts

    KEY => VALUE

or

    KEY => [ VALUE, VALUE2, VALUE3 ]

type data structure. It is similar to RDBMS theory like this.

    KEY1 VALUE1-1 ""     ""
    KEY2 VALUE2-1 VALUE2-2 VALUE2-3
    KEY3 VALUE3-1 VALUE3-2 VALUE3-3
    KEY4 VALUE4-1 VALUE4-2 VALUE4-3

To maintain address list, least fundamental methods of IO::Adapter are

    open()
    close()

and IO operations to the object

    add(KEY, ARGV) (ARGV is class dependent)
    delete(KEY)
    find(KEY or REGEXP)
    get_next_key()

methods. At least, enough to write user management codes.

Prev | Home | Next
Forward Error Messages | Up | Methods / Operation Vector

fml 8.0 (fml-devel) project homepage is www.fml.org/software/fml8/.
fml 4.0 project homepage is www.fml.org/software/fml4/.
about one floppy bsd routers, see www.bsdrouter.org/.
other free softwares are found at www.fml.org/software/.

author's homepage is www.fml.org/home/fukachan/.
Also, visit nuinui's world :) at www.nuinui.net.

For questions about FML, e-mail <fml-bugs@fml.org>.