public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* grub-0.97/VFS
@ 2009-07-22 16:04 Edward Shishkin
  0 siblings, 0 replies; only message in thread
From: Edward Shishkin @ 2009-07-22 16:04 UTC (permalink / raw)
  To: linux-btrfs, grub-devel

Hello everyone.

Grub-0.97 filesystem interface (read_func, dir_func)
seems to be poor. Instead of this I would prefer to
have something like the following:

/*
 *
 * .init_root()           // set index of root dir
 * .lookup_begin()        // get index by name
 * .lookup_end()          // get inode by index
 * .read_file()
 * .read_dir()
 * .read_symlink()
 *
 * so that dir_func in grub_open will look like the
 * following:
 */
int path_walk()
{
    ops->init_root();
    while (1) {
        int mode;
        ops->lookup_end(&mode, ...);

        switch (type_of_file(mode)) {
        case SYMLINK_FILE:
            follow_symlink(read_symlink, ...);
            ...;
            continue;
        case REGULAR_FILE:
            /*
             * the end of path walk:
             * normally we want to exit here
             */
            ...;
            return 1;
        case DIRECTORY_FILE:
            /*
             * optionally this will
             * print possibilities
             */
            ops->lookup_begin(mode, read_dir, ...);
            ...;
            continue;
        default:
            errnum = ERR_BAD_FILETYPE;
            return 0;
        }
    }
}

Just my 2 cents in the (grub-2?) development process..

Thanks,
Edward.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-22 16:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22 16:04 grub-0.97/VFS Edward Shishkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox