Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SUNCC = CC
SUNcc = cc

S86OPT = -D_REENTRANT -DOO_STD $(NLGR) -DSUN -DSUNX86 -Wno-deprecated
S86OPT = $(SUNOPT) -DSUNX86
S86OPT = $(SUNOPT) -DSUNX86

S86CC = CC
S86cc = gcc
Expand Down Expand Up @@ -77,6 +77,8 @@ SOURCE = \
bbcp_Args.C \
bbcp_BuffPool.C \
bbcp_C32.C \
bbcp_C32C.C \
bbcp_C32_Zip.C \
bbcp_ChkSum.C \
bbcp_Config.C \
bbcp_Emsg.C \
Expand Down Expand Up @@ -116,6 +118,8 @@ OBJECT = \
$(OBJDIR)/bbcp_Args.o \
$(OBJDIR)/bbcp_BuffPool.o \
$(OBJDIR)/bbcp_C32.o \
$(OBJDIR)/bbcp_C32C.o \
$(OBJDIR)/bbcp_C32_Zip.o \
$(OBJDIR)/bbcp_ChkSum.o \
$(OBJDIR)/bbcp_Config.o \
$(OBJDIR)/bbcp_Emsg.o \
Expand Down Expand Up @@ -154,7 +158,7 @@ TARGET = $(BINDIR)/bbcp


all:
@make `uname` OSVER=`../MakeSname` RELEASE=`../MakeSname -r`
@+make `uname` OSVER=`../MakeSname` RELEASE=`../MakeSname -r`
@echo Make done.

doitall: $(TARGET)
Expand Down Expand Up @@ -191,21 +195,21 @@ FreeBSD:
LIBS="$(BSDLIBS)"

Linux:
@make makeLinux`/bin/uname -i` \
@+make makeLinux`/bin/uname -i` \
MD5HEADER=bbcp_MD5_openssl.h \
OBJMD5="$(OBJDIR)/bbcp_MD5_openssl.o"

makeLinuxi386:
@make $(MKPARMS) \
@+make $(MKPARMS) \
CC=$(LNXCC) \
BB=$(LNXcc) \
CFLAGS="$(ENVCFLAGS) $(LNXOPT)" \
BFLAGS="$(ENVCFLAGS) $(LNXOPT_B)" \
INCLUDE="$(ENVINCLUDE)" \
LIBS="$(LNXLIBS32)"

makeLinuxx86_64:
@make $(MKPARMS) RR=$(RELNUM) \
makeLinuxx86_64 makeLinuxaarch64:
@+make $(MKPARMS) RR=$(RELNUM) \
CC=$(LNXCC) \
BB=$(LNXcc) \
CFLAGS="$(ENVCFLAGS) $(LNXOPT)" \
Expand All @@ -214,7 +218,7 @@ makeLinuxx86_64:
LIBS="$(LNXLIBS64)"

Darwin:
@MACOSX_DEPLOYMENT_TARGET=10.5;\
@MACOSX_DEPLOYMENT_TARGET=10.11;\
make $(MKPARMS) \
CC=$(MACCC) \
BB=$(MACcc) \
Expand Down Expand Up @@ -282,8 +286,16 @@ $(OBJDIR)/bbcp_C32.o: bbcp_C32.C bbcp_C32.h bbcp_ChkSum.h bbcp_Endian.h
@echo Compiling bbcp_C32.C
@$(CC) -c $(CFLAGS) $(INCLUDE) $(*F).C -o $(OBJDIR)/$(*F).o

$(OBJDIR)/bbcp_C32C.o: bbcp_C32C.C bbcp_C32C.h bbcp_ChkSum.h bbcp_Endian.h
@echo Compiling bbcp_C32C.C
@$(CC) -c $(CFLAGS) $(INCLUDE) $(*F).C -o $(OBJDIR)/$(*F).o

$(OBJDIR)/bbcp_C32_Zip.o: bbcp_C32_Zip.C bbcp_C32_Zip.h bbcp_ChkSum.h bbcp_Endian.h
@echo Compiling bbcp_C32_Zip.C
@$(CC) -c $(CFLAGS) $(INCLUDE) $(*F).C -o $(OBJDIR)/$(*F).o

