Example #1
0
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;
}
Example #2
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);
}
Example #3
0
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;
}