rpms/mfstools/EL-4 mfstools-cvs20060914.patch, NONE, 1.1 mfstools-fixllseek.patch, NONE, 1.1 mfstools.spec, 1.8, 1.9

Tom Callaway (spot) fedora-extras-commits at redhat.com
Thu Aug 2 13:13:46 UTC 2007


Author: spot

Update of /cvs/extras/rpms/mfstools/EL-4
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv23408/EL-4

Modified Files:
	mfstools.spec 
Added Files:
	mfstools-cvs20060914.patch mfstools-fixllseek.patch 
Log Message:

bring EL-4 up to date


mfstools-cvs20060914.patch:

--- NEW FILE mfstools-cvs20060914.patch ---
diff -urp MFSTools-snapshot050221/backup/backmain.c mfstools/backup/backmain.c
--- MFSTools-snapshot050221/backup/backmain.c	2005-02-21 21:36:22.000000000 -0600
+++ mfstools/backup/backmain.c	2005-02-23 03:24:34.000000000 -0600
@@ -269,7 +269,11 @@ backup_main (int argc, char **argv)
 		if (filename[0] == '-' && filename[1] == '\0')
 			fd = 1;
 		else
+#if O_LARGEFILE
+			fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, 0644);
+#else
 			fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+#endif
 
 		if (fd < 0)
 		{
diff -urp MFSTools-snapshot050221/backup/backup.c mfstools/backup/backup.c
--- MFSTools-snapshot050221/backup/backup.c	2005-02-21 22:23:06.000000000 -0600
+++ mfstools/backup/backup.c	2005-03-02 02:46:01.000000000 -0600
@@ -31,406 +31,136 @@
 #include "macpart.h"
 #include "backup.h"
 
-struct blocklist
-{
-	int backup;
-	unsigned int sector;
-	struct blocklist *next;
-};
-
-/***************************************************************************/
-/* Allocate a block from the given block pool.  If the pool is dry, calloc */
-/* it.  Either way, the returned block shall be zeroed out. */
-static struct blocklist *
-alloc_block (struct blocklist **pool)
-{
-	struct blocklist *newblock = *pool;
-
-	if (newblock)
-	{
-		*pool = newblock->next;
-		newblock->sector = 0;
-		newblock->backup = 0;
-		newblock->next = 0;
-	}
-	else
-	{
-		newblock = calloc (sizeof (*newblock), 1);
-	}
-
-	return newblock;
-}
-
-/*******************************/
-/* Return a block to the pool. */
-static void
-free_block (struct blocklist **pool, struct blocklist *block)
-{
-	block->next = *pool;
-	*pool = block;
-}
-
-/***********************************************************************/
-/* Free an entire list of blocks.  This can be used to cleanup a pool. */
-static void
-free_block_list (struct blocklist **blocks)
-{
-	while (*blocks)
-	{
-		struct blocklist *tmp = *blocks;
-		*blocks = tmp->next;
-		free (tmp);
-	}
-}
-
-/*********************************/
-/* Free an array of block lists. */
-static void
-free_block_list_array (struct blocklist **blocks)
+/**************************************************************/
+/* Add an inode to the list, allocating more space if needed. */
+static int
+backup_inode_list_add (unsigned **list, unsigned *allocated, unsigned *total, unsigned val)
 {
-	while (*blocks)
+/* No space, (re)allocate space. */
+	if (*allocated <= *total)
 	{
-		free_block_list (blocks);
-		blocks++;
+		*allocated += 32;
+		*list = realloc (*list, *allocated * sizeof (val));
 	}
-}
-
-/***********************************************************************/
-/* Concatenates an array of block lists into a single list.  This list */
-/* should be read or free only.  Any write to it will likely confuse the */
-/* add function. */
-static struct blocklist *
-block_list_array_concat (struct blocklist **blocks)
-{
-	struct blocklist *res = NULL;
-	struct blocklist **last = &res;
 
-	while (*blocks)
-	{
-		*last = *blocks;
+/* Allocation error. */
+	if (!*list)
+		return -1;
 
-		while (*last)
-		{
-			last = &(*last)->next;
-		}
-		*blocks = 0;
-		blocks++;
-	}
+/* Append the value to the end of the list. */
+	(*list)[(*total)++] = val;
 
-	return res;
+	return 0;
 }
 
-/************************************************/
-/* Add a block to the list of blocks to backup. */
-static int
-backup_add_block (struct blocklist **blocks, unsigned int *partstart, struct blocklist **pool, int sector, int count)
+/*****************************************************************/
+/* Scan the inode table and generate a list of inodes to backup. */
+unsigned
+backup_scan_inodes (struct backup_info *info)
 {
-	struct blocklist **loop;
-	struct blocklist *prev = 0;
-
-	while (partstart[1] <= sector)
-	{
-		partstart++;
-		blocks++;
-	}
+	unsigned int loop, loop2, loop3;
+	int ninodes = mfs_inode_count (info->mfs);
+	unsigned int highest = 0;
 
-/* A little debug here and there never hurt anything. */
+	unsigned int appsectors = 0, mediasectors = 0;
 #if DEBUG
-	fprintf (stderr, "Adding block %d of %d from volume at %d\n", sector, count, partstart[0]);
+	unsigned int mediainodes = 0, appinodes = 0;
 #endif
 
-/* Find where in the list this block fits.  This will return with &loop */
-/* pointing to the first block with a sector number greater than the new */
-/* block. */
-	for (loop = blocks; *loop && (*loop)->sector < sector; loop = &((*loop)->next))
-	{
-		prev = *loop;
-	}
+	unsigned allocated = 0;
 
-	if (!*loop)
+/* Add inodes. */
+	for (loop = 0; loop < ninodes; loop++)
 	{
-/* There are no blocks prior to this one, and it doesn't butt up against */
-/* the end of the list. */
-		struct blocklist *newblock;
-		newblock = alloc_block (pool);
+		mfs_inode *inode = mfs_read_inode (info->mfs, loop);
 
-		if (!newblock)
+		if (mfs_has_error (info->mfs))
 		{
-			return -1;
+			if (info->inodes)
+				free (info->inodes);
+			info->inodes = 0;
+			return ~0;
 		}
 
-/* And one more.  Since this is the end of the list, this tail block is */
-/* to indicate the size of this block. */
-
-		newblock->next = alloc_block (pool);
+/* Don't think this should ever happen. */
+		if (!inode)
+			continue;
 
-		if (!newblock->next)
+/* If it a stream, treat it specially. */
+		if (inode->type == tyStream && inode->refcount > 0)
 		{
-			free (newblock);
-			return -1;
-		}
-
-		newblock->backup = 1;
[...4525 lines suppressed...]
 
-	bzero (swaphdr, sizeof (swaphdr));
-	memcpy ((char *)swaphdr + sizeof (swaphdr) - strlen (swapspace), swapspace, strlen (swapspace));
-
 	file = tivo_partition_open_direct (info->devs[0].devname, 8, O_RDWR);
 
 	if (!file)
@@ -1322,18 +2090,43 @@ restore_make_swap (struct backup_info *i
 
 	size = tivo_partition_size (file);
 
-	while (loop < 0xff0 / 4 && size >= 32 * SWAP_PAGESZ / 512)
-	{
-		swaphdr[loop++] = 0xffffffff;
-		size -= 32 * SWAP_PAGESZ / 512;
-	}
+	bzero (swaphdr, sizeof (swaphdr));
 
-	for (loop2 = 0x1; loop2 > 0 && size >= SWAP_PAGESZ / 512; size -= SWAP_PAGESZ / 512, loop2 <<= 1)
+	if (info->back_flags & RF_SWAPV1)
 	{
-		swaphdr[loop] |= htonl (loop2);
+// Version 1 swap header
+		struct {
+			char bootbits[1024];
+			unsigned int version;
+			unsigned int last_page;
+			unsigned int nr_badpages;
+			unsigned int padding[125];
+			unsigned int badpages[1];
+		} *hdr = (void *)swaphdr;
+
+		memcpy ((char *)swaphdr + sizeof (swaphdr) - strlen (swapspacev1), swapspacev1, strlen (swapspacev1));
+		hdr->version = htonl (1);
+		hdr->last_page = htonl (size / (SWAP_PAGESZ / 512) - 1);
+		hdr->nr_badpages = 0;
 	}
+	else
+	{
+// Version 0 swap header
+		memcpy ((char *)swaphdr + sizeof (swaphdr) - strlen (swapspace), swapspace, strlen (swapspace));
+
+		while (loop < 0xff0 / 4 && size >= 32 * SWAP_PAGESZ / 512)
+		{
+			swaphdr[loop++] = 0xffffffff;
+			size -= 32 * SWAP_PAGESZ / 512;
+		}
 
-	swaphdr[0] &= ~htonl (1);
+		for (loop2 = 0x1; loop2 > 0 && size >= SWAP_PAGESZ / 512; size -= SWAP_PAGESZ / 512, loop2 <<= 1)
+		{
+			swaphdr[loop] |= htonl (loop2);
+		}
+
+		swaphdr[0] &= ~htonl (1);
+	}
 
 	loop = tivo_partition_write (file, swaphdr, 0, sizeof (swaphdr) / 512);
 	tivo_partition_close (file);
@@ -1430,7 +2223,7 @@ restore_fudge_log (char *trans, unsigned
 			return 0;
 		}
 
-		if (htons (cur->log.length) >= htonl (cur->inode.dbsize) + sizeof (log_inode_update) - 2)
+		if (htons (cur->log.length) >= htonl (cur->inode.datasize) + sizeof (log_inode_update) - 2)
 		{
 			int loc, spot;
 			unsigned int shrunk = 0;
@@ -1441,7 +2234,7 @@ restore_fudge_log (char *trans, unsigned
 			dused = htonl (cur->inode.blockused) * bsize;
 			curblks = 0;
 
-			for (loc = 0, spot = 0; loc < htonl (cur->inode.dbsize) / sizeof (cur->inode.datablocks[0]); loc++)
+			for (loc = 0, spot = 0; loc < htonl (cur->inode.datasize) / sizeof (cur->inode.datablocks[0]); loc++)
 			{
 				if (htonl (cur->inode.datablocks[loc].sector) < volsize)
 				{
@@ -1475,7 +2268,7 @@ restore_fudge_log (char *trans, unsigned
 				cur->log.length = htons (htons (cur->log.length) - shrunk);
 				cur->inode.size = htonl (dsize / bsize);
 				cur->inode.blockused = htonl (dused / bsize);
-				cur->inode.dbsize = htonl (htonl (cur->inode.dbsize) - shrunk);
+				cur->inode.datasize = htonl (htonl (cur->inode.datasize) - shrunk);
 			}
 			return shrunk;
 		}
@@ -1787,24 +2580,34 @@ restore_finish(struct backup_info *info)
 		info->err_msg = "Premature end of backup data";
 		return -1;
 	}
-	if (restore_cleanup_parts (info) < 0)
-		return -1;
-	if (restore_make_swap (info) < 0)
-		return -1;
-	if (restore_fixup_vol_list (info) < 0)
-		return -1;
-	if (restore_fixup_zone_maps (info) < 0)
-		return -1;
 
-	mfsvol_cleanup (info->vols);
-	info->vols = 0;
-	info->mfs = mfs_init (info->devs[0].devname, info->ndevs > 1? info->devs[1].devname: NULL, O_RDWR);
-	if (!info->mfs || mfs_has_error (info->mfs))
-		return -1;
-	if (restore_fudge_inodes (info) < 0)
-		return -1;
-	if (restore_fudge_transactions (info) < 0)
+	if (info->state < bsComplete)
+	{
+		info->err_msg = "Internal error: State machine in state %d, expecting complete";
+		info->err_arg1 = (void *)info->state;
 		return -1;
+	}
+
+	if (info->state < bsMax)
+	{
+		enum backup_state_ret ret;
+
+		ret = ((*info->state_machine)[info->state]) (info, 0, 0, 0);
+
+		switch (ret)
+		{
+		bsError:
+			return -1;
+			break;
+
+		bsNextState:
+			break;
+
+		default:
+			info->err_msg = "Bad return from state machine: %d";
+			info->err_arg1 = (void *)ret;
+		}
+	}
 
 	return 0;
 }
diff -urp MFSTools-snapshot050221/TODO mfstools/TODO
--- MFSTools-snapshot050221/TODO	2005-02-21 22:52:04.000000000 -0600
+++ mfstools/TODO	2005-02-27 00:37:33.000000000 -0600
@@ -3,18 +3,21 @@ MFS Lib
 *DONE*  Ability to open a truncated MFS volume (Bad 2nd drive case)
   Function to manipulate MFS allocation bitmap (Allocate new space)
 *DONE*  Remove dependency on environment variables
-Backup format
-  Addition of list of inodes (Not fsids)
-    Inodes replace block list for the listed streams
-    Restore to figure out blocks to restore to
-  New magic: TBK3
-Backup
-  Re-order blocks so application data is always before streams
+
+*DONE*Backup format
+*DONE*  Addition of list of inodes (Not fsids)
+*DONE*    Inodes replace block list for the listed streams
+*DONE*    Restore to figure out blocks to restore to
+*DONE*  New magic: TBK3
+
+*DONE*Backup
+*DONE*  Re-order blocks so application data is always before streams
 *DONE*  Verify all needed data is within the MFS volume pair
 *DONE*    Inode tables/data bearing application partitions
 *DONE*    Streams to be backed up
+
 Restore
-  Support for V1/2 and V3 backup format
+*DONE*  Support for V1/2 and V3 backup format
   New restore mode - MFS rebuild
     Requires V3 backup format
     Truncates MFS volume at last data storing app partition/media partition pair
@@ -31,6 +34,7 @@ Restore
       Finish V3 backup as normal (Allocating space from inodes)
 *DONE* Direct drive copy
 *DONE*  New tool to combine backup/restore in one process for direct copy
+
 Misc bug fixes
 *DONE*  Swap size
   Mfsadd to drives larger than 256gb (Need to investigate)
@@ -40,10 +44,20 @@ Misc bug fixes
 Plan V3.0
 1. Clean up error reporting/return (All)
 *DONE* 2. Handling of truncated volumes (Lib/Backup)
-3. V3 backup handling (Backup/Restore)
+*DONE* 3. V3 backup handling (Backup/Restore)
 4. MFS rebuild (Restore/Lib)
 *DONE* 5. Clean up platform independence (Merge of MacOs branch)
 
+TBK3 backup strategy:
+  NON-MFS
+    Raw partitions
+  MFS
+    Volume Header
+    Header allocated space (Transaction log and ? following log)
+    Zone maps (In order linked)
+    Inodes (Only allocated (Maybe), only one copy)
+    Streams
+
 Macpart
   API for modifying/creating partition table
     X Read table to validate partitions

mfstools-fixllseek.patch:

--- NEW FILE mfstools-fixllseek.patch ---
--- MFSTools-snapshot050221/lib/readwrite.c.BAD	2006-09-14 19:22:00.000000000 -0500
+++ MFSTools-snapshot050221/lib/readwrite.c	2006-09-14 19:24:19.000000000 -0500
@@ -43,7 +43,6 @@
 _syscall4 (static long, readsectors, unsigned int, fd, struct FsIovec *, buf, int, buf_len, struct FsIoRequest *, request) _syscall4 (static long, writesectors, unsigned int, fd, struct FsIovec *, buf, int, buf_len, struct FsIoRequest *, request)
 #endif
 #ifdef __NR__llseek
-static _syscall5 (int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res, uint, wh);
 #define USE_LLSEEK
 #endif
 
@@ -130,7 +129,7 @@
 
 /* A file, or not TiVo, use llseek and read. */
 #ifdef USE_LLSEEK
-	if (_llseek (_tivo_partition_fd (file), sector >> 23, sector << 9, &result, SEEK_SET) < 0)
+	if (syscall(__NR__llseek, _tivo_partition_fd (file), sector >> 23, sector << 9, &result, SEEK_SET) < 0)
 #else
 #if TARGET_OS_MAC
 	if (lseek (_tivo_partition_fd (file), (off_t)sector << 9, SEEK_SET) != (off_t)sector << 9)
@@ -205,7 +204,7 @@
 
 /* A file, or not TiVo, use llseek and write. */
 #ifdef USE_LLSEEK
-	if (_llseek (_tivo_partition_fd (file), sector >> 23, sector << 9, &result, SEEK_SET) < 0)
+	if (syscall(__NR__llseek, _tivo_partition_fd (file), sector >> 23, sector << 9, &result, SEEK_SET) < 0)
 #else
 #if TARGET_OS_MAC
 	if (lseek (_tivo_partition_fd (file), (off_t)sector << 9, SEEK_SET) != (off_t)sector << 9)


Index: mfstools.spec
===================================================================
RCS file: /cvs/extras/rpms/mfstools/EL-4/mfstools.spec,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- mfstools.spec	28 Feb 2006 23:14:37 -0000	1.8
+++ mfstools.spec	2 Aug 2007 13:13:10 -0000	1.9
@@ -2,13 +2,15 @@
 
 Name:		mfstools
 Version:	2.0
-Release:	9.%{releasename}%{?dist}
+Release:	11.%{releasename}%{?dist}
 Summary:	Utilities for TiVo drive upgrades
 Group:		Applications/File
 License:	GPL
 URL:		http://mfstools.sourceforge.net/
 Source0:	http://download.sourceforge.net/mfstools/MFSTools-%{releasename}-src.tar.gz
 Source1:	http://www.tyger.org/MFS/2.0/howto.html
+Patch0:		mfstools-cvs20060914.patch
+Patch1:		mfstools-fixllseek.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:	zlib-devel
 
@@ -18,6 +20,10 @@
 
 %prep
 %setup -q -n MFSTools-%{releasename}
+# There are some notable improvements in CVS
+%patch0 -p1 -b .20060914
+# Do not use the _syscall5 macro -- use syscall(2) instead
+%patch1 -p1 -b .llseek
 
 %build
 CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"
@@ -40,6 +46,12 @@
 %{_bindir}/*
 
 %changelog
+* Thu Sep 14 2006 Tom "spot" Callaway <tcallawa at redhat.com> 2.0-11.snapshot050221
+- Do not use the _syscall5 macro -- use syscall(2) instead
+
+* Thu Sep 14 2006 Tom "spot" Callaway <tcallawa at redhat.com> 2.0-10.snapshot050221
+- merge with CVS
+
 * Tue Feb 28 2006 Tom "spot" Callaway <tcallawa at redhat.com> 2.0-9.snapshot050221
 - bump for FC-5
 




More information about the fedora-extras-commits mailing list