svn commit: r223073 - head/sys/netinet/ipfw

2011-06-14 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jun 14 07:20:16 2011
New Revision: 223073
URL: http://svn.freebsd.org/changeset/base/223073

Log:
  Add IPv6 support to the ipfw uid/gid check. Pass an ip_fw_args structure
  to the check_uidgid() function, since it contains all needed arguments
  and also pointer to mbuf and now it is possible use in_pcblookup_mbuf()
  function.
  
  Since i can not test it for the non-FreeBSD case, i keep this ifdef
  unchanged.
  
  Tested by:Alexander V. Chernikov
  MFC after:3 weeks

Modified:
  head/sys/netinet/ipfw/ip_fw2.c

Modified: head/sys/netinet/ipfw/ip_fw2.c
==
--- head/sys/netinet/ipfw/ip_fw2.c  Tue Jun 14 06:45:48 2011
(r223072)
+++ head/sys/netinet/ipfw/ip_fw2.c  Tue Jun 14 07:20:16 2011
(r223073)
@@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #ifdef INET6
+#include 
 #include 
 #include 
 #endif
@@ -646,21 +647,27 @@ send_reject(struct ip_fw_args *args, int
  * we tried and failed, or any other value if successful.
  */
 static int
-check_uidgid(ipfw_insn_u32 *insn, int proto, struct ifnet *oif,
-struct in_addr dst_ip, u_int16_t dst_port, struct in_addr src_ip,
-u_int16_t src_port, int *ugid_lookupp,
-struct ucred **uc, struct inpcb *inp)
+check_uidgid(ipfw_insn_u32 *insn, struct ip_fw_args *args, int *ugid_lookupp,
+struct ucred **uc)
 {
 #ifndef __FreeBSD__
+   /* XXX */
return cred_check(insn, proto, oif,
dst_ip, dst_port, src_ip, src_port,
(struct bsd_ucred *)uc, ugid_lookupp, ((struct mbuf *)inp)->m_skb);
 #else  /* FreeBSD */
+   struct in_addr src_ip, dst_ip;
struct inpcbinfo *pi;
+   struct ipfw_flow_id *id;
+   struct inpcb *pcb, *inp;
+   struct ifnet *oif;
int lookupflags;
-   struct inpcb *pcb;
int match;
 
+   id = &args->f_id;
+   inp = args->inp;
+   oif = args->oif;
+
/*
 * Check to see if the UDP or TCP stack supplied us with
 * the PCB. If so, rather then holding a lock and looking
@@ -681,10 +688,10 @@ check_uidgid(ipfw_insn_u32 *insn, int pr
 */
if (*ugid_lookupp == -1)
return (0);
-   if (proto == IPPROTO_TCP) {
+   if (id->proto == IPPROTO_TCP) {
lookupflags = 0;
pi = &V_tcbinfo;
-   } else if (proto == IPPROTO_UDP) {
+   } else if (id->proto == IPPROTO_UDP) {
lookupflags = INPLOOKUP_WILDCARD;
pi = &V_udbinfo;
} else
@@ -692,19 +699,36 @@ check_uidgid(ipfw_insn_u32 *insn, int pr
lookupflags |= INPLOOKUP_RLOCKPCB;
match = 0;
if (*ugid_lookupp == 0) {
-   /*
-* XXXRW: If we had the mbuf here, could use
-* in_pcblookup_mbuf().
-*/
-   pcb =  (oif) ?
-   in_pcblookup(pi,
-   dst_ip, htons(dst_port),
-   src_ip, htons(src_port),
-   lookupflags, oif) :
-   in_pcblookup(pi,
-   src_ip, htons(src_port),
-   dst_ip, htons(dst_port),
-   lookupflags, NULL);
+   if (id->addr_type == 6) {
+#ifdef INET6
+   if (oif == NULL)
+   pcb = in6_pcblookup_mbuf(pi,
+   &id->src_ip6, htons(id->src_port),
+   &id->dst_ip6, htons(id->dst_port),
+   lookupflags, oif, args->m);
+   else
+   pcb = in6_pcblookup_mbuf(pi,
+   &id->dst_ip6, htons(id->dst_port),
+   &id->src_ip6, htons(id->src_port),
+   lookupflags, oif, args->m);
+#else
+   *ugid_lookupp = -1;
+   return (0);
+#endif
+   } else {
+   src_ip.s_addr = htonl(id->src_ip);
+   dst_ip.s_addr = htonl(id->dst_ip);
+   if (oif == NULL)
+   pcb = in_pcblookup_mbuf(pi,
+   src_ip, htons(id->src_port),
+   dst_ip, htons(id->dst_port),
+   lookupflags, oif, args->m);
+   else
+   pcb = in_pcblookup_mbuf(pi,
+   dst_ip, htons(id->dst_port),
+   src_ip, htons(id->src_port),
+   lookupflags, oif, args->m);
+   }
if (pcb != NULL) {
INP_RLOCK_ASSERT(pcb);
*uc = crhold(pcb->inp_cred);
@@ -719,14 +743,14 @@ check_uidgid(ipfw_insn_u32 *

svn commit: r223077 - head/sys/netinet/libalias

2011-06-14 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jun 14 12:06:38 2011
New Revision: 223077
URL: http://svn.freebsd.org/changeset/base/223077

Log:
  Sort alias mode flags in the increasing order.

Modified:
  head/sys/netinet/libalias/alias.h

Modified: head/sys/netinet/libalias/alias.h
==
--- head/sys/netinet/libalias/alias.h   Tue Jun 14 10:50:16 2011
(r223076)
+++ head/sys/netinet/libalias/alias.h   Tue Jun 14 12:06:38 2011
(r223077)
@@ -197,17 +197,6 @@ struct mbuf*m_megapullup(struct mbuf
  */
 #definePKT_ALIAS_RESET_ON_ADDR_CHANGE  0x20
 
-#ifndef NO_FW_PUNCH
-/*
- * If PKT_ALIAS_PUNCH_FW is set, active FTP and IRC DCC connections will
- * create a 'hole' in the firewall to allow the transfers to work.  The
- * ipfw rule number that the hole is created with is controlled by
- * PacketAliasSetFWBase().  The hole will be attached to that
- * particular alias_link, so when the link goes away the hole is deleted.
- */
-#definePKT_ALIAS_PUNCH_FW  0x100
-#endif
-
 /*
  * If PKT_ALIAS_PROXY_ONLY is set, then NAT will be disabled and only
  * transparent proxying is performed.
@@ -220,6 +209,17 @@ struct mbuf*m_megapullup(struct mbuf
  */
 #definePKT_ALIAS_REVERSE   0x80
 
+#ifndef NO_FW_PUNCH
+/*
+ * If PKT_ALIAS_PUNCH_FW is set, active FTP and IRC DCC connections will
+ * create a 'hole' in the firewall to allow the transfers to work.  The
+ * ipfw rule number that the hole is created with is controlled by
+ * PacketAliasSetFWBase().  The hole will be attached to that
+ * particular alias_link, so when the link goes away the hole is deleted.
+ */
+#definePKT_ALIAS_PUNCH_FW  0x100
+#endif
+
 /* Function return codes. */
 #definePKT_ALIAS_ERROR -1
 #definePKT_ALIAS_OK1
___
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: r223078 - in head: sbin/ifconfig sys/net

2011-06-14 Thread Luigi Rizzo
Author: luigi
Date: Tue Jun 14 12:40:55 2011
New Revision: 223078
URL: http://svn.freebsd.org/changeset/base/223078

Log:
  Grab one of the ifcap bits for netmap, and enable printing in ifconfig.
  
  Document the fact that we might want an IFCAP_CANTCHANGE mask,
  even though the value is not yet used in sys/net/if.c
  
  (asked on -current a week ago, no feedback so i assume no objection).

Modified:
  head/sbin/ifconfig/ifconfig.c
  head/sys/net/if.h

Modified: head/sbin/ifconfig/ifconfig.c
==
--- head/sbin/ifconfig/ifconfig.c   Tue Jun 14 12:06:38 2011
(r223077)
+++ head/sbin/ifconfig/ifconfig.c   Tue Jun 14 12:40:55 2011
(r223078)
@@ -908,7 +908,7 @@ unsetifdescr(const char *val, int value,
 #defineIFCAPBITS \
 "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
 "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \
-"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE"
+"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP"
 
 /*
  * Print the status of the interface.  If an address family was

Modified: head/sys/net/if.h
==
--- head/sys/net/if.h   Tue Jun 14 12:06:38 2011(r223077)
+++ head/sys/net/if.h   Tue Jun 14 12:40:55 2011(r223078)
@@ -199,6 +199,13 @@ struct if_data {
  *   field.  IFCAP_* and CSUM_* do not match one to one and CSUM_* may be
  *   more detailed or differenciated than IFCAP_*.
  *   Hwassist features are defined CSUM_* in sys/mbuf.h
+ *
+ * Capabilities that cannot be arbitrarily changed with ifconfig/ioctl
+ * are listed in IFCAP_CANTCHANGE, similar to IFF_CANTCHANGE.
+ * This is not strictly necessary because the common code never
+ * changes capabilities, and it is left to the individual driver
+ * to do the right thing. However, having the filter here
+ * avoids replication of the same code in all individual drivers.
  */
 #defineIFCAP_RXCSUM0x1  /* can offload checksum on RX 
*/
 #defineIFCAP_TXCSUM0x2  /* can offload checksum on TX 
*/
@@ -220,12 +227,15 @@ struct if_data {
 #defineIFCAP_POLLING_NOCOUNT   0x2 /* polling ticks cannot be 
fragmented */
 #defineIFCAP_VLAN_HWTSO0x4 /* can do IFCAP_TSO on VLANs */
 #defineIFCAP_LINKSTATE 0x8 /* the runtime link state is 
dynamic */
+#defineIFCAP_NETMAP0x10 /* netmap mode 
supported/enabled */
 
 #define IFCAP_HWCSUM   (IFCAP_RXCSUM | IFCAP_TXCSUM)
 #defineIFCAP_TSO   (IFCAP_TSO4 | IFCAP_TSO6)
 #defineIFCAP_WOL   (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | 
IFCAP_WOL_MAGIC)
 #defineIFCAP_TOE   (IFCAP_TOE4 | IFCAP_TOE6)
 
+#defineIFCAP_CANTCHANGE(IFCAP_NETMAP)
+
 #defineIFQ_MAXLEN  50
 #defineIFNET_SLOWHZ1   /* granularity is 1 second */
 
___
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: r223079 - head/sbin/ipfw

2011-06-14 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jun 14 13:02:26 2011
New Revision: 223079
URL: http://svn.freebsd.org/changeset/base/223079

Log:
  Check nat id a bit more strictly.

Modified:
  head/sbin/ipfw/nat.c

Modified: head/sbin/ipfw/nat.c
==
--- head/sbin/ipfw/nat.cTue Jun 14 12:40:55 2011(r223078)
+++ head/sbin/ipfw/nat.cTue Jun 14 13:02:26 2011(r223079)
@@ -721,16 +721,18 @@ ipfw_config_nat(int ac, char **av)
 {
struct cfg_nat *n;  /* Nat instance configuration. */
int i, off, tok, ac1;
-   char *id, *buf, **av1;
+   char *id, *buf, **av1, *end;
size_t len;
 
av++; ac--;
/* Nat id. */
-   if (ac && isdigit(**av)) {
-   id = *av;
-   ac--; av++;
-   } else
+   if (ac == 0)
errx(EX_DATAERR, "missing nat id");
+   id = *av;
+   i = (int)strtol(id, &end, 0);
+   if (i <= 0 || *end != '\0')
+   errx(EX_DATAERR, "illegal nat id: %s", id);
+   av++; ac--;
if (ac == 0)
errx(EX_DATAERR, "missing option");
 
@@ -787,7 +789,6 @@ ipfw_config_nat(int ac, char **av)
off = sizeof(*n);
memset(buf, 0, len);
n = (struct cfg_nat *)buf;
-   i = atoi(id);
n->id = i;
 
while (ac > 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: r223080 - in head: sbin/ipfw sys/netinet/ipfw sys/netinet/libalias

2011-06-14 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jun 14 13:35:24 2011
New Revision: 223080
URL: http://svn.freebsd.org/changeset/base/223080

Log:
  Implement "global" mode for ipfw nat. It is similar to natd(8)
  "globalport" option for multiple NAT instances.
  
  If ipfw rule contains "global" keyword instead of nat_number, then
  for each outgoing packet ipfw_nat looks up translation state in all
  configured nat instances. If an entry is found, packet aliased
  according to that entry, otherwise packet is passed unchanged.
  
  User can specify "skip_global" option in NAT configuration to exclude
  an instance from the lookup in global mode.
  
  PR:   kern/157867
  Submitted by: Alexander V. Chernikov (previous version)
  Tested by:Eugene Grosbein

Modified:
  head/sbin/ipfw/ipfw.8
  head/sbin/ipfw/ipfw2.c
  head/sbin/ipfw/ipfw2.h
  head/sbin/ipfw/nat.c
  head/sys/netinet/ipfw/ip_fw2.c
  head/sys/netinet/ipfw/ip_fw_nat.c
  head/sys/netinet/libalias/alias.h

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Tue Jun 14 13:02:26 2011(r223079)
+++ head/sbin/ipfw/ipfw.8   Tue Jun 14 13:35:24 2011(r223080)
@@ -1,7 +1,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 30, 2011
+.Dd June 14, 2011
 .Dt IPFW 8
 .Os
 .Sh NAME
@@ -2435,6 +2435,27 @@ Reset table of the packet aliasing engin
 Reverse the way libalias handles aliasing.
 .It Cm proxy_only
 Obey transparent proxy rules only, packet aliasing is not performed.
+.It Cm skip_global
+Skip instance in case of global state lookup (see below).
+.El
+.Pp
+Some specials value can be supplied instead of
+.Va nat_number:
+.Bl -tag -width indent
+.It Cm global
+Looks up translation state in all configured nat instances.
+If an entry is found, packet is aliased according to that entry.
+If no entry was found in any of the instances, packet is passed unchanged,
+and no new entry will be created.
+See section
+.Sx MULTIPLE INSTANCES
+in
+.Xr natd 8
+for more information.
+.It Cm tablearg
+Uses argument supplied in lookup table. See
+.Sx LOOKUP TABLES
+section below for more information on lookup tables.
 .El
 .Pp
 To let the packet continue after being (de)aliased, set the sysctl variable

Modified: head/sbin/ipfw/ipfw2.c
==
--- head/sbin/ipfw/ipfw2.c  Tue Jun 14 13:02:26 2011(r223079)
+++ head/sbin/ipfw/ipfw2.c  Tue Jun 14 13:35:24 2011(r223080)
@@ -1121,8 +1121,11 @@ show_ipfw(struct ip_fw *rule, int pcwidt
break;
 
case O_NAT:
-   PRINT_UINT_ARG("nat ", cmd->arg1);
-   break;
+   if (cmd->arg1 != 0)
+   PRINT_UINT_ARG("nat ", cmd->arg1);
+   else
+   printf("nat global");
+   break;
 
case O_SETFIB:
PRINT_UINT_ARG("setfib ", cmd->arg1);
@@ -2738,9 +2741,14 @@ ipfw_add(char *av[])
break;
 
case TOK_NAT:
-   action->opcode = O_NAT;
-   action->len = F_INSN_SIZE(ipfw_insn_nat);
-   goto chkarg;
+   action->opcode = O_NAT;
+   action->len = F_INSN_SIZE(ipfw_insn_nat);
+   if (_substrcmp(*av, "global") == 0) {
+   action->arg1 = 0;
+   av++;
+   break;
+   } else
+   goto chkarg;
 
case TOK_QUEUE:
action->opcode = O_QUEUE;

Modified: head/sbin/ipfw/ipfw2.h
==
--- head/sbin/ipfw/ipfw2.h  Tue Jun 14 13:02:26 2011(r223079)
+++ head/sbin/ipfw/ipfw2.h  Tue Jun 14 13:35:24 2011(r223080)
@@ -178,6 +178,7 @@ enum tokens {
TOK_DENY_INC,
TOK_SAME_PORTS,
TOK_UNREG_ONLY,
+   TOK_SKIP_GLOBAL,
TOK_RESET_ADDR,
TOK_ALIAS_REV,
TOK_PROXY_ONLY,

Modified: head/sbin/ipfw/nat.c
==
--- head/sbin/ipfw/nat.cTue Jun 14 13:02:26 2011(r223079)
+++ head/sbin/ipfw/nat.cTue Jun 14 13:35:24 2011(r223080)
@@ -53,6 +53,7 @@ static struct _s_x nat_params[] = {
{ "deny_in",TOK_DENY_INC },
{ "same_ports", TOK_SAME_PORTS },
{ "unreg_only", TOK_UNREG_ONLY },
+   { "skip_global",TOK_SKIP_GLOBAL },
{ "reset",  TOK_RESET_ADDR },
{ "reverse",TOK_ALIAS_REV },
{ "proxy_only", TOK_PROXY_ONLY },
@@ -628,6 +629,9 @@ print_nat_config(unsigned char *buf)
} else if (n->mode & PKT_ALIAS_SAME_PORTS) {
printf(" same_ports");
n->mode &= ~PKT_ALIAS_SAME_PORTS;
+

svn commit: r223081 - in head: sbin/camcontrol sys/cam sys/cam/scsi

2011-06-14 Thread Justin T. Gibbs
Author: gibbs
Date: Tue Jun 14 14:53:17 2011
New Revision: 223081
URL: http://svn.freebsd.org/changeset/base/223081

Log:
  Lay groundwork in CAM for recording and reporting physical path and
  other device attributes stored in the CAM Existing Device Table (EDT).
  This includes some infrastructure requried by the enclosure services
  driver to export physical path information.
  
  Make the CAM device advanced info interface accept store requests.
  
sys/cam/scsi/scsi_all.c:
sys/cam/scsi/scsi_all.h:
- Replace scsi_get_sas_addr() with a scsi_get_devid() which takes
  a callback that decides whether to accept a particular descriptor.
  Provide callbacks for NAA IEEE Registered addresses and for SAS
  addresses, replacing the old function.  This is needed because
  the old function doesn't work for an enclosure address for a SAS
  device, which is not flagged as a SAS address, but is NAA IEEE
  Registered.  It may be worthwhile merging this interface with the
  devid match interface.
- Add a few more defines for some device ID fields.
  
sbin/camcontrol/camcontrol.c:
- Update for the CCB_DEV_ADVINFO interface change.
  
cam/cam_xpt_internal.h:
- Add the new fields for the physical path string to the CAM EDT.
cam/cam_ccb.h:
- Rename CCB_GDEV_ADVINFO to simply CCB_DEV_ADVINFO, and the ccb
  structure to ccb_dev_advinfo.
- Add a flag that changes this CCB's action to store, rather than
  the default, retrieve.
- Add a new buffer type, CDAI_TYPE_PHYS_PATH, for the new CAM EDT
  physpath field.
- Remove the never-implemented transport & proto flags.
cam/cam_xpt.c:
cam/cam_xpt.h:
- Add xpt_getattr(), which provides a wrapper for fetching a device's
  attribute using the GEOM strings as key.  This method currently
  supports "GEOM::ident" and "GEOM::physpath".
  
  Submitted by: will
  Reviewed by : gibbs
  
  Extend the XPT_DEV_MATCH api to allow a device search by device ID.
  As far as the API is concerned, device ID is a binary blob to be
  interpreted by the transport layer.  The SCSI implementation assumes
  it is an array of VPD device ID descriptors.
  
sys/cam/cam_ccb.h:
Create a new structure, device_id_match_pattern, and
update the XPT_DEV_MATCH datastructures and flags so
that this pattern type can be used.
  
sys/cam/cam_xpt.c:
- A single pattern matching on both inquiry data and device
  ID is invalid.  Report any violators.
- Pass device ID match requests through to the new routine
  scsi_devid_match().  The direct call of a SCSI routine is
  a layering violation, but no worse than the one a few
  lines up that checks inquiry data.  Defer cleaning this
  up until our future, larger, rototilling of CAM.
- Zero out cam_ed and cam_et nodes on allocation.  Prior to
  this change, device_id_len and device_id were not inialized,
  preventing proper detection of the presence of this
  information.
  
sys/cam/scsi/scsi_all.c:
sys/cam/scsi/scsi_all.h:
Add the scsi_match_devid() routine.
  
  Add a helper function for extracting peripherial driver names
  
sys/cam/cam_periph.c:
sys/cam/cam_periph.h:
Add the cam_periph_list() method which fills an sbuf
with a comma delimited list of the peripheral instances
associated with a given CAM path.
  
  Add a helper functions for SCSI commands used by the SES driver.
  
sys/cam/scsi/scsi_all.c:
sys/cam/scsi/scsi_all.h:
Add structure definitions and csio filling functions for
the receive diagnostic results and send diagnostic commands.
  
  Misc CAM XPT cleanups.
  
sys/cam/cam_xpt.c:
Broadcast AC_FOUND_DEVICE and AC_PATH_REGISTERED
events at the time async event handlers are attached
even when registering just for events on a partitular
SIM.  Previously, you had to register for these
events on all SIMs in the system in order to get
the initial broadcast even though subsequent device
and path arrivals would be delivered.
  
sys/cam/cam_xpt.c:
Remove SIM mutex held asserts from path accessors.
CAM paths are reference counted and it is this
reference count, not the sim mutex, that garantees
they are stable.
  
  Sponsored by: Spectra Logic Corporation

Modified:
  head/sbin/camcontrol/camcontrol.c
  head/sys/cam/cam_ccb.h
  head/sys/cam/cam_periph.c
  head/sys/cam/cam_periph.h
  head/sys/cam/cam_xpt.c
  head/sys/cam/cam_xpt.h
  head/sys/cam/cam_xpt_internal.h
  head/sys/cam/scsi/scsi_all.c
  head/sys/cam/scsi/scsi_all.h
  head/sys/cam/scsi/scsi_pass.c
  head/sys/cam/scsi/scsi_xpt.c

Modified: head/sbin/camcontrol/camcontrol.c
===

svn commit: r223082 - head/contrib/gdb/gdb

2011-06-14 Thread Andreas Tobler
Author: andreast
Date: Tue Jun 14 15:20:30 2011
New Revision: 223082
URL: http://svn.freebsd.org/changeset/base/223082

Log:
  - Check on target wordsize instead of compile time define if we build on
64-bit PowerPC or 32-bit PowerPC.
  - Make gdb work on powerpc64, the code for this is obtained from
ppc-linux-tdep.c.
  - Remove non-elf core read functionality. Implement core read functionality
similar like other FreeBSD targets.
  - Set long double limitations.

Modified:
  head/contrib/gdb/gdb/ppcfbsd-tdep.c

Modified: head/contrib/gdb/gdb/ppcfbsd-tdep.c
==
--- head/contrib/gdb/gdb/ppcfbsd-tdep.c Tue Jun 14 14:53:17 2011
(r223081)
+++ head/contrib/gdb/gdb/ppcfbsd-tdep.c Tue Jun 14 15:20:30 2011
(r223082)
@@ -27,7 +27,9 @@
 #include "target.h"
 #include "breakpoint.h"
 #include "value.h"
+#include "gdb_string.h"
 #include "osabi.h"
+#include "regset.h"
 
 #include "ppc-tdep.h"
 #include "ppcfbsd-tdep.h"
@@ -80,6 +82,17 @@ ppcfbsd_supply_reg (char *regs, int regn
 regcache_raw_supply (current_regcache, PC_REGNUM,
 regs + REG_PC_OFFSET);
 }
+static void
+ppcfbsd_supply_gregset (const struct regset *regset,
+   struct regcache *regcache,
+   int regnum, void *gregs, size_t size)
+{
+  ppcfbsd_supply_reg (gregs, -1);
+}
+
+static struct regset ppcfbsd_gregset = {
+  NULL, (void*)ppcfbsd_supply_gregset
+};
 
 void
 ppcfbsd_fill_reg (char *regs, int regno)
@@ -144,6 +157,20 @@ ppcfbsd_supply_fpreg (char *fpregs, int 
 fpregs + FPREG_FPSCR_OFFSET);
 }
 
+static void
+ppcfbsd_supply_fpregset (const struct regset *regset,
+struct regcache * regcache,
+int regnum, void *fpset, size_t size)
+{
+  ppcfbsd_supply_fpreg (fpset, -1);
+}
+
+
+static struct regset ppcfbsd_fpregset =
+{
+  NULL, (void*)ppcfbsd_supply_fpregset
+};
+
 void
 ppcfbsd_fill_fpreg (char *fpregs, int regno)
 {
@@ -174,69 +201,285 @@ ppcfbsd_fill_fpreg (char *fpregs, int re
  fpregs + FPREG_FPSCR_OFFSET);
 }
 
-static void
-fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
-  CORE_ADDR ignore)
+/* Return the appropriate register set for the core section identified
+   by SECT_NAME and SECT_SIZE.  */
+
+const struct regset *
+ppcfbsd_regset_from_core_section (struct gdbarch *gdbarch,
+   const char *sect_name, size_t sect_size)
 {
-  char *regs, *fpregs;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  if (strcmp (sect_name, ".reg") == 0 && sect_size >= SIZEOF_STRUCT_REG)
+return &ppcfbsd_gregset;
+
+  if (strcmp (sect_name, ".reg2") == 0 && sect_size >= SIZEOF_STRUCT_FPREG)
+return &ppcfbsd_fpregset;
 
-  /* We get everything from one section.  */
-  if (which != 0)
-return;
+  return NULL;
+}
 
-  regs = core_reg_sect;
-  fpregs = core_reg_sect + SIZEOF_STRUCT_REG;
 
-  /* Integer registers.  */
-  ppcfbsd_supply_reg (regs, -1);
+/* Macros for matching instructions.  Note that, since all the
+   operands are masked off before they're or-ed into the instruction,
+   you can use -1 to make masks.  */
+
+#define insn_d(opcd, rts, ra, d)\
+  opcd) & 0x3f) << 26)  \
+   | (((rts) & 0x1f) << 21) \
+   | (((ra) & 0x1f) << 16)  \
+   | ((d) & 0x))
+
+#define insn_ds(opcd, rts, ra, d, xo)   \
+  opcd) & 0x3f) << 26)  \
+   | (((rts) & 0x1f) << 21) \
+   | (((ra) & 0x1f) << 16)  \
+   | ((d) & 0xfffc) \
+   | ((xo) & 0x3))
+
+#define insn_xfx(opcd, rts, spr, xo)\
+  opcd) & 0x3f) << 26)  \
+   | (((rts) & 0x1f) << 21) \
+   | (((spr) & 0x1f) << 16) \
+   | (((spr) & 0x3e0) << 6) \
+   | (((xo) & 0x3ff) << 1))
+
+/* Read a PPC instruction from memory.  PPC instructions are always
+   big-endian, no matter what endianness the program is running in, so
+   we can't use read_memory_integer or one of its friends here.  */
+static unsigned int
+read_insn (CORE_ADDR pc)
+{
+  unsigned char buf[4];
 
-  /* Floating point registers.  */
-  ppcfbsd_supply_fpreg (fpregs, -1);
+  read_memory (pc, buf, 4);
+  return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
 }
 
