j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: laurent Date: 2009-11-22 10:58:01 +0100 (Sun, 22 Nov 2009) New Revision: 630
Modified: trunk/openbios-devel/forth/debugging/client.fs trunk/openbios-devel/include/openbios/fs.h trunk/openbios-devel/modules/filesystems.c Log: Implement command "dir <path>". This is the generic command, it needs support from the filesystem packages.
Signed-off-by: Laurent Vivier Laurent@vivier.eu
Modified: trunk/openbios-devel/forth/debugging/client.fs =================================================================== --- trunk/openbios-devel/forth/debugging/client.fs 2009-11-22 09:53:54 UTC (rev 629) +++ trunk/openbios-devel/forth/debugging/client.fs 2009-11-22 09:58:01 UTC (rev 630) @@ -307,6 +307,23 @@ init-program ;
+: dir ( "{paths}<cr>" -- ) + linefeed parse 2dup + open-dev dup 0= if + 3drop + exit + then + dup >r + dup ihandle>phandle " dir" rot find-method ( xt 0|1 ) + if + swap call-package + else + 3drop + cr ." Cannot find dir for this package" + then + r> close-dev +; + : go ( -- ) state-valid @ not if exit then elf file-type @ = if
Modified: trunk/openbios-devel/include/openbios/fs.h =================================================================== --- trunk/openbios-devel/include/openbios/fs.h 2009-11-22 09:53:54 UTC (rev 629) +++ trunk/openbios-devel/include/openbios/fs.h 2009-11-22 09:58:01 UTC (rev 630) @@ -42,6 +42,7 @@ int (*read)( file_desc_t *file, void *buf, size_t count ); int (*lseek)( file_desc_t *file, off_t offset, int whence ); char *(*get_path)( file_desc_t *file, char *buf, int len ); + void (*dir)( file_desc_t *file );
const char *(*get_fstype)( fs_ops_t *fs ); };
Modified: trunk/openbios-devel/modules/filesystems.c =================================================================== --- trunk/openbios-devel/modules/filesystems.c 2009-11-22 09:53:54 UTC (rev 629) +++ trunk/openbios-devel/modules/filesystems.c 2009-11-22 09:58:01 UTC (rev 630) @@ -295,6 +295,21 @@ }
static void +files_dir( files_info_t *mi ) +{ + fs_ops_t *fs = do_open( my_parent() ); + char *path = pop_fstr_copy(); + + if (!path) + return; + + if (fs->dir) + fs->dir(mi->file); + + free(path); +} + +static void files_initializer( files_info_t *dummy ) { fword("register-fs-package"); @@ -309,6 +324,7 @@ { "seek", files_seek }, { "tell", files_tell }, { "load", files_load }, + { "dir", files_dir }, { "block-size", files_block_size },
/* special */