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 ...@@ -29,6 +29,7 @@ BINDIR= /usr/local/bin
# Set to 1 for "secure frisbee" support. Requires openssl libraries. # Set to 1 for "secure frisbee" support. Requires openssl libraries.
WITH_CRYPTO = 1 WITH_CRYPTO = 1
WITH_SIGNING = 1
# #
# Which filesystems to support # Which filesystems to support
...@@ -36,8 +37,8 @@ WITH_CRYPTO = 1 ...@@ -36,8 +37,8 @@ WITH_CRYPTO = 1
WITH_EXTFS = 1 WITH_EXTFS = 1
WITH_FFS = 1 WITH_FFS = 1
WITH_FAT = 1 WITH_FAT = 1
WITH_NTFS = 0 WITH_NTFS = 1
WITH_HASH = 0 WITH_HASH = 1
WITH_V3COMPAT = 1 WITH_V3COMPAT = 1
...@@ -82,16 +83,14 @@ endif ...@@ -82,16 +83,14 @@ endif
ifeq ($(WITH_NTFS),1) ifeq ($(WITH_NTFS),1)
FSOBJS += ntfs/ntfs_glue.o FSOBJS += ntfs/ntfs_glue.o
FSLIBS += ntfs/libntfs/libntfs.a 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 endif
# with HASH # with HASH
ifeq ($(WITH_HASH),1) ifeq ($(WITH_HASH),1)
CFLAGS += -DWITH_HASH -DHASHSTATS FSOBJS += hashmap/hashmap.o
SUBDIRCFLAGS += -DHASHSTATS CFLAGS += -DWITH_HASH -DHASHSTATS -Ihashmap
SUBDIRS += hashmap LIBS += -lcrypto
ZIPLIBS += hashmap/libhashmap.a
LIBS += -lcrypto $(PTHREADLIBS)
endif endif
all: imagezip imageunzip imagedump all: imagezip imageunzip imagedump
...@@ -111,6 +110,8 @@ imagedump: imagedump.o checksum.o version.o ...@@ -111,6 +110,8 @@ imagedump: imagedump.o checksum.o version.o
version.c: imagezip.c imageunzip.c imagedump.c version.c: imagezip.c imageunzip.c imagedump.c
echo >$@ "char build_info[] = \"Built `date +%d-%b-%Y` by `id -nu`@`hostname | sed 's/\..*//'`:`pwd`\";" 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: ntfs/libntfs/libntfs.a:
(cd ntfs/libntfs; make -f Makefile-linux.sa) (cd ntfs/libntfs; make -f Makefile-linux.sa)
......
...@@ -23,41 +23,26 @@ ...@@ -23,41 +23,26 @@
all: libntfs.a all: libntfs.a
NTFSDIR = ntfsprogs-1.7.1.linux NTFSDIR = ntfsprogs-2.0.0
LIBSRCDIR = $(NTFSDIR)/libntfs
INCLUDES = -I${NTFSDIR}/include INCLUDES = -I${NTFSDIR}/include
CFLAGS = -O2 -g -static -Wall $(INCLUDES) CFLAGS = -O2 -g -static -Wall $(INCLUDES)
OBJS= attrib.o \ %.o: $(LIBSRCDIR)/%.c
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
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
libntfs.a: configureit $(OBJS) libntfs.a: configureit
ar crv $@ $(OBJS) $(MAKE) -C $(LIBSRCDIR) all
ranlib $@ cp -p $(LIBSRCDIR)/.libs/libntfs.a $@
configureit: configureit:
wget -q -N http://www.emulab.net/ntfsprogs-1.7.1.tar.gz wget -q -N http://www.emulab.net/distributions/ntfsprogs-2.0.0.tar.gz
tar zxf ntfsprogs-1.7.1.tar.gz tar zxf ntfsprogs-2.0.0.tar.gz
mv ntfsprogs-1.7.1 $(NTFSDIR) patch -sN -d $(NTFSDIR) -p1 < ntfsprogs-2.0.0.patch
patch -sN -d $(NTFSDIR) -p1 < ntfs.linuxpatch (cd $(NTFSDIR); ./configure)
patch -sN -d $(NTFSDIR) -p1 < ntfs_lvalue.patch cp $(NTFSDIR)/config.h $(NTFSDIR)/include
$(NTFSDIR)/configure
mv config.h $(NTFSDIR)/include
touch configureit touch configureit
clean: clean:
rm -f $(OBJS) libntfs.a $(MAKE) -C $(LIBSRCDIR) clean
rm -f libntfs.a
...@@ -356,12 +356,17 @@ if (mysystem("$sudo mkdir -p $localdir")) { ...@@ -356,12 +356,17 @@ if (mysystem("$sudo mkdir -p $localdir")) {
# memory filesystem is too much for our older machines--let's go # memory filesystem is too much for our older machines--let's go
# with 64MB for now. # with 64MB for now.
# #
my $MEMFS_SIZE = (64 * 1024 * 1024); my $MEMFS_SIZE = "64m";
if ($dofrisbee) { if ($dofrisbee) {
if ($^O eq 'linux') { 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 { } 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 newfs -b 8192 -i 25000 -o space /dev/md4") ||
mysystem("$sudo mount /dev/md4 $localdir")) { mysystem("$sudo mount /dev/md4 $localdir")) {
print STDERR "Could not create $MEMFS_SIZE byte local MFS\n"; print STDERR "Could not create $MEMFS_SIZE byte local MFS\n";
...@@ -389,7 +394,9 @@ foreach my $iid (sort keys %iinfo) { ...@@ -389,7 +394,9 @@ foreach my $iid (sort keys %iinfo) {
# #
if ($dofrisbee) { if ($dofrisbee) {
if ($^O eq 'linux') { 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 { } else {
if (mysystem("$sudo umount $localdir") || if (mysystem("$sudo umount $localdir") ||
mysystem("$sudo mdconfig -d -u 4")) { 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