libparted 3.6
Loading...
Searching...
No Matches
geom.h
Go to the documentation of this file.
1/*
2 libparted - a library for manipulating disk partitions
3 Copyright (C) 1998-2001, 2005, 2007, 2009-2014, 2019-2023 Free Software
4 Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
27#ifndef PED_GEOM_H_INCLUDED
28#define PED_GEOM_H_INCLUDED
29
31
40};
41
42#include <parted/device.h>
43#include <parted/timer.h>
44
45extern int ped_geometry_init (PedGeometry* geom, const PedDevice* dev,
51 const PedGeometry* b);
52extern void ped_geometry_destroy (PedGeometry* geom);
56extern int ped_geometry_set_end (PedGeometry* geom, PedSector end);
57extern int ped_geometry_test_overlap (const PedGeometry* a,
58 const PedGeometry* b)
59#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
60 __attribute ((__pure__))
61#endif
62;
63extern int ped_geometry_test_inside (const PedGeometry* a,
64 const PedGeometry* b)
65#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
66 __attribute ((__pure__))
67#endif
68;
69extern int ped_geometry_test_equal (const PedGeometry* a, const PedGeometry* b)
70
71#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
72 __attribute ((__pure__))
73#endif
74;
75extern int ped_geometry_test_sector_inside (const PedGeometry* geom,
76 PedSector sect)
77#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
78 __attribute ((__pure__))
79#endif
80;
81
82extern int ped_geometry_read (const PedGeometry* geom, void* buffer,
84extern int ped_geometry_read_alloc (const PedGeometry* geom, void** buffer,
86extern int ped_geometry_write (PedGeometry* geom, const void* buffer,
88extern PedSector ped_geometry_check (PedGeometry* geom, void* buffer,
89 PedSector buffer_size, PedSector offset,
90 PedSector granularity, PedSector count,
91 PedTimer* timer);
92extern int ped_geometry_sync (PedGeometry* geom);
93extern int ped_geometry_sync_fast (PedGeometry* geom);
94
95/* returns -1 if "sector" is not within dest's space. */
96extern PedSector ped_geometry_map (const PedGeometry* dst,
97 const PedGeometry* src,
99#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
100 __attribute ((__pure__))
101#endif
102;
103
104#endif /* PED_GEOM_H_INCLUDED */
105
uint32_t start
Definition: dos.c:4
uint32_t length
Definition: dos.c:5
offset
Definition: fdasd.h:264
long long PedSector
We can address 2^63 sectors.
Definition: device.h:31
PedSector ped_geometry_check(PedGeometry *geom, void *buffer, PedSector buffer_size, PedSector offset, PedSector granularity, PedSector count, PedTimer *timer)
Checks for physical disk errors.
Definition: geom.c:407
PedGeometry * ped_geometry_duplicate(const PedGeometry *geom)
Duplicate a PedGeometry object.
Definition: geom.c:104
void ped_geometry_destroy(PedGeometry *geom)
Destroy a PedGeometry object.
Definition: geom.c:140
int ped_geometry_test_sector_inside(const PedGeometry *geom, PedSector sect)
Tests if sector is inside geom.
Definition: geom.c:261
int ped_geometry_test_overlap(const PedGeometry *a, const PedGeometry *b)
Test if a overlaps with b.
Definition: geom.c:205
PedSector ped_geometry_map(const PedGeometry *dst, const PedGeometry *src, PedSector sector)
This function takes a sector inside the region described by src, and returns that sector's address in...
Definition: geom.c:467
int ped_geometry_write(PedGeometry *geom, const void *buffer, PedSector offset, PedSector count)
Writes data into the region represented by geom.
Definition: geom.c:362
int ped_geometry_read_alloc(const PedGeometry *geom, void **buffer, PedSector offset, PedSector count)
Definition: geom.c:305
int ped_geometry_set(PedGeometry *geom, PedSector start, PedSector length)
Assign a new start, end (implicitly) and length to geom.
Definition: geom.c:153
PedGeometry * ped_geometry_intersect(const PedGeometry *a, const PedGeometry *b)
Return a PedGeometry object that refers to the intersection of a and b.
Definition: geom.c:120
int ped_geometry_sync(PedGeometry *geom)
Flushes the cache on geom.
Definition: geom.c:331
PedGeometry * ped_geometry_new(const PedDevice *dev, PedSector start, PedSector length)
Create a new PedGeometry object on disk, starting at start with a size of length sectors.
Definition: geom.c:74
int ped_geometry_test_equal(const PedGeometry *a, const PedGeometry *b)
Tests if a and b refer to the same physical region.
Definition: geom.c:245
int ped_geometry_test_inside(const PedGeometry *a, const PedGeometry *b)
Tests if b lies completely within a.
Definition: geom.c:227
int ped_geometry_sync_fast(PedGeometry *geom)
Flushes the cache on geom.
Definition: geom.c:348
int ped_geometry_set_start(PedGeometry *geom, PedSector start)
Assign a new start to geom without changing geom->end.
Definition: geom.c:181
int ped_geometry_read(const PedGeometry *geom, void *buffer, PedSector offset, PedSector count)
Reads data from the region represented by geom.
Definition: geom.c:283
int ped_geometry_set_end(PedGeometry *geom, PedSector end)
Assign a new end to geom without changing geom->start.
Definition: geom.c:192
int ped_geometry_init(PedGeometry *geom, const PedDevice *dev, PedSector start, PedSector length)
Initialize the previously allocated PedGeometry geom.
Definition: geom.c:57
#define __attribute(arg)
Definition: parted.h:32
uint8_t sector
Definition: pc98.c:7
A block device - for example, /dev/hda, not /dev/hda3.
Definition: device.h:74
Geometry of the partition.
Definition: geom.h:35
PedSector end
Definition: geom.h:39
PedSector start
Definition: geom.h:37
PedSector length
Definition: geom.h:38
PedDevice * dev
Definition: geom.h:36
Definition: timer.h:39