Skip to content

Commit

Permalink
c0appz: move clovis config files to $HOME/.c0appz/
Browse files Browse the repository at this point in the history
Closes Seagate#7.
  • Loading branch information
andriytk committed Sep 7, 2020
1 parent f9a3445 commit 6a19993
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 69 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ help.h
cscope.*
m0trace.*
core.*
.c0*
c0cp
c0ct
c0isc_demo
Expand Down
25 changes: 14 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ C0CT = c0ct
C0RM = c0rm
FGEN = fgen

RCDIR = $(HOME)/.c0appz
APPASSIGN = sage-user-application-assignment

#isc executables and library
LIBISC = libdemo.so
ISC_REG = c0isc_reg
Expand Down Expand Up @@ -163,16 +166,16 @@ vmrcf:
./scripts/c0appzrcgen > ./.$(ISC_INVK)rc/$(NODE)

sagercf:
mkdir -p .${C0CP}rc
mkdir -p .${C0CT}rc
mkdir -p .${C0RM}rc
mkdir -p .$(ISC_REG)rc
mkdir -p .$(ISC_INVK)rc
sage-user-application-assignment ganesan $(C0CP) 172.18.1.${c} > .$(C0CP)rc/client-${c}
sage-user-application-assignment ganesan $(C0CT) 172.18.1.${c} > .$(C0CT)rc/client-${c}
sage-user-application-assignment ganesan $(C0RM) 172.18.1.${c} > .$(C0RM)rc/client-${c}
sage-user-application-assignment ganesan $(C0CP) 172.18.1.${c} > .$(ISC_REG)rc/client-${c}
sage-user-application-assignment ganesan $(C0CT) 172.18.1.${c} > .$(ISC_INVK)rc/client-${c}
mkdir -p $(RCDIR)/${C0CP}rc
mkdir -p $(RCDIR)/${C0CT}rc
mkdir -p $(RCDIR)/${C0RM}rc
mkdir -p $(RCDIR)/$(ISC_REG)rc
mkdir -p $(RCDIR)/$(ISC_INVK)rc
$(APPASSIGN) ganesan $(C0CP) 172.18.1.${c} > $(RCDIR)/$(C0CP)rc/client-${c}
$(APPASSIGN) ganesan $(C0CT) 172.18.1.${c} > $(RCDIR)/$(C0CT)rc/client-${c}
$(APPASSIGN) ganesan $(C0RM) 172.18.1.${c} > $(RCDIR)/$(C0RM)rc/client-${c}
$(APPASSIGN) ganesan $(C0CP) 172.18.1.${c} > $(RCDIR)/$(ISC_REG)rc/client-${c}
$(APPASSIGN) ganesan $(C0CT) 172.18.1.${c} > $(RCDIR)/$(ISC_INVK)rc/client-${c}

clean: isc-clean
rm -f $(C0CP) $(C0CT) $(C0RM) m0trace.*
Expand Down Expand Up @@ -219,7 +222,7 @@ mpi-clean:

mpi-sagercf:
mkdir -p .${EXE6}rc
sage-user-application-assignment ganesan $(EXE6) 172.18.1.${c} > .$(EXE6)rc/client-${c}
$(APPASSIGN) ganesan $(EXE6) 172.18.1.${c} > .$(EXE6)rc/client-${c}

