CVS: is/intersync intersync.c,1.49,1.50 request.c,1.55,1.56
Robert Read <[email protected]> Thu, 26 Sep 2002 17:43:18 -0700
| Newsgroups | gmane.comp.file-systems.intermezzo.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/intermezzo/is/intersync
In directory usw-pr-cvs1:/tmp/cvs-serv20479/intersync
Modified Files:
intersync.c request.c
Log Message:
* fix various endian problems so PowerPC can work
Index: intersync.c
===================================================================
RCS file: /cvsroot/intermezzo/is/intersync/intersync.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -U2 -r1.49 -r1.50
--- intersync.c 25 Sep 2002 06:31:38 -0000 1.49
+++ intersync.c 27 Sep 2002 00:43:16 -0000 1.50
@@ -518,5 +518,4 @@
setsid();
chroot("/");
- // umask(0);
snprintf(tag, sizeof(tag), "intersync-%d", channel);
Index: request.c
===================================================================
RCS file: /cvsroot/intermezzo/is/intersync/request.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -U2 -r1.55 -r1.56
--- request.c 20 May 2002 05:10:22 -0000 1.55
+++ request.c 27 Sep 2002 00:43:16 -0000 1.56
@@ -189,4 +189,8 @@
__u32 isbranch = 0;
time_t start_time, end_time;
+
+ char *tmp_buf = NULL; /* unpack using a copy, so
+ kernel can upack again. */
+ char *tmp_ptr, *tmp_end;
#ifdef DEBUG_KML_OFFSET
@@ -223,4 +227,7 @@
CDEBUG(D_KML, "kml size: %d\n", end - ptr);
+ tmp_ptr = tmp_buf = g_malloc(end - ptr);
+ memcpy(tmp_buf, buf, end-ptr);
+ tmp_end = tmp_buf + (end-ptr);
#ifdef DEBUG_KML_OFFSET
@@ -233,5 +240,5 @@
if (rc < 0) {
CDEBUG(D_INFO, "get_rcvd failure: %d, %d\n", rc, errno);
- return rc;
+ goto out_free;
}
if (start_byte != lr_rec.lr_remote_offset)
@@ -245,9 +252,10 @@
while (ptr < end) {
int rc;
- char *old_ptr = ptr;
-
- if ((rc = kml_unpack(&rec, &ptr, end)) != 0) {
+ char *old_ptr = tmp_ptr;
+
+ if ((rc = kml_unpack(&rec, &tmp_ptr, tmp_end)) != 0) {
CERROR("kml_unpack failed: %s\n", g_strerror(-rc));
- return -1;
+ rc = -1;
+ goto out_free;
} else {
char *str = kml_print_rec(&rec, 1);
@@ -258,5 +266,5 @@
branch_fixpath(fset, &rec);
}
- rc = kml_iocreint(ptr - old_ptr, old_ptr,
+ rc = kml_iocreint(tmp_ptr - old_ptr, ptr,
start_byte,
fset->fset_mtpt_fd,
@@ -264,5 +272,5 @@
if (rc == ENOTCONN) {
CERROR("disconnected, reintegration halted\n");
- return rc;
+ goto out_free;
} else if (rc) {
is_die("reintegrate failed, aborting: %s\n",
@@ -272,7 +280,8 @@
/* FIXME: Set them _all_. */
ctxt->ctxt_replicator->rp_rcvd_rec.lr_remote_offset +=
- ptr - old_ptr;
- start_byte += ptr - old_ptr;
+ tmp_ptr - old_ptr;
+ start_byte += tmp_ptr - old_ptr;
+ ptr += tmp_ptr - old_ptr;
#ifdef DEBUG_KML_OFFSET
kml_rec_size += rec.suffix->len;
@@ -286,8 +295,8 @@
if (rc < 0) {
CERROR("get_rcvd failure: %d, %d\n", rc, errno);
- return rc;
+ goto out_free;
}
- kml_remote_offset += ptr - old_ptr;
+ kml_remote_offset += tmp_ptr - old_ptr;
if (kml_remote_offset != lr_rec.lr_remote_offset) {
fflush(stdout);
@@ -307,5 +316,8 @@
CDEBUG(D_REINT, "reint complete: %d in %ld secs\n", end - buf,
end_time - start_time);
- return 0;
+ rc = 0;
+ out_free:
+ g_free(tmp_buf);
+ return rc;
}
@@ -422,5 +434,5 @@
}
- rc = is_get_kml_range(ctxt, NULL, rec->lr_remote_offset, kmlsize);
+ rc = is_get_kml_range(ctxt, NULL, rec->lr_remote_offset, kmlsize-1);
out:
@@ -521,5 +533,4 @@
CERROR("\n");
- uuid_data->port = HTON__u64(uuid_data->port);
uuid_unparse(ctxt->ctxt_intersync->is_local_uuid, uuidstr);
cgi = g_strdup_printf("uuid?client_port=%llu&uuid=%s&client_flag=%d",
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf