LINUX.ORG.RU

запара с получением информации о разделах на винче


0

0

int __current_primary_partition_table_position = 1;
int __current_extended_partition_table_position = 1;
long EBR_off[100]; // 100 ;)
long __current___known_EBRs_variable_position = 0;
int active,begin_C,begin_H,begin_S,type_of_the_partition,end_C,end_H,end_S;
int start,length;

void fo() {
if (active == 0x80) printf("yes "); else printf("no ");
printf("%d/%d/%d ",begin_C,begin_H,begin_S);
print_partition_type(type_of_the_partition);
printf("(0x%X) ",type_of_the_partition);
printf("%d/%d/%d ",end_C,end_H,end_S);
printf("%d %d\n", start, length);
}


void nfo() {
read(d,&active,1);
read(d,&begin_C,1);
read(d,&begin_H,1);
read(d,&begin_S,1);
read(d,&type_of_the_partition,1);
read(d,&end_C,1);
read(d,&end_H,1);
read(d,&end_S,1);
read(d,&start,4);
read(d,&length,4);
}

void info(long BR_offset)
{
d = open(disk, O_RDONLY);
int iiiii;
for (iiiii = 0;iiiii<512;iiiii++)
lseek(d,BR_offset,1);
if (__current___known_EBRs_variable_position == 0) {
switch (__current_primary_partition_table_position) {
case 1:
lseek(d,0x01BE,1);
nfo();
fo();
__current_primary_partition_table_position++;
break;

case 2:
lseek(d,0x01CE,1);
nfo();
fo();
if (type_of_the_partition == 0xF || type_of_the_partition == 0x5) {
__current___known_EBRs_variable_position ++;
EBR_off [__current___known_EBRs_variable_position] = start;
break;

}
__current_primary_partition_table_position++;
break;
case 3:
lseek(d,0x01DE,1);
nfo();
fo();
if (type_of_the_partition == 0xF || type_of_the_partition == 0x5) {
__current___known_EBRs_variable_position ++;
EBR_off [__current___known_EBRs_variable_position] = start;
break;

}
__current_primary_partition_table_position++;
break;
case 4:
lseek(d,0x01EE,1);
nfo();
fo();
if (type_of_the_partition == 0xF || type_of_the_partition == 0x5) {
__current___known_EBRs_variable_position ++;
EBR_off [__current___known_EBRs_variable_position] = start;
break;

}
__current_primary_partition_table_position++;
break;
}
} else {
switch (__current_extended_partition_table_position) {
case 1:
lseek(d,0x01BE,1);
nfo();
printf("\t");
fo();
__current_extended_partition_table_position++;
break;
case 2:
lseek(d,0x01CE,1);
nfo();
printf("\t");
fo();
if (type_of_the_partition == 0xF || type_of_the_partition == 0x5) {
__current___known_EBRs_variable_position ++;
EBR_off [__current___known_EBRs_variable_position] = start;
break;

} else __current___known_EBRs_variable_position --;
__current_extended_partition_table_position++;
__current_primary_partition_table_position++;
break;
}
}
close(d);
if (__current_primary_partition_table_position < 5) info(EBR_off[__current___known_EBRs_variable_position]);
}


Вопрос: почему почти на всех разделах пишутся в begin_C и end_C 254?

/dev/hda geometry: 4865/255/63
Total sectors: 78165360
active begin_CHS type end_CHS start length
yes 1/1/0 Linux(0x83) 254/63/12 63 208782
no 0/1/13 Linux(0x83) 254/255/255 208845 54894105
no 254/255/255 Linux(0x83) 254/255/255 55102950 20964825
no 254/255/255 extended DOS(0xF) 254/255/255 76067775 2088450
no 254/255/255 Linux SWAP(0x82) 254/255/255 63 2088387
no 0/0/0 empty(0x0) 0/0/0 0 0




ЗЫ: С такими переменными мне удобнее ;)

★★
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.