svn commit: r237263 - in head: sbin/ifconfig sys/amd64/conf sys/conf sys/contrib/rdma sys/contrib/rdma/krping sys/dev/cxgb sys/dev/cxgb/common sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/cxgb...

2012-06-19 Thread Navdeep Parhar
Author: np
Date: Tue Jun 19 07:34:13 2012
New Revision: 237263
URL: http://svn.freebsd.org/changeset/base/237263

Log:
  - Updated TOE support in the kernel.
  
  - Stateful TCP offload drivers for Terminator 3 and 4 (T3 and T4) ASICs.
These are available as t3_tom and t4_tom modules that augment cxgb(4)
and cxgbe(4) respectively.  The cxgb/cxgbe drivers continue to work as
usual with or without these extra features.
  
  - iWARP driver for Terminator 3 ASIC (kernel verbs).  T4 iWARP in the
works and will follow soon.
  
  Build-tested with make universe.
  
  30s overview
  
  What interfaces support TCP offload?  Look for TOE4 and/or TOE6 in the
  capabilities of an interface:
  # ifconfig -m | grep TOE
  
  Enable/disable TCP offload on an interface (just like any other ifnet
  capability):
  # ifconfig cxgbe0 toe
  # ifconfig cxgbe0 -toe
  
  Which connections are offloaded?  Look for toe4 and/or toe6 in the
  output of netstat and sockstat:
  # netstat -np tcp | grep toe
  # sockstat -46c | grep toe
  
  Reviewed by:  bz, gnn
  Sponsored by: Chelsio communications.
  MFC after:~3 months (after 9.1, and after ensuring MFC is feasible)

Added:
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ib_intfc.h   (contents, props changed)
  head/sys/dev/cxgbe/tom/
  head/sys/dev/cxgbe/tom/t4_connect.c   (contents, props changed)
  head/sys/dev/cxgbe/tom/t4_cpl_io.c   (contents, props changed)
  head/sys/dev/cxgbe/tom/t4_listen.c   (contents, props changed)
  head/sys/dev/cxgbe/tom/t4_tom.c   (contents, props changed)
  head/sys/dev/cxgbe/tom/t4_tom.h   (contents, props changed)
  head/sys/dev/cxgbe/tom/t4_tom_l2t.c   (contents, props changed)
  head/sys/dev/cxgbe/tom/t4_tom_l2t.h   (contents, props changed)
  head/sys/modules/cxgbe/tom/
  head/sys/modules/cxgbe/tom/Makefile   (contents, props changed)
  head/sys/modules/toecore/
  head/sys/modules/toecore/Makefile   (contents, props changed)
  head/sys/netinet/toecore.c   (contents, props changed)
  head/sys/netinet/toecore.h   (contents, props changed)
Deleted:
  head/sys/dev/cxgb/cxgb_offload.c
  head/sys/dev/cxgb/t3cdev.h
  head/sys/dev/cxgb/ulp/toecore/
  head/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c
  head/sys/dev/cxgb/ulp/tom/cxgb_ddp.c
  head/sys/dev/cxgb/ulp/tom/cxgb_defs.h
  head/sys/dev/cxgb/ulp/tom/cxgb_t3_ddp.h
  head/sys/dev/cxgb/ulp/tom/cxgb_tcp.h
  head/sys/dev/cxgb/ulp/tom/cxgb_tcp_offload.c
  head/sys/dev/cxgb/ulp/tom/cxgb_tcp_offload.h
  head/sys/dev/cxgb/ulp/tom/cxgb_tom_sysctl.c
  head/sys/modules/cxgb/toecore/
  head/sys/netinet/toedev.h
Modified:
  head/sbin/ifconfig/ifconfig.c
  head/sys/amd64/conf/GENERIC
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options
  head/sys/contrib/rdma/krping/krping.c
  head/sys/contrib/rdma/krping/krping.h
  head/sys/contrib/rdma/krping/krping_dev.c
  head/sys/contrib/rdma/rdma_addr.c
  head/sys/contrib/rdma/rdma_cache.c
  head/sys/dev/cxgb/common/cxgb_ctl_defs.h
  head/sys/dev/cxgb/cxgb_adapter.h
  head/sys/dev/cxgb/cxgb_main.c
  head/sys/dev/cxgb/cxgb_offload.h
  head/sys/dev/cxgb/cxgb_osdep.h
  head/sys/dev/cxgb/cxgb_sge.c
  head/sys/dev/cxgb/sys/mvec.h
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.h
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.h
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cq.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_dbg.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ev.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.h
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_mem.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.h
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_resource.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_user.h
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_wr.h
  head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
  head/sys/dev/cxgb/ulp/tom/cxgb_l2t.c
  head/sys/dev/cxgb/ulp/tom/cxgb_l2t.h
  head/sys/dev/cxgb/ulp/tom/cxgb_listen.c
  head/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h
  head/sys/dev/cxgb/ulp/tom/cxgb_tom.c
  head/sys/dev/cxgb/ulp/tom/cxgb_tom.h
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/offload.h
  head/sys/dev/cxgbe/t4_l2t.c
  head/sys/dev/cxgbe/t4_l2t.h
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/i386/conf/GENERIC
  head/sys/i386/conf/XEN
  head/sys/modules/Makefile
  head/sys/modules/cxgb/Makefile
  head/sys/modules/cxgb/cxgb/Makefile
  head/sys/modules/cxgb/iw_cxgb/Makefile
  head/sys/modules/cxgb/tom/Makefile
  head/sys/modules/cxgbe/Makefile
  head/sys/modules/rdma/krping/Makefile
  head/sys/net/if_var.h
  head/sys/net/if_vlan.c
  head/sys/netinet/if_ether.c
  head/sys/netinet/if_ether.h
  head/sys/netinet/in.c
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_offload.c
  head/sys/netinet/tcp_offload.h
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_subr.c
  head/sys/netine

Re: svn commit: r237244 - head/sys/fs/nfsclient

