Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2155)

Unified Diff: crypto/nss_util.cc

Issue 147933003: Use file_util::GetFileSystemType() in crypto/nss_util.cc. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix typo Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/nss_util.cc
===================================================================
--- crypto/nss_util.cc (revision 248111)
+++ crypto/nss_util.cc (working copy)
@@ -13,10 +13,7 @@
#include <prtime.h>
#include <secmod.h>
-#if defined(OS_LINUX)
-#include <linux/nfs_fs.h>
-#include <sys/vfs.h>
-#elif defined(OS_OPENBSD)
+#if defined(OS_OPENBSD)
#include <sys/mount.h>
#include <sys/param.h>
#endif
@@ -147,21 +144,25 @@
// Because this function sets an environment variable it must be run before we
// go multi-threaded.
void UseLocalCacheOfNSSDatabaseIfNFS(const base::FilePath& database_dir) {
-#if defined(OS_LINUX) || defined(OS_OPENBSD)
- struct statfs buf;
- if (statfs(database_dir.value().c_str(), &buf) == 0) {
+ bool db_on_nfs = false;
#if defined(OS_LINUX)
- if (buf.f_type == NFS_SUPER_MAGIC) {
+ file_util::FileSystemType fs_type = file_util::FILE_SYSTEM_UNKNOWN;
+ if (file_util::GetFileSystemType(database_dir, &fs_type))
+ db_on_nfs = (fs_type == file_util::FILE_SYSTEM_NFS);
#elif defined(OS_OPENBSD)
- if (strcmp(buf.f_fstypename, MOUNT_NFS) == 0) {
+ struct statfs buf;
+ if (statfs(database_dir.value().c_str(), &buf) == 0)
+ db_on_nfs = (strcmp(buf.f_fstypename, MOUNT_NFS) == 0);
+#else
+ NOTIMPLEMENTED();
#endif
- scoped_ptr<base::Environment> env(base::Environment::Create());
- const char* use_cache_env_var = "NSS_SDB_USE_CACHE";
- if (!env->HasVar(use_cache_env_var))
- env->SetVar(use_cache_env_var, "yes");
- }
+
+ if (db_on_nfs) {
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ static const char kUseCacheEnvVar[] = "NSS_SDB_USE_CACHE";
+ if (!env->HasVar(kUseCacheEnvVar))
+ env->SetVar(kUseCacheEnvVar, "yes");
}
-#endif // defined(OS_LINUX) || defined(OS_OPENBSD)
}
#endif // defined(USE_NSS)
@@ -909,10 +910,10 @@
paths.push_back(base::FilePath("/usr/lib/arm-linux-gnueabihf/nss"));
#else
paths.push_back(base::FilePath("/usr/lib/arm-linux-gnueabi/nss"));
-#endif
+#endif // defined(__ARM_PCS_VFP)
#elif defined(ARCH_CPU_MIPSEL)
paths.push_back(base::FilePath("/usr/lib/mipsel-linux-gnu/nss"));
-#endif
+#endif // defined(ARCH_CPU_X86_64)
// A list of library files to load.
std::vector<std::string> libs;
@@ -938,7 +939,7 @@
} else {
LOG(ERROR) << "Failed to load NSS libraries.";
}
-#endif
+#endif // defined(USE_NSS)
}
bool CheckNSSVersion(const char* version) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698