diff -C 3 -P -r root_v3.03.09/Makefile root_chirped/Makefile *** root_v3.03.09/Makefile Mon Jan 6 14:28:37 2003 --- root_chirped/Makefile Mon Jan 6 14:33:49 2003 *************** *** 116,126 **** ifneq ($(CERNLIBS),) MODULES += hbook endif ifneq ($(findstring $(MAKECMDGOALS),distclean maintainer-clean),) MODULES += unix winnt x11 x11ttf win32 win32gdk gl rfio thread pythia \ pythia6 venus table mysql pgsql sapdb srputils x3d rootx \ ! rootd proofd dcache hbook alien asimage MODULES := $(sort $(MODULES)) # removes duplicates endif --- 116,129 ---- ifneq ($(CERNLIBS),) MODULES += hbook endif + ifneq ($(CHIRPCLIENTLIB),) + MODULES += chirp + endif ifneq ($(findstring $(MAKECMDGOALS),distclean maintainer-clean),) MODULES += unix winnt x11 x11ttf win32 win32gdk gl rfio thread pythia \ pythia6 venus table mysql pgsql sapdb srputils x3d rootx \ ! rootd proofd dcache chirp hbook alien asimage MODULES := $(sort $(MODULES)) # removes duplicates endif diff -C 3 -P -r root_v3.03.09/chirp/Module.mk root_chirped/chirp/Module.mk *** root_v3.03.09/chirp/Module.mk Wed Dec 31 18:00:00 1969 --- root_chirped/chirp/Module.mk Mon Jan 6 14:33:49 2003 *************** *** 0 **** --- 1,66 ---- + # Module.mk for chirp module + # + # Author: Dan Bradley , 16/12/2002 + + + MODDIR := chirp + MODDIRS := $(MODDIR)/src + MODDIRI := $(MODDIR)/inc + + CHIRPDIR := $(MODDIR) + CHIRPDIRS := $(CHIRPDIR)/src + CHIRPDIRI := $(CHIRPDIR)/inc + + ##### libChirp ##### + CHIRPL := $(MODDIRI)/LinkDef.h + CHIRPDS := $(MODDIRS)/G__Chirp.cxx + CHIRPDO := $(CHIRPDS:.cxx=.o) + CHIRPDH := $(CHIRPDS:.cxx=.h) + + CHIRPH := $(filter-out $(MODDIRI)/LinkDef%,$(wildcard $(MODDIRI)/*.h)) + CHIRPS := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx)) + CHIRPO := $(CHIRPS:.cxx=.o) + + CHIRPDEP := $(CHIRPO:.o=.d) $(CHIRPDO:.o=.d) + + CHIRPLIB := $(LPATH)/libChirp.$(SOEXT) + + # used in the main Makefile + ALLHDRS += $(patsubst $(MODDIRI)/%.h,include/%.h,$(CHIRPH)) + ALLLIBS += $(CHIRPLIB) + + # include all dependency files + INCLUDEFILES += $(CHIRPDEP) + + ##### local rules ##### + include/%.h: $(CHIRPDIRI)/%.h + cp $< $@ + + $(CHIRPLIB): $(CHIRPO) $(CHIRPDO) $(MAINLIBS) + @$(MAKELIB) $(PLATFORM) $(LD) "$(LDFLAGS)" \ + "$(SOFLAGS)" libChirp.$(SOEXT) $@ "$(CHIRPO) $(CHIRPDO)" \ + "$(CHIRPLIBEXTRA) $(CHIRPLIBDIR) $(CHIRPCLIENTLIB)" + + $(CHIRPDS): $(CHIRPH) $(CHIRPL) $(ROOTCINTTMP) + @echo "Generating dictionary $@..." + $(ROOTCINTTMP) -f $@ -c $(CHIRPH) $(CHIRPL) + + $(CHIRPDO): $(CHIRPDS) + $(CXX) $(NOOPT) $(CXXFLAGS) -I$(CHIRPINCDIR) -I. -o $@ -c $< + + all-chirp: $(CHIRPLIB) + + clean-chirp: + @rm -f $(CHIRPO) $(CHIRPDO) + + clean:: clean-chirp + + distclean-chirp: clean-chirp + @rm -f $(CHIRPDEP) $(CHIRPDS) $(CHIRPDH) $(CHIRPLIB) + + distclean:: distclean-chirp + + ##### extra rules ###### + $(CHIRPO): %.o: %.cxx + $(CXX) $(OPT) $(CXXFLAGS) -I$(CHIRPINCDIR) -o $@ -c $< + diff -C 3 -P -r root_v3.03.09/chirp/inc/LinkDef.h root_chirped/chirp/inc/LinkDef.h *** root_v3.03.09/chirp/inc/LinkDef.h Wed Dec 31 18:00:00 1969 --- root_chirped/chirp/inc/LinkDef.h Mon Jan 6 14:33:49 2003 *************** *** 0 **** --- 1,9 ---- + #ifdef __CINT__ + + #pragma link off all globals; + #pragma link off all classes; + #pragma link off all functions; + + #pragma link C++ class TChirpFile; + + #endif diff -C 3 -P -r root_v3.03.09/chirp/inc/TChirpFile.h root_chirped/chirp/inc/TChirpFile.h *** root_v3.03.09/chirp/inc/TChirpFile.h Wed Dec 31 18:00:00 1969 --- root_chirped/chirp/inc/TChirpFile.h Mon Jan 6 14:37:54 2003 *************** *** 0 **** --- 1,64 ---- + // Author: Dan Bradley 17/12/2002 + + /************************************************************************* + * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + + #ifndef ROOT_TChirpFile + #define ROOT_TChirpFile + + + ////////////////////////////////////////////////////////////////////////// + // // + // TChirpFile // + // // + // A TChirpFile is like a normal TFile except that it reads and writes // + // its data via a Chirp server. For more information, see // + // http://www.cs.wisc.edu/condor/chirp. // + // // + ////////////////////////////////////////////////////////////////////////// + + + #ifndef ROOT_TFile + #include "TFile.h" + #endif + + class TChirpFile : public TFile { + + private: + Seek_t fOffset; + struct chirp_client *chirp_client; + + TChirpFile(): fOffset(0),chirp_client(0) { } + + // Interface to basic system I/O routines + Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode); + Int_t SysClose(Int_t fd); + Int_t SysRead(Int_t fd, void *buf, Int_t len); + Int_t SysWrite(Int_t fd, const void *buf, Int_t len); + Seek_t SysSeek(Int_t fd, Seek_t offset, Int_t whence); + Int_t SysStat(Int_t fd, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime); + Int_t SysSync(Int_t fd); + + Int_t OpenChirpClient(const char *URL,char const **path); + Int_t CloseChirpClient(); + + public: + TChirpFile(const char *path, Option_t *option="", + const char *ftitle="", Int_t compress=1); + + ~TChirpFile(); + + Bool_t ReadBuffer(char *buf, Int_t len); + Bool_t WriteBuffer(const char *buf, Int_t len); + + void ResetErrno() const; + + ClassDef(TChirpFile,0) //A ROOT file that reads/writes via a Chirp server + }; + + #endif diff -C 3 -P -r root_v3.03.09/chirp/src/TChirpFile.cxx root_chirped/chirp/src/TChirpFile.cxx *** root_v3.03.09/chirp/src/TChirpFile.cxx Wed Dec 31 18:00:00 1969 --- root_chirped/chirp/src/TChirpFile.cxx Wed Jan 8 10:56:53 2003 *************** *** 0 **** --- 1,319 ---- + // Author: Dan Bradley 17/12/2002 + + /************************************************************************* + * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + + ////////////////////////////////////////////////////////////////////////// + // // + // TChirpFile // + // // + // A TChirpFile is like a normal TFile except that it may read and // + // write its data via a Chirp server (for more on the Chirp protocol // + // see http://www.cs.wisc.edu/condor/chirp). // + // // + ////////////////////////////////////////////////////////////////////////// + + #include "TChirpFile.h" + #include "TError.h" + #include "TSystem.h" + #include "TROOT.h" + + #include + #include + #include + + #include "chirp_client.h" + + //______________________________________________________________________________ + static const char* const CHIRP_PREFIX = "chirp:"; + static const size_t CHIRP_PREFIX_LEN = 6; + + //______________________________________________________________________________ + ClassImp(TChirpFile) + + //______________________________________________________________________________ + TChirpFile::TChirpFile(const char *path, Option_t *option, + const char *ftitle, Int_t compress): + TFile(path, "NET", ftitle, compress) + { + //Passing option "NET" to prevent base-class from doing any local access. + fOption = option; + + fOffset = 0; + chirp_client = NULL; + + Bool_t create = kFALSE; + if (!fOption.CompareTo("NEW", TString::kIgnoreCase) || + !fOption.CompareTo("CREATE", TString::kIgnoreCase)) + create = kTRUE; + Bool_t recreate = fOption.CompareTo("RECREATE", TString::kIgnoreCase) + ? kFALSE : kTRUE; + Bool_t update = fOption.CompareTo("UPDATE", TString::kIgnoreCase) + ? kFALSE : kTRUE; + Bool_t read = fOption.CompareTo("READ", TString::kIgnoreCase) + ? kFALSE : kTRUE; + if (!create && !recreate && !update && !read) { + read = kTRUE; + fOption = "READ"; + } + + char const *path_part; + const char *fname; + + if( OpenChirpClient(path,&path_part) ) { + SysError("TChirpFile", "chirp client for %s can not be opened", path); + goto zombie; + } + + SetName(path_part); + + fname = GetName(); + + if (create || update || recreate) { + Int_t mode = O_RDWR | O_CREAT; + if(recreate) mode |= O_TRUNC; + + #ifndef WIN32 + fD = SysOpen(fname, mode, 0644); + #else + fD = SysOpen(fname, mode | O_BINARY, S_IREAD | S_IWRITE); + #endif + if (fD == -1) { + SysError("TChirpFile", "file %s can not be opened", fname); + goto zombie; + } + fWritable = kTRUE; + } else { + #ifndef WIN32 + fD = SysOpen(fname, O_RDONLY, 0644); + #else + fD = SysOpen(fname, O_RDONLY | O_BINARY, S_IREAD | S_IWRITE); + #endif + if (fD == -1) { + SysError("TFile", "file %s can not be opened for reading", fname); + goto zombie; + } + fWritable = kFALSE; + } + + Init(create || recreate); + + return; + + zombie: + // error in file opening occured, make this object a zombie + MakeZombie(); + gDirectory = gROOT; + } + + //______________________________________________________________________________ + TChirpFile::~TChirpFile() + { + // Close and cleanup Chirp file. + + Close(); + CloseChirpClient(); + } + + //______________________________________________________________________________ + Bool_t TChirpFile::ReadBuffer(char *buf, Int_t len) + { + // Read specified byte range from remote file via Chirp daemon. + // Returns kTRUE in case of error. + + if (fCache) { + Int_t st; + Seek_t off = fOffset; + if ((st = fCache->ReadBuffer(fOffset, buf, len)) < 0) { + Error("ReadBuffer", "error reading from cache"); + return kTRUE; + } + if (st > 0) { + // fOffset might have been changed via TCache::ReadBuffer(), reset it + fOffset = off + len; + return kFALSE; + } + } + + return TFile::ReadBuffer(buf, len); + } + + //______________________________________________________________________________ + Bool_t TChirpFile::WriteBuffer(const char *buf, Int_t len) + { + // Write specified byte range to remote file via Chirp daemon. + // Returns kTRUE in case of error. + + if (!IsOpen() || !fWritable) return kTRUE; + + if (fCache) { + Int_t st; + Seek_t off = fOffset; + if ((st = fCache->WriteBuffer(fOffset, buf, len)) < 0) { + Error("WriteBuffer", "error writing to cache"); + return kTRUE; + } + if (st > 0) { + // fOffset might have been changed via TCache::WriteBuffer(), reset it + fOffset = off + len; + return kFALSE; + } + } + + return TFile::WriteBuffer(buf, len); + } + + //------------------------------------------------------------------------------ + //Caller should delete [] path when finished. + //URL format: chirp:machine.name:port/path + // or: chirp:path (use default connection to Condor job manager) + + Int_t TChirpFile::OpenChirpClient(char const *URL,char const **path_part) { + *path_part = NULL; + + CloseChirpClient(); + + chirp_client = chirp_client_connect_url(URL,path_part); + + if(!chirp_client) { + gSystem->SetErrorStr(strerror(errno)); + return -1; + } + return 0; + } + + //------------------------------------------------------------------------------ + Int_t TChirpFile::CloseChirpClient() { + if(chirp_client) { + struct chirp_client *c = chirp_client; + chirp_client = NULL; + + chirp_client_disconnect(c); + } + + return 0; + } + + //______________________________________________________________________________ + Int_t TChirpFile::SysOpen(const char *pathname, Int_t flags, UInt_t mode) + { + + char open_flags[8]; + char *f = open_flags; + + if((flags & O_WRONLY) || (flags & O_RDWR)) *(f++) = 'w'; + if((flags & O_RDONLY) || (flags & O_RDWR) || !flags) *(f++) = 'r'; + if(flags & O_APPEND) *(f++) = 'a'; + if(flags & O_CREAT) *(f++) = 'c'; + if(flags & O_TRUNC) *(f++) = 't'; + if(flags & O_EXCL) *(f++) = 'x'; + + *f = '\0'; + + Int_t rc = chirp_client_open(chirp_client, pathname, open_flags, (Int_t) mode); + + if (rc < 0) { + gSystem->SetErrorStr(strerror(errno)); + } + + return rc; + } + + //______________________________________________________________________________ + Int_t TChirpFile::SysClose(Int_t fd) + { + Int_t rc = chirp_client_close(chirp_client,fd); + + if (rc < 0) { + gSystem->SetErrorStr(strerror(errno)); + } + + return rc; + } + + //______________________________________________________________________________ + Int_t TChirpFile::SysRead(Int_t fd, void *buf, Int_t len) + { + fOffset += len; + + Int_t rc = chirp_client_read(chirp_client, fd, buf, len); + + if (rc < 0) { + gSystem->SetErrorStr(strerror(errno)); + } + + return rc; + } + + //______________________________________________________________________________ + Int_t TChirpFile::SysWrite(Int_t fd, const void *buf, Int_t len) + { + fOffset += len; + + Int_t rc = chirp_client_write(chirp_client, fd, (char *)buf, len); + + if (rc < 0) { + gSystem->SetErrorStr(strerror(errno)); + } + + return rc; + } + + //______________________________________________________________________________ + Seek_t TChirpFile::SysSeek(Int_t fd, Seek_t offset, Int_t whence) + { + if(whence == SEEK_SET && offset == fOffset) return offset; + + Int_t rc = chirp_client_lseek(chirp_client, fd, offset, whence); + + if (rc < 0) { + gSystem->SetErrorStr(strerror(errno)); + } + else { + fOffset = rc; + } + + return rc; + } + + //______________________________________________________________________________ + Int_t TChirpFile::SysSync(Int_t fd) + { + + Int_t rc = chirp_client_fsync(chirp_client, fd); + + if (rc < 0) { + gSystem->SetErrorStr(strerror(errno)); + } + + return rc; + } + + //______________________________________________________________________________ + Int_t TChirpFile::SysStat(Int_t fd, Long_t *id, Long_t *size, + Long_t *flags, Long_t *modtime) + { + // FIXME: chirp library doesn't (yet) provide any stat() + // capabilities + + *id = ::Hash(GetName()); + + Seek_t offset = fOffset; + *size = SysSeek(fd, 0, SEEK_END); + SysSeek(fd, offset, SEEK_SET); + + *flags = 0; + *modtime = 0; + return 0; + } + + //______________________________________________________________________________ + void TChirpFile::ResetErrno() const + { + TSystem::ResetErrno(); + } diff -C 3 -P -r root_v3.03.09/config/Makefile.in root_chirped/config/Makefile.in *** root_v3.03.09/config/Makefile.in Mon Jan 6 14:28:40 2003 --- root_chirped/config/Makefile.in Mon Jan 6 14:33:49 2003 *************** *** 73,78 **** --- 73,82 ---- DCAPLIB := @dcaplib@ DCAPINCDIR := @dcapincdir@ + CHIRPLIBDIR := @chirplibdir@ + CHIRPCLIENTLIB := @chirplib@ + CHIRPINCDIR := @chirpincdir@ + ALIENLIBDIR := @alienlibdir@ ALIENCLILIB := @alienlib@ ALIENINCDIR := @alienincdir@ diff -C 3 -P -r root_v3.03.09/config/rootrc.in root_chirped/config/rootrc.in *** root_v3.03.09/config/rootrc.in Mon Jan 6 14:28:40 2003 --- root_chirped/config/rootrc.in Mon Jan 6 14:33:49 2003 *************** *** 133,138 **** --- 133,139 ---- # Plugin library handlers Plugin.TFile: ^rfio: TRFIOFile RFIO "TRFIOFile(const char*,Option_t*,const char*,Int_t)" +Plugin.TFile: ^dcache: TDCacheFile DCache "TDCacheFile(const char*,Option_t*,const char*,Int_t)" + +Plugin.TFile: ^chirp: TChirpFile Chirp "TChirpFile(const char*,Option_t*,const char*,Int_t)" Plugin.TSQLServer: ^mysql: TMySQLServer MySQL "TMySQLServer(const char*,const char*,const char*)" +Plugin.TSQLServer: ^pgsql: TPgSQLServer PgSQL "TPgSQLServer(const char*,const char*,const char*)" +Plugin.TSQLServer: ^sapdb: TSapDBServer SapDB "TSapDBServer(const char*,const char*,const char*)" diff -C 3 -P -r root_v3.03.09/configure root_chirped/configure *** root_v3.03.09/configure Mon Jan 6 14:28:40 2003 --- root_chirped/configure Mon Jan 6 14:33:49 2003 *************** *** 24,29 **** --- 24,30 ---- enable_asimage=yes enable_cern=yes enable_dcache=yes + enable_chirp=yes enable_krb5=yes enable_mysql=yes enable_opengl=yes *************** *** 50,56 **** enable_sapdb enable_shadowpw enable_shared enable_soversion \ enable_srp enable_table enable_thread enable_ttf enable_venus \ enable_krb5 enable_exceptions enable_openiv enable_alien \ ! enable_asimage" ###################################################################### --- 51,57 ---- enable_sapdb enable_shadowpw enable_shared enable_soversion \ enable_srp enable_table enable_thread enable_ttf enable_venus \ enable_krb5 enable_exceptions enable_openiv enable_alien \ ! enable_asimage enable_chirp" ###################################################################### *************** *** 310,315 **** --- 311,317 ---- asimage Image processing support, requires libAfterImage cern CERNLIB usage, build h2root and g2root dcache dCache support, requires libdcap from DESY + chirp Chirp support (Condor remote I/O proxy) krb5 Kerberos5 support, requires Kerberos libs mysql MySQL support, requires libmysqlclient opengl OpenGL support, requires libGL and libGLU *************** *** 337,342 **** --- 339,346 ---- cern-libdir HBOOK converter, location of CERNLIB libraries dcap-incdir dCache support, location of dcap.h dcap-libdir dCache support, location of libdcap + chirp-incdir Chirp support, location of chirp_client.h + chirp-libdir Chirp support, location of libchirp_client krb5 Kerberos5 support, location of Kerberos distribution mysql-incdir MySQL support, location of mysql.h mysql-libdir MySQL support, location of libmysqlclient *************** *** 430,435 **** --- 434,441 ---- --with-cern-libdir=*) cernlibdir=$optarg ; enable_cern="yes" ;; --with-dcap-incdir=*) dcapincdir=$optarg ; enable_dcache="yes" ;; --with-dcap-libdir=*) dcaplibdir=$optarg ; enable_dcache="yes" ;; + --with-chirp-incdir=*) chirpincdir=$optarg ; enable_chirp="yes" ;; + --with-chirp-libdir=*) chirplibdir=$optarg ; enable_chirp="yes" ;; --with-krb5=*) krb5dir=$optarg ; enable_krb5="yes" ;; --with-mysql-incdir=*) mysqlincdir=$optarg ; enable_mysql="yes" ;; --with-mysql-libdir=*) mysqllibdir=$optarg ; enable_mysql="yes" ;; *************** *** 1018,1023 **** --- 1024,1054 ---- ###################################################################### # + ### echo %%% Chirp Support - Third party libraries + # + # + # Check for libchirp_client + # + if test ! "x$enable_chirp" = "xno" ; then + check_header "chirp_client.h" "$chirpincdir" \ + /opt/chirp/include /usr/include /usr/local/include + chirpincdir=$found_dir + + #At this time, libchirp_client.a should always be prefered over .so, + #to avoid problems with linkage on grid execute machines. + + check_library "libchirp_client" "no" "$chirplibdir" \ + /opt/chirp/lib /usr/lib /usr/local/lib + chirplib=$found_lib + chirplibdir=$found_dir + + if test "x$chirpincdir" = "x" || test "x$chirplib" = "x"; then + enable_chirp="no" + fi + fi + + ###################################################################### + # ### echo %%% AliEn Support - Third party libraries # # (See http://alien.cern.ch) *************** *** 1477,1482 **** --- 1508,1516 ---- -e "s|@dcapincdir@|$dcapincdir|" \ -e "s|@dcaplib@|$dcaplib|" \ -e "s|@dcaplibdir@|$dcaplibdir|" \ + -e "s|@chirpincdir@|$chirpincdir|" \ + -e "s|@chirplib@|$chirplib|" \ + -e "s|@chirplibdir@|$chirplibdir|" \ -e "s|@docdir@|$docdir|" \ -e "s|@elispdir@|$elispdir|" \ -e "s|@enable_table@|$enable_table|" \ Only in root_v3.03.09: new Only in root_v3.03.09: star