ra_loader.c (302408) | ra_loader.c (362181) |
---|---|
1/* 2 * ra_loader.c: logic for loading different RA library implementations 3 * 4 * ==================================================================== 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file --- 66 unchanged lines hidden (view full) --- 75 const char * const *schemes; 76 /* the initialization function if linked in; otherwise, NULL */ 77 svn_ra__init_func_t initfunc; 78 svn_ra_init_func_t compat_initfunc; 79} ra_libraries[] = { 80 { 81 "svn", 82 svn_schemes, | 1/* 2 * ra_loader.c: logic for loading different RA library implementations 3 * 4 * ==================================================================== 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file --- 66 unchanged lines hidden (view full) --- 75 const char * const *schemes; 76 /* the initialization function if linked in; otherwise, NULL */ 77 svn_ra__init_func_t initfunc; 78 svn_ra_init_func_t compat_initfunc; 79} ra_libraries[] = { 80 { 81 "svn", 82 svn_schemes, |
83#ifdef SVN_LIBSVN_CLIENT_LINKS_RA_SVN | 83#ifdef SVN_LIBSVN_RA_LINKS_RA_SVN |
84 svn_ra_svn__init, 85 svn_ra_svn__deprecated_init 86#endif 87 }, 88 89 { 90 "local", 91 local_schemes, | 84 svn_ra_svn__init, 85 svn_ra_svn__deprecated_init 86#endif 87 }, 88 89 { 90 "local", 91 local_schemes, |
92#ifdef SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL | 92#ifdef SVN_LIBSVN_RA_LINKS_RA_LOCAL |
93 svn_ra_local__init, 94 svn_ra_local__deprecated_init 95#endif 96 }, 97 98 { 99 "serf", 100 dav_schemes, | 93 svn_ra_local__init, 94 svn_ra_local__deprecated_init 95#endif 96 }, 97 98 { 99 "serf", 100 dav_schemes, |
101#ifdef SVN_LIBSVN_CLIENT_LINKS_RA_SERF | 101#ifdef SVN_LIBSVN_RA_LINKS_RA_SERF |
102 svn_ra_serf__init, 103 svn_ra_serf__deprecated_init 104#endif 105 }, 106 107 /* ADD NEW RA IMPLEMENTATIONS HERE (as they're written) */ 108 109 /* sentinel */ --- 28 unchanged lines hidden (view full) --- 138 { 139 apr_dso_handle_t *dso; 140 apr_dso_handle_sym_t symbol; 141 const char *libname; 142 const char *funcname; 143 const char *compat_funcname; 144 apr_status_t status; 145 | 102 svn_ra_serf__init, 103 svn_ra_serf__deprecated_init 104#endif 105 }, 106 107 /* ADD NEW RA IMPLEMENTATIONS HERE (as they're written) */ 108 109 /* sentinel */ --- 28 unchanged lines hidden (view full) --- 138 { 139 apr_dso_handle_t *dso; 140 apr_dso_handle_sym_t symbol; 141 const char *libname; 142 const char *funcname; 143 const char *compat_funcname; 144 apr_status_t status; 145 |
146 libname = apr_psprintf(pool, "libsvn_ra_%s-%d.so.%d", | 146 libname = apr_psprintf(pool, "libsvn_ra_%s-" SVN_DSO_SUFFIX_FMT, |
147 ra_name, SVN_VER_MAJOR, SVN_SOVERSION); 148 funcname = apr_psprintf(pool, "svn_ra_%s__init", ra_name); 149 compat_funcname = apr_psprintf(pool, "svn_ra_%s_init", ra_name); 150 151 /* find/load the specified library */ 152 SVN_ERR(svn_dso_load(&dso, libname)); 153 if (! dso) 154 return SVN_NO_ERROR; --- 96 unchanged lines hidden (view full) --- 251svn_error_t * 252svn_ra_create_callbacks(svn_ra_callbacks2_t **callbacks, 253 apr_pool_t *pool) 254{ 255 *callbacks = apr_pcalloc(pool, sizeof(**callbacks)); 256 return SVN_NO_ERROR; 257} 258 | 147 ra_name, SVN_VER_MAJOR, SVN_SOVERSION); 148 funcname = apr_psprintf(pool, "svn_ra_%s__init", ra_name); 149 compat_funcname = apr_psprintf(pool, "svn_ra_%s_init", ra_name); 150 151 /* find/load the specified library */ 152 SVN_ERR(svn_dso_load(&dso, libname)); 153 if (! dso) 154 return SVN_NO_ERROR; --- 96 unchanged lines hidden (view full) --- 251svn_error_t * 252svn_ra_create_callbacks(svn_ra_callbacks2_t **callbacks, 253 apr_pool_t *pool) 254{ 255 *callbacks = apr_pcalloc(pool, sizeof(**callbacks)); 256 return SVN_NO_ERROR; 257} 258 |
259svn_error_t *svn_ra_open4(svn_ra_session_t **session_p, | 259svn_error_t *svn_ra_open5(svn_ra_session_t **session_p, |
260 const char **corrected_url_p, | 260 const char **corrected_url_p, |
261 const char **redirect_url_p, |
|
261 const char *repos_URL, 262 const char *uuid, 263 const svn_ra_callbacks2_t *callbacks, 264 void *callback_baton, 265 apr_hash_t *config, 266 apr_pool_t *pool) 267{ 268 apr_pool_t *sesspool = svn_pool_create(pool); --- 107 unchanged lines hidden (view full) --- 376 /* Create the session object. */ 377 session = apr_pcalloc(sesspool, sizeof(*session)); 378 session->cancel_func = callbacks->cancel_func; 379 session->cancel_baton = callback_baton; 380 session->vtable = vtable; 381 session->pool = sesspool; 382 383 /* Ask the library to open the session. */ | 262 const char *repos_URL, 263 const char *uuid, 264 const svn_ra_callbacks2_t *callbacks, 265 void *callback_baton, 266 apr_hash_t *config, 267 apr_pool_t *pool) 268{ 269 apr_pool_t *sesspool = svn_pool_create(pool); --- 107 unchanged lines hidden (view full) --- 377 /* Create the session object. */ 378 session = apr_pcalloc(sesspool, sizeof(*session)); 379 session->cancel_func = callbacks->cancel_func; 380 session->cancel_baton = callback_baton; 381 session->vtable = vtable; 382 session->pool = sesspool; 383 384 /* Ask the library to open the session. */ |
384 err = vtable->open_session(session, corrected_url_p, | 385 err = vtable->open_session(session, corrected_url_p, redirect_url_p, |
385 repos_URL, 386 callbacks, callback_baton, auth_baton, 387 config, sesspool, scratch_pool); 388 389 if (err) 390 { 391 svn_pool_destroy(sesspool); /* Includes scratch_pool */ 392 if (err->apr_err == SVN_ERR_RA_SESSION_URL_MISMATCH) --- 8 unchanged lines hidden (view full) --- 401 /* If the session open stuff detected a server-provided URL 402 correction (a 301 or 302 redirect response during the initial 403 OPTIONS request), then kill the session so the caller can decide 404 what to do. */ 405 if (corrected_url_p && *corrected_url_p) 406 { 407 /* *session_p = NULL; */ 408 *corrected_url_p = apr_pstrdup(pool, *corrected_url_p); | 386 repos_URL, 387 callbacks, callback_baton, auth_baton, 388 config, sesspool, scratch_pool); 389 390 if (err) 391 { 392 svn_pool_destroy(sesspool); /* Includes scratch_pool */ 393 if (err->apr_err == SVN_ERR_RA_SESSION_URL_MISMATCH) --- 8 unchanged lines hidden (view full) --- 402 /* If the session open stuff detected a server-provided URL 403 correction (a 301 or 302 redirect response during the initial 404 OPTIONS request), then kill the session so the caller can decide 405 what to do. */ 406 if (corrected_url_p && *corrected_url_p) 407 { 408 /* *session_p = NULL; */ 409 *corrected_url_p = apr_pstrdup(pool, *corrected_url_p); |
410 if (redirect_url_p && *redirect_url_p) 411 *redirect_url_p = apr_pstrdup(pool, *redirect_url_p); |
|
409 svn_pool_destroy(sesspool); /* Includes scratch_pool */ 410 return SVN_NO_ERROR; 411 } 412 | 412 svn_pool_destroy(sesspool); /* Includes scratch_pool */ 413 return SVN_NO_ERROR; 414 } 415 |
416 if (vtable->set_svn_ra_open) 417 SVN_ERR(vtable->set_svn_ra_open(session, svn_ra_open5)); 418 |
|
413 /* Check the UUID. */ 414 if (uuid) 415 { 416 const char *repository_uuid; 417 418 SVN_ERR(vtable->get_uuid(session, &repository_uuid, pool)); 419 if (strcmp(uuid, repository_uuid) != 0) 420 { --- 42 unchanged lines hidden (view full) --- 463 session->pool = result_pool; 464 465 SVN_ERR(old_session->vtable->dup_session(session, 466 old_session, 467 session_url, 468 result_pool, 469 scratch_pool)); 470 | 419 /* Check the UUID. */ 420 if (uuid) 421 { 422 const char *repository_uuid; 423 424 SVN_ERR(vtable->get_uuid(session, &repository_uuid, pool)); 425 if (strcmp(uuid, repository_uuid) != 0) 426 { --- 42 unchanged lines hidden (view full) --- 469 session->pool = result_pool; 470 471 SVN_ERR(old_session->vtable->dup_session(session, 472 old_session, 473 session_url, 474 result_pool, 475 scratch_pool)); 476 |
477 if (session->vtable->set_svn_ra_open) 478 SVN_ERR(session->vtable->set_svn_ra_open(session, svn_ra_open5)); 479 |
|
471 *new_session = session; 472 return SVN_NO_ERROR; 473} 474 475svn_error_t *svn_ra_reparent(svn_ra_session_t *session, 476 const char *url, 477 apr_pool_t *pool) 478{ --- 155 unchanged lines hidden (view full) --- 634 apr_uint32_t dirent_fields, 635 apr_pool_t *pool) 636{ 637 SVN_ERR_ASSERT(svn_relpath_is_canonical(path)); 638 return session->vtable->get_dir(session, dirents, fetched_rev, props, 639 path, revision, dirent_fields, pool); 640} 641 | 480 *new_session = session; 481 return SVN_NO_ERROR; 482} 483 484svn_error_t *svn_ra_reparent(svn_ra_session_t *session, 485 const char *url, 486 apr_pool_t *pool) 487{ --- 155 unchanged lines hidden (view full) --- 643 apr_uint32_t dirent_fields, 644 apr_pool_t *pool) 645{ 646 SVN_ERR_ASSERT(svn_relpath_is_canonical(path)); 647 return session->vtable->get_dir(session, dirents, fetched_rev, props, 648 path, revision, dirent_fields, pool); 649} 650 |
651svn_error_t * 652svn_ra_list(svn_ra_session_t *session, 653 const char *path, 654 svn_revnum_t revision, 655 const apr_array_header_t *patterns, 656 svn_depth_t depth, 657 apr_uint32_t dirent_fields, 658 svn_ra_dirent_receiver_t receiver, 659 void *receiver_baton, 660 apr_pool_t *scratch_pool) 661{ 662 SVN_ERR_ASSERT(svn_relpath_is_canonical(path)); 663 if (!session->vtable->list) 664 return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, NULL); 665 666 SVN_ERR(svn_ra__assert_capable_server(session, SVN_RA_CAPABILITY_LIST, 667 NULL, scratch_pool)); 668 669 return session->vtable->list(session, path, revision, patterns, depth, 670 dirent_fields, receiver, receiver_baton, 671 scratch_pool); 672} 673 |
|
642svn_error_t *svn_ra_get_mergeinfo(svn_ra_session_t *session, 643 svn_mergeinfo_catalog_t *catalog, 644 const apr_array_header_t *paths, 645 svn_revnum_t revision, 646 svn_mergeinfo_inheritance_t inherit, 647 svn_boolean_t include_descendants, 648 apr_pool_t *pool) 649{ --- 298 unchanged lines hidden (view full) --- 948 apr_hash_t **locations, 949 const char *path, 950 svn_revnum_t peg_revision, 951 const apr_array_header_t *location_revisions, 952 apr_pool_t *pool) 953{ 954 svn_error_t *err; 955 | 674svn_error_t *svn_ra_get_mergeinfo(svn_ra_session_t *session, 675 svn_mergeinfo_catalog_t *catalog, 676 const apr_array_header_t *paths, 677 svn_revnum_t revision, 678 svn_mergeinfo_inheritance_t inherit, 679 svn_boolean_t include_descendants, 680 apr_pool_t *pool) 681{ --- 298 unchanged lines hidden (view full) --- 980 apr_hash_t **locations, 981 const char *path, 982 svn_revnum_t peg_revision, 983 const apr_array_header_t *location_revisions, 984 apr_pool_t *pool) 985{ 986 svn_error_t *err; 987 |
988 SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(peg_revision)); |
|
956 SVN_ERR_ASSERT(svn_relpath_is_canonical(path)); 957 err = session->vtable->get_locations(session, locations, path, 958 peg_revision, location_revisions, pool); 959 if (err && (err->apr_err == SVN_ERR_RA_NOT_IMPLEMENTED)) 960 { 961 svn_error_clear(err); 962 963 /* Do it the slow way, using get-logs, for older servers. */ --- 151 unchanged lines hidden (view full) --- 1115svn_error_t *svn_ra_replay(svn_ra_session_t *session, 1116 svn_revnum_t revision, 1117 svn_revnum_t low_water_mark, 1118 svn_boolean_t text_deltas, 1119 const svn_delta_editor_t *editor, 1120 void *edit_baton, 1121 apr_pool_t *pool) 1122{ | 989 SVN_ERR_ASSERT(svn_relpath_is_canonical(path)); 990 err = session->vtable->get_locations(session, locations, path, 991 peg_revision, location_revisions, pool); 992 if (err && (err->apr_err == SVN_ERR_RA_NOT_IMPLEMENTED)) 993 { 994 svn_error_clear(err); 995 996 /* Do it the slow way, using get-logs, for older servers. */ --- 151 unchanged lines hidden (view full) --- 1148svn_error_t *svn_ra_replay(svn_ra_session_t *session, 1149 svn_revnum_t revision, 1150 svn_revnum_t low_water_mark, 1151 svn_boolean_t text_deltas, 1152 const svn_delta_editor_t *editor, 1153 void *edit_baton, 1154 apr_pool_t *pool) 1155{ |
1156 SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision) 1157 && SVN_IS_VALID_REVNUM(low_water_mark)); |
|
1123 return session->vtable->replay(session, revision, low_water_mark, 1124 text_deltas, editor, edit_baton, pool); 1125} 1126 1127svn_error_t * 1128svn_ra__replay_ev2(svn_ra_session_t *session, 1129 svn_revnum_t revision, 1130 svn_revnum_t low_water_mark, --- 51 unchanged lines hidden (view full) --- 1182 svn_revnum_t end_revision, 1183 svn_revnum_t low_water_mark, 1184 svn_boolean_t text_deltas, 1185 svn_ra_replay_revstart_callback_t revstart_func, 1186 svn_ra_replay_revfinish_callback_t revfinish_func, 1187 void *replay_baton, 1188 apr_pool_t *pool) 1189{ | 1158 return session->vtable->replay(session, revision, low_water_mark, 1159 text_deltas, editor, edit_baton, pool); 1160} 1161 1162svn_error_t * 1163svn_ra__replay_ev2(svn_ra_session_t *session, 1164 svn_revnum_t revision, 1165 svn_revnum_t low_water_mark, --- 51 unchanged lines hidden (view full) --- 1217 svn_revnum_t end_revision, 1218 svn_revnum_t low_water_mark, 1219 svn_boolean_t text_deltas, 1220 svn_ra_replay_revstart_callback_t revstart_func, 1221 svn_ra_replay_revfinish_callback_t revfinish_func, 1222 void *replay_baton, 1223 apr_pool_t *pool) 1224{ |
1190 svn_error_t *err = | 1225 svn_error_t *err; 1226 1227 SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(start_revision) 1228 && SVN_IS_VALID_REVNUM(end_revision) 1229 && start_revision <= end_revision 1230 && SVN_IS_VALID_REVNUM(low_water_mark)); 1231 1232 err = |
1191 session->vtable->replay_range(session, start_revision, end_revision, 1192 low_water_mark, text_deltas, 1193 revstart_func, revfinish_func, 1194 replay_baton, pool); 1195 1196 if (!err || (err && (err->apr_err != SVN_ERR_RA_NOT_IMPLEMENTED))) 1197 return svn_error_trace(err); 1198 --- 314 unchanged lines hidden (view full) --- 1513 return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL, 1514 _("Unrecognized URL scheme '%s'"), url); 1515} 1516 1517/* For each libsvn_ra_foo library that is not linked in, provide a default 1518 implementation for svn_ra_foo_init which returns a "not implemented" 1519 error. */ 1520 | 1233 session->vtable->replay_range(session, start_revision, end_revision, 1234 low_water_mark, text_deltas, 1235 revstart_func, revfinish_func, 1236 replay_baton, pool); 1237 1238 if (!err || (err && (err->apr_err != SVN_ERR_RA_NOT_IMPLEMENTED))) 1239 return svn_error_trace(err); 1240 --- 314 unchanged lines hidden (view full) --- 1555 return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL, 1556 _("Unrecognized URL scheme '%s'"), url); 1557} 1558 1559/* For each libsvn_ra_foo library that is not linked in, provide a default 1560 implementation for svn_ra_foo_init which returns a "not implemented" 1561 error. */ 1562 |
1521#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_NEON | 1563#ifndef SVN_LIBSVN_RA_LINKS_RA_NEON |
1522svn_error_t * 1523svn_ra_dav_init(int abi_version, 1524 apr_pool_t *pool, 1525 apr_hash_t *hash) 1526{ 1527 return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); 1528} | 1564svn_error_t * 1565svn_ra_dav_init(int abi_version, 1566 apr_pool_t *pool, 1567 apr_hash_t *hash) 1568{ 1569 return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); 1570} |
1529#endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_NEON */ | 1571#endif /* ! SVN_LIBSVN_RA_LINKS_RA_NEON */ |
1530 | 1572 |
1531#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_SVN | 1573#ifndef SVN_LIBSVN_RA_LINKS_RA_SVN |
1532svn_error_t * 1533svn_ra_svn_init(int abi_version, 1534 apr_pool_t *pool, 1535 apr_hash_t *hash) 1536{ 1537 return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); 1538} | 1574svn_error_t * 1575svn_ra_svn_init(int abi_version, 1576 apr_pool_t *pool, 1577 apr_hash_t *hash) 1578{ 1579 return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); 1580} |
1539#endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_SVN */ | 1581#endif /* ! SVN_LIBSVN_RA_LINKS_RA_SVN */ |
1540 | 1582 |
1541#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL | 1583#ifndef SVN_LIBSVN_RA_LINKS_RA_LOCAL |
1542svn_error_t * 1543svn_ra_local_init(int abi_version, 1544 apr_pool_t *pool, 1545 apr_hash_t *hash) 1546{ 1547 return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); 1548} | 1584svn_error_t * 1585svn_ra_local_init(int abi_version, 1586 apr_pool_t *pool, 1587 apr_hash_t *hash) 1588{ 1589 return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); 1590} |
1549#endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL */ | 1591#endif /* ! SVN_LIBSVN_RA_LINKS_RA_LOCAL */ |
1550 | 1592 |
1551#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_SERF | 1593#ifndef SVN_LIBSVN_RA_LINKS_RA_SERF |
1552svn_error_t * 1553svn_ra_serf_init(int abi_version, 1554 apr_pool_t *pool, 1555 apr_hash_t *hash) 1556{ 1557 return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); 1558} | 1594svn_error_t * 1595svn_ra_serf_init(int abi_version, 1596 apr_pool_t *pool, 1597 apr_hash_t *hash) 1598{ 1599 return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); 1600} |
1559#endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_SERF */ | 1601#endif /* ! SVN_LIBSVN_RA_LINKS_RA_SERF */ |