/* * list the extended attribute of a file, internal call * */ ssize_t gfal_posix_internal_listxattr (const char *path, char *list, size_t size){ GError* tmp_err=NULL; gfal2_context_t handle; ssize_t res= -1; if((handle = gfal_posix_instance()) == NULL){ errno = EIO; return -1; } res = gfal2_listxattr(handle, path, list, size, &tmp_err); if(tmp_err){ gfal_posix_register_internal_error(handle, "[gfal_listxattr]", tmp_err); errno = tmp_err->code; } return res; }
int gfal_posix_internal_symlink(const char* oldpath, const char* newpath){ GError* tmp_err = NULL; gfal2_context_t handle; int ret=-1; if( (handle = gfal_posix_instance() ) ==NULL){ errno = EIO; return -1; } ret = gfal2_symlink(handle, oldpath, newpath,&tmp_err); if(tmp_err){ gfal_posix_register_internal_error(handle, "[gfal_symlink]", tmp_err); errno = tmp_err->code; } return (ret)?-1:0; }
/* * set a value to a extended attribute * */ int gfal_posix_internal_setxattr (const char *path, const char *name, const void *value, size_t size, int flags){ GError* tmp_err=NULL; gfal_handle handle; int res= -1; if((handle = gfal_posix_instance()) == NULL){ errno = EIO; return -1; } res = gfal2_setxattr(handle, path, name, value, size, flags, &tmp_err); if(tmp_err){ gfal_posix_register_internal_error(handle, "[gfal_setxattr]", tmp_err); errno = tmp_err->code; } return res; }
void mock_srm_access_right_response(char* surl){ #if USE_MOCK GError* mock_err=NULL; gfal_handle handle = gfal_posix_instance(); gfal_plugins_instance(handle,NULL); test_mock_lfc(handle, &mock_err); setup_mock_srm(); if( gfal_check_GError(&mock_err)) return; gfal_plugins_instance(handle, NULL); char* surls[] = { surl, NULL }; char* turls[] = { "nawak", NULL }; int status[] = { 0, 0 }; define_mock_srmv2_filestatus(1, surls, NULL, turls, status); define_mock_endpoints(TEST_SRM_DPM_FULLENDPOINT_URL); will_respond(srm_mock_srm_context_init, 0, want_non_null(context), want_string(srm_endpoint, TEST_SRM_DPM_FULLENDPOINT_URL)); will_respond(srm_mock_srm_check_permission, 1, want_non_null(context), want_non_null(statuses), want_non_null(input)); #endif }
void test_mock_srm_open_write_valid(char** tab, char** tab_turl, int* res){ #if USE_MOCK test_rfio_mock_all(); setup_mock_srm(); gfal_handle handle = gfal_posix_instance(); gfal_plugins_instance(handle,NULL); int status[] = { 0,0 }; char* turls[] = { "rfio://mockedturl", NULL }; char* surls[] = { "srm://mockedsurl", NULL }; define_mock_endpoints(TEST_SRM_DPM_FULLENDPOINT_URL); // mock the mds for the srm endpoitn resolution will_respond(srm_mock_srm_context_init, 0, want_non_null(context), want_string(srm_endpoint, TEST_SRM_DPM_FULLENDPOINT_URL)); define_mock_srmv2_putoutput(1, tab, NULL, tab_turl, res); will_respond(srm_mock_srm_prepare_to_put, 1, want_non_null(context), want_non_null(input), want_non_null(output)); will_respond(rfio_mock_open, 15, want_non_null(path)); define_put_done(1, surls, NULL, turls, status); will_respond(srm_mock_srm_put_done,1, want_non_null(context)); will_respond(rfio_mock_close, 0, want(fd, 15)); #endif }