2012-06-19 Thread Konstantin Belousov
On Tue, Jun 19, 2012 at 03:06:09AM +, Benjamin Kaduk wrote:
> On Mon, 18 Jun 2012, Rick Macklem wrote:
> 
> >Author: rmacklem
> >Date: Mon Jun 18 22:17:28 2012
> >New Revision: 237244
> >URL: http://svn.freebsd.org/changeset/base/237244
> >
> >Log:
> > Fix the NFSv4 client for the case where mmap'd files are
> > written, but not msync'd by a process. A VOP_PUTPAGES()
> > called when VOP_RECLAIM() happens will usually fail, since
> > the NFSv4 Open has already been closed by VOP_INACTIVE().
> > Add a vm_object_page_clean() call to the NFSv4 client's
> > VOP_INACTIVE(), so that the write happens before the NFSv4
> > Open is closed. kib@ suggested using vgone() instead and
> > I will explore this, but this patch fixes things in the
> 
> Hi Rick,
> 
> OpenAFS is currently using vgone() in the vnode cleanup path (though it is 
> actually in RECLAIM not INACTIVE because of how AFS has traditionally 
> separated the two).
Calling vgone() from VOP_RECLAIM is exactly NOP.

> However, it seems that the other *BSD implementations do not call vgone() 
> in the same place, instead the corresponding flush functions call 
> cache_purge() and sometimes other things.  My colleague is trying to get 
> our FreeBSD implementation to match, so I would be interested in your test 
> case to confirm that we do not rely on the full vgone() there.
> 
> Thanks,
> 
> Ben
> 
> > meantime. For some reason, the VOP_PUTPAGES() is still
> > attaempted in VOP_RECLAIM(), but having this fail doesn't
> > cause any problems except a "stateid0 in write" being logged.


pgp6Qw79nPCO4.pgp
Description: PGP signature


svn commit: r237264 - head/sys/amd64/amd64

2012-06-19 Thread Alan Cox
Author: alc
Date: Tue Jun 19 08:12:44 2012
New Revision: 237264
URL: http://svn.freebsd.org/changeset/base/237264

Log:
  Condition the implementation of pv_entry_count on PV_STATS.  On amd64,
  pv_entry_count is purely informational.  It does not serve any functional
  purpose.
  
  Add PV chunk locking to get_pv_entry().

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Tue Jun 19 07:34:13 2012(r237263)
+++ head/sys/amd64/amd64/pmap.c Tue Jun 19 08:12:44 2012(r237264)
@@ -2043,10 +2043,6 @@ pv_to_chunk(pv_entry_t pv)
 
 static const uint64_t pc_freemask[_NPCM] = { PC_FREE0, PC_FREE1, PC_FREE2 };
 
-static long pv_entry_count;
-SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0,
-   "Current number of pv entries");
-
 #ifdef PV_STATS
 static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail;
 
@@ -2059,13 +2055,15 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_
 SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_tryfail, CTLFLAG_RD, 
&pc_chunk_tryfail, 0,
"Number of times tried to get a chunk page but failed.");
 
-static long pv_entry_frees, pv_entry_allocs;
+static long pv_entry_frees, pv_entry_allocs, pv_entry_count;
 static int pv_entry_spare;
 
 SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_frees, CTLFLAG_RD, &pv_entry_frees, 0,
"Current number of pv entry frees");
 SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_allocs, CTLFLAG_RD, &pv_entry_allocs, 
0,
"Current number of pv entry allocs");
+SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0,
+   "Current number of pv entries");
 SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0,
"Current number of spare pv entries");
 #endif
@@ -2164,7 +2162,7 @@ pmap_pv_reclaim(pmap_t locked_pmap)
pmap_resident_count_dec(pmap, freed);
PV_STAT(pv_entry_frees += freed);
PV_STAT(pv_entry_spare += freed);
-   pv_entry_count -= freed;
+   PV_STAT(atomic_subtract_long(&pv_entry_count, freed));
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
if (pc->pc_map[0] == PC_FREE0 && pc->pc_map[1] == PC_FREE1 &&
pc->pc_map[2] == PC_FREE2) {
@@ -2212,7 +2210,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
PV_STAT(pv_entry_frees++);
PV_STAT(pv_entry_spare++);
-   pv_entry_count--;
+   PV_STAT(atomic_subtract_long(&pv_entry_count, 1));
pc = pv_to_chunk(pv);
idx = pv - &pc->pc_pventry[0];
field = idx / 64;
@@ -2261,9 +2259,9 @@ get_pv_entry(pmap_t pmap, boolean_t try)
struct pv_chunk *pc;
vm_page_t m;
 
-   rw_assert(&pvh_global_lock, RA_WLOCKED);
+   rw_assert(&pvh_global_lock, RA_LOCKED);
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-   PV_STAT(pv_entry_allocs++);
+   PV_STAT(atomic_add_long(&pv_entry_allocs, 1));
 retry:
pc = TAILQ_FIRST(&pmap->pm_pvchunk);
if (pc != NULL) {
@@ -2283,8 +2281,8 @@ retry:
TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc,
pc_list);
}
-   pv_entry_count++;
-   PV_STAT(pv_entry_spare--);
+   PV_STAT(atomic_add_long(&pv_entry_count, 1));
+   PV_STAT(atomic_subtract_int(&pv_entry_spare, 1));
return (pv);
}
}
@@ -2300,19 +2298,21 @@ retry:
if (m == NULL)
goto retry;
}
-   PV_STAT(pc_chunk_count++);
-   PV_STAT(pc_chunk_allocs++);
+   PV_STAT(atomic_add_int(&pc_chunk_count, 1));
+   PV_STAT(atomic_add_int(&pc_chunk_allocs, 1));
dump_add_page(m->phys_addr);
pc = (void *)PHYS_TO_DMAP(m->phys_addr);
pc->pc_pmap = pmap;
pc->pc_map[0] = PC_FREE0 & ~1ul;/* preallocated bit 0 */
pc->pc_map[1] = PC_FREE1;
pc->pc_map[2] = PC_FREE2;
+   mtx_lock(&pv_chunks_mutex);
TAILQ_INSERT_TAIL(&pv_chunks, pc, pc_lru);
+   mtx_unlock(&pv_chunks_mutex);
pv = &pc->pc_pventry[0];
TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
-   pv_entry_count++;
-   PV_STAT(pv_entry_spare += _NPCPV - 1);
+   PV_STAT(atomic_add_long(&pv_entry_count, 1));
+   PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV - 1));
return (pv);
 }
 
