[BACK]Return to fdisk.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sbin / fdisk

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sbin/fdisk/fdisk.c between version 1.88.2.2 and 1.89

version 1.88.2.2, 2009/05/30 06:37:13 version 1.89, 2005/04/07 20:23:13
Line 1263  intuit_translated_geometry(void)
Line 1263  intuit_translated_geometry(void)
                         a2 -= s2;                          a2 -= s2;
                         num = (uint64_t)h1 * a2 - (uint64_t)h2 * a1;                          num = (uint64_t)h1 * a2 - (uint64_t)h2 * a1;
                         denom = (uint64_t)c2 * a1 - (uint64_t)c1 * a2;                          denom = (uint64_t)c2 * a1 - (uint64_t)c1 * a2;
                         if (denom != 0 && num != 0 && num % denom == 0) {                          if (denom != 0 && num % denom == 0) {
                                 xheads = num / denom;                                  xheads = num / denom;
                                 xsectors = a1 / (c1 * xheads + h1);                                  xsectors = a1 / (c1 * xheads + h1);
                                 break;                                  break;
Line 1273  intuit_translated_geometry(void)
Line 1273  intuit_translated_geometry(void)
                         break;                          break;
         }          }
   
         if (xheads == -1) {          if (xheads == -1)
                 warnx("Cannot determine the number of heads");  
                 return;                  return;
         }  
   
         /* Estimate the number of cylinders. */          /* Estimate the number of cylinders. */
         xcylinders = disklabel.d_secperunit / xheads / xsectors;          xcylinders = disklabel.d_secperunit / xheads / xsectors;
Line 1328  get_mapping(int i, uint *cylinder, uint 
Line 1326  get_mapping(int i, uint *cylinder, uint 
         if (i % 2 == 0) {          if (i % 2 == 0) {
                 *cylinder = MBR_PCYL(part->mbrp_scyl, part->mbrp_ssect);                  *cylinder = MBR_PCYL(part->mbrp_scyl, part->mbrp_ssect);
                 *head = part->mbrp_shd;                  *head = part->mbrp_shd;
                 *sector = MBR_PSECT(part->mbrp_ssect);                  *sector = MBR_PSECT(part->mbrp_ssect) - 1;
                 *absolute = le32toh(part->mbrp_start);                  *absolute = le32toh(part->mbrp_start);
         } else {          } else {
                 *cylinder = MBR_PCYL(part->mbrp_ecyl, part->mbrp_esect);                  *cylinder = MBR_PCYL(part->mbrp_ecyl, part->mbrp_esect);
                 *head = part->mbrp_ehd;                  *head = part->mbrp_ehd;
                 *sector = MBR_PSECT(part->mbrp_esect);                  *sector = MBR_PSECT(part->mbrp_esect) - 1;
                 *absolute = le32toh(part->mbrp_start)                  *absolute = le32toh(part->mbrp_start)
                     + le32toh(part->mbrp_size) - 1;                      + le32toh(part->mbrp_size) - 1;
         }          }
         /* Sanity check the data against all zeroes */  
         if ((*cylinder == 0) && (*sector == 0) && (*head == 0))  
                 return -1;  
         /* sector numbers in the MBR partition table start at 1 */  
         *sector = *sector - 1;  
         /* Sanity check the data against max values */          /* Sanity check the data against max values */
         if ((((*cylinder * MAXHEAD) + *head) * MAXSECTOR + *sector) < *absolute)          if ((((*cylinder * MAXHEAD) + *head) * MAXSECTOR + *sector) < *absolute)
                 /* cannot be a CHS mapping */                  /* cannot be a CHS mapping */
Line 1865  change_part(int extended, int part, int 
Line 1858  change_part(int extended, int part, int 
                  * somewhere to safely write the menu tag.                   * somewhere to safely write the menu tag.
                  */                   */
                 if (le16toh(boot->mbr_bootsel_magic) != MBR_BS_MAGIC) {                  if (le16toh(boot->mbr_bootsel_magic) != MBR_BS_MAGIC) {
                         if (f_flag ||                          if (yesno("The bootselect code is not installed, "
                             yesno("The bootselect code is not installed, "                                              "do you want to install it now?"))
                             "do you want to install it now?"))  
                                 install_bootsel(MBR_BS_ACTIVE);                                  install_bootsel(MBR_BS_ACTIVE);
                 }                  }
                 if (le16toh(boot->mbr_bootsel_magic) == MBR_BS_MAGIC) {                  if (le16toh(boot->mbr_bootsel_magic) == MBR_BS_MAGIC) {
Line 2349  decimal(const char *prompt, int dflt, in
Line 2341  decimal(const char *prompt, int dflt, in
 {  {
         int acc = 0;          int acc = 0;
         char *cp;          char *cp;
           char ch;
   
         for (;;) {          for (;;) {
                 if (flags & DEC_SEC) {                  if (flags & DEC_SEC) {
Line 2374  decimal(const char *prompt, int dflt, in
Line 2367  decimal(const char *prompt, int dflt, in
                 if (isdigit((unsigned char)*cp) || *cp == '-') {                  if (isdigit((unsigned char)*cp) || *cp == '-') {
                         acc = strtol(lbuf, &cp, 10);                          acc = strtol(lbuf, &cp, 10);
                         if (flags & DEC_SEC) {                          if (flags & DEC_SEC) {
                                 if (*cp == 'm' || *cp == 'M') {                                  ch = *cp;
                                   if (ch == 'g' || ch == 'G') {
                                           acc *= 1024;
                                           ch = 'm';
                                   }
                                   if (ch == 'm' || ch == 'M') {
                                         acc *= SEC_IN_1M;                                          acc *= SEC_IN_1M;
                                         /* round to whole number of cylinders */                                          /* round to whole number of cylinders */
                                         acc += dos_cylindersectors / 2;                                          acc += dos_cylindersectors / 2;
                                         acc /= dos_cylindersectors;                                          acc /= dos_cylindersectors;
                                         cp = "c";                                          ch = 'c';
                                 }                                  }
                                 if (*cp == 'c' || *cp == 'C') {                                  if (ch == 'c' || ch == 'C') {
                                         cp = "";                                          cp++;
                                         acc *= dos_cylindersectors;                                          acc *= dos_cylindersectors;
                                         /* adjustments for cylinder boundary */                                          /* adjustments for cylinder boundary */
                                         if (acc == 0 && flags & DEC_RND_0)                                          if (acc == 0 && flags & DEC_RND_0)

Legend:
Removed from v.1.88.2.2  
changed lines
  Added in v.1.89

CVSweb <webmaster@jp.NetBSD.org>