Hello,
        Sorry, I forgot to send the attachments. I am sending them with
this mail.

Thanks,
--------------------
Ashutosh S. Rajekar
--- disk_io.c   Sun Aug 15 19:25:41 1999

+++ /gnu/src/grub-0.5.92/stage2/disk_io.c       Sun Aug 15 19:15:01 1999

@@ -532,10 +532,20 @@

 } part_choice;

 

 

+/* This has all changed now. We use the traditional BSD-style naming scheme.

+

+       (hd1,0)         ->      /dev/hd1s0

+       (hd0,2,a)       ->      /dev/hd0s2a

+       (hd1,7)         ->      /dev/hd1s7

+       

+We still need to change this, it should be according to the num. of the IDE

+drive, whereas now we are checking only hard disks, as CD-ROMs are not

+reported */

 char *set_device(char *device)

 {

        /* The use of retval in this function is not really clean, but it works */

        char *retval = 0;

+       char ch;

 

        incomplete = 0;

        disk_choice = 1;

@@ -543,133 +553,71 @@

        current_drive = saved_drive;

        current_partition = 0xFFFFFF;

 

-#ifndef STAGE1_5

-       if (*device == '(' && !*(device + 1))

-               /* user has given '(' only, let disk_choice handle what disks we have 
*/

-               return device + 1;

-#endif

-

-       if (*device == '(' && *(++device)) {

-               if (*device != ',' && *device != ')') {

-                       char ch = *device;

+       if (substring("/dev/", device) != -1)  {

+               errnum = ERR_DEV_FORMAT;

+               return 0;

+       }

 

-#ifndef STAGE1_5

-                       if (*device == 'f' || *device == 'h') {

-                               /* user has given '([fh]', check for resp. add 'd' and 


-                                  let disk_choice handle what disks we have */

-                               if (!*(device + 1)) {

-                                       device++;

-                                       *device++ = 'd';

-                                       *device = '\0';

-                                       return device;

-                               } else if (*(device + 1) == 'd' && !*(device + 2))

-                                       return device + 2;

-                       }

+       device += 5;

+       ch = *device;

+       

+#ifndef        STAGE1_5

+       if (*device == 'h' || *device == 'f') {

+               if (!*(device + 1)) {   /* Let disk_choice complete this; add 'd' */

+                       device++;

+                       *device = 'd';

+                       *device = '\0';

+                       return device;

+               } else if ((*(device + 1) == 'd') && !*(device + 2))

+                       return device + 2;

+       }

 #endif

 

-                       if ((*device == 'f' || *device == 'h')

-                           && (device += 2, (*(device - 1) != 'd')))

-                               errnum = ERR_NUMBER_PARSING;

-

-                       safe_parse_maxint(&device, (int *) &current_drive);

-

-                       disk_choice = 0;

-                       if (ch == 'h')

-                               current_drive += 0x80;

-               }

-               if (errnum)

-                       return 0;

+       if ((*device == 'h' || *device == 'f') 

+               && (device += 2, (*(device - 1) != 'd')))

+               errnum = ERR_NUMBER_PARSING;

+

+       safe_parse_maxint(&device, (int *) &current_drive);

+       part_choice = PART_DISK;

+       disk_choice = 0;

+       if (ch == 'h' || ch == 's')

+               current_drive += 0x80;

 

-               if (*device == ')') {

-                       part_choice = PART_CHOSEN;

-                       retval++;

-               } else if (*device == ',') {

-                       /* Either an absolute PC or BSD partition. */

-                       disk_choice = 0;

+       if (errnum)

+               return 0;

+               

+       if(!*device)  {

+               retval++;

+       } else if (*device != 's')

+               errnum = ERR_DEV_FORMAT;

+       

+       if (*device == 's' && !*(device + 1)) {

+               device++;       /* Let disk_choice complete this */

+               *device = '\0';

+               return device;

+       }

+       

+       else  {

+               device++;

+               if (*device >= '0' && *device <= '9') {

                        part_choice++;

-                       device++;

-

-                       if (*device >= '0' && *device <= '9') {

-                               part_choice++;

-                               current_partition = 0;

-

-                               if (!(current_drive & 0x80)

-                                   || !safe_parse_maxint(&device, (int *) 
&current_partition)

-                                   || current_partition > 254) {

-                                       errnum = ERR_DEV_FORMAT;

-                                       return 0;

-                               }

-                               current_partition = (current_partition << 16) + 
0xFFFF;

+                       current_partition = 0;

 

-                               if (*device == ','

-                                   && *(device + 1) >= 'a' && *(device + 1) <= 'h') {

-                                       device++;

-                                       current_partition = (((*(device++) - 'a') << 
8)

-                                       | (current_partition & 0xFF00FF));

-                               }

-                       } else if (*device >= 'a' && *device <= 'h') {

-                               part_choice++;

-                               current_partition = ((*(device++) - 'a') << 8) | 
0xFF00FF;

+                       if (!(current_drive & 0x80)

+                       || !safe_parse_maxint(&device, (int *) &current_partition)

+                           || current_partition > 254) {

+                               errnum = ERR_DEV_FORMAT;

+                               return 0;

                        }

-                       if (*device == ')') {

-                               if (part_choice == PART_DISK) {

-                                       current_partition = saved_partition;

-                                       part_choice++;

-                               }

-                               retval++;

-                       }

-               }

-       } else {

-               char ch;

-

-               /* A Mach-style absolute partition name. */

-               ch = *device;

-               if ((*device != 'f' && *device != 'h') ||

-                   (device += 2, (*(device - 1) != 'd')))

-                       errnum = ERR_DEV_FORMAT;

-               else

-                       safe_parse_maxint(&device, (int *) &current_drive);

-

-               disk_choice = 0;

-               if (ch != 'f')

-                       current_drive += 0x80;

-

-               if (errnum)

-                       return 0;

-

-               if (*device == '/') {

-                       part_choice = PART_CHOSEN;

-                       retval++;

-               } else if (*device == 's') {

-                       /* An absolute PC partition. */

-                       disk_choice = 0;

-                       part_choice++;

-                       device++;

-

-                       if (*device >= '0' && *device <= '9') {

+                       current_partition = (current_partition << 16) + 0xFFFF;

+               

+                       if (*device >= 'a' && *device <= 'h') {

                                part_choice++;

-                               current_partition = 0;

-

-                               if (!(current_drive & 0x80) ||

-                                   !safe_parse_maxint(&device, (int *) 
&current_partition) ||

-                                   (--current_partition) > 254) {

-                                       errnum = ERR_DEV_FORMAT;

-                                       return 0;

-                               }

-                               current_partition = (current_partition << 16) + 
0xFFFF;

-

-                               if (*device >= 'a' && *device <= 'h') {

-                                       /* A BSD partition within the slice. */

-                                       current_partition = (((*(device++) - 'a') << 
8)

-                                       | (current_partition & 0xFF00FF));

-                               }

+                               current_partition = ((*(device++) - 'a') << 8) | 
+0xFF00FF;

                        }

-               } else if (*device >= 'a' && *device <= 'h') {

-                       /* An absolute BSD partition. */

-                       part_choice++;

-                       current_partition = ((*(device++) - 'a') << 8) | 0xFF00FF;

                }

-               if (*device == '/') {

+       

+               if (!*device) {

                        if (part_choice == PART_DISK) {

                                current_partition = saved_partition;

                                part_choice++;

@@ -677,7 +625,7 @@

                        retval++;

                }

        }

-

+       

        if (retval)

                retval = device + 1;

        else {

@@ -685,7 +633,7 @@

                        incomplete = 1;

                errnum = ERR_DEV_FORMAT;

        }

-

+       

        return retval;

 }

 

@@ -693,7 +641,6 @@

  *  This performs a "mount" on the current device, both drive and partition

  *  number.

  */

-

 int open_device(void)

 {

        if (open_partition())

@@ -705,7 +652,6 @@

        return 1;

 }

 

-

 #ifndef STAGE1_5

 int set_bootdev(int hdbias)

 {

@@ -734,11 +680,8 @@

                           ((saved_drive - hdbias) & 0x79),

                           ((saved_partition >> 8) & 0xFF));

 }

-#endif                         /* STAGE1_5 */

-

-

-static char *

- setup_part(char *filename)

+#endif /* STAGE1_5 */ 

+static char *setup_part(char *filename)

 {

        /* FIXME: decide on syntax for blocklist vs. old-style vs. /dev/hd0s1 */

        /* Strip any leading /dev. */

@@ -750,12 +693,12 @@

                        current_drive = 0xFF;

                        return 0;

                }

-#ifndef NO_BLOCK_FILES

-               if (*filename != '/')

-                       open_partition();

+#ifndef NO_BLOCK_FILES  

+       if (*filename != '/')

+               open_partition();

                else

 #endif                         /* NO_BLOCK_FILES */

-                       open_device();

+               open_device();

        } else if (saved_drive != current_drive

                   || saved_partition != current_partition

                   || (*filename == '/' && fsys_type == NUM_FSYS)

@@ -806,11 +749,11 @@

 }

 #endif                         /* STAGE1_5 */

 

-#ifndef STAGE1_5

+#ifndef STAGE1_5               

 /*

  *  print_a_completion saves what has been printed to unique_string

  *  printf's with a leading ' '.

- */

+ */ 

 

 void print_a_completion(char *filename)

 {

@@ -827,7 +770,7 @@

                *u = '\0';

        }

        unique++;

-

+       

        printf(" %s", filename);

 }

 

@@ -842,11 +785,13 @@

 

        *unique_string = '\0';

        unique = 0;

-

-       if (*filename == '/' || (ptr = set_device(filename)) || incomplete) {

+       

+       if(*filename == '/' || incomplete) {

                errnum = 0;

-

-               if (*filename != '/' && (incomplete || !*ptr)) {

+               

+               ptr = set_device(filename);

+               if ((substring("/dev/", filename) < 1)

+                       && (incomplete || !*ptr)) {

                        if (!part_choice) {

                                /* disk completions */

                                int disk_no, i, j;

@@ -861,33 +806,28 @@

                                                disk_no = (i * 0x80) + j;

                                                if ((disk_choice || disk_no == 
current_drive) &&

                                                    !get_diskinfo(disk_no, &geom)) {

-                                                       char dev_name[4];

+                                                       char dev_name[8];

 

-                                                       dev_name[0] = (i ? 'h' : 'f');

+                                                       dev_name[0] = '/';

                                                        dev_name[1] = 'd';

-                                                       dev_name[2] = '0' + j;

-                                                       dev_name[3] = '\0';

+                                                       dev_name[2] = 'e';

+                                                       dev_name[3] = 'v';

+                                                       dev_name[4] = '/';

+                                                       dev_name[5] = (i ? 'h' : 'f');
+
+                                                       dev_name[6] = 'd';

+                                                       dev_name[7] = '0' + j;

+                                                       dev_name[8] = '\0';

                                                        print_a_completion(dev_name);

                                                }

                                        }

-                               }

-

-                               ptr = filename;

-                               while (*ptr != '(')

-                                       ptr--;

-                               ptr++;

-                               {

-                                       char *u = unique_string;

-                                       while ((*ptr++ = *u++));

-                                       ptr--;

-                               }

-                               ptr--;

-                               if ((*(ptr - 2) == 'h') && (*(ptr - 1) == 'd')

-                                   && ('0' <= *ptr && *ptr <= '8'))

-                                       *(ptr + 1) = ',', *(ptr + 2) = '\0';

-                               if ((*(ptr - 2) == 'f') && (*(ptr - 1) == 'd')

-                                   && ('0' <= *ptr && *ptr <= '8'))

-                                       *(ptr + 1) = ')', *(ptr + 2) = '\0';

+                               } 

+                               

+                               ptr = filename;                         

+                               ptr += 5;               /* Jump beyond "/dev/" */

+                               if ((*ptr == 'h' || *ptr == 'f') 

+                                       && (*(ptr + 1) == 'd') 

+                                       && ('0' <= *(ptr + 2) && *(ptr + 2) <= '8'))

+                                       *(ptr + 3) = 's', *(ptr + 4) = '\0';

 

                                putchar('\n');

                        } else {

@@ -903,9 +843,8 @@

                                                ptr = filename;

                                                while (*ptr)

                                                        ptr++;

-                                               if (*(ptr - 1) != ')')

-                                                       *ptr++ = ')';

-                                               *ptr++ = '/';

+                                               if (*(ptr - 1) != 's')

+                                                       *ptr++ = 's';

                                                *ptr = '\0';

                                        }

                                }

@@ -978,9 +917,9 @@

                                break;

                        }

                        /* since we use the same filesystem buffer, mark it to

-                          be remounted */

+                          be remounted */ 

+                          

                        fsys_type = NUM_FSYS;

-

                        BLK_BLKSTART(list_addr) = tmp;

                        ptr++;

 

--- ChangeLog   Sun Aug 15 20:15:51 1999

+++ ChangeLog~  Tue Jul 27 04:27:52 1999

@@ -1,12 +1,3 @@

-1999-08-15  Ashutosh S. Rajekar <[EMAIL PROTECTED]>

-       * Made changes in stage2/disk_io.c to the functions set_device()

-       and print_completions(), to make the syntax more BSD-like, though 

-       full BSD-style syntax is not complete as yet. Now the device

-       names are specified as :

-       for root=(hd1,0) => /dev/hd1s0     ->   (should be /dev/hd2s1)

-       for root=(hd0,2,a) => /dev/hd0s2a  ->   (should be /dev/hd0s3a)

-       Also the option root=(0x80) is replaced by root=/dev/hd0s0.

-

 1999-07-15  Gordon Matzigkeit  <[EMAIL PROTECTED]>

 

        * docs/Makefile.am (grub.info): Use an ugly hack to downgrade

Reply via email to