ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6


4 - Let's Get Moving

Life is good. You have a file, and you're reading and writing merrily away. Well, at least for 4k, anyway. The next roadblock is hitting the top of your allocated file. If you've worked with the realloc() memory routine, you'll be happy to know that there's an ebm file equivalent (two, actually):

int ebo_contract(const ebo_name_t * name, off_t newsize)
int ebo_extend (const ebo_name_t * name, off_t newsize)

In both cases, you pass the new size (rounded to EBO_BLK_SIZE of course), and the file is expanded or shrunk accordingly, and returns the usual negative error flag/positive success flag.

To end all this fun, call

int ebo_unmap (void * addr, size_t size)

Wherein you pass the pointer to your memory map, and the size of the file you've mapped in.

Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice