Ejemplo n.º 1
0
// Return -1 for error, 0 for entry not changed, 1 for entry changed (or new).
static int found_in_current_manifest(struct asfd *asfd,
	struct sbuf *csb, struct sbuf *sb,
	struct manio *cmanio, struct manio *unmanio,
	struct blk **blk, struct conf *conf)
{
	// Located the entry in the current manifest.
	// If the file type changed, I think it is time to back it up again
	// (for example, EFS changing to normal file, or back again).
	if(csb->path.cmd!=sb->path.cmd)
	{
		if(manio_forward_through_sigs(asfd, &csb, blk, cmanio, conf)<0)
			return -1;
		return 1;
	}

	// mtime is the actual file data.
	// ctime is the attributes or meta data.
	if(csb->statp.st_mtime==sb->statp.st_mtime
	  && csb->statp.st_ctime==sb->statp.st_ctime)
	{
		// Got an unchanged file.
		if(manio_copy_entry(asfd, &csb, sb,
			blk, cmanio, unmanio, conf)<0) return -1;
		return 0;
	}

	if(csb->statp.st_mtime==sb->statp.st_mtime
	  && csb->statp.st_ctime!=sb->statp.st_ctime)
	{
		// File data stayed the same, but attributes or meta data
		// changed. We already have the attributes, but may need to
		// get extra meta data.
		// FIX THIS
		if(manio_copy_entry(asfd, &csb, sb,
			blk, cmanio, unmanio, conf)<0) return -1;
		return 0;
	}

	// File data changed.
	if(manio_forward_through_sigs(asfd, &csb, blk, cmanio, conf)<0)
		return -1;
	return 1;
}
Ejemplo n.º 2
0
// Return -1 for error, 0 for entry not changed, 1 for entry changed (or new).
static int found_in_current_manifest(struct sbuf *csb, struct sbuf *sb,
	struct manios *manios, struct asfd *chfd,
	struct cntr *cntr)
{
	// Located the entry in the current manifest.
	// If the file type changed, I think it is time to back it up again
	// (for example, EFS changing to normal file, or back again).
	if(csb->path.cmd!=sb->path.cmd)
	{
		if(manio_forward_through_sigs(csb, manios->current)<0)
			return -1;
		return 1;
	}

	// mtime is the actual file data.
	// ctime is the attributes or meta data.
	if(csb->statp.st_mtime==sb->statp.st_mtime
	  && csb->statp.st_ctime==sb->statp.st_ctime)
	{
		// Got an unchanged file.
		cntr_add_same(cntr, sb->path.cmd);
		return unchanged(csb, sb, manios, chfd);
	}

	if(csb->statp.st_mtime==sb->statp.st_mtime
	  && csb->statp.st_ctime!=sb->statp.st_ctime)
	{
		// FIX THIS:
		// File data stayed the same, but attributes or meta data
		// changed. We already have the attributes, but may need to
		// get extra meta data.
		cntr_add_same(cntr, sb->path.cmd);
		return unchanged(csb, sb, manios, chfd);
	}

	// File data changed.
	cntr_add_changed(cntr, sb->path.cmd);
	if(manio_forward_through_sigs(csb, manios->current)<0)
		return -1;
	return 1;
}