Commit 7c6925ab authored by Mike Hibler's avatar Mike Hibler

Pieces of Linux MFS support for versioned images.

Pain, oh the pain...
parent fe594567
......@@ -29,6 +29,7 @@ BINDIR= /usr/local/bin
# Set to 1 for "secure frisbee" support. Requires openssl libraries.
WITH_CRYPTO = 1
WITH_SIGNING = 1
#
# Which filesystems to support
......@@ -36,8 +37,8 @@ WITH_CRYPTO = 1
WITH_EXTFS = 1
WITH_FFS = 1
WITH_FAT = 1
WITH_NTFS = 0
WITH_HASH = 0
WITH_NTFS = 1
WITH_HASH = 1
WITH_V3COMPAT = 1
......@@ -82,16 +83,14 @@ endif
ifeq ($(WITH_NTFS),1)
FSOBJS += ntfs/ntfs_glue.o
FSLIBS += ntfs/libntfs/libntfs.a
CFLAGS += -DWITH_NTFS -DOLD_LIBNTFS -Intfs/libntfs/ntfsprogs-1.7.1.linux/include
CFLAGS += -DWITH_NTFS -DHAVE_CONFIG_H -Intfs/libntfs/ntfsprogs-2.0.0/include -Intfs/libntfs/ntfsprogs-2.0.0/include/ntfs
endif
# with HASH
ifeq ($(WITH_HASH),1)
CFLAGS += -DWITH_HASH -DHASHSTATS
SUBDIRCFLAGS += -DHASHSTATS
SUBDIRS += hashmap
ZIPLIBS += hashmap/libhashmap.a
LIBS += -lcrypto $(PTHREADLIBS)
FSOBJS += hashmap/hashmap.o
CFLAGS += -DWITH_HASH -DHASHSTATS -Ihashmap
LIBS += -lcrypto
endif
all: imagezip imageunzip imagedump
......@@ -111,6 +110,8 @@ imagedump: imagedump.o checksum.o version.o
version.c: imagezip.c imageunzip.c imagedump.c
echo >$@ "char build_info[] = \"Built `date +%d-%b-%Y` by `id -nu`@`hostname | sed 's/\..*//'`:`pwd`\";"
hashmap/hashmap.o: hashmap/hashmap.h imagehdr.h imagehash.h
ntfs/libntfs/libntfs.a:
(cd ntfs/libntfs; make -f Makefile-linux.sa)
......
......@@ -23,41 +23,26 @@
all: libntfs.a
NTFSDIR = ntfsprogs-1.7.1.linux
NTFSDIR = ntfsprogs-2.0.0
LIBSRCDIR = $(NTFSDIR)/libntfs
INCLUDES = -I${NTFSDIR}/include
CFLAGS = -O2 -g -static -Wall $(INCLUDES)
OBJS= attrib.o \
bitmap.o \
bootsect.o \
compat.o \
debug.o \
dir.o \
disk_io.o \
inode.o \
lcnalloc.o \
mft.o \
mst.o \
runlist.o \
unistr.o \
volume.o
%.o: $(NTFSDIR)/libntfs/%.c
%.o: $(LIBSRCDIR)/%.c
$(CC) $(CFLAGS) -c -o $@ $<
libntfs.a: configureit $(OBJS)
ar crv $@ $(OBJS)
ranlib $@
libntfs.a: configureit
$(MAKE) -C $(LIBSRCDIR) all
cp -p $(LIBSRCDIR)/.libs/libntfs.a $@
configureit:
wget -q -N http://www.emulab.net/ntfsprogs-1.7.1.tar.gz
tar zxf ntfsprogs-1.7.1.tar.gz
mv ntfsprogs-1.7.1 $(NTFSDIR)
patch -sN -d $(NTFSDIR) -p1 < ntfs.linuxpatch
patch -sN -d $(NTFSDIR) -p1 < ntfs_lvalue.patch
$(NTFSDIR)/configure
mv config.h $(NTFSDIR)/include
wget -q -N http://www.emulab.net/distributions/ntfsprogs-2.0.0.tar.gz
tar zxf ntfsprogs-2.0.0.tar.gz
patch -sN -d $(NTFSDIR) -p1 < ntfsprogs-2.0.0.patch
(cd $(NTFSDIR); ./configure)
cp $(NTFSDIR)/config.h $(NTFSDIR)/include
touch configureit
clean:
rm -f $(OBJS) libntfs.a
$(MAKE) -C $(LIBSRCDIR) clean
rm -f libntfs.a
......@@ -356,12 +356,17 @@ if (mysystem("$sudo mkdir -p $localdir")) {
# memory filesystem is too much for our older machines--let's go
# with 64MB for now.
#
my $MEMFS_SIZE = (64 * 1024 * 1024);
my $MEMFS_SIZE = "64m";
if ($dofrisbee) {
if ($^O eq 'linux') {
die "No can do Linux right now!\n";
if (mysystem("$sudo mount -t tmpfs -o size=$MEMFS_SIZE tmpfs $localdir")) {
print STDERR "Could not create $MEMFS_SIZE byte local MFS\n";
# XXX try NFS instead
exit(1);
}
} else {
if (mysystem("$sudo mdconfig -a -t swap -s 64m -u 4") ||
if (mysystem("$sudo mdconfig -a -t swap -s $MEMFS_SIZE -u 4") ||
mysystem("$sudo newfs -b 8192 -i 25000 -o space /dev/md4") ||
mysystem("$sudo mount /dev/md4 $localdir")) {
print STDERR "Could not create $MEMFS_SIZE byte local MFS\n";
......@@ -389,7 +394,9 @@ foreach my $iid (sort keys %iinfo) {
#
if ($dofrisbee) {
if ($^O eq 'linux') {
print STDERR "No can do Linux right now!\n";
if (mysystem("$sudo umount $localdir")) {
print STDERR "WARNING: could not destroy local MFS\n";
}
} else {
if (mysystem("$sudo umount $localdir") ||
mysystem("$sudo mdconfig -d -u 4")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment