Ignore:
Timestamp:
11/12/11 15:49:22 (18 months ago)
Author:
BrainSlayer
Message:

block only get functions until nvram is available

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/nvram/nvram_linux.c

    r17874 r17886  
    3939#ifdef HAVE_X86 
    4040        FILE *in = fopen("/usr/local/nvram/nvram.bin", "rb"); 
    41         if (in==NULL) 
    42             return -1; 
     41        if (in == NULL) 
     42                return -1; 
    4343        fclose(in); 
    4444#endif 
     
    9191        unsigned long *off = (unsigned long *)tmp; 
    9292 
    93         if (nvram_fd < 0) 
     93        if (nvram_fd < 0) { 
     94#ifdef HAVE_X86 
     95                FILE *in = fopen("/usr/local/nvram/nvram.bin", "rb"); 
     96                if (in == NULL) 
     97                        return NULL; 
     98                fclose(in); 
     99#endif 
    94100                if (nvram_init(NULL)) { 
    95101                        //unlock(); 
    96102                        return NULL; 
    97103                } 
     104        } 
    98105        if (count > sizeof(tmp)) { 
    99106                if (!(off = malloc(count))) { 
     
    112119        else 
    113120                value = NULL; 
    114          
     121 
    115122#ifndef HAVE_MICRO 
    116123        if (value) 
    117             msync(nvram_buf, NVRAM_SPACE, MS_INVALIDATE); 
     124                msync(nvram_buf, NVRAM_SPACE, MS_INVALIDATE); 
    118125#endif 
    119126        if (count < 0) 
     
    124131        //unlock(); 
    125132 
    126  
    127133        return value; 
    128134} 
     
    133139        int ret; 
    134140 
    135         if (nvram_fd < 0) 
     141        if (nvram_fd < 0) { 
     142#ifdef HAVE_X86 
     143                FILE *in = fopen("/usr/local/nvram/nvram.bin", "rb"); 
     144                if (in == NULL) 
     145                        return 0; 
     146                fclose(in); 
     147#endif 
    136148                if ((ret = nvram_init(NULL))) { 
    137149                        //unlock(); 
    138150                        return ret; 
    139151                } 
     152        } 
    140153        if (count == 0) { 
    141154                //unlock(); 
     
    244257                exit(1); 
    245258        } 
    246 #if defined(HAVE_WZRHPG300NH) || defined(HAVE_WHRHPGN) || defined(HAVE_WZRHPAG300NH) || defined(HAVE_DIR825) || defined(HAVE_TEW632BRP) || defined(HAVE_TG2521) || defined(HAVE_WR1043)  || defined(HAVE_WRT400) || defined(HAVE_WZRHPAG300NH) || defined(HAVE_WZRG450) || defined(HAVE_DANUBE)  
    247         system("/sbin/ledtool 1");  
     259#if defined(HAVE_WZRHPG300NH) || defined(HAVE_WHRHPGN) || defined(HAVE_WZRHPAG300NH) || defined(HAVE_DIR825) || defined(HAVE_TEW632BRP) || defined(HAVE_TG2521) || defined(HAVE_WR1043)  || defined(HAVE_WRT400) || defined(HAVE_WZRHPAG300NH) || defined(HAVE_WZRG450) || defined(HAVE_DANUBE) 
     260        system("/sbin/ledtool 1"); 
    248261#elif HAVE_LSX 
    249262        //nothing 
Note: See TracChangeset for help on using the changeset viewer.