static int builtin_posix_element_translate (builtin_posix_module_t *posix_module, hio_element_t element, off_t offset, size_t *size, hio_file_t **file_out, bool reading) { builtin_posix_module_dataset_t *posix_dataset = (builtin_posix_module_dataset_t *) hioi_element_dataset (element); if (HIO_FILE_MODE_BASIC == posix_dataset->base.ds_fmode) { *file_out = &element->e_file; if (offset != element->e_file.f_offset) { fseek (element->e_file.f_hndl, offset, SEEK_SET); element->e_file.f_offset = offset; } return HIO_SUCCESS; } if (reading && 0 == element->e_scount) { return builtin_posix_element_translate_opt_old (posix_module, element, offset, size, file_out); } return builtin_posix_element_translate_opt (posix_module, element, offset, size, file_out, reading); }
static int builtin_posix_element_translate (builtin_posix_module_t *posix_module, hio_element_t element, uint64_t offset, size_t *size, hio_file_t **file_out, bool reading) { builtin_posix_module_dataset_t *posix_dataset = (builtin_posix_module_dataset_t *) hioi_element_dataset (element); int rc = HIO_SUCCESS; switch (posix_dataset->ds_fmode) { case HIO_FILE_MODE_BASIC: *file_out = &element->e_file; hioi_file_seek (&element->e_file, offset, SEEK_SET); break; case HIO_FILE_MODE_STRIDED: rc = builtin_posix_element_translate_strided (posix_module, element, offset, size, file_out); break; case HIO_FILE_MODE_OPTIMIZED: rc = builtin_posix_element_translate_opt (posix_module, element, offset, size, file_out, reading); break; } return rc; }