@@ -4266,7 +4266,7 @@ pmap_remove_pages(pmap_t pmap)
}
PV_STAT(atomic_add_long(&pv_entry_frees, freed));
PV_STAT(atomic_add_int(&pv_entry_spare, freed));
-   atomic_subtract_long(&pv_entry_count, freed);
+   PV_STAT(atomic_subtract_long(&pv_entry_count, freed));
if (allfree) {

Re: svn commit: r237223 - head/sys/dev/fb

2012-06-19 Thread Andriy Gapon
on 19/06/2012 08:27 Poul-Henning Kamp said the following:
> In message <68fbe843-7337-4c90-b01f-e0caabb62...@gsoft.com.au>, "Daniel 
> O'Conno
> r" writes:
> 
>>> If size is odd, this does not copy the last byte. Not sure, whether =
>> this is intended.
> 
> Feel free to improve...

Interesting reaction to a bug reported in one's freshly committed code...

-- 
Andriy Gapon


___
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: r237268 - head/lib/libutil

2012-06-19 Thread Baptiste Daroussin
Author: bapt
Date: Tue Jun 19 11:39:56 2012
New Revision: 237268
URL: http://svn.freebsd.org/changeset/base/237268

Log:
  Revert user comparison back to user names as some user can share uids 
(root/toor
  for example)
  
  get the username information from old_pw structures to still allow renaming 
of a
  user.
  
  Reported by:  Claude Buisson 
  Approved by:  des (mentor)
  MFC after:3 weeks

Modified:
  head/lib/libutil/pw_util.c

Modified: head/lib/libutil/pw_util.c
==
--- head/lib/libutil/pw_util.c  Tue Jun 19 10:07:50 2012(r237267)
+++ head/lib/libutil/pw_util.c  Tue Jun 19 11:39:56 2012(r237268)
@@ -437,14 +437,21 @@ pw_copy(int ffd, int tfd, const struct p
size_t len;
int eof, readlen;
 
-   spw = pw;
+   if (old_pw == NULL && pw == NULL)
+   return (-1);
+
+   spw = old_pw;
+   /* deleting a user */
if (pw == NULL) {
line = NULL;
-   if (old_pw == NULL)
+   } else {
+   if ((line = pw_make(pw)) == NULL)
return (-1);
-   spw = old_pw;
-   } else if ((line = pw_make(pw)) == NULL)
-   return (-1);
+   }
+
+   /* adding a user */
+   if (spw == NULL)
+   spw = pw;
 
eof = 0;
len = 0;
@@ -511,7 +518,7 @@ pw_copy(int ffd, int tfd, const struct p
 */
 
*q = t;
-   if (fpw == NULL || fpw->pw_uid != spw->pw_uid) {
+   if (fpw == NULL || strcmp(fpw->pw_name, spw->pw_name) != 0) {
/* nope */
if (fpw != NULL)
free(fpw);
___
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: r237269 - in head: etc lib/libutil

2012-06-19 Thread Dag-Erling Smorgrav
Author: des
Date: Tue Jun 19 14:46:18 2012
New Revision: 237269
URL: http://svn.freebsd.org/changeset/base/237269

Log:
  Switch the default password hash from md5 to sha512.
  
  MFC after:1 week

Modified:
  head/etc/login.conf
  head/lib/libutil/login.conf.5

Modified: head/etc/login.conf
==
--- head/etc/login.conf Tue Jun 19 11:39:56 2012(r237268)
+++ head/etc/login.conf Tue Jun 19 14:46:18 2012(r237269)
@@ -23,7 +23,7 @@
 # AND SEMANTICS'' section of getcap(3) for more escape sequences).
 
 default:\
-   :passwd_format=md5:\
+   :passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\

Modified: head/lib/libutil/login.conf.5
==
--- head/lib/libutil/login.conf.5   Tue Jun 19 11:39:56 2012
(r237268)
+++ head/lib/libutil/login.conf.5   Tue Jun 19 14:46:18 2012
(r237269)
@@ -267,7 +267,7 @@ The backoff delay is the number of tries
 multiplied by 5 seconds.
 .It "login-retries number  10  The number of login attempts"
 allowed before the login fails.
-.It "passwd_format string  md5 The encryption format that new or"
+.It "passwd_format string  sha512  The encryption format that new or"
 changed passwords will use.
 Valid values include "des", "md5", "blf", "sha256" and "sha512"; see
 .Xr crypt 3
___
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: r237270 - head/etc

2012-06-19 Thread Dag-Erling Smorgrav
Author: des
Date: Tue Jun 19 14:47:07 2012
New Revision: 237270
URL: http://svn.freebsd.org/changeset/base/237270

Log:
  Passive mode is the default, and has been for a while.
  
  MFC after:1 week

Modified:
  head/etc/login.conf

Modified: head/etc/login.conf
==
--- head/etc/login.conf Tue Jun 19 14:46:18 2012(r237269)
+++ head/etc/login.conf Tue Jun 19 14:47:07 2012(r237270)
@@ -26,7 +26,7 @@ default:\
:passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
-   :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\
+   :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\
:path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin 
/usr/local/bin ~/bin:\
:nologin=/var/run/nologin:\
:cputime=unlimited:\
___
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: r237271 - head/sys/dev/pci

2012-06-19 Thread John Baldwin
Author: jhb
Date: Tue Jun 19 15:15:35 2012
New Revision: 237271
URL: http://svn.freebsd.org/changeset/base/237271

Log:
  Fix another off-by-one error in the previous fix so that the new start
  address is properly aligned.  While here, use a simpler expression to
  align the new end address that we use elsewhere for aligning the end.

Modified:
  head/sys/dev/pci/pci_pci.c

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Tue Jun 19 14:47:07 2012(r237270)
+++ head/sys/dev/pci/pci_pci.c  Tue Jun 19 15:15:35 2012(r237271)
@@ -913,7 +913,7 @@ pcib_grow_window(struct pcib_softc *sc, 
if (bootverbose)
printf("\tfront candidate range: %#lx-%#lx\n",
front, end_free);
-   front &= ~(1ul << w->step) - 1;
+   front &= ~((1ul << w->step) - 1);
front = rman_get_start(w->res) - front;
} else
front = 0;
@@ -941,7 +941,7 @@ pcib_grow_window(struct pcib_softc *sc, 
if (bootverbose)
printf("\tback candidate range: %#lx-%#lx\n",
start_free, back);
-   back = roundup2(back + 1, 1ul << w->step) - 1;
+   back |= (1ul << w->step) - 1;
back -= rman_get_end(w->res);
} else
back = 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: r237272 - head/sys/dev/pci

2012-06-19 Thread John Baldwin
Author: jhb
Date: Tue Jun 19 16:06:27 2012
New Revision: 237272
URL: http://svn.freebsd.org/changeset/base/237272

Log:
  Add a 'wmask' variable to hold the expression '(1ul << w->step) - 1' in
  pcib_grow_window().  This makes the code slightly easier to read and
  prevents the type of bug fixed in r237271.
  
  MFC after:3 days

Modified:
  head/sys/dev/pci/pci_pci.c

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Tue Jun 19 15:15:35 2012(r237271)
+++ head/sys/dev/pci/pci_pci.c  Tue Jun 19 16:06:27 2012(r237272)
@@ -815,7 +815,7 @@ static int
 pcib_grow_window(struct pcib_softc *sc, struct pcib_window *w, int type,
 u_long start, u_long end, u_long count, u_int flags)
 {
-   u_long align, start_free, end_free, front, back;
+   u_long align, start_free, end_free, front, back, wmask;
int error, rid;
 
/*
@@ -828,6 +828,7 @@ pcib_grow_window(struct pcib_softc *sc, 
end = w->rman.rm_end;
if (start + count - 1 > end || start + count < start)
return (EINVAL);
+   wmask = (1ul << w->step) - 1;
 
/*
 * If there is no resource at all, just try to allocate enough
@@ -838,8 +839,8 @@ pcib_grow_window(struct pcib_softc *sc, 
flags &= ~RF_ALIGNMENT_MASK;
flags |= RF_ALIGNMENT_LOG2(w->step);
}
-   start &= ~((1ul << w->step) - 1);
-   end |= ((1ul << w->step) - 1);
+   start &= ~wmask;
+   end |= wmask;
count = roundup2(count, 1ul << w->step);
rid = w->reg;
w->res = bus_alloc_resource(sc->dev, type, &rid, start, end,
@@ -913,7 +914,7 @@ pcib_grow_window(struct pcib_softc *sc, 
if (bootverbose)
printf("\tfront candidate range: %#lx-%#lx\n",
front, end_free);
-   front &= ~((1ul << w->step) - 1);
+   front &= ~wmask;
front = rman_get_start(w->res) - front;
} else
front = 0;
@@ -941,7 +942,7 @@ pcib_grow_window(struct pcib_softc *sc, 
if (bootverbose)
printf("\tback candidate range: %#lx-%#lx\n",
start_free, back);
-   back |= (1ul << w->step) - 1;
+   back |= wmask;
back -= rman_get_end(w->res);
} else
back = 0;
@@ -1000,10 +1001,8 @@ updatewin:
/* Save the new window. */
w->base = rman_get_start(w->res);
w->limit = rman_get_end(w->res);
-   KASSERT((w->base & ((1ul << w->step) - 1)) == 0,
-   ("start address is not aligned"));
-   KASSERT((w->limit & ((1ul << w->step) - 1)) == (1ul << w->step) - 1,
-   ("end address is not aligned"));
+   KASSERT((w->base & wmask) == 0, ("start address is not aligned"));
+   KASSERT((w->limit & wmask) == wmask, ("end address is not aligned"));
pcib_write_windows(sc, w->mask);
return (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"


Re: svn commit: r237269 - in head: etc lib/libutil

2012-06-19 Thread Alexey Dokuchaev
On Tue, Jun 19, 2012 at 02:46:19PM +, Dag-Erling Smorgrav wrote:
> Author: des
> Date: Tue Jun 19 14:46:18 2012
> New Revision: 237269
> URL: http://svn.freebsd.org/changeset/base/237269
> 
> Log:
>   Switch the default password hash from md5 to sha512.

Pardon my possible unawareness, but was this change discussed anywhere?
I understand the rationale to move away from MD5, but reasons for SHA512
seem moot.  I've personally had been using Blowfish for password hashes
since OpenBSD switched to it, for example, as fast and apparently reliable
hash.  Is there anything wrong with it?  Why SHA512 is clear winner here?
FWIW, ports use SHA256 for now.  Could it be that switch to SHA512 will
impose perfomance problems?

./danfe
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237269 - in head: etc lib/libutil

2012-06-19 Thread Chris Rees
On Jun 19, 2012 5:15 PM, "Alexey Dokuchaev"  wrote:
>
> On Tue, Jun 19, 2012 at 02:46:19PM +, Dag-Erling Smorgrav wrote:
> > Author: des
> > Date: Tue Jun 19 14:46:18 2012
> > New Revision: 237269
> > URL: http://svn.freebsd.org/changeset/base/237269
> >
> > Log:
> >   Switch the default password hash from md5 to sha512.
>
> Pardon my possible unawareness, but was this change discussed anywhere?

http://lists.freebsd.org/pipermail/freebsd-security/2012-June/006271.html

> I understand the rationale to move away from MD5, but reasons for SHA512
> seem moot.  I've personally had been using Blowfish for password hashes
> since OpenBSD switched to it, for example, as fast and apparently reliable
> hash.  Is there anything wrong with it?  Why SHA512 is clear winner here?
> FWIW, ports use SHA256 for now.  Could it be that switch to SHA512 will
> impose perfomance problems?

Why would you want password matching to be fast?  That makes brute-forcing
easier.

Chris
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r237273 - head/share/man/man4

2012-06-19 Thread Sean Bruno
Author: sbruno
Date: Tue Jun 19 17:13:14 2012
New Revision: 237273
URL: http://svn.freebsd.org/changeset/base/237273

Log:
  Correct misunderstanding of hw.est.strict
  
  Setting strict causes a validation of the requested
  value vs the value currently running after a frequency
  change is requested.
  
  Change applicability to be single core not i386.
  
  Thanks to mav@ for reviewing and commenting on my
  lack of understanding.
  
  MFC after:2 weeks

Modified:
  head/share/man/man4/est.4

Modified: head/share/man/man4/est.4
==
--- head/share/man/man4/est.4   Tue Jun 19 16:06:27 2012(r237272)
+++ head/share/man/man4/est.4   Tue Jun 19 17:13:14 2012(r237273)
@@ -66,8 +66,8 @@ Attempt to infer information from direct
 Should only be used in diagnostic cases
 .Pq default 0
 .It hw.est.strict
-Do not allow different cpus to be set to different frequencies.
-It appears that this will only work on i386 systems
+Validate frequency requested is accepted by the cpu when set.
+It appears that this will only work on single core cpus.
 .Pq default 0
 .El
 .Sh DIAGNOSTICS
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237269 - in head: etc lib/libutil

2012-06-19 Thread Alexey Dokuchaev
On Tue, Jun 19, 2012 at 05:21:13PM +0100, Chris Rees wrote:
> On Jun 19, 2012 5:15 PM, "Alexey Dokuchaev"  wrote:
> > Pardon my possible unawareness, but was this change discussed anywhere?
> 
> http://lists.freebsd.org/pipermail/freebsd-security/2012-June/006271.html

Thanks for the link, I didn't check -security@ for some reason.

> > I understand the rationale to move away from MD5, but reasons for SHA512
> > seem moot.  I've personally had been using Blowfish for password hashes
> > since OpenBSD switched to it, for example, as fast and apparently reliable
> > hash.  Is there anything wrong with it?  Why SHA512 is clear winner here?
> > FWIW, ports use SHA256 for now.  Could it be that switch to SHA512 will
> > impose performance problems?
> 
> Why would you want password matching to be fast?  That makes brute-forcing
> easier.

Maybe I don't.  I just want to know if I should switch from Blowfish to
SHA512.  It seems that the former is quite popular judging from discussion
link given above.  It also seems that des@' rationale for the switch boils
down to "I vastly prefer sha512 to blf, as that is what the rest of the
world uses."  If there's nothing wrong with Blowfish, I guess I'll stick to
it as I prefer compatibility among *BSD to some weird Unix clones.  :-)

./danfe
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237269 - in head: etc lib/libutil

2012-06-19 Thread Dag-Erling Smørgrav
Alexey Dokuchaev  writes:
> Maybe I don't.  I just want to know if I should switch from Blowfish to
> SHA512.  It seems that the former is quite popular judging from discussion
> link given above.  It also seems that des@' rationale for the switch boils
> down to "I vastly prefer sha512 to blf, as that is what the rest of the
> world uses."  If there's nothing wrong with Blowfish, I guess I'll stick to
> it as I prefer compatibility among *BSD to some weird Unix clones.  :-)

My understanding is that blf and sha512 are approximately equally hard
(or equally easy, if you like) to brute-force with a CPU, but sha512 is
supposedly less GPU-friendly.  That plus compatibility - but mostly
compatibility, to be honest - tipped the scales in favor of sha512.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237269 - in head: etc lib/libutil

2012-06-19 Thread Alexey Dokuchaev
On Tue, Jun 19, 2012 at 08:27:52PM +0200, Dag-Erling Sm??rgrav wrote:
> Alexey Dokuchaev  writes:
> > Maybe I don't.  I just want to know if I should switch from Blowfish to
> > SHA512.  It seems that the former is quite popular judging from discussion
> > link given above.  It also seems that des@' rationale for the switch boils
> > down to "I vastly prefer sha512 to blf, as that is what the rest of the
> > world uses."  If there's nothing wrong with Blowfish, I guess I'll stick to
> > it as I prefer compatibility among *BSD to some weird Unix clones.  :-)
> 
> My understanding is that blf and sha512 are approximately equally hard
> (or equally easy, if you like) to brute-force with a CPU, but sha512 is
> supposedly less GPU-friendly.  That plus compatibility - but mostly
> compatibility, to be honest - tipped the scales in favor of sha512.

This CPU vs. GPU particularity is something I wanted to know about,
actually.  Thanks for this piece of knowledge Dag-Erling, and sorry for the
noise.

./danfe
___
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: r237274 - in head: lib/libc/sys sys/kern sys/sys

2012-06-19 Thread John Baldwin
Author: jhb
Date: Tue Jun 19 18:42:24 2012
New Revision: 237274
URL: http://svn.freebsd.org/changeset/base/237274

Log:
  Further refine the implementation of POSIX_FADV_NOREUSE.
  
  First, extend the changes in r230782 to better handle the common case
  of using NOREUSE with sequential reads.  A NOREUSE file descriptor
  will now track the last implicit DONTNEED request it made as a result
  of a NOREUSE read.  If a subsequent NOREUSE read is adjacent to the
  previous range, it will apply the DONTNEED request to the entire range
  of both the previous read and the current read.  The effect is that
  each read of a file accessed sequentially will apply the DONTNEED
  request to the entire range that has been read.  This allows NOREUSE
  to properly handle misaligned reads by flushing each buffer to cache
  once it has been completely read.
  
  Second, apply the same changes made to read(2) by r230782 and this
  change to writes.  This provides much better performance in the
  sequential write case as it allows writes to still be clustered.  It
  also provides much better performance for misaligned writes.  It does
  mean that NOREUSE will be generally ineffective for non-sequential
  writes as the current implementation relies on a future NOREUSE
  write's implicit DONTNEED request to flush the dirty buffer from the
  current write.
  
  MFC after:2 weeks

Modified:
  head/lib/libc/sys/posix_fadvise.2
  head/sys/kern/vfs_syscalls.c
  head/sys/kern/vfs_vnops.c
  head/sys/sys/file.h

Modified: head/lib/libc/sys/posix_fadvise.2
==
--- head/lib/libc/sys/posix_fadvise.2   Tue Jun 19 17:13:14 2012
(r237273)
+++ head/lib/libc/sys/posix_fadvise.2   Tue Jun 19 18:42:24 2012
(r237274)
@@ -28,7 +28,7 @@
 .\"@(#)madvise.2   8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd February 25, 2012
+.Dd June 19, 2012
 .Dt POSIX_FADVISE 2
 .Os
 .Sh NAME
@@ -84,10 +84,9 @@ specified range and future access to thi
 .It Dv POSIX_FADV_NOREUSE
 Tells the system that the specified data will only be accessed once and
 then not reused.
-Accesses to data within the specified range are treated as if the file
-descriptor has the
-.Dv O_DIRECT
-flag enabled.
+The system may decrease the in-memory priority of data once it has been
+read or written.
+Future access to this data may require a read operation.
 .El
 .Sh RETURN VALUES
 .Rv -std posix_fadvise

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cTue Jun 19 17:13:14 2012
(r237273)
+++ head/sys/kern/vfs_syscalls.cTue Jun 19 18:42:24 2012
(r237274)
@@ -4872,6 +4872,8 @@ kern_posix_fadvise(struct thread *td, in
new->fa_advice = advice;
new->fa_start = offset;
new->fa_end = end;
+   new->fa_prevstart = 0;
+   new->fa_prevend = 0;
fp->f_advice = new;
new = fa;
}

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Tue Jun 19 17:13:14 2012(r237273)
+++ head/sys/kern/vfs_vnops.c   Tue Jun 19 18:42:24 2012(r237274)
@@ -542,7 +542,7 @@ vn_read(fp, uio, active_cred, flags, td)
int error, ioflag;
struct mtx *mtxp;
int advice, vfslocked;
-   off_t offset;
+   off_t offset, start, end;
 
KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
uio->uio_td, td));
@@ -607,9 +607,38 @@ vn_read(fp, uio, active_cred, flags, td)
fp->f_nextoff = uio->uio_offset;
VOP_UNLOCK(vp, 0);
if (error == 0 && advice == POSIX_FADV_NOREUSE &&
-   offset != uio->uio_offset)
-   error = VOP_ADVISE(vp, offset, uio->uio_offset - 1,
-   POSIX_FADV_DONTNEED);
+   offset != uio->uio_offset) {
+   /*
+* Use POSIX_FADV_DONTNEED to flush clean pages and
+* buffers for the backing file after a
+* POSIX_FADV_NOREUSE read(2).  To optimize the common
+* case of using POSIX_FADV_NOREUSE with sequential
+* access, track the previous implicit DONTNEED
+* request and grow this request to include the
+* current read(2) in addition to the previous
+* DONTNEED.  With purely sequential access this will
+* cause the DONTNEED requests to continously grow to
+* cover all of the previously read regions of the
+* file.  This allows filesystem blocks that are
+* accessed by multiple calls to read(2) to be flushed
+* once the last read(2) finishes.
+*/
+   start = offset;
+

svn commit: r237276 - head/sys/kern

2012-06-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Jun 19 22:21:59 2012
New Revision: 237276
URL: http://svn.freebsd.org/changeset/base/237276

Log:
  The falloc() function obtains two references to newly created 'fp'.
  On success we have to drop one after procdesc_finit() and on failure
  we have to close allocated slot with fdclose(), which also drops one
  reference for us and drop the remaining reference with fdrop().
  
  Without this change closing process descriptor didn't result in killing
  pdfork(2)ed child.
  
  Reviewed by:  rwatson
  MFC after:1 month

Modified:
  head/sys/kern/kern_fork.c

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Tue Jun 19 19:40:54 2012(r237275)
+++ head/sys/kern/kern_fork.c   Tue Jun 19 22:21:59 2012(r237276)
@@ -921,8 +921,10 @@ fork1(struct thread *td, int flags, int 
 */
*procp = newproc;
 #ifdef PROCDESC
-   if (flags & RFPROCDESC)
+   if (flags & RFPROCDESC) {
procdesc_finit(newproc->p_procdesc, fp_procdesc);
+   fdrop(fp_procdesc, td);
+   }
 #endif
racct_proc_fork_done(newproc);
return (0);
@@ -944,8 +946,10 @@ fail1:
vmspace_free(vm2);
uma_zfree(proc_zone, newproc);
 #ifdef PROCDESC
-   if (((flags & RFPROCDESC) != 0) && (fp_procdesc != NULL))
+   if (((flags & RFPROCDESC) != 0) && (fp_procdesc != NULL)) {
+   fdclose(td->td_proc->p_fd, fp_procdesc, *procdescp, td);
fdrop(fp_procdesc, td);
+   }
 #endif
pause("fork", hz / 2);
return (error);
___
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: r237277 - head/sys/kern

2012-06-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Jun 19 22:23:59 2012
New Revision: 237277
URL: http://svn.freebsd.org/changeset/base/237277

Log:
  Check proper flag (PDF_DAEMON, not PD_DAEMON) when deciding if the process
  should be killed or not.
  
  This fixes killing pdfork(2)ed process on last close of the corresponding
  process descriptor.
  
  Reviewed by:  rwatson
  MFC after:1 month

Modified:
  head/sys/kern/sys_procdesc.c

Modified: head/sys/kern/sys_procdesc.c
==
--- head/sys/kern/sys_procdesc.cTue Jun 19 22:21:59 2012
(r237276)
+++ head/sys/kern/sys_procdesc.cTue Jun 19 22:23:59 2012
(r237277)
@@ -338,7 +338,7 @@ procdesc_reap(struct proc *p)
 
 /*
  * procdesc_close() - last close on a process descriptor.  If the process is
- * still running, terminate with SIGKILL (unless PD_DAEMON is set) and let
+ * still running, terminate with SIGKILL (unless PDF_DAEMON is set) and let
  * init(8) clean up the mess; if not, we have to clean up the zombie ourselves.
  */
 static int
@@ -386,7 +386,7 @@ procdesc_close(struct file *fp, struct t
 */
p->p_sigparent = SIGCHLD;
proc_reparent(p, initproc);
-   if ((pd->pd_flags & PD_DAEMON) == 0)
+   if ((pd->pd_flags & PDF_DAEMON) == 0)
kern_psignal(p, SIGKILL);
PROC_UNLOCK(p);
sx_xunlock(&proctree_lock);
___
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: r237279 - in head: etc/mtree include

2012-06-19 Thread David E. O'Brien
Author: obrien
Date: Wed Jun 20 00:09:47 2012
New Revision: 237279
URL: http://svn.freebsd.org/changeset/base/237279

Log:
  Install filemon.h into /usr/include for userland consumption.

Modified:
  head/etc/mtree/BSD.include.dist
  head/include/Makefile

Modified: head/etc/mtree/BSD.include.dist
==
--- head/etc/mtree/BSD.include.dist Tue Jun 19 23:45:17 2012
(r237278)
+++ head/etc/mtree/BSD.include.dist Wed Jun 20 00:09:47 2012
(r237279)
@@ -102,6 +102,8 @@
 ..
 ciss
 ..
+filemon
+..
 firewire
 ..
 hwpmc

Modified: head/include/Makefile
==
--- head/include/Makefile   Tue Jun 19 23:45:17 2012(r237278)
+++ head/include/Makefile   Wed Jun 20 00:09:47 2012(r237279)
@@ -39,7 +39,7 @@ LDIRS=bsm cam geom net net80211 netatal
sys vm
 
 LSUBDIRS=  cam/ata cam/scsi \
-   dev/acpica dev/an dev/bktr dev/ciss dev/firewire dev/hwpmc \
+   dev/acpica dev/an dev/bktr dev/ciss dev/filemon dev/firewire dev/hwpmc \
dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \
dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
___
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: r237281 - head/sbin/camcontrol

2012-06-19 Thread Scott Long
Author: scottl
Date: Wed Jun 20 00:17:29 2012
New Revision: 237281
URL: http://svn.freebsd.org/changeset/base/237281

Log:
  Update the 'fwdownload' command to also flash disks connected over an
  ATA/SATA transport.  The detection logic is automatic, so it should Just
  Work.  While here, also improve the progress meter that is displayed
  during firmware download.
  
  Submitted by: Alistair Crooks
  Obtained from:Netflix, Inc.
  MFC after:3 days

Modified:
  head/sbin/camcontrol/Makefile
  head/sbin/camcontrol/camcontrol.c
  head/sbin/camcontrol/camcontrol.h
  head/sbin/camcontrol/fwdownload.c

Modified: head/sbin/camcontrol/Makefile
==
--- head/sbin/camcontrol/Makefile   Wed Jun 20 00:13:44 2012
(r237280)
+++ head/sbin/camcontrol/Makefile   Wed Jun 20 00:17:29 2012
(r237281)
@@ -3,7 +3,7 @@
 PROG=  camcontrol
 SRCS=  camcontrol.c util.c
 .if !defined(RELEASE_CRUNCH)
-SRCS+= fwdownload.c modeedit.c
+SRCS+= fwdownload.c modeedit.c progress.c
 .else
 CFLAGS+= -DMINIMALISTIC
 .endif

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Wed Jun 20 00:13:44 2012
(r237280)
+++ head/sbin/camcontrol/camcontrol.c   Wed Jun 20 00:17:29 2012
(r237281)
@@ -3071,6 +3071,26 @@ get_cgd_bailout:
return(retval);
 }
 
+/* return the type of disk (really the command type) */
+static const char *
+get_disk_type(struct cam_device *device)
+{
+   struct ccb_getdev   cgd;
+
+   (void) memset(&cgd, 0x0, sizeof(cgd));
+   get_cgd(device, &cgd);
+   switch(cgd.protocol) {
+   case PROTO_SCSI:
+   return "scsi";
+   case PROTO_ATA:
+   case PROTO_ATAPI:
+   case PROTO_SATAPM:
+   return "ata";
+   default:
+   return "unknown";
+   }
+}
+
 static void
 cpi_print(struct ccb_pathinq *cpi)
 {
@@ -6197,7 +6217,8 @@ main(int argc, char **argv)
break;
case CAM_CMD_DOWNLOAD_FW:
error = fwdownload(cam_dev, argc, argv, combinedopt,
-   arglist & CAM_ARG_VERBOSE, retry_count, timeout);
+   arglist & CAM_ARG_VERBOSE, retry_count, timeout,
+   get_disk_type(cam_dev));
break;
 #endif /* MINIMALISTIC */
case CAM_CMD_USAGE:

Modified: head/sbin/camcontrol/camcontrol.h
==
--- head/sbin/camcontrol/camcontrol.h   Wed Jun 20 00:13:44 2012
(r237280)
+++ head/sbin/camcontrol/camcontrol.h   Wed Jun 20 00:17:29 2012
(r237281)
@@ -41,7 +41,8 @@ struct get_hook
 };
 
 int fwdownload(struct cam_device *device, int argc, char **argv,
-  char *combinedopt, int verbose, int retry_count, int timeout);
+  char *combinedopt, int verbose, int retry_count, int timeout,
+  const char */*type*/);
 void mode_sense(struct cam_device *device, int mode_page, int page_control,
int dbd, int retry_count, int timeout, u_int8_t *data,
int datalen);

