static int
check_sgi_label(void)
{
	if (sizeof(sgi_partition) > 512) {
		/* According to MIPS Computer Systems, Inc the label
		 * must not contain more than 512 bytes */
		BUG_bad_sgi_partition_size();
	}

	if (sgilabel->magic != SGI_LABEL_MAGIC
	 && sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED
	) {
		current_label_type = label_dos;
		return 0;
	}

	sgi_other_endian = (sgilabel->magic == SGI_LABEL_MAGIC_SWAPPED);
	/*
	 * test for correct checksum
	 */
	if (two_s_complement_32bit_sum((unsigned int*)sgilabel,
				sizeof(*sgilabel))) {
		printf("Detected sgi disklabel with wrong checksum\n");
	}
	update_units();
	current_label_type = label_sgi;
	partitions = 16;
	sgi_volumes = 15;
	return 1;
}
示例#2
0
int
check_sgi_label() {
	if (sizeof(sgilabel) > 512) {
		fprintf(stderr,
			_("According to MIPS Computer Systems, Inc the "
			  "Label must not contain more than 512 bytes\n"));
		exit(1);
	}

	if (sgilabel->magic != SGI_LABEL_MAGIC &&
	    sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED) {
		other_endian = 0;
		return 0;
	}

	other_endian = (sgilabel->magic == SGI_LABEL_MAGIC_SWAPPED);
	/*
	 * test for correct checksum
	 */
	if (two_s_complement_32bit_sum((unsigned int*)sgilabel,
				       sizeof(*sgilabel))) {
		fprintf(stderr,
			_("Detected sgi disklabel with wrong checksum.\n"));
	}
	update_units();
	disklabel = SGI_LABEL;
	partitions= 16;
	volumes = 15;
	return 1;
}
示例#3
0
static int
check_sun_label(void)
{
    unsigned short *ush;
    int csum;

    if (sunlabel->magic != SUN_LABEL_MAGIC
            && sunlabel->magic != SUN_LABEL_MAGIC_SWAPPED
       ) {
        current_label_type = LABEL_DOS;
        sun_other_endian = 0;
        return 0;
    }
    sun_other_endian = (sunlabel->magic == SUN_LABEL_MAGIC_SWAPPED);
    ush = ((unsigned short *) (sunlabel + 1)) - 1;
    for (csum = 0; ush >= (unsigned short *)sunlabel;) csum ^= *ush--;
    if (csum) {
        printf("Detected sun disklabel with wrong checksum.\n"
               "Probably you'll have to set all the values,\n"
               "e.g. heads, sectors, cylinders and partitions\n"
               "or force a fresh label (s command in main menu)\n");
    } else {
        g_heads = SUN_SSWAP16(sunlabel->ntrks);
        g_cylinders = SUN_SSWAP16(sunlabel->ncyl);
        g_sectors = SUN_SSWAP16(sunlabel->nsect);
    }
    update_units();
    current_label_type = LABEL_SUN;
    g_partitions = 8;
    return 1;
}
示例#4
0
void change_units(struct fdisk_context *cxt)
{
	display_in_cyl_units = !display_in_cyl_units;
	update_units(cxt);

	if (display_in_cyl_units)
		printf(_("Changing display/entry units to cylinders (DEPRECATED!)\n"));
	else
		printf(_("Changing display/entry units to sectors\n"));
}
示例#5
0
int
check_aix_label( void )
{
    if (aixlabel->magic != AIX_LABEL_MAGIC &&
	aixlabel->magic != AIX_LABEL_MAGIC_SWAPPED) {
	other_endian = 0;
	return 0;
    }
    other_endian = (aixlabel->magic == AIX_LABEL_MAGIC_SWAPPED);
    update_units();
    disklabel = AIX_LABEL;
    partitions= 1016;
    volumes = 15;
    aix_info();
    aix_nolabel();		/* %% */
    return 1;
}
示例#6
0
static int
check_aix_label(void)
{
	if (aixlabel->magic != AIX_LABEL_MAGIC &&
		aixlabel->magic != AIX_LABEL_MAGIC_SWAPPED) {
		current_label_type = 0;
		aix_other_endian = 0;
		return 0;
	}
	aix_other_endian = (aixlabel->magic == AIX_LABEL_MAGIC_SWAPPED);
	update_units();
	current_label_type = label_aix;
	partitions = 1016;
	aix_volumes = 15;
	aix_info();
	/*aix_nolabel();*/              /* %% */
	/*aix_label = 1;*/              /* %% */
	return 1;
}