svn commit: r316125 - head/contrib/libpcap

2017-03-28 Thread Xin LI
Author: delphij
Date: Wed Mar 29 03:36:26 2017
New Revision: 316125
URL: https://svnweb.freebsd.org/changeset/base/316125

Log:
  MFV r316124: Fix build when WITHOUT_INET6.
  
  Reported by:  Randy Westlund 
  MFC after:3 days

Modified:
  head/contrib/libpcap/gencode.c
Directory Properties:
  head/contrib/libpcap/   (props changed)

Modified: head/contrib/libpcap/gencode.c
==
--- head/contrib/libpcap/gencode.c  Wed Mar 29 03:28:09 2017
(r316124)
+++ head/contrib/libpcap/gencode.c  Wed Mar 29 03:36:26 2017
(r316125)
@@ -525,7 +525,8 @@ static struct block *gen_host6(compiler_
 struct in6_addr *, int, int, int);
 #endif
 #ifndef INET6
-static struct block *gen_gateway(const u_char *, bpf_u_int32 **, int, int);
+static struct block *gen_gateway(compiler_state_t *, const u_char *,
+bpf_u_int32 **, int, int);
 #endif
 static struct block *gen_ipfrag(compiler_state_t *);
 static struct block *gen_portatom(compiler_state_t *, int, bpf_int32);