Modified: head/sbin/camcontrol/fwdownload.c
==
--- head/sbin/camcontrol/fwdownload.c   Wed Jun 20 00:13:44 2012
(r237280)
+++ head/sbin/camcontrol/fwdownload.c   Wed Jun 20 00:17:29 2012
(r237281)
@@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include "progress.h"
+
 #include "camcontrol.h"
 
 #defineCMD_TIMEOUT 5   /* 50 seconds */
@@ -73,6 +75,7 @@ typedef enum {
VENDOR_HP,
VENDOR_IBM,
VENDOR_PLEXTOR,
+   VENDOR_QUALSTAR,
VENDOR_QUANTUM,
VENDOR_SEAGATE,
VENDOR_UNKNOWN
@@ -93,17 +96,43 @@ static const struct fw_vendor vendors_li
{VENDOR_HP, "HP",   0x8000, 0x07, 0x07, 0, 1},
{VENDOR_IBM,"IBM",  0x8000, 0x05, 0x05, 1, 0},
{VENDOR_PLEXTOR,"PLEXTOR",  0x2000, 0x04, 0x05, 0, 1},
+   {VENDOR_QUALSTAR,   "QUALSTAR", 0x2030, 0x05, 0x05, 0, 0},
{VENDOR_QUANTUM,"QUANTUM",  0x2000, 0x04, 0x05, 0, 1},
{VENDOR_SEAGATE,"SEAGATE",  0x8000, 0x07, 0x07, 0, 1},
+   /* the next 2 are SATA disks going through SAS HBA */
+   {VENDOR_SEAGATE,"ATA ST",   0x8000, 0x07, 0x07, 0, 1},
+   {VENDOR_HITACHI,"ATA HDS",  0x8000, 0x05, 0x05, 1, 0},
{VENDOR_UNKNOWN,NULL,   0x, 0x00, 0x00, 0, 0}
 };
 
+#ifndef ATA_DOWNLOAD_MICROCODE
+#define ATA_DOWNLOAD_MICROCODE 0x92
+#endif
+
+#define USE_OFFSETS_FEATURE0x3
+
+#ifndef LOW_SECTOR_SIZE
+#define LOW_SECTOR_SIZE512
+#endif
+
+#define ATA_MAKE_LBA(o, p) \
+   ((o) / L

svn commit: r237282 - head/usr.bin/make

2012-06-19 Thread David E. O'Brien
Author: obrien
Date: Wed Jun 20 00:37:00 2012
New Revision: 237282
URL: http://svn.freebsd.org/changeset/base/237282

Log:
  Correct typo in version.

Modified:
  head/usr.bin/make/Makefile

Modified: head/usr.bin/make/Makefile
==
--- head/usr.bin/make/Makefile  Wed Jun 20 00:17:29 2012(r237281)
+++ head/usr.bin/make/Makefile  Wed Jun 20 00:37:00 2012(r237282)
@@ -15,7 +15,7 @@ NO_SHARED?=   YES
 .endif
 
 # Version has the RMMDDX format, where R is from RELENG_
-CFLAGS+=-DMAKE_VERSION=\"10201120530\"
+CFLAGS+=-DMAKE_VERSION=\"10201205300\"
 
 # There is no obvious performance improvement currently.
 # CFLAGS+=-DUSE_KQUEUE
___
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: r237284 - head/bin/rm

2012-06-19 Thread Kevin Lo
Author: kevlo
Date: Wed Jun 20 02:21:53 2012
New Revision: 237284
URL: http://svn.freebsd.org/changeset/base/237284

Log:
  Fix potential symlink race condition in "rm -P" by adding a check
  that the file we have opened is the one we expected.  Also open in
  non-blocking mode to avoid a potential hang with FIFOs.
  
  Obtained from:NetBSD via OpenBSD

Modified:
  head/bin/rm/rm.c

Modified: head/bin/rm/rm.c
==
--- head/bin/rm/rm.cWed Jun 20 00:41:31 2012(r237283)
+++ head/bin/rm/rm.cWed Jun 20 02:21:53 2012(r237284)
@@ -408,7 +408,7 @@ rm_file(char **argv)
 int
 rm_overwrite(char *file, struct stat *sbp)
 {
-   struct stat sb;
+   struct stat sb, sb2;
struct statfs fsb;
off_t len;
int bsize, fd, wlen;
@@ -427,8 +427,15 @@ rm_overwrite(char *file, struct stat *sb
file, sbp->st_ino);
return (0);
}
-   if ((fd = open(file, O_WRONLY, 0)) == -1)
+   if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1)
goto err;
+   if (fstat(fd, &sb2))
+   goto err;
+   if (sb2.st_dev != sbp->st_dev || sb2.st_ino != sbp->st_ino ||
+   !S_ISREG(sb2.st_mode)) {
+   errno = EPERM;
+   goto err;
+   }
if (fstatfs(fd, &fsb) == -1)
goto err;
bsize = MAX(fsb.f_iosize, 1024);
___
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: r237285 - head/sbin/camcontrol

