| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/extent-scan.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count |
|---|---|---|
| 1 | /* core functions for efficient reading sparse files | - |
| 2 | Copyright (C) 2010-2018 Free Software Foundation, Inc. | - |
| 3 | - | |
| 4 | This program is free software: you can redistribute it and/or modify | - |
| 5 | it under the terms of the GNU General Public License as published by | - |
| 6 | the Free Software Foundation, either version 3 of the License, or | - |
| 7 | (at your option) any later version. | - |
| 8 | - | |
| 9 | This program is distributed in the hope that it will be useful, | - |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | - |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - |
| 12 | GNU General Public License for more details. | - |
| 13 | - | |
| 14 | You should have received a copy of the GNU General Public License | - |
| 15 | along with this program. If not, see <https://www.gnu.org/licenses/>. | - |
| 16 | - | |
| 17 | Written by Jie Liu (jeff.liu@oracle.com). */ | - |
| 18 | - | |
| 19 | #ifndef EXTENT_SCAN_H | - |
| 20 | # define EXTENT_SCAN_H | - |
| 21 | - | |
| 22 | /* Structure used to store information of each extent. */ | - |
| 23 | struct extent_info | - |
| 24 | { | - |
| 25 | /* Logical offset of an extent. */ | - |
| 26 | off_t ext_logical; | - |
| 27 | - | |
| 28 | /* Extent length. */ | - |
| 29 | off_t ext_length; | - |
| 30 | - | |
| 31 | /* Extent flags, use it for FIEMAP only, or set it to zero. */ | - |
| 32 | unsigned int ext_flags; | - |
| 33 | }; | - |
| 34 | - | |
| 35 | /* Structure used to reserve extent scan information per file. */ | - |
| 36 | struct extent_scan | - |
| 37 | { | - |
| 38 | /* File descriptor of extent scan run against. */ | - |
| 39 | int fd; | - |
| 40 | - | |
| 41 | /* Next scan start offset. */ | - |
| 42 | off_t scan_start; | - |
| 43 | - | |
| 44 | /* Flags to use for scan. */ | - |
| 45 | unsigned int fm_flags; | - |
| 46 | - | |
| 47 | /* How many extent info returned for a scan. */ | - |
| 48 | size_t ei_count; | - |
| 49 | - | |
| 50 | /* If true, fall back to a normal copy, either set by the | - |
| 51 | failure of ioctl(2) for FIEMAP or lseek(2) with SEEK_DATA. */ | - |
| 52 | bool initial_scan_failed; | - |
| 53 | - | |
| 54 | /* If true, the total extent scan per file has been finished. */ | - |
| 55 | bool hit_final_extent; | - |
| 56 | - | |
| 57 | /* Extent information: a malloc'd array of ei_count structs. */ | - |
| 58 | struct extent_info *ext_info; | - |
| 59 | }; | - |
| 60 | - | |
| 61 | void extent_scan_init (int src_fd, struct extent_scan *scan); | - |
| 62 | - | |
| 63 | bool extent_scan_read (struct extent_scan *scan); | - |
| 64 | - | |
| 65 | static inline void | - |
| 66 | extent_scan_free (struct extent_scan *scan) | - |
| 67 | { | - |
| 68 | free (scan->ext_info); | - |
| 69 | scan->ext_info = NULL; | - |
| 70 | scan->ei_count = 0; | - |
| 71 | } executed 64 times by 1 test: end of blockExecuted by:
| 64 |
| 72 | - | |
| 73 | #endif /* EXTENT_SCAN_H */ | - |
| Source code | Switch to Preprocessed file |