Beispiel #1
0
/*FUNCTION*/
void hook_closedir(pExecuteObject pEo,
                   DIR *pDirectory
  ){
/*noverbatim
CUT*/

  file_closedir(pDirectory);
  }
Beispiel #2
0
static void file_closedir_func() {
	int file_fd = 0;
	int file_context = 0;

	__malloc_pool = malloc(0x40000);
	init_memory_pool(0x40000, __malloc_pool, 0);

	__fio = fio_create(__malloc_pool);

	timer_init("Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz");
	event_init();
	file_init();
	
	for(int i = 0; i < 256; i++) {
		file_context = file_fd = i;

		int status = file_closedir(file_fd, closedir_callback, &file_context);

		__fio->output_buffer->head = i;
		__fio->output_buffer->tail = i + 1;

		FIORequest* output_buffer = malloc(sizeof(FIORequest));
		output_buffer->type = FILE_T_CLOSEDIR;
		output_buffer->context = &file_context;
		output_buffer->id = (__fio->request_id - 1) % FIO_MAX_REQUEST_ID;
		output_buffer->fd = file_fd;

		__fio->output_buffer->array[i] = output_buffer;

		assert_int_equal(status, FIO_OK);

		event_loop();
	}	

	fifo_destroy(__fio->input_buffer);
	fifo_destroy(__fio->output_buffer);
	__free(__fio, __malloc_pool);
	
	destroy_memory_pool(__malloc_pool);	
	free(__malloc_pool);
	__malloc_pool = NULL;
}
Beispiel #3
0
struct file *
file_create_caseinsensitive(char *name)
{
    char dirname[strlen(name)+1];
    char *filename;
    char *p;
    void *d;
    struct file *ret;

    ret=file_create(name);
    if (ret)
        return ret;

    strcpy(dirname, name);
    p=dirname+strlen(name);
    while (p > dirname) {
        if (*p == '/')
            break;
        p--;
    }
    *p=0;
    d=file_opendir(dirname);
    if (d) {
        *p++='/';
        while ((filename=file_readdir(d))) {
            if (!strcasecmp(filename, p)) {
                strcpy(p, filename);
                ret=file_create(dirname);
                if (ret)
                    break;
            }
        }
        file_closedir(d);
    }
    return ret;
}
Beispiel #4
0
struct file *
file_create_caseinsensitive(char *name, struct attr **options)
{
	char *dirname=g_alloca(sizeof(char)*(strlen(name)+1));
	char *filename;
	char *p;
	void *d;
	struct file *ret;

	ret=file_create(name, options);
	if (ret)
		return ret;

	strcpy(dirname, name);
	p=dirname+strlen(name);
	while (p > dirname) {
		if (*p == '/')
			break;
		p--;
	}
	*p=0;
	d=file_opendir(dirname);
	if (d) {
		*p++='/';
		while ((filename=file_readdir(d))) {
			if (!g_strcasecmp(filename, p)) {
				strcpy(p, filename);
				ret=file_create(dirname, options);
				if (ret)
					break;
			}
		}
		file_closedir(d);
	}
	return ret;
}