const char *GetString(int num) { // First, search for platform-specific variable string switch (num) { case STR_EXTFS_VOLUME_NAME: return get_volume_name(); } // Next, search for platform-specific constant string int i = 0; while (platform_strings[i].num >= 0) { if (platform_strings[i].num == num) return platform_strings[i].str; i++; } // Not found, search for common string i = 0; while (common_strings[i].num >= 0) { if (common_strings[i].num == num) return common_strings[i].str; i++; } return NULL; }
static int readdir_volume_inner(struct dirstr_desc *dir, struct dirent *entry) { /* Volumes (secondary file systems) get inserted into the system root * directory. If the path specified volume 0, enumeration will not * include other volumes, but just its own files and directories. * * Fake special directories, which don't really exist, that will get * redirected upon opendir() */ while (++dir->volumecounter < NUM_VOLUMES) { /* on the system root */ if (!fat_ismounted(dir->volumecounter)) continue; get_volume_name(dir->volumecounter, entry->d_name); dir->entry.info.attr = ATTR_MOUNT_POINT; dir->entry.info.size = 0; dir->entry.info.wrtdate = 0; dir->entry.info.wrttime = 0; return 1; } /* do normal directory entry fetching */ return 0; }
/* A special link is created under e.g. HOME_DIR/<microSD1>, e.g. to access * external storage in a convenient location, much similar to the mount * point on our native targets. Here they are treated as symlink (one which * doesn't actually exist in the filesystem and therefore we have to override * readlink() */ static const char *handle_special_links(const char* link, unsigned flags, char *buf, const size_t bufsize) { (void) flags; char vol_string[VOL_MAX_LEN + 1]; int len; for (int i = 1; i < NUM_VOLUMES; i++) { len = get_volume_name(i, vol_string); /* link might be passed with or without HOME_DIR expanded. To handle * both perform substring matching (VOL_NAMES is unique enough) */ const char *begin = strstr(link, vol_string); if (begin) { /* begin now points to the start of vol_string within link, * we want to copy the remainder of the paths, prefixed by * the actual mount point (the remainder might be "") */ snprintf(buf, bufsize, MULTIDRIVE_DIR"%s", begin + len); return buf; } } return link; }
bool LabelVisitor::VisitLabel(struct exfat_entry* entry) { TRACE("LabelVisitor::VisitLabel()\n"); char name[B_FILE_NAME_LENGTH]; status_t result = get_volume_name(entry, name, sizeof(name)); if (result != B_OK) return false; fVolume->SetName(name); return true; }