| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 module filesystem; | 5 module filesystem; |
| 6 | 6 |
| 7 // Error codes used by the file system. These error codes line up exactly with | 7 // Error codes used by the file system. These error codes line up exactly with |
| 8 // those of base::File. | 8 // those of base::File. |
| 9 enum FileError { | 9 enum Error { |
| 10 OK = 0, | 10 OK = 0, |
| 11 FAILED = -1, | 11 FAILED = -1, |
| 12 IN_USE = -2, | 12 IN_USE = -2, |
| 13 EXISTS = -3, | 13 EXISTS = -3, |
| 14 NOT_FOUND = -4, | 14 NOT_FOUND = -4, |
| 15 ACCESS_DENIED = -5, | 15 ACCESS_DENIED = -5, |
| 16 TOO_MANY_OPENED = -6, | 16 TOO_MANY_OPENED = -6, |
| 17 NO_MEMORY = -7, | 17 NO_MEMORY = -7, |
| 18 NO_SPACE = -8, | 18 NO_SPACE = -8, |
| 19 NOT_A_DIRECTORY = -9, | 19 NOT_A_DIRECTORY = -9, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 43 struct TimespecOrNow { | 43 struct TimespecOrNow { |
| 44 bool now; | 44 bool now; |
| 45 double seconds; | 45 double seconds; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // Describes various information about a file or directory (for |Stat()|). Note | 48 // Describes various information about a file or directory (for |Stat()|). Note |
| 49 // that access/modification times may be set arbitrarily (by those with | 49 // that access/modification times may be set arbitrarily (by those with |
| 50 // appropriate capabilities) and may not reflect reality. | 50 // appropriate capabilities) and may not reflect reality. |
| 51 struct FileInformation { | 51 struct FileInformation { |
| 52 // Type of the file. | 52 // Type of the file. |
| 53 FsFileType type; | 53 FileType type; |
| 54 // Size of the file, in bytes. Zero for directories. | 54 // Size of the file, in bytes. Zero for directories. |
| 55 int64 size; | 55 int64 size; |
| 56 // Last access time, in seconds since Unix Epoch. | 56 // Last access time, in seconds since Unix Epoch. |
| 57 double atime; | 57 double atime; |
| 58 // Last modification time, in seconds since Unix Epoch. | 58 // Last modification time, in seconds since Unix Epoch. |
| 59 double mtime; | 59 double mtime; |
| 60 // Create time of the file, in seconds since Unix Epoch. | 60 // Create time of the file, in seconds since Unix Epoch. |
| 61 double ctime; | 61 double ctime; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // File and directory open flags. Is a limited subset of base::File::Flags. Thes
e | 64 // File and directory open flags. Is a limited subset of base::File::Flags. Thes
e |
| 65 // are constants instead of enums so that they are bitwise OR-able. | 65 // are constants instead of enums so that they are bitwise OR-able. |
| 66 | 66 |
| 67 // Opens a file, only if it exists. | 67 // Opens a file, only if it exists. |
| 68 const uint32 kFlagOpen = 0x1; | 68 const uint32 kFlagOpen = 0x1; |
| 69 // Creates a new file, only if it does not already exist. | 69 // Creates a new file, only if it does not already exist. |
| 70 const uint32 kFlagCreate = 0x2; | 70 const uint32 kFlagCreate = 0x2; |
| 71 // May create a new file. | 71 // May create a new file. |
| 72 const uint32 kFlagOpenAlways = 0x4; | 72 const uint32 kFlagOpenAlways = 0x4; |
| 73 // May overwrite an old file. | 73 // May overwrite an old file. |
| 74 const uint32 kCreateAlways = 0x8; | 74 const uint32 kCreateAlways = 0x8; |
| 75 // Opens a file and truncates it, only if it exists. | 75 // Opens a file and truncates it, only if it exists. |
| 76 const uint32 kFlagOpenTruncated = 0x10; | 76 const uint32 kFlagOpenTruncated = 0x10; |
| 77 const uint32 kFlagRead = 0x20; | 77 const uint32 kFlagRead = 0x20; |
| 78 const uint32 kFlagWrite = 0x40; | 78 const uint32 kFlagWrite = 0x40; |
| 79 const uint32 kFlagAppend = 0x80; | 79 const uint32 kFlagAppend = 0x80; |
| 80 | 80 |
| 81 // File types. | 81 // File types. |
| 82 // | 82 enum FileType { |
| 83 // Note: This is named FsFileType because otherwise we have a name collision | |
| 84 // with windows.h. | |
| 85 enum FsFileType { | |
| 86 UNKNOWN = 0, | 83 UNKNOWN = 0, |
| 87 REGULAR_FILE, | 84 REGULAR_FILE, |
| 88 DIRECTORY, | 85 DIRECTORY, |
| 89 }; | 86 }; |
| 90 | 87 |
| 91 // Describes a directory entry (i.e., a single member of a directory). | 88 // Describes a directory entry (i.e., a single member of a directory). |
| 92 struct DirectoryEntry { | 89 struct DirectoryEntry { |
| 93 FsFileType type; | 90 FileType type; |
| 94 string name; | 91 string name; |
| 95 }; | 92 }; |
| 96 | 93 |
| 97 // Deletion flags: | 94 // Deletion flags: |
| 98 // Recursively delete. | 95 // Recursively delete. |
| 99 const uint32 kDeleteFlagRecursive = 0x1; | 96 const uint32 kDeleteFlagRecursive = 0x1; |
| OLD | NEW |