Commit 03d876c7 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents d11f9f42 44445500
......@@ -2221,17 +2221,17 @@ for ac_hdr in ulxmlrpcpp/ulxr_config.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2226: checking for $ac_hdr" >&5
echo "configure:2225: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2231 "configure"
#line 2230 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2235: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -2270,17 +2270,17 @@ for ac_hdr in linux/videodev.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2275: checking for $ac_hdr" >&5
echo "configure:2274: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2280 "configure"
#line 2279 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -2313,7 +2313,7 @@ done
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2318: checking for $ac_word" >&5
echo "configure:2317: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2370,7 +2370,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
echo "configure:2375: checking how to run the C++ preprocessor" >&5
echo "configure:2374: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -2383,12 +2383,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
#line 2388 "configure"
#line 2387 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2393: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2392: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
......@@ -2414,17 +2414,17 @@ echo "$ac_t""$CXXCPP" 1>&6
ac_safe=`echo "xercesc/dom/DOM.hpp" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for xercesc/dom/DOM.hpp""... $ac_c" 1>&6
echo "configure:2419: checking for xercesc/dom/DOM.hpp" >&5
echo "configure:2418: checking for xercesc/dom/DOM.hpp" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2424 "configure"
#line 2423 "configure"
#include "confdefs.h"
#include <xercesc/dom/DOM.hpp>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2429: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -2488,7 +2488,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:2493: checking for a BSD compatible install" >&5
echo "configure:2492: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -2549,7 +2549,7 @@ esac
# Extract the first word of "rsync", so it can be a program name with args.
set dummy rsync; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2554: checking for $ac_word" >&5
echo "configure:2553: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RSYNC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2776,6 +2776,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
apache/GNUmakefile apache/httpd.conf \
xmlrpc/GNUmakefile xmlrpc/emulabclient.py xmlrpc/emulabserver.py \
xmlrpc/sshxmlrpc_client.py xmlrpc/sshxmlrpc_server.py \
xmlrpc/sslxmlrpc_client.py xmlrpc/sslxmlrpc_server.py \
xmlrpc/webxmlrpc xmlrpc/script_wrapper.py xmlrpc/libxmlrpc.pm \
xmlrpc/emulab xmlrpc/node xmlrpc/experiment xmlrpc/fs xmlrpc/user \
xmlrpc/imageid xmlrpc/osid xmlrpc/server xmlrpc/xmlrpcbag \
......
......@@ -1012,6 +1012,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
apache/GNUmakefile apache/httpd.conf \
xmlrpc/GNUmakefile xmlrpc/emulabclient.py xmlrpc/emulabserver.py \
xmlrpc/sshxmlrpc_client.py xmlrpc/sshxmlrpc_server.py \
xmlrpc/sslxmlrpc_client.py xmlrpc/sslxmlrpc_server.py \
xmlrpc/webxmlrpc xmlrpc/script_wrapper.py xmlrpc/libxmlrpc.pm \
xmlrpc/emulab xmlrpc/node xmlrpc/experiment xmlrpc/fs xmlrpc/user \
xmlrpc/imageid xmlrpc/osid xmlrpc/server xmlrpc/xmlrpcbag \
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -41,10 +41,6 @@ WITH_LTHREADS = 1
endif
endif
endif
# XXX special checkpoint/shadow device support
WITH_SHD = 0
endif
# Linux specific goop
......@@ -145,14 +141,6 @@ SUBDIRS += fat
ZIPLIBS += fat/libfat.a
endif
# with SHD
ifeq ($(WITH_SHD),1)
CFLAGS += -DWITH_SHD
SUBDIRS += shd
ZIPLIBS += shd/libshd.a
SHDLIBS += shd/libshd.a
endif
# with HASH
ifeq ($(WITH_HASH),1)
CFLAGS += -DWITH_HASH -DHASHSTATS
......@@ -185,8 +173,8 @@ imageunzip: imageunzip.o disksize.o crc.o version.o
imageunzip.o: imageunzip.c
$(CC) -c $(UNZIPCFLAGS) -o imageunzip.o $<
imagedump: imagedump.o version.o $(SHDLIBS)
$(CC) $(CFLAGS) imagedump.o version.o $(LIBS) $(SHDLIBS) -o imagedump
imagedump: imagedump.o version.o
$(CC) $(CFLAGS) imagedump.o version.o $(LIBS) -o imagedump
imagehash: imagehash.o version.o
$(CC) $(CFLAGS) imagehash.o version.o $(HASHLIBS) -o imagehash
......
......@@ -55,12 +55,6 @@ static int dumpchunk(char *name, char *buf, int chunkno, int checkindex);
static void dumpchunkhash(char *name, char *buf, int chunkno, int checkindex);
#endif
#ifdef WITH_SHD
void add_shdrange(u_int32_t start, u_int32_t size);
int write_shd(char *shddev);
int debug = 0;
#endif
#define SECTOBYTES(s) ((unsigned long long)(s) * SECSIZE)
int
......@@ -288,13 +282,6 @@ dumpfile(char *name, int fd)
}
done:
#ifdef WITH_SHD
if (chkpointdev && write_shd(chkpointdev)) {
fprintf(stderr, "Could not record SHD alloc block info\n");
exit(1);
}
#endif
if (filesize == 0)
filesize = (off_t)(chunkno + 1) * CHUNKSIZE;
......@@ -505,14 +492,6 @@ dumpchunk(char *name, char *buf, int chunkno, int checkindex)
franges++;
}
#ifdef WITH_SHD
/*
* Accumulate SHD allocated list info
*/
if (chkpointdev)
add_shdrange(reg->start, reg->size);
#endif
count = reg->size;
sectinuse += count;
if (count < amin)
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2009 University of Utah and the Flux Group.
* Copyright (c) 2000-2010 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -61,10 +61,6 @@ int filemode = 0;
off_t datawritten;
partmap_t ignore, forceraw;
#ifdef WITH_SHD
char *chkpointdev;
#endif
#ifdef WITH_HASH
char *hashfile;
#endif
......@@ -119,11 +115,6 @@ int read_raw(void);
int compress_image(void);
void usage(void);
#ifdef WITH_SHD
int read_shd(char *shddev, char *infile, int infd, u_int32_t ssect,
void (*add)(uint32_t, uint32_t));
#endif
#ifdef WITH_HASH
struct range *hashmap_compute_delta(struct range *, char *, int, u_int32_t);
void report_hash_stats(int pnum);
......@@ -379,7 +370,7 @@ main(int argc, char *argv[])
extern char build_info[];
gettimeofday(&sstamp, 0);
while ((ch = getopt(argc, argv, "vlbnNdihrs:c:z:ofI:1F:DR:S:XC:H:M")) != -1)
while ((ch = getopt(argc, argv, "vlbnNdihrs:c:z:ofI:1F:DR:S:XH:M")) != -1)
switch(ch) {
case 'v':
version++;
......@@ -447,14 +438,6 @@ main(int argc, char *argv[])
case 'X':
forcereads++;
break;
case 'C':
#ifdef WITH_SHD
chkpointdev = optarg;
#else
fprintf(stderr, "'C' option not supported\n");
usage();
#endif
break;
case 'H':
#ifdef WITH_HASH
hashfile = optarg;
......@@ -487,9 +470,6 @@ main(int argc, char *argv[])
fprintf(stderr, "%c %s",
ch > 1 ? ',' : ':',
fsmap[ch].desc);
#ifdef WITH_SHD
fprintf(stderr, ", SHD device");
#endif
#ifdef WITH_HASH
fprintf(stderr, ", hash-signature comparison");
#endif
......@@ -538,73 +518,33 @@ main(int argc, char *argv[])
inputmaxsec = getdisksize(infd);
#endif
#ifdef WITH_SHD
if (chkpointdev) {
rval = 0;
if (dorelocs) {
fprintf(stderr, "WARNING: no relocation info "
"generated for checkpoint images\n");
dorelocs = 0;
}
/*
* Slice indicates the slice shadowed for checkpointing.
* XXX we need this right now to determine the offset of
* the block numbers returned by the shd device.
*/
if (slicemode) {
struct doslabel doslabel;
rval = read_doslabel(infd, DOSBBSECTOR, 0, &doslabel);
if (rval == 0) {
inputminsec = doslabel.parts[slice-1].dp_start;
inputmaxsec = inputminsec +
doslabel.parts[slice-1].dp_size;
}
}
if (rval == 0) {
rval = read_shd(chkpointdev, infilename, infd,
inputminsec, addvalid);
if (rval == 0)
sortrange(&ranges, 1, 0);
}
if (rval) {
fprintf(stderr, "* * * Aborting * * *\n");
exit(1);
}
} else
#endif
{
/*
* Create the skip list by scanning the filesystems on
* the disk or indicated partition.
*/
if (slicetype != 0) {
rval = read_slice(-1, slicetype, 0, 0,
infilename, infd);
if (rval == -1)
fprintf(stderr, ", cannot process\n");
} else if (rawmode)
rval = read_raw();
else
rval = read_image(DOSBBSECTOR, 0, 0);
if (rval) {
fprintf(stderr, "* * * Aborting * * *\n");
exit(1);
}
/*
* Create a valid range list from the skip list
*/
(void) mergeskips(debug > 1);
if (debug)
dumpskips(debug > 1);
makeranges();
/*
* Create the skip list by scanning the filesystems on
* the disk or indicated partition.
*/
if (slicetype != 0) {
rval = read_slice(-1, slicetype, 0, 0,
infilename, infd);
if (rval == -1)
fprintf(stderr, ", cannot process\n");
} else if (rawmode)
rval = read_raw();
else
rval = read_image(DOSBBSECTOR, 0, 0);
if (rval) {
fprintf(stderr, "* * * Aborting * * *\n");
exit(1);
}
/*
* Create a valid range list from the skip list
*/
(void) mergeskips(debug > 1);
if (debug)
dumpskips(debug > 1);
makeranges();
if (debug)
dumpranges(debug > 1);
sortrange(&fixups, 0, cmpfixups);
if (debug > 1)
dumpfixups(debug > 2);
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../../..
SUBDIR = os/imagezip/shd
MAINDIR = $(SRCDIR)/..
include $(OBJDIR)/Makeconf
CFLAGS += $(SUBDIRCFLAGS) -I$(MAINDIR) -I$(SRCDIR)
all: libshd.a
include $(TESTBED_SRCDIR)/GNUmakerules
OBJS = shd.o
shd.o: shd.h
shd.o: $(MAINDIR)/global.h $(MAINDIR)/sliceinfo.h $(MAINDIR)/imagehdr.h
libshd.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
install:
clean:
rm -f libshd.a $(OBJS)
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2005 University of Utah and the Flux Group.
* All rights reserved.
*/
/*
* Support for extracting a changed block list from the shadow/checkpoint
* device driver.
*
* Open the indicated device and make repeated ioctl calls to extract the
* changed block info.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#include <sys/ioctl.h>
#include "shd.h"
#include "sliceinfo.h"
#include "global.h"
#include "imagehdr.h"
#define ENTRIESPERCALL 1024
#ifdef FAKEIT
#define SHDIOCTL fake_ioctl
int fake_ioctl(int, int, void *);
#else
#define SHDIOCTL ioctl
#endif
int
read_shd(char *shddev, char *infile, int infd, u_int32_t ssect,
void (*addvalid)(u_int32_t, u_int32_t))
{
int shdfd;
struct shd_modinfo sm;
sm.bufsiz = ENTRIESPERCALL;
sm.buf = malloc(sm.bufsiz * sizeof(struct shd_range));
if (sm.buf == 0) {
fprintf(stderr, "No memory for SHD ranges\n");
return 1;
}
/*
* Open the shd device so we can ioctl
*/
shdfd = open(shddev, O_RDONLY, 0);
if (shdfd < 0) {
perror(shddev);
return 1;
}
/*
* Initialize the iterator (and return the first set of entries)
*/
sm.command = 1;
if (SHDIOCTL(shdfd, SHDGETMODIFIEDRANGES, &sm) < 0) {
perror(shddev);
close(shdfd);
return 1;
}
/*
* Loop extracting changed block ranges and creating imagezip
* block ranges.
*/
while (sm.retsiz > 0) {
struct shd_range *sr = sm.buf;
if (debug > 1)
fprintf(stderr, "GETRANGES returns %ld ranges:\n",
sm.retsiz);
for (sr = sm.buf; sm.retsiz > 0; sr++, sm.retsiz--) {
if (debug > 2)
fprintf(stderr, " %12d %9d\n",
sr->start, (sr->end-sr->start));
(*addvalid)(sr->start + ssect, (sr->end-sr->start));
}
sm.command = 2;
if (SHDIOCTL(shdfd, SHDGETMODIFIEDRANGES, &sm) < 0) {
perror(shddev);
close(shdfd);
/* XXX should flush the valid table */
return 1;
}
}
sm.command = 3;
(void) SHDIOCTL(shdfd, SHDGETMODIFIEDRANGES, &sm);
close(shdfd);
return 0;
}
static struct shd_allocinfo alloclist;
int
write_shd(char *shddev)
{
int shdfd;
if (alloclist.buf == 0 || alloclist.bufsiz == 0)
return 0;
/*
* Open the shd device so we can ioctl
*/
shdfd = open(shddev, O_RDWR);
if (shdfd < 0) {
perror(shddev);
return 1;
}
if (SHDIOCTL(shdfd, SHDSETALLOCATEDRANGES, &alloclist) < 0) {
perror(shddev);
close(shdfd);
return 1;
}
close(shdfd);
free(alloclist.buf);
alloclist.buf = 0;
alloclist.bufsiz = 0;
return 0;
}
void
add_shdrange(u_int32_t start, u_int32_t size)
{
size_t nsize = (alloclist.bufsiz + 1) * sizeof(struct shd_range);
alloclist.buf = realloc(alloclist.buf, nsize);
if (alloclist.buf == 0) {
fprintf(stderr, "No memory for SHD alloc ranges\n");
exit(1);
}
alloclist.buf[alloclist.bufsiz].start = start;
alloclist.buf[alloclist.bufsiz].end = start + size;
alloclist.bufsiz++;
}
#ifdef FAKEIT
struct shd_range foo[] = {
{ 110427, 4 },
{ 2410487, 8 },
{ 2564819, 12 },
{ 2862827, 16 },
{ 2774027, 20 },
{ 4277895, 24 },
{ 3853567, 28 },
{ 2372447, 32 },
{ 12352615, 40 },
{ 5428223, 44 },
{ 2436383, 48 },
{ 2602463, 52 },
{ 11039151, 56 },
{ 4774459, 68 },
{ 10265207, 88 },
{ 4409343, 120 },
{ 4387795, 204 },
{ 11033303, 408 },
{ 9786815, 1040 },
{ 2361715, 1056 },
{ 8139631, 1752 },
{ 9795103, 11808 },
{ 4499231, 104368 },
{ 11832015, 112032 },
{ 9076719, 115560 },
{ 9307719, 123600 },
{ 5598591, 130240 },
{ 0, 0 }
};
int
fake_ioctl(int fd, int cmd, void *data)
{
static struct shd_range *fooptr, *out;
int i;
switch (cmd) {
case SHDGETMODIFIEDRANGES:
{
struct shd_modinfo *sm = data;
switch (sm->command) {
case 1:
fooptr = foo;
case 2:
out = sm->buf;
for (i = 0; i < sm->bufsiz; i++) {
if (fooptr->start == 0 && fooptr->end == 0)
break;
out->start = fooptr->start;
out->end = fooptr->start + fooptr->end;
fooptr++, out++;
}
sm->retsiz = i;
break;
case 3:
break;
}
return 0;
}
case SHDSETALLOCATEDRANGES:
{
struct shd_allocinfo *sa = data;
int i;
printf("SETALLOCATEDRANGES: %ld entries:\n", sa->bufsiz);
out = sa->buf;
for (i = 0; i < sa->bufsiz; i++) {
printf(" [%u-%u]\n", out->start, out->end);