1 /* map.c - Map file creation
3 * Copyright 1992-1998 Werner Almesberger
4 * Copyright 1999-2004 John Coffman
5 * Copyright 2009-2011 Joachim Wiedorn
8 * Licensed under the terms contained in the file 'COPYING'
9 * in the source directory.
27 void map_patch_first(char *name,char *str);
28 /* Puts str into the first sector of a map file. */
30 void map_create(char *name);
31 /* Create and initialize the specified map file. */
33 void map_descrs(DESCR_SECTORS *descr, SECTOR_ADDR* addr, SECTOR_ADDR* dflcmd);
34 /* Updates map file with descriptors & default command line */
36 void map_close(BOOT_PARAMS_2 *param2, off_t here);
37 /* closes the map file, write second stage parameters */
39 void map_add_sector(void *sector);
40 /* Adds the specified sector to the map file and registers it in the map
43 void map_begin_section(void);
44 /* Begins a map section. Note: maps can also be written to memory with
45 map_write. Thus, the map routines can be used even without map_create. */
47 void map_add(GEOMETRY *geo,int from,int num_sect);
48 /* Adds pointers to sectors from the specified file to the map file, starting
49 "from" sectors from the beginning. */
51 void map_add_zero(void);
52 /* Adds a zero-filled sector to the current section. */
54 int map_end_section(SECTOR_ADDR *addr,int dont_compact);
55 /* Writes a map section to the map file and returns the address of the first
56 sector of that section. The first DONT_COMPACT sectors are never compacted.
57 Returns the number of sectors that have been mapped. */
60 int map_write(SECTOR_ADDR *list,int max_len,int terminate,int sa6);
62 int map_write(SECTOR_ADDR *list,int max_len,int terminate);
64 /* Writes a map section to an array. If terminate is non-zero, a terminating
65 zero entry is written. If the section (including the terminating zero entry)
66 exceeds max_len sectors, map_write dies. */
68 off_t map_insert_file(GEOMETRY *geo, int skip, int sectors);
69 /* Copies a file (second stage loader, usually) into the map file, skipping
70 'skip' sectors at the beginning, and writing 'sectors' sectors. The
71 sectors are added to the current map section. */
73 off_t map_insert_data(unsigned char *data, int size);
74 /* Copies data from an internal array into the map file. The sectors
75 are added to the current map section */