OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_EXTENT_MAPPER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_EXTENT_MAPPER_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_EXTENT_MAPPER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_EXTENT_MAPPER_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "update_engine/update_metadata.pb.h" | 11 #include "update_engine/update_metadata.pb.h" |
12 | 12 |
13 namespace chromeos_update_engine { | 13 namespace chromeos_update_engine { |
14 | 14 |
15 namespace extent_mapper { | 15 namespace extent_mapper { |
16 | 16 |
17 // Uses the FIBMAP ioctl to get all blocks used by a file and return them | 17 // Uses the FIBMAP ioctl to get all blocks used by a file and return them |
18 // as extents. Blocks are relative to the start of the filesystem. If | 18 // as extents. Blocks are relative to the start of the filesystem. If |
19 // there is a sparse "hole" in the file, the blocks for that will be | 19 // there is a sparse "hole" in the file, the blocks for that will be |
20 // represented by an extent whose start block is kSpareseHole. | 20 // represented by an extent whose start block is kSpareseHole. |
21 // The resulting extents are stored in 'out'. Keep in mind that while | 21 // The resulting extents are stored in 'out'. Keep in mind that while |
22 // the blocksize of a filesystem is often 4096 bytes, that is not always | 22 // the blocksize of a filesystem is often 4096 bytes, that is not always |
23 // the case, so one should consult GetFilesystemBlockSize(), too. | 23 // the case, so one should consult GetFilesystemBlockSize(), too. |
24 // Returns true on success. | 24 // Returns true on success. |
25 bool ExtentsForFileFibmap(const std::string& path, std::vector<Extent>* out); | 25 bool ExtentsForFileFibmap(const std::string& path, std::vector<Extent>* out); |
26 | 26 |
27 // Puts the blocksize of the filesystem, as used by the FIBMAP ioctl, into | 27 // Puts the blocksize of the filesystem, as used by the FIBMAP ioctl, into |
28 // out_blocksize by using the FIGETBSZ ioctl. Returns true on success. | 28 // out_blocksize by using the FIGETBSZ ioctl. Returns true on success. |
29 bool GetFilesystemBlockSize(const std::string& path, uint32* out_blocksize); | 29 bool GetFilesystemBlockSize(const std::string& path, uint32_t* out_blocksize); |
30 | 30 |
31 } // namespace extent_mapper | 31 } // namespace extent_mapper |
32 | 32 |
33 } // namespace chromeos_update_engine | 33 } // namespace chromeos_update_engine |
34 | 34 |
35 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_EXTENT_MAPPER_H__ | 35 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_EXTENT_MAPPER_H__ |
OLD | NEW |