From 6eaab4d00446c070c655f0e6c9a872532a776b6f Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 1 Sep 2010 21:29:34 +0000 Subject: Ged rid of uisimulator/common/io.c for android builds. Use host's functions for file i/o directly (open(), close() ,etc.), not the sim_* variants. Some dir functions need to be wrapped still because we need to cache the parents dir's path (host's dirent doesn't let us know). For the same reason (incompatibility) with host's dirent) detach some members from Rockbox' dirent struct and put it into an extra one, the values can be retrieved via the new dir_get_info(). Get rid of the sim_ prefix for sleep as well and change the signature to unix sleep(). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27968 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/SOURCES | 4 +++- uisimulator/common/io.c | 21 +++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'uisimulator') diff --git a/uisimulator/common/SOURCES b/uisimulator/common/SOURCES index a30b5abeb2..39f008b9dd 100644 --- a/uisimulator/common/SOURCES +++ b/uisimulator/common/SOURCES @@ -9,8 +9,10 @@ fmradio.c backlight-sim.c #endif +#if !(CONFIG_PLATFORM & PLATFORM_ANDROID) +io.c +#endif /* this is still needed for application since it has some stubs */ powermgmt-sim.c -io.c sim_tasks.c stubs.c diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 6547421668..f630ae49c8 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c @@ -158,13 +158,18 @@ extern const char *sim_root_dir; static int num_openfiles = 0; -struct sim_dirent { - unsigned char d_name[MAX_PATH]; +/* from dir.h */ +struct dirinfo { int attribute; long size; + unsigned short wrtdate; + unsigned short wrttime; +}; + +struct sim_dirent { + unsigned char d_name[MAX_PATH]; + struct dirinfo info; long startcluster; - unsigned short wrtdate; /* Last write date */ - unsigned short wrttime; /* Last write time */ }; struct dirstruct { @@ -329,14 +334,14 @@ struct sim_dirent *sim_readdir(MYDIR *dir) #define ATTR_DIRECTORY 0x10 - secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0; - secret.size = s.st_size; + secret.info.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0; + secret.info.size = s.st_size; tm = localtime(&(s.st_mtime)); - secret.wrtdate = ((tm->tm_year - 80) << 9) | + secret.info.wrtdate = ((tm->tm_year - 80) << 9) | ((tm->tm_mon + 1) << 5) | tm->tm_mday; - secret.wrttime = (tm->tm_hour << 11) | + secret.info.wrttime = (tm->tm_hour << 11) | (tm->tm_min << 5) | (tm->tm_sec >> 1); return &secret; -- cgit