@@ -692,7 +693,9 @@ pcap_compile(pcap_t *p, struct bpf_progr
}
initchunks();
cstate.no_optimize = 0;
+#ifdef INET6
cstate.ai = NULL;
+#endif
cstate.ic.root = NULL;
cstate.ic.cur_mark = 0;
cstate.bpf_pcap = p;
@@ -4904,11 +4907,8 @@ gen_host6(compiler_state_t *cstate, stru
 
 #ifndef INET6
 static struct block *
-gen_gateway(eaddr, alist, proto, dir)
-   const u_char *eaddr;
-   bpf_u_int32 **alist;
-   int proto;
-   int dir;
+gen_gateway(compiler_state_t *cstate, const u_char *eaddr, bpf_u_int32 **alist,
+int proto, int dir)
 {
struct block *b0, *b1, *tmp;
 
@@ -6472,7 +6472,7 @@ gen_scode(compiler_state_t *cstate, cons
alist = pcap_nametoaddr(name);
if (alist == NULL || *alist == NULL)
bpf_error(cstate, "unknown host '%s'", name);
-   b = gen_gateway(eaddr, alist, proto, dir);
+   b = gen_gateway(cstate, eaddr, alist, proto, dir);
free(eaddr);
return b;
 #else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316124 - vendor/libpcap/dist

2017-03-28 Thread Xin LI
Author: delphij
Date: Wed Mar 29 03:28:09 2017
New Revision: 316124
URL: https://svnweb.freebsd.org/changeset/base/316124

Log:
  Apply vendor revision 470df104c6f55f6d6f390df7448d8eb65c7642b9:
  
  From: Guy Harris 
  Subject: [PATCH] Fix compilation if INET6 isn't defined.
  
  Addresses GitHub issue #541, but differently from the pull request (it
  defines gen_gateway() with a function prototype rather than using a
  pre-prototype-style definition).

Modified:
  vendor/libpcap/dist/gencode.c

Modified: vendor/libpcap/dist/gencode.c
==
--- vendor/libpcap/dist/gencode.c   Wed Mar 29 02:21:05 2017
(r316123)
+++ vendor/libpcap/dist/gencode.c   Wed Mar 29 03:28:09 2017
(r316124)
@@ -523,7 +523,8 @@ static struct block *gen_host6(compiler_
 struct in6_addr *, int, int, int);
 #endif
 #ifndef INET6
-static struct block *gen_gateway(const u_char *, bpf_u_int32 **, int, int);
+static struct block *gen_gateway(compiler_state_t *, const u_char *,
+bpf_u_int32 **, int, int);
 #endif
 static struct block *gen_ipfrag(compiler_state_t *);
 static struct block *gen_portatom(compiler_state_t *, int, bpf_int32);
@@ -690,7 +691,9 @@ pcap_compile(pcap_t *p, struct bpf_progr
}
initchunks();
cstate.no_optimize = 0;
+#ifdef INET6
cstate.ai = NULL;
+#endif
cstate.ic.root = NULL;
cstate.ic.cur_mark = 0;
cstate.bpf_pcap = p;
@@ -4902,11 +4905,8 @@ gen_host6(compiler_state_t *cstate, stru
 
 #ifndef INET6
 static struct block *
-gen_gateway(eaddr, alist, proto, dir)
-   const u_char *eaddr;
-   bpf_u_int32 **alist;
-   int proto;
-   int dir;
+gen_gateway(compiler_state_t *cstate, const u_char *eaddr, bpf_u_int32 **alist,
+int proto, int dir)
 {
struct block *b0, *b1, *tmp;
 
@@ -6470,7 +6470,7 @@ gen_scode(compiler_state_t *cstate, cons
alist = pcap_nametoaddr(name);
if (alist == NULL || *alist == NULL)
bpf_error(cstate, "unknown host '%s'", name);
-   b = gen_gateway(eaddr, alist, proto, dir);
+   b = gen_gateway(cstate, eaddr, alist, proto, dir);
free(eaddr);
return b;
 #else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316123 - in stable/10/sys/dev/cxgbe: . iw_cxgbe

2017-03-28 Thread Navdeep Parhar
Author: np
Date: Wed Mar 29 02:21:05 2017
New Revision: 316123
URL: https://svnweb.freebsd.org/changeset/base/316123

Log:
  MFC r315201, r315920, r315921, r315922, r316008, and r316062.
  
  r315201:
  cxgbe(4):  Fix an always-true assertion (reported by PVS-Studio).
  
  sys/dev/cxgbe/t4_main.c: PVS-Studio: Expression is Always True (CWE-571) (3)
  
  r315920:
  cxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.
  
  r315921:
  
  cxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
  alloc_ep.
  
  r315922:
  cxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
  FreeBSD) cannot fail.
  
  r316008:
  cxgbe/iw_cxgbe: Remove unused code.
  
  r316062:
  cxgbe/iw_cxgbe: Defer the handling of error CQEs and RDMA_TERMINATE to
  the thread that deals with socket state changes.  This eliminates
  various bad races with the ithread.

Modified:
  stable/10/sys/dev/cxgbe/iw_cxgbe/cm.c
  stable/10/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
  stable/10/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- stable/10/sys/dev/cxgbe/iw_cxgbe/cm.c   Wed Mar 29 02:20:07 2017
(r316122)
+++ stable/10/sys/dev/cxgbe/iw_cxgbe/cm.c   Wed Mar 29 02:21:05 2017
(r316123)
@@ -74,20 +74,19 @@ static spinlock_t req_lock;
 static TAILQ_HEAD(c4iw_ep_list, c4iw_ep_common) req_list;
 static struct work_struct c4iw_task;
 static struct workqueue_struct *c4iw_taskq;
-static LIST_HEAD(timeout_list);
-static spinlock_t timeout_lock;
+static LIST_HEAD(err_cqe_list);
+static spinlock_t err_cqe_lock;
 
 static void process_req(struct work_struct *ctx);
 static void start_ep_timer(struct c4iw_ep *ep);
 static int stop_ep_timer(struct c4iw_ep *ep);
 static int set_tcpinfo(struct c4iw_ep *ep);
 static void process_timeout(struct c4iw_ep *ep);
-static void process_timedout_eps(void);
+static void process_err_cqes(void);
 static enum c4iw_ep_state state_read(struct c4iw_ep_common *epc);
 static void __state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state 
tostate);
 static void state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state tostate);
 static void *alloc_ep(int size, gfp_t flags);
-void __free_ep(struct c4iw_ep_common *epc);
 static struct rtentry * find_route(__be32 local_ip, __be32 peer_ip, __be16 
local_port,
__be16 peer_port, u8 tos);
 static void close_socket(struct socket *so);
@@ -114,7 +113,10 @@ static void process_connected(struct c4i
 static int c4iw_so_upcall(struct socket *so, void *arg, int waitflag);
 static void process_socket_event(struct c4iw_ep *ep);
 static void release_ep_resources(struct c4iw_ep *ep);
-
+static int process_terminate(struct c4iw_ep *ep);
+static int terminate(struct sge_iq *iq, const struct rss_header *rss,
+struct mbuf *m);
+static int add_ep_to_req_list(struct c4iw_ep *ep, int ep_events);
 #define START_EP_TIMER(ep) \
 do { \
CTR3(KTR_IW_CXGBE, "start_ep_timer (%s:%d) ep %p", \
@@ -223,22 +225,32 @@ static void process_timeout(struct c4iw_
return;
 }
 
-static void process_timedout_eps(void)
+struct cqe_list_entry {
+   struct list_head entry;
+   struct c4iw_dev *rhp;
+   struct t4_cqe err_cqe;
+};
+
+static void
+process_err_cqes(void)
 {
-   struct c4iw_ep *ep;
+   unsigned long flag;
+   struct cqe_list_entry *cle;
 
-   spin_lock(_lock);
-   while (!list_empty(_list)) {
+   spin_lock_irqsave(_cqe_lock, flag);
+   while (!list_empty(_cqe_list)) {
struct list_head *tmp;
-   tmp = timeout_list.next;
+   tmp = err_cqe_list.next;
list_del(tmp);
tmp->next = tmp->prev = NULL;
-   spin_unlock(_lock);
-   ep = list_entry(tmp, struct c4iw_ep, entry);
-   process_timeout(ep);
-   spin_lock(_lock);
+   spin_unlock_irqrestore(_cqe_lock, flag);
+   cle = list_entry(tmp, struct cqe_list_entry, entry);
+   c4iw_ev_dispatch(cle->rhp, >err_cqe);
+   free(cle, M_CXGBE);
+   spin_lock_irqsave(_cqe_lock, flag);
}
-   spin_unlock(_lock);
+   spin_unlock_irqrestore(_cqe_lock, flag);
+
return;
 }
 
@@ -246,23 +258,31 @@ static void
 process_req(struct work_struct *ctx)
 {
struct c4iw_ep_common *epc;
+   unsigned long flag;
+   int ep_events;
 
-   process_timedout_eps();
-   spin_lock(_lock);
+   process_err_cqes();
+   spin_lock_irqsave(_lock, flag);
while (!TAILQ_EMPTY(_list)) {
epc = TAILQ_FIRST(_list);
TAILQ_REMOVE(_list, epc, entry);
epc->entry.tqe_prev = NULL;
-   spin_unlock(_lock);
-   CTR3(KTR_IW_CXGBE, "%s so :%p, ep:%p", __func__,
-   epc->so, epc);
-

svn commit: r316122 - in stable/11/sys/dev/cxgbe: . iw_cxgbe

2017-03-28 Thread Navdeep Parhar
Author: np
Date: Wed Mar 29 02:20:07 2017
New Revision: 316122
URL: https://svnweb.freebsd.org/changeset/base/316122

Log:
  MFC r315201, r315920, r315921, r315922, r316008, and r316062.
  
  r315201:
  cxgbe(4):  Fix an always-true assertion (reported by PVS-Studio).
  
  sys/dev/cxgbe/t4_main.c: PVS-Studio: Expression is Always True (CWE-571) (3)
  
  r315920:
  cxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.
  
  r315921:
  
  cxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
  alloc_ep.
  
  r315922:
  cxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
  FreeBSD) cannot fail.
  
  r316008:
  cxgbe/iw_cxgbe: Remove unused code.
  
  r316062:
  cxgbe/iw_cxgbe: Defer the handling of error CQEs and RDMA_TERMINATE to
  the thread that deals with socket state changes.  This eliminates
  various bad races with the ithread.

Modified:
  stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c
  stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
  stable/11/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c   Wed Mar 29 01:32:34 2017
(r316121)
+++ stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c   Wed Mar 29 02:20:07 2017
(r316122)
@@ -76,20 +76,19 @@ static spinlock_t req_lock;
 static TAILQ_HEAD(c4iw_ep_list, c4iw_ep_common) req_list;
 static struct work_struct c4iw_task;
 static struct workqueue_struct *c4iw_taskq;
-static LIST_HEAD(timeout_list);
-static spinlock_t timeout_lock;
+static LIST_HEAD(err_cqe_list);
+static spinlock_t err_cqe_lock;
 
 static void process_req(struct work_struct *ctx);
 static void start_ep_timer(struct c4iw_ep *ep);
 static int stop_ep_timer(struct c4iw_ep *ep);
 static int set_tcpinfo(struct c4iw_ep *ep);
 static void process_timeout(struct c4iw_ep *ep);
-static void process_timedout_eps(void);
+static void process_err_cqes(void);
 static enum c4iw_ep_state state_read(struct c4iw_ep_common *epc);
 static void __state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state 
tostate);
 static void state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state tostate);
 static void *alloc_ep(int size, gfp_t flags);
-void __free_ep(struct c4iw_ep_common *epc);
 static int find_route(__be32 local_ip, __be32 peer_ip, __be16 local_port,
__be16 peer_port, u8 tos, struct nhop4_extended *pnh4);
 static void close_socket(struct socket *so);
@@ -116,7 +115,10 @@ static void process_connected(struct c4i
 static int c4iw_so_upcall(struct socket *so, void *arg, int waitflag);
 static void process_socket_event(struct c4iw_ep *ep);
 static void release_ep_resources(struct c4iw_ep *ep);
-
+static int process_terminate(struct c4iw_ep *ep);
+static int terminate(struct sge_iq *iq, const struct rss_header *rss,
+struct mbuf *m);
+static int add_ep_to_req_list(struct c4iw_ep *ep, int ep_events);
 #define START_EP_TIMER(ep) \
 do { \
CTR3(KTR_IW_CXGBE, "start_ep_timer (%s:%d) ep %p", \
@@ -225,22 +227,32 @@ static void process_timeout(struct c4iw_
return;
 }
 
-static void process_timedout_eps(void)
+struct cqe_list_entry {
+   struct list_head entry;
+   struct c4iw_dev *rhp;
+   struct t4_cqe err_cqe;
+};
+
+static void
+process_err_cqes(void)
 {
-   struct c4iw_ep *ep;
+   unsigned long flag;
+   struct cqe_list_entry *cle;
 
-   spin_lock(_lock);
-   while (!list_empty(_list)) {
+   spin_lock_irqsave(_cqe_lock, flag);
+   while (!list_empty(_cqe_list)) {
struct list_head *tmp;
-   tmp = timeout_list.next;
+   tmp = err_cqe_list.next;
list_del(tmp);
tmp->next = tmp->prev = NULL;
-   spin_unlock(_lock);
-   ep = list_entry(tmp, struct c4iw_ep, entry);
-   process_timeout(ep);
-   spin_lock(_lock);
+   spin_unlock_irqrestore(_cqe_lock, flag);
+   cle = list_entry(tmp, struct cqe_list_entry, entry);
+   c4iw_ev_dispatch(cle->rhp, >err_cqe);
+   free(cle, M_CXGBE);
+   spin_lock_irqsave(_cqe_lock, flag);
}
-   spin_unlock(_lock);
+   spin_unlock_irqrestore(_cqe_lock, flag);
+
return;
 }
 
@@ -248,23 +260,31 @@ static void
 process_req(struct work_struct *ctx)
 {
struct c4iw_ep_common *epc;
+   unsigned long flag;
+   int ep_events;
 
-   process_timedout_eps();
-   spin_lock(_lock);
+   process_err_cqes();
+   spin_lock_irqsave(_lock, flag);
while (!TAILQ_EMPTY(_list)) {
epc = TAILQ_FIRST(_list);
TAILQ_REMOVE(_list, epc, entry);
epc->entry.tqe_prev = NULL;
-   spin_unlock(_lock);
-   CTR3(KTR_IW_CXGBE, "%s so :%p, ep:%p", __func__,
-   

svn commit: r316121 - stable/10/etc

2017-03-28 Thread Cy Schubert
Author: cy
Date: Wed Mar 29 01:32:34 2017
New Revision: 316121
URL: https://svnweb.freebsd.org/changeset/base/316121

Log:
  MFC r311103 (ian):
  
  Update ntp.conf to use the ntpd pool feature.
  
  Our previous ntp.conf file configured 3 servers from freebsd.pool.ntp.org
  using 3 separate 'server' config lines.  That is now replaced with a single
  'pool' line which causes ntpd to add multiple servers from the pool.
  
  More than just making the config smaller, the pool feature in ntpd has one
  major advantage over configuring 3 separate servers from a pool: if a server
  that was added using a 'pool' statement provides bad time (initially or at
  some later date), ntpd automatically discards it and configures a new
  different server from the pool without needing to be restarted.
  
  These changes also add a 'tos' line to control how many pool servers get
  added, a 'restrict source' line that is required to allow ntpd to add new
  peers from the pool, and it deletes a 'restrict 127.127.1.0' line that does
  nothing and should never have been there (127.127.1.0 is not a valid IP
  address, it's a refclock identifier).
  
  Reviewed by:  cy
  MFC requested by: ache
  Differential Revision:  https://reviews.freebsd.org/D9011

Modified:
  stable/10/etc/ntp.conf
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/ntp.conf
==
--- stable/10/etc/ntp.conf  Wed Mar 29 01:21:48 2017(r316120)
+++ stable/10/etc/ntp.conf  Wed Mar 29 01:32:34 2017(r316121)
@@ -11,28 +11,43 @@
 #
 
 #
-# The following three servers will give you a random set of three
-# NTP servers geographically close to you.
-# See http://www.pool.ntp.org/ for details. Note, the pool encourages
+# Set the target and limit for adding servers configured via pool statements
+# or discovered dynamically via mechanisms such as broadcast and manycast.
+# Ntpd automatically adds maxclock-1 servers from configured pools, and may
+# add as many as maxclock*2 if necessary to ensure that at least minclock 
+# servers are providing good consistant time.
+#
+tos minclock 3 maxclock 6
+
+#
+# The following pool statement will give you a random set of NTP servers
+# geographically close to you.  A single pool statement adds multiple
+# servers from the pool, according to the tos minclock/maxclock targets.
+# See http://www.pool.ntp.org/ for details.  Note, pool.ntp.org encourages
 # users with a static IP and good upstream NTP servers to add a server
 # to the pool. See http://www.pool.ntp.org/join.html if you are interested.
 #
 # The option `iburst' is used for faster initial synchronization.
 #
-server 0.freebsd.pool.ntp.org iburst
-server 1.freebsd.pool.ntp.org iburst
-server 2.freebsd.pool.ntp.org iburst
-#server 3.freebsd.pool.ntp.org iburst
+pool 0.freebsd.pool.ntp.org iburst
 
 #
 # If you want to pick yourself which country's public NTP server
-# you want sync against, comment out the above servers, uncomment
-# the next ones and replace CC with the country's abbreviation.
-# Make sure that the hostnames resolve to a proper IP address!
-#
-# server 0.CC.pool.ntp.org iburst
-# server 1.CC.pool.ntp.org iburst
-# server 2.CC.pool.ntp.org iburst
+# you want to sync against, comment out the above pool, uncomment
+# the next one, and replace CC with the country's abbreviation.
+# Make sure that the hostname resolves to a proper IP address!
+#
+# pool 0.CC.pool.ntp.org iburst
+
+#
+# To configure a specific server, such as an organization-wide local
+# server, add lines similar to the following.  One or more specific
+# servers can be configured in addition to, or instead of, any server
+# pools specified above.  When both are configured, ntpd first adds all
+# the specific servers, then adds servers from the pool until the tos
+# minclock/maxclock targets are met.
+#
+#server time.my-internal.org iburst
 
 #
 # Security:
@@ -40,11 +55,17 @@ server 2.freebsd.pool.ntp.org iburst
 # By default, only allow time queries and block all other requests
 # from unauthenticated clients.
 #
+# The "restrict source" line allows peers to be mobilized when added by
+# ntpd from a pool, but does not enable mobilizing a new peer association
+# by other dynamic means (broadcast, manycast, ntpq commands, etc).
+#
 # See http://support.ntp.org/bin/view/Support/AccessRestrictions
 # for more information.
 #
-restrict default limited kod nomodify notrap nopeer noquery
-restrict -6 default limited kod nomodify notrap nopeer noquery
+restrictdefault limited kod nomodify notrap noquery nopeer
+restrict -6 default limited kod nomodify notrap noquery nopeer
+restrictsource  limited kod nomodify notrap noquery
+
 #
 # Alternatively, the following rules would block all unauthorized access.
 #
@@ -65,7 +86,6 @@ restrict -6 default limited kod nomodify
 # The following settings allow unrestricted access from the localhost
 restrict 127.0.0.1
 

svn commit: r316120 - in stable/11: share/man/man9 sys/kern sys/sys

2017-03-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Mar 29 01:21:48 2017
New Revision: 316120
URL: https://svnweb.freebsd.org/changeset/base/316120

Log:
  MFC r315280 r315287
  
  When the RTC is adjusted, reevaluate absolute sleep times based on the RTC
  
  POSIX 2008 says this about clock_settime(2):
  
  If the value of the CLOCK_REALTIME clock is set via clock_settime(),
  the new value of the clock shall be used to determine the time
  of expiration for absolute time services based upon the
  CLOCK_REALTIME clock.  This applies to the time at which armed
  absolute timers expire.  If the absolute time requested at the
  invocation of such a time service is before the new value of
  the clock, the time service shall expire immediately as if the
  clock had reached the requested time normally.
  
  Setting the value of the CLOCK_REALTIME clock via clock_settime()
  shall have no effect on threads that are blocked waiting for
  a relative time service based upon this clock, including the
  nanosleep() function; nor on the expiration of relative timers
  based upon this clock.  Consequently, these time services shall
  expire when the requested relative interval elapses, independently
  of the new or old value of the clock.
  
  When the real-time clock is adjusted, such as by clock_settime(3),
  wake any threads sleeping until an absolute real-clock time.
  Such a sleep is indicated by a non-zero td_rtcgen.  The sleep functions
  will set that field to zero and return zero to tell the caller
  to reevaluate its sleep duration based on the new value of the clock.
  
  At present, this affects the following functions:
  
  pthread_cond_timedwait(3)
  pthread_mutex_timedlock(3)
  pthread_rwlock_timedrdlock(3)
  pthread_rwlock_timedwrlock(3)
  sem_timedwait(3)
  sem_clockwait_np(3)
  
  I'm working on adding clock_nanosleep(2), which will also be affected.
  
  Reported by:  Sebastian Huber 
  Relnotes: yes
  Sponsored by: Dell EMC

Modified:
  stable/11/share/man/man9/sleep.9
  stable/11/sys/kern/kern_tc.c
  stable/11/sys/kern/kern_umtx.c
  stable/11/sys/kern/subr_sleepqueue.c
  stable/11/sys/sys/proc.h
  stable/11/sys/sys/sleepqueue.h
  stable/11/sys/sys/time.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/sleep.9
==
--- stable/11/share/man/man9/sleep.9Tue Mar 28 23:56:02 2017
(r316119)
+++ stable/11/share/man/man9/sleep.9Wed Mar 29 01:21:48 2017
(r316120)
@@ -280,6 +280,21 @@ to
 pay particular attention to ensure that no other threads wait on the
 same
 .Fa chan .
+.Pp
+If the timeout given by
+.Fa timo
+or
+.Fa sbt
+is based on an absolute real-time clock value,
+then the thread should copy the global
+.Va rtc_generation
+into its
+.Va td_rtcgen
+member before reading the RTC.
+If the real-time clock is adjusted, these functions will set
+.Va td_rtcgen
+to zero and return zero.
+The caller should reconsider its orientation with the new RTC value.
 .Sh RETURN VALUES
 When awakened by a call to
 .Fn wakeup
@@ -298,6 +313,9 @@ the
 .Fn msleep_spin ,
 .Fn tsleep ,
 and locking primitive sleep functions return 0.
+Zero can also be returned when the real-time clock is adjusted;
+see above regarding
+.Va td_rtcgen .
 Otherwise, a non-zero error code is returned.
 .Sh ERRORS
 .Fn msleep ,

Modified: stable/11/sys/kern/kern_tc.c
==
--- stable/11/sys/kern/kern_tc.cTue Mar 28 23:56:02 2017
(r316119)
+++ stable/11/sys/kern/kern_tc.cWed Mar 29 01:21:48 2017
(r316120)
@@ -28,7 +28,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -128,6 +130,8 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO,
 sysctl_kern_timecounter_adjprecision, "I",
 "Allowed time interval deviation in percents");
 
+volatile int rtc_generation = 1;
+
 static int tc_chosen;  /* Non-zero if a specific tc was chosen via sysctl. */
 
 static void tc_windup(struct bintime *new_boottimebin);
@@ -1263,6 +1267,26 @@ tc_getfrequency(void)
return (timehands->th_counter->tc_frequency);
 }
 
+static bool
+sleeping_on_old_rtc(struct thread *td)
+{
+
+   /*
+* td_rtcgen is modified by curthread when it is running,
+* and by other threads in this function.  By finding the thread
+* on a sleepqueue and holding the lock on the sleepqueue
+* chain, we guarantee that the thread is not running and that
+* modifying td_rtcgen is safe.  Setting td_rtcgen to zero informs
+* the thread that it was woken due to a real-time clock adjustment.
+* (The declaration of td_rtcgen refers to this comment.)
+*/
+   if (td->td_rtcgen != 0 && td->td_rtcgen != rtc_generation) {

svn commit: r316119 - in head/sys/boot: arm/uboot efi/boot1 efi/loader

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 23:56:02 2017
New Revision: 316119
URL: https://svnweb.freebsd.org/changeset/base/316119

Log:
  self_reloc.c: Pass -Wno-error=maybe-uninitialized to gcc versions greater 
than 4.2.1
  
  self_reloc.c doesn't initialize `rel` in all cases in the C code, however, 
the value
  might be initialized properly on the stack in the assembly code.
  
  For right now (because this doesn't seem to be breaking anything and my 
initializing
  the stack value could break something since it's called from assembly code) 
disable
  the warning for self_reloc.c. More investigation should be done to determine 
the
  appropriate response to this warning (either intialize the value or find a 
smarter
  way to deal with the warning).
  
  A long MFC timeout is being set for this change to allow a better solution 
for the
  issue to be developed in that time period.
  
  MFC after:2 months
  Reported by:  Jenkins (FreeBSD-head-amd64-gcc job)
  Tested with:  amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/efi/boot1/Makefile
  head/sys/boot/efi/loader/Makefile

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileTue Mar 28 23:39:11 2017
(r316118)
+++ head/sys/boot/arm/uboot/MakefileTue Mar 28 23:56:02 2017
(r316119)
@@ -15,6 +15,10 @@ UBLDR_LOADADDR?= 0x100
 # Architecture-specific loader code
 SRCS=  start.S conf.c self_reloc.c vers.c
 
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
+CWARNFLAGS.self_reloc.c+=  -Wno-error=maybe-uninitialized
+.endif
+
 .if !defined(LOADER_NO_DISK_SUPPORT)
 LOADER_DISK_SUPPORT?=  yes
 .else

Modified: head/sys/boot/efi/boot1/Makefile
==
--- head/sys/boot/efi/boot1/MakefileTue Mar 28 23:39:11 2017
(r316118)
+++ head/sys/boot/efi/boot1/MakefileTue Mar 28 23:56:02 2017
(r316119)
@@ -37,6 +37,10 @@ CFLAGS+= -DSKEIN_LOOP=111
 .PATH: ${.CURDIR}/../../../crypto/skein
 .endif
 
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
+CWARNFLAGS.self_reloc.c+=  -Wno-error=maybe-uninitialized
+.endif
+
 CFLAGS+=   -I.
 CFLAGS+=   -I${.CURDIR}/../include
 CFLAGS+=   -I${.CURDIR}/../include/${MACHINE}

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Tue Mar 28 23:39:11 2017
(r316118)
+++ head/sys/boot/efi/loader/Makefile   Tue Mar 28 23:56:02 2017
(r316119)
@@ -35,6 +35,10 @@ CWARNFLAGS.zfs.c+=   -Wno-array-bounds
 CWARNFLAGS.zfs.c+= -Wno-missing-prototypes
 .endif
 
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
+CWARNFLAGS.self_reloc.c+=  -Wno-error=maybe-uninitialized
+.endif
+
 # We implement a slightly non-standard %S in that it always takes a
 # CHAR16 that's common in UEFI-land instead of a wchar_t. This only
 # seems to matter on arm64 where wchar_t defaults to an int instead
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316118 - head/sys/dev/cxgbe/iw_cxgbe

2017-03-28 Thread Navdeep Parhar
Author: np
Date: Tue Mar 28 23:39:11 2017
New Revision: 316118
URL: https://svnweb.freebsd.org/changeset/base/316118

Log:
  cxgbe/iw_cxgbe: T6 has no limit on the amount of memory that can be
  registered in one ib_reg_phys_mr.

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/mem.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/mem.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/mem.c   Tue Mar 28 23:02:41 2017
(r316117)
+++ head/sys/dev/cxgbe/iw_cxgbe/mem.c   Tue Mar 28 23:39:11 2017
(r316118)
@@ -47,11 +47,14 @@ __FBSDID("$FreeBSD$");
 #define C4IW_MAX_INLINE_SIZE 96
 
 static int
-mr_exceeds_hw_limits(struct c4iw_dev *dev __unused, u64 length)
+mr_exceeds_hw_limits(struct c4iw_dev *dev, u64 length)
 {
 
-   return (length >= 8*1024*1024*1024ULL);
+   return ((is_t4(dev->rdev.adap) ||
+   is_t5(dev->rdev.adap)) &&
+   length >= 8*1024*1024*1024ULL);
 }
+
 static int
 write_adapter_mem(struct c4iw_rdev *rdev, u32 addr, u32 len, void *data)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316117 - head/sys/cam/ata

2017-03-28 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Tue Mar 28 23:02:41 2017
New Revision: 316117
URL: https://svnweb.freebsd.org/changeset/base/316117

Log:
  In r289137 the legacy_aliases compatibility shims for ata were removed,
  also remove a leftover define used for implementing them.
  
  Reviewed by:  mav
  Differential Revision:https://reviews.freebsd.org/D6726

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Tue Mar 28 22:40:51 2017(r316116)
+++ head/sys/cam/ata/ata_da.c   Tue Mar 28 23:02:41 2017(r316117)
@@ -774,10 +774,6 @@ static voidadashutdown(void *arg, int 
 static voidadasuspend(void *arg);
 static voidadaresume(void *arg);
 
-#ifndefADA_DEFAULT_LEGACY_ALIASES
-#defineADA_DEFAULT_LEGACY_ALIASES  1
-#endif
-
 #ifndef ADA_DEFAULT_TIMEOUT
 #define ADA_DEFAULT_TIMEOUT 30 /* Timeout in seconds */
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316116 - head/sys/dev/iwn

2017-03-28 Thread Andriy Voskoboinyk
Author: avos
Date: Tue Mar 28 22:40:51 2017
New Revision: 316116
URL: https://svnweb.freebsd.org/changeset/base/316116

Log:
  iwn: remove unneeded cast.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Tue Mar 28 22:32:11 2017(r316115)
+++ head/sys/dev/iwn/if_iwn.c   Tue Mar 28 22:40:51 2017(r316116)
@@ -2994,7 +2994,7 @@ iwn_rx_done(struct iwn_softc *sc, struct
struct iwn_ops *ops = >ops;
struct ieee80211com *ic = >sc_ic;
struct iwn_rx_ring *ring = >rxq;
-   struct ieee80211_frame *wh;
+   struct ieee80211_frame_min *wh;
struct ieee80211_node *ni;
struct mbuf *m, *m1;
struct iwn_rx_stat *stat;
@@ -3096,9 +3096,9 @@ iwn_rx_done(struct iwn_softc *sc, struct
m->m_pkthdr.len = m->m_len = len;
 
/* Grab a reference to the source node. */
-   wh = mtod(m, struct ieee80211_frame *);
+   wh = mtod(m, struct ieee80211_frame_min *);
if (len >= sizeof(struct ieee80211_frame_min))
-   ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min 
*)wh);
+   ni = ieee80211_find_rxnode(ic, wh);
else
ni = NULL;
nf = (ni != NULL && ni->ni_vap->iv_state == IEEE80211_S_RUN &&
@@ -3130,7 +3130,7 @@ iwn_rx_done(struct iwn_softc *sc, struct
if (sc->sc_beacon_wait) {
uint8_t type, subtype;
/* NB: Re-assign wh */
-   wh = mtod(m, struct ieee80211_frame *);
+   wh = mtod(m, struct ieee80211_frame_min *);
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316115 - head/lib/libcam

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 22:32:11 2017
New Revision: 316115
URL: https://svnweb.freebsd.org/changeset/base/316115

Log:
  libcam: use __func__ instead of hardcoding the function name as `func_name`
  
  MFC after:3 days
  Tested with:  `cam_device_copy(NULL, NULL)` // ;)..
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libcam/camlib.c

Modified: head/lib/libcam/camlib.c
==
--- head/lib/libcam/camlib.cTue Mar 28 22:31:48 2017(r316114)
+++ head/lib/libcam/camlib.cTue Mar 28 22:32:11 2017(r316115)
@@ -114,7 +114,6 @@ cam_freeccb(union ccb *ccb)
 int
 cam_get_device(const char *path, char *dev_name, int devnamelen, int *unit)
 {
-   char *func_name = "cam_get_device";
char *tmpstr, *tmpstr2;
char *newpath;
int unit_offset;
@@ -122,7 +121,7 @@ cam_get_device(const char *path, char *d
 
if (path == NULL) {
snprintf(cam_errbuf, sizeof(cam_errbuf),
-   "%s: device pathname was NULL", func_name);
+   "%s: device pathname was NULL", __func__);
return(-1);
}
 
@@ -145,7 +144,7 @@ cam_get_device(const char *path, char *d
 
if (*tmpstr == '\0') {
snprintf(cam_errbuf, sizeof(cam_errbuf),
-   "%s: no text after slash", func_name);
+   "%s: no text after slash", __func__);
free(newpath);
return(-1);
}
@@ -174,7 +173,7 @@ cam_get_device(const char *path, char *d
if (strlen(tmpstr) < 2) {
snprintf(cam_errbuf, sizeof(cam_errbuf),
"%s: must have both device name and unit number",
-   func_name);
+   __func__);
free(newpath);
return(-1);
}
@@ -186,7 +185,7 @@ cam_get_device(const char *path, char *d
if (isdigit(*tmpstr)) {
snprintf(cam_errbuf, sizeof(cam_errbuf),
"%s: device name cannot begin with a number",
-   func_name);
+   __func__);
free(newpath);
return(-1);
}
@@ -198,7 +197,7 @@ cam_get_device(const char *path, char *d
 */
if (!isdigit(tmpstr[strlen(tmpstr) - 1])) {
snprintf(cam_errbuf, sizeof(cam_errbuf),
-   "%s: unable to find device unit number", func_name);
+   "%s: unable to find device unit number", __func__);
free(newpath);
return(-1);
}
@@ -270,13 +269,12 @@ cam_open_btl(path_id_t path_id, target_i
 {
union ccb ccb;
struct periph_match_pattern *match_pat;
-   char *func_name = "cam_open_btl";
int fd, bufsize;
 
if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
snprintf(cam_errbuf, sizeof(cam_errbuf),
-   "%s: couldn't open %s\n%s: %s", func_name, XPT_DEVICE,
-   func_name, strerror(errno));
+   "%s: couldn't open %s\n%s: %s", __func__, XPT_DEVICE,
+   __func__, strerror(errno));
return(NULL);
}
 
@@ -292,7 +290,7 @@ cam_open_btl(path_id_t path_id, target_i
ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize);
if (ccb.cdm.matches == NULL) {
snprintf(cam_errbuf, sizeof(cam_errbuf),
-   "%s: couldn't malloc match buffer", func_name);
+   "%s: couldn't malloc match buffer", __func__);
close(fd);
return(NULL);
}
@@ -305,7 +303,7 @@ cam_open_btl(path_id_t path_id, target_i
sizeof(struct dev_match_pattern));
if (ccb.cdm.patterns == NULL) {
snprintf(cam_errbuf, sizeof(cam_errbuf),
-   "%s: couldn't malloc pattern buffer", func_name);
+   "%s: couldn't malloc pattern buffer", __func__);
free(ccb.cdm.matches);
ccb.cdm.matches = NULL;
close(fd);
@@ -329,7 +327,7 @@ cam_open_btl(path_id_t path_id, target_i
if (ioctl(fd, CAMIOCOMMAND, ) == -1) {
snprintf(cam_errbuf, sizeof(cam_errbuf),
"%s: CAMIOCOMMAND ioctl failed\n"
-   "%s: %s", func_name, func_name, strerror(errno));
+   "%s: %s", __func__, __func__, strerror(errno));
goto btl_bailout;
}
 
@@ -341,7 +339,7 @@ cam_open_btl(path_id_t path_id, target_i
   && (ccb.cdm.status != CAM_DEV_MATCH_MORE))) {
snprintf(cam_errbuf, sizeof(cam_errbuf),
"%s: CAM error %#x, CDM error %d "
-   "returned from XPT_DEV_MATCH ccb", func_name,
+   "returned from XPT_DEV_MATCH ccb", __func__,
ccb.ccb_h.status, ccb.cdm.status);
goto btl_bailout;
}
@@ -350,14 +348,14 @@ 

svn commit: r316114 - head/sys/dev/iwn

2017-03-28 Thread Andriy Voskoboinyk
Author: avos
Date: Tue Mar 28 22:31:48 2017
New Revision: 316114
URL: https://svnweb.freebsd.org/changeset/base/316114

Log:
  iwn: drop duplicate synchronization requests.
  
  Rx descriptor / payload is already synchronized in iwn_notif_intr()
  (before accessing desc->type / desc->qid fields).
  
  Tested with Intel 6205, STA mode.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Tue Mar 28 21:54:36 2017(r316113)
+++ head/sys/dev/iwn/if_iwn.c   Tue Mar 28 22:31:48 2017(r316114)
@@ -196,16 +196,13 @@ static void   iwn_newassoc(struct ieee8021
 static int iwn_media_change(struct ifnet *);
 static int iwn_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static voidiwn_calib_timeout(void *);
-static voidiwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *,
-   struct iwn_rx_data *);
+static voidiwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
-static voidiwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *,
-   struct iwn_rx_data *);
+static voidiwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn5000_rx_calib_results(struct iwn_softc *,
-   struct iwn_rx_desc *, struct iwn_rx_data *);
-static voidiwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *,
-   struct iwn_rx_data *);
+   struct iwn_rx_desc *);
+static voidiwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn4965_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
 static voidiwn5000_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
@@ -2975,13 +2972,11 @@ iwn_calib_timeout(void *arg)
  * followed by an MPDU_RX_DONE notification.
  */
 static void
-iwn_rx_phy(struct iwn_softc *sc, struct iwn_rx_desc *desc,
-struct iwn_rx_data *data)
+iwn_rx_phy(struct iwn_softc *sc, struct iwn_rx_desc *desc)
 {
struct iwn_rx_stat *stat = (struct iwn_rx_stat *)(desc + 1);
 
DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: received PHY stats\n", __func__);
-   bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD);
 
/* Save RX statistics, they will be used on MPDU_RX_DONE. */
memcpy(>last_rx_stat, stat, sizeof (*stat));
@@ -3021,8 +3016,6 @@ iwn_rx_done(struct iwn_softc *sc, struct
} else
stat = (struct iwn_rx_stat *)(desc + 1);
 
-   bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);
-
if (stat->cfg_phy_len > IWN_STAT_MAXLEN) {
device_printf(sc->sc_dev,
"%s: invalid RX statistic header, len %d\n", __func__,
@@ -3176,8 +3169,7 @@ iwn_rx_done(struct iwn_softc *sc, struct
 
 /* Process an incoming Compressed BlockAck. */
 static void
-iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc,
-struct iwn_rx_data *data)
+iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc)
 {
struct ieee80211_ratectl_tx_status *txs = >sc_txs;
struct iwn_ops *ops = >ops;
@@ -3196,8 +3188,6 @@ iwn_rx_compressed_ba(struct iwn_softc *s
 
DPRINTF(sc, IWN_DEBUG_TRACE | IWN_DEBUG_XMIT, "->%s begin\n", __func__);
 
-   bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD);
-
qid = le16toh(ba->qid);
txq = >txq[ba->qid];
tap = sc->qid2tap[ba->qid];
@@ -3282,8 +3272,7 @@ iwn_rx_compressed_ba(struct iwn_softc *s
  * firmware on response to a CMD_CALIB_CONFIG command (5000 only).
  */
 static void
-iwn5000_rx_calib_results(struct iwn_softc *sc, struct iwn_rx_desc *desc,
-struct iwn_rx_data *data)
+iwn5000_rx_calib_results(struct iwn_softc *sc, struct iwn_rx_desc *desc)
 {
struct iwn_phy_calib *calib = (struct iwn_phy_calib *)(desc + 1);
int len, idx = -1;
@@ -3297,7 +3286,6 @@ iwn5000_rx_calib_results(struct iwn_soft
return;
}
len = (le32toh(desc->len) & 0x3fff) - 4;
-   bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD);
 
switch (calib->code) {
case IWN5000_PHY_CALIB_DC:
@@ -3406,8 +3394,7 @@ iwn_stats_update(struct iwn_softc *sc, s
  * The latter is sent by the firmware after each received beacon.
  */
 static void
-iwn_rx_statistics(struct iwn_softc *sc, struct iwn_rx_desc *desc,
-struct iwn_rx_data *data)
+iwn_rx_statistics(struct iwn_softc *sc, struct iwn_rx_desc *desc)
 {
struct iwn_ops *ops = >ops;
struct ieee80211com *ic = >sc_ic;
@@ -3427,8 +3414,6 @@ iwn_rx_statistics(struct iwn_softc *sc, 
return;
}
 
-   bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD);
-
DPRINTF(sc, IWN_DEBUG_CALIBRATE | 

svn commit: r316113 - head/sys/dev/ichsmb

2017-03-28 Thread Gavin Atkinson
Author: gavin
Date: Tue Mar 28 21:54:36 2017
New Revision: 316113
URL: https://svnweb.freebsd.org/changeset/base/316113

Log:
  Remove #define PCIS_SERIALBUS_SMBUS_PROGIF, unused since r200091

Modified:
  head/sys/dev/ichsmb/ichsmb_pci.c

Modified: head/sys/dev/ichsmb/ichsmb_pci.c
==
--- head/sys/dev/ichsmb/ichsmb_pci.cTue Mar 28 21:50:11 2017
(r316112)
+++ head/sys/dev/ichsmb/ichsmb_pci.cTue Mar 28 21:54:36 2017
(r316113)
@@ -95,8 +95,6 @@ __FBSDID("$FreeBSD$");
 #defineID_SRPT 0xa1238086
 #defineID_SRPTLP   0x9d238086
 
-#define PCIS_SERIALBUS_SMBUS_PROGIF0x00
-
 /* Internal functions */
 static int ichsmb_pci_probe(device_t dev);
 static int ichsmb_pci_attach(device_t dev);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316112 - head/sys/boot/common

2017-03-28 Thread Toomas Soome
Author: tsoome
Date: Tue Mar 28 21:50:11 2017
New Revision: 316112
URL: https://svnweb.freebsd.org/changeset/base/316112

Log:
  loader: ls command should display file types properly
  
  With some file system the ls is unable to display file types.
  
  Reviewed by:  allanjude
  Approved by:  allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D10066

Modified:
  head/sys/boot/common/ls.c

Modified: head/sys/boot/common/ls.c
==
--- head/sys/boot/common/ls.c   Tue Mar 28 21:47:12 2017(r316111)
+++ head/sys/boot/common/ls.c   Tue Mar 28 21:50:11 2017(r316112)
@@ -60,26 +60,26 @@ command_ls(int argc, char *argv[])
 {
 intfd;
 struct statsb;
-struct dirent *d;
+struct dirent *d;
 char   *buf, *path;
 char   lbuf[128];  /* one line */
 intresult, ch;
 intverbose;
-   
+
 result = CMD_OK;
 fd = -1;
 verbose = 0;
 optind = 1;
 optreset = 1;
 while ((ch = getopt(argc, argv, "l")) != -1) {
-   switch(ch) {
+   switch (ch) {
case 'l':
verbose = 1;
break;
case '?':
default:
/* getopt has already reported an error */
-   return(CMD_OK);
+   return (CMD_OK);
}
 }
 argv += (optind - 1);
@@ -91,6 +91,18 @@ command_ls(int argc, char *argv[])
path = argv[1];
 }
 
+if (stat(path, ) == 0 && !S_ISDIR(sb.st_mode)) {
+   if (verbose) {
+   printf(" %c %8d %s\n",
+   typestr[sb.st_mode >> 12],
+   (int)sb.st_size, path);
+   } else {
+   printf(" %c  %s\n",
+   typestr[sb.st_mode >> 12], path);
+   }
+   return (CMD_OK);
+}
+
 fd = ls_getdir();
 if (fd == -1) {
result = CMD_ERROR;
@@ -102,19 +114,28 @@ command_ls(int argc, char *argv[])
 
 while ((d = readdirfd(fd)) != NULL) {
if (strcmp(d->d_name, ".") && strcmp(d->d_name, "..")) {
-   if (verbose) {
+   if (d->d_type == 0 || verbose) {
/* stat the file, if possible */
sb.st_size = 0;
+   sb.st_mode = 0;
buf = malloc(strlen(path) + strlen(d->d_name) + 2);
-   sprintf(buf, "%s/%s", path, d->d_name);
-   /* ignore return, could be symlink, etc. */
-   if (stat(buf, ))
-   sb.st_size = 0;
-   free(buf);
-   sprintf(lbuf, " %c %8d %s\n", typestr[d->d_type],
+   if (buf != NULL) {
+   sprintf(buf, "%s/%s", path, d->d_name);
+   /* ignore return, could be symlink, etc. */
+   if (stat(buf, )) {
+   sb.st_size = 0;
+   sb.st_mode = 0;
+   }
+   free(buf);
+   }
+   }
+   if (verbose) {
+   snprintf(lbuf, sizeof(lbuf), " %c %8d %s\n",
+   typestr[d->d_type? d->d_type:sb.st_mode >> 12],
(int)sb.st_size, d->d_name);
} else {
-   sprintf(lbuf, " %c  %s\n", typestr[d->d_type], d->d_name);
+   snprintf(lbuf, sizeof(lbuf), " %c  %s\n",
+   typestr[d->d_type? d->d_type:sb.st_mode >> 12], d->d_name);
}
if (pager_output(lbuf))
goto out;
@@ -124,9 +145,8 @@ command_ls(int argc, char *argv[])
 pager_close();
 if (fd != -1)
close(fd);
-if (path != NULL)
-   free(path);
-return(result);
+free(path);/* ls_getdir() did allocate path */
+return (result);
 }
 
 /*
@@ -145,6 +165,11 @@ ls_getdir(char **pathp)
 
 /* one extra byte for a possible trailing slash required */
 path = malloc(strlen(*pathp) + 2);
+if (path == NULL) {
+   snprintf(command_errbuf, sizeof (command_errbuf),
+   "out of memory");
+   goto out;
+}
 strcpy(path, *pathp);
 
 /* Make sure the path is respectable to begin with */
@@ -153,7 +178,7 @@ ls_getdir(char **pathp)
"bad path '%s'", path);
goto out;
 }
-
+
 /* If there's no path on the device, assume '/' */
 if (*cp == 0)
strcat(path, "/");
@@ -176,12 +201,12 @@ ls_getdir(char **pathp)
 }
 
 *pathp = path;
-return(fd);
+return (fd);
 
  out:
 free(path);
 *pathp = NULL;
 if (fd != -1)
close(fd);
-return(-1);
+return (-1);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316111 - head/sys/boot/i386/libi386

2017-03-28 Thread Toomas Soome
Author: tsoome
Date: Tue Mar 28 21:47:12 2017
New Revision: 316111
URL: https://svnweb.freebsd.org/changeset/base/316111

Log:
  loader: move bios getsecs into time.c
  
  Move the time related function into time.c, keep the same logic as libefi.
  
  Reviewed by:  allanjude
  Approved by:  allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D10058

Modified:
  head/sys/boot/i386/libi386/pxe.c
  head/sys/boot/i386/libi386/time.c

Modified: head/sys/boot/i386/libi386/pxe.c
==
--- head/sys/boot/i386/libi386/pxe.cTue Mar 28 21:39:24 2017
(r316110)
+++ head/sys/boot/i386/libi386/pxe.cTue Mar 28 21:47:12 2017
(r316111)
@@ -621,13 +621,6 @@ bangpxe_call(int func)
v86.ctl  = V86_FLAGS;
 }
 
-time_t
-getsecs(void)
-{
-   time_t n = 0;
-   time();
-   return n;
-}
 
 static int
 pxe_netif_match(struct netif *nif, void *machdep_hint)

Modified: head/sys/boot/i386/libi386/time.c
==
--- head/sys/boot/i386/libi386/time.c   Tue Mar 28 21:39:24 2017
(r316110)
+++ head/sys/boot/i386/libi386/time.c   Tue Mar 28 21:47:12 2017
(r316111)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include "bootstrap.h"
 #include "libi386.h"
 
+time_t getsecs(void);
 static int bios_seconds(void);
 
 /*
@@ -91,6 +92,14 @@ time(time_t *t)
 return(now);
 }
 
+time_t
+getsecs(void)
+{
+   time_t n = 0;
+   time();
+   return n;
+}
+
 /*
  * Use the BIOS Wait function to pause for (period) microseconds.
  *
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316110 - head/sys/boot/efi/boot1

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 21:39:24 2017
New Revision: 316110
URL: https://svnweb.freebsd.org/changeset/base/316110

Log:
  Use `-Wno-missing-declarations` with CWARNFLAGS for skein.c
  
  `-Wno-missing-variable-declarations` is a clang-specific flag,
  so gcc (not 4.2.1, in particular 6.3.0 in my case) dies when
  it's passed the flag.
  
  X-MFC with:   r304321
  Reported by:  amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/efi/boot1/Makefile

Modified: head/sys/boot/efi/boot1/Makefile
==
--- head/sys/boot/efi/boot1/MakefileTue Mar 28 21:35:18 2017
(r316109)
+++ head/sys/boot/efi/boot1/MakefileTue Mar 28 21:39:24 2017
(r316110)
@@ -20,7 +20,11 @@ CWARNFLAGS.zfs_module.c += -Wno-sign-com
 CWARNFLAGS.zfs_module.c += -Wno-unused-parameter
 CWARNFLAGS.zfs_module.c += -Wno-unused-function
 CWARNFLAGS.skein.c += -Wno-cast-align
+.if ${COMPILER_TYPE} == "clang"
 CWARNFLAGS.skein.c += -Wno-missing-variable-declarations
+.else if ${COMPILER_TYPE} == "gcc"
+CWARNFLAGS.skein.c += -Wno-missing-declarations
+.endif
 .endif
 
 # architecture-specific loader code
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316109 - in head/sys/boot: efi/boot1 i386/boot2 i386/zfsboot sparc64/boot1

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 21:35:18 2017
New Revision: 316109
URL: https://svnweb.freebsd.org/changeset/base/316109

Log:
  Don't hardcode input files for stage 1/2 bootloaders; use .ALLSRC instead
  
  This is a better pattern to follow when creating the bootloaders and doing
  the relevant space checks to make sure that the sizes aren't exceeded (and
  thus, copy-pasting is a bit less error prone).
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/efi/boot1/Makefile
  head/sys/boot/i386/boot2/Makefile
  head/sys/boot/i386/zfsboot/Makefile
  head/sys/boot/sparc64/boot1/Makefile

Modified: head/sys/boot/efi/boot1/Makefile
==
--- head/sys/boot/efi/boot1/MakefileTue Mar 28 21:16:11 2017
(r316108)
+++ head/sys/boot/efi/boot1/MakefileTue Mar 28 21:35:18 2017
(r316109)
@@ -114,7 +114,7 @@ boot1.o: ${.CURDIR}/../../common/ufsread
 BOOT1_MAXSIZE?=131072
 
 boot1.efifat: boot1.efi
-   @set -- `ls -l boot1.efi`; \
+   @set -- `ls -l ${.ALLSRC}`; \
x=$$(($$5-${BOOT1_MAXSIZE})); \
if [ $$x -ge 0 ]; then \
echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\
@@ -124,7 +124,7 @@ boot1.efifat: boot1.efi
uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
bzip2 -f -d ${.TARGET}.bz2
-   ${DD} if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
+   ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
 
 CLEANFILES= boot1.efi boot1.efifat
 

Modified: head/sys/boot/i386/boot2/Makefile
==
--- head/sys/boot/i386/boot2/Makefile   Tue Mar 28 21:16:11 2017
(r316108)
+++ head/sys/boot/i386/boot2/Makefile   Tue Mar 28 21:35:18 2017
(r316109)
@@ -67,9 +67,9 @@ CLEANFILES+=  boot2 boot2.ld boot2.ldr bo
boot2.h sio.o
 
 boot2: boot2.ld
-   @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
+   @set -- `ls -l ${.ALLSRC}`; x=$$((7680-$$5)); \
echo "$$x bytes available"; test $$x -ge 0
-   ${DD} if=boot2.ld of=${.TARGET} obs=7680 conv=osync
+   ${DD} if=${.ALLSRC} of=${.TARGET} obs=7680 conv=osync
 
 boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \

Modified: head/sys/boot/i386/zfsboot/Makefile
==
--- head/sys/boot/i386/zfsboot/Makefile Tue Mar 28 21:16:11 2017
(r316108)
+++ head/sys/boot/i386/zfsboot/Makefile Tue Mar 28 21:35:18 2017
(r316109)
@@ -68,9 +68,9 @@ CLEANFILES+=  zfsboot2 zfsboot.ld zfsboot
 BOOT2SIZE= 131072
 
 zfsboot2: zfsboot.ld
-   @set -- `ls -l zfsboot.ld`; x=$$((${BOOT2SIZE}-$$5)); \
+   @set -- `ls -l ${.ALLSRC}`; x=$$((${BOOT2SIZE}-$$5)); \
echo "$$x bytes available"; test $$x -ge 0
-   ${DD} if=zfsboot.ld of=${.TARGET} obs=${BOOT2SIZE} conv=osync
+   ${DD} if=${.ALLSRC} of=${.TARGET} obs=${BOOT2SIZE} conv=osync
 
 zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN}
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \

Modified: head/sys/boot/sparc64/boot1/Makefile
==
--- head/sys/boot/sparc64/boot1/MakefileTue Mar 28 21:16:11 2017
(r316108)
+++ head/sys/boot/sparc64/boot1/MakefileTue Mar 28 21:35:18 2017
(r316109)
@@ -17,10 +17,10 @@ LDFLAGS=-Ttext ${BOOTBLOCKBASE} -Wl,-N
 # Construct boot1. sunlabel expects it to contain zeroed-out space for the
 # label, and to be of the correct size.
 ${FILES}: boot1.aout
-   @set -- `ls -l boot1.aout`; x=$$((7680-$$5)); \
+   @set -- `ls -l ${.ALLSRC}`; x=$$((7680-$$5)); \
echo "$$x bytes available"; test $$x -ge 0
${DD} if=/dev/zero of=${.TARGET} bs=512 count=16
-   ${DD} if=boot1.aout of=${.TARGET} bs=512 oseek=1 conv=notrunc
+   ${DD} if=${.ALLSRC} of=${.TARGET} bs=512 oseek=1 conv=notrunc
 
 boot1.aout: boot1.elf
elf2aout -o ${.TARGET} ${.ALLSRC}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316108 - head/sys/boot/common

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 21:16:11 2017
New Revision: 316108
URL: https://svnweb.freebsd.org/changeset/base/316108

Log:
  Remove -Wunused-but-set variable, `tail` in `ls_getdir(..)`
  
  This variable has been unused since its inception in r40106.
  
  MFC after:3 days
  Reported by:  amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/common/ls.c

Modified: head/sys/boot/common/ls.c
==
--- head/sys/boot/common/ls.c   Tue Mar 28 20:52:59 2017(r316107)
+++ head/sys/boot/common/ls.c   Tue Mar 28 21:16:11 2017(r316108)
@@ -139,9 +139,8 @@ ls_getdir(char **pathp)
 struct statsb;
 intfd;
 const char *cp;
-char   *path, *tail;
+char   *path;
 
-tail = NULL;
 fd = -1;
 
 /* one extra byte for a possible trailing slash required */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r315974 - in head: lib/libthread_db/arch/arm sys/arm/arm sys/arm/include

2017-03-28 Thread John Baldwin
On Tuesday, March 28, 2017 12:20:04 PM Michal Meloun wrote:
> 
> On 27.03.2017 19:40, Warner Losh wrote:
> > On Mon, Mar 27, 2017 at 11:07 AM, John Baldwin  wrote:
> >> On Sunday, March 26, 2017 08:36:56 AM Michal Meloun wrote:
> >>> Author: mmel
> >>> Date: Sun Mar 26 08:36:56 2017
> >>> New Revision: 315974
> >>> URL: https://svnweb.freebsd.org/changeset/base/315974
> >>>
> >>> Log:
> >>>   Preserve VFP state across signal delivery.
> >>>
> >>>   We don't have enouch space to store full VFP context within mcontext
> >>>   stucture. Due to this:
> >>>- follow i386/amd64 way and store VFP state outside of the mcontext_t
> >>>  but point to it. Use the size of VFP state structure as an 'magic'
> >>>  indicator of the saved VFP state presence.
> >>>- teach set_mcontext() about this external storage.
> >>>- for signal delivery, store VFP state to expanded 'struct sigframe'.
> >>>
> >>>   Submited by:Andrew Gierth (initial version)
> >>>   PR: 217611
> >>>   MFC after:  2 weeks
> >>>
> >>> Modified:
> >>>   head/lib/libthread_db/arch/arm/libpthread_md.c
> >>>   head/sys/arm/arm/machdep.c
> >>>   head/sys/arm/include/frame.h
> >>>   head/sys/arm/include/ucontext.h
> >>>
> >>> Modified: head/lib/libthread_db/arch/arm/libpthread_md.c
> >>> ==
> >>> --- head/lib/libthread_db/arch/arm/libpthread_md.cSun Mar 26 08:36:20 
> >>> 2017(r315973)
> >>> +++ head/lib/libthread_db/arch/arm/libpthread_md.cSun Mar 26 08:36:56 
> >>> 2017(r315974)
> >>> @@ -90,7 +90,9 @@ pt_fpreg_to_ucontext(const struct fpreg
> >>>   mcontext_t *mc = >uc_mcontext;
> >>>
> >>>   /* XXX */
> >>> - memset(>mc_spare, 0, sizeof(mc->mc_spare));
> >>> + mc->mc_vfp_size = 0;
> >>> + mc->mc_vfp_ptr = NULL;
> >>> + memset(mc->mc_spare, 0, sizeof(mc->mc_spare));
> >>>  }
> >> I suspect you don't need this bit?  Has FreeBSD/arm ever supported VFP on 
> >> a release
> >> that also shipped libkse?  (i.e. not libthr but the other thread library)
> > No. And even if we had, we blew up binary compat when we went from OABI to 
> > EABI.
> >
> > Warner
> I just wanted to maintain the status quo, nothing more.
> 
> All I know is that none of threading libraries maintains VFP state,
> 'struct fpreg' is badly defined (is to short for fill VFP context), and
> pre r315974 kernel doesn't initialize _vfp (renamed to mc_spare) part
> of mcontext_t.
> 
> So I'm seeking a way how to fix all this. But I'm not familiar with
> kse -> pthread  transition history, so I'm not sure which parts are
> actively used.

The libpthread_md.c files are for the KSE-based libpthread and generally don't
need changing at this point as they are only there to allow old gdb binaries
to debug old binaries using libpthread.  In particular, with the KSE thread
library, a "paused" user thread that wasn't associated with a kernel thread
("LWP") needed it's userland register state saved somewhere until it resumed
execution.  The libpthread bits are for extracting that saved register state
so a debugger can examine a non-running user thread.

Modern gdb in ports doesn't use libthread_db at all, and I think lldb might
not use it either.  (Both just assume that every pthread has an associated
LWP and use ptrace() to query information about LWPs directly).  Note that on
x86 we haven't updated any of the libthread_db stuff to handle newer vector
register extensions like AVX.  That only works via direct ptrace() for example.

It will be good to include VFP info in cores via new core notes (if not done
already) and to provide a way to fetch the register banks from a running thread
via ptrace, but you can generally ignore libthread_db.

At some point gdb in ports might use some small bits of libthread_db to
determine the pthread_t associated with a kernel-enumerated LWP, but that's
about all it would ever be used for at this point.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316107 - head/sys/boot/zfs

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 20:52:59 2017
New Revision: 316107
URL: https://svnweb.freebsd.org/changeset/base/316107

Log:
  Remove redundant declaration for `zfs_crc64_table`
  
  zfssubr.c already defines this statically. Besides, zfsimpl.c defined it, but
  didn't use it.
  
  This fixes a -Wredundant-decls warning.
  
  MFC after:3 days
  Reported by:  amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/zfs/zfsimpl.c

Modified: head/sys/boot/zfs/zfsimpl.c
==
--- head/sys/boot/zfs/zfsimpl.c Tue Mar 28 20:39:24 2017(r316106)
+++ head/sys/boot/zfs/zfsimpl.c Tue Mar 28 20:52:59 2017(r316107)
@@ -68,7 +68,6 @@ static const char *features_for_read[] =
  */
 static spa_list_t zfs_pools;
 
-static uint64_t zfs_crc64_table[256];
 static const dnode_phys_t *dnode_cache_obj = NULL;
 static uint64_t dnode_cache_bn;
 static char *dnode_cache_buf;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316106 - head/sys/boot/zfs

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 20:39:24 2017
New Revision: 316106
URL: https://svnweb.freebsd.org/changeset/base/316106

Log:
  Don't shadow read(2) definition with `read` argument in vdev_{create,probe}
  
  This fixes several -Wshadow warnings introduced in r192194, but now errors
  with gcc 6.3.0.
  
  MFC after:3 days
  Reported by:  amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/zfs/zfsimpl.c

Modified: head/sys/boot/zfs/zfsimpl.c
==
--- head/sys/boot/zfs/zfsimpl.c Tue Mar 28 20:34:02 2017(r316105)
+++ head/sys/boot/zfs/zfsimpl.c Tue Mar 28 20:39:24 2017(r316106)
@@ -494,7 +494,7 @@ vdev_find(uint64_t guid)
 }
 
 static vdev_t *
-vdev_create(uint64_t guid, vdev_read_t *read)
+vdev_create(uint64_t guid, vdev_read_t *_read)
 {
vdev_t *vdev;
 
@@ -503,7 +503,7 @@ vdev_create(uint64_t guid, vdev_read_t *
STAILQ_INIT(>v_children);
vdev->v_guid = guid;
vdev->v_state = VDEV_STATE_OFFLINE;
-   vdev->v_read = read;
+   vdev->v_read = _read;
vdev->v_phys_read = 0;
vdev->v_read_priv = 0;
STAILQ_INSERT_TAIL(_vdevs, vdev, v_alllink);
@@ -907,7 +907,7 @@ spa_all_status(void)
 }
 
 static int
-vdev_probe(vdev_phys_read_t *read, void *read_priv, spa_t **spap)
+vdev_probe(vdev_phys_read_t *_read, void *read_priv, spa_t **spap)
 {
vdev_t vtmp;
vdev_phys_t *vdev_label = (vdev_phys_t *) zap_scratch;
@@ -932,7 +932,7 @@ vdev_probe(vdev_phys_read_t *read, void 
 * uberblock is most current.
 */
memset(, 0, sizeof(vtmp));
-   vtmp.v_phys_read = read;
+   vtmp.v_phys_read = _read;
vtmp.v_read_priv = read_priv;
off = offsetof(vdev_label_t, vl_vdev_phys);
BP_ZERO();
@@ -1060,7 +1060,7 @@ vdev_probe(vdev_phys_read_t *read, void 
 */
vdev = vdev_find(guid);
if (vdev) {
-   vdev->v_phys_read = read;
+   vdev->v_phys_read = _read;
vdev->v_read_priv = read_priv;
vdev->v_state = VDEV_STATE_HEALTHY;
} else {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316105 - head/sbin/nvmecontrol

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 20:34:02 2017
New Revision: 316105
URL: https://svnweb.freebsd.org/changeset/base/316105

Log:
  Don't use K style prototypes; ANSIfy them
  
  This fixes several -Wold-style-definition warnings.
  
  X-MFC with:   313191
  Reported by:  amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sbin/nvmecontrol/wdc.c

Modified: head/sbin/nvmecontrol/wdc.c
==
--- head/sbin/nvmecontrol/wdc.c Tue Mar 28 20:30:33 2017(r316104)
+++ head/sbin/nvmecontrol/wdc.c Tue Mar 28 20:34:02 2017(r316105)
@@ -178,7 +178,7 @@ wdc_do_clear_dump(int fd, uint32_t opcod
 }
 
 static void
-wdc_cap_diag_usage()
+wdc_cap_diag_usage(void)
 {
fprintf(stderr, "usage:\n");
fprintf(stderr, WDC_CAP_DIAG_USAGE);
@@ -215,7 +215,7 @@ wdc_cap_diag(int argc, char *argv[])
 }
 
 static void
-wdc_drive_log_usage()
+wdc_drive_log_usage(void)
 {
fprintf(stderr, "usage:\n");
fprintf(stderr, WDC_DRIVE_LOG_USAGE);
@@ -252,7 +252,7 @@ wdc_drive_log(int argc, char *argv[])
 }
 
 static void
-wdc_get_crash_dump_usage()
+wdc_get_crash_dump_usage(void)
 {
fprintf(stderr, "usage:\n");
fprintf(stderr, WDC_CAP_DIAG_USAGE);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316104 - head/sys/boot/i386/gptzfsboot

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 20:30:33 2017
New Revision: 316104
URL: https://svnweb.freebsd.org/changeset/base/316104

Log:
  Use `NO_WCAST_ALIGN` instead of spelling it out as -Wno-cast-align in CFLAGS
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/i386/gptzfsboot/Makefile

Modified: head/sys/boot/i386/gptzfsboot/Makefile
==
--- head/sys/boot/i386/gptzfsboot/Makefile  Tue Mar 28 20:26:04 2017
(r316103)
+++ head/sys/boot/i386/gptzfsboot/Makefile  Tue Mar 28 20:30:33 2017
(r316104)
@@ -33,11 +33,13 @@ CFLAGS= -DBOOTPROG=\"gptzfsboot\" \
-I${.CURDIR}/../btx/lib -I. \
-I${.CURDIR}/../boot2 \
-I${.CURDIR}/../../.. \
-   -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
+   -Wall -Waggregate-return -Wbad-function-cast \
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
-Winline -Wno-pointer-sign
 
+NO_WCAST_ALIGN=
+
 .if ${COMPILER_TYPE} == "clang" || \
 (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201)
 CFLAGS+=   -Wno-tentative-definition-incomplete-type
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316103 - head/sys/boot/efi/boot1

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 20:26:04 2017
New Revision: 316103
URL: https://svnweb.freebsd.org/changeset/base/316103

Log:
  Remove redundant declarations
  
  They're already defined in libstand.h
  
  MFC after:1 week
  Reported by:  amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/efi/boot1/boot1.c
  head/sys/boot/efi/boot1/boot_module.h

Modified: head/sys/boot/efi/boot1/boot1.c
==
--- head/sys/boot/efi/boot1/boot1.c Tue Mar 28 20:22:44 2017
(r316102)
+++ head/sys/boot/efi/boot1/boot1.c Tue Mar 28 20:26:04 2017
(r316103)
@@ -47,7 +47,6 @@ static const boot_module_t *boot_modules
 /* The initial number of handles used to query EFI for partitions. */
 #define NUM_HANDLES_INIT   24
 
-void putchar(int c);
 EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab);
 
 EFI_SYSTEM_TABLE *systab;

Modified: head/sys/boot/efi/boot1/boot_module.h
==
--- head/sys/boot/efi/boot1/boot_module.h   Tue Mar 28 20:22:44 2017
(r316102)
+++ head/sys/boot/efi/boot1/boot_module.h   Tue Mar 28 20:26:04 2017
(r316103)
@@ -105,8 +105,6 @@ extern const boot_module_t zfs_module;
 
 /* Functions available to modules. */
 extern void add_device(dev_info_t **devinfop, dev_info_t *devinfo);
-extern void panic(const char *fmt, ...) __dead2;
-extern int printf(const char *fmt, ...);
 extern int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap);
 
 extern EFI_SYSTEM_TABLE *systab;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316102 - head/sys/boot/common

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 20:22:44 2017
New Revision: 316102
URL: https://svnweb.freebsd.org/changeset/base/316102

Log:
  Wrap bootcamp DEBUG statement with curly braces
  
  This fixes a -Wempty-body warning with gcc 6.3.0 when PART_DEBUG is undefined.
  
  MFC after:3 days
  Reported by:  Jenkins (FreeBSD-head-amd64-gcc job)
  Tested with:  amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/common/part.c

Modified: head/sys/boot/common/part.c
==
--- head/sys/boot/common/part.c Tue Mar 28 19:01:01 2017(r316101)
+++ head/sys/boot/common/part.c Tue Mar 28 20:22:44 2017(r316102)
@@ -684,8 +684,9 @@ ptable_open(void *dev, uint64_t sectors,
if (dp[1].dp_typ != DOSPTYP_HFS) {
table->type = PTABLE_NONE;
DEBUG("Incorrect PMBR, ignore it");
-   } else
+   } else {
DEBUG("Bootcamp detected");
+   }
}
 #ifdef LOADER_GPT_SUPPORT
if (table->type == PTABLE_GPT) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r315689 - head/lib/libcompiler_rt

2017-03-28 Thread Dimitry Andric
On 28 Mar 2017, at 21:02, Ngie Cooper (yaneurabeya)  
wrote:
> 
>> On Mar 28, 2017, at 10:49, Ngie Cooper (yaneurabeya)  
>> wrote:
> …
>> Oh wait… I forgot that libgcc_s also references these sources *facepalm*.

Aha! That explains why Li-Wen still saw -Werror warnings on the Jenkins
bot.  They just happened in libgcc_s, not in libcompiler_rt.


> Addressed in r316101 (inspired by your change).

Thanks.  It would be nice if there was some sort of pragma to shut up
gcc in this particular case, then I could also submit it upstream... :)

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r315689 - head/lib/libcompiler_rt

2017-03-28 Thread Ngie Cooper (yaneurabeya)

> On Mar 28, 2017, at 10:49, Ngie Cooper (yaneurabeya)  
> wrote:

…

> Oh wait… I forgot that libgcc_s also references these sources *facepalm*.

Addressed in r316101 (inspired by your change).
Thanks!
-Ngie



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r316101 - head/lib/libgcc_s

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 19:01:01 2017
New Revision: 316101
URL: https://svnweb.freebsd.org/changeset/base/316101

Log:
  Apply r315689 to lib/libgcc_s as well to unbreak the gcc xtoolchain build
  
  lib/libgcc_s consumes lib/libcompiler_rt/Makefile*. The NO_WERROR.gcc in
  lib/libcompiler_rt/Makefile doesn't seem to have made a difference in being
  able to build this, so sprinkle NO_WERROR.gcc here as well.
  
  MFC after:3 days
  Reported by:  Jenkins (FreeBSD-head-amd64-gcc)
  Tested with:  amd64-gcc-6.3.0 (devel/amd64-xtoolchain-gcc)
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libgcc_s/Makefile

Modified: head/lib/libgcc_s/Makefile
==
--- head/lib/libgcc_s/Makefile  Tue Mar 28 18:09:01 2017(r316100)
+++ head/lib/libgcc_s/Makefile  Tue Mar 28 19:01:01 2017(r316101)
@@ -14,6 +14,10 @@ VERSION_MAP= ${.CURDIR}/Version.map
 .include "../libcompiler_rt/Makefile.inc"
 .include "../libgcc_eh/Makefile.inc"
 
+# gcc has incompatible internal declarations for __divtc3 and __multc3, but has
+# no option to silence its warning, so make warnings non-fatal.
+NO_WERROR.gcc=
+
 LIBCSRCDIR=${SRCTOP}/lib/libc
 LIBMSRCDIR=${SRCTOP}/lib/msun/src
 CFLAGS+=   -I${LIBCSRCDIR}/include -I${LIBCSRCDIR}/${MACHINE_CPUARCH}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r316100 - head/sys/boot/i386/boot2

2017-03-28 Thread Ngie Cooper (yaneurabeya)

> On Mar 28, 2017, at 11:09, Warner Losh  wrote:
> 
> Author: imp
> Date: Tue Mar 28 18:09:01 2017
> New Revision: 316100
> URL: https://svnweb.freebsd.org/changeset/base/316100
> 
> Log:
>  Remove -fno-guess-branch-probability and -fno-unit-at-a-time.
> 
>  bde enabled -fno-guess-branch-probability in 2003, well before our
>  current compiler was imported. At the time it produced weirdly orded
>  code. It no longer does that. It also saves 0-4 bytes depending on
>  other options.
> 
>  kan disabled unit-at-a-time in 2004 because it badly mangled boot2 so
>  it wouldn't work. That too was before the 4.2.1 compiler, where it no
>  longer does that. This saves 44 bytes.
> 
>  I had planned to document why they were needed, but when I discovered
>  their antiquity, I removed them and boot2 still works and is
>  smaller. In qemu, the old and new boot2's behaved identically.
> 
>  These are gcc specific hacks, and won't affect clang-built boot2
>  at all.

Nice!!!
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r316064 - head/sys/boot/i386/boot2

2017-03-28 Thread Poul-Henning Kamp

In message <201703281555.v2sftosu005...@pdx.rh.cn85.dnsmgr.net>, "Rodney W. Gri
mes" writes:

>I think we still have an 8k size limit on boot1 for ffs/(ufs1 or ufs2)

Having a former release-engineer & disk-I/O renovator on the UFS2
team took care of that:  We tried to be future compatible, and UFS2
will look four different places for the superblock: +64k, +8k, +0k
and +256k, (the latter named SBLOCK_PIGGY because somebody senior
thought even 64k was an outrageous waste of space :-)

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316100 - head/sys/boot/i386/boot2

2017-03-28 Thread Warner Losh
Author: imp
Date: Tue Mar 28 18:09:01 2017
New Revision: 316100
URL: https://svnweb.freebsd.org/changeset/base/316100

Log:
  Remove -fno-guess-branch-probability and -fno-unit-at-a-time.
  
  bde enabled -fno-guess-branch-probability in 2003, well before our
  current compiler was imported. At the time it produced weirdly orded
  code. It no longer does that. It also saves 0-4 bytes depending on
  other options.
  
  kan disabled unit-at-a-time in 2004 because it badly mangled boot2 so
  it wouldn't work. That too was before the 4.2.1 compiler, where it no
  longer does that. This saves 44 bytes.
  
  I had planned to document why they were needed, but when I discovered
  their antiquity, I removed them and boot2 still works and is
  smaller. In qemu, the old and new boot2's behaved identically.
  
  These are gcc specific hacks, and won't affect clang-built boot2
  at all.

Modified:
  head/sys/boot/i386/boot2/Makefile

Modified: head/sys/boot/i386/boot2/Makefile
==
--- head/sys/boot/i386/boot2/Makefile   Tue Mar 28 17:37:49 2017
(r316099)
+++ head/sys/boot/i386/boot2/Makefile   Tue Mar 28 18:09:01 2017
(r316100)
@@ -38,8 +38,6 @@ CFLAGS=   -fomit-frame-pointer \
-Winline
 
 CFLAGS.gcc+=   -Os \
-   -fno-guess-branch-probability \
-   -fno-unit-at-a-time \
--param max-inline-insns-single=100
 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
 CFLAGS.gcc+=   -mno-align-long-strings
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r315689 - head/lib/libcompiler_rt

2017-03-28 Thread Ngie Cooper (yaneurabeya)

> On Mar 28, 2017, at 10:48, Ngie Cooper (yaneurabeya)  
> wrote:
> 
>> 
>> On Mar 21, 2017, at 14:07, Dimitry Andric  wrote:
>> 
>> Author: dim
>> Date: Tue Mar 21 21:07:37 2017
>> New Revision: 315689
>> URL: https://svnweb.freebsd.org/changeset/base/315689
>> 
>> Log:
>> Gcc has incompatible internal declarations for __divtc3 and __multc3 as
>> defined in compiler-rt, but it has no option to silence its warning, so
>> make gcc warnings for libcompiler_rt non-fatal.
>> 
>> Noticed by:  lwhsu
>> MFC after:   3 days
>> 
>> Modified:
>> head/lib/libcompiler_rt/Makefile
> 
> This doesn’t work:
> 
> 11:31:39
> /workspace/src/contrib/compiler-rt/lib/builtins/divtc3.c:21:1: error: 
> conflicting types for built-in function '__divtc3' [-Werror]
> 
> 11:31:39
> __divtc3(long double __a, long double __b, long double __c, long double __d)
> 
> 11:31:39  ^~~~
> 
> Thanks,
> -Ngie

Oh wait… I forgot that libgcc_s also references these sources *facepalm*.
Thanks,
-Ngie



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r315689 - head/lib/libcompiler_rt

2017-03-28 Thread Ngie Cooper (yaneurabeya)

> On Mar 21, 2017, at 14:07, Dimitry Andric  wrote:
> 
> Author: dim
> Date: Tue Mar 21 21:07:37 2017
> New Revision: 315689
> URL: https://svnweb.freebsd.org/changeset/base/315689
> 
> Log:
>  Gcc has incompatible internal declarations for __divtc3 and __multc3 as
>  defined in compiler-rt, but it has no option to silence its warning, so
>  make gcc warnings for libcompiler_rt non-fatal.
> 
>  Noticed by:  lwhsu
>  MFC after:   3 days
> 
> Modified:
>  head/lib/libcompiler_rt/Makefile

This doesn’t work:

11:31:39
/workspace/src/contrib/compiler-rt/lib/builtins/divtc3.c:21:1: error: 
conflicting types for built-in function '__divtc3' [-Werror]

11:31:39
 __divtc3(long double __a, long double __b, long double __c, long double __d)

11:31:39  ^~~~

Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r316099 - in head: etc/mtree lib/libkvm lib/libkvm/tests

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 17:37:49 2017
New Revision: 316099
URL: https://svnweb.freebsd.org/changeset/base/316099

Log:
  lib/libkvm: start adding basic tests for kvm(3)
  
  - kvm_close: add a testcase to verify support for errno = EINVAL / -1
(see D10065) when kd == NULL is provided to the libcall.
  - kvm_geterr:
  -- Add a negative testcase for kd == NULL returning "" (see D10022).
  -- Add two positive testcases:
  --- test the error case using kvm_write on a O_RDONLY descriptor.
  --- test the "no error" case using kvm_read(3) and kvm_nlist(3) as
  helper routines and by injecting a bogus error message via
  _kvm_err (an internal API) _kvm_err was used as there isn't a
  formalized way to clear the error output, and because
  kvm_nlist always returns ENOENT with the NULL terminator today.
  - kvm_open, kvm_open2:
  -- Add some basic negative tests for kvm_open(3) and kvm_open2(3).
 Testing positive cases with a specific
 `corefile`/`execfile`/`resolver` requires more work and would require
 user intervention today in order to reliably test this out.
  
  Reviewed by:  markj
  MFC after:2 months
  Sponsored by: Dell EMC Isilon
  Differential Revision:D10024

Added:
  head/lib/libkvm/tests/
  head/lib/libkvm/tests/Makefile   (contents, props changed)
  head/lib/libkvm/tests/kvm_close_test.c   (contents, props changed)
  head/lib/libkvm/tests/kvm_geterr_test.c   (contents, props changed)
  head/lib/libkvm/tests/kvm_open2_test.c   (contents, props changed)
  head/lib/libkvm/tests/kvm_open_test.c   (contents, props changed)
  head/lib/libkvm/tests/kvm_test_common.c   (contents, props changed)
  head/lib/libkvm/tests/kvm_test_common.h   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/lib/libkvm/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Tue Mar 28 13:39:04 2017
(r316098)
+++ head/etc/mtree/BSD.tests.dist   Tue Mar 28 17:37:49 2017
(r316099)
@@ -328,6 +328,8 @@
 ..
 libdevdctl
 ..
+libkvm
+..
 libmp
 ..
 libnv

Modified: head/lib/libkvm/Makefile
==
--- head/lib/libkvm/MakefileTue Mar 28 13:39:04 2017(r316098)
+++ head/lib/libkvm/MakefileTue Mar 28 17:37:49 2017(r316099)
@@ -36,4 +36,8 @@ MLINKS+=kvm_nlist.3 kvm_nlist2.3
 MLINKS+=kvm_open.3 kvm_close.3 kvm_open.3 kvm_open2.3 kvm_open.3 
kvm_openfiles.3
 MLINKS+=kvm_read.3 kvm_read2.3 kvm_read.3 kvm_write.3
 
+.include 
+
+SUBDIR.${MK_TESTS}=tests
+
 .include 

Added: head/lib/libkvm/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libkvm/tests/Makefile  Tue Mar 28 17:37:49 2017
(r316099)
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+.include 
+
+ATF_TESTS_C+=  kvm_close_test
+ATF_TESTS_C+=  kvm_geterr_test
+ATF_TESTS_C+=  kvm_open_test
+ATF_TESTS_C+=  kvm_open2_test
+
+CFLAGS.kvm_geterr_test+=   -I${.CURDIR:H}
+
+LIBADD+=   kvm
+
+WARNS?=6
+
+BINDIR=${TESTSDIR}
+
+.for t in kvm_geterr_test kvm_open_test kvm_open2_test
+SRCS.$t=   $t.c kvm_test_common.c
+.endfor
+
+.include 

Added: head/lib/libkvm/tests/kvm_close_test.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libkvm/tests/kvm_close_test.c  Tue Mar 28 17:37:49 2017
(r316099)
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 2017 Ngie Cooper 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING 

Re: svn commit: r316064 - head/sys/boot/i386/boot2

2017-03-28 Thread Bruce Evans

On Tue, 28 Mar 2017, Rodney W. Grimes wrote:


On Mon, 27 Mar 2017, Julian Elischer wrote:


On Tue, 28 Mar 2017, Bruce Evans wrote:

[...]


they have to fit below 640K and a few multiples of 64K are already
used for buffers).  The limit on 8K is mainly a historical mistake.
A limit of 7.5K simplified booting from 15-sector floppies.  18-sector


My memory says that the limit of 7.5K is becuase there was only 8k left free
at the front of UFS1 and one sector was used for the boot0 code.


That is only a limit if the boot code is in the ffs partition.  This causes
other problems.  It was the default to start the 'a' partition at offset 0,
but that was changed 10-15 years ago.  I can't find exactly where it is
changed.  I use an offset of 8192 sectors or 4M on new and repartitioned
hard disks.


IIRC, it was sizeof(boot0)+sizeof(boot1) had to fit in the 8K byte hole
at the start of a ffs/ufs1 disk if and only if the disk was in dangeriously
dedicated mode, which is the same case for a floppy.


Dangerously dedicated is still often partitioned, except on floppies.


This 8K hole, again iirc, is actually a #define.  Later someone seems
to have though you need to offset partition a: by 16 blocks for this
and made the installers do magic this, as far as I can see, is incorrect
and I have manually been reseting the first partition of my bsdlabels
to 0 and adding 16 blocks to there size.


The #define is BBSIZE, but struct disklabel always (at least as far back
as FreeBSD-1) had a variable field d_bbsize for it.  The support for
changing the variable is just fairly broken.  struct disklabel also has
d_sbsize for giving the maximum size of the "fs" superblock.  These fields
might be limited by the fs iff the label is inside an fs partition.  They
are in practice for ffs.  Other fs's might not even have an ffs-style
superblock.

The offset is necessary for separate protection on the metadata and the
file system.  I still have to fight the geom's protection.
kern.debug/geomflags sometimes works.

If there were more partitions then the metadata should be on a separate
one.  Of course, you might want the same protection on the label and
the root partition, to make it harder to change either.


I think we still have an 8k size limit on boot1 for ffs/(ufs1 or ufs2)
(Proved self wrong on the 8k limit, see comments from sys/ufs/ffs/fs.h
below)
as it this code still lives in the start of the partition, though there
is usually 62 (or some other similiar number that is geometry dependent)
sectors of unused space between the mbr and the start of the bsd slice.


boot1 is normally part of boot2, and only exists logically.

boot0 should have size 1 sector (or 512 bytes) since the second sector
is more likely to be clobbered by other OSes and BIOSes and you can't
control these.  Windows even scribbles a disk id on the first sector.


Here is the truth on the magic holes from sys/ufs/ffs/fs.h:
* Depending on the architecture and the media, the superblock may
* reside in any one of four places. For tiny media where every block
* counts, it is placed at the very front of the partition. Historically,
* UFS1 placed it 8K from the front to leave room for the disk label and
* a small bootstrap. For UFS2 it got moved to 64K from the front to leave
* room for the disk label and a bigger bootstrap, and for really piggy
* systems we check at 256K from the front if the first three fail. In
* all cases the size of the superblock will be SBLOCKSIZE. All values are
* given in byte-offset form, so they do not imply a sector size. The
* SBLOCKSEARCH specifies the order in which the locations should be searched.


Only true for ffs in the very dangerously dedicated case with no
partitions :-).  The boot blocks are somewhat constrained by this.  You
need small ones if you want to support the worse case of ffs1 on a very
dangerously dedicated disk.  Once you have written these, it is simplest
to use them in all cases.

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


Re: svn commit: r316064 - head/sys/boot/i386/boot2

2017-03-28 Thread Toomas Soome

> On 28. märts 2017, at 18:55, Rodney W. Grimes 
>  wrote:
> 
>> On Mon, 27 Mar 2017, Julian Elischer wrote:
>> 
>>> On Tue, 28 Mar 2017, Bruce Evans wrote:
>>> 
>>> [...]
>>> 
 they have to fit below 640K and a few multiples of 64K are already
 used for buffers).  The limit on 8K is mainly a historical mistake.
 A limit of 7.5K simplified booting from 15-sector floppies.  18-sector
>>> 
>>> My memory says that the limit of 7.5K is becuase there was only 8k left 
>>> free 
>>> at the front of UFS1 and one sector was used for the boot0 code.
>> 
>> That is only a limit if the boot code is in the ffs partition.  This causes
>> other problems.  It was the default to start the 'a' partition at offset 0,
>> but that was changed 10-15 years ago.  I can't find exactly where it is
>> changed.  I use an offset of 8192 sectors or 4M on new and repartitioned
>> hard disks.
> 
> IIRC, it was sizeof(boot0)+sizeof(boot1) had to fit in the 8K byte hole
> at the start of a ffs/ufs1 disk if and only if the disk was in dangeriously
> dedicated mode, which is the same case for a floppy.
> 
> This 8K hole, again iirc, is actually a #define.  Later someone seems
> to have though you need to offset partition a: by 16 blocks for this
> and made the installers do magic this, as far as I can see, is incorrect
> and I have manually been reseting the first partition of my bsdlabels
> to 0 and adding 16 blocks to there size.
> 
> I think we still have an 8k size limit on boot1 for ffs/(ufs1 or ufs2)
> (Proved self wrong on the 8k limit, see comments from sys/ufs/ffs/fs.h
> below)
> as it this code still lives in the start of the partition, though there
> is usually 62 (or some other similiar number that is geometry dependent)
> sectors of unused space between the mbr and the start of the bsd slice.
> 
> Here is the truth on the magic holes from sys/ufs/ffs/fs.h:
> * Depending on the architecture and the media, the superblock may
> * reside in any one of four places. For tiny media where every block
> * counts, it is placed at the very front of the partition. Historically,
> * UFS1 placed it 8K from the front to leave room for the disk label and
> * a small bootstrap. For UFS2 it got moved to 64K from the front to leave
> * room for the disk label and a bigger bootstrap, and for really piggy
> * systems we check at 256K from the front if the first three fail. In
> * all cases the size of the superblock will be SBLOCKSIZE. All values are
> * given in byte-offset form, so they do not imply a sector size. The
> * SBLOCKSEARCH specifies the order in which the locations should be searched.
> 
>> This is again affected by the existence of floppy disks.  Floppy disks are
>> usually not partitioned, and don't have space to spare for large boot
>> blocks.  Some version of the boot code has to work on small media, and
>> FreeBSD uses the same boot code for all media.  This allowed FreeBSD-1
>> to have a single boot.flp where IIRC Linux had about 100 variations.
>> Small media is not as small as it used to be.
>> 
>> Bruce
> 
> -- 
> Rod Grimes rgri...@freebsd.org
> 


Also note that SunOS (which ufs is based on ufs1), has disk layout on sparc as 
sector 0 for VTOC (512B), followed by 15 sectors for bootblk, total 16 sectors, 
or 8KB, the setup which did allow to define slice 0 to start from the absolute 
sector 0, and which probably did also burn uncounted amount of DBA’s who did 
attempt the same for their raw databases;)

rgds,
toomas
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r316064 - head/sys/boot/i386/boot2

2017-03-28 Thread Rodney W. Grimes
> On Mon, 27 Mar 2017, Julian Elischer wrote:
> 
> > On Tue, 28 Mar 2017, Bruce Evans wrote:
> >
> > [...]
> >
> >> they have to fit below 640K and a few multiples of 64K are already
> >> used for buffers).  The limit on 8K is mainly a historical mistake.
> >> A limit of 7.5K simplified booting from 15-sector floppies.  18-sector
> >
> > My memory says that the limit of 7.5K is becuase there was only 8k left 
> > free 
> > at the front of UFS1 and one sector was used for the boot0 code.
> 
> That is only a limit if the boot code is in the ffs partition.  This causes
> other problems.  It was the default to start the 'a' partition at offset 0,
> but that was changed 10-15 years ago.  I can't find exactly where it is
> changed.  I use an offset of 8192 sectors or 4M on new and repartitioned
> hard disks.

IIRC, it was sizeof(boot0)+sizeof(boot1) had to fit in the 8K byte hole
at the start of a ffs/ufs1 disk if and only if the disk was in dangeriously
dedicated mode, which is the same case for a floppy.

This 8K hole, again iirc, is actually a #define.  Later someone seems
to have though you need to offset partition a: by 16 blocks for this
and made the installers do magic this, as far as I can see, is incorrect
and I have manually been reseting the first partition of my bsdlabels
to 0 and adding 16 blocks to there size.

I think we still have an 8k size limit on boot1 for ffs/(ufs1 or ufs2)
(Proved self wrong on the 8k limit, see comments from sys/ufs/ffs/fs.h
below)
as it this code still lives in the start of the partition, though there
is usually 62 (or some other similiar number that is geometry dependent)
sectors of unused space between the mbr and the start of the bsd slice.

Here is the truth on the magic holes from sys/ufs/ffs/fs.h:
 * Depending on the architecture and the media, the superblock may
 * reside in any one of four places. For tiny media where every block
 * counts, it is placed at the very front of the partition. Historically,
 * UFS1 placed it 8K from the front to leave room for the disk label and
 * a small bootstrap. For UFS2 it got moved to 64K from the front to leave
 * room for the disk label and a bigger bootstrap, and for really piggy
 * systems we check at 256K from the front if the first three fail. In
 * all cases the size of the superblock will be SBLOCKSIZE. All values are
 * given in byte-offset form, so they do not imply a sector size. The
 * SBLOCKSEARCH specifies the order in which the locations should be searched.

> This is again affected by the existence of floppy disks.  Floppy disks are
> usually not partitioned, and don't have space to spare for large boot
> blocks.  Some version of the boot code has to work on small media, and
> FreeBSD uses the same boot code for all media.  This allowed FreeBSD-1
> to have a single boot.flp where IIRC Linux had about 100 variations.
> Small media is not as small as it used to be.
> 
> Bruce

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316098 - in stable/11: lib/libnetbsd usr.bin usr.bin/getaddrinfo

2017-03-28 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Mar 28 13:39:04 2017
New Revision: 316098
URL: https://svnweb.freebsd.org/changeset/base/316098

Log:
  MFC r315640
  
  Port the getaddrinfo(1) utility from NetBSD.
  
  PR:   183148
  Submitted by: Lohith Bellad 
  Obtained from:NetBSD
  Relnotes: yes
  Sponsored by: Dell EMC

Added:
  stable/11/lib/libnetbsd/sockaddr_snprintf.c
 - copied unchanged from r315640, head/lib/libnetbsd/sockaddr_snprintf.c
  stable/11/usr.bin/getaddrinfo/
 - copied from r315640, head/usr.bin/getaddrinfo/
Modified:
  stable/11/lib/libnetbsd/Makefile
  stable/11/lib/libnetbsd/util.h
  stable/11/usr.bin/Makefile
  stable/11/usr.bin/getaddrinfo/getaddrinfo.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libnetbsd/Makefile
==
--- stable/11/lib/libnetbsd/MakefileTue Mar 28 10:43:20 2017
(r316097)
+++ stable/11/lib/libnetbsd/MakefileTue Mar 28 13:39:04 2017
(r316098)
@@ -7,7 +7,7 @@ LIB=netbsd
 
 CFLAGS+=   -I${.CURDIR}
 
-SRCS+= strsuftoll.c util.c util.h
+SRCS+= sockaddr_snprintf.c strsuftoll.c util.c util.h
 
 INTERNALLIB=
 

Copied: stable/11/lib/libnetbsd/sockaddr_snprintf.c (from r315640, 
head/lib/libnetbsd/sockaddr_snprintf.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/lib/libnetbsd/sockaddr_snprintf.c Tue Mar 28 13:39:04 2017
(r316098, copy of r315640, head/lib/libnetbsd/sockaddr_snprintf.c)
@@ -0,0 +1,317 @@
+/* $NetBSD: sockaddr_snprintf.c,v 1.14 2016/12/29 18:30:55 christos Exp $  
*/
+
+/*-
+ * Copyright (c) 2004, 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#ifdef HAVE_NET_IF_DL_H
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef BSD4_4
+# define SALEN(sa) ((sa)->sa ## _len)
+#else
+# define SALEN(sa) ((unsigned)sizeof(*sa))
+#endif
+
+static int
+debug_in(char *str, size_t len, const struct sockaddr_in *sin)
+{
+   return snprintf(str, len, "sin_len=%u, sin_family=%u, sin_port=%u, "
+   "sin_addr.s_addr=%08x",
+   SALEN(sin), sin->sin_family, sin->sin_port,
+   sin->sin_addr.s_addr);
+}
+
+static int
+debug_in6(char *str, size_t len, const struct sockaddr_in6 *sin6)
+{
+   const uint8_t *s = sin6->sin6_addr.s6_addr;
+
+   return snprintf(str, len, "sin6_len=%u, sin6_family=%u, sin6_port=%u, "
+   "sin6_flowinfo=%u, "
+   "sin6_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:"
+   "%02x:%02x:%02x:%02x:%02x:%02x, sin6_scope_id=%u",
+   SALEN(sin6), sin6->sin6_family, sin6->sin6_port,
+   sin6->sin6_flowinfo, s[0x0], s[0x1], s[0x2], s[0x3], s[0x4], s[0x5],
+   s[0x6], s[0x7], s[0x8], s[0x9], s[0xa], s[0xb], s[0xc], s[0xd],
+   s[0xe], s[0xf], sin6->sin6_scope_id);
+}
+
+static int
+debug_un(char *str, size_t len, const struct sockaddr_un *sun)
+{
+   return snprintf(str, len, "sun_len=%u, sun_family=%u, sun_path=%*s",
+   SALEN(sun), sun->sun_family, (int)sizeof(sun->sun_path),
+   sun->sun_path);
+}
+
+#ifdef HAVE_NET_IF_DL_H
+static int
+debug_dl(char *str, size_t len, const struct sockaddr_dl *sdl)
+{
+   const uint8_t *s = 

Re: svn commit: r316069 - in stable/10: contrib/ntp contrib/ntp/adjtimed contrib/ntp/clockstuff contrib/ntp/html contrib/ntp/include contrib/ntp/include/isc contrib/ntp/kernel contrib/ntp/kernel/sys c

2017-03-28 Thread Andrey Chernov
On 28.03.2017 7:48, Xin LI wrote:
> Author: delphij
> Date: Tue Mar 28 04:48:55 2017
> New Revision: 316069
> URL: https://svnweb.freebsd.org/changeset/base/316069
> 
> Log:
>   MFC r315871: MFV r315791: ntp 4.2.8p10.

Should /etc/ntp.conf be updated to?

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


Re: svn commit: r316081 - head/lib/libcam

2017-03-28 Thread Bruce Evans

On Tue, 28 Mar 2017, Ngie Cooper wrote:


Log:
 Use `sizeof(cam_errbuf)` instead of `CAM_ERRBUF_SIZE` in snprintf calls

 Reindent snprintf calls' arguments to match style(9) guidelines with
 respect to indentation.


Unfortunately, cam is is supposed to not match style(9) guidelines for
indentation.  It has its own style for many things, and used to follow
this very consistently.  Its style for continuation indentation is the
same as gnu style (-lp).

The following of -lp seems to have been perfect for multi-line
snprintf()s in camlib.c.  This gave 56 lines perfectly not matching
style(9), or about 1/4 of the non-matches.

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


svn commit: r316096 - stable/11/sbin/swapon

2017-03-28 Thread Dmitry Marakasov
Author: amdmi3 (ports committer)
Date: Tue Mar 28 10:43:19 2017
New Revision: 316096
URL: https://svnweb.freebsd.org/changeset/base/316096

Log:
  MFC r315242: Fix late and noauto with geli swap
  
  With the following in /etc/fstab:
  
  /dev/gpt/swap.eli none swap sw,late 0 0
  
  swap will not be enabled, with `swapon -aL' complaining:
  
  swapon: Invalid option: late
  
  This happens because swap_on_geli_args() which parses geli arguments
  out of all mount options does not expect late or noauto among them.
  Fix this by explicitly allowing these arguments.
  
  Reviewed by:  jilles
  Approved by:  jilles
  Differential Revision:D9835

Modified:
  stable/11/sbin/swapon/swapon.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/swapon/swapon.c
==
--- stable/11/sbin/swapon/swapon.c  Tue Mar 28 10:39:17 2017
(r316095)
+++ stable/11/sbin/swapon/swapon.c  Tue Mar 28 10:43:19 2017
(r316096)
@@ -375,8 +375,12 @@ swap_on_geli_args(const char *mntops)
free(ops);
return (NULL);
}
-   } else if ((p = strstr(token, "notrim")) == token) {
+   } else if (strcmp(token, "notrim") == 0) {
Tflag = " -T ";
+   } else if (strcmp(token, "late") == 0) {
+   /* ignore known option */
+   } else if (strcmp(token, "noauto") == 0) {
+   /* ignore known option */
} else if (strcmp(token, "sw") != 0) {
warnx("Invalid option: %s", token);
free(ops);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316097 - stable/10/sbin/swapon

2017-03-28 Thread Dmitry Marakasov
Author: amdmi3 (ports committer)
Date: Tue Mar 28 10:43:20 2017
New Revision: 316097
URL: https://svnweb.freebsd.org/changeset/base/316097

Log:
  MFC r315242: Fix late and noauto with geli swap
  
  With the following in /etc/fstab:
  
  /dev/gpt/swap.eli none swap sw,late 0 0
  
  swap will not be enabled, with `swapon -aL' complaining:
  
  swapon: Invalid option: late
  
  This happens because swap_on_geli_args() which parses geli arguments
  out of all mount options does not expect late or noauto among them.
  Fix this by explicitly allowing these arguments.
  
  Reviewed by:  jilles
  Approved by:  jilles
  Differential Revision:D9835

Modified:
  stable/10/sbin/swapon/swapon.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/swapon/swapon.c
==
--- stable/10/sbin/swapon/swapon.c  Tue Mar 28 10:43:19 2017
(r316096)
+++ stable/10/sbin/swapon/swapon.c  Tue Mar 28 10:43:20 2017
(r316097)
@@ -369,6 +369,10 @@ swap_on_geli_args(const char *mntops)
free(ops);
return (NULL);
}
+   } else if (strcmp(token, "late") == 0) {
+   /* ignore known option */
+   } else if (strcmp(token, "noauto") == 0) {
+   /* ignore known option */
} else if (strcmp(token, "sw") != 0) {
warnx("Invalid option: %s", token);
free(ops);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316095 - in head: contrib/libarchive contrib/libarchive/libarchive lib/libarchive

2017-03-28 Thread Martin Matuska
Author: mm
Date: Tue Mar 28 10:39:17 2017
New Revision: 316095
URL: https://svnweb.freebsd.org/changeset/base/316095

Log:
  MFV r316083,316094:
  Sync libarchive with vendor
  
  Vendor changes (FreeBSD-related):
  - constify variables in several places
  - unify platform ACL code in a single source file
  - fix unused variable if compiling on FreeBSD without NFSv4 ACL support
  
  MFC after:3 days
  X-MFC-with:   315636, 315876

Added:
  head/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c
 - copied, changed from r316083, 
vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.c
Deleted:
  head/contrib/libarchive/libarchive/archive_acl_maps.h
  head/contrib/libarchive/libarchive/archive_acl_maps_freebsd.c
  head/contrib/libarchive/libarchive/archive_read_disk_acl_freebsd.c
  head/contrib/libarchive/libarchive/archive_write_disk_acl_freebsd.c
Modified:
  head/contrib/libarchive/FREEBSD-Xlist
  head/contrib/libarchive/libarchive/archive_entry.c
  head/contrib/libarchive/libarchive/archive_getdate.c
  head/contrib/libarchive/libarchive/archive_pack_dev.c
  head/contrib/libarchive/libarchive/archive_read_support_format_cab.c
  head/contrib/libarchive/libarchive/archive_read_support_format_lha.c
  head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c
  head/contrib/libarchive/libarchive/archive_read_support_format_zip.c
  head/contrib/libarchive/libarchive/archive_string_sprintf.c
  head/contrib/libarchive/libarchive/archive_util.c
  head/contrib/libarchive/libarchive/archive_write_add_filter.c
  head/contrib/libarchive/libarchive/archive_write_add_filter_by_name.c
  head/contrib/libarchive/libarchive/archive_write_add_filter_lz4.c
  head/contrib/libarchive/libarchive/archive_write_add_filter_program.c
  head/contrib/libarchive/libarchive/archive_write_set_format.c
  head/contrib/libarchive/libarchive/archive_write_set_format_by_name.c
  head/contrib/libarchive/libarchive/archive_write_set_format_filter_by_ext.c
  head/contrib/libarchive/libarchive/archive_write_set_format_warc.c
  head/lib/libarchive/Makefile
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/FREEBSD-Xlist
==
--- head/contrib/libarchive/FREEBSD-Xlist   Tue Mar 28 10:34:44 2017
(r316094)
+++ head/contrib/libarchive/FREEBSD-Xlist   Tue Mar 28 10:39:17 2017
(r316095)
@@ -21,6 +21,9 @@ doc
 examples
 libarchive/CMakeLists.txt
 libarchive/archive_entry_copy_bhfi.c
+libarchive/archive_disk_acl_darwin.c
+libarchive/archive_disk_acl_linux.c
+libarchive/archive_disk_acl_sunos.c
 libarchive/archive_read_disk_windows.c
 libarchive/archive_windows.c
 libarchive/archive_windows.h

Copied and modified: 
head/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c (from r316083, 
vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.c)
==
--- vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.cTue Mar 
28 09:58:54 2017(r316083, copy source)
+++ head/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c   Tue Mar 
28 10:39:17 2017(r316095)
@@ -27,6 +27,8 @@
 
 #include "archive_platform.h"
 
+#if ARCHIVE_ACL_FREEBSD
+
 #ifdef HAVE_ERRNO_H
 #include 
 #endif
@@ -695,3 +697,4 @@ archive_write_disk_set_acls(struct archi
 #endif
return (ret);
 }
+#endif /* ARCHIVE_ACL_FREEBSD */

Modified: head/contrib/libarchive/libarchive/archive_entry.c
==
--- head/contrib/libarchive/libarchive/archive_entry.c  Tue Mar 28 10:34:44 
2017(r316094)
+++ head/contrib/libarchive/libarchive/archive_entry.c  Tue Mar 28 10:39:17 
2017(r316095)
@@ -1638,7 +1638,7 @@ _archive_entry_acl_text_l(struct archive
  * SUCH DAMAGE.
  */
 
-static struct flag {
+static const struct flag {
const char  *name;
const wchar_t   *wname;
unsigned longset;
@@ -1843,7 +1843,7 @@ ae_fflagstostr(unsigned long bitset, uns
char *string, *dp;
const char *sp;
unsigned long bits;
-   struct flag *flag;
+   const struct flag *flag;
size_t  length;
 
bits = bitset | bitclear;
@@ -1895,7 +1895,7 @@ static const char *
 ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp)
 {
const char *start, *end;
-   struct flag *flag;
+   const struct flag *flag;
unsigned long set, clear;
const char *failed;
 
@@ -1963,7 +1963,7 @@ static const wchar_t *
 ae_wcstofflags(const wchar_t *s, unsigned long *setp, unsigned long *clrp)
 {
const wchar_t *start, *end;
-   struct flag *flag;
+   const struct flag *flag;
unsigned long set, clear;
const wchar_t *failed;
 

Modified: head/contrib/libarchive/libarchive/archive_getdate.c

svn commit: r316094 - in vendor/libarchive/dist: . libarchive

2017-03-28 Thread Martin Matuska
Author: mm
Date: Tue Mar 28 10:34:44 2017
New Revision: 316094
URL: https://svnweb.freebsd.org/changeset/base/316094

Log:
  Update vendor/libarchive to git a04b5adede4022dd593af76cb2fc2e96cb34df91
  
  Vendor changes (FreeBSD-related):
  - add missing file from previous merge
  - encapsulate platform ACL code in an #ifdef

Modified:
  vendor/libarchive/dist/Makefile.am
  vendor/libarchive/dist/libarchive/archive_disk_acl_darwin.c
  vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.c
  vendor/libarchive/dist/libarchive/archive_disk_acl_linux.c
  vendor/libarchive/dist/libarchive/archive_disk_acl_sunos.c

Modified: vendor/libarchive/dist/Makefile.am
==
--- vendor/libarchive/dist/Makefile.am  Tue Mar 28 10:26:27 2017
(r316093)
+++ vendor/libarchive/dist/Makefile.am  Tue Mar 28 10:34:44 2017
(r316094)
@@ -250,32 +250,16 @@ libarchive_la_SOURCES+= \
 endif
 
 if INC_LINUX_ACL
-libarchive_la_SOURCES+= \
-   libarchive/archive_acl_maps.h \
-   libarchive/archive_acl_maps_linux.c \
-   libarchive/archive_read_disk_acl_linux.c \
-   libarchive/archive_write_disk_acl_linux.c
+libarchive_la_SOURCES+= libarchive/archive_disk_acl_linux.c
 else
 if INC_SUNOS_ACL
-libarchive_la_SOURCES+= \
-   libarchive/archive_acl_maps.h \
-   libarchive/archive_acl_maps_sunos.c \
-   libarchive/archive_read_disk_acl_sunos.c \
-   libarchive/archive_write_disk_acl_sunos.c
+libarchive_la_SOURCES+= libarchive/archive_disk_acl_sunos.c
 else
 if INC_DARWIN_ACL
-libarchive_la_SOURCES+= \
-   libarchive/archive_acl_maps.h \
-   libarchive/archive_acl_maps_darwin.c \
-   libarchive/archive_read_disk_acl_darwin.c \
-   libarchive/archive_write_disk_acl_darwin.c
+libarchive_la_SOURCES+= libarchive/archive_disk_acl_darwin.c
 else
 if INC_FREEBSD_ACL
-libarchive_la_SOURCES+= \
-   libarchive/archive_acl_maps.h \
-   libarchive/archive_acl_maps_freebsd.c \
-   libarchive/archive_read_disk_acl_freebsd.c \
-   libarchive/archive_write_disk_acl_freebsd.c
+libarchive_la_SOURCES+= libarchive/archive_disk_acl_freebsd.c
 endif
 endif
 endif

Modified: vendor/libarchive/dist/libarchive/archive_disk_acl_darwin.c
==
--- vendor/libarchive/dist/libarchive/archive_disk_acl_darwin.c Tue Mar 28 
10:26:27 2017(r316093)
+++ vendor/libarchive/dist/libarchive/archive_disk_acl_darwin.c Tue Mar 28 
10:34:44 2017(r316094)
@@ -25,6 +25,8 @@
 
 #include "archive_platform.h"
 
+#if ARCHIVE_ACL_DARWIN
+
 #ifdef HAVE_FCNTL_H
 #include 
 #endif
@@ -554,3 +556,4 @@ archive_write_disk_set_acls(struct archi
}
return (ret);
 }
+#endif /* ARCHIVE_ACL_DARWIN */

Modified: vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.c
==
--- vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.cTue Mar 
28 10:26:27 2017(r316093)
+++ vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.cTue Mar 
28 10:34:44 2017(r316094)
@@ -27,6 +27,8 @@
 
 #include "archive_platform.h"
 
+#if ARCHIVE_ACL_FREEBSD
+
 #ifdef HAVE_ERRNO_H
 #include 
 #endif
@@ -695,3 +697,4 @@ archive_write_disk_set_acls(struct archi
 #endif
return (ret);
 }
+#endif /* ARCHIVE_ACL_FREEBSD */

Modified: vendor/libarchive/dist/libarchive/archive_disk_acl_linux.c
==
--- vendor/libarchive/dist/libarchive/archive_disk_acl_linux.c  Tue Mar 28 
10:26:27 2017(r316093)
+++ vendor/libarchive/dist/libarchive/archive_disk_acl_linux.c  Tue Mar 28 
10:34:44 2017(r316094)
@@ -27,6 +27,8 @@
 
 #include "archive_platform.h"
 
+#if ARCHIVE_ACL_LIBACL || ARCHIVE_ACL_LIBRICHACL
+
 #ifdef HAVE_ERRNO_H
 #include 
 #endif
@@ -738,3 +740,4 @@ archive_write_disk_set_acls(struct archi
 #endif /* ARCHIVE_ACL_LIBACL */
return (ret);
 }
+#endif /* ARCHIVE_ACL_LIBACL || ARCHIVE_ACL_LIBRICHACL */

Modified: vendor/libarchive/dist/libarchive/archive_disk_acl_sunos.c
==
--- vendor/libarchive/dist/libarchive/archive_disk_acl_sunos.c  Tue Mar 28 
10:26:27 2017(r316093)
+++ vendor/libarchive/dist/libarchive/archive_disk_acl_sunos.c  Tue Mar 28 
10:34:44 2017(r316094)
@@ -25,6 +25,8 @@
 
 #include "archive_platform.h"
 
+#if ARCHIVE_ACL_SUNOS
+
 #ifdef HAVE_ERRNO_H
 #include 
 #endif
@@ -816,3 +818,4 @@ archive_write_disk_set_acls(struct archi
 #endif
return (ret);
 }
+#endif /* ARCHIVE_ACL_SUNOS */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316092 - stable/11/sys/dev/isp

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:25:56 2017
New Revision: 316092
URL: https://svnweb.freebsd.org/changeset/base/316092

Log:
  MFC r315279: Remove some dead/broken code paths around async handling

Modified:
  stable/11/sys/dev/isp/isp.c
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/isp_target.c
  stable/11/sys/dev/isp/ispvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Tue Mar 28 10:25:10 2017(r316091)
+++ stable/11/sys/dev/isp/isp.c Tue Mar 28 10:25:56 2017(r316092)
@@ -95,11 +95,11 @@ static const uint8_t alpa_map[] = {
 /*
  * Local function prototypes.
  */
-static int isp_parse_async(ispsoftc_t *, uint16_t);
-static int isp_parse_async_fc(ispsoftc_t *, uint16_t);
+static void isp_parse_async(ispsoftc_t *, uint16_t);
+static void isp_parse_async_fc(ispsoftc_t *, uint16_t);
 static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t 
*);
-static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *); 
static void
-isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, long *);
+static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *);
+static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, 
long *);
 static void isp_fastpost_complete(ispsoftc_t *, uint32_t);
 static void isp_scsi_init(ispsoftc_t *);
 static void isp_scsi_channel_init(ispsoftc_t *, int);
@@ -4950,10 +4950,10 @@ again:
isp_prt(isp, ISP_LOGWARN, "mailbox cmd (0x%x) 
with no waiters", info);
}
} else {
-   i = IS_FC(isp)? isp_parse_async_fc(isp, info) : 
isp_parse_async(isp, info);
-   if (i < 0) {
-   return;
-   }
+   if (IS_FC(isp))
+   isp_parse_async_fc(isp, info);
+   else
+   isp_parse_async(isp, info);
}
if ((IS_FC(isp) && info != ASYNC_RIOZIO_STALL) || 
isp->isp_state != ISP_RUNSTATE) {
goto out;
@@ -5504,13 +5504,10 @@ isp_prt_endcmd(ispsoftc_t *isp, XS_T *xs
 
 /*
  * Parse an ASYNC mailbox complete
- *
- * Return non-zero if the event has been acknowledged.
  */
-static int
+static void
 isp_parse_async(ispsoftc_t *isp, uint16_t mbox)
 {
-   int acked = 0;
uint32_t h1 = 0, h2 = 0;
uint16_t chan = 0;
 
@@ -5529,9 +5526,7 @@ isp_parse_async(ispsoftc_t *isp, uint16_
case ASYNC_BUS_RESET:
ISP_SET_SENDMARKER(isp, chan, 1);
 #ifdef ISP_TARGET_MODE
-   if (isp_target_async(isp, chan, mbox)) {
-   acked = 1;
-   }
+   isp_target_async(isp, chan, mbox);
 #endif
isp_async(isp, ISPASYNC_BUS_RESET, chan);
break;
@@ -5551,7 +5546,6 @@ isp_parse_async(ispsoftc_t *isp, uint16_
 * restart the firmware
 */
isp_async(isp, ISPASYNC_FW_CRASH);
-   acked = 1;
break;
 
case ASYNC_RQS_XFER_ERR:
@@ -5575,9 +5569,7 @@ isp_parse_async(ispsoftc_t *isp, uint16_
isp_prt(isp, ISP_LOGWARN, "timeout initiated SCSI bus reset of 
chan %d", chan);
ISP_SET_SENDMARKER(isp, chan, 1);
 #ifdef ISP_TARGET_MODE
-   if (isp_target_async(isp, chan, mbox)) {
-   acked = 1;
-   }
+   isp_target_async(isp, chan, mbox);
 #endif
break;
 
@@ -5585,9 +5577,7 @@ isp_parse_async(ispsoftc_t *isp, uint16_
isp_prt(isp, ISP_LOGINFO, "device reset on chan %d", chan);
ISP_SET_SENDMARKER(isp, chan, 1);
 #ifdef ISP_TARGET_MODE
-   if (isp_target_async(isp, chan, mbox)) {
-   acked = 1;
-   }
+   isp_target_async(isp, chan, mbox);
 #endif
break;
 
@@ -5687,14 +5677,12 @@ isp_parse_async(ispsoftc_t *isp, uint16_
} else {
isp->isp_intoasync++;
}
-   return (acked);
 }
 
-static int
+static void
 isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
 {
fcparam *fcp;
-   int acked = 0;
uint16_t chan;
 
if (IS_DUALBUS(isp)) {
@@ -5723,7 +5711,6 @@ isp_parse_async_fc(ispsoftc_t *isp, uint
 * restart the firmware
 */
isp_async(isp, ISPASYNC_FW_CRASH);
-   acked = 1;
break;
 
case ASYNC_RQS_XFER_ERR:
@@ -5756,11 +5743,9 @@ isp_parse_async_fc(ispsoftc_t *isp, uint
 
case ASYNC_CTIO_DONE:
 #ifdef ISP_TARGET_MODE
-   if (isp_target_async(isp, (ISP_READ(isp, OUTMAILBOX2) << 16) | 
ISP_READ(isp, OUTMAILBOX1), mbox)) {
-   

svn commit: r316093 - stable/10/sys/dev/isp

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:26:27 2017
New Revision: 316093
URL: https://svnweb.freebsd.org/changeset/base/316093

Log:
  MFC r315279: Remove some dead/broken code paths around async handling

Modified:
  stable/10/sys/dev/isp/isp.c
  stable/10/sys/dev/isp/isp_freebsd.c
  stable/10/sys/dev/isp/isp_target.c
  stable/10/sys/dev/isp/ispvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp.c
==
--- stable/10/sys/dev/isp/isp.c Tue Mar 28 10:25:56 2017(r316092)
+++ stable/10/sys/dev/isp/isp.c Tue Mar 28 10:26:27 2017(r316093)
@@ -95,11 +95,11 @@ static const uint8_t alpa_map[] = {
 /*
  * Local function prototypes.
  */
-static int isp_parse_async(ispsoftc_t *, uint16_t);
-static int isp_parse_async_fc(ispsoftc_t *, uint16_t);
+static void isp_parse_async(ispsoftc_t *, uint16_t);
+static void isp_parse_async_fc(ispsoftc_t *, uint16_t);
 static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t 
*);
-static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *); 
static void
-isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, long *);
+static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *);
+static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, 
long *);
 static void isp_fastpost_complete(ispsoftc_t *, uint32_t);
 static void isp_scsi_init(ispsoftc_t *);
 static void isp_scsi_channel_init(ispsoftc_t *, int);
@@ -4950,10 +4950,10 @@ again:
isp_prt(isp, ISP_LOGWARN, "mailbox cmd (0x%x) 
with no waiters", info);
}
} else {
-   i = IS_FC(isp)? isp_parse_async_fc(isp, info) : 
isp_parse_async(isp, info);
-   if (i < 0) {
-   return;
-   }
+   if (IS_FC(isp))
+   isp_parse_async_fc(isp, info);
+   else
+   isp_parse_async(isp, info);
}
if ((IS_FC(isp) && info != ASYNC_RIOZIO_STALL) || 
isp->isp_state != ISP_RUNSTATE) {
goto out;
@@ -5504,13 +5504,10 @@ isp_prt_endcmd(ispsoftc_t *isp, XS_T *xs
 
 /*
  * Parse an ASYNC mailbox complete
- *
- * Return non-zero if the event has been acknowledged.
  */
-static int
+static void
 isp_parse_async(ispsoftc_t *isp, uint16_t mbox)
 {
-   int acked = 0;
uint32_t h1 = 0, h2 = 0;
uint16_t chan = 0;
 
@@ -5529,9 +5526,7 @@ isp_parse_async(ispsoftc_t *isp, uint16_
case ASYNC_BUS_RESET:
ISP_SET_SENDMARKER(isp, chan, 1);
 #ifdef ISP_TARGET_MODE
-   if (isp_target_async(isp, chan, mbox)) {
-   acked = 1;
-   }
+   isp_target_async(isp, chan, mbox);
 #endif
isp_async(isp, ISPASYNC_BUS_RESET, chan);
break;
@@ -5551,7 +5546,6 @@ isp_parse_async(ispsoftc_t *isp, uint16_
 * restart the firmware
 */
isp_async(isp, ISPASYNC_FW_CRASH);
-   acked = 1;
break;
 
case ASYNC_RQS_XFER_ERR:
@@ -5575,9 +5569,7 @@ isp_parse_async(ispsoftc_t *isp, uint16_
isp_prt(isp, ISP_LOGWARN, "timeout initiated SCSI bus reset of 
chan %d", chan);
ISP_SET_SENDMARKER(isp, chan, 1);
 #ifdef ISP_TARGET_MODE
-   if (isp_target_async(isp, chan, mbox)) {
-   acked = 1;
-   }
+   isp_target_async(isp, chan, mbox);
 #endif
break;
 
@@ -5585,9 +5577,7 @@ isp_parse_async(ispsoftc_t *isp, uint16_
isp_prt(isp, ISP_LOGINFO, "device reset on chan %d", chan);
ISP_SET_SENDMARKER(isp, chan, 1);
 #ifdef ISP_TARGET_MODE
-   if (isp_target_async(isp, chan, mbox)) {
-   acked = 1;
-   }
+   isp_target_async(isp, chan, mbox);
 #endif
break;
 
@@ -5687,14 +5677,12 @@ isp_parse_async(ispsoftc_t *isp, uint16_
} else {
isp->isp_intoasync++;
}
-   return (acked);
 }
 
-static int
+static void
 isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
 {
fcparam *fcp;
-   int acked = 0;
uint16_t chan;
 
if (IS_DUALBUS(isp)) {
@@ -5723,7 +5711,6 @@ isp_parse_async_fc(ispsoftc_t *isp, uint
 * restart the firmware
 */
isp_async(isp, ISPASYNC_FW_CRASH);
-   acked = 1;
break;
 
case ASYNC_RQS_XFER_ERR:
@@ -5756,11 +5743,9 @@ isp_parse_async_fc(ispsoftc_t *isp, uint
 
case ASYNC_CTIO_DONE:
 #ifdef ISP_TARGET_MODE
-   if (isp_target_async(isp, (ISP_READ(isp, OUTMAILBOX2) << 16) | 
ISP_READ(isp, OUTMAILBOX1), mbox)) {
-   

Re: svn commit: r316064 - head/sys/boot/i386/boot2

2017-03-28 Thread Bruce Evans

On Tue, 28 Mar 2017, Warner Losh wrote:


[[ sorry for the top post but it's quick ]]


It's quicker and almost equivalent to delete what you reply to.


Summary, in Bruce's own words


the whole optimization step was silly.


I agree. on my -current system, clang compiled boot2 was 4 bytes
smaller after ripping it out. gcc was a whopping 7 bytes larger. Since
gcc has 156 still free, I think it's best to just retire this.

Maybe you can give me a hint as to which structs to look at to get
back those 7 bytes :)


Just sort the character arrays to get back 4.  Maybe clang already does
this, though I like getting the same order as in the sources.

Reducing 1 of the arrays by 1 byte would then save 1 and get back the
other 3.

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


svn commit: r316091 - stable/10/sys/dev/isp

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:25:10 2017
New Revision: 316091
URL: https://svnweb.freebsd.org/changeset/base/316091

Log:
  MFC r315273: Remove tangled isp_mbox_continue() mechanism.
  
  It was implemented to reduce context switches when uploading firmware to
  card's RAM.  But this mechanism is not used last 10 years since all mbox
  operations are now polled, and it was never used for cards produced in
  last 15 years.  Newer cards can use DMA to upload firmware.

Modified:
  stable/10/sys/dev/isp/isp.c
  stable/10/sys/dev/isp/isp_freebsd.c
  stable/10/sys/dev/isp/isp_freebsd.h
  stable/10/sys/dev/isp/ispvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp.c
==
--- stable/10/sys/dev/isp/isp.c Tue Mar 28 10:24:41 2017(r316090)
+++ stable/10/sys/dev/isp/isp.c Tue Mar 28 10:25:10 2017(r316091)
@@ -101,7 +101,6 @@ static int isp_handle_other_response(isp
 static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *); 
static void
 isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, long *);
 static void isp_fastpost_complete(ispsoftc_t *, uint32_t);
-static int isp_mbox_continue(ispsoftc_t *);
 static void isp_scsi_init(ispsoftc_t *);
 static void isp_scsi_channel_init(ispsoftc_t *, int);
 static void isp_fibre_init(ispsoftc_t *);
@@ -130,7 +129,6 @@ static int isp_register_port_name_24xx(i
 static int isp_register_node_name_24xx(ispsoftc_t *, int);
 static uint16_t isp_next_handle(ispsoftc_t *, uint16_t *);
 static int isp_fw_state(ispsoftc_t *, int);
-static void isp_mboxcmd_qnw(ispsoftc_t *, mbreg_t *, int);
 static void isp_mboxcmd(ispsoftc_t *, mbreg_t *);
 
 static void isp_spi_update(ispsoftc_t *, int);
@@ -734,87 +732,47 @@ isp_reset(ispsoftc_t *isp, int do_load_d
isp->isp_loaded_fw = 0;
if (dodnld && IS_24XX(isp)) {
const uint32_t *ptr = isp->isp_mdvec->dv_ispfw;
-   int wordload;
+   uint32_t la, wi, wl;
 
/*
 * Keep loading until we run out of f/w.
 */
code_org = ptr[2];  /* 1st load address is our start addr */
-   wordload = 0;
 
for (;;) {
-   uint32_t la, wi, wl;
 
isp_prt(isp, ISP_LOGDEBUG0, "load 0x%x words of code at 
load address 0x%x", ptr[3], ptr[2]);
 
wi = 0;
la = ptr[2];
wl = ptr[3];
-
while (wi < ptr[3]) {
uint32_t *cp;
uint32_t nw;
 
-   nw = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)) >> 2;
-   if (nw > wl) {
-   nw = wl;
-   }
+   nw = min(wl, 
ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)) / 4);
cp = isp->isp_rquest;
-   for (i = 0; i < nw; i++) {
-   ISP_IOXPUT_32(isp,  ptr[wi++], [i]);
-   wl--;
-   }
+   for (i = 0; i < nw; i++)
+   ISP_IOXPUT_32(isp, ptr[wi + i], [i]);
MEMORYBARRIER(isp, SYNC_REQUEST, 0, 
ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1);
-   again:
-   MBSINIT(, 0, MBLOGALL, 0);
-   if (la < 0x1 && nw < 0x1) {
-   mbs.param[0] = MBOX_LOAD_RISC_RAM_2100;
-   mbs.param[1] = la;
-   mbs.param[2] = 
DMA_WD1(isp->isp_rquest_dma);
-   mbs.param[3] = 
DMA_WD0(isp->isp_rquest_dma);
-   mbs.param[4] = nw;
-   mbs.param[6] = 
DMA_WD3(isp->isp_rquest_dma);
-   mbs.param[7] = 
DMA_WD2(isp->isp_rquest_dma);
-   isp_prt(isp, ISP_LOGDEBUG0, "LOAD RISC 
RAM 2100 %u words at load address 0x%x", nw, la);
-   } else if (wordload) {
-   union {
-   const uint32_t *cp;
-   uint32_t *np;
-   } ucd;
-   ucd.cp = (const uint32_t *)cp;
-   mbs.param[0] = 
MBOX_WRITE_RAM_WORD_EXTENDED;
-   mbs.param[1] = la;
-   mbs.param[2] = (*ucd.np);
-   mbs.param[3] = (*ucd.np) >> 16;
-   

svn commit: r316090 - stable/11/sys/dev/isp

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:24:41 2017
New Revision: 316090
URL: https://svnweb.freebsd.org/changeset/base/316090

Log:
  MFC r315273: Remove tangled isp_mbox_continue() mechanism.
  
  It was implemented to reduce context switches when uploading firmware to
  card's RAM.  But this mechanism is not used last 10 years since all mbox
  operations are now polled, and it was never used for cards produced in
  last 15 years.  Newer cards can use DMA to upload firmware.

Modified:
  stable/11/sys/dev/isp/isp.c
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/isp_freebsd.h
  stable/11/sys/dev/isp/ispvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Tue Mar 28 10:24:01 2017(r316089)
+++ stable/11/sys/dev/isp/isp.c Tue Mar 28 10:24:41 2017(r316090)
@@ -101,7 +101,6 @@ static int isp_handle_other_response(isp
 static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *); 
static void
 isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, long *);
 static void isp_fastpost_complete(ispsoftc_t *, uint32_t);
-static int isp_mbox_continue(ispsoftc_t *);
 static void isp_scsi_init(ispsoftc_t *);
 static void isp_scsi_channel_init(ispsoftc_t *, int);
 static void isp_fibre_init(ispsoftc_t *);
@@ -130,7 +129,6 @@ static int isp_register_port_name_24xx(i
 static int isp_register_node_name_24xx(ispsoftc_t *, int);
 static uint16_t isp_next_handle(ispsoftc_t *, uint16_t *);
 static int isp_fw_state(ispsoftc_t *, int);
-static void isp_mboxcmd_qnw(ispsoftc_t *, mbreg_t *, int);
 static void isp_mboxcmd(ispsoftc_t *, mbreg_t *);
 
 static void isp_spi_update(ispsoftc_t *, int);
@@ -734,87 +732,47 @@ isp_reset(ispsoftc_t *isp, int do_load_d
isp->isp_loaded_fw = 0;
if (dodnld && IS_24XX(isp)) {
const uint32_t *ptr = isp->isp_mdvec->dv_ispfw;
-   int wordload;
+   uint32_t la, wi, wl;
 
/*
 * Keep loading until we run out of f/w.
 */
code_org = ptr[2];  /* 1st load address is our start addr */
-   wordload = 0;
 
for (;;) {
-   uint32_t la, wi, wl;
 
isp_prt(isp, ISP_LOGDEBUG0, "load 0x%x words of code at 
load address 0x%x", ptr[3], ptr[2]);
 
wi = 0;
la = ptr[2];
wl = ptr[3];
-
while (wi < ptr[3]) {
uint32_t *cp;
uint32_t nw;
 
-   nw = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)) >> 2;
-   if (nw > wl) {
-   nw = wl;
-   }
+   nw = min(wl, 
ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)) / 4);
cp = isp->isp_rquest;
-   for (i = 0; i < nw; i++) {
-   ISP_IOXPUT_32(isp,  ptr[wi++], [i]);
-   wl--;
-   }
+   for (i = 0; i < nw; i++)
+   ISP_IOXPUT_32(isp, ptr[wi + i], [i]);
MEMORYBARRIER(isp, SYNC_REQUEST, 0, 
ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1);
-   again:
-   MBSINIT(, 0, MBLOGALL, 0);
-   if (la < 0x1 && nw < 0x1) {
-   mbs.param[0] = MBOX_LOAD_RISC_RAM_2100;
-   mbs.param[1] = la;
-   mbs.param[2] = 
DMA_WD1(isp->isp_rquest_dma);
-   mbs.param[3] = 
DMA_WD0(isp->isp_rquest_dma);
-   mbs.param[4] = nw;
-   mbs.param[6] = 
DMA_WD3(isp->isp_rquest_dma);
-   mbs.param[7] = 
DMA_WD2(isp->isp_rquest_dma);
-   isp_prt(isp, ISP_LOGDEBUG0, "LOAD RISC 
RAM 2100 %u words at load address 0x%x", nw, la);
-   } else if (wordload) {
-   union {
-   const uint32_t *cp;
-   uint32_t *np;
-   } ucd;
-   ucd.cp = (const uint32_t *)cp;
-   mbs.param[0] = 
MBOX_WRITE_RAM_WORD_EXTENDED;
-   mbs.param[1] = la;
-   mbs.param[2] = (*ucd.np);
-   mbs.param[3] = (*ucd.np) >> 16;
-   

svn commit: r316089 - stable/10/sys/dev/isp

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:24:01 2017
New Revision: 316089
URL: https://svnweb.freebsd.org/changeset/base/316089

Log:
  MFC r315236: Remove dangerous and questionable isp_mboxcmd_qnw() call.

Modified:
  stable/10/sys/dev/isp/isp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp.c
==
--- stable/10/sys/dev/isp/isp.c Tue Mar 28 10:23:32 2017(r316088)
+++ stable/10/sys/dev/isp/isp.c Tue Mar 28 10:24:01 2017(r316089)
@@ -6503,20 +6503,8 @@ isp_parse_status(ispsoftc_t *isp, ispsta
 
isp_prt(isp, ISP_LOGINFO, "port %s for target %d", reason, 
XS_TGT(xs));
 
-   /*
-* If we're on a local loop, force a LIP (which is overkill)
-* to force a re-login of this unit. If we're on fabric,
-* then we'll have to log in again as a matter of course.
-*/
-   if (fcp->isp_topo == TOPO_NL_PORT ||
-   fcp->isp_topo == TOPO_FL_PORT) {
-   mbreg_t mbs;
-   MBSINIT(, MBOX_INIT_LIP, MBLOGALL, 0);
-   if (ISP_CAP_2KLOGIN(isp)) {
-   mbs.ibits = (1 << 10);
-   }
-   isp_mboxcmd_qnw(isp, , 1);
-   }
+   /* XXX: Should we trigger rescan or FW announce change? */
+
if (XS_NOERR(xs)) {
lp = >portdb[XS_TGT(xs)];
if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
@@ -6664,9 +6652,8 @@ isp_parse_status_24xx(ispsoftc_t *isp, i
isp_prt(isp, ISP_LOGINFO, "Chan %d port %s for target %d",
chan, reason, XS_TGT(xs));
 
-   /*
-* There is no MBOX_INIT_LIP for the 24XX.
-*/
+   /* XXX: Should we trigger rescan or FW announce change? */
+
if (XS_NOERR(xs)) {
lp = >portdb[XS_TGT(xs)];
if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316088 - stable/11/sys/dev/isp

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:23:32 2017
New Revision: 316088
URL: https://svnweb.freebsd.org/changeset/base/316088

Log:
  MFC r315236: Remove dangerous and questionable isp_mboxcmd_qnw() call.

Modified:
  stable/11/sys/dev/isp/isp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Tue Mar 28 10:22:55 2017(r316087)
+++ stable/11/sys/dev/isp/isp.c Tue Mar 28 10:23:32 2017(r316088)
@@ -6503,20 +6503,8 @@ isp_parse_status(ispsoftc_t *isp, ispsta
 
isp_prt(isp, ISP_LOGINFO, "port %s for target %d", reason, 
XS_TGT(xs));
 
-   /*
-* If we're on a local loop, force a LIP (which is overkill)
-* to force a re-login of this unit. If we're on fabric,
-* then we'll have to log in again as a matter of course.
-*/
-   if (fcp->isp_topo == TOPO_NL_PORT ||
-   fcp->isp_topo == TOPO_FL_PORT) {
-   mbreg_t mbs;
-   MBSINIT(, MBOX_INIT_LIP, MBLOGALL, 0);
-   if (ISP_CAP_2KLOGIN(isp)) {
-   mbs.ibits = (1 << 10);
-   }
-   isp_mboxcmd_qnw(isp, , 1);
-   }
+   /* XXX: Should we trigger rescan or FW announce change? */
+
if (XS_NOERR(xs)) {
lp = >portdb[XS_TGT(xs)];
if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
@@ -6664,9 +6652,8 @@ isp_parse_status_24xx(ispsoftc_t *isp, i
isp_prt(isp, ISP_LOGINFO, "Chan %d port %s for target %d",
chan, reason, XS_TGT(xs));
 
-   /*
-* There is no MBOX_INIT_LIP for the 24XX.
-*/
+   /* XXX: Should we trigger rescan or FW announce change? */
+
if (XS_NOERR(xs)) {
lp = >portdb[XS_TGT(xs)];
if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316087 - stable/10/sys/dev/isp

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:22:55 2017
New Revision: 316087
URL: https://svnweb.freebsd.org/changeset/base/316087

Log:
  MFC r315234: Improvements around attach, reset and detach.
  
  This change fixes DMA resource leak on driver unload.  Also it removes
  DMA resources allocation for hardcoded number of requests before fetching
  the real number from firmware.  Also it prepares ground for more flexible
  IRQs allocation according to firmware capabilities.

Modified:
  stable/10/sys/dev/isp/isp.c
  stable/10/sys/dev/isp/isp_freebsd.c
  stable/10/sys/dev/isp/isp_freebsd.h
  stable/10/sys/dev/isp/isp_library.c
  stable/10/sys/dev/isp/isp_library.h
  stable/10/sys/dev/isp/isp_pci.c
  stable/10/sys/dev/isp/isp_sbus.c
  stable/10/sys/dev/isp/ispvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp.c
==
--- stable/10/sys/dev/isp/isp.c Tue Mar 28 10:19:52 2017(r316086)
+++ stable/10/sys/dev/isp/isp.c Tue Mar 28 10:22:55 2017(r316087)
@@ -178,13 +178,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
const char *btype = "";
static const char dcrc[] = "Downloaded RISC Code Checksum Failure";
 
-   isp->isp_state = ISP_NILSTATE;
-   if (isp->isp_dead) {
-   isp_shutdown(isp);
-   ISP_DISABLE_INTS(isp);
-   return;
-   }
-
/*
 * Basic types (SCSI, FibreChannel and PCI or SBus)
 * have been set in the MD code. We figure out more
@@ -195,56 +188,10 @@ isp_reset(ispsoftc_t *isp, int do_load_d
 * for SCSI adapters and do other settings for the 2100.
 */
 
+   isp->isp_state = ISP_NILSTATE;
ISP_DISABLE_INTS(isp);
 
/*
-* Pick an initial maxcmds value which will be used
-* to allocate xflist pointer space. It may be changed
-* later by the firmware.
-*/
-   if (IS_24XX(isp)) {
-   isp->isp_maxcmds = 4096;
-   } else if (IS_2322(isp)) {
-   isp->isp_maxcmds = 2048;
-   } else if (IS_23XX(isp) || IS_2200(isp)) {
-   isp->isp_maxcmds = 1024;
-   } else {
-   isp->isp_maxcmds = 512;
-   }
-
-   /*
-* Set up DMA for the request and response queues.
-*
-* We do this now so we can use the request queue
-* for dma to load firmware from.
-*/
-   if (ISP_MBOXDMASETUP(isp) != 0) {
-   isp_prt(isp, ISP_LOGERR, "Cannot setup DMA");
-   return;
-   }
-
-   /*
-* Set up default request/response queue in-pointer/out-pointer
-* register indices.
-*/
-   if (IS_24XX(isp)) {
-   isp->isp_rqstinrp = BIU2400_REQINP;
-   isp->isp_rqstoutrp = BIU2400_REQOUTP;
-   isp->isp_respinrp = BIU2400_RSPINP;
-   isp->isp_respoutrp = BIU2400_RSPOUTP;
-   } else if (IS_23XX(isp)) {
-   isp->isp_rqstinrp = BIU_REQINP;
-   isp->isp_rqstoutrp = BIU_REQOUTP;
-   isp->isp_respinrp = BIU_RSPINP;
-   isp->isp_respoutrp = BIU_RSPOUTP;
-   } else {
-   isp->isp_rqstinrp = INMAILBOX4;
-   isp->isp_rqstoutrp = OUTMAILBOX4;
-   isp->isp_respinrp = OUTMAILBOX5;
-   isp->isp_respoutrp = INMAILBOX5;
-   }
-
-   /*
 * Put the board into PAUSE mode (so we can read the SXP registers
 * or write FPM/FBM registers).
 */
@@ -468,7 +415,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
isp->isp_clock = isp->isp_mdvec->dv_clock;
}
}
-
}
 
/*
@@ -477,11 +423,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
isp->isp_intcnt = isp->isp_intbogus = 0;
 
/*
-* Do MD specific pre initialization
-*/
-   ISP_RESET0(isp);
-
-   /*
 * Hit the chip over the head with hammer,
 * and give it a chance to recover.
 */
@@ -513,7 +454,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
}
}
if (val & BIU2400_DMA_ACTIVE) {
-   ISP_RESET0(isp);
isp_prt(isp, ISP_LOGERR, "DMA Failed to Stop on Reset");
return;
}
@@ -533,7 +473,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
}
}
if (val & BIU2400_SOFT_RESET) {
-   ISP_RESET0(isp);
isp_prt(isp, ISP_LOGERR, "Failed to come out of reset");
return;
}
@@ -572,7 +511,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
ISP_DELAY(100);
if (--loops < 0) {
ISP_DUMPREGS(isp, "chip reset timed out");
-   ISP_RESET0(isp);

Re: svn commit: r315974 - in head: lib/libthread_db/arch/arm sys/arm/arm sys/arm/include

2017-03-28 Thread Michal Meloun


On 27.03.2017 19:40, Warner Losh wrote:
> On Mon, Mar 27, 2017 at 11:07 AM, John Baldwin  wrote:
>> On Sunday, March 26, 2017 08:36:56 AM Michal Meloun wrote:
>>> Author: mmel
>>> Date: Sun Mar 26 08:36:56 2017
>>> New Revision: 315974
>>> URL: https://svnweb.freebsd.org/changeset/base/315974
>>>
>>> Log:
>>>   Preserve VFP state across signal delivery.
>>>
>>>   We don't have enouch space to store full VFP context within mcontext
>>>   stucture. Due to this:
>>>- follow i386/amd64 way and store VFP state outside of the mcontext_t
>>>  but point to it. Use the size of VFP state structure as an 'magic'
>>>  indicator of the saved VFP state presence.
>>>- teach set_mcontext() about this external storage.
>>>- for signal delivery, store VFP state to expanded 'struct sigframe'.
>>>
>>>   Submited by:Andrew Gierth (initial version)
>>>   PR: 217611
>>>   MFC after:  2 weeks
>>>
>>> Modified:
>>>   head/lib/libthread_db/arch/arm/libpthread_md.c
>>>   head/sys/arm/arm/machdep.c
>>>   head/sys/arm/include/frame.h
>>>   head/sys/arm/include/ucontext.h
>>>
>>> Modified: head/lib/libthread_db/arch/arm/libpthread_md.c
>>> ==
>>> --- head/lib/libthread_db/arch/arm/libpthread_md.cSun Mar 26 08:36:20 
>>> 2017(r315973)
>>> +++ head/lib/libthread_db/arch/arm/libpthread_md.cSun Mar 26 08:36:56 
>>> 2017(r315974)
>>> @@ -90,7 +90,9 @@ pt_fpreg_to_ucontext(const struct fpreg
>>>   mcontext_t *mc = >uc_mcontext;
>>>
>>>   /* XXX */
>>> - memset(>mc_spare, 0, sizeof(mc->mc_spare));
>>> + mc->mc_vfp_size = 0;
>>> + mc->mc_vfp_ptr = NULL;
>>> + memset(mc->mc_spare, 0, sizeof(mc->mc_spare));
>>>  }
>> I suspect you don't need this bit?  Has FreeBSD/arm ever supported VFP on a 
>> release
>> that also shipped libkse?  (i.e. not libthr but the other thread library)
> No. And even if we had, we blew up binary compat when we went from OABI to 
> EABI.
>
> Warner
I just wanted to maintain the status quo, nothing more.

All I know is that none of threading libraries maintains VFP state,
'struct fpreg' is badly defined (is to short for fill VFP context), and
pre r315974 kernel doesn't initialize _vfp (renamed to mc_spare) part
of mcontext_t.

So I'm seeking a way how to fix all this. But I'm not familiar with
kse -> pthread  transition history, so I'm not sure which parts are
actively used.

Michal

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


svn commit: r316086 - stable/10

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:19:52 2017
New Revision: 316086
URL: https://svnweb.freebsd.org/changeset/base/316086

Log:
  MFC r313568 (by ken):
  Change the isp(4) driver to not adjust the tag type for REQUEST SENSE.
  
  The isp(4) driver was changing the tag type for REQUEST SENSE
  commands to Head of Queue, when the CAM CCB flag
  CAM_TAG_ACTION_VALID was NOT set.  CAM_TAG_ACTION_VALID is set
  when the tag action in the XPT_SCSI_IO is not CAM_TAG_ACTION_NONE
  and when the target has tagged queueing turned on.
  
  In most cases when CAM_TAG_ACTION_VALID is not set, it is because
  the target is not doing tagged queueing.  In those cases, trying to
  send a Head of Queue tag may cause problems.  Instead, default to
  sending a simple tag.
  
  IBM tape drives claim to support tagged queueing in their standard
  Inquiry data, but have the DQue bit set in the control mode page
  (mode page 10).  CAM correctly detects that these drives do not
  support tagged queueing, and clears the CAM_TAG_ACTION_VALID flag
  on CCBs sent down to the drives.
  
  This caused the isp(4) driver to go down the path of setting the
  tag action to a default value, and for Request Sense commands only,
  set the tag action to Head of Queue.
  
  If an IBM tape drive does get a Head of Queue tag, it rejects it with
  Invalid Message Error (0x49,0x00).  (The Qlogic firmware translates that
  to a Transport Error, which the driver translates to an Unrecoverable
  HBA Error, or CAM_UNREC_HBA_ERROR.) So, by default, it wasn't possible
  to get a good response from a REQUEST SENSE to an FC-attached IBM
  tape drive with the isp(4) driver.
  
  IBM tape drives (tested on an LTO-5 with G9N1 firmware and a TS1150
  with 4470 firmware) also have a bug in that sending a command with a
  non-simple tag attribute breaks the tape drive's Command Reference
  Number (CRN) accounting and causes it to ignore all subsequent
  commands because it and the initiator disagree about the next
  expected CRN.  The drives do reject the initial command with a head
  of queue tag with an Invalid Message Error (0x49,0x00), but after that
  they ignore any subsequent commands.  IBM confirmed that it is a bug,
  and sent me test firmware that fixes the bug.  However tape drives in
  the field will still exhibit the bug until they are upgraded.
  
  Request Sense is not often sent to targets because most errors are
  reported automatically through autosense in Fibre Channel and other
  modern transports.  ("Modern" meaning post SCSI-2.)  So this is not
  an error that would crop up frequently.  But Request Sense is useful on
  tape devices to report status information, aside from error reporting.
  
  This problem is less serious without FC-Tape features turned on,
  specifically precise delivery of commands (which enables Command
  Reference Numbers), enabled on the target and initiator.  Without
  FC-Tape features turned on, the target would return an error and
  things would continue on.
  
  And it also does not cause problems for targets that do tagged
  queueing, because in those cases the isp(4) driver just uses the
  tag type that is specified in the CCB, assuming the
  CAM_TAG_ACTION_VALID flag is set, and defaults to sending a Simple
  tag action if it isn't an ordered or head of queue tag.
  
  sys/dev/isp/isp.c:
  In isp_start(), don't try to send Request Sense commands
  with the Head of Queue tag attribute if the CCB doesn't
  have a valid tag action.  The tag action likely isn't valid
  because the target doesn't support tagged queueing.

Modified:
Directory Properties:
  stable/10/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316085 - stable/10/sys/dev/isp

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:15:30 2017
New Revision: 316085
URL: https://svnweb.freebsd.org/changeset/base/316085

Log:
  MFC r299849 (by trasz):
  Remove NULL checks after M_WAITOK allocations from isp(4).

Modified:
  stable/10/sys/dev/isp/isp_pci.c
  stable/10/sys/dev/isp/isp_sbus.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp_pci.c
==
--- stable/10/sys/dev/isp/isp_pci.c Tue Mar 28 10:11:00 2017
(r316084)
+++ stable/10/sys/dev/isp/isp_pci.c Tue Mar 28 10:15:30 2017
(r316085)
@@ -1600,11 +1600,6 @@ isp_pci_mbxdma(ispsoftc_t *isp)
 
len = isp->isp_maxcmds * sizeof (struct isp_pcmd);
isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *) malloc(len, M_DEVBUF, 
M_WAITOK | M_ZERO);
-   if (isp->isp_osinfo.pcmd_pool == NULL) {
-   isp_prt(isp, ISP_LOGERR, "cannot allocate pcmds");
-   ISP_LOCK(isp);
-   return (1);
-   }
 
if (isp->isp_osinfo.sixtyfourbit) {
nsegs = ISP_NSEG64_MAX;
@@ -1621,12 +1616,6 @@ isp_pci_mbxdma(ispsoftc_t *isp)
 
len = sizeof (isp_hdl_t) * isp->isp_maxcmds;
isp->isp_xflist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | 
M_ZERO);
-   if (isp->isp_xflist == NULL) {
-   free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
-   ISP_LOCK(isp);
-   isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
-   return (1);
-   }
for (len = 0; len < isp->isp_maxcmds - 1; len++) {
isp->isp_xflist[len].cmd = >isp_xflist[len+1];
}

Modified: stable/10/sys/dev/isp/isp_sbus.c
==
--- stable/10/sys/dev/isp/isp_sbus.cTue Mar 28 10:11:00 2017
(r316084)
+++ stable/10/sys/dev/isp/isp_sbus.cTue Mar 28 10:15:30 2017
(r316085)
@@ -448,19 +448,8 @@ isp_sbus_mbxdma(ispsoftc_t *isp)
len = sizeof (struct isp_pcmd) * isp->isp_maxcmds;
isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *)
malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
-   if (isp->isp_osinfo.pcmd_pool == NULL) {
-   isp_prt(isp, ISP_LOGERR, "cannot alloc pcmd pool");
-   ISP_LOCK(isp);
-   return (1);
-   }
-
len = sizeof (isp_hdl_t *) * isp->isp_maxcmds;
isp->isp_xflist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | 
M_ZERO);
-   if (isp->isp_xflist == NULL) {
-   isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
-   ISP_LOCK(isp);
-   return (1);
-   }
for (len = 0; len < isp->isp_maxcmds - 1; len++) {
isp->isp_xflist[len].cmd = >isp_xflist[len+1];
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316084 - stable/11/sys/dev/isp

2017-03-28 Thread Alexander Motin
Author: mav
Date: Tue Mar 28 10:11:00 2017
New Revision: 316084
URL: https://svnweb.freebsd.org/changeset/base/316084

Log:
  MFC r315234: Improvements around attach, reset and detach.
  
  This change fixes DMA resource leak on driver unload.  Also it removes
  DMA resources allocation for hardcoded number of requests before fetching
  the real number from firmware.  Also it prepares ground for more flexible
  IRQs allocation according to firmware capabilities.

Modified:
  stable/11/sys/dev/isp/isp.c
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/isp_freebsd.h
  stable/11/sys/dev/isp/isp_library.c
  stable/11/sys/dev/isp/isp_library.h
  stable/11/sys/dev/isp/isp_pci.c
  stable/11/sys/dev/isp/isp_sbus.c
  stable/11/sys/dev/isp/ispvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Tue Mar 28 09:58:54 2017(r316083)
+++ stable/11/sys/dev/isp/isp.c Tue Mar 28 10:11:00 2017(r316084)
@@ -178,13 +178,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
const char *btype = "";
static const char dcrc[] = "Downloaded RISC Code Checksum Failure";
 
-   isp->isp_state = ISP_NILSTATE;
-   if (isp->isp_dead) {
-   isp_shutdown(isp);
-   ISP_DISABLE_INTS(isp);
-   return;
-   }
-
/*
 * Basic types (SCSI, FibreChannel and PCI or SBus)
 * have been set in the MD code. We figure out more
@@ -195,56 +188,10 @@ isp_reset(ispsoftc_t *isp, int do_load_d
 * for SCSI adapters and do other settings for the 2100.
 */
 
+   isp->isp_state = ISP_NILSTATE;
ISP_DISABLE_INTS(isp);
 
/*
-* Pick an initial maxcmds value which will be used
-* to allocate xflist pointer space. It may be changed
-* later by the firmware.
-*/
-   if (IS_24XX(isp)) {
-   isp->isp_maxcmds = 4096;
-   } else if (IS_2322(isp)) {
-   isp->isp_maxcmds = 2048;
-   } else if (IS_23XX(isp) || IS_2200(isp)) {
-   isp->isp_maxcmds = 1024;
-   } else {
-   isp->isp_maxcmds = 512;
-   }
-
-   /*
-* Set up DMA for the request and response queues.
-*
-* We do this now so we can use the request queue
-* for dma to load firmware from.
-*/
-   if (ISP_MBOXDMASETUP(isp) != 0) {
-   isp_prt(isp, ISP_LOGERR, "Cannot setup DMA");
-   return;
-   }
-
-   /*
-* Set up default request/response queue in-pointer/out-pointer
-* register indices.
-*/
-   if (IS_24XX(isp)) {
-   isp->isp_rqstinrp = BIU2400_REQINP;
-   isp->isp_rqstoutrp = BIU2400_REQOUTP;
-   isp->isp_respinrp = BIU2400_RSPINP;
-   isp->isp_respoutrp = BIU2400_RSPOUTP;
-   } else if (IS_23XX(isp)) {
-   isp->isp_rqstinrp = BIU_REQINP;
-   isp->isp_rqstoutrp = BIU_REQOUTP;
-   isp->isp_respinrp = BIU_RSPINP;
-   isp->isp_respoutrp = BIU_RSPOUTP;
-   } else {
-   isp->isp_rqstinrp = INMAILBOX4;
-   isp->isp_rqstoutrp = OUTMAILBOX4;
-   isp->isp_respinrp = OUTMAILBOX5;
-   isp->isp_respoutrp = INMAILBOX5;
-   }
-
-   /*
 * Put the board into PAUSE mode (so we can read the SXP registers
 * or write FPM/FBM registers).
 */
@@ -468,7 +415,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
isp->isp_clock = isp->isp_mdvec->dv_clock;
}
}
-
}
 
/*
@@ -477,11 +423,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
isp->isp_intcnt = isp->isp_intbogus = 0;
 
/*
-* Do MD specific pre initialization
-*/
-   ISP_RESET0(isp);
-
-   /*
 * Hit the chip over the head with hammer,
 * and give it a chance to recover.
 */
@@ -513,7 +454,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
}
}
if (val & BIU2400_DMA_ACTIVE) {
-   ISP_RESET0(isp);
isp_prt(isp, ISP_LOGERR, "DMA Failed to Stop on Reset");
return;
}
@@ -533,7 +473,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
}
}
if (val & BIU2400_SOFT_RESET) {
-   ISP_RESET0(isp);
isp_prt(isp, ISP_LOGERR, "Failed to come out of reset");
return;
}
@@ -572,7 +511,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
ISP_DELAY(100);
if (--loops < 0) {
ISP_DUMPREGS(isp, "chip reset timed out");
-   ISP_RESET0(isp);

svn commit: r316083 - vendor/libarchive/dist/libarchive

2017-03-28 Thread Martin Matuska
Author: mm
Date: Tue Mar 28 09:58:54 2017
New Revision: 316083
URL: https://svnweb.freebsd.org/changeset/base/316083

Log:
  Update vendor/libarchive to git 13b0ed2ba504389c363cd302041fe10afa1837ad
  
  Vendor changes (FreeBSD-related):
  - constify variables in several places
  - unify platform ACL code in a single source file
  - fix unused variable if compiling on FreeBSD without NFSv4 ACL support

Added:
  vendor/libarchive/dist/libarchive/archive_disk_acl_darwin.c
 - copied, changed from r316082, 
vendor/libarchive/dist/libarchive/archive_read_disk_acl_darwin.c
  vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.c
 - copied, changed from r316082, 
vendor/libarchive/dist/libarchive/archive_read_disk_acl_freebsd.c
  vendor/libarchive/dist/libarchive/archive_disk_acl_linux.c
 - copied, changed from r316082, 
vendor/libarchive/dist/libarchive/archive_read_disk_acl_linux.c
  vendor/libarchive/dist/libarchive/archive_disk_acl_sunos.c
 - copied, changed from r316082, 
vendor/libarchive/dist/libarchive/archive_read_disk_acl_sunos.c
Deleted:
  vendor/libarchive/dist/libarchive/archive_acl_maps.h
  vendor/libarchive/dist/libarchive/archive_acl_maps_darwin.c
  vendor/libarchive/dist/libarchive/archive_acl_maps_freebsd.c
  vendor/libarchive/dist/libarchive/archive_acl_maps_linux.c
  vendor/libarchive/dist/libarchive/archive_acl_maps_sunos.c
  vendor/libarchive/dist/libarchive/archive_read_disk_acl_darwin.c
  vendor/libarchive/dist/libarchive/archive_read_disk_acl_freebsd.c
  vendor/libarchive/dist/libarchive/archive_read_disk_acl_linux.c
  vendor/libarchive/dist/libarchive/archive_read_disk_acl_sunos.c
  vendor/libarchive/dist/libarchive/archive_write_disk_acl_darwin.c
  vendor/libarchive/dist/libarchive/archive_write_disk_acl_freebsd.c
  vendor/libarchive/dist/libarchive/archive_write_disk_acl_linux.c
  vendor/libarchive/dist/libarchive/archive_write_disk_acl_sunos.c
Modified:
  vendor/libarchive/dist/libarchive/CMakeLists.txt
  vendor/libarchive/dist/libarchive/archive_entry.c
  vendor/libarchive/dist/libarchive/archive_getdate.c
  vendor/libarchive/dist/libarchive/archive_pack_dev.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_cab.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_mtree.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c
  vendor/libarchive/dist/libarchive/archive_string_sprintf.c
  vendor/libarchive/dist/libarchive/archive_util.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_by_name.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_lz4.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_program.c
  vendor/libarchive/dist/libarchive/archive_write_set_format.c
  vendor/libarchive/dist/libarchive/archive_write_set_format_by_name.c
  vendor/libarchive/dist/libarchive/archive_write_set_format_filter_by_ext.c
  vendor/libarchive/dist/libarchive/archive_write_set_format_warc.c

Modified: vendor/libarchive/dist/libarchive/CMakeLists.txt
==
--- vendor/libarchive/dist/libarchive/CMakeLists.txtTue Mar 28 09:02:42 
2017(r316082)
+++ vendor/libarchive/dist/libarchive/CMakeLists.txtTue Mar 28 09:58:54 
2017(r316083)
@@ -214,25 +214,13 @@ IF(WIN32 AND NOT CYGWIN)
 ENDIF(WIN32 AND NOT CYGWIN)
 
 IF(ARCHIVE_ACL_DARWIN)
-  LIST(APPEND libarchive_SOURCES archive_acl_maps.h)
-  LIST(APPEND libarchive_SOURCES archive_acl_maps_darwin.c)
-  LIST(APPEND libarchive_SOURCES archive_read_disk_acl_darwin.c)
-  LIST(APPEND libarchive_SOURCES archive_write_disk_acl_darwin.c)
+  LIST(APPEND libarchive_SOURCES archive_disk_acl_darwin.c)
 ELSEIF(ARCHIVE_ACL_FREEBSD)
-  LIST(APPEND libarchive_SOURCES archive_acl_maps.h)
-  LIST(APPEND libarchive_SOURCES archive_acl_maps_freebsd.c)
-  LIST(APPEND libarchive_SOURCES archive_read_disk_acl_freebsd.c)
-  LIST(APPEND libarchive_SOURCES archive_write_disk_acl_freebsd.c)
+  LIST(APPEND libarchive_SOURCES archive_disk_acl_freebsd.c)
 ELSEIF(ARCHIVE_ACL_LIBACL)
-  LIST(APPEND libarchive_SOURCES archive_acl_maps.h)
-  LIST(APPEND libarchive_SOURCES archive_acl_maps_linux.c)
-  LIST(APPEND libarchive_SOURCES archive_read_disk_acl_linux.c)
-  LIST(APPEND libarchive_SOURCES archive_write_disk_acl_linux.c)
+  LIST(APPEND libarchive_SOURCES archive_disk_acl_linux.c)
 ELSEIF(ARCHIVE_ACL_SUNOS)
-  LIST(APPEND libarchive_SOURCES archive_acl_maps.h)
-  LIST(APPEND libarchive_SOURCES archive_acl_maps_sunos.c)
-  LIST(APPEND libarchive_SOURCES archive_read_disk_acl_sunos.c)
-  LIST(APPEND libarchive_SOURCES archive_write_disk_acl_sunos.c)
+  LIST(APPEND libarchive_SOURCES archive_disk_acl_sunos.c)
 ENDIF()
 
 # Libarchive is a shared library

Copied and modified: 
vendor/libarchive/dist/libarchive/archive_disk_acl_darwin.c (from r316082, 

svn commit: r316082 - head/share/misc

2017-03-28 Thread Maxim Konovalov
Author: maxim
Date: Tue Mar 28 09:02:42 2017
New Revision: 316082
URL: https://svnweb.freebsd.org/changeset/base/316082

Log:
  DragonFly BSD 4.8.0 release added.

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Tue Mar 28 08:24:16 2017
(r316081)
+++ head/share/misc/bsd-family-tree Tue Mar 28 09:02:42 2017
(r316082)
@@ -351,6 +351,7 @@ FreeBSD 5.2   |  |  
  *--FreeBSD macOS|OpenBSD 6.0  |
  |   11.0   10.12| |   |
  ||   NetBSD 7.1   |   |
+ ||  | |   DragonFly 4.8.0
  ||  | |   |
 FreeBSD 12 -current   |  NetBSD -current  OpenBSD -currentDragonFly 
-current
  ||  | |   |
@@ -708,6 +709,7 @@ OpenBSD 6.0 2016-09-01 [OBD]
 macOS 10.122016-09-20 [APL]
 FreeBSD 11.0   2016-10-10 [FBD]
 NetBSD 7.1 2017-03-11 [NBD]
+DragonFly 4.8.02017-03-27 [DFB]
 
 Bibliography
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r316064 - head/sys/boot/i386/boot2

2017-03-28 Thread Bruce Evans

On Mon, 27 Mar 2017, Julian Elischer wrote:


On Tue, 28 Mar 2017, Bruce Evans wrote:

[...]


they have to fit below 640K and a few multiples of 64K are already
used for buffers).  The limit on 8K is mainly a historical mistake.
A limit of 7.5K simplified booting from 15-sector floppies.  18-sector


My memory says that the limit of 7.5K is becuase there was only 8k left free 
at the front of UFS1 and one sector was used for the boot0 code.


That is only a limit if the boot code is in the ffs partition.  This causes
other problems.  It was the default to start the 'a' partition at offset 0,
but that was changed 10-15 years ago.  I can't find exactly where it is
changed.  I use an offset of 8192 sectors or 4M on new and repartitioned
hard disks.

This is again affected by the existence of floppy disks.  Floppy disks are
usually not partitioned, and don't have space to spare for large boot
blocks.  Some version of the boot code has to work on small media, and
FreeBSD uses the same boot code for all media.  This allowed FreeBSD-1
to have a single boot.flp where IIRC Linux had about 100 variations.
Small media is not as small as it used to be.

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


svn commit: r316081 - head/lib/libcam

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 08:24:16 2017
New Revision: 316081
URL: https://svnweb.freebsd.org/changeset/base/316081

Log:
  Use `sizeof(cam_errbuf)` instead of `CAM_ERRBUF_SIZE` in snprintf calls
  
  Reindent snprintf calls' arguments to match style(9) guidelines with
  respect to indentation.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libcam/camlib.c

Modified: head/lib/libcam/camlib.c
==
--- head/lib/libcam/camlib.cTue Mar 28 08:19:51 2017(r316080)
+++ head/lib/libcam/camlib.cTue Mar 28 08:24:16 2017(r316081)
@@ -120,10 +120,9 @@ cam_get_device(const char *path, char *d
int unit_offset;
int i;
 
-
if (path == NULL) {
-   snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
-"%s: device pathname was NULL", func_name);
+   snprintf(cam_errbuf, sizeof(cam_errbuf),
+   "%s: device pathname was NULL", func_name);
return(-1);
}
 
@@ -145,8 +144,8 @@ cam_get_device(const char *path, char *d
}
 
if (*tmpstr == '\0') {
-   snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
-"%s: no text after slash", func_name);
+   snprintf(cam_errbuf, sizeof(cam_errbuf),
+   "%s: no text after slash", func_name);
free(newpath);
return(-1);
}
@@ -173,9 +172,9 @@ cam_get_device(const char *path, char *d
 * If we only have 1, we don't have a valid device name.
 */
if (strlen(tmpstr) < 2) {
-   snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
-"%s: must have both device name and unit number",
-func_name);
+   snprintf(cam_errbuf, sizeof(cam_errbuf),
+   "%s: must have both device name and unit number",
+   func_name);
free(newpath);
return(-1);
}
@@ -185,9 +184,9 @@ cam_get_device(const char *path, char *d
 * has probably given us all numbers.  Point out the error.
 */
if (isdigit(*tmpstr)) {
-   snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
-"%s: device name cannot begin with a number",
-func_name);
+   snprintf(cam_errbuf, sizeof(cam_errbuf),
+   "%s: device name cannot begin with a number",
+   func_name);
free(newpath);
return(-1);
}
@@ -198,8 +197,8 @@ cam_get_device(const char *path, char *d
 * or he gave us a device name/number format we don't recognize.
 */
if (!isdigit(tmpstr[strlen(tmpstr) - 1])) {
-   snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
-"%s: unable to find device unit number", func_name);
+   snprintf(cam_errbuf, sizeof(cam_errbuf),
+   "%s: unable to find device unit number", func_name);
free(newpath);
return(-1);
}
@@ -275,9 +274,9 @@ cam_open_btl(path_id_t path_id, target_i
int fd, bufsize;
 
if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) {
-   snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
-"%s: couldn't open %s\n%s: %s", func_name, XPT_DEVICE,
-func_name, strerror(errno));
+   snprintf(cam_errbuf, sizeof(cam_errbuf),
+   "%s: couldn't open %s\n%s: %s", func_name, XPT_DEVICE,
+   func_name, strerror(errno));
return(NULL);
}
 
@@ -292,8 +291,8 @@ cam_open_btl(path_id_t path_id, target_i
ccb.cdm.match_buf_len = bufsize;
ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize);
if (ccb.cdm.matches == NULL) {
-   snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
-"%s: couldn't malloc match buffer", func_name);
+   snprintf(cam_errbuf, sizeof(cam_errbuf),
+   "%s: couldn't malloc match buffer", func_name);
close(fd);
return(NULL);
}
@@ -305,8 +304,8 @@ cam_open_btl(path_id_t path_id, target_i
ccb.cdm.patterns = (struct dev_match_pattern *)malloc(
sizeof(struct dev_match_pattern));
if (ccb.cdm.patterns == NULL) {
-   snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
-"%s: couldn't malloc pattern buffer", func_name);
+   snprintf(cam_errbuf, sizeof(cam_errbuf),
+   "%s: couldn't malloc pattern buffer", func_name);
free(ccb.cdm.matches);
ccb.cdm.matches = NULL;
close(fd);
@@ -328,9 +327,9 @@ cam_open_btl(path_id_t path_id, target_i
   PERIPH_MATCH_LUN | PERIPH_MATCH_NAME;
 
if (ioctl(fd, CAMIOCOMMAND, ) == -1) {
-   

svn commit: r316080 - head/lib/libcam

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 08:19:51 2017
New Revision: 316080
URL: https://svnweb.freebsd.org/changeset/base/316080

Log:
  Fix some localized style(9) issues and reword CAM_ERRBUF_SIZE description
  
  The CAM_ERRBUF_SIZE description rewording fixes a typo by proxy.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libcam/camlib.h

Modified: head/lib/libcam/camlib.h
==
--- head/lib/libcam/camlib.hTue Mar 28 07:58:27 2017(r316079)
+++ head/lib/libcam/camlib.hTue Mar 28 08:19:51 2017(r316080)
@@ -70,13 +70,13 @@
 #include 
 #include 
 
-#define CAM_ERRBUF_SIZE 2048   /* sizeof the CAM libarary error string  */
+#defineCAM_ERRBUF_SIZE 2048/* CAM library error string size */
 
 /*
  * Right now we hard code the transport layer device, but this will change
  * if we ever get more than one transport layer.
  */
-#define XPT_DEVICE "/dev/xpt0"
+#defineXPT_DEVICE  "/dev/xpt0"
 
 
 extern char cam_errbuf[];
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r316064 - head/sys/boot/i386/boot2

2017-03-28 Thread Warner Losh
[[ sorry for the top post but it's quick ]]

Summary, in Bruce's own words

> the whole optimization step was silly.

I agree. on my -current system, clang compiled boot2 was 4 bytes
smaller after ripping it out. gcc was a whopping 7 bytes larger. Since
gcc has 156 still free, I think it's best to just retire this.

Maybe you can give me a hint as to which structs to look at to get
back those 7 bytes :)

Thanks for the writeup. It was most enlightening.

Warner

On Mon, Mar 27, 2017 at 11:53 PM, Bruce Evans  wrote:
> On Mon, 27 Mar 2017, Warner Losh wrote:
>
>> Log:
>>  Fix build with path names with 'align' or 'nop' in them.
>>
>>  clang is now inserting .file directives with the entire path in
>>  them. This is fine, except that our sed peephole optimizer removes
>>  them if ${SRCTOP} or ${OBJTOP} contains 'align' or 'nop', leading to
>>  build failures. The sed peephole optimizer removes useful things for
>>  boot2 when used with clang, so restrict its use to gcc. Also, gcc no
>>  longer generates nops to pad things, so there's no point in removing
>>  it. Specialize the optimization to just removing the .align 4 lines to
>>  preclude inadvertant path matching.
>>
>>  Sponsored by: Netflix
>>  Commit brought to you the path: /home/xxx/NCD-3592-logsynopts/FreeBSD
>>
>> Modified:
>>  head/sys/boot/i386/boot2/Makefile
>>
>> Modified: head/sys/boot/i386/boot2/Makefile
>>
>> ==
>> --- head/sys/boot/i386/boot2/Makefile   Mon Mar 27 22:34:43 2017
>> (r316063)
>> +++ head/sys/boot/i386/boot2/Makefile   Mon Mar 27 22:53:36 2017
>> (r316064)
>> @@ -91,10 +91,18 @@ boot2.o: boot2.s
>>
>> SRCS=   boot2.c boot2.h
>>
>> +# Gcc (4.2.1 at least) benefits from removing the forced alignment
>> +# clang doesn't. Make the removal as specific as possible to avoid
>> +# false positives (like path names with odd names for debugging info).
>> +# In the past, gcc benefited from nop removal, but not in 4.2.1.
>> +# Think of this as a poor-man's peephole optimizer for gcc 4.2.1
>> boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c
>> ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c
>> -   sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
>> -   rm -f boot2.s.tmp
>> +.if ${COMPILER_TYPE} == "gcc"
>> +   sed -e '/\.align 4/d' < boot2.s.tmp > boot2.s
>> +.else
>> +   cp boot2.s.tmp boot2.s
>> +.endif
>>
>> boot2.h: boot1.out
>> ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
>
>
> That's silly; if you just fix the regexps to actually be as specifice as
> possible, then they would just work with no need for large comments or
> ifdefs.  '\.align' instead of 'align' is a good start.  ' 4' instead of
> nothing is not so good.  There should also be a check for nothing
> except whitespace before '\.align'.  The whitespace before '4' might
> be a tab, but perhaps gcc only generates a space, and only generates
> unwanted alignments of precisely 4, with no fill bytes.  The general
> syntax would be too hard to parse, but it is easy to handle any digit,
> and also '\.p2align', and allow nothing except whitespace after the
> digit.
>
> Last time I looked at this about 5 years ago, but after clang, the
> whole optimization step was silly.  It made little difference for gcc
> and no difference for clang as you say.  The nop removal that you
> removed was silliest.  I think compilers stopped generating nops for
> padding many years before that code was written.  In text sections,
> They should generate something like '.p2align x,y,z', where x is the
> alignment, y is empty (it is the fill byte, which defaults to nop, but
> we don't want that but want a larger null instruction for multiple
> bytes) and z is a limit on the amount of padding (x is only a
> preference and z limits it).  This syntax would be hard to parse.
> But CFLAGS has -Os, and that works for preventing padding in the
> text section, so nop is never generated, not even with the spelling
> 'align'.
>
> -Os doesn't work so well for other things.  For kernels, it is completely
> broken with gcc-4.2.1 unless -fno-inline-functions is also used (it
> breaks the inlining parameters whose misconfiguration is probably the
> actual bug.  This doesn't seem to be a problem for boot code.  IIRC,
> the only simply broken thing is that alignment is still done for variables.
> This generates ".align 4".
>
> -Os is differently broken for clang, so the simple editing doesn't help.
> -Wa,-al to see what the assembler is doing is broken for clang.
> -mpreferred-stack-boundary doesn't work for clang, so is not used, but
> clang does better stack alignment by default.  This might still waste
> some instructions, but not for every function.  -mno-align-long-strings
> doesn't work for clang or for gcc > 4.2.1, so is not used.  clang does
> quite different string padding by default, and IIRC it is worse.  But
> boot2 hardly has any long strings.
>
> boot code 

svn commit: r316079 - head/sys/boot/i386/boot2

2017-03-28 Thread Warner Losh
Author: imp
Date: Tue Mar 28 07:58:27 2017
New Revision: 316079
URL: https://svnweb.freebsd.org/changeset/base/316079

Log:
  Simply retire the sedification of the boot2.s file. It's been obsolete
  for years.
  
  clang before 96 free after 100 (+4)
  gcc before 163 free after 156 (-7)
  
  Suggested by: bde@
  Sponsored by: Netflix

Modified:
  head/sys/boot/i386/boot2/Makefile

Modified: head/sys/boot/i386/boot2/Makefile
==
--- head/sys/boot/i386/boot2/Makefile   Tue Mar 28 07:10:35 2017
(r316078)
+++ head/sys/boot/i386/boot2/Makefile   Tue Mar 28 07:58:27 2017
(r316079)
@@ -66,7 +66,7 @@ boot1.out: boot1.o
${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
 
 CLEANFILES+=   boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
-   boot2.s boot2.s.tmp boot2.h sio.o
+   boot2.h sio.o
 
 boot2: boot2.ld
@set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
@@ -86,24 +86,8 @@ boot2.bin: boot2.out
 boot2.out: ${BTXCRT} boot2.o sio.o
${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
 
-boot2.o: boot2.s
-   ${CC} ${ACFLAGS} -c boot2.s
-
 SRCS=  boot2.c boot2.h
 
-# Gcc (4.2.1 at least) benefits from removing the forced alignment
-# clang doesn't. Make the removal as specific as possible to avoid
-# false positives (like path names with odd names for debugging info).
-# In the past, gcc benefited from nop removal, but not in 4.2.1.
-# Think of this as a poor-man's peephole optimizer for gcc 4.2.1
-boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c
-   ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c
-.if ${COMPILER_TYPE} == "gcc"
-   sed -e '/\.align 4/d' < boot2.s.tmp > boot2.s
-.else
-   cp boot2.s.tmp boot2.s
-.endif
-
 boot2.h: boot1.out
${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
{ x = $$1 - ORG1; \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316078 - head/sys/boot/i386/gptboot

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 07:10:35 2017
New Revision: 316078
URL: https://svnweb.freebsd.org/changeset/base/316078

Log:
  gpt*boot: Save a bit more memory when LOADER_NO_GELI_SUPPORT is specified
  
  Don't compile geliargs into the image and don't pass geliargs to the 
respective
  bootloader code via __exec(..).
  
  This saves a negligible amount of memory/disk space.
  
  X-MFC with:   r296963
  Obtained from:Isilon OneFS
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/i386/gptboot/gptboot.c

Modified: head/sys/boot/i386/gptboot/gptboot.c
==
--- head/sys/boot/i386/gptboot/gptboot.cTue Mar 28 07:01:40 2017
(r316077)
+++ head/sys/boot/i386/gptboot/gptboot.cTue Mar 28 07:10:35 2017
(r316078)
@@ -84,7 +84,9 @@ static struct dsk dsk;
 static char kname[1024];
 static int comspeed = SIOSPD;
 static struct bootinfo bootinfo;
+#ifdef LOADER_GELI_SUPPORT
 static struct geli_boot_args geliargs;
+#endif
 
 static vm_offset_t high_heap_base;
 static uint32_tbios_basemem, bios_extmem, high_heap_size;
@@ -476,16 +478,18 @@ load(void)
 bootinfo.bi_esymtab = VTOP(p);
 bootinfo.bi_kernelname = VTOP(kname);
 bootinfo.bi_bios_dev = dsk.drive;
-geliargs.size = sizeof(geliargs);
 #ifdef LOADER_GELI_SUPPORT
+geliargs.size = sizeof(geliargs);
 bcopy(gelipw, geliargs.gelipw, sizeof(geliargs.gelipw));
 bzero(gelipw, sizeof(gelipw));
-#else
-   geliargs.gelipw[0] = '\0';
 #endif
 __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
   MAKEBOOTDEV(dev_maj[dsk.type], dsk.part + 1, dsk.unit, 0xff),
-  KARGS_FLAGS_EXTARG, 0, 0, VTOP(), geliargs);
+  KARGS_FLAGS_EXTARG, 0, 0, VTOP()
+#ifdef LOADER_GELI_SUPPORT
+  , geliargs
+#endif
+  );
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316077 - head/sys/boot/i386/gptzfsboot

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 07:01:40 2017
New Revision: 316077
URL: https://svnweb.freebsd.org/changeset/base/316077

Log:
  Unbreak compilation with gcc 4.2.1
  
  -Wtentative-definition-incomplete-type isn't implemented for 4.2.1
  
  X-MFC with:   r304321
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/i386/gptzfsboot/Makefile

Modified: head/sys/boot/i386/gptzfsboot/Makefile
==
--- head/sys/boot/i386/gptzfsboot/Makefile  Tue Mar 28 06:39:54 2017
(r316076)
+++ head/sys/boot/i386/gptzfsboot/Makefile  Tue Mar 28 07:01:40 2017
(r316077)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include 
+
 .PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../gptboot \
${.CURDIR}/../zfsboot ${.CURDIR}/../common \
${.CURDIR}/../../common ${.CURDIR}/../../../crypto/skein
@@ -34,7 +36,12 @@ CFLAGS=  -DBOOTPROG=\"gptzfsboot\" \
-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
-   -Winline -Wno-tentative-definition-incomplete-type -Wno-pointer-sign
+   -Winline -Wno-pointer-sign
+
+.if ${COMPILER_TYPE} == "clang" || \
+(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201)
+CFLAGS+=   -Wno-tentative-definition-incomplete-type
+.endif
 
 # Do not unroll skein loops, reduce code size
 CFLAGS+=   -DSKEIN_LOOP=111
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316076 - head/sys/boot/common

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 06:39:54 2017
New Revision: 316076
URL: https://svnweb.freebsd.org/changeset/base/316076

Log:
  sys/boot/common: Make geli(4) support optional in MI sources
  
  This saves a negligible amount of memory for non-geli enabled
  bootloaders.
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/common/Makefile.inc
  head/sys/boot/common/module.c

Modified: head/sys/boot/common/Makefile.inc
==
--- head/sys/boot/common/Makefile.inc   Tue Mar 28 06:13:21 2017
(r316075)
+++ head/sys/boot/common/Makefile.inc   Tue Mar 28 06:39:54 2017
(r316076)
@@ -37,6 +37,9 @@ CFLAGS+= -DLOADER_GPT_SUPPORT
 CFLAGS+= -DLOADER_MBR_SUPPORT
 .endif
 .endif
+.if !defined(LOADER_NO_GELI_SUPPORT)
+CFLAGS+= -DLOADER_GELI_SUPPORT
+.endif
 
 .if defined(HAVE_BCACHE)
 SRCS+=  bcache.c

Modified: head/sys/boot/common/module.c
==
--- head/sys/boot/common/module.c   Tue Mar 28 06:13:21 2017
(r316075)
+++ head/sys/boot/common/module.c   Tue Mar 28 06:39:54 2017
(r316076)
@@ -183,6 +183,7 @@ command_load(int argc, char *argv[])
 return (error == 0 ? CMD_OK : CMD_CRIT);
 }
 
+#ifdef LOADER_GELI_SUPPORT
 COMMAND_SET(load_geli, "load_geli", "load a geli key", command_load_geli);
 
 static int
@@ -221,6 +222,7 @@ command_load_geli(int argc, char *argv[]
 sprintf(typestr, "%s:geli_keyfile%d", argv[1], num);
 return (file_loadraw(argv[2], typestr, 1) ? CMD_OK : CMD_ERROR);
 }
+#endif
 
 void
 unload(void)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r316064 - head/sys/boot/i386/boot2

2017-03-28 Thread Julian Elischer



On Tue, 28 Mar 2017, Bruce Evans wrote:

[...]


they have to fit below 640K and a few multiples of 64K are already
used for buffers).  The limit on 8K is mainly a historical mistake.
A limit of 7.5K simplified booting from 15-sector floppies.  18-sector


My memory says that the limit of 7.5K is becuase there was only 8k left 
free at the front of UFS1 and one sector was used for the boot0 code.




floppies allowed easy expansion to 9K, but were unportable for a small
gain.  The default partition layout left only 8K below the ffs
superblock, but was only a default.

Bruce



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


svn commit: r316074 - in stable/10: lib/libutil share/man/man9

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 06:13:16 2017
New Revision: 316074
URL: https://svnweb.freebsd.org/changeset/base/316074

Log:
  MFC r313436,r313437,r313438,r314587,r315687:
  
  r313436:
  
  Clarify #includes for hexdump(3) vs sbuf_hexdump(9)
  
  hexdump(3) only requires libutil.h, whereas sbuf_hexdump(9) requires
  sys/types.h (for ssize_t) and sys/sbuf.h
  
  r313437:
  
  Create link from hexdump(3) to sbuf_hexdump(9) as the manpage describes
  sbuf_hexdump(9)'s behavior
  
  r313438:
  
  Clean up trailing and leading whitespace for variables to make it
  consistent with the rest of the file and style.Makefile(9) a bit
  more
  
  r314587:
  
  Correct MLINKS for sbuf_hexdump(9)
  
  sbuf_hexdump(9) should be linked to sbuf(9), not hexdump(3). Another
  review will be posted to deduplicate the sbuf_hexdump reference in
  in hexdump(3) or at the very least make the information less duplicative.
  
  r315687:
  
  Document sbuf_hexdump(9) in just sbuf(9)
  
  - Remove duplicate references to sbuf_hexdump(9) from hexdump(3).
sbuf_hexdump(9) already pointed back to hexdump(3) for implementation
details.
  - Refer to sbuf_hexdump(9) instead of sbuf(9) for completeness

Modified:
  stable/10/lib/libutil/hexdump.3
  stable/10/share/man/man9/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libutil/hexdump.3
==
--- stable/10/lib/libutil/hexdump.3 Tue Mar 28 06:07:59 2017
(r316073)
+++ stable/10/lib/libutil/hexdump.3 Tue Mar 28 06:13:16 2017
(r316074)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 8, 2014
+.Dd March 21, 2017
 .Dt HEXDUMP 3
 .Os
 .Sh NAME
@@ -36,17 +36,8 @@
 .Nd "dump a block of bytes to standard out in hexadecimal form"
 .Sh SYNOPSIS
 .In libutil.h
-.In sys/sbuf.h
 .Ft void
 .Fn hexdump "void *ptr" "int length" "const char *hdr" "int flags"
-.Ft void
-.Fo sbuf_hexdump
-.Fa "struct sbuf *sb"
-.Fa "void *ptr"
-.Fa "int length"
-.Fa "const char *hdr"
-.Fa "int flags"
-.Fc
 .Sh DESCRIPTION
 The
 .Fn hexdump
@@ -59,11 +50,6 @@ output will start with an offset count, 
 followed by 16
 .Tn ASCII
 characters.
-.Pp
-The
-.Fn sbuf_hexdump
-function prints the hexdump to the supplied
-.Xr sbuf 9 .
 .Bl -tag -width indent
 .It Fa ptr
 Pointer to the array of bytes to print.
@@ -103,7 +89,7 @@ Do not print the character values on eac
 .El
 .Sh SEE ALSO
 .Xr ascii 7 ,
-.Xr sbuf 9
+.Xr sbuf_hexdump 9
 .Sh AUTHORS
 This manual page was written by
 .An Scott Long .

Modified: stable/10/share/man/man9/Makefile
==
--- stable/10/share/man/man9/Makefile   Tue Mar 28 06:07:59 2017
(r316073)
+++ stable/10/share/man/man9/Makefile   Tue Mar 28 06:13:16 2017
(r316074)
@@ -1156,6 +1156,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \
sbuf.9 sbuf_done.9 \
sbuf.9 sbuf_error.9 \
sbuf.9 sbuf_finish.9 \
+   sbuf.9 sbuf_hexdump.9 \
sbuf.9 sbuf_len.9 \
sbuf.9 sbuf_new.9 \
sbuf.9 sbuf_new_for_sysctl.9 \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316075 - in stable/11: lib/libutil share/man/man9

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 06:13:21 2017
New Revision: 316075
URL: https://svnweb.freebsd.org/changeset/base/316075

Log:
  MFC r313436,r313437,r313438,r314587,r315687:
  
  r313436:
  
  Clarify #includes for hexdump(3) vs sbuf_hexdump(9)
  
  hexdump(3) only requires libutil.h, whereas sbuf_hexdump(9) requires
  sys/types.h (for ssize_t) and sys/sbuf.h
  
  r313437:
  
  Create link from hexdump(3) to sbuf_hexdump(9) as the manpage describes
  sbuf_hexdump(9)'s behavior
  
  r313438:
  
  Clean up trailing and leading whitespace for variables to make it
  consistent with the rest of the file and style.Makefile(9) a bit
  more
  
  r314587:
  
  Correct MLINKS for sbuf_hexdump(9)
  
  sbuf_hexdump(9) should be linked to sbuf(9), not hexdump(3). Another
  review will be posted to deduplicate the sbuf_hexdump reference in
  in hexdump(3) or at the very least make the information less duplicative.
  
  r315687:
  
  Document sbuf_hexdump(9) in just sbuf(9)
  
  - Remove duplicate references to sbuf_hexdump(9) from hexdump(3).
sbuf_hexdump(9) already pointed back to hexdump(3) for implementation
details.
  - Refer to sbuf_hexdump(9) instead of sbuf(9) for completeness

Modified:
  stable/11/lib/libutil/hexdump.3
  stable/11/share/man/man9/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libutil/hexdump.3
==
--- stable/11/lib/libutil/hexdump.3 Tue Mar 28 06:13:16 2017
(r316074)
+++ stable/11/lib/libutil/hexdump.3 Tue Mar 28 06:13:21 2017
(r316075)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 8, 2014
+.Dd March 21, 2017
 .Dt HEXDUMP 3
 .Os
 .Sh NAME
@@ -36,17 +36,8 @@
 .Nd "dump a block of bytes to standard out in hexadecimal form"
 .Sh SYNOPSIS
 .In libutil.h
-.In sys/sbuf.h
 .Ft void
 .Fn hexdump "void *ptr" "int length" "const char *hdr" "int flags"
-.Ft void
-.Fo sbuf_hexdump
-.Fa "struct sbuf *sb"
-.Fa "void *ptr"
-.Fa "int length"
-.Fa "const char *hdr"
-.Fa "int flags"
-.Fc
 .Sh DESCRIPTION
 The
 .Fn hexdump
@@ -59,11 +50,6 @@ output will start with an offset count, 
 followed by 16
 .Tn ASCII
 characters.
-.Pp
-The
-.Fn sbuf_hexdump
-function prints the hexdump to the supplied
-.Xr sbuf 9 .
 .Bl -tag -width indent
 .It Fa ptr
 Pointer to the array of bytes to print.
@@ -103,7 +89,7 @@ Do not print the character values on eac
 .El
 .Sh SEE ALSO
 .Xr ascii 7 ,
-.Xr sbuf 9
+.Xr sbuf_hexdump 9
 .Sh AUTHORS
 This manual page was written by
 .An Scott Long .

Modified: stable/11/share/man/man9/Makefile
==
--- stable/11/share/man/man9/Makefile   Tue Mar 28 06:13:16 2017
(r316074)
+++ stable/11/share/man/man9/Makefile   Tue Mar 28 06:13:21 2017
(r316075)
@@ -1467,6 +1467,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \
sbuf.9 sbuf_done.9 \
sbuf.9 sbuf_error.9 \
sbuf.9 sbuf_finish.9 \
+   sbuf.9 sbuf_hexdump.9 \
sbuf.9 sbuf_len.9 \
sbuf.9 sbuf_new.9 \
sbuf.9 sbuf_new_auto.9 \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316073 - in stable/11/sys: dev/drm dev/drm2 kern vm

2017-03-28 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 28 06:07:59 2017
New Revision: 316073
URL: https://svnweb.freebsd.org/changeset/base/316073

Log:
  MFC r315281:
  Use atop() instead of OFF_TO_IDX() for convertion of addresses or
  addresses offsets, as intended.
  
  MFC r315580 (by alc):
  Simplify the logic for clipping the range returned by the pager to fit
  within the map entry.
  Use atop() rather than OFF_TO_IDX() on addresses.

Modified:
  stable/11/sys/dev/drm/drm_scatter.c
  stable/11/sys/dev/drm2/drm_scatter.c
  stable/11/sys/kern/kern_proc.c
  stable/11/sys/kern/vfs_bio.c
  stable/11/sys/vm/vm_fault.c
  stable/11/sys/vm/vm_kern.c
  stable/11/sys/vm/vm_map.c
  stable/11/sys/vm/vm_mmap.c
  stable/11/sys/vm/vm_object.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/drm/drm_scatter.c
==
--- stable/11/sys/dev/drm/drm_scatter.c Tue Mar 28 06:05:26 2017
(r316072)
+++ stable/11/sys/dev/drm/drm_scatter.c Tue Mar 28 06:07:59 2017
(r316073)
@@ -48,7 +48,7 @@ drm_sg_alloc(struct drm_device *dev, str
entry = malloc(sizeof(*entry), DRM_MEM_DRIVER, M_WAITOK | M_ZERO);
 
size = round_page(request->size);
-   entry->pages = OFF_TO_IDX(size);
+   entry->pages = atop(size);
entry->busaddr = malloc(entry->pages * sizeof(*entry->busaddr),
DRM_MEM_SGLISTS, M_WAITOK | M_ZERO);
 

Modified: stable/11/sys/dev/drm2/drm_scatter.c
==
--- stable/11/sys/dev/drm2/drm_scatter.cTue Mar 28 06:05:26 2017
(r316072)
+++ stable/11/sys/dev/drm2/drm_scatter.cTue Mar 28 06:07:59 2017
(r316073)
@@ -74,7 +74,7 @@ int drm_sg_alloc(struct drm_device *dev,
DRM_DEBUG("request size=%ld\n", request->size);
 
size = round_page(request->size);
-   entry->pages = OFF_TO_IDX(size);
+   entry->pages = atop(size);
entry->busaddr = malloc(entry->pages * sizeof(*entry->busaddr),
DRM_MEM_SGLISTS, M_NOWAIT | M_ZERO);
if (!entry->busaddr) {

Modified: stable/11/sys/kern/kern_proc.c
==
--- stable/11/sys/kern/kern_proc.c  Tue Mar 28 06:05:26 2017
(r316072)
+++ stable/11/sys/kern/kern_proc.c  Tue Mar 28 06:07:59 2017
(r316073)
@@ -2272,7 +2272,7 @@ kern_proc_vmmap_resident(vm_map_t map, v
if (m_adv != NULL) {
m = m_adv;
} else {
-   pi_adv = OFF_TO_IDX(entry->end - addr);
+   pi_adv = atop(entry->end - addr);
pindex = pi;
for (tobj = obj;; tobj = tobj->backing_object) {
m = vm_page_find_least(tobj, pindex);
@@ -2296,7 +2296,7 @@ kern_proc_vmmap_resident(vm_map_t map, v
(pmap_mincore(map->pmap, addr, _pa) &
MINCORE_SUPER) != 0) {
kve->kve_flags |= KVME_FLAG_SUPER;
-   pi_adv = OFF_TO_IDX(pagesizes[1]);
+   pi_adv = atop(pagesizes[1]);
} else {
/*
 * We do not test the found page on validity.

Modified: stable/11/sys/kern/vfs_bio.c
==
--- stable/11/sys/kern/vfs_bio.cTue Mar 28 06:05:26 2017
(r316072)
+++ stable/11/sys/kern/vfs_bio.cTue Mar 28 06:07:59 2017
(r316073)
@@ -3918,7 +3918,7 @@ biodone(struct bio *bp)
start = trunc_page((vm_offset_t)bp->bio_data);
end = round_page((vm_offset_t)bp->bio_data + bp->bio_length);
bp->bio_data = unmapped_buf;
-   pmap_qremove(start, OFF_TO_IDX(end - start));
+   pmap_qremove(start, atop(end - start));
vmem_free(transient_arena, start, end - start);
atomic_add_int(_transient_maps, -1);
}

Modified: stable/11/sys/vm/vm_fault.c
==
--- stable/11/sys/vm/vm_fault.c Tue Mar 28 06:05:26 2017(r316072)
+++ stable/11/sys/vm/vm_fault.c Tue Mar 28 06:07:59 2017(r316073)
@@ -352,8 +352,7 @@ vm_fault_populate(struct faultstate *fs,
MPASS(fs->lookup_still_valid);
 
pager_first = OFF_TO_IDX(fs->entry->offset);
-   pager_last = OFF_TO_IDX(fs->entry->offset + fs->entry->end -
-   fs->entry->start) - 1;
+   pager_last = pager_first + atop(fs->entry->end - fs->entry->start) - 1;
unlock_map(fs);
unlock_vp(fs);
 
@@ -404,18 +403,20 @@ vm_fault_populate(struct faultstate *fs,
 * In case the pager expanded the range, clip it to fit into
 * the map entry.
 */
-   map_first = MAX(OFF_TO_IDX(fs->entry->offset), pager_first);
-   

svn commit: r316072 - stable/10/lib/libkvm

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 06:05:26 2017
New Revision: 316072
URL: https://svnweb.freebsd.org/changeset/base/316072

Log:
  MFC r315686,r315688:
  
  r315686:
  
  kvm_geterr: handle `kd` == NULL in a deterministic/graceful manner
  
  Return a NUL string instead of just working by accident with kvm_geterr(3)
  when MALLOC_PRODUCTION is disabled (I didn't confirm the MALLOC_PRODUCTION
  being enabled path).
  
  Document the new explicit return behavior for kvm_geterr(3), as well
  as the previous implicit behavior, i.e., the buffer attached to
  returned via kvm_geterr(3) would be empty if a previous error hadn't been
  stored in `kd`.
  
  r315688:
  
  kvm_write: fix -Wcast-qual warning in pointer arithmetic argument
  
  Cast buf to `const char *` when doing arithmetic operation to match
  `cp`'s type [1].

Modified:
  stable/10/lib/libkvm/kvm.c
  stable/10/lib/libkvm/kvm_geterr.3
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libkvm/kvm.c
==
--- stable/10/lib/libkvm/kvm.c  Tue Mar 28 06:03:43 2017(r316071)
+++ stable/10/lib/libkvm/kvm.c  Tue Mar 28 06:05:26 2017(r316072)
@@ -76,9 +76,14 @@ static char sccsid[] = "@(#)kvm.c8.2 (B
 /* from src/lib/libc/gen/nlist.c */
 int __fdnlist(int, struct nlist *);
 
+static char _kd_is_null[] = "";
+
 char *
 kvm_geterr(kvm_t *kd)
 {
+
+   if (kd == NULL)
+   return (_kd_is_null);
return (kd->errbuf);
 }
 
@@ -623,5 +628,5 @@ kvm_write(kvm_t *kd, u_long kva, const v
len -= cw;
}
 
-   return (cp - (char *)buf);
+   return (cp - (const char *)buf);
 }

Modified: stable/10/lib/libkvm/kvm_geterr.3
==
--- stable/10/lib/libkvm/kvm_geterr.3   Tue Mar 28 06:03:43 2017
(r316071)
+++ stable/10/lib/libkvm/kvm_geterr.3   Tue Mar 28 06:05:26 2017
(r316072)
@@ -32,7 +32,7 @@
 .\" @(#)kvm_geterr.3   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd March 21, 2017
 .Dt KVM_GETERR 3
 .Os
 .Sh NAME
@@ -54,6 +54,15 @@ library call did not produce an error.
 The string returned is stored in memory owned by
 .Xr kvm 3
 so the message should be copied out and saved elsewhere if necessary.
+.Sh RETURN VALUES
+The function
+.Fn kvm_geterr
+will return "" if
+.Fa kd
+is
+.Dv NULL
+or an error has not been captured for
+.Fa kd .
 .Sh SEE ALSO
 .Xr kvm 3 ,
 .Xr kvm_close 3 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316071 - stable/11/lib/libkvm

2017-03-28 Thread Ngie Cooper
Author: ngie
Date: Tue Mar 28 06:03:43 2017
New Revision: 316071
URL: https://svnweb.freebsd.org/changeset/base/316071

Log:
  MFC r315686,r315688:
  
  r315686:
  
  kvm_geterr: handle `kd` == NULL in a deterministic/graceful manner
  
  Return a NUL string instead of just working by accident with kvm_geterr(3)
  when MALLOC_PRODUCTION is disabled (I didn't confirm the MALLOC_PRODUCTION
  being enabled path).
  
  Document the new explicit return behavior for kvm_geterr(3), as well
  as the previous implicit behavior, i.e., the buffer attached to
  returned via kvm_geterr(3) would be empty if a previous error hadn't been
  stored in `kd`.
  
  r315688:
  
  kvm_write: fix -Wcast-qual warning in pointer arithmetic argument
  
  Cast buf to `const char *` when doing arithmetic operation to match
  `cp`'s type [1].

Modified:
  stable/11/lib/libkvm/kvm.c
  stable/11/lib/libkvm/kvm_geterr.3
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libkvm/kvm.c
==
--- stable/11/lib/libkvm/kvm.c  Tue Mar 28 05:57:20 2017(r316070)
+++ stable/11/lib/libkvm/kvm.c  Tue Mar 28 06:03:43 2017(r316071)
@@ -66,6 +66,8 @@ static char sccsid[] = "@(#)kvm.c 8.2 (B
 
 SET_DECLARE(kvm_arch, struct kvm_arch);
 
+static char _kd_is_null[] = "";
+
 /* from src/lib/libc/gen/nlist.c */
 int __fdnlist(int, struct nlist *);
 
@@ -113,6 +115,9 @@ kvm_fdnlist(kvm_t *kd, struct kvm_nlist 
 char *
 kvm_geterr(kvm_t *kd)
 {
+
+   if (kd == NULL)
+   return (_kd_is_null);
return (kd->errbuf);
 }
 
@@ -932,7 +937,7 @@ kvm_write(kvm_t *kd, u_long kva, const v
len -= cw;
}
 
-   return (cp - (char *)buf);
+   return (cp - (const char *)buf);
 }
 
 int

Modified: stable/11/lib/libkvm/kvm_geterr.3
==
--- stable/11/lib/libkvm/kvm_geterr.3   Tue Mar 28 05:57:20 2017
(r316070)
+++ stable/11/lib/libkvm/kvm_geterr.3   Tue Mar 28 06:03:43 2017
(r316071)
@@ -32,7 +32,7 @@
 .\" @(#)kvm_geterr.3   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd March 21, 2017
 .Dt KVM_GETERR 3
 .Os
 .Sh NAME
@@ -54,6 +54,15 @@ library call did not produce an error.
 The string returned is stored in memory owned by
 .Xr kvm 3
 so the message should be copied out and saved elsewhere if necessary.
+.Sh RETURN VALUES
+The function
+.Fn kvm_geterr
+will return "" if
+.Fa kd
+is
+.Dv NULL
+or an error has not been captured for
+.Fa kd .
 .Sh SEE ALSO
 .Xr kvm 3 ,
 .Xr kvm_close 3 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"