OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <sys/vfs.h> | 10 #include <sys/vfs.h> |
11 | 11 |
12 namespace file_util { | 12 namespace file_util { |
13 | 13 |
14 bool GetFileSystemType(const FilePath& path, FileSystemType* type) { | 14 bool GetFileSystemType(const base::FilePath& path, FileSystemType* type) { |
15 struct statfs statfs_buf; | 15 struct statfs statfs_buf; |
16 if (statfs(path.value().c_str(), &statfs_buf) < 0) { | 16 if (statfs(path.value().c_str(), &statfs_buf) < 0) { |
17 if (errno == ENOENT) | 17 if (errno == ENOENT) |
18 return false; | 18 return false; |
19 *type = FILE_SYSTEM_UNKNOWN; | 19 *type = FILE_SYSTEM_UNKNOWN; |
20 return true; | 20 return true; |
21 } | 21 } |
22 | 22 |
23 // While you would think the possible values of f_type would be available | 23 // While you would think the possible values of f_type would be available |
24 // in a header somewhere, it appears that is not the case. These values | 24 // in a header somewhere, it appears that is not the case. These values |
(...skipping 28 matching lines...) Expand all Loading... |
53 case 0x27e0eb: // CGROUP | 53 case 0x27e0eb: // CGROUP |
54 *type = FILE_SYSTEM_CGROUP; | 54 *type = FILE_SYSTEM_CGROUP; |
55 break; | 55 break; |
56 default: | 56 default: |
57 *type = FILE_SYSTEM_OTHER; | 57 *type = FILE_SYSTEM_OTHER; |
58 } | 58 } |
59 return true; | 59 return true; |
60 } | 60 } |
61 | 61 |
62 } // namespace | 62 } // namespace |
OLD | NEW |