Changeset 17204


Ignore:
Timestamp:
06/16/11 15:13:34 (2 years ago)
Author:
BrainSlayer
Message:

new x86 code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/services/sysinit/sysinit-x86.c

    r17023 r17204  
    5757#define sys_reboot() eval("sync"); eval("event","3","1","15") 
    5858 
    59 static int getdiscindex(void)   // works only for squashfs  
     59static char *getdisc(void)      // works only for squashfs  
    6060{ 
    6161        int i; 
    62  
    63         for (i = 0; i < 10; i++) { 
     62        unsigned char *disks[]={"/dev/sda2","/dev/sdb2","/dev/sdc2","/dev/sdd2","/dev/sde2","/dev/sdf2","/dev/sdg2","/dev/sdh2","/dev/sdi2"}; 
     63        for (i = 0; i < 9; i++) { 
    6464                char dev[64]; 
    6565 
    66                 sprintf(dev, "/dev/discs/disc%d/part2", i); 
     66                strcpy(dev, disks[i]); 
    6767                FILE *in = fopen(dev, "rb"); 
    6868 
     
    7777                        fclose(in); 
    7878                        // filesystem detected 
    79                         return i; 
     79                        return disks[i]; 
    8080                } 
    8181                fclose(in); 
    8282        } 
    83         return -1; 
     83        return NULL; 
    8484} 
    8585 
     
    8989 
    9090        char dev[64]; 
    91         int index = getdiscindex(); 
    92  
    93         if (index == -1) { 
     91        char *disk = getdisc(); 
     92 
     93        if (disk == NULL) { 
    9494                fprintf(stderr, 
    9595                        "no valid dd-wrt partition found, calling shell"); 
     
    114114        if (in == NULL) { 
    115115                fprintf(stderr, "recover broken nvram\n"); 
    116                 sprintf(dev, "/dev/discs/disc%d/disc", index); 
     116                strcpy(dev,disk); 
    117117                in = fopen(dev, "rb"); 
    118118                fseeko(in, 0, SEEK_END); 
Note: See TracChangeset for help on using the changeset viewer.