diff options
Diffstat (limited to 'ceed')
-rwxr-xr-x | ceed/Makefile | 42 | ||||
-rwxr-xr-x | ceed/ceed.c | 70 | ||||
-rwxr-xr-x | ceed/ceed_api.c | 157 | ||||
-rwxr-xr-x | ceed/ceed_api.h | 22 |
4 files changed, 0 insertions, 291 deletions
diff --git a/ceed/Makefile b/ceed/Makefile deleted file mode 100755 index 58205ed..0000000 --- a/ceed/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -CFLAGS =-g -I. -I../ -LDFLAGS =-lm - -ifeq ($(CC),x86_64-w64-mingw32-gcc) -LDFLAGS += -lws2_32 -endif - -DEPS = ceed_api.h ../globals.h ../utils.h -OBJ = ceed.o ceed_api.o ../utils.o ../globals.o - -all: ceed - -debug: DFLAGS = -DDBG -debug: clean ceed - -%.o: %.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) $(DFLAGS) - -ceed: $(OBJ) - $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) - -.PHONY: clean -clean: - rm -f $(OBJ) ceed *.exe - -windows: - docker ps -a -q --filter "name=ceed-windows" | awk '{print $1}' | xargs -I {} docker rm -f {} - docker images -q --filter "label=name=ceed-windows" | awk '{print $1}' | xargs -I {} docker rmi {} - cd ../dockerfiles; docker build -t crops/ceed:windows -f Dockerfile.ceed.win ../ - docker run --name=ceed-windows crops/ceed:windows; mkdir -p ../outdir - docker cp ceed-windows:/usr/local/crops/ceed/ceed ../outdir/ceed.exe - docker ps -a -q --filter "name=ceed-windows" | awk '{print $1}' | xargs -I {} docker rm -f {} - docker images -q --filter "label=name=ceed-windows" | awk '{print $1}' | xargs -I {} docker rmi {} - -linux: - docker ps -a -q --filter "name=ceed-linux" | awk '{print $1}' | xargs -I {} docker rm -f {} - docker images -q --filter "label=name=ceed-linux" | awk '{print $1}' | xargs -I {} docker rmi {} - cd ../dockerfiles; docker build -t crops/ceed:linux -f Dockerfile.ceed.linux ../ - docker run --name=ceed-linux crops/ceed:linux; mkdir -p ../outdir - docker cp ceed-linux:/usr/local/crops/ceed/ceed ../outdir/ceed - docker ps -a -q --filter "name=ceed-linux" | awk '{print $1}' | xargs -I {} docker rm -f {} - docker images -q --filter "label=name=ceed-linux" | awk '{print $1}' | xargs -I {} docker rmi {} diff --git a/ceed/ceed.c b/ceed/ceed.c deleted file mode 100755 index f0fa0cc..0000000 --- a/ceed/ceed.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2016 Intel Corporation - * - * Author: Todor Minchev <todor.minchev@linux.intel.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, or (at your option) any later version, as published by - * the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#include <stdlib.h> -#include "globals.h" -#include "ceed_api.h" -#include "utils.h" - -extern char *ceed_ops[]; - -int main(int argc, char *argv[]) { - int i, done, sock_fd; - char *turff_nodes[KEY_ARR_SZ]; - struct addrinfo *addr_p; - void *ceed_out; - - parse_ceed_params(argc, argv); - - addr_p = connect_to_socket(ceed_ops[KEY('i')], ceed_ops[KEY('s')], &sock_fd); - - if(addr_p == NULL) { - ERR("Could not connect to CODI\n"); - } else { - INFO("Connected to CODI on %s port : %s\n", - ceed_ops[KEY('i')], ceed_ops[KEY('s')]); - } - - INFO("Host Architecture : %s\n", ceed_ops[KEY('a')]); - send_args(sock_fd, ceed_ops); - - if(ceed_ops[KEY('l')] == NULL) { /* this was a service request */ - INFO(" ========== CEED OUTPUT BEGIN ==========\n"); - ceed_out = calloc(1, BUFSIZ); - done = 0; - - while(!done) { - memset(ceed_out, 0, BUFSIZ); - receive_data(sock_fd, ceed_out, BUFSIZ, 1, &done); - } - free(ceed_out); - - INFO(" ========== CEED OUTPUT END ==========\n"); - } else { /* this was nodes request, receive turff nodes */ - do { - for(i = 0; i < KEY_ARR_SZ; i++) - turff_nodes[i] = NULL; - - receive_args(sock_fd, turff_nodes); - if(turff_nodes[KEY('e')] == NULL) { - INFO("TURFF Node ID: %s \n", turff_nodes[KEY('d')]); - } - }while (turff_nodes[KEY('e')] == NULL); - } - - close(sock_fd); - return 0; -} diff --git a/ceed/ceed_api.c b/ceed/ceed_api.c deleted file mode 100755 index 973c050..0000000 --- a/ceed/ceed_api.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2016 Intel Corporation - * - * Author: Todor Minchev <todor.minchev@linux.intel.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, or (at your option) any later version, as published by - * the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#include "globals.h" -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <ctype.h> - -char *ceed_ops[KEY_ARR_SZ]; - -void print_ceed_usage(int argc, char *argv[]) { - - printf("Usage: %s -p prj -i 192.168.99.100 -s 10000 -b\n", argv[0]); - printf(" -i CODI ip address [default: 127.0.0.1 (linux) or 192.168.99.100 (win/mac)]\n"); - printf(" -s CODI listening port [default: 10000]\n"); - printf(" -l list available build containers\n"); - printf(" -d container_id. Send command to container_id\n"); - printf(" -p prj_name [required]\n"); - printf(" -b build project [NOTE: -b and -c are mutually exclusive]\n"); - printf(" -c clean project [NOTE: -c and -b are mutually exclusive]\n"); - printf(" -t autotools project [NOTE: -t and -k and -m are mutually exclusive]\n"); - printf(" -k cmake project [NOTE: -k and -t and -m are mutually exclusive]\n"); - printf(" -m target make makefile_target [NOTE: -m and -t and -k are mutually exclusive]\n"); - printf(" -g gen_cmd execute generic command\n"); - printf(" -r args generic command arguments\n"); - printf(" -e env environment variables\n"); - printf(" -h print this help menu\n"); - printf(" -v show ceed version\n"); - exit(EXIT_FAILURE); -} - -void init_ceed_params(){ -#if defined(_WIN32) || defined(__CYGWIN__) - ceed_ops[KEY('a')] = "win"; - ceed_ops[KEY('i')] = CODI_IP_VIRT; -#elif __APPLE__ - ceed_ops[KEY('a')] = "mac"; - ceed_ops[KEY('i')] = CODI_IP_VIRT; -#elif __linux - ceed_ops[KEY('a')] = "linux"; - ceed_ops[KEY('i')] = CODI_IP_NATIVE; -#endif - ceed_ops[KEY('p')] = NULL; - ceed_ops[KEY('s')] = CODI_PORT; - ceed_ops[KEY('v')] = VERSION; - ceed_ops[KEY('r')] = " "; - ceed_ops[KEY('z')] = CEED_NAME; -} - -void parse_ceed_params(int argc, char *argv[]) { - int c, b_flg = 0, c_flg = 0, t_flg = 0, m_flg = 0, k_flg = 0; - - init_ceed_params(); - - while((c = getopt(argc, argv, "hvltm:kbcp:i:s:g:r:d:")) != -1) { - switch (c) { - case 'h': - print_ceed_usage(argc, argv); - exit(EXIT_SUCCESS); - break; - case 'v': - INFO("ceed version : %s\n", VERSION); - exit(EXIT_SUCCESS); - break; - case 'p': - ceed_ops[KEY('p')] = optarg; - break; - case 'i': - ceed_ops[KEY('i')] = optarg; - break; - case 's': - ceed_ops[KEY('s')] = optarg; - break; - case 'g': - ceed_ops[KEY('g')] = optarg; - break; - case 'r': - ceed_ops[KEY('r')] = optarg; - break; - case 'd': - ceed_ops[KEY('d')] = optarg; - break; - case 'l': - asprintf(&ceed_ops[KEY('l')] , "set"); - break; - case 'b': - if(c_flg) { - print_ceed_usage(argc, argv); - } else { - b_flg++; - asprintf(&ceed_ops[KEY('b')] , "set"); - } - break; - case 'c': - if(b_flg) { - print_ceed_usage(argc, argv); - } else { - c_flg++; - asprintf(&ceed_ops[KEY('c')] , "set"); - } - break; - case 't': - if(m_flg || k_flg) { - print_ceed_usage(argc, argv); - } else { - t_flg++; - asprintf(&ceed_ops[KEY('t')] , "set"); - } - break; - case 'm': - if(t_flg || k_flg) - print_ceed_usage(argc, argv); - else { - m_flg++; - ceed_ops[KEY('m')] = optarg; - } - break; - case 'k': - if(t_flg || m_flg) - print_ceed_usage(argc, argv); - else { - k_flg++; - asprintf(&ceed_ops[KEY('k')] , "set"); - } - break; - case '?': - if (optopt == 'p' || optopt == 'i' || optopt == 's' || optopt == 'm') - ERR("Option -%c requires an argument.\n", optopt); - else if (isprint(optopt)) - ERR("Unknown option `-%c'.\n", optopt); - else - ERR("Unknown option character `\\x%x'.\n", optopt); - default: - print_ceed_usage(argc, argv); - } - } - - if ((ceed_ops[KEY('l')] == NULL && ceed_ops[KEY('p')] == NULL && ceed_ops[KEY('g')] == NULL ) - || (ceed_ops[KEY('i')] == NULL || ceed_ops[KEY('s')] == NULL)) { - print_ceed_usage(argc, argv); - } -} - diff --git a/ceed/ceed_api.h b/ceed/ceed_api.h deleted file mode 100755 index a66e6e6..0000000 --- a/ceed/ceed_api.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2016 Intel Corporation - * - * Author: Todor Minchev <todor.minchev@linux.intel.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, or (at your option) any later version, as published by - * the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#ifndef CEED_API_H -#define CEED_API_H - -void parse_ceed_params(int argc, char *argv[]); - -#endif |