[syslinux] [Patch]: Drive/Partition and extensible filesystem support for syslinux
Ram Yalamanchili
ramyinc at gmail.com
Wed Apr 18 01:38:47 PDT 2007
Here is the patch for making syslinux enable opening partitions with
fat filesystems (well, the architecture is in place to make it open
other filesystems too).
Usage is like this:
#include <syslinux/io.h>
#include <syslinux/partitions.h>
#include <fs/fat/libfat.h>
syslinux_devdesc dfd;
struct libfat_filesystem* fs;
diskinfo disk_info;
char mbr[512];
static part_entry *partition;
int fd;
syslinux_get_disk_params(drive, &disk_info); // specify your drive number
syslinux_read_disk(&disk_info, mbr, 0, 1); // Read mbr
partition = PARTITION_ENTRY(mbr, 2); // 2 for partition 2
// this is the disk device/partition descriptor
dfd.disk_info = &disk_info;
dfd.partition = partition;
// try opening libfat partition on the given partition descriptor
fs = libfat_open(syslinux_fs_partition_read_handle, (intptr_t) &dfd);
fd = fs->ops.open(fs, "MYFILE CFG", O_RDONLY);
// This will give you a open descriptor
// Now on, you can read files just like any other *nix file...! :)
read(fd, mybuf, 128); // read 128 bytes from file..
OR
you can use zlib funtionality of syslinux with:
gzFile gzf = gzdopen(fd, "r");
gzread(gzf, mybuffer, 128);
etc...
//After you are done, you can close the descriptor with
close(fd);
// FS can be closed with
libfat_close(fs);
One thing which is missing is the way you specify file names for open.
It is the short name format of DOS. Would appreciate if someone can
add long file name search for libfat.
thanks.
--
Ram
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drive_partition_fs_syslinux_patch
Type: application/octet-stream
Size: 43340 bytes
Desc: not available
URL: <http://www.zytor.com/pipermail/syslinux/attachments/20070418/d4b26280/attachment.obj>
More information about the Syslinux
mailing list