-static void
-fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int 
which,
- CORE_ADDR ignore)
+
+/* An instruction to match.  */
+struct insn_pattern
 {
-  switch (which)
+  unsigned int mask;/* mask the insn with this... */
+  unsigned int data;/* ...and see if it matches this. */
+  int optional; /* If non-zero, this insn may be absent.  */
+};
+
+/* Return non-zero if the ins

svn commit: r223084 - head/sys/cam/scsi

2011-06-14 Thread Justin T. Gibbs
Author: gibbs
Date: Tue Jun 14 16:05:00 2011
New Revision: 223084
URL: http://svn.freebsd.org/changeset/base/223084

Log:
  sys/cam/scsi/scsi_da.c:
- Only attempt the closing synchronize cache on a disk
  if it is still there.
- When a device is lost, report the number of outstanding
  I/Os as they are drained.
- When a device is lost, return any unprocessed bios with
  ENXIO instead of EIO.
- Filter asynchronous events, but always allow cam_periph_async()
  to see them too.
  
  Sponsored by: Spectra Logic Corporation

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Tue Jun 14 15:45:41 2011(r223083)
+++ head/sys/cam/scsi/scsi_da.c Tue Jun 14 16:05:00 2011(r223084)
@@ -727,7 +727,8 @@ daclose(struct disk *dp)
 
softc = (struct da_softc *)periph->softc;
 
-   if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0) {
+   if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0
+&& (softc->flags & DA_FLAG_PACK_INVALID) == 0) {
union   ccb *ccb;
 
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL);
@@ -977,7 +978,8 @@ daoninvalidate(struct cam_periph *periph
bioq_flush(&softc->bio_queue, NULL, ENXIO);
 
disk_gone(softc->disk);
-   xpt_print(periph->path, "lost device\n");
+   xpt_print(periph->path, "lost device - %d outstanding\n",
+ softc->outstanding_cmds);
 }
 
 static void
@@ -1060,12 +1062,12 @@ daasync(void *callback_arg, u_int32_t co
softc->flags |= DA_FLAG_RETRY_UA;
LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le)
ccbh->ccb_state |= DA_CCB_RETRY_UA;
-   /* FALLTHROUGH*/
+   break;
}
default:
-   cam_periph_async(periph, code, path, arg);
break;
}
+   cam_periph_async(periph, code, path, arg);
 }
 
 static void
