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
3 // found in the LICENSE file.
7 // Error codes used by the file system. These error codes line up exactly with
8 // those of base::File.
20 INVALID_OPERATION = -10,
29 // Used to explain the meaning of an offset within a file. These values line up
30 // exactly with base::File.
32 // Offset is relative to the beginning of the file.
34 // Offset is from current position in the file.
36 // Offset is relative to the end of the file.
40 // Used for |Touch()| calls. If |now| is set, |timespec| must be null (the time
41 // "now" will be used). Otherwise, |timespec| must not be null.
42 // TODO(vtl): Use a union instead, when that becomes possible.
43 struct TimespecOrNow {
48 // Describes various information about a file or directory (for |Stat()|). Note
49 // that access/modification times may be set arbitrarily (by those with
50 // appropriate capabilities) and may not reflect reality.
51 struct FileInformation {
54 // Size of the file, in bytes. Zero for directories.
56 // Last access time, in seconds since Unix Epoch.
58 // Last modification time, in seconds since Unix Epoch.
60 // Create time of the file, in seconds since Unix Epoch.
64 // File and directory open flags. Is a limited subset of base::File::Flags. These
65 // are constants instead of enums so that they are bitwise OR-able.
67 // Opens a file, only if it exists.
68 const uint32 kFlagOpen = 0x1;
69 // Creates a new file, only if it does not already exist.
70 const uint32 kFlagCreate = 0x2;
71 // May create a new file.
72 const uint32 kFlagOpenAlways = 0x4;
73 // May overwrite an old file.
74 const uint32 kCreateAlways = 0x8;
75 // Opens a file and truncates it, only if it exists.
76 const uint32 kFlagOpenTruncated = 0x10;
77 const uint32 kFlagRead = 0x20;
78 const uint32 kFlagWrite = 0x40;
79 const uint32 kFlagAppend = 0x80;
80 // Deletes the file when closed.
81 const uint32 kDeleteOnClose = 0x2000;
85 // Note: This is named FsFileType because otherwise we have a name collision
93 // Describes a directory entry (i.e., a single member of a directory).
94 struct DirectoryEntry {
100 // Recursively delete.
101 const uint32 kDeleteFlagRecursive = 0x1;