Beispiel #1
0
u_int32 read_file       (u_int32 handle,u_int32 buf_len,void*buf ,u_int32 send_pid){
	/*patch:判断权限*/
	int i;
	int8*buffer=(int8*)transTolinerAddr((u_int32)buf,send_pid,1);
	/*patch:判断handle的有效性*/
	u_int32 size=fat.i_node_arr[handle].byte_size;
	/*请求长度超过了文件长度,只读取本文件*/
	if(buf_len>size)
		buf_len=size;
	u_int32 read_sects=buf_len/512;
	u_int32 start=fat.i_node_arr[handle].startSector;
	u_int32 pos=0;
	for(i=start;i<start+read_sects;i++,pos+=512)
		while(read_sector(i,buffer+pos)==FALSE);
	if((buf_len%512)==0)
	{
		return buf_len;
	}
	else
	{/*否则对最后一个扇区特殊处理*/
		int8 tempBuf[512];
		while(read_sector(start+read_sects,tempBuf)==FALSE);
		memcpy8(tempBuf,buffer+read_sects*512,buf_len%512);
		return buf_len;
	}
}
Beispiel #2
0
void
report(int fd)
{
	uint8_t *vdit, *vdit2, *tmpvdit;
	size_t vditsize, vditsize2;
	struct vdm_label *dl;
	struct vdm_boot_info *bi;
	struct disklabel *lp;
	uint8_t sector[VDM_BLOCK_SIZE];
	struct vdit_block_header *hdr;

	read_sector(fd, VDM_LABEL_SECTOR, sector);
	analyze_label_sector(sector, &dl, &bi);

	if (dl == NULL)
		return;

	printf("label version %04x\n", betoh16(dl->version));

	if (bi != NULL)
		printf("disk boot info: start %08x size %08x version %08x\n",
		    betoh32(bi->boot_start),
		    betoh32(bi->boot_size), betoh32(bi->version));

	read_sector(fd, VDIT_SECTOR, sector);
	hdr = (struct vdit_block_header *)sector;
	if (VDM_ID_KIND(&hdr->id) != VDIT_BLOCK_HEAD_BE) {
		lp = (struct disklabel *)(sector + LABELOFFSET);
		if (lp->d_magic == DISKMAGIC && lp->d_magic2 == DISKMAGIC) {
			if (verbose)
				printf("no VDIT but a native OpenBSD label\n");
			return;
		}
		errx(3, "unexpected block kind on sector %08x: %02x",
		    1, VDM_ID_KIND(&hdr->id));
	}

	vdit = read_vdit(fd, 1, &vditsize);
	if (vdit != NULL) {
		tmpvdit = vdit;
		while (tmpvdit != NULL)
			tmpvdit = print_vdit_entry(tmpvdit);

		vdit2 = read_vdit(fd, betoh32(hdr->secondary_vdit), &vditsize2);
		if (vdit2 == NULL)
			printf("can't read backup VDIT\n");
		else {
			if (vditsize2 < vditsize) {
				printf("WARNING: backup VDIT is smaller "
				    "than main VDIT!\n");
				vditsize = vditsize2;
			}
			if (memcmp(vdit, vdit2, vditsize) != 0)
				printf("VDIT and backup VDIT differ!\n");
			free(vdit2);
		}

		free(vdit);
	}
}
Beispiel #3
0
// reads the FAT to determine the next cluster in the
// list after the given cluster.
static unsigned int next_cluster(int cluster)
{
    void* b = fat;
    unsigned offset;
    if (fat_type == TFAT12)
        offset = cluster + (cluster / 2);
    else if (fat_type == TFAT16)
        offset = cluster * 2;
    else
        offset = cluster * 4;
    int sector = offset / bpb.BytsPerSec + bpb.RsvdSecCnt;
    if (sector != cur_fat_sec)
    {
        read_sector(sector, &b);
        if (fat_type == TFAT12)
            read_sector(sector+1, &b);
    }
    cur_fat_sec = sector;
    if (fat_type == TFAT12)
    {
        if (cluster & 1)
            return *(unsigned short*)(fat+(offset % bpb.BytsPerSec)) >> 4;
        else
            return *(unsigned short*)(fat+(offset % bpb.BytsPerSec)) & 0xFFF;
    }
Beispiel #4
0
uint8_t floppy_read(uint8_t C,uint8_t H,uint8_t S) {
    if(S != 18) {
        read_sector(C,H,S+1);
    } else {
        if(H != 1) {
            read_sector(C,H+1,0);
        } else if(C != 80) {
            read_sector(C+1,0,0);
        }
    }
    memcpy((uint8_t *)0xA00,(uint8_t *)0xC00,0x200);
    read_sector(C,H,S);
    return 0;
}
Beispiel #5
0
// FSM
void disk_sched_irq_handler(){
	irq_disable();
	disk_job_str* current = disk_queue;
assert(current);
	ctx_s* owner = current->ctx;
	_dprint("DISK_IRQ\n");

	switch(disk_state){
		case DS_IDLE:
			fprintf(stderr, "WARNING - %s:%d - UNEXPECTED INTERRUPT IN IDLE STATE.\n", __FILE__, __LINE__);
			return;
		case DS_SEEK:{
			_dprint("SEEK TERMINE\n");
			// on vient de finir le seek.
			// Que faire maintenant ? > Dépend du type de tâche	
			switch(current->type){
				case DJT_READ:
					// on lance le read
					disk_state = DS_READ;
					read_sector(current->cyl, current->sect, current->buffer);
					irq_enable();
					return;
				case DJT_WRITE:
					// on lance le write
					disk_state = DS_WRITE;
					write_sector(current->cyl, current->sect, current->buffer);
					irq_enable();
					return;
				case DJT_FORMAT:
					// on lance le format
					disk_state = DS_FORMAT;
					mFormat(current->cyl, current->sect, 1, 0x0);
					irq_enable();
					return;
				default:
					// ???
					return;
			}
		}
		case DS_READ: // les données sont présentes dans le MASTERBUFFER. On les copie dans l buffer du job
			_dprint("READ TERMINE\n");
			assert(current->buffer);
			memcpy(current->buffer, MASTERBUFFER, secSize);
		case DS_WRITE:
		case DS_FORMAT:
			//disk_delete_job(current);
			disk_queue = current->next;

			// retour à idle
			disk_state = DS_IDLE;
			disk_ctx->status = CTXS_ACTIVABLE;
			// réactiver contexte propriétaire.
            owner->status = CTXS_ACTIVABLE;
			_dprint("JOB DONE\n");
			irq_enable();
			return;
		default:
			return;
	}
}
Beispiel #6
0
void UPD765A::read_data(bool deleted, bool scan)
{
	result = check_cond(false);
	if(result & ST1_MA) {
		REGISTER_PHASE_EVENT(PHASE_EXEC, 10000);
		return;
	}
	if(result) {
		shift_to_result7();
		return;
	}
	result = read_sector();
	if(deleted) {
		result ^= ST2_CM;
	}
	if((result & ~ST2_CM) && !(result & ST2_DD)) {
		shift_to_result7();
		return;
	}
	if((result & ST2_CM) && (command & 0x20)) {
		REGISTER_PHASE_EVENT(PHASE_TIMER, 100000);
		return;
	}
	int length = (id[3] & 7) ? (0x80 << (id[3] & 7)) : (__min(dtl, 0x80));
	if(!scan) {
		shift_to_read(length);
	} else {
		shift_to_scan(length);
	}
	return;
}
Beispiel #7
0
Datei: dmps.c Projekt: Haelia/ASE
int main (int argc, char ** argv) {
	int i;
	unsigned int cylinder, sector;
	unsigned char buffer[BUFSIZE];
	
	if(argc !=3){
		printf("Format necessite 2 arguments: le cylindre et le secteur\n");
		exit(EXIT_FAILURE);
	}

	
	
	cylinder = atoi(argv[1]);
	sector = atoi(argv[2]);
	
	
	/* initialisation hardware */
	if(init_hardware(HARDWARE_INI) == 0) {
		fprintf(stderr, "Erreur lors de l'initialisation du hardware\n");
		exit(EXIT_FAILURE);
	}
	for(i = 0; i < 15; i++)
		IRQVECTOR[i] = nothing;
	
	
	read_sector(cylinder,sector,buffer);
	toHexa(buffer);
	exit(EXIT_SUCCESS);
}
Beispiel #8
0
static int
cda_seek_sample (DB_fileinfo_t *_info, int sample)
{
    trace("cda_seek_sample %d\n", sample);
    cdda_info_t *info = (cdda_info_t *)_info;
    const int sector = sample * SAMPLESIZE / SECTORSIZE + info->first_sector;
    const int offset = sample * SAMPLESIZE % SECTORSIZE;

#if USE_PARANOIA
    if (info->paranoia) {
        paranoia_seek(info->paranoia, sector, SEEK_SET);
    }
#endif
    info->current_sector = sector;
    const char *p_readbuf = read_sector(info);
    if (!p_readbuf) {
        return -1;
    }

    info->tail = (char *)p_readbuf + offset;
    info->tail_length = SECTORSIZE - offset;
    _info->readpos = (float)sample / _info->fmt.samplerate;

    return 0;
}
Beispiel #9
0
/*
 main qui prend 3 arguments en entrée:
    ./dmps cylinder sector value
 il affiche la partie du disque désignée par les arguments cylinder & sector
 */
int main(int argc, char **argv){
    
    init_hard();
    
    int cylinder, sector;
    uchar buffer[HDA_SECTORSIZE];
    
    if(argc < 3){
        printf("exe: ./dmps cylinder sector\n");
        printf("Numero de cylindre: ");
        scanf("%d", &cylinder);
        printf("\tsector: ");
        scanf("%d", &sector);
    } else {
        cylinder = atoi(argv[1]);
        sector = atoi(argv[2]);
    }
    
    assert(cylinder >= 0 && cylinder < HDA_MAXCYLINDER);
    assert(sector >= 0 && sector < HDA_MAXSECTOR);

    read_sector( (uint)cylinder, (uint)sector, buffer );
    int i = 0;
    int j = 0;
    for(i=0; i<HDA_SECTORSIZE / 16; i++){
        printf("0%03d: ", i * 16);
        for(j=0; j<16; j++){
            printf(" %02x", buffer[i*16 + j]);
        }
        printf("\n");
    }
    
    
    return 0;
}
Beispiel #10
0
// checks whether a file or folder exists in the root
// directory. If it does, the appropriate info structure is
// loaded when the function returns.
static int read_root_file(const char* filename, int is_dir)
{
    int i;
    void* b;
    unsigned cluster = bpb32.RootClus;
    if (fat_type == TFAT32)
    {
        while (!eof(cluster))
        {
            b = disk;
            read_cluster(cluster, &b);
            if (find_file(filename,cluster_size,is_dir)) return 1;
            cluster = next_cluster(cluster);
        }
    }
    else
    {
        for (i = 0; i < root_sectors; i++)
        {
            b = disk;
            read_sector(root_start+i, &b);
            if (find_file(filename,bpb.BytsPerSec,is_dir)) return 1;
        }
    }
    return 0;
}
Beispiel #11
0
u_int32 write_file      (u_int32 handle,u_int32 buf_len,void*buf,u_int32 send_pid ){
	/*patch:判断权限*/
	int i;
	/*patch:判断handle的有效性*/
	int8*buffer=(int8*)transTolinerAddr((u_int32)buf,send_pid,1);
	u_int32 write_sects=buf_len/512;
	/*patch:增加判断扇区超出文件拥有扇区*/
	u_int32 start=fat.i_node_arr[handle].startSector;
	u_int32 pos=0;
	for(i=start;i<start+write_sects;i++,pos+=512)
		while(write_sector(i,buffer+pos)==FALSE);
	/*文件若变得更长,则需要更新信息*/
	u_int32 size=fat.i_node_arr[handle].byte_size;
	if(buf_len>size)
		fat.i_node_arr[handle].byte_size=buf_len;
	if((buf_len%512)==0)
	{
		return TRUE;
	}
	else
	{/*否则对最后一个扇区特殊处理*/
		int8 tempBuf[512];
		while(read_sector(start+write_sects,tempBuf)==FALSE);
		memcpy8(buffer+write_sects*512,tempBuf,buf_len%512);
		while(write_sector(start+write_sects,tempBuf)==FALSE);
		return TRUE;
	}
}
Beispiel #12
0
unsigned int chained_cluster(unsigned int cluster)
{
  unsigned int retVal=0;

  do {
    int fat_sector_num=cluster/(512/4);
    int fat_sector_offset=(cluster*4)&0x1FF;
    if (fat_sector_num>=sectors_per_fat) {
      printf("ERROR: cluster number too large.\n");
      retVal=-1; break;
    }

    // Read in the sector of FAT1
    unsigned char fat_sector[512];
    if (read_sector(partition_start+fat1_sector+fat_sector_num,fat_sector,0)) {
      printf("ERROR: Failed to read sector $%x of first FAT\n",fat_sector_num);
      retVal=-1; break;
    }

    // Set the bytes for this cluster to $0FFFFF8 to mark end of chain and in use
    retVal=fat_sector[fat_sector_offset+0];
    retVal|=fat_sector[fat_sector_offset+1]<<8;
    retVal|=fat_sector[fat_sector_offset+2]<<16;
    retVal|=fat_sector[fat_sector_offset+3]<<24;

    printf("Cluster %d chains to cluster %d ($%x)\n",cluster,retVal,retVal);
    
  } while(0);
  
  return retVal;
}
Beispiel #13
0
FATDrive::FATDrive(LPCTSTR path)
 :	FATDirectory(*this, TEXT("\\"))
{
	_bufl = 0;
	_bufents = 0;
	_SClus = 0;
	_FATCache = NULL;
	_CacheCount = 0;
	_CacheSec = NULL;
	_CacheCnt = NULL;
	_CacheDty = NULL;
	_Caches = 0;

	_hDrive = CreateFile(path, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);

	if (_hDrive != INVALID_HANDLE_VALUE) {
		_boot_sector.BytesPerSector = 512;

		if (read_sector(0, (Buffer*)&_boot_sector, 1)) {
			_bufl = _boot_sector.BytesPerSector;
			_SClus = _boot_sector.SectorsPerCluster;
			_bufents = _bufl / sizeof(union DEntry);
		}

		small_cache();
	}
}
Beispiel #14
0
static int read_vcd(bgav_input_context_t* ctx,
                    uint8_t * buffer, int len)
  {
  int bytes_read = 0;
  int bytes_to_copy;
    
  vcd_priv * priv;
  priv = ctx->priv;

  while(bytes_read < len)
    {
    if(priv->buffer_ptr - priv->buffer >= SECTOR_SIZE)
      {
      if(!read_sector(ctx, priv->sector))
        return bytes_read;
      }

    if(len - bytes_read < SECTOR_SIZE - (priv->buffer_ptr - priv->buffer))
      bytes_to_copy = len - bytes_read;
    else
      bytes_to_copy = SECTOR_SIZE - (priv->buffer_ptr - priv->buffer);

    memcpy(buffer + bytes_read, priv->buffer_ptr, bytes_to_copy);
    priv->buffer_ptr += bytes_to_copy;
    bytes_read += bytes_to_copy;
    }
  return bytes_read;
  }
Beispiel #15
0
int getRootSize()
{
    int done = 0;
    int currentSector = 19;
    int sectorsRead = 0;
    ubyte* image;

    while (done != 1) {
        image = (ubyte*)malloc(BYTES_PER_SECTOR * sizeof(ubyte));
        read_sector(currentSector, image);

        for (int i = 0; i < 16; i++) {
            if (image[i * 32] == 0x00) {
                done = 1;
                break;
            }
        }

        sectorsRead++;
        currentSector++;

        free(image);
    }


    return sectorsRead;

}
Beispiel #16
0
uint32_t
get_vdit_size(int fd, uint32_t secno)
{
	uint8_t sector[VDM_BLOCK_SIZE];
	struct vdit_block_header *hdr;
	uint32_t cursize = 0;
	int kind = VDIT_BLOCK_HEAD_BE;

	for (;;) {
		read_sector(fd, secno, sector);
		hdr = (struct vdit_block_header *)sector;
		if (VDM_ID_KIND(&hdr->id) != kind) {
			printf("unexpected VDIT block kind "
			    "on sector %08x: %02x\n",
			    secno, VDM_ID_KIND(&hdr->id));
			return 0;
		}

		if (verbose)
			printf("sector %08x: vdit frag type %02x, length %04x, "
			    "next frag at %08x\n",
			    secno, VDM_ID_KIND(&hdr->id),
			    betoh16(hdr->chunksz), secno);

		cursize += betoh16(hdr->chunksz);
		if (betoh32(hdr->nextblk) == VDM_NO_BLK_NUMBER)
			break;

		secno = betoh32(hdr->nextblk);
		kind = VDIT_PORTION_HEADER_BLOCK;
	}

	return cursize;
}
Beispiel #17
0
uint8_t *
append_vdit_portion(int fd, uint32_t secno, uint8_t *buf, uint8_t *sector,
    int kind)
{
	struct vdit_block_header *hdr;
	u_int chunksz;

	hdr = (struct vdit_block_header *)sector;
	if (VDM_ID_KIND(&hdr->id) != kind) {
		printf("unexpected block kind on sector %08x: %02x\n",
		    secno, VDM_ID_KIND(&hdr->id));
		return NULL;
	}

	/* store first sector of the portion */
	chunksz = betoh16(hdr->chunksz);
	buf = append_vdit_sector(secno, buf, sector, kind);
	chunksz--;
	secno++;

	/* do the others */
	while (chunksz-- != 0) {
		read_sector(fd, secno, sector);
		buf = append_vdit_sector(secno, buf, sector, VDIT_BLOCK);
		if (buf == NULL)
			return NULL;
		secno++;
	}

	return buf;
}
static int decode_C7(void)
{
	if( !read_sector(fin) )
		return 0;
	if( !write_sector(fout) )
		return 0;
	
	return 1;
}
Beispiel #19
0
int main(int argc, char **argv)
{
    unsigned int i;
    unsigned char buffer[HDA_SECTORSIZE];
    unsigned int cylinder;
    unsigned int sector;

    if(argc < 3) {
	    fprintf(stderr, "Error arguments missing\n");
	    exit(EXIT_FAILURE);
    }

    cylinder = atoi(argv[1]);
    sector = atoi(argv[2]);

    if(cylinder < 0 || cylinder >= HDA_MAXCYLINDER) {
	    fprintf(stderr, "Error cylinder\n");
	    exit(EXIT_FAILURE);
    }

    if(sector < 0 || sector >= HDA_MAXSECTOR) {
	    fprintf(stderr, "Error sector\n");
	    exit(EXIT_FAILURE);
    }
    
    /* init hardware */
    if(init_hardware("hardware.ini") == 0) {
	    fprintf(stderr, "Error in hardware initialization\n");
	    exit(EXIT_FAILURE);
    }

    /* Interreupt handlers */
    for(i=0; i<16; i++)
	    IRQVECTOR[i] = empty_it;

    /* Allows all IT */
    _mask(1);

    read_sector(cylinder, sector, buffer);
    
    printf("--------------------------------------------------------------------------------\n");
    printf("Cylindre %i | Secteur %i\n", cylinder, sector);
    printf("--------------------------------------------------------------------------------");
    for(i = 0; i < HDA_SECTORSIZE; i++)
    {
        if(i%8 == 0) {
            printf("\n");
        }
        printf("\t0x%x ",buffer[i]);
    }
    printf("\n");
    printf("--------------------------------------------------------------------------------\n");

    /* and exit! */
    exit(EXIT_SUCCESS);
}
Beispiel #20
0
/* Allocate a buffer and read a partition table sector */
static void read_pte(struct fdisk_context *cxt, int pno, sector_t offset)
{
	struct pte *pe = &ptes[pno];

	pe->offset = offset;
	pe->sectorbuffer = xmalloc(cxt->sector_size);
	read_sector(cxt, offset, pe->sectorbuffer);
	pe->changed = 0;
	pe->part_table = pe->ext_pointer = NULL;
}
Beispiel #21
0
void read_bloc(const unsigned int vol, 
	       const unsigned int nbloc, 
	       unsigned char* buffer) {

  unsigned int secteur, cylindre;

  calc_secteur_cylindre(vol, nbloc, &secteur, &cylindre);

  read_sector(cylindre, secteur, buffer);
}
Beispiel #22
0
int load_fs(struct fs *the_fs)
{
    size_t size = sizeof(struct fs);
    char *data = malloc(sizeof(char) * size);
    
    size_t offset = 0;
    int cur_sect = 0;
    for(int i = 0; i < size / BYTES_PER_SECTOR; ++i) {
        read_sector(0, cur_sect, data + offset);
        cur_sect++;
        offset += BYTES_PER_SECTOR;
    }
    char leftover[BYTES_PER_SECTOR];
    read_sector(0, cur_sect, leftover);
    memcpy(data, leftover, size - offset);
    memcpy(the_fs, data, size);
    free(data);
    return 0;
}
Beispiel #23
0
ubyte* readFatTable(int fatTableSize,int numFatSectors,int bytesPerSector)
{
    ubyte* fat = malloc(fatTableSize);

    for (int i = 0; i < numFatSectors; i++)
    {
        read_sector(i + 1, &fat[i * bytesPerSector]);
    }

    return fat;
}
Beispiel #24
0
u_int32 identify_fs     (                                     ){
	int8 buf[512];
	u_int32 status=read_sector(SUPERBLOCK_START,buf);
	if(status==FALSE)
		return FALSE;
	else
	{
		memcpy8(buf,(u_int8*)&superBlock,SUPERBLOCK_SIZE);
		return TRUE;
	}
}
Beispiel #25
0
static void* readThreadRun(void* args) {
    while(1) {
        struct voucher* v = (struct voucher*) blockingReadBB(readVoucherBuffer);
        int status = read_sector(diskDevice, &(v->sector));
        pthread_mutex_lock(&(v->voucherMutex));
        v->status = status;
        pthread_cond_signal(&(v->voucherCond));
        pthread_mutex_unlock(&(v->voucherMutex));
    }
    pthread_exit(NULL);
}
Beispiel #26
0
void read_directory(int sector, int len)
{
  int ptr = 0;
  unsigned char *sector_buffer = (unsigned char*)memalign(32,2048);
  read_sector(sector_buffer, sector);
  
  files = 0;
  memset(DVDToc,0,sizeof(file_entries));
  while (len > 0)
  {
    ptr += read_direntry(sector_buffer + ptr);
    if (ptr >= 2048 || !sector_buffer[ptr])
    {
      len -= 2048;
      sector++;
      read_sector(sector_buffer, sector);
      ptr = 0;
    }
  }
  free(sector_buffer);
}
Beispiel #27
0
int sdhc_check(void)
{
  unsigned char buffer[512];

  sdhc=0;

  // Force early detection of old vs new uart monitor
  if (onceOnly) slow_write(fd,"r\r",2,2500);
  onceOnly=0;
  
  int r0=read_sector(0,buffer,1);
  int r1=read_sector(1,buffer,1);
  int r200=read_sector(0x200,buffer,1);
  // printf("%d %d %d\n",r0,r1,r200);
  if (r0||r200) {
    fprintf(stderr,"Could not detect SD/SDHC card\n");
    exit(-3);
  }
  sdhc=r1;
  return sdhc;
}
Beispiel #28
0
void mem_map()
{
    int cyl, sect;
    int blank[BYTES_PER_SECTOR+1] = {0};
    for(cyl = 1; cyl < CYLINDERS; ++cyl) {
        for(sect = 0; sect < SECTORS_PER_CYLINDER; ++sect) {
            char data[BYTES_PER_SECTOR];
            read_sector(cyl, sect, data);
            printf("Cylinder: %d\nSector: %d\n\tData: %s\n\n", cyl, sect, data);
        }
    }
}
Beispiel #29
0
void main(void)
{
	int i, j, k;
	unsigned int base = 0x8000;
	unsigned int server_a_base = 0x2000;
	unsigned int server_b_base = 0x3000;
	prints("Bootloader:\r\n");
	prints(" Loading #2..#129 sectors into M[0x8000:0x0000].");
	for(i = 0;i < 128; i++)
	{
	if((i &63) == 0)
	prints("\r\n ");
	read_sector(i+2, base, 0);
	base += 32;
	prints(".");
	}
	prints("Done. \r\n");
	
	prints(" Loading #130..#257 sectors into M[0x2000:0x0000].");
	for(j = 0;j < 128;j++)
	{
	if((j &63) == 0)
	prints("\r\n ");
	read_sector(j+2+128, server_a_base, 0);
	server_a_base += 32;
	prints(".");
	}
	prints("done. \r\n");

	prints(" Loading #258..# sectors into M[0x3000:0x0000].");
	for( k= 0;k < 128;k++)
	{
	if((k &63) == 0)
	prints("\r\n ");
	read_sector(k+2+256, server_b_base, 0);
	server_b_base += 32;
	prints(".");
	}
	prints("done. \r\n");
}
Beispiel #30
0
/* Allocate a buffer and read a partition table sector */
static void read_pte(struct fdisk_context *cxt, int pno, sector_t offset)
{
	struct pte *pe = &ptes[pno];

	pe->offset = offset;
	pe->sectorbuffer = xcalloc(1, cxt->sector_size);

	if (read_sector(cxt, offset, pe->sectorbuffer) != 0)
		fprintf(stderr, _("Failed to read extended partition table (offset=%jd)\n"),
					(uintmax_t) offset);
	pe->changed = 0;
	pe->part_table = pe->ext_pointer = NULL;
}