#
#ISC Demo
Expand Down
29 changes: 11 additions & 18 deletions c0appz.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,26 +935,19 @@ int c0appz_free(void)
* c0appz_setrc()
* set c0apps resource filename
*/
int c0appz_setrc(char *rcfile)
int c0appz_setrc(char *prog)
{
char buf1[256];
char buf2[256];
char hostname[SZC0RCFILE] = {0};

/* null */
if (!rcfile) {
fprintf(stderr, "error! null rc filename.\n");
return 1;
if (!prog) {
fprintf(stderr, "error! null progname.\n");
return -EINVAL;
}

/* add hostname */
memset(buf1, 0x00, 256);
memset(buf2, 0x00, 256);
gethostname(buf1, 256);
sprintf(buf2,"%s/%s", rcfile, buf1);

/* update rc filename */
memset(c0rcfile, 0x00, SZC0RCFILE);
strncpy(c0rcfile, buf2, strlen(buf2));
gethostname(hostname, SZC0RCFILE);
snprintf(c0rcfile, SZC0RCFILE, "%s/.c0appz/%src/%s",
getenv("HOME"), prog, hostname);

/* success */
return 0;
Expand All @@ -964,11 +957,11 @@ int c0appz_setrc(char *rcfile)
* c0appz_putrc()
* print c0apps resource filename
*/
int c0appz_putrc(void)
void c0appz_putrc(void)
{
/* print rc filename */
fprintf(stderr, "%s\n", c0rcfile);
return 0;
if (trace_level > 0)
fprintf(stderr, "%s\n", c0rcfile);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions c0appz.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ int c0appz_ct(uint64_t idhi, uint64_t idlo, char *filename,
int c0appz_cp_async(uint64_t idhi, uint64_t idlo, char *filename, uint64_t bsz,
uint64_t cnt, uint32_t op_cnt, uint64_t m0bs);

int c0appz_setrc(char *rcfile);
int c0appz_putrc(void);
int c0appz_setrc(char *progname);
void c0appz_putrc(void);
int c0appz_timeout(uint64_t sz);
int c0appz_timein();
int c0appz_dump_perf(void);
Expand Down
7 changes: 1 addition & 6 deletions c0cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,7 @@ int main(int argc, char **argv)
if (argc - optind != 4)
help();

/* c0rcfile
* overwrite .cappzrc to a .[app]rc file.
*/
char str[256];
sprintf(str,"%s/.%src", dirname(argv[0]), prog);
c0appz_setrc(str);
c0appz_setrc(prog);
c0appz_putrc();

/* set input */
Expand Down
7 changes: 1 addition & 6 deletions c0ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,7 @@ int main(int argc, char **argv)
/* time in */
c0appz_timein();

/* c0rcfile
* overwrite .cappzrc to a .[app]rc file.
*/
char str[256];
sprintf(str,"%s/.%src", dirname(argv[0]), prog);
c0appz_setrc(str);
c0appz_setrc(prog);
c0appz_putrc();

/* set input */
Expand Down
7 changes: 1 addition & 6 deletions c0isc_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,7 @@ int main(int argc, char **argv)
/* time in */
c0appz_timein();

/* c0rcfile
* overwrite .cappzrc to a .[app]rc file.
*/
char str[256];
sprintf(str,"%s/.%src", dirname(argv[0]), prog);
c0appz_setrc(str);
c0appz_setrc(prog);
c0appz_putrc();

op_type = op_type_get(argv[1]);
Expand Down
8 changes: 1 addition & 7 deletions c0isc_register.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,9 @@ int main(int argc, char **argv)
/* time in */
c0appz_timein();

/* c0rcfile
* overwrite .cappzrc to a .[app]rc file.
*/
char str[256];
sprintf(str,"%s/.%src", dirname(argv[0]), prog);
c0appz_setrc(str);
c0appz_setrc(prog);
c0appz_putrc();


/* initialize resources */
if (c0appz_init(0) != 0) {
fprintf(stderr,"error! clovis initialization failed.\n");
Expand Down
7 changes: 1 addition & 6 deletions c0rm.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,7 @@ int main(int argc, char **argv)
help();
}

/* c0rcfile
* overwrite .cappzrc to a .[app]rc file.
*/
char str[256];
sprintf(str,"%s/.%src", dirname(argv[0]), prog);
c0appz_setrc(str);
c0appz_setrc(prog);
c0appz_putrc();

/* set input */
Expand Down
11 changes: 5 additions & 6 deletions mpiapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define DMPISEQ 0
#define DCLOVIS 1

char *prog;

/* main */
int main(int argc, char **argv)
{
Expand Down Expand Up @@ -70,12 +72,9 @@ int main(int argc, char **argv)
/* time in */
c0appz_timein();

/* c0rcfile
* overwrite .cappzrc to a .[app]rc file.
*/
char str[256];
sprintf(str,".%src",basename(argv[0]));
c0appz_setrc(str);
prog = basename(strdup(argv[0]));

c0appz_setrc(prog);
c0appz_putrc();

#if DMPISEQ
Expand Down

0 comments on commit 6a19993

Please sign in to comment.