@@ -1558,7 +1560,7 @@ dadone(struct cam_periph *periph, union 
if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
int error;
int sf;
-   
+
if ((csio->ccb_h.ccb_state & DA_CCB_RETRY_UA) != 0)
sf = SF_RETRY_UA;
else
@@ -1573,8 +1575,17 @@ dadone(struct cam_periph *periph, union 
return;
}
if (error != 0) {
+   int queued_error;
+
+   /*
+* return all queued I/O with EIO, so that
+* the client can retry these I/Os in the
+* proper order should it attempt to recover.
+*/
+   queued_error = EIO;
 
-   if (error == ENXIO) {
+   if (error == ENXIO
+&& (softc->flags & DA_FLAG_PACK_INVALID)== 0) {
/*
 * Catastrophic error.  Mark our pack as
 * invalid.
@@ -1586,14 +1597,10 @@ dadone(struct cam_periph *periph, union 
xpt_print(periph->path,
"Invalidating pack\n");
softc->flags |= DA_FLAG_PACK_INVALID;
+   queued_error = ENXIO;
}
-
-   /*
-* return all queued I/O with EIO, so that
-* the client can retry these I/Os in the
-* proper order should it attempt to recover.
-*/
-   bioq_flush(&softc->bio_queue, NULL, EIO);
+   bioq_flush(&softc->bio_queue, NULL,
+  queued_error);
bp->bio_error = error;
bp->bio_resid = bp->bio_bcount;
bp->bio_flags |= BIO_ERROR;
@@ -1626,6 +1633,11 @@ dadone(struct cam_periph *periph, union 
if (softc->outstanding_cmds == 0)
softc->flags |= DA_FLAG_WENT_IDLE;
 
+   if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) {
+   xpt_print(periph->path, "oustanding %d\n",
+ softc->outstanding_cmds);
+   }
+
biodone(bp);
break;
}
___
svn-src-head@freebsd.org mailing

svn commit: r223085 - in head/sys: kern sys

2011-06-14 Thread Justin T. Gibbs
Author: gibbs
Date: Tue Jun 14 16:29:43 2011
New Revision: 223085
URL: http://svn.freebsd.org/changeset/base/223085

Log:
  sys/sys/conf.h:
  sys/kern/kern_conf.c:
Add make_dev_physpath_alias().  This interface takes
the parent cdev of the alias, an old alias cdev (if any)
to replace with the newly created alias, and the physical
path string.  The alias is visiable as a symlink to the
parent, with the same name as the parent, rooted at
physpath in devfs.
  
Note: make_dev_physpath_alias() has hard coded knowledge of the
  Solaris style prefix convention for physical path data,
  "id1,".  In the future, I expect the convention to change
  to allow "physical path quality" to be reported in the
  prefix.  For example, a physical path based on NewBus
  topology would be of "lower quality" than a physical path
  reported by a device enclosure.
  
  Sponsored by: Spectra Logic Corporation

Modified:
  head/sys/kern/kern_conf.c
  head/sys/sys/conf.h

Modified: head/sys/kern/kern_conf.c
==
--- head/sys/kern/kern_conf.c   Tue Jun 14 16:05:00 2011(r223084)
+++ head/sys/kern/kern_conf.c   Tue Jun 14 16:29:43 2011(r223085)
@@ -963,6 +963,68 @@ make_dev_alias_p(int flags, struct cdev 
return (res);
 }
 
+int
+make_dev_physpath_alias(int flags, struct cdev **cdev, struct cdev *pdev, 
+struct cdev *old_alias, const char *physpath)
+{
+   char *devfspath;
+   int physpath_len;
+   int max_parentpath_len;
+   int parentpath_len;
+   int devfspathbuf_len;
+   int mflags;
+   int ret;
+
+   *cdev = NULL;
+   devfspath = NULL;
+   physpath_len = strlen(physpath);
+   ret = EINVAL;
+   if (physpath_len == 0)
+   goto out;
+
+   if (strncmp("id1,", physpath, 4) == 0) {
+   physpath += 4;
+   physpath_len -= 4;
+   if (physpath_len == 0)
+   goto out;
+   }
+
+   max_parentpath_len = SPECNAMELEN - physpath_len - /*/*/1;
+   parentpath_len = strlen(pdev->si_name);
+   if (max_parentpath_len < parentpath_len) {
+   printf("make_dev_physpath_alias: WARNING - Unable to alias %s "
+   "to %s/%s - path too long\n",
+   pdev->si_name, physpath, pdev->si_name);
+   ret = ENAMETOOLONG;
+   goto out;
+   }
+
+   mflags = (flags & MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK;
+   devfspathbuf_len = physpath_len + /*/*/1 + parentpath_len + /*NUL*/1;
+   devfspath = malloc(devfspathbuf_len, M_DEVBUF, mflags);
+   if (devfspath == NULL) {
+   ret = ENOMEM;
+   goto out;
+   }
+
+   sprintf(devfspath, "%s/%s", physpath, pdev->si_name);
+   if (old_alias != NULL
+&& strcmp(old_alias->si_name, devfspath) == 0) {
+   /* Retain the existing alias. */
+   *cdev = old_alias;
+   old_alias = NULL;
+   ret = 0;
+   } else {
+   ret = make_dev_alias_p(flags, cdev, pdev, devfspath);
+   }
+out:
+   if (old_alias != NULL)  
+   destroy_dev(old_alias);
+   if (devfspath != NULL)
+   free(devfspath, M_DEVBUF);
+   return (ret);
+}
+
 static void
 destroy_devl(struct cdev *dev)
 {

Modified: head/sys/sys/conf.h
==
--- head/sys/sys/conf.h Tue Jun 14 16:05:00 2011(r223084)
+++ head/sys/sys/conf.h Tue Jun 14 16:29:43 2011(r223085)
@@ -280,6 +280,9 @@ struct cdev *make_dev_alias(struct cdev 
__printflike(2, 3);
 intmake_dev_alias_p(int _flags, struct cdev **_cdev, struct cdev *_pdev,
const char *_fmt, ...) __printflike(4, 5);
+intmake_dev_physpath_alias(int _flags, struct cdev **_cdev,
+   struct cdev *_pdev, struct cdev *_old_alias,
+const char *_physpath);
 void   dev_lock(void);
 void   dev_unlock(void);
 void   setconf(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: r223086 - head/bin/ps

2011-06-14 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Jun 14 16:50:16 2011
New Revision: 223086
URL: http://svn.freebsd.org/changeset/base/223086

Log:
  Add "gid" and "group" keywords to display the effective group ID
  and effective group name.  Also, add "egid", "egroup" and "euid" aliases.
  
  PR:   bin/146331
  Submitted by: Jeremie Le Hen 

Modified:
  head/bin/ps/extern.h
  head/bin/ps/keyword.c
  head/bin/ps/print.c
  head/bin/ps/ps.1

Modified: head/bin/ps/extern.h
==
--- head/bin/ps/extern.hTue Jun 14 16:29:43 2011(r223085)
+++ head/bin/ps/extern.hTue Jun 14 16:50:16 2011(r223086)
@@ -70,6 +70,7 @@ void   pmem(KINFO *, VARENT *);
 voidpri(KINFO *, VARENT *);
 voidprintheader(void);
 voidpriorityr(KINFO *, VARENT *);
+voidegroupname(KINFO *, VARENT *);
 voidrgroupname(KINFO *, VARENT *);
 voidruname(KINFO *, VARENT *);
 voidrvar(KINFO *, VARENT *);
@@ -78,6 +79,7 @@ ints_cputime(KINFO *);
 int s_label(KINFO *);
 int s_loginclass(KINFO *);
 int s_logname(KINFO *);
+int s_egroupname(KINFO *);
 int s_rgroupname(KINFO *);
 int s_runame(KINFO *);
 int s_systime(KINFO *);

Modified: head/bin/ps/keyword.c
==
--- head/bin/ps/keyword.c   Tue Jun 14 16:29:43 2011(r223085)
+++ head/bin/ps/keyword.c   Tue Jun 14 16:50:16 2011(r223086)
@@ -88,12 +88,19 @@ static VAR var[] = {
{"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d",
0},
{"cputime", "", "time", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
+   {"egid", "", "gid", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
+   {"egroup", "", "group", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"emul", "EMUL", NULL, LJUST, emulname, NULL, EMULLEN, 0, CHAR,
NULL, 0},
{"etime", "ELAPSED", NULL, USER, elapsed, NULL, 12, 0, CHAR, NULL, 0},
{"etimes", "ELAPSED", NULL, USER, elapseds, NULL, 12, 0, CHAR, NULL, 0},
+   {"euid", "", "uid", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"f", "F", NULL, 0, kvar, NULL, 8, KOFF(ki_flag), INT, "x", 0},
{"flags", "", "f", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
+   {"gid", "GID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_groups),
+   UINT, UIDFMT, 0},
+   {"group", "GROUP", NULL, LJUST, egroupname, s_egroupname,
+   USERLEN, 0, CHAR, NULL, 0},
{"ignored", "", "sigignore", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"inblk", "INBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_inblock), LONG,
"ld", 0},

Modified: head/bin/ps/print.c
==
--- head/bin/ps/print.c Tue Jun 14 16:29:43 2011(r223085)
+++ head/bin/ps/print.c Tue Jun 14 16:50:16 2011(r223086)
@@ -341,6 +341,22 @@ s_uname(KINFO *k)
 }
 
 void
+egroupname(KINFO *k, VARENT *ve)
+{
+   VAR *v;
+
+   v = ve->var;
+   (void)printf("%-*s", v->width,
+   group_from_gid(k->ki_p->ki_groups[0], 0));
+}
+
+int
+s_egroupname(KINFO *k)
+{
+   return (strlen(group_from_gid(k->ki_p->ki_groups[0], 0)));
+}
+
+void
 rgroupname(KINFO *k, VARENT *ve)
 {
VAR *v;

Modified: head/bin/ps/ps.1
==
--- head/bin/ps/ps.1Tue Jun 14 16:29:43 2011(r223085)
+++ head/bin/ps/ps.1Tue Jun 14 16:50:16 2011(r223086)
@@ -29,7 +29,7 @@
 .\" @(#)ps.1   8.3 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd April 18, 2011
+.Dd June 14, 2011
 .Dt PS 1
 .Os
 .Sh NAME
@@ -502,6 +502,12 @@ elapsed running time, in decimal integer
 .It Cm flags
 the process flags, in hexadecimal (alias
 .Cm f )
+.It Cm gid
+effective group ID (alias
+.Cm egid )
+.It Cm group
+group name (from egid) (alias
+.Cm egroup )
 .It Cm inblk
 total blocks read (alias
 .Cm inblock )
@@ -629,7 +635,8 @@ process pointer
 .It Cm ucomm
 name to be used for accounting
 .It Cm uid
-effective user ID
+effective user ID (alias
+.Cm euid )
 .It Cm upr
 scheduling priority on return from system call (alias
 .Cm usrpri )
___
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: r223088 - in head/sys: kern sys

2011-06-14 Thread David E. O'Brien
Author: obrien
Date: Tue Jun 14 17:09:30 2011
New Revision: 223088
URL: http://svn.freebsd.org/changeset/base/223088

Log:
  We should not return ECHILD when debugging a child and the parent does a
  "wait4(-1, ..., WNOHANG, ...)".  Instead wait(2) should behave as if the
  child does not wish to report status at this time.
  
  Reviewed by:  jhb

Modified:
  head/sys/kern/kern_exit.c
  head/sys/kern/sys_process.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Tue Jun 14 16:50:29 2011(r223087)
+++ head/sys/kern/kern_exit.c   Tue Jun 14 17:09:30 2011(r223088)
@@ -701,8 +701,9 @@ proc_reap(struct thread *td, struct proc
 */
if (p->p_oppid && (t = pfind(p->p_oppid)) != NULL) {
PROC_LOCK(p);
-   p->p_oppid = 0;
proc_reparent(p, t);
+   p->p_pptr->p_dbg_child--;
+   p->p_oppid = 0;
PROC_UNLOCK(p);
pksignal(t, SIGCHLD, p->p_ksi);
wakeup(t);
@@ -794,7 +795,8 @@ kern_wait(struct thread *td, pid_t pid, 
pid = -q->p_pgid;
PROC_UNLOCK(q);
}
-   if (options &~ (WUNTRACED|WNOHANG|WCONTINUED|WNOWAIT|WLINUXCLONE))
+   /* If we don't know the option, just return. */
+   if (options & ~(WUNTRACED|WNOHANG|WCONTINUED|WNOWAIT|WLINUXCLONE))
return (EINVAL);
 loop:
if (q->p_flag & P_STATCHILD) {
@@ -873,7 +875,10 @@ loop:
}
if (nfound == 0) {
sx_xunlock(&proctree_lock);
-   return (ECHILD);
+   if (td->td_proc->p_dbg_child)
+   return (0);
+   else
+   return (ECHILD);
}
if (options & WNOHANG) {
sx_xunlock(&proctree_lock);

Modified: head/sys/kern/sys_process.c
==
--- head/sys/kern/sys_process.c Tue Jun 14 16:50:29 2011(r223087)
+++ head/sys/kern/sys_process.c Tue Jun 14 17:09:30 2011(r223088)
@@ -831,8 +831,11 @@ kern_ptrace(struct thread *td, int req, 
/* security check done above */
p->p_flag |= P_TRACED;
p->p_oppid = p->p_pptr->p_pid;
-   if (p->p_pptr != td->td_proc)
+   if (p->p_pptr != td->td_proc) {
+   /* Remember that a child is being debugged(traced). */
+   p->p_pptr->p_dbg_child++;
proc_reparent(p, td->td_proc);
+   }
data = SIGSTOP;
goto sendsig;   /* in PT_CONTINUE below */
 
@@ -919,11 +922,12 @@ kern_ptrace(struct thread *td, int req, 
PROC_UNLOCK(pp);
PROC_LOCK(p);
proc_reparent(p, pp);
+   p->p_pptr->p_dbg_child--;
if (pp == initproc)
p->p_sigparent = SIGCHLD;
}
-   p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK);
p->p_oppid = 0;
+   p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK);
 
/* should we send SIGCHLD? */
/* childproc_continued(p); */

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Tue Jun 14 16:50:29 2011(r223087)
+++ head/sys/sys/proc.h Tue Jun 14 17:09:30 2011(r223088)
@@ -503,6 +503,8 @@ struct proc {
 /* The following fields are all zeroed upon creation in fork. */
 #definep_startzero p_oppid
pid_t   p_oppid;/* (c + e) Save ppid in ptrace. XXX */
+   int p_dbg_child;/* (c + e) # of debugged children in
+   ptrace. */
struct vmspace  *p_vmspace; /* (b) Address space. */
u_int   p_swtick;   /* (c) Tick when swapped in or out. */
struct itimerval p_realtimer;   /* (c) Alarm timer. */
___
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: r223089 - in head: sys/cam/ata sys/cam/scsi sys/geom sys/sys usr.sbin/diskinfo

2011-06-14 Thread Justin T. Gibbs
Author: gibbs
Date: Tue Jun 14 17:10:32 2011
New Revision: 223089
URL: http://svn.freebsd.org/changeset/base/223089

Log:
  Plumb device physical path reporting from CAM devices, through GEOM and
  DEVFS, and make it accessible via the diskinfo utility.
  
  Extend GEOM's generic attribute query mechanism into generic disk consumers.
  sys/geom/geom_disk.c:
  sys/geom/geom_disk.h:
  sys/cam/scsi/scsi_da.c:
  sys/cam/ata/ata_da.c:
- Allow disk providers to implement a new method which can override
  the default BIO_GETATTR response, d_getattr(struct bio *).  This
  function returns -1 if not handled, otherwise it returns 0 or an
  errno to be passed to g_io_deliver().
  
  sys/cam/scsi/scsi_da.c:
  sys/cam/ata/ata_da.c:
- Don't copy the serial number to dp->d_ident anymore, as the CAM XPT
  is now responsible for returning this information via
  d_getattr()->(a)dagetattr()->xpt_getatr().
  
  sys/geom/geom_dev.c:
- Implement a new ioctl, DIOCGPHYSPATH, which returns the GEOM
  attribute "GEOM::physpath", if possible.  If the attribute request
  returns a zero-length string, ENOENT is returned.
  
  usr.sbin/diskinfo/diskinfo.c:
- If the DIOCGPHYSPATH ioctl is successful, report physical path
  data when diskinfo is executed with the '-v' option.
  
  Submitted by: will
  Reviewed by:  gibbs
  Sponsored by: Spectra Logic Corporation
  
  Add generic attribute change notification support to GEOM.
  
  sys/sys/geom/geom.h:
Add a new attrchanged method field to both g_class
and g_geom.
  
  sys/sys/geom/geom.h:
  sys/geom/geom_event.c:
- Provide the g_attr_changed() function that providers
  can use to advertise attribute changes.
- Perform delivery of attribute change notifications
  from a thread context via the standard GEOM event
  mechanism.
  
  sys/geom/geom_subr.c:
Inherit the attrchanged method from class to geom (class instance).
  
  sys/geom/geom_disk.c:
Provide disk_attr_changed() to provide g_attr_changed() access
to consumers of the disk API.
  
  sys/cam/scsi/scsi_pass.c:
  sys/cam/scsi/scsi_da.c:
  sys/geom/geom_dev.c:
  sys/geom/geom_disk.c:
Use attribute changed events to track updates to physical path
information.
  
  sys/cam/scsi/scsi_da.c:
Add AC_ADVINFO_CHANGED to the registered asynchronous CAM
events for this driver.  When this event occurs, and
the updated buffer type references our physical path
attribute, emit a GEOM attribute changed event via the
disk_attr_changed() API.
  
  sys/cam/scsi/scsi_pass.c:
Add AC_ADVINFO_CHANGED to the registered asynchronous CAM
events for this driver.  When this event occurs, update
the physical patch devfs alias for this pass instance.
  
  Submitted by: gibbs
  Sponsored by: Spectra Logic Corporation

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_pass.c
  head/sys/geom/geom.h
  head/sys/geom/geom_dev.c
  head/sys/geom/geom_disk.c
  head/sys/geom/geom_disk.h
  head/sys/geom/geom_event.c
  head/sys/geom/geom_subr.c
  head/sys/sys/disk.h
  head/usr.sbin/diskinfo/diskinfo.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Tue Jun 14 17:09:30 2011(r223088)
+++ head/sys/cam/ata/ata_da.c   Tue Jun 14 17:10:32 2011(r223089)
@@ -812,6 +812,25 @@ adasysctlinit(void *context, int pending
cam_periph_release(periph);
 }
 
+static int
+adagetattr(struct bio *bp)
+{
+   int ret = -1;
+   struct cam_periph *periph;
+
+   if (bp->bio_disk == NULL || bp->bio_disk->d_drv1)
+   return ENXIO;
+   periph = (struct cam_periph *)bp->bio_disk->d_drv1;
+   if (periph->path == NULL)
+   return ENXIO;
+
+   ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute,
+   periph->path);
+   if (ret == 0)
+   bp->bio_completed = bp->bio_length;
+   return ret;
+}
+
 static cam_status
 adaregister(struct cam_periph *periph, void *arg)
 {
@@ -917,6 +936,7 @@ adaregister(struct cam_periph *periph, v
softc->disk->d_open = adaopen;
softc->disk->d_close = adaclose;
softc->disk->d_strategy = adastrategy;
+   softc->disk->d_getattr = adagetattr;
softc->disk->d_dump = adadump;
softc->disk->d_name = "ada";
softc->disk->d_drv1 = periph;
@@ -938,8 +958,6 @@ adaregister(struct cam_periph *periph, v
((softc->flags & ADA_FLAG_CAN_CFA) &&
!(softc->flags & ADA_FLAG_CAN_48BIT)))
softc->disk->d_flags |= DISKFLAG_CANDELETE;
-   strlcpy(softc->disk->d_ident, cgd->serial_num,
-   MIN(sizeof(softc->disk->d_ident), cgd->serial_num_len + 1));
strlcpy(softc->disk->d_descr, cgd->ident_data.model,

svn commit: r223090 - head/share/misc

2011-06-14 Thread Stephen Montgomery-Smith
Author: stephen (ports committer)
Date: Tue Jun 14 17:51:46 2011
New Revision: 223090
URL: http://svn.freebsd.org/changeset/base/223090

Log:
  Reviewed by:  gabor (mentor)
  Approved by:  gabor (mentor)

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotTue Jun 14 17:10:32 2011
(r223089)
+++ head/share/misc/committers-ports.dotTue Jun 14 17:51:46 2011
(r223090)
@@ -166,6 +166,7 @@ skreuzer [label="Steven Kreuzer\nskreuze
 sobomax[label="Maxim Sobolev\nsobo...@freebsd.org\n2000/05/17"]
 stas [label="Stanislav Sedov\ns...@freebsd.org\n2006/09/18"]
 stefan [label="Stefan Walter\nste...@freebsd.org\n2006/05/07"]
+stephen [label="Stephen Montgomery-Smith\nstep...@freebsd.org\n2011/06/13"]
 sunpoet [label="Po-Chuan Hsieh\nsunp...@freebsd.org\n2010/09/21"]
 sylvio [label="Sylvio Cesar Teixeira\nsyl...@freebsd.org\n2009/10/29"]
 swills [label="Steve Wills\nswi...@freebsd.org\n2010/09/03"]
@@ -259,6 +260,7 @@ flz -> romain
 
 gabor -> lippe
 gabor -> pgj
+gabor -> stephen
 
 garga -> acm
 garga -> alepulver
@@ -311,6 +313,7 @@ lioux -> pat
 
 lwhsu -> yzlin
 
+maho -> stephen
 maho -> tota
 
 marcus -> ahze
___
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: r223091 - head/sys/dev/puc

2011-06-14 Thread John Baldwin
Author: jhb
Date: Tue Jun 14 18:19:48 2011
New Revision: 223091
URL: http://svn.freebsd.org/changeset/base/223091

Log:
  Add location and pnpinfo strings for puc device ports.  The location is
  announced during boot and contains the port number.  The pnpinfo string
  lists the port type (PUC_TYPE_* constants).
  
  Tested by:Boris Samorodov  bsam ipt ru
  MFC after:1 week

Modified:
  head/sys/dev/puc/puc.c
  head/sys/dev/puc/puc_bfe.h
  head/sys/dev/puc/puc_pccard.c
  head/sys/dev/puc/puc_pci.c

Modified: head/sys/dev/puc/puc.c
==
--- head/sys/dev/puc/puc.c  Tue Jun 14 17:51:46 2011(r223090)
+++ head/sys/dev/puc/puc.c  Tue Jun 14 18:19:48 2011(r223091)
@@ -726,3 +726,41 @@ puc_bus_read_ivar(device_t dev, device_t
}
return (0);
 }
+
+int
+puc_bus_print_child(device_t dev, device_t child)
+{
+   struct puc_port *port;
+   int retval;
+
+   port = device_get_ivars(child);
+   retval = 0;
+
+   retval += bus_print_child_header(dev, child);
+   retval += printf(" at port %d", port->p_nr);
+   retval += bus_print_child_footer(dev, child);
+
+   return (retval);
+}
+
+int
+puc_bus_child_location_str(device_t dev, device_t child, char *buf,
+size_t buflen)
+{
+   struct puc_port *port;
+
+   port = device_get_ivars(child);
+   snprintf(buf, buflen, "port=%d", port->p_nr);
+   return (0);
+}
+
+int
+puc_bus_child_pnpinfo_str(device_t dev, device_t child, char *buf,
+size_t buflen)
+{
+   struct puc_port *port;
+
+   port = device_get_ivars(child);
+   snprintf(buf, buflen, "type=%d", port->p_type);
+   return (0);
+}

Modified: head/sys/dev/puc/puc_bfe.h
==
--- head/sys/dev/puc/puc_bfe.h  Tue Jun 14 17:51:46 2011(r223090)
+++ head/sys/dev/puc/puc_bfe.h  Tue Jun 14 18:19:48 2011(r223091)
@@ -82,9 +82,12 @@ int puc_bfe_attach(device_t);
 int puc_bfe_detach(device_t);
 int puc_bfe_probe(device_t, const struct puc_cfg *);
 
+int puc_bus_child_location_str(device_t, device_t, char *, size_t);
+int puc_bus_child_pnpinfo_str(device_t, device_t, char *, size_t);
 struct resource *puc_bus_alloc_resource(device_t, device_t, int, int *, u_long,
 u_long, u_long, u_int);
 int puc_bus_get_resource(device_t, device_t, int, int, u_long *, u_long *);
+int puc_bus_print_child(device_t, device_t);
 int puc_bus_read_ivar(device_t, device_t, int, uintptr_t *);
 int puc_bus_release_resource(device_t, device_t, int, int, struct resource *);
 int puc_bus_setup_intr(device_t, device_t, struct resource *, int,

Modified: head/sys/dev/puc/puc_pccard.c
==
--- head/sys/dev/puc/puc_pccard.c   Tue Jun 14 17:51:46 2011
(r223090)
+++ head/sys/dev/puc/puc_pccard.c   Tue Jun 14 18:19:48 2011
(r223091)
@@ -82,7 +82,9 @@ static device_method_t puc_pccard_method
 DEVMETHOD(bus_read_ivar,   puc_bus_read_ivar),
 DEVMETHOD(bus_setup_intr,  puc_bus_setup_intr),
 DEVMETHOD(bus_teardown_intr,   puc_bus_teardown_intr),
-DEVMETHOD(bus_print_child, bus_generic_print_child),
+DEVMETHOD(bus_print_child, puc_bus_print_child),
+DEVMETHOD(bus_child_pnpinfo_str,   puc_bus_child_pnpinfo_str),
+DEVMETHOD(bus_child_location_str,  puc_bus_child_location_str),
 DEVMETHOD(bus_driver_added,bus_generic_driver_added),
 { 0, 0 }
 };

Modified: head/sys/dev/puc/puc_pci.c
==
--- head/sys/dev/puc/puc_pci.c  Tue Jun 14 17:51:46 2011(r223090)
+++ head/sys/dev/puc/puc_pci.c  Tue Jun 14 18:19:48 2011(r223091)
@@ -132,7 +132,9 @@ static device_method_t puc_pci_methods[]
 DEVMETHOD(bus_read_ivar,   puc_bus_read_ivar),
 DEVMETHOD(bus_setup_intr,  puc_bus_setup_intr),
 DEVMETHOD(bus_teardown_intr,   puc_bus_teardown_intr),
-DEVMETHOD(bus_print_child, bus_generic_print_child),
+DEVMETHOD(bus_print_child, puc_bus_print_child),
+DEVMETHOD(bus_child_pnpinfo_str,   puc_bus_child_pnpinfo_str),
+DEVMETHOD(bus_child_location_str,  puc_bus_child_location_str),
 DEVMETHOD(bus_driver_added,bus_generic_driver_added),
 { 0, 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: r223097 - head/sys/dev/ata/chipsets

2011-06-14 Thread Alexander Motin
Author: mav
Date: Tue Jun 14 20:30:15 2011
New Revision: 223097
URL: http://svn.freebsd.org/changeset/base/223097

Log:
  Skip BAR(5) usage for SATA registers access on ICH8M Apples, because for
  some reason it causes system lock up. Linux does the same.
  
  MFC after:1 week

Modified:
  head/sys/dev/ata/chipsets/ata-intel.c

Modified: head/sys/dev/ata/chipsets/ata-intel.c
==
--- head/sys/dev/ata/chipsets/ata-intel.c   Tue Jun 14 20:04:23 2011
(r223096)
+++ head/sys/dev/ata/chipsets/ata-intel.c   Tue Jun 14 20:30:15 2011
(r223097)
@@ -288,7 +288,9 @@ ata_intel_chipinit(device_t dev)
ATA_OUTL(ctlr->r_res2, 0x0C,
ATA_INL(ctlr->r_res2, 0x0C) | 0xf);
}
-   } else {
+   /* Skip BAR(5) on ICH8M Apples, system locks up on access. */
+   } else if (ctlr->chip->chipid != ATA_I82801HBM_S1 ||
+   pci_get_subvendor(dev) != 0x106b) {
ctlr->r_type2 = SYS_RES_IOPORT;
ctlr->r_rid2 = PCIR_BAR(5);
ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,
___
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: r223098 - in head/sys: amd64/conf i386/conf

2011-06-14 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jun 14 20:30:49 2011
New Revision: 223098
URL: http://svn.freebsd.org/changeset/base/223098

Log:
  Enable USB 3.0 support by default in i386 and amd64 GENERIC kernels.
  
  Discussed with:   joel @ and thompsa @
  MFC after:7 days

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/i386/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Tue Jun 14 20:30:15 2011(r223097)
+++ head/sys/amd64/conf/GENERIC Tue Jun 14 20:30:49 2011(r223098)
@@ -295,6 +295,7 @@ options USB_DEBUG   # enable debug msgs
 device uhci# UHCI PCI->USB interface
 device ohci# OHCI PCI->USB interface
 device ehci# EHCI PCI->USB interface (USB 2.0)
+device xhci# XHCI PCI->USB interface (USB 3.0)
 device usb # USB Bus (required)
 #deviceudbp# USB Double Bulk Pipe devices (needs 
netgraph)
 device uhid# "Human Interface Devices"

Modified: head/sys/i386/conf/GENERIC
==
--- head/sys/i386/conf/GENERIC  Tue Jun 14 20:30:15 2011(r223097)
+++ head/sys/i386/conf/GENERIC  Tue Jun 14 20:30:49 2011(r223098)
@@ -308,6 +308,7 @@ options USB_DEBUG   # enable debug msgs
 device uhci# UHCI PCI->USB interface
 device ohci# OHCI PCI->USB interface
 device ehci# EHCI PCI->USB interface (USB 2.0)
+device xhci# XHCI PCI->USB interface (USB 3.0)
 device usb # USB Bus (required)
 #deviceudbp# USB Double Bulk Pipe devices (needs 
netgraph)
 device uhid# "Human Interface Devices"
___
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: r223099 - head/sys/kern

2011-06-14 Thread Justin T. Gibbs
Author: gibbs
Date: Tue Jun 14 21:37:25 2011
New Revision: 223099
URL: http://svn.freebsd.org/changeset/base/223099

Log:
  sys/kern/subr_kdb.c:
Modify the "alternate break sequence" detecting state
machine so that only a contiguous invocation of the
break sequence is accepted.  The old implementation
did not reset the state machine when detecting an
unexpected character.
  
While here, use an enum for the states of the machine
instead of magic numbers.bmitted by:
  
  Sponsored by: Spectra Logic Corporation

Modified:
  head/sys/kern/subr_kdb.c

Modified: head/sys/kern/subr_kdb.c
==
--- head/sys/kern/subr_kdb.cTue Jun 14 20:30:49 2011(r223098)
+++ head/sys/kern/subr_kdb.cTue Jun 14 21:37:25 2011(r223099)
@@ -244,29 +244,44 @@ kdb_reboot(void)
 #defineKEY_CRTLP   16  /* ^P */
 #defineKEY_CRTLR   18  /* ^R */
 
+/* States of th KDB "alternate break sequence" detecting state machine. */
+enum {
+   KDB_ALT_BREAK_SEEN_NONE,
+   KDB_ALT_BREAK_SEEN_CR,
+   KDB_ALT_BREAK_SEEN_CR_TILDE,
+};
+
 int
 kdb_alt_break(int key, int *state)
 {
int brk;
 
+   /* All states transition to KDB_ALT_BREAK_SEEN_CR on a CR. */
+   if (key == KEY_CR) {
+   *state = KDB_ALT_BREAK_SEEN_CR;
+   return (0);
+   }
+
brk = 0;
switch (*state) {
-   case 0:
-   if (key == KEY_CR)
-   *state = 1;
-   break;
-   case 1:
+   case KDB_ALT_BREAK_SEEN_CR:
+   *state = KDB_ALT_BREAK_SEEN_NONE;
if (key == KEY_TILDE)
-   *state = 2;
+   *state = KDB_ALT_BREAK_SEEN_CR_TILDE;
break;
-   case 2:
+   case KDB_ALT_BREAK_SEEN_CR_TILDE:
+   *state = KDB_ALT_BREAK_SEEN_NONE;
if (key == KEY_CRTLB)
brk = KDB_REQ_DEBUGGER;
else if (key == KEY_CRTLP)
brk = KDB_REQ_PANIC;
else if (key == KEY_CRTLR)
brk = KDB_REQ_REBOOT;
-   *state = 0;
+   break;
+   case KDB_ALT_BREAK_SEEN_NONE:
+   default:
+   *state = KDB_ALT_BREAK_SEEN_NONE;
+   break;
}
return (brk);
 }
___
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: r223105 - head/sys/ufs/ffs

2011-06-14 Thread Kirk McKusick
Author: mckusick
Date: Wed Jun 15 06:13:08 2011
New Revision: 223105
URL: http://svn.freebsd.org/changeset/base/223105

Log:
  Missing cleanup case after completion of a snapshot vnode write
  claiming a released block.
  
  Submitted by: Jeff Roberson
  Tested by:Peter Holm

Modified:
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Wed Jun 15 01:08:47 2011
(r223104)
+++ head/sys/ufs/ffs/ffs_softdep.c  Wed Jun 15 06:13:08 2011
(r223105)
@@ -10417,6 +10417,10 @@ softdep_disk_write_complete(bp)
WORKLIST_INSERT(&reattach, wk);
continue;
 
+   case D_FREEDEP:
+   free_freedep(WK_FREEDEP(wk));
+   continue;
+
default:
panic("handle_disk_write_complete: Unknown type %s",
TYPENAME(wk->wk_type));
___
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"