mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Implement command "dir <path>".
This is the generic command, it needs support from the filesystem packages. Signed-off-by: Laurent Vivier <Laurent@vivier.eu> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@630 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -307,6 +307,23 @@ variable bootinfo-size
|
|||||||
init-program
|
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 ( -- )
|
: go ( -- )
|
||||||
state-valid @ not if exit then
|
state-valid @ not if exit then
|
||||||
elf file-type @ = if
|
elf file-type @ = if
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ struct fs_ops {
|
|||||||
int (*read)( file_desc_t *file, void *buf, size_t count );
|
int (*read)( file_desc_t *file, void *buf, size_t count );
|
||||||
int (*lseek)( file_desc_t *file, off_t offset, int whence );
|
int (*lseek)( file_desc_t *file, off_t offset, int whence );
|
||||||
char *(*get_path)( file_desc_t *file, char *buf, int len );
|
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 );
|
const char *(*get_fstype)( fs_ops_t *fs );
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -294,6 +294,21 @@ files_block_size( files_info_t *dummy )
|
|||||||
PUSH(512);
|
PUSH(512);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
files_initializer( files_info_t *dummy )
|
files_initializer( files_info_t *dummy )
|
||||||
{
|
{
|
||||||
@@ -309,6 +324,7 @@ NODE_METHODS( files ) = {
|
|||||||
{ "seek", files_seek },
|
{ "seek", files_seek },
|
||||||
{ "tell", files_tell },
|
{ "tell", files_tell },
|
||||||
{ "load", files_load },
|
{ "load", files_load },
|
||||||
|
{ "dir", files_dir },
|
||||||
{ "block-size", files_block_size },
|
{ "block-size", files_block_size },
|
||||||
|
|
||||||
/* special */
|
/* special */
|
||||||
|
|||||||
Reference in New Issue
Block a user