diff --git a/NEWS b/NEWS index 0a8d4e506b8018f41eded7133b0ba98a560c150d..5190d689955be11e8f11db65a61810a3801b2f27 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,9 @@ documents those changes that are of interest to users and admins. slurm.conf pathname) -- Remove slurmd "-f" -- Several documenation changes for slurm administrators + -- Convert shared object plugins to use only functions with prefix + of "slurm_" to avoid linking conflicts with applications using + SLURM library * Changes in SLURM 0.3.0.0-pre9 =============================== diff --git a/src/api/job_info.h b/src/api/job_info.h index 79d50b237ab52a78a37a5357adba81affac163a6..32c85f483c0be35baa015f7d1bf563e55f7ee2fc 100644 --- a/src/api/job_info.h +++ b/src/api/job_info.h @@ -28,7 +28,7 @@ #define _JOB_INFO_H /* - * make_time_str - convert time_t to string with "month/date hour:min:sec" + * slurm_make_time_str - convert time_t to string "month/date hour:min:sec" * IN time - a time stamp * OUT string - pointer user defined buffer */ diff --git a/src/common/arg_desc.c b/src/common/arg_desc.c index 566ae5282542d0f2542a8ff56a4e478dd766e027..16dea709db5f6634ede183de1ceb6153dd6ddf18 100644 --- a/src/common/arg_desc.c +++ b/src/common/arg_desc.c @@ -1,7 +1,16 @@ #include <string.h> #include "src/common/arg_desc.h" +#include "src/common/macros.h" #include "src/common/xassert.h" +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(arg_count, slurm_arg_count); +strong_alias(arg_idx_by_name, slurm_arg_idx_by_name); +strong_alias(arg_name_by_idx, slurm_arg_name_by_idx); + const int arg_count( const arg_desc_t *desc ) { diff --git a/src/common/bitstring.c b/src/common/bitstring.c index b6bb7af4261b195cbec0651fa8c94f10966416c9..4869ff4b1219b1e250722b759885a50d714729a8 100644 --- a/src/common/bitstring.c +++ b/src/common/bitstring.c @@ -33,8 +33,37 @@ #include <string.h> #include "src/common/bitstring.h" +#include "src/common/macros.h" #include "src/common/xmalloc.h" +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(bit_alloc, slurm_bit_alloc); +strong_alias(bit_test, slurm_bit_test); +strong_alias(bit_set, slurm_bit_set); +strong_alias(bit_clear, slurm_bit_clear); +strong_alias(bit_nclear, slurm_bit_nclear); +strong_alias(bit_nset, slurm_bit_nset); +strong_alias(bit_ffc, slurm_bit_ffc); +strong_alias(bit_ffs, slurm_bit_ffs); +strong_alias(bit_free, slurm_bit_free); +strong_alias(bit_realloc, slurm_bit_realloc); +strong_alias(bit_size, slurm_bit_size); +strong_alias(bit_and, slurm_bit_and); +strong_alias(bit_not, slurm_bit_not); +strong_alias(bit_or, slurm_bit_or); +strong_alias(bit_set_count, slurm_bit_set_count); +strong_alias(bit_clear_count, slurm_bit_clear_count); +strong_alias(bit_fmt, slurm_bit_fmt); +strong_alias(bit_fls, slurm_bit_fls); +strong_alias(bit_fill_gaps, slurm_bit_fill_gaps); +strong_alias(bit_super_set, slurm_bit_super_set); +strong_alias(bit_copy, slurm_bit_copy); +strong_alias(bit_pick_cnt, slurm_bit_pick_cnt); +strong_alias(bitfmt2int, slurm_bitfmt2int); + /* * Allocate a bitstring. * nbits (IN) valid bits in new bitstring, initialized to all clear diff --git a/src/common/hostlist.c b/src/common/hostlist.c index 230f85eee7bc1d2a7e02aee49a6f241dece09713..af897a9399283ff41db27f3995c134d6b9ec7976 100644 --- a/src/common/hostlist.c +++ b/src/common/hostlist.c @@ -48,7 +48,48 @@ #include <sys/param.h> #include <unistd.h> -#include "hostlist.h" +#include "src/common/hostlist.h" +#include "src/common/macros.h" + +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(hostlist_create, slurm_hostlist_create); +strong_alias(hostlist_copy, slurm_hostlist_copy); +strong_alias(hostlist_count, slurm_hostlist_count); +strong_alias(hostlist_delete, slurm_hostlist_delete); +strong_alias(hostlist_delete_host, slurm_hostlist_delete_host); +strong_alias(hostlist_delete_nth, slurm_hostlist_delete_nth); +strong_alias(hostlist_deranged_string, slurm_hostlist_deranged_string); +strong_alias(hostlist_destroy, slurm_hostlist_destroy); +strong_alias(hostlist_find, slurm_hostlist_find); +strong_alias(hostlist_iterator_create, slurm_hostlist_iterator_create); +strong_alias(hostlist_iterator_destroy, slurm_hostlist_iterator_destroy); +strong_alias(hostlist_iterator_reset, slurm_hostlist_iterator_reset); +strong_alias(hostlist_next, slurm_hostlist_next); +strong_alias(hostlist_next_range, slurm_hostlist_next_range); +strong_alias(hostlist_nth, slurm_hostlist_nth); +strong_alias(hostlist_pop, slurm_hostlist_pop); +strong_alias(hostlist_pop_range, slurm_hostlist_pop_range); +strong_alias(hostlist_push, slurm_hostlist_push); +strong_alias(hostlist_push_host, slurm_hostlist_push_host); +strong_alias(hostlist_push_list, slurm_hostlist_push_list); +strong_alias(hostlist_ranged_string, slurm_hostlist_ranged_string); +strong_alias(hostlist_remove, slurm_hostlist_remove); +strong_alias(hostlist_shift, slurm_hostlist_shift); +strong_alias(hostlist_shift_range, slurm_hostlist_shift_range); +strong_alias(hostlist_sort, slurm_hostlist_soft); +strong_alias(hostlist_uniq, slurm_hostlist_uniq); +strong_alias(hostset_copy, slurm_hostset_copy); +strong_alias(hostset_count, slurm_hostset_count); +strong_alias(hostset_create, slurm_hostset_create); +strong_alias(hostset_delete, slurm_hostset_delete); +strong_alias(hostset_destroy, slurm_hostset_destroy); +strong_alias(hostset_insert, slurm_hostset_insert); +strong_alias(hostset_shift, slurm_hostset_shift); +strong_alias(hostset_shift_range, slurm_hostset_shift_range); +strong_alias(hostset_within, slurm_hostset_within); /* * lsd_fatal_error : fatal error macro @@ -214,7 +255,8 @@ static int hostname_suffix_width(hostname_t); static hostrange_t hostrange_new(void); static hostrange_t hostrange_create_single(const char *); -static hostrange_t hostrange_create(char *, unsigned long, unsigned long, int); +static hostrange_t hostrange_create(char *, unsigned long, unsigned long, +int); static unsigned long hostrange_count(hostrange_t); static hostrange_t hostrange_copy(hostrange_t); static void hostrange_destroy(hostrange_t); @@ -229,7 +271,8 @@ static char * hostrange_shift(hostrange_t); static int hostrange_join(hostrange_t, hostrange_t); static hostrange_t hostrange_intersect(hostrange_t, hostrange_t); static int hostrange_hn_within(hostrange_t, hostname_t); -static size_t hostrange_to_string(hostrange_t hr, size_t, char *, char *); +static size_t hostrange_to_string(hostrange_t hr, size_t, char *, char +*); static size_t hostrange_numstr(hostrange_t, size_t, char *); static hostlist_t hostlist_new(void); diff --git a/src/common/list.c b/src/common/list.c index 339fd358182145b781970c671f65ded95011f2bd..2d05a6b61597b5cc3c0ed5dc7d007b3eede63807 100644 --- a/src/common/list.c +++ b/src/common/list.c @@ -40,8 +40,36 @@ #include <stdlib.h> #include <string.h> #include "list.h" +#include "macros.h" - +/* +** Define slurm-specific aliases for use by plugins, see slurm_xlator.h +** for details. + */ +strong_alias(list_create, slurm_list_create); +strong_alias(list_destroy, slurm_list_destroy); +strong_alias(list_is_empty, slurm_list_is_empty); +strong_alias(list_count, slurm_list_count); +strong_alias(list_append, slurm_list_append); +strong_alias(list_prepend, slurm_list_prepend); +strong_alias(list_find_first, slurm_list_find_first); +strong_alias(list_delete_all, slurm_list_delete_all); +strong_alias(list_for_each, slurm_list_for_each); +strong_alias(list_sort, slurm_list_sort); +strong_alias(list_push, slurm_list_push); +strong_alias(list_pop, slurm_list_pop); +strong_alias(list_peek, slurm_list_peek); +strong_alias(list_enqueue, slurm_list_enqueue); +strong_alias(list_dequeue, slurm_list_dequeue); +strong_alias(list_iterator_create, slurm_list_iterator_create); +strong_alias(list_iterator_reset, slurm_list_iterator_reset); +strong_alias(list_iterator_destroy, slurm_list_iterator_destroy); +strong_alias(list_next, slurm_list_next); +strong_alias(list_insert, slurm_list_insert); +strong_alias(list_find, slurm_list_find); +strong_alias(list_remove, slurm_list_remove); +strong_alias(list_delete, slurm_list_delete); +strong_alias(list_install_fork_handlers, slurm_list_install_fork_handlers); /********************* * lsd_fatal_error * *********************/ diff --git a/src/common/log.c b/src/common/log.c index 3c66406fb673b35b2c3f718e9ffbb74bc3a4d454..8f5a18a44b2f3991991f8b9438f98202985367d5 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -83,6 +83,32 @@ # define LINEBUFSIZE 256 #endif +/* +** Define slurm-specific aliases for use by plugins, see slurm_xlator.h +** for details. + */ +strong_alias(log_init, slurm_log_init); +strong_alias(log_reinit, slurm_log_reinit); +strong_alias(log_fini, slurm_log_fini); +strong_alias(log_alter, slurm_log_alter); +strong_alias(log_set_fpfx, slurm_log_set_fpfx); +strong_alias(log_fp, slurm_log_fp); +strong_alias(log_has_data, slurm_log_has_data); +strong_alias(log_flush, slurm_log_flush); +strong_alias(dump_cleanup_list, slurm_dump_cleanup_list); +strong_alias(fatal_add_cleanup, slurm_fatal_add_cleanup); +strong_alias(fatal_add_cleanup_job, slurm_fatal_add_cleanup_job); +strong_alias(fatal_remove_cleanup, slurm_fatal_remove_cleanup); +strong_alias(fatal_remove_cleanup_job, slurm_fatal_remove_cleanup_job); +strong_alias(fatal_cleanup, slurm_fatal_cleanup); +strong_alias(fatal, slurm_fatal); +strong_alias(error, slurm_error); +strong_alias(info, slurm_info); +strong_alias(verbose, slurm_verbose); +strong_alias(debug, slurm_debug); +strong_alias(debug2, slurm_debug2); +strong_alias(debug3, slurm_debug3); + /* ** struct defining a "log" type */ diff --git a/src/common/macros.h b/src/common/macros.h index 92e58a7e51da49ef02f5142da45f8d8415e64d42..45c18c9c50400cafc500ae12b3b2af46c2a3e9b2 100644 --- a/src/common/macros.h +++ b/src/common/macros.h @@ -201,4 +201,8 @@ typedef enum {false, true} bool; #endif /* WITH_PTHREADS */ +#ifndef strong_alias +# define strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute ((alias (#name))) +#endif #endif /* !_MACROS_H */ diff --git a/src/common/pack.c b/src/common/pack.c index 2e445064bc084d1faa85bea0d42b4320db2b2581..00ee7d42928770e28e92e900fcc284e11ba1c44d 100644 --- a/src/common/pack.c +++ b/src/common/pack.c @@ -45,6 +45,33 @@ #define BUF_SIZE 4096 +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(create_buf, slurm_create_buf); +strong_alias(free_buf, slurm_free_buf); +strong_alias(init_buf, slurm_init_buf); +strong_alias(xfer_buf_data, slurm_xfer_buf_data); +strong_alias(pack_time, slurm_pack_time); +strong_alias(unpack_time, slurm_unpack_time); +strong_alias(pack32, slurm_pack32); +strong_alias(unpack32, slurm_unpack32); +strong_alias(pack16, slurm_pack16); +strong_alias(unpack16, slurm_unpack16); +strong_alias(pack8, slurm_pack8); +strong_alias(unpack8, slurm_unpack8); +strong_alias(pack32_array, slurm_pack32_array); +strong_alias(unpack32_array, slurm_unpack32_array); +strong_alias(packmem, slurm_packmem); +strong_alias(unpackmem, slurm_unpackmem); +strong_alias(unpackmem_ptr, slurm_unpackmem_ptr); +strong_alias(unpackmem_xmalloc, slurm_unpackmem_xmalloc); +strong_alias(unpackmem_malloc, slurm_unpackmem_malloc); +strong_alias(packstr_array, slurm_packstr_array); +strong_alias(unpackstr_array, slurm_unpackstr_array); +strong_alias(packmem_array, slurm_packmem_array); +strong_alias(unpackmem_array, slurm_unpackmem_array); /* Basic buffer management routines */ /* create_buf - create a buffer with the supplied contents, contents must diff --git a/src/common/setenvpf.c b/src/common/setenvpf.c index ccbea5672a3433ed5e8cceedc9b6f7ba4cdfd02b..2392036437550a542ad4467de4c2c7488bada04a 100644 --- a/src/common/setenvpf.c +++ b/src/common/setenvpf.c @@ -33,11 +33,20 @@ #include <stdarg.h> #include <string.h> -#include "src/common/xmalloc.h" #include "src/common/log.h" +#include "src/common/macros.h" +#include "src/common/setenvpf.h" #include "src/common/xassert.h" +#include "src/common/xmalloc.h" #include "src/common/xstring.h" +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(setenvpf, slurm_setenvpf); +strong_alias(unsetenvp, slurm_unsetenvp); +strong_alias(getenvp, slurm_getenvp); /* * Return pointer to `name' entry in environment if found, or diff --git a/src/common/setenvpf.h b/src/common/setenvpf.h index 8a9060a30c3c35e17d164674fb5eccfae34c15af..b7a99e865783f3e9d2dcc91af047cbc3e4a1ef46 100644 --- a/src/common/setenvpf.h +++ b/src/common/setenvpf.h @@ -26,8 +26,8 @@ #ifndef _SETENVPF_H #define _SETENVPF_H -int setenvpf(char ***envp, const char *name, const char *fmt, ...); -int unsetenvp(char **env, const char *name); -char * getenvp(char **env, const char *name); +int setenvpf(char ***envp, const char *name, const char *fmt, ...); +void unsetenvp(char **env, const char *name); +char * getenvp(char **env, const char *name); #endif diff --git a/src/common/slurm_xlator.h b/src/common/slurm_xlator.h index 7705ace3f2811ed5ddf5f212864100a4755b9164..e676cd772c846ed40e9dfd43d9f9172a90e79fde 100644 --- a/src/common/slurm_xlator.h +++ b/src/common/slurm_xlator.h @@ -9,19 +9,21 @@ * should be avoided. * * All SLURM functions referenced from the switch and auth plugins should - * be aliased here. + * have aliases established. Functions not referenced from the plugins + * need not be aliased. * * To use this header file: - * 1. Add the strong_alias functions for the functions being exported - * 2. Include the header file defining the functions (needed before - * strong_alias is executed) - * 3. In the header file defining the functions, include - * "src/common/slurm_xlator.h" _before_ any "#ifndef" test. This insures - * that strong_alias() is always executed after the functions are defined. - * 4. If the module containing the relevant function does not include its - * matching header (e.g. "log.c" does not include "log.h") then explicitly - * include "src/common/slurm_xlator.h" - * Note: Items 3 and 4 result in minimal changes to existing modules + * 1. In the module containing the exported function code, establish an + * alias for each of the functions after they are defined. + * #include "src/common/macros.h" + * strong_alias(<name>, slurm_<name>); + * 2. For each function, change it's name then include the appropriate + * header file with definitions. + * #define <name> slurm_<name> + * 3. In the plugin modules using the functions, include this header file + * and remove other slurm header files (they should all be in this header). + * This logic will have the plugin link only to the function names with + * the "slurm_" prefix. ***************************************************************************** * Copyright (C) 2004 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). @@ -49,22 +51,230 @@ #ifndef __SLURM_XLATOR_H__ #define __SLURM_XLATOR_H__ -#include "src/common/log.h" +/* arg_desc.[ch] functions*/ +#define arg_count slurm_arg_count +#define arg_idx_by_name slurm_arg_idx_by_name +#define arg_name_by_inx slurm_arg_name_by_inx + +/* bitstring.[ch] functions*/ +#define bit_alloc slurm_bit_alloc +#define bit_test slurm_bit_test +#define bit_set slurm_bit_set +#define bit_clear slurm_bit_clear +#define bit_nclear slurm_bit_nclear +#define bit_nset slurm_bit_nset +#define bit_ffc slurm_bit_ffc +#define bit_ffs slurm_bit_ffs +#define bit_free slurm_bit_free +#define bit_realloc slurm_bit_realloc +#define bit_size slurm_bit_size +#define bit_and slurm_bit_and +#define bit_not slurm_bit_not +#define bit_or slurm_bit_or +#define bit_set_count slurm_bit_set_count +#define bit_clear_count slurm_bit_clear_count +#define bit_fmt slurm_bit_fmt +#define bit_fls slurm_bit_fls +#define bit_fill_gaps slurm_bit_fill_gaps +#define bit_super_set slurm_bit_super_set +#define bit_copy slurm_bit_copy +#define bit_pick_cnt slurm_bit_pick_cnt +#define bitfmt2int slurm_bitfmt2int -#define strong_alias(name, aliasname) \ -extern __typeof (name) aliasname __attribute ((alias (#name))) +/* hostlist.[ch] functions */ +#define hostlist_create slurm_hostlist_create +#define hostlist_copy slurm_hostlist_copy +#define hostlist_count slurm_hostlist_count +#define hostlist_delete slurm_hostlist_delete +#define hostlist_delete_host slurm_hostlist_delete_host +#define hostlist_delete_nth slurm_hostlist_delete_nth +#define hostlist_deranged_string slurm_hostlist_deranged_string +#define hostlist_destroy slurm_hostlist_destroy +#define hostlist_find slurm_hostlist_find +#define hostlist_iterator_create slurm_hostlist_iterator_create +#define hostlist_iterator_destroy slurm_hostlist_iterator_destroy +#define hostlist_iterator_reset slurm_hostlist_iterator_reset +#define hostlist_next slurm_hostlist_next +#define hostlist_next_range slurm_hostlist_next_range +#define hostlist_nth slurm_hostlist_nth +#define hostlist_pop slurm_hostlist_pop +#define hostlist_pop_range slurm_hostlist_pop_range +#define hostlist_push slurm_hostlist_push +#define hostlist_push_host slurm_hostlist_push_host +#define hostlist_push_list slurm_hostlist_push_list +#define hostlist_ranged_string slurm_hostlist_ranged_string +#define hostlist_remove slurm_hostlist_remove +#define hostlist_shift slurm_hostlist_shift +#define hostlist_shift_range slurm_hostlist_shift_range +#define hostlist_sort slurm_hostlist_soft +#define hostlist_uniq slurm_hostlist_uniq +#define hostset_copy slurm_hostset_copy +#define hostset_count slurm_hostset_count +#define hostset_create slurm_hostset_create +#define hostset_delete slurm_hostset_delete +#define hostset_destroy slurm_hostset_destroy +#define hostset_insert slurm_hostset_insert +#define hostset_shift slurm_hostset_shift +#define hostset_shift_range slurm_hostset_shift_range +#define hostset_within slurm_hostset_within -/* - * rename all functions via gcc alias - */ +/* list.[ch] functions */ +#define list_create slurm_list_create +#define list_destroy slurm_list_destroy +#define list_is_empty slurm_list_is_empty +#define list_count slurm_list_count +#define list_append slurm_list_append +#define list_prepend slurm_list_prepend +#define list_find_first slurm_list_find_first +#define list_delete_all slurm_list_delete_all +#define list_for_each slurm_list_for_each +#define list_sort slurm_list_sort +#define list_push slurm_list_push +#define list_pop slurm_list_pop +#define list_peek slurm_list_peek +#define list_enqueue slurm_list_enqueue +#define list_dequeue slurm_list_dequeue +#define list_iterator_create slurm_list_iterator_create +#define list_iterator_reset slurm_list_iterator_reset +#define list_iterator_destroy slurm_list_iterator_destroy +#define list_next slurm_list_next +#define list_insert slurm_list_insert +#define list_find slurm_list_find +#define list_remove slurm_list_remove +#define list_delete slurm_list_delete +#define list_install_fork_handlers slurm_list_install_fork_handlers /* log.[ch] functions */ -strong_alias(fatal, slurm_fatal); -strong_alias(error, slurm_error); -strong_alias(info, slurm_info); -strong_alias(verbose, slurm_verbose); -strong_alias(debug, slurm_debug); -strong_alias(debug2, slurm_debug2); -strong_alias(debug3, slurm_debug3); +#define log_init slurm_log_init +#define log_reinit slurm_log_reinit +#define log_fini slurm_log_fini +#define log_alter slurm_log_alter +#define log_set_fpfx slurm_log_set_fpfx +#define log_fp slurm_log_fp +#define log_has_data slurm_log_has_data +#define log_flush slurm_log_flush +#define dump_cleanup_list slurm_dump_cleanup_list +#define fatal_add_cleanup slurm_fatal_add_cleanup +#define fatal_add_cleanup_job slurm_fatal_add_cleanup_job +#define fatal_remove_cleanup slurm_fatal_remove_cleanup +#define fatal_remove_cleanup_job slurm_fatal_remove_cleanup_job +#define fatal_cleanup slurm_fatal_cleanup +#define fatal slurm_fatal +#define error slurm_error +#define info slurm_info +#define verbose slurm_verbose +#define debug slurm_debug +#define debug2 slurm_debug2 +#define debug3 slurm_debug3 + +/* macros.h functions + * None exported today. + * The header file used only for #define values. */ + +/* pack.[ch] functions */ +#define create_buf slurm_create_buf +#define free_buf slurm_free_buf +#define init_buf slurm_init_buf +#define xfer_buf_data slurm_xfer_buf_data +#define pack_time slurm_pack_time +#define unpack_time slurm_unpack_time +#define pack32 slurm_pack32 +#define unpack32 slurm_unpack32 +#define pack16 slurm_pack16 +#define unpack16 slurm_unpack16 +#define pack8 slurm_pack8 +#define unpack8 slurm_unpack8 +#define pack32_array slurm_pack32_array +#define unpack32_array slurm_unpack32_array +#define packmem slurm_packmem +#define unpackmem slurm_unpackmem +#define unpackmem_ptr slurm_unpackmem_ptr +#define unpackmem_xmalloc slurm_unpackmem_xmalloc +#define unpackmem_malloc slurm_unpackmem_malloc +#define packstr_array slurm_packstr_array +#define unpackstr_array slurm_unpackstr_array +#define packmem_array slurm_packmem_array +#define unpackmem_array slurm_unpackmem_array + +/* setenvpf.[ch] functions */ +#define setenvpf slurm_setenvpf +#define unsetenvp slurm_unsetenvp +#define getenvp slurm_getenvp + +/* slurm_auth.[ch] functions + * None exported today. + * The header file used only for #define values. */ + +/* strlcpy.[ch] functions */ +#define strlcpy slurm_strlcpy + +/* switch.[ch] functions */ +#define switch_init slurm_switch_init +#define switch_save slurm_switch_save +#define switch_restore slurm_switch_restore +#define switch_no_frag slurm_switch_no_frag +#define switch_get_errno slurm_switch_get_errno +#define switch_strerror slurm_switch_strerror +#define switch_alloc_jobinfo slurm_switch_alloc_jobinfo +#define switch_build_jobinfo slurm_switch_build_jobinfo +#define switch_copy_jobinfo slurm_switch_copy_jobinfo +#define switch_free_jobinfo slurm_switch_free_jobinfo +#define switch_pack_jobinfo slurm_switch_pack_jobinfo +#define switch_unpack_jobinfo slurm_switch_unpack_jobinfo +#define switch_print_jobinfo slurm_switch_print_jobinfo +#define switch_sprint_jobinfo slurm_switch_sprint_jobinfo +#define interconnect_node_init slurm_interconnect_node_init +#define interconnect_node_fini slurm_interconnect_node_fini +#define interconnect_preinit slurm_interconnect_preinit +#define interconnect_init slurm_interconnect_init +#define interconnect_fini slurm_interconnect_fini +#define interconnect_postfini slurm_interconnect_postfini +#define interconnect_attach slurm_interconnect_attach + +/* xassert.[ch] functions */ +#define __xassert_failed slurm_xassert_failed + +/* xmalloc.[ch] functions */ +#define _xmalloc slurm_xmalloc +#define _try_xmalloc slurm_try_xmalloc +#define _xfree slurm_xfree +#define _xrealloc slurm_xrealloc +#define _try_xrealloc slurm_try_xrealloc +#define _xsize slurm_xsize + +/* xsignal.[ch] functions */ +#define xsignal slurm_xsignal +#define xsignal_save_mask slurm_xsignal_save_mask +#define xsignal_set_mask slurm_xsignal_set_mask +#define xsignal_block slurm_xsignal_block +#define xsignal_unblock slurm_xsignal_unblock +#define xsignal_sigset_create slurm_xsignal_sigset_create + +/* xstring.[ch] functions */ +#define _xstrcat slurm_xstrcat +#define _xstrcatchar slurm_xstrcatchar +#define _xslurm_strerrorcat slurm_xslurm_strerrorcat +#define _xstrftimecat slurm_xstrftimecat +#define _xstrfmtcat slurm_xstrfmtcat +#define _xmemcat slurm_xmemcat +#define xstrdup slurm_xstrdup +#define xbasename slurm_xbasename + +/* Include the function definitions after redefining their names. */ +#include "src/common/arg_desc.h" +#include "src/common/bitstring.h" +#include "src/common/hostlist.h" +#include "src/common/list.h" +#include "src/common/log.h" +#include "src/common/macros.h" +#include "src/common/pack.h" +#include "src/common/setenvpf.h" +#include "src/common/slurm_auth.h" +#include "src/common/strlcpy.h" +#include "src/common/switch.h" +#include "src/common/xassert.h" +#include "src/common/xmalloc.h" +#include "src/common/xsignal.h" +#include "src/common/xstring.h" #endif /*__SLURM_XLATOR_H__*/ diff --git a/src/common/strlcpy.c b/src/common/strlcpy.c index 5f586964b7622191775316b552dcf93933ae195f..374d851501b71f8888aec454d294209b19d1a8fd 100644 --- a/src/common/strlcpy.c +++ b/src/common/strlcpy.c @@ -28,12 +28,22 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $"; +static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp +$"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> #include <string.h> +#include "src/common/macros.h" +#include "src/common/strlcpy.h" + +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(strlcpy, slurm_strlcpy); + /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). diff --git a/src/common/switch.c b/src/common/switch.c index b10a92abe9d31c041ea5c84a8fd9c626ae94d8ec..7c9c3217e089096e5c170e164a07304ec858baac 100644 --- a/src/common/switch.c +++ b/src/common/switch.c @@ -37,6 +37,32 @@ #include "src/common/xmalloc.h" #include "src/common/xstring.h" +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(switch_init, slurm_switch_init); +strong_alias(switch_save, slurm_switch_save); +strong_alias(switch_restore, slurm_switch_restore); +strong_alias(switch_no_frag, slurm_switch_no_frag); +strong_alias(switch_get_errno, slurm_switch_get_errno); +strong_alias(switch_strerror, slurm_switch_strerror); +strong_alias(switch_alloc_jobinfo, slurm_switch_alloc_jobinfo); +strong_alias(switch_build_jobinfo, slurm_switch_build_jobinfo); +strong_alias(switch_copy_jobinfo, slurm_switch_copy_jobinfo); +strong_alias(switch_free_jobinfo, slurm_switch_free_jobinfo); +strong_alias(switch_pack_jobinfo, slurm_switch_pack_jobinfo); +strong_alias(switch_unpack_jobinfo, slurm_switch_unpack_jobinfo); +strong_alias(switch_print_jobinfo, slurm_switch_print_jobinfo); +strong_alias(switch_sprint_jobinfo, slurm_switch_sprint_jobinfo); +strong_alias(interconnect_node_init, slurm_interconnect_node_init); +strong_alias(interconnect_node_fini, slurm_interconnect_node_fini); +strong_alias(interconnect_preinit, slurm_interconnect_preinit); +strong_alias(interconnect_init, slurm_interconnect_init); +strong_alias(interconnect_fini, slurm_interconnect_fini); +strong_alias(interconnect_postfini, slurm_interconnect_postfini); +strong_alias(interconnect_attach, slurm_interconnect_attach); + /* * WARNING: Do not change the order of these fields or add additional * fields at the beginning of the structure. If you do, job completion diff --git a/src/common/xassert.c b/src/common/xassert.c index 208eac84df6f5913469df0ace6dad98b8fabc8c7..9211dd14a0679278cc48e2ad4aacdd2d93af5639 100644 --- a/src/common/xassert.c +++ b/src/common/xassert.c @@ -13,6 +13,14 @@ #include <stdio.h> #include "src/common/log.h" +#include "src/common/macros.h" + +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +void __xassert_failed(char *expr, const char *file, int line, char *func); +strong_alias(__xassert_failed, slurm_xassert_failed); void __xassert_failed(char *expr, const char *file, int line, char *func) { diff --git a/src/common/xmalloc.c b/src/common/xmalloc.c index bc15faf7168885a0fc3d551d480de29235c9191e..e0ed0f1caf431b3d2fac8c3c9c375c927e1eb6c2 100644 --- a/src/common/xmalloc.c +++ b/src/common/xmalloc.c @@ -40,6 +40,18 @@ #include "src/common/xmalloc.h" #include "src/common/log.h" +#include "src/common/macros.h" + +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(_xmalloc, slurm_xmalloc); +strong_alias(_try_xmalloc, slurm_try_xmalloc); +strong_alias(_xfree, slurm_xfree); +strong_alias(_xrealloc, slurm_xrealloc); +strong_alias(_try_xrealloc, slurm_try_xrealloc); +strong_alias(_xsize, slurm_xsize); #if HAVE_UNSAFE_MALLOC # include <pthread.h> diff --git a/src/common/xsignal.c b/src/common/xsignal.c index 8eb09aa21e3223321f1e291bd1a640ca54b6c200..dfb0916c44fdda9158b7c5bdcbcc7ee90b07c6e5 100644 --- a/src/common/xsignal.c +++ b/src/common/xsignal.c @@ -34,9 +34,20 @@ #include <slurm/slurm_errno.h> #include "src/common/log.h" +#include "src/common/macros.h" #include "src/common/xsignal.h" #include "src/common/xassert.h" +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(xsignal, slurm_xsignal); +strong_alias(xsignal_save_mask, slurm_xsignal_save_mask); +strong_alias(xsignal_set_mask, slurm_xsignal_set_mask); +strong_alias(xsignal_block, slurm_xsignal_block); +strong_alias(xsignal_unblock, slurm_xsignal_unblock); +strong_alias(xsignal_sigset_create, slurm_xsignal_sigset_create); SigFunc * xsignal(int signo, SigFunc *f) diff --git a/src/common/xstring.c b/src/common/xstring.c index ca1ce8fd4e04506428d13e70ab6f21084de1fd6c..e480459ff06cd68c189d4e673aeb52713b6df240 100644 --- a/src/common/xstring.c +++ b/src/common/xstring.c @@ -46,6 +46,7 @@ #include <slurm/slurm_errno.h> +#include "src/common/macros.h" #include "src/common/strlcpy.h" #include "src/common/xassert.h" #include "src/common/xmalloc.h" @@ -53,6 +54,18 @@ #define XFGETS_CHUNKSIZE 64 +/* + * Define slurm-specific aliases for use by plugins, see slurm_xlator.h + * for details. + */ +strong_alias(_xstrcat, slurm_xstrcat); +strong_alias(_xstrcatchar, slurm_xstrcatchar); +strong_alias(_xslurm_strerrorcat, slurm_xslurm_strerrorcat); +strong_alias(_xstrftimecat, slurm_xstrftimecat); +strong_alias(_xstrfmtcat, slurm_xstrfmtcat); +strong_alias(_xmemcat, slurm_xmemcat); +strong_alias(xstrdup, slurm_xstrdup); +strong_alias(xbasename, slurm_xbasename); /* * Ensure that a string has enough space to add 'needed' characters. diff --git a/src/plugins/auth/auth_authd.c b/src/plugins/auth/auth_authd.c index 453267787260a1301e5ce96c4c884d3e68a10b11..7edd777576f53c6202713065a51d53c65cbcb8e2 100644 --- a/src/plugins/auth/auth_authd.c +++ b/src/plugins/auth/auth_authd.c @@ -49,12 +49,7 @@ #endif #include <slurm/slurm_errno.h> -#include "src/common/slurm_auth.h" -#include "src/common/xmalloc.h" -#include "src/common/xassert.h" -#include "src/common/pack.h" -#include "src/common/log.h" -#include "src/common/arg_desc.h" +#include "src/common/slurm_xlator.h" const char plugin_name[] = "Brent Chun's authd authentication plugin"; const char plugin_type[] = "auth/authd"; diff --git a/src/plugins/auth/auth_munge.c b/src/plugins/auth/auth_munge.c index 030af6296a45d8e23ea998e3ec9535b68a387d01..098f6dc7d61d2d5005144e51d624c2ba20beb469 100644 --- a/src/plugins/auth/auth_munge.c +++ b/src/plugins/auth/auth_munge.c @@ -57,14 +57,7 @@ #include <munge.h> #include <slurm/slurm_errno.h> - -#include "src/common/xassert.h" -#include "src/common/xmalloc.h" -#include "src/common/xsignal.h" -#include "src/common/pack.h" -#include "src/common/log.h" -#include "src/common/slurm_auth.h" -#include "src/common/arg_desc.h" +#include "src/common/slurm_xlator.h" #define MUNGE_ERRNO_OFFSET 1000 diff --git a/src/plugins/auth/auth_none.c b/src/plugins/auth/auth_none.c index b2e53b2694c5275469be5181c3f7291f12d3b2e0..a2f14c10639cc2f7b15556c34b43354a278e3494 100644 --- a/src/plugins/auth/auth_none.c +++ b/src/plugins/auth/auth_none.c @@ -52,11 +52,7 @@ #include <stdio.h> #include <slurm/slurm_errno.h> -#include "src/common/xassert.h" -#include "src/common/xmalloc.h" -#include "src/common/pack.h" -#include "src/common/log.h" -#include "src/common/slurm_auth.h" +#include "src/common/slurm_xlator.h" /* * These variables are required by the generic plugin interface. If they diff --git a/src/plugins/switch/elanhosts.c b/src/plugins/switch/elanhosts.c index 47fcda1c210af6fc466dd8221dd4e4c0d8544797..ec292bfea8386c8486dd27bd86c27a67486edc6d 100644 --- a/src/plugins/switch/elanhosts.c +++ b/src/plugins/switch/elanhosts.c @@ -35,8 +35,7 @@ #include <stdarg.h> #include <stdlib.h> -#include "src/common/list.h" -#include "src/common/hostlist.h" +#include "src/common/slurm_xlator.h" #include "elanhosts.h" /* Default ElanId config file */ diff --git a/src/plugins/switch/qsw.c b/src/plugins/switch/qsw.c index 08bc20fae943dade819d9cbf8e50a4b6037436c1..db2d34aa4a24d2a469bc93dea3698aff04b3fd26 100644 --- a/src/plugins/switch/qsw.c +++ b/src/plugins/switch/qsw.c @@ -82,11 +82,7 @@ #include <slurm/slurm_errno.h> -#include "src/common/xassert.h" -#include "src/common/strlcpy.h" -#include "src/common/bitstring.h" -#include "src/common/log.h" -#include "src/common/pack.h" +#include "src/common/slurm_xlator.h" #include "src/plugins/switch/elanhosts.h" #include "src/plugins/switch/qsw.h" diff --git a/src/plugins/switch/qsw.h b/src/plugins/switch/qsw.h index 08b0c1b4da9b07e82039ec82a038d1e6119c589b..f2caba7703a4634a0c47ef8357e56ac3f59936ad 100644 --- a/src/plugins/switch/qsw.h +++ b/src/plugins/switch/qsw.h @@ -31,8 +31,7 @@ # include "config.h" #endif -#include "src/common/bitstring.h" -#include "src/common/pack.h" +#include "src/common/slurm_xlator.h" #ifndef _QSW_INCLUDED #define _QSW_INCLUDED diff --git a/src/plugins/switch/switch_elan.c b/src/plugins/switch/switch_elan.c index e994f8112cdcf7ce89c08d2a4589c733a5fca1d5..97f85ed254ace572850874cfa3b4bf44f5c96537 100644 --- a/src/plugins/switch/switch_elan.c +++ b/src/plugins/switch/switch_elan.c @@ -42,14 +42,7 @@ #include <slurm/slurm_errno.h> -#include "src/common/bitstring.h" -#include "src/common/hostlist.h" -#include "src/common/log.h" -#include "src/common/macros.h" -#include "src/common/setenvpf.h" -#include "src/common/switch.h" -#include "src/common/xmalloc.h" -#include "src/common/xstring.h" +#include "src/common/slurm_xlator.h" #include "src/plugins/switch/qsw.h" diff --git a/src/plugins/switch/switch_none.c b/src/plugins/switch/switch_none.c index b6f7031b9a8c394902fa1c45cb77511226245bef..679128a8bfe389512c47aa53ebcbee3c360fcf89 100644 --- a/src/plugins/switch/switch_none.c +++ b/src/plugins/switch/switch_none.c @@ -32,9 +32,7 @@ #include <sys/types.h> #include <slurm/slurm_errno.h> - -#include "src/common/macros.h" -#include "src/common/switch.h" +#include "src/common/slurm_xlator.h" /* * These variables are required by the generic plugin interface. If they