summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-17 15:57:07 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-17 17:10:52 -0400
commit012908e0641f0581ee2d0515596db287ee5edf4c (patch)
treeff64817ab09dc99fc2bcf0e51c27a0f4b55ed948
parenta68fc3b6c2eca281738b853bb2f508ac49ddfee1 (diff)
downloadrockbox-012908e0641f0581ee2d0515596db287ee5edf4c.tar.gz
rockbox-012908e0641f0581ee2d0515596db287ee5edf4c.zip
hosted: Fix HAVE_MULTIDRIVE to work properly with PIVOT_ROOT
Change-Id: Ibc97de5c345e88c19ad8ba8c05fefebbada08790
-rw-r--r--firmware/export/config/samsungypr0.h2
-rw-r--r--firmware/target/hosted/filesystem-app.c16
2 files changed, 13 insertions, 5 deletions
diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h
index 655ed811b7..286299bf81 100644
--- a/firmware/export/config/samsungypr0.h
+++ b/firmware/export/config/samsungypr0.h
@@ -164,7 +164,7 @@
164 164
165/* External SD card can be mounted */ 165/* External SD card can be mounted */
166#define CONFIG_STORAGE (STORAGE_HOSTFS|STORAGE_SD) 166#define CONFIG_STORAGE (STORAGE_HOSTFS|STORAGE_SD)
167#define HAVE_MULTIDRIVE 167#define HAVE_MULTIDRIVE /* But _not_ CONFIG_STORAGE_MULTI */
168#define NUM_DRIVES 2 168#define NUM_DRIVES 2
169#define HAVE_HOTSWAP 169#define HAVE_HOTSWAP
170#define HAVE_STORAGE_FLUSH 170#define HAVE_STORAGE_FLUSH
diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c
index 16ad5e312f..93057e7a83 100644
--- a/firmware/target/hosted/filesystem-app.c
+++ b/firmware/target/hosted/filesystem-app.c
@@ -8,6 +8,7 @@
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2010 Thomas Martitz 10 * Copyright (C) 2010 Thomas Martitz
11 * Copyright (C) 2020 Solomon Peachy
11 * 12 *
12 * This program is free software; you can redistribute it and/or 13 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 14 * modify it under the terms of the GNU General Public License
@@ -53,8 +54,10 @@ static const char rbhome[] = "/sdcard";
53#elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \ 54#elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \
54 && !defined(__PCTOOL__) 55 && !defined(__PCTOOL__)
55static const char *rbhome; 56static const char *rbhome;
57#elif defined(PIVOT_ROOT)
58static const char rbhome[] = PIVOT_ROOT;
56#else 59#else
57/* YPR0, YPR1, NWZ, etc */ 60/* Anything else? */
58static const char rbhome[] = HOME_DIR; 61static const char rbhome[] = HOME_DIR;
59#endif 62#endif
60#endif 63#endif
@@ -94,9 +97,7 @@ static const char *handle_special_links(const char* link, unsigned flags,
94 97
95 return link; 98 return link;
96} 99}
97#endif
98 100
99#ifdef HAVE_MULTIDRIVE
100/* we keep an open descriptor of the home directory to detect when it has been 101/* we keep an open descriptor of the home directory to detect when it has been
101 opened by opendir() so that its "symlinks" may be enumerated */ 102 opened by opendir() so that its "symlinks" may be enumerated */
102static void cleanup_rbhome(void) 103static void cleanup_rbhome(void)
@@ -209,12 +210,19 @@ const char * handle_special_dirs(const char *dir, unsigned flags,
209 dir = _get_user_file_path(dir, flags, buf, bufsize); 210 dir = _get_user_file_path(dir, flags, buf, bufsize);
210#endif 211#endif
211#ifdef HAVE_MULTIDRIVE 212#ifdef HAVE_MULTIDRIVE
213#define MULTIDRIVE_DIR_LEN (sizeof(MULTIDRIVE_DIR)-1)
214
212 dir = handle_special_links(dir, flags, buf, bufsize); 215 dir = handle_special_links(dir, flags, buf, bufsize);
213#endif 216#endif
214#ifdef PIVOT_ROOT 217#ifdef PIVOT_ROOT
215#define PIVOT_ROOT_LEN (sizeof(PIVOT_ROOT)-1) 218#define PIVOT_ROOT_LEN (sizeof(PIVOT_ROOT)-1)
216 /* Prepend root prefix to find actual path */ 219 /* Prepend root prefix to find actual path */
217 if (strncmp(PIVOT_ROOT, dir, PIVOT_ROOT_LEN)) 220 if (strncmp(PIVOT_ROOT, dir, PIVOT_ROOT_LEN)
221#ifdef MULTIDRIVE_DIR
222 /* Unless it's a MULTIDRIVE dir, in which case use as-is */
223 && strncmp(MULTIDRIVE_DIR, dir, MULTIDRIVE_DIR_LEN)
224#endif
225 )
218 { 226 {
219 snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir); 227 snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir);
220 dir = buf; 228 dir = buf;