$(OBJDIR)/bbcp_ChkSum.o: bbcp_ChkSum.C bbcp_ChkSum.h bbcp_Endian.h \
bbcp_A32.h bbcp_A32_zlib.h bbcp_C32.h bbcp_MD5.h $(MD5HEADER)
bbcp_A32.h bbcp_A32_zlib.h bbcp_C32.h bbcp_C32_Zip.h bbcp_MD5.h $(MD5HEADER)
@echo Compiling bbcp_ChkSum.C
@$(CC) -c $(CFLAGS) $(INCLUDE) $(*F).C -o $(OBJDIR)/$(*F).o

Expand Down
51 changes: 26 additions & 25 deletions src/bbcp.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
/* */
/* b b c p . C */
/* */
/*(c) 2010-14 by the Board of Trustees of the Leland Stanford, Jr., University*//* All Rights Reserved. See bbcp_Version.C for complete License Terms */
/*(c) 2010-17 by the Board of Trustees of the Leland Stanford, Jr., University*/
/* All Rights Reserved. See bbcp_Version.C for complete License Terms */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
Expand Down Expand Up @@ -65,7 +66,7 @@
/* G l o b a l V a r i a b l e s */
/******************************************************************************/

extern bbcp_Config bbcp_Config;
extern bbcp_Config bbcp_Cfg;

extern bbcp_BuffPool bbcp_BuffPool;

Expand All @@ -90,20 +91,20 @@ int main(int argc, char *argv[], char *envp[])
// Process configuration file
//
bbcp_OS.EnvP = envp;
if (bbcp_Config.ConfigInit(argc, argv)) exit(1);
if (bbcp_Cfg.ConfigInit(argc, argv)) exit(1);

// Process the arguments
//
bbcp_Config.Arguments(argc, argv);
bbcp_Cfg.Arguments(argc, argv);

