2 * UCW Library -- Mapping of File Parts
4 * (c) 2003--2006 Martin Mares <mj@ucw.cz>
5 * (c) 2003--2005 Robert Spalek <robert@ucw.cz>
7 * This software may be freely distributed and used according to the terms
8 * of the GNU Lesser General Public License.
11 #ifndef _UCW_PARTMAP_H
12 #define _UCW_PARTMAP_H
17 sh_off_t start_off, end_off;
22 struct partmap *partmap_open(byte *name, int writeable);
23 void partmap_close(struct partmap *p);
24 sh_off_t partmap_size(struct partmap *p);
25 void partmap_load(struct partmap *p, sh_off_t start, uns size);
28 partmap_map(struct partmap *p, sh_off_t start, uns size UNUSED)
30 #ifndef CONFIG_PARTMAP_IS_MMAP
31 if (unlikely(!p->start_map || start < p->start_off || (sh_off_t) (start+size) > p->end_off))
32 partmap_load(p, start, size);
34 return p->start_map + (start - p->start_off);
38 partmap_map_forward(struct partmap *p, sh_off_t start, uns size UNUSED)
40 #ifndef CONFIG_PARTMAP_IS_MMAP
41 if (unlikely((sh_off_t) (start+size) > p->end_off))
42 partmap_load(p, start, size);
44 return p->start_map + (start - p->start_off);