Beispiel #1
0
extern void initial_image_hdr(char* device, image_head* image_hdr){
    fs_open(device);
    if (MAGIC == MINIX_SUPER_MAGIC) {
	fs_version = 1;
    } else if (MAGIC == MINIX_SUPER_MAGIC2) {
	fs_version = 1;
    } else if (MAGIC == MINIX2_SUPER_MAGIC) {
	fs_version = 2;
    } else if (MAGIC == MINIX2_SUPER_MAGIC2) {
	fs_version = 2;
    } else if (MAGIC3 == MINIX3_SUPER_MAGIC){
	fs_version = 3;
    } else
	log_mesg(0, 1, 1, fs_opt.debug, "%s: bad magic number in super-block", __FILE__);

    log_mesg(0, 0, 0, fs_opt.debug, "%s: get_first_zone %lu\n", __FILE__, get_first_zone());
    log_mesg(0, 0, 0, fs_opt.debug, "%s: get_nzones %lu\n", __FILE__, get_nzones());
    log_mesg(0, 0, 0, fs_opt.debug, "%s: zones map size %lu\n", __FILE__, get_nzmaps());
    strncpy(image_hdr->magic, IMAGE_MAGIC, IMAGE_MAGIC_SIZE);
    strncpy(image_hdr->fs, minix_MAGIC, FS_MAGIC_SIZE);
    image_hdr->block_size  = get_block_size();
    image_hdr->totalblock  = get_nzones();
    image_hdr->usedblocks  = count_used_block();
    image_hdr->device_size = get_nzones()*get_block_size();
    fs_close();
}
Beispiel #2
0
void read_super_blocks(char* device, file_system_info* fs_info) {
    fs_open(device);
    if (MAGIC == MINIX_SUPER_MAGIC) {
        fs_version = 1;
    } else if (MAGIC == MINIX_SUPER_MAGIC2) {
        fs_version = 1;
    } else if (MAGIC == MINIX2_SUPER_MAGIC) {
        fs_version = 2;
    } else if (MAGIC == MINIX2_SUPER_MAGIC2) {
        fs_version = 2;
    } else if (MAGIC3 == MINIX3_SUPER_MAGIC) {
        fs_version = 3;
    } else
        log_mesg(0, 1, 1, fs_opt.debug, "%s: bad magic number in super-block", __FILE__);

    log_mesg(0, 0, 0, fs_opt.debug, "%s: get_first_zone %lu\n", __FILE__, get_first_zone());
    log_mesg(0, 0, 0, fs_opt.debug, "%s: get_nzones %lu\n", __FILE__, get_nzones());
    log_mesg(0, 0, 0, fs_opt.debug, "%s: zones map size %lu\n", __FILE__, get_nzmaps());
    strncpy(fs_info->fs, minix_MAGIC, FS_MAGIC_SIZE);
    fs_info->block_size  = get_block_size();
    fs_info->totalblock  = get_nzones();
    fs_info->usedblocks  = count_used_block();
    fs_info->device_size = fs_info->totalblock * fs_info->block_size;
    fs_close();
}