grub1.96之Biosdisk.c(disk/i386/pc)

来源:互联网 发布:华为升级软件 编辑:程序博客网 时间:2024/04/30 11:02

static int cd_start = GRUB_BIOSDISK_MACHINE_CDROM_START;
static int cd_count = 0;

 

 

//根据设备名获取驱动器在BIOS中的编号,如果是物理磁盘,返回值为0x80、0x81...,如果是光驱设备则返回0xe0、0xe1...

static int
grub_biosdisk_get_drive (const char *name)

{

   //const char *name 形式为hd0、hd1...或fd0、fd1...
  unsigned long drive;

  if ((name[0] != 'f' && name[0] != 'h' && name[0] != 'c') || name[1] != 'd')
    goto fail;
   
  drive = grub_strtoul (name + 2, 0, 10);
  if (grub_errno != GRUB_ERR_NONE)
    goto fail;

  if (name[0] == 'h')
    drive += 0x80;
  else if (name[0] == 'c')
    drive += cd_start;
 
  return (int) drive ;

 fail:
  grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a biosdisk");
  return -1;
}

 

 

欢迎大家加入"数据恢复技术"QQ群:30481379 

        本QQ群主要研究分析NTFS、EXT2/3、ResierFS等文件系统及数据恢复技术,同时对各种系统的磁盘阵列恢复的阵列参数智能分析算法进行技术交流,欢迎有志同道合者加入!

         由于本群主要面向数据恢复的技术研究,同时起点要高于一般的数据恢复技术,所以希望加入者在加入本群以前已经有关于这方面技术的积累会相关研究经验,希望大家能理解!