// Process final source/sink actions here
//
if (bbcp_Config.Options & (bbcp_SRC | bbcp_SNK))
if (bbcp_Cfg.Options & (bbcp_SRC | bbcp_SNK))
{int retc;
bbcp_ProcMon theAgent;
theAgent.Start(bbcp_OS.getGrandP());
{bbcp_Node SS_Node;
retc = (bbcp_Config.Options & bbcp_SRC
retc = (bbcp_Cfg.Options & bbcp_SRC
? Protocol.Process(&SS_Node)
: Protocol.Request(&SS_Node));
}
Expand All @@ -113,46 +114,46 @@ int main(int argc, char *argv[], char *envp[])
// Do some debugging here
//
Elapsed_Timer.Start();
if (bbcp_Debug.Trace > 2) bbcp_Config.Display();
if (bbcp_Debug.Trace > 2) bbcp_Cfg.Display();

// Allocate the source and sink node and common protocol
//
Source = new bbcp_Node;
Sink = new bbcp_Node;
tfs = bbcp_Config.snkSpec;
tfs = bbcp_Cfg.snkSpec;

// Allocate the log file
//
if (bbcp_Config.Logfn)
{bbcp_Config.MLog = new bbcp_LogFile();
if (bbcp_Config.MLog->Open(bbcp_Config.Logfn)) exit(5);
if (bbcp_Cfg.Logfn)
{bbcp_Cfg.MLog = new bbcp_LogFile();
if (bbcp_Cfg.MLog->Open(bbcp_Cfg.Logfn)) exit(5);
}

// Grab all source files for each particular user/host and copy them
//
retc = 0;
while(!retc && (psp = bbcp_Config.srcSpec))
while(!retc && (psp = bbcp_Cfg.srcSpec))
{fsp = psp->next;
while(fsp && Same(fsp->username, psp->username)
&& Same(fsp->hostname, psp->hostname))
{psp = fsp; fsp = fsp->next;}
psp->next = 0;
sfs = bbcp_Config.srcSpec;
bbcp_Config.srcSpec = fsp;
if (bbcp_Config.Options & bbcp_CON2SRC)
sfs = bbcp_Cfg.srcSpec;
bbcp_Cfg.srcSpec = fsp;
if (bbcp_Cfg.Options & bbcp_CON2SRC)
retc = Protocol.Schedule(Source, sfs,
(char *)bbcp_Config.SrcXeq,
(char *)bbcp_Config.SrcArg,
(char *)bbcp_Cfg.SrcXeq,
(char *)bbcp_Cfg.SrcArg,
Sink, tfs,
(char *)bbcp_Config.SnkXeq,
(char *)bbcp_Config.SnkArg, Sink);
(char *)bbcp_Cfg.SnkXeq,
(char *)bbcp_Cfg.SnkArg, Sink);
else
retc = Protocol.Schedule(Sink, tfs,
(char *)bbcp_Config.SnkXeq,
(char *)bbcp_Config.SnkArg,
(char *)bbcp_Cfg.SnkXeq,
(char *)bbcp_Cfg.SnkArg,
Source, sfs,
(char *)bbcp_Config.SrcXeq,
(char *)bbcp_Config.SrcArg, Sink);
(char *)bbcp_Cfg.SrcXeq,
(char *)bbcp_Cfg.SrcArg, Sink);
TotFiles += Sink->TotFiles;
TotBytes += Sink->TotBytes;
}
Expand All @@ -165,7 +166,7 @@ int main(int argc, char *argv[], char *envp[])
// Report final statistics if wanted
//
DEBUG("Ending; rc=" <<retc <<" files=" <<TotFiles <<" bytes=" <<TotBytes);
if (bbcp_Config.Options & bbcp_VERBOSE
if (bbcp_Cfg.Options & bbcp_VERBOSE
&& !retc && TotFiles && TotBytes)
{double ttime;
char buff[128];
Expand All @@ -176,6 +177,6 @@ int main(int argc, char *argv[], char *envp[])
cerr <<TotFiles <<(TotFiles != 1 ? " files" : " file");
cerr <<" copied at effectively " <<buff <<endl;
}
if (bbcp_Config.MLog) delete bbcp_Config.MLog;
if (bbcp_Cfg.MLog) delete bbcp_Cfg.MLog;
exit(retc);
}
3 changes: 2 additions & 1 deletion src/bbcp_A32.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/* */
/* b b c p _ A 3 2 . h */
/* */
/*(c) 2010-14 by the Board of Trustees of the Leland Stanford, Jr., University*//* All Rights Reserved. See bbcp_Version.C for complete License Terms *//* All Rights Reserved */
/*(c) 2010-17 by the Board of Trustees of the Leland Stanford, Jr., University*/
/* All Rights Reserved. See bbcp_Version.C for complete License Terms */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
Expand Down
24 changes: 18 additions & 6 deletions src/bbcp_A32_zlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/* */
/* b b c p _ A 3 2 . h */
/* */
/*(c) 2010-14 by the Board of Trustees of the Leland Stanford, Jr., University*//* All Rights Reserved. See bbcp_Version.C for complete License Terms *//* All Rights Reserved */
/*(c) 2010-17 by the Board of Trustees of the Leland Stanford, Jr., University*/
/* All Rights Reserved. See bbcp_Version.C for complete License Terms */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
Expand Down Expand Up @@ -50,13 +51,23 @@ class bbcp_A32_zlib : public bbcp_ChkSum

int csSize() {return sizeof(adler);}

char *csCurr(char **Text=0) {
curradler = finish(Text);
return (char *)&curradler;
}

char *Final(char **Text=0) {

adler = finish(Text);
return (char *)&adler;
}

uLong finish(char **Text) {
uLong the_adler = adler;
#ifndef BBCP_BIG_ENDIAN
adler = htonl(adler);
the_adler = htonl(the_adler);
#endif
if (Text) *Text = x2a((char *)&adler);
return (char *)&adler;
if (Text) *Text = x2a((char *)&the_adler);
return the_adler;
}

const char *Type() {return "a32";}
Expand All @@ -66,6 +77,7 @@ class bbcp_A32_zlib : public bbcp_ChkSum

private:
uLong adler;

uLong curradler;

};
#endif
30 changes: 19 additions & 11 deletions src/bbcp_Args.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
/* */
/* b b c p _ A r g s . C */
/* */
/*(c) 2002-14 by the Board of Trustees of the Leland Stanford, Jr., University*//* All Rights Reserved. See bbcp_Version.C for complete License Terms *//* All Rights Reserved */
/*(c) 2002-17 by the Board of Trustees of the Leland Stanford, Jr., University*/
/* All Rights Reserved. See bbcp_Version.C for complete License Terms */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
Expand All @@ -28,15 +29,12 @@
#include <stdlib.h>
#include <strings.h>
#include "bbcp_Args.h"
#include "bbcp_Config.h"
#include "bbcp_Headers.h"

