summaryrefslogtreecommitdiffstats
path: root/src/pnext.h
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-12-21 18:18:55 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-12-21 18:18:55 +0100
commitb47b36998a17dccb922bc8a9591c8071f951c14f (patch)
tree9702e81b4ad3b3ac7c7933390711ff869e76f7b5 /src/pnext.h
parent5f4faee1f6f82fb3667653a951714c80932522db (diff)
Remove loc field from struct file_recovery_struct, use location instead
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);
+}