1
0
Fork 0
forked from len0rd/rockbox
foxbox/firmware/include/dir.h
William Wilgus fdc3668a6a [BugFix] Multiboot Database duplicate files
When the sd card is mounted into the root namespace the database
picks up files through both paths

previously we hid the mounted drive but this causes issues with users
databases when the drive letter changes

Adds a way to keep track of volumes mounted in the root namespace

Hides the enumerated volume in root

Database:
we can just parse the root directory ('/') and get to any mounted
volume but we can also enumerate a volume in the root directory
when this occurs it leads to multiple entries since the files can
be reached through multiple paths ex, /Foo could also be /SD1/Foo
Instead we will attempt to rewrite the root with any non-hidden volumes
failing that just leave the paths alone

Change-Id: I7bdba8cfaf63902d2a3852d28484bcf8ca317ebd
2024-03-23 01:03:33 -04:00

94 lines
2.6 KiB
C

/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2007 by Kévin Ferrare
*
* 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 _DIR_H_
#define _DIR_H_
#include <sys/types.h>
#include <fcntl.h>
#include <time.h>
#include "config.h"
#include "fs_attr.h"
#if defined (APPLICATION) || defined(CHECKWPS)
#include "filesystem-app.h"
#elif defined(SIMULATOR) || defined(DBTOOL)
#include "../../uisimulator/common/filesystem-sim.h"
#else
#include "filesystem-native.h"
#endif
#ifndef DIRFUNCTIONS_DEFINED
#ifndef opendir
#define opendir FS_PREFIX(opendir)
#endif
#ifndef readdir
#define readdir FS_PREFIX(readdir)
#endif
#ifndef readdir_r
#define readdir_r FS_PREFIX(readdir_r)
#endif
#ifndef rewinddir
#define rewinddir FS_PREFIX(rewinddir)
#endif
#ifndef closedir
#define closedir FS_PREFIX(closedir)
#endif
#ifndef mkdir
#define mkdir FS_PREFIX(mkdir)
#endif
#ifndef rmdir
#define rmdir FS_PREFIX(rmdir)
#endif
#ifndef samedir
#define samedir FS_PREFIX(samedir)
#endif
#ifndef dir_exists
#define dir_exists FS_PREFIX(dir_exists)
#endif
#ifndef root_realpath
#define root_realpath FS_PREFIX(root_realpath)
#endif
#endif /* !DIRFUNCTIONS_DEFINED */
#ifndef DIRENT_DEFINED
struct DIRENT
{
struct dirinfo_native info; /* platform extra info */
char d_name[MAX_PATH]; /* UTF-8 name of entry (last!) */
};
#endif /* DIRENT_DEFINED */
struct dirinfo
{
unsigned int attribute; /* attribute bits of file */
off_t size; /* binary size of file */
time_t mtime; /* local file time */
};
#ifndef DIRFUNCTIONS_DECLARED
/* TIP: set errno to zero before calling to see if anything failed */
struct dirinfo dir_get_info(DIR *dirp, struct DIRENT *entry);
const char* root_realpath(void);
#endif /* !DIRFUNCTIONS_DECLARED */
#endif /* _DIR_H_ */