diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-08-20 21:54:00 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2020-08-20 21:54:00 -0400 |
commit | f850bbbbc4b7345bebde241f651bad1c5c28df66 (patch) | |
tree | 1574bcca604f0617130aa9f1c426cfcdc097c901 /firmware/include | |
parent | bd744059cf959c8b9086978b32660efef5925b7d (diff) | |
download | rockbox-f850bbbbc4.tar.gz rockbox-f850bbbbc4.zip |
Revert root_redirect :(
This reverts commit 31fc46ded69be7438cca2ba2c2b93c1f200165a6.
Change-Id: Ia78618c0e8b25ca65f7c8ae0db1cb9c9b321bad9
Diffstat (limited to 'firmware/include')
-rw-r--r-- | firmware/include/dircache_redirect.h | 58 | ||||
-rw-r--r-- | firmware/include/file_internal.h | 22 | ||||
-rw-r--r-- | firmware/include/fileobj_mgr.h | 5 | ||||
-rw-r--r-- | firmware/include/fs_defines.h | 11 | ||||
-rw-r--r-- | firmware/include/rb_namespace.h | 79 |
5 files changed, 12 insertions, 163 deletions
diff --git a/firmware/include/dircache_redirect.h b/firmware/include/dircache_redirect.h index e8cf8dc8f5..9fae16b551 100644 --- a/firmware/include/dircache_redirect.h +++ b/firmware/include/dircache_redirect.h @@ -20,16 +20,7 @@ ****************************************************************************/ #ifndef _DIRCACHE_REDIRECT_H_ -#include "rbpaths.h" -#include "pathfuncs.h" #include "dir.h" -#include "dircache.h" - -#if defined(HAVE_MULTIBOOT) && !defined(SIMULATOR) -#include "rb-loader.h" -#include "bootdata.h" -#include "crc32.h" -#endif /*** ** Internal redirects that depend upon whether or not dircache is made @@ -132,56 +123,10 @@ static inline void fileop_onsync_internal(struct filestr_base *stream) static inline void volume_onmount_internal(IF_MV_NONVOID(int volume)) { -#ifdef HAVE_MULTIVOLUME - char path[VOL_MAX_LEN+2]; - make_volume_root(volume, path); -#else - const char *path = PATH_ROOTSTR; -#endif - -#if defined(HAVE_MULTIBOOT) && !defined(SIMULATOR) - static char rtpath[VOL_MAX_LEN+2] = RB_ROOT_CONTENTS_DIR; - static bool redirected = false; - int boot_volume = 0; - unsigned int crc = 0; - - crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff); - if (crc == boot_data.crc) - { - root_mount_path(path, 0); /*root could be different folder don't hide*/ - boot_volume = boot_data.boot_volume; /* boot volume contained in uint8_t payload */ - //root_mount_path(path, volume == boot_volume ? NSITEM_HIDDEN : 0); - if (!redirected && volume == boot_volume) - { - if (get_redirect_dir(rtpath, sizeof(rtpath), volume, "", "") < 0) - { /* Error occurred, card removed? Set root to default */ - root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS); - } - else - redirected = true; - } - if (redirected && volume == boot_volume) - root_mount_path(rtpath, NSITEM_CONTENTS); - } /*CRC OK*/ - else - { - root_mount_path(path, RB_ROOT_VOL_HIDDEN(volume) ? NSITEM_HIDDEN : 0); - if (volume == path_strip_volume(RB_ROOT_CONTENTS_DIR, NULL, false)) - root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS); - } -#else - - root_mount_path(path, RB_ROOT_VOL_HIDDEN(volume) ? NSITEM_HIDDEN : 0); -#ifdef HAVE_MULTIVOLUME - if (volume == path_strip_volume(RB_ROOT_CONTENTS_DIR, NULL, false)) -#endif - root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS); - -#endif /* HAVE_MULTIBOOT */ - #ifdef HAVE_DIRCACHE dircache_mount(); #endif + IF_MV( (void)volume; ) } static inline void volume_onunmount_internal(IF_MV_NONVOID(int volume)) @@ -190,7 +135,6 @@ static inline void volume_onunmount_internal(IF_MV_NONVOID(int volume)) /* First, to avoid update of something about to be destroyed anyway */ dircache_unmount(IF_MV(volume)); #endif - root_unmount_volume(IF_MV(volume)); fileobj_mgr_unmount(IF_MV(volume)); } diff --git a/firmware/include/file_internal.h b/firmware/include/file_internal.h index f4bd8bb8c2..d62b5a8541 100644 --- a/firmware/include/file_internal.h +++ b/firmware/include/file_internal.h @@ -72,18 +72,16 @@ enum fildes_and_obj_flags /* used in descriptor and common */ FDO_BUSY = 0x0001, /* descriptor/object is in use */ /* only used in individual stream descriptor */ - FD_VALID = 0x0002, /* descriptor is valid but not registered */ - FD_WRITE = 0x0004, /* descriptor has write mode */ - FD_WRONLY = 0x0008, /* descriptor is write mode only */ - FD_APPEND = 0x0010, /* descriptor is append mode */ + FD_WRITE = 0x0002, /* descriptor has write mode */ + FD_WRONLY = 0x0004, /* descriptor is write mode only */ + FD_APPEND = 0x0008, /* descriptor is append mode */ FD_NONEXIST = 0x8000, /* closed but not freed (uncombined) */ /* only used as common flags */ - FO_DIRECTORY = 0x0020, /* fileobj is a directory */ - FO_TRUNC = 0x0040, /* fileobj is opened to be truncated */ - FO_REMOVED = 0x0080, /* fileobj was deleted while open */ - FO_SINGLE = 0x0100, /* fileobj has only one stream open */ - FO_MOUNTTARGET = 0x0200, /* fileobj kept open as a mount target */ - FDO_MASK = 0x03ff, + FO_DIRECTORY = 0x0010, /* fileobj is a directory */ + FO_TRUNC = 0x0020, /* fileobj is opened to be truncated */ + FO_REMOVED = 0x0040, /* fileobj was deleted while open */ + FO_SINGLE = 0x0080, /* fileobj has only one stream open */ + FDO_MASK = 0x00ff, FDO_CHG_MASK = FO_TRUNC, /* fileobj permitted external change */ /* bitflags that instruct various 'open' functions how to behave; * saved in stream flags (only) but not used by manager */ @@ -97,9 +95,7 @@ enum fildes_and_obj_flags FF_CACHEONLY = 0x00200000, /* succeed only if in dircache */ FF_INFO = 0x00400000, /* return info on self */ FF_PARENTINFO = 0x00800000, /* return info on parent */ - FF_DEVPATH = 0x01000000, /* path is a device path, not root-based */ - FF_NOFS = 0x02000000, /* no filesystem mounted here */ - FF_MASK = 0x03ff0000, + FF_MASK = 0x00ff0000, }; /** Common data structures used throughout **/ diff --git a/firmware/include/fileobj_mgr.h b/firmware/include/fileobj_mgr.h index 0db3520d34..627d2df341 100644 --- a/firmware/include/fileobj_mgr.h +++ b/firmware/include/fileobj_mgr.h @@ -29,11 +29,6 @@ void file_binding_remove(struct file_base_binding *bindp); void file_binding_remove_next(struct file_base_binding *prevp, struct file_base_binding *bindp); -bool fileobj_mount(const struct file_base_info *srcinfop, - unsigned int callflags, - struct file_base_binding **bindpp); -void fileobj_unmount(struct file_base_binding *bindp); - void fileobj_fileop_open(struct filestr_base *stream, const struct file_base_info *srcinfop, unsigned int callflags); diff --git a/firmware/include/fs_defines.h b/firmware/include/fs_defines.h index aee6daff6a..538c4b36cd 100644 --- a/firmware/include/fs_defines.h +++ b/firmware/include/fs_defines.h @@ -51,19 +51,12 @@ /* internal functions open streams as well; make sure they don't fail if all user descs are busy; this needs to be at least the greatest quantity needed at once by all internal functions */ -/* internal functions open streams as well; make sure they don't fail if all - user descs are busy; this needs to be at least the greatest quantity needed - at once by all internal functions */ -#define MOUNT_AUX_FILEOBJS 1 - #ifdef HAVE_DIRCACHE -#define DIRCACHE_AUX_FILEOBJS 1 +#define AUX_FILEOBJS 3 #else -#define DIRCACHE_AUX_FILEOBJS 0 +#define AUX_FILEOBJS 2 #endif -#define AUX_FILEOBJS (2+DIRCACHE_AUX_FILEOBJS+MOUNT_AUX_FILEOBJS) - /* number of components statically allocated to handle the vast majority of path depths; should maybe be tuned for >= 90th percentile but for now, imma just guessing based on something like: diff --git a/firmware/include/rb_namespace.h b/firmware/include/rb_namespace.h deleted file mode 100644 index 4d7a125c7b..0000000000 --- a/firmware/include/rb_namespace.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2017 by Michael Sevakis - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef RB_NAMESPACE_H -#define RB_NAMESPACE_H - -#include "file_internal.h" - -enum ns_item_flags -{ - NSITEM_MOUNTED = 0x01, /* item is mounted */ - NSITEM_HIDDEN = 0x02, /* item is not enumerated */ - NSITEM_CONTENTS = 0x04, /* contents enumerate */ -}; - -struct ns_scan_info -{ - struct dirscan_info scan; /* dirscan info - first! */ - int item; /* current item in parent */ -}; - -/* root functions */ -int root_mount_path(const char *path, unsigned int flags); -void root_unmount_volume(IF_MV_NONVOID(int volume)); -int root_readdir_dirent(struct filestr_base *stream, - struct ns_scan_info *scanp, - struct dirent *entry); - -/* namespace functions */ -int ns_parse_root(const char *path, const char **pathp, uint16_t *lenp); -int ns_open_root(IF_MV(int volume,) unsigned int *callflagsp, - struct file_base_info *infop, uint16_t *attrp); -int ns_open_stream(const char *path, unsigned int callflags, - struct filestr_base *stream, struct ns_scan_info *scanp); - -/* closes the namespace stream */ -static inline int ns_close_stream(struct filestr_base *stream) -{ - return close_stream_internal(stream); -} - -#include "dircache_redirect.h" - -static inline void ns_dirscan_rewind(struct ns_scan_info *scanp) -{ - rewinddir_dirent(&scanp->scan); - if (scanp->item != -1) - scanp->item = 0; -} - -static inline int ns_readdir_dirent(struct filestr_base *stream, - struct ns_scan_info *scanp, - struct dirent *entry) - -{ - if (scanp->item == -1) - return readdir_dirent(stream, &scanp->scan, entry); - else - return root_readdir_dirent(stream, scanp, entry); -} - -#endif /* RB_NAMESPACE_H */ |