/******************************************************************************/
/* G l o b a l O b j e c t s */
/******************************************************************************/

extern bbcp_Config bbcp_Config;

/******************************************************************************/
/* L o c a l C l a s s e s */
/******************************************************************************/
Expand Down Expand Up @@ -130,10 +128,17 @@ char *bbcp_Args::getarg(int newln)
/******************************************************************************/
/* g e t o p t */
/******************************************************************************/
extern const char *bbcp_HostName;

char bbcp_Args::getopt()
{
char optval, optbuff[2] = {0,0}, *optspec, *arglist, *theOpt = optbuff;
char optval, *optspec, *arglist;

// Do some required initialization
//
optbuff[0] = 0;
optbuff[1] = 0;
theOpt = optbuff;

// Check if we really have any more options
//
Expand All @@ -145,6 +150,7 @@ char bbcp_Args::getopt()
else if (inStream)
{if (MOA) arglist = arg_stream.GetLine();
else arglist = (char *)"";

if (arglist && (curopt = arg_stream.GetToken(&arglist)))
{if (*curopt != '-') {arg_stream.RetToken(); curopt = 0;}
else curopt++;
Expand All @@ -164,14 +170,13 @@ char bbcp_Args::getopt()

// Check for extended options or single letter option
//
if (optp && strlen(curopt) > 2 && *curopt == '-'
&& (optspec = *optp%(curopt+1)))
{theOpt = curopt; curopt = 0;
if (!(optspec = index(vopts, *optspec)))
if (optp && strlen(curopt) > 2 && *curopt == '-')
{if (!(optspec = *optp%(curopt+1))
|| !(optspec = index(vopts, *optspec)))
{cerr <<epfx <<"Invalid option, '-" <<theOpt <<"'." <<endl;
endopts = 1;
return '?';
}
} else {theOpt = curopt; curopt = 0;}
}
else if (!(optspec = index(vopts, *curopt))
|| *curopt == ':' || *curopt == '.')
Expand All @@ -187,7 +192,10 @@ char bbcp_Args::getopt()

// Get the argument from whatever source we have
//
if (inStream) argval = (MOA ? arglist : arg_stream.GetToken());
if (inStream)
{argval = (MOA ? arglist : arg_stream.GetToken());
curopt = 0;
}
else argval = (Aloc < Argc ? Argv[Aloc++] : 0);

// If we have a valid argument, then we are all done
Expand Down
5 changes: 4 additions & 1 deletion src/bbcp_Args.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/* */
/* b b c p _ A r g s . h */
/* */
/*(c) 2002-14 by the Board of Trustees of the Leland Stanford, Jr., University*//* All Rights Reserved. See bbcp_Version.C for complete License Terms *//* All Rights Reserved */
/*(c) 2002-17 by the Board of Trustees of the Leland Stanford, Jr., University*/
/* All Rights Reserved. See bbcp_Version.C for complete License Terms */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
Expand Down Expand Up @@ -52,6 +53,7 @@ void Options(char *opts, int argc, char **argv);
~bbcp_Args();

char *argval;
char *theOpt;

private:

Expand All @@ -64,6 +66,7 @@ int inStream;
int endopts;
int Argc;
int Aloc;
char optbuff[2];
char **Argv;
bbcp_Stream arg_stream;
};
Expand Down
3 changes: 2 additions & 1 deletion src/bbcp_BuffPool.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
/* */
/* b b c p _ B u f f P o o l . C */
/* */
/*(c) 2002-14 by the Board of Trustees of the Leland Stanford, Jr., University*//* All Rights Reserved. See bbcp_Version.C for complete License Terms *//* All Rights Reserved */
/*(c) 2002-17 by the Board of Trustees of the Leland Stanford, Jr., University*/
/* All Rights Reserved. See bbcp_Version.C for complete License Terms */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
Expand Down
Loading