OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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 // Update file format: A delta update file contains all the deltas needed |
| 6 // to update a system from one specific version to another specific |
| 7 // version. The update format is represented by this struct pseudocode: |
| 8 // struct delta_update_file { |
| 9 // char magic[4] = "CrAU"; |
| 10 // uint64 bom_offset; // Offset of protobuf DeltaArchiveManifest |
| 11 // uint64 bom_size; // Sise of protobuf DeltaArchiveManifest |
| 12 // |
| 13 // // Data blobs for files, no specific format. The specific offset |
| 14 // // and length of each data blob is recorded in the DeltaArchiveManifest. |
| 15 // struct { |
| 16 // char data[]; |
| 17 // } blobs[]; |
| 18 // |
| 19 // // The Gzip compressed DeltaArchiveManifest |
| 20 // char bom[]; |
| 21 // }; |
| 22 |
| 23 // The DeltaArchiveManifest protobuf is an ordered list of File objects. |
| 24 // These File objects are stored in a linear array in the |
| 25 // DeltaArchiveManifest, each with a specific index. Each File object |
| 26 // can contain children in its children list. Each child in the list |
| 27 // has a name and an index. The index refers to the index within |
| 28 // DeltaArchiveManifest.files. Thus, the DeltaArchiveManifest.files |
| 29 // can be seen as a tree structure that mimicks the filesystem. |
| 30 // The root object (the object an index 0) has no name, since names |
| 31 // for children are stored in the parent. |
| 32 |
| 33 // The DeltaArchiveManifest will contain one File entry for each |
| 34 // file that will be on the resultant filesystem. Because we have |
| 35 // a tree structure, and children are ordered alphabetically within |
| 36 // a parent, we can do log-time˜path lookup on a DeltaArchiveManifest |
| 37 // object. We can also iterate through a DeltaArchiveManifest object |
| 38 // using a preorder tree traversal to see each file in the |
| 39 // DeltaArchiveManifest, seeing each directory before any of its children; |
| 40 // this takes linear time. |
| 41 |
| 42 // Here's an example from Dan Erat showing DeltaArchiveManifest |
| 43 // for a filesystem with files /bin/cat and /bin/ls.: |
| 44 |
| 45 // files[0] { // "/" directory |
| 46 // children[0] { |
| 47 // name "bin" |
| 48 // index 1 |
| 49 // } |
| 50 // } |
| 51 // files[1] { // "/bin" directory |
| 52 // children[0] { |
| 53 // name "cat" |
| 54 // index 2 |
| 55 // } |
| 56 // children[1] { |
| 57 // name "ls" |
| 58 // index 3 |
| 59 // } |
| 60 // } |
| 61 // files[2] { // "/bin/cat" |
| 62 // } |
| 63 // files[3] { // "/bin/ls" |
| 64 // } |
| 65 |
| 66 // If a file has a data_format set, it should also have data_offset and |
| 67 // data_length set. data_offset and data_length refer to a range of bytes |
| 68 // in the delta update file itself which have the format specified by |
| 69 // data_format. FULL and FULL_GZ mean the entire file is present (FULL_GZ, |
| 70 // gzip compressed). BSDIFF means the old file with the same path should be |
| 71 // patched with 'bspatch' to produce the desired output file. COURGETTE |
| 72 // is not yet used, but it will be another binary diff format. |
| 73 |
| 74 // Directories should not have any data. |
| 75 |
| 76 // There are other types of files, too: symlinks, block and character devices, |
| 77 // fifos, and sockets. Fifos and sockets contain no data. Block and |
| 78 // character devices have data. It must be the format FULL or FULL_GZ, and |
| 79 // the contents are a serialized LinuxDevice protobuf. Symlinks must either |
| 80 // be FULL, FULL_GZ, or have no data. A symlink with no data is unchanged, |
| 81 // and with data it's set to that data. |
| 82 |
| 83 // TODO(adlr): Add support for hard links; CL is prepared already. |
| 84 // Extended attributes are unsupported at this time. |
| 85 |
| 86 package chromeos_update_engine; |
| 87 |
| 88 message DeltaArchiveManifest { |
| 89 message File { |
| 90 // This is st_mode from struct stat. It includes file type and permission |
| 91 // bits. |
| 92 optional uint32 mode = 1; |
| 93 optional uint32 uid = 2; |
| 94 optional uint32 gid = 3; |
| 95 |
| 96 // File Data, not for directories |
| 97 enum DataFormat { |
| 98 FULL = 0; // The data is the complete file |
| 99 FULL_GZ = 1; // The data is the complete file gzipped |
| 100 BSDIFF = 2; // The data is a bsdiff binary diff |
| 101 COURGETTE = 3; // The data is a courgette binary diff |
| 102 } |
| 103 // If present, there is data associated with this File object and |
| 104 // data_offset and data_size must be set. |
| 105 optional DataFormat data_format = 4; |
| 106 // The offset into the delta file where the data (if any) is stored |
| 107 optional uint32 data_offset = 5; |
| 108 // The length of the data in the delta file |
| 109 optional uint32 data_length = 6; |
| 110 |
| 111 message Child { |
| 112 // A File that's a directory (and only those types of File objects) |
| 113 // will have exactly one Child submessage per child. |
| 114 required string name = 1; // File name of child |
| 115 |
| 116 // Index into DeltaArchiveManifest.files for the File object of the child. |
| 117 required uint32 index = 2; |
| 118 } |
| 119 repeated Child children = 7; |
| 120 } |
| 121 repeated File files = 1; |
| 122 } |
| 123 |
| 124 message LinuxDevice { |
| 125 required int32 major = 1; |
| 126 required int32 minor = 2; |
| 127 } |
OLD | NEW |