Loading...
Searching...
No Matches
constraint.in.h
Go to the documentation of this file.
/*
libparted - a library for manipulating disk partitions
Copyright (C) 1998-2000, 2007, 2009-2014, 2019-2023, 2026 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PED_CONSTRAINT_H_INCLUDED
#define PED_CONSTRAINT_H_INCLUDED
typedef struct _PedConstraint PedConstraint;
#include <parted/device.h>
#include <parted/geom.h>
#include <parted/natmath.h>
struct _PedConstraint {
PedAlignment* start_align;
PedAlignment* end_align;
PedGeometry* start_range;
PedGeometry* end_range;
PedSector min_size;
PedSector max_size;
};
extern 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);
extern 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);
extern PedConstraint*
ped_constraint_new_from_min_max (
const PedGeometry* min,
const PedGeometry* max);
extern PedConstraint*
ped_constraint_new_from_min (const PedGeometry* min);
extern PedConstraint*
ped_constraint_new_from_max (const PedGeometry* max);
extern PedConstraint*
ped_constraint_duplicate (const PedConstraint* constraint);
extern void
ped_constraint_done (PedConstraint* constraint);
extern void
ped_constraint_destroy (PedConstraint* constraint);
extern PedConstraint*
ped_constraint_intersect (const PedConstraint* a, const PedConstraint* b);
extern PedGeometry*
ped_constraint_solve_max (const PedConstraint* constraint);
extern PedGeometry*
ped_constraint_solve_nearest (
const PedConstraint* constraint, const PedGeometry* geom);
extern int
ped_constraint_is_solution (const PedConstraint* constraint,
const PedGeometry* geom) _GL_ATTRIBUTE_PURE;
extern PedConstraint*
ped_constraint_any (const PedDevice* dev);
extern PedConstraint*
ped_constraint_exact (const PedGeometry* geom);
#endif /* PED_CONSTRAINT_H_INCLUDED */
PedConstraint
struct _PedConstraint PedConstraint
Definition constraint.h:23
device.h
geom.h
PedAlignment
struct _PedAlignment PedAlignment
Definition natmath.h:31
ped_constraint_solve_nearest
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
ped_constraint_destroy
void ped_constraint_destroy(PedConstraint *constraint)
Release the memory allocated for a PedConstraint constructed with ped_constraint_new().
Definition constraint.c:278
ped_constraint_exact
PedConstraint * ped_constraint_exact(const PedGeometry *geom)
Return a constraint that only the given region will satisfy.
Definition constraint.c:510
ped_constraint_init
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
ped_constraint_any
PedConstraint * ped_constraint_any(const PedDevice *dev)
Return a constraint that any region on the given device will satisfy.
Definition constraint.c:490
ped_constraint_new_from_min_max
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
ped_constraint_new_from_max
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
ped_constraint_duplicate
PedConstraint * ped_constraint_duplicate(const PedConstraint *constraint)
Duplicate a constraint.
Definition constraint.c:183
ped_constraint_is_solution
int ped_constraint_is_solution(const PedConstraint *constraint, const PedGeometry *geom) _GL_ATTRIBUTE_PURE
Check whether geom satisfies the given constraint.
Definition constraint.c:463
ped_constraint_done
void ped_constraint_done(PedConstraint *constraint)
Release the memory allocated for a PedConstraint constructed with ped_constraint_init().
Definition constraint.c:263
ped_constraint_intersect
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
ped_constraint_new
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
ped_constraint_solve_max
PedGeometry * ped_constraint_solve_max(const PedConstraint *constraint)
Find the largest region that satisfies a constraint.
Definition constraint.c:445
ped_constraint_new_from_min
PedConstraint * ped_constraint_new_from_min(const PedGeometry *min)
Return a constraint that requires a region to entirely contain min.
Definition constraint.c:151
PedSector
long long PedSector
We can address 2^63 sectors.
Definition device.h:31
PedDevice
struct _PedDevice PedDevice
Definition device.h:58
PedGeometry
struct _PedGeometry PedGeometry
Definition geom.h:30
natmath.h
_PedConstraint
Definition constraint.h:29
_PedConstraint::max_size
PedSector max_size
Definition constraint.h:35
_PedConstraint::end_range
PedGeometry * end_range
Definition constraint.h:33
_PedConstraint::start_align
PedAlignment * start_align
Definition constraint.h:30
_PedConstraint::start_range
PedGeometry * start_range
Definition constraint.h:32
_PedConstraint::end_align
PedAlignment * end_align
Definition constraint.h:31
_PedConstraint::min_size
PedSector min_size
Definition constraint.h:34