void threadmain(int argc, char **argv) { char *net; //extern long _threaddebuglevel; //_threaddebuglevel = 1<<20; /* DBGNOTE */ rfork(RFNOTEG); ARGBEGIN{ case 'D': chatty9p++; break; case 'n': setexecname(EARGF(usage())); break; }ARGEND switch(argc){ default: usage(); case 0: net = "/net"; break; case 1: net = argv[0]; break; } quotefmtinstall(); initfs(); threadpostmountsrv(&fs, nil, net, MBEFORE); threadexits(nil); }
int main(){ char *nome = "arquivo6", *bufferLeitura; cry_desc_t* descritor; uint32_t bytesLidos; int i, retorno; retorno = initfs(nome, 19); assert(retorno != FALHA); printf("Inicialização do arquivo hospedeiro com 19 blocos: OK\n"); descritor = cry_openfs(nome); assert(descritor != NULL); printf("Abertura do arquivo hospedeiro: OK\n"); leTodosOsDescritores(descritor); leTodosOsArquivosAbertos(descritor); retorno = cry_open(descritor, "arquivo1", LEITURAESCRITA, 'a'); assert(retorno != FALHA); printf("Abertura de 1 arquivo: OK\n"); for(i = 0; i < 4; i++){ escreve(1, TAMANHOESCRITA1); } printf("Escrito um bloco em 4 vezes no único arquivo do sistema: OK\n"); printf("Descritores e tabela de arquivos abertos do sistema atual:\n"); leTodosOsDescritores(descritor); leTodosOsArquivosAbertos(descritor); return 0; }
int kmain(/*struct multiboot *mboot_ptr*/) { init_descriptor_tables(); keyboard_install(); initfs(); shell(); return 0xDEADBADA; }
char chkfs(char isrootfs) { if(isrootfs) { rewind(); if(getc(rootfs)== EOF || getc == NULL) { puts("[WARNING] Root filesystem record is empty. It will have to be reinitialized.\n"); initfs(1); return 1; } } }
int main() { cry_desc_t * descritor; indice_arquivo_t indice; initfs("arquivao", 5); descritor = cry_openfs("arquivao"); indice = cry_open(descritor,"bunda",ESCRITA,'n'); uint32_t tamanho; char *buffer = "vai se foder"; char buffer2[8]; cry_write(indice,sizeof(buffer),buffer); tamanho = cry_read(indice,8,buffer2); cry_close(indice); cry_delete(indice); return 0; }
/* test2 cria um arquivo host com 8 blocos e 2 arquivos */ void main(int argc, char *argv[]){ cry_desc_t * descritor; indice_arquivo_t indice1; indice_arquivo_t indice2; initfs("host", 30); descritor = cry_openfs("host"); char buffer[] = "babaca"; char buffer2[] = "z"; indice1 = cry_open(descritor,"arquivo1", ESCRITA, 'y'); indice2 = cry_open(descritor,"arquivo2", ESCRITA, 'q'); cry_write(indice1, sizeof(buffer), buffer); cry_write(indice2, sizeof(buffer2), buffer2); int del,del1; del = cry_close(indice1); del1 = cry_close(indice2); del = cry_delete(indice1); del1 = cry_delete(indice2); }
void loadkernel(){ Init8259(); Setinterrupt(0x26,FloppyIntHandler); Setinterrupt(0x2e,HdIntHandler); outp(0x21,inp(0x21)&0xfb); //允许从片中断 outp(0xa1,inp(0xa1)&0xbf); //开启硬盘中断 sti(); initfs(); filedes file; if(file_open(&file,"chouryos",O_RDWR)<0){ putstring("Can't find kernel!\n"); }else{ file_read(&file,(void *)KernelLocation,0xffffffff); file_close(&file); kernel(); } }
void threadmain(int argc, char **argv) { rfork(RFNOTEG); ARGBEGIN{ case 'd': mainmem->flags |= POOL_PARANOIA|POOL_ANTAGONISM; break; case 'D': chatty9p++; break; case 'c': cookiefile = EARGF(usage()); break; case 'm': mtpt = EARGF(usage()); break; case 's': service = EARGF(usage()); break; default: usage(); }ARGEND quotefmtinstall(); if(argc != 0) usage(); plumbinit(); globalctl.useragent = estrdup(globalctl.useragent); initcookies(cookiefile); initurl(); initfs(); threadpostmountsrv(&fs, service, mtpt, MREPL); threadexits(nil); }