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 | |
22 | typedef struct _PedConstraint PedConstraint; |
23 | |
24 | #include <parted/device.h> |
25 | #include <parted/geom.h> |
26 | #include <parted/natmath.h> |
27 | |
28 | struct _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 | |
37 | extern int |
38 | ped_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 | |
47 | extern PedConstraint* |
48 | ped_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 | |
56 | extern PedConstraint* |
57 | ped_constraint_new_from_min_max ( |
58 | const PedGeometry* min, |
59 | const PedGeometry* max); |
60 | |
61 | extern PedConstraint* |
62 | ped_constraint_new_from_min (const PedGeometry* min); |
63 | |
64 | extern PedConstraint* |
65 | ped_constraint_new_from_max (const PedGeometry* max); |
66 | |
67 | extern PedConstraint* |
68 | ped_constraint_duplicate (const PedConstraint* constraint); |
69 | |
70 | extern void |
71 | ped_constraint_done (PedConstraint* constraint); |
72 | |
73 | extern void |
74 | ped_constraint_destroy (PedConstraint* constraint); |
75 | |
76 | extern PedConstraint* |
77 | ped_constraint_intersect (const PedConstraint* a, const PedConstraint* b); |
78 | |
79 | extern PedGeometry* |
80 | ped_constraint_solve_max (const PedConstraint* constraint); |
81 | |
82 | extern PedGeometry* |
83 | ped_constraint_solve_nearest ( |
84 | const PedConstraint* constraint, const PedGeometry* geom); |
85 | |
86 | extern int |
87 | ped_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 | |
94 | extern PedConstraint* |
95 | ped_constraint_any (const PedDevice* dev); |
96 | |
97 | extern PedConstraint* |
98 | ped_constraint_exact (const PedGeometry* geom); |
99 | |
100 | #endif /* PED_CONSTRAINT_H_INCLUDED */ |
101 | |