1/*
2 libparted - a library for manipulating disk partitions
3 Copyright (C) 1998-2000, 2007, 2009-2012 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef PED_CONSTRAINT_H_INCLUDED
20#define PED_CONSTRAINT_H_INCLUDED
21
22typedef struct _PedConstraint PedConstraint;
23
24#include <parted/device.h>
25#include <parted/geom.h>
26#include <parted/natmath.h>
27
28struct _PedConstraint {
29 PedAlignment* start_align;
30 PedAlignment* end_align;
31 PedGeometry* start_range;
32 PedGeometry* end_range;
33 PedSector min_size;
34 PedSector max_size;
35};
36
37extern int
38ped_constraint_init (
39 PedConstraint* constraint,
40 const PedAlignment* start_align,
41 const PedAlignment* end_align,
42 const PedGeometry* start_range,
43 const PedGeometry* end_range,
44 PedSector min_size,
45 PedSector max_size);
46
47extern PedConstraint*
48ped_constraint_new (
49 const PedAlignment* start_align,
50 const PedAlignment* end_align,
51 const PedGeometry* start_range,
52 const PedGeometry* end_range,
53 PedSector min_size,
54 PedSector max_size);
55
56extern PedConstraint*
57ped_constraint_new_from_min_max (
58 const PedGeometry* min,
59 const PedGeometry* max);
60
61extern PedConstraint*
62ped_constraint_new_from_min (const PedGeometry* min);
63
64extern PedConstraint*
65ped_constraint_new_from_max (const PedGeometry* max);
66
67extern PedConstraint*
68ped_constraint_duplicate (const PedConstraint* constraint);
69
70extern void
71ped_constraint_done (PedConstraint* constraint);
72
73extern void
74ped_constraint_destroy (PedConstraint* constraint);
75
76extern PedConstraint*
77ped_constraint_intersect (const PedConstraint* a, const PedConstraint* b);
78
79extern PedGeometry*
80ped_constraint_solve_max (const PedConstraint* constraint);
81
82extern PedGeometry*
83ped_constraint_solve_nearest (
84 const PedConstraint* constraint, const PedGeometry* geom);
85
86extern int
87ped_constraint_is_solution (const PedConstraint* constraint,
88 const PedGeometry* geom)
89#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
90 __attribute ((__pure__))
91#endif
92;
93
94extern PedConstraint*
95ped_constraint_any (const PedDevice* dev);
96
97extern PedConstraint*
98ped_constraint_exact (const PedGeometry* geom);
99
100#endif /* PED_CONSTRAINT_H_INCLUDED */
101