svn commit: r247535 - head/sys/arm/include
Author: alc Date: Fri Mar 1 08:30:31 2013 New Revision: 247535 URL: http://svnweb.freebsd.org/changeset/base/247535 Log: Copy the definition of VM_MAX_AUTOTUNE_MAXUSERS from i386. (See r242847.) Tested by:andrew Modified: head/sys/arm/include/vmparam.h Modified: head/sys/arm/include/vmparam.h == --- head/sys/arm/include/vmparam.h Fri Mar 1 07:39:14 2013 (r247534) +++ head/sys/arm/include/vmparam.h Fri Mar 1 08:30:31 2013 (r247535) @@ -178,4 +178,8 @@ extern vm_offset_t vm_max_kernel_address #defineZERO_REGION_SIZE(64 * 1024) /* 64KB */ +#ifndef VM_MAX_AUTOTUNE_MAXUSERS +#defineVM_MAX_AUTOTUNE_MAXUSERS384 +#endif + #endif /* _MACHINE_VMPARAM_H_ */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247540 - in head: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: mm Date: Fri Mar 1 09:42:58 2013 New Revision: 247540 URL: http://svnweb.freebsd.org/changeset/base/247540 Log: Fix the zfs_ioctl compat layer to support zfs_cmd size change introduced in r247265 (ZFS deadman thread). Both new utilities now support the old kernel and new kernel properly detects old utilities. For future backwards compatibility, the vfs.zfs.version.ioctl read-only sysctl has been introduced. With this sysctl zfs utilities will be able to detect the ioctl interface version of the currently loaded zfs module. As a side effect, the zfs utilities between r247265 and this revision don't support the old kernel module. If you are using HEAD newer or equal than r247265, install the new kernel module (or whole kernel) first. MFC after:10 days Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h == --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Fri Mar 1 09:40:02 2013(r247539) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Fri Mar 1 09:42:58 2013(r247540) @@ -24,6 +24,7 @@ * Copyright (c) 2011 Pawel Jakub Dawidek pa...@dawidek.net. * All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2013 Martin Matuska m...@freebsd.org. All rights reserved. */ #ifndef_LIBFS_IMPL_H @@ -216,6 +217,7 @@ extern void libzfs_fru_clear(libzfs_hand #ifndef sun static int zfs_kernel_version = 0; +static int zfs_ioctl_version = 0; /* * This is FreeBSD version of ioctl, because Solaris' ioctl() updates @@ -225,19 +227,34 @@ static int zfs_kernel_version = 0; static __inline int zcmd_ioctl(int fd, unsigned long cmd, zfs_cmd_t *zc) { - size_t oldsize, zfs_kernel_version_size; + size_t oldsize, zfs_kernel_version_size, zfs_ioctl_version_size; int version, ret, cflag = ZFS_CMD_COMPAT_NONE; - zfs_kernel_version_size = sizeof(zfs_kernel_version); - if (zfs_kernel_version == 0) { - sysctlbyname(vfs.zfs.version.spa, zfs_kernel_version, - zfs_kernel_version_size, NULL, 0); + zfs_ioctl_version_size = sizeof(zfs_ioctl_version); + if (zfs_ioctl_version == 0) { + sysctlbyname(vfs.zfs.version.ioctl, zfs_ioctl_version, + zfs_ioctl_version_size, NULL, 0); } - if (zfs_kernel_version == SPA_VERSION_15 || - zfs_kernel_version == SPA_VERSION_14 || - zfs_kernel_version == SPA_VERSION_13) - cflag = ZFS_CMD_COMPAT_V15; + /* +* If vfs.zfs.version.ioctl is not defined, assume we have v28 +* compatible binaries and use vfs.zfs.version.spa to test for v15 +*/ + if (zfs_ioctl_version ZFS_IOCVER_DEADMAN) { + cflag = ZFS_CMD_COMPAT_V28; + zfs_kernel_version_size = sizeof(zfs_kernel_version); + + if (zfs_kernel_version == 0) { + sysctlbyname(vfs.zfs.version.spa, + zfs_kernel_version, + zfs_kernel_version_size, NULL, 0); + } + + if (zfs_kernel_version == SPA_VERSION_15 || + zfs_kernel_version == SPA_VERSION_14 || + zfs_kernel_version == SPA_VERSION_13) + cflag = ZFS_CMD_COMPAT_V15; + } oldsize = zc-zc_nvlist_dst_size; ret = zcmd_ioctl_compat(fd, cmd, zc, cflag); Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c == --- head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c Fri Mar 1 09:40:02 2013(r247539) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c Fri Mar 1 09:42:58 2013(r247540) @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2010 Martin Matuska m...@freebsd.org. All rights reserved. + * Copyright 2013 Martin Matuska m...@freebsd.org. All rights reserved. * Portions Copyright 2005, 2010, Oracle and/or its affiliates. * All rights reserved. * Use is subject to license terms. @@ -35,22 +35,100 @@ #include sys/zfs_ioctl.h #include zfs_ioctl_compat.h +static int zfs_version_ioctl = ZFS_IOCVER_CURRENT; +SYSCTL_DECL(_vfs_zfs_version); +SYSCTL_INT(_vfs_zfs_version, OID_AUTO, ioctl, CTLFLAG_RD, zfs_version_ioctl, +0, ZFS_IOCTL_VERSION); + /* - * FreeBSD zfs_cmd compatibility with v15 and older binaries + * FreeBSD zfs_cmd compatibility with older binaries * appropriately remap/extend the zfs_cmd_t structure */
Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test
On Wed, Feb 27, 2013 at 07:25:48PM +1100, Peter Jeremy wrote: On 2013-Feb-26 01:02:27 +0100, Jilles Tjoelker jil...@stack.nl wrote: Enhance test(1) by adding provision to compare any combination of the access, birth, change and modify times of two files, instead of only being able to compare modify times. The builtin test in sh(1) will automagically acquire the same expansion. What do you need this for? If it is not needed very often, this test can be done more portably (older FreeBSD and GNU) as [ -n $(find -L FILE1 -prune -newerXY FILE2 2/dev/null) ] In my case I needed to compare the ctime on one set of files with the mtime in another set. I had a think about using find(1) and gave it away as too ugly. That expression needs serious thought to understand and about ½ the tokens in the find(1) are to handle special cases - which is a further indication that it isn't ideal. Making everything ideal out of the box is not possible; it would bloat up things too much and make scripts harder to read. There are many possible extensions to avoid problems with special cases that would be useful more frequently, such as arrays, ${PARAM/WORD/REPLACEMENT}, ${PARAM:START:LENGTH} and optional more useful signal handling. And I don't think this case is particularly bad. By defining the below function file_newer() { test -n $(find -L -- $2 -prune -newer$1$3 $4 2/dev/null) } you can do things like file_newer m file1 c file2 to compare file1's mtime to file2's ctime. The ugliness is isolated to the function definition. The birth time is designated by B instead of b. This is because find(1) wants B, and so does stat(1). Furthermore, it also allows file_newer m file1 t '2 days ago' to compare to a specified time; however, only the second time can be 't'. It is also possible to query file times using stat(1). This allows intuitive constructions like [ $(stat -f %m FILE1) -gt $(stat -f %c FILE2) ] lets you compare to things like $(($(date +%s) - 86400)) and allows control whether symlinks should be followed. However, this may fork more often than the find(1)-based approach and hard-codes the limitation to seconds into the script unless you do something more complicated like [ $(stat -f %040.9Fm FILE1) \ $(stat -f %040.9Fc FILE2) ] The test(1) syntax will also be incorrect if the files do not exist. The find(1) and stat(1) approaches also work in other shells such as bash, ksh and zsh. An extension to test(1) can only be used by writing ugly things like /bin/test. Whatever you may think of it, people write scripts for those other shells and it is somewhat unfortunate that they cannot use all FreeBSD-specific features. I have generally been rather reluctant in adding things to sh(1) and even more so if they are completely new. Someone proposed something rather similar (except that it added a time string parser -- even more code) in PR bin/57054 and I rejected it in 2009. Time parsing is a large can of worms - getting it right is messy (that patch includes 1KLOC of new code and still isn't locale aware). And the work-around of touching a dummy file to the wanted age isn't too horrrible. This is a much smaller patch and there's no equally clean work-around. I think my function definition is a clean enough workaround. I wouldn't mind having more such functions somewhere part of the base system, perhaps somewhat like rc.subr and dteske's bsdconfig scripts. There are some such functions in src/bin/sh/funcs/ but they are not installed. When I add things to sh, I usually include the new feature in a message to a mailing list like http://lists.freebsd.org/pipermail/freebsd-arch/2010-June/010353.html and http://lists.freebsd.org/pipermail/freebsd-arch/2011-December/011976.html first. Randomly adding features interferes with the design and the process. +a=/tmp/test$$.1 +b=/tmp/test$$.2 Please use mktemp(1). Using $$ for temporary files is insecure on multiuser systems. In this case, I want filenames that don't exist. I will look at using mktemp(1) to create a temporary directory. That's what I usually do in sh testcases. The directory usually serves to contain temporary fifos. Fifos are both faster and more reliable to enforce ordering than sleeps. +sleep 2# Ensure $b is newer than $a +touch $b Please use touch -t instead of sleeping. I'm impatient while running tests :) In this case, I want all the timestamps on $b to be later than $a. I initially tried without the sleep but that failed with the builtin test(1) because the FS timestamps weren't sufficiently granular to report the difference. I could create one of the files much earlier during the test and then use a conditional test to only sleep if the timestamps were indistinguishable (this probably needs to use the above find(1) horror to avoid using test(1) to test itself). You can compare to a file somewhere else on the system. I agree the other sleep(1)s should be able to
svn commit: r247550 - head/lib/libc/rpc
Author: kevlo Date: Fri Mar 1 15:45:57 2013 New Revision: 247550 URL: http://svnweb.freebsd.org/changeset/base/247550 Log: Assign the len field of the netbuf structure to the current length of a sockaddr. Obtained from:NetBSD Modified: head/lib/libc/rpc/clnt_vc.c Modified: head/lib/libc/rpc/clnt_vc.c == --- head/lib/libc/rpc/clnt_vc.c Fri Mar 1 15:09:23 2013(r247549) +++ head/lib/libc/rpc/clnt_vc.c Fri Mar 1 15:45:57 2013(r247550) @@ -260,7 +260,7 @@ clnt_vc_create(fd, raddr, prog, vers, se if (ct-ct_addr.buf == NULL) goto err; memcpy(ct-ct_addr.buf, raddr-buf, raddr-len); - ct-ct_addr.len = raddr-maxlen; + ct-ct_addr.len = raddr-len; ct-ct_addr.maxlen = raddr-maxlen; /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247551 - head/sys/dev/tws
Author: kevlo Date: Fri Mar 1 15:48:31 2013 New Revision: 247551 URL: http://svnweb.freebsd.org/changeset/base/247551 Log: Fix typo. Modified: head/sys/dev/tws/tws_hdm.c Modified: head/sys/dev/tws/tws_hdm.c == --- head/sys/dev/tws/tws_hdm.c Fri Mar 1 15:45:57 2013(r247550) +++ head/sys/dev/tws/tws_hdm.c Fri Mar 1 15:48:31 2013(r247551) @@ -99,7 +99,7 @@ tws_init_ctlr(struct tws_softc *sc) regh = tws_read_reg(sc, TWS_I2O0_IOPOBQPH, 4); regl = tws_read_reg(sc, TWS_I2O0_IOPOBQPL, 4); reg = (((u_int64_t)regh) 32) | regl; -TWS_TRACE_DEBUG(sc, host outbound clenup,reg, regl); +TWS_TRACE_DEBUG(sc, host outbound cleanup,reg, regl); if ( regh == TWS_FIFO_EMPTY32 ) break; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test
On 1 Mar 2013 14:27, Jilles Tjoelker jil...@stack.nl wrote: On Wed, Feb 27, 2013 at 07:25:48PM +1100, Peter Jeremy wrote: On 2013-Feb-26 01:02:27 +0100, Jilles Tjoelker jil...@stack.nl wrote: Enhance test(1) by adding provision to compare any combination of the access, birth, change and modify times of two files, instead of only being able to compare modify times. The builtin test in sh(1) will automagically acquire the same expansion. What do you need this for? If it is not needed very often, this test can be done more portably (older FreeBSD and GNU) as [ -n $(find -L FILE1 -prune -newerXY FILE2 2/dev/null) ] In my case I needed to compare the ctime on one set of files with the mtime in another set. I had a think about using find(1) and gave it away as too ugly. That expression needs serious thought to understand and about ½ the tokens in the find(1) are to handle special cases - which is a further indication that it isn't ideal. Making everything ideal out of the box is not possible; it would bloat up things too much and make scripts harder to read. There are many possible extensions to avoid problems with special cases that would be useful more frequently, such as arrays, ${PARAM/WORD/REPLACEMENT}, ${PARAM:START:LENGTH} and optional more useful signal handling. And I don't think this case is particularly bad. By defining the below function file_newer() { test -n $(find -L -- $2 -prune -newer$1$3 $4 2/dev/null) } you can do things like file_newer m file1 c file2 to compare file1's mtime to file2's ctime. The ugliness is isolated to the function definition. The birth time is designated by B instead of b. This is because find(1) wants B, and so does stat(1). Furthermore, it also allows file_newer m file1 t '2 days ago' to compare to a specified time; however, only the second time can be 't'. It is also possible to query file times using stat(1). This allows intuitive constructions like [ $(stat -f %m FILE1) -gt $(stat -f %c FILE2) ] lets you compare to things like $(($(date +%s) - 86400)) and allows control whether symlinks should be followed. However, this may fork more often than the find(1)-based approach and hard-codes the limitation to seconds into the script unless you do something more complicated like [ $(stat -f %040.9Fm FILE1) \ $(stat -f %040.9Fc FILE2) ] The test(1) syntax will also be incorrect if the files do not exist. The find(1) and stat(1) approaches also work in other shells such as bash, ksh and zsh. An extension to test(1) can only be used by writing ugly things like /bin/test. Whatever you may think of it, people write scripts for those other shells and it is somewhat unfortunate that they cannot use all FreeBSD-specific features. +1 While I'm aware that we have many very useful extensions to sh, we should not sacrifice portability. We (porters) are on thin ground when complaining at upstream for assuming /bin/sh is bash when we have extensions such as these. Chris ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247560 - head/sys/kern
Author: kib Date: Fri Mar 1 18:40:14 2013 New Revision: 247560 URL: http://svnweb.freebsd.org/changeset/base/247560 Log: Make the default implementation of the VOP_VPTOCNP() fail if the directory entry, matched by the inode number, is .. NFSv4 client might instantiate the distinct vnodes which have the same inode number, since single v4 export can be combined from several filesystems on the server. For instance, a case when the nested server mount point is exactly one directory below the top of the export, causes directory and its parent to have the same inode number 2. The vop_stdvptocnp() algorithm then returns . as the name of the lower directory. Filtering out the . entry with ENOENT works around this behaviour, the error forces getcwd(3) to fall back to usermode implementation, which compares both st_dev and st_ino. Based on the submission by: rmacklem Tested by:rmacklem MFC after:1 week Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c == --- head/sys/kern/vfs_default.c Fri Mar 1 18:39:55 2013(r247559) +++ head/sys/kern/vfs_default.c Fri Mar 1 18:40:14 2013(r247560) @@ -856,8 +856,12 @@ vop_stdvptocnp(struct vop_vptocnp_args * error = ENOMEM; goto out; } - bcopy(dp-d_name, buf + i, dp-d_namlen); - error = 0; + if (dp-d_namlen == 1 dp-d_name[0] == '.') { + error = ENOENT; + } else { + bcopy(dp-d_name, buf + i, dp-d_namlen); + error = 0; + } goto out; } } while (len 0 || !eofflag); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247561 - head/sys/kern
Author: marius Date: Fri Mar 1 18:49:14 2013 New Revision: 247561 URL: http://svnweb.freebsd.org/changeset/base/247561 Log: - Use strdup(9) instead of reimplementing it. - Use __DECONST instead of strange casts. - Reduce code duplication and simplify name2oid(). PR: 176373 Submitted by: Christoph Mallon MFC after:1 week Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c == --- head/sys/kern/kern_sysctl.c Fri Mar 1 18:40:14 2013(r247560) +++ head/sys/kern/kern_sysctl.c Fri Mar 1 18:49:14 2013(r247561) @@ -444,9 +444,9 @@ sysctl_remove_oid_locked(struct sysctl_o SYSCTL_SLEEP(oidp-oid_running, oidrm, 0); } if (oidp-oid_descr) - free((void *)(uintptr_t)(const void *)oidp-oid_descr, M_SYSCTLOID); - free((void *)(uintptr_t)(const void *)oidp-oid_name, -M_SYSCTLOID); + free(__DECONST(char *, oidp-oid_descr), + M_SYSCTLOID); + free(__DECONST(char *, oidp-oid_name), M_SYSCTLOID); free(oidp, M_SYSCTLOID); } } @@ -462,8 +462,6 @@ sysctl_add_oid(struct sysctl_ctx_list *c int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr) { struct sysctl_oid *oidp; - ssize_t len; - char *newname; /* You have to hook up somewhere.. */ if (parent == NULL) @@ -490,11 +488,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c SLIST_NEXT(oidp, oid_link) = NULL; oidp-oid_number = number; oidp-oid_refcnt = 1; - len = strlen(name); - newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK); - bcopy(name, newname, len + 1); - newname[len] = '\0'; - oidp-oid_name = newname; + oidp-oid_name = strdup(name, M_SYSCTLOID); oidp-oid_handler = handler; oidp-oid_kind = CTLFLAG_DYN | kind; if ((kind CTLTYPE) == CTLTYPE_NODE) { @@ -508,12 +502,8 @@ sysctl_add_oid(struct sysctl_ctx_list *c oidp-oid_arg2 = arg2; } oidp-oid_fmt = fmt; - if (descr) { - int len = strlen(descr) + 1; - oidp-oid_descr = malloc(len, M_SYSCTLOID, M_WAITOK); - if (oidp-oid_descr) - strcpy((char *)(uintptr_t)(const void *)oidp-oid_descr, descr); - } + if (descr) + oidp-oid_descr = strdup(descr, M_SYSCTLOID); /* Update the context, if used */ if (clist != NULL) sysctl_ctx_entry_add(clist, oidp); @@ -529,16 +519,12 @@ sysctl_add_oid(struct sysctl_ctx_list *c void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name) { - ssize_t len; char *newname; - void *oldname; + char *oldname; - len = strlen(name); - newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK); - bcopy(name, newname, len + 1); - newname[len] = '\0'; + newname = strdup(name, M_SYSCTLOID); SYSCTL_XLOCK(); - oldname = (void *)(uintptr_t)(const void *)oidp-oid_name; + oldname = __DECONST(char *, oidp-oid_name); oidp-oid_name = newname; SYSCTL_XUNLOCK(); free(oldname, M_SYSCTLOID); @@ -823,39 +809,26 @@ static SYSCTL_NODE(_sysctl, 2, next, CTL static int name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) { - int i; struct sysctl_oid *oidp; struct sysctl_oid_list *lsp = sysctl__children; char *p; SYSCTL_ASSERT_XLOCKED(); - if (!*name) - return (ENOENT); + for (*len = 0; *len CTL_MAXNAME;) { + p = strsep(name, .); - p = name + strlen(name) - 1 ; - if (*p == '.') - *p = '\0'; - - *len = 0; - - for (p = name; *p *p != '.'; p++) - ; - i = *p; - if (i == '.') - *p = '\0'; - - oidp = SLIST_FIRST(lsp); - - while (oidp *len CTL_MAXNAME) { - if (strcmp(name, oidp-oid_name)) { - oidp = SLIST_NEXT(oidp, oid_link); - continue; + oidp = SLIST_FIRST(lsp); + for (;; oidp = SLIST_NEXT(oidp, oid_link)) { + if (oidp == NULL) + return (ENOENT); + if (strcmp(p, oidp-oid_name) == 0) + break; } *oid++ = oidp-oid_number; (*len)++; - if (!i) { + if (name == NULL || *name == '\0') { if (oidpp) *oidpp = oidp; return (0); @@ -868,13 +841,6 @@ name2oid(char *name, int *oid, int
svn commit: r247564 - in head/sys/arm: econa s3c2xx0 xscale/i80321 xscale/i8134x xscale/ixp425 xscale/pxa
Author: alc Date: Fri Mar 1 19:02:41 2013 New Revision: 247564 URL: http://svnweb.freebsd.org/changeset/base/247564 Log: Eliminate a redundant #include: machine/pmap.h is already included through vm/pmap.h. Modified: head/sys/arm/econa/econa_machdep.c head/sys/arm/s3c2xx0/s3c24x0_machdep.c head/sys/arm/xscale/i80321/ep80219_machdep.c head/sys/arm/xscale/i80321/iq31244_machdep.c head/sys/arm/xscale/i8134x/crb_machdep.c head/sys/arm/xscale/ixp425/avila_machdep.c head/sys/arm/xscale/pxa/pxa_machdep.c Modified: head/sys/arm/econa/econa_machdep.c == --- head/sys/arm/econa/econa_machdep.c Fri Mar 1 19:01:52 2013 (r247563) +++ head/sys/arm/econa/econa_machdep.c Fri Mar 1 19:02:41 2013 (r247564) @@ -68,7 +68,6 @@ __FBSDID($FreeBSD$); #include vm/vm_object.h #include vm/vm_page.h #include vm/vm_map.h -#include machine/pmap.h #include machine/vmparam.h #include machine/pcb.h #include machine/undefined.h Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c == --- head/sys/arm/s3c2xx0/s3c24x0_machdep.c Fri Mar 1 19:01:52 2013 (r247563) +++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c Fri Mar 1 19:02:41 2013 (r247564) @@ -78,7 +78,6 @@ __FBSDID($FreeBSD$); #include vm/vm_object.h #include vm/vm_page.h #include vm/vm_map.h -#include machine/pmap.h #include machine/vmparam.h #include machine/pcb.h #include machine/undefined.h Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c == --- head/sys/arm/xscale/i80321/ep80219_machdep.cFri Mar 1 19:01:52 2013(r247563) +++ head/sys/arm/xscale/i80321/ep80219_machdep.cFri Mar 1 19:02:41 2013(r247564) @@ -78,7 +78,6 @@ __FBSDID($FreeBSD$); #include vm/vm_object.h #include vm/vm_page.h #include vm/vm_map.h -#include machine/pmap.h #include machine/vmparam.h #include machine/pcb.h #include machine/undefined.h Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c == --- head/sys/arm/xscale/i80321/iq31244_machdep.cFri Mar 1 19:01:52 2013(r247563) +++ head/sys/arm/xscale/i80321/iq31244_machdep.cFri Mar 1 19:02:41 2013(r247564) @@ -78,7 +78,6 @@ __FBSDID($FreeBSD$); #include vm/vm_object.h #include vm/vm_page.h #include vm/vm_map.h -#include machine/pmap.h #include machine/vmparam.h #include machine/pcb.h #include machine/undefined.h Modified: head/sys/arm/xscale/i8134x/crb_machdep.c == --- head/sys/arm/xscale/i8134x/crb_machdep.cFri Mar 1 19:01:52 2013 (r247563) +++ head/sys/arm/xscale/i8134x/crb_machdep.cFri Mar 1 19:02:41 2013 (r247564) @@ -78,7 +78,6 @@ __FBSDID($FreeBSD$); #include vm/vm_object.h #include vm/vm_page.h #include vm/vm_map.h -#include machine/pmap.h #include machine/vmparam.h #include machine/pcb.h #include machine/undefined.h Modified: head/sys/arm/xscale/ixp425/avila_machdep.c == --- head/sys/arm/xscale/ixp425/avila_machdep.c Fri Mar 1 19:01:52 2013 (r247563) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Fri Mar 1 19:02:41 2013 (r247564) @@ -78,7 +78,6 @@ __FBSDID($FreeBSD$); #include vm/vm_object.h #include vm/vm_page.h #include vm/vm_map.h -#include machine/pmap.h #include machine/vmparam.h #include machine/pcb.h #include machine/undefined.h Modified: head/sys/arm/xscale/pxa/pxa_machdep.c == --- head/sys/arm/xscale/pxa/pxa_machdep.c Fri Mar 1 19:01:52 2013 (r247563) +++ head/sys/arm/xscale/pxa/pxa_machdep.c Fri Mar 1 19:02:41 2013 (r247564) @@ -80,7 +80,6 @@ __FBSDID($FreeBSD$); #include vm/vm_object.h #include vm/vm_page.h #include vm/vm_map.h -#include machine/pmap.h #include machine/vmparam.h #include machine/pcb.h #include machine/undefined.h ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247565 - head/sys/dev/bce
Author: marius Date: Fri Mar 1 19:12:38 2013 New Revision: 247565 URL: http://svnweb.freebsd.org/changeset/base/247565 Log: - Make tables, device ID strings etc const. - Use NULL instead of 0 for pointers. - Remove redundant bzero(9)'ing of the softc. - Remove redundant/unused softc members. - Don't allocate MSI/MSI-X as RF_SHAREABLE. - Re-use bus accessor macros instead of duplicating them. - In bce_miibus_{read,write}_reg(), remove superfluous limiting of the PHY address (missed in r213893). MFC after:1 week Modified: head/sys/dev/bce/if_bce.c head/sys/dev/bce/if_bcereg.h Modified: head/sys/dev/bce/if_bce.c == --- head/sys/dev/bce/if_bce.c Fri Mar 1 19:02:41 2013(r247564) +++ head/sys/dev/bce/if_bce.c Fri Mar 1 19:12:38 2013(r247565) @@ -95,7 +95,7 @@ __FBSDID($FreeBSD$); // #define BCE_DEVDESC_MAX64 -static struct bce_type bce_devs[] = { +static const struct bce_type bce_devs[] = { /* BCM5706C Controllers and OEM boards. */ { BRCM_VENDORID, BRCM_DEVICEID_BCM5706, HP_VENDORID, 0x3101, HP NC370T Multifunction Gigabit Server Adapter }, @@ -161,7 +161,7 @@ static struct bce_type bce_devs[] = { // /* Supported Flash NVRAM device data. */ // -static struct flash_spec flash_table[] = +static const struct flash_spec flash_table[] = { #define BUFFERED_FLAGS (BCE_NV_BUFFERED | BCE_NV_TRANSLATE) #define NONBUFFERED_FLAGS (BCE_NV_WREN) @@ -258,7 +258,7 @@ static struct flash_spec flash_table[] = * logical-to-physical mapping is required in the * driver. */ -static struct flash_spec flash_5709 = { +static const struct flash_spec flash_5709 = { .flags = BCE_NV_BUFFERED, .page_bits = BCM5709_FLASH_PAGE_BITS, .page_size = BCM5709_FLASH_PAGE_SIZE, @@ -481,8 +481,8 @@ MODULE_DEPEND(bce, pci, 1, 1, 1); MODULE_DEPEND(bce, ether, 1, 1, 1); MODULE_DEPEND(bce, miibus, 1, 1, 1); -DRIVER_MODULE(bce, pci, bce_driver, bce_devclass, 0, 0); -DRIVER_MODULE(miibus, bce, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(bce, pci, bce_driver, bce_devclass, NULL, NULL); +DRIVER_MODULE(miibus, bce, miibus_driver, miibus_devclass, NULL, NULL); // @@ -647,7 +647,7 @@ SYSCTL_UINT(_hw_bce, OID_AUTO, rx_ticks, static int bce_probe(device_t dev) { - struct bce_type *t; + const struct bce_type *t; struct bce_softc *sc; char *descbuf; u16 vid = 0, did = 0, svid = 0, sdid = 0; @@ -655,7 +655,6 @@ bce_probe(device_t dev) t = bce_devs; sc = device_get_softc(dev); - bzero(sc, sizeof(struct bce_softc)); sc-bce_unit = device_get_unit(dev); sc-bce_dev = dev; @@ -1040,7 +1039,7 @@ bce_attach(device_t dev) struct bce_softc *sc; struct ifnet *ifp; u32 val; - int error, rid, rc = 0; + int count, error, rc = 0, rid; sc = device_get_softc(dev); sc-bce_dev = dev; @@ -1084,14 +1083,14 @@ bce_attach(device_t dev) ((sc-bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_MEMORY, rid, RF_ACTIVE)) != NULL)) { - msi_needed = sc-bce_msi_count = 1; + msi_needed = count = 1; - if (((error = pci_alloc_msix(dev, sc-bce_msi_count)) != 0) || - (sc-bce_msi_count != msi_needed)) { + if (((error = pci_alloc_msix(dev, count)) != 0) || + (count != msi_needed)) { BCE_PRINTF(%s(%d): MSI-X allocation failed! Requested = %d, Received = %d, error = %d\n, __FILE__, __LINE__, - msi_needed, sc-bce_msi_count, error); - sc-bce_msi_count = 0; + msi_needed, count, error); + count = 0; pci_release_msi(dev); bus_release_resource(dev, SYS_RES_MEMORY, rid, sc-bce_res_irq); @@ -1100,19 +1099,18 @@ bce_attach(device_t dev) DBPRINT(sc, BCE_INFO_LOAD, %s(): Using MSI-X interrupt.\n, __FUNCTION__); sc-bce_flags |= BCE_USING_MSIX_FLAG; - sc-bce_intr = bce_intr; } } #endif /* Try allocating a MSI interrupt. */ if ((sc-bce_cap_flags BCE_MSI_CAPABLE_FLAG) - (bce_msi_enable = 1) (sc-bce_msi_count == 0)) { - sc-bce_msi_count = 1; -
svn commit: r247570 - head/sys/dev/aac
Author: marius Date: Fri Mar 1 19:55:10 2013 New Revision: 247570 URL: http://svnweb.freebsd.org/changeset/base/247570 Log: - Make tables, device ID strings etc const. This includes #ifdef'ing 0 aac_command_status_table, which is actually unused since r111532. While at it, make aac_if a pointer to the now const interface tables instead of copying them over to the softc (this alone already reduces the size of aac.ko on amd64 by ~1 KiB). - Remove redundant softc members. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. - Remove redundant bzero(9)'ing of the softc. - Use pci_enable_busmaster(9) instead of duplicating it. - Remove redundant checking for PCIM_CMD_MEMEN (resource allocation will just fail). - Canonicalize the error messages in case of resource allocation failures. - Add support for using MSI instead of INTx, controllable via the tunable hw.aac.enable_msi (defaulting to on). MFC after:1 month Modified: head/sys/dev/aac/aac.c head/sys/dev/aac/aac_cam.c head/sys/dev/aac/aac_disk.c head/sys/dev/aac/aac_pci.c head/sys/dev/aac/aac_tables.h head/sys/dev/aac/aacvar.h Modified: head/sys/dev/aac/aac.c == --- head/sys/dev/aac/aac.c Fri Mar 1 19:54:25 2013(r247569) +++ head/sys/dev/aac/aac.c Fri Mar 1 19:55:10 2013(r247570) @@ -117,7 +117,7 @@ static void aac_sa_set_mailbox(struct aa static int aac_sa_get_mailbox(struct aac_softc *sc, int mb); static voidaac_sa_set_interrupts(struct aac_softc *sc, int enable); -struct aac_interface aac_sa_interface = { +const struct aac_interface aac_sa_interface = { aac_sa_get_fwstatus, aac_sa_qnotify, aac_sa_get_istatus, @@ -142,7 +142,7 @@ static int aac_rx_send_command(struct aa static int aac_rx_get_outb_queue(struct aac_softc *sc); static void aac_rx_set_outb_queue(struct aac_softc *sc, int index); -struct aac_interface aac_rx_interface = { +const struct aac_interface aac_rx_interface = { aac_rx_get_fwstatus, aac_rx_qnotify, aac_rx_get_istatus, @@ -169,7 +169,7 @@ static int aac_rkt_send_command(struct a static int aac_rkt_get_outb_queue(struct aac_softc *sc); static void aac_rkt_set_outb_queue(struct aac_softc *sc, int index); -struct aac_interface aac_rkt_interface = { +const struct aac_interface aac_rkt_interface = { aac_rkt_get_fwstatus, aac_rkt_qnotify, aac_rkt_get_istatus, @@ -183,8 +183,8 @@ struct aac_interface aac_rkt_interface = }; /* Debugging and Diagnostics */ -static voidaac_describe_controller(struct aac_softc *sc); -static char*aac_describe_code(struct aac_code_lookup *table, +static voidaac_describe_controller(struct aac_softc *sc); +static const char *aac_describe_code(const struct aac_code_lookup *table, u_int32_t code); /* Management Interface */ @@ -222,7 +222,7 @@ static struct cdevsw aac_cdevsw = { static MALLOC_DEFINE(M_AACBUF, aacbuf, Buffers for the AAC driver); /* sysctl node */ -static SYSCTL_NODE(_hw, OID_AUTO, aac, CTLFLAG_RD, 0, AAC driver parameters); +SYSCTL_NODE(_hw, OID_AUTO, aac, CTLFLAG_RD, 0, AAC driver parameters); /* * Device Interface @@ -634,8 +634,8 @@ aac_free(struct aac_softc *sc) if (sc-aac_intr) bus_teardown_intr(sc-aac_dev, sc-aac_irq, sc-aac_intr); if (sc-aac_irq != NULL) - bus_release_resource(sc-aac_dev, SYS_RES_IRQ, sc-aac_irq_rid, -sc-aac_irq); + bus_release_resource(sc-aac_dev, SYS_RES_IRQ, + rman_get_rid(sc-aac_irq), sc-aac_irq); /* destroy data-transfer DMA tag */ if (sc-aac_buffer_dmat) @@ -648,10 +648,10 @@ aac_free(struct aac_softc *sc) /* release the register window mapping */ if (sc-aac_regs_res0 != NULL) bus_release_resource(sc-aac_dev, SYS_RES_MEMORY, -sc-aac_regs_rid0, sc-aac_regs_res0); + rman_get_rid(sc-aac_regs_res0), sc-aac_regs_res0); if (sc-aac_hwif == AAC_HWIF_NARK sc-aac_regs_res1 != NULL) bus_release_resource(sc-aac_dev, SYS_RES_MEMORY, -sc-aac_regs_rid1, sc-aac_regs_res1); + rman_get_rid(sc-aac_regs_res1), sc-aac_regs_res1); } /* @@ -1333,9 +1333,6 @@ aac_bio_complete(struct aac_command *cm) } else { bp-bio_error = EIO; bp-bio_flags |= BIO_ERROR; - /* pass an error string out to the disk layer */ - bp-bio_driver1 = aac_describe_code(aac_command_status_table, - status); } aac_biodone(bp); } @@ -1687,7 +1684,7 @@ static int aac_check_firmware(struct aac_softc *sc) { u_int32_t code, major, minor, options = 0, atu_size
svn commit: r247571 - head/sys/dev/puc
Author: marius Date: Fri Mar 1 20:16:06 2013 New Revision: 247571 URL: http://svnweb.freebsd.org/changeset/base/247571 Log: - Apparently, r186520 was just wrong and the clock of Oxford OX16PCI958 is neither DEFAULT_RCLK * 2 nor DEFAULT_RCLK * 10 but plain DEFAULT_RCLK and there's no (open) source indicating otherwise. This was tested with an EXSYS EX-41098-2, whose clock is not configurable and identifies as: puc0@pci0:5:1:0:class=0x070200 card=0x06711415 chip=0x95381415 rev=0x01 hdr=0x00 vendor = 'Oxford Semiconductor Ltd' class = simple comms subclass = multiport serial Note that this exactly matches the card mentioned in PR 129665 so no sub-device/sub-vendor based quirking of the latter is possible. So maybe we should grow some sort of tunable, in case non-default cards such as the latter aren't configurable either (this also wouldn't be the first time an allegedly tested commit turns out to be wrong though). - Make the TiMedia tables const. MFC after:1 week Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c == --- head/sys/dev/puc/pucdata.c Fri Mar 1 19:55:10 2013(r247570) +++ head/sys/dev/puc/pucdata.c Fri Mar 1 20:16:06 2013(r247571) @@ -769,7 +769,7 @@ const struct puc_cfg puc_pci_devices[] = { 0x1415, 0x9538, 0x, 0, Oxford Semiconductor OX16PCI958 UARTs, - DEFAULT_RCLK * 10, + DEFAULT_RCLK, PUC_PORT_8S, 0x18, 0, 8, }, @@ -918,6 +918,7 @@ const struct puc_cfg puc_pci_devices[] = DEFAULT_RCLK * 8, PUC_PORT_4S, 0x10, 0, 8, }, + { 0x14d2, 0xa004, 0x, 0, Titan PCI-800H, DEFAULT_RCLK * 8, @@ -1060,7 +1061,7 @@ const struct puc_cfg puc_pci_devices[] = { 0x9710, 0x9865, 0xa000, 0x3004, NetMos NM9865 Quad UART, DEFAULT_RCLK, - PUC_PORT_4S, 0x10, 4, 0,0 + PUC_PORT_4S, 0x10, 4, 0, }, { 0x9710, 0x9865, 0xa000, 0x3011, @@ -1420,26 +1421,26 @@ static int puc_config_timedia(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { - static uint16_t dual[] = { + static const uint16_t dual[] = { 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085, 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079, 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079, 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079, 0xD079, 0 }; - static uint16_t quad[] = { + static const uint16_t quad[] = { 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157, 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159, 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056, 0xB157, 0 }; - static uint16_t octa[] = { + static const uint16_t octa[] = { 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166, 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 }; - static struct { + static const struct { int ports; - uint16_t *ids; + const uint16_t *ids; } subdevs[] = { { 2, dual }, { 4, quad }, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247573 - head/sys/sparc64/pci
Author: marius Date: Fri Mar 1 20:34:02 2013 New Revision: 247573 URL: http://svnweb.freebsd.org/changeset/base/247573 Log: - Remove an unused header. - Use NULL instead of 0 for pointers. - Let ofw_pcib_probe() return BUS_PROBE_DEFAULT instead of 0 so specialized PCI-PCI-bridge drivers may attach instead. - Add WARs for PLX Technology PEX 8114 bridges and PEX 8532 switches. Ideally, these should live in MI code but at least for the latter we're missing the necessary infrastructure there. MFC after:1 week Modified: head/sys/sparc64/pci/ofw_pcib.c Modified: head/sys/sparc64/pci/ofw_pcib.c == --- head/sys/sparc64/pci/ofw_pcib.c Fri Mar 1 20:33:35 2013 (r247572) +++ head/sys/sparc64/pci/ofw_pcib.c Fri Mar 1 20:34:02 2013 (r247573) @@ -47,8 +47,6 @@ __FBSDID($FreeBSD$); #include dev/ofw/ofw_bus.h #include dev/ofw/openfirm.h -#include machine/bus.h - #include dev/pci/pcireg.h #include dev/pci/pcivar.h #include dev/pci/pcib_private.h @@ -58,8 +56,12 @@ __FBSDID($FreeBSD$); #include sparc64/pci/ofw_pci.h #include sparc64/pci/ofw_pcib_subr.h +#definePCI_DEVID_ALI_M5249 0x524910b9 +#definePCI_VENDOR_PLX 0x10b5 + static device_probe_t ofw_pcib_probe; static device_attach_t ofw_pcib_attach; +static ofw_pci_setup_device_t ofw_pcib_setup_device; static device_method_t ofw_pcib_methods[] = { /* Device interface */ @@ -73,6 +75,7 @@ static device_method_t ofw_pcib_methods[ /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node), + DEVMETHOD(ofw_pci_setup_device, ofw_pcib_setup_device), DEVMETHOD_END }; @@ -81,7 +84,7 @@ static devclass_t pcib_devclass; DEFINE_CLASS_1(pcib, ofw_pcib_driver, ofw_pcib_methods, sizeof(struct ofw_pcib_gen_softc), pcib_driver); -EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, 0, 0, +EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, NULL, NULL, BUS_PASS_BUS); MODULE_DEPEND(ofw_pcib, pci, 1, 1, 1); @@ -104,7 +107,7 @@ ofw_pcib_probe(device_t dev) ISDTYPE(pbdtype, OFW_TYPE_PCIE) ? e : , ISDTYPE(dtype, OFW_TYPE_PCIE) ? e : ); device_set_desc_copy(dev, desc); - return (0); + return (BUS_PROBE_DEFAULT); } #undef ISDTYPE @@ -119,7 +122,6 @@ ofw_pcib_attach(device_t dev) sc = device_get_softc(dev); - /* Quirk handling */ switch (pci_get_devid(dev)) { /* * The ALi M5249 found in Fire-based machines by definition must me @@ -127,13 +129,46 @@ ofw_pcib_attach(device_t dev) * don't indicate this in the class code although the ISA I/O range * isn't included in their bridge decode. */ - case 0x524910b9: + case PCI_DEVID_ALI_M5249: sc-ops_pcib_sc.flags |= PCIB_SUBTRACTIVE; break; } + switch (pci_get_vendor(dev)) { + /* +* Concurrently write the primary and secondary bus numbers in order +* to work around a bug in PLX PEX 8114 causing the internal shadow +* copies of these not to be updated when setting them bytewise. +*/ + case PCI_VENDOR_PLX: + pci_write_config(dev, PCIR_PRIBUS_1, + pci_read_config(dev, PCIR_SECBUS_1, 1) 8 | + pci_read_config(dev, PCIR_PRIBUS_1, 1), 2); + break; + } + ofw_pcib_gen_setup(dev); pcib_attach_common(dev); device_add_child(dev, pci, -1); return (bus_generic_attach(dev)); } + +static void +ofw_pcib_setup_device(device_t bus, device_t child) +{ + int i; + uint16_t reg; + + switch (pci_get_vendor(bus)) { + /* +* For PLX PEX 8532 issue 64 TLPs to the child from the downstream +* port to the child device in order to work around a hardware bug. +*/ + case PCI_VENDOR_PLX: + for (i = 0, reg = 0; i 64; i++) + reg |= pci_get_devid(child); + break; + } + + OFW_PCI_SETUP_DEVICE(device_get_parent(bus), child); +} ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247574 - head/sys/sparc64/pci
Author: marius Date: Fri Mar 1 20:36:59 2013 New Revision: 247574 URL: http://svnweb.freebsd.org/changeset/base/247574 Log: - In sbbc_pci_attach() just pass the already obtained bus tag and handle instead of acquiring these anew. - Use NULL instead of 0 for pointers. MFC after:1 week Modified: head/sys/sparc64/pci/sbbc.c Modified: head/sys/sparc64/pci/sbbc.c == --- head/sys/sparc64/pci/sbbc.c Fri Mar 1 20:34:02 2013(r247573) +++ head/sys/sparc64/pci/sbbc.c Fri Mar 1 20:36:59 2013(r247574) @@ -299,7 +299,7 @@ static device_method_t sbbc_pci_methods[ static devclass_t sbbc_devclass; DEFINE_CLASS_0(sbbc, sbbc_driver, sbbc_pci_methods, sizeof(struct sbbc_softc)); -DRIVER_MODULE(sbbc, pci, sbbc_driver, sbbc_devclass, 0, 0); +DRIVER_MODULE(sbbc, pci, sbbc_driver, sbbc_devclass, NULL, NULL); static int sbbc_pci_probe(device_t dev) @@ -358,8 +358,7 @@ sbbc_pci_attach(device_t dev) if (error != 0) device_printf(dev, failed to attach UART device\n); } else { - error = sbbc_parse_toc(rman_get_bustag(sc-sc_res), - rman_get_bushandle(sc-sc_res)); + error = sbbc_parse_toc(bst, bsh); if (error != 0) { device_printf(dev, failed to parse TOC\n); if (sbbc_console != 0) { @@ -609,7 +608,7 @@ static device_method_t sbbc_uart_sbbc_me DEFINE_CLASS_0(uart, sbbc_uart_driver, sbbc_uart_sbbc_methods, sizeof(struct uart_softc)); -DRIVER_MODULE(uart, sbbc, sbbc_uart_driver, uart_devclass, 0, 0); +DRIVER_MODULE(uart, sbbc, sbbc_uart_driver, uart_devclass, NULL, NULL); static int sbbc_uart_sbbc_probe(device_t dev) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247579 - head/sys/dev/cas
Author: marius Date: Fri Mar 1 20:51:53 2013 New Revision: 247579 URL: http://svnweb.freebsd.org/changeset/base/247579 Log: - Move reporting of failures to disable RX/TX MAC under bootverbose as at least the Saturn chips of 501-6738 cards may fail to do so the first time, which isn't fatal though. Reported by: Paul Keusemann - Explain why we don't enable infinite bursts on sparc64. - Given that these chips support memory write invalidate, make sure that it's enabled in the command register. Also make sure that PERR# and SERR# assertion is enabled. MFC after:1 week Modified: head/sys/dev/cas/if_cas.c Modified: head/sys/dev/cas/if_cas.c == --- head/sys/dev/cas/if_cas.c Fri Mar 1 20:49:56 2013(r247578) +++ head/sys/dev/cas/if_cas.c Fri Mar 1 20:51:53 2013(r247579) @@ -824,7 +824,8 @@ cas_disable_rx(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); if (cas_bitwait(sc, CAS_MAC_RX_CONF, CAS_MAC_RX_CONF_EN, 0)) return (1); - device_printf(sc-sc_dev, cannot disable RX MAC\n); + if (bootverbose) + device_printf(sc-sc_dev, cannot disable RX MAC\n); return (0); } @@ -838,7 +839,8 @@ cas_disable_tx(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); if (cas_bitwait(sc, CAS_MAC_TX_CONF, CAS_MAC_TX_CONF_EN, 0)) return (1); - device_printf(sc-sc_dev, cannot disable TX MAC\n); + if (bootverbose) + device_printf(sc-sc_dev, cannot disable TX MAC\n); return (0); } @@ -1041,7 +1043,8 @@ cas_init_locked(struct cas_softc *sc) /* * Enable infinite bursts for revisions without PCI issues if * applicable. Doing so greatly improves the TX performance on -* !__sparc64__. +* !__sparc64__ (on sparc64, setting CAS_INF_BURST improves TX +* performance only marginally but hurts RX throughput quite a bit). */ CAS_WRITE_4(sc, CAS_INF_BURST, #if !defined(__sparc64__) @@ -2691,7 +2694,10 @@ cas_pci_attach(device_t dev) return (ENXIO); } - pci_enable_busmaster(dev); + /* PCI configuration */ + pci_write_config(dev, PCIR_COMMAND, + pci_read_config(dev, PCIR_COMMAND, 2) | PCIM_CMD_BUSMASTEREN | + PCIM_CMD_MWRICEN | PCIM_CMD_PERRESPEN | PCIM_CMD_SERRESPEN, 2); sc-sc_dev = dev; if (sc-sc_variant == CAS_CAS pci_get_devid(dev) 0x02) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247584 - head/sys/kern
Author: pjd Date: Fri Mar 1 21:57:02 2013 New Revision: 247584 URL: http://svnweb.freebsd.org/changeset/base/247584 Log: Reduce lock scope a little. Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c == --- head/sys/kern/vfs_syscalls.cFri Mar 1 21:35:53 2013 (r247583) +++ head/sys/kern/vfs_syscalls.cFri Mar 1 21:57:02 2013 (r247584) @@ -2633,9 +2633,9 @@ setfflags(td, vp, flags) if ((error = vn_start_write(vp, mp, V_WAIT | PCATCH)) != 0) return (error); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); VATTR_NULL(vattr); vattr.va_flags = flags; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); #ifdef MAC error = mac_vnode_check_setflags(td-td_ucred, vp, vattr.va_flags); if (error == 0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247585 - in head: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs
Author: mm Date: Fri Mar 1 21:58:51 2013 New Revision: 247585 URL: http://svnweb.freebsd.org/changeset/base/247585 Log: MFV r247316: Merge new read-only zfs properties from vendor (illumos) Illumos ZFS issues: 3588 provide zfs properties for logical (uncompressed) space used and referenced References: https://www.illumos.org/issues/3588 MFC after:2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 == --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Mar 1 21:57:02 2013 (r247584) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Mar 1 21:58:51 2013 (r247585) @@ -526,6 +526,39 @@ if the snapshot has been marked for defe .Qq Nm Cm destroy -d command. Otherwise, the property is .Cm off . +.It Sy logicalreferenced +The amount of space that is +.Qq logically +accessible by this dataset. +See the +.Sy referenced +property. +The logical space ignores the effect of the +.Sy compression +and +.Sy copies +properties, giving a quantity closer to the amount of data that applications +see. +However, it does include space consumed by metadata. +.Pp +This property can also be referred to by its shortened column name, +.Sy lrefer . +.It Sy logicalused +The amount of space that is +.Qq logically +consumed by this dataset and all its descendents. +See the +.Sy used +property. +The logical space ignores the effect of the +.Sy compression +and +.Sy copies +properties, giving a quantity closer to the amount of data that applications +see. +.Pp +This property can also be referred to by its shortened column name, +.Sy lused . .It Sy mounted For file systems, indicates whether the file system is currently mounted. This property can be either Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c == --- head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Fri Mar 1 21:57:02 2013(r247584) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Fri Mar 1 21:58:51 2013(r247585) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -350,6 +350,10 @@ zfs_prop_init(void) ZFS_TYPE_SNAPSHOT, count, USERREFS); zprop_register_number(ZFS_PROP_WRITTEN, written, 0, PROP_READONLY, ZFS_TYPE_DATASET, size, WRITTEN); + zprop_register_number(ZFS_PROP_LOGICALUSED, logicalused, 0, + PROP_READONLY, ZFS_TYPE_DATASET, size, LUSED); + zprop_register_number(ZFS_PROP_LOGICALREFERENCED, logicalreferenced, + 0, PROP_READONLY, ZFS_TYPE_DATASET, size, LREFER); /* default number properties */ zprop_register_number(ZFS_PROP_QUOTA, quota, 0, PROP_DEFAULT, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Mar 1 21:57:02 2013(r247584) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Mar 1 21:58:51 2013(r247585) @@ -2344,6 +2344,8 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvl (ds-ds_phys-ds_uncompressed_bytes * 100 / ds-ds_phys-ds_compressed_bytes); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, ratio); + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALREFERENCED, + ds-ds_phys-ds_uncompressed_bytes); if (ds-ds_phys-ds_next_snap_obj) { /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Fri Mar 1 21:57:02 2013(r247584) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Fri Mar 1 21:58:51 2013(r247585) @@ -541,6 +541,8 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *n dd-dd_phys-dd_compressed_bytes == 0 ? 100 : (dd-dd_phys-dd_uncompressed_bytes * 100 / dd-dd_phys-dd_compressed_bytes)); + dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALUSED, + dd-dd_phys-dd_uncompressed_bytes); if (dd-dd_phys-dd_flags DD_FLAG_USED_BREAKDOWN) {
svn commit: r247586 - head/sys/kern
Author: pjd Date: Fri Mar 1 21:58:56 2013 New Revision: 247586 URL: http://svnweb.freebsd.org/changeset/base/247586 Log: Remove unnecessary variables. Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Fri Mar 1 21:58:51 2013(r247585) +++ head/sys/kern/vfs_vnops.c Fri Mar 1 21:58:56 2013(r247586) @@ -1860,7 +1860,6 @@ vn_chmod(struct file *fp, mode_t mode, s struct thread *td) { struct vnode *vp; - int error; vp = fp-f_vnode; #ifdef AUDIT @@ -1868,8 +1867,7 @@ vn_chmod(struct file *fp, mode_t mode, s AUDIT_ARG_VNODE1(vp); VOP_UNLOCK(vp, 0); #endif - error = setfmode(td, active_cred, vp, mode); - return (error); + return (setfmode(td, active_cred, vp, mode)); } int @@ -1877,7 +1875,6 @@ vn_chown(struct file *fp, uid_t uid, gid struct thread *td) { struct vnode *vp; - int error; vp = fp-f_vnode; #ifdef AUDIT @@ -1885,8 +1882,7 @@ vn_chown(struct file *fp, uid_t uid, gid AUDIT_ARG_VNODE1(vp); VOP_UNLOCK(vp, 0); #endif - error = setfown(td, active_cred, vp, uid, gid); - return (error); + return (setfown(td, active_cred, vp, uid, gid)); } void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247587 - head/sys/arm/include
Author: andrew Date: Fri Mar 1 21:59:23 2013 New Revision: 247587 URL: http://svnweb.freebsd.org/changeset/base/247587 Log: Increase the maximum text size on ARM to 64MiB. Without this clang would be sent a SIGABRT when it is loaded as it is too large. This is the smallest power of two MiB value that allows us to execute clang. While here wrap it in an #ifndef to be consistent with the other architectures. Submitted by: Daisuke Aoyama aoyama at peach.ne.jp Modified: head/sys/arm/include/vmparam.h Modified: head/sys/arm/include/vmparam.h == --- head/sys/arm/include/vmparam.h Fri Mar 1 21:58:56 2013 (r247586) +++ head/sys/arm/include/vmparam.h Fri Mar 1 21:59:23 2013 (r247587) @@ -153,7 +153,9 @@ VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5) #endif -#define MAXTSIZ(16*1024*1024) +#ifndef MAXTSIZ +#define MAXTSIZ(64*1024*1024) +#endif #ifndef DFLDSIZ #define DFLDSIZ (128*1024*1024) #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247588 - in head/sys: dev/mps kern sys
Author: jhb Date: Fri Mar 1 22:03:31 2013 New Revision: 247588 URL: http://svnweb.freebsd.org/changeset/base/247588 Log: Replace the TDP_NOSLEEPING flag with a counter so that the THREAD_NO_SLEEPING() and THREAD_SLEEPING_OK() macros can nest. Reviewed by: attilio Modified: head/sys/dev/mps/mps.c head/sys/kern/subr_sleepqueue.c head/sys/kern/subr_trap.c head/sys/sys/proc.h head/sys/sys/rmlock.h Modified: head/sys/dev/mps/mps.c == --- head/sys/dev/mps/mps.c Fri Mar 1 21:59:23 2013(r247587) +++ head/sys/dev/mps/mps.c Fri Mar 1 22:03:31 2013(r247588) @@ -136,8 +136,8 @@ mps_diag_reset(struct mps_softc *sc,int /*Force NO_SLEEP for threads prohibited to sleep * e.a Thread from interrupt handler are prohibited to sleep. - */ - if(curthread-td_pflags TDP_NOSLEEPING) + */ + if (curthread-td_no_sleeping != 0) sleep_flag = NO_SLEEP; /* Push the magic sequence */ @@ -469,8 +469,8 @@ mps_request_sync(struct mps_softc *sc, v uint16_t *data16; int i, count, ioc_sz, residual; int sleep_flags = CAN_SLEEP; - - if(curthread-td_pflags TDP_NOSLEEPING) + + if (curthread-td_no_sleeping != 0) sleep_flags = NO_SLEEP; /* Step 1 */ Modified: head/sys/kern/subr_sleepqueue.c == --- head/sys/kern/subr_sleepqueue.c Fri Mar 1 21:59:23 2013 (r247587) +++ head/sys/kern/subr_sleepqueue.c Fri Mar 1 22:03:31 2013 (r247588) @@ -296,8 +296,8 @@ sleepq_add(void *wchan, struct lock_obje MPASS((queue = 0) (queue NR_SLEEPQS)); /* If this thread is not allowed to sleep, die a horrible death. */ - KASSERT(!(td-td_pflags TDP_NOSLEEPING), - (%s: td %p to sleep on wchan %p with TDP_NOSLEEPING on, + KASSERT(td-td_no_sleeping == 0, + (%s: td %p to sleep on wchan %p with sleeping prohibited, __func__, td, wchan)); /* Look up the sleep queue associated with the wait channel 'wchan'. */ Modified: head/sys/kern/subr_trap.c == --- head/sys/kern/subr_trap.c Fri Mar 1 21:59:23 2013(r247587) +++ head/sys/kern/subr_trap.c Fri Mar 1 22:03:31 2013(r247588) @@ -158,7 +158,7 @@ userret(struct thread *td, struct trapfr (userret: Returning with %d locks held, td-td_locks)); KASSERT((td-td_pflags TDP_NOFAULTING) == 0, (userret: Returning with pagefaults disabled)); - KASSERT((td-td_pflags TDP_NOSLEEPING) == 0, + KASSERT(td-td_no_sleeping == 0, (userret: Returning with sleep disabled)); KASSERT(td-td_pinned == 0 || (td-td_pflags TDP_CALLCHAIN) != 0, (userret: Returning with with pinned thread)); Modified: head/sys/sys/proc.h == --- head/sys/sys/proc.h Fri Mar 1 21:59:23 2013(r247587) +++ head/sys/sys/proc.h Fri Mar 1 22:03:31 2013(r247588) @@ -273,6 +273,7 @@ struct thread { struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */ pid_t td_dbg_forked; /* (c) Child pid for debugger. */ u_int td_vp_reserv; /* (k) Count of reserved vnodes. */ + int td_no_sleeping; /* (k) Sleeping disabled count. */ #definetd_endzero td_sigmask /* Copied during fork1() or create_thread(). */ @@ -404,7 +405,7 @@ do { \ #defineTDP_ALTSTACK0x0020 /* Have alternate signal stack. */ #defineTDP_DEADLKTREAT 0x0040 /* Lock aquisition - deadlock treatment. */ #defineTDP_NOFAULTING 0x0080 /* Do not handle page faults. */ -#defineTDP_NOSLEEPING 0x0100 /* Thread is not allowed to sleep on a sq. */ +#defineTDP_UNUSED9 0x0100 /* --available-- */ #defineTDP_OWEUPC 0x0200 /* Call addupc() at next AST. */ #defineTDP_ITHREAD 0x0400 /* Thread is an interrupt thread. */ #defineTDP_SYNCIO 0x0800 /* Local override, disable async i/o. */ @@ -790,17 +791,9 @@ extern pid_t pid_max; #definethread_safetoswapout(td)((td)-td_flags TDF_CANSWAP) /* Control whether or not it is safe for curthread to sleep. */ -#defineTHREAD_NO_SLEEPING() do { \ - KASSERT(!(curthread-td_pflags TDP_NOSLEEPING), \ - (nested no sleeping));\ - curthread-td_pflags |= TDP_NOSLEEPING; \ -} while (0) +#defineTHREAD_NO_SLEEPING()((curthread)-td_no_sleeping++) -#define
svn commit: r247590 - head/sys/dev/bce
Author: marius Date: Fri Mar 1 22:05:20 2013 New Revision: 247590 URL: http://svnweb.freebsd.org/changeset/base/247590 Log: Initialize count in order to appease clang. Submitted by: delphij Modified: head/sys/dev/bce/if_bce.c Modified: head/sys/dev/bce/if_bce.c == --- head/sys/dev/bce/if_bce.c Fri Mar 1 22:03:57 2013(r247589) +++ head/sys/dev/bce/if_bce.c Fri Mar 1 22:05:20 2013(r247590) @@ -1076,6 +1076,7 @@ bce_attach(device_t dev) bce_probe_pci_caps(dev, sc); rid = 1; + count = 0; #if 0 /* Try allocating MSI-X interrupts. */ if ((sc-bce_cap_flags BCE_MSIX_CAPABLE_FLAG) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247591 - head/sys/dev/aac
Author: marius Date: Fri Mar 1 22:09:08 2013 New Revision: 247591 URL: http://svnweb.freebsd.org/changeset/base/247591 Log: Initialize count in order to appease clang. Submitted by: delphij Modified: head/sys/dev/aac/aac_pci.c Modified: head/sys/dev/aac/aac_pci.c == --- head/sys/dev/aac/aac_pci.c Fri Mar 1 22:05:20 2013(r247590) +++ head/sys/dev/aac/aac_pci.c Fri Mar 1 22:09:08 2013(r247591) @@ -394,6 +394,7 @@ aac_pci_attach(device_t dev) * Allocate the interrupt. */ rid = 0; + count = 0; if (aac_enable_msi != 0 pci_find_cap(dev, PCIY_MSI, reg) == 0) { count = pci_msi_count(dev); if (count 1) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247592 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: delphij Date: Fri Mar 1 22:20:13 2013 New Revision: 247592 URL: http://svnweb.freebsd.org/changeset/base/247592 Log: MFV r247575: Import a fix tighten assertion on SPA versions from vendor (Illumos). Illumos ZFS issue: 3543 Feature flags causes assertion in spa.c to miss certain cases MFC after:2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Mar 1 22:09:08 2013(r247591) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Mar 1 22:20:13 2013(r247592) @@ -6018,7 +6018,7 @@ spa_sync_version(void *arg1, void *arg2, */ ASSERT(tx-tx_txg != TXG_INITIAL); - ASSERT(version = SPA_VERSION); + ASSERT(SPA_VERSION_IS_SUPPORTED(version)); ASSERT(version = spa_version(spa)); spa-spa_uberblock.ub_version = version; @@ -6559,7 +6559,7 @@ spa_upgrade(spa_t *spa, uint64_t version * future version would result in an unopenable pool, this shouldn't be * possible. */ - ASSERT(spa-spa_uberblock.ub_version = SPA_VERSION); + ASSERT(SPA_VERSION_IS_SUPPORTED(spa-spa_uberblock.ub_version)); ASSERT(version = spa-spa_uberblock.ub_version); spa-spa_uberblock.ub_version = version; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r247588 - in head/sys: dev/mps kern sys
On Fri, Mar 1, 2013 at 11:03 PM, John Baldwin j...@freebsd.org wrote: Author: jhb Date: Fri Mar 1 22:03:31 2013 New Revision: 247588 URL: http://svnweb.freebsd.org/changeset/base/247588 Log: Replace the TDP_NOSLEEPING flag with a counter so that the THREAD_NO_SLEEPING() and THREAD_SLEEPING_OK() macros can nest. Reviewed by: attilio My cleanup had some small tweaks like: - No trailing white space cleanup in mps - td_no_sleeping u_int rather than int - s/TDP_UNUSED9/TDP_UNUSED09 (consistency with others definitions) - There is no need to use braces around curthread Also the rmlock part doesn't belong to this patchset. http://www.freebsd.org/~attilio/jhbnosleep.patch Attilio -- Peace can only be achieved by understanding - A. Einstein ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247594 - head/sys/dev/mfi
Author: delphij Date: Fri Mar 1 23:18:20 2013 New Revision: 247594 URL: http://svnweb.freebsd.org/changeset/base/247594 Log: Fix a typo in mfi_stp_cmd() that would give wrong assignment. Submitted by: Sascha Wildner saw online de Obtained from:DragonFly rev 0dc98fff2206d7bb78ce5e07ac34d6954e4bd96a MFC after:3 days Modified: head/sys/dev/mfi/mfi.c Modified: head/sys/dev/mfi/mfi.c == --- head/sys/dev/mfi/mfi.c Fri Mar 1 22:40:30 2013(r247593) +++ head/sys/dev/mfi/mfi.c Fri Mar 1 23:18:20 2013(r247594) @@ -2997,7 +2997,7 @@ mfi_stp_cmd(struct mfi_softc *sc, struct cm-cm_frame-stp.sgl.sg64[i].len = ioc-mfi_sgl[i].iov_len; } else { - cm-cm_frame-stp.sgl.sg32[i].len = + cm-cm_frame-stp.sgl.sg32[i].addr = kern_sge[i].phys_addr; cm-cm_frame-stp.sgl.sg32[i].len = ioc-mfi_sgl[i].iov_len; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247595 - head/sys/compat/ndis
Author: delphij Date: Fri Mar 1 23:21:18 2013 New Revision: 247595 URL: http://svnweb.freebsd.org/changeset/base/247595 Log: Fix wrong assignment. Submitted by: Sascha Wildner saw online de Obtained from:DragonFly rev 9568dd07a22a136e380e6c19a8ea188eb92976d5 MFC after:2 weeks Modified: head/sys/compat/ndis/kern_ndis.c Modified: head/sys/compat/ndis/kern_ndis.c == --- head/sys/compat/ndis/kern_ndis.cFri Mar 1 23:18:20 2013 (r247594) +++ head/sys/compat/ndis/kern_ndis.cFri Mar 1 23:21:18 2013 (r247595) @@ -566,7 +566,7 @@ ndis_convert_res(arg) return (ENOMEM); rl-cprl_version = 5; - rl-cprl_version = 1; + rl-cprl_revision = 1; rl-cprl_count = sc-ndis_rescnt; prd = rl-cprl_partial_descs; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r247274 - in head: bin/test tools/regression/bin/test
On Friday, 1 March 2013 at 17:13:45 +, Chris Rees wrote: On 1 Mar 2013 14:27, Jilles Tjoelker jil...@stack.nl wrote: The find(1) and stat(1) approaches also work in other shells such as bash, ksh and zsh. An extension to test(1) can only be used by writing ugly things like /bin/test. Whatever you may think of it, people write scripts for those other shells and it is somewhat unfortunate that they cannot use all FreeBSD-specific features. +1 While I'm aware that we have many very useful extensions to sh, we should not sacrifice portability. This doesn't sacrifice portability. If you're aiming for complete portability, you may choose not to use these extensions, or to find alternatives for non-FreeBSD systems. This goes for just about every utility. We (porters) are on thin ground when complaining at upstream for assuming /bin/sh is bash when we have extensions such as these. There's a difference between having extensions and expecting them to be present everywhere. But you have a point: it should be documented that these extensions (and also , , -nt, -ot and -ef) are not portable. Greg -- Sent from my desktop computer. Finger g...@freebsd.org for PGP public key. See complete headers for address and phone numbers. This message is digitally signed. If your Microsoft MUA reports problems, please read http://tinyurl.com/broken-mua pgprIdRCj8BsR.pgp Description: PGP signature
svn commit: r247596 - head/lib/libc/regex
Author: delphij Date: Fri Mar 1 23:26:13 2013 New Revision: 247596 URL: http://svnweb.freebsd.org/changeset/base/247596 Log: Fix assignment of maximum bounadary. Submitted by: Sascha Wildner saw online de Obtained from:DragonFly rev fd39c81ba220f7ad6e4dc9b30d45e828cf58a1ad MFC after:2 weeks Modified: head/lib/libc/regex/regcomp.c Modified: head/lib/libc/regex/regcomp.c == --- head/lib/libc/regex/regcomp.c Fri Mar 1 23:21:18 2013 (r247595) +++ head/lib/libc/regex/regcomp.c Fri Mar 1 23:26:13 2013 (r247596) @@ -1212,7 +1212,7 @@ CHaddrange(struct parse *p, cset *cs, wi } cs-ranges = newranges; cs-ranges[cs-nranges].min = min; - cs-ranges[cs-nranges].min = max; + cs-ranges[cs-nranges].max = max; cs-nranges++; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247598 - in head/lib/libc: gen sys
Author: pjd Date: Sat Mar 2 00:11:27 2013 New Revision: 247598 URL: http://svnweb.freebsd.org/changeset/base/247598 Log: Provide cap_sandboxed(3) function, which is a wrapper around cap_getmode(2) system call, which has a nice property - it never fails, so it is a bit easier to use. If there is no support for capability mode in the kernel the function will return false (not in a sandbox). If the kernel is compiled with the support for capability mode, the function will return true or false depending if the calling process is in the capability mode sandbox or not respectively. Sponsored by: The FreeBSD Foundation Added: head/lib/libc/gen/cap_sandboxed.3 (contents, props changed) head/lib/libc/gen/cap_sandboxed.c (contents, props changed) Modified: head/lib/libc/gen/Makefile.inc head/lib/libc/sys/Symbol.map head/lib/libc/sys/cap_enter.2 Modified: head/lib/libc/gen/Makefile.inc == --- head/lib/libc/gen/Makefile.inc Sat Mar 2 00:04:07 2013 (r247597) +++ head/lib/libc/gen/Makefile.inc Sat Mar 2 00:11:27 2013 (r247598) @@ -16,6 +16,7 @@ SRCS+=__getosreldate.c \ assert.c \ auxv.c \ basename.c \ + cap_sandboxed.c \ check_utility_compat.c \ clock.c \ clock_getcpuclockid.c \ @@ -168,6 +169,7 @@ SYM_MAPS+=${.CURDIR}/gen/Symbol.map MAN+= alarm.3 \ arc4random.3 \ basename.3 \ + cap_sandboxed.3 \ check_utility_compat.3 \ clock.3 \ clock_getcpuclockid.3 \ Added: head/lib/libc/gen/cap_sandboxed.3 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/cap_sandboxed.3 Sat Mar 2 00:11:27 2013 (r247598) @@ -0,0 +1,70 @@ +.\ Copyright (c) 2012 The FreeBSD Foundation +.\ All rights reserved. +.\ +.\ This documentation was written by Pawel Jakub Dawidek under sponsorship +.\ from the FreeBSD Foundation. +.\ +.\ 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 September 18, 2012 +.Dt CAP_SANDBOXED 3 +.Os +.Sh NAME +.Nm cap_sandboxed +.Nd Check if in a capability mode sandbox +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/capability.h +.In stdbool.h +.Ft bool +.Fn cap_sandboxed void +.Sh DESCRIPTION +.Fn cap_sandboxed +returns +.Va true +if the process is in a capability mode sandbox or +.Va false +if it is not. +This function is a more handy alternative to the +.Xr cap_getmode 2 +system call as it always succeeds, so there is no need for error checking. +If the support for capability mode is not compiled into the kernel, +.Fn cap_sandboxed +will always return +.Va false . +.Sh RETURN VALUES +Function +.Fn cap_sandboxed +is always successful and will return either +.Va true +or +.Va false . +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr capsicum 4 +.Sh AUTHORS +This function was implemented and manual page was written by +.An Pawel Jakub Dawidek Aq pa...@dawidek.net +under sponsorship of the FreeBSD Foundation. Added: head/lib/libc/gen/cap_sandboxed.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/cap_sandboxed.c Sat Mar 2 00:11:27 2013 (r247598) @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2012 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Pawel Jakub Dawidek under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following
svn commit: r247600 - in head/sys: conf sparc64/pci
Author: marius Date: Sat Mar 2 00:37:31 2013 New Revision: 247600 URL: http://svnweb.freebsd.org/changeset/base/247600 Log: - While Netra X1 generally show no ill effects when registering a power fail interrupt handler, there seems to be either a broken batch of them or a tendency to develop a defect which causes this interrupt to fire inadvertedly. Given that apart from this problem these machines work just fine, add a tunable allowing the setup of the power fail interrupt to be disabled. While at it, remove the DEBUGGER_ON_POWERFAIL compile time option and make that behavior also selectable via the newly added tunable. - Apparently, it's no longer a problem to call shutdown_nice(9) from within an interrupt filter (some other drivers in the tree do the same). So change the power fail interrupt from an handler in order to simplify the code and get rid of a !INTR_MPSAFE handler. - Use NULL instead of 0 for pointers. MFC after:1 week Modified: head/sys/conf/options.sparc64 head/sys/sparc64/pci/psycho.c Modified: head/sys/conf/options.sparc64 == --- head/sys/conf/options.sparc64 Sat Mar 2 00:21:29 2013 (r247599) +++ head/sys/conf/options.sparc64 Sat Mar 2 00:37:31 2013 (r247600) @@ -23,7 +23,6 @@ PSM_DEBUG opt_psm.h PSM_HOOKRESUME opt_psm.h PSM_RESETAFTERSUSPEND opt_psm.h -DEBUGGER_ON_POWERFAIL opt_psycho.h PSYCHO_DEBUG opt_psycho.h SCHIZO_DEBUG opt_schizo.h Modified: head/sys/sparc64/pci/psycho.c == --- head/sys/sparc64/pci/psycho.c Sat Mar 2 00:21:29 2013 (r247599) +++ head/sys/sparc64/pci/psycho.c Sat Mar 2 00:37:31 2013 (r247600) @@ -54,6 +54,7 @@ __FBSDID($FreeBSD$); #include sys/pcpu.h #include sys/reboot.h #include sys/rman.h +#include sys/sysctl.h #include dev/ofw/ofw_bus.h #include dev/ofw/ofw_pci.h @@ -80,7 +81,7 @@ static const struct psycho_desc *psycho_ const char *); static const struct psycho_desc *psycho_get_desc(device_t); static void psycho_set_intr(struct psycho_softc *, u_int, bus_addr_t, -driver_filter_t, driver_intr_t); +driver_filter_t); static int psycho_find_intrmap(struct psycho_softc *, u_int, bus_addr_t *, bus_addr_t *, u_long *); static void sabre_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, @@ -94,8 +95,9 @@ static void psycho_intr_clear(void *); static driver_filter_t psycho_ue; static driver_filter_t psycho_ce; static driver_filter_t psycho_pci_bus; -static driver_filter_t psycho_powerfail; -static driver_intr_t psycho_overtemp; +static driver_filter_t psycho_powerdebug; +static driver_filter_t psycho_powerdown; +static driver_filter_t psycho_overtemp; #ifdef PSYCHO_MAP_WAKEUP static driver_filter_t psycho_wakeup; #endif @@ -159,9 +161,16 @@ static devclass_t psycho_devclass; DEFINE_CLASS_0(pcib, psycho_driver, psycho_methods, sizeof(struct psycho_softc)); -EARLY_DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, 0, 0, +EARLY_DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, NULL, NULL, BUS_PASS_BUS); +static SYSCTL_NODE(_hw, OID_AUTO, psycho, CTLFLAG_RD, 0, psycho parameters); + +static u_int psycho_powerfail = 1; +TUNABLE_INT(hw.psycho.powerfail, psycho_powerfail); +SYSCTL_UINT(_hw_psycho, OID_AUTO, powerfail, CTLFLAG_RDTUN, psycho_powerfail, +0, powerfail action (0: none, 1: shutdown (default), 2: debugger)); + static SLIST_HEAD(, psycho_softc) psycho_softcs = SLIST_HEAD_INITIALIZER(psycho_softcs); @@ -610,15 +619,20 @@ psycho_attach(device_t dev) * XXX Not all controllers have these, but installing them * is better than trying to sort through this mess. */ - psycho_set_intr(sc, 1, PSR_UE_INT_MAP, psycho_ue, NULL); - psycho_set_intr(sc, 2, PSR_CE_INT_MAP, psycho_ce, NULL); -#ifdef DEBUGGER_ON_POWERFAIL - psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, psycho_powerfail, - NULL); -#else - psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, NULL, - (driver_intr_t *)psycho_powerfail); -#endif + psycho_set_intr(sc, 1, PSR_UE_INT_MAP, psycho_ue); + psycho_set_intr(sc, 2, PSR_CE_INT_MAP, psycho_ce); + switch (psycho_powerfail) { + case 0: + break; + case 2: + psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, + psycho_powerdebug); + break; + default: + psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, + psycho_powerdown); + break; + } if (sc-sc_mode == PSYCHO_MODE_PSYCHO) {
svn commit: r247601 - head/sys/sparc64/sbus
Author: marius Date: Sat Mar 2 00:41:51 2013 New Revision: 247601 URL: http://svnweb.freebsd.org/changeset/base/247601 Log: - Apparently, it's no longer a problem to call shutdown_nice(9) from within an interrupt filter (some other drivers in the tree do the same). So change the overtemperature and power fail interrupts from handlers in order to code and get rid of a !INTR_MPSAFE handlers. - Mark unused parameters as such. - Use NULL instead of 0 for pointers. MFC after:1 week Modified: head/sys/sparc64/sbus/sbus.c Modified: head/sys/sparc64/sbus/sbus.c == --- head/sys/sparc64/sbus/sbus.cSat Mar 2 00:37:31 2013 (r247600) +++ head/sys/sparc64/sbus/sbus.cSat Mar 2 00:41:51 2013 (r247601) @@ -152,8 +152,8 @@ static void sbus_intr_assign(void *); static void sbus_intr_clear(void *); static int sbus_find_intrmap(struct sbus_softc *, u_int, bus_addr_t *, bus_addr_t *); -static driver_intr_t sbus_overtemp; -static driver_intr_t sbus_pwrfail; +static driver_filter_t sbus_overtemp; +static driver_filter_t sbus_pwrfail; static int sbus_print_res(struct sbus_devinfo *); static device_method_t sbus_methods[] = { @@ -199,7 +199,7 @@ static driver_t sbus_driver = { static devclass_t sbus_devclass; -EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0, +EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, NULL, NULL, BUS_PASS_BUS); MODULE_DEPEND(sbus, nexus, 1, 1, 1); MODULE_VERSION(sbus, 1); @@ -410,7 +410,7 @@ sbus_attach(device_t dev) INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec || intr_vectors[vec].iv_ic != sbus_ic || bus_setup_intr(dev, sc-sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE, - NULL, sbus_overtemp, sc, sc-sc_ot_ihand) != 0) + sbus_overtemp, NULL, sc, sc-sc_ot_ihand) != 0) panic(%s: failed to set up temperature interrupt, __func__); i = 3; sc-sc_pf_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, i, @@ -420,7 +420,7 @@ sbus_attach(device_t dev) INTVEC(SYSIO_READ8(sc, SBR_POWER_INT_MAP)) != vec || intr_vectors[vec].iv_ic != sbus_ic || bus_setup_intr(dev, sc-sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE, - NULL, sbus_pwrfail, sc, sc-sc_pf_ihand) != 0) + sbus_pwrfail, NULL, sc, sc-sc_pf_ihand) != 0) panic(%s: failed to set up power fail interrupt, __func__); /* Initialize the counter-timer. */ @@ -897,31 +897,33 @@ sbus_get_devinfo(device_t bus, device_t * This handles the interrupt and powers off the machine. * The same needs to be done to PCI controller drivers. */ -static void -sbus_overtemp(void *arg) +static int +sbus_overtemp(void *arg __unused) { static int shutdown; /* As the interrupt is cleared we may be called multiple times. */ if (shutdown != 0) - return; + return (FILTER_HANDLED); shutdown++; printf(DANGER: OVER TEMPERATURE detected\nShutting down NOW.\n); shutdown_nice(RB_POWEROFF); + return (FILTER_HANDLED); } /* Try to shut down in time in case of power failure. */ -static void -sbus_pwrfail(void *arg) +static int +sbus_pwrfail(void *arg __unused) { static int shutdown; /* As the interrupt is cleared we may be called multiple times. */ if (shutdown != 0) - return; + return (FILTER_HANDLED); shutdown++; printf(Power failure detected\nShutting down NOW.\n); - shutdown_nice(0); + shutdown_nice(FILTER_HANDLED); + return (FILTER_HANDLED); } static int ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247602 - in head: contrib/openbsm/etc lib/libc/include lib/libc/sys lib/libprocstat sys/bsm sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/fr...
Author: pjd Date: Sat Mar 2 00:53:12 2013 New Revision: 247602 URL: http://svnweb.freebsd.org/changeset/base/247602 Log: Merge Capsicum overhaul: - Capability is no longer separate descriptor type. Now every descriptor has set of its own capability rights. - The cap_new(2) system call is left, but it is no longer documented and should not be used in new code. - The new syscall cap_rights_limit(2) should be used instead of cap_new(2), which limits capability rights of the given descriptor without creating a new one. - The cap_getrights(2) syscall is renamed to cap_rights_get(2). - If CAP_IOCTL capability right is present we can further reduce allowed ioctls list with the new cap_ioctls_limit(2) syscall. List of allowed ioctls can be retrived with cap_ioctls_get(2) syscall. - If CAP_FCNTL capability right is present we can further reduce fcntls that can be used with the new cap_fcntls_limit(2) syscall and retrive them with cap_fcntls_get(2). - To support ioctl and fcntl white-listing the filedesc structure was heavly modified. - The audit subsystem, kdump and procstat tools were updated to recognize new syscalls. - Capability rights were revised and eventhough I tried hard to provide backward API and ABI compatibility there are some incompatible changes that are described in detail below: CAP_CREATE old behaviour: - Allow for openat(2)+O_CREAT. - Allow for linkat(2). - Allow for symlinkat(2). CAP_CREATE new behaviour: - Allow for openat(2)+O_CREAT. Added CAP_LINKAT: - Allow for linkat(2). ABI: Reuses CAP_RMDIR bit. - Allow to be target for renameat(2). Added CAP_SYMLINKAT: - Allow for symlinkat(2). Removed CAP_DELETE. Old behaviour: - Allow for unlinkat(2) when removing non-directory object. - Allow to be source for renameat(2). Removed CAP_RMDIR. Old behaviour: - Allow for unlinkat(2) when removing directory. Added CAP_RENAMEAT: - Required for source directory for the renameat(2) syscall. Added CAP_UNLINKAT (effectively it replaces CAP_DELETE and CAP_RMDIR): - Allow for unlinkat(2) on any object. - Required if target of renameat(2) exists and will be removed by this call. Removed CAP_MAPEXEC. CAP_MMAP old behaviour: - Allow for mmap(2) with any combination of PROT_NONE, PROT_READ and PROT_WRITE. CAP_MMAP new behaviour: - Allow for mmap(2)+PROT_NONE. Added CAP_MMAP_R: - Allow for mmap(PROT_READ). Added CAP_MMAP_W: - Allow for mmap(PROT_WRITE). Added CAP_MMAP_X: - Allow for mmap(PROT_EXEC). Added CAP_MMAP_RW: - Allow for mmap(PROT_READ | PROT_WRITE). Added CAP_MMAP_RX: - Allow for mmap(PROT_READ | PROT_EXEC). Added CAP_MMAP_WX: - Allow for mmap(PROT_WRITE | PROT_EXEC). Added CAP_MMAP_RWX: - Allow for mmap(PROT_READ | PROT_WRITE | PROT_EXEC). Renamed CAP_MKDIR to CAP_MKDIRAT. Renamed CAP_MKFIFO to CAP_MKFIFOAT. Renamed CAP_MKNODE to CAP_MKNODEAT. CAP_READ old behaviour: - Allow pread(2). - Disallow read(2), readv(2) (if there is no CAP_SEEK). CAP_READ new behaviour: - Allow read(2), readv(2). - Disallow pread(2) (CAP_SEEK was also required). CAP_WRITE old behaviour: - Allow pwrite(2). - Disallow write(2), writev(2) (if there is no CAP_SEEK). CAP_WRITE new behaviour: - Allow write(2), writev(2). - Disallow pwrite(2) (CAP_SEEK was also required). Added convinient defines: #define CAP_PREAD (CAP_SEEK | CAP_READ) #define CAP_PWRITE (CAP_SEEK | CAP_WRITE) #define CAP_MMAP_R (CAP_MMAP | CAP_SEEK | CAP_READ) #define CAP_MMAP_W (CAP_MMAP | CAP_SEEK | CAP_WRITE) #define CAP_MMAP_X (CAP_MMAP | CAP_SEEK | 0x0008ULL) #define CAP_MMAP_RW (CAP_MMAP_R | CAP_MMAP_W) #define CAP_MMAP_RX (CAP_MMAP_R | CAP_MMAP_X) #define CAP_MMAP_WX (CAP_MMAP_W | CAP_MMAP_X) #define CAP_MMAP_RWX(CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X) #define CAP_RECVCAP_READ #define CAP_SENDCAP_WRITE #define CAP_SOCK_CLIENT \ (CAP_CONNECT | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT | \ CAP_PEELOFF | CAP_RECV | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN) #define CAP_SOCK_SERVER \ (CAP_ACCEPT | CAP_BIND | CAP_GETPEERNAME | CAP_GETSOCKNAME | \ CAP_GETSOCKOPT | CAP_LISTEN | CAP_PEELOFF | CAP_RECV | CAP_SEND | \
svn commit: r247604 - in head/sys: compat/freebsd32 kern sys
Author: pjd Date: Sat Mar 2 00:55:09 2013 New Revision: 247604 URL: http://svnweb.freebsd.org/changeset/base/247604 Log: Regen after r247602. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h == --- head/sys/compat/freebsd32/freebsd32_proto.h Sat Mar 2 00:53:16 2013 (r247603) +++ head/sys/compat/freebsd32/freebsd32_proto.h Sat Mar 2 00:55:09 2013 (r247604) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd */ #ifndef _FREEBSD32_SYSPROTO_H_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h == --- head/sys/compat/freebsd32/freebsd32_syscall.h Sat Mar 2 00:53:16 2013(r247603) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Sat Mar 2 00:55:09 2013(r247604) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd */ #defineFREEBSD32_SYS_syscall 0 @@ -416,7 +416,7 @@ #defineFREEBSD32_SYS_freebsd32_shmctl 512 #defineFREEBSD32_SYS_lpathconf 513 #defineFREEBSD32_SYS_cap_new 514 -#defineFREEBSD32_SYS_cap_getrights 515 +#defineFREEBSD32_SYS_cap_rights_get515 #defineFREEBSD32_SYS_cap_enter 516 #defineFREEBSD32_SYS_cap_getmode 517 #defineFREEBSD32_SYS_freebsd32_pselect 522 @@ -430,4 +430,9 @@ #defineFREEBSD32_SYS_freebsd32_posix_fallocate 530 #defineFREEBSD32_SYS_freebsd32_posix_fadvise 531 #defineFREEBSD32_SYS_freebsd32_wait6 532 -#defineFREEBSD32_SYS_MAXSYSCALL533 +#defineFREEBSD32_SYS_cap_rights_limit 533 +#defineFREEBSD32_SYS_cap_ioctls_limit 534 +#defineFREEBSD32_SYS_cap_ioctls_get535 +#defineFREEBSD32_SYS_cap_fcntls_limit 536 +#defineFREEBSD32_SYS_cap_fcntls_get537 +#defineFREEBSD32_SYS_MAXSYSCALL538 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c == --- head/sys/compat/freebsd32/freebsd32_syscalls.c Sat Mar 2 00:53:16 2013(r247603) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Sat Mar 2 00:55:09 2013(r247604) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 242958 2012-11-13 12:52:31Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247602 2013-03-02 00:53:12Z pjd */ const char *freebsd32_syscallnames[] = { @@ -538,7 +538,7 @@ const char *freebsd32_syscallnames[] = { freebsd32_shmctl, /* 512 = freebsd32_shmctl */ lpathconf,/* 513 = lpathconf */ cap_new, /* 514 = cap_new */ - cap_getrights,/* 515 = cap_getrights */ + cap_rights_get, /* 515 = cap_rights_get */ cap_enter,/* 516 = cap_enter */ cap_getmode, /* 517 = cap_getmode */ #518, /* 518 = pdfork */ @@ -556,4 +556,9 @@ const char *freebsd32_syscallnames[] = { freebsd32_posix_fallocate,/* 530 = freebsd32_posix_fallocate */ freebsd32_posix_fadvise, /* 531 = freebsd32_posix_fadvise */ freebsd32_wait6, /* 532 = freebsd32_wait6 */ + cap_rights_limit, /* 533 = cap_rights_limit */ + cap_ioctls_limit, /* 534 = cap_ioctls_limit */ + cap_ioctls_get, /* 535 = cap_ioctls_get */ + cap_fcntls_limit, /* 536 = cap_fcntls_limit */ + cap_fcntls_get, /* 537 = cap_fcntls_get */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c == --- head/sys/compat/freebsd32/freebsd32_sysent.cSat
svn commit: r247605 - head/tools/regression/security/cap_test
Author: pjd Date: Sat Mar 2 00:56:53 2013 New Revision: 247605 URL: http://svnweb.freebsd.org/changeset/base/247605 Log: Update existing regression tests after Capsicum overhaul. Modified: head/tools/regression/security/cap_test/cap_test_capabilities.c head/tools/regression/security/cap_test/cap_test_relative.c Modified: head/tools/regression/security/cap_test/cap_test_capabilities.c == --- head/tools/regression/security/cap_test/cap_test_capabilities.c Sat Mar 2 00:55:09 2013(r247604) +++ head/tools/regression/security/cap_test/cap_test_capabilities.c Sat Mar 2 00:56:53 2013(r247605) @@ -1,8 +1,12 @@ /*- * Copyright (c) 2009-2011 Robert N. M. Watson * Copyright (c) 2011 Jonathan Anderson + * Copyright (c) 2012 FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Pawel Jakub Dawidek under + * sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -43,6 +47,7 @@ __FBSDID($FreeBSD$); #include err.h #include fcntl.h #include poll.h +#include stdint.h #include stdio.h #include stdlib.h #include string.h @@ -60,14 +65,20 @@ __FBSDID($FreeBSD$); */ #defineCHECK_RESULT(syscall, rights_needed, succeeded) do { \ if ((rights (rights_needed)) == (rights_needed)) {\ - if (!(succeeded)) \ + if (succeeded) {\ + if (success == -1) \ + success = PASSED; \ + } else {\ SYSCALL_FAIL(syscall, failed);\ + } \ } else {\ - if (succeeded) \ + if (succeeded) {\ FAILX(%s:\tsucceeded when it shouldn't have \ -(rights 0x%jx), #syscall, rights); \ - else if (errno != ENOTCAPABLE) \ +(rights 0x%jx), #syscall,\ + (uintmax_t)rights); \ + } else if (errno != ENOTCAPABLE) { \ SYSCALL_FAIL(syscall, errno != ENOTCAPABLE); \ + } \ } \ errno = 0; \ } while (0) @@ -79,8 +90,11 @@ __FBSDID($FreeBSD$); if ((rights (rights_needed)) == (rights_needed)) {\ if (p == MAP_FAILED)\ SYSCALL_FAIL(mmap, failed); \ - else\ + else { \ (void)munmap(p, getpagesize()); \ + if (success == -1) \ + success = PASSED; \ + } \ } else {\ if (p != MAP_FAILED) { \ FAILX(%s:\tsucceeded when it shouldn't have \ @@ -97,96 +111,200 @@ __FBSDID($FreeBSD$); * make sure only those rights work. */ static int -try_file_ops(int fd, cap_rights_t rights) +try_file_ops(int filefd, int dirfd, cap_rights_t rights) { struct stat sb; struct statfs sf; - int fd_cap, fd_capcap; + cap_rights_t erights; + int fd_cap, fd_capcap, dfd_cap; ssize_t ssize, ssize2; off_t off; void *p; char ch; int ret, is_nfs; struct pollfd pollfd; - int success = PASSED; + int success = -1; - REQUIRE(fstatfs(fd, sf)); - is_nfs = (strncmp(nfs, sf.f_fstypename, sizeof(sf.f_fstypename)) - == 0); + REQUIRE(fstatfs(filefd, sf)); + is_nfs = (strcmp(nfs, sf.f_fstypename) == 0); - REQUIRE(fd_cap = cap_new(fd, rights)); + REQUIRE(fd_cap = cap_new(filefd, rights)); + CHECK(cap_getrights(fd_cap, erights) == 0); + CHECK(rights == erights); REQUIRE(fd_capcap = cap_new(fd_cap, rights)); + CHECK(cap_getrights(fd_capcap, erights) ==
svn commit: r247606 - in head/tools/regression/capsicum: . syscalls
Author: pjd Date: Sat Mar 2 01:00:26 2013 New Revision: 247606 URL: http://svnweb.freebsd.org/changeset/base/247606 Log: Add regression tests for the new Capsicum system calls. Sponsored by: The FreeBSD Foundation Added: head/tools/regression/capsicum/ head/tools/regression/capsicum/syscalls/ head/tools/regression/capsicum/syscalls/Makefile (contents, props changed) head/tools/regression/capsicum/syscalls/cap_fcntls_limit.c (contents, props changed) head/tools/regression/capsicum/syscalls/cap_getmode.c (contents, props changed) head/tools/regression/capsicum/syscalls/cap_ioctls_limit.c (contents, props changed) head/tools/regression/capsicum/syscalls/misc.c (contents, props changed) head/tools/regression/capsicum/syscalls/misc.h (contents, props changed) Added: head/tools/regression/capsicum/syscalls/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/capsicum/syscalls/MakefileSat Mar 2 01:00:26 2013(r247606) @@ -0,0 +1,28 @@ +# $FreeBSD$ + +SYSCALLS= cap_fcntls_limit cap_getmode cap_ioctls_limit + +CFLAGS=-O2 -pipe -std=gnu99 -fstack-protector +CFLAGS+= -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter +CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type +CFLAGS+= -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter +CFLAGS+= -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls +CFLAGS+= -Wold-style-definition -Wno-pointer-sign + +all: ${SYSCALLS} ${SYSCALLS:=.t} + +.for SYSCALL in ${SYSCALLS} + +${SYSCALL}:${SYSCALL}.c misc.c + ${CC} ${CFLAGS} ${@}.c misc.c -o $@ + +${SYSCALL}.t: ${SYSCALL} + @printf #!/bin/sh\n\n%s/%s\n ${.CURDIR} ${@:.t=} $@ + +.endfor + +test: all + @prove -r ${.CURDIR} + +clean: + rm -f ${SYSCALLS} ${SYSCALLS:=.t} Added: head/tools/regression/capsicum/syscalls/cap_fcntls_limit.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/capsicum/syscalls/cap_fcntls_limit.c Sat Mar 2 01:00:26 2013(r247606) @@ -0,0 +1,540 @@ +/*- + * Copyright (c) 2012 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Pawel Jakub Dawidek under sponsorship from + * the FreeBSD Foundation. + * + * 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 AUTHORS 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 AUTHORS 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. + */ + +#include sys/cdefs.h +__FBSDID($FreeBSD$); + +#include sys/types.h +#include sys/capability.h +#include sys/procdesc.h +#include sys/socket.h +#include sys/wait.h + +#include err.h +#include errno.h +#include stdio.h +#include stdlib.h +#include unistd.h + +#include misc.h + +static void +fcntl_tests_0(int fd) +{ + uint32_t fcntlrights; + + fcntlrights = 0; + CHECK(cap_fcntls_get(fd, fcntlrights) == 0); + CHECK(fcntlrights == CAP_FCNTL_ALL); + + CHECK(fcntl(fd, F_GETFD) == 0); + CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0); + CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC); + CHECK(fcntl(fd, F_SETFD, 0) == 0); + CHECK(fcntl(fd, F_GETFD) == 0); + + CHECK(fcntl(fd, F_GETFL) == O_RDWR); + CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == 0); + CHECK(fcntl(fd, F_GETFL) == (O_RDWR | O_NONBLOCK)); + CHECK(fcntl(fd, F_SETFL, 0) == 0); + CHECK(fcntl(fd, F_GETFL) == O_RDWR); + + errno = 0; + CHECK(cap_fcntls_limit(fd, ~CAP_FCNTL_ALL) == -1); + CHECK(errno == EINVAL); + CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL | CAP_FCNTL_SETFL) == 0);
svn commit: r247608 - head/sys/arm/arm
Author: andrew Date: Sat Mar 2 02:19:04 2013 New Revision: 247608 URL: http://svnweb.freebsd.org/changeset/base/247608 Log: Ensure the stack is correctly aligned before calling the first C function. Modified: head/sys/arm/arm/locore.S Modified: head/sys/arm/arm/locore.S == --- head/sys/arm/arm/locore.S Sat Mar 2 01:04:02 2013(r247607) +++ head/sys/arm/arm/locore.S Sat Mar 2 02:19:04 2013(r247608) @@ -204,6 +204,7 @@ mmu_done: virt_done: mov r1, #20 /* loader info size is 20 bytes also second arg */ subssp, sp, r1 /* allocate arm_boot_params struct on stack */ + bic sp, sp, #7 /* align stack to 8 bytes */ mov r0, sp /* loader info pointer is first arg */ str r1, [r0]/* Store length of loader info */ str r9, [r0, #4]/* Store r0 from boot loader */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247609 - head/sys/arm/conf
Author: andrew Date: Sat Mar 2 03:23:14 2013 New Revision: 247609 URL: http://svnweb.freebsd.org/changeset/base/247609 Log: Build the Raspberry Pi dtb file when building the kernel so we can copy it to the boot partition for U-Boot. Modified: head/sys/arm/conf/RPI-B Modified: head/sys/arm/conf/RPI-B == --- head/sys/arm/conf/RPI-B Sat Mar 2 02:19:04 2013(r247608) +++ head/sys/arm/conf/RPI-B Sat Mar 2 03:23:14 2013(r247609) @@ -117,4 +117,4 @@ options FDT # Note: DTB is normally loaded and modified by RPi boot loader, then # handed to kernel via U-Boot and ubldr. #options FDT_DTB_STATIC -#makeoptions FDT_DTS_FILE=bcm2835-rpi-b.dts +makeoptions FDT_DTS_FILE=bcm2835-rpi-b.dts ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r247609 - head/sys/arm/conf
On Mar 1, 2013, at 7:23 PM, Andrew Turner wrote: Author: andrew Date: Sat Mar 2 03:23:14 2013 New Revision: 247609 URL: http://svnweb.freebsd.org/changeset/base/247609 Log: Build the Raspberry Pi dtb file when building the kernel so we can copy it to the boot partition for U-Boot. Modified: head/sys/arm/conf/RPI-B Modified: head/sys/arm/conf/RPI-B == --- head/sys/arm/conf/RPI-B Sat Mar 2 02:19:04 2013(r247608) +++ head/sys/arm/conf/RPI-B Sat Mar 2 03:23:14 2013(r247609) @@ -117,4 +117,4 @@ options FDT # Note: DTB is normally loaded and modified by RPi boot loader, then # handed to kernel via U-Boot and ubldr. #options FDT_DTB_STATIC -#makeoptions FDT_DTS_FILE=bcm2835-rpi-b.dts +makeoptions FDT_DTS_FILE=bcm2835-rpi-b.dts FWIW, I personally find it easier to just run dtc to compile the DTS file as required. Tim ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247610 - head/sys/arm/include
Author: andrew Date: Sat Mar 2 05:02:29 2013 New Revision: 247610 URL: http://svnweb.freebsd.org/changeset/base/247610 Log: Move some virtual memory constants to the top of the file where they are on other architectures [1]. While here: - Remove an unused and commented out include. - Add a comment describing the file that other copies have. - Fix the style of the defines and add a comment on what each one is. Suggested by: [1] alc Modified: head/sys/arm/include/vmparam.h Modified: head/sys/arm/include/vmparam.h == --- head/sys/arm/include/vmparam.h Sat Mar 2 03:23:14 2013 (r247609) +++ head/sys/arm/include/vmparam.h Sat Mar 2 05:02:29 2013 (r247610) @@ -34,9 +34,32 @@ #ifndef_MACHINE_VMPARAM_H_ #define_MACHINE_VMPARAM_H_ +/* + * Machine dependent constants for ARM. + */ + +/* + * Virtual memory related constants, all in bytes + */ +#ifndefMAXTSIZ +#defineMAXTSIZ (64UL*1024*1024)/* max text size */ +#endif +#ifndefDFLDSIZ +#defineDFLDSIZ (128UL*1024*1024) /* initial data size limit */ +#endif +#ifndefMAXDSIZ +#defineMAXDSIZ (512UL*1024*1024) /* max data size */ +#endif +#ifndefDFLSSIZ +#defineDFLSSIZ (2UL*1024*1024) /* initial stack size limit */ +#endif +#ifndefMAXSSIZ +#defineMAXSSIZ (8UL*1024*1024) /* max stack size */ +#endif +#ifndefSGROWSIZ +#defineSGROWSIZ(128UL*1024)/* amount to grow stack */ +#endif -/*#include arm/arm32/vmparam.h -*/ /* * Address space constants */ @@ -153,25 +176,6 @@ VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5) #endif -#ifndef MAXTSIZ -#define MAXTSIZ(64*1024*1024) -#endif -#ifndef DFLDSIZ -#define DFLDSIZ (128*1024*1024) -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (512*1024*1024) -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (2*1024*1024) -#endif -#ifndef MAXSSIZ -#define MAXSSIZ (8*1024*1024) -#endif -#ifndef SGROWSIZ -#define SGROWSIZ(128*1024) -#endif - #ifdef ARM_USE_SMALL_ALLOC #define UMA_MD_SMALL_ALLOC #endif /* ARM_USE_SMALL_ALLOC */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247611 - head/lib/libstand
Author: marcel Date: Sat Mar 2 05:03:36 2013 New Revision: 247611 URL: http://svnweb.freebsd.org/changeset/base/247611 Log: Fix nandfs support by providing the same crc32 function as is used in newfs_nandfs. In libstand we get crc32 from libz. The polynomial is not the same as used for nandfs, which is the crc32 used in the kernel. Modified: head/lib/libstand/nandfs.c Modified: head/lib/libstand/nandfs.c == --- head/lib/libstand/nandfs.c Sat Mar 2 05:02:29 2013(r247610) +++ head/lib/libstand/nandfs.c Sat Mar 2 05:03:36 2013(r247611) @@ -125,6 +125,27 @@ struct fs_ops nandfs_fsops = { #defineNINDIR(fs) ((fs)-nf_blocksize / sizeof(nandfs_daddr_t)) +/* from NetBSD's src/sys/net/if_ethersubr.c */ +static uint32_t +nandfs_crc32(uint32_t crc, const uint8_t *buf, size_t len) +{ + static const uint32_t crctab[] = { + 0x, 0x1db71064, 0x3b6e20c8, 0x26d930ac, + 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, + 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, + 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c + }; + size_t i; + + crc = crc ^ ~0U; + for (i = 0; i len; i++) { + crc ^= buf[i]; + crc = (crc 4) ^ crctab[crc 0xf]; + crc = (crc 4) ^ crctab[crc 0xf]; + } + return (crc ^ ~0U); +} + static int nandfs_check_fsdata_crc(struct nandfs_fsdata *fsdata) { @@ -138,7 +159,7 @@ nandfs_check_fsdata_crc(struct nandfs_fs /* Calculate */ fsdata-f_sum = (0); - comp_crc = crc32(0, (uint8_t *)fsdata, fsdata-f_bytes); + comp_crc = nandfs_crc32(0, (uint8_t *)fsdata, fsdata-f_bytes); /* Restore */ fsdata-f_sum = fsdata_crc; @@ -162,7 +183,7 @@ nandfs_check_superblock_crc(struct nandf /* Calculate */ super-s_sum = (0); - comp_crc = crc32(0, (uint8_t *)super, fsdata-f_sbbytes); + comp_crc = nandfs_crc32(0, (uint8_t *)super, fsdata-f_sbbytes); /* Restore */ super-s_sum = super_crc; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247612 - head/lib/libstand
Author: marcel Date: Sat Mar 2 05:07:51 2013 New Revision: 247612 URL: http://svnweb.freebsd.org/changeset/base/247612 Log: Fix warnings (control reaches end of non-void function). Modified: head/lib/libstand/nandfs.c Modified: head/lib/libstand/nandfs.c == --- head/lib/libstand/nandfs.c Sat Mar 2 05:03:36 2013(r247611) +++ head/lib/libstand/nandfs.c Sat Mar 2 05:07:51 2013(r247612) @@ -418,7 +418,7 @@ nandfs_open(const char *path, struct ope return (0); } -static int +static void nandfs_free_node(struct nandfs_node *node) { struct bmap_buf *bmap, *tmp; @@ -445,6 +445,7 @@ nandfs_close(struct open_file *f) nandfs_free_node(fs-nf_opened_node); free(fs-nf_sb); free(fs); + return (0); } static int ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r247609 - head/sys/arm/conf
On Fri, 1 Mar 2013 19:32:17 -0800 Tim Kientzle t...@kientzle.com wrote: On Mar 1, 2013, at 7:23 PM, Andrew Turner wrote: Author: andrew Date: Sat Mar 2 03:23:14 2013 New Revision: 247609 URL: http://svnweb.freebsd.org/changeset/base/247609 Log: Build the Raspberry Pi dtb file when building the kernel so we can copy it to the boot partition for U-Boot. Modified: head/sys/arm/conf/RPI-B Modified: head/sys/arm/conf/RPI-B == --- head/sys/arm/conf/RPI-B Sat Mar 2 02:19:04 2013 (r247608) +++ head/sys/arm/conf/RPI-B Sat Mar 2 03:23:14 2013(r247609) @@ -117,4 +117,4 @@ options FDT # Note: DTB is normally loaded and modified by RPi boot loader, then # handed to kernel via U-Boot and ubldr. #options FDT_DTB_STATIC -#makeoptions FDT_DTS_FILE=bcm2835-rpi-b.dts +makeoptions FDT_DTS_FILE=bcm2835-rpi-b.dts FWIW, I personally find it easier to just run dtc to compile the DTS file as required. I know at least one user has been caught out by this, and I was as an old version of the dtb was where I was expecting the new one to be. When we move to a GENERIC kernel for armv6 I would not expect FDT_DTS_FILE to be set, but for a single board kernel config it can help as the user doesn't have to search around for dtc in the case it's not installed on the build host. Andrew ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247613 - head/lib/libstand
Author: marcel Date: Sat Mar 2 05:28:55 2013 New Revision: 247613 URL: http://svnweb.freebsd.org/changeset/base/247613 Log: Make this WARNS=9 clean on i386 w/ clang. Modified: head/lib/libstand/nandfs.c Modified: head/lib/libstand/nandfs.c == --- head/lib/libstand/nandfs.c Sat Mar 2 05:07:51 2013(r247612) +++ head/lib/libstand/nandfs.c Sat Mar 2 05:28:55 2013(r247613) @@ -95,8 +95,7 @@ static off_t nandfs_seek(struct open_fil static int nandfs_stat(struct open_file *, struct stat *); static int nandfs_readdir(struct open_file *, struct dirent *); -static int nandfs_buf_read(struct nandfs *, char **, size_t *); -static struct nandfs_node *nandfs_lookup_inode(struct nandfs *, nandfs_daddr_t); +static int nandfs_buf_read(struct nandfs *, void **, size_t *); static struct nandfs_node *nandfs_lookup_path(struct nandfs *, const char *); static int nandfs_read_inode(struct nandfs *, struct nandfs_node *, nandfs_lbn_t, u_int, void *, int); @@ -453,7 +452,7 @@ nandfs_read(struct open_file *f, void *a { struct nandfs *fs = (struct nandfs *)f-f_fsdata; size_t csize, buf_size; - uint8_t *buf; + void *buf; int error = 0; NANDFS_DEBUG(nandfs_read(file=%p, addr=%p, size=%d)\n, f, addr, size); @@ -462,7 +461,7 @@ nandfs_read(struct open_file *f, void *a if (fs-nf_offset = fs-nf_opened_node-inode-i_size) break; - error = nandfs_buf_read(fs, (void *)buf, buf_size); + error = nandfs_buf_read(fs, buf, buf_size); if (error) break; @@ -539,7 +538,7 @@ nandfs_readdir(struct open_file *f, stru { struct nandfs *fs = f-f_fsdata; struct nandfs_dir_entry *dirent; - uint8_t *buf; + void *buf; size_t buf_size; NANDFS_DEBUG(nandfs_readdir(file=%p, dirent=%p)\n, f, d); @@ -550,7 +549,7 @@ nandfs_readdir(struct open_file *f, stru return (ENOENT); } - if (nandfs_buf_read(fs, (void *)buf, buf_size)) { + if (nandfs_buf_read(fs, buf, buf_size)) { NANDFS_DEBUG(nandfs_readdir(file=%p, dirent=%p) buf_read failed\n, f, d); return (EIO); @@ -568,7 +567,7 @@ nandfs_readdir(struct open_file *f, stru } static int -nandfs_buf_read(struct nandfs *fs, char **buf_p, size_t *size_p) +nandfs_buf_read(struct nandfs *fs, void **buf_p, size_t *size_p) { nandfs_daddr_t blknr, blkoff; @@ -634,8 +633,8 @@ nandfs_lookup_path(struct nandfs *fs, co struct nandfs_node *node; struct nandfs_dir_entry *dirent; char *namebuf; - uint64_t i, j, done, counter, pinode, inode; - int nlinks = 0, len, link_len, nameidx; + uint64_t i, done, pinode, inode; + int nlinks = 0, counter, len, link_len, nameidx; uint8_t *buffer, *orig; char *strp, *lpath; @@ -672,7 +671,8 @@ nandfs_lookup_path(struct nandfs *fs, co buffer = orig; done = counter = 0; while (1) { - dirent = (struct nandfs_dir_entry *)buffer; + dirent = + (struct nandfs_dir_entry *)(void *)buffer; NANDFS_DEBUG(%s: dirent.name = %s\n, __func__, dirent-name); NANDFS_DEBUG(%s: dirent.rec_len = %d\n, @@ -768,9 +768,9 @@ static int nandfs_read_inode(struct nandfs *fs, struct nandfs_node *node, nandfs_daddr_t blknr, u_int nblks, void *buf, int raw) { - int i; uint64_t *pblks; uint64_t *vblks; + u_int i; int error; pblks = malloc(nblks * sizeof(uint64_t)); @@ -799,7 +799,7 @@ nandfs_read_inode(struct nandfs *fs, str return (EIO); } - buf += fs-nf_blocksize; + buf = (void *)((uintptr_t)buf + fs-nf_blocksize); } free(pblks); @@ -881,8 +881,7 @@ nandfs_bmap_lookup(struct nandfs *fs, st { struct nandfs_inode *ino; nandfs_daddr_t ind_block_num; - uint64_t *map, *indir; - uint64_t idx0, idx1, vblk, tmp; + uint64_t *map; int idx; int level; @@ -1028,7 +1027,7 @@ ioread(struct open_file *f, off_t pos, v err = (f-f_dev-dv_strategy)(f-f_devdata, F_READ, pos, nsec * bsize, buffer, NULL); - memcpy(buf, buffer + off, length); + memcpy(buf, (void *)((uintptr_t)buffer + off), length); free(buffer); return (err); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r247600 - in head/sys: conf sparc64/pci
On Sat, 2 Mar 2013, Marius Strobl wrote: Log: - While Netra X1 generally show no ill effects when registering a power fail interrupt handler, there seems to be either a broken batch of them or a tendency to develop a defect which causes this interrupt to fire inadvertedly. Given that apart from this problem these machines work just fine, add a tunable allowing the setup of the power fail interrupt to be disabled. While at it, remove the DEBUGGER_ON_POWERFAIL compile time option and make that behavior also selectable via the newly added tunable. - Apparently, it's no longer a problem to call shutdown_nice(9) from within an interrupt filter (some other drivers in the tree do the same). So change the power fail interrupt from an handler in order to simplify the code and get rid of a !INTR_MPSAFE handler. Gak! It it is any error to call any() from within a fast interrupt handler. Even with fast interrupt handlers broken to be interrupt filters, it is an error to call almost any(). shutdown_nice() is an especially invalid any(). It sends a signal to init, and uses many sleep locks for this. So you have the interrupt filter which is locked by critical_enter() and probably also by hard-disabling interrupts on the current CPU, calling up to code locked by sleep mutexes. This asks for deadlock, and gets it when the interrupt preempts code holding one of the sleep locks that is wandered into. The other broken drivers that do this seem to be mainly serial console drivers. Their debugger entry was subverted into calling panic() or shutdown_nice() according to an escape sequence. Even the debugger entry part of this was broken by changing it from a hard breakpoint to a kdb_enter() call which does invalid things (it accesses global state without locking, and calls printf() before entering debugger context). shutdown_nice() is also called from acpi and from syscons. I think the latter still uses an ordinary (Giant locked) interrupt handler. Calling shutdown_nice() from there has a chance of never deadlocking. It would just have to wait if the interrupt interrupted something holding shutdown_nice()'s locks. The dangerous calls in syscons are actually from scgetc(). I think they are reachable in debugger mode too. Then they are invalid. So are ddb's commands for rebooting and panicing. You can't call any() from ddb either, but these commands do. A non-broken version of these commands (or call any()) would exit from ddb context after arranging to make the call using a trampoline. The call might fail, but then it is not the fault of ddb's context. The trampoline is needed to regain control if the call can return. The reboot and panic commands are safer than most of the unsafe ones since they are supposed to give an unclean shutdown and if they don't work then nothing much worse than a recursive unclean shutdown can happen. Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r247614 - head/lib/libc/sys
Author: joel (doc committer) Date: Sat Mar 2 06:55:55 2013 New Revision: 247614 URL: http://svnweb.freebsd.org/changeset/base/247614 Log: mdoc: remove superfluous paragraph macro. Modified: head/lib/libc/sys/cap_fcntls_limit.2 head/lib/libc/sys/cap_ioctls_limit.2 head/lib/libc/sys/cap_rights_limit.2 Modified: head/lib/libc/sys/cap_fcntls_limit.2 == --- head/lib/libc/sys/cap_fcntls_limit.2Sat Mar 2 05:28:55 2013 (r247613) +++ head/lib/libc/sys/cap_fcntls_limit.2Sat Mar 2 06:55:55 2013 (r247614) @@ -120,7 +120,6 @@ argument points at an invalid address. Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. -.Pp .Sh AUTHORS This function was created by .An Pawel Jakub Dawidek Aq pa...@dawidek.net Modified: head/lib/libc/sys/cap_ioctls_limit.2 == --- head/lib/libc/sys/cap_ioctls_limit.2Sat Mar 2 05:28:55 2013 (r247613) +++ head/lib/libc/sys/cap_ioctls_limit.2Sat Mar 2 06:55:55 2013 (r247614) @@ -151,7 +151,6 @@ argument points at invalid address. Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. -.Pp .Sh AUTHORS This function was created by .An Pawel Jakub Dawidek Aq pa...@dawidek.net Modified: head/lib/libc/sys/cap_rights_limit.2 == --- head/lib/libc/sys/cap_rights_limit.2Sat Mar 2 05:28:55 2013 (r247613) +++ head/lib/libc/sys/cap_rights_limit.2Sat Mar 2 06:55:55 2013 (r247614) @@ -590,7 +590,6 @@ argument points at an invalid address. Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. -.Pp .Sh AUTHORS This function was created by .An Pawel Jakub Dawidek Aq pa...@dawidek.net ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r247601 - head/sys/sparc64/sbus
On Sat, 2 Mar 2013, Marius Strobl wrote: Log: - Apparently, it's no longer a problem to call shutdown_nice(9) from within an interrupt filter (some other drivers in the tree do the same). So change the overtemperature and power fail interrupts from handlers in order to code and get rid of a !INTR_MPSAFE handlers. Sigh. Maybe the only thing that works better with a filter is that LOR detection for it is broken since filters don't use normal mutexes? Modified: head/sys/sparc64/sbus/sbus.c == --- head/sys/sparc64/sbus/sbus.cSat Mar 2 00:37:31 2013 (r247600) +++ head/sys/sparc64/sbus/sbus.cSat Mar 2 00:41:51 2013 (r247601) @@ -199,7 +199,7 @@ static driver_t sbus_driver = { static devclass_t sbus_devclass; -EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0, +EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, NULL, NULL, BUS_PASS_BUS); MODULE_DEPEND(sbus, nexus, 1, 1, 1); MODULE_VERSION(sbus, 1); @@ -410,7 +410,7 @@ sbus_attach(device_t dev) INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec || intr_vectors[vec].iv_ic != sbus_ic || bus_setup_intr(dev, sc-sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE, - NULL, sbus_overtemp, sc, sc-sc_ot_ihand) != 0) + sbus_overtemp, NULL, sc, sc-sc_ot_ihand) != 0) panic(%s: failed to set up temperature interrupt, __func__); i = 3; sc-sc_pf_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, i, It still doesn't claim INTR_MPSAFE. Maybe that is meaningless for filters. But some filters claim it. @@ -897,31 +897,33 @@ sbus_get_devinfo(device_t bus, device_t * This handles the interrupt and powers off the machine. * The same needs to be done to PCI controller drivers. */ -static void -sbus_overtemp(void *arg) +static int +sbus_overtemp(void *arg __unused) { static int shutdown; /* As the interrupt is cleared we may be called multiple times. */ if (shutdown != 0) - return; + return (FILTER_HANDLED); shutdown++; printf(DANGER: OVER TEMPERATURE detected\nShutting down NOW.\n); Calling the any() function printf() is also invalid in fast interrupt handlers. It is especially unsafe in practice in versions that serialize the output -- this printf() may be long delayed. shutdown_nice(RB_POWEROFF); + return (FILTER_HANDLED); } /* Try to shut down in time in case of power failure. */ -static void -sbus_pwrfail(void *arg) +static int +sbus_pwrfail(void *arg __unused) { static int shutdown; /* As the interrupt is cleared we may be called multiple times. */ if (shutdown != 0) - return; + return (FILTER_HANDLED); shutdown++; printf(Power failure detected\nShutting down NOW.\n); - shutdown_nice(0); + shutdown_nice(FILTER_HANDLED); FILTER_HANDLED is a garbage arg for shutdown_nice(). It happens to be 2, which happens to be RB_SINGLE, which is a boot flag and not a reboot flag, and is also not really used, so this bug has little effect. + return (FILTER_HANDLED); } static int I don't see anything to make these more MPSAFE than before. They seem to be basically correct and MPSAFE as ordinary interrupt handlers, but basically incorrect and MPSAFE as filters. The shutdown_nice() call is MPSAFE if calling it is safe at all. You just need to ensure that the handlers are not connected to multiple interrupt sources (including ones for other devies), so that rest of the global state accessed by the handlers doesn't need locking. This state is just the `shutdown' variable in each, so it could easily be protected by an atomic op. The locking is just as missing for the filter version as for the normal version if there can be multiple interrupt sources. However, the worst that can happen if the counter gets messed up seems to be multiple printf()s and multiple SIGINTs sent to init. Both are probably harmless. Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org