2012-06-19 Thread Scott Long
Author: scottl
Date: Wed Jun 20 04:11:34 2012
New Revision: 237285
URL: http://svn.freebsd.org/changeset/base/237285

Log:
  Add progress.c and progress.h, missed in the previous commit to camcontrol.
  
  Submitted by:   Garrett Cooper
  Obtained from:  Netflix, Inc.

Added:
  head/sbin/camcontrol/progress.c   (contents, props changed)
  head/sbin/camcontrol/progress.h   (contents, props changed)

Added: head/sbin/camcontrol/progress.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sbin/camcontrol/progress.c Wed Jun 20 04:11:34 2012
(r237285)
@@ -0,0 +1,186 @@
+/* $NetBSD: progressbar.c,v 1.21 2009/04/12 10:18:52 lukem Exp $   */
+
+/*-
+ * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "progress.h"
+
+static const char * const suffixes[] = {
+   "", /* 2^0  (byte) */
+   "KiB",  /* 2^10 Kibibyte */
+   "MiB",  /* 2^20 Mebibyte */
+   "GiB",  /* 2^30 Gibibyte */
+   "TiB",  /* 2^40 Tebibyte */
+   "PiB",  /* 2^50 Pebibyte */
+   "EiB",  /* 2^60 Exbibyte */
+};
+
+#define NSUFFIXES  (sizeof(suffixes) / sizeof(suffixes[0]))
+#define SECSPERHOUR(60 * 60)
+#define DEFAULT_TTYWIDTH   80
+
+/* initialise progress meter structure */
+int
+progress_init(progress_t *prog, const char *prefix, uint64_t total)
+{
+struct winsize winsize;
+intoerrno = errno;
+
+   (void) memset(prog, 0x0, sizeof(*prog));
+   prog->size = total;
+   prog->prefix = strdup(prefix);
+   prog->start = time(NULL);
+if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) != -1 &&
+winsize.ws_col != 0) {
+prog->ttywidth = winsize.ws_col;
+} else {
+prog->ttywidth = DEFAULT_TTYWIDTH;
+   }
+errno = oerrno;
+   return 1;
+}
+
+/* update the values in the progress meter */
+int
+progress_update(progress_t *prog, uint64_t done)
+{
+   prog->done = done;
+   prog->percent = (prog->done * 100) / prog->size;
+   prog->now = time(NULL);
+   prog->elapsed = prog->now - prog->start;
+   if (done == 0 || prog->elapsed == 0 || prog->done / prog->elapsed == 0) 
{
+   prog->eta = 0;
+   } else {
+   prog->eta = prog->size / (prog->done / prog->elapsed) - 
prog->elapsed;
+   }
+   return 1;
+}
+
+/* update the values in the progress meter */
+int
+progress_reset_size(progress_t *prog, uint64_t size)
+{
+   prog->size = size;
+   return 1;
+}
+
+/* make it look pretty at the end - display done bytes (usually total) */
+int
+progress_complete(progress_t *prog, uint64_t done)
+{
+   progress_update(prog, done);
+   progress_draw(prog);
+   printf("\n");
+   return 1;
+}
+
+/* draw the progress meter */
+int
+progress_draw(progress_t *prog)
+{
+#defineBAROVERHEAD 45  /* non `*' portion of progress 
bar */
+   /*
+* stars should contain at least
+* sizeof(buf) - BAROVERHEAD entries
+*/
+   static const char   stars[] =
+"*"
+"***

svn commit: r237286 - head/lib/libc/gen

2012-06-19 Thread Eitan Adler
Author: eadler
Date: Wed Jun 20 06:38:41 2012
New Revision: 237286
URL: http://svn.freebsd.org/changeset/base/237286

Log:
  Don't close an uninitialized descriptor. [1]
  Add a sanity check for the validity of the passed fd.
  
  PR:   kern/139080 [1]
  Submitted by: Andrey Simonenko  [1]
  Reviewed by:  pjd (briefly)
  Approved by:  cperciva
  MFC after:1 week

Modified:
  head/lib/libc/gen/syslog.c

Modified: head/lib/libc/gen/syslog.c
==
--- head/lib/libc/gen/syslog.c  Wed Jun 20 04:11:34 2012(r237285)
+++ head/lib/libc/gen/syslog.c  Wed Jun 20 06:38:41 2012(r237286)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -413,8 +414,11 @@ void
 closelog(void)
 {
THREAD_LOCK();
-   (void)_close(LogFile);
-   LogFile = -1;
+   assert(LogFile >= -1);
+   if (LogFile != -1) {
+   (void)_close(LogFile);
+   LogFile = -1;
+   }
LogTag = NULL;
status = NOCONN;
THREAD_UNLOCK();
___
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"