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