Loading Makefile.am +74 −60 Original line number Diff line number Diff line Loading @@ -23,70 +23,84 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = etc lib examples SUBDIRS = etc lib examples src DIST_SUBDIRS = lib examples bin_PROGRAMS = src/urd #bin_PROGRAMS = src/urd CLEANFILES = $(builddir)/src/defaults.cpp #MOSTLYCLEANFILES = \ # $(builddir)/src/defaults.cpp \ # $(builddir)/src/messages.pb.cc \ # $(builddir)/src/messages.pb.h src_urd_SOURCES = \ src/ipc-listener.hpp \ src/backends.cpp \ src/backends.hpp \ src/defaults.hpp \ src/nvml-dax.cpp \ src/nvml-dax.hpp \ src/main.cpp \ src/posix-fs.cpp \ src/posix-fs.hpp \ src/settings.cpp \ src/settings.hpp \ src/urd.cpp \ src/urd.hpp \ src/utils.cpp \ src/utils.hpp nodist_src_urd_SOURCES = \ src/defaults.cpp BUILT_SOURCES = \ src/defaults.hpp src_urd_CXXFLAGS = \ @TBB_CFLAGS@ \ -std=gnu++11 -Wall -Wextra src_urd_CPPFLAGS = \ -DSPDLOG_ENABLE_SYSLOG \ @BOOST_CPPFLAGS@ \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src src_urd_LDFLAGS = \ @TBB_LIBS@ \ @BOOST_LDFLAGS@ \ @BOOST_SYSTEM_LIB@ \ @BOOST_ASIO_LIB@ \ @BOOST_PROGRAM_OPTIONS_LIB@ \ -pthread src_urd_LDADD = \ -lboost_system #src_urd_SOURCES = \ # rpc/norns-rpc.h \ # src/ipc-listener.hpp \ # src/backends.cpp \ # src/backends.hpp \ # src/defaults.hpp \ # src/nvml-dax.cpp \ # src/nvml-dax.hpp \ # src/main.cpp \ # src/posix-fs.cpp \ # src/posix-fs.hpp \ # src/settings.cpp \ # src/settings.hpp \ # src/urd.cpp \ # src/urd.hpp \ # src/utils.cpp \ # src/utils.hpp # #nodist_src_urd_SOURCES = \ # src/defaults.cpp \ # src/messages.pb.cc \ # src/messages.pb.h $(builddir)/src/defaults.cpp: Makefile @( echo "/* This file autogenerated by Makefile */"; \ echo "#include \"defaults.hpp\""; \ echo ""; \ echo "namespace defaults {"; \ echo " const char* progname = \"urd\";"; \ echo " const bool daemonize = true;"; \ echo " const char* running_dir = \"/tmp\";"; \ echo " const char* ipc_sockfile = \"/tmp/urd.socket\";"; \ echo " const char* daemon_pidfile = \"/tmp/urd.pid\";"; \ echo " const uint32_t workers_in_pool = std::thread::hardware_concurrency();"; \ echo " const char* config_file = \"$(sysconfdir)/norns.conf\";"; \ echo "} // namespace defaults"; \ ) > $@ #BUILT_SOURCES = \ # src/defaults.hpp \ # src/messages.pb.cc \ # src/messages.pb.h # #src_urd_CXXFLAGS = \ # @TBB_CFLAGS@ \ # -std=gnu++11 -Wall -Wextra # #src_urd_CPPFLAGS = \ # -DSPDLOG_ENABLE_SYSLOG \ # @BOOST_CPPFLAGS@ \ # -I$(top_srcdir)/include \ # -I$(top_srcdir)/src \ # -I$(top_srcdir)/rpc \ # -I$(top_builddir)/rpc # # #src_urd_LDFLAGS = \ # @TBB_LIBS@ \ # @BOOST_LDFLAGS@ \ # @BOOST_SYSTEM_LIB@ \ # @BOOST_ASIO_LIB@ \ # @BOOST_PROGRAM_OPTIONS_LIB@ \ # -pthread # #src_urd_LDADD = \ # -lboost_system # #$(builddir)/src/defaults.cpp: Makefile # @( echo "/* This file autogenerated by Makefile */"; \ # echo "#include \"defaults.hpp\""; \ # echo ""; \ # echo "namespace defaults {"; \ # echo " const char* progname = \"urd\";"; \ # echo " const bool daemonize = true;"; \ # echo " const char* running_dir = \"/tmp\";"; \ # echo " const char* ipc_sockfile = \"/tmp/urd.socket\";"; \ # echo " const char* daemon_pidfile = \"/tmp/urd.pid\";"; \ # echo " const uint32_t workers_in_pool = std::thread::hardware_concurrency();"; \ # echo " const char* config_file = \"$(sysconfdir)/norns.conf\";"; \ # echo "} // namespace defaults"; \ # ) > $@ # #$(builddir)/src/%.pb.cc %.pb.h: %.proto # $(PROTOC) --proto_path=$(srcdir) --cpp_out=$(builddir) $^ configure.ac +17 −1 Original line number Diff line number Diff line Loading @@ -80,6 +80,20 @@ AC_MSG_ERROR([This software requires the development files of Intel TBB. * In RHEL/CentOS: yum install tbb-devel]) ) # check for protobuf-c PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 1.0.0]) AC_CHECK_PROG([PROTOC_C], [protoc-c], [protoc-c]) AS_IF([test "x${PROTOC_C}" == "x"], [AC_MSG_ERROR([ProtoBuf C compiler "protoc-c" not found.])]) # check for protobuf PKG_CHECK_MODULES([PROTOBUF], [protobuf >= 2.5.0]) AC_CHECK_PROG([PROTOC], [protoc], [protoc]) AS_IF([test "x${PROTOC}" == "x"], [AC_MSG_ERROR([ProtoBuf compiler "protoc" not found.])]) # Checks for header files. # Checks for typedefs, structures, and compiler characteristics. Loading @@ -90,5 +104,7 @@ AC_CONFIG_FILES([ Makefile etc/Makefile lib/Makefile examples/Makefile]) examples/Makefile src/Makefile ]) AC_OUTPUT examples/Makefile.am +16 −2 Original line number Diff line number Diff line Loading @@ -21,13 +21,15 @@ # along with Data Scheduler. If not, see <http://www.gnu.org/licenses/>. # bin_PROGRAMS = app bin_PROGRAMS = \ app \ job_registration app_SOURCES = \ app.c app_CFLAGS = \ -std=c99 -Wall -Wextra -std=gnu99 -Wall -Wextra app_CPPFLAGS = \ -I$(top_srcdir)/include Loading @@ -35,3 +37,15 @@ app_CPPFLAGS = \ app_LDADD = \ $(top_builddir)/lib/libnorns.la job_registration_SOURCES = \ job_registration.c job_registration_CFLAGS = \ -std=gnu99 -Wall -Wextra job_registration_CPPFLAGS = \ -I$(top_srcdir)/include job_registration_LDADD = \ $(top_builddir)/lib/libnorns.la examples/job_registration.c 0 → 100644 +90 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 Barcelona Supercomputing Center * Centro Nacional de Supercomputacion * * This file is part of the Data Scheduler, a daemon for tracking and managing * requests for asynchronous data transfer in a hierarchical storage environment. * * See AUTHORS file in the top level directory for information * regarding developers and contributors. * * The Data Scheduler is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Data Scheduler is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Data Scheduler. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <string.h> #include <norns.h> const char* ex_hosts[5] = { "node-00", "node-01", "node-02", "node-03", "node-04", }; int main(int argc, char* argv[]) { (void) argc; (void) argv; // create job descriptor from example data // 1. fill in hostnames int num_hosts = 3; const char** hosts = NORNS_PLIST_ALLOC(const char*, num_hosts); for(int i=0; i<num_hosts; ++i) { hosts[i] = ex_hosts[i]; } // 2. declare which backends the job is authorized to use // and provide info on them int num_backends = 3; struct norns_backend** backends = NORNS_PLIST_ALLOC(struct norns_backend*, num_backends); for(int i=0; i<num_backends; ++i) { backends[i] = NORNS_ALLOC(sizeof(struct norns_backend)); char str_mount[50]; snprintf(str_mount, sizeof(str_mount), "/mnt/a-%d", i); size_t n = strlen(str_mount); backends[i]->b_mount = strndup(str_mount, n); backends[i]->b_type = NORNS_LOCAL_NVML; backends[i]->b_quota = 1024; } struct norns_job job = { .jb_jobid = 42, .jb_hosts = hosts, .jb_nhosts = num_hosts, .jb_backends = backends, .jb_nbackends = num_backends }; struct norns_cred cred; norns_register_job(&cred, &job); NORNS_PLIST_FREE(hosts); NORNS_PLIST_FREE(backends); } include/norns.h +66 −13 Original line number Diff line number Diff line Loading @@ -27,9 +27,17 @@ #include <features.h> #include <sys/types.h> #include <stdint.h> #include <assert.h> __BEGIN_DECLS /* Error codes */ #define NORNS_SUCCESS 0 #define NORNS_EBADPARAMS -1 #define NORNS_ENOMEM -2 #define NORNS_ECONNFAILED -3 #define NORNS_ERPCSENDFAILED -4 typedef uint32_t jobid_t; /* Process credentials */ Loading @@ -39,12 +47,6 @@ struct norns_cred { gid_t cr_gid; /* GID of the process */ }; /* Batch job descriptor */ struct norns_job { const char** jb_hosts; /* NULL-terminated array of hostnames participating in the job */ size_t jb_nhosts; /* number of hostnames in the list */ }; /* Data resource descriptor */ struct norns_resource { const char* r_hostname; /* hostname */ Loading @@ -56,10 +58,6 @@ struct norns_resource { /* I/O task descriptor */ struct norns_iotd { uint32_t ni_tid; /* task identifier */ // uint32_t ni_sbid; /* source backend identifier */ // const char* ni_spath; /* path to data source */ // uint32_t ni_dbid; /* destination backend identifier */ // const char* ni_dpath; /* path to data destination */ struct norns_resource ni_src; /* data source */ struct norns_resource ni_dst; /* data destination */ Loading @@ -72,6 +70,12 @@ struct norns_iotd { }; /* Storage resource types */ #define NORNS_NVML 0x1000 #define NORNS_POSIX 0x1001 /* Task types */ //enum { // NORNS_COPY = 00000000, Loading Loading @@ -131,17 +135,66 @@ int norns_error(struct norns_iotd* iotdp) __THROW; /* (only authenticated processes will be able to successfully call these) */ /**************************************************************************/ #define NORNS_LOCAL_NVML 0x10000000 #define NORNS_REMOTE_NVML 0x10000001 #define NORNS_LUSTRE 0x10000002 /* Storage backend descriptor */ struct norns_backend { int b_type; const char* b_mount; /* mount point */ size_t b_quota; /* backend capacity (in megabytes) allocated to the job */ }; #define NORNS_ALLOC(size) \ ({ \ size_t __n = (size); \ void* __p = malloc(__n); \ assert(__p != NULL); \ __p; \ }) #define NORNS_FREE(p) \ ({ \ free(__p;) \ }) #define NORNS_PLIST_ALLOC(type, size) \ ({ \ size_t __n = (size); \ void** __plist = (void**) malloc(sizeof(type) * (__n + 1)); \ memset(__plist, 0, __n + 1); \ (type*) __plist; \ }) #define NORNS_PLIST_FREE(plist) \ ({ \ free((plist)); \ }) /* Batch job descriptor */ struct norns_job { uint32_t jb_jobid; /* desired job ID (for later requests) */ const char** jb_hosts; /* NULL-terminated list of hostnames participating in the job */ size_t jb_nhosts; /* entries in hostname list */ struct norns_backend** jb_backends; /* NULL-terminated list of storage backends the job will use */ size_t jb_nbackends; /* entries in backend list */ }; /* Send a command to the daemon (e.g. stop accepting new tasks) */ int norns_command(struct norns_cred* auth); /* Register and describe a batch job */ int norns_register_job(struct norns_cred* auth, struct norns_job* job_desc); int norns_register_job(struct norns_cred* auth, struct norns_job* job); /* Update the description of an existing batch job */ int norns_update_job(struct norns_cred* auth, struct norns_job* job_desc); int norns_update_job(struct norns_cred* auth, struct norns_job* job); /* Remove the description of a batch job */ int norns_remove_job(struct norns_cred* auth, struct norns_job* job_desc); int norns_remove_job(struct norns_cred* auth, struct norns_job* job); __END_DECLS Loading Loading
Makefile.am +74 −60 Original line number Diff line number Diff line Loading @@ -23,70 +23,84 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = etc lib examples SUBDIRS = etc lib examples src DIST_SUBDIRS = lib examples bin_PROGRAMS = src/urd #bin_PROGRAMS = src/urd CLEANFILES = $(builddir)/src/defaults.cpp #MOSTLYCLEANFILES = \ # $(builddir)/src/defaults.cpp \ # $(builddir)/src/messages.pb.cc \ # $(builddir)/src/messages.pb.h src_urd_SOURCES = \ src/ipc-listener.hpp \ src/backends.cpp \ src/backends.hpp \ src/defaults.hpp \ src/nvml-dax.cpp \ src/nvml-dax.hpp \ src/main.cpp \ src/posix-fs.cpp \ src/posix-fs.hpp \ src/settings.cpp \ src/settings.hpp \ src/urd.cpp \ src/urd.hpp \ src/utils.cpp \ src/utils.hpp nodist_src_urd_SOURCES = \ src/defaults.cpp BUILT_SOURCES = \ src/defaults.hpp src_urd_CXXFLAGS = \ @TBB_CFLAGS@ \ -std=gnu++11 -Wall -Wextra src_urd_CPPFLAGS = \ -DSPDLOG_ENABLE_SYSLOG \ @BOOST_CPPFLAGS@ \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src src_urd_LDFLAGS = \ @TBB_LIBS@ \ @BOOST_LDFLAGS@ \ @BOOST_SYSTEM_LIB@ \ @BOOST_ASIO_LIB@ \ @BOOST_PROGRAM_OPTIONS_LIB@ \ -pthread src_urd_LDADD = \ -lboost_system #src_urd_SOURCES = \ # rpc/norns-rpc.h \ # src/ipc-listener.hpp \ # src/backends.cpp \ # src/backends.hpp \ # src/defaults.hpp \ # src/nvml-dax.cpp \ # src/nvml-dax.hpp \ # src/main.cpp \ # src/posix-fs.cpp \ # src/posix-fs.hpp \ # src/settings.cpp \ # src/settings.hpp \ # src/urd.cpp \ # src/urd.hpp \ # src/utils.cpp \ # src/utils.hpp # #nodist_src_urd_SOURCES = \ # src/defaults.cpp \ # src/messages.pb.cc \ # src/messages.pb.h $(builddir)/src/defaults.cpp: Makefile @( echo "/* This file autogenerated by Makefile */"; \ echo "#include \"defaults.hpp\""; \ echo ""; \ echo "namespace defaults {"; \ echo " const char* progname = \"urd\";"; \ echo " const bool daemonize = true;"; \ echo " const char* running_dir = \"/tmp\";"; \ echo " const char* ipc_sockfile = \"/tmp/urd.socket\";"; \ echo " const char* daemon_pidfile = \"/tmp/urd.pid\";"; \ echo " const uint32_t workers_in_pool = std::thread::hardware_concurrency();"; \ echo " const char* config_file = \"$(sysconfdir)/norns.conf\";"; \ echo "} // namespace defaults"; \ ) > $@ #BUILT_SOURCES = \ # src/defaults.hpp \ # src/messages.pb.cc \ # src/messages.pb.h # #src_urd_CXXFLAGS = \ # @TBB_CFLAGS@ \ # -std=gnu++11 -Wall -Wextra # #src_urd_CPPFLAGS = \ # -DSPDLOG_ENABLE_SYSLOG \ # @BOOST_CPPFLAGS@ \ # -I$(top_srcdir)/include \ # -I$(top_srcdir)/src \ # -I$(top_srcdir)/rpc \ # -I$(top_builddir)/rpc # # #src_urd_LDFLAGS = \ # @TBB_LIBS@ \ # @BOOST_LDFLAGS@ \ # @BOOST_SYSTEM_LIB@ \ # @BOOST_ASIO_LIB@ \ # @BOOST_PROGRAM_OPTIONS_LIB@ \ # -pthread # #src_urd_LDADD = \ # -lboost_system # #$(builddir)/src/defaults.cpp: Makefile # @( echo "/* This file autogenerated by Makefile */"; \ # echo "#include \"defaults.hpp\""; \ # echo ""; \ # echo "namespace defaults {"; \ # echo " const char* progname = \"urd\";"; \ # echo " const bool daemonize = true;"; \ # echo " const char* running_dir = \"/tmp\";"; \ # echo " const char* ipc_sockfile = \"/tmp/urd.socket\";"; \ # echo " const char* daemon_pidfile = \"/tmp/urd.pid\";"; \ # echo " const uint32_t workers_in_pool = std::thread::hardware_concurrency();"; \ # echo " const char* config_file = \"$(sysconfdir)/norns.conf\";"; \ # echo "} // namespace defaults"; \ # ) > $@ # #$(builddir)/src/%.pb.cc %.pb.h: %.proto # $(PROTOC) --proto_path=$(srcdir) --cpp_out=$(builddir) $^
configure.ac +17 −1 Original line number Diff line number Diff line Loading @@ -80,6 +80,20 @@ AC_MSG_ERROR([This software requires the development files of Intel TBB. * In RHEL/CentOS: yum install tbb-devel]) ) # check for protobuf-c PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 1.0.0]) AC_CHECK_PROG([PROTOC_C], [protoc-c], [protoc-c]) AS_IF([test "x${PROTOC_C}" == "x"], [AC_MSG_ERROR([ProtoBuf C compiler "protoc-c" not found.])]) # check for protobuf PKG_CHECK_MODULES([PROTOBUF], [protobuf >= 2.5.0]) AC_CHECK_PROG([PROTOC], [protoc], [protoc]) AS_IF([test "x${PROTOC}" == "x"], [AC_MSG_ERROR([ProtoBuf compiler "protoc" not found.])]) # Checks for header files. # Checks for typedefs, structures, and compiler characteristics. Loading @@ -90,5 +104,7 @@ AC_CONFIG_FILES([ Makefile etc/Makefile lib/Makefile examples/Makefile]) examples/Makefile src/Makefile ]) AC_OUTPUT
examples/Makefile.am +16 −2 Original line number Diff line number Diff line Loading @@ -21,13 +21,15 @@ # along with Data Scheduler. If not, see <http://www.gnu.org/licenses/>. # bin_PROGRAMS = app bin_PROGRAMS = \ app \ job_registration app_SOURCES = \ app.c app_CFLAGS = \ -std=c99 -Wall -Wextra -std=gnu99 -Wall -Wextra app_CPPFLAGS = \ -I$(top_srcdir)/include Loading @@ -35,3 +37,15 @@ app_CPPFLAGS = \ app_LDADD = \ $(top_builddir)/lib/libnorns.la job_registration_SOURCES = \ job_registration.c job_registration_CFLAGS = \ -std=gnu99 -Wall -Wextra job_registration_CPPFLAGS = \ -I$(top_srcdir)/include job_registration_LDADD = \ $(top_builddir)/lib/libnorns.la
examples/job_registration.c 0 → 100644 +90 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 Barcelona Supercomputing Center * Centro Nacional de Supercomputacion * * This file is part of the Data Scheduler, a daemon for tracking and managing * requests for asynchronous data transfer in a hierarchical storage environment. * * See AUTHORS file in the top level directory for information * regarding developers and contributors. * * The Data Scheduler is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Data Scheduler is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Data Scheduler. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <string.h> #include <norns.h> const char* ex_hosts[5] = { "node-00", "node-01", "node-02", "node-03", "node-04", }; int main(int argc, char* argv[]) { (void) argc; (void) argv; // create job descriptor from example data // 1. fill in hostnames int num_hosts = 3; const char** hosts = NORNS_PLIST_ALLOC(const char*, num_hosts); for(int i=0; i<num_hosts; ++i) { hosts[i] = ex_hosts[i]; } // 2. declare which backends the job is authorized to use // and provide info on them int num_backends = 3; struct norns_backend** backends = NORNS_PLIST_ALLOC(struct norns_backend*, num_backends); for(int i=0; i<num_backends; ++i) { backends[i] = NORNS_ALLOC(sizeof(struct norns_backend)); char str_mount[50]; snprintf(str_mount, sizeof(str_mount), "/mnt/a-%d", i); size_t n = strlen(str_mount); backends[i]->b_mount = strndup(str_mount, n); backends[i]->b_type = NORNS_LOCAL_NVML; backends[i]->b_quota = 1024; } struct norns_job job = { .jb_jobid = 42, .jb_hosts = hosts, .jb_nhosts = num_hosts, .jb_backends = backends, .jb_nbackends = num_backends }; struct norns_cred cred; norns_register_job(&cred, &job); NORNS_PLIST_FREE(hosts); NORNS_PLIST_FREE(backends); }
include/norns.h +66 −13 Original line number Diff line number Diff line Loading @@ -27,9 +27,17 @@ #include <features.h> #include <sys/types.h> #include <stdint.h> #include <assert.h> __BEGIN_DECLS /* Error codes */ #define NORNS_SUCCESS 0 #define NORNS_EBADPARAMS -1 #define NORNS_ENOMEM -2 #define NORNS_ECONNFAILED -3 #define NORNS_ERPCSENDFAILED -4 typedef uint32_t jobid_t; /* Process credentials */ Loading @@ -39,12 +47,6 @@ struct norns_cred { gid_t cr_gid; /* GID of the process */ }; /* Batch job descriptor */ struct norns_job { const char** jb_hosts; /* NULL-terminated array of hostnames participating in the job */ size_t jb_nhosts; /* number of hostnames in the list */ }; /* Data resource descriptor */ struct norns_resource { const char* r_hostname; /* hostname */ Loading @@ -56,10 +58,6 @@ struct norns_resource { /* I/O task descriptor */ struct norns_iotd { uint32_t ni_tid; /* task identifier */ // uint32_t ni_sbid; /* source backend identifier */ // const char* ni_spath; /* path to data source */ // uint32_t ni_dbid; /* destination backend identifier */ // const char* ni_dpath; /* path to data destination */ struct norns_resource ni_src; /* data source */ struct norns_resource ni_dst; /* data destination */ Loading @@ -72,6 +70,12 @@ struct norns_iotd { }; /* Storage resource types */ #define NORNS_NVML 0x1000 #define NORNS_POSIX 0x1001 /* Task types */ //enum { // NORNS_COPY = 00000000, Loading Loading @@ -131,17 +135,66 @@ int norns_error(struct norns_iotd* iotdp) __THROW; /* (only authenticated processes will be able to successfully call these) */ /**************************************************************************/ #define NORNS_LOCAL_NVML 0x10000000 #define NORNS_REMOTE_NVML 0x10000001 #define NORNS_LUSTRE 0x10000002 /* Storage backend descriptor */ struct norns_backend { int b_type; const char* b_mount; /* mount point */ size_t b_quota; /* backend capacity (in megabytes) allocated to the job */ }; #define NORNS_ALLOC(size) \ ({ \ size_t __n = (size); \ void* __p = malloc(__n); \ assert(__p != NULL); \ __p; \ }) #define NORNS_FREE(p) \ ({ \ free(__p;) \ }) #define NORNS_PLIST_ALLOC(type, size) \ ({ \ size_t __n = (size); \ void** __plist = (void**) malloc(sizeof(type) * (__n + 1)); \ memset(__plist, 0, __n + 1); \ (type*) __plist; \ }) #define NORNS_PLIST_FREE(plist) \ ({ \ free((plist)); \ }) /* Batch job descriptor */ struct norns_job { uint32_t jb_jobid; /* desired job ID (for later requests) */ const char** jb_hosts; /* NULL-terminated list of hostnames participating in the job */ size_t jb_nhosts; /* entries in hostname list */ struct norns_backend** jb_backends; /* NULL-terminated list of storage backends the job will use */ size_t jb_nbackends; /* entries in backend list */ }; /* Send a command to the daemon (e.g. stop accepting new tasks) */ int norns_command(struct norns_cred* auth); /* Register and describe a batch job */ int norns_register_job(struct norns_cred* auth, struct norns_job* job_desc); int norns_register_job(struct norns_cred* auth, struct norns_job* job); /* Update the description of an existing batch job */ int norns_update_job(struct norns_cred* auth, struct norns_job* job_desc); int norns_update_job(struct norns_cred* auth, struct norns_job* job); /* Remove the description of a batch job */ int norns_remove_job(struct norns_cred* auth, struct norns_job* job_desc); int norns_remove_job(struct norns_cred* auth, struct norns_job* job); __END_DECLS Loading