Date: Sun, 26 Jul 2009 20:36:57 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 166599 for review Message-ID: <200907262036.n6QKavjL042319@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166599 Change 166599 by mav@mav_mavbook on 2009/07/26 20:36:54 IFC Affected files ... .. //depot/projects/scottl-camlock/src/lib/libarchive/archive_read_support_format_iso9660.c#4 integrate .. //depot/projects/scottl-camlock/src/lib/libc/sys/mmap.2#4 integrate .. //depot/projects/scottl-camlock/src/lib/libjail/jail.c#3 integrate .. //depot/projects/scottl-camlock/src/lib/libjail/jail.h#2 integrate .. //depot/projects/scottl-camlock/src/sbin/ifconfig/ifconfig.c#4 integrate .. //depot/projects/scottl-camlock/src/share/man/man4/Makefile#10 integrate .. //depot/projects/scottl-camlock/src/share/man/man4/ahci.4#4 integrate .. //depot/projects/scottl-camlock/src/share/man/man4/altq.4#4 integrate .. //depot/projects/scottl-camlock/src/share/man/man4/epair.4#2 integrate .. //depot/projects/scottl-camlock/src/share/man/man9/netisr.9#2 integrate .. //depot/projects/scottl-camlock/src/sys/boot/forth/loader.conf#20 integrate .. //depot/projects/scottl-camlock/src/sys/compat/linux/linux_mib.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/conf/NOTES#33 integrate .. //depot/projects/scottl-camlock/src/sys/conf/files#42 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ata/ata-all.c#18 integrate .. //depot/projects/scottl-camlock/src/sys/kern/kern_jail.c#20 integrate .. //depot/projects/scottl-camlock/src/sys/kern/kern_vimage.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/modules/Makefile#33 integrate .. //depot/projects/scottl-camlock/src/sys/modules/if_epair/Makefile#1 branch .. //depot/projects/scottl-camlock/src/sys/net/if.c#32 integrate .. //depot/projects/scottl-camlock/src/sys/net/if_epair.c#2 integrate .. //depot/projects/scottl-camlock/src/sys/net/netisr.h#9 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctputil.c#14 integrate .. //depot/projects/scottl-camlock/src/sys/sys/jail.h#12 integrate .. //depot/projects/scottl-camlock/src/sys/sys/vimage.h#9 integrate .. //depot/projects/scottl-camlock/src/tools/regression/poll/Makefile#2 integrate .. //depot/projects/scottl-camlock/src/usr.sbin/jail/jail.8#7 integrate .. //depot/projects/scottl-camlock/src/usr.sbin/jls/jls.c#7 integrate Differences ... ==== //depot/projects/scottl-camlock/src/lib/libarchive/archive_read_support_format_iso9660.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_iso9660.c,v 1.35 2009/04/26 18:43:49 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_iso9660.c,v 1.37 2009/07/26 18:11:44 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -579,6 +579,7 @@ && file->size > 0) { archive_entry_set_hardlink(entry, iso9660->previous_pathname.s); + archive_entry_unset_size(entry); iso9660->entry_bytes_remaining = 0; iso9660->entry_sparse_offset = 0; release_file(iso9660, file); @@ -1174,12 +1175,12 @@ parse_rockridge_SL1(struct file_info *file, const unsigned char *data, int data_length) { - int component_continues = 1; + const char *separator = ""; - if (!file->symlink_continues) + if (!file->symlink_continues || file->symlink.length < 1) archive_string_empty(&file->symlink); - else - archive_strcat(&file->symlink, "/"); + else if (file->symlink.s[file->symlink.length - 1] != '/') + separator = "/"; file->symlink_continues = 0; /* @@ -1216,9 +1217,8 @@ unsigned char nlen = *data++; data_length -= 2; - if (!component_continues) - archive_strcat(&file->symlink, "/"); - component_continues = 0; + archive_strcat(&file->symlink, separator); + separator = "/"; switch(flag) { case 0: /* Usual case, this is text. */ @@ -1232,7 +1232,7 @@ return; archive_strncat(&file->symlink, (const char *)data, nlen); - component_continues = 1; + separator = ""; break; case 0x02: /* Current dir. */ archive_strcat(&file->symlink, "."); @@ -1243,6 +1243,7 @@ case 0x08: /* Root of filesystem. */ archive_string_empty(&file->symlink); archive_strcat(&file->symlink, "/"); + separator = ""; break; case 0x10: /* Undefined (historically "volume root" */ archive_string_empty(&file->symlink); ==== //depot/projects/scottl-camlock/src/lib/libc/sys/mmap.2#4 (text+ko) ==== @@ -26,9 +26,9 @@ .\" SUCH DAMAGE. .\" .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 -.\" $FreeBSD: src/lib/libc/sys/mmap.2,v 1.58 2009/07/14 19:45:36 jhb Exp $ +.\" $FreeBSD: src/lib/libc/sys/mmap.2,v 1.59 2009/07/26 06:38:56 alc Exp $ .\" -.Dd July 14, 2009 +.Dd July 26, 2009 .Dt MMAP 2 .Os .Sh NAME @@ -353,10 +353,3 @@ The previous documented limit of 2GB was a documentation bug. That limit has not existed since .Fx 2.2 . -.Pp -Note that an attempt to -.Fn mmap -zero bytes has no effect and succeeds, while an attempt to -.Fn munmap -zero bytes will return -.Bq Er EINVAL . ==== //depot/projects/scottl-camlock/src/lib/libjail/jail.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libjail/jail.c,v 1.2 2009/06/25 22:42:19 jamie Exp $"); +__FBSDID("$FreeBSD: src/lib/libjail/jail.c,v 1.3 2009/07/25 14:48:57 jamie Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -54,6 +54,8 @@ #define ARRAY_SLOP 5 +static int jailparam_import_enum(const char **values, int nvalues, + const char *valstr, size_t valsize, int *value); static int jailparam_vlist(struct jailparam **jpp, va_list ap); static int jailparam_type(struct jailparam *jp); static char *noname(const char *name); @@ -61,6 +63,9 @@ char jail_errmsg[JAIL_ERRMSGLEN]; +static const char *bool_values[] = { "false", "true" }; +static const char *jailsys_values[] = { "disable", "new", "inherit" }; + /* * Import a null-terminated parameter list and set a jail with the flags @@ -140,7 +145,6 @@ jailparam_all(struct jailparam **jpp) { struct jailparam *jp; - char *nname; size_t mlen1, mlen2, buflen; int njp, nlist; int mib1[CTL_MAXNAME], mib2[CTL_MAXNAME - 2]; @@ -182,6 +186,8 @@ "sysctl(0.1): %s", strerror(errno)); goto error; } + if (buf[buflen - 2] == '.') + buf[buflen - 2] = '\0'; /* Add the parameter to the list */ if (njp >= nlist) { nlist *= 2; @@ -197,17 +203,6 @@ njp++; goto error; } - /* Convert nobool parameters to bool. */ - if (jp[njp].jp_flags & JP_NOBOOL) { - nname = nononame(jp[njp].jp_name); - if (nname == NULL) { - njp++; - goto error; - } - free(jp[njp].jp_name); - jp[njp].jp_name = nname; - jp[njp].jp_flags ^= JP_BOOL | JP_NOBOOL; - } mib1[1] = 2; } jp = realloc(jp, njp * sizeof(*jp)); @@ -285,14 +280,31 @@ switch (jp->jp_ctltype & CTLTYPE) { case CTLTYPE_INT: if (jp->jp_flags & (JP_BOOL | JP_NOBOOL)) { - if (!strncasecmp(avalue, "true", 4)) - ((int *)jp->jp_value)[i] = 1; - else if (!strncasecmp(avalue, "false", 5)) - ((int *)jp->jp_value)[i] = 0; - else { + if (!jailparam_import_enum(bool_values, 2, + avalue, fw, &((int *)jp->jp_value)[i])) { + snprintf(jail_errmsg, + JAIL_ERRMSGLEN, "%s: " + "unknown boolean value \"%.*s\"", + jp->jp_name, fw, avalue); + errno = EINVAL; + goto error; + } + break; + } + if (jp->jp_flags & JP_JAILSYS) { + /* + * Allow setting a jailsys parameter to "new" + * in a booleanesque fashion. + */ + if (value[0] == '\0') + ((int *)jp->jp_value)[i] = JAIL_SYS_NEW; + else if (!jailparam_import_enum(jailsys_values, + sizeof(jailsys_values) / + sizeof(jailsys_values[0]), avalue, fw, + &((int *)jp->jp_value)[i])) { snprintf(jail_errmsg, - JAIL_ERRMSGLEN, - "%s: unknown boolean value \"%.*s\"", + JAIL_ERRMSGLEN, "%s: " + "unknown jailsys value \"%.*s\"", jp->jp_name, fw, avalue); errno = EINVAL; goto error; @@ -373,6 +385,23 @@ return (-1); } +static int +jailparam_import_enum(const char **values, int nvalues, const char *valstr, + size_t valsize, int *value) +{ + char *ep; + int i; + + for (i = 0; i < nvalues; i++) + if (valsize == strlen(values[i]) && + !strncasecmp(valstr, values[i], valsize)) { + *value = i; + return 1; + } + *value = strtol(valstr, &ep, 10); + return (ep == valstr + valsize); +} + /* * Put a name and value into a jail parameter element, copying the value * but not altering it. @@ -428,6 +457,15 @@ } } else { + /* + * Try to fill in missing values with an empty string. + */ + if (jp[j].jp_value == NULL && jp[j].jp_valuelen > 0 && + jailparam_import(jp + j, "") < 0) { + njp = j; + jid = -1; + goto done; + } jiov[i].iov_base = jp[j].jp_value; jiov[i].iov_len = (jp[j].jp_ctltype & CTLTYPE) == CTLTYPE_STRING @@ -632,7 +670,7 @@ { char *value, *tvalue, **values; size_t valuelen; - int i, nval; + int i, nval, ival; char valbuf[INET6_ADDRSTRLEN]; if (!jp->jp_ctltype && jailparam_type(jp) < 0) @@ -655,14 +693,21 @@ for (i = 0; i < nval; i++) { switch (jp->jp_ctltype & CTLTYPE) { case CTLTYPE_INT: - if (jp->jp_flags & (JP_BOOL | JP_NOBOOL)) { - strlcpy(valbuf, - ((int *)jp->jp_value)[i] ? "true" : "false", + ival = ((int *)jp->jp_value)[i]; + if ((jp->jp_flags & (JP_BOOL | JP_NOBOOL)) && + (unsigned)ival < 2) { + strlcpy(valbuf, bool_values[ival], + sizeof(valbuf)); + break; + } + if ((jp->jp_flags & JP_JAILSYS) && + (unsigned)ival < sizeof(jailsys_values) / + sizeof(jailsys_values[0])) { + strlcpy(valbuf, jailsys_values[ival], sizeof(valbuf)); break; } - snprintf(valbuf, sizeof(valbuf), "%d", - ((int *)jp->jp_value)[i]); + snprintf(valbuf, sizeof(valbuf), "%d", ival); break; case CTLTYPE_UINT: snprintf(valbuf, sizeof(valbuf), "%u", @@ -688,7 +733,7 @@ valbuf, sizeof(valbuf)) == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - + return (NULL); } break; @@ -698,7 +743,7 @@ valbuf, sizeof(valbuf)) == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - + return (NULL); } break; @@ -846,11 +891,13 @@ } } } + unknown_parameter: snprintf(jail_errmsg, JAIL_ERRMSGLEN, "unknown parameter: %s", jp->jp_name); errno = ENOENT; return (-1); } + mib_desc: mib[1] = 4; desclen = sizeof(desc); if (sysctl(mib, (miblen / sizeof(int)) + 2, &desc, &desclen, @@ -873,8 +920,9 @@ switch (desc.i & CTLTYPE) { case CTLTYPE_INT: if (desc.s[0] == 'B') - jp->jp_flags |= - (desc.s[1] == 'N') ? JP_NOBOOL : JP_BOOL; + jp->jp_flags |= JP_BOOL; + else if (!strcmp(desc.s, "E,jailsys")) + jp->jp_flags |= JP_JAILSYS; case CTLTYPE_UINT: jp->jp_valuelen = sizeof(int); break; @@ -916,41 +964,21 @@ } break; case CTLTYPE_NODE: - /* - * A node isn't normally a parameter, but may be a boolean - * if its "no" counterpart exists. - */ - nname = noname(jp->jp_name); - if (nname == NULL) - return (-1); - mib[1] = 3; - snprintf(desc.s, sizeof(desc.s), SJPARAM ".%s", nname); - free(nname); - miblen = sizeof(mib) - 2 * sizeof(int); - if (sysctl(mib, 2, mib + 2, &miblen, desc.s, - strlen(desc.s)) < 0) { - snprintf(jail_errmsg, JAIL_ERRMSGLEN, - "unknown parameter: %s", jp->jp_name); - return (-1); - } - mib[1] = 4; - desclen = sizeof(desc); - if (sysctl(mib, (miblen / sizeof(int)) + 2, &desc, &desclen, + /* A node might be described by an empty-named child. */ + mib[1] = 1; + mib[(miblen / sizeof(int)) + 2] = + mib[(miblen / sizeof(int)) + 1] - 1; + miblen += sizeof(int); + desclen = sizeof(desc.s); + if (sysctl(mib, (miblen / sizeof(int)) + 2, desc.s, &desclen, NULL, 0) < 0) { snprintf(jail_errmsg, JAIL_ERRMSGLEN, - "sysctl(0.4.%s): %s", desc.s, strerror(errno)); + "sysctl(0.1): %s", strerror(errno)); return (-1); } - if ((desc.i & CTLTYPE) != CTLTYPE_INT || desc.s[0] != 'B') { - snprintf(jail_errmsg, JAIL_ERRMSGLEN, - "unknown parameter: %s", jp->jp_name); - errno = ENOENT; - return (-1); - } - jp->jp_valuelen = sizeof(int); - jp->jp_ctltype = desc.i; - jp->jp_flags |= JP_BOOL; - break; + if (desc.s[desclen - 2] != '.') + goto unknown_parameter; + goto mib_desc; default: snprintf(jail_errmsg, JAIL_ERRMSGLEN, "unknown type for %s", jp->jp_name); ==== //depot/projects/scottl-camlock/src/lib/libjail/jail.h#2 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libjail/jail.h,v 1.1 2009/06/24 18:18:35 jamie Exp $ + * $FreeBSD: src/lib/libjail/jail.h,v 1.2 2009/07/25 14:48:57 jamie Exp $ */ #ifndef _JAIL_H @@ -32,6 +32,7 @@ #define JP_RAWVALUE 0x01 #define JP_BOOL 0x02 #define JP_NOBOOL 0x04 +#define JP_JAILSYS 0x08 #define JAIL_ERRMSGLEN 1024 ==== //depot/projects/scottl-camlock/src/sbin/ifconfig/ifconfig.c#4 (text+ko) ==== @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #endif static const char rcsid[] = - "$FreeBSD: src/sbin/ifconfig/ifconfig.c,v 1.145 2009/06/24 18:21:37 jamie Exp $"; + "$FreeBSD: src/sbin/ifconfig/ifconfig.c,v 1.146 2009/07/26 11:25:57 bz Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -252,6 +252,19 @@ ifconfig(argc, argv, 1, NULL); exit(0); } + /* + * NOTE: We have to special-case the `-vnet' command + * right here as we would otherwise fail when trying + * to find the interface as it lives in another vnet. + */ + if (argc > 0 && (strcmp(argv[0], "-vnet") == 0)) { + iflen = strlcpy(name, ifname, sizeof(name)); + if (iflen >= sizeof(name)) + errx(1, "%s: interface name too long", + ifname); + ifconfig(argc, argv, 0, NULL); + exit(0); + } errx(1, "interface %s does not exist", ifname); } } @@ -636,10 +649,10 @@ struct ifreq my_ifr; memcpy(&my_ifr, &ifr, sizeof(my_ifr)); - ifr.ifr_jid = jail_getid(jname); - if (ifr.ifr_jid < 0) + my_ifr.ifr_jid = jail_getid(jname); + if (my_ifr.ifr_jid < 0) errx(1, "%s", jail_errmsg); - if (ioctl(s, SIOCSIFVNET, &ifr) < 0) + if (ioctl(s, SIOCSIFVNET, &my_ifr) < 0) err(1, "SIOCSIFVNET"); } @@ -650,11 +663,11 @@ struct ifreq my_ifr; memcpy(&my_ifr, &ifr, sizeof(my_ifr)); - ifr.ifr_jid = jail_getid(jname); - if (ifr.ifr_jid < 0) + my_ifr.ifr_jid = jail_getid(jname); + if (my_ifr.ifr_jid < 0) errx(1, "%s", jail_errmsg); - if (ioctl(s, SIOCSIFRVNET, &ifr) < 0) - err(1, "SIOCSIFRVNET"); + if (ioctl(s, SIOCSIFRVNET, &my_ifr) < 0) + err(1, "SIOCSIFRVNET(%d, %s)", my_ifr.ifr_jid, my_ifr.ifr_name); } static void ==== //depot/projects/scottl-camlock/src/share/man/man4/Makefile#10 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 -# $FreeBSD: src/share/man/man4/Makefile,v 1.459 2009/07/21 12:32:46 mav Exp $ +# $FreeBSD: src/share/man/man4/Makefile,v 1.460 2009/07/26 12:20:07 bz Exp $ MAN= aac.4 \ acpi.4 \ @@ -94,6 +94,7 @@ em.4 \ en.4 \ enc.4 \ + epair.4 \ esp.4 \ et.4 \ exca.4 \ @@ -490,6 +491,7 @@ MLINKS+=em.4 if_em.4 MLINKS+=en.4 if_en.4 MLINKS+=enc.4 if_enc.4 +MLINKS+=epair.4 if_epair.4 MLINKS+=et.4 if_et.4 MLINKS+=faith.4 if_faith.4 MLINKS+=fatm.4 if_fatm.4 ==== //depot/projects/scottl-camlock/src/share/man/man4/ahci.4#4 (text+ko) ==== @@ -23,7 +23,7 @@ .\" (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$ +.\" $FreeBSD: src/share/man/man4/ahci.4,v 1.2 2009/07/25 18:19:31 mav Exp $ .\" .Dd June 26, 2009 .Dt AHCI 4 @@ -87,7 +87,7 @@ .Tn SATA ports of AHCI-compatible controllers. Each SATA port found is represented to CAM as a separate bus with one -target, or, if HBA supports Port Multipliers, 15 targets. +target, or, if HBA supports Port Multipliers, 16 targets. Most of the bus-management details are handled by the SATA-specific transport of CAM. Connected ATA disks are handled by the ATA protocol disk peripheral driver ==== //depot/projects/scottl-camlock/src/share/man/man4/altq.4#4 (text+ko) ==== @@ -23,9 +23,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/altq.4,v 1.41 2009/06/15 18:24:04 marius Exp $ +.\" $FreeBSD: src/share/man/man4/altq.4,v 1.42 2009/07/26 12:20:07 bz Exp $ .\" -.Dd June 14, 2009 +.Dd July 26, 2009 .Dt ALTQ 4 .Os .Sh NAME @@ -131,6 +131,7 @@ .Xr ed 4 , .Xr em 4 , .Xr ep 4 , +.Xr epair 4 , .Xr fxp 4 , .Xr gem 4 , .Xr hme 4 , ==== //depot/projects/scottl-camlock/src/share/man/man4/epair.4#2 (text+ko) ==== @@ -26,14 +26,14 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/epair.4,v 1.1 2009/06/24 22:21:30 bz Exp $ +.\" $FreeBSD: src/share/man/man4/epair.4,v 1.2 2009/07/26 12:20:07 bz Exp $ .\" -.Dd December 15, 2008 +.Dd July 26, 2009 .Dt EPAIR 4 .Os .Sh NAME .Nm epair -.Nd Virtual cross-over Ethernet-like interface pair. +.Nd A pair of virtual back-to-back connected Ethernet interfaces. .Sh SYNOPSIS To compile this driver into the kernel, place the following line in your @@ -52,7 +52,7 @@ The .Nm is a pair of Ethernet-like software interfaces, -which are directly connected by a virtual cross-over cable. +which are connected back-to-back with a virtual cross-over cable. .Pp Each .Nm ==== //depot/projects/scottl-camlock/src/share/man/man9/netisr.9#2 (text+ko) ==== @@ -25,9 +25,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH .\" DAMAGE. .\" -.\" $FreeBSD: src/share/man/man9/netisr.9,v 1.3 2009/06/14 17:15:18 bz Exp $ +.\" $FreeBSD: src/share/man/man9/netisr.9,v 1.4 2009/07/26 12:20:07 bz Exp $ .\" -.Dd June 14, 2009 +.Dd July 26, 2009 .Dt NETISR 9 .Os .Sh NAME @@ -208,6 +208,8 @@ IPv6 .It Dv NETISR_NATM ATM +.It Dv NETISR_EPAIR +.Xr epair 4 .El .Sh AUTHORS This manual page and the ==== //depot/projects/scottl-camlock/src/sys/boot/forth/loader.conf#20 (text+ko) ==== @@ -6,7 +6,7 @@ # # All arguments must be in double quotes. # -# $FreeBSD: src/sys/boot/forth/loader.conf,v 1.142 2009/06/15 18:22:41 marius Exp $ +# $FreeBSD: src/sys/boot/forth/loader.conf,v 1.143 2009/07/26 12:20:07 bz Exp $ ############################################################## ### Basic configuration options ############################ @@ -190,6 +190,7 @@ if_disc_load="NO" # Discard device if_ef_load="NO" # pseudo-device providing support for multiple # ethernet frame types +if_epair_load="NO" # Virtual b-t-b Ethernet-like interface pair if_faith_load="NO" # IPv6-to-IPv4 TCP relay capturing interface if_gif_load="NO" # generic tunnel interface if_gre_load="NO" # encapsulating network device ==== //depot/projects/scottl-camlock/src/sys/compat/linux/linux_mib.c#9 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.36 2009/05/27 14:11:23 jamie Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.37 2009/07/25 14:48:57 jamie Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -237,12 +237,14 @@ { struct prison *pr = obj; struct vfsoptlist *opts = data; + int jsys; - if (vfs_flagopt(opts, "nolinux", NULL, 0)) + if (vfs_copyopt(opts, "linux", &jsys, sizeof(jsys)) == 0 && + jsys == JAIL_SYS_INHERIT) return (0); /* * Inherit a prison's initial values from its parent - * (different from NULL which also inherits changes). + * (different from JAIL_SYS_INHERIT which also inherits changes). */ return linux_alloc_prison(pr, NULL); } @@ -252,11 +254,16 @@ { struct vfsoptlist *opts = data; char *osname, *osrelease; - int error, len, osrel, oss_version; + int error, jsys, len, osrel, oss_version; /* Check that the parameters are correct. */ - (void)vfs_flagopt(opts, "linux", NULL, 0); - (void)vfs_flagopt(opts, "nolinux", NULL, 0); + error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys)); + if (error != ENOENT) { + if (error != 0) + return (error); + if (jsys != JAIL_SYS_NEW && jsys != JAIL_SYS_INHERIT) + return (EINVAL); + } error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len); if (error != ENOENT) { if (error != 0) @@ -296,33 +303,40 @@ struct prison *pr = obj; struct vfsoptlist *opts = data; char *osname, *osrelease; - int error, gotversion, len, nolinux, oss_version, yeslinux; + int error, gotversion, jsys, len, oss_version; /* Set the parameters, which should be correct. */ - yeslinux = vfs_flagopt(opts, "linux", NULL, 0); - nolinux = vfs_flagopt(opts, "nolinux", NULL, 0); + error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys)); + if (error == ENOENT) + jsys = -1; error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len); if (error == ENOENT) osname = NULL; else - yeslinux = 1; + jsys = JAIL_SYS_NEW; error = vfs_getopt(opts, "linux.osrelease", (void **)&osrelease, &len); if (error == ENOENT) osrelease = NULL; else - yeslinux = 1; + jsys = JAIL_SYS_NEW; error = vfs_copyopt(opts, "linux.oss_version", &oss_version, sizeof(oss_version)); - gotversion = (error == 0); - yeslinux |= gotversion; - if (nolinux) { - /* "nolinux": inherit the parent's Linux info. */ + if (error == ENOENT) + gotversion = 0; + else { + gotversion = 1; + jsys = JAIL_SYS_NEW; + } + switch (jsys) { + case JAIL_SYS_INHERIT: + /* "linux=inherit": inherit the parent's Linux info. */ mtx_lock(&pr->pr_mtx); osd_jail_del(pr, linux_osd_jail_slot); mtx_unlock(&pr->pr_mtx); - } else if (yeslinux) { + break; + case JAIL_SYS_NEW: /* - * "linux" or "linux.*": + * "linux=new" or "linux.*": * the prison gets its own Linux info. */ error = linux_alloc_prison(pr, &lpr); @@ -348,9 +362,7 @@ return (0); } -SYSCTL_JAIL_PARAM_NODE(linux, "Jail Linux parameters"); -SYSCTL_JAIL_PARAM(, nolinux, CTLTYPE_INT | CTLFLAG_RW, - "BN", "Jail w/ no Linux parameters"); +SYSCTL_JAIL_PARAM_SYS_NODE(linux, CTLFLAG_RW, "Jail Linux parameters"); SYSCTL_JAIL_PARAM_STRING(_linux, osname, CTLFLAG_RW, LINUX_MAX_UTSNAME, "Jail Linux kernel OS name"); SYSCTL_JAIL_PARAM_STRING(_linux, osrelease, CTLFLAG_RW, LINUX_MAX_UTSNAME, @@ -371,15 +383,22 @@ /* See if this prison is the one with the Linux info. */ lpr = linux_find_prison(pr, &ppr); - i = (ppr == pr); + i = (ppr == pr) ? JAIL_SYS_NEW : JAIL_SYS_INHERIT; error = vfs_setopt(opts, "linux", &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done; - i = !i; - error = vfs_setopt(opts, "nolinux", &i, sizeof(i)); - if (error != 0 && error != ENOENT) - goto done; if (i) { + error = vfs_setopts(opts, "linux.osname", lpr->pr_osname); + if (error != 0 && error != ENOENT) + goto done; + error = vfs_setopts(opts, "linux.osrelease", lpr->pr_osrelease); + if (error != 0 && error != ENOENT) + goto done; + error = vfs_setopt(opts, "linux.oss_version", + &lpr->pr_oss_version, sizeof(lpr->pr_oss_version)); + if (error != 0 && error != ENOENT) + goto done; + } else { /* * If this prison is inheriting its Linux info, report * empty/zero parameters. @@ -394,17 +413,6 @@ sizeof(lpr->pr_oss_version)); if (error != 0 && error != ENOENT) goto done; - } else { - error = vfs_setopts(opts, "linux.osname", lpr->pr_osname); - if (error != 0 && error != ENOENT) - goto done; - error = vfs_setopts(opts, "linux.osrelease", lpr->pr_osrelease); - if (error != 0 && error != ENOENT) - goto done; - error = vfs_setopt(opts, "linux.oss_version", - &lpr->pr_oss_version, sizeof(lpr->pr_oss_version)); - if (error != 0 && error != ENOENT) - goto done; } error = 0; ==== //depot/projects/scottl-camlock/src/sys/conf/NOTES#33 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1550 2009/07/11 15:02:45 rpaulo Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1553 2009/07/26 12:20:07 bz Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -784,6 +784,10 @@ # included for testing and benchmarking purposes. device disc +# The `epair' device implements a virtual back-to-back connected Ethernet +# like interface pair. +device epair + # The `edsc' device implements a minimal Ethernet interface, # which discards all packets sent and receives none. device edsc @@ -1638,6 +1642,18 @@ device twe # 3ware ATA RAID # +# Serial ATA host controllers: +# +# ahci: Advanced Host Controller Interface (AHCI) compatible +# siis: SiliconImage SiI3124/SiI3132/SiI3531 controllers +# +# These drivers are part of cam(4) subsystem. They supersede less featured +# ata(4) subsystem drivers, supporting same hardware. + +device ahci +device siis + +# # The 'ATA' driver supports all ATA and ATAPI devices, including PC Card # devices. You only need one "device ata" for it to find all # PCI and PC Card ATA/ATAPI devices on modern machines. ==== //depot/projects/scottl-camlock/src/sys/conf/files#42 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1456 2009/07/24 13:50:29 jhb Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1457 2009/07/26 12:20:07 bz Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -2203,6 +2203,7 @@ net/if_edsc.c optional edsc net/if_ef.c optional ef net/if_enc.c optional enc ipsec inet | enc ipsec inet6 +net/if_epair.c optional epair net/if_ethersubr.c optional ether \ compile-with "${NORMAL_C} -I$S/contrib/pf" net/if_faith.c optional faith ==== //depot/projects/scottl-camlock/src/sys/dev/ata/ata-all.c#18 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.306 2009/07/16 19:48:39 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.307 2009/07/26 14:04:48 mav Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -711,7 +711,7 @@ struct ata_channel *ch = device_get_softc(dev); struct ata_device *atadev; device_t *children; - device_t child; + device_t child, master = NULL; int nchildren, i, n = ch->devices; if (bootverbose) @@ -748,6 +748,15 @@ unit = (device_get_unit(dev) << 1) + i; #endif if ((child = ata_add_child(dev, atadev, unit))) { + /* + * PATA slave should be identified first, to allow + * device cable detection on master to work properly. + */ + if (i == 0 && (n & ATA_PORTMULTIPLIER) == 0 && + (n & ((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << 1)) != 0) { + master = child; + continue; + } if (ata_getparam(atadev, 1)) { device_delete_child(dev, child); free(atadev, M_ATA); @@ -757,6 +766,13 @@ free(atadev, M_ATA); } } + if (master) { + atadev = device_get_softc(master); + if (ata_getparam(atadev, 1)) { + device_delete_child(dev, master); + free(atadev, M_ATA); + } + } bus_generic_probe(dev); bus_generic_attach(dev); mtx_unlock(&Giant); ==== //depot/projects/scottl-camlock/src/sys/kern/kern_jail.c#20 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_jail.c,v 1.112 2009/07/17 14:48:21 jamie Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_jail.c,v 1.113 2009/07/25 14:48:57 jamie Exp $"); #include "opt_compat.h" #include "opt_ddb.h" @@ -120,29 +120,26 @@ */ static char *pr_flag_names[] = { [0] = "persist", - "host", -#ifdef INET - "ip4", -#endif -#ifdef INET6 - [3] = "ip6", -#endif -#ifdef VIMAGE - [4] = "vnet", -#endif }; static char *pr_flag_nonames[] = { [0] = "nopersist", - "nohost", +}; + +struct jailsys_flags { + const char *name; + unsigned disable; + unsigned new; +} pr_flag_jailsys[] = { + { "host", 0, PR_HOST }, +#ifdef VIMAGE + { "vnet", 0, PR_VNET }, +#endif #ifdef INET - "noip4", + { "ip4", PR_IP4_USER | PR_IP4_DISABLE, PR_IP4_USER }, #endif #ifdef INET6 - [3] = "noip6", -#endif -#ifdef VIMAGE - [4] = "novnet", + { "ip6", PR_IP6_USER | PR_IP6_DISABLE, PR_IP6_USER }, #endif }; @@ -478,7 +475,8 @@ unsigned long hid; size_t namelen, onamelen; int created, cuflags, descend, enforce, error, errmsg_len, errmsg_pos; - int gotchildmax, gotenforce, gothid, gotslevel, fi, jid, len, level; + int gotchildmax, gotenforce, gothid, gotslevel; + int fi, jid, jsys, len, level; int childmax, slevel, vfslocked; #if defined(INET) || defined(INET6) int ii, ij; @@ -569,6 +567,34 @@ vfs_flagopt(opts, pr_flag_nonames[fi], &ch_flags, 1 << fi); } ch_flags |= pr_flags; + for (fi = 0; fi < sizeof(pr_flag_jailsys) / sizeof(pr_flag_jailsys[0]); + fi++) { + error = vfs_copyopt(opts, pr_flag_jailsys[fi].name, &jsys, + sizeof(jsys)); + if (error == ENOENT) + continue; + if (error != 0) + goto done_free; + switch (jsys) { + case JAIL_SYS_DISABLE: + if (!pr_flag_jailsys[fi].disable) { + error = EINVAL; + goto done_free; + } + pr_flags |= pr_flag_jailsys[fi].disable; + break; + case JAIL_SYS_NEW: + pr_flags |= pr_flag_jailsys[fi].new; + break; + case JAIL_SYS_INHERIT: + break; + default: + error = EINVAL; + goto done_free; + } + ch_flags |= + pr_flag_jailsys[fi].new | pr_flag_jailsys[fi].disable; + } if ((flags & (JAIL_CREATE | JAIL_UPDATE | JAIL_ATTACH)) == JAIL_CREATE && !(pr_flags & PR_PERSIST)) { error = EINVAL; @@ -684,16 +710,18 @@ #ifdef INET error = vfs_getopt(opts, "ip4.addr", &op, &ip4s); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907262036.n6QKavjL042319>