Date: Tue, 22 Dec 2009 06:31:23 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 172074 for review Message-ID: <200912220631.nBM6VNbw058026@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=172074 Change 172074 by trasz@trasz_victim on 2009/12/22 06:30:53 IFC. Affected files ... .. //depot/projects/soc2009/trasz_limits/etc/rc.subr#7 integrate .. //depot/projects/soc2009/trasz_limits/lib/libc/stdio/sprintf.c#2 integrate .. //depot/projects/soc2009/trasz_limits/lib/libc/stdio/sscanf.c#2 integrate .. //depot/projects/soc2009/trasz_limits/lib/libc/stdio/vsscanf.c#2 integrate .. //depot/projects/soc2009/trasz_limits/lib/libc/stdtime/localtime.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sbin/dumpfs/dumpfs.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sbin/mount/mntopts.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sbin/mount/mount.8#4 integrate .. //depot/projects/soc2009/trasz_limits/sbin/mount/mount.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sbin/tunefs/tunefs.8#3 integrate .. //depot/projects/soc2009/trasz_limits/sbin/tunefs/tunefs.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/ahci/ahci.c#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/ata/chipsets/ata-amd.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/auxio/auxio.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/if_ndis/if_ndis_usb.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/sound/usb/uaudio.c#10 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/ste/if_ste.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/uart/uart_bus_acpi.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/controller/ehci_pci.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/controller/ohci_pci.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/serial/uftdi.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/usbdevs#13 integrate .. //depot/projects/soc2009/trasz_limits/sys/geom/raid3/g_raid3.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/geom/raid3/g_raid3.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/sparc64/central/central.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/sparc64/fhc/fhc.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/sparc64/pci/apb.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/sparc64/pci/ofw_pcib.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/sparc64/sbus/sbus.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/sparc64/sparc64/nexus.c#2 integrate .. //depot/projects/soc2009/trasz_limits/tools/regression/acltools/02.t#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/newsyslog/newsyslog.c#2 integrate .. //depot/projects/soc2009/trasz_limits/usr.sbin/powerd/powerd.8#2 integrate .. //depot/projects/soc2009/trasz_limits/usr.sbin/service/service.8#2 integrate .. //depot/projects/soc2009/trasz_limits/usr.sbin/service/service.sh#2 integrate Differences ... ==== //depot/projects/soc2009/trasz_limits/etc/rc.subr#7 (text+ko) ==== @@ -1,5 +1,5 @@ # $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $ -# $FreeBSD: src/etc/rc.subr,v 1.94 2009/10/18 19:51:06 ed Exp $ +# $FreeBSD: src/etc/rc.subr,v 1.95 2009/12/21 22:16:07 jilles Exp $ # # Copyright (c) 1997-2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -390,7 +390,7 @@ _list=$_nlist echo -n ${_prefix:-"Waiting for PIDS: "}$_list _prefix=", " - sleep 2 + pwait $_list 2>/dev/null || sleep 2 done if [ -n "$_prefix" ]; then echo "." ==== //depot/projects/soc2009/trasz_limits/lib/libc/stdio/sprintf.c#2 (text+ko) ==== @@ -34,7 +34,7 @@ static char sccsid[] = "@(#)sprintf.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/sprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/sprintf.c,v 1.17 2009/12/21 19:59:38 delphij Exp $"); #include <stdio.h> #include <stdarg.h> @@ -46,17 +46,9 @@ { int ret; va_list ap; - FILE f; - f._file = -1; - f._flags = __SWR | __SSTR; - f._bf._base = f._p = (unsigned char *)str; - f._bf._size = f._w = INT_MAX; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); va_start(ap, fmt); - ret = __vfprintf(&f, fmt, ap); + ret = vsprintf(str, fmt, ap); va_end(ap); - *f._p = 0; return (ret); } ==== //depot/projects/soc2009/trasz_limits/lib/libc/stdio/sscanf.c#2 (text+ko) ==== @@ -34,44 +34,21 @@ static char sccsid[] = "@(#)sscanf.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.13 2008/04/17 22:17:54 jhb Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.14 2009/12/21 19:56:03 delphij Exp $"); #include <stdio.h> #include <string.h> #include <stdarg.h> #include "local.h" -static int eofread(void *, char *, int); - -/* ARGSUSED */ -static int -eofread(cookie, buf, len) - void *cookie; - char *buf; - int len; -{ - - return (0); -} - int sscanf(const char * __restrict str, char const * __restrict fmt, ...) { int ret; va_list ap; - FILE f; - f._file = -1; - f._flags = __SRD; - f._bf._base = f._p = (unsigned char *)str; - f._bf._size = f._r = strlen(str); - f._read = eofread; - f._ub._base = NULL; - f._lb._base = NULL; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); va_start(ap, fmt); - ret = __svfscanf(&f, fmt, ap); + ret = vsscanf(str, fmt, ap); va_end(ap); return (ret); } ==== //depot/projects/soc2009/trasz_limits/lib/libc/stdio/vsscanf.c#2 (text+ko) ==== @@ -34,7 +34,7 @@ static char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.14 2008/04/17 22:17:54 jhb Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.15 2009/12/21 19:55:05 delphij Exp $"); #include <stdio.h> #include <string.h> @@ -45,20 +45,15 @@ /* ARGSUSED */ static int -eofread(cookie, buf, len) - void *cookie; - char *buf; - int len; +eofread(void *cookie, char *buf, int len) { return (0); } int -vsscanf(str, fmt, ap) - const char * __restrict str; - const char * __restrict fmt; - __va_list ap; +vsscanf(const char * __restrict str, const char * __restrict fmt, + __va_list ap) { FILE f; ==== //depot/projects/soc2009/trasz_limits/lib/libc/stdtime/localtime.c#6 (text+ko) ==== @@ -9,7 +9,7 @@ static char elsieid[] __unused = "@(#)localtime.c 8.9"; #endif /* !defined NOID */ #endif /* !defined lint */ -__FBSDID("$FreeBSD: src/lib/libc/stdtime/localtime.c,v 1.47 2009/11/20 19:21:33 jhb Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdtime/localtime.c,v 1.48 2009/12/21 19:43:23 jhb Exp $"); /* ** Leap second handling from Bradley White. @@ -237,6 +237,9 @@ static int lcl_is_set; static pthread_once_t gmt_once = PTHREAD_ONCE_INIT; static pthread_rwlock_t lcl_rwlock = PTHREAD_RWLOCK_INITIALIZER; +static pthread_once_t localtime_once = PTHREAD_ONCE_INIT; +static pthread_key_t localtime_key; +static int localtime_key_error; char * tzname[2] = { wildabbr, @@ -1406,27 +1409,24 @@ return result; } +static void +localtime_key_init(void) +{ + + localtime_key_error = _pthread_key_create(&localtime_key, free); +} + struct tm * localtime(timep) const time_t * const timep; { - static pthread_mutex_t localtime_mutex = PTHREAD_MUTEX_INITIALIZER; - static pthread_key_t localtime_key = -1; struct tm *p_tm; - int r; if (__isthreaded != 0) { - if (localtime_key < 0) { - _pthread_mutex_lock(&localtime_mutex); - if (localtime_key < 0) { - if ((r = _pthread_key_create(&localtime_key, - free)) != 0) { - _pthread_mutex_unlock(&localtime_mutex); - errno = r; - return(NULL); - } - } - _pthread_mutex_unlock(&localtime_mutex); + _once(&localtime_once, localtime_key_init); + if (localtime_key_error != 0) { + errno = localtime_key_error; + return(NULL); } p_tm = _pthread_getspecific(localtime_key); if (p_tm == NULL) { ==== //depot/projects/soc2009/trasz_limits/sbin/dumpfs/dumpfs.c#3 (text+ko) ==== @@ -53,7 +53,7 @@ static char sccsid[] = "@(#)dumpfs.c 8.5 (Berkeley) 4/29/95"; #endif static const char rcsid[] = - "$FreeBSD: src/sbin/dumpfs/dumpfs.c,v 1.47 2009/10/19 14:04:19 ru Exp $"; + "$FreeBSD: src/sbin/dumpfs/dumpfs.c,v 1.48 2009/12/21 19:39:10 trasz Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -251,8 +251,11 @@ printf("gjournal "); if (fsflags & FS_FLAGS_UPDATED) printf("fs_flags expanded "); + if (fsflags & FS_NFS4ACLS) + printf("nfsv4acls "); fsflags &= ~(FS_UNCLEAN | FS_DOSOFTDEP | FS_NEEDSFSCK | FS_INDEXDIRS | - FS_ACLS | FS_MULTILABEL | FS_GJOURNAL | FS_FLAGS_UPDATED); + FS_ACLS | FS_MULTILABEL | FS_GJOURNAL | FS_FLAGS_UPDATED | + FS_NFS4ACLS); if (fsflags != 0) printf("unknown flags (%#x)", fsflags); putchar('\n'); ==== //depot/projects/soc2009/trasz_limits/sbin/mount/mntopts.h#2 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)mntopts.h 8.7 (Berkeley) 3/29/95 - * $FreeBSD: src/sbin/mount/mntopts.h,v 1.29 2005/12/02 03:55:02 rodrigc Exp $ + * $FreeBSD: src/sbin/mount/mntopts.h,v 1.30 2009/12/21 19:39:10 trasz Exp $ */ struct mntopt { @@ -54,6 +54,7 @@ #define MOPT_SNAPSHOT { "snapshot", 0, MNT_SNAPSHOT, 0 } #define MOPT_MULTILABEL { "multilabel", 0, MNT_MULTILABEL, 0 } #define MOPT_ACLS { "acls", 0, MNT_ACLS, 0 } +#define MOPT_NFS4ACLS { "nfsv4acls", 0, MNT_NFS4ACLS, 0 } /* Control flags. */ #define MOPT_FORCE { "force", 0, MNT_FORCE, 0 } @@ -87,7 +88,8 @@ MOPT_NOCLUSTERR, \ MOPT_NOCLUSTERW, \ MOPT_MULTILABEL, \ - MOPT_ACLS + MOPT_ACLS, \ + MOPT_NFS4ACLS void getmntopts(const char *, const struct mntopt *, int *, int *); void rmslashes(char *, char *); ==== //depot/projects/soc2009/trasz_limits/sbin/mount/mount.8#4 (text+ko) ==== @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 -.\" $FreeBSD: src/sbin/mount/mount.8,v 1.92 2009/11/11 12:55:58 trasz Exp $ +.\" $FreeBSD: src/sbin/mount/mount.8,v 1.93 2009/12/21 19:39:10 trasz Exp $ .\" .Dd March 11, 2008 .Dt MOUNT 8 @@ -120,11 +120,14 @@ The following options are available: .Bl -tag -width indent .It Cm acls -Enable Access Control Lists, or ACLS, which can be customized via the +Enable POSIX.1e Access Control Lists, or ACLs, which can be customized via the .Xr setfacl 1 and .Xr getfacl 1 commands. +This flag is mutually exclusive with +.Cm nfsv4acls +flag. .It Cm async All .Tn I/O @@ -186,6 +189,15 @@ .Xr mac 4 for more information, which cause the multilabel mount flag to be set automatically at mount-time. +.It Cm nfsv4acls +Enable NFSv4 ACLs, which can be customized via the +.Xr setfacl 1 +and +.Xr getfacl 1 +commands. +This flag is mutually exclusive with +.Cm acls +flag. .It Cm noasync Metadata I/O should be done synchronously, while data I/O should be done asynchronously. ==== //depot/projects/soc2009/trasz_limits/sbin/mount/mount.c#4 (text+ko) ==== @@ -37,7 +37,7 @@ #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sbin/mount/mount.c,v 1.108 2009/09/14 21:08:22 pjd Exp $"); +__FBSDID("$FreeBSD: src/sbin/mount/mount.c,v 1.109 2009/12/21 19:39:10 trasz Exp $"); #include <sys/param.h> #include <sys/mount.h> @@ -111,6 +111,7 @@ { MNT_SOFTDEP, "soft-updates" }, { MNT_MULTILABEL, "multilabel" }, { MNT_ACLS, "acls" }, + { MNT_NFS4ACLS, "nfsv4acls" }, { MNT_GJOURNAL, "gjournal" }, { 0, NULL } }; @@ -918,6 +919,7 @@ if (flags & MNT_SUIDDIR) res = catopt(res, "suiddir"); if (flags & MNT_MULTILABEL) res = catopt(res, "multilabel"); if (flags & MNT_ACLS) res = catopt(res, "acls"); + if (flags & MNT_NFS4ACLS) res = catopt(res, "nfsv4acls"); return (res); } ==== //depot/projects/soc2009/trasz_limits/sbin/tunefs/tunefs.8#3 (text+ko) ==== @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)tunefs.8 8.2 (Berkeley) 12/11/93 -.\" $FreeBSD: src/sbin/tunefs/tunefs.8,v 1.41 2009/10/21 10:15:26 remko Exp $ +.\" $FreeBSD: src/sbin/tunefs/tunefs.8,v 1.42 2009/12/21 19:39:10 trasz Exp $ .\" .Dd October 21, 2009 .Dt TUNEFS 8 @@ -44,6 +44,7 @@ .Op Fl L Ar volname .Op Fl l Cm enable | disable .Op Fl m Ar minfree +.Op Fl N Cm enable | disable .Op Fl n Cm enable | disable .Op Fl o Cm space | time .Op Fl p @@ -70,7 +71,7 @@ primary super-block. This is potentially dangerous - use with caution. .It Fl a Cm enable | disable -Turn on/off the administrative ACL enable flag. +Turn on/off the administrative POSIX.1e ACL enable flag. .It Fl e Ar maxbpg Indicate the maximum number of blocks any single file can allocate out of a cylinder group before it is forced to begin @@ -114,6 +115,8 @@ If the value is raised above the current usage level, users will be unable to allocate files until enough files have been deleted to get under the higher threshold. +.It Fl N Cm enable | disable +Turn on/off the administrative NFSv4 ACL enable flag. .It Fl n Cm enable | disable Turn on/off soft updates. .It Fl o Cm space | time ==== //depot/projects/soc2009/trasz_limits/sbin/tunefs/tunefs.c#2 (text+ko) ==== @@ -39,7 +39,7 @@ #endif /* not lint */ #endif #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sbin/tunefs/tunefs.c,v 1.43 2006/10/31 21:52:28 pjd Exp $"); +__FBSDID("$FreeBSD: src/sbin/tunefs/tunefs.c,v 1.44 2009/12/21 19:39:10 trasz Exp $"); /* * tunefs: change layout parameters to an existing file system. @@ -76,12 +76,12 @@ int main(int argc, char *argv[]) { - char *avalue, *Jvalue, *Lvalue, *lvalue, *nvalue; + char *avalue, *Jvalue, *Lvalue, *lvalue, *Nvalue, *nvalue; const char *special, *on; const char *name; int active; int Aflag, aflag, eflag, evalue, fflag, fvalue, Jflag, Lflag, lflag; - int mflag, mvalue, nflag, oflag, ovalue, pflag, sflag, svalue; + int mflag, mvalue, Nflag, nflag, oflag, ovalue, pflag, sflag, svalue; int ch, found_arg, i; const char *chg[2]; struct ufs_args args; @@ -90,12 +90,12 @@ if (argc < 3) usage(); Aflag = aflag = eflag = fflag = Jflag = Lflag = lflag = mflag = 0; - nflag = oflag = pflag = sflag = 0; - avalue = Jvalue = Lvalue = lvalue = nvalue = NULL; + Nflag = nflag = oflag = pflag = sflag = 0; + avalue = Jvalue = Lvalue = lvalue = Nvalue = nvalue = NULL; evalue = fvalue = mvalue = ovalue = svalue = 0; active = 0; found_arg = 0; /* At least one arg is required. */ - while ((ch = getopt(argc, argv, "Aa:e:f:J:L:l:m:n:o:ps:")) != -1) + while ((ch = getopt(argc, argv, "Aa:e:f:J:L:l:m:N:n:o:ps:")) != -1) switch (ch) { case 'A': @@ -105,7 +105,7 @@ case 'a': found_arg = 1; - name = "ACLs"; + name = "POSIX.1e ACLs"; avalue = optarg; if (strcmp(avalue, "enable") && strcmp(avalue, "disable")) { @@ -187,6 +187,18 @@ mflag = 1; break; + case 'N': + found_arg = 1; + name = "NFSv4 ACLs"; + Nvalue = optarg; + if (strcmp(Nvalue, "enable") && + strcmp(Nvalue, "disable")) { + errx(10, "bad %s (options are %s)", + name, "`enable' or `disable'"); + } + Nflag = 1; + break; + case 'n': found_arg = 1; name = "soft updates"; @@ -255,10 +267,13 @@ strlcpy(sblock.fs_volname, Lvalue, MAXVOLLEN); } if (aflag) { - name = "ACLs"; + name = "POSIX.1e ACLs"; if (strcmp(avalue, "enable") == 0) { if (sblock.fs_flags & FS_ACLS) { warnx("%s remains unchanged as enabled", name); + } else if (sblock.fs_flags & FS_NFS4ACLS) { + warnx("%s and NFSv4 ACLs are mutually " + "exclusive", name); } else { sblock.fs_flags |= FS_ACLS; warnx("%s set", name); @@ -349,6 +364,29 @@ warnx(OPTWARN, "space", "<", MINFREE); } } + if (Nflag) { + name = "NFSv4 ACLs"; + if (strcmp(Nvalue, "enable") == 0) { + if (sblock.fs_flags & FS_NFS4ACLS) { + warnx("%s remains unchanged as enabled", name); + } else if (sblock.fs_flags & FS_ACLS) { + warnx("%s and POSIX.1e ACLs are mutually " + "exclusive", name); + } else { + sblock.fs_flags |= FS_NFS4ACLS; + warnx("%s set", name); + } + } else if (strcmp(Nvalue, "disable") == 0) { + if ((~sblock.fs_flags & FS_NFS4ACLS) == + FS_NFS4ACLS) { + warnx("%s remains unchanged as disabled", + name); + } else { + sblock.fs_flags &= ~FS_NFS4ACLS; + warnx("%s cleared", name); + } + } + } if (nflag) { name = "soft updates"; if (strcmp(nvalue, "enable") == 0) { @@ -423,16 +461,18 @@ fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: tunefs [-A] [-a enable | disable] [-e maxbpg] [-f avgfilesize]", " [-J enable | disable ] [-L volname] [-l enable | disable]", -" [-m minfree] [-n enable | disable] [-o space | time] [-p]", -" [-s avgfpdir] special | filesystem"); +" [-m minfree] [-N enable | disable] [-n enable | disable]", +" [-o space | time] [-p] [-s avgfpdir] special | filesystem"); exit(2); } void printfs(void) { - warnx("ACLs: (-a) %s", + warnx("POSIX.1e ACLs: (-a) %s", (sblock.fs_flags & FS_ACLS)? "enabled" : "disabled"); + warnx("NFSv4 ACLs: (-N) %s", + (sblock.fs_flags & FS_NFS4ACLS)? "enabled" : "disabled"); warnx("MAC multilabel: (-l) %s", (sblock.fs_flags & FS_MULTILABEL)? "enabled" : "disabled"); warnx("soft updates: (-n) %s", ==== //depot/projects/soc2009/trasz_limits/sys/dev/ahci/ahci.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ahci/ahci.c,v 1.19 2009/12/06 23:56:54 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ahci/ahci.c,v 1.20 2009/12/21 21:27:56 mav Exp $"); #include <sys/param.h> #include <sys/module.h> @@ -596,20 +596,18 @@ unit = irq->r_irq_rid - 1; is = ATA_INL(ctlr->r_mem, AHCI_IS); } + /* Some controllers have edge triggered IS. */ + if (ctlr->quirks & AHCI_Q_EDGEIS) + ATA_OUTL(ctlr->r_mem, AHCI_IS, is); for (; unit < ctlr->channels; unit++) { if ((is & (1 << unit)) != 0 && (arg = ctlr->interrupt[unit].argument)) { - if (ctlr->quirks & AHCI_Q_EDGEIS) { - /* Some controller have edge triggered IS. */ - ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); ctlr->interrupt[unit].function(arg); - } else { - /* but AHCI declares level triggered IS. */ - ctlr->interrupt[unit].function(arg); - ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); - } } } + /* AHCI declares level triggered IS. */ + if (!(ctlr->quirks & AHCI_Q_EDGEIS)) + ATA_OUTL(ctlr->r_mem, AHCI_IS, is); } /* ==== //depot/projects/soc2009/trasz_limits/sys/dev/ata/chipsets/ata-amd.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/chipsets/ata-amd.c,v 1.4 2009/12/14 21:11:50 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/chipsets/ata-amd.c,v 1.5 2009/12/21 21:47:33 mav Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -61,7 +61,7 @@ #define AMD_CABLE 0x02 /* - * American Micro Devices (AMD) chipset support functions + * Advanced Micro Devices (AMD) chipset support functions */ static int ata_amd_probe(device_t dev) ==== //depot/projects/soc2009/trasz_limits/sys/dev/auxio/auxio.c#2 (text+ko) ==== @@ -56,12 +56,12 @@ */ /* - * AUXIO registers support on the sbus & ebus2, used for the floppy driver + * AUXIO registers support on the SBus & EBus2, used for the floppy driver * and to control the system LED, for the BLINK option. */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/auxio/auxio.c,v 1.5 2006/01/26 19:04:18 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/auxio/auxio.c,v 1.6 2009/12/21 21:29:16 marius Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -85,8 +85,8 @@ #include <dev/auxio/auxioreg.h> /* - * on sun4u, auxio exists with one register (LED) on the sbus, and 5 - * registers on the ebus2 (pci) (LED, PCIMODE, FREQUENCY, SCSI + * On sun4u, auxio exists with one register (LED) on the SBus, and 5 + * registers on the EBus2 (pci) (LED, PCIMODE, FREQUENCY, SCSI * OSCILLATOR, and TEMP SENSE. */ @@ -142,6 +142,7 @@ static devclass_t auxio_devclass; DRIVER_MODULE(auxio, sbus, auxio_sbus_driver, auxio_devclass, 0, 0); +MODULE_DEPEND(auxio, sbus, 1, 1, 1); /* EBus */ static device_method_t auxio_ebus_methods[] = { @@ -158,6 +159,7 @@ }; DRIVER_MODULE(auxio, ebus, auxio_ebus_driver, auxio_devclass, 0, 0); +MODULE_DEPEND(auxio, ebus, 1, 1, 1); MODULE_VERSION(auxio, 1); #define AUXIO_LOCK_INIT(sc) \ ==== //depot/projects/soc2009/trasz_limits/sys/dev/if_ndis/if_ndis_usb.c#7 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_usb.c,v 1.20 2009/11/02 11:07:42 rpaulo Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_usb.c,v 1.21 2009/12/22 02:04:16 thompsa Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -165,6 +165,7 @@ driver_object *drv; int devidx = 0; + device_set_usb_desc(self); db = uaa->driver_ivar; sc = (struct ndis_softc *)dummy; sc->ndis_dev = self; ==== //depot/projects/soc2009/trasz_limits/sys/dev/sound/usb/uaudio.c#10 (text+ko) ==== @@ -1,5 +1,5 @@ /* $NetBSD: uaudio.c,v 1.91 2004/11/05 17:46:14 kent Exp $ */ -/* $FreeBSD: src/sys/dev/sound/usb/uaudio.c,v 1.59 2009/11/22 21:26:27 thompsa Exp $ */ +/* $FreeBSD: src/sys/dev/sound/usb/uaudio.c,v 1.60 2009/12/22 02:11:37 thompsa Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -87,20 +87,27 @@ #include <dev/sound/chip.h> #include "feeder_if.h" -static int uaudio_default_rate = 96000; +static int uaudio_default_rate = 0; /* use rate list */ static int uaudio_default_bits = 32; -static int uaudio_default_channels = 2; +static int uaudio_default_channels = 0; /* use default */ #if USB_DEBUG static int uaudio_debug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio"); + SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RW, &uaudio_debug, 0, "uaudio debug level"); + +TUNABLE_INT("hw.usb.uaudio.default_rate", &uaudio_default_rate); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_rate, CTLFLAG_RW, &uaudio_default_rate, 0, "uaudio default sample rate"); + +TUNABLE_INT("hw.usb.uaudio.default_bits", &uaudio_default_bits); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RW, &uaudio_default_bits, 0, "uaudio default sample bits"); + +TUNABLE_INT("hw.usb.uaudio.default_channels", &uaudio_default_channels); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_channels, CTLFLAG_RW, &uaudio_default_channels, 0, "uaudio default sample channels"); #endif @@ -169,10 +176,16 @@ uint32_t intr_size; /* in bytes */ uint32_t intr_frames; /* in units */ uint32_t sample_rate; + uint32_t frames_per_second; + uint32_t sample_rem; + uint32_t sample_curr; + uint32_t format; uint32_t pcm_format[2]; - uint16_t bytes_per_frame; + uint16_t bytes_per_frame[2]; + + uint16_t sample_size; uint8_t valid; uint8_t iface_index; @@ -330,7 +343,7 @@ static usb_callback_t umidi_bulk_write_callback; static void uaudio_chan_fill_info_sub(struct uaudio_softc *, - struct usb_device *, uint32_t, uint16_t, uint8_t, uint8_t); + struct usb_device *, uint32_t, uint8_t, uint8_t); static void uaudio_chan_fill_info(struct uaudio_softc *, struct usb_device *); static void uaudio_mixer_add_ctl_sub(struct uaudio_softc *, @@ -787,8 +800,7 @@ static void uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, - uint32_t rate, uint16_t fps, uint8_t channels, - uint8_t bit_resolution) + uint32_t rate, uint8_t channels, uint8_t bit_resolution) { struct usb_descriptor *desc = NULL; const struct usb2_audio_streaming_interface_descriptor *asid = NULL; @@ -811,7 +823,6 @@ uint8_t bBitResolution; uint8_t x; uint8_t audio_if = 0; - uint8_t sample_size; while ((desc = usb_desc_foreach(cd, desc))) { @@ -1040,16 +1051,10 @@ chan->usb2_cfg = uaudio_cfg_play; - sample_size = (( + chan->sample_size = (( UAUDIO_MAX_CHAN(chan->p_asf1d->bNrChannels) * chan->p_asf1d->bBitResolution) / 8); - /* - * NOTE: "chan->bytes_per_frame" - * should not be zero! - */ - chan->bytes_per_frame = ((rate / fps) * sample_size); - if (sc->sc_sndstat_valid) { sbuf_printf(&sc->sc_sndstat, "\n\t" "mode %d.%d:(%s) %dch, %d/%dbit, %s, %dHz", @@ -1067,12 +1072,32 @@ } } +/* This structure defines all the supported rates. */ + +static const uint32_t uaudio_rate_list[] = { + 96000, + 88000, + 80000, + 72000, + 64000, + 56000, + 48000, + 44100, + 40000, + 32000, + 24000, + 22050, + 16000, + 11025, + 8000, + 0 +}; + static void uaudio_chan_fill_info(struct uaudio_softc *sc, struct usb_device *udev) { uint32_t rate = uaudio_default_rate; - uint32_t z; - uint16_t fps = usbd_get_isoc_fps(udev); + uint8_t z; uint8_t bits = uaudio_default_bits; uint8_t y; uint8_t channels = uaudio_default_channels; @@ -1083,14 +1108,24 @@ /* set a valid value */ bits = 32; } - rate -= (rate % fps); - if ((rate == 0) || (rate > 192000)) { - /* set a valid value */ - rate = 192000 - (192000 % fps); - } - if ((channels == 0) || (channels > 2)) { - /* set a valid value */ - channels = 2; + if (channels == 0) { + switch (usbd_get_speed(udev)) { + case USB_SPEED_LOW: + case USB_SPEED_FULL: + /* + * Due to high bandwidth usage and problems + * with HIGH-speed split transactions we + * disable surround setups on FULL-speed USB + * by default + */ + channels = 2; + break; + default: + channels = 16; + break; + } + } else if (channels > 16) { + channels = 16; } if (sbuf_new(&sc->sc_sndstat, NULL, 4096, SBUF_AUTOEXTEND)) { sc->sc_sndstat_valid = 1; @@ -1099,8 +1134,14 @@ for (x = channels; x; x--) { for (y = bits; y; y -= 8) { - for (z = rate; z; z -= fps) { - uaudio_chan_fill_info_sub(sc, udev, z, fps, x, y); + + /* try user defined rate, if any */ + if (rate != 0) + uaudio_chan_fill_info_sub(sc, udev, rate, x, y); + + /* try find a matching rate, if any */ + for (z = 0; uaudio_rate_list[z]; z++) { + uaudio_chan_fill_info_sub(sc, udev, uaudio_rate_list[z], x, y); if (sc->sc_rec_chan.valid && sc->sc_play_chan.valid) { @@ -1116,19 +1157,7 @@ } } -/* - * The following function sets up data size and block count for the - * next audio transfer. - */ static void -uaudio_setup_blockcount(struct uaudio_chan *ch, - uint32_t *total, uint32_t *blockcount) -{ - *total = ch->intr_size; - *blockcount = ch->intr_frames; -} - -static void uaudio_chan_play_callback(struct usb_xfer *xfer, usb_error_t error) { struct uaudio_chan *ch = usbd_xfer_softc(xfer); @@ -1137,12 +1166,11 @@ uint32_t blockcount; uint32_t n; uint32_t offset; - int actlen, sumlen; + int actlen; + int sumlen; usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); - uaudio_setup_blockcount(ch, &total, &blockcount); - if (ch->end == ch->start) { DPRINTF("no buffer!\n"); return; @@ -1153,22 +1181,39 @@ tr_transferred: if (actlen < sumlen) { DPRINTF("short transfer, " - "%d of %d bytes\n", actlen, total); + "%d of %d bytes\n", actlen, sumlen); } chn_intr(ch->pcm_ch); case USB_ST_SETUP: - if (ch->bytes_per_frame > usbd_xfer_max_framelen(xfer)) { + if (ch->bytes_per_frame[1] > usbd_xfer_max_framelen(xfer)) { DPRINTF("bytes per transfer, %d, " "exceeds maximum, %d!\n", - ch->bytes_per_frame, + ch->bytes_per_frame[1], usbd_xfer_max_framelen(xfer)); break; } - /* setup frame length */ + + blockcount = ch->intr_frames; + + /* setup number of frames */ usbd_xfer_set_frames(xfer, blockcount); - for (n = 0; n != blockcount; n++) - usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame); + + /* reset total length */ + total = 0; + + /* setup frame lengths */ + for (n = 0; n != blockcount; n++) { + ch->sample_curr += ch->sample_rem; + if (ch->sample_curr >= ch->frames_per_second) { + ch->sample_curr -= ch->frames_per_second; + usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame[1]); + total += ch->bytes_per_frame[1]; + } else { + usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame[0]); + total += ch->bytes_per_frame[0]; + } + } DPRINTFN(6, "transfer %d bytes\n", total); @@ -1210,7 +1255,6 @@ struct usb_page_cache *pc; uint32_t n; uint32_t m; - uint32_t total; uint32_t blockcount; uint32_t offset0; uint32_t offset1; @@ -1222,8 +1266,6 @@ usbd_xfer_status(xfer, &actlen, NULL, NULL, &nframes); mfl = usbd_xfer_max_framelen(xfer); - uaudio_setup_blockcount(ch, &total, &blockcount); - if (ch->end == ch->start) { DPRINTF("no buffer!\n"); return; @@ -1231,12 +1273,8 @@ switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (actlen < total) { - DPRINTF("short transfer, " - "%d of %d bytes\n", actlen, total); - } else { - DPRINTFN(6, "transferred %d bytes\n", actlen); - } + + DPRINTFN(6, "transferred %d bytes\n", actlen); offset0 = 0; pc = usbd_xfer_get_frame(xfer, 0); @@ -1271,6 +1309,8 @@ case USB_ST_SETUP: tr_setup: + blockcount = ch->intr_frames; + usbd_xfer_set_frames(xfer, blockcount); for (n = 0; n < blockcount; n++) { usbd_xfer_set_frame_len(xfer, n, mfl); @@ -1295,6 +1335,8 @@ &sc->sc_play_chan : &sc->sc_rec_chan); uint32_t buf_size; uint32_t frames; + uint32_t format; + uint16_t fps; uint8_t endpoint; uint8_t blocks; uint8_t iface_index; @@ -1302,7 +1344,9 @@ uint8_t fps_shift; usb_error_t err; - if (usbd_get_isoc_fps(sc->sc_udev) < 8000) { + fps = usbd_get_isoc_fps(sc->sc_udev); + + if (fps < 8000) { /* FULL speed USB */ frames = 8; } else { @@ -1310,10 +1354,6 @@ frames = UAUDIO_NFRAMES; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912220631.nBM6VNbw058026>