libparted 3.6
Loading...
Searching...
No Matches
constraint.h
Go to the documentation of this file.
1/*
2 libparted - a library for manipulating disk partitions
3 Copyright (C) 1998-2000, 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
20#ifndef PED_CONSTRAINT_H_INCLUDED
21#define PED_CONSTRAINT_H_INCLUDED
22
24
25#include <parted/device.h>
26#include <parted/geom.h>
27#include <parted/natmath.h>
28
36};
37
38extern int
40 PedConstraint* constraint,
41 const PedAlignment* start_align,
42 const PedAlignment* end_align,
43 const PedGeometry* start_range,
44 const PedGeometry* end_range,
45 PedSector min_size,
46 PedSector max_size);
47
48extern PedConstraint*
50 const PedAlignment* start_align,
51 const PedAlignment* end_align,
52 const PedGeometry* start_range,
53 const PedGeometry* end_range,
54 PedSector min_size,
55 PedSector max_size);
56
57extern PedConstraint*
59 const PedGeometry* min,
60 const PedGeometry* max);
61
62extern PedConstraint*
64
65extern PedConstraint*
67
68extern PedConstraint*
69ped_constraint_duplicate (const PedConstraint* constraint);
70
71extern void
73
74extern void
76
77extern PedConstraint*
79
80extern PedGeometry*
81ped_constraint_solve_max (const PedConstraint* constraint);
82
83extern PedGeometry*
85 const PedConstraint* constraint, const PedGeometry* geom);
86
87extern int
89 const PedGeometry* geom)
90#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
91 __attribute ((__pure__))
92#endif
93;
94
95extern PedConstraint*
96ped_constraint_any (const PedDevice* dev);
97
98extern PedConstraint*
100
101#endif /* PED_CONSTRAINT_H_INCLUDED */
PedGeometry * ped_constraint_solve_nearest(const PedConstraint *constraint, const PedGeometry *geom)
Return the nearest region to geom that satisfy a constraint.
Definition: constraint.c:411
void ped_constraint_destroy(PedConstraint *constraint)
Release the memory allocated for a PedConstraint constructed with ped_constraint_new().
Definition: constraint.c:278
PedConstraint * ped_constraint_exact(const PedGeometry *geom)
Return a constraint that only the given region will satisfy.
Definition: constraint.c:510
int ped_constraint_init(PedConstraint *constraint, const PedAlignment *start_align, const PedAlignment *end_align, const PedGeometry *start_range, const PedGeometry *end_range, PedSector min_size, PedSector max_size)
Initializes a pre-allocated piece of memory to contain a constraint with the supplied default values.
Definition: constraint.c:59
PedConstraint * ped_constraint_any(const PedDevice *dev)
Return a constraint that any region on the given device will satisfy.
Definition: constraint.c:490
PedConstraint * ped_constraint_new_from_min_max(const PedGeometry *min, const PedGeometry *max)
Return a constraint that requires a region to be entirely contained inside max, and to entirely conta...
Definition: constraint.c:123
PedConstraint * ped_constraint_new_from_max(const PedGeometry *max)
Return a constraint that requires a region to be entirely contained inside max.
Definition: constraint.c:168
PedConstraint * ped_constraint_duplicate(const PedConstraint *constraint)
Duplicate a constraint.
Definition: constraint.c:183
int ped_constraint_is_solution(const PedConstraint *constraint, const PedGeometry *geom)
Check whether geom satisfies the given constraint.
Definition: constraint.c:463
void ped_constraint_done(PedConstraint *constraint)
Release the memory allocated for a PedConstraint constructed with ped_constraint_init().
Definition: constraint.c:263
PedConstraint * ped_constraint_intersect(const PedConstraint *a, const PedConstraint *b)
Return a constraint that requires a region to satisfy both a and b.
Definition: constraint.c:206
PedConstraint * ped_constraint_new(const PedAlignment *start_align, const PedAlignment *end_align, const PedGeometry *start_range, const PedGeometry *end_range, PedSector min_size, PedSector max_size)
Convenience wrapper for ped_constraint_init().
Definition: constraint.c:92
PedGeometry * ped_constraint_solve_max(const PedConstraint *constraint)
Find the largest region that satisfies a constraint.
Definition: constraint.c:445
PedConstraint * ped_constraint_new_from_min(const PedGeometry *min)
Return a constraint that requires a region to entirely contain min.
Definition: constraint.c:151
long long PedSector
We can address 2^63 sectors.
Definition: device.h:31
#define __attribute(arg)
Definition: parted.h:32
Definition: natmath.h:56
Definition: constraint.h:29
PedSector max_size
Definition: constraint.h:35
PedGeometry * end_range
Definition: constraint.h:33
PedAlignment * start_align
Definition: constraint.h:30
PedGeometry * start_range
Definition: constraint.h:32
PedAlignment * end_align
Definition: constraint.h:31
PedSector min_size
Definition: constraint.h:34
A block device - for example, /dev/hda, not /dev/hda3.
Definition: device.h:74
Geometry of the partition.
Definition: geom.h:35