svn commit: r268285 - head/sys/kern

2014-07-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Jul  5 06:12:48 2014
New Revision: 268285
URL: http://svnweb.freebsd.org/changeset/base/268285

Log:
  When getting the initial value of numeric tunables use the
  getenv_xxx() functions instead of strtoq(), because the getenv_xxx()
  functions include wrappers for various postfixes like G/M/K, which
  strtoq() doesn't do.

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Sat Jul  5 05:44:26 2014(r268284)
+++ head/sys/kern/kern_sysctl.c Sat Jul  5 06:12:48 2014(r268285)
@@ -167,13 +167,14 @@ sysctl_load_tunable_by_oid_locked(struct
 {
struct sysctl_req req;
struct sysctl_oid *curr;
-   char *penv;
+   char *penv = NULL;
char path[64];
ssize_t rem = sizeof(path);
ssize_t len;
int val_int;
long val_long;
int64_t val_64;
+   quad_t val_quad;
int error;
 
path[--rem] = 0;
@@ -192,10 +193,6 @@ sysctl_load_tunable_by_oid_locked(struct
path[rem + len] = '.';
}
 
-   penv = getenv(path + rem);
-   if (penv == NULL)
-   return;
-
memset(&req, 0, sizeof(req));
 
req.td = curthread;
@@ -205,41 +202,52 @@ sysctl_load_tunable_by_oid_locked(struct
 
switch (oidp->oid_kind & CTLTYPE) {
case CTLTYPE_INT:
-   val_int = strtoq(penv, NULL, 0);
+   if (getenv_int(path + rem, &val_int) == 0)
+   return;
req.newlen = sizeof(val_int);
req.newptr = &val_int;
break;
case CTLTYPE_UINT:
-   val_int = strtouq(penv, NULL, 0);
+   if (getenv_uint(path + rem, (unsigned int *)&val_int) == 0)
+   return;
req.newlen = sizeof(val_int);
req.newptr = &val_int;
break;
case CTLTYPE_LONG:
-   val_long = strtoq(penv, NULL, 0);
+   if (getenv_long(path + rem, &val_long) == 0)
+   return;
req.newlen = sizeof(val_long);
req.newptr = &val_long;
break;
case CTLTYPE_ULONG:
-   val_long = strtouq(penv, NULL, 0);
+   if (getenv_ulong(path + rem, (unsigned long *)&val_long) == 0)
+   return;
req.newlen = sizeof(val_long);
req.newptr = &val_long;
break;
case CTLTYPE_S64:
-   val_64 = strtoq(penv, NULL, 0);
+   if (getenv_quad(path + rem, &val_quad) == 0)
+   return;
+   val_64 = val_quad;
req.newlen = sizeof(val_64);
req.newptr = &val_64;
break;
case CTLTYPE_U64:
-   val_64 = strtouq(penv, NULL, 0);
+   /* XXX there is no getenv_uquad() */
+   if (getenv_quad(path + rem, &val_quad) == 0)
+   return;
+   val_64 = val_quad;
req.newlen = sizeof(val_64);
req.newptr = &val_64;
break;
case CTLTYPE_STRING:
+   penv = getenv(path + rem);
+   if (penv == NULL)
+   return;
req.newlen = strlen(penv);
req.newptr = penv;
break;
default:
-   freeenv(penv);
return;
}
error = sysctl_root_handler_locked(oidp, oidp->oid_arg1,
___
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: r268284 - in head: sys/cam/ctl usr.sbin/ctladm

2014-07-04 Thread Alexander Motin
Author: mav
Date: Sat Jul  5 05:44:26 2014
New Revision: 268284
URL: http://svnweb.freebsd.org/changeset/base/268284

Log:
  Introduce new IOCTL CTL_PORT_LIST reporting in more flexible XML format.
  
  Leave old CTL_GET_PORT_LIST in place so far.  Garbage-collect it later.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_ioctl.h
  head/usr.sbin/ctladm/ctladm.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Sat Jul  5 04:10:24 2014(r268283)
+++ head/sys/cam/ctl/ctl.c  Sat Jul  5 05:44:26 2014(r268284)
@@ -3138,6 +3138,104 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
retval = fe->ioctl(dev, cmd, addr, flag, td);
break;
}
+   case CTL_PORT_LIST: {
+   struct sbuf *sb;
+   struct ctl_port *port;
+   struct ctl_lun_list *list;
+// struct ctl_option *opt;
+
+   list = (struct ctl_lun_list *)addr;
+
+   sb = sbuf_new(NULL, NULL, list->alloc_len, SBUF_FIXEDLEN);
+   if (sb == NULL) {
+   list->status = CTL_LUN_LIST_ERROR;
+   snprintf(list->error_str, sizeof(list->error_str),
+"Unable to allocate %d bytes for LUN list",
+list->alloc_len);
+   break;
+   }
+
+   sbuf_printf(sb, "\n");
+
+   mtx_lock(&softc->ctl_lock);
+   STAILQ_FOREACH(port, &softc->port_list, links) {
+   retval = sbuf_printf(sb, "\n",
+(uintmax_t)port->targ_port);
+
+   /*
+* Bail out as soon as we see that we've overfilled
+* the buffer.
+*/
+   if (retval != 0)
+   break;
+
+   retval = sbuf_printf(sb, "\t%s"
+   "\n", port->frontend->name);
+   if (retval != 0)
+   break;
+
+   retval = sbuf_printf(sb, 
"\t%d\n",
+port->port_type);
+   if (retval != 0)
+   break;
+
+   retval = sbuf_printf(sb, "\t%s\n",
+   (port->status & CTL_PORT_STATUS_ONLINE) ? "YES" : 
"NO");
+   if (retval != 0)
+   break;
+
+   retval = sbuf_printf(sb, 
"\t%s\n",
+   port->port_name);
+   if (retval != 0)
+   break;
+
+   retval = sbuf_printf(sb, 
"\t%d\n",
+   port->physical_port);
+   if (retval != 0)
+   break;
+
+   retval = sbuf_printf(sb, 
"\t%d\n",
+   port->virtual_port);
+   if (retval != 0)
+   break;
+
+   retval = sbuf_printf(sb, "\t%#jx\n",
+   (uintmax_t)port->wwnn);
+   if (retval != 0)
+   break;
+
+   retval = sbuf_printf(sb, "\t%#jx\n",
+   (uintmax_t)port->wwpn);
+   if (retval != 0)
+   break;
+
+   retval = sbuf_printf(sb, "\n");
+   if (retval != 0)
+   break;
+   }
+   mtx_unlock(&softc->ctl_lock);
+
+   if ((retval != 0)
+|| ((retval = sbuf_printf(sb, "\n")) != 0)) {
+   retval = 0;
+   sbuf_delete(sb);
+   list->status = CTL_LUN_LIST_NEED_MORE_SPACE;
+   snprintf(list->error_str, sizeof(list->error_str),
+"Out of space, %d bytes is too small",
+list->alloc_len);
+   break;
+   }
+
+   sbuf_finish(sb);
+
+   retval = copyout(sbuf_data(sb), list->lun_xml,
+sbuf_len(sb) + 1);
+
+   list->fill_len = sbuf_len(sb) + 1;
+   list->status = CTL_LUN_LIST_OK;
+   sbuf_delete(sb);
+   break;
+   }
default: {
/* XXX KDM should we fix this? */
 #if 0

Modified: head/sys/cam/ctl/ctl_ioctl.h
==
--- head/sys/cam/ctl/ctl_ioctl.hSat Jul  5 04:10:24 2014
(r268283)
+++ head/sys/cam/ctl/ctl_ioctl.hSat Jul  5 05:44:26 2014
(r268284)
@@ -789,6 +789,7 @@ struct ctl_iscsi {
 #define 

svn commit: r268283 - head/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Sat Jul  5 04:10:24 2014
New Revision: 268283
URL: http://svnweb.freebsd.org/changeset/base/268283

Log:
  Improve readability of XML generated by CTL_LUN_LIST.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_backend_block.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Sat Jul  5 03:49:20 2014(r268282)
+++ head/sys/cam/ctl/ctl.c  Sat Jul  5 04:10:24 2014(r268283)
@@ -3007,7 +3007,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
if (retval != 0)
break;
 
-   retval = sbuf_printf(sb, "%s"
+   retval = sbuf_printf(sb, "\t%s"
 "\n",
 (lun->backend == NULL) ?  "none" :
 lun->backend->name);
@@ -3015,7 +3015,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
if (retval != 0)
break;
 
-   retval = sbuf_printf(sb, "%d\n",
+   retval = sbuf_printf(sb, "\t%d\n",
 lun->be_lun->lun_type);
 
if (retval != 0)
@@ -3028,20 +3028,20 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
continue;
}
 
-   retval = sbuf_printf(sb, "%ju\n",
+   retval = sbuf_printf(sb, "\t%ju\n",
 (lun->be_lun->maxlba > 0) ?
 lun->be_lun->maxlba + 1 : 0);
 
if (retval != 0)
break;
 
-   retval = sbuf_printf(sb, "%u\n",
+   retval = sbuf_printf(sb, 
"\t%u\n",
 lun->be_lun->blocksize);
 
if (retval != 0)
break;
 
-   retval = sbuf_printf(sb, "");
+   retval = sbuf_printf(sb, "\t");
 
if (retval != 0)
break;
@@ -3057,7 +3057,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
if (retval != 0)
break;
 
-   retval = sbuf_printf(sb, "");
+   retval = sbuf_printf(sb, "\t");
 
if (retval != 0)
break;
@@ -3078,7 +3078,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
break;
}
STAILQ_FOREACH(opt, &lun->be_lun->options, links) {
-   retval = sbuf_printf(sb, "<%s>%s", 
opt->name, opt->value, opt->name);
+   retval = sbuf_printf(sb, "\t<%s>%s\n",
+   opt->name, opt->value, opt->name);
if (retval != 0)
break;
}

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cSat Jul  5 03:49:20 2014
(r268282)
+++ head/sys/cam/ctl/ctl_backend_block.cSat Jul  5 04:10:24 2014
(r268283)
@@ -2509,7 +2509,7 @@ ctl_be_block_lun_info(void *be_lun, stru
lun = (struct ctl_be_block_lun *)be_lun;
retval = 0;
 
-   retval = sbuf_printf(sb, "");
+   retval = sbuf_printf(sb, "\t");
 
if (retval != 0)
goto bailout;
@@ -2519,7 +2519,7 @@ ctl_be_block_lun_info(void *be_lun, stru
if (retval != 0)
goto bailout;
 
-   retval = sbuf_printf(sb, "");
+   retval = sbuf_printf(sb, "\n");
 
 bailout:
 
___
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: r268282 - head/usr.bin/units

2014-07-04 Thread Eitan Adler
Author: eadler
Date: Sat Jul  5 03:49:20 2014
New Revision: 268282
URL: http://svnweb.freebsd.org/changeset/base/268282

Log:
  units(1): Clean up
Remove unused constant.  Add 'static' where able.

Modified:
  head/usr.bin/units/units.c

Modified: head/usr.bin/units/units.c
==
--- head/usr.bin/units/units.c  Sat Jul  5 03:48:22 2014(r268281)
+++ head/usr.bin/units/units.c  Sat Jul  5 03:49:20 2014(r268282)
@@ -69,11 +69,7 @@ static struct {
 
 static char NULLUNIT[] = "";
 
-#ifdef MSDOS
-#define SEPARATOR  ";"
-#else
 #define SEPARATOR  ":"
-#endif
 
 static int unitcount;
 static int prefixcount;
@@ -107,7 +103,7 @@ static const char * prompt(EditLine *e _
return promptstr;
 }
 
-char *
+static char *
 dupstr(const char *str)
 {
char *ret;
@@ -119,7 +115,7 @@ dupstr(const char *str)
 }
 
 
-void 
+static void 
 readunits(const char *userfile)
 {
FILE *unitfile;
@@ -224,7 +220,7 @@ readunits(const char *userfile)
fclose(unitfile);
 }
 
-void 
+static void 
 initializeunit(struct unittype * theunit)
 {
theunit->numerator[0] = theunit->denominator[0] = NULL;
@@ -234,7 +230,7 @@ initializeunit(struct unittype * theunit
 }
 
 
-int 
+static int 
 addsubunit(char *product[], char *toadd)
 {
char **ptr;
@@ -251,7 +247,7 @@ addsubunit(char *product[], char *toadd)
 }
 
 
-void 
+static void 
 showunit(struct unittype * theunit)
 {
char **ptr;
@@ -313,7 +309,7 @@ zeroerror(void)
Returns 0 for successful addition, nonzero on error.
 */
 
-int 
+static int 
 addunit(struct unittype * theunit, const char *toadd, int flip, int quantity)
 {
char *scratch, *savescr;
@@ -421,14 +417,14 @@ addunit(struct unittype * theunit, const
 }
 
 
-int 
+static int 
 compare(const void *item1, const void *item2)
 {
return strcmp(*(const char * const *)item1, *(const char * const 
*)item2);
 }
 
 
-void 
+static void 
 sortunit(struct unittype * theunit)
 {
char **ptr;
@@ -549,7 +545,7 @@ lookupunit(const char *unit)
 
 #define ERROR 4
 
-int 
+static int 
 reduceproduct(struct unittype * theunit, int flip)
 {
 
@@ -592,7 +588,7 @@ reduceproduct(struct unittype * theunit,
Returns 0 on success, or 1 on unknown unit error.
 */
 
-int 
+static int 
 reduceunit(struct unittype * theunit)
 {
int ret;
@@ -607,7 +603,7 @@ reduceunit(struct unittype * theunit)
 }
 
 
-int 
+static int 
 compareproducts(char **one, char **two)
 {
while (*one || *two) {
@@ -630,7 +626,7 @@ compareproducts(char **one, char **two)
 
 /* Return zero if units are compatible, nonzero otherwise */
 
-int 
+static int 
 compareunits(struct unittype * first, struct unittype * second)
 {
return
@@ -639,7 +635,7 @@ compareunits(struct unittype * first, st
 }
 
 
-int 
+static int 
 completereduce(struct unittype * unit)
 {
if (reduceunit(unit))
@@ -649,7 +645,7 @@ completereduce(struct unittype * unit)
return 0;
 }
 
-void 
+static void 
 showanswer(struct unittype * have, struct unittype * want)
 {
double ans;
___
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: r268281 - stable/10/sys/dev/vmware/vmxnet3

2014-07-04 Thread Bryan Venteicher
Author: bryanv
Date: Sat Jul  5 03:48:22 2014
New Revision: 268281
URL: http://svnweb.freebsd.org/changeset/base/268281

Log:
  MFC r268012, r268196:
  
- Remove some write only variables
- Give each interrupt a descriptive name when using MSIX

Modified:
  stable/10/sys/dev/vmware/vmxnet3/if_vmx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c
==
--- stable/10/sys/dev/vmware/vmxnet3/if_vmx.c   Sat Jul  5 03:34:52 2014
(r268280)
+++ stable/10/sys/dev/vmware/vmxnet3/if_vmx.c   Sat Jul  5 03:48:22 2014
(r268281)
@@ -692,6 +692,8 @@ vmxnet3_setup_msix_interrupts(struct vmx
 vmxnet3_txq_intr, txq, &intr->vmxi_handler);
if (error)
return (error);
+   bus_describe_intr(dev, intr->vmxi_irq, intr->vmxi_handler,
+   "tq%d", i);
txq->vxtxq_intr_idx = intr->vmxi_rid - 1;
}
 
@@ -701,6 +703,8 @@ vmxnet3_setup_msix_interrupts(struct vmx
vmxnet3_rxq_intr, rxq, &intr->vmxi_handler);
if (error)
return (error);
+   bus_describe_intr(dev, intr->vmxi_irq, intr->vmxi_handler,
+   "rq%d", i);
rxq->vxrxq_intr_idx = intr->vmxi_rid - 1;
}
 
@@ -708,6 +712,7 @@ vmxnet3_setup_msix_interrupts(struct vmx
vmxnet3_event_intr, sc, &intr->vmxi_handler);
if (error)
return (error);
+   bus_describe_intr(dev, intr->vmxi_irq, intr->vmxi_handler, "event");
sc->vmx_event_intr_idx = intr->vmxi_rid - 1;
 
return (0);
@@ -2219,12 +2224,10 @@ vmxnet3_legacy_intr(void *xsc)
struct vmxnet3_softc *sc;
struct vmxnet3_rxqueue *rxq;
struct vmxnet3_txqueue *txq;
-   struct ifnet *ifp;
 
sc = xsc;
rxq = &sc->vmx_rxq[0];
txq = &sc->vmx_txq[0];
-   ifp = sc->vmx_ifp;
 
if (sc->vmx_intr_type == VMXNET3_IT_LEGACY) {
if (vmxnet3_read_bar1(sc, VMXNET3_BAR1_INTR) == 0)
@@ -2253,11 +2256,9 @@ vmxnet3_txq_intr(void *xtxq)
 {
struct vmxnet3_softc *sc;
struct vmxnet3_txqueue *txq;
-   struct ifnet *ifp;
 
txq = xtxq;
sc = txq->vxtxq_sc;
-   ifp = sc->vmx_ifp;
 
if (sc->vmx_intr_mask_mode == VMXNET3_IMM_ACTIVE)
vmxnet3_disable_intr(sc, txq->vxtxq_intr_idx);
@@ -2765,7 +2766,6 @@ static int
 vmxnet3_txq_encap(struct vmxnet3_txqueue *txq, struct mbuf **m0)
 {
struct vmxnet3_softc *sc;
-   struct ifnet *ifp;
struct vmxnet3_txring *txr;
struct vmxnet3_txdesc *txd, *sop;
struct mbuf *m;
@@ -2774,7 +2774,6 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue
int i, gen, nsegs, etype, proto, start, error;
 
sc = txq->vxtxq_sc;
-   ifp = sc->vmx_ifp;
start = 0;
txd = NULL;
txr = &txq->vxtxq_cmd_ring;
___
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: r268280 - head/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Sat Jul  5 03:34:52 2014
New Revision: 268280
URL: http://svnweb.freebsd.org/changeset/base/268280

Log:
  Make options KPI more generic to allow it to be used for ports too,
  not only for LUNs.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl.h
  head/sys/cam/ctl/ctl_backend.c
  head/sys/cam/ctl/ctl_backend.h
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_backend_ramdisk.c
  head/sys/cam/ctl/ctl_frontend_iscsi.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Sat Jul  5 03:27:31 2014(r268279)
+++ head/sys/cam/ctl/ctl.c  Sat Jul  5 03:34:52 2014(r268280)
@@ -2954,7 +2954,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
struct sbuf *sb;
struct ctl_lun *lun;
struct ctl_lun_list *list;
-   struct ctl_be_lun_option *opt;
+   struct ctl_option *opt;
 
list = (struct ctl_lun_list *)addr;
 
@@ -9579,7 +9579,8 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio
 */
desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10;
desc->length = sizeof(*t10id) + devid_len;
-   if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "vendor")) == NULL) {
+   if (lun == NULL || (val = ctl_get_opt(&lun->be_lun->options,
+   "vendor")) == NULL) {
strncpy((char *)t10id->vendor, CTL_VENDOR, 
sizeof(t10id->vendor));
} else {
memset(t10id->vendor, ' ', sizeof(t10id->vendor));
@@ -9963,7 +9964,8 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
 * We have 8 bytes for the vendor name, and 16 bytes for the device
 * name and 4 bytes for the revision.
 */
-   if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "vendor")) == NULL) {
+   if (lun == NULL || (val = ctl_get_opt(&lun->be_lun->options,
+   "vendor")) == NULL) {
strcpy(inq_ptr->vendor, CTL_VENDOR);
} else {
memset(inq_ptr->vendor, ' ', sizeof(inq_ptr->vendor));
@@ -9972,7 +9974,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
}
if (lun == NULL) {
strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT);
-   } else if ((val = ctl_get_opt(lun->be_lun, "product")) == NULL) {
+   } else if ((val = ctl_get_opt(&lun->be_lun->options, "product")) == 
NULL) {
switch (lun->be_lun->lun_type) {
case T_DIRECT:
strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT);
@@ -9994,7 +9996,8 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
 * XXX make this a macro somewhere so it automatically gets
 * incremented when we make changes.
 */
-   if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "revision")) == 
NULL) {
+   if (lun == NULL || (val = ctl_get_opt(&lun->be_lun->options,
+   "revision")) == NULL) {
strncpy(inq_ptr->revision, "0001", sizeof(inq_ptr->revision));
} else {
memset(inq_ptr->revision, ' ', sizeof(inq_ptr->revision));

Modified: head/sys/cam/ctl/ctl.h
==
--- head/sys/cam/ctl/ctl.h  Sat Jul  5 03:27:31 2014(r268279)
+++ head/sys/cam/ctl/ctl.h  Sat Jul  5 03:34:52 2014(r268280)
@@ -186,6 +186,22 @@ void ctl_config_write_done(union ctl_io 
 void ctl_portDB_changed(int portnum);
 void ctl_init_isc_msg(void);
 
+/*
+ * KPI to manipulate LUN/port options
+ */
+
+struct ctl_option {
+   STAILQ_ENTRY(ctl_option)links;
+   char*name;
+   char*value;
+};
+typedef STAILQ_HEAD(ctl_options, ctl_option) ctl_options_t;
+
+struct ctl_be_arg;
+void ctl_init_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args);
+void ctl_free_opts(ctl_options_t *opts);
+char * ctl_get_opt(ctl_options_t *opts, const char *name);
+
 #endif /* _KERNEL */
 
 #endif /* _CTL_H_ */

Modified: head/sys/cam/ctl/ctl_backend.c
==
--- head/sys/cam/ctl/ctl_backend.c  Sat Jul  5 03:27:31 2014
(r268279)
+++ head/sys/cam/ctl/ctl_backend.c  Sat Jul  5 03:34:52 2014
(r268280)
@@ -174,29 +174,29 @@ ctl_backend_find(char *backend_name)
 }
 
 void
-ctl_init_opts(struct ctl_be_lun *be_lun, struct ctl_lun_req *req)
+ctl_init_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args)
 {
-   struct ctl_be_lun_option *opt;
+   struct ctl_option *opt;
int i;
 
-   STAILQ_INIT(&be_lun->options);
-   for (i = 0; i < req->num_be_args; i++) {
+   STAILQ_INIT(opts);
+   for (i = 0; i < num_args; i++) {
opt = malloc(sizeof(*opt), M_CTL, M_WAITOK);
-   opt->name = malloc(strlen(req->kern_be_args[i].kname) + 1, 
M_CTL, M_WAITOK);
-   strcpy(opt->name, req->kern_be_args[i

svn commit: r268279 - head/usr.bin/units

2014-07-04 Thread Eitan Adler
Author: eadler
Date: Sat Jul  5 03:27:31 2014
New Revision: 268279
URL: http://svnweb.freebsd.org/changeset/base/268279

Log:
  units(1): Convert units.lib to use '#' instead of '/'.
This allows us to run GNU units against our data files and compare the 
output.
In addition, current units(1) does not support '/' as a comment at all.

Modified:
  head/usr.bin/units/units.lib

Modified: head/usr.bin/units/units.lib
==
--- head/usr.bin/units/units.libSat Jul  5 03:25:26 2014
(r268278)
+++ head/usr.bin/units/units.libSat Jul  5 03:27:31 2014
(r268279)
@@ -1,6 +1,6 @@
-/ $FreeBSD$
+# $FreeBSD$
 
-/ primitive units
+# primitive units
 
 m  !a!
 kg !b!
@@ -13,7 +13,7 @@ bit   !h!
 erlang !i!
 K  !j!
 
-/ prefixes
+# prefixes
 
 yotta- 1e24
 zetta- 1e21
@@ -68,7 +68,7 @@ a-atto
 z- zopto
 y- yocto
 
-/ binary prefixes introduced in 1999
+# binary prefixes introduced in 1999
 exbi-  1152921504606846976
 pebi-  1125899906842624
 tebi-  1099511627776
@@ -83,7 +83,7 @@ Gi-   gibi
 Mi-mebi
 Ki-kibi
 
-/ constants
+# constants
 
 fuzz   1
 pi 3.14159265358979323846
@@ -109,7 +109,7 @@ electronmass9.1093821545-31 kg
 protonmass 1.6726217129-27 kg
 neutronmass1.6749272928-27 kg
 
-/ dimensionless
+# dimensionless
 
 radian .5 / pi
 degree 1|180 pi-radian
@@ -127,7 +127,7 @@ steradian   radian2
 sphere 4 pi-steradian
 sr steradian
 
-/ Time
+# Time
 
 second sec
 s  sec
@@ -143,13 +143,13 @@ yryear
 month  1|12 year
 us microsec
 
-/ Mass
+# Mass
 
 gram   millikg
 gm gram
 metricton  kilokg
 
-/ Avoirdupois
+# Avoirdupois
 
 lb .45359237 kg
 pound  lb
@@ -164,7 +164,7 @@ shortton2000 lb
 tonshortton
 longton2240 lb
 
-/ Apothecary
+# Apothecary
 
 scruple20 grain
 apdram 60 grain
@@ -172,7 +172,7 @@ apounce 480 grain
 appound5760 grain
 troypound  appound
 
-/ Mining
+# Mining
 
 troyounce  apounce
 troz   apounce
@@ -180,7 +180,7 @@ pennyweight 1|20 troz
 pwtpennyweight
 dwtpennyweight
 
-/ Length
+# Length
 
 meter  m
 micron micrometer
@@ -208,7 +208,7 @@ cc  cm3
 liter  kilocc
 ml milliliter
 
-/ US Liquid
+# US Liquid
 
 gallon 231 in3
 imperial   1.20095
@@ -222,7 +222,7 @@ floz1|16 pt
 fldr   1|8 floz
 shot   3|2 floz
 
-/ US Dry
+# US Dry
 
 dry268.8025 in3/gallon fuzz
 peck   8 dry-quart
@@ -231,7 +231,7 @@ bushel  4 peck
 bu bushel
 chaldron   36 bushel
 
-/ British
+# British
 
 brgallon   277.420 in3 fuzz
 brquart1|4 brgallon
@@ -241,10 +241,10 @@ brpeck554.84 in3 fuzz
 brbushel   4 brpeck
 brhundredweight112 lb
 
-/ Bottles
+# Bottles
 
 bottle 750 milliliter
-/bottlefifth
+#bottlefifth
 
 miniature  100 milliliter
 split  1|4 bottle
@@ -258,7 +258,7 @@ balthazar   16 bottle
 nebuchadnezzar 20 bottle
 sovereign  34 bottle
 
-/ Bottles - alternate names and spellings
+# Bottles - alternate names and spellings
 
 pony   split
 fillette   half
@@ -266,7 +266,7 @@ tappit-hen  3 imperial
 rheoboam   rehoboam
 shalmanesersalmanazar
 
-/ Russian
+# Russian
 berkovets  10 pood
 pood   40 funt
 funt   0.40951 kg
@@ -279,7 +279,7 @@ verst   1066.8 m
 sazhen 1|500 verst
 kosayasazhen   1|430.2 verst
 arshin 1|1500 verst
-/ is not exactly defined
+# is not exactly defined
 ruell  16.54 in
 liniya 1|10 in
 vershok1.75 in
@@ -296,7 +296,7 @@ sqverst 104.2 desyatina_state
 sqarshin   1|21600 desyatina_state
 sqfoot 1|117600 desyatina_state
 
-/ Energy Work

svn commit: r268278 - head/usr.bin/units

2014-07-04 Thread Eitan Adler
Author: eadler
Date: Sat Jul  5 03:25:26 2014
New Revision: 268278
URL: http://svnweb.freebsd.org/changeset/base/268278

Log:
  units: Support start of line comments with '#'
Modern GNU units(1) supports comments anywhere with '#' but take the 
easy route for now and at least support start of line # comments.

Modified:
  head/usr.bin/units/units.1
  head/usr.bin/units/units.c

Modified: head/usr.bin/units/units.1
==
--- head/usr.bin/units/units.1  Sat Jul  5 03:17:57 2014(r268277)
+++ head/usr.bin/units/units.1  Sat Jul  5 03:25:26 2014(r268278)
@@ -149,7 +149,7 @@ The
 program will not detect infinite loops that could be caused
 by careless unit definitions.
 Comments in the unit definition file
-begin with a '/' character at the beginning of a line.
+begin with a '#' or '/' character at the beginning of a line.
 .Pp
 Prefixes are defined in the same was as standard units, but with
 a trailing dash at the end of the prefix name.

Modified: head/usr.bin/units/units.c
==
--- head/usr.bin/units/units.c  Sat Jul  5 03:17:57 2014(r268277)
+++ head/usr.bin/units/units.c  Sat Jul  5 03:25:26 2014(r268278)
@@ -166,7 +166,7 @@ readunits(const char *userfile)
break;
linenum++;
lineptr = line;
-   if (*lineptr == '/')
+   if (*lineptr == '/' || *lineptr == '#')
continue;
lineptr += strspn(lineptr, " \n\t");
len = strcspn(lineptr, " \n\t");
___
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: r268277 - head/usr.bin/units

2014-07-04 Thread Eitan Adler
Author: eadler
Date: Sat Jul  5 03:17:57 2014
New Revision: 268277
URL: http://svnweb.freebsd.org/changeset/base/268277

Log:
  units(1): Add 'terse' support
terse output is used when calling units from another script.

Modified:
  head/usr.bin/units/units.1
  head/usr.bin/units/units.c

Modified: head/usr.bin/units/units.1
==
--- head/usr.bin/units/units.1  Sat Jul  5 02:38:53 2014(r268276)
+++ head/usr.bin/units/units.1  Sat Jul  5 03:17:57 2014(r268277)
@@ -26,6 +26,10 @@ If not, print
 .Qo
 Units data file not found
 .Qc
+.It Fl t No , Fl -terse
+Only print the result.  This is used when calling
+.Nm
+from other programs for easy to parse results.
 .It Fl v No , Fl -verbose
 Print the units in the conversion output.
 Be more verbose in general.

Modified: head/usr.bin/units/units.c
==
--- head/usr.bin/units/units.c  Sat Jul  5 02:38:53 2014(r268276)
+++ head/usr.bin/units/units.c  Sat Jul  5 03:17:57 2014(r268277)
@@ -78,6 +78,7 @@ static char NULLUNIT[] = "";
 static int unitcount;
 static int prefixcount;
 static bool verbose = false;
+static bool terse = false;
 static const char * havestr;
 static const char * wantstr;
 
@@ -657,14 +658,16 @@ showanswer(struct unittype * have, struc
printf("conformability error\n");
if (verbose)
printf("\t%s = ", havestr);
-   else
+   else if (!terse)
printf("\t");
showunit(have);
-   if (verbose)
-   printf("\t%s = ", wantstr);
-   else
-   printf("\t");
-   showunit(want);
+   if (!terse) {
+   if (verbose)
+   printf("\t%s = ", wantstr);
+   else
+   printf("\t");
+   showunit(want);
+   }
}
else if (have->offset != want->offset) {
if (want->quantity)
@@ -684,12 +687,14 @@ showanswer(struct unittype * have, struc
ans = have->factor / want->factor;
if (verbose)
printf("\t%s = %.8g * %s\n", havestr, ans, wantstr);
-   else
+   else if (terse) 
+   printf("%.8g\n", ans);
+   else 
printf("\t* %.8g\n", ans);
 
if (verbose)
printf("\t%s = (1 / %.8g) * %s\n", havestr, 1/ans,  
wantstr);
-   else
+   else if (!terse)
printf("\t/ %.8g\n", 1/ans);
}
 }
@@ -707,8 +712,9 @@ static struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
{"file", required_argument, NULL, 'f'},
{"quiet", no_argument, NULL, 'q'},
-   {"verbose", no_argument, NULL, 'v'},
+   {"terse", no_argument, NULL, 't'},
{"unitsfile", no_argument, NULL, 'U'},
+   {"verbose", no_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'},
{ 0, 0, 0, 0 }
 };
@@ -729,7 +735,7 @@ main(int argc, char **argv)
 
quiet = false;
readfile = false;
-   while ((optchar = getopt_long(argc, argv, "+hf:qvUV", longopts, NULL)) 
!= -1) {
+   while ((optchar = getopt_long(argc, argv, "+hf:qtvUV", longopts, NULL)) 
!= -1) {
switch (optchar) {
case 'f':
readfile = true;
@@ -741,6 +747,9 @@ main(int argc, char **argv)
case 'q':
quiet = true;
break;
+   case 't':
+   terse = true;
+   break;
case 'v':
verbose = true;
break;
@@ -825,5 +834,5 @@ main(int argc, char **argv)
 
history_end(inhistory);
el_end(el);
-   return(0);
+   return (0);
 }
___
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: r268276 - head/usr.sbin/bhyve

2014-07-04 Thread Peter Grehan
Author: grehan
Date: Sat Jul  5 02:38:53 2014
New Revision: 268276
URL: http://svnweb.freebsd.org/changeset/base/268276

Log:
  Extend capabilities to 64-bits in preparation for some API changes.
  The v1.0 virtio spec supports an extended size for guest/host
  caps, but in practice 64-bits should last for a long time.

Modified:
  head/usr.sbin/bhyve/virtio.h

Modified: head/usr.sbin/bhyve/virtio.h
==
--- head/usr.sbin/bhyve/virtio.hSat Jul  5 01:24:06 2014
(r268275)
+++ head/usr.sbin/bhyve/virtio.hSat Jul  5 02:38:53 2014
(r268276)
@@ -352,7 +352,7 @@ struct virtio_consts {
/* called to read config regs */
int (*vc_cfgwrite)(void *, int, int, uint32_t);
/* called to write config regs */
-   uint32_t vc_hv_caps;/* hypervisor-provided capabilities */
+   uint64_t vc_hv_caps;/* hypervisor-provided capabilities */
 };
 
 /*
___
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: r268275 - head/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Sat Jul  5 01:24:06 2014
New Revision: 268275
URL: http://svnweb.freebsd.org/changeset/base/268275

Log:
  Use proper links field for ports linking.

Modified:
  head/sys/cam/ctl/ctl_frontend.c

Modified: head/sys/cam/ctl/ctl_frontend.c
==
--- head/sys/cam/ctl/ctl_frontend.c Sat Jul  5 01:14:14 2014
(r268274)
+++ head/sys/cam/ctl/ctl_frontend.c Sat Jul  5 01:24:06 2014
(r268275)
@@ -162,7 +162,7 @@ ctl_port_register(struct ctl_port *port,
mtx_lock(&control_softc->ctl_lock);
port->targ_port = port_num + (master_shelf != 0 ? 0 : CTL_MAX_PORTS);
port->max_initiators = CTL_MAX_INIT_PER_PORT;
-   STAILQ_INSERT_TAIL(&port->frontend->port_list, port, links);
+   STAILQ_INSERT_TAIL(&port->frontend->port_list, port, fe_links);
STAILQ_INSERT_TAIL(&control_softc->port_list, port, links);
control_softc->ctl_ports[port_num] = port;
mtx_unlock(&control_softc->ctl_lock);
___
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: r268274 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-07-04 Thread Alexander Motin
Author: mav
Date: Sat Jul  5 01:14:14 2014
New Revision: 268274
URL: http://svnweb.freebsd.org/changeset/base/268274

Log:
  MFC r268178:
  Fix bug in sync control in new "dev" mode of ZVOL (r265678).
  
  Don't check ZVOL_WCE flag, used in Solaris to control device "write cache".
  It is not applicable on FreeBSD and by default set to "disable".

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Jul 
 4 22:47:07 2014(r268273)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Jul 
 5 01:14:14 2014(r268274)
@@ -1628,7 +1628,11 @@ zvol_write(struct cdev *dev, struct uio 
}
 #endif
 
+#ifdef sun
sync = !(zv->zv_flags & ZVOL_WCE) ||
+#else
+   sync =
+#endif
(zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS);
 
rl = zfs_range_lock(&zv->zv_znode, uio->uio_loffset, uio->uio_resid,
___
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: r268273 - head/sys/fs/nfsserver

2014-07-04 Thread Rick Macklem
Author: rmacklem
Date: Fri Jul  4 22:47:07 2014
New Revision: 268273
URL: http://svnweb.freebsd.org/changeset/base/268273

Log:
  The new NFSv3 server did not generate directory postop attributes for
  the reply to ReaddirPlus when the server failed within the loop
  that calls VFS_VGET(). This failure is most likely an error
  return from VFS_VGET() caused by a bogus d_fileno that was
  truncated to 32bits.
  This patch fixes the server so that it will return directory postop
  attributes for the failure. It does not fix the underlying issue caused
  by d_fileno being uint32_t when a file system like ZFS generates
  a fileno that is greater than 32bits.
  
  Reported by:  jpaetzel
  Reviewed by:  jpaetzel
  MFC after:1 month

Modified:
  head/sys/fs/nfsserver/nfs_nfsdport.c

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==
--- head/sys/fs/nfsserver/nfs_nfsdport.cFri Jul  4 22:39:39 2014
(r268272)
+++ head/sys/fs/nfsserver/nfs_nfsdport.cFri Jul  4 22:47:07 2014
(r268273)
@@ -2264,9 +2264,11 @@ again:
if (dirlen > cnt || nd->nd_repstat) {
if (!nd->nd_repstat && entrycnt == 0)
nd->nd_repstat = NFSERR_TOOSMALL;
-   if (nd->nd_repstat)
+   if (nd->nd_repstat) {
newnfs_trimtrailing(nd, mb0, bpos0);
-   else
+   if (nd->nd_flag & ND_NFSV3)
+   nfsrv_postopattr(nd, getret, &at);
+   } else
newnfs_trimtrailing(nd, mb1, bpos1);
eofflag = 0;
} else if (cpos < cend)
___
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: r268272 - head/lib/libc/locale

2014-07-04 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jul  4 22:39:39 2014
New Revision: 268272
URL: http://svnweb.freebsd.org/changeset/base/268272

Log:
  minor perf enhancement for UTF-8
  
  Reduce some duplicate code.
  
  Reference:
  https://www.illumos.org/issues/628
  
  Obtained from:Illumos
  MFC after:1 week

Modified:
  head/lib/libc/locale/utf8.c

Modified: head/lib/libc/locale/utf8.c
==
--- head/lib/libc/locale/utf8.c Fri Jul  4 22:19:21 2014(r268271)
+++ head/lib/libc/locale/utf8.c Fri Jul  4 22:39:39 2014(r268272)
@@ -1,4 +1,5 @@
 /*-
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2002-2004 Tim J. Robbins
  * All rights reserved.
  *
@@ -112,13 +113,6 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, 
/* Incomplete multibyte sequence */
return ((size_t)-2);
 
-   if (us->want == 0 && ((ch = (unsigned char)*s) & ~0x7f) == 0) {
-   /* Fast path for plain ASCII characters. */
-   if (pwc != NULL)
-   *pwc = ch;
-   return (ch != '\0' ? 1 : 0);
-   }
-
if (us->want == 0) {
/*
 * Determine the number of octets that make up this character
@@ -134,10 +128,12 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, 
 */
ch = (unsigned char)*s;
if ((ch & 0x80) == 0) {
-   mask = 0x7f;
-   want = 1;
-   lbound = 0;
-   } else if ((ch & 0xe0) == 0xc0) {
+   /* Fast path for plain ASCII characters. */
+   if (pwc != NULL)
+   *pwc = ch;
+   return (ch != '\0' ? 1 : 0);
+   }
+   if ((ch & 0xe0) == 0xc0) {
mask = 0x1f;
want = 2;
lbound = 0x80;
@@ -316,12 +312,6 @@ _UTF8_wcrtomb(char * __restrict s, wchar
/* Reset to initial shift state (no-op) */
return (1);
 
-   if ((wc & ~0x7f) == 0) {
-   /* Fast path for plain ASCII characters. */
-   *s = (char)wc;
-   return (1);
-   }
-
/*
 * Determine the number of octets needed to represent this character.
 * We always output the shortest sequence possible. Also specify the
@@ -329,8 +319,9 @@ _UTF8_wcrtomb(char * __restrict s, wchar
 * about the sequence length.
 */
if ((wc & ~0x7f) == 0) {
-   lead = 0;
-   len = 1;
+   /* Fast path for plain ASCII characters. */
+   *s = (char)wc;
+   return (1);
} else if ((wc & ~0x7ff) == 0) {
lead = 0xc0;
len = 2;
___
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: r268271 - head/usr.bin/units

2014-07-04 Thread Eitan Adler
Author: eadler
Date: Fri Jul  4 22:19:21 2014
New Revision: 268271
URL: http://svnweb.freebsd.org/changeset/base/268271

Log:
  units(1): Add 'help' flag
- Add support for --help for compatibility
- Make usage() static

Modified:
  head/usr.bin/units/units.1
  head/usr.bin/units/units.c

Modified: head/usr.bin/units/units.1
==
--- head/usr.bin/units/units.1  Fri Jul  4 21:34:48 2014(r268270)
+++ head/usr.bin/units/units.1  Fri Jul  4 22:19:21 2014(r268271)
@@ -13,6 +13,8 @@
 .Sh OPTIONS
 The following options are available:
 .Bl -tag -width indent
+.It Fl h No , Fl -help
+Show an overview of options
 .It Fl f Ar filename No , Fl -file Ar filename
 Specify the name of the units data file to load.
 .It Fl q No , Fl -quiet

Modified: head/usr.bin/units/units.c
==
--- head/usr.bin/units/units.c  Fri Jul  4 21:34:48 2014(r268270)
+++ head/usr.bin/units/units.c  Fri Jul  4 22:19:21 2014(r268271)
@@ -695,7 +695,7 @@ showanswer(struct unittype * have, struc
 }
 
 
-void 
+static void 
 usage(void)
 {
fprintf(stderr,
@@ -704,6 +704,7 @@ usage(void)
 }
 
 static struct option longopts[] = {
+   {"help", no_argument, NULL, 'h'},
{"file", required_argument, NULL, 'f'},
{"quiet", no_argument, NULL, 'q'},
{"verbose", no_argument, NULL, 'v'},
@@ -728,7 +729,7 @@ main(int argc, char **argv)
 
quiet = false;
readfile = false;
-   while ((optchar = getopt_long(argc, argv, "+f:qvUV", longopts, NULL)) 
!= -1) {
+   while ((optchar = getopt_long(argc, argv, "+hf:qvUV", longopts, NULL)) 
!= -1) {
switch (optchar) {
case 'f':
readfile = true;
@@ -753,6 +754,9 @@ main(int argc, char **argv)
printf("Units data file not found");
exit(0);
break;
+   case 'h':
+   /* FALLTHROUGH */
+
default:
usage();
}
___
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: r268270 - head/usr.bin/units

2014-07-04 Thread Eitan Adler
Author: eadler
Date: Fri Jul  4 21:34:48 2014
New Revision: 268270
URL: http://svnweb.freebsd.org/changeset/base/268270

Log:
  units(1): Fix man page
Igor walks one way.  I walked the other.
  
  Reported by:  wblock

Modified:
  head/usr.bin/units/units.1

Modified: head/usr.bin/units/units.1
==
--- head/usr.bin/units/units.1  Fri Jul  4 21:21:05 2014(r268269)
+++ head/usr.bin/units/units.1  Fri Jul  4 21:34:48 2014(r268270)
@@ -1,5 +1,5 @@
 .\" $FreeBSD$
-.Dd April 14, 2014
+.Dd July 4, 2014
 .Dt UNITS 1
 .Os
 .Sh NAME
@@ -19,12 +19,14 @@ Specify the name of the units data file 
 Suppress prompting of the user for units and the display of statistics
 about the number of units loaded.
 .It Fl U No , Fl -unitsfile
-If the default unit file exists prints its location.  If not, print
+If the default unit file exists prints its location.
+If not, print
 .Qo
 Units data file not found
 .Qc
 .It Fl v No , Fl -verbose
-Print the units in the conversion output.  Be more verbose in general.
+Print the units in the conversion output.
+Be more verbose in general.
 .It Fl V No , Fl -version
 Print the version number, usage, and then exit.
 .It Ar from-unit to-unit
___
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: r268269 - head/usr.bin/units

2014-07-04 Thread Eitan Adler
Author: eadler
Date: Fri Jul  4 21:21:05 2014
New Revision: 268269
URL: http://svnweb.freebsd.org/changeset/base/268269

Log:
  units(1): add long options
Things brings additional compatibility with units 2.10
  
  Discussed with:   wblock (man page)

Modified:
  head/usr.bin/units/units.1
  head/usr.bin/units/units.c

Modified: head/usr.bin/units/units.1
==
--- head/usr.bin/units/units.1  Fri Jul  4 21:06:48 2014(r268268)
+++ head/usr.bin/units/units.1  Fri Jul  4 21:21:05 2014(r268269)
@@ -13,17 +13,19 @@
 .Sh OPTIONS
 The following options are available:
 .Bl -tag -width indent
-.It Fl f Ar filename
+.It Fl f Ar filename No , Fl -file Ar filename
 Specify the name of the units data file to load.
-.It Fl q
+.It Fl q No , Fl -quiet
 Suppress prompting of the user for units and the display of statistics
 about the number of units loaded.
-.It Fl U
+.It Fl U No , Fl -unitsfile
 If the default unit file exists prints its location.  If not, print
 .Qo
 Units data file not found
 .Qc
-.It Fl V
+.It Fl v No , Fl -verbose
+Print the units in the conversion output.  Be more verbose in general.
+.It Fl V No , Fl -version
 Print the version number, usage, and then exit.
 .It Ar from-unit to-unit
 Allow a single unit conversion to be done directly from the command
@@ -31,8 +33,6 @@ line.
 The program will not print prompts.
 It will print out the
 result of the single specified conversion.
-.It Fl v
-Print the units in the conversion output.  Be more verbose in general.
 .El
 .Sh DESCRIPTION
 The

Modified: head/usr.bin/units/units.c
==
--- head/usr.bin/units/units.c  Fri Jul  4 21:06:48 2014(r268268)
+++ head/usr.bin/units/units.c  Fri Jul  4 21:21:05 2014(r268269)
@@ -24,6 +24,7 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -702,6 +703,15 @@ usage(void)
exit(3);
 }
 
+static struct option longopts[] = {
+   {"file", required_argument, NULL, 'f'},
+   {"quiet", no_argument, NULL, 'q'},
+   {"verbose", no_argument, NULL, 'v'},
+   {"unitsfile", no_argument, NULL, 'U'},
+   {"version", no_argument, NULL, 'V'},
+   { 0, 0, 0, 0 }
+};
+
 
 int
 main(int argc, char **argv)
@@ -718,7 +728,7 @@ main(int argc, char **argv)
 
quiet = false;
readfile = false;
-   while ((optchar = getopt(argc, argv, "f:qvUV")) != -1) {
+   while ((optchar = getopt_long(argc, argv, "+f:qvUV", longopts, NULL)) 
!= -1) {
switch (optchar) {
case 'f':
readfile = true;
___
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: r267745 - head/lib/libc/stdlib

2014-07-04 Thread Pedro Giffuni


On 07/04/14 14:18, Benjamin Kaduk wrote:
On Sun, Jun 22, 2014 at 4:13 PM, Pedro F. Giffuni > wrote:


Author: pfg
Date: Sun Jun 22 20:13:57 2014
New Revision: 267745
URL: http://svnweb.freebsd.org/changeset/base/267745

Log:
  getopt(3): recognize option:: as GNU extension for "optional
options".

[...]

 is to follow.
+If an individual character is followed by two colons, then the
+option argument is optional;
+.Va optarg
+is set to the rest of the current
+.Va argv
+word, or
+.Dv NULL
+if there were no more characters in the current word.
+This is a
+.Nx
+extension.


.Nx is NetBSD, not GNU...



Thanks!

I tried to fix it in r268268 but I am not a documentation expert.

Regards,

Pedro.

-Ben


___
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: r268268 - head/lib/libc/stdlib

2014-07-04 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jul  4 21:06:48 2014
New Revision: 268268
URL: http://svnweb.freebsd.org/changeset/base/268268

Log:
  getopt(3): clarify GNU instead of NetBSD.
  
  The manpage and the code for r267745 came from NetBSD but the
  option is inspired on GNU.
  
  Reported by:  Ben Kaduk
  MFC after:3 days

Modified:
  head/lib/libc/stdlib/getopt.3

Modified: head/lib/libc/stdlib/getopt.3
==
--- head/lib/libc/stdlib/getopt.3   Fri Jul  4 21:04:19 2014
(r268267)
+++ head/lib/libc/stdlib/getopt.3   Fri Jul  4 21:06:48 2014
(r268268)
@@ -74,7 +74,7 @@ word, or
 .Dv NULL
 if there were no more characters in the current word.
 This is a
-.Nx
+.It Tn GNU
 extension.
 For example, an option string
 .Li \&"x"
___
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: r268267 - releng/9.3/sys/conf

2014-07-04 Thread Glen Barber
Author: gjb
Date: Fri Jul  4 21:04:19 2014
New Revision: 268267
URL: http://svnweb.freebsd.org/changeset/base/268267

Log:
  Switch releng/9.3 to -RC3 as part of the 9.3-RELEASE cycle.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/9.3/sys/conf/newvers.sh

Modified: releng/9.3/sys/conf/newvers.sh
==
--- releng/9.3/sys/conf/newvers.sh  Fri Jul  4 19:27:06 2014
(r268266)
+++ releng/9.3/sys/conf/newvers.sh  Fri Jul  4 21:04:19 2014
(r268267)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="9.3"
-BRANCH="RC2"
+BRANCH="RC3"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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: r268266 - head/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Fri Jul  4 19:27:06 2014
New Revision: 268266
URL: http://svnweb.freebsd.org/changeset/base/268266

Log:
  Separate concepts of frontend and port.
  
  Before iSCSI implementation CTL had no knowledge about frontend drivers,
  it had only frontends, which really were ports (alike to LUNs, if comparing
  to backends).  But iSCSI added there ioctl() method, which does not belong
  to frontend as a port, but belongs to a frontend driver.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_frontend.c
  head/sys/cam/ctl/ctl_frontend.h
  head/sys/cam/ctl/ctl_frontend_cam_sim.c
  head/sys/cam/ctl/ctl_frontend_internal.c
  head/sys/cam/ctl/ctl_frontend_iscsi.c
  head/sys/cam/ctl/ctl_frontend_iscsi.h
  head/sys/cam/ctl/ctl_private.h
  head/sys/cam/ctl/scsi_ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Fri Jul  4 19:19:03 2014(r268265)
+++ head/sys/cam/ctl/ctl.c  Fri Jul  4 19:27:06 2014(r268266)
@@ -466,6 +466,11 @@ static moduledata_t ctl_moduledata = {
 DECLARE_MODULE(ctl, ctl_moduledata, SI_SUB_CONFIGURE, SI_ORDER_THIRD);
 MODULE_VERSION(ctl, 1);
 
+static struct ctl_frontend ioctl_frontend =
+{
+   .name = "ioctl",
+};
+
 static void
 ctl_isc_handler_finish_xfer(struct ctl_softc *ctl_softc,
union ctl_ha_msg *msg_info)
@@ -926,7 +931,7 @@ ctl_init(void)
 {
struct ctl_softc *softc;
struct ctl_io_pool *internal_pool, *emergency_pool, *other_pool;
-   struct ctl_frontend *fe;
+   struct ctl_port *port;
 uint8_t sc_id =0;
int i, error, retval;
//int isc_retval;
@@ -1006,6 +1011,7 @@ ctl_init(void)
STAILQ_INIT(&softc->lun_list);
STAILQ_INIT(&softc->pending_lun_queue);
STAILQ_INIT(&softc->fe_list);
+   STAILQ_INIT(&softc->port_list);
STAILQ_INIT(&softc->be_list);
STAILQ_INIT(&softc->io_pools);
 
@@ -1083,23 +1089,25 @@ ctl_init(void)
/*
 * Initialize the ioctl front end.
 */
-   fe = &softc->ioctl_info.fe;
-   sprintf(softc->ioctl_info.port_name, "CTL ioctl");
-   fe->port_type = CTL_PORT_IOCTL;
-   fe->num_requested_ctl_io = 100;
-   fe->port_name = softc->ioctl_info.port_name;
-   fe->port_online = ctl_ioctl_online;
-   fe->port_offline = ctl_ioctl_offline;
-   fe->onoff_arg = &softc->ioctl_info;
-   fe->lun_enable = ctl_ioctl_lun_enable;
-   fe->lun_disable = ctl_ioctl_lun_disable;
-   fe->targ_lun_arg = &softc->ioctl_info;
-   fe->fe_datamove = ctl_ioctl_datamove;
-   fe->fe_done = ctl_ioctl_done;
-   fe->max_targets = 15;
-   fe->max_target_id = 15;
+   ctl_frontend_register(&ioctl_frontend);
+   port = &softc->ioctl_info.port;
+   port->frontend = &ioctl_frontend;
+   sprintf(softc->ioctl_info.port_name, "ioctl");
+   port->port_type = CTL_PORT_IOCTL;
+   port->num_requested_ctl_io = 100;
+   port->port_name = softc->ioctl_info.port_name;
+   port->port_online = ctl_ioctl_online;
+   port->port_offline = ctl_ioctl_offline;
+   port->onoff_arg = &softc->ioctl_info;
+   port->lun_enable = ctl_ioctl_lun_enable;
+   port->lun_disable = ctl_ioctl_lun_disable;
+   port->targ_lun_arg = &softc->ioctl_info;
+   port->fe_datamove = ctl_ioctl_datamove;
+   port->fe_done = ctl_ioctl_done;
+   port->max_targets = 15;
+   port->max_target_id = 15;
 
-   if (ctl_frontend_register(&softc->ioctl_info.fe,
+   if (ctl_port_register(&softc->ioctl_info.port,
  (softc->flags & CTL_FLAG_MASTER_SHELF)) != 0) {
printf("ctl: ioctl front end registration failed, will "
   "continue anyway\n");
@@ -1125,7 +1133,7 @@ ctl_shutdown(void)
 
softc = (struct ctl_softc *)control_softc;
 
-   if (ctl_frontend_deregister(&softc->ioctl_info.fe) != 0)
+   if (ctl_port_deregister(&softc->ioctl_info.port) != 0)
printf("ctl: ioctl front end deregistration failed\n");
 
mtx_lock(&softc->ctl_lock);
@@ -1140,6 +1148,8 @@ ctl_shutdown(void)
 
mtx_unlock(&softc->ctl_lock);
 
+   ctl_frontend_deregister(&ioctl_frontend);
+
/*
 * This will rip the rug out from under any FETDs or anyone else
 * that has a pool allocated.  Since we increment our module
@@ -1204,7 +1214,7 @@ int
 ctl_port_enable(ctl_port_type port_type)
 {
struct ctl_softc *softc;
-   struct ctl_frontend *fe;
+   struct ctl_port *port;
 
if (ctl_is_single == 0) {
union ctl_ha_msg msg_info;
@@ -1233,13 +1243,13 @@ ctl_port_enable(ctl_port_type port_type)
 
softc = control_softc;
 
-   STAILQ_FOREACH(fe, &softc->fe_list, links) {
-   if (port_type & fe->port_type)
+   STAILQ_FOREACH(port, &softc->port_list, links) {
+   if (port_type & port->port_type)

Re: svn commit: r267745 - head/lib/libc/stdlib

2014-07-04 Thread Benjamin Kaduk
On Sun, Jun 22, 2014 at 4:13 PM, Pedro F. Giffuni  wrote:

> Author: pfg
> Date: Sun Jun 22 20:13:57 2014
> New Revision: 267745
> URL: http://svnweb.freebsd.org/changeset/base/267745
>
> Log:
>   getopt(3): recognize option:: as GNU extension for "optional options".
>
[...]

>  is to follow.
> +If an individual character is followed by two colons, then the
> +option argument is optional;
> +.Va optarg
> +is set to the rest of the current
> +.Va argv
> +word, or
> +.Dv NULL
> +if there were no more characters in the current word.
> +This is a
> +.Nx
> +extension.
>

.Nx is NetBSD, not GNU...

-Ben
___
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: r268265 - head/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Fri Jul  4 19:19:03 2014
New Revision: 268265
URL: http://svnweb.freebsd.org/changeset/base/268265

Log:
  Remove targ_enable()/targ_disable() frontend methods.
  
  Those methods were never implemented, and I believe that their concept is
  wrong, since single frontend (SCSI port) can not handle several targets.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_frontend.h
  head/sys/cam/ctl/ctl_frontend_cam_sim.c
  head/sys/cam/ctl/ctl_frontend_internal.c
  head/sys/cam/ctl/ctl_frontend_iscsi.c
  head/sys/cam/ctl/scsi_ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Fri Jul  4 18:47:25 2014(r268264)
+++ head/sys/cam/ctl/ctl.c  Fri Jul  4 19:19:03 2014(r268265)
@@ -329,8 +329,6 @@ static int ctl_open(struct cdev *dev, in
 static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td);
 static void ctl_ioctl_online(void *arg);
 static void ctl_ioctl_offline(void *arg);
-static int ctl_ioctl_targ_enable(void *arg, struct ctl_id targ_id);
-static int ctl_ioctl_targ_disable(void *arg, struct ctl_id targ_id);
 static int ctl_ioctl_lun_enable(void *arg, struct ctl_id targ_id, int lun_id);
 static int ctl_ioctl_lun_disable(void *arg, struct ctl_id targ_id, int lun_id);
 static int ctl_ioctl_do_datamove(struct ctl_scsiio *ctsio);
@@ -1093,8 +1091,6 @@ ctl_init(void)
fe->port_online = ctl_ioctl_online;
fe->port_offline = ctl_ioctl_offline;
fe->onoff_arg = &softc->ioctl_info;
-   fe->targ_enable = ctl_ioctl_targ_enable;
-   fe->targ_disable = ctl_ioctl_targ_disable;
fe->lun_enable = ctl_ioctl_lun_enable;
fe->lun_disable = ctl_ioctl_lun_disable;
fe->targ_lun_arg = &softc->ioctl_info;
@@ -1449,22 +1445,6 @@ bailout:
return (retval);
 }
 
-/*
- * XXX KDM should we pretend to do something in the target/lun
- * enable/disable functions?
- */
-static int
-ctl_ioctl_targ_enable(void *arg, struct ctl_id targ_id)
-{
-   return (0);
-}
-
-static int
-ctl_ioctl_targ_disable(void *arg, struct ctl_id targ_id)
-{
-   return (0);
-}
-
 static int
 ctl_ioctl_lun_enable(void *arg, struct ctl_id targ_id, int lun_id)
 {
@@ -4310,24 +4290,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
STAILQ_FOREACH(fe, &ctl_softc->fe_list, links) {
int retval;
 
-   /*
-* XXX KDM this only works for ONE TARGET ID.  We'll need
-* to do things differently if we go to a multiple target
-* ID scheme.
-*/
-   if ((fe->status & CTL_PORT_STATUS_TARG_ONLINE) == 0) {
-
-   retval = fe->targ_enable(fe->targ_lun_arg, target_id);
-   if (retval != 0) {
-   printf("ctl_alloc_lun: FETD %s port %d "
-  "returned error %d for targ_enable on "
-  "target %ju\n", fe->port_name,
-  fe->targ_port, retval,
-  (uintmax_t)target_id.id);
-   } else
-   fe->status |= CTL_PORT_STATUS_TARG_ONLINE;
-   }
-
retval = fe->lun_enable(fe->targ_lun_arg, target_id,lun_number);
if (retval != 0) {
printf("ctl_alloc_lun: FETD %s port %d returned error "

Modified: head/sys/cam/ctl/ctl_frontend.h
==
--- head/sys/cam/ctl/ctl_frontend.h Fri Jul  4 18:47:25 2014
(r268264)
+++ head/sys/cam/ctl/ctl_frontend.h Fri Jul  4 19:19:03 2014
(r268265)
@@ -105,30 +105,6 @@ typedef int (*fe_devid_t)(struct ctl_scs
  *   and port_offline().  This is specified by the
  *   FETD.
  *
- * targ_enable():This function is called, with targ_lun_arg and a
- *   target ID as its arguments, by CTL when it wants
- *   the FETD to enable a particular target.  targ_enable()
- *   will always be called for a particular target ID
- *   before any LUN is enabled for that target.  If the
- *   FETD does not support enabling targets, but rather
- *   LUNs, it should ignore this call and return 0.  If
- *   the FETD does support enabling targets, it should
- *   return 0 for success and non-zero if it cannot
- *   enable the given target.
- *
- *   TODO:  Add the ability to specify a WWID here.
- *
- * targ_disable():   This function is called, with targ_lun_arg and a
- *   target ID as its arguments, by CTL when it wants
- *   the FETD to disable a particular target.
- *  

svn commit: r268264 - head/usr.bin/mkimg

2014-07-04 Thread Marcel Moolenaar
Author: marcel
Date: Fri Jul  4 18:47:25 2014
New Revision: 268264
URL: http://svnweb.freebsd.org/changeset/base/268264

Log:
  Document the -y option as a unit test option.
  Add missing -v (and -y) to the usage message.
  
  Requested by: eadler@

Modified:
  head/usr.bin/mkimg/mkimg.1
  head/usr.bin/mkimg/mkimg.c

Modified: head/usr.bin/mkimg/mkimg.1
==
--- head/usr.bin/mkimg/mkimg.1  Fri Jul  4 18:26:32 2014(r268263)
+++ head/usr.bin/mkimg/mkimg.1  Fri Jul  4 18:47:25 2014(r268264)
@@ -24,12 +24,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 2, 2014
+.Dd July 4, 2014
 .Dt MKIMG 1
 .Os
 .Sh NAME
 .Nm mkimg
-.Nd "utility to make a disk image"
+.Nd "utility to make disk images"
 .Sh SYNOPSIS
 .Nm
 .Op Fl H Ar heads
@@ -40,6 +40,7 @@
 .Op Fl f Ar format
 .Op Fl o Ar outfile
 .Op Fl v
+.Op Fl y
 .Fl s Ar scheme
 .Fl p Ar partition
 .Op Fl p Ar partition ...
@@ -111,6 +112,16 @@ option increases the level of output tha
 .Nm
 utility prints.
 .Pp
+The
+.Op Fl y
+option is used for testing purposes only and is not to be used in production.
+When present, the
+.Nm
+utility will generate predictable values for Universally Unique Identifiers
+(UUIDs) and time stamps so that consecutive runs of the
+.Nm
+utility will create images that are identical.
+.Pp
 For a complete list of supported partitioning schemes or supported output
 format, or for a detailed description of how to specify partitions, run the
 .Nm

Modified: head/usr.bin/mkimg/mkimg.c
==
--- head/usr.bin/mkimg/mkimg.c  Fri Jul  4 18:26:32 2014(r268263)
+++ head/usr.bin/mkimg/mkimg.c  Fri Jul  4 18:47:25 2014(r268264)
@@ -75,6 +75,8 @@ usage(const char *why)
fprintf(stderr, "\t-o \t-  file to write image into\n");
fprintf(stderr, "\t-p \n");
fprintf(stderr, "\t-s \n");
+   fprintf(stderr, "\t-v\t\t-  increase verbosity\n");
+   fprintf(stderr, "\t-y\t\t-  [developers] enable unit test\n");
fprintf(stderr, "\t-H \t-  number of heads to simulate\n");
fprintf(stderr, "\t-P \t-  physical sector size\n");
fprintf(stderr, "\t-S \t-  logical sector size\n");
___
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: r268263 - stable/9/sbin/sysctl

2014-07-04 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jul  4 18:26:32 2014
New Revision: 268263
URL: http://svnweb.freebsd.org/changeset/base/268263

Log:
  Undo MFC of r267960:
  This patch cannot be ported as-is to 9-stable.

Modified:
  stable/9/sbin/sysctl/sysctl.c
Directory Properties:
  stable/9/sbin/sysctl/   (props changed)

Modified: stable/9/sbin/sysctl/sysctl.c
==
--- stable/9/sbin/sysctl/sysctl.c   Fri Jul  4 16:17:15 2014
(r268262)
+++ stable/9/sbin/sysctl/sysctl.c   Fri Jul  4 18:26:32 2014
(r268263)
@@ -582,10 +582,9 @@ show_var(int *oid, int nlen)
warnx("malloc failed");
return (1);
}
-   ctltype = (kind & CTLTYPE);
len = j;
i = sysctl(oid, nlen, val, &len, 0, 0);
-   if (i != 0 || (len == 0 && ctltype != CTLTYPE_STRING)) {
+   if (i || !len) {
free(oval);
return (1);
}
@@ -599,6 +598,7 @@ show_var(int *oid, int nlen)
fmt = buf;
oidfmt(oid, nlen, fmt, &kind);
p = val;
+   ctltype = (kind & CTLTYPE);
sign = ctl_sign[ctltype];
intlen = ctl_size[ctltype];
 
___
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: r268262 - stable/10/usr.sbin/ctld

2014-07-04 Thread Alexander Motin
Author: mav
Date: Fri Jul  4 16:17:15 2014
New Revision: 268262
URL: http://svnweb.freebsd.org/changeset/base/268262

Log:
  MFC r267648:
  serial_num and device_id fields are not necessarily null-terminated.
  
  Before this it was impossible to use all 16 bytes of serial number, and
  client always got serial number NULL-terminated, that is not required.

Modified:
  stable/10/usr.sbin/ctld/kernel.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/kernel.c
==
--- stable/10/usr.sbin/ctld/kernel.cFri Jul  4 16:11:30 2014
(r268261)
+++ stable/10/usr.sbin/ctld/kernel.cFri Jul  4 16:17:15 2014
(r268262)
@@ -413,13 +413,13 @@ kernel_lun_add(struct lun *lun)
req.reqdata.create.device_type = T_DIRECT;
 
if (lun->l_serial != NULL) {
-   strlcpy(req.reqdata.create.serial_num, lun->l_serial,
+   strncpy(req.reqdata.create.serial_num, lun->l_serial,
sizeof(req.reqdata.create.serial_num));
req.reqdata.create.flags |= CTL_LUN_FLAG_SERIAL_NUM;
}
 
if (lun->l_device_id != NULL) {
-   strlcpy(req.reqdata.create.device_id, lun->l_device_id,
+   strncpy(req.reqdata.create.device_id, lun->l_device_id,
sizeof(req.reqdata.create.device_id));
req.reqdata.create.flags |= CTL_LUN_FLAG_DEVID;
}
___
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: r268261 - stable/10/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Fri Jul  4 16:11:30 2014
New Revision: 268261
URL: http://svnweb.freebsd.org/changeset/base/268261

Log:
  MFC r267641:
  Add some more CTL_FLAG_ABORT check points.
  
  This should allow to abort commands doing mostly disk I/O, such as VERIFY
  or WRITE SAME.  Before this change CTL_FLAG_ABORT was only checked around
  data moves, which for these commands may not happen for a very long time.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_backend_block.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Fri Jul  4 16:10:14 2014(r268260)
+++ stable/10/sys/cam/ctl/ctl.c Fri Jul  4 16:11:30 2014(r268261)
@@ -5009,9 +5009,10 @@ ctl_data_submit_done(union ctl_io *io)
 * If there is an error, though, we don't want to keep processing.
 * Instead, just send status back to the initiator.
 */
-   if ((io->io_hdr.flags & CTL_FLAG_IO_CONT)
-&& (((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)
- || ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS))) {
+   if ((io->io_hdr.flags & CTL_FLAG_IO_CONT) &&
+   (io->io_hdr.flags & CTL_FLAG_ABORT) == 0 &&
+   ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE ||
+(io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) {
io->scsiio.io_cont(io);
return;
}

Modified: stable/10/sys/cam/ctl/ctl_backend_block.c
==
--- stable/10/sys/cam/ctl/ctl_backend_block.c   Fri Jul  4 16:10:14 2014
(r268260)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c   Fri Jul  4 16:11:30 2014
(r268261)
@@ -944,8 +944,9 @@ ctl_be_block_cw_done_ws(struct ctl_be_bl
 
io = beio->io;
ctl_free_beio(beio);
-   if (((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE)
- && ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS)) {
+   if ((io->io_hdr.flags & CTL_FLAG_ABORT) ||
+   ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE &&
+(io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS)) {
ctl_config_write_done(io);
return;
}
@@ -1186,8 +1187,9 @@ ctl_be_block_next(struct ctl_be_block_io
io = beio->io;
be_lun = beio->lun;
ctl_free_beio(beio);
-   if (((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE)
- && ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS)) {
+   if ((io->io_hdr.flags & CTL_FLAG_ABORT) ||
+   ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE &&
+(io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS)) {
ctl_data_submit_done(io);
return;
}
___
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: r268260 - stable/10/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Fri Jul  4 16:10:14 2014
New Revision: 268260
URL: http://svnweb.freebsd.org/changeset/base/268260

Log:
  MFC r267637:
  Add iSCSI Target Name ID descriptor to VPD 83h.
  
  It shall/should be there according to SPC-4, and istgt also provides it.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Fri Jul  4 16:09:09 2014
(r268259)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Fri Jul  4 16:10:14 2014
(r268260)
@@ -2053,12 +2053,13 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
struct cfiscsi_session *cs;
struct scsi_vpd_device_id *devid_ptr;
struct scsi_vpd_id_descriptor *desc, *desc1, *desc2, *desc3, *desc4;
+   struct scsi_vpd_id_descriptor *desc5;
struct scsi_vpd_id_t10 *t10id;
struct ctl_lun *lun;
const struct icl_pdu *request;
int i, ret;
char *val;
-   size_t devid_len, wwpn_len, lun_name_len;
+   size_t devid_len, wwnn_len, wwpn_len, lun_name_len;
 
lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
request = ctsio->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
@@ -2070,6 +2071,11 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
if ((wwpn_len % 4) != 0)
wwpn_len += (4 - (wwpn_len % 4));
 
+   wwnn_len = strlen(cs->cs_target->ct_name);
+   wwnn_len += 1; /* '\0' */
+   if ((wwnn_len % 4) != 0)
+   wwnn_len += (4 - (wwnn_len % 4));
+
if (lun == NULL) {
lun_name_len = 0;
} else {
@@ -2084,6 +2090,7 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
sizeof(struct scsi_vpd_id_descriptor) +
sizeof(struct scsi_vpd_id_t10) + CTL_DEVID_LEN +
sizeof(struct scsi_vpd_id_descriptor) + lun_name_len +
+   sizeof(struct scsi_vpd_id_descriptor) + wwnn_len +
sizeof(struct scsi_vpd_id_descriptor) + wwpn_len +
sizeof(struct scsi_vpd_id_descriptor) +
sizeof(struct scsi_vpd_id_rel_trgt_port_id) +
@@ -2114,8 +2121,10 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
desc2 = (struct scsi_vpd_id_descriptor *)(&desc1->identifier[0] +
lun_name_len);
desc3 = (struct scsi_vpd_id_descriptor *)(&desc2->identifier[0] +
-   wwpn_len);
+   wwnn_len);
desc4 = (struct scsi_vpd_id_descriptor *)(&desc3->identifier[0] +
+   wwpn_len);
+   desc5 = (struct scsi_vpd_id_descriptor *)(&desc4->identifier[0] +
sizeof(struct scsi_vpd_id_rel_trgt_port_id));
 
if (lun != NULL)
@@ -2189,32 +2198,41 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
}
 
/*
-* desc2 is for the WWPN which is a port asscociation.
+* desc2 is for the Target Name.
+*/
+   desc2->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_UTF8;
+   desc2->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_TARGET |
+   SVPD_ID_TYPE_SCSI_NAME;
+   desc2->length = wwnn_len;
+   snprintf(desc2->identifier, wwnn_len, "%s", cs->cs_target->ct_name);
+
+   /*
+* desc3 is for the WWPN which is a port asscociation.
 */
-   desc2->proto_codeset = (SCSI_PROTO_ISCSI << 4) | 
SVPD_ID_CODESET_UTF8;
-   desc2->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
+   desc3->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_UTF8;
+   desc3->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
SVPD_ID_TYPE_SCSI_NAME;
-   desc2->length = wwpn_len;
-   snprintf(desc2->identifier, wwpn_len, "%s,t,0x%4.4x",
+   desc3->length = wwpn_len;
+   snprintf(desc3->identifier, wwpn_len, "%s,t,0x%4.4x",
cs->cs_target->ct_name, cs->cs_portal_group_tag);
 
/*
 * desc3 is for the Relative Target Port(type 4h) identifier
 */
-   desc3->proto_codeset = (SCSI_PROTO_ISCSI << 4) | 
SVPD_ID_CODESET_BINARY;
-   desc3->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
+   desc4->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_BINARY;
+   desc4->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
SVPD_ID_TYPE_RELTARG;
-   desc3->length = 4;
-   desc3->identifier[3] = 1;
+   desc4->length = 4;
+   desc4->identifier[3] = 1;
 
/*
 * desc4 is for the Target Port Group(type 5h) identifier
 */
-   desc4->proto_codeset = (SCSI_PROTO_ISCSI << 4) | 
SVPD_ID_CODESET_BINARY;
-   desc4->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
+   desc5->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_BINARY;
+   desc5->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
SVPD_ID_TYPE_TPORTGRP;
-   desc4->length = 4;
-   desc4->identifier[3] = 1;
+   desc5->

svn commit: r268259 - stable/10/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Fri Jul  4 16:09:09 2014
New Revision: 268259
URL: http://svnweb.freebsd.org/changeset/base/268259

Log:
  MFC r267610 (by trasz):
  Rework session termination in iSCSI target to actually wait
  for any outstanding commands to be properly aborted by CTL.
  Without it, in some cases (such as files backing the LUNs
  stored on failing disk drives), terminating a busy session
  would result in panic.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Fri Jul  4 16:07:57 2014
(r268258)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Fri Jul  4 16:09:09 2014
(r268259)
@@ -1044,7 +1044,7 @@ cfiscsi_session_terminate_tasks(struct c
 {
struct cfiscsi_data_wait *cdw, *tmpcdw;
union ctl_io *io;
-   int error;
+   int error, last;
 
 #ifdef notyet
io = ctl_alloc_io(cs->cs_target->ct_softc->fe.ctl_pool_ref);
@@ -1101,12 +1101,31 @@ cfiscsi_session_terminate_tasks(struct c
CFISCSI_SESSION_DEBUG(cs, "removing csw for initiator task tag "
"0x%x", cdw->cdw_initiator_task_tag);
 #endif
+   /*
+* Set nonzero port status; this prevents backends from
+* assuming that the data transfer actually succeeded
+* and writing uninitialized data to disk.
+*/
+   cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 42;
cdw->cdw_ctl_io->scsiio.be_move_done(cdw->cdw_ctl_io);
TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next);
uma_zfree(cfiscsi_data_wait_zone, cdw);
}
CFISCSI_SESSION_UNLOCK(cs);
 #endif
+
+   /*
+* Wait for CTL to terminate all the tasks.
+*/
+   for (;;) {
+   refcount_acquire(&cs->cs_outstanding_ctl_pdus);
+   last = refcount_release(&cs->cs_outstanding_ctl_pdus);
+   if (last != 0)
+   break;
+   CFISCSI_SESSION_WARN(cs, "waiting for CTL to terminate tasks, "
+   "%d remaining", cs->cs_outstanding_ctl_pdus);
+   pause("cfiscsi_terminate", 1);
+   }
 }
 
 static void
@@ -1123,19 +1142,22 @@ cfiscsi_maintenance_thread(void *arg)
CFISCSI_SESSION_UNLOCK(cs);
 
if (cs->cs_terminating) {
-   cfiscsi_session_terminate_tasks(cs);
-   callout_drain(&cs->cs_callout);
 
+   /*
+* We used to wait up to 30 seconds to deliver queued
+* PDUs to the initiator.  We also tried hard to deliver
+* SCSI Responses for the aborted PDUs.  We don't do
+* that anymore.  We might need to revisit that.
+*/
+   callout_drain(&cs->cs_callout);
icl_conn_shutdown(cs->cs_conn);
icl_conn_close(cs->cs_conn);
 
/*
-* XXX: We used to wait up to 30 seconds to deliver 
queued PDUs
-*  to the initiator.  We also tried hard to 
deliver SCSI Responses
-*  for the aborted PDUs.  We don't do that 
anymore.  We might need
-*  to revisit that.
+* At this point ICL receive thread is no longer
+* running; no new tasks can be queued.
 */
-
+   cfiscsi_session_terminate_tasks(cs);
cfiscsi_session_delete(cs);
kthread_exit();
return;
___
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: r268258 - stable/10/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Fri Jul  4 16:07:57 2014
New Revision: 268258
URL: http://svnweb.freebsd.org/changeset/base/268258

Log:
  MFC r267574 (by trasz):
  Make cs_terminating a bool; no functional changes.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Fri Jul  4 16:06:56 2014
(r268257)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Fri Jul  4 16:07:57 2014
(r268258)
@@ -1129,8 +1129,6 @@ cfiscsi_maintenance_thread(void *arg)
icl_conn_shutdown(cs->cs_conn);
icl_conn_close(cs->cs_conn);
 
-   cs->cs_terminating++;
-
/*
 * XXX: We used to wait up to 30 seconds to deliver 
queued PDUs
 *  to the initiator.  We also tried hard to 
deliver SCSI Responses
@@ -1150,9 +1148,9 @@ static void
 cfiscsi_session_terminate(struct cfiscsi_session *cs)
 {
 
-   if (cs->cs_terminating != 0)
+   if (cs->cs_terminating)
return;
-   cs->cs_terminating = 1;
+   cs->cs_terminating = true;
cv_signal(&cs->cs_maintenance_cv);
 #ifdef ICL_KERNEL_PROXY
cv_signal(&cs->cs_login_cv);

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.h
==
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.h  Fri Jul  4 16:06:56 2014
(r268257)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.h  Fri Jul  4 16:07:57 2014
(r268258)
@@ -72,7 +72,7 @@ struct cfiscsi_session {
int cs_timeout;
int cs_portal_group_tag;
struct cv   cs_maintenance_cv;
-   int cs_terminating;
+   boolcs_terminating;
size_t  cs_max_data_segment_length;
size_t  cs_max_burst_length;
boolcs_immediate_data;
___
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: r268257 - stable/10/sys/cam/ctl

2014-07-04 Thread Alexander Motin
Author: mav
Date: Fri Jul  4 16:06:56 2014
New Revision: 268257
URL: http://svnweb.freebsd.org/changeset/base/268257

Log:
  MFC r267547, r267551 (by trasz):
  Add LUN-associated name to VPD, to make Hyper-V Failover Cluster happy.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Fri Jul  4 15:55:32 2014
(r268256)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Fri Jul  4 16:06:56 2014
(r268257)
@@ -2032,13 +2032,13 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
 {
struct cfiscsi_session *cs;
struct scsi_vpd_device_id *devid_ptr;
-   struct scsi_vpd_id_descriptor *desc, *desc1;
-   struct scsi_vpd_id_descriptor *desc2, *desc3; /* for types 4h and 5h */
+   struct scsi_vpd_id_descriptor *desc, *desc1, *desc2, *desc3, *desc4;
struct scsi_vpd_id_t10 *t10id;
struct ctl_lun *lun;
const struct icl_pdu *request;
+   int i, ret;
char *val;
-   size_t devid_len, wwpn_len;
+   size_t devid_len, wwpn_len, lun_name_len;
 
lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
request = ctsio->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
@@ -2050,9 +2050,20 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
if ((wwpn_len % 4) != 0)
wwpn_len += (4 - (wwpn_len % 4));
 
+   if (lun == NULL) {
+   lun_name_len = 0;
+   } else {
+   lun_name_len = strlen(cs->cs_target->ct_name);
+   lun_name_len += strlen(",lun,");
+   lun_name_len += 1; /* '\0' */
+   if ((lun_name_len % 4) != 0)
+   lun_name_len += (4 - (lun_name_len % 4));
+   }
+
devid_len = sizeof(struct scsi_vpd_device_id) +
sizeof(struct scsi_vpd_id_descriptor) +
sizeof(struct scsi_vpd_id_t10) + CTL_DEVID_LEN +
+   sizeof(struct scsi_vpd_id_descriptor) + lun_name_len +
sizeof(struct scsi_vpd_id_descriptor) + wwpn_len +
sizeof(struct scsi_vpd_id_descriptor) +
sizeof(struct scsi_vpd_id_rel_trgt_port_id) +
@@ -2081,8 +2092,10 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
desc1 = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] +
sizeof(struct scsi_vpd_id_t10) + CTL_DEVID_LEN);
desc2 = (struct scsi_vpd_id_descriptor *)(&desc1->identifier[0] +
-   wwpn_len);
+   lun_name_len);
desc3 = (struct scsi_vpd_id_descriptor *)(&desc2->identifier[0] +
+   wwpn_len);
+   desc4 = (struct scsi_vpd_id_descriptor *)(&desc3->identifier[0] +
sizeof(struct scsi_vpd_id_rel_trgt_port_id));
 
if (lun != NULL)
@@ -2128,33 +2141,61 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
}
 
/*
-* desc1 is for the WWPN which is a port asscociation.
-*/
-   desc1->proto_codeset = (SCSI_PROTO_ISCSI << 4) | 
SVPD_ID_CODESET_UTF8;
-   desc1->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
-   SVPD_ID_TYPE_SCSI_NAME;
-   desc1->length = wwpn_len;
-   snprintf(desc1->identifier, wwpn_len, "%s,t,0x%4.4x",
-   cs->cs_target->ct_name, cs->cs_portal_group_tag);
+* desc1 is for the unique LUN name.
+*
+* XXX: According to SPC-3, LUN must report the same ID through
+*  all the ports.  The code below, however, reports the
+*  ID only via iSCSI.
+*/
+   desc1->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_UTF8;
+   desc1->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN |
+   SVPD_ID_TYPE_SCSI_NAME;
+   desc1->length = lun_name_len;
+   if (lun != NULL) {
+   /*
+* Find the per-target LUN number.
+*/
+   for (i = 0; i < CTL_MAX_LUNS; i++) {
+   if (cs->cs_target->ct_luns[i] == lun->lun)
+   break;
+   }
+   KASSERT(i < CTL_MAX_LUNS,
+   ("lun %jd not found", (uintmax_t)lun->lun));
+   ret = snprintf(desc1->identifier, lun_name_len, "%s,lun,%d",
+   cs->cs_target->ct_name, i);
+   KASSERT(ret > 0 && ret <= lun_name_len, ("bad snprintf"));
+   } else {
+   KASSERT(lun_name_len == 0, ("no lun, but lun_name_len != 0"));
+   }
 
/*
-* desc2 is for the Relative Target Port(type 4h) identifier
+* desc2 is for the WWPN which is a port asscociation.
 */
-   desc2->proto_codeset = (SCSI_PROTO_ISCSI << 4) | 
SVPD_ID_CODESET_BINARY;
+   desc2->proto_codeset = (SCSI_PROTO_ISCSI << 4) | 
SVPD_ID_CODESET_UTF8;
desc2->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
- 

svn commit: r268256 - in head: sbin/geom/class/part sys/geom/part sys/sys usr.sbin/bsdinstall/partedit

2014-07-04 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Fri Jul  4 15:55:32 2014
New Revision: 268256
URL: http://svnweb.freebsd.org/changeset/base/268256

Log:
  After EFI support was added to the installer, it needed to allow boot
  partitions of types other than "freebsd-boot" (in particular, "efi").
  This allows the removal of some nasty hacks for supporting PowerPC systems,
  in particular aliasing freebsd-boot to apple-boot on APM and an IBM-specific
  code on MBR.
  
  This changes the installer to use the correct names, which also breaks a
  degeneracy in the meaning of "freebsd-boot" that allows the addition
  of support for some newer IBM systems that can boot from GPT in addition to
  MBR. Since I have no idea how to detect which those systems are, leave
  the default on IBM PPC systems as MBR for now.

Modified:
  head/sbin/geom/class/part/gpart.8
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part.h
  head/sys/geom/part/g_part_apm.c
  head/sys/geom/part/g_part_gpt.c
  head/sys/geom/part/g_part_mbr.c
  head/sys/sys/gpt.h
  head/usr.sbin/bsdinstall/partedit/partedit_powerpc.c

Modified: head/sbin/geom/class/part/gpart.8
==
--- head/sbin/geom/class/part/gpart.8   Fri Jul  4 15:09:56 2014
(r268255)
+++ head/sbin/geom/class/part/gpart.8   Fri Jul  4 15:55:32 2014
(r268256)
@@ -553,6 +553,16 @@ for partition types that do not have sym
 Symbolic names currently understood and used by
 .Fx are:
 .Bl -tag -width ".Cm dragonfly-disklabel64"
+.It Cm apple-boot
+The system partition dedicated to storing boot loaders on some Apple
+systems.
+The scheme-specific types are
+.Qq Li "!171"
+for MBR,
+.Qq Li "!Apple_Bootstrap"
+for APM, and
+.Qq Li "!426f6f74--11aa-aa11-00306543ecac"
+for GPT.
 .It Cm bios-boot
 The system partition dedicated to second stage of the boot loader program.
 Usually it is used by the GRUB 2 loader for GPT partitioning schemes.
@@ -823,6 +833,14 @@ A partition that contains a NTFS or exFA
 The scheme-specific type is
 .Qq Li "!7"
 for MBR.
+.It Cm prep-boot
+The system partition dedicated to storing boot loaders on some PowerPC systems,
+notably those made by IBM.
+The scheme-specific types are
+.Qq Li "!65"
+for MBR and
+.Qq Li "!0x9e1a2d38-c612-4316-aa26-8b49521e5a8b"
+for GPT.
 .It Cm vmware-vmfs
 A partition that contains a VMware File System (VMFS).
 The scheme-specific types are
@@ -1018,7 +1036,7 @@ Instead, the 800 KBytes bootstrap code i
 should be written with the
 .Cm gpart bootcode
 command to a partition of type
-.Cm freebsd-boot ,
+.Cm apple-boot ,
 which should also be 800 KB in size.
 .Sh OPERATIONAL FLAGS
 Actions other than the

Modified: head/sys/geom/part/g_part.c
==
--- head/sys/geom/part/g_part.c Fri Jul  4 15:09:56 2014(r268255)
+++ head/sys/geom/part/g_part.c Fri Jul  4 15:55:32 2014(r268256)
@@ -117,6 +117,7 @@ struct g_part_alias_list {
{ "dragonfly-legacy", G_PART_ALIAS_DFBSD_LEGACY },
{ "dragonfly-hammer", G_PART_ALIAS_DFBSD_HAMMER },
{ "dragonfly-hammer2", G_PART_ALIAS_DFBSD_HAMMER2 },
+   { "prep-boot", G_PART_ALIAS_PREP_BOOT },
 };
 
 SYSCTL_DECL(_kern_geom);

Modified: head/sys/geom/part/g_part.h
==
--- head/sys/geom/part/g_part.h Fri Jul  4 15:09:56 2014(r268255)
+++ head/sys/geom/part/g_part.h Fri Jul  4 15:55:32 2014(r268256)
@@ -84,6 +84,7 @@ enum g_part_alias {
G_PART_ALIAS_DFBSD_LEGACY,  /* A DfBSD legacy partition entry */
G_PART_ALIAS_DFBSD_HAMMER,  /* A DfBSD HAMMER FS partition entry */
G_PART_ALIAS_DFBSD_HAMMER2, /* A DfBSD HAMMER2 FS partition entry */
+   G_PART_ALIAS_PREP_BOOT, /* A PREP/CHRP boot partition entry. */
/* Keep the following last */
G_PART_ALIAS_COUNT
 };

Modified: head/sys/geom/part/g_part_apm.c
==
--- head/sys/geom/part/g_part_apm.c Fri Jul  4 15:09:56 2014
(r268255)
+++ head/sys/geom/part/g_part_apm.c Fri Jul  4 15:55:32 2014
(r268256)
@@ -149,11 +149,6 @@ apm_parse_type(const char *type, char *b
strcpy(buf, APM_ENT_TYPE_APPLE_UFS);
return (0);
}
-   alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_BOOT);
-   if (!strcasecmp(type, alias)) {
-   strcpy(buf, APM_ENT_TYPE_APPLE_BOOT);
-   return (0);
-   }
alias = g_part_alias_name(G_PART_ALIAS_FREEBSD);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_FREEBSD);

Modified: head/sys/geom/part/g_part_gpt.c
==
--- head/sys/geom/part/g_part_gpt.c Fri Jul  4 15:09:56 2014
(r268255)
+++ head/sys/geom/part/g_part_gpt.c Fri Jul  4 15:55:32 

svn commit: r268255 - in stable/10/sys: cam/scsi compat/linux

2014-07-04 Thread Alexander Motin
Author: mav
Date: Fri Jul  4 15:09:56 2014
New Revision: 268255
URL: http://svnweb.freebsd.org/changeset/base/268255

Log:
  MFC r267051:
  - Add support for SG_GET_SG_TABLESIZE IOCTL to report that we don't support
  scatter/gather lists.
  - Return error for still unsupported SG 3.x API read/write calls.

Modified:
  stable/10/sys/cam/scsi/scsi_sg.c
  stable/10/sys/compat/linux/linux_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_sg.c
==
--- stable/10/sys/cam/scsi/scsi_sg.cFri Jul  4 14:49:40 2014
(r268254)
+++ stable/10/sys/cam/scsi/scsi_sg.cFri Jul  4 15:09:56 2014
(r268255)
@@ -627,6 +627,13 @@ sgioctl(struct cdev *dev, u_long cmd, ca
break;
}
 
+   case SG_GET_SG_TABLESIZE:
+   {
+   int *size = (int *)arg;
+   *size = 0;
+   break;
+   }
+
case SG_EMULATED_HOST:
case SG_SET_TRANSFORM:
case SG_GET_TRANSFORM:
@@ -638,7 +645,6 @@ sgioctl(struct cdev *dev, u_long cmd, ca
case SG_GET_ACCESS_COUNT:
case SG_SET_FORCE_LOW_DMA:
case SG_GET_LOW_DMA:
-   case SG_GET_SG_TABLESIZE:
case SG_SET_FORCE_PACK_ID:
case SG_GET_PACK_ID:
case SG_SET_RESERVED_SIZE:
@@ -684,6 +690,12 @@ sgwrite(struct cdev *dev, struct uio *ui
if (error)
goto out_hdr;
 
+   /* XXX: We don't support SG 3.x read/write API. */
+   if (hdr->reply_len < 0) {
+   error = ENODEV;
+   goto out_hdr;
+   }
+
ccb = xpt_alloc_ccb();
if (ccb == NULL) {
error = ENOMEM;

Modified: stable/10/sys/compat/linux/linux_ioctl.c
==
--- stable/10/sys/compat/linux/linux_ioctl.cFri Jul  4 14:49:40 2014
(r268254)
+++ stable/10/sys/compat/linux/linux_ioctl.cFri Jul  4 15:09:56 2014
(r268255)
@@ -2750,6 +2750,9 @@ linux_ioctl_sg(struct thread *td, struct
case LINUX_SG_GET_SCSI_ID:
args->cmd = SG_GET_SCSI_ID;
break;
+   case LINUX_SG_GET_SG_TABLESIZE:
+   args->cmd = SG_GET_SG_TABLESIZE;
+   break;
default:
return (ENODEV);
}
___
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: r268254 - head/sys/boot/forth

2014-07-04 Thread John-Mark Gurney
Author: jmg
Date: Fri Jul  4 14:49:40 2014
New Revision: 268254
URL: http://svnweb.freebsd.org/changeset/base/268254

Log:
  add a hit that you can enable this by default if you want...  necessary
  if you want the keyboard break to work early in boot..
  
  MFC after:1 week

Modified:
  head/sys/boot/forth/loader.conf

Modified: head/sys/boot/forth/loader.conf
==
--- head/sys/boot/forth/loader.conf Fri Jul  4 14:32:15 2014
(r268253)
+++ head/sys/boot/forth/loader.conf Fri Jul  4 14:49:40 2014
(r268254)
@@ -134,6 +134,7 @@ module_path="/boot/modules" # Set the mo
 #vfs.root.mountfrom="" # Specify root partition in a way the
# kernel understands
 #vm.kmem_size=""   # Sets the size of kernel memory (bytes)
+#debug.kdb.break_to_debugger="0" # Allow console to break into debugger.
 #debug.ktr.cpumask="0xf"   # Bitmask of CPUs to enable KTR on
 #debug.ktr.mask="0x1200"   # Bitmask of KTR events to enable
 #debug.ktr.verbose="1" # Enable console dump of KTR events
___
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: r268253 - head/sys/conf

2014-07-04 Thread John-Mark Gurney
Author: jmg
Date: Fri Jul  4 14:32:15 2014
New Revision: 268253
URL: http://svnweb.freebsd.org/changeset/base/268253

Log:
  BREAK_TO_DEBUGGER is not just serial console anymore, it controls all
  console's ability to enter the debugger  rwatson forgot to document
  this when he changed it back in 2011...  There is more docs to write
  about this, but at least fix this for now...
  
  Reviewed by:  emaste
  MFC after:1 week

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Fri Jul  4 14:00:29 2014(r268252)
+++ head/sys/conf/NOTES Fri Jul  4 14:32:15 2014(r268253)
@@ -1823,7 +1823,7 @@ hint.uart.0.baud="115200"
 #
 
 # Options for serial drivers that support consoles:
-optionsBREAK_TO_DEBUGGER   # A BREAK on a serial console goes to
+optionsBREAK_TO_DEBUGGER   # A BREAK/DBG on the console goes to
# ddb, if available.
 
 # Solaris implements a new BREAK which is initiated by a character
___
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: r268252 - stable/8/sys/dev/ata/chipsets

2014-07-04 Thread Marius Strobl
Author: marius
Date: Fri Jul  4 14:00:29 2014
New Revision: 268252
URL: http://svnweb.freebsd.org/changeset/base/268252

Log:
  MFC: r268095
  
  Actually pro AMD chipsets, making r244146 (MFCed to stable/8 in r245801) work.
  
  Sponsored by: Bally Wulff Games & Entertainment GmbH

Modified:
  stable/8/sys/dev/ata/chipsets/ata-ati.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/ata/   (props changed)

Modified: stable/8/sys/dev/ata/chipsets/ata-ati.c
==
--- stable/8/sys/dev/ata/chipsets/ata-ati.c Fri Jul  4 13:59:48 2014
(r268251)
+++ stable/8/sys/dev/ata/chipsets/ata-ati.c Fri Jul  4 14:00:29 2014
(r268252)
@@ -99,7 +99,7 @@ ata_ati_probe(device_t dev)
  { ATA_AMD_HUDSON2_S5,  0x00, ATI_AHCI, 0, ATA_SA300, "Hudson-2" },
  { 0, 0, 0, 0, 0, 0}};
 
-if (pci_get_vendor(dev) != ATA_ATI_ID)
+if (pci_get_vendor(dev) != ATA_AMD_ID && pci_get_vendor(dev) != ATA_ATI_ID)
return ENXIO;
 
 if (!(ctlr->chip = ata_match_chip(dev, ids)))
___
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: r268251 - stable/9/sys/dev/ata/chipsets

2014-07-04 Thread Marius Strobl
Author: marius
Date: Fri Jul  4 13:59:48 2014
New Revision: 268251
URL: http://svnweb.freebsd.org/changeset/base/268251

Log:
  MFC: r268095
  
  Actually pro AMD chipsets, making r244146 (MFCed to stable/9 in r245797) work.
  
  Sponsored by: Bally Wulff Games & Entertainment GmbH

Modified:
  stable/9/sys/dev/ata/chipsets/ata-ati.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/ata/chipsets/ata-ati.c
==
--- stable/9/sys/dev/ata/chipsets/ata-ati.c Fri Jul  4 13:57:58 2014
(r268250)
+++ stable/9/sys/dev/ata/chipsets/ata-ati.c Fri Jul  4 13:59:48 2014
(r268251)
@@ -99,7 +99,7 @@ ata_ati_probe(device_t dev)
  { ATA_AMD_HUDSON2_S5,  0x00, ATI_AHCI, 0, ATA_SA300, "Hudson-2" },
  { 0, 0, 0, 0, 0, 0}};
 
-if (pci_get_vendor(dev) != ATA_ATI_ID)
+if (pci_get_vendor(dev) != ATA_AMD_ID && pci_get_vendor(dev) != ATA_ATI_ID)
return ENXIO;
 
 if (!(ctlr->chip = ata_match_chip(dev, ids)))
___
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: r268250 - stable/10/sys/dev/ata/chipsets

2014-07-04 Thread Marius Strobl
Author: marius
Date: Fri Jul  4 13:57:58 2014
New Revision: 268250
URL: http://svnweb.freebsd.org/changeset/base/268250

Log:
  MFC: r268095
  
  Actually pro AMD chipsets, making r244146 work.
  
  Sponsored by: Bally Wulff Games & Entertainment GmbH

Modified:
  stable/10/sys/dev/ata/chipsets/ata-ati.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ata/chipsets/ata-ati.c
==
--- stable/10/sys/dev/ata/chipsets/ata-ati.cFri Jul  4 09:34:24 2014
(r268249)
+++ stable/10/sys/dev/ata/chipsets/ata-ati.cFri Jul  4 13:57:58 2014
(r268250)
@@ -98,7 +98,7 @@ ata_ati_probe(device_t dev)
  { ATA_AMD_HUDSON2_S5,  0x00, ATI_AHCI, 0, ATA_SA300, "Hudson-2" },
  { 0, 0, 0, 0, 0, 0}};
 
-if (pci_get_vendor(dev) != ATA_ATI_ID)
+if (pci_get_vendor(dev) != ATA_AMD_ID && pci_get_vendor(dev) != ATA_ATI_ID)
return ENXIO;
 
 if (!(ctlr->chip = ata_match_chip(dev, ids)))
___
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: r268246 - head/tools/tools/nanobsd/rescue

2014-07-04 Thread Michael Reifenberger
Author: mr
Date: Fri Jul  4 09:29:43 2014
New Revision: 268246
URL: http://svnweb.freebsd.org/changeset/base/268246

Log:
  Adopt to current and other changes:
use dedicated kernel files with some local settings
use mkimg for ISO building
put images into separate directory and rename them for better 
consistency

Added:
  head/tools/tools/nanobsd/rescue/R32   (contents, props changed)
  head/tools/tools/nanobsd/rescue/R64   (contents, props changed)
Modified:
  head/tools/tools/nanobsd/rescue/build.sh
  head/tools/tools/nanobsd/rescue/common
  head/tools/tools/nanobsd/rescue/merge.sh
  head/tools/tools/nanobsd/rescue/rescue_amd64.conf
  head/tools/tools/nanobsd/rescue/rescue_i386.conf

Added: head/tools/tools/nanobsd/rescue/R32
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/nanobsd/rescue/R32 Fri Jul  4 09:29:43 2014
(r268246)
@@ -0,0 +1,14 @@
+#
+# R32 -- Generic kernel configuration file with modifications for rescue.
+#
+# $FreeBSD$
+
+include GENERIC
+
+ident  R32
+
+nooptions  INVARIANTS
+nooptions  INVARIANT_SUPPORT
+nooptions  WITNESS
+nooptions  WITNESS_SKIPSPIN
+nooptions  MALLOC_DEBUG_MAXZONES

Added: head/tools/tools/nanobsd/rescue/R64
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/nanobsd/rescue/R64 Fri Jul  4 09:29:43 2014
(r268246)
@@ -0,0 +1,14 @@
+#
+# R64 -- Generic kernel configuration file with modifications for rescue.
+#
+# $FreeBSD$
+
+include GENERIC
+
+ident  R64
+
+nooptions  INVARIANTS
+nooptions  INVARIANT_SUPPORT
+nooptions  WITNESS
+nooptions  WITNESS_SKIPSPIN
+nooptions  MALLOC_DEBUG_MAXZONES

Modified: head/tools/tools/nanobsd/rescue/build.sh
==
--- head/tools/tools/nanobsd/rescue/build.shFri Jul  4 07:02:11 2014
(r268245)
+++ head/tools/tools/nanobsd/rescue/build.shFri Jul  4 09:29:43 2014
(r268246)
@@ -3,6 +3,8 @@
 # $FreeBSD$
 #
 
+today=`date '+%Y%m%d'`
+
 if [ -z "${1}" -o \! -f "${1}" ]; then
   echo "Usage: $0 cfg_file [-bhiknw]"
   echo "-i : skip image build"
@@ -15,4 +17,26 @@ fi
 CFG="${1}"
 shift;
 
+if [ \! -d /usr/obj/Rescue ]; then
+  mkdir -p /usr/obj/Rescue
+fi
+
 sh ../nanobsd.sh $* -c ${CFG}
+
+F32="/usr/obj/Rescue/rescue_${today}_x32"
+D32="/usr/obj/nanobsd.rescue_i386"
+if [ -f "${D32}/_.disk.full" ]; then
+  mv "${D32}/_.disk.full" "${F32}.img"
+fi
+if [ -f "${D32}/_.disk.iso" ]; then
+  mv "${D32}/_.disk.iso" "${F32}.iso"
+fi
+
+F64="/usr/obj/Rescue/rescue_${today}_x64"
+D64="/usr/obj/nanobsd.rescue_amd64"
+if [ -f "${D64}/_.disk.full" ]; then
+  mv "${D64}/_.disk.full" "${F64}.img"
+fi
+if [ -f "${D64}/_.disk.iso" ]; then
+  mv "${D64}/_.disk.iso" "${F64}.iso"
+fi

Modified: head/tools/tools/nanobsd/rescue/common
==
--- head/tools/tools/nanobsd/rescue/common  Fri Jul  4 07:02:11 2014
(r268245)
+++ head/tools/tools/nanobsd/rescue/common  Fri Jul  4 09:29:43 2014
(r268246)
@@ -3,7 +3,7 @@
 #
 NANO_TOOLS=`pwd`
 NANO_PACKAGE_DIR=`pwd`/Pkg
-NANO_RAM_TMPVARSIZE=20480
+NANO_RAM_TMPVARSIZE=40960
 NANO_PMAKE="make -j 8"
 NANO_LABEL="rescue"
 NANO_RAM_TMPVARSIZE=40960
@@ -68,6 +68,7 @@ cust_etc_cfg () (
echo "#ifconfig_fxp0=\"AUTO\"" >> etc/rc.conf
echo "#sshd_enable=\"YES\"" >> etc/rc.conf
echo "/dev/ufs/${NANO_LABEL}s1a / ufs ro,noatime 0 0" > etc/fstab
+   echo "/dev/${NANO_DRIVE}s3 /cfg ufs rw,noauto 2 2" >> etc/fstab
echo "tmpfs /boot/zfs tmpfs rw,size=1048576,mode=777 0 0" >> etc/fstab
echo "ports:/usr/ports /usr/ports nfs 
rw,noauto,noatime,bg,soft,intr,nfsv3 0 0" >> etc/fstab
 #  echo "/dev/ad1s1a /scratch ufs rw,noauto,noatime 0 0" >> etc/fstab
@@ -100,9 +101,9 @@ last_orders () (
touch conf/default/etc/.keepme
touch conf/default/var/.keepme
cd ..
-   mkisofs -quiet -r -J -no-emul-boot \
-   -V ${NANO_LABEL} \
-   -b boot/cdboot -o _.disk.iso _.w/
+   makefs -t cd9660 -o rockridge \
+   -o label="${NANO_LABEL}" -o publisher="RMX" \
+   -o bootimage="i386;_.w/boot/cdboot" -o no-emul-boot _.disk.iso _.w/
)
 )
 

Modified: head/tools/tools/nanobsd/rescue/merge.sh
==
--- head/tools/tools/nanobsd/rescue/merge.shFri Jul  4 07:02:11 2014
(r268245)
+++ head/tools/tools/nanobsd/rescue/merge.shFri Jul  4 09:29:43 2014
(r268246)
@@ -1,18 +1,28 @@
 #!/bin/sh
 # $FreeBSD$
 
-D1="/usr/obj/nanobsd.rescue_i386"
-D2="/usr/obj/nanobsd.rescue_amd64"
+today=`date '+%Y%m%d'`
 
-MD=`mdconfig -a -t vnode -f ${D1}/_.disk.full`
+I32="/usr/obj/Rescue/rescue_${today