From 4f60ed2dd7ce84ebc3bcbe97ed904c3398540dfb Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Mon, 30 Apr 2012 16:46:37 -0400 Subject: [PATCH] Backed out changeset 3812e7c1b642 (Bug 749661) for bustage on Android, r=red --- xpcom/io/nsLocalFileUnix.cpp | 53 +----------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index 885159a266aa..57cef5438ebc 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -165,16 +165,8 @@ nsDirEnumeratorUnix : public nsISimpleEnumerator, DIR *mDir; struct dirent *mEntry; nsCString mParentPath; -#ifdef ANDROID - off_t mNextOffset; -#endif }; -#ifdef ANDROID -#define YAFFS2_MAGIC 0x5941FF53 -static uint32_t sFSMagic = 0; -#endif - nsDirEnumeratorUnix::nsDirEnumeratorUnix() : mDir(nsnull), mEntry(nsnull) @@ -200,22 +192,6 @@ nsDirEnumeratorUnix::Init(nsLocalFile *parent, bool resolveSymlinks /*ignored*/) if (NS_FAILED(parent->GetNativePath(mParentPath))) return NS_ERROR_FAILURE; -#ifdef ANDROID - mNextOffset = -1; - if (!sFSMagic) { - struct STATFS fs; - if (!STATFS("/data", &fs)) { - sFSMagic = fs.f_type; - if (sFSMagic == YAFFS2_MAGIC) { - printf_stderr("Using YAFFS2 workarounds"); - } - } else { - printf_stderr("Could not determine the fs of /data"); - sFSMagic = 0xFFFFFFFF; - } - } -#endif - mDir = opendir(dirPath.get()); if (!mDir) return NSRESULT_FOR_ERRNO(); @@ -245,25 +221,6 @@ nsDirEnumeratorUnix::GetNext(nsISupports **_retval) NS_IMETHODIMP nsDirEnumeratorUnix::GetNextEntry() { -#ifdef ANDROID - /* Workaround yaffs2 bug - * - * This is only used on Android if /data is a yaffs2 partition. - * However, this workaround would apply to any linux system - * unlucky enough to be using yaffs2. - * - * yaffs2 may reset the offset on readdir calls if we've done something - * to a file in the directory since the last call. - * This can end up in an infinite loop. - */ - if (sFSMagic == YAFFS2_MAGIC && mNextOffset >= 0) { - // Let yaffs2 clobber the offset - mEntry = readdir(mDir); - // And then set the right offset we cached from last time - lseek(dirfd(mDir), mNextOffset, SEEK_SET); - } -#endif - do { errno = 0; mEntry = readdir(mDir); @@ -277,14 +234,6 @@ nsDirEnumeratorUnix::GetNextEntry() (mEntry->d_name[1] == '\0' || // .\0 (mEntry->d_name[1] == '.' && mEntry->d_name[2] == '\0'))); // ..\0 - -#ifdef ANDROID - // Save the correct offset for the next entry - if (sFSMagic == YAFFS2_MAGIC) { - mNextOffset = lseek(dirfd(mDir), 0, SEEK_CUR); - } -#endif - return NS_OK; } @@ -1042,7 +991,7 @@ nsLocalFile::Remove(bool recursive) rv = file->Remove(recursive); #ifdef ANDROID - // See bug 580434 - Yaffs2 gives us just deleted files + // See bug 580434 - Bionic gives us just deleted files if (rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) continue; #endif