constraint.h revision 9663:ace9a2ac3683
1/*
2    libparted - a library for manipulating disk partitions
3    Copyright (C) 1998, 1999, 2000, 2007 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/natmath.h>
26
27struct _PedConstraint {
28	PedAlignment*	start_align;
29	PedAlignment*	end_align;
30	PedGeometry*	start_range;
31	PedGeometry*	end_range;
32	PedSector	min_size;
33	PedSector	max_size;
34};
35
36extern int
37ped_constraint_init (
38	PedConstraint* constraint,
39	const PedAlignment* start_align,
40	const PedAlignment* end_align,
41	const PedGeometry* start_range,
42	const PedGeometry* end_range,
43	PedSector min_size,
44	PedSector max_size);
45
46extern PedConstraint*
47ped_constraint_new (
48	const PedAlignment* start_align,
49	const PedAlignment* end_align,
50	const PedGeometry* start_range,
51	const PedGeometry* end_range,
52	PedSector min_size,
53	PedSector max_size);
54
55extern PedConstraint*
56ped_constraint_new_from_min_max (
57	const PedGeometry* min,
58	const PedGeometry* max);
59
60extern PedConstraint*
61ped_constraint_new_from_min (const PedGeometry* min);
62
63extern PedConstraint*
64ped_constraint_new_from_max (const PedGeometry* max);
65
66extern PedConstraint*
67ped_constraint_duplicate (const PedConstraint* constraint);
68
69extern void
70ped_constraint_done (PedConstraint* constraint);
71
72extern void
73ped_constraint_destroy (PedConstraint* constraint);
74
75extern PedConstraint*
76ped_constraint_intersect (const PedConstraint* a, const PedConstraint* b);
77
78extern PedGeometry*
79ped_constraint_solve_max (const PedConstraint* constraint);
80
81extern PedGeometry*
82ped_constraint_solve_nearest (
83	const PedConstraint* constraint, const PedGeometry* geom);
84
85extern int
86ped_constraint_is_solution (const PedConstraint* constraint,
87			    const PedGeometry* geom);
88
89extern PedConstraint*
90ped_constraint_any (const PedDevice* dev);
91
92extern PedConstraint*
93ped_constraint_exact (const PedGeometry* geom);
94
95#endif /* PED_CONSTRAINT_H_INCLUDED */
96
97