示例#1
0
文件: fchdir.c 项目: VanL/zrt
int zrt_zcall_fchdir(int fd){
    CHECK_EXIT_IF_ZRT_NOT_READY;
    errno=0;
    LOG_SYSCALL_START(P_TEXT, "");    
    int ret = -1;

    const struct HandleItem* entry = get_handle_allocator()->entry(fd);
    if ( entry == NULL ){
	SET_ERRNO(EBADF);
	return -1;
    }

    /*get reference to filesystem that related to path*/
    struct MountsPublicInterface* fs_implementation = entry->mount_fs;
    struct MountSpecificPublicInterface* fs_specific_implementation 
	= fs_implementation->implem(fs_implementation);

    const char* path = fs_specific_implementation->handle_path(fs_specific_implementation, fd);
    if ( path != NULL ){
	ret = chdir(path);
    }
    else{
	SET_ERRNO(ENOENT);
	return -1;
    }

    LOG_SHORT_SYSCALL_FINISH( ret, "get_phys_pages=%d", ret );
    return ret;
}
示例#2
0
struct MountsPublicInterface* mm_mount_byhandle( struct MountsManager *mounts_manager,
                                                 int handle ){
    const struct HandleItem* entry = get_handle_allocator()->entry(handle);
    /*if handle exist and related to opened file*/
    if ( entry && NULL != 
         get_open_files_pool()->entry(entry->open_file_description_id) ) 
	return entry->mount_fs;
    else return NULL;
}
示例#3
0
int mm_fusemount_add( struct MountsManager *mounts_manager,
                      const char* path, 
                      struct fuse_operations* fuse_mount,
                      char expect_absolute_path,
                      char proxy_mode){
    struct MountsPublicInterface* fs 
	= CONSTRUCT_L(FUSE_OPERATIONS_MOUNT)( get_handle_allocator(),
					      get_open_files_pool(),
					      fuse_mount,
                                              proxy_mode);
    return mm_mount_add( mounts_manager, path, fs, expect_absolute_path );
}
示例#4
0
struct MountsManager* get_mounts_manager(){
    s_mounts_manager.handle_allocator = get_handle_allocator();
    s_mounts_manager.open_files_pool = get_open_files_pool();
    return &s_mounts_manager;
}