summaryrefslogtreecommitdiffstats
path: root/src/pnext.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pnext.h')
-rw-r--r--src/pnext.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pnext.h b/src/pnext.h
index fe2ce19..20088d6 100644
--- a/src/pnext.h
+++ b/src/pnext.h
@@ -71,3 +71,22 @@ void get_next_sector(alloc_data_t *list_search_space, alloc_data_t **current_sea
else
get_next_header(list_search_space, current_search_space, offset);
}
+
+static inline void get_prev_header(alloc_data_t *list_search_space, alloc_data_t **current_search_space, uint64_t *offset, const unsigned int blocksize)
+{
+ if((*current_search_space) != list_search_space)
+ *current_search_space=td_list_entry((*current_search_space)->list.prev, alloc_data_t, list);
+ *offset=(*current_search_space)->end + 1 - blocksize;
+}
+
+static inline void get_prev_sector(alloc_data_t *list_search_space, alloc_data_t **current_search_space, uint64_t *offset, const unsigned int blocksize)
+{
+ if((*current_search_space) == list_search_space)
+ {
+ return ;
+ }
+ if((*offset) >= (*current_search_space)->start + blocksize)
+ *offset-=blocksize;
+ else
+ get_prev_header(list_search_space, current_search_space, offset, blocksize);
+}