From 64f58cf827535a5fdf8b472f089638db7f44c427 Mon Sep 17 00:00:00 2001 From: Mike Ryan Date: Fri, 26 Aug 2011 13:59:01 -0700 Subject: [PATCH] open a fat_file_t from a dirent --- posix.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/posix.c b/posix.c index e301581..0fbb23f 100644 --- a/posix.c +++ b/posix.c @@ -88,6 +88,20 @@ int fat_open(const char *filename, char *flags, fat_file_t *file) { } /** + * Open a file from a dirent. Assumes you've found the file you desire using + * fat_find_create. + */ +void fat_open_from_dirent(fat_file_t *file, fat_dirent *de) { + file->de = *de; + file->dir = 0; // FIXME ? + + file->cluster = de->start_cluster; + file->sector = 0; + file->offset = 0; + file->position = 0; +} + +/** * Read len bytes out of file into buf. * * Returns the number of bytes read. -- 1.7.10.4