[OpenAFS] Volume stays offline

Hartmut Reuter reuter@rzg.mpg.de
Mon, 22 Dec 2003 17:09:40 +0100


This is a multi-part message in MIME format.
--------------030005020307040509020109
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Frank Burkhardt wrote:
> Hi,
> 
> On Thu, Dec 18, 2003 at 12:08:06PM +0100, Hartmut Reuter wrote:
> 
>>Apply this patch to dumptool.c, then it schould work also with big dump 
>>files.
> 
> The patched dumptool is able to open the 9G-dumpfile correctly.
> "ls" shows all files as expected but "cp" doesn't:
> 
>   $ dumptool c.movies.6.dump
>   > cp "Carrie (1976).avi" /SCR/x
>   Seek failed: Invalid argument
>   >

I see, what I proposed is not enough. you have to use fseeko instead of 
fseek and you have to use afs_uint64 for
the offset.

Try the attached patch.
We are here running MR-AFS, therefore I cannot test the patch myself. It 
may contain still more bugs.

Hartmut




> 
> The fseek-call within CopyFile() seems to be
> called with a variable which isn't 64 bits wide (and contains -1
> when used as fseek-argument).
> 
> It this a problem caused by my compiler (gcc 2.95.4)/libraries (glibc 2.2.5)?
> 
> Regards,
> 
> Frank
> _______________________________________________
> OpenAFS-info mailing list
> OpenAFS-info@openafs.org
> https://lists.openafs.org/mailman/listinfo/openafs-info


-- 
-----------------------------------------------------------------
Hartmut Reuter                           e-mail reuter@rzg.mpg.de
					   phone +49-89-3299-1328
RZG (Rechenzentrum Garching)               fax   +49-89-3299-1301
Computing Center of the Max-Planck-Gesellschaft (MPG) and the
Institut fuer Plasmaphysik (IPP)
-----------------------------------------------------------------

--------------030005020307040509020109
Content-Type: text/plain;
 name="diffs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="diffs"

--- dumptool.c	Mon Dec 22 17:03:45 2003
+++ /home/hwr/a/t/openafs/src/tests/dumptool.c	Thu Dec 18 12:04:22 2003
@@ -102,7 +102,6 @@
 #include <pty.h>
 #endif
 
-#define _FILE_OFFSET_BITS 64
 /*
  * Stuff that is in private AFS header files, unfortunately
  */
@@ -238,7 +237,7 @@
 struct vnodeData {
 	struct VnodeDiskObject *vnode;	/* A pointer to the disk vnode */
 	int vnodeNumber;		/* The vnode number */
-	afs_uint64 dumpdata;		/* File offset of dump data (if
+	long dumpdata;			/* File offset of dump data (if
 					   available */
 	unsigned char *filedata;	/* A pointer to the actual file
 					   data itself (if available) */
@@ -308,7 +307,7 @@
 	unsigned int magic;
 	struct DumpHeader dheader;
 	VolumeDiskData vol;
-	afs_uint64 offset;
+	long offset;
 	int Res, Arg1, Arg2, Arg3, i;
 	char *p;
 	struct winsize win;
@@ -505,14 +504,14 @@
 	 * vnodes, the other to actually build the index.
 	 */
 
-	offset = ftello(f);
+	offset = ftell(f);
 
 	if (ScanVnodes(f, &vol, 1)) {
 		fprintf(stderr, "First vnode scan failed, aborting\n");
 		exit(1);
 	}
 
-	fseeko(f, offset, SEEK_SET);
+	fseek(f, offset, SEEK_SET);
 
 	if (ScanVnodes(f, &vol, 0)) {
 		fprintf(stderr, "Second vnode scan failed, aborting\n");
@@ -900,7 +899,7 @@
 	int numDirVnodes = 0;
 	unsigned char buf[SIZEOF_LARGEDISKVNODE];
 	struct VnodeDiskObject *vnode = (struct VnodeDiskObject *) buf;
-	afs_uint64 offset, oldoffset;
+	long offset, oldoffset;
 	struct vnodeData *vdata;
 	unsigned int length;
 
@@ -1056,7 +1055,7 @@
 					return -1;
 				}
 				vnode->length = length;
-				offset = ftello(f);
+				offset = ftell(f);
 				fseek(f, length, SEEK_CUR);
 				break;
 			default:
@@ -1133,8 +1132,8 @@
 					return -1;
 				}
 
-				oldoffset = ftello(f);
-				fseeko(f, offset, SEEK_SET);
+				oldoffset = ftell(f);
+				fseek(f, offset, SEEK_SET);
 
 				if (fread(vdata->filedata, length, 1, f) != 1) {
 					if (verbose)
@@ -1143,7 +1142,7 @@
 					return -1;
 				}
 
-				fseeko(f, oldoffset, SEEK_SET);
+				fseek(f, oldoffset, SEEK_SET);
 			} else if (vnode->type == vDirectory)
 				/*
 				 * Warn the user we may not have all directory
@@ -1634,7 +1633,7 @@
 		return;
 	}
 
-	if (fseeko(f, vdata->dumpdata, SEEK_SET)) {
+	if (fseek(f, vdata->dumpdata, SEEK_SET)) {
 		fprintf(stderr, "Seek failed: %s\n", strerror(errno));
 		fclose(out);
 		return;
@@ -1726,7 +1725,7 @@
 		return;
 	}
 
-	if (fseeko(f, vdata->dumpdata, SEEK_SET)) {
+	if (fseek(f, vdata->dumpdata, SEEK_SET)) {
 		fprintf(stderr, "Seek failed: %s\n", strerror(errno));
 		fclose(out);
 		return;

--------------030005020307040509020109--