From owner-svn-src-user@FreeBSD.ORG Sun Jan 20 08:11:54 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A897CB39; Sun, 20 Jan 2013 08:11:54 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7C8BA6AB; Sun, 20 Jan 2013 08:11:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0K8Bs1I086671; Sun, 20 Jan 2013 08:11:54 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0K8BoTh086645; Sun, 20 Jan 2013 08:11:50 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201301200811.r0K8BoTh086645@svn.freebsd.org> From: Xin LI Date: Sun, 20 Jan 2013 08:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245684 - in user/delphij/zfs-lz4: bin/sh contrib/compiler-rt/lib contrib/compiler-rt/lib/arm lib lib/libc/arm lib/libc/arm/aeabi lib/libc/arm/gen lib/libc/quad lib/libcompiler_rt libex... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jan 2013 08:11:54 -0000 Author: delphij Date: Sun Jan 20 08:11:50 2013 New Revision: 245684 URL: http://svnweb.freebsd.org/changeset/base/245684 Log: IFC @245683. Added: user/delphij/zfs-lz4/lib/libc/arm/Symbol_oabi.map - copied unchanged from r245683, head/lib/libc/arm/Symbol_oabi.map user/delphij/zfs-lz4/lib/libc/arm/aeabi/ - copied from r245683, head/lib/libc/arm/aeabi/ - copied from r245683, head/lib/libvmmapi/ - copied unchanged from r245683, head/share/man/man4/bhyve.4 - copied unchanged from r245683, head/sys/amd64/include/vmm.h - copied unchanged from r245683, head/sys/amd64/include/vmm_dev.h - copied unchanged from r245683, head/sys/amd64/include/vmm_instruction_emul.h - copied from r245683, head/sys/amd64/vmm/ - copied from r245683, head/sys/dev/blackhole/ - copied from r245683, head/sys/dev/bvm/ - copied from r245683, head/sys/modules/blackhole/ - copied from r245683, head/sys/modules/vmm/ - copied from r245683, head/usr.sbin/bhyve/ - copied from r245683, head/usr.sbin/bhyvectl/ - copied from r245683, head/usr.sbin/bhyveload/ Directory Properties: user/delphij/zfs-lz4/lib/libvmmapi/ (props changed) user/delphij/zfs-lz4/share/man/man4/bhyve.4 (props changed) user/delphij/zfs-lz4/sys/amd64/include/vmm.h (props changed) user/delphij/zfs-lz4/sys/amd64/include/vmm_dev.h (props changed) user/delphij/zfs-lz4/sys/amd64/include/vmm_instruction_emul.h (props changed) user/delphij/zfs-lz4/sys/amd64/vmm/ (props changed) user/delphij/zfs-lz4/sys/dev/blackhole/ (props changed) user/delphij/zfs-lz4/sys/dev/bvm/ (props changed) user/delphij/zfs-lz4/sys/modules/blackhole/ (props changed) user/delphij/zfs-lz4/sys/modules/vmm/ (props changed) user/delphij/zfs-lz4/usr.sbin/bhyve/ (props changed) user/delphij/zfs-lz4/usr.sbin/bhyvectl/ (props changed) user/delphij/zfs-lz4/usr.sbin/bhyveload/ (props changed) Modified: user/delphij/zfs-lz4/bin/sh/input.c user/delphij/zfs-lz4/contrib/compiler-rt/lib/arm/aeabi_uldivmod.S user/delphij/zfs-lz4/contrib/compiler-rt/lib/int_lib.h user/delphij/zfs-lz4/lib/Makefile user/delphij/zfs-lz4/lib/libc/arm/Makefile.inc user/delphij/zfs-lz4/lib/libc/arm/SYS.h user/delphij/zfs-lz4/lib/libc/arm/Symbol.map user/delphij/zfs-lz4/lib/libc/arm/gen/Makefile.inc user/delphij/zfs-lz4/lib/libc/quad/Makefile.inc user/delphij/zfs-lz4/lib/libcompiler_rt/Makefile user/delphij/zfs-lz4/libexec/rtld-elf/Makefile user/delphij/zfs-lz4/sbin/newfs_msdos/newfs_msdos.c user/delphij/zfs-lz4/share/man/man4/Makefile user/delphij/zfs-lz4/share/mk/bsd.libnames.mk user/delphij/zfs-lz4/sys/amd64/amd64/pmap.c user/delphij/zfs-lz4/sys/arm/ti/ti_scm.c user/delphij/zfs-lz4/sys/boot/arm/uboot/Makefile user/delphij/zfs-lz4/sys/boot/fdt/dts/beaglebone.dts user/delphij/zfs-lz4/sys/cam/scsi/scsi_all.c user/delphij/zfs-lz4/sys/conf/Makefile.arm user/delphij/zfs-lz4/sys/conf/files.amd64 user/delphij/zfs-lz4/sys/conf/ldscript.arm user/delphij/zfs-lz4/sys/dev/usb/storage/umass.c user/delphij/zfs-lz4/sys/i386/i386/pmap.c user/delphij/zfs-lz4/sys/modules/Makefile user/delphij/zfs-lz4/usr.bin/xinstall/install.1 user/delphij/zfs-lz4/usr.sbin/Makefile.amd64 user/delphij/zfs-lz4/usr.sbin/bsdinstall/partedit/diskeditor.c Directory Properties: user/delphij/zfs-lz4/ (props changed) user/delphij/zfs-lz4/contrib/compiler-rt/ (props changed) user/delphij/zfs-lz4/lib/libc/ (props changed) user/delphij/zfs-lz4/sbin/ (props changed) user/delphij/zfs-lz4/share/man/man4/ (props changed) user/delphij/zfs-lz4/sys/ (props changed) user/delphij/zfs-lz4/sys/boot/ (props changed) user/delphij/zfs-lz4/sys/conf/ (props changed) Modified: user/delphij/zfs-lz4/bin/sh/input.c ============================================================================== --- user/delphij/zfs-lz4/bin/sh/input.c Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/bin/sh/input.c Sun Jan 20 08:11:50 2013 (r245684) @@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$"); #define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */ -MKINIT struct strpush { struct strpush *prev; /* preceding string on stack */ char *prevstring; @@ -78,7 +77,6 @@ struct strpush { * contains information about the current file being read. */ -MKINIT struct parsefile { struct parsefile *prev; /* preceding file on stack */ int linno; /* current line */ @@ -96,8 +94,11 @@ int plinno = 1; /* input line number * int parsenleft; /* copy of parsefile->nleft */ MKINIT int parselleft; /* copy of parsefile->lleft */ char *parsenextc; /* copy of parsefile->nextc */ -MKINIT struct parsefile basepf; /* top level input file */ -char basebuf[BUFSIZ + 1]; /* buffer for top level input file */ +static char basebuf[BUFSIZ + 1];/* buffer for top level input file */ +static struct parsefile basepf = { /* top level input file */ + .nextc = basebuf, + .buf = basebuf +}; static struct parsefile *parsefile = &basepf; /* current input file */ int whichprompt; /* 1 == PS1, 2 == PS2 */ @@ -111,12 +112,6 @@ static void popstring(void); INCLUDE "input.h" INCLUDE "error.h" -MKINIT char basebuf[]; - -INIT { - basepf.nextc = basepf.buf = basebuf; -} - RESET { popallfiles(); parselleft = parsenleft = 0; /* clear input buffer */ Modified: user/delphij/zfs-lz4/contrib/compiler-rt/lib/arm/aeabi_uldivmod.S ============================================================================== --- user/delphij/zfs-lz4/contrib/compiler-rt/lib/arm/aeabi_uldivmod.S Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/contrib/compiler-rt/lib/arm/aeabi_uldivmod.S Sun Jan 20 08:11:50 2013 (r245684) @@ -27,4 +27,5 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_uldiv ldr r2, [sp, #8] ldr r3, [sp, #12] add sp, sp, #16 - pop {r11, pc} \ No newline at end of file + pop {r11, pc} + Modified: user/delphij/zfs-lz4/contrib/compiler-rt/lib/int_lib.h ============================================================================== --- user/delphij/zfs-lz4/contrib/compiler-rt/lib/int_lib.h Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/contrib/compiler-rt/lib/int_lib.h Sun Jan 20 08:11:50 2013 (r245684) @@ -25,7 +25,15 @@ #if __ARM_EABI__ # define ARM_EABI_FNALIAS(aeabi_name, name) \ void __aeabi_##aeabi_name() __attribute__((alias("__" #name))); -# define COMPILER_RT_ABI __attribute__((pcs("aapcs"))) + +# if !defined(__clang__) && defined(__GNUC__) && \ + (__GNUC__ < 4 || __GNUC__ == 4 && __GNUC_MINOR__ < 5) +/* The pcs attribute was introduced in GCC 4.5.0 */ +# define COMPILER_RT_ABI +# else +# define COMPILER_RT_ABI __attribute__((pcs("aapcs"))) +# endif + #else # define ARM_EABI_FNALIAS(aeabi_name, name) # define COMPILER_RT_ABI Modified: user/delphij/zfs-lz4/lib/Makefile ============================================================================== --- user/delphij/zfs-lz4/lib/Makefile Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/lib/Makefile Sun Jan 20 08:11:50 2013 (r245684) @@ -115,6 +115,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libusbhid} \ ${_libusb} \ ${_libvgl} \ + ${_libvmmapi} \ libwrap \ liby \ libz \ @@ -198,6 +199,10 @@ _libproc= libproc _librtld_db= librtld_db .endif +.if ${MACHINE_CPUARCH} == "amd64" +_libvmmapi= libvmmapi +.endif + .if ${MACHINE_CPUARCH} == "ia64" _libefi= libefi .endif Modified: user/delphij/zfs-lz4/lib/libc/arm/Makefile.inc ============================================================================== --- user/delphij/zfs-lz4/lib/libc/arm/Makefile.inc Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/lib/libc/arm/Makefile.inc Sun Jan 20 08:11:50 2013 (r245684) @@ -8,3 +8,11 @@ SOFTFLOAT_BITS=32 # Long double is just double precision. MDSRCS+=machdep_ldisd.c SYM_MAPS+=${.CURDIR}/arm/Symbol.map + +.if ${MK_ARM_EABI} == "no" +# This contains the symbols that were removed when moving to the ARM EABI +SYM_MAPS+=${.CURDIR}/arm/Symbol_oabi.map +.else +.include "${.CURDIR}/arm/aeabi/Makefile.inc" +.endif + Modified: user/delphij/zfs-lz4/lib/libc/arm/SYS.h ============================================================================== --- user/delphij/zfs-lz4/lib/libc/arm/SYS.h Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/lib/libc/arm/SYS.h Sun Jan 20 08:11:50 2013 (r245684) @@ -39,7 +39,15 @@ #include #include +#ifdef __ARM_EABI__ +#define SYSTRAP(x) \ + mov ip, r7; \ + ldr r7, =SYS_ ## x; \ + swi 0; \ + mov r7, ip +#else #define SYSTRAP(x) swi 0 | SYS_ ## x +#endif #define CERROR _C_LABEL(cerror) #define CURBRK _C_LABEL(curbrk) Modified: user/delphij/zfs-lz4/lib/libc/arm/Symbol.map ============================================================================== --- user/delphij/zfs-lz4/lib/libc/arm/Symbol.map Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/lib/libc/arm/Symbol.map Sun Jan 20 08:11:50 2013 (r245684) @@ -46,10 +46,6 @@ FBSDprivate_1.0 { _set_tp; __aeabi_read_tp; ___longjmp; - __umodsi3; - __modsi3; - __udivsi3; - __divsi3; __makecontext; __longjmp; signalcontext; Copied: user/delphij/zfs-lz4/lib/libc/arm/Symbol_oabi.map (from r245683, head/lib/libc/arm/Symbol_oabi.map) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/delphij/zfs-lz4/lib/libc/arm/Symbol_oabi.map Sun Jan 20 08:11:50 2013 (r245684, copy of r245683, head/lib/libc/arm/Symbol_oabi.map) @@ -0,0 +1,16 @@ +/* + * $FreeBSD$ + */ + +/* + * This only needs to contain symbols that are not listed in + * symbol maps from other parts of libc (i.e., not found in + * stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...) + * and are not used in the ARM EABI. + */ +FBSDprivate_1.0 { + __umodsi3; + __modsi3; + __udivsi3; + __divsi3; +}; Modified: user/delphij/zfs-lz4/lib/libc/arm/gen/Makefile.inc ============================================================================== --- user/delphij/zfs-lz4/lib/libc/arm/gen/Makefile.inc Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/lib/libc/arm/gen/Makefile.inc Sun Jan 20 08:11:50 2013 (r245684) @@ -3,4 +3,8 @@ SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \ getcontextx.c infinity.c ldexp.c makecontext.c \ - __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S divsi3.S flt_rounds.c + __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S flt_rounds.c + +.if ${MK_ARM_EABI} == "no" +SRCS+= divsi3.S +.endif Modified: user/delphij/zfs-lz4/lib/libc/quad/Makefile.inc ============================================================================== --- user/delphij/zfs-lz4/lib/libc/quad/Makefile.inc Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/lib/libc/quad/Makefile.inc Sun Jan 20 08:11:50 2013 (r245684) @@ -8,6 +8,10 @@ SRCS+= cmpdi2.c divdi3.c moddi3.c qdivrem.c ucmpdi2.c udivdi3.c umoddi3.c +.elif ${LIBC_ARCH} == "arm" && ${MK_ARM_EABI} != "no" + +SRCS+= adddi3.c anddi3.c floatunsdidf.c iordi3.c lshldi3.c notdi2.c \ + qdivrem.c subdi3.c xordi3.c .else SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c fixdfdi.c \ Modified: user/delphij/zfs-lz4/lib/libcompiler_rt/Makefile ============================================================================== --- user/delphij/zfs-lz4/lib/libcompiler_rt/Makefile Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/lib/libcompiler_rt/Makefile Sun Jan 20 08:11:50 2013 (r245684) @@ -136,18 +136,22 @@ SRCF+= adddf3 \ addsf3 \ divdf3 \ divsf3 \ - divsi3 \ extendsfdf2 \ fixdfsi \ fixsfsi \ floatsidf \ floatsisf \ - modsi3 \ muldf3 \ mulsf3 \ subdf3 \ subsf3 \ - truncdfsf2 \ + truncdfsf2 +.endif + +.if ${MACHINE_CPUARCH} != "mips" && \ + (${MACHINE_CPUARCH} != "arm" || ${MK_ARM_EABI} != "no") +SRCF+= divsi3 \ + modsi3 \ udivsi3 \ umodsi3 .endif @@ -181,6 +185,13 @@ SRCS+= ${file}.c . endif .endfor +.if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" +SRCS+= aeabi_idivmod.S \ + aeabi_ldivmod.S \ + aeabi_uidivmod.S \ + aeabi_uldivmod.S +.endif + .if ${MACHINE_CPUARCH} != "mips" . if ${MK_INSTALLLIB} != "no" SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a Modified: user/delphij/zfs-lz4/libexec/rtld-elf/Makefile ============================================================================== --- user/delphij/zfs-lz4/libexec/rtld-elf/Makefile Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/libexec/rtld-elf/Makefile Sun Jan 20 08:11:50 2013 (r245684) @@ -42,6 +42,16 @@ LDFLAGS+= -shared -Wl,-Bsymbolic DPADD= ${LIBC_PIC} LDADD= -lc_pic +.if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" +# Some of the required math functions (div & mod) are implemented in libgcc +# on ARM. The library also needs to be placed first to be correctly linked. +# As some of the functions are used before we have shared libraries. +DPADD+= ${LIBGCC} +LDADD+= -lgcc +.endif + + + .if ${MK_SYMVER} == "yes" LIBCDIR= ${TOPSRCDIR}/lib/libc VERSION_DEF= ${LIBCDIR}/Versions.def Modified: user/delphij/zfs-lz4/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- user/delphij/zfs-lz4/sbin/newfs_msdos/newfs_msdos.c Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/sbin/newfs_msdos/newfs_msdos.c Sun Jan 20 08:11:50 2013 (r245684) @@ -808,7 +808,7 @@ getdiskinfo(int fd, const char *fname, c struct stat st; if (fstat(fd, &st)) - err(1, "Cannot get disk size"); + err(1, "cannot get disk size"); /* create a fake geometry for a file image */ ms = st.st_size; dlp.d_secsize = 512; @@ -832,18 +832,18 @@ getdiskinfo(int fd, const char *fname, c if (ioctl(fd, DIOCGDINFO, &dlp) == -1) { if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE, &dlp.d_secsize) == -1) - errx(1, "Cannot get sector size, %s", strerror(errno)); + err(1, "cannot get sector size"); dlp.d_secperunit = ms / dlp.d_secsize; if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS, &dlp.d_nsectors) == -1) { - warnx("Cannot get number of sectors per track, %s", strerror(errno)); + warn("cannot get number of sectors per track"); dlp.d_nsectors = 63; } if (bpb->bpbHeads == 0 && ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) { - warnx("Cannot get number of heads, %s", strerror(errno)); + warn("cannot get number of heads"); if (dlp.d_secperunit <= 63*1*1024) dlp.d_ntracks = 1; else if (dlp.d_secperunit <= 63*16*1024) Modified: user/delphij/zfs-lz4/share/man/man4/Makefile ============================================================================== --- user/delphij/zfs-lz4/share/man/man4/Makefile Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/share/man/man4/Makefile Sun Jan 20 08:11:50 2013 (r245684) @@ -70,6 +70,7 @@ MAN= aac.4 \ bce.4 \ bfe.4 \ bge.4 \ + ${_bhyve.4} \ bktr.4 \ blackhole.4 \ bpf.4 \ @@ -784,6 +785,7 @@ MLINKS+=lindev.4 full.4 .endif .if ${MACHINE_CPUARCH} == "amd64" +_bhyve.4= bhyve.4 _qlxgb.4= qlxgb.4 _sfxge.4= sfxge.4 Copied: user/delphij/zfs-lz4/share/man/man4/bhyve.4 (from r245683, head/share/man/man4/bhyve.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/delphij/zfs-lz4/share/man/man4/bhyve.4 Sun Jan 20 08:11:50 2013 (r245684, copy of r245683, head/share/man/man4/bhyve.4) @@ -0,0 +1,68 @@ +.\" +.\" Copyright (c) 2012 NetApp Inc +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 5, 2013 +.Dt BHYVE 4 +.Os +.Sh NAME +.Nm bhyve +.Nd virtual machine monitor +.Sh SYNOPSIS +.Cd "/usr/sbin/bhyve" +.Cd "/usr/sbin/bhyveload" +.Cd "/usr/sbin/bhyvectl" +.Cd "/boot/kernel/vmm.ko" +.Sh DESCRIPTION +.Nm +is a virtual machine monitor that is hosted by FreeBSD. It is used to host +unmodified guest operating systems on top of FreeBSD. +.Pp +.Nm +relies heavily on hardware assist provided by the CPU and chipset to virtualize +processor and memory resources. +.Sh SEE ALSO +.Xr bhyve 8 , +.Xr bhyveload 8 , +.Xr bhyvectl 8 , +.Xr vmm 4 +.Sh HISTORY +.Nm +first appeared in +.Fx 10.0 , +and was developed at NetApp Inc. +.Sh AUTHORS +.Nm +was developed by +.An -nosplit +.An "Peter Grehan" Aq grehan@FreeBSD.org +and +.An "Neel Natu" Aq neel@FreeBSD.org +at NetApp Inc. +.Sh BUGS +.Nm +is considered experimental in +.Fx . Modified: user/delphij/zfs-lz4/share/mk/bsd.libnames.mk ============================================================================== --- user/delphij/zfs-lz4/share/mk/bsd.libnames.mk Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/share/mk/bsd.libnames.mk Sun Jan 20 08:11:50 2013 (r245684) @@ -162,6 +162,7 @@ LIBULOG?= ${DESTDIR}${LIBDIR}/libulog.a LIBUTIL?= ${DESTDIR}${LIBDIR}/libutil.a LIBUUTIL?= ${DESTDIR}${LIBDIR}/libuutil.a LIBVGL?= ${DESTDIR}${LIBDIR}/libvgl.a +LIBVMMAPI?= ${DESTDIR}${LIBDIR}/libvmmapi.a LIBWIND?= ${DESTDIR}${LIBDIR}/libwind.a LIBWRAP?= ${DESTDIR}${LIBDIR}/libwrap.a LIBXPG4?= ${DESTDIR}${LIBDIR}/libxpg4.a Modified: user/delphij/zfs-lz4/sys/amd64/amd64/pmap.c ============================================================================== --- user/delphij/zfs-lz4/sys/amd64/amd64/pmap.c Sun Jan 20 07:45:04 2013 (r245683) +++ user/delphij/zfs-lz4/sys/amd64/amd64/pmap.c Sun Jan 20 08:11:50 2013 (r245684) @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); #include "opt_vm.h" #include +#include #include #include #include @@ -133,6 +134,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include Copied: user/delphij/zfs-lz4/sys/amd64/include/vmm.h (from r245683, head/sys/amd64/include/vmm.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/delphij/zfs-lz4/sys/amd64/include/vmm.h Sun Jan 20 08:11:50 2013 (r245684, copy of r245683, head/sys/amd64/include/vmm.h) @@ -0,0 +1,293 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VMM_H_ +#define _VMM_H_ + +#ifdef _KERNEL + +#define VM_MAX_NAMELEN 32 + +struct vm; +struct vm_memory_segment; +struct seg_desc; +struct vm_exit; +struct vm_run; +struct vlapic; + +enum x2apic_state; + +typedef int (*vmm_init_func_t)(void); +typedef int (*vmm_cleanup_func_t)(void); +typedef void * (*vmi_init_func_t)(struct vm *vm); /* instance specific apis */ +typedef int (*vmi_run_func_t)(void *vmi, int vcpu, register_t rip); +typedef void (*vmi_cleanup_func_t)(void *vmi); +typedef int (*vmi_mmap_set_func_t)(void *vmi, vm_paddr_t gpa, + vm_paddr_t hpa, size_t length, + vm_memattr_t attr, int prot, + boolean_t superpages_ok); +typedef vm_paddr_t (*vmi_mmap_get_func_t)(void *vmi, vm_paddr_t gpa); +typedef int (*vmi_get_register_t)(void *vmi, int vcpu, int num, + uint64_t *retval); +typedef int (*vmi_set_register_t)(void *vmi, int vcpu, int num, + uint64_t val); +typedef int (*vmi_get_desc_t)(void *vmi, int vcpu, int num, + struct seg_desc *desc); +typedef int (*vmi_set_desc_t)(void *vmi, int vcpu, int num, + struct seg_desc *desc); +typedef int (*vmi_inject_event_t)(void *vmi, int vcpu, + int type, int vector, + uint32_t code, int code_valid); +typedef int (*vmi_get_cap_t)(void *vmi, int vcpu, int num, int *retval); +typedef int (*vmi_set_cap_t)(void *vmi, int vcpu, int num, int val); + +struct vmm_ops { + vmm_init_func_t init; /* module wide initialization */ + vmm_cleanup_func_t cleanup; + + vmi_init_func_t vminit; /* vm-specific initialization */ + vmi_run_func_t vmrun; + vmi_cleanup_func_t vmcleanup; + vmi_mmap_set_func_t vmmmap_set; + vmi_mmap_get_func_t vmmmap_get; + vmi_get_register_t vmgetreg; + vmi_set_register_t vmsetreg; + vmi_get_desc_t vmgetdesc; + vmi_set_desc_t vmsetdesc; + vmi_inject_event_t vminject; + vmi_get_cap_t vmgetcap; + vmi_set_cap_t vmsetcap; +}; + +extern struct vmm_ops vmm_ops_intel; +extern struct vmm_ops vmm_ops_amd; + +struct vm *vm_create(const char *name); +void vm_destroy(struct vm *vm); +const char *vm_name(struct vm *vm); +int vm_malloc(struct vm *vm, vm_paddr_t gpa, size_t len); +int vm_map_mmio(struct vm *vm, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); +int vm_unmap_mmio(struct vm *vm, vm_paddr_t gpa, size_t len); +vm_paddr_t vm_gpa2hpa(struct vm *vm, vm_paddr_t gpa, size_t size); +int vm_gpabase2memseg(struct vm *vm, vm_paddr_t gpabase, + struct vm_memory_segment *seg); +int vm_get_register(struct vm *vm, int vcpu, int reg, uint64_t *retval); +int vm_set_register(struct vm *vm, int vcpu, int reg, uint64_t val); +int vm_get_seg_desc(struct vm *vm, int vcpu, int reg, + struct seg_desc *ret_desc); +int vm_set_seg_desc(struct vm *vm, int vcpu, int reg, + struct seg_desc *desc); +int vm_get_pinning(struct vm *vm, int vcpu, int *cpuid); +int vm_set_pinning(struct vm *vm, int vcpu, int cpuid); +int vm_run(struct vm *vm, struct vm_run *vmrun); +int vm_inject_event(struct vm *vm, int vcpu, int type, + int vector, uint32_t error_code, int error_code_valid); +int vm_inject_nmi(struct vm *vm, int vcpu); +int vm_nmi_pending(struct vm *vm, int vcpuid); +void vm_nmi_clear(struct vm *vm, int vcpuid); +uint64_t *vm_guest_msrs(struct vm *vm, int cpu); +struct vlapic *vm_lapic(struct vm *vm, int cpu); +int vm_get_capability(struct vm *vm, int vcpu, int type, int *val); +int vm_set_capability(struct vm *vm, int vcpu, int type, int val); +int vm_get_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state *state); +int vm_set_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state state); +void vm_activate_cpu(struct vm *vm, int vcpu); +cpuset_t vm_active_cpus(struct vm *vm); +struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid); + +/* + * Return 1 if device indicated by bus/slot/func is supposed to be a + * pci passthrough device. + * + * Return 0 otherwise. + */ +int vmm_is_pptdev(int bus, int slot, int func); + +void *vm_iommu_domain(struct vm *vm); + +enum vcpu_state { + VCPU_IDLE, + VCPU_RUNNING, + VCPU_CANNOT_RUN, +}; + +int vcpu_set_state(struct vm *vm, int vcpu, enum vcpu_state state); +enum vcpu_state vcpu_get_state(struct vm *vm, int vcpu); + +static int __inline +vcpu_is_running(struct vm *vm, int vcpu) +{ + return (vcpu_get_state(vm, vcpu) == VCPU_RUNNING); +} + +void *vcpu_stats(struct vm *vm, int vcpu); +void vm_interrupt_hostcpu(struct vm *vm, int vcpu); + +#endif /* KERNEL */ + +#include + +#define VM_MAXCPU 8 /* maximum virtual cpus */ + +/* + * Identifiers for events that can be injected into the VM + */ +enum vm_event_type { + VM_EVENT_NONE, + VM_HW_INTR, + VM_NMI, + VM_HW_EXCEPTION, + VM_SW_INTR, + VM_PRIV_SW_EXCEPTION, + VM_SW_EXCEPTION, + VM_EVENT_MAX +}; + +/* + * Identifiers for architecturally defined registers. + */ +enum vm_reg_name { + VM_REG_GUEST_RAX, + VM_REG_GUEST_RBX, + VM_REG_GUEST_RCX, + VM_REG_GUEST_RDX, + VM_REG_GUEST_RSI, + VM_REG_GUEST_RDI, + VM_REG_GUEST_RBP, + VM_REG_GUEST_R8, + VM_REG_GUEST_R9, + VM_REG_GUEST_R10, + VM_REG_GUEST_R11, + VM_REG_GUEST_R12, + VM_REG_GUEST_R13, + VM_REG_GUEST_R14, + VM_REG_GUEST_R15, + VM_REG_GUEST_CR0, + VM_REG_GUEST_CR3, + VM_REG_GUEST_CR4, + VM_REG_GUEST_DR7, + VM_REG_GUEST_RSP, + VM_REG_GUEST_RIP, + VM_REG_GUEST_RFLAGS, + VM_REG_GUEST_ES, + VM_REG_GUEST_CS, + VM_REG_GUEST_SS, + VM_REG_GUEST_DS, + VM_REG_GUEST_FS, + VM_REG_GUEST_GS, + VM_REG_GUEST_LDTR, + VM_REG_GUEST_TR, + VM_REG_GUEST_IDTR, + VM_REG_GUEST_GDTR, + VM_REG_GUEST_EFER, + VM_REG_LAST +}; + +/* + * Identifiers for optional vmm capabilities + */ +enum vm_cap_type { + VM_CAP_HALT_EXIT, + VM_CAP_MTRAP_EXIT, + VM_CAP_PAUSE_EXIT, + VM_CAP_UNRESTRICTED_GUEST, + VM_CAP_MAX +}; + +enum x2apic_state { + X2APIC_ENABLED, + X2APIC_AVAILABLE, + X2APIC_DISABLED, + X2APIC_STATE_LAST +}; + +/* + * The 'access' field has the format specified in Table 21-2 of the Intel + * Architecture Manual vol 3b. + * + * XXX The contents of the 'access' field are architecturally defined except + * bit 16 - Segment Unusable. + */ +struct seg_desc { + uint64_t base; + uint32_t limit; + uint32_t access; +}; + +enum vm_exitcode { + VM_EXITCODE_INOUT, + VM_EXITCODE_VMX, + VM_EXITCODE_BOGUS, + VM_EXITCODE_RDMSR, + VM_EXITCODE_WRMSR, + VM_EXITCODE_HLT, + VM_EXITCODE_MTRAP, + VM_EXITCODE_PAUSE, + VM_EXITCODE_PAGING, + VM_EXITCODE_SPINUP_AP, + VM_EXITCODE_MAX +}; + +struct vm_exit { + enum vm_exitcode exitcode; + int inst_length; /* 0 means unknown */ + uint64_t rip; + union { + struct { + uint16_t bytes:3; /* 1 or 2 or 4 */ + uint16_t in:1; /* out is 0, in is 1 */ + uint16_t string:1; + uint16_t rep:1; + uint16_t port; + uint32_t eax; /* valid for out */ + } inout; + struct { + uint64_t gpa; + struct vie vie; + } paging; + /* + * VMX specific payload. Used when there is no "better" + * exitcode to represent the VM-exit. + */ + struct { + int error; /* vmx inst error */ + uint32_t exit_reason; + uint64_t exit_qualification; + } vmx; + struct { + uint32_t code; /* ecx value */ + uint64_t wval; + } msr; + struct { + int vcpu; + uint64_t rip; + } spinup_ap; + } u; +}; + +#endif /* _VMM_H_ */ Copied: user/delphij/zfs-lz4/sys/amd64/include/vmm_dev.h (from r245683, head/sys/amd64/include/vmm_dev.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/delphij/zfs-lz4/sys/amd64/include/vmm_dev.h Sun Jan 20 08:11:50 2013 (r245684, copy of r245683, head/sys/amd64/include/vmm_dev.h) @@ -0,0 +1,215 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VMM_DEV_H_ +#define _VMM_DEV_H_ + +#ifdef _KERNEL +void vmmdev_init(void); +int vmmdev_cleanup(void); +#endif + +struct vm_memory_segment { + vm_paddr_t gpa; /* in */ + size_t len; /* in */ +}; + +struct vm_register { + int cpuid; + int regnum; /* enum vm_reg_name */ + uint64_t regval; +}; + +struct vm_seg_desc { /* data or code segment */ + int cpuid; + int regnum; /* enum vm_reg_name */ + struct seg_desc desc; +}; + +struct vm_pin { + int vm_cpuid; + int host_cpuid; /* -1 to unpin */ +}; + +struct vm_run { + int cpuid; + uint64_t rip; /* start running here */ + struct vm_exit vm_exit; +}; + +struct vm_event { + int cpuid; + enum vm_event_type type; + int vector; + uint32_t error_code; + int error_code_valid; +}; + +struct vm_lapic_irq { + int cpuid; + int vector; +}; + +struct vm_capability { + int cpuid; + enum vm_cap_type captype; + int capval; + int allcpus; +}; + +struct vm_pptdev { + int bus; + int slot; + int func; +}; + +struct vm_pptdev_mmio { + int bus; + int slot; + int func; + vm_paddr_t gpa; + vm_paddr_t hpa; + size_t len; +}; + +struct vm_pptdev_msi { + int vcpu; + int bus; + int slot; + int func; + int numvec; /* 0 means disabled */ + int vector; + int destcpu; +}; + +struct vm_pptdev_msix { + int vcpu; + int bus; + int slot; + int func; + int idx; + uint32_t msg; + uint32_t vector_control; + uint64_t addr; +}; + +struct vm_nmi { + int cpuid; +}; + +#define MAX_VM_STATS 64 +struct vm_stats { + int cpuid; /* in */ + int num_entries; /* out */ + struct timeval tv; + uint64_t statbuf[MAX_VM_STATS]; +}; + +struct vm_stat_desc { + int index; /* in */ + char desc[128]; /* out */ +}; + +struct vm_x2apic { + int cpuid; + enum x2apic_state state; +}; + +enum { + IOCNUM_RUN, + IOCNUM_SET_PINNING, + IOCNUM_GET_PINNING, + IOCNUM_MAP_MEMORY, + IOCNUM_GET_MEMORY_SEG, + IOCNUM_SET_REGISTER, + IOCNUM_GET_REGISTER, + IOCNUM_SET_SEGMENT_DESCRIPTOR, + IOCNUM_GET_SEGMENT_DESCRIPTOR, + IOCNUM_INJECT_EVENT, + IOCNUM_LAPIC_IRQ, + IOCNUM_SET_CAPABILITY, + IOCNUM_GET_CAPABILITY, + IOCNUM_BIND_PPTDEV, + IOCNUM_UNBIND_PPTDEV, + IOCNUM_MAP_PPTDEV_MMIO, + IOCNUM_PPTDEV_MSI, + IOCNUM_PPTDEV_MSIX, + IOCNUM_INJECT_NMI, + IOCNUM_VM_STATS, + IOCNUM_VM_STAT_DESC, + IOCNUM_SET_X2APIC_STATE, + IOCNUM_GET_X2APIC_STATE, +}; + +#define VM_RUN \ + _IOWR('v', IOCNUM_RUN, struct vm_run) +#define VM_SET_PINNING \ + _IOW('v', IOCNUM_SET_PINNING, struct vm_pin) +#define VM_GET_PINNING \ + _IOWR('v', IOCNUM_GET_PINNING, struct vm_pin) +#define VM_MAP_MEMORY \ + _IOWR('v', IOCNUM_MAP_MEMORY, struct vm_memory_segment) +#define VM_GET_MEMORY_SEG \ + _IOWR('v', IOCNUM_GET_MEMORY_SEG, struct vm_memory_segment) +#define VM_SET_REGISTER \ + _IOW('v', IOCNUM_SET_REGISTER, struct vm_register) +#define VM_GET_REGISTER \ + _IOWR('v', IOCNUM_GET_REGISTER, struct vm_register) +#define VM_SET_SEGMENT_DESCRIPTOR \ + _IOW('v', IOCNUM_SET_SEGMENT_DESCRIPTOR, struct vm_seg_desc) +#define VM_GET_SEGMENT_DESCRIPTOR \ + _IOWR('v', IOCNUM_GET_SEGMENT_DESCRIPTOR, struct vm_seg_desc) +#define VM_INJECT_EVENT \ + _IOW('v', IOCNUM_INJECT_EVENT, struct vm_event) +#define VM_LAPIC_IRQ \ + _IOW('v', IOCNUM_LAPIC_IRQ, struct vm_lapic_irq) +#define VM_SET_CAPABILITY \ + _IOW('v', IOCNUM_SET_CAPABILITY, struct vm_capability) +#define VM_GET_CAPABILITY \ + _IOWR('v', IOCNUM_GET_CAPABILITY, struct vm_capability) +#define VM_BIND_PPTDEV \ + _IOW('v', IOCNUM_BIND_PPTDEV, struct vm_pptdev) +#define VM_UNBIND_PPTDEV \ + _IOW('v', IOCNUM_UNBIND_PPTDEV, struct vm_pptdev) +#define VM_MAP_PPTDEV_MMIO \ + _IOW('v', IOCNUM_MAP_PPTDEV_MMIO, struct vm_pptdev_mmio) +#define VM_PPTDEV_MSI \ + _IOW('v', IOCNUM_PPTDEV_MSI, struct vm_pptdev_msi) +#define VM_PPTDEV_MSIX \ + _IOW('v', IOCNUM_PPTDEV_MSIX, struct vm_pptdev_msix) +#define VM_INJECT_NMI \ + _IOW('v', IOCNUM_INJECT_NMI, struct vm_nmi) +#define VM_STATS \ + _IOWR('v', IOCNUM_VM_STATS, struct vm_stats) +#define VM_STAT_DESC \ + _IOWR('v', IOCNUM_VM_STAT_DESC, struct vm_stat_desc) +#define VM_SET_X2APIC_STATE \ + _IOW('v', IOCNUM_SET_X2APIC_STATE, struct vm_x2apic) +#define VM_GET_X2APIC_STATE \ + _IOWR('v', IOCNUM_GET_X2APIC_STATE, struct vm_x2apic) +#endif Copied: user/delphij/zfs-lz4/sys/amd64/include/vmm_instruction_emul.h (from r245683, head/sys/amd64/include/vmm_instruction_emul.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/delphij/zfs-lz4/sys/amd64/include/vmm_instruction_emul.h Sun Jan 20 08:11:50 2013 (r245684, copy of r245683, head/sys/amd64/include/vmm_instruction_emul.h) @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2012 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VMM_INSTRUCTION_EMUL_H_ +#define _VMM_INSTRUCTION_EMUL_H_ + +/* + * The data structures 'vie' and 'vie_op' are meant to be opaque to the + * consumers of instruction decoding. The only reason why their contents + * need to be exposed is because they are part of the 'vm_exit' structure. + */ +struct vie_op { + uint8_t op_byte; /* actual opcode byte */ + uint8_t op_type; /* type of operation (e.g. MOV) */ + uint16_t op_flags; +}; + +#define VIE_INST_SIZE 15 +struct vie { + uint8_t inst[VIE_INST_SIZE]; /* instruction bytes */ + uint8_t num_valid; /* size of the instruction */ + uint8_t num_processed; + + uint8_t rex_w:1, /* REX prefix */ + rex_r:1, + rex_x:1, + rex_b:1; + + uint8_t mod:2, /* ModRM byte */ + reg:4, + rm:4; + + uint8_t ss:2, /* SIB byte */ + index:4, + base:4; + + uint8_t disp_bytes; + uint8_t imm_bytes; + + uint8_t scale; + int base_register; /* VM_REG_GUEST_xyz */ + int index_register; /* VM_REG_GUEST_xyz */ + + int64_t displacement; /* optional addr displacement */ + int64_t immediate; /* optional immediate operand */ + + uint8_t decoded; /* set to 1 if successfully decoded */ + + struct vie_op op; /* opcode description */ +}; + +/* + * Callback functions to read and write memory regions. + */ +typedef int (*mem_region_read_t)(void *vm, int cpuid, uint64_t gpa, + uint64_t *rval, int rsize, void *arg); + +typedef int (*mem_region_write_t)(void *vm, int cpuid, uint64_t gpa, + uint64_t wval, int wsize, void *arg); + +/* + * Emulate the decoded 'vie' instruction. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Jan 20 08:26:13 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9BD98FD7; Sun, 20 Jan 2013 08:26:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8A72C708; Sun, 20 Jan 2013 08:26:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0K8QDuG090271; Sun, 20 Jan 2013 08:26:13 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0K8QAiw090246; Sun, 20 Jan 2013 08:26:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201301200826.r0K8QAiw090246@svn.freebsd.org> From: Xin LI Date: Sun, 20 Jan 2013 08:26:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245686 - in user/delphij/zfs-lz4: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/boot/zfs sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/com... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jan 2013 08:26:13 -0000 Author: delphij Date: Sun Jan 20 08:26:09 2013 New Revision: 245686 URL: http://svnweb.freebsd.org/changeset/base/245686 Log: WIP checkpoint for LZ4 merge (MFV r245512). WARNING: there is known data corruption issue with this version and this is only intended for developers. Added: user/delphij/zfs-lz4/sys/cddl/boot/zfs/lz4.c (contents, props changed) user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4 - copied unchanged from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4 user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip - copied unchanged from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c - copied, changed from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c Modified: user/delphij/zfs-lz4/cddl/contrib/opensolaris/cmd/zfs/zfs.8 user/delphij/zfs-lz4/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 user/delphij/zfs-lz4/sys/cddl/boot/zfs/README user/delphij/zfs-lz4/sys/cddl/boot/zfs/zfsimpl.h user/delphij/zfs-lz4/sys/cddl/boot/zfs/zfssubr.c user/delphij/zfs-lz4/sys/cddl/compat/opensolaris/sys/byteorder.h user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/Makefile.files user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Directory Properties: user/delphij/zfs-lz4/cddl/contrib/opensolaris/ (props changed) user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/ (props changed) Modified: user/delphij/zfs-lz4/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- user/delphij/zfs-lz4/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Jan 20 08:26:09 2013 (r245686) @@ -24,6 +24,7 @@ .\" Copyright (c) 2011, Pawel Jakub Dawidek .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery +.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. .\" .\" $FreeBSD$ .\" @@ -866,7 +867,7 @@ but this may change in future releases). disables integrity checking on user data. Disabling checksums is .Em NOT a recommended practice. -.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle +.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | zle | Cm lz4 Controls the compression algorithm used for this dataset. The .Cm lzjb compression algorithm is optimized for performance while providing decent data @@ -894,6 +895,26 @@ The .Cm zle compression algorithm compresses runs of zeros. .Pp +The +.Sy lz4 +compression algorithm is a high-performance replacement +for the +.Sy lzjb +algorithm. It features significantly faster +compression and decompression, as well as a moderately higher +compression ratio than +.Sy lzjb , +but can only be used on pools with +the +.Sy lz4_compress +feature set to +.Sy enabled . +See +.Xr zpool-features 7 +for details on ZFS feature flags and the +.Sy lz4_compress +feature. +.Pp This property can also be referred to by its shortened column name .Cm compress . Changing this property affects only newly-written data. Modified: user/delphij/zfs-lz4/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- user/delphij/zfs-lz4/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sun Jan 20 08:26:09 2013 (r245686) @@ -18,6 +18,7 @@ .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" Copyright (c) 2012 by Delphix. All rights reserved. +.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. .\" .\" $FreeBSD$ .\" @@ -185,6 +186,49 @@ This feature is .Sy active while there are any filesystems, volumes, or snapshots which were created after enabling this feature. +.It Sy lz4_compress +.Bl -column "READ\-ONLY COMPATIBLE" "org.illumos:lz4_compress" +.It GUID Ta org.illumos:lz4_compress +.It READ\-ONLY COMPATIBLE Ta no +.It DEPENDENCIES Ta none +.El +.Pp +.Sy lz4 +is a high-performance real-time compression algorithm that +features significantly faster compression and decompression as well as a +higher compression ratio than the older +.Sy lzjb +compression. +Typically, +.Sy lz4 +compression is approximately 50% faster on +compressible data and 200% faster on incompressible data than +.Sy lzjb . +It is also approximately 80% faster on decompression, while +giving approximately 10% better compression ratio. +.Pp +When the +.Sy lz4_compress +feature is set to +.Sy enabled , +the +administrator can turn on +.Sy lz4 +compression on any dataset on the +pool using the +.Xr zfs 8 +command. Please note that doing so will +immediately activate the +.Sy lz4_compress +feature on the underlying +pool (even before any data is written). Since this feature is not +read-only compatible, this operation will render the pool unimportable +on systems without support for the +.Sy lz4_compress +feature. At the +moment, this operation cannot be reversed. Booting off of +.Sy lz4 +-compressed root pools is supported. .El .Sh SEE ALSO .Xr zpool 8 Modified: user/delphij/zfs-lz4/sys/cddl/boot/zfs/README ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/boot/zfs/README Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/boot/zfs/README Sun Jan 20 08:26:09 2013 (r245686) @@ -5,6 +5,7 @@ are used by the ZFS bootstrap: fletcher.c checksum support sha256.c checksum support + lz4.c compression support lzjb.c compression support zfssubr.c checksum, compression and raidz support zfsimpl.h mostly describing the physical layout Added: user/delphij/zfs-lz4/sys/cddl/boot/zfs/lz4.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/delphij/zfs-lz4/sys/cddl/boot/zfs/lz4.c Sun Jan 20 08:26:09 2013 (r245686) @@ -0,0 +1,310 @@ +/* + * LZ4 - Fast LZ compression algorithm + * Header File + * Copyright (C) 2011-2013, Yann Collet. + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at : + * - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html + * - LZ4 source repository : http://code.google.com/p/lz4/ + */ + +static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, + int isize, int maxOutputSize); + +/* ARGSUSED */ +static int +lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int dummy __unused) +{ + const uint8_t *src = s_start; + uint32_t bufsiz = htonl(*(uint32_t *)src); + + /* invalid compressed buffer size encoded at start */ + if (bufsiz + 4 > s_len) + return (1); + + /* + * Returns 0 on success (decompression function returned non-negative) + * and non-zero on failure (decompression function returned negative). + */ + return (LZ4_uncompress_unknownOutputSize(s_start + 4, d_start, bufsiz, + d_len) < 0); +} + +/* + * CPU Feature Detection + */ + +/* 32 or 64 bits ? */ +#if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || \ + defined(__amd64) || defined(__ppc64__) || defined(_WIN64) || \ + defined(__LP64__) || defined(_LP64)) +#define LZ4_ARCH64 1 +#else +#define LZ4_ARCH64 0 +#endif + +/* + * Little Endian or Big Endian? + * Note: overwrite the below #define if you know your architecture endianess. + */ +#if (defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) || \ + defined(_BIG_ENDIAN) || defined(_ARCH_PPC) || defined(__PPC__) || \ + defined(__PPC) || defined(PPC) || defined(__powerpc__) || \ + defined(__powerpc) || defined(powerpc) || \ + ((defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)))) +#define LZ4_BIG_ENDIAN 1 +#else + /* + * Little Endian assumed. PDP Endian and other very rare endian format + * are unsupported. + */ +#endif + +/* + * Compiler Options + */ +#if __STDC_VERSION__ >= 199901L /* C99 */ +/* "restrict" is a known keyword */ +#else +/* Disable restrict */ +#define restrict +#endif + +#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) + +#define lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) \ + | (((x) & 0xffu) << 8))) + +#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__) +#define expect(expr, value) (__builtin_expect((expr), (value))) +#else +#define expect(expr, value) (expr) +#endif + +#define likely(expr) expect((expr) != 0, 1) +#define unlikely(expr) expect((expr) != 0, 0) + +/* Basic types */ +#define BYTE uint8_t +#define U16 uint16_t +#define U32 uint32_t +#define S32 int32_t +#define U64 uint64_t + +typedef struct _U16_S { + U16 v; +} U16_S; +typedef struct _U32_S { + U32 v; +} U32_S; +typedef struct _U64_S { + U64 v; +} U64_S; + +#define A64(x) (((U64_S *)(x))->v) +#define A32(x) (((U32_S *)(x))->v) +#define A16(x) (((U16_S *)(x))->v) + +/* + * Constants + */ +#define MINMATCH 4 + +#define COPYLENGTH 8 +#define LASTLITERALS 5 + +#define ML_BITS 4 +#define ML_MASK ((1U<> ML_BITS)) == RUN_MASK) { + int s = 255; + while ((ip < iend) && (s == 255)) { + s = *ip++; + length += s; + } + } + /* copy literals */ + cpy = op + length; + if ((cpy > oend - COPYLENGTH) || + (ip + length > iend - COPYLENGTH)) { + if (cpy > oend) + /* + * Error: request to write beyond destination + * buffer. + */ + goto _output_error; + if (ip + length > iend) + /* + * Error : request to read beyond source + * buffer. + */ + goto _output_error; + memcpy(op, ip, length); + op += length; + ip += length; + if (ip < iend) + /* Error : LZ4 format violation */ + goto _output_error; + /* Necessarily EOF, due to parsing restrictions. */ + break; + } + LZ4_WILDCOPY(ip, op, cpy); + ip -= (op - cpy); + op = cpy; + + /* get offset */ + LZ4_READ_LITTLEENDIAN_16(ref, cpy, ip); + ip += 2; + if (ref < (BYTE * const) dest) + /* + * Error: offset creates reference outside of + * destination buffer. + */ + goto _output_error; + + /* get matchlength */ + if ((length = (token & ML_MASK)) == ML_MASK) { + while (ip < iend) { + int s = *ip++; + length += s; + if (s == 255) + continue; + break; + } + } + /* copy repeated sequence */ + if unlikely(op - ref < STEPSIZE) { +#if LZ4_ARCH64 + size_t dec2table[] = { 0, 0, 0, -1, 0, 1, 2, 3 }; + size_t dec2 = dec2table[op - ref]; +#else + const int dec2 = 0; +#endif + *op++ = *ref++; + *op++ = *ref++; + *op++ = *ref++; + *op++ = *ref++; + ref -= dec[op - ref]; + A32(op) = A32(ref); + op += STEPSIZE - 4; + ref -= dec2; + } else { + LZ4_COPYSTEP(ref, op); + } + cpy = op + length - (STEPSIZE - 4); + if (cpy > oend - COPYLENGTH) { + if (cpy > oend) + /* + * Error: request to write outside of + * destination buffer. + */ + goto _output_error; + LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH)); + while (op < cpy) + *op++ = *ref++; + op = cpy; + if (op == oend) + /* + * Check EOF (should never happen, since last + * 5 bytes are supposed to be literals). + */ + break; + continue; + } + LZ4_SECURECOPY(ref, op, cpy); + op = cpy; /* correction */ + } + + /* end of decoding */ + return (int)(((char *)op) - dest); + + /* write overflow error detected */ + _output_error: + return (int)(-(((char *)ip) - source)); +} Modified: user/delphij/zfs-lz4/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/boot/zfs/zfsimpl.h Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/boot/zfs/zfsimpl.h Sun Jan 20 08:26:09 2013 (r245686) @@ -52,6 +52,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2013 by Saso Kiselkov. All rights reserved. + */ #define MAXNAMELEN 256 @@ -439,6 +442,7 @@ enum zio_compress { ZIO_COMPRESS_GZIP_8, ZIO_COMPRESS_GZIP_9, ZIO_COMPRESS_ZLE, + ZIO_COMPRESS_LZ4, ZIO_COMPRESS_FUNCTIONS }; Modified: user/delphij/zfs-lz4/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/boot/zfs/zfssubr.c Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/boot/zfs/zfssubr.c Sun Jan 20 08:26:09 2013 (r245686) @@ -119,6 +119,7 @@ typedef struct zio_compress_info { #include "lzjb.c" #include "zle.c" +#include "lz4.c" /* * Compression vectors. @@ -139,6 +140,7 @@ static zio_compress_info_t zio_compress_ {NULL, NULL, 8, "gzip-8"}, {NULL, NULL, 9, "gzip-9"}, {NULL, zle_decompress, 64, "zle"}, + {NULL, lz4_decompress, 0, "lz4"}, }; static void Modified: user/delphij/zfs-lz4/sys/cddl/compat/opensolaris/sys/byteorder.h ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/compat/opensolaris/sys/byteorder.h Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/compat/opensolaris/sys/byteorder.h Sun Jan 20 08:26:09 2013 (r245686) @@ -86,4 +86,6 @@ #define ntohll(x) BSWAP_64(x) #endif +#define BE_IN32(xa) htonl(*((uint32_t *)(void *)(xa))) + #endif /* _OPENSOLARIS_SYS_BYTEORDER_H_ */ Modified: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c Sun Jan 20 08:26:09 2013 (r245686) @@ -21,6 +21,7 @@ /* * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifdef _KERNEL @@ -155,4 +156,7 @@ zpool_feature_init(void) zfeature_register(SPA_FEATURE_EMPTY_BPOBJ, "com.delphix:empty_bpobj", "empty_bpobj", "Snapshots use less space.", B_TRUE, B_FALSE, NULL); + zfeature_register(SPA_FEATURE_LZ4_COMPRESS, + "org.illumos:lz4_compress", "lz4_compress", + "LZ4 compression algorithm support.", B_FALSE, B_FALSE, NULL); } Modified: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h Sun Jan 20 08:26:09 2013 (r245686) @@ -21,6 +21,7 @@ /* * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _ZFEATURE_COMMON_H @@ -51,6 +52,7 @@ typedef int (zfeature_func_t)(zfeature_i static enum spa_feature { SPA_FEATURE_ASYNC_DESTROY, SPA_FEATURE_EMPTY_BPOBJ, + SPA_FEATURE_LZ4_COMPRESS, SPA_FEATURES } spa_feature_t; Modified: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Sun Jan 20 08:26:09 2013 (r245686) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -96,6 +97,7 @@ zfs_prop_init(void) { "gzip-8", ZIO_COMPRESS_GZIP_8 }, { "gzip-9", ZIO_COMPRESS_GZIP_9 }, { "zle", ZIO_COMPRESS_ZLE }, + { "lz4", ZIO_COMPRESS_LZ4 }, { NULL } }; @@ -211,8 +213,8 @@ zfs_prop_init(void) zprop_register_index(ZFS_PROP_COMPRESSION, "compression", ZIO_COMPRESS_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, - "on | off | lzjb | gzip | gzip-[1-9] | zle", "COMPRESS", - compress_table); + "on | off | lzjb | gzip | gzip-[1-9] | zle | lz4", + "COMPRESS", compress_table); zprop_register_index(ZFS_PROP_SNAPDIR, "snapdir", ZFS_SNAPDIR_HIDDEN, PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "hidden | visible", "SNAPDIR", snapdir_table); Modified: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sun Jan 20 08:26:09 2013 (r245686) @@ -22,6 +22,7 @@ # # Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012 by Delphix. All rights reserved. +# Copyright (c) 2013 by Saso Kiselkov. All rights reserved. # # # This Makefile defines all file modules for the directory uts/common @@ -56,6 +57,7 @@ ZFS_COMMON_OBJS += \ dsl_scan.o \ zfeature.o \ gzip.o \ + lz4.o \ lzjb.o \ metaslab.o \ refcount.o \ Copied: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4 (from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4 Sun Jan 20 08:26:09 2013 (r245686, copy of r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4) @@ -0,0 +1,30 @@ +LZ4 - Fast LZ compression algorithm +Copyright (C) 2011-2013, Yann Collet. +BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +You can contact the author at : +- LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html +- LZ4 source repository : http://code.google.com/p/lz4/ Copied: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip (from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip Sun Jan 20 08:26:09 2013 (r245686, copy of r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip) @@ -0,0 +1 @@ +LZ4 COMPRESSION FUNCTIONALITY IN ZFS Copied and modified: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c (from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c) ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c Wed Jan 16 23:11:13 2013 (r245512, copy source) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Sun Jan 20 08:26:09 2013 (r245686) @@ -201,8 +201,13 @@ lz4_decompress(void *s_start, void *d_st * Illumos: On amd64 we have 20k of stack and 24k on sun4u and sun4v, so we * can spend 16k on the algorithm */ +#if notyet #define STACKLIMIT 12 #else +/* XXX need larger stack size on FreeBSD for zio threads */ +#define STACKLIMIT 11 +#endif +#else #define LZ4_ARCH64 0 /* * Illumos: On i386 we only have 12k of stack, so in order to maintain the Modified: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Jan 20 08:26:09 2013 (r245686) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _ZIO_H @@ -106,14 +107,17 @@ enum zio_compress { ZIO_COMPRESS_GZIP_8, ZIO_COMPRESS_GZIP_9, ZIO_COMPRESS_ZLE, + ZIO_COMPRESS_LZ4, ZIO_COMPRESS_FUNCTIONS }; +/* N.B. when altering this value, also change BOOTFS_COMPRESS_VALID below */ #define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB #define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF #define BOOTFS_COMPRESS_VALID(compress) \ ((compress) == ZIO_COMPRESS_LZJB || \ + (compress) == ZIO_COMPRESS_LZ4 || \ ((compress) == ZIO_COMPRESS_ON && \ ZIO_COMPRESS_ON_VALUE == ZIO_COMPRESS_LZJB) || \ (compress) == ZIO_COMPRESS_OFF) Modified: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Sun Jan 20 08:26:09 2013 (r245686) @@ -23,6 +23,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. + */ #ifndef _SYS_ZIO_COMPRESS_H #define _SYS_ZIO_COMPRESS_H @@ -68,6 +71,10 @@ extern size_t zle_compress(void *src, vo int level); extern int zle_decompress(void *src, void *dst, size_t s_len, size_t d_len, int level); +extern size_t lz4_compress(void *src, void *dst, size_t s_len, size_t d_len, + int level); +extern int lz4_decompress(void *src, void *dst, size_t s_len, size_t d_len, + int level); /* * Compress and decompress data if necessary. Modified: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Jan 20 08:26:09 2013 (r245686) @@ -27,6 +27,7 @@ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #include @@ -75,6 +76,7 @@ #include #include #include +#include #include "zfs_namecheck.h" #include "zfs_prop.h" @@ -131,6 +133,12 @@ int zfs_set_prop_nvlist(const char *, zp static void zfsdev_close(void *data); +static int zfs_prop_activate_feature(dsl_pool_t *dp, zfeature_info_t *feature); +static int zfs_prop_activate_feature_check(void *arg1, void *arg2, + dmu_tx_t *tx); +static void zfs_prop_activate_feature_sync(void *arg1, void *arg2, + dmu_tx_t *tx); + /* _NOTE(PRINTFLIKE(4)) - this is printf-like, but lint is too whiney */ void __dprintf(const char *file, const char *func, int line, const char *fmt, ...) @@ -2264,6 +2272,40 @@ zfs_prop_set_special(const char *dsname, } break; } + case ZFS_PROP_COMPRESSION: + { + if (intval == ZIO_COMPRESS_LZ4) { + zfeature_info_t *feature = + &spa_feature_table[SPA_FEATURE_LZ4_COMPRESS]; + spa_t *spa; + dsl_pool_t *dp; + + if ((err = spa_open(dsname, &spa, FTAG)) != 0) + return (err); + + dp = spa->spa_dsl_pool; + + /* + * Setting the LZ4 compression algorithm activates + * the feature. + */ + if (!spa_feature_is_active(spa, feature)) { + if ((err = zfs_prop_activate_feature(dp, + feature)) != 0) { + spa_close(spa, FTAG); + return (err); + } + } + + spa_close(spa, FTAG); + } + /* + * We still want the default set action to be performed in the + * caller, we only performed zfeature settings here. + */ + err = -1; + break; + } default: err = -1; @@ -3481,6 +3523,22 @@ zfs_check_settable(const char *dsname, n SPA_VERSION_ZLE_COMPRESSION)) return (ENOTSUP); + if (intval == ZIO_COMPRESS_LZ4) { + zfeature_info_t *feature = + &spa_feature_table[ + SPA_FEATURE_LZ4_COMPRESS]; + spa_t *spa; + + if ((err = spa_open(dsname, &spa, FTAG)) != 0) + return (err); + + if (!spa_feature_is_enabled(spa, feature)) { + spa_close(spa, FTAG); + return (ENOTSUP); + } + spa_close(spa, FTAG); + } + /* * If this is a bootable dataset then * verify that the compression algorithm @@ -3525,6 +3583,56 @@ zfs_check_settable(const char *dsname, n } /* + * Activates a feature on a pool in response to a property setting. This + * creates a new sync task which modifies the pool to reflect the feature + * as being active. + */ +static int +zfs_prop_activate_feature(dsl_pool_t *dp, zfeature_info_t *feature) +{ + int err; + + /* EBUSY here indicates that the feature is already active */ + err = dsl_sync_task_do(dp, zfs_prop_activate_feature_check, + zfs_prop_activate_feature_sync, dp->dp_spa, feature, 2); + + if (err != 0 && err != EBUSY) + return (err); + else + return (0); +} + +/* + * Checks for a race condition to make sure we don't increment a feature flag + * multiple times. + */ +/*ARGSUSED*/ +static int +zfs_prop_activate_feature_check(void *arg1, void *arg2, dmu_tx_t *tx) +{ + spa_t *spa = arg1; + zfeature_info_t *feature = arg2; + + if (!spa_feature_is_active(spa, feature)) + return (0); + else + return (EBUSY); +} + +/* + * The callback invoked on feature activation in the sync task caused by + * zfs_prop_activate_feature. + */ +static void +zfs_prop_activate_feature_sync(void *arg1, void *arg2, dmu_tx_t *tx) +{ + spa_t *spa = arg1; + zfeature_info_t *feature = arg2; + + spa_feature_incr(spa, feature, tx); +} + +/* * Removes properties from the given props list that fail permission checks * needed to clear them and to restore them in case of a receive error. For each * property, make sure we have both set and inherit permissions. Modified: user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c ============================================================================== --- user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Sun Jan 20 08:18:56 2013 (r245685) +++ user/delphij/zfs-lz4/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Sun Jan 20 08:26:09 2013 (r245686) @@ -23,6 +23,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. + */ #include #include @@ -50,6 +53,7 @@ zio_compress_info_t zio_compress_table[Z {gzip_compress, gzip_decompress, 8, "gzip-8"}, {gzip_compress, gzip_decompress, 9, "gzip-9"}, {zle_compress, zle_decompress, 64, "zle"}, + {lz4_compress, lz4_decompress, 0, "lz4"}, }; enum zio_compress From owner-svn-src-user@FreeBSD.ORG Tue Jan 22 04:50:22 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 873FEA61; Tue, 22 Jan 2013 04:50:22 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6161126F; Tue, 22 Jan 2013 04:50:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0M4oMWw010013; Tue, 22 Jan 2013 04:50:22 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0M4oM4D010012; Tue, 22 Jan 2013 04:50:22 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201301220450.r0M4oM4D010012@svn.freebsd.org> From: Hiroki Sato Date: Tue, 22 Jan 2013 04:50:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245766 - user/hrs/releng/release/sparc64 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 04:50:22 -0000 Author: hrs Date: Tue Jan 22 04:50:21 2013 New Revision: 245766 URL: http://svnweb.freebsd.org/changeset/base/245766 Log: - Remove whitespace before and after braces. - Use gpart(8) instead of sunlabel(8). Suggested by: marius Modified: user/hrs/releng/release/sparc64/mkisoimages.sh Modified: user/hrs/releng/release/sparc64/mkisoimages.sh ============================================================================== --- user/hrs/releng/release/sparc64/mkisoimages.sh Tue Jan 22 04:14:27 2013 (r245765) +++ user/hrs/releng/release/sparc64/mkisoimages.sh Tue Jan 22 04:50:21 2013 (r245766) @@ -56,15 +56,15 @@ dd if=$4/boot/boot1 of="${BOOTFSIMG}" bs # Create a boot ISO image : ${CYLSIZE:=640} ISOSIZE=$(stat -f %z ${NAME}.tmp) -ISOBLKS=$(( (${ISOSIZE} + 511) / 512 )) -ISOCYLS=$(( (${ISOBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE} )) +ISOBLKS=$(((${ISOSIZE} + 511) / 512)) +ISOCYLS=$(((${ISOBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE})) BOOTFSSIZE=$(stat -f %z "${BOOTFSIMG}") -BOOTFSBLKS=$(( (${BOOTFSSIZE} + 511) / 512 )) -BOOTFSCYLS=$(( (${BOOTFSBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE} )) +BOOTFSBLKS=$(((${BOOTFSSIZE} + 511) / 512)) +BOOTFSCYLS=$(((${BOOTFSBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE})) -ENDCYL=$(( ${ISOCYLS} + ${BOOTFSCYLS} )) -NSECTS=$(( ${ENDCYL} * 1 * ${CYLSIZE} )) +ENDCYL=$((${ISOCYLS} + ${BOOTFSCYLS})) +NSECTS=$((${ENDCYL} * 1 * ${CYLSIZE})) dd if=${NAME}.tmp of=${NAME} bs=${CYLSIZE}b conv=notrunc,sync dd if=${BOOTFSIMG} of=${NAME} bs=${CYLSIZE}b seek=${ISOCYLS} conv=notrunc,sync @@ -73,21 +73,10 @@ dd if=/dev/zero of=${NAME} bs=${CYLSIZE} rm -rf ${NAME}.tmp ${TMPIMGDIR} # Write VTOC8 label to boot ISO image -MD=`mdconfig -a -t vnode -f ${NAME}` -cat < Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 771DBA82; Tue, 22 Jan 2013 11:17:51 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4CA929FF; Tue, 22 Jan 2013 11:17:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0MBHpvW027526; Tue, 22 Jan 2013 11:17:51 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0MBHpGP027525; Tue, 22 Jan 2013 11:17:51 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301221117.r0MBHpGP027525@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 22 Jan 2013 11:17:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245785 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 11:17:51 -0000 Author: ae Date: Tue Jan 22 11:17:50 2013 New Revision: 245785 URL: http://svnweb.freebsd.org/changeset/base/245785 Log: Simplify in6_addrscope function. Modified: user/ae/inet6/sys/netinet6/scope6.c Modified: user/ae/inet6/sys/netinet6/scope6.c ============================================================================== --- user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 10:22:12 2013 (r245784) +++ user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 11:17:50 2013 (r245785) @@ -202,60 +202,20 @@ scope6_get(struct ifnet *ifp, struct sco int in6_addrscope(struct in6_addr *addr) { - int scope; - - if (addr->s6_addr[0] == 0xfe) { - scope = addr->s6_addr[1] & 0xc0; - - switch (scope) { - case 0x80: - return IPV6_ADDR_SCOPE_LINKLOCAL; - break; - case 0xc0: - return IPV6_ADDR_SCOPE_SITELOCAL; - break; - default: - return IPV6_ADDR_SCOPE_GLOBAL; /* just in case */ - break; - } - } - - if (addr->s6_addr[0] == 0xff) { - scope = addr->s6_addr[1] & 0x0f; - - /* - * due to other scope such as reserved, - * return scope doesn't work. - */ - switch (scope) { - case IPV6_ADDR_SCOPE_INTFACELOCAL: - return IPV6_ADDR_SCOPE_INTFACELOCAL; - break; - case IPV6_ADDR_SCOPE_LINKLOCAL: - return IPV6_ADDR_SCOPE_LINKLOCAL; - break; - case IPV6_ADDR_SCOPE_SITELOCAL: - return IPV6_ADDR_SCOPE_SITELOCAL; - break; - default: - return IPV6_ADDR_SCOPE_GLOBAL; - break; - } - } - - /* - * Regard loopback and unspecified addresses as global, since - * they have no ambiguity. - */ + if (IN6_IS_ADDR_MULTICAST(addr)) + return (IPV6_ADDR_MC_SCOPE(addr)); + if (IN6_IS_ADDR_LINKLOCAL(addr)) + return (IPV6_ADDR_SCOPE_LINKLOCAL); if (bcmp(&in6addr_loopback, addr, sizeof(*addr) - 1) == 0) { if (addr->s6_addr[15] == 1) /* loopback */ - return IPV6_ADDR_SCOPE_LINKLOCAL; - if (addr->s6_addr[15] == 0) /* unspecified */ - return IPV6_ADDR_SCOPE_GLOBAL; /* XXX: correct? */ + return (IPV6_ADDR_SCOPE_LINKLOCAL); + /* + * Regard unspecified address as global, since + * it has no ambiguity. + */ } - - return IPV6_ADDR_SCOPE_GLOBAL; + return (IPV6_ADDR_SCOPE_GLOBAL); } /* From owner-svn-src-user@FreeBSD.ORG Tue Jan 22 11:43:01 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7DA84FE; Tue, 22 Jan 2013 11:43:01 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 571A7B22; Tue, 22 Jan 2013 11:43:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0MBh18A035435; Tue, 22 Jan 2013 11:43:01 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0MBh1ra035433; Tue, 22 Jan 2013 11:43:01 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301221143.r0MBh1ra035433@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 22 Jan 2013 11:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245786 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 11:43:01 -0000 Author: ae Date: Tue Jan 22 11:43:00 2013 New Revision: 245786 URL: http://svnweb.freebsd.org/changeset/base/245786 Log: Since we don't allow configure several loopback addresses, we can disable special handling for them in the in6_addrscope() function. Add new sa6_checkzone() function. It checks sin6_scope_id field in the sockaddr_in6 structure passed from applications. Modified: user/ae/inet6/sys/netinet6/scope6.c Modified: user/ae/inet6/sys/netinet6/scope6.c ============================================================================== --- user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 11:17:50 2013 (r245785) +++ user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 11:43:00 2013 (r245786) @@ -207,7 +207,14 @@ in6_addrscope(struct in6_addr *addr) return (IPV6_ADDR_MC_SCOPE(addr)); if (IN6_IS_ADDR_LINKLOCAL(addr)) return (IPV6_ADDR_SCOPE_LINKLOCAL); +#if 0 if (bcmp(&in6addr_loopback, addr, sizeof(*addr) - 1) == 0) { + /* + * XXX: RFC 4007 says that ::1 should treated as having + * link-local scope. But we don't allow configure it on + * several loopback interfaces. So, actually it has the + * global scope. + */ if (addr->s6_addr[15] == 1) /* loopback */ return (IPV6_ADDR_SCOPE_LINKLOCAL); /* @@ -215,6 +222,7 @@ in6_addrscope(struct in6_addr *addr) * it has no ambiguity. */ } +#endif return (IPV6_ADDR_SCOPE_GLOBAL); } @@ -441,3 +449,30 @@ in6_getlinkzone(const struct ifnet *ifp) return (ifp->if_index); } +/* + * This function is for checking sockaddr_in6 structure, that was passed + * from the application level. + * + * sin6_scope_id should be set for link-local unicast addresses and for + * any multicast addresses, except from global scope. + * + * If it is zero, then look into default zone ids. If default zone id is + * not set or disabled, then return error. + */ +int +sa6_checkzone(struct sockaddr_in6 *sa6) +{ + int scope; + + scope = in6_addrscope(&sa6->sin6_addr); + if (scope == IPV6_ADDR_SCOPE_GLOBAL) { + /* We don't want zone id for global scope */ + return (sa6.sin6_scope_id ? EINVAL: 0); + } + if (sa6.sin6_scope_id != 0) + return (0); + if (V_ip6_use_defzone != 0) + sa6.sin6_scope_id = V_sid_default.s6id_list[scope]; + /* Return error if we can't determine zone id */ + return (sa6.sin6_scope_id ? 0: EINVAL); +} From owner-svn-src-user@FreeBSD.ORG Tue Jan 22 12:34:23 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0A1A7516; Tue, 22 Jan 2013 12:34:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D6C23F69; Tue, 22 Jan 2013 12:34:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0MCYMZH050950; Tue, 22 Jan 2013 12:34:22 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0MCYMHd050948; Tue, 22 Jan 2013 12:34:22 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301221234.r0MCYMHd050948@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 22 Jan 2013 12:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245790 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 12:34:23 -0000 Author: ae Date: Tue Jan 22 12:34:22 2013 New Revision: 245790 URL: http://svnweb.freebsd.org/changeset/base/245790 Log: Add in6ifa_ifwithaddr() function. It is similar to ifa_ifwithaddr(), but optimized for IPv6. Modified: user/ae/inet6/sys/netinet6/in6.c user/ae/inet6/sys/netinet6/in6_var.h Modified: user/ae/inet6/sys/netinet6/in6.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6.c Tue Jan 22 12:10:51 2013 (r245789) +++ user/ae/inet6/sys/netinet6/in6.c Tue Jan 22 12:34:22 2013 (r245790) @@ -1904,6 +1904,33 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, st } /* + * find the internet address corresponding to a given address. + * ifaddr is returned referenced. + */ +struct in6_ifaddr * +in6ifa_ifwithaddr(const struct sockaddr_in6 *sa6) +{ + struct in6_ifaddr *ia; + + IN6_IFADDR_RLOCK(); + LIST_FOREACH(ia, IN6ADDR_HASH(&sa6->sin6_addr), ia6_hash) { + if (IN6_ARE_ADDR_EQUAL(IA6_IN6(ia), &sa6->sin6_addr)) { + /* + * XXX: should we determine the scope and compare + * sin6_scope_id with corresponding zone id? + */ + if (sa6->sin6_scope_id != 0 && + sa6->sin6_scope_id != in6_getlinkzone(ia->ia_ifp)) + continue; + ifa_ref(ia); + break; + } + } + IN6_IFADDR_RUNLOCK(); + return (ia); +} + +/* * Convert IP6 address to printable (loggable) representation. Caller * has to make sure that ip6buf is at least INET6_ADDRSTRLEN long. */ Modified: user/ae/inet6/sys/netinet6/in6_var.h ============================================================================== --- user/ae/inet6/sys/netinet6/in6_var.h Tue Jan 22 12:10:51 2013 (r245789) +++ user/ae/inet6/sys/netinet6/in6_var.h Tue Jan 22 12:34:22 2013 (r245790) @@ -801,6 +801,7 @@ void in6_setmaxmtu(void); int in6_if2idlen(struct ifnet *); struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, struct in6_addr *); +struct in6_ifaddr *in6ifa_ifwithaddr(const struct sockaddr_in6 *); char *ip6_sprintf(char *, const struct in6_addr *); int in6_addr2zoneid(struct ifnet *, struct in6_addr *, u_int32_t *); int in6_matchlen(struct in6_addr *, struct in6_addr *); From owner-svn-src-user@FreeBSD.ORG Tue Jan 22 12:40:01 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4A72B797; Tue, 22 Jan 2013 12:40:01 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3DD4FFE5; Tue, 22 Jan 2013 12:40:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0MCe186051797; Tue, 22 Jan 2013 12:40:01 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0MCe1bU051796; Tue, 22 Jan 2013 12:40:01 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301221240.r0MCe1bU051796@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 22 Jan 2013 12:40:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245791 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 12:40:01 -0000 Author: ae Date: Tue Jan 22 12:40:00 2013 New Revision: 245791 URL: http://svnweb.freebsd.org/changeset/base/245791 Log: Use sa6_checkzone and in6ifa_ifwithaddr functions in the in6_pcbbind. Modified: user/ae/inet6/sys/netinet6/in6_pcb.c Modified: user/ae/inet6/sys/netinet6/in6_pcb.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_pcb.c Tue Jan 22 12:34:22 2013 (r245790) +++ user/ae/inet6/sys/netinet6/in6_pcb.c Tue Jan 22 12:40:00 2013 (r245791) @@ -142,8 +142,8 @@ in6_pcbbind(register struct inpcb *inp, if (nam->sa_family != AF_INET6) return (EAFNOSUPPORT); - if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0) - return(error); + if ((error = sa6_checkzone(sin6)) != 0) + return (error); if ((error = prison_local_ip6(cred, &sin6->sin6_addr, ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0) @@ -161,11 +161,10 @@ in6_pcbbind(register struct inpcb *inp, if (so->so_options & SO_REUSEADDR) reuseport = SO_REUSEADDR|SO_REUSEPORT; } else if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { - struct ifaddr *ifa; + struct in6_ifaddr *ifa; sin6->sin6_port = 0; /* yech... */ - if ((ifa = ifa_ifwithaddr((struct sockaddr *)sin6)) == - NULL && + if ((ifa = in6ifa_ifwithaddr(sin6)) == NULL && (inp->inp_flags & INP_BINDANY) == 0) { return (EADDRNOTAVAIL); } @@ -176,8 +175,7 @@ in6_pcbbind(register struct inpcb *inp, * We should allow to bind to a deprecated address, since * the application dares to use it. */ - if (ifa != NULL && - ((struct in6_ifaddr *)ifa)->ia6_flags & + if (ifa != NULL && ifa->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|IN6_IFF_DETACHED)) { ifa_free(ifa); return (EADDRNOTAVAIL); From owner-svn-src-user@FreeBSD.ORG Tue Jan 22 17:15:56 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E648F7B6; Tue, 22 Jan 2013 17:15:56 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BCFB96F6; Tue, 22 Jan 2013 17:15:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0MHFuT2043435; Tue, 22 Jan 2013 17:15:56 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0MHFuf5043434; Tue, 22 Jan 2013 17:15:56 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201301221715.r0MHFuf5043434@svn.freebsd.org> From: Peter Holm Date: Tue, 22 Jan 2013 17:15:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245799 - user/pho/stress2 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 17:15:57 -0000 Author: pho Date: Tue Jan 22 17:15:56 2013 New Revision: 245799 URL: http://svnweb.freebsd.org/changeset/base/245799 Log: ddb commands added to /etc/ddb.conf, for stress2 crash reporting. Added: user/pho/stress2/ddb.conf Added: user/pho/stress2/ddb.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/ddb.conf Tue Jan 22 17:15:56 2013 (r245799) @@ -0,0 +1,6 @@ +# $FreeBSD$ +# +# ddb commands used for stress2 crash reports +# + +script stress2=bt; show allpcpu; show alllocks; show lockedvnods; show mount;ps; allt; call doadump; reset From owner-svn-src-user@FreeBSD.ORG Tue Jan 22 18:25:56 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8210D5D9; Tue, 22 Jan 2013 18:25:56 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5ECD2B3E; Tue, 22 Jan 2013 18:25:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0MIPuPZ065238; Tue, 22 Jan 2013 18:25:56 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0MIPuhC065236; Tue, 22 Jan 2013 18:25:56 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301221825.r0MIPuhC065236@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 22 Jan 2013 18:25:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245812 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 18:25:56 -0000 Author: ae Date: Tue Jan 22 18:25:55 2013 New Revision: 245812 URL: http://svnweb.freebsd.org/changeset/base/245812 Log: Automatically fill sin6_scope_id for loopback address. Modified: user/ae/inet6/sys/netinet6/scope6.c Modified: user/ae/inet6/sys/netinet6/scope6.c ============================================================================== --- user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 18:23:07 2013 (r245811) +++ user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 18:25:55 2013 (r245812) @@ -466,6 +466,20 @@ sa6_checkzone(struct sockaddr_in6 *sa6) scope = in6_addrscope(&sa6->sin6_addr); if (scope == IPV6_ADDR_SCOPE_GLOBAL) { + /* + * Since ::1 address always configured on the lo0, we can + * automagically set its zone id, when it is not specified. + * Return error, when specified zone id doesn't match with + * actual value. + */ + if (IN6_IS_ADDR_LOOPBACK(&sa6->sin6_addr)) { + if (sa6.sin6_scope_id == 0) { + sa6.sin6_scope_id = in6_getlinkzone(V_loif); + return (0); + } + if (sa6.sin6_scope_id == in6_getlinkzone(V_loif)) + return (0); + } /* We don't want zone id for global scope */ return (sa6.sin6_scope_id ? EINVAL: 0); } From owner-svn-src-user@FreeBSD.ORG Tue Jan 22 18:30:47 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0C01A95B; Tue, 22 Jan 2013 18:30:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F3596B9E; Tue, 22 Jan 2013 18:30:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0MIUkXH067405; Tue, 22 Jan 2013 18:30:46 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0MIUkm5067404; Tue, 22 Jan 2013 18:30:46 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301221830.r0MIUkm5067404@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 22 Jan 2013 18:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245814 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2013 18:30:47 -0000 Author: ae Date: Tue Jan 22 18:30:46 2013 New Revision: 245814 URL: http://svnweb.freebsd.org/changeset/base/245814 Log: Fix vim's autocompletions. Modified: user/ae/inet6/sys/netinet6/scope6.c Modified: user/ae/inet6/sys/netinet6/scope6.c ============================================================================== --- user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 18:27:19 2013 (r245813) +++ user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 18:30:46 2013 (r245814) @@ -473,20 +473,20 @@ sa6_checkzone(struct sockaddr_in6 *sa6) * actual value. */ if (IN6_IS_ADDR_LOOPBACK(&sa6->sin6_addr)) { - if (sa6.sin6_scope_id == 0) { - sa6.sin6_scope_id = in6_getlinkzone(V_loif); + if (sa6->sin6_sin6_scope_id == 0) { + sa6->sin6_scope_id = in6_getlinkzone(V_loif); return (0); } - if (sa6.sin6_scope_id == in6_getlinkzone(V_loif)) + if (sa6->sin6_scope_id == in6_getlinkzone(V_loif)) return (0); } /* We don't want zone id for global scope */ - return (sa6.sin6_scope_id ? EINVAL: 0); + return (sa6->sin6_scope_id ? EINVAL: 0); } - if (sa6.sin6_scope_id != 0) + if (sa6->sin6_scope_id != 0) return (0); if (V_ip6_use_defzone != 0) - sa6.sin6_scope_id = V_sid_default.s6id_list[scope]; + sa6->sin6_scope_id = V_sid_default.s6id_list[scope]; /* Return error if we can't determine zone id */ - return (sa6.sin6_scope_id ? 0: EINVAL); + return (sa6->sin6_scope_id ? 0: EINVAL); } From owner-svn-src-user@FreeBSD.ORG Wed Jan 23 02:29:06 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 80792275; Wed, 23 Jan 2013 02:29:06 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5B2FE254; Wed, 23 Jan 2013 02:29:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0N2T65o011845; Wed, 23 Jan 2013 02:29:06 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0N2T6LE011843; Wed, 23 Jan 2013 02:29:06 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201301230229.r0N2T6LE011843@svn.freebsd.org> From: Alfred Perlstein Date: Wed, 23 Jan 2013 02:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245833 - in user/alfred/ewatchdog/sys: dev/watchdog sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2013 02:29:06 -0000 Author: alfred Date: Wed Jan 23 02:29:05 2013 New Revision: 245833 URL: http://svnweb.freebsd.org/changeset/base/245833 Log: Implement part of Linux's watchdog API. ioctls added: WDIOC_GETTIMELEFT - seconds until watchdog goes off WDIOC_SETTIMEOUT - set the timeout (nearly the same as WDIOCPATPAT) WDIOC_GETTIMEOUT - get the timeout/interval This will allow us to craft a utility to bark when the timeout is about to expire and otherwise gather information about pending watchdogs. Modified: user/alfred/ewatchdog/sys/dev/watchdog/watchdog.c user/alfred/ewatchdog/sys/sys/watchdog.h Modified: user/alfred/ewatchdog/sys/dev/watchdog/watchdog.c ============================================================================== --- user/alfred/ewatchdog/sys/dev/watchdog/watchdog.c Wed Jan 23 02:06:20 2013 (r245832) +++ user/alfred/ewatchdog/sys/dev/watchdog/watchdog.c Wed Jan 23 02:29:05 2013 (r245833) @@ -39,8 +39,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include /* kern_clock_gettime() */ + static struct cdev *wd_dev; -static volatile u_int wd_last_u; +static volatile u_int wd_last_u; /* last timeout value set by kern_do_pat */ + +static int wd_lastpat_valid = 0; +static time_t wd_lastpat = 0; /* when the watchdog was last patted */ static int kern_do_pat(u_int utim) @@ -51,11 +56,20 @@ kern_do_pat(u_int utim) return (EINVAL); if ((utim & WD_LASTVAL) != 0) { + /* + * if WD_LASTVAL is set, fill in the bits for timeout + * from the saved value in wd_last_u. + */ MPASS((wd_last_u & ~WD_INTERVAL) == 0); utim &= ~WD_LASTVAL; utim |= wd_last_u; - } else + } else { + /* + * Otherwise save the new interval. + * This can be zero (to disable the watchdog) + */ wd_last_u = (utim & WD_INTERVAL); + } if ((utim & WD_INTERVAL) == WD_TO_NEVER) { utim = 0; @@ -66,17 +80,28 @@ kern_do_pat(u_int utim) error = EOPNOTSUPP; } EVENTHANDLER_INVOKE(watchdog_list, utim, &error); + /* + * If we were able to arm/strobe the watchdog, then + * update the last time it was strobed for WDIOC_GETTIMELEFT + */ + if (!error) { + struct timespec ts; + + error = kern_clock_gettime(curthread /* XXX */, + CLOCK_MONOTONIC_FAST, &ts); + if (!error) { + wd_lastpat = ts.tv_sec; + wd_lastpat_valid = 1; + } + } return (error); } static int -wd_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, - int flags __unused, struct thread *td) +wd_ioctl_patpat(caddr_t data) { u_int u; - if (cmd != WDIOCPATPAT) - return (ENOIOCTL); u = *(u_int *)data; if (u & ~(WD_ACTIVE | WD_PASSIVE | WD_LASTVAL | WD_INTERVAL)) return (EINVAL); @@ -92,6 +117,57 @@ wd_ioctl(struct cdev *dev __unused, u_lo return (kern_do_pat(u)); } +static int +wd_get_time_left(struct thread *td, time_t *remainp) +{ + struct timespec ts; + int error; + + error = kern_clock_gettime(td, CLOCK_MONOTONIC_FAST, &ts); + if (error) + return (error); + if (!wd_lastpat_valid) + return (ENOENT); + *remainp = ts.tv_sec - wd_lastpat; + return (0); +} + +static int +wd_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, + int flags __unused, struct thread *td) +{ + u_int u; + time_t timeleft; + int error; + + error = 0; + + switch (cmd) { + case WDIOC_GETTIMELEFT: + error = wd_get_time_left(td, &timeleft); + if (error) + break; + *(int *)data = (int)timeleft; + break; + case WDIOC_SETTIMEOUT: + u = *(u_int *)data; + error = wdog_kern_pat(u); + break; + case WDIOC_GETTIMEOUT: + u = wdog_kern_last_timeout(); + *(u_int *)data = u; + break; + case WDIOCPATPAT: + error = wd_ioctl_patpat(data); + break; + default: + error = ENOIOCTL; + break; + } + return (error); +} + + u_int wdog_kern_last_timeout(void) { Modified: user/alfred/ewatchdog/sys/sys/watchdog.h ============================================================================== --- user/alfred/ewatchdog/sys/sys/watchdog.h Wed Jan 23 02:06:20 2013 (r245832) +++ user/alfred/ewatchdog/sys/sys/watchdog.h Wed Jan 23 02:29:05 2013 (r245833) @@ -33,6 +33,9 @@ #define _PATH_WATCHDOG "fido" #define WDIOCPATPAT _IOW('W', 42, u_int) +#define WDIOC_SETTIMEOUT _IOW('W', 43, int) +#define WDIOC_GETTIMEOUT _IOR('W', 44, int) +#define WDIOC_GETTIMELEFT _IOR('W', 45, int) #define WD_ACTIVE 0x8000000 /* From owner-svn-src-user@FreeBSD.ORG Thu Jan 24 12:28:28 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F17DCE88; Thu, 24 Jan 2013 12:28:27 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id AEB5B312; Thu, 24 Jan 2013 12:28:27 +0000 (UTC) Received: from localhost (global-1-11.nat.csx.cam.ac.uk [131.111.184.11]) by mail.dawidek.net (Postfix) with ESMTPSA id 00004176; Thu, 24 Jan 2013 13:25:44 +0100 (CET) Date: Thu, 24 Jan 2013 13:28:58 +0100 From: Pawel Jakub Dawidek To: "Andrey V. Elsukov" Subject: Re: svn commit: r245814 - user/ae/inet6/sys/netinet6 Message-ID: <20130124122858.GA1449@garage.freebsd.pl> References: <201301221830.r0MIUkm5067404@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline In-Reply-To: <201301221830.r0MIUkm5067404@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2013 12:28:28 -0000 --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 22, 2013 at 06:30:46PM +0000, Andrey V. Elsukov wrote: > Author: ae > Date: Tue Jan 22 18:30:46 2013 > New Revision: 245814 > URL: http://svnweb.freebsd.org/changeset/base/245814 >=20 > Log: > Fix vim's autocompletions. >=20 > Modified: > user/ae/inet6/sys/netinet6/scope6.c >=20 > Modified: user/ae/inet6/sys/netinet6/scope6.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 18:27:19 2013 (r245813) > +++ user/ae/inet6/sys/netinet6/scope6.c Tue Jan 22 18:30:46 2013 (r245814) > @@ -473,20 +473,20 @@ sa6_checkzone(struct sockaddr_in6 *sa6) > * actual value. > */ > if (IN6_IS_ADDR_LOOPBACK(&sa6->sin6_addr)) { > - if (sa6.sin6_scope_id =3D=3D 0) { > - sa6.sin6_scope_id =3D in6_getlinkzone(V_loif); > + if (sa6->sin6_sin6_scope_id =3D=3D 0) { This doesn't look correct. One sin6 too many? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --nFreZHaLTZJo0R7j Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlEBKQoACgkQForvXbEpPzRIhgCgjH1OQuxYqvtco63Gn+CCZsZl Y8cAoKA4xR6L2qRTBx9an6YnTXOE6YzK =5ZLv -----END PGP SIGNATURE----- --nFreZHaLTZJo0R7j-- From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 11:37:57 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2BBA1C54; Fri, 25 Jan 2013 11:37:57 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 01F652CF; Fri, 25 Jan 2013 11:37:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0PBbuRY051835; Fri, 25 Jan 2013 11:37:56 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0PBbuiN051834; Fri, 25 Jan 2013 11:37:56 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301251137.r0PBbuiN051834@svn.freebsd.org> From: Sean Bruno Date: Fri, 25 Jan 2013 11:37:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245902 - user/sbruno/head_146698 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 11:37:57 -0000 Author: sbruno Date: Fri Jan 25 11:37:56 2013 New Revision: 245902 URL: http://svnweb.freebsd.org/changeset/base/245902 Log: Branch head from the past at svn r146698 which is the approximate 6Current timeframe where pxe_http was developed during GSOC 2007. This is based on the cvs tags from the project tar ball at: http://code.google.com/p/google-summer-of-code-2007-freebsd/downloads/detail?name=Alexey_Tarasov.tar.gz&can=2&q= and perforce commit history: http://p4web.freebsd.org/@md=d&cd=//depot/projects/soc2007/&c=SxU@//depot/projects/soc2007/taleks-pxe_http/?ac=83 Added: user/sbruno/head_146698/ - copied from r146698, head/ From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 11:49:19 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BF628E4A; Fri, 25 Jan 2013 11:49:19 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 95F6834A; Fri, 25 Jan 2013 11:49:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0PBnJGh054855; Fri, 25 Jan 2013 11:49:19 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0PBnJw4054854; Fri, 25 Jan 2013 11:49:19 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301251149.r0PBnJw4054854@svn.freebsd.org> From: Sean Bruno Date: Fri, 25 Jan 2013 11:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245903 - user/sbruno/pxe_http-gsoc2007 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 11:49:19 -0000 Author: sbruno Date: Fri Jan 25 11:49:19 2013 New Revision: 245903 URL: http://svnweb.freebsd.org/changeset/base/245903 Log: Create place for the tar ball code drop of the gsoc code This tar ball is *not* the same as the current state of the perforce tree of pxe_http. Added: user/sbruno/pxe_http-gsoc2007/ From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 11:51:29 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9D0851B9; Fri, 25 Jan 2013 11:51:29 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8BC2435D; Fri, 25 Jan 2013 11:51:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0PBpTNf056743; Fri, 25 Jan 2013 11:51:29 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0PBpTHE056739; Fri, 25 Jan 2013 11:51:29 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301251151.r0PBpTHE056739@svn.freebsd.org> From: Sean Bruno Date: Fri, 25 Jan 2013 11:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245904 - in user/sbruno/pxe_http-gsoc2007: . project project/i386_mod project/libi386_mod project/libstand_mod project/loader_mod X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 11:51:29 -0000 Author: sbruno Date: Fri Jan 25 11:51:28 2013 New Revision: 245904 URL: http://svnweb.freebsd.org/changeset/base/245904 Log: Drop in the contents of the 2007 gsoc code that was submitted at the end of the project. This code compiles/works under 6current from that time frame. Added: user/sbruno/pxe_http-gsoc2007/INFO user/sbruno/pxe_http-gsoc2007/project/ user/sbruno/pxe_http-gsoc2007/project/Makefile user/sbruno/pxe_http-gsoc2007/project/README user/sbruno/pxe_http-gsoc2007/project/httpfs.c user/sbruno/pxe_http-gsoc2007/project/httpfs.h user/sbruno/pxe_http-gsoc2007/project/i386_mod/ user/sbruno/pxe_http-gsoc2007/project/i386_mod/Makefile user/sbruno/pxe_http-gsoc2007/project/libi386_mod/ user/sbruno/pxe_http-gsoc2007/project/libi386_mod/Makefile user/sbruno/pxe_http-gsoc2007/project/libi386_mod/pxe.c user/sbruno/pxe_http-gsoc2007/project/libi386_mod/pxe.h user/sbruno/pxe_http-gsoc2007/project/libstand_mod/ user/sbruno/pxe_http-gsoc2007/project/libstand_mod/printf.c user/sbruno/pxe_http-gsoc2007/project/libstand_mod/stand.h user/sbruno/pxe_http-gsoc2007/project/loader_mod/ user/sbruno/pxe_http-gsoc2007/project/loader_mod/Makefile user/sbruno/pxe_http-gsoc2007/project/loader_mod/conf.c user/sbruno/pxe_http-gsoc2007/project/loader_mod/loader.rc user/sbruno/pxe_http-gsoc2007/project/loader_mod/main.c user/sbruno/pxe_http-gsoc2007/project/pxe_arp.c user/sbruno/pxe_http-gsoc2007/project/pxe_arp.h user/sbruno/pxe_http-gsoc2007/project/pxe_await.c user/sbruno/pxe_http-gsoc2007/project/pxe_await.h user/sbruno/pxe_http-gsoc2007/project/pxe_buffer.c user/sbruno/pxe_http-gsoc2007/project/pxe_buffer.h user/sbruno/pxe_http-gsoc2007/project/pxe_connection.c user/sbruno/pxe_http-gsoc2007/project/pxe_connection.h user/sbruno/pxe_http-gsoc2007/project/pxe_core.c user/sbruno/pxe_http-gsoc2007/project/pxe_core.h user/sbruno/pxe_http-gsoc2007/project/pxe_dhcp.c user/sbruno/pxe_http-gsoc2007/project/pxe_dhcp.h user/sbruno/pxe_http-gsoc2007/project/pxe_dns.c user/sbruno/pxe_http-gsoc2007/project/pxe_dns.h user/sbruno/pxe_http-gsoc2007/project/pxe_filter.c user/sbruno/pxe_http-gsoc2007/project/pxe_filter.h user/sbruno/pxe_http-gsoc2007/project/pxe_http.c user/sbruno/pxe_http-gsoc2007/project/pxe_http.h user/sbruno/pxe_http-gsoc2007/project/pxe_icmp.c user/sbruno/pxe_http-gsoc2007/project/pxe_icmp.h user/sbruno/pxe_http-gsoc2007/project/pxe_ip.c user/sbruno/pxe_http-gsoc2007/project/pxe_ip.h user/sbruno/pxe_http-gsoc2007/project/pxe_isr.S user/sbruno/pxe_http-gsoc2007/project/pxe_isr.h user/sbruno/pxe_http-gsoc2007/project/pxe_mem.c user/sbruno/pxe_http-gsoc2007/project/pxe_mem.h user/sbruno/pxe_http-gsoc2007/project/pxe_segment.c user/sbruno/pxe_http-gsoc2007/project/pxe_segment.h user/sbruno/pxe_http-gsoc2007/project/pxe_sock.c user/sbruno/pxe_http-gsoc2007/project/pxe_sock.h user/sbruno/pxe_http-gsoc2007/project/pxe_tcp.c user/sbruno/pxe_http-gsoc2007/project/pxe_tcp.h user/sbruno/pxe_http-gsoc2007/project/pxe_udp.c user/sbruno/pxe_http-gsoc2007/project/pxe_udp.h Added: user/sbruno/pxe_http-gsoc2007/INFO ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/pxe_http-gsoc2007/INFO Fri Jan 25 11:51:28 2013 (r245904) @@ -0,0 +1,30 @@ +Here is 'http support for PXE' project snapshot at 19th of August +(last submit during GSoC). + +There was post GSoC submit and may be will be ready next changes at time you are +reading this sentence, so repository contents differs from this tarball. Also, +deleted at the end phase of project files (e.g. pxe_mutex module) and unused +after all (btx_mod directory) are not included to this tarball. + +Other related (may be even useful) info may be found at: + + * blog.freebsdish.org/taleks + - project related blog + + * wiki.freebsd.org/http_support_for_PXE + - wiki project page + + * perforce.freebsd.org/depotTreeBrowser.cgi?FSPC=//depot/projects/soc2007/taleks%2dpxe%5fhttp&HIDEDEL=NO + - web interface to perforce repository with project + + +Directories structure: + + pxe_http library, main developed code: + /project/*.* + + also, there were made changes to already existed code: + /project/libstand_mod - modified files of libs/libstand library + /project/loader_mod - modified files of i386/loader code + /project/libi386_mod - modified files of i386/libi386 + /project/i386_mod - modified Makefile of i386 folder Added: user/sbruno/pxe_http-gsoc2007/project/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/pxe_http-gsoc2007/project/Makefile Fri Jan 25 11:51:28 2013 (r245904) @@ -0,0 +1,46 @@ +# pxe_http project +# +LIB= pxe_http +INTERNALLIB= + +SRCS= pxe_isr.S pxe_mem.c pxe_buffer.c pxe_await.c pxe_arp.c pxe_ip.c \ + pxe_core.c pxe_icmp.c pxe_udp.c pxe_filter.c pxe_dns.c \ + pxe_dhcp.c pxe_segment.c pxe_tcp.c pxe_sock.c \ + pxe_connection.c pxe_http.c httpfs.c + +CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ + -I${.CURDIR}/../../../contrib/dev/acpica \ + -I${.CURDIR}/../../.. -I. -I$(.CURDIR)/.. -I${.CURDIR}/../libi386/ +# the location of libstand +CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ + +#debug flag +#CFLAGS+= -DPXE_DEBUG +#CFLAGS+= -DPXE_DEBUG_HELL + +# core module debug +#CFLAGS+= -DPXE_CORE_DEBUG_HELL +#CFLAGS+= -DPXE_CORE_DEBUG +# TCP module debug +#CFLAGS+= -DPXE_TCP_DEBUG +#CFLAGS+= -DPXE_TCP_DEBUG_HELL +# IP module debug +#CFLAGS+= -DPXE_IP_DEBUG +#CFLAGS+= -DPXE_IP_DEBUG_HELL +# ARP module debug +#CFLAGS+= -DPXE_ARP_DEBUG +#CFLAGS+= -DPXE_ARP_DEBUG_HELL +# httpfs module +#CFLAGS+= -DPXE_HTTP_DEBUG +#CFLAGS+= -DPXE_HTTP_DEBUG_HELL + +# define to get more PXE related code and testing functions +#CFLAGS+= -DPXE_MORE + +# define to get some speed up by bigger requests +CFLAGS+= -DPXE_HTTPFS_CACHING + +# define to send packets freqently to speed up connection +#CFLAGS+= -DPXE_TCP_AGRESSIVE + +.include Added: user/sbruno/pxe_http-gsoc2007/project/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/sbruno/pxe_http-gsoc2007/project/README Fri Jan 25 11:51:28 2013 (r245904) @@ -0,0 +1,1253 @@ +Contents +---------- + +1. Introduction + + 1.2. Setting up + + 1.2.1. DHCP configuration + 1.2.2. TFTP configuration + 1.2.3. Web-server configuration + 1.2.4. loader.rc configuratuion + +2. Project organisation + + 2.1. Code modules + 2.2. Naming conventions + 2.3. Understanding logical structure of code + +3. API usage + + 3.1. Base information + 3.2. PXE sockets API overview + + 3.2.1. PXE API socket details + + 3.3. Quick Reference to API, available for user code + + 3.3.1. pxe_arp module + 3.3.2. pxe_await module + 3.3.3. pxe_buffer module + 3.3.4. pxe_connection module + 3.3.5. pxe_core module + 3.3.6. pxe_dhcp module + 3.3.7. pxe_dns module + 3.3.8. pxe_filter module + 3.3.9. pxe_http module + 3.3.10. httpfs module + 3.3.11. pxe_icmp module + 3.3.12. pxe_ip module + 3.3.13. pxe_isr module + 3.3.14. pxe_mem module + 3.3.15. pxe_sock module + 3.3.16. pxe_segment module + 3.3.17. pxe_tcp module + 3.3.18. pxe_udp module + +4. Debugging, testing and tuning pxe_http library. + + 4.1. Using 'pxe' loader's command + 4.2. Defining debug macroses + 4.3. Tuning + 4.4. NFS loading with pxe_http + +1. Introduction +---------------- + + pxe_http library is user space implementation of simplified + TCP/IP4 stack with support of sockets. Socket implementation is similar + to common sockets, but differs, so I call this variant of sockets - + "PXE sockets" + + features (read: simpliest ever implementation of): + * supports TCP/UDP PXE sockets + * DHCP client + * DNS client + * http based filesystem + * ICMP echo + +1.1. Requirements +------------------ + + To use pxeboot with extensions from pxe_http library + you need: + * DHCP server + - any DHCP server with support of some options + (see below). In example of configuration files + ISC DHCP v.3.0.5 was used. + * TFTP server + * Web server - I've used Apache 1.3.34 + + +1.2. Setting it up +------------------- + + In most cases, it's the same as for usual pxeboot. Main + difference is in configuration file of DHCP server and in usage of + Web-server. + + +1.2.1. DHCP configuration +------------------------- + + Here is example of configuration: + + # /etc/dhcpd.conf example + # + ddns-update-style none; + server-name "DHCPserver"; + server-identifier 192.168.0.4; + default-lease-time 7200; + max-lease-time 7200; + + # + # significant options for correct working of pxeboot + # + + # your LAN subnet mask + option subnet-mask 255.255.255.0; + + # default gateway to use + option routers 192.168.0.1; + + # name of file to download via TFTP + filename "pxeboot"; + + # name server, used for resolving of domain names + option domain-name-servers 192.168.0.1; + + # ip address of web server + option www-server 192.168.0.2; + + # path, where nessesary files are stored on web server + option root-path "th.lan:/path/to/root"; + + subnet 192.168.0.0 netmask 255.255.255.0 { + next-server 192.168.0.4; + range 192.168.0.10 192.168.0.20; + } + + /* end of example */ + + NOTES: + 1. www-server option is used only if root-path is absent in + DHCP reply. In that case assumed, that /boot directory is + placed in DocumentRoot of web-server. + 2. format of root-path has such format: "server:/path". It's + possible use both IP's and domain names for server. /path is + relative to DocumentRoot of web-server. In example above + files are stored at /usr/local/www/data/path/to/root, + assuming that /usr/local/www/data - is DocumentRoot. + 3. DHCP options are not greater then 255 bytes. So, root-path + must satisfy this requirement. + + +1.2.2. TFTP configuration +-------------------------- + + Same as usually. pxe_http doesn't directly use this protocol. + + +1.2.3. Web-server configuration +-------------------------------- + + Just copy all from "/boot" directory to + /DocumentRoot/path/to/root. + + NOTES: + 1. Need to be sure, that partial downloading and keep-alive + connections are supported by server. e.g. for Apache 1.x, + check this options: + + KeepAlive On + MaxKeepAliveRequests 10 # well, choose best for + # server + KeepAliveTimeout 15 # more then 2 seconds + # is good enough + + 2. loader checks gzipped versions of files first, it's good + idea to compress every needed file. e.g. + beastie.4th.gz + device.hints + frames.4th.gz + loader.4th.gz + loader.conf + loader.help.gz + loader.rc + mfsroot.gz + screen.4th.gz + support.4th.gz + /kernel/kernel.gz + +1.2.4. loader.rc configuratuion +-------------------------------- + + HTTP downloading of kernel is not all need to startup system + correctly. The main question is where will be root filesystem after + booting of kernel. The simpliest way - is to use RAM drive with + installation tools or ready to work system. + Here is example of changes to loader.rc, that instructs loader + to download RAM-drive image (in this example, common mfsroot.gz found + in boot.flp floppy image file) + + + \ Includes additional commands + include /boot/loader.4th + + \ Reads and processes loader.conf variables + start + + \ Tests for password -- executes autoboot first if a password was defined + check-password + + \ Load in the boot menu + include /boot/beastie.4th + + \ pxe_http changes: + echo "loading RAM-drive image" + load -t mfs_root /boot/mfsroot + set vfs.root.mountfrom="ufs:/dev/md0c" + \ + + \ Start the boot menu + beastie-start + + /* end of example */ + + Of course, it's possible to set any other filesystem to work + as root, e,g, NFS and not use RAM drive. + +2. Project organisation +------------------------ + +2.1. Code modules +------------------ + + All project code is divided into following modules: + pxe_arp - ARP protocol (3.3.1) + pxe_await - provides functions for awaiting (3.3.2) + pxe_buffer - implements cyclic buffers (3.3.3) + pxe_connection - TCP connection related functions (3.3.4) + pxe_core - provides calls to PXE API (3.3.5) + pxe_dhcp - DHCP client (3.3.6) + pxe_dns - DNS client (3.3.7) + pxe_filter - incoming packet filters (3.3.8) + pxe_http - HTTP related functions (3.3.9) + httpfs - http based file system (3.3.10) + pxe_icmp - ICMP protocol (3.3.11) + pxe_ip - IP protocol (3.3.12) + pxe_isr - assembler side support for PXE API + calling (3.3.13) + pxe_mem - memory work routines (3.3.14) + pxe_sock - simple sockets (3.3.15) + pxe_segment - TCP segments (3.3.16) + pxe_tcp - TCP protocol (3.3.17) + pxe_udp - UDP protocol (3.3.18) + +2.2. Naming conventions +------------------------ + + Most of functions, that may be called directly by user API uses + pxe_ prefix. + Functions related to some module have subprefix of this module, + e.g. pxe_dhcp_query() - function related to DHCP module. + All structures, that are used have typedef equivalent with + naming in upper case. e.g. struct pxe_ipaddr has equivalent PXE_IPADDR. + This is done to have similar to existing pxe.h declarations from libi386. + + +2.3. Understanding logical structure of code +--------------------------------------------- + + Logicallly all modules may be divided to parts. + + Part 1: PXE API related modules (pxe_isr, pxe_core) + Part 2: base protocols related (pxe_ip, pxe_udp) + Part 3: sockets related (pxe_sock) + Part 4: other protocols (pxe_dns, pxe_dhcp) + Part 5: utility (pxe_mem, pxe_buffer) + + Some modules may be used independently, other depend on some + lower level modules. + + In run-time, many calls to sockets functions start packet + recieving or packet sending functions. Sending is more simplier and may + be assumed in many cases just as wrappers to PXE API. But receiving is + a little bit more complicated. Receiving functions start + pxe_core_recv_packets() function in cycle to get packets. + After receiving of packet, it's handling depends on it's type: + ARP, IP or other. ARP packets directly provided to handler + pxe_arp_protocol(), IP packets are provided to registered handler of IP + stack protocol, other packets are ignored. + Registration of handler (except ARP) is performed during + initialisation time of module with usage of pxe_core_register() function, + which register handler for IP stack protocol number. + So, packet is provided to handler, but it may be fragmented, + thus before processing it must be recieved completely. But in some cases + packet may be not interesting for protocol (unexpected packet, dublicated + or something else) and it's possible to determiny if this packet useful + just by examining of packet header. + If packet is fragmented - it firstly provided to handler with + flag PXE_CORE_FRAG. Handler returns appropriate value if is interested in + whole packet, packet is read completely from input queue of fragments and + provided again with flag PXE_CORE_HANDLE. Otherwise packet is dropped + in core by reading of all it's fragments from incoming queue. + Packet structure provides just buffer with received packet and + size of packet. All pxe_core module send/recieve functions work with + PXE_PACKET structure. + TCP and UDP protocols are checking filters in theirs handlers. + This helps to filter out packets that are not interesting for protocol + (e.g. to port that is not listening) + Socket and filter structures are separated. Socket provides + buffers for incoming and outcoming data. Filters may be used without + sockets, e.g. for TCP connections in TIME_WAIT state. For active + connection filter is used to determiny in which receiving buffer (in + which socket) must be placed incoming data. + + +3. API usage +------------- + + Here much attention paid to sockets, other pxe_http API + may be used less frequently. + +3.1. Base information +----------------------- + + User code must perform initialisation of pxe_core module (which + is performed currently in loader during pxe_enable() call). After this + sockets related functions become available. + + pxe_core_init() performs initialisation of pxe_core module and starts + initialisation routines of other modules. It inits TCP, UDP, ARP and + etc modules, however in most of cases it's possible skip theirs + initialisation if module's functions are unused. + Work is finished by pxe_core_shutdown() function. + + +3.2. PXE sockets API overview +------------------------------- + + PXE sockets API differs from common sockets. It's more simplier + and has some limitations due user space implementations. All socket + related functions are declared in pxe_sock.h header + + Socket is created by pxe_socket() call. After usage socket must + be closed by pxe_close() call. Result of pxe_socket() is integer + descriptor associated with socket. After creating socket is unbinded + and not connected. + pxe_sendto(), pxe_connect(), pxe_bind() functions performs + binding and connecting. After successful calling of one of them - socket + is in active state. It's possible to perform reading and sending from/to + socket. Cause socket API may use buffers to optimize packet sending + process, user code must call pxe_flush() functions to be sure, that + data is really processed to sending module. + While receiving need to keep in memory, that if UDP datagram is + not readed completely by one call of pxe_recv() in this implementation + rest of datagram is omited and lost for user code. + All incoming and outcoming data is written to socket buffers, + that have default sizes 16Kb and 4Kb. If buffers are full, next calls + related to writing or reading data will fail. + + +3.2.1. PXE API socket details +------------------------------ + + /* Here is simple example of API usage. */ + + int socket = pxe_socket(); + /* if result is not -1, then socket variable contains value, + * assosiated with socket structure. Call differs from common sockets, + * there are no domain, type and protocol parameters. + * Cause domain is always AF_INET now. others are use in pxe_connect() + * call. + */ + + int result = pxe_connect(socket, &hh->addr, 80, PXE_TCP_PROTOCOL); + /* This call creates filter, associates it with socket and establishes + * communication if needed. + * Parameters are socket, remote ip address (PXE_IPADDR)m remote port + * and one of PXE_UDP_PROTOCOL and PXE_TCP_PROTOCOL protocols. + */ + + if (result == -1) { + pxe_close(socket); + /* any socket must be closed, even if it was not really used + * or conencted. pxe_close() call releases used internal + * structures. After this call any other operations with + * 'socket' descriptor are invalid. + */ + return (0); + } + + /* pxe_send() function sends data to socket. As usual, there is no + * guarantee, that whole buffer is transmited. And actually for TCP + * protocol, this call just places data to buffer. User code have no + * knowledge if data is really sent to network. if current segment is + * not fullly used, data may stay in buffer infinitely. + */ + if (len != pxe_send(socket, hh->buf, len)) { + /* failed to send data, at least whole buffer */ + pxe_close(socket); + return (0); + } + + /* if user code need guarantee, that data is sent to remote host, it + * must call pxe_flush(). It forces sending of any data, that must be + * sent. + */ + if (pxe_flush(socket) == -1) { + /* failed to flush socket */ + pxe_close(socket); + return (0); + } + + /* perform reading cycle */ + + while (count < maxsize) { + /* pxe_recv() is similar to recv() call for common sockets, + * but have no flags parameter + */ + result = pxe_recv(socket, &data[count], maxsize - count); + + if (result == -1) { /* failed to recv */ + break; + } + + if (result == 0) /* nothing received yet */ + continue; + + count += result; + } + + pxe_close(socket); + + + /* End of example */ + + +3.3 Quick Reference to API, available for user code +---------------------------------------------------- + + This overview covers functions and macro definitions that + may be usefull for user code. + + +3.3.1 pxe_arp module +--------------------- + + This module is used mainly by internal code while sending IP + packets. + +macro definitions: + +MAX_ARP_ENTRIES - how much may be ARP table in size. If ARP table full + and new MAC must be placed, then one of older entry is + replaced by new. Default number is 4. + +PXE_MAX_ARP_TRY - how much trys will be peformed when sending ARP + requests, before say MAC search failed. Default: 3 + +PXE_TIME_TO_DIE - how much time to wait ARP reply in milliseconds. + Default: 5000 ms. + +PXE_ARP_SNIFF - sometimes it's usefull to get senders MACs from + incoming requests (this may save time, MAC may be found + in table without requesting it by ARP module itself). + But if network is big enough - ARP table will be + updated too often. By default this option is defined. + + +functions: + +void pxe_arp_init() + - inits pxe_arp module. Usually this call is performed from + pxe_core_init() + +const MAC_ADDR *pxe_arp_ip4mac(const PXE_IPADDR *addr) + - returns MAC address for requested IP address + +void pxe_arp_stats() + - shows ARP table. Available if defined PXE_MORE macro. + + +3.3.2 pxe_await module +----------------------- + + Implements awaiting mechanism. Many operations are performed + similar in protocol implementations. Usually, packet is sended and + application awaits for reply. pxe_await() function helps to simplify + code in such case. + It starts await callback function with some flags and counts + timeouts, try count. + + Here is example of awaiting: + + /* we start awaiting, with dns_await() calllback function, maximum 4 + * trys, each try 20 seconds and waiting data static_wait_data. + * Waiting data - is some data associated with current awaiting, it's + * used by await callback function. + */ + if (!pxe_await(dns_await, 4, 20000, &static_wait_data)) + return (NULL); + + /* pxe_await() returns 1 if awaiting was successfull (await function + * returned PXE_AWAIT_COMPLETED flag) + */ + + /* it's an awaiting function. pxe_await() provides current function, + * current try number, time exceeded from start of try, pointer to + * associated wait data. + */ + int + dns_await(uint8_t function, uint16_t try_number, uint32_t timeout, + void *data) + { + /* cast to our type of wait data */ + PXE_DNS_WAIT_DATA *wait_data = (PXE_DNS_WAIT_DATA *)data; + + switch(function) { + + case PXE_AWAIT_STARTTRY: + /* is called at start of each try + * Here must be performed any await initialisation + * (e.g. request packet sending ) + */ + if (!dns_request(wait_data)) { + /* if initialisation of try failed, try more */ + return (PXE_AWAIT_NEXTTRY); + } + /* otherwise return success result of await function */ + break; + + case PXE_AWAIT_FINISHTRY: + /* this function is called at the end of any try (even + * if try was successful). Here cleanup must be + * performed. + */ + if (wait_data->socket != -1) + pxe_close(wait_data->socket); + + wait_data->id += 1; + break; + + case PXE_AWAIT_NEWPACKETS: + /* while waiting this function called if new packets + * were received by pxe_core_recv_packets(). Actually + * it may be not packets we are waiting for, may be + * even not packets with out protocol. Here we must + * check for new usefull for us packets, receive + * new data if any. + */ + size = pxe_recv(wait_data->socket, wait_data->data, + wait_data->size); + + parse_dns_reply(wait_data); + + if (wait_data->result.ip != 0) { + /* return success of awaiting. This may be + * returned from any function + */ + return (PXE_AWAIT_COMPLETED); + } + + /* if await was not completed, continue waiting */ + return (PXE_AWAIT_CONTINUE); + break; + + case PXE_AWAIT_END: + /* this called if await is ended without any result */ + default: + break; + } + + return (PXE_AWAIT_OK); + } + + /* end of example */ + + So, wait data used for providing and receiving data while + awaiting. pxe_await() performs unified working with code, needed for + waiting of incoming packets. + +macro definitions: + +TIME_DELTA_MS - delay between iterations during awaitng. At each + iteration are checked: + * receiving of new packet. If received - awaiting + function with PXE_AWAIT_NEWPACKETS function is called. + * try timeout. if timeout exceeds maximum timeout - + awaiting function with PXE_AWAIT_FINISHTRY and + PXE_AWAIT_STARTTRY flags sequentially are called. + * try count. if try count exceeds maximum - awaiting + function with PXE_AWAIT_ENDED flag is called. This + means that await failed. + Default: 1 + +TIME_DELTA - default: 1000, same as TIME_DELTA_MS, but in ticks + for delay. + + +3.3.3 pxe_buffer module +------------------------ + + This module provides reading and writing of cyclic buffers. + It's not used directly by user code. + +macro definitions: + +PXE_POOL_SLOTS - if defined, then statical allocation of buffers is + used. Otherwise buffers are allocated at run-time from + heap with pxe_alloc() function. Current statical + allocation algorithm is simple and square, there are + two big buffers data storages divided in slots (by + default 2). + Each slot has size equal to + PXE_DEFAULT_RECV_BUFSIZE or PXE_DEFAULT_SEND_BUFSIZE. + Depending on requested size in pxe_buffer_alloc() + function data allocated from one of stoarge and + related slot marked busy. When pxe_buffer_free() called, + slot marked as free. + Default: undefined + +PXE_DEFAULT_RECV_BUFSIZE - size of receiving buffer. Default: 16392 + +PXE_DEFAULT_SEND_BUFSIZE - size of sending buffer. Default: 4096 + + +3.3.4 pxe_connection module +---------------------------- + + This module is one of TCP related modules. It implements + connection entity. TCP connection is logical structure, that have + needed by TCP protocol counters and states. + User code is not directly works with this module. + +macro definitions: + +PXE_MAX_TCP_CONNECTIONS - how much simultaneous connections may be. + + +functions: + +void pxe_connection_stats() + - returns connections statistics. Available if PXE_MORE macro is + defined. + + +3.3.5 pxe_core module +---------------------- + + This module performs lowlevel work with PXE API: initialisation, + receiving/sending of packets, provides information functions. + In most cases, user code doesn't uses this module directly. + +macro definitions: + +PXE_BUFFER_SIZE - size of core buffers, used in PXE API calling, + Default: 4096 + +PXE_CORE_STATIC_BUFFERS - if defined, core buffers are allocated statically. + Otherwise they are allocated in heap. Default: defined + +functions: + +int pxe_core_recv_packets() + - recieves all packets waiting in incoming queue of NIC, and calls + appropriate protocols if needed + + +void pxe_core_register(uint8_t ip_proto, pxe_protocol_call proc) + - registers IP stack protocol, associates protocol number and handler. + +const MAC_ADDR *pxe_get_mymac() + - returns MAC of NIC, for which PXE API is used. + +const PXE_IPADDR *pxe_get_ip(uint8_t id) + - returns of stored IP, for provided id. + id may be: + PXE_IP_MY - NIC IP address + PXE_IP_NET - network adrress + PXE_IP_NETMASK - network mask + PXE_IP_NAMESERVER - nameserver to use in name resolving + PXE_IP_GATEWAY - default gateway + PXE_IP_BROADCAST - broadcast address + PXE_IP_SERVER - server from which loading of pxeboot + was performed + PXE_IP_WWW - IP address of http-server + PXE_IP_ROOT - IP adddress of server, where root + file system is situated. Currently + it's synonym for PXE_IP_WWW + +void pxe_set_ip(uint8_t id, const PXE_IPADDR *ip) + - sets value by it's id. + +time_t pxe_get_secs() + - returns time in seconds. Used in timeout and resend checking. + +types: + +typedef int (*pxe_protocol_call)(PXE_PACKET *pack, uint8_t function) + - protocol callback function type + + +3.3.6. pxe_dhcp module +----------------------- + + This module implements simple DHCP client, used to obtain + gateway, nameserver and other information. + + +macro definitions: + +PXE_BOOTP_USE_LIBSTAND - use bootp() function provided by libstand instead + of own DHCP client. NOTE: bootp() doesn't set nameip (nameserver ip + structure), thus DNS resolving will be impossible. Default: undefined + + NOTE: to use bootp(), also UDP_DEFAULT_SOCKET macro must be defined. + + +functions: + +void pxe_dhcp_query(uint32_t xid) + - sends DHCPDISCOVER packet and sets core_ips, if gets reply. + + +3.3.6. pxe_dns module +---------------------- + + This module provides domain name resolving. Actually + A and CNAME resource records are supported. + +macro definitions: + +PXE_MAX_DNS_TIMEOUT - max time to wait DNS reply in milliseconds. + Default: 10 seconds + +PXE_MAX_DNS_TRYS - how many times to try to resend request, + if there is no reply. Default: 3 + +PXE_DNS_MAX_PACKET_SIZE - maximum UDP packet size in bytes. Default: 512. + This DNS client doesn't support TCP for resolving. + +functions: + +const PXE_IPADDR *pxe_gethostbyname(char *name) + - returns IP, if resolved, for provided domain name. + +uint32_t pxe_convert_ipstr(char *str) + - converts string value of ipv4 to uint32_t value. + + +3.3.8. pxe_filter module +------------------------- + + This module is not supposed to be used by user code directly. + It implements filtering of incoming IP packets. It's used by UDP and + TCP modules for sorting packets in appropriate socket. + Module provides functions for adding and removing filters. + Each filter contains source/destination ip:port definition and masks + for all of them. Usage of masks gives opportunity to recieve data + from subnet, or subset of ports. + +functions: + +void pxe_filter_init() + - inits filter module structures such as list of free filter entries. + +void pxe_filter_stats() + - show active filters information. Used for debugging. Available if + PXE_MORE macro defined. + + +3.3.9. pxe_http module +----------------------- + + pxe_http implements functions for getting files via HTTP. + Most of it's functions are used only by httpfs module. + At opening file pxe_exists() function is called, which + gets filesize (if possible) by HEAD method of request and opens + connection to file. Result of pxe_exists() call is keep-alive + connection to file. + pxe_get() function gets needed data and reestablishes + connection if needed. + if PXE_MORE defined - pxe_get_close() function becomes + available. It opens connection, gets portion of data and closes + connection. It's rather not optimal usage of http connections, + but some times it may be needed (e.g. for servers, where keep + alive connections are prohibited). + +macro definitions: + +PXE_MAX_HTTP_HDRLEN - buffer size for generating/getting http header. + Default: 1024 bytes. + +functions: + +int pxe_fetch(char *server, char *filename, off_t from, size_t size) + - testing function, gets file from server ()may be partially) and + outputs received data to screen. Available if PXE_MORE defined. + + +3.3.10. httpfs module +---------------------- + + httpfs is filesystem, available via HTTP. It is read-only + filesystem, mainly with sequential access to files. It exports + file operations structure and is not used directly by user code. + httpfs module may support some kind of caching: it requests + more data per request then it's needed at http_read() call and + reads this data later. Such approach speed ups connections speed + and reduces server load. + This opportunity is available if PXE_HTTPFS_CACHING macro + is defined. + + +3.3.11. pxe_icmp module +------------------------ + + pxe_icmp module provides some basic functionality of ICMP + protocol: echo requesting/replying. + Module is unavailable, if PXE_MORE undefined. + + +macro definitions: + +PXE_ICMP_TIMEOUT - timeout in milliseconds when waiting echo reply. + Default: 5000 ms. + + +functions: + +int pxe_ping(const PXE_IPADDR *ip, int count, int flags) + - works similar to usual ping, sends echo request and shows timeout + before echo reply. + +int pxe_icmp_init() + - inits module + + +3.3.12. pxe_ip module +---------------------- + + This module implemets IP protocol functions, also it works + with routing table. It also declares PXE_IPADDR, that is used widely. + +macro definitions: + +PXE_MAX_ROUTES - route table size. Default: 4, usually used 2 entries. + + +functions: + +uint16_t pxe_ip_checksum(const void *data, size_t size) + - calculates checksum for provided block of data. + + +void pxe_ip_route_init(const PXE_IPADDR *def_gw) + - inits routing table, sets default gateway + + +int pxe_ip_route_add(const PXE_IPADDR *net, uint32_t mask, + const PXE_IPADDR *gw) + - adds route to routing table + +int pxe_ip_route_del(const PXE_IPADDR *net, uint32_t mask, + const PXE_IPADDR *gw) + - dels route from routing table + +uint32_t pxe_ip_get_netmask(const PXE_IPADDR *ip) + - returns class based netmask for ip. + +int pxe_ip_route_default(const PXE_IPADDR *gw) + - adds default gateway + +int pxe_ip_send(void *data, const PXE_IPADDR *dst, uint8_t protocol, + uint16_t size) + - sends ip packet with provided data. There must be space for + IP header in buffer, pointed by data. + +void pxe_ip_route_stat() + - show route table. Available if PXE_MORE defined + + +3.3.13. pxe_isr module +----------------------- + + Contains assembler side functions, used in pxe_core. + User code has no direct access to them. + There supported: installation/removing of interrupt handler, + interrupt handler and wrapper for PXE API calls. + + +3.3.14. pxe_mem module +----------------------- + + Actually this module just a wrapper to bcopy(), alloc() and free() + functions. That's done to make pxe_http library more portable. + But in fact, pxe_http depends much on other libstand functions, + such as printf(), strcpy() and etc. So this module is not very usefull and + will be probably removed in future. + + +3.3.15. pxe_sock module +------------------------ + + Most used by user code module. Contains implementation of + pxe_http sockets API. + + +macro definitions: + +PXE_DEFAULT_SOCKETS - count of sockets used at the same time. If all + socket structures are used, next socket creating calls + and API that depends on it, will fail. Default: 4 + + +PXE_SOCKET_TIMEOUT - how long pxe_recv() will be wiating incoming data per + call before return error. Default: 30000 ms + +PXE_SOCKET_CHECK_TIMEOUT - If pxe_recv() waits incoming data and have big free + space in buffer, and in case of TCP protocol it may notice + remote server about this by sending empty packet (with + no data) acking current state, so remote host updates + knowledge about receiving window of client and sends new + data. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 14:33:20 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D0CDF912; Fri, 25 Jan 2013 14:33:20 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B4605E9F; Fri, 25 Jan 2013 14:33:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0PEXKfF005020; Fri, 25 Jan 2013 14:33:20 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0PEXJsR005009; Fri, 25 Jan 2013 14:33:19 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301251433.r0PEXJsR005009@svn.freebsd.org> From: Sean Bruno Date: Fri, 25 Jan 2013 14:33:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245906 - in user/sbruno/head_146698: lib/libstand sys/boot/i386 sys/boot/i386/libi386 sys/boot/i386/loader sys/boot/i386/pxe_http X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 14:33:20 -0000 Author: sbruno Date: Fri Jan 25 14:33:19 2013 New Revision: 245906 URL: http://svnweb.freebsd.org/changeset/base/245906 Log: Massage the pxe_http soc2007 code drop release tar ball into this 6current tree that approximates the state of the tree at the time of release. Everything compiles but nothing actually works. Typical. Added: user/sbruno/head_146698/sys/boot/i386/pxe_http/ user/sbruno/head_146698/sys/boot/i386/pxe_http/Makefile user/sbruno/head_146698/sys/boot/i386/pxe_http/README user/sbruno/head_146698/sys/boot/i386/pxe_http/httpfs.c user/sbruno/head_146698/sys/boot/i386/pxe_http/httpfs.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_arp.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_arp.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_await.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_await.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_buffer.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_buffer.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_connection.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_connection.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_dhcp.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_dhcp.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_dns.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_dns.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_filter.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_filter.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_http.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_http.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_icmp.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_icmp.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_ip.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_ip.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_isr.S user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_isr.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_mem.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_mem.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_segment.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_segment.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_sock.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_sock.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_tcp.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_tcp.h user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_udp.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_udp.h Modified: user/sbruno/head_146698/lib/libstand/printf.c user/sbruno/head_146698/lib/libstand/stand.h user/sbruno/head_146698/sys/boot/i386/Makefile user/sbruno/head_146698/sys/boot/i386/libi386/Makefile user/sbruno/head_146698/sys/boot/i386/libi386/pxe.c user/sbruno/head_146698/sys/boot/i386/libi386/pxe.h user/sbruno/head_146698/sys/boot/i386/loader/Makefile user/sbruno/head_146698/sys/boot/i386/loader/conf.c user/sbruno/head_146698/sys/boot/i386/loader/main.c Modified: user/sbruno/head_146698/lib/libstand/printf.c ============================================================================== --- user/sbruno/head_146698/lib/libstand/printf.c Fri Jan 25 11:52:56 2013 (r245905) +++ user/sbruno/head_146698/lib/libstand/printf.c Fri Jan 25 14:33:19 2013 (r245906) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); #define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1) static char *ksprintn (char *buf, uintmax_t num, int base, int *len); -static int kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap); +static int kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, size_t size, va_list ap); int printf(const char *fmt, ...) @@ -70,7 +70,7 @@ printf(const char *fmt, ...) int retval; va_start(ap, fmt); - retval = kvprintf(fmt, putchar, NULL, 10, ap); + retval = kvprintf(fmt, putchar, NULL, 10, 0, ap); va_end(ap); return retval; } @@ -79,7 +79,7 @@ void vprintf(const char *fmt, va_list ap) { - kvprintf(fmt, putchar, NULL, 10, ap); + kvprintf(fmt, putchar, NULL, 10, 0, ap); } int @@ -89,18 +89,42 @@ sprintf(char *buf, const char *cfmt, ... va_list ap; va_start(ap, cfmt); - retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap); + retval = kvprintf(cfmt, NULL, (void *)buf, 10, 0, ap); buf[retval] = '\0'; va_end(ap); return retval; } +int +snprintf(char *buf, size_t size, const char *cfmt, ...) +{ + int retval; + va_list ap; + size_t maxsize = (size > 1) ? size - 1 : 0; + + if (maxsize == 0) { + buf[0] = '\0'; + return (0); + } + + va_start(ap, cfmt); + retval = kvprintf(cfmt, NULL, (void *)buf, 10, maxsize, ap); + + if (retval < maxsize) + buf[retval] = '\0'; + else + buf[maxsize] = '\0'; + + va_end(ap); + return retval; +} + void vsprintf(char *buf, const char *cfmt, va_list ap) { int retval; - retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap); + retval = kvprintf(cfmt, NULL, (void *)buf, 10, 0, ap); buf[retval] = '\0'; } @@ -152,9 +176,11 @@ ksprintn(char *nbuf, uintmax_t num, int * ("%*D", len, ptr, " " -> XX XX XX XX ... */ static int -kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap) +kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, size_t maxsize, va_list ap) { -#define PCHAR(c) {int cc=(c); if (func) (*func)(cc); else *d++ = cc; retval++; } +#define PCHAR(c) { int cc=(c); if (func) (*func)(cc); else *d++ = cc; retval++; \ + if (maxsize && (retval == maxsize)) return (retval); \ + } char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; Modified: user/sbruno/head_146698/lib/libstand/stand.h ============================================================================== --- user/sbruno/head_146698/lib/libstand/stand.h Fri Jan 25 11:52:56 2013 (r245905) +++ user/sbruno/head_146698/lib/libstand/stand.h Fri Jan 25 14:33:19 2013 (r245906) @@ -250,6 +250,7 @@ extern char *getdisklabel(const char *, extern int printf(const char *fmt, ...) __printflike(1, 2); extern void vprintf(const char *fmt, __va_list); extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); +extern int snprintf(char *buf, size_t size, const char *cfmt, ...) __printflike(3, 4); extern void vsprintf(char *buf, const char *cfmt, __va_list); extern void twiddle(void); Modified: user/sbruno/head_146698/sys/boot/i386/Makefile ============================================================================== --- user/sbruno/head_146698/sys/boot/i386/Makefile Fri Jan 25 11:52:56 2013 (r245905) +++ user/sbruno/head_146698/sys/boot/i386/Makefile Fri Jan 25 14:33:19 2013 (r245906) @@ -1,6 +1,6 @@ # $FreeBSD$ -SUBDIR= mbr boot0 boot0sio btx boot2 cdboot kgzldr libi386 loader +SUBDIR= mbr boot0 boot0sio btx boot2 cdboot kgzldr pxe_http libi386 loader # special boot programs, 'self-extracting boot2+loader' SUBDIR+= pxeldr Modified: user/sbruno/head_146698/sys/boot/i386/libi386/Makefile ============================================================================== --- user/sbruno/head_146698/sys/boot/i386/libi386/Makefile Fri Jan 25 11:52:56 2013 (r245905) +++ user/sbruno/head_146698/sys/boot/i386/libi386/Makefile Fri Jan 25 14:33:19 2013 (r245906) @@ -7,7 +7,7 @@ SRCS= biosacpi.c bioscd.c biosdisk.c bio biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \ comconsole.c devicename.c elf32_freebsd.c \ elf64_freebsd.c gatea20.c \ - i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \ + i386_copy.c i386_module.c nullconsole.c pxe.c \ time.c vidconsole.c amd64_tramp.S BOOT_COMCONSOLE_PORT?= 0x3f8 @@ -23,10 +23,14 @@ CFLAGS+= -DDISK_DEBUG # Include simple terminal emulation (cons25-compatible) CFLAGS+= -DTERM_EMU +CDLAGS+= -DPXE_DEBUG + +# allow pxe_http perform udpread/udpwrite +CFLAGS+= -DPXEHTTP_UDP_FOR_LIBSTAND CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../../contrib/dev/acpica \ - -I${.CURDIR}/../../.. -I. + -I${.CURDIR}/../../.. -I. -I${.CURDIR}/../pxe_http/ # the location of libstand CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ Modified: user/sbruno/head_146698/sys/boot/i386/libi386/pxe.c ============================================================================== --- user/sbruno/head_146698/sys/boot/i386/libi386/pxe.c Fri Jan 25 11:52:56 2013 (r245905) +++ user/sbruno/head_146698/sys/boot/i386/libi386/pxe.c Fri Jan 25 14:33:19 2013 (r245906) @@ -39,67 +39,61 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef LOADER_NFS_SUPPORT #include +#endif #include #include #include #include "btxv86.h" #include "pxe.h" +#include "pxe_core.h" +#include "pxe_dhcp.h" +#include "pxe_isr.h" +#include "pxe_ip.h" +#include "pxe_udp.h" -/* - * Allocate the PXE buffers statically instead of sticking grimy fingers into - * BTX's private data area. The scratch buffer is used to send information to - * the PXE BIOS, and the data buffer is used to receive data from the PXE BIOS. - */ -#define PXE_BUFFER_SIZE 0x2000 #define PXE_TFTP_BUFFER_SIZE 512 -static char scratch_buffer[PXE_BUFFER_SIZE]; -static char data_buffer[PXE_BUFFER_SIZE]; +#ifndef PXEHTTP_UDP_FOR_LIBSTAND +extern uint8_t *scratch_buffer; +extern uint8_t *data_buffer; +#endif + +extern char servername[256]; static pxenv_t *pxenv_p = NULL; /* PXENV+ */ static pxe_t *pxe_p = NULL; /* !PXE */ -static BOOTPLAYER bootplayer; /* PXE Cached information. */ -static int pxe_debug = 0; -static int pxe_sock = -1; +int pxe_sock = -1; static int pxe_opens = 0; void pxe_enable(void *pxeinfo); -static void (*pxe_call)(int func); -static void pxenv_call(int func); -static void bangpxe_call(int func); static int pxe_init(void); static int pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, size_t *rsize); + static int pxe_open(struct open_file *f, ...); static int pxe_close(struct open_file *f); -static void pxe_print(int verbose); static void pxe_cleanup(void); -static void pxe_setnfshandle(char *rootpath); +static void pxe_print(int verbose); -static void pxe_perror(int error); static int pxe_netif_match(struct netif *nif, void *machdep_hint); static int pxe_netif_probe(struct netif *nif, void *machdep_hint); static void pxe_netif_init(struct iodesc *desc, void *machdep_hint); static int pxe_netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout); + static int pxe_netif_put(struct iodesc *desc, void *pkt, size_t len); static void pxe_netif_end(struct netif *nif); -extern struct netif_stats pxe_st[]; -extern u_int16_t __bangpxeseg; -extern u_int16_t __bangpxeoff; -extern void __bangpxeentry(void); -extern u_int16_t __pxenvseg; -extern u_int16_t __pxenvoff; -extern void __pxenventry(void); - -struct netif_dif pxe_ifs[] = { -/* dif_unit dif_nsel dif_stats dif_private */ - {0, 1, &pxe_st[0], 0} -}; +extern struct netif_stats pxe_st[]; + +struct netif_dif pxe_ifs[] = { + /* dif_unit dif_nsel dif_stats dif_private */ + {0, 1, &pxe_st[0], 0} + }; struct netif_stats pxe_st[NENTS(pxe_ifs)]; @@ -132,277 +126,229 @@ struct devsw pxedisk = { pxe_cleanup }; -/* - * This function is called by the loader to enable PXE support if we - * are booted by PXE. The passed in pointer is a pointer to the - * PXENV+ structure. +/* pxe_enable() - This function is called by the loader to enable PXE support + * if we are booted by PXE. + * in: + * pxeinfo - pointer is a pointer to the PXENV+ structure. + * out: + * none */ void pxe_enable(void *pxeinfo) { + pxenv_p = (pxenv_t *)pxeinfo; pxe_p = (pxe_t *)PTOV(pxenv_p->PXEPtr.segment * 16 + pxenv_p->PXEPtr.offset); - pxe_call = NULL; } -/* - * return true if pxe structures are found/initialized, - * also figures out our IP information via the pxe cached info struct +/* pxe_init() - inits pxe_core structs + * in: + * none + * out: + * 2 - already initialized + * 1 - if pxe structures are found & initialized + * 0 - failed */ static int pxe_init(void) { - t_PXENV_GET_CACHED_INFO *gci_p; - int counter; - uint8_t checksum; - uint8_t *checkptr; - - if(pxenv_p == NULL) - return (0); - - /* look for "PXENV+" */ - if (bcmp((void *)pxenv_p->Signature, S_SIZE("PXENV+"))) { - pxenv_p = NULL; - return (0); - } - - /* make sure the size is something we can handle */ - if (pxenv_p->Length > sizeof(*pxenv_p)) { - printf("PXENV+ structure too large, ignoring\n"); - pxenv_p = NULL; - return (0); - } - - /* - * do byte checksum: - * add up each byte in the structure, the total should be 0 - */ - checksum = 0; - checkptr = (uint8_t *) pxenv_p; - for (counter = 0; counter < pxenv_p->Length; counter++) - checksum += *checkptr++; - if (checksum != 0) { - printf("PXENV+ structure failed checksum, ignoring\n"); - pxenv_p = NULL; - return (0); - } - - /* - * PXENV+ passed, so use that if !PXE is not available or - * the checksum fails. - */ - pxe_call = pxenv_call; - if (pxenv_p->Version >= 0x0200) { - for (;;) { - if (bcmp((void *)pxe_p->Signature, S_SIZE("!PXE"))) { - pxe_p = NULL; - break; - } - checksum = 0; - checkptr = (uint8_t *)pxe_p; - for (counter = 0; counter < pxe_p->StructLength; - counter++) - checksum += *checkptr++; - if (checksum != 0) { - pxe_p = NULL; - break; - } - pxe_call = bangpxe_call; - break; - } - } - - printf("\nPXE version %d.%d, real mode entry point ", - (uint8_t) (pxenv_p->Version >> 8), - (uint8_t) (pxenv_p->Version & 0xFF)); - if (pxe_call == bangpxe_call) - printf("@%04x:%04x\n", - pxe_p->EntryPointSP.segment, - pxe_p->EntryPointSP.offset); - else - printf("@%04x:%04x\n", - pxenv_p->RMEntry.segment, pxenv_p->RMEntry.offset); - - gci_p = (t_PXENV_GET_CACHED_INFO *) scratch_buffer; - bzero(gci_p, sizeof(*gci_p)); - gci_p->PacketType = PXENV_PACKET_TYPE_BINL_REPLY; - pxe_call(PXENV_GET_CACHED_INFO); - if (gci_p->Status != 0) { - pxe_perror(gci_p->Status); - pxe_p = NULL; - return (0); - } - bcopy(PTOV((gci_p->Buffer.segment << 4) + gci_p->Buffer.offset), - &bootplayer, gci_p->BufferSize); - return (1); + if (__pxe_nic_irq != 0) + return (2); + + return pxe_core_init(pxenv_p, pxe_p); } - +/* block device strategy function */ static int pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, size_t *rsize) { + return (EIO); } +static void +pxe_print(int verbose) +{ + printf(" pxenet0: MAC %6D\n", pxe_get_mymac(), ":"); + printf(" ISR: at %x:%x (chained at: %x:%x)\n", + __pxe_entry_seg, __pxe_entry_off, + __chained_irq_seg, __chained_irq_off); + + return; +} + static int pxe_open(struct open_file *f, ...) { - va_list args; - char *devname; /* Device part of file name (or NULL). */ - char temp[FNAME_SIZE]; - int error = 0; - int i; - - va_start(args, f); - devname = va_arg(args, char*); - va_end(args); - - /* On first open, do netif open, mount, etc. */ - if (pxe_opens == 0) { - /* Find network interface. */ - if (pxe_sock < 0) { - pxe_sock = netif_open(devname); - if (pxe_sock < 0) { - printf("pxe_open: netif_open() failed\n"); - return (ENXIO); - } - if (pxe_debug) - printf("pxe_open: netif_open() succeeded\n"); - } - if (rootip.s_addr == 0) { - /* - * Do a bootp/dhcp request to find out where our - * NFS/TFTP server is. Even if we dont get back - * the proper information, fall back to the server - * which brought us to life and a default rootpath. - */ - bootp(pxe_sock, BOOTP_PXE); - if (rootip.s_addr == 0) - rootip.s_addr = bootplayer.sip; - if (!rootpath[1]) - strcpy(rootpath, PXENFSROOTPATH); - - for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) - if (rootpath[i] == ':') - break; - if (i && i != FNAME_SIZE && rootpath[i] == ':') { - rootpath[i++] = '\0'; - if (inet_addr(&rootpath[0]) != INADDR_NONE) - rootip.s_addr = inet_addr(&rootpath[0]); - bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1); - bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1); - } - printf("pxe_open: server addr: %s\n", inet_ntoa(rootip)); - printf("pxe_open: server path: %s\n", rootpath); - printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); - - setenv("boot.netif.ip", inet_ntoa(myip), 1); - setenv("boot.netif.netmask", intoa(netmask), 1); - setenv("boot.netif.gateway", inet_ntoa(gateip), 1); - if (bootplayer.Hardware == ETHER_TYPE) { - sprintf(temp, "%6D", bootplayer.CAddr, ":"); - setenv("boot.netif.hwaddr", temp, 1); + va_list args; + char *devname = NULL; + int i = 0; + + va_start(args, f); + devname = va_arg(args, char*); + va_end(args); + + if (pxe_opens == 0) { + /* Find network interface. */ + if (pxe_sock < 0) { + pxe_sock = netif_open(devname); + + if (pxe_sock < 0) { + printf("pxe_open: netif_open() failed\n"); + return (ENXIO); + } + } - setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); - setenv("boot.nfsroot.path", rootpath, 1); - setenv("dhcp.host-name", hostname, 1); + +#ifdef PXE_BOOTP_USE_LIBSTAND + const PXE_IPADDR *addr = pxe_get_ip(PXE_IP_ROOT); + + if ( (addr->ip == 0)) { + pxe_dhcp_query(0); + pxe_core_update_bootp(); + +#ifdef PXEHTTP_UDP_FOR_LIBSTAND + gateip.s_addr = pxe_get_ip(PXE_IP_GATEWAY)->ip; + rootip.s_addr = pxe_get_ip(PXE_IP_ROOT)->ip; + netmask = pxe_get_ip(PXE_IP_NETMASK)->ip; + myip.s_addr = pxe_get_ip(PXE_IP_MY)->ip; + nameip.s_addr = pxe_get_ip(PXE_IP_NAMESERVER)->ip; +#endif + } +#endif /* PXE_BOOTP_USE_LIBSTAND */ } - } - pxe_opens++; - f->f_devdata = &pxe_sock; - return (error); + ++pxe_opens; + f->f_devdata = &pxe_sock; + + return (0); } static int pxe_close(struct open_file *f) { + /* On last close, do netif close, etc. */ + f->f_devdata = NULL; + + if (pxe_opens) + --pxe_opens; + + /* Not last close? */ + if (pxe_opens > 0) + return (0); -#ifdef PXE_DEBUG - if (pxe_debug) - printf("pxe_close: opens=%d\n", pxe_opens); + if (pxe_sock >= 0) { +#ifdef PXE_DEBUG + printf("pxe_close: calling netif_close()\n"); #endif - - /* On last close, do netif close, etc. */ - f->f_devdata = NULL; - /* Extra close call? */ - if (pxe_opens <= 0) + netif_close(pxe_sock); + pxe_sock = -1; + } + return (0); - pxe_opens--; - /* Not last close? */ - if (pxe_opens > 0) - return(0); - - /* get an NFS filehandle for our root filesystem */ - pxe_setnfshandle(rootpath); +} - if (pxe_sock >= 0) { +static void +pxe_cleanup(void) +{ + pxe_core_shutdown(); +} +static int +pxe_netif_match(struct netif *nif, void *machdep_hint) +{ #ifdef PXE_DEBUG - if (pxe_debug) - printf("pxe_close: calling netif_close()\n"); + printf("pxe_netif_match() called."); #endif - netif_close(pxe_sock); - pxe_sock = -1; - } - return (0); + return (1); } -static void -pxe_print(int verbose) + +static int +pxe_netif_probe(struct netif *nif, void *machdep_hint) { - if (pxe_call != NULL) { - if (*bootplayer.Sname == '\0') { - printf(" "IP_STR":%s\n", - IP_ARGS(htonl(bootplayer.sip)), - bootplayer.bootfile); - } else { - printf(" %s:%s\n", bootplayer.Sname, - bootplayer.bootfile); - } - } +#ifdef PXE_DEBUG + printf("pxe_netif_probe() called."); +#endif - return; +#ifdef PXEHTTP_UDP_FOR_LIBSTAND + if (__pxe_nic_irq == 0) + return (-1); +#else + t_PXENV_UDP_OPEN *udpopen_p = (t_PXENV_UDP_OPEN *)scratch_buffer; + + bzero(udpopen_p, sizeof(*udpopen_p)); + + const PXE_IPADDR *my = pxe_get_ip(PXE_IP_MY); + udpopen_p->src_ip = my->ip; + + pxe_core_call(PXENV_UDP_OPEN); + + if (udpopen_p->status != 0) { + printf("pxe_netif_probe: failed %x\n", udpopen_p->status); + return (-1); + } +#endif + return (0); } static void -pxe_cleanup(void) +pxe_netif_end(struct netif *nif) { #ifdef PXE_DEBUG - t_PXENV_UNLOAD_STACK *unload_stack_p = - (t_PXENV_UNLOAD_STACK *)scratch_buffer; - t_PXENV_UNDI_SHUTDOWN *undi_shutdown_p = - (t_PXENV_UNDI_SHUTDOWN *)scratch_buffer; + printf("pxe_netif_end() called."); #endif - if (pxe_call == NULL) - return; +#ifndef PXEHTTP_UDP_FOR_LIBSTAND + t_PXENV_UDP_CLOSE *udpclose_p = (t_PXENV_UDP_CLOSE *)scratch_buffer; + + bzero(udpclose_p, sizeof(*udpclose_p)); + + pxe_core_call(PXENV_UDP_CLOSE); - pxe_call(PXENV_UNDI_SHUTDOWN); + if (udpclose_p->status != 0) + printf("pxe_end failed %x\n", udpclose_p->status); +#endif +} +static void +pxe_netif_init(struct iodesc *desc, void *machdep_hint) +{ + #ifdef PXE_DEBUG - if (pxe_debug && undi_shutdown_p->Status != 0) - printf("pxe_cleanup: UNDI_SHUTDOWN failed %x\n", - undi_shutdown_p->Status); + printf("pxe_netif_init(): called.\n"); #endif + uint8_t *mac = (uint8_t *)pxe_get_mymac(); + + int i; + for (i = 0; i < 6; ++i) + desc->myea[i] = mac[i]; - pxe_call(PXENV_UNLOAD_STACK); + const PXE_IPADDR *my = pxe_get_ip(PXE_IP_MY); + desc->xid = my->ip; +} -#ifdef PXE_DEBUG - if (pxe_debug && unload_stack_p->Status != 0) - printf("pxe_cleanup: UNLOAD_STACK failed %x\n", - unload_stack_p->Status); +static int +pxe_netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout) +{ +#ifdef PXE_DEBUG + printf("pxe_netif_get(): called.\n"); #endif + return (len); } -void -pxe_perror(int err) +static int +pxe_netif_put(struct iodesc *desc, void *pkt, size_t len) { - return; +#ifdef PXE_DEBUG + printf("pxe_netif_put(): called.\n"); +#endif + return (len); } +#if defined(LOADER_NFS_SUPPORT) /* * Reach inside the libstand NFS code and dig out an NFS handle * for the root filesystem. @@ -413,6 +359,7 @@ struct nfs_iodesc { u_char fh[NFS_FHSIZE]; /* structure truncated here */ }; + extern struct nfs_iodesc nfs_root_node; extern int rpc_port; @@ -454,181 +401,127 @@ pxe_setnfshandle(char *rootpath) sprintf(cp, "X"); setenv("boot.nfsroot.nfshandle", buf, 1); } - -void -pxenv_call(int func) -{ -#ifdef PXE_DEBUG - if (pxe_debug) - printf("pxenv_call %x\n", func); #endif - - bzero(&v86, sizeof(v86)); - bzero(data_buffer, sizeof(data_buffer)); - - __pxenvseg = pxenv_p->RMEntry.segment; - __pxenvoff = pxenv_p->RMEntry.offset; - - v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.es = VTOPSEG(scratch_buffer); - v86.edi = VTOPOFF(scratch_buffer); - v86.addr = (VTOPSEG(__pxenventry) << 16) | VTOPOFF(__pxenventry); - v86.ebx = func; - v86int(); - v86.ctl = V86_FLAGS; -} -void -bangpxe_call(int func) +#ifdef PXEHTTP_UDP_FOR_LIBSTAND +/* new versions of udp send/recv functions */ +ssize_t +sendudp(struct iodesc *h, void *pkt, size_t len) { -#ifdef PXE_DEBUG - if (pxe_debug) - printf("bangpxe_call %x\n", func); +#ifdef PXE_DEBUG_HELL + printf("sendudp(): sending %u bytes from me:%u -> %s:%u\n", + len, ntohs(h->myport), + inet_ntoa(h->destip), ntohs(h->destport)); #endif + void *ipdata = pkt - sizeof(PXE_UDP_PACKET); - bzero(&v86, sizeof(v86)); - bzero(data_buffer, sizeof(data_buffer)); - - __bangpxeseg = pxe_p->EntryPointSP.segment; - __bangpxeoff = pxe_p->EntryPointSP.offset; - - v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.edx = VTOPSEG(scratch_buffer); - v86.eax = VTOPOFF(scratch_buffer); - v86.addr = (VTOPSEG(__bangpxeentry) << 16) | VTOPOFF(__bangpxeentry); - v86.ebx = func; - v86int(); - v86.ctl = V86_FLAGS; -} - - -time_t -getsecs() -{ - time_t n = 0; - time(&n); - return n; -} - -static int -pxe_netif_match(struct netif *nif, void *machdep_hint) -{ - return 1; -} - + PXE_IPADDR dst; + dst.ip = h->destip.s_addr; -static int -pxe_netif_probe(struct netif *nif, void *machdep_hint) -{ - t_PXENV_UDP_OPEN *udpopen_p = (t_PXENV_UDP_OPEN *)scratch_buffer; - - if (pxe_call == NULL) - return -1; - - bzero(udpopen_p, sizeof(*udpopen_p)); - udpopen_p->src_ip = bootplayer.yip; - pxe_call(PXENV_UDP_OPEN); - - if (udpopen_p->status != 0) { - printf("pxe_netif_probe: failed %x\n", udpopen_p->status); - return -1; + if (!pxe_udp_send(ipdata, &dst, ntohs(h->destport), + ntohs(h->myport), len + sizeof(PXE_UDP_PACKET))) + { + printf("sendudp(): failed\n"); + return (-1); } - return 0; -} - -static void -pxe_netif_end(struct netif *nif) -{ - t_PXENV_UDP_CLOSE *udpclose_p = (t_PXENV_UDP_CLOSE *)scratch_buffer; - bzero(udpclose_p, sizeof(*udpclose_p)); - - pxe_call(PXENV_UDP_CLOSE); - if (udpclose_p->status != 0) - printf("pxe_end failed %x\n", udpclose_p->status); -} - -static void -pxe_netif_init(struct iodesc *desc, void *machdep_hint) -{ - int i; - for (i = 0; i < 6; ++i) - desc->myea[i] = bootplayer.CAddr[i]; - desc->xid = bootplayer.ident; + + return (len); } -static int -pxe_netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout) +ssize_t +readudp(struct iodesc *h, void *pkt, size_t len, time_t timeout) { - return len; -} + PXE_UDP_DGRAM dgram; + struct udphdr *uh = (struct udphdr *) pkt - 1; + + /* process any queued incoming packets */ + pxe_core_recv_packets(); -static int -pxe_netif_put(struct iodesc *desc, void *pkt, size_t len) -{ - return len; + /* reading from default socket */ + int recv = pxe_udp_read(NULL, pkt, len, &dgram); + + if (recv == -1) { + printf("readudp(): failed\n"); + return (-1); + } +#ifdef PXE_DEBUG_HELL + printf("readudp(): received %d(%u/%u) bytes from %u port\n", + recv, len, dgram.size, dgram.src_port); +#endif + uh->uh_sport = htons(dgram.src_port); + + return (recv); } +#else /* !defined(PXEHTTP_UDP_FOR_LIBSTAND) */ +/* old variants of udp send/recv functions */ ssize_t sendudp(struct iodesc *h, void *pkt, size_t len) { - t_PXENV_UDP_WRITE *udpwrite_p = (t_PXENV_UDP_WRITE *)scratch_buffer; - bzero(udpwrite_p, sizeof(*udpwrite_p)); - - udpwrite_p->ip = h->destip.s_addr; - udpwrite_p->dst_port = h->destport; - udpwrite_p->src_port = h->myport; - udpwrite_p->buffer_size = len; - udpwrite_p->buffer.segment = VTOPSEG(pkt); - udpwrite_p->buffer.offset = VTOPOFF(pkt); - - if (netmask == 0 || SAMENET(myip, h->destip, netmask)) - udpwrite_p->gw = 0; - else - udpwrite_p->gw = gateip.s_addr; - - pxe_call(PXENV_UDP_WRITE); + t_PXENV_UDP_WRITE *udpwrite_p = (t_PXENV_UDP_WRITE *)scratch_buffer; + bzero(udpwrite_p, sizeof(*udpwrite_p)); + + udpwrite_p->ip = h->destip.s_addr; + udpwrite_p->dst_port = h->destport; + udpwrite_p->src_port = h->myport; + udpwrite_p->buffer_size = len; + udpwrite_p->buffer.segment = VTOPSEG(pkt); + udpwrite_p->buffer.offset = VTOPOFF(pkt); + + if (netmask == 0 || SAMENET(myip, h->destip, netmask)) + udpwrite_p->gw = 0; + else + udpwrite_p->gw = gateip.s_addr; + pxe_core_call(PXENV_UDP_WRITE); #if 0 - /* XXX - I dont know why we need this. */ - delay(1000); + /* XXX - I dont know why we need this. */ + delay(1000); #endif - if (udpwrite_p->status != 0) { - /* XXX: This happens a lot. It shouldn't. */ - if (udpwrite_p->status != 1) - printf("sendudp failed %x\n", udpwrite_p->status); - return -1; + if (udpwrite_p->status != 0) { + /* XXX: This happens a lot. It shouldn't. */ + if (udpwrite_p->status != 1) + printf("sendudp failed %x\n", udpwrite_p->status); + + return (-1); } - return len; + + return (len); } ssize_t readudp(struct iodesc *h, void *pkt, size_t len, time_t timeout) { - t_PXENV_UDP_READ *udpread_p = (t_PXENV_UDP_READ *)scratch_buffer; - struct udphdr *uh = NULL; - - uh = (struct udphdr *) pkt - 1; - bzero(udpread_p, sizeof(*udpread_p)); - - udpread_p->dest_ip = h->myip.s_addr; - udpread_p->d_port = h->myport; - udpread_p->buffer_size = len; - udpread_p->buffer.segment = VTOPSEG(data_buffer); - udpread_p->buffer.offset = VTOPOFF(data_buffer); - - pxe_call(PXENV_UDP_READ); - + t_PXENV_UDP_READ *udpread_p = (t_PXENV_UDP_READ *)scratch_buffer; + struct udphdr *uh = NULL; + + uh = (struct udphdr *) pkt - 1; + bzero(udpread_p, sizeof(*udpread_p)); + + udpread_p->dest_ip = h->myip.s_addr; + udpread_p->d_port = h->myport; + udpread_p->buffer_size = len; + udpread_p->buffer.segment = VTOPSEG(data_buffer); + udpread_p->buffer.offset = VTOPOFF(data_buffer); + + pxe_core_call(PXENV_UDP_READ); + #if 0 - /* XXX - I dont know why we need this. */ - delay(1000); + /* XXX - I dont know why we need this. */ + delay(1000); #endif - if (udpread_p->status != 0) { - /* XXX: This happens a lot. It shouldn't. */ - if (udpread_p->status != 1) - printf("readudp failed %x\n", udpread_p->status); - return -1; + if (udpread_p->status != 0) { + /* XXX: This happens a lot. It shouldn't. */ + if (udpread_p->status != 1) + printf("readudp failed %x\n", udpread_p->status); + + return (-1); } - bcopy(data_buffer, pkt, udpread_p->buffer_size); - uh->uh_sport = udpread_p->s_port; - return udpread_p->buffer_size; + + bcopy(data_buffer, pkt, udpread_p->buffer_size); + uh->uh_sport = udpread_p->s_port; + + return (udpread_p->buffer_size); } + +#endif /* PXEHTTP_UDP_FOR_LIBSTAND */ Modified: user/sbruno/head_146698/sys/boot/i386/libi386/pxe.h ============================================================================== --- user/sbruno/head_146698/sys/boot/i386/libi386/pxe.h Fri Jan 25 11:52:56 2013 (r245905) +++ user/sbruno/head_146698/sys/boot/i386/libi386/pxe.h Fri Jan 25 14:33:19 2013 (r245906) @@ -48,6 +48,9 @@ * structures passed into PXE * Question: does this really work for PXE's expected ABI? */ +#ifndef __PXE__H__ +#define __PXE__H__ + #define PACKED __packed #define S_SIZE(s) s, sizeof(s) - 1 @@ -156,7 +159,7 @@ typedef struct { PXENV_STATUS_t Status; ADDR32_t ProtocolIni; /* Phys addr of a copy of the driver module */ uint8_t reserved[8]; -} PACKED t_PXENV_UNDI_INITALIZE; +} PACKED t_PXENV_UNDI_INITIALIZE; #define MAXNUM_MCADDR 8 @@ -334,6 +337,15 @@ typedef struct { uint32_t Reserved[4]; /* must be 0 */ } PACKED t_PXENV_UNDI_GET_NDIS_INFO; +#define PXENV_UNDI_GET_STATE 0x0015 +typedef struct { + PXENV_STATUS_t Status; +#define PXE_UNDI_GET_STATE_STARTED 1 +#define PXE_UNDI_GET_STATE_INITIALIZED 2 +#define PXE_UNDI_GET_STATE_OPENED 3 + uint8_t UNDIstate; /* UNDI engine state */ +} PACKED t_PXENV_UNDI_GET_STATE; + #define PXENV_UNDI_ISR 0x0014 typedef struct { PXENV_STATUS_t Status; @@ -520,3 +532,5 @@ typedef struct { typedef struct { PXENV_STATUS_t Status; } PACKED t_PXENV_STOP_BASE; + +#endif Modified: user/sbruno/head_146698/sys/boot/i386/loader/Makefile ============================================================================== --- user/sbruno/head_146698/sys/boot/i386/loader/Makefile Fri Jan 25 11:52:56 2013 (r245905) +++ user/sbruno/head_146698/sys/boot/i386/loader/Makefile Fri Jan 25 14:33:19 2013 (r245906) @@ -7,6 +7,11 @@ NEWVERSWHAT= "bootstrap loader" i386 # architecture-specific loader code SRCS= main.c conf.c vers.c *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 14:36:18 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A8855C34; Fri, 25 Jan 2013 14:36:18 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 839E5ED2; Fri, 25 Jan 2013 14:36:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0PEaINh005430; Fri, 25 Jan 2013 14:36:18 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0PEaI6m005429; Fri, 25 Jan 2013 14:36:18 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301251436.r0PEaI6m005429@svn.freebsd.org> From: Sean Bruno Date: Fri, 25 Jan 2013 14:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245907 - user/sbruno/pxestuff X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 14:36:18 -0000 Author: sbruno Date: Fri Jan 25 14:36:17 2013 New Revision: 245907 URL: http://svnweb.freebsd.org/changeset/base/245907 Log: Obsoleted tree. Deleted: user/sbruno/pxestuff/ From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 15:37:37 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 632314ED; Fri, 25 Jan 2013 15:37:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 41CDE3C8; Fri, 25 Jan 2013 15:37:37 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5E662B91E; Fri, 25 Jan 2013 10:37:36 -0500 (EST) From: John Baldwin To: Sean Bruno Subject: Re: svn commit: r245902 - user/sbruno/head_146698 Date: Fri, 25 Jan 2013 08:32:43 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201301251137.r0PBbuiN051834@svn.freebsd.org> In-Reply-To: <201301251137.r0PBbuiN051834@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201301250832.43222.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 25 Jan 2013 10:37:36 -0500 (EST) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 15:37:37 -0000 On Friday, January 25, 2013 6:37:56 am Sean Bruno wrote: > Author: sbruno > Date: Fri Jan 25 11:37:56 2013 > New Revision: 245902 > URL: http://svnweb.freebsd.org/changeset/base/245902 > > Log: > Branch head from the past at svn r146698 which is the approximate 6Current > timeframe where pxe_http was developed during GSOC 2007. > > This is based on the cvs tags from the project tar ball at: > http://code.google.com/p/google-summer-of-code-2007- freebsd/downloads/detail?name=Alexey_Tarasov.tar.gz&can=2&q= > > and perforce commit history: > http://p4web.freebsd.org/@md=d&cd=//depot/projects/soc2007/&c=SxU@//depot/projects/soc2007/taleks- pxe_http/?ac=83 > > Added: > user/sbruno/head_146698/ > - copied from r146698, head/ Have you considered just doing a 'p4 integ' on the GSOC branch in p4? Or rather, making a copy of that branch in p4 and then doing an integ from HEAD into that? That might be simpler than trying to recreate everything in svn. Once you have an up-to-date diff you can then move that to an svn branch. -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 15:51:24 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F2884135; Fri, 25 Jan 2013 15:51:23 +0000 (UTC) (envelope-from seanwbruno@gmail.com) Received: from mail-pb0-f49.google.com (mail-pb0-f49.google.com [209.85.160.49]) by mx1.freebsd.org (Postfix) with ESMTP id A977472D; Fri, 25 Jan 2013 15:51:23 +0000 (UTC) Received: by mail-pb0-f49.google.com with SMTP id xa12so280872pbc.22 for ; Fri, 25 Jan 2013 07:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:from:reply-to:to:cc:in-reply-to:references :content-type:date:message-id:mime-version:x-mailer; bh=XG5CweODh1WVBk0IccmaUs53v0sMePyBmcFc6aROezU=; b=sGreVOpHHcOoUEXvKlI5TaFEAszWOQ+4dK4qabw2TGrQgUkaWrq6SPOvG1g3TdqJUz fArYgKmA75N0QchzbLk5kBEnc4ft8AZOgbT7jntIK8Nsaa842eH297EtxQOEROdk3jrW /nz4U2S3IUBFRB/L3E3bs1PIvNBAhcEHGsKMDF372oWKaSelz/TMzxiq0C4UV7W/jbRY 1RnpmTukEYuc0r03QAG5dAbrxbBPEa5rZQsjUYeEatlvvaQbvORxzkZc3bg7ordWuALb igiHE9SfRVBvVtfyI0mSBlme3AGzWsXfVbL2XdOi1TUqITc1Y70R9BOrpzy4NGPBvbrd MZjw== X-Received: by 10.68.209.170 with SMTP id mn10mr15448382pbc.11.1359129083522; Fri, 25 Jan 2013 07:51:23 -0800 (PST) Received: from [10.73.203.110] (nat-dip3.cfw-a-gci.corp.yahoo.com. [209.131.62.145]) by mx.google.com with ESMTPS id ix9sm884969pbc.7.2013.01.25.07.51.21 (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 25 Jan 2013 07:51:22 -0800 (PST) Subject: Re: svn commit: r245902 - user/sbruno/head_146698 From: Sean Bruno To: John Baldwin In-Reply-To: <201301250832.43222.jhb@freebsd.org> References: <201301251137.r0PBbuiN051834@svn.freebsd.org> <201301250832.43222.jhb@freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-lJvZwzokJh3/pkP37LfL" Date: Fri, 25 Jan 2013 07:51:19 -0800 Message-ID: <1359129079.5527.7.camel@powernoodle.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Sean Bruno List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 15:51:24 -0000 --=-lJvZwzokJh3/pkP37LfL Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2013-01-25 at 08:32 -0500, John Baldwin wrote: > On Friday, January 25, 2013 6:37:56 am Sean Bruno wrote: > > Author: sbruno > > Date: Fri Jan 25 11:37:56 2013 > > New Revision: 245902 > > URL: http://svnweb.freebsd.org/changeset/base/245902 > >=20 > > Log: > > Branch head from the past at svn r146698 which is the approximate 6Cu= rrent > > timeframe where pxe_http was developed during GSOC 2007. > > =20 > > This is based on the cvs tags from the project tar ball at: > > http://code.google.com/p/google-summer-of-code-2007- > freebsd/downloads/detail?name=3DAlexey_Tarasov.tar.gz&can=3D2&q=3D > > =20 > > and perforce commit history: > > =20 > http://p4web.freebsd.org/@md=3Dd&cd=3D//depot/projects/soc2007/&c=3DSxU@/= /depot/projects/soc2007/taleks- > pxe_http/?ac=3D83 > >=20 > > Added: > > user/sbruno/head_146698/ > > - copied from r146698, head/ >=20 > Have you considered just doing a 'p4 integ' on the GSOC branch in p4? Or= =20 > rather, making a copy of that branch in p4 and then doing an integ from H= EAD=20 > into that? That might be simpler than trying to recreate everything in = svn. =20 > Once you have an up-to-date diff you can then move that to an svn branch. >=20 Yes. =20 Step 1. Validate that anything in this code base works. If Step 1, then attempt to integrate 7 years of history and move this code forward. sean --=-lJvZwzokJh3/pkP37LfL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAABAgAGBQJRAqn3AAoJEBkJRdwI6BaHD1UH/04z1Aa/g0uE5H6LRn5MIt2b MTd6w856A5TUK3h3qyPoIFkYY+pAtT3xidigL3LLIa2LPrWHUCPIuGoWdHMODLR3 q1ocfnrNs0E3vwUOyvcnPg0bGVSqSImCnOVAWjrnDQYOnTn6A0wds3YRafZhosIX c832bORridsV0M1Z5ti/AttOTgUDlI1/kfo/10VqJEKWm6sC8IGLVfGClvGPDjVl VH/R3Zq7Jz2IqqIkm/5hU/GZeM/OTJqhKHhTCPhGHcZpFosx/ieC/F7wn2L8zTV2 rEX/IAFj0Ck3eLNmJoxvD3BjFEmgv9IAicyeg1CrrgYSXZwmwgJPNjYZbM0Syp8= =x5dZ -----END PGP SIGNATURE----- --=-lJvZwzokJh3/pkP37LfL-- From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 17:01:55 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D844AA02; Fri, 25 Jan 2013 17:01:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id AB0CCA56; Fri, 25 Jan 2013 17:01:55 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 95C5CB977; Fri, 25 Jan 2013 12:01:54 -0500 (EST) From: John Baldwin To: Sean Bruno Subject: Re: svn commit: r245902 - user/sbruno/head_146698 Date: Fri, 25 Jan 2013 11:59:14 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201301251137.r0PBbuiN051834@svn.freebsd.org> <201301250832.43222.jhb@freebsd.org> <1359129079.5527.7.camel@powernoodle.corp.yahoo.com> In-Reply-To: <1359129079.5527.7.camel@powernoodle.corp.yahoo.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201301251159.14515.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 25 Jan 2013 12:01:54 -0500 (EST) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 17:01:55 -0000 On Friday, January 25, 2013 10:51:19 am Sean Bruno wrote: > On Fri, 2013-01-25 at 08:32 -0500, John Baldwin wrote: > > On Friday, January 25, 2013 6:37:56 am Sean Bruno wrote: > > > Author: sbruno > > > Date: Fri Jan 25 11:37:56 2013 > > > New Revision: 245902 > > > URL: http://svnweb.freebsd.org/changeset/base/245902 > > > > > > Log: > > > Branch head from the past at svn r146698 which is the approximate 6Current > > > timeframe where pxe_http was developed during GSOC 2007. > > > > > > This is based on the cvs tags from the project tar ball at: > > > http://code.google.com/p/google-summer-of-code-2007- > > freebsd/downloads/detail?name=Alexey_Tarasov.tar.gz&can=2&q= > > > > > > and perforce commit history: > > > > > http://p4web.freebsd.org/@md=d&cd=//depot/projects/soc2007/&c=SxU@//depot/projects/soc2007/taleks- > > pxe_http/?ac=83 > > > > > > Added: > > > user/sbruno/head_146698/ > > > - copied from r146698, head/ > > > > Have you considered just doing a 'p4 integ' on the GSOC branch in p4? Or > > rather, making a copy of that branch in p4 and then doing an integ from HEAD > > into that? That might be simpler than trying to recreate everything in svn. > > Once you have an up-to-date diff you can then move that to an svn branch. > > > > Yes. > > Step 1. Validate that anything in this code base works. > > If Step 1, then attempt to integrate 7 years of history and move this > code forward. Hmm, could you do that with a checkout of the p4 branch then? -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 19:34:55 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8EBFFE1D; Fri, 25 Jan 2013 19:34:55 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 81298315; Fri, 25 Jan 2013 19:34:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0PJYtxO094135; Fri, 25 Jan 2013 19:34:55 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0PJYtqM094134; Fri, 25 Jan 2013 19:34:55 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301251934.r0PJYtqM094134@svn.freebsd.org> From: Sean Bruno Date: Fri, 25 Jan 2013 19:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245913 - user/sbruno/head_146698/sys/boot/i386/pxe_http X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 19:34:55 -0000 Author: sbruno Date: Fri Jan 25 19:34:54 2013 New Revision: 245913 URL: http://svnweb.freebsd.org/changeset/base/245913 Log: Make the WWW IP work if PXE_BOOTP_USE_LIBSTAND defined. Modified: user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c Modified: user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c ============================================================================== --- user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c Fri Jan 25 18:47:16 2013 (r245912) +++ user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c Fri Jan 25 19:34:54 2013 (r245913) @@ -86,62 +86,61 @@ static int pxe_state = PXE_DOWN; void pxe_core_update_bootp() { - const PXE_IPADDR *paddr = pxe_get_ip(PXE_IP_ROOT); - int i = 0; - char temp[20]; + const PXE_IPADDR *paddr = pxe_get_ip(PXE_IP_ROOT); + int i = 0; + char temp[20]; - if (paddr->ip == 0) - pxe_set_ip(PXE_IP_ROOT, pxe_get_ip(PXE_IP_SERVER)); + if (paddr->ip == 0) + pxe_set_ip(PXE_IP_ROOT, pxe_get_ip(PXE_IP_SERVER)); - struct in_addr tmp_in; + struct in_addr tmp_in; - tmp_in.s_addr = pxe_get_ip(PXE_IP_GATEWAY)->ip; - setenv("boot.netif.gateway", inet_ntoa(tmp_in), 1); + tmp_in.s_addr = pxe_get_ip(PXE_IP_GATEWAY)->ip; + setenv("boot.netif.gateway", inet_ntoa(tmp_in), 1); /* initing route tables, using DHCP reply data */ - pxe_ip_route_init(pxe_get_ip(PXE_IP_GATEWAY)); + pxe_ip_route_init(pxe_get_ip(PXE_IP_GATEWAY)); #ifdef PXE_DEBUG - printf("pxe_open: gateway ip: %s\n", inet_ntoa(tmp_in)); + printf("pxe_open: gateway ip: %s\n", inet_ntoa(tmp_in)); #endif - tmp_in.s_addr = pxe_get_ip(PXE_IP_MY)->ip; - setenv("boot.netif.ip", inet_ntoa(tmp_in), 1); + tmp_in.s_addr = pxe_get_ip(PXE_IP_MY)->ip; + setenv("boot.netif.ip", inet_ntoa(tmp_in), 1); - tmp_in.s_addr = pxe_get_ip(PXE_IP_NETMASK)->ip; - setenv("boot.netif.netmask", inet_ntoa(tmp_in), 1); + tmp_in.s_addr = pxe_get_ip(PXE_IP_NETMASK)->ip; + setenv("boot.netif.netmask", inet_ntoa(tmp_in), 1); - sprintf(temp, "%6D", pxe_get_mymac(), ":"); - setenv("boot.netif.hwaddr", temp, 1); + sprintf(temp, "%6D", pxe_get_mymac(), ":"); + setenv("boot.netif.hwaddr", temp, 1); - if (!rootpath[1]) - strcpy(rootpath, PXENFSROOTPATH); + if (!rootpath[1]) + strcpy(rootpath, PXENFSROOTPATH); - for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) + printf("rootpath: %s\n", rootpath); + for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) if (rootpath[i] == ':') - break; + break; - if (i && i != FNAME_SIZE && rootpath[i] == ':') { - - rootpath[i++] = '\0'; - - const PXE_IPADDR *root_addr = pxe_gethostbyname(rootpath); - pxe_set_ip(PXE_IP_ROOT, root_addr); - - pxe_memcpy(rootpath, servername, i); - pxe_memcpy(&rootpath[i], &rootpath[0], - strlen(&rootpath[i]) + 1); - } + if (i && i != FNAME_SIZE && rootpath[i] == ':') { + rootpath[i++] = '\0'; + const PXE_IPADDR *root_addr = pxe_gethostbyname(rootpath); + pxe_set_ip(PXE_IP_ROOT, root_addr); + + pxe_memcpy(rootpath, servername, i); + pxe_memcpy(&rootpath[i], &rootpath[0], + strlen(&rootpath[i]) + 1); + } - tmp_in.s_addr = pxe_get_ip(PXE_IP_ROOT)->ip; + tmp_in.s_addr = pxe_get_ip(PXE_IP_ROOT)->ip; #ifdef PXE_DEBUG - printf("pxe_open: server addr: %s\n", inet_ntoa(tmp_in)); - printf("pxe_open: server path: %s\n", rootpath); + printf("pxe_open: server addr: %s\n", inet_ntoa(tmp_in)); + printf("pxe_open: server path: %s\n", rootpath); #endif #ifdef LOADER_NFS_SUPPORT - setenv("boot.nfsroot.server", inet_ntoa(tmp_in), 1); - setenv("boot.nfsroot.path", rootpath, 1); + setenv("boot.nfsroot.server", inet_ntoa(tmp_in), 1); + setenv("boot.nfsroot.path", rootpath, 1); #endif } @@ -368,6 +367,9 @@ pxe_core_init(pxenv_t *pxenv_p, pxe_t* p /* trying to get gateway/nameserver info from DHCP server */ pxe_dhcp_query(bootplayer->ident); pxe_core_update_bootp(); +#else + pxe_set_ip(PXE_IP_WWW, pxe_get_ip(PXE_IP_SERVER)); + pxe_set_ip(PXE_IP_ROOT, pxe_get_ip(PXE_IP_SERVER)); #endif #ifdef PXE_CORE_DEBUG From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 19:55:50 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B0C3951A; Fri, 25 Jan 2013 19:55:50 +0000 (UTC) (envelope-from seanwbruno@gmail.com) Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx1.freebsd.org (Postfix) with ESMTP id 4CB86641; Fri, 25 Jan 2013 19:55:50 +0000 (UTC) Received: by mail-pb0-f43.google.com with SMTP id jt11so399409pbb.2 for ; Fri, 25 Jan 2013 11:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:from:reply-to:to:cc:in-reply-to:references :content-type:date:message-id:mime-version:x-mailer; bh=f1xuX+595wgqBQN2mQAuK0YhUQ8n4II/FEH1mULBdGg=; b=vXWq8hXCeOsLeRs08b3a+5oYgTufu+s13FTDSYMyP8VeEFb0QiApSSa9mJ+cbhk7gz /gvT094j6YHdImySc8QP84PIjpicgIKegc/QOIT8IXmUwEuSDKLoe8p66RD8r0gCVETZ PyKud0wuEvneqX4sXr7KrmFDOdlD2b6vS9lhLlC+v+kZZhrlKtBO7QirAmMNxvpWx2SM lABrimYIndqn6hJXBsgUpQEmijonIB81Pa+YuTeC4Yr5XEqb7COsNVqezWLCJPHSJeGH Eez7t89PzT8AslA4SYZv/LMGxF34Hgdu9BfKNv1veDK/W/NeNs6dxEW9nqNEgiQi26Z1 vxeQ== X-Received: by 10.68.216.201 with SMTP id os9mr16977675pbc.36.1359143744581; Fri, 25 Jan 2013 11:55:44 -0800 (PST) Received: from [10.73.203.110] (nat-dip3.cfw-a-gci.corp.yahoo.com. [209.131.62.145]) by mx.google.com with ESMTPS id ou3sm1189426pbb.46.2013.01.25.11.55.42 (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 25 Jan 2013 11:55:43 -0800 (PST) Subject: Re: svn commit: r245902 - user/sbruno/head_146698 From: Sean Bruno To: John Baldwin In-Reply-To: <201301251159.14515.jhb@freebsd.org> References: <201301251137.r0PBbuiN051834@svn.freebsd.org> <201301250832.43222.jhb@freebsd.org> <1359129079.5527.7.camel@powernoodle.corp.yahoo.com> <201301251159.14515.jhb@freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-xHAVI2w/Vk2mD1dTkeD1" Date: Fri, 25 Jan 2013 11:55:41 -0800 Message-ID: <1359143741.19091.4.camel@powernoodle.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Sean Bruno List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 19:55:50 -0000 --=-xHAVI2w/Vk2mD1dTkeD1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2013-01-25 at 11:59 -0500, John Baldwin wrote: > On Friday, January 25, 2013 10:51:19 am Sean Bruno wrote: > > On Fri, 2013-01-25 at 08:32 -0500, John Baldwin wrote: > > > On Friday, January 25, 2013 6:37:56 am Sean Bruno wrote: > > > > Author: sbruno > > > > Date: Fri Jan 25 11:37:56 2013 > > > > New Revision: 245902 > > > > URL: http://svnweb.freebsd.org/changeset/base/245902 > > > >=20 > > > > Log: > > > > Branch head from the past at svn r146698 which is the approximate= 6Current > > > > timeframe where pxe_http was developed during GSOC 2007. > > > > =20 > > > > This is based on the cvs tags from the project tar ball at: > > > > http://code.google.com/p/google-summer-of-code-2007- > > > freebsd/downloads/detail?name=3DAlexey_Tarasov.tar.gz&can=3D2&q=3D > > > > =20 > > > > and perforce commit history: > > > > =20 > > > http://p4web.freebsd.org/@md=3Dd&cd=3D//depot/projects/soc2007/&c=3DS= xU@//depot/projects/soc2007/taleks- > > > pxe_http/?ac=3D83 > > > >=20 > > > > Added: > > > > user/sbruno/head_146698/ > > > > - copied from r146698, head/ > > >=20 > > > Have you considered just doing a 'p4 integ' on the GSOC branch in p4?= Or=20 > > > rather, making a copy of that branch in p4 and then doing an integ fr= om HEAD=20 > > > into that? That might be simpler than trying to recreate everything= in svn. =20 > > > Once you have an up-to-date diff you can then move that to an svn bra= nch. > > >=20 > >=20 > > Yes. =20 > >=20 > > Step 1. Validate that anything in this code base works. > >=20 > > If Step 1, then attempt to integrate 7 years of history and move this > > code forward. >=20 > Hmm, could you do that with a checkout of the p4 branch then? >=20 No, the project code didn't branch a full bsd tree, nor a tree of sys/boot. Individual files that were modified in sys/boot and lib/libstand were put into subdirs and modified at branch time so I'm not convinced that the files correspond to the $FreeBSD tags either. I suspect that I'm approaching a functional state and will be slowly creeping this tree forward over the next few weeks and then generate a review request. Sean --=-xHAVI2w/Vk2mD1dTkeD1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAABAgAGBQJRAuM9AAoJEBkJRdwI6BaH7mAIAItp1HDnDulTxjH0Z3s5KoJv M6e1d1tt+nmfH//d000sNnR/tLg1sGV+0cJIq0okXLh8DtalZcerR24AMlgcSaEq TMabnTIoooOyeWreO4kl4DjVQ2cCGdgLnD5QAemMjms6uoFLnZhYv2l/AbiyFJvS q1q7oPvHn+fXDspMh36Rp5pvIs9c4w/F9QmUp8YCkqB0vZWKmytFe/q/Rt7b+TOw n+3AoiE3N8NT+qiCKzNW32uQnzKq+zElaJ3fI76HxrEseywQPKvNhZtH0ilIKgQy s91FlHMFux9eoIejAHZBOjUt8/s8N8baovPdQ1MztTWj3mrXOCc6m0ETSCPblbg= =5tcY -----END PGP SIGNATURE----- --=-xHAVI2w/Vk2mD1dTkeD1--