| // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "base/files/file_util.h" |
| #include "base/files/file_path.h" |
| #include "starboard/types.h" |
| bool GetFileSystemType(const FilePath& path, FileSystemType* type) { |
| struct statfs statfs_buf; |
| if (statfs(path.value().c_str(), &statfs_buf) < 0) { |
| *type = FILE_SYSTEM_UNKNOWN; |
| // Not all possible |statfs_buf.f_type| values are in linux/magic.h. |
| // Missing values are copied from the statfs man page. |
| switch (statfs_buf.f_type) { |
| case EXT2_SUPER_MAGIC: // Also ext3 and ext4 |
| case REISERFS_SUPER_MAGIC: |
| *type = FILE_SYSTEM_ORDINARY; |
| *type = FILE_SYSTEM_CODA; |
| *type = FILE_SYSTEM_MEMORY; |
| *type = FILE_SYSTEM_CGROUP; |
| *type = FILE_SYSTEM_OTHER; |