rockbox/firmware/include/dir.h
Aidan MacDonald 3a57f2f721 Add "rbfs" prefix to native filesystem functions
Most of the churn here occurs because 'filesize' is one of
the redefined filesystem functions, but some of the structs
used by the native FS code also include a 'filesize' member
variable which gets renamed by the macro in some but not all
source files.

It's easier to rename 'filesize()' to 'ffilesize()' rather
than try to clean up the macro mess or renaming the struct
members.

There is weirdness with root_realpath() which now breaks on
native builds because it was assumed to be unprefixed there.
dir_get_info() was unprefixed everywhere but this just seems
inconsistent; make it follow the FS_PREFIX() convention too.

Change-Id: Ic3700c6234ea45f32679c1a8429d70fdb8f4088a
2026-09-17 16:22:31 -04:00

91 lines
2.6 KiB
C

/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* 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"
#include "fs_defines.h"
#if (CONFIG_PLATFORM & PLATFORM_GAME_CONSOLE) && !defined(SIMULATOR)
#include "filesystem-console.h"
#elif 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 dir_get_info
#define dir_get_info FS_PREFIX(dir_get_info)
#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 */
};
#endif /* _DIR_H_ */