svn commit: r189529 - in head/sys: kern security/audit security/mac security/mac_stub security/mac_test
Author: rwatson Date: Sun Mar 8 10:58:37 2009 New Revision: 189529 URL: http://svn.freebsd.org/changeset/base/189529 Log: Improve the consistency of MAC Framework and MAC policy entry point naming by renaming certain "proc" entry points to "cred" entry points, reflecting their manipulation of credentials. For some entry points, the process was passed into the framework but not into policies; in these cases, stop passing in the process since we don't need it. mac_proc_check_setaudit -> mac_cred_check_setaudit mac_proc_check_setaudit_addr -> mac_cred_check_setaudit_addr mac_proc_check_setauid -> mac_cred_check_setauid mac_proc_check_setegid -> mac_cred_check_setegid mac_proc_check_seteuid -> mac_cred_check_seteuid mac_proc_check_setgid -> mac_cred_check_setgid mac_proc_check_setgroups -> mac_cred_ceck_setgroups mac_proc_check_setregid -> mac_cred_check_setregid mac_proc_check_setresgid -> mac_cred_check_setresgid mac_proc_check_setresuid -> mac_cred_check_setresuid mac_proc_check_setreuid -> mac_cred_check_setreuid mac_proc_check_setuid -> mac_cred_check_setuid Obtained from:TrustedBSD Project Sponsored by: Google, Inc. Modified: head/sys/kern/kern_prot.c head/sys/security/audit/audit_syscalls.c head/sys/security/mac/mac_audit.c head/sys/security/mac/mac_cred.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_framework.h head/sys/security/mac/mac_policy.h head/sys/security/mac/mac_process.c head/sys/security/mac_stub/mac_stub.c head/sys/security/mac_test/mac_test.c Modified: head/sys/kern/kern_prot.c == --- head/sys/kern/kern_prot.c Sun Mar 8 06:56:13 2009(r189528) +++ head/sys/kern/kern_prot.c Sun Mar 8 10:58:37 2009(r189529) @@ -489,7 +489,7 @@ setuid(struct thread *td, struct setuid_ oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setuid(p, oldcred, uid); + error = mac_cred_check_setuid(oldcred, uid); if (error) goto fail; #endif @@ -601,7 +601,7 @@ seteuid(struct thread *td, struct seteui oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_seteuid(p, oldcred, euid); + error = mac_cred_check_seteuid(oldcred, euid); if (error) goto fail; #endif @@ -654,7 +654,7 @@ setgid(struct thread *td, struct setgid_ oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setgid(p, oldcred, gid); + error = mac_cred_check_setgid(oldcred, gid); if (error) goto fail; #endif @@ -753,7 +753,7 @@ setegid(struct thread *td, struct setegi oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setegid(p, oldcred, egid); + error = mac_cred_check_setegid(oldcred, egid); if (error) goto fail; #endif @@ -815,7 +815,7 @@ kern_setgroups(struct thread *td, u_int oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setgroups(p, oldcred, ngrp, groups); + error = mac_cred_check_setgroups(oldcred, ngrp, groups); if (error) goto fail; #endif @@ -880,7 +880,7 @@ setreuid(register struct thread *td, str oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setreuid(p, oldcred, ruid, euid); + error = mac_cred_check_setreuid(oldcred, ruid, euid); if (error) goto fail; #endif @@ -945,7 +945,7 @@ setregid(register struct thread *td, str oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setregid(p, oldcred, rgid, egid); + error = mac_cred_check_setregid(oldcred, rgid, egid); if (error) goto fail; #endif @@ -1016,7 +1016,7 @@ setresuid(register struct thread *td, st oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setresuid(p, oldcred, ruid, euid, suid); + error = mac_cred_check_setresuid(oldcred, ruid, euid, suid); if (error) goto fail; #endif @@ -1093,7 +1093,7 @@ setresgid(register struct thread *td, st oldcred = p->p_ucred; #ifdef MAC - error = mac_proc_check_setresgid(p, oldcred, rgid, egid, sgid); + error = mac_cred_check_setresgid(oldcred, rgid, egid, sgid); if (error) goto fail; #endif Modified: head/sys/security/audit/audit_syscalls.c == --- head/sys/security/audit/audit_syscalls.cSun Mar 8 06:56:13 2009 (r189528) +++ head/sys/security/audit/audit_syscalls.cSun Mar 8 10:58:37 2009 (r189529) @@ -474,7 +474,7 @@ setauid(struct thread *td, struct setaui oldcred = td->td_proc->p_ucred; crcopy(newcred, oldcred); #ifdef MAC - error = mac_proc_check_setauid(oldcred, id); + error = mac_cred_check_setauid(oldcred, id); if (error)
svn commit: r189530 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern
Author: dchagin Date: Sun Mar 8 11:12:23 2009 New Revision: 189530 URL: http://svn.freebsd.org/changeset/base/189530 Log: MFC r189232, r189313: Fix range-check error introduced in r182292. Panic in case the ncpus == 0. it helps to catch bugs in the callers. Approved by: kib (mentor) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/subr_smp.c Modified: stable/7/sys/kern/subr_smp.c == --- stable/7/sys/kern/subr_smp.cSun Mar 8 10:58:37 2009 (r189529) +++ stable/7/sys/kern/subr_smp.cSun Mar 8 11:12:23 2009 (r189530) @@ -358,9 +358,11 @@ smp_rendezvous_cpus(cpumask_t map, return; } - for (i = 0; i < mp_maxid; i++) + for (i = 0; i <= mp_maxid; i++) if (((1 << i) & map) != 0 && !CPU_ABSENT(i)) ncpus++; + if (ncpus == 0) + panic("ncpus is 0 with map=0x%x", map); /* obtain rendezvous lock */ mtx_lock_spin(&smp_ipi_mtx); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189531 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb net
Author: rwatson Date: Sun Mar 8 11:20:54 2009 New Revision: 189531 URL: http://svn.freebsd.org/changeset/base/189531 Log: Merge missed routing lock fix r186061 from head to stable/7: Dont leak the rnh lock on error. Original change was from thompsa. This may correct routing-related panics seen by uses of ppp, including the following PRs: PR: 132215, 13, 132404 Reported by: Ethan Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/net/rtsock.c Modified: stable/7/sys/net/rtsock.c == --- stable/7/sys/net/rtsock.c Sun Mar 8 11:12:23 2009(r189530) +++ stable/7/sys/net/rtsock.c Sun Mar 8 11:20:54 2009(r189531) @@ -629,10 +629,10 @@ route_output(struct mbuf *m, struct sock rt->rt_ifa->ifa_addr))) { RT_UNLOCK(rt); RADIX_NODE_HEAD_LOCK(rnh); - if ((error = rt_getifa_fib(&info, - rt->rt_fibnum)) != 0) - senderr(error); + error = rt_getifa_fib(&info, rt->rt_fibnum); RADIX_NODE_HEAD_UNLOCK(rnh); + if (error != 0) + senderr(error); RT_LOCK(rt); } if (info.rti_ifa != NULL && ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r189499 - in head/sys: conf dev/drm modules/drm/radeon
On Sat, 7 Mar 2009 21:36:57 + (UTC) Robert Noland wrote: > Author: rnoland > Date: Sat Mar 7 21:36:57 2009 > New Revision: 189499 > URL: http://svn.freebsd.org/changeset/base/189499 > > Log: > Import support for ATI Radeon R600 and R700 series chips. > > Tested on an HD3850 (RV670) on loan from Warren Block. > > Currently, you need one of the following for this to be useful: > > x11-drivers/xf86-video-radeonhd-devel (not tested) > I tested this driver with radeon-drm-next-r6-7xx-030609-2.patch (the precursor to this commit) and it works OK. --- Gary Jennejohn ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189532 - head/sys/security/mac
Author: rwatson Date: Sun Mar 8 12:22:00 2009 New Revision: 189532 URL: http://svn.freebsd.org/changeset/base/189532 Log: Rename 'ucred' argument to mac_socket_check_bind() to 'cred' to match other use of the same variable type. Obtained from:TrustedBSD Project Sponsored by: Google, Inc. Modified: head/sys/security/mac/mac_socket.c Modified: head/sys/security/mac/mac_socket.c == --- head/sys/security/mac/mac_socket.c Sun Mar 8 11:20:54 2009 (r189531) +++ head/sys/security/mac/mac_socket.c Sun Mar 8 12:22:00 2009 (r189532) @@ -301,15 +301,15 @@ MAC_CHECK_PROBE_DEFINE3(socket_check_bin "struct socket *", "struct sockaddr *"); int -mac_socket_check_bind(struct ucred *ucred, struct socket *so, +mac_socket_check_bind(struct ucred *cred, struct socket *so, struct sockaddr *sa) { int error; SOCK_LOCK_ASSERT(so); - MAC_CHECK(socket_check_bind, ucred, so, so->so_label, sa); - MAC_CHECK_PROBE3(socket_check_bind, error, ucred, so, sa); + MAC_CHECK(socket_check_bind, cred, so, so->so_label, sa); + MAC_CHECK_PROBE3(socket_check_bind, error, cred, so, sa); return (error); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189533 - in head/sys: kern security/mac security/mac_biba security/mac_bsdextended security/mac_lomac security/mac_mls security/mac_stub security/mac_test
Author: rwatson Date: Sun Mar 8 12:32:06 2009 New Revision: 189533 URL: http://svn.freebsd.org/changeset/base/189533 Log: Remove 'uio' argument from MAC Framework and MAC policy entry points for extended attribute get/set; in the case of get an uninitialized user buffer was passed before the EA was retrieved, making it of relatively little use; the latter was simply unused by any policies. Obtained from:TrustedBSD Project Sponsored by: Google, Inc. Modified: head/sys/kern/vfs_extattr.c head/sys/security/mac/mac_framework.h head/sys/security/mac/mac_policy.h head/sys/security/mac/mac_vfs.c head/sys/security/mac_biba/mac_biba.c head/sys/security/mac_bsdextended/ugidfw_internal.h head/sys/security/mac_bsdextended/ugidfw_vnode.c head/sys/security/mac_lomac/mac_lomac.c head/sys/security/mac_mls/mac_mls.c head/sys/security/mac_stub/mac_stub.c head/sys/security/mac_test/mac_test.c Modified: head/sys/kern/vfs_extattr.c == --- head/sys/kern/vfs_extattr.c Sun Mar 8 12:22:00 2009(r189532) +++ head/sys/kern/vfs_extattr.c Sun Mar 8 12:32:06 2009(r189533) @@ -195,7 +195,7 @@ extattr_set_vp(struct vnode *vp, int att #ifdef MAC error = mac_vnode_check_setextattr(td->td_ucred, vp, attrnamespace, - attrname, &auio); + attrname); if (error) goto done; #endif @@ -373,7 +373,7 @@ extattr_get_vp(struct vnode *vp, int att #ifdef MAC error = mac_vnode_check_getextattr(td->td_ucred, vp, attrnamespace, - attrname, &auio); + attrname); if (error) goto done; #endif Modified: head/sys/security/mac/mac_framework.h == --- head/sys/security/mac/mac_framework.h Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac/mac_framework.h Sun Mar 8 12:32:06 2009 (r189533) @@ -85,7 +85,6 @@ struct pipepair; struct thread; struct timespec; struct ucred; -struct uio; struct vattr; struct vnode; struct vop_setlabel_args; @@ -377,7 +376,7 @@ int mac_vnode_check_exec(struct ucred *c intmac_vnode_check_getacl(struct ucred *cred, struct vnode *vp, acl_type_t type); intmac_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, - int attrnamespace, const char *name, struct uio *uio); + int attrnamespace, const char *name); intmac_vnode_check_link(struct ucred *cred, struct vnode *dvp, struct vnode *vp, struct componentname *cnp); intmac_vnode_check_listextattr(struct ucred *cred, struct vnode *vp, @@ -404,7 +403,7 @@ int mac_vnode_check_revoke(struct ucred intmac_vnode_check_setacl(struct ucred *cred, struct vnode *vp, acl_type_t type, struct acl *acl); intmac_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, - int attrnamespace, const char *name, struct uio *uio); + int attrnamespace, const char *name); intmac_vnode_check_setflags(struct ucred *cred, struct vnode *vp, u_long flags); intmac_vnode_check_setmode(struct ucred *cred, struct vnode *vp, Modified: head/sys/security/mac/mac_policy.h == --- head/sys/security/mac/mac_policy.h Sun Mar 8 12:22:00 2009 (r189532) +++ head/sys/security/mac/mac_policy.h Sun Mar 8 12:32:06 2009 (r189533) @@ -97,7 +97,6 @@ struct sysctl_oid; struct sysctl_req; struct thread; struct ucred; -struct uio; struct vattr; struct vnode; @@ -557,7 +556,7 @@ typedef int (*mpo_vnode_check_getacl_t)( acl_type_t type); typedef int(*mpo_vnode_check_getextattr_t)(struct ucred *cred, struct vnode *vp, struct label *vplabel, - int attrnamespace, const char *name, struct uio *uio); + int attrnamespace, const char *name); typedef int(*mpo_vnode_check_link_t)(struct ucred *cred, struct vnode *dvp, struct label *dvplabel, struct vnode *vp, struct label *vplabel, @@ -606,7 +605,7 @@ typedef int (*mpo_vnode_check_setacl_t)( struct acl *acl); typedef int(*mpo_vnode_check_setextattr_t)(struct ucred *cred, struct vnode *vp, struct label *vplabel, - int attrnamespace, const char *name, struct uio *uio); + int attrnamespace, const char *name); typedef int(*mpo_vnode_check_setflags_t)(struct ucred *cred, struct vnode *vp, struct label *vplabel, u_long flags); typedef int(*mpo_vnode_check_setmode_t)(struct ucred *cred, Modified: head/sys/security/mac/mac_vfs.c == --- head/sys/security/mac/mac_vfs.c Sun Mar 8 12:22:00 2009
svn commit: r189534 - head/sbin/devd
Author: kib Date: Sun Mar 8 14:28:40 2009 New Revision: 189534 URL: http://svn.freebsd.org/changeset/base/189534 Log: Document several notifications, among them are DEVFS, update to ifneti, coretemp and kern. The asmc(4) and zfs(5) are still not documented. Based on the patch by Roland Smith . MFC after:1 week Modified: head/sbin/devd/devd.conf.5 Modified: head/sbin/devd/devd.conf.5 == --- head/sbin/devd/devd.conf.5 Sun Mar 8 12:32:06 2009(r189533) +++ head/sbin/devd/devd.conf.5 Sun Mar 8 14:28:40 2009(r189534) @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd October 25, 2006 +.Dd March 8, 2009 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -238,6 +238,10 @@ statement. .Ic Description .It Li bus Device name of parent bus. +.It Li cdev +Device node path if one is created by the +.Xr devfs 5 +filesystem. .It Li cisproduct CIS-product. .It Li cisvendor @@ -280,7 +284,7 @@ A partial list of systems, subsystems, a .Ic notify mechanism. .Pp -.Bl -tag -width ".Li IFNET" -compact +.Bl -tag -width ".Li coretemp" -compact .It Sy System .It Li ACPI Events related to the ACPI subsystem. @@ -313,6 +317,55 @@ took place. Carrier status changed to UP. .It Li LINK_DOWN Carrier status changed to DOWN. +.It Li ATTACH +The network inteface is attached to the system. +.It Li DETACH +The network inteface is detached from the system. +.El +.El +.It Li DEVFS +Events related to the +.Xr devfs 5 +filesystem. +.Bl -tag -width ".Sy Subsystem" -compact +.It Sy Subsystem +.It Li CDEV +.Bl -tag -width ".Li DESTROY" -compact +.It Sy Type +.It Li CREATE +The +.Xr devfs 5 +node is created. +.It Li DESTROY +The +.Xr devfs 5 +node is destroyed. +.El +.El +.It Li coretemp +Events related to the +.Xr coretemp 4 +device. +.Bl -tag -width ".Sy Subsystem" -compact +.It Sy Subsystem +.It Li Thermal +Notification that the CPU core has reached critical temperature. +.Bl -tag -width ".Ar temperature" -compact +.It Sy Type +.It Ar temperature +String containing the temperature of the core that has become too hot. +.El +.El +.It Li kern +Events related to the kernel. +.Bl -tag -width ".Sy Subsystem" -compact +.It Sy Subsystem +.It Li power +Information about the state of the system. +.Bl -tag -width ".li resume" -compact +.It Sy Type +.It Li resume +Notification that the system has woken from the suspended state. .El .El .El @@ -430,4 +483,6 @@ The installed .Pa /etc/devd.conf has many additional examples. .Sh SEE ALSO -.Xr devd 8 +.Xr devd 8 , +.Xr devfs 5 , +.Xr coretemp 4 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189536 - stable/7/sys/powerpc/powerpc
Author: nwhitehorn Date: Sun Mar 8 16:19:29 2009 New Revision: 189536 URL: http://svn.freebsd.org/changeset/base/189536 Log: Fix a mismerge from head that I somehow missed last night. This caused builds with KDB enabled to fail. Pointy hat to:me Modified: stable/7/sys/powerpc/powerpc/trap_subr.S Modified: stable/7/sys/powerpc/powerpc/trap_subr.S == --- stable/7/sys/powerpc/powerpc/trap_subr.SSun Mar 8 16:16:55 2009 (r189535) +++ stable/7/sys/powerpc/powerpc/trap_subr.SSun Mar 8 16:19:29 2009 (r189536) @@ -515,12 +515,9 @@ CNAME(ppc_db_trap): */ dbtrap: /* Write the trap vector to SPRG3 by computing LR & 0xff00 */ - mflr%r1 - andi. %r1,%r1,0xff00 - mtsprg3 %r1 - - lis %r1,(tmpstk+TMPSTKSZ-16)@ha /* get new SP */ - addi%r1,%r1,(tmpstk+TMPSTKSZ-16)@l + mflr%r31 + andi. %r31,%r31,0xff00 + mtsprg3 %r31 FRAME_SETUP(PC_DBSAVE) /* Call C trap code: */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189538 - head/sbin/devd
Author: maxim Date: Sun Mar 8 18:02:30 2009 New Revision: 189538 URL: http://svn.freebsd.org/changeset/base/189538 Log: o Spell. Sort .Xrs. Modified: head/sbin/devd/devd.conf.5 Modified: head/sbin/devd/devd.conf.5 == --- head/sbin/devd/devd.conf.5 Sun Mar 8 16:29:59 2009(r189537) +++ head/sbin/devd/devd.conf.5 Sun Mar 8 18:02:30 2009(r189538) @@ -120,7 +120,7 @@ Specifies PID file. .It Ic set Ar regexp-name Qq Ar (some|regexp) ; Creates a regular expression and assigns it to the variable .Ar regexp-name . -The variable is avaiable throughout the rest of +The variable is available throughout the rest of the configuration file. All regular expressions have an implicit .Ql ^$ @@ -208,7 +208,7 @@ The following sub-statements are support statement. The .Dq Li notify -variable is avaiable inside this statement and contains, a value, depending +variable is available inside this statement and contains, a value, depending on which system and subsystem that delivered the event. .Bl -tag -width ".Ic directory" .It Ic action Qq Ar command ; @@ -223,7 +223,7 @@ statements can exist within a statement; .Ar value can be either a fixed string or a regular expression. -Below is a list of avaiable systems, subsystems, and types. +Below is a list of available systems, subsystems, and types. .It Ic media-type Qq Ar string ; See above. .El @@ -318,9 +318,9 @@ Carrier status changed to UP. .It Li LINK_DOWN Carrier status changed to DOWN. .It Li ATTACH -The network inteface is attached to the system. +The network interface is attached to the system. .It Li DETACH -The network inteface is detached from the system. +The network interface is detached from the system. .El .El .It Li DEVFS @@ -483,6 +483,6 @@ The installed .Pa /etc/devd.conf has many additional examples. .Sh SEE ALSO -.Xr devd 8 , +.Xr coretemp 4 , .Xr devfs 5 , -.Xr coretemp 4 +.Xr devd 8 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189539 - head/sys/kern
Author: marcus (doc,ports committer) Date: Sun Mar 8 19:05:53 2009 New Revision: 189539 URL: http://svn.freebsd.org/changeset/base/189539 Log: Add a default implementation for VOP_VPTOCNP(9) which scans the parent directory of a vnode to find a dirent with a matching file number. The name from that dirent is then used to provide the component name. Note: if the initial vnode argument is not a directory itself, then the default VOP_VPTOCNP(9) implementation still returns ENOENT. Reviewed by: kib Approved by: kib Tested by:pho Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c == --- head/sys/kern/vfs_default.c Sun Mar 8 18:02:30 2009(r189538) +++ head/sys/kern/vfs_default.c Sun Mar 8 19:05:53 2009(r189539) @@ -48,8 +48,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include +#include #include #include @@ -63,6 +66,14 @@ __FBSDID("$FreeBSD$"); static int vop_nolookup(struct vop_lookup_args *); static int vop_nostrategy(struct vop_strategy_args *); +static int get_next_dirent(struct vnode *vp, struct dirent **dpp, + char *dirbuf, int dirbuflen, off_t *off, + char **cpos, int *len, int *eofflag, + struct thread *td); +static int dirent_exists(struct vnode *vp, const char *dirname, + struct thread *td); + +#define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN+1) + 4) /* * This vnode table stores what we want to do if the filesystem doesn't @@ -98,7 +109,7 @@ struct vop_vector default_vnodeops = { .vop_revoke = VOP_PANIC, .vop_strategy = vop_nostrategy, .vop_unlock = vop_stdunlock, - .vop_vptocnp = VOP_ENOENT, + .vop_vptocnp = vop_stdvptocnp, .vop_vptofh = vop_stdvptofh, }; @@ -210,6 +221,108 @@ vop_nostrategy (struct vop_strategy_args return (EOPNOTSUPP); } +static int +get_next_dirent(struct vnode *vp, struct dirent **dpp, char *dirbuf, + int dirbuflen, off_t *off, char **cpos, int *len, + int *eofflag, struct thread *td) +{ + int error, reclen; + struct uio uio; + struct iovec iov; + struct dirent *dp; + + KASSERT(VOP_ISLOCKED(vp), ("vp %p is not locked", vp)); + KASSERT(vp->v_type == VDIR, ("vp %p is not a directory", vp)); + + if (*len == 0) { + iov.iov_base = dirbuf; + iov.iov_len = dirbuflen; + + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + uio.uio_offset = *off; + uio.uio_resid = dirbuflen; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_rw = UIO_READ; + uio.uio_td = td; + + *eofflag = 0; + +#ifdef MAC + error = mac_vnode_check_readdir(td->td_ucred, vp); + if (error == 0) +#endif + error = VOP_READDIR(vp, &uio, td->td_ucred, eofflag, + NULL, NULL); + if (error) + return (error); + + *off = uio.uio_offset; + + *cpos = dirbuf; + *len = (dirbuflen - uio.uio_resid); + } + + dp = (struct dirent *)(*cpos); + reclen = dp->d_reclen; + *dpp = dp; + + /* check for malformed directory.. */ + if (reclen < DIRENT_MINSIZE) + return (EINVAL); + + *cpos += reclen; + *len -= reclen; + + return (0); +} + +/* + * Check if a named file exists in a given directory vnode. + */ +static int +dirent_exists(struct vnode *vp, const char *dirname, struct thread *td) +{ + char *dirbuf, *cpos; + int error, eofflag, dirbuflen, len, found; + off_t off; + struct dirent *dp; + struct vattr va; + + KASSERT(VOP_ISLOCKED(vp), ("vp %p is not locked", vp)); + KASSERT(vp->v_type == VDIR, ("vp %p is not a directory", vp)); + + found = 0; + + error = VOP_GETATTR(vp, &va, td->td_ucred); + if (error) + return (found); + + dirbuflen = DEV_BSIZE; + if (dirbuflen < va.va_blocksize) + dirbuflen = va.va_blocksize; + dirbuf = (char *)malloc(dirbuflen, M_TEMP, M_WAITOK); + + off = 0; + len = 0; + do { + error = get_next_dirent(vp, &dp, dirbuf, dirbuflen, &off, + &cpos, &len, &eofflag, td); + if (error) + goto out; + + if ((dp->d_type != DT_WHT) && + !strcmp(dp->d_name, dirname)) { + found = 1; + goto out; + } + } while (len > 0 || !eofflag); + +out: + free(dirb
svn commit: r189540 - head/sys/sys
Author: marcus (doc,ports committer) Date: Sun Mar 8 19:06:26 2009 New Revision: 189540 URL: http://svn.freebsd.org/changeset/base/189540 Log: Add a prototype for the new vop_stdvptocnp function. Reviewed by: kib Approved by: kib Tested by:pho Modified: head/sys/sys/vnode.h Modified: head/sys/sys/vnode.h == --- head/sys/sys/vnode.hSun Mar 8 19:05:53 2009(r189539) +++ head/sys/sys/vnode.hSun Mar 8 19:06:26 2009(r189540) @@ -658,6 +658,7 @@ int vop_stdadvlock(struct vop_advlock_ar intvop_stdadvlockasync(struct vop_advlockasync_args *ap); intvop_stdpathconf(struct vop_pathconf_args *); intvop_stdpoll(struct vop_poll_args *); +intvop_stdvptocnp(struct vop_vptocnp_args *ap); intvop_stdvptofh(struct vop_vptofh_args *ap); intvop_eopnotsupp(struct vop_generic_args *ap); intvop_ebadf(struct vop_generic_args *ap); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189541 - head/share/man/man9
Author: marcus (doc,ports committer) Date: Sun Mar 8 19:07:44 2009 New Revision: 189541 URL: http://svn.freebsd.org/changeset/base/189541 Log: Document the new default implementation of VOP_VPTOCNP(9). Approved by: kib Modified: head/share/man/man9/VOP_VPTOCNP.9 Modified: head/share/man/man9/VOP_VPTOCNP.9 == --- head/share/man/man9/VOP_VPTOCNP.9 Sun Mar 8 19:06:26 2009 (r189540) +++ head/share/man/man9/VOP_VPTOCNP.9 Sun Mar 8 19:07:44 2009 (r189541) @@ -57,7 +57,13 @@ The remaining size of the buffer. .Pp The default implementation of .Nm -simply returns ENOENT. +scans through +.Fa vp Ns 's +parent directory looking for a dirent with a matching file number. If +.Fa vp +is not a directory, then +.Nm +returns ENOENT. .Sh LOCKS The vnode should be locked on entry and will still be locked on exit. The parent directory vnode will be unlocked on a successful exit. However, it ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189542 - head/bin/sh
Author: ed Date: Sun Mar 8 19:09:55 2009 New Revision: 189542 URL: http://svn.freebsd.org/changeset/base/189542 Log: Don't disable CR-to-NL translation when waiting for data to arrive. A difference between the old and the new TTY layer is that the new implementation does not perform any post-processing before returning data back to userspace when calling read(). sh(1)'s read turns the TTY into a raw mode before calling select(). This means that the first character will not receive any ICRNL processing. Inherit this flag from the original terminal attributes. Even though this issue is not present on RELENG_*, I'm MFCing it to make sh(1) in jails behave better. PR: bin/129566 MFC after:2 weeks Modified: head/bin/sh/miscbltin.c Modified: head/bin/sh/miscbltin.c == --- head/bin/sh/miscbltin.c Sun Mar 8 19:07:44 2009(r189541) +++ head/bin/sh/miscbltin.c Sun Mar 8 19:09:55 2009(r189542) @@ -147,6 +147,7 @@ readcmd(int argc __unused, char **argv _ if (tcgetattr(0, &told) == 0) { memcpy(&tnew, &told, sizeof(told)); cfmakeraw(&tnew); + tnew.c_iflag |= told.c_iflag & ICRNL; tcsetattr(0, TCSANOW, &tnew); tsaved = 1; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r189496 - head/sys/dev/usb/controller
Andrew Thompson wrote: Author: thompsa Date: Sat Mar 7 19:49:47 2009 New Revision: 189496 URL: http://svn.freebsd.org/changeset/base/189496 Log: (re)merge r186415,186416 from the old usb stack; o add Transaction Translator support (still missing ISOC xfers) o add EHCI_SCFLG_BIGEMMIO flag to force big-endian byte-select to be set in USBMODE o split reset work into new public routine ehci_reset so bus shim drivers can force big-endian byte-select before ehci_init o enable TT and big-endian MMIO o force a reset before ehci_init to get byte-select setup Also go back to using USB_EHCI_BIG_ENDIAN_DESC at compile time to enable the byteswapping and reduce diffs to the original commits. This fixes the new USB stack on the Cambria board. Beware there appear to be h/w issues w/ usb on 2358 boards that show up as devices not attaching properly (at least for me) and/or poor performance. I also observe significant problems on 2348 boards that I do not see with the usb1 code--which is why it remains the default configuration. Sam ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r189542 - head/bin/sh
On Sun, Mar 08, 2009 at 07:09:55PM +, Ed Schouten wrote: > Author: ed > Date: Sun Mar 8 19:09:55 2009 > New Revision: 189542 > URL: http://svn.freebsd.org/changeset/base/189542 > > Log: > Don't disable CR-to-NL translation when waiting for data to arrive. > > A difference between the old and the new TTY layer is that the new > implementation does not perform any post-processing before returning > data back to userspace when calling read(). > > sh(1)'s read turns the TTY into a raw mode before calling select(). This > means that the first character will not receive any ICRNL processing. > Inherit this flag from the original terminal attributes. > > Even though this issue is not present on RELENG_*, I'm MFCing it to make > sh(1) in jails behave better. Wouldn't this be a problem for any other tty users too, in particular for the other shells that use raw mode ? pgpU62eag2MBT.pgp Description: PGP signature
Re: svn commit: r189542 - head/bin/sh
* Kostik Belousov wrote: > Wouldn't this be a problem for any other tty users too, in particular for > the other shells that use raw mode ? Not likely. Where processing should be done (before or after storing it in a queue) is not specified (in POSIX) at all. As mentioned in the PR, it turns out Solaris has the same behaviour, for example. Shells that work on a number of different operating systems should not be affected. -- Ed Schouten WWW: http://80386.nl/ pgp8eN5oQc2aH.pgp Description: PGP signature
svn commit: r189543 - head/tools/regression/sockets/unix_gc
Author: rwatson Date: Sun Mar 8 21:06:02 2009 New Revision: 189543 URL: http://svn.freebsd.org/changeset/base/189543 Log: In UNIX domain socket GC regression test, after setting a socket non-blocking, EINPROGRESS is an acceptable result from connect(). Modified: head/tools/regression/sockets/unix_gc/unix_gc.c Modified: head/tools/regression/sockets/unix_gc/unix_gc.c == --- head/tools/regression/sockets/unix_gc/unix_gc.c Sun Mar 8 19:09:55 2009(r189542) +++ head/tools/regression/sockets/unix_gc/unix_gc.c Sun Mar 8 21:06:02 2009(r189543) @@ -160,7 +160,7 @@ static void my_connect(int sock, struct sockaddr *sa, socklen_t len) { - if (connect(sock, sa, len) < 0) + if (connect(sock, sa, len) < 0 && errno != EINPROGRESS) err(-1, "%s: connect", test); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189544 - head/sys/kern
Author: rwatson Date: Sun Mar 8 21:48:29 2009 New Revision: 189544 URL: http://svn.freebsd.org/changeset/base/189544 Log: Decompose the global UNIX domain sockets rwlock into two different locks: a global list/counter/generation counter protected by a new mutex unp_list_lock, and a global linkage rwlock, unp_global_rwlock, which protects the connections between UNIX domain sockets. This eliminates conditional lock acquisition that was previously a property of the global lock being held over sonewconn() leading to a call to uipc_attach(), which also required the global lock, but couldn't rely on it as other paths existed to uipc_attach() that didn't hold it: now uipc_attach() uses only the list lock, which follows the linkage lock in the lock order. It may also reduce contention on the global lock for some workloads. Add global UNIX domain socket locks to hard-coded witness lock order. MFC after:1 week Discussed with: kris Modified: head/sys/kern/subr_witness.c head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/subr_witness.c == --- head/sys/kern/subr_witness.cSun Mar 8 21:06:02 2009 (r189543) +++ head/sys/kern/subr_witness.cSun Mar 8 21:48:29 2009 (r189544) @@ -522,6 +522,8 @@ static struct witness_order_list_entry o /* * UNIX Domain Sockets */ + { "unp_global_rwlock", &lock_class_rw }, + { "unp_list_lock", &lock_class_mtx_sleep }, { "unp", &lock_class_mtx_sleep }, { "so_snd", &lock_class_mtx_sleep }, { NULL, NULL }, Modified: head/sys/kern/uipc_usrreq.c == --- head/sys/kern/uipc_usrreq.c Sun Mar 8 21:06:02 2009(r189543) +++ head/sys/kern/uipc_usrreq.c Sun Mar 8 21:48:29 2009(r189544) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. - * Copyright (c) 2004-2008 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,13 +99,19 @@ __FBSDID("$FreeBSD$"); #include +/* + * Locking key: + * (l) Locked using list lock + * (g) Locked using linkage lock + */ + static uma_zone_t unp_zone; -static unp_gen_t unp_gencnt; -static u_int unp_count; /* Count of local sockets. */ +static unp_gen_t unp_gencnt; /* (l) */ +static u_int unp_count; /* (l) Count of local sockets. */ static ino_t unp_ino;/* Prototype for fake inode numbers. */ -static int unp_rights; /* File descriptors in flight. */ -static struct unp_head unp_shead; /* List of local stream sockets. */ -static struct unp_head unp_dhead; /* List of local datagram sockets. */ +static int unp_rights; /* (g) File descriptors in flight. */ +static struct unp_head unp_shead; /* (l) List of stream sockets. */ +static struct unp_head unp_dhead; /* (l) List of datagram sockets. */ static const struct sockaddr sun_noname = { sizeof(sun_noname), AF_LOCAL }; @@ -152,14 +158,13 @@ SYSCTL_INT(_net_local, OID_AUTO, infligh /*- * Locking and synchronization: * - * The global UNIX domain socket rwlock (unp_global_rwlock) protects all - * global variables, including the linked lists tracking the set of allocated - * UNIX domain sockets. The global rwlock also serves to prevent deadlock - * when more than one PCB lock is acquired at a time (i.e., during - * connect()). Finally, the global rwlock protects uncounted references from - * vnodes to sockets bound to those vnodes: to safely dereference the - * v_socket pointer, the global rwlock must be held while a full reference is - * acquired. + * Three types of locks exit in the local domain socket implementation: a + * global list mutex, a global linkage rwlock, and per-unpcb mutexes. Of the + * global locks, the list lock protects the socket count, global generation + * number, and stream/datagram global lists. The linkage lock protects the + * interconnection of unpcbs, the v_socket and unp_vnode pointers, and can be + * held exclusively over the acquisition of multiple unpcb locks to prevent + * deadlock. * * UNIX domain sockets each have an unpcb hung off of their so_pcb pointer, * allocated in pru_attach() and freed in pru_detach(). The validity of that @@ -180,8 +185,8 @@ SYSCTL_INT(_net_local, OID_AUTO, infligh * atomic reads without the lock may be performed "lockless", but more * complex reads and read-modify-writes require the mutex to be held. No * lock order is defined between unpcb locks -- multiple unpcb locks may be - * acquired at the same time only when holding the global UNIX domain socket - * rwlock exclusively, which prevents deadlocks. + * acquired a
svn commit: r189545 - head/sys/kern
Author: rwatson Date: Sun Mar 8 22:19:28 2009 New Revision: 189545 URL: http://svn.freebsd.org/changeset/base/189545 Log: By default, don't compile in counters of calls to various time query functions in the kernel, as these effectively serialize parallel calls to the gettimeofday(2) system call, as well as other kernel services that use timestamps. Use the NetBSD version of the fix (kern_tc.c:1.32 by ad@) as they have picked up our timecounter code and also ran into the same problem. Reported by: kris Obtained from:NetBSD MFC after:3 days Modified: head/sys/kern/kern_tc.c Modified: head/sys/kern/kern_tc.c == --- head/sys/kern/kern_tc.c Sun Mar 8 21:48:29 2009(r189544) +++ head/sys/kern/kern_tc.c Sun Mar 8 22:19:28 2009(r189545) @@ -103,6 +103,7 @@ static int timestepwarnings; SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW, ×tepwarnings, 0, ""); +#ifdef TC_COUNTERS #define TC_STATS(foo) \ static u_int foo; \ SYSCTL_UINT(_kern_timecounter, OID_AUTO, foo, CTLFLAG_RD, &foo, 0, "");\ @@ -114,7 +115,11 @@ TC_STATS(ngetbinuptime); TC_STATS(ngetna TC_STATS(ngetbintime); TC_STATS(ngetnanotime); TC_STATS(ngetmicrotime); TC_STATS(nsetclock); +#defineTC_COUNT(var) var++ #undef TC_STATS +#else +#defineTC_COUNT(var) /* nothing */ +#endif /* TC_COUNTERS */ static void tc_windup(void); static void cpu_tick_calibrate(int); @@ -180,7 +185,7 @@ binuptime(struct bintime *bt) struct timehands *th; u_int gen; - nbinuptime++; + TC_COUNT(nbinuptime); do { th = timehands; gen = th->th_generation; @@ -194,7 +199,7 @@ nanouptime(struct timespec *tsp) { struct bintime bt; - nnanouptime++; + TC_COUNT(nnanouptime); binuptime(&bt); bintime2timespec(&bt, tsp); } @@ -204,7 +209,7 @@ microuptime(struct timeval *tvp) { struct bintime bt; - nmicrouptime++; + TC_COUNT(nmicrouptime); binuptime(&bt); bintime2timeval(&bt, tvp); } @@ -213,7 +218,7 @@ void bintime(struct bintime *bt) { - nbintime++; + TC_COUNT(nbintime); binuptime(bt); bintime_add(bt, &boottimebin); } @@ -223,7 +228,7 @@ nanotime(struct timespec *tsp) { struct bintime bt; - nnanotime++; + TC_COUNT(nnanotime); bintime(&bt); bintime2timespec(&bt, tsp); } @@ -233,7 +238,7 @@ microtime(struct timeval *tvp) { struct bintime bt; - nmicrotime++; + TC_COUNT(nmicrotime); bintime(&bt); bintime2timeval(&bt, tvp); } @@ -244,7 +249,7 @@ getbinuptime(struct bintime *bt) struct timehands *th; u_int gen; - ngetbinuptime++; + TC_COUNT(ngetbinuptime); do { th = timehands; gen = th->th_generation; @@ -258,7 +263,7 @@ getnanouptime(struct timespec *tsp) struct timehands *th; u_int gen; - ngetnanouptime++; + TC_COUNT(ngetnanouptime); do { th = timehands; gen = th->th_generation; @@ -272,7 +277,7 @@ getmicrouptime(struct timeval *tvp) struct timehands *th; u_int gen; - ngetmicrouptime++; + TC_COUNT(ngetmicrouptime); do { th = timehands; gen = th->th_generation; @@ -286,7 +291,7 @@ getbintime(struct bintime *bt) struct timehands *th; u_int gen; - ngetbintime++; + TC_COUNT(ngetbintime); do { th = timehands; gen = th->th_generation; @@ -301,7 +306,7 @@ getnanotime(struct timespec *tsp) struct timehands *th; u_int gen; - ngetnanotime++; + TC_COUNT(ngetnanotime); do { th = timehands; gen = th->th_generation; @@ -315,7 +320,7 @@ getmicrotime(struct timeval *tvp) struct timehands *th; u_int gen; - ngetmicrotime++; + TC_COUNT(ngetmicrotime); do { th = timehands; gen = th->th_generation; @@ -406,7 +411,7 @@ tc_setclock(struct timespec *ts) struct bintime bt, bt2; cpu_tick_calibrate(1); - nsetclock++; + TC_COUNT(nsetclock); nanotime(&tbef); timespec2bintime(ts, &bt); binuptime(&bt2); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189546 - head/sys/dev/usb/serial
Author: thompsa Date: Sun Mar 8 22:55:17 2009 New Revision: 189546 URL: http://svn.freebsd.org/changeset/base/189546 Log: MFp4 //depot/projects/u...@158869 Fix sael init code. Reported by: Alberto Mijares Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/serial/u3g.c Modified: head/sys/dev/usb/serial/u3g.c == --- head/sys/dev/usb/serial/u3g.c Sun Mar 8 22:19:28 2009 (r189545) +++ head/sys/dev/usb/serial/u3g.c Sun Mar 8 22:55:17 2009 (r189546) @@ -299,6 +299,7 @@ u3g_sael_m460_init(struct usb2_device *u }; struct usb2_device_request req; + usb2_error_t err; uint16_t len; uint8_t buf[0x300]; uint8_t n; @@ -320,25 +321,28 @@ u3g_sael_m460_init(struct usb2_device *u DPRINTFN(0, "too small buffer\n"); continue; } - if (usb2_do_request(udev, NULL, &req, buf)) { - DPRINTFN(0, "request %u failed\n", - (unsigned int)n); - break; - } + err = usb2_do_request(udev, NULL, &req, buf); } else { if (len > (sizeof(setup[0]) - 8)) { DPRINTFN(0, "too small buffer\n"); continue; } - if (usb2_do_request(udev, NULL, &req, - __DECONST(uint8_t *, &setup[n][8]))) { - DPRINTFN(0, "request %u failed\n", - (unsigned int)n); + err = usb2_do_request(udev, NULL, &req, + __DECONST(uint8_t *, &setup[n][8])); + } + if (err) { + DPRINTFN(1, "request %u failed\n", + (unsigned int)n); + /* +* Some of the requests will fail. Stop doing +* requests when we are getting timeouts so +* that we don't block the explore/attach +* thread forever. +*/ + if (err == USB_ERR_TIMEOUT) break; - } } } - return; } static int ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189547 - head/sys/dev/usb
Author: thompsa Date: Sun Mar 8 22:58:19 2009 New Revision: 189547 URL: http://svn.freebsd.org/changeset/base/189547 Log: MFp4 //depot/projects/u...@158868 Fix bugs and improve HID parsing. - fix possible memory leak found - fix possible NULL pointer access - fix possible invalid memory read - parsing improvements - reset item data position when a new report ID is detected. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_hid.c head/sys/dev/usb/usb_hid.h Modified: head/sys/dev/usb/usb_hid.c == --- head/sys/dev/usb/usb_hid.c Sun Mar 8 22:55:17 2009(r189546) +++ head/sys/dev/usb/usb_hid.c Sun Mar 8 22:58:19 2009(r189547) @@ -57,19 +57,25 @@ __FBSDID("$FreeBSD$"); #include static void hid_clear_local(struct hid_item *); +static uint8_t hid_get_byte(struct hid_data *s, const uint16_t wSize); -#defineMAXUSAGE 100 +#defineMAXUSAGE 64 +#defineMAXPUSH 4 struct hid_data { const uint8_t *start; const uint8_t *end; const uint8_t *p; - struct hid_item cur; - int32_t usages[MAXUSAGE]; - int nu; - int minset; - int multi; - int multimax; + struct hid_item cur[MAXPUSH]; + int32_t usages_min[MAXUSAGE]; + int32_t usages_max[MAXUSAGE]; int kindset; + uint8_t pushlevel; /* current pushlevel */ + uint8_t ncount; /* end usage item count */ + uint8_t icount; /* current usage item count */ + uint8_t nusage; /* end "usages_min/max" index */ + uint8_t iusage; /* current "usages_min/max" index */ + uint8_t ousage; /* current "usages_min/max" offset */ + uint8_t susage; /* usage set flags */ }; /** @@ -79,6 +85,8 @@ static void hid_clear_local(struct hid_item *c) { + c->loc.count = 0; + c->loc.size = 0; c->usage = 0; c->usage_minimum = 0; c->usage_maximum = 0; @@ -99,6 +107,12 @@ hid_start_parse(const void *d, int len, { struct hid_data *s; + if ((kindset-1) & kindset) { + DPRINTFN(0, "Only one bit can be " + "set in the kindset\n"); + return (NULL); + } + s = malloc(sizeof *s, M_TEMP, M_WAITOK | M_ZERO); s->start = s->p = d; s->end = ((const uint8_t *)d) + len; @@ -112,60 +126,103 @@ hid_start_parse(const void *d, int len, void hid_end_parse(struct hid_data *s) { + if (s == NULL) + return; - while (s->cur.next != NULL) { - struct hid_item *hi = s->cur.next->next; - - free(s->cur.next, M_TEMP); - s->cur.next = hi; - } free(s, M_TEMP); } /** + * get byte from HID descriptor + **/ +static uint8_t +hid_get_byte(struct hid_data *s, const uint16_t wSize) +{ + const uint8_t *ptr; + uint8_t retval; + + ptr = s->p; + + /* check if end is reached */ + if (ptr == s->end) + return (0); + + /* read out a byte */ + retval = *ptr; + + /* check if data pointer can be advanced by "wSize" bytes */ + if ((s->end - ptr) < wSize) + ptr = s->end; + else + ptr += wSize; + + /* update pointer */ + s->p = ptr; + + return (retval); +} + +/** * hid_get_item **/ int hid_get_item(struct hid_data *s, struct hid_item *h) { - struct hid_item *c = &s->cur; + struct hid_item *c; unsigned int bTag, bType, bSize; uint32_t oldpos; - const uint8_t *data; + int32_t mask; int32_t dval; - const uint8_t *p; - struct hid_item *hi; - int i; -top: - if (s->multimax != 0) { - if (s->multi < s->multimax) { - c->usage = s->usages[MIN(s->multi, s->nu - 1)]; - s->multi++; + if (s == NULL) + return (0); + + c = &s->cur[s->pushlevel]; + + top: + /* check if there is an array of items */ + if ((s->icount != s->ncount) && + (s->iusage != s->nusage)) { + dval = s->usages_min[s->iusage] + s->ousage; + c->usage = dval; + if (dval == s->usages_max[s->iusage]) { + s->iusage ++; + s->ousage = 0; + } else { + s->ousage ++; + } + s->icount ++; + /* +* Only cop
svn commit: r189548 - head/sys/arm/xscale/ixp425
Author: sam Date: Sun Mar 8 23:45:56 2009 New Revision: 189548 URL: http://svn.freebsd.org/changeset/base/189548 Log: o mark unexpected callbacks more clearly o unwrap some lines Modified: head/sys/arm/xscale/ixp425/ixp425_pci.c Modified: head/sys/arm/xscale/ixp425/ixp425_pci.c == --- head/sys/arm/xscale/ixp425/ixp425_pci.c Sun Mar 8 22:58:19 2009 (r189547) +++ head/sys/arm/xscale/ixp425/ixp425_pci.c Sun Mar 8 23:45:56 2009 (r189548) @@ -97,10 +97,8 @@ static void ixp425_pci_conf_reg_write(struct ixppcib_softc *sc, uint32_t reg, uint32_t data) { - PCI_CSR_WRITE_4(sc, - PCI_CRP_AD_CBE, ((reg & ~3) | COMMAND_CRP_WRITE)); - PCI_CSR_WRITE_4(sc, - PCI_CRP_AD_WDATA, data); + PCI_CSR_WRITE_4(sc, PCI_CRP_AD_CBE, ((reg & ~3) | COMMAND_CRP_WRITE)); + PCI_CSR_WRITE_4(sc, PCI_CRP_AD_WDATA, data); } static int @@ -325,7 +323,8 @@ ixppcib_activate_resource(device_t bus, struct resource *r) { - device_printf(bus, "%s called activate_resource\n", device_get_nameunit(child)); + device_printf(bus, "%s called activate_resource (unexpected)\n", + device_get_nameunit(child)); return (ENXIO); } @@ -334,7 +333,8 @@ ixppcib_deactivate_resource(device_t bus struct resource *r) { - device_printf(bus, "%s called deactivate_resource\n", device_get_nameunit(child)); + device_printf(bus, "%s called deactivate_resource (unexpected)\n", + device_get_nameunit(child)); return (ENXIO); } @@ -343,7 +343,8 @@ ixppcib_release_resource(device_t bus, d struct resource *r) { - device_printf(bus, "%s called release_resource\n", device_get_nameunit(child)); + device_printf(bus, "%s called release_resource (unexpected)\n", + device_get_nameunit(child)); return (ENXIO); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189549 - in head/lib/libthr: . thread
Author: davidxu Date: Mon Mar 9 02:34:02 2009 New Revision: 189549 URL: http://svn.freebsd.org/changeset/base/189549 Log: Don't reference non-existent __fcntl_compat if WITHOUT_SYSCALL_COMPAT is defined. Submitted by: Pawel Worach "pawel dot worach at gmail dot com" Modified: head/lib/libthr/Makefile head/lib/libthr/thread/thr_syscalls.c Modified: head/lib/libthr/Makefile == --- head/lib/libthr/MakefileSun Mar 8 23:45:56 2009(r189548) +++ head/lib/libthr/MakefileMon Mar 9 02:34:02 2009(r189549) @@ -51,4 +51,8 @@ SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthr SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a .endif +.if !defined(WITHOUT_SYSCALL_COMPAT) +CFLAGS+=-DSYSCALL_COMPAT +.endif + .include Modified: head/lib/libthr/thread/thr_syscalls.c == --- head/lib/libthr/thread/thr_syscalls.c Sun Mar 8 23:45:56 2009 (r189548) +++ head/lib/libthr/thread/thr_syscalls.c Mon Mar 9 02:34:02 2009 (r189549) @@ -132,7 +132,9 @@ int __aio_suspend(const struct aiocb * c int__close(int); int__connect(int, const struct sockaddr *, socklen_t); int__fcntl(int, int,...); +#ifdef SYSCALL_COMPAT extern int __fcntl_compat(int, int,...); +#endif int__fsync(int); int__msync(void *, size_t, int); int__nanosleep(const struct timespec *, struct timespec *); @@ -253,7 +255,11 @@ __fcntl(int fd, int cmd,...) ret = __sys_fcntl(fd, cmd); break; default: +#ifdef SYSCALL_COMPAT ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); +#else + ret = EOPNOTSUPP; +#endif } va_end(ap); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189550 - head/sys/dev/if_ndis
Author: sam Date: Mon Mar 9 02:37:52 2009 New Revision: 189550 URL: http://svn.freebsd.org/changeset/base/189550 Log: Fix TXPMGT handling: o correct dBm<->mW conversion logic o set net80211 TXPMGT capability only if driver reports it is capable PR: kern/132342 Submitted by: "Paul B. Mahol" Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c == --- head/sys/dev/if_ndis/if_ndis.c Mon Mar 9 02:34:02 2009 (r189549) +++ head/sys/dev/if_ndis/if_ndis.c Mon Mar 9 02:37:52 2009 (r189550) @@ -102,7 +102,7 @@ SYSCTL_INT(_hw_ndisusb, OID_AUTO, halt, "Halt NDIS USB driver when it's attached"); /* 0 - 30 dBm to mW conversion table */ -const uint16_t dBm2mW[] = { +static const uint16_t dBm2mW[] = { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 25, 28, @@ -749,7 +749,7 @@ ndis_attach(dev) ic->ic_ifp = ifp; ic->ic_opmode = IEEE80211_M_STA; ic->ic_phytype = IEEE80211_T_DS; - ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_IBSS | IEEE80211_C_TXPMGT; + ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_IBSS; setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO); len = 0; r = ndis_get_info(sc, OID_802_11_NETWORK_TYPES_SUPPORTED, @@ -928,6 +928,11 @@ got_crypto: r = ndis_get_info(sc, OID_802_11_POWER_MODE, &arg, &i); if (r == 0) ic->ic_caps |= IEEE80211_C_PMGT; + + r = ndis_get_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &i); + if (r == 0) + ic->ic_caps |= IEEE80211_C_TXPMGT; + bcopy(eaddr, &ic->ic_myaddr, sizeof(eaddr)); ieee80211_ifattach(ic); ic->ic_raw_xmit = ndis_raw_xmit; @@ -2325,9 +2330,10 @@ ndis_setstate_80211(sc) ndis_set_info(sc, OID_802_11_POWER_MODE, &arg, &len); /* Set TX power */ - if (ic->ic_txpowlimit < sizeof(dBm2mW)) { - len = sizeof(arg); + if ((ic->ic_caps & IEEE80211_C_TXPMGT) && + ic->ic_txpowlimit < (sizeof(dBm2mW) / sizeof(dBm2mW[0]))) { arg = dBm2mW[ic->ic_txpowlimit]; + len = sizeof(arg); ndis_set_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &len); } @@ -2798,11 +2804,10 @@ ndis_getstate_80211(sc) } /* Get TX power */ - len = sizeof(arg); - rval = ndis_get_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &len); - - if (!rval) { - for (i = 0; i < sizeof(dBm2mW); i++) + if (ic->ic_caps & IEEE80211_C_TXPMGT) { + len = sizeof(arg); + ndis_get_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &len); + for (i = 0; i < (sizeof(dBm2mW) / sizeof(dBm2mW[0])); i++) if (dBm2mW[i] >= arg) break; ic->ic_txpowlimit = i; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189551 - head/sys/amd64/amd64
Author: alc Date: Mon Mar 9 03:35:25 2009 New Revision: 189551 URL: http://svn.freebsd.org/changeset/base/189551 Log: Change pmap_enter_quick_locked() so that it uses the kernel's direct map instead of the pmap's recursive mapping to access the lowest level of the page table when it maps a user-space virtual address. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Mon Mar 9 02:37:52 2009(r189550) +++ head/sys/amd64/amd64/pmap.c Mon Mar 9 03:35:25 2009(r189551) @@ -3253,17 +3253,12 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ return (mpte); } } + pte = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mpte)); + pte = &pte[pmap_pte_index(va)]; } else { mpte = NULL; + pte = vtopte(va); } - - /* -* This call to vtopte makes the assumption that we are -* entering the page into the current pmap. In order to support -* quick entry into any pmap, one would likely use pmap_pte. -* But that isn't as quick as vtopte. -*/ - pte = vtopte(va); if (*pte) { if (mpte != NULL) { mpte->wire_count--; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189552 - head/share/man/man7
Author: delphij Date: Mon Mar 9 05:41:04 2009 New Revision: 189552 URL: http://svn.freebsd.org/changeset/base/189552 Log: A system with plenty of memory would not require so much swap for generic usage. Discussed with: dillon Modified: head/share/man/man7/tuning.7 Modified: head/share/man/man7/tuning.7 == --- head/share/man/man7/tuning.7Mon Mar 9 03:35:25 2009 (r189551) +++ head/share/man/man7/tuning.7Mon Mar 9 05:41:04 2009 (r189552) @@ -51,7 +51,9 @@ I usually create, in order, a 128M root, and use any remaining space for .Pa /home . .Pp -You should typically size your swap space to approximately 2x main memory. +You should typically size your swap space to approximately 2x main memory +for systems with less than 2GB of RAM, or approximately 1x main memory +if you have more. If you do not have a lot of RAM, though, you will generally want a lot more swap. It is not recommended that you configure any less than ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189553 - head/lib/libthr/thread
Author: davidxu Date: Mon Mar 9 05:54:43 2009 New Revision: 189553 URL: http://svn.freebsd.org/changeset/base/189553 Log: Don't ignore other fcntl functions, directly call __sys_fcntl if WITHOUT_SYSCALL_COMPAT is not defined. Reviewed by: deischen Modified: head/lib/libthr/thread/thr_syscalls.c Modified: head/lib/libthr/thread/thr_syscalls.c == --- head/lib/libthr/thread/thr_syscalls.c Mon Mar 9 05:41:04 2009 (r189552) +++ head/lib/libthr/thread/thr_syscalls.c Mon Mar 9 05:54:43 2009 (r189553) @@ -258,7 +258,7 @@ __fcntl(int fd, int cmd,...) #ifdef SYSCALL_COMPAT ret = __fcntl_compat(fd, cmd, va_arg(ap, void *)); #else - ret = EOPNOTSUPP; + ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); #endif } va_end(ap); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189555 - head/sys/dev/re
Author: yongari Date: Mon Mar 9 06:02:55 2009 New Revision: 189555 URL: http://svn.freebsd.org/changeset/base/189555 Log: Add a new tunable hw.re.prefer_iomap which disables memory register mapping. The tunable is OFF for all controllers except RTL8169SC family. RTL8169SC seems to require more magic to use memory register mapping. r187483 added a fix for RTL8169SCe controller but it does not looke like fix other variants of RTL8169SC. Tested by:Gavin Stone-Tolcher g.stone-tolcher <> its dot uq dot edu dot au Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c == --- head/sys/dev/re/if_re.c Mon Mar 9 06:02:05 2009(r189554) +++ head/sys/dev/re/if_re.c Mon Mar 9 06:02:55 2009(r189555) @@ -158,6 +158,8 @@ MODULE_DEPEND(re, miibus, 1, 1, 1); /* Tunables. */ static int msi_disable = 0; TUNABLE_INT("hw.re.msi_disable", &msi_disable); +static int prefer_iomap = 0; +TUNABLE_INT("hw.re.prefer_iomap", &prefer_iomap); #define RE_CSUM_FEATURES(CSUM_IP | CSUM_TCP | CSUM_UDP) @@ -1118,25 +1120,35 @@ re_attach(device_t dev) pci_enable_busmaster(dev); devid = pci_get_device(dev); - /* Prefer memory space register mapping over IO space. */ - sc->rl_res_id = PCIR_BAR(1); - sc->rl_res_type = SYS_RES_MEMORY; - /* RTL8168/8101E seems to use different BARs. */ - if (devid == RT_DEVICEID_8168 || devid == RT_DEVICEID_8101E) - sc->rl_res_id = PCIR_BAR(2); + /* +* Prefer memory space register mapping over IO space. +* Because RTL8169SC does not seem to work when memory mapping +* is used always activate io mapping. +*/ + if (devid == RT_DEVICEID_8169SC) + prefer_iomap = 1; + if (prefer_iomap == 0) { + sc->rl_res_id = PCIR_BAR(1); + sc->rl_res_type = SYS_RES_MEMORY; + /* RTL8168/8101E seems to use different BARs. */ + if (devid == RT_DEVICEID_8168 || devid == RT_DEVICEID_8101E) + sc->rl_res_id = PCIR_BAR(2); + } else { + sc->rl_res_id = PCIR_BAR(0); + sc->rl_res_type = SYS_RES_IOPORT; + } sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, &sc->rl_res_id, RF_ACTIVE); - - if (sc->rl_res == NULL) { + if (sc->rl_res == NULL && prefer_iomap == 0) { sc->rl_res_id = PCIR_BAR(0); sc->rl_res_type = SYS_RES_IOPORT; sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, &sc->rl_res_id, RF_ACTIVE); - if (sc->rl_res == NULL) { - device_printf(dev, "couldn't map ports/memory\n"); - error = ENXIO; - goto fail; - } + } + if (sc->rl_res == NULL) { + device_printf(dev, "couldn't map ports/memory\n"); + error = ENXIO; + goto fail; } sc->rl_btag = rman_get_bustag(sc->rl_res); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"