#include "gpt.h"
+static int get_boot(enum action what);
static void delete_partition(int i);
#define hex_val(c) ({ \
* 0: found or created label
* 1: I/O error
*/
-int
+static int
get_boot(enum action what) {
int i;
pe->changed = (what == create_empty_dos);
}
- if (what == create_empty_sun && check_sun_label())
- return 0;
-
memset(MBRbuffer, 0, 512);
if (what == create_empty_dos)
case try_only:
return -1;
case create_empty_dos:
- case create_empty_sun:
break;
default:
fprintf(stderr, _("Internal error\n"));
unable_to_open, unable_to_read, unable_to_seek,
unable_to_write};
-enum action {fdisk, try_only, create_empty_dos, create_empty_sun};
+enum action {fdisk, try_only, create_empty_dos};
struct geom {
unsigned int heads;
extern void change_units(void);
extern void fatal(enum failure why);
extern void get_geometry(int fd, struct geom *);
-extern int get_boot(enum action what);
extern int get_partition(int warn, int max);
extern void list_types(struct systypes *sys);
extern int read_line (int *asked);
print_partition_size(i + 1, start, stop, sysid);
}
+static void init(void)
+{
+ disklabel = SUN_LABEL;
+ partitions = SUN_NUM_PARTITIONS;
+}
+
void sun_nolabel(void)
{
sunlabel->magic = 0;
other_endian = 0;
return 0;
}
+
+ init();
other_endian = (sunlabel->magic == SUN_LABEL_MAGIC_SWAPPED);
ush = ((unsigned short *) (sunlabel + 1)) - 1;
}
}
update_units();
- disklabel = SUN_LABEL;
- partitions = SUN_NUM_PARTITIONS;
return 1;
}
#else
other_endian = 0;
#endif
+
+ init();
zeroize_mbr_buffer();
+
sunlabel->magic = SSWAP16(SUN_LABEL_MAGIC);
sunlabel->sanity = SSWAP32(SUN_LABEL_SANE);
sunlabel->version = SSWAP32(SUN_LABEL_VERSION);
} else
ndiv = cylinders * 2 / 3;
- /* Make sure print_partition_size() uses correct sysid names */
- disklabel = SUN_LABEL;
-
set_sun_partition(0, 0, ndiv * heads * sectors,
SUN_TAG_LINUX_NATIVE);
set_sun_partition(1, ndiv * heads * sectors,
}
set_all_unchanged();
- get_boot(create_empty_sun);
set_changed(0);
}