Gene Cumm
2014-Mar-02 14:30 UTC
[syslinux] stat() (was: pull request: upgrade to Lua 5.2.3, automatic Linux boot menu and cmenu binding)
On Sun, Mar 2, 2014 at 3:53 AM, Ferenc Wagner <wferi at niif.hu> wrote:>> And an official stat() implementation would be very useful. After >> inventing mine, I noticed rosh also invented its own...#include <sys/stat.h> int stat(const char *path, struct stat *buf); I invented my own in rosh after not having one in the libraries based on what I thought was the most reasonable use of existing functions. -- -Gene
Gene Cumm <gene.cumm at gmail.com> writes:> On Sun, Mar 2, 2014 at 3:53 AM, Ferenc Wagner <wferi at niif.hu> wrote: > >>> And an official stat() implementation would be very useful. After >>> inventing mine, I noticed rosh also invented its own... > > #include <sys/stat.h> > int stat(const char *path, struct stat *buf); > > I invented my own in rosh after not having one in the libraries based > on what I thought was the most reasonable use of existing functions.Yes, that's what I mentioned, but I can't find it in the library modules, only in rosh.elf. Or maybe I didn't get your point. Could you elaborate, please? On the other hand, your implementation (as well as mine) calls open() and opendir() to identify files and directories. That more or less works for everyday purposes (and FAT filesystems), but I wonder whether there's more available power in dirent() in other filesystem drivers. Maybe a searchdir()-based stat() implementation would be better from all aspects, but I don't know enough about the internals to judge. -- Regards, Feri.
Seemingly Similar Threads
- pull request: upgrade to Lua 5.2.3, automatic Linux boot menu and cmenu binding
- pull request: upgrade to Lua 5.2.3, automatic Linux boot menu and cmenu binding
- Upgrade to Lua 5.2.2, add filesystem module and get_key binding
- [PATCH 0/2] improve Lua API for files and initramfs objects
- [PATCH 0/2] improve Lua API for files and initramfs objects