static int read_write ( const char *basepath, UMSDOS_REGISTER ®, int line_length) { /* #Specification: utstspc / read write We write files with special pattern and read it back using different blocking scheme. This is to make sure the new read ahead support in the msdos fs is not screwing. */ char fname[MAXSIZ_PATH]; sprintf (fname,"%s/file.c",basepath); int size = read_initfile(fname,reg,line_length); if (size != -1){ reg.verbose ("Creating a %d bytes file %s (line length %d)\n" ,size,fname,line_length); static int tb[]={ 4096,2048,1024,512,513,255,50,256*1024 }; for (unsigned int i=0; i<sizeof(tb)/sizeof(tb[0]) && reg.getnberr()==0; i++){ reg.verbose ("\tTesting block size %d\n",tb[i]); read_checkfile (fname,reg,tb[i],size,line_length); } util_unlink (fname,reg,0); } return reg.getnberr(); }
void read_inittab(void) { numcmd = 0; /* Fake an inittab entry if boot console defined */ #ifdef CONFIG_USER_INIT_CONSOLE_SH #if LINUX_VERSION_CODE < 0x020100 if (console_device && strcmp(console_device, "/dev/null")) #else if (have_console) #endif { struct initline *p; char def_console_name[10]="console"; p = inittab + numcmd++; init_itab(p); #if defined( CONFIG_RTL865X) && defined(CONFIG_PCI) if(boot_uart1) strcpy(def_console_name, "ttyS1"); #endif strcpy(p->fullline, def_console_name); strcpy(p->tty, def_console_name); strcpy(p->termcap, "linux"); p->toks[0] = "/bin/sh"; } #endif read_initfile(_PATH_INITTAB); #ifdef CONFIG_USER_FLATFSD_FLATFSD read_initfile(_PATH_CONFIGTAB); #endif if (numcmd == 0) _exit(1); }
void read_inittab(void) { int i; /* * free any old data and start again */ for (i = 0; i < numcmd; i++) clear_itab(&inittab[i]); numcmd = 0; /* Fake an inittab entry if boot console defined */ #ifdef CONFIG_USER_INIT_CONSOLE_SH #if LINUX_VERSION_CODE < 0x020100 if (console_device && strcmp(console_device, "/dev/null")) #else if (have_console) #endif { struct initline *p; p = inittab + numcmd++; init_itab(p); p->fullline = strdup("console"); strcpy(p->tty, "console"); strcpy(p->termcap, "linux"); add_tok(p, "-/bin/sh"); } #endif i = 0; if (read_initfile(_PATH_INITTAB) == 0) i++; #ifdef CONFIG_USER_FLATFSD_FLATFSD if (read_initfile(_PATH_CONFIGTAB) == 0) i++; #endif if (i == 0) { err("Failed to open " _PATH_INITTAB #ifdef CONFIG_USER_FLATFSD_FLATFSD " or " _PATH_CONFIGTAB #endif "." ); } #ifdef CONFIG_USER_INIT_CONF load_init_conf(); #endif /* if needed, shrink the array using realloc - * must be done here so that we include the results of all init files * when calculating number of commands */ if ((numcmd + 2) < (inittab_size - NUMCMD)) { /* round up from numcmd to the nearest multiple of NUMCMD */ inittab_size = ((numcmd + 2) / NUMCMD + 1) * NUMCMD; inittab = realloc(inittab, inittab_size * sizeof(struct initline)); if (!inittab) { /* failure case - what do you do if init fails? */ err("malloc failed"); _exit(1); } } if (numcmd == 0) _exit(1); }