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

Side by Side Diff: services/files/types.mojom

Issue 1013313002: Move services/files/*.mojom -> mojo/services/files/public/interfaces/. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « services/files/shared_impl.h ('k') | services/files/util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 module mojo.files;
6
7 // Error codes used by the file manager.
8 // TODO(vtl): Add more (to, e.g., cover all of errno).
9 enum Error {
10 OK = 0,
11 UNKNOWN,
12 INVALID_ARGUMENT,
13 PERMISSION_DENIED,
14 OUT_OF_RANGE,
15 UNIMPLEMENTED,
16 CLOSED,
17 UNAVAILABLE,
18 INTERNAL,
19 };
20
21 // Used to explain the meaning of an offset within a file.
22 enum Whence {
23 // Offset is from current position in the file.
24 FROM_CURRENT = 0,
25 // Offset is relative to the beginning of the file.
26 FROM_START,
27 // Offset is relative to the end of the file.
28 FROM_END,
29 };
30
31 // Describes (idealized) wall-clock time, since Unix epoch (i.e., since
32 // "1970-01-01 00:00 UTC", ignoring leap seconds and that UTC as we know it
33 // started in 1972).
34 // TODO(vtl): Should probably be moved out of mojo.files (maybe to mojo.time?).
35 struct Timespec {
36 int64 seconds;
37 int32 nanoseconds; // Always in the interval [0, 10^9).
38 };
39
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 {
44 bool now;
45 Timespec? timespec;
46 };
47
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 {
52 // Type of the file.
53 FileType type;
54 // Size of the file, in bytes. Zero for directories.
55 int64 size;
56 // Last access time, if available/supported.
57 Timespec? atime;
58 // Last modification time, if available/supported.
59 Timespec? mtime;
60 };
61
62 // File and directory open flags (at least one of |kOpenFlagRead| and
63 // |kOpenFlagWrite| is required):
64 // Opens the file/directory for reading.
65 const uint32 kOpenFlagRead = 0x1;
66 // Opens the file/directory for writing.
67 const uint32 kOpenFlagWrite = 0x2;
68 // Only meaningful together with |kOpenFlagWrite|: creates the file if
69 // necessary.
70 const uint32 kOpenFlagCreate = 0x4;
71 // Only meaningful together with |kOpenFlagCreate|: requires file/directory to
72 // be created, failing if it already exists.
73 const uint32 kOpenFlagExclusive = 0x8;
74 // Only meaningful for files, together with |kOpenFlagWrite|: writes will always
75 // append to the file.
76 const uint32 kOpenFlagAppend = 0x10;
77 // Only meaningful for files, together with |kOpenFlagWrite|: truncates the
78 // file.
79 const uint32 kOpenFlagTruncate = 0x20;
80
81 // File types.
82 enum FileType {
83 UNKNOWN = 0,
84 REGULAR_FILE,
85 DIRECTORY,
86 };
87
88 // Describes a directory entry (i.e., a single member of a directory).
89 struct DirectoryEntry {
90 FileType type;
91 string name;
92 };
93
94 // Deletion flags:
95 // Only delete if the path refers to a file/non-directory (by default, will
96 // delete files and directories).
97 const uint32 kDeleteFlagFileOnly = 0x1;
98 // Only delete if the path refers to a directory.
99 const uint32 kDeleteFlagDirectoryOnly = 0x2;
100 // Recursively delete (neither of the two flags above may be specified).
101 const uint32 kDeleteFlagRecursive = 0x4;
OLDNEW
« no previous file with comments | « services/files/shared_impl.h ('k') | services/files/util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698