faubackup2/src/copier distributor.cpp,1.13,1.14 distributor.hpp,1.9,1.10

Erik Merkel <[email protected]> Tue, 20 Sep 2005 23:31:14 +0000
Newsgroups gmane.comp.sysutils.backup.faubackup.cvs
Message-ID <[email protected]>
Update of /cvsroot/faubackup/faubackup2/src/copier
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25478

Modified Files:
	distributor.cpp distributor.hpp 
Log Message:
fixed bug: if hardlink files are scheduled one file will be transfered and the 
others a linked against the first one. If the first one should only be 
transfered if an older copy exist and on the server are no older copys, the 
hardlinking of the other files failes.


Index: distributor.cpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/copier/distributor.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** distributor.cpp	20 Sep 2005 13:59:13 -0000	1.13
--- distributor.cpp	20 Sep 2005 23:31:12 -0000	1.14
***************
*** 13,24 ****
  extern int do_nothing;
  
! void Distributor::file_changed(Fileinfo &file)
  {
! 	if(file.getBackupMode() == KeepExisting)
  		file_unchanged(file);
  	if(do_nothing) {
  		output.information(F_("transfer file:\t%s")
  				   % file.getFilename(), DEBUG_OUTPUT);
! 		return;
  	}
  	struct stat st;
--- 13,26 ----
  extern int do_nothing;
  
! bool Distributor::file_changed(Fileinfo &file)
  {
! 	if(file.getBackupMode() == KeepExisting) {
  		file_unchanged(file);
+ 		return false;
+ 	}
  	if(do_nothing) {
  		output.information(F_("transfer file:\t%s")
  				   % file.getFilename(), DEBUG_OUTPUT);
! 		return true;
  	}
  	struct stat st;
***************
*** 39,42 ****
--- 41,45 ----
  		network->sendString(file.getFilename());
  	}
+ 	return true;
  }
  void Distributor::file_unchanged(Fileinfo &file)
***************
*** 52,56 ****
  
  }
! void Distributor::new_file(Fileinfo &file)
  {
  	if(file.getBackupMode() == KeepExisting) {
--- 55,59 ----
  
  }
! bool Distributor::new_file(Fileinfo &file)
  {
  	if(file.getBackupMode() == KeepExisting) {
***************
*** 59,71 ****
  					   % file.getFilename(), DEBUG_OUTPUT);
  		}
! 		return;
  	}
  	if(do_nothing) {
  		output.information(F_("Transfer file:\t%s")
  				   % file.getFilename(), DEBUG_OUTPUT);
! 		return;
  	}
  	network->sendByte(CopyRegFile);
  	network->sendString(file.getFilename());
  
  }
--- 62,75 ----
  					   % file.getFilename(), DEBUG_OUTPUT);
  		}
! 		return false;
  	}
  	if(do_nothing) {
  		output.information(F_("Transfer file:\t%s")
  				   % file.getFilename(), DEBUG_OUTPUT);
! 		return true;
  	}
  	network->sendByte(CopyRegFile);
  	network->sendString(file.getFilename());
+ 	return true;
  
  }
***************
*** 141,151 ****
  		string destination = i->second.getFilename();
  		dev_t deviceNo = i->second.getDeviceNo();
! 		if(i->second.getExisting())
! 			file_changed(i->second);
! 		else
! 			new_file(i->second);
  		j = result.second;
! 		if(i == j) //just one element
  			continue;
  		todelete = i;
  		i++;
--- 145,166 ----
  		string destination = i->second.getFilename();
  		dev_t deviceNo = i->second.getDeviceNo();
! 		if(i->second.getExisting()) {
! 			if(!file_changed(i->second)) //keep existing
! 			{
! 				HardlinkMap.erase(i);
! 				continue;
! 			}
! 		} else {
! 			if(!new_file(i->second)) //keep existing and file does not exist
! 			{
! 				HardlinkMap.erase(i);
! 				continue;
! 			}
! 		}
  		j = result.second;
! 		if(i == j) { //just one element
! 			HardlinkMap.erase(i);
  			continue;
+ 		}
  		todelete = i;
  		i++;
***************
*** 243,252 ****
  			} else {
  				fileinfo.setExisting(false);
! 				output.information("file does not exist: "  +
! 						   fileinfo.getFilename(), DEBUG_OUTPUT);
! 
! 				if(fileinfo.getInodeNo())
  					register_hardlink_file(fileinfo.getInodeNo(), fileinfo);
! 				else
  					new_file(fileinfo);
  			}
--- 258,266 ----
  			} else {
  				fileinfo.setExisting(false);
! 				if(fileinfo.getInodeNo()) {
! 					fileinfo.getFilename(), DEBUG_OUTPUT);
  					register_hardlink_file(fileinfo.getInodeNo(), fileinfo);
! 
! 				} else
  					new_file(fileinfo);
  			}

Index: distributor.hpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/copier/distributor.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** distributor.hpp	20 Sep 2005 13:59:13 -0000	1.9
--- distributor.hpp	20 Sep 2005 23:31:12 -0000	1.10
***************
*** 42,48 ****
  
  
! 	void file_changed(Fileinfo &file);
  	void file_unchanged(Fileinfo &file);
! 	void new_file(Fileinfo &file);
  	void no_reg_file(Fileinfo &file);
  	void sendHardlinks();
--- 42,48 ----
  
  
! 	bool file_changed(Fileinfo &file);
  	void file_unchanged(Fileinfo &file);
! 	bool new_file(Fileinfo &file);
  	void no_reg_file(Fileinfo &file);
  	void sendHardlinks();



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php