diff options
Diffstat (limited to 'src/glibext/gbinportion.c')
-rw-r--r-- | src/glibext/gbinportion.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c index b8e3ed7..731cd08 100644 --- a/src/glibext/gbinportion.c +++ b/src/glibext/gbinportion.c @@ -485,6 +485,40 @@ const mrange_t *g_binary_portion_get_range(const GBinPortion *portion) } +/****************************************************************************** +* * +* Paramètres : portion = description de partie à mettre à jour. * +* max = première position physique hors limite. * +* * +* Description : Assure qu'une portion ne dépasse pas une position donnée. * +* * +* Retour : true si la portion a été modifiée, false sinon. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_binary_portion_limit_range(GBinPortion *portion, phys_t max) +{ + bool result; /* Bilan à retourner */ + vmpa2t end; /* Limite actuelle de portion */ + const vmpa2t *start; /* Position de départ */ + + compute_mrange_end_addr(&portion->range, &end); + + result = get_phy_addr(&end) > max; + + if (result) + { + start = get_mrange_addr(&portion->range); + set_mrange_length(&portion->range, max - get_phy_addr(start)); + + } + + return result; + +} + /****************************************************************************** * * |