static void dir_fs ( file_desc_t *fd ) { iso9660_COMMON *common = (iso9660_COMMON *)fd; struct iso_directory_record *idr; char name_buf[256]; if (common->type != DIR) return; forth_printf("\n"); while ( (idr = iso9660_readdir(common->dir)) ) { forth_printf("% 10d ", isonum_733(idr->size)); forth_printf("%d-%02d-%02d %02d:%02d:%02d ", idr->date[0] + 1900, /* year */ idr->date[1], /* month */ idr->date[2], /* day */ idr->date[3], idr->date[4], idr->date[5]); iso9660_name(common->dir->volume, idr, name_buf); if (idr->flags[0] & 2) forth_printf("%s\\\n", name_buf); else forth_printf("%s\n", name_buf); } }
/* static method, ( pathstr len ihandle -- ) */ static void grubfs_files_dir( grubfs_info_t *dummy ) { forth_printf("dir method not implemented for grubfs filesystem\n"); POP(); POP(); POP(); }
/* static method, ( pathstr len ihandle -- ) */ static void hfsp_files_dir( hfsp_info_t *dummy ) { forth_printf("dir method not implemented for HFS+ filesystem\n"); POP(); POP(); POP(); }
/* ( -- success? ) */ static void grubfs_files_open( grubfs_info_t *mi ) { int fd, i; char *path = my_args_copy(); char *s; fd = open_ih( my_parent() ); if ( fd == -1 ) { free( path ); RET( 0 ); } mi->gfs = &dummy_fs; for (i = 0; i < sizeof(fsys_table)/sizeof(fsys_table[0]); i++) { #ifdef CONFIG_DEBUG_FS printk("Trying %s\n", fsys_table[i].name); #endif if (fsys_table[i].mount_func()) { const fsys_entry_t *fsys = &fsys_table[i]; #ifdef CONFIG_DEBUG_FS printk("Mounted %s\n", fsys->name); #endif mi->gfs = malloc(sizeof(grubfs_t)); mi->gfs->fsys = fsys; mi->gfs->dev_fd = fd; mi->gfs->offset = 0; s = path; while (*s) { if(*s=='\\') *s='/'; s++; } #ifdef CONFIG_DEBUG_FS printk("Path=%s\n",path); #endif if (!mi->gfs->fsys->dir_func((char *) path)) { forth_printf("File not found\n"); RET( 0 ); } mi->gfs->fd = malloc(sizeof(grubfile_t)); mi->gfs->fd->pos = filepos; mi->gfs->fd->len = filemax; mi->gfs->fd->path = strdup(path); RET( -1 ); } } #ifdef CONFIG_DEBUG_FS printk("Unknown filesystem type\n"); #endif RET( 0 ); }