svn commit: r222049 - head/sys/dev/ath/ath_rate/sample

2011-05-18 Thread Adrian Chadd
Author: adrian
Date: Wed May 18 07:20:30 2011
New Revision: 222049
URL: http://svn.freebsd.org/changeset/base/222049

Log:
  Modify the sample rate control algorithm to only select/sample HT
  rates for HT nodes.

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Wed May 18 02:14:26 2011
(r222048)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Wed May 18 07:20:30 2011
(r222049)
@@ -161,9 +161,10 @@ dot11rate_label(const HAL_RATE_TABLE *rt
  * or -1 if all the average_tx_times are 0.
  */
 static __inline int
-pick_best_rate(struct sample_node *sn, const HAL_RATE_TABLE *rt,
+pick_best_rate(struct ath_node *an, const HAL_RATE_TABLE *rt,
 int size_bin, int require_acked_before)
 {
+   struct sample_node *sn = ATH_NODE_SAMPLE(an);
 int best_rate_rix, best_rate_tt;
uint32_t mask;
int rix, tt;
@@ -174,6 +175,12 @@ pick_best_rate(struct sample_node *sn, c
if ((mask & 1) == 0)/* not a supported rate */
continue;
 
+   /* Don't pick a non-HT rate for a HT node */
+   if ((an->an_node.ni_flags & IEEE80211_NODE_HT) &&
+   (rt->info[rix].phy != IEEE80211_T_HT)) {
+   continue;
+   }
+
tt = sn->stats[size_bin][rix].average_tx_time;
if (tt <= 0 ||
(require_acked_before &&
@@ -196,11 +203,12 @@ pick_best_rate(struct sample_node *sn, c
  * Pick a good "random" bit-rate to sample other than the current one.
  */
 static __inline int
-pick_sample_rate(struct sample_softc *ssc , struct sample_node *sn,
+pick_sample_rate(struct sample_softc *ssc , struct ath_node *an,
 const HAL_RATE_TABLE *rt, int size_bin)
 {
 #defineDOT11RATE(ix)   (rt->info[ix].dot11Rate & IEEE80211_RATE_VAL)
 #defineMCS(ix) (rt->info[ix].dot11Rate | IEEE80211_RATE_MCS)
+   struct sample_node *sn = ATH_NODE_SAMPLE(an);
int current_rix, rix;
unsigned current_tt;
uint32_t mask;
@@ -208,6 +216,7 @@ pick_sample_rate(struct sample_softc *ss
current_rix = sn->current_rix[size_bin];
if (current_rix < 0) {
/* no successes yet, send at the lowest bit-rate */
+   /* XXX should return MCS0 if HT */
return 0;
}
 
@@ -223,6 +232,13 @@ pick_sample_rate(struct sample_softc *ss
continue;
}
 
+   /* if the node is HT and the rate isn't HT, don't bother sample 
*/
+   if ((an->an_node.ni_flags & IEEE80211_NODE_HT) &&
+   (rt->info[rix].phy != IEEE80211_T_HT)) {
+   mask &= ~(1 current_tt) {
mask &= ~(1< 11M */
-   if (DOT11RATE(rix) > 2*11 && rix > current_rix + 2) {
-   mask &= ~(1< 11M for 
non-HT rates */
+   if (! (an->an_node.ni_flags & IEEE80211_NODE_HT)) {
+   if (DOT11RATE(rix) > 2*11 && rix > current_rix + 2) {
+   mask &= ~(1sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT);
 
-   best_rix = pick_best_rate(sn, rt, size_bin, !mrr);
+   best_rix = pick_best_rate(an, rt, size_bin, !mrr);
if (best_rix >= 0) {
average_tx_time = sn->stats[size_bin][best_rix].average_tx_time;
} else {
@@ -338,7 +356,7 @@ ath_rate_findrate(struct ath_softc *sc, 
 * rates to sample_rate% of the total transmission time.
 */
if (sn->sample_tt[size_bin] < average_tx_time * 
(sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) {
-   rix = pick_sample_rate(ssc, sn, rt, size_bin);
+   rix = pick_sample_rate(ssc, an, rt, size_bin);
IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL,
 &an->an_node, "size %u sample rate %d current rate %d",
 bin_to_size(size_bin), RATE(rix),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222050 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2011-05-18 Thread Martin Matuska
Author: mm
Date: Wed May 18 07:37:02 2011
New Revision: 222050
URL: http://svn.freebsd.org/changeset/base/222050

Log:
  Restore old (v15) behaviour for a recursive snapshot destroy.
  (zfs destroy -r pool/dataset@snapshot)
  
  To destroy all descendent snapshots with the same name the top level
  snapshot was not required to exist. So if the top level snapshot does
  not exist, check permissions of the parent dataset instead.
  
  Filed as Illumos Bug #1043
  
  Reviewed by:  delphij
  Approved by:  pjd
  MFC after:together with v28

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed May 
18 07:20:30 2011(r222049)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed May 
18 07:37:02 2011(r222050)
@@ -689,6 +689,9 @@ zfs_secpolicy_destroy(zfs_cmd_t *zc, cre
  * and destroying snapshots requires descendent permissions, a successfull
  * check of the top level snapshot applies to snapshots of all descendent
  * datasets as well.
+ *
+ * The top level snapshot may not exist when doing a recursive destroy.
+ * In this case fallback to permissions of the parent dataset.
  */
 static int
 zfs_secpolicy_destroy_snaps(zfs_cmd_t *zc, cred_t *cr)
@@ -700,6 +703,9 @@ zfs_secpolicy_destroy_snaps(zfs_cmd_t *z
 
error = zfs_secpolicy_destroy_perms(dsname, cr);
 
+   if (error == ENOENT)
+   error = zfs_secpolicy_destroy_perms(zc->zc_name, cr);
+
strfree(dsname);
return (error);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222051 - in head/sys/dev: sound/usb usb usb/input usb/storage

2011-05-18 Thread Andriy Gapon
Author: avg
Date: Wed May 18 07:40:12 2011
New Revision: 222051
URL: http://svn.freebsd.org/changeset/base/222051

Log:
  usb: change to one-pass probing of device drivers
  
  This brings USB bus more in line with how newbus is supposed to be used.
  Also, because of the two-pass probing the following message was produced
  by devd in default configuration when almost any USB device was
  connected:
Unknown USB device: vendor <> product <> bus <>
  This should be fixed now.
  
  Note that many USB device drivers pass some information from probe
  method to attach method via ivars.  For this to continue working we rely
  on the fact that the subr_bus code calls probe method of a winning driver
  again before calling its attach method in the case where multiple
  drivers claim to support a device.  This is done because device
  description is set in successful probe methods and we want to get a correct
  device description from a winning driver.  So now this logic is re-used
  for setting ivars too.
  
  Reviewed by:  hselasky
  MFC after:1 month

Modified:
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/usb/input/ums.c
  head/sys/dev/usb/storage/umass.c
  head/sys/dev/usb/storage/ustorage_fs.c
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usbdi.h

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Wed May 18 07:37:02 2011
(r222050)
+++ head/sys/dev/sound/usb/uaudio.c Wed May 18 07:40:12 2011
(r222051)
@@ -539,9 +539,6 @@ uaudio_probe(device_t dev)
if (uaa->usb_mode != USB_MODE_HOST)
return (ENXIO);
 
-   if (uaa->use_generic == 0)
-   return (ENXIO);
-
/* lookup non-standard device */
 
if (uaa->info.bInterfaceClass != UICLASS_AUDIO) {
@@ -555,7 +552,7 @@ uaudio_probe(device_t dev)
if (usb_test_quirk(uaa, UQ_BAD_AUDIO))
return (ENXIO);
else
-   return (0);
+   return (BUS_PROBE_GENERIC);
}
 
/* check for MIDI stream */
@@ -564,7 +561,7 @@ uaudio_probe(device_t dev)
if (usb_test_quirk(uaa, UQ_BAD_MIDI))
return (ENXIO);
else
-   return (0);
+   return (BUS_PROBE_GENERIC);
}
return (ENXIO);
 }

Modified: head/sys/dev/usb/input/uhid.c
==
--- head/sys/dev/usb/input/uhid.c   Wed May 18 07:37:02 2011
(r222050)
+++ head/sys/dev/usb/input/uhid.c   Wed May 18 07:40:12 2011
(r222051)
@@ -617,10 +617,6 @@ uhid_probe(device_t dev)
if (uaa->usb_mode != USB_MODE_HOST) {
return (ENXIO);
}
-   if (uaa->use_generic == 0) {
-   /* give Mouse and Keyboard drivers a try first */
-   return (ENXIO);
-   }
if (uaa->info.bInterfaceClass != UICLASS_HID) {
 
/* the Xbox 360 gamepad doesn't use the HID class */

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Wed May 18 07:37:02 2011
(r222050)
+++ head/sys/dev/usb/input/ukbd.c   Wed May 18 07:40:12 2011
(r222051)
@@ -771,7 +771,7 @@ ukbd_probe(device_t dev)
if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
return (ENXIO);
else
-   return (BUS_PROBE_GENERIC);
+   return (BUS_PROBE_DEFAULT);
}
 
error = usbd_req_get_hid_desc(uaa->device, NULL,
@@ -793,7 +793,7 @@ ukbd_probe(device_t dev)
if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
error = ENXIO;
else
-   error = BUS_PROBE_GENERIC;
+   error = BUS_PROBE_DEFAULT;
} else
error = ENXIO;
 

Modified: head/sys/dev/usb/input/ums.c
==
--- head/sys/dev/usb/input/ums.cWed May 18 07:37:02 2011
(r222050)
+++ head/sys/dev/usb/input/ums.cWed May 18 07:40:12 2011
(r222051)
@@ -373,7 +373,7 @@ ums_probe(device_t dev)
 
if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
(uaa->info.bInterfaceProtocol == UIPROTO_MOUSE))
-   return (BUS_PROBE_GENERIC);
+   return (BUS_PROBE_DEFAULT);
 
error = usbd_req_get_hid_desc(uaa->device, NULL,
&d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex);
@@ -383,7 +383,7 @@ ums_probe(device_t dev)
 
if (hid_is_collection(d_ptr, d_len,
HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)))
-   error = BUS_PROBE_GENERIC;
+  

svn commit: r222053 - head/lib/libprocstat

2011-05-18 Thread Sergey Kandaurov
Author: pluknet
Date: Wed May 18 10:04:54 2011
New Revision: 222053
URL: http://svn.freebsd.org/changeset/base/222053

Log:
  Release allocated memory in procstat_close().
  
  Reviewed by:  stass

Modified:
  head/lib/libprocstat/libprocstat.c

Modified: head/lib/libprocstat/libprocstat.c
==
--- head/lib/libprocstat/libprocstat.c  Wed May 18 08:26:59 2011
(r222052)
+++ head/lib/libprocstat/libprocstat.c  Wed May 18 10:04:54 2011
(r222053)
@@ -132,6 +132,7 @@ procstat_close(struct procstat *procstat
assert(procstat);
if (procstat->type == PROCSTAT_KVM)
kvm_close(procstat->kd);
+   free(procstat);
 }
 
 struct procstat *
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r222051 - in head/sys/dev: sound/usb usb usb/input usb/storage

2011-05-18 Thread Hans Petter Selasky
On Wednesday 18 May 2011 09:40:12 Andriy Gapon wrote:
> Author: avg
> Date: Wed May 18 07:40:12 2011
> New Revision: 222051
> URL: http://svn.freebsd.org/changeset/base/222051
> 
> Log:
>   usb: change to one-pass probing of device drivers
> 
>   This brings USB bus more in line with how newbus is supposed to be used.
>   Also, because of the two-pass probing the following message was produced
>   by devd in default configuration when almost any USB device was
>   connected:
>   Unknown USB device: vendor <> product <> bus <>
>   This should be fixed now.
> 
>   Note that many USB device drivers pass some information from probe
>   method to attach method via ivars.  For this to continue working we rely
>   on the fact that the subr_bus code calls probe method of a winning driver
>   again before calling its attach method in the case where multiple
>   drivers claim to support a device.  This is done because device
>   description is set in successful probe methods and we want to get a
> correct device description from a winning driver.  So now this logic is
> re-used for setting ivars too.
> 
>   Reviewed by:hselasky
>   MFC after:  1 month
> 
> Modified:
>   head/sys/dev/sound/usb/uaudio.c
>   head/sys/dev/usb/input/uhid.c
>   head/sys/dev/usb/input/ukbd.c
>   head/sys/dev/usb/input/ums.c
>   head/sys/dev/usb/storage/umass.c
>   head/sys/dev/usb/storage/ustorage_fs.c
>   head/sys/dev/usb/usb_device.c
>   head/sys/dev/usb/usbdi.h
> 

Looks like you missed ng_ubt.c. Just do a "grep -r" for the replaced fields.

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


svn commit: r222054 - head/sys/dev/ath/ath_hal/ar5416

2011-05-18 Thread Adrian Chadd
Author: adrian
Date: Wed May 18 11:28:23 2011
New Revision: 222054
URL: http://svn.freebsd.org/changeset/base/222054

Log:
  This isn't needed any longer, it's defined in ah_internal.h.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c  Wed May 18 10:04:54 
2011(r222053)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c  Wed May 18 11:28:23 
2011(r222054)
@@ -1368,10 +1368,6 @@ ar5416UpdateChainMasks(struct ath_hal *a
AH5416(ah)->ah_rx_chainmask);
 }
 
-#ifndef IS_5GHZ_FAST_CLOCK_EN
-#defineIS_5GHZ_FAST_CLOCK_EN(ah, chan) AH_FALSE
-#endif
-
 void
 ar5416InitPLL(struct ath_hal *ah, const struct ieee80211_channel *chan)
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r222051 - in head/sys/dev: sound/usb usb usb/input usb/storage

2011-05-18 Thread Garrett Cooper
On Wed, May 18, 2011 at 4:20 AM, Hans Petter Selasky
 wrote:
> On Wednesday 18 May 2011 09:40:12 Andriy Gapon wrote:
>> Author: avg
>> Date: Wed May 18 07:40:12 2011
>> New Revision: 222051
>> URL: http://svn.freebsd.org/changeset/base/222051
>>
>> Log:
>>   usb: change to one-pass probing of device drivers
>>
>>   This brings USB bus more in line with how newbus is supposed to be used.
>>   Also, because of the two-pass probing the following message was produced
>>   by devd in default configuration when almost any USB device was
>>   connected:
>>       Unknown USB device: vendor <> product <> bus <>
>>   This should be fixed now.
>>
>>   Note that many USB device drivers pass some information from probe
>>   method to attach method via ivars.  For this to continue working we rely
>>   on the fact that the subr_bus code calls probe method of a winning driver
>>   again before calling its attach method in the case where multiple
>>   drivers claim to support a device.  This is done because device
>>   description is set in successful probe methods and we want to get a
>> correct device description from a winning driver.  So now this logic is
>> re-used for setting ivars too.
>>
>>   Reviewed by:        hselasky
>>   MFC after:  1 month
>>
>> Modified:
>>   head/sys/dev/sound/usb/uaudio.c
>>   head/sys/dev/usb/input/uhid.c
>>   head/sys/dev/usb/input/ukbd.c
>>   head/sys/dev/usb/input/ums.c
>>   head/sys/dev/usb/storage/umass.c
>>   head/sys/dev/usb/storage/ustorage_fs.c
>>   head/sys/dev/usb/usb_device.c
>>   head/sys/dev/usb/usbdi.h
>>
>
> Looks like you missed ng_ubt.c. Just do a "grep -r" for the replaced fields.

The patch I sent offline to you guys was the only affected file
based on a grep around /sys/... ; I based my patch on other code
patterns in this commit.
Thanks!
-Garrett
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222055 - head/sys/netgraph/bluetooth/drivers/ubt

2011-05-18 Thread Andriy Gapon
Author: avg
Date: Wed May 18 11:38:36 2011
New Revision: 222055
URL: http://svn.freebsd.org/changeset/base/222055

Log:
  usb: fix a missed use of use_generic in r222051
  
  Submitted by: gcooper
  Pointyhat to: avg
  MFC after:1 month
  X-MFC with:   r222051

Modified:
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c

Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
==
--- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.cWed May 18 11:28:23 
2011(r222054)
+++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.cWed May 18 11:38:36 
2011(r222055)
@@ -409,6 +409,7 @@ static int
 ubt_probe(device_t dev)
 {
struct usb_attach_arg   *uaa = device_get_ivars(dev);
+   int error;
 
if (uaa->usb_mode != USB_MODE_HOST)
return (ENXIO);
@@ -416,14 +417,14 @@ ubt_probe(device_t dev)
if (uaa->info.bIfaceIndex != 0)
return (ENXIO);
 
-   if (uaa->use_generic == 0)
-   return (ENXIO);
-
if (usbd_lookup_id_by_uaa(ubt_ignore_devs,
sizeof(ubt_ignore_devs), uaa) == 0)
return (ENXIO);
 
-   return (usbd_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa));
+   error = usbd_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa);
+   if (error == 0)
+   return (BUS_PROBE_GENERIC);
+   return (error);
 } /* ubt_probe */
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r222051 - in head/sys/dev: sound/usb usb usb/input usb/storage

2011-05-18 Thread Andriy Gapon
on 18/05/2011 14:32 Garrett Cooper said the following:
> On Wed, May 18, 2011 at 4:20 AM, Hans Petter Selasky
>  wrote:
>> Looks like you missed ng_ubt.c. Just do a "grep -r" for the replaced fields.

I thought I did, but...
Thank you for the report.

> The patch I sent offline to you guys was the only affected file
> based on a grep around /sys/... ; I based my patch on other code
> patterns in this commit.

Thank you Garrett for the patch and the report.

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


svn commit: r222056 - stable/8/sys/nfs

2011-05-18 Thread Ruslan Ermilov
Author: ru
Date: Wed May 18 14:02:33 2011
New Revision: 222056
URL: http://svn.freebsd.org/changeset/base/222056

Log:
  r221933 vanished support for "nocto" in boot.nfsroot.options loader
  tunable; fix it by redoing a merge of r221436.

Modified:
  stable/8/sys/nfs/nfs_diskless.c

Modified: stable/8/sys/nfs/nfs_diskless.c
==
--- stable/8/sys/nfs/nfs_diskless.c Wed May 18 11:38:36 2011
(r222055)
+++ stable/8/sys/nfs/nfs_diskless.c Wed May 18 14:02:33 2011
(r222056)
@@ -112,6 +112,8 @@ nfs_parse_options(const char *envopts, s
nd->flags |= NFSMNT_NOCONN;
else if (strcmp(o, "nolockd") == 0)
nd->flags |= NFSMNT_NOLOCKD;
+   else if (strcmp(o, "nocto") == 0)
+   nd->flags |= NFSMNT_NOCTO;
else if (strcmp(o, "nfsv2") == 0)
nd->flags &= ~(NFSMNT_NFSV3 | NFSMNT_NFSV4);
else if (strcmp(o, "nfsv3") == 0) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222064 - stable/8/sys/geom/label

2011-05-18 Thread Andrey V. Elsukov
Author: ae
Date: Wed May 18 16:07:24 2011
New Revision: 222064
URL: http://svn.freebsd.org/changeset/base/222064

Log:
  MFC r221433:
When checking existence of providers skip those which are orphaned.
  
PR: kern/132273

Modified:
  stable/8/sys/geom/label/g_label.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/geom/label/g_label.c
==
--- stable/8/sys/geom/label/g_label.c   Wed May 18 16:01:29 2011
(r222063)
+++ stable/8/sys/geom/label/g_label.c   Wed May 18 16:07:24 2011
(r222064)
@@ -162,6 +162,8 @@ g_label_create(struct gctl_req *req, str
pp2 = LIST_FIRST(&gp->provider);
if (pp2 == NULL)
continue;
+   if ((pp2->flags & G_PF_ORPHAN) != 0)
+   continue;
if (strcmp(pp2->name, name) == 0) {
G_LABEL_DEBUG(1, "Label %s(%s) already exists (%s).",
label, name, pp->name);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222065 - head/sys/i386/xen

2011-05-18 Thread Attilio Rao
Author: attilio
Date: Wed May 18 16:07:30 2011
New Revision: 222065
URL: http://svn.freebsd.org/changeset/base/222065

Log:
  Merge part of r221322 from largeSMP project:
  Sync XEN support with i386 about the usage of ipi_send_cpu()
  
  Tested by:pluknet
  MFC after:2 weeks

Modified:
  head/sys/i386/xen/mp_machdep.c

Modified: head/sys/i386/xen/mp_machdep.c
==
--- head/sys/i386/xen/mp_machdep.c  Wed May 18 16:07:24 2011
(r222064)
+++ head/sys/i386/xen/mp_machdep.c  Wed May 18 16:07:30 2011
(r222065)
@@ -960,6 +960,30 @@ start_ap(int apic_id)
 }
 
 /*
+ * send an IPI to a specific CPU.
+ */
+static void
+ipi_send_cpu(int cpu, u_int ipi)
+{
+   u_int bitmap, old_pending, new_pending;
+
+   if (IPI_IS_BITMAPED(ipi)) { 
+   bitmap = 1 << ipi;
+   ipi = IPI_BITMAP_VECTOR;
+   do {
+   old_pending = cpu_ipi_pending[cpu];
+   new_pending = old_pending | bitmap;
+   } while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
+   old_pending, new_pending)); 
+   if (!old_pending)
+   ipi_pcpu(cpu, RESCHEDULE_VECTOR);
+   } else {
+   KASSERT(call_data != NULL, ("call_data not set"));
+   ipi_pcpu(cpu, CALL_FUNCTION_VECTOR);
+   }
+}
+
+/*
  * Flush the TLB on all other CPU's
  */
 static void
@@ -1101,14 +1125,6 @@ void
 ipi_selected(cpumask_t cpus, u_int ipi)
 {
int cpu;
-   u_int bitmap = 0;
-   u_int old_pending;
-   u_int new_pending;
-   
-   if (IPI_IS_BITMAPED(ipi)) { 
-   bitmap = 1 << ipi;
-   ipi = IPI_BITMAP_VECTOR;
-   } 
 
/*
 * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit
@@ -1118,23 +1134,11 @@ ipi_selected(cpumask_t cpus, u_int ipi)
if (ipi == IPI_STOP_HARD)
atomic_set_int(&ipi_nmi_pending, cpus);
 
-   CTR3(KTR_SMP, "%s: cpus: %x ipi: %x", __func__, cpus, ipi);
while ((cpu = ffs(cpus)) != 0) {
cpu--;
cpus &= ~(1 << cpu);
-
-   if (bitmap) {
-   do {
-   old_pending = cpu_ipi_pending[cpu];
-   new_pending = old_pending | bitmap;
-   } while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
-   old_pending, new_pending)); 
-   if (!old_pending)
-   ipi_pcpu(cpu, RESCHEDULE_VECTOR);
-   } else {
-   KASSERT(call_data != NULL, ("call_data not set"));
-   ipi_pcpu(cpu, CALL_FUNCTION_VECTOR);
-   }
+   CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi);
+   ipi_send_cpu(cpu, ipi);
}
 }
 
@@ -1144,14 +1148,6 @@ ipi_selected(cpumask_t cpus, u_int ipi)
 void
 ipi_cpu(int cpu, u_int ipi)
 {
-   u_int bitmap = 0;
-   u_int old_pending;
-   u_int new_pending;
-   
-   if (IPI_IS_BITMAPED(ipi)) { 
-   bitmap = 1 << ipi;
-   ipi = IPI_BITMAP_VECTOR;
-   } 
 
/*
 * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit
@@ -1162,19 +1158,7 @@ ipi_cpu(int cpu, u_int ipi)
atomic_set_int(&ipi_nmi_pending, 1 << cpu);
 
CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi);
-
-   if (bitmap) {
-   do {
-   old_pending = cpu_ipi_pending[cpu];
-   new_pending = old_pending | bitmap;
-   } while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
-   old_pending, new_pending)); 
-   if (!old_pending)
-   ipi_pcpu(cpu, RESCHEDULE_VECTOR);
-   } else {
-   KASSERT(call_data != NULL, ("call_data not set"));
-   ipi_pcpu(cpu, CALL_FUNCTION_VECTOR);
-   }
+   ipi_send_cpu(cpu, ipi);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222067 - stable/7/sys/geom/label

2011-05-18 Thread Andrey V. Elsukov
Author: ae
Date: Wed May 18 16:28:28 2011
New Revision: 222067
URL: http://svn.freebsd.org/changeset/base/222067

Log:
  MFC r221433:
When checking existence of providers skip those which are orphaned.
  
PR: kern/132273

Modified:
  stable/7/sys/geom/label/g_label.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/geom/label/g_label.c
==
--- stable/7/sys/geom/label/g_label.c   Wed May 18 16:20:28 2011
(r222066)
+++ stable/7/sys/geom/label/g_label.c   Wed May 18 16:28:28 2011
(r222067)
@@ -161,6 +161,8 @@ g_label_create(struct gctl_req *req, str
pp2 = LIST_FIRST(&gp->provider);
if (pp2 == NULL)
continue;
+   if ((pp2->flags & G_PF_ORPHAN) != 0)
+   continue;
if (strcmp(pp2->name, name) == 0) {
G_LABEL_DEBUG(1, "Label %s(%s) already exists (%s).",
label, name, pp->name);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r221904 - head/sys/netinet

2011-05-18 Thread Bjoern A. Zeeb

On May 14, 2011, at 6:22 PM, Michael Tuexen wrote:

> Author: tuexen
> Date: Sat May 14 18:22:14 2011
> New Revision: 221904
> URL: http://svn.freebsd.org/changeset/base/221904
> 
> Log:
>  Fix the source address selection for boundall sockets
>  when sending INITs to a global IPv4 address having
>  only private IPv4 address.
>  Allow the usage of a private address and make sure
>  that no other private address will be used by the
>  association.
>  Initial work was done by rrs@.
> 
>  MFC after: 1 week.
> 
> Modified:
>  head/sys/netinet/sctp_output.c
>  head/sys/netinet/sctp_output.h
> 
> Modified: head/sys/netinet/sctp_output.c
> ==
> --- head/sys/netinet/sctp_output.cSat May 14 18:22:08 2011
> (r221903)
> +++ head/sys/netinet/sctp_output.cSat May 14 18:22:14 2011
> (r221904)

...

> @@ -3068,19 +3112,81 @@ plan_d:
>* It is restricted for some
>* reason.. probably not yet added.
>*/
> + sifa = NULL;
>   continue;
>   }
>   }
> - atomic_add_int(&sifa->refcount, 1);
> - return (sifa);
> + goto out;
>   }
>   }
> - /*
> -  * Ok we can find NO address to source from that is not on our
> -  * restricted list and non_asoc_address is NOT ok, or it is on our
> -  * restricted list. We can't source to it :-(
> -  */
> - return (NULL);
> +#ifdef INET
> + if ((retried == 0) && (stcb->asoc.ipv4_local_scope == 0)) {
> + stcb->asoc.ipv4_local_scope = 1;
> + retried = 1;
> + goto again_with_private_addresses_allowed;
> + } else if (retried == 1) {
> + stcb->asoc.ipv4_local_scope = 0;
> + }
> +#endif
> +out:
> + if (sifa) {
> +#ifdef INET

either this needs to go outside the if() or ...

> + if (retried == 1) {
> + LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
> + if (dest_is_loop == 0 && 
> SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) {
> + /* wrong base scope */
> + continue;
> + }
> + LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, 
> next_ifa) {
> + struct sctp_ifa *tmp_sifa;
> +
> + if ((sctp_ifa->localifa_flags & 
> SCTP_ADDR_DEFER_USE) &&
> + (non_asoc_addr_ok == 0))
> + continue;
> + tmp_sifa = 
> sctp_is_ifa_addr_acceptable(sctp_ifa,
> + dest_is_loop,
> + dest_is_priv, fam);
> + if (tmp_sifa == NULL) {
> + continue;
> + }
> + if (tmp_sifa == sifa) {
> + continue;
> + }
> + if (stcb) {
> + if 
> (sctp_is_address_in_scope(tmp_sifa,
> + stcb->asoc.ipv4_addr_legal,
> + stcb->asoc.ipv6_addr_legal,
> + stcb->asoc.loopback_scope,
> + stcb->asoc.ipv4_local_scope,
> + stcb->asoc.local_scope,
> + stcb->asoc.site_scope, 0) 
> == 0) {
> + continue;
> + }
> + if (((non_asoc_addr_ok == 0) &&
> + 
> (sctp_is_addr_restricted(stcb, tmp_sifa))) ||
> + (non_asoc_addr_ok &&
> + 
> (sctp_is_addr_restricted(stcb, tmp_sifa)) &&
> + 
> (!sctp_is_addr_pending(stcb, tmp_sifa {
> + /*
> +  * It is restricted
> +  * for some reason..
> +  * probably not yet
> +  * added.
> +  */
> 

svn commit: r222068 - head/sys/powerpc/booke

2011-05-18 Thread Attilio Rao
Author: attilio
Date: Wed May 18 16:41:38 2011
New Revision: 222068
URL: http://svn.freebsd.org/changeset/base/222068

Log:
  Fix newly introduced code.
  
  Reported by:  sbruno

Modified:
  head/sys/powerpc/booke/platform_bare.c

Modified: head/sys/powerpc/booke/platform_bare.c
==
--- head/sys/powerpc/booke/platform_bare.c  Wed May 18 16:28:28 2011
(r222067)
+++ head/sys/powerpc/booke/platform_bare.c  Wed May 18 16:41:38 2011
(r222068)
@@ -241,7 +241,7 @@ bare_smp_start_cpu(platform_t plat, stru
int timeout;
 
eebpcr = ccsr_read4(OCP85XX_EEBPCR);
-   if ((eebpcr & (pc->pc_cpumask << 24)) != 0) {
+   if ((eebpcr & (1 << (pc->pc_cpuid + 24))) != 0) {
printf("%s: CPU=%d already out of hold-off state!\n",
__func__, pc->pc_cpuid);
return (ENXIO);
@@ -259,7 +259,8 @@ bare_smp_start_cpu(platform_t plat, stru
/*
 * Release AP from hold-off state
 */
-   eebpcr |= (pc->pc_cpumask << 24);
+   
+   eebpcr |= (1 << (pc->pc_cpuid + 24));
ccsr_write4(OCP85XX_EEBPCR, eebpcr);
__asm __volatile("isync; msync");
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222069 - head/sys/powerpc/booke

2011-05-18 Thread Attilio Rao
Author: attilio
Date: Wed May 18 16:42:01 2011
New Revision: 222069
URL: http://svn.freebsd.org/changeset/base/222069

Log:
  Fix warning spit out.
  
  Reported by:  sbruno

Modified:
  head/sys/powerpc/booke/pmap.c

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Wed May 18 16:41:38 2011
(r222068)
+++ head/sys/powerpc/booke/pmap.c   Wed May 18 16:42:01 2011
(r222069)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1228,7 +1229,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset
PTE_VALID;
}
/* Mark kernel_pmap active on all CPUs */
-   kernel_pmap->pm_active = ~0;
+   CPU_FILL(&kernel_pmap->pm_active);
 
/***/
/* Final setup */
@@ -1483,7 +1484,7 @@ mmu_booke_pinit(mmu_t mmu, pmap_t pmap)
PMAP_LOCK_INIT(pmap);
for (i = 0; i < MAXCPU; i++)
pmap->pm_tid[i] = TID_NONE;
-   pmap->pm_active = 0;
+   CPU_ZERO(&kernel_pmap->pm_active);
bzero(&pmap->pm_stats, sizeof(pmap->pm_stats));
bzero(&pmap->pm_pdir, sizeof(pte_t *) * PDIR_NENTRIES);
TAILQ_INIT(&pmap->pm_ptbl_list);
@@ -1838,7 +1839,7 @@ mmu_booke_activate(mmu_t mmu, struct thr
 
mtx_lock_spin(&sched_lock);
 
-   atomic_set_int(&pmap->pm_active, PCPU_GET(cpumask));
+   CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask));
PCPU_SET(curpmap, pmap);

if (pmap->pm_tid[PCPU_GET(cpuid)] == TID_NONE)
@@ -1867,7 +1868,9 @@ mmu_booke_deactivate(mmu_t mmu, struct t
CTR5(KTR_PMAP, "%s: td=%p, proc = '%s', id = %d, pmap = 0x%08x",
__func__, td, td->td_proc->p_comm, td->td_proc->p_pid, pmap);
 
-   atomic_clear_int(&pmap->pm_active, PCPU_GET(cpumask));
+   sched_pin();
+   CPU_NAND_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask));
+   sched_unpin();
PCPU_SET(curpmap, NULL);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222070 - head/sys/powerpc/booke

2011-05-18 Thread Attilio Rao
Author: attilio
Date: Wed May 18 16:50:13 2011
New Revision: 222070
URL: http://svn.freebsd.org/changeset/base/222070

Log:
  Revert r222069,222068 as they were intended to be committed to the
  largeSMP branch.
  
  Reported by:  pluknet

Modified:
  head/sys/powerpc/booke/platform_bare.c
  head/sys/powerpc/booke/pmap.c

Modified: head/sys/powerpc/booke/platform_bare.c
==
--- head/sys/powerpc/booke/platform_bare.c  Wed May 18 16:42:01 2011
(r222069)
+++ head/sys/powerpc/booke/platform_bare.c  Wed May 18 16:50:13 2011
(r222070)
@@ -241,7 +241,7 @@ bare_smp_start_cpu(platform_t plat, stru
int timeout;
 
eebpcr = ccsr_read4(OCP85XX_EEBPCR);
-   if ((eebpcr & (1 << (pc->pc_cpuid + 24))) != 0) {
+   if ((eebpcr & (pc->pc_cpumask << 24)) != 0) {
printf("%s: CPU=%d already out of hold-off state!\n",
__func__, pc->pc_cpuid);
return (ENXIO);
@@ -259,8 +259,7 @@ bare_smp_start_cpu(platform_t plat, stru
/*
 * Release AP from hold-off state
 */
-   
-   eebpcr |= (1 << (pc->pc_cpuid + 24));
+   eebpcr |= (pc->pc_cpumask << 24);
ccsr_write4(OCP85XX_EEBPCR, eebpcr);
__asm __volatile("isync; msync");
 

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Wed May 18 16:42:01 2011
(r222069)
+++ head/sys/powerpc/booke/pmap.c   Wed May 18 16:50:13 2011
(r222070)
@@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -1229,7 +1228,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset
PTE_VALID;
}
/* Mark kernel_pmap active on all CPUs */
-   CPU_FILL(&kernel_pmap->pm_active);
+   kernel_pmap->pm_active = ~0;
 
/***/
/* Final setup */
@@ -1484,7 +1483,7 @@ mmu_booke_pinit(mmu_t mmu, pmap_t pmap)
PMAP_LOCK_INIT(pmap);
for (i = 0; i < MAXCPU; i++)
pmap->pm_tid[i] = TID_NONE;
-   CPU_ZERO(&kernel_pmap->pm_active);
+   pmap->pm_active = 0;
bzero(&pmap->pm_stats, sizeof(pmap->pm_stats));
bzero(&pmap->pm_pdir, sizeof(pte_t *) * PDIR_NENTRIES);
TAILQ_INIT(&pmap->pm_ptbl_list);
@@ -1839,7 +1838,7 @@ mmu_booke_activate(mmu_t mmu, struct thr
 
mtx_lock_spin(&sched_lock);
 
-   CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask));
+   atomic_set_int(&pmap->pm_active, PCPU_GET(cpumask));
PCPU_SET(curpmap, pmap);

if (pmap->pm_tid[PCPU_GET(cpuid)] == TID_NONE)
@@ -1868,9 +1867,7 @@ mmu_booke_deactivate(mmu_t mmu, struct t
CTR5(KTR_PMAP, "%s: td=%p, proc = '%s', id = %d, pmap = 0x%08x",
__func__, td, td->td_proc->p_comm, td->td_proc->p_pid, pmap);
 
-   sched_pin();
-   CPU_NAND_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask));
-   sched_unpin();
+   atomic_clear_int(&pmap->pm_active, PCPU_GET(cpumask));
PCPU_SET(curpmap, NULL);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222072 - head

2011-05-18 Thread Warner Losh
Author: imp
Date: Wed May 18 17:06:11 2011
New Revision: 222072
URL: http://svn.freebsd.org/changeset/base/222072

Log:
  Clean up a loose end from the conversion from gnu ar/ranlib to the BSD
  one.  Without this, we don't have ar or randlib in the tool path,
  leading to much pain for some users.  This pain is exposed by the
  external toolchain enhancements that I'm working on.
  
  Submitted by: John Hein (ages ago, and dropped on the floor by me: sorry)

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed May 18 16:56:36 2011(r222071)
+++ head/Makefile.inc1  Wed May 18 17:06:11 2011(r222072)
@@ -1552,7 +1552,8 @@ _xb-build-tools:
 _xb-cross-tools:
 .for _tool in \
 gnu/usr.bin/binutils \
-gnu/usr.bin/cc
+gnu/usr.bin/cc \
+usr.bin/ar
${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ obj; \
@@ -1577,7 +1578,8 @@ _xi-cross-tools:
@echo "_xi-cross-tools"
 .for _tool in \
 gnu/usr.bin/binutils \
-gnu/usr.bin/cc
+gnu/usr.bin/cc \
+usr.bin/ar
${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222074 - head/release

2011-05-18 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Wed May 18 17:39:28 2011
New Revision: 222074
URL: http://svn.freebsd.org/changeset/base/222074

Log:
  As requested by many people, with final prodding from Jason Hall, fix this
  so that running make release causes make obj to be run before doing
  anything. This fixes a bug wherein, when run for the first time, and
  without -DNOSRC, make release would attempt to recursively tar up the src
  directory including its own output and enter an infinite loop.
  
  While here, make the cross-building stuff work a little more the way it
  should if only one of TARGET/TARGET_ARCH is specified.

Modified:
  head/release/Makefile
  head/release/generate-release.sh

Modified: head/release/Makefile
==
--- head/release/Makefile   Wed May 18 17:18:44 2011(r222073)
+++ head/release/Makefile   Wed May 18 17:39:28 2011(r222074)
@@ -25,11 +25,11 @@ PORTSDIR?=  /usr/ports
 DOCDIR?=   /usr/doc
 RELNOTES_LANG?= en_US.ISO8859-1
 
-TARGET_ARCH?=  ${MACHINE_ARCH}
-.if ${TARGET_ARCH} == ${MACHINE_ARCH}
 TARGET?=   ${MACHINE}
+.if ${TARGET} == ${MACHINE}
+TARGET_ARCH?=  ${MACHINE_ARCH}
 .else
-TARGET?=   ${TARGET_ARCH}
+TARGET_ARCH?=  ${TARGET}
 .endif
 IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
 DISTDIR=   ${.OBJDIR}/dist
@@ -169,7 +169,9 @@ ftp: packagesystem
mkdir ftp
cp *.txz MANIFEST ftp
 
-release: obj ${RELEASE_TARGETS}
+release:
+   ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
+   ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
 
 clean:
chflags -R noschg ${.OBJDIR}

Modified: head/release/generate-release.sh
==
--- head/release/generate-release.shWed May 18 17:18:44 2011
(r222073)
+++ head/release/generate-release.shWed May 18 17:39:28 2011
(r222074)
@@ -63,7 +63,6 @@ if [ -d $2/usr/doc ]; then 
 fi
 
 chroot $2 make -C /usr/src $MAKE_FLAGS buildworld buildkernel
-chroot $2 make -C /usr/src/release obj
 chroot $2 make -C /usr/src/release release
 chroot $2 make -C /usr/src/release install DESTDIR=/R
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222075 - in head/sys: fs/nfsclient nfsclient

2011-05-18 Thread Rick Macklem
Author: rmacklem
Date: Wed May 18 18:36:40 2011
New Revision: 222075
URL: http://svn.freebsd.org/changeset/base/222075

Log:
  Add a sanity check for the existence of an "addr" option
  to both NFS clients. This avoids the crash reported by
  Sergey Kandaurov (pluk...@gmail.com) to the freebsd-fs@
  list with subject "[old nfsclient] different nmount()
  args passed from mount vs mount_nfs" dated May 17, 2011.
  
  Tested by:pluknet at gmail.com (old nfs client)
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsclient/nfs_clvfsops.c
  head/sys/nfsclient/nfs_vfsops.c

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==
--- head/sys/fs/nfsclient/nfs_clvfsops.cWed May 18 17:39:28 2011
(r222074)
+++ head/sys/fs/nfsclient/nfs_clvfsops.cWed May 18 18:36:40 2011
(r222075)
@@ -1079,15 +1079,21 @@ nfs_mount(struct mount *mp)
dirpath[0] = '\0';
dirlen = strlen(dirpath);
 
-   if (has_nfs_args_opt == 0 && vfs_getopt(mp->mnt_optnew, "addr",
-   (void **)&args.addr, &args.addrlen) == 0) {
-   if (args.addrlen > SOCK_MAXADDRLEN) {
-   error = ENAMETOOLONG;
+   if (has_nfs_args_opt == 0) {
+   if (vfs_getopt(mp->mnt_optnew, "addr",
+   (void **)&args.addr, &args.addrlen) == 0) {
+   if (args.addrlen > SOCK_MAXADDRLEN) {
+   error = ENAMETOOLONG;
+   goto out;
+   }
+   nam = malloc(args.addrlen, M_SONAME, M_WAITOK);
+   bcopy(args.addr, nam, args.addrlen);
+   nam->sa_len = args.addrlen;
+   } else {
+   vfs_mount_error(mp, "No server address");
+   error = EINVAL;
goto out;
}
-   nam = malloc(args.addrlen, M_SONAME, M_WAITOK);
-   bcopy(args.addr, nam, args.addrlen);
-   nam->sa_len = args.addrlen;
}
 
args.fh = nfh;

Modified: head/sys/nfsclient/nfs_vfsops.c
==
--- head/sys/nfsclient/nfs_vfsops.c Wed May 18 17:39:28 2011
(r222074)
+++ head/sys/nfsclient/nfs_vfsops.c Wed May 18 18:36:40 2011
(r222075)
@@ -1149,6 +1149,10 @@ nfs_mount(struct mount *mp)
goto out;
}
}
+   } else if (has_addr_opt == 0) {
+   vfs_mount_error(mp, "No server address");
+   error = EINVAL;
+   goto out;
}
error = mountnfs(&args, mp, nam, args.hostname, &vp,
curthread->td_ucred, negnametimeo);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222077 - head/sys/netinet

2011-05-18 Thread Michael Tuexen
Author: tuexen
Date: Wed May 18 19:49:39 2011
New Revision: 222077
URL: http://svn.freebsd.org/changeset/base/222077

Log:
  Unbreak INET-less build.
  Reported by bz@
  MFC after: 1 week

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Wed May 18 19:46:26 2011
(r222076)
+++ head/sys/netinet/sctp_output.c  Wed May 18 19:49:39 2011
(r222077)
@@ -3129,8 +3129,8 @@ plan_d:
}
 #endif
 out:
-   if (sifa) {
 #ifdef INET
+   if (sifa) {
if (retried == 1) {
LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
if (dest_is_loop == 0 && 
SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r222077 - head/sys/netinet

2011-05-18 Thread Bjoern A. Zeeb

On May 18, 2011, at 7:49 PM, Michael Tuexen wrote:

> Author: tuexen
> Date: Wed May 18 19:49:39 2011
> New Revision: 222077
> URL: http://svn.freebsd.org/changeset/base/222077
> 
> Log:
>  Unbreak INET-less build.
>  Reported by bz@

Thanks a lot!

>  MFC after: 1 week
> 
> Modified:
>  head/sys/netinet/sctp_output.c
> 
> Modified: head/sys/netinet/sctp_output.c
> ==
> --- head/sys/netinet/sctp_output.cWed May 18 19:46:26 2011
> (r222076)
> +++ head/sys/netinet/sctp_output.cWed May 18 19:49:39 2011
> (r222077)
> @@ -3129,8 +3129,8 @@ plan_d:
>   }
> #endif
> out:
> - if (sifa) {
> #ifdef INET
> + if (sifa) {
>   if (retried == 1) {
>   LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
>   if (dest_is_loop == 0 && 
> SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) {

-- 
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.

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


Re: svn commit: r221904 - head/sys/netinet

2011-05-18 Thread Michael Tuexen
Hi Bjoern,

fixed in http://svn.freebsd.org/changeset/base/222077
Thanks for reporting it.

Best regards
Michael

On May 18, 2011, at 6:35 PM, Bjoern A. Zeeb wrote:

> 
> On May 14, 2011, at 6:22 PM, Michael Tuexen wrote:
> 
>> Author: tuexen
>> Date: Sat May 14 18:22:14 2011
>> New Revision: 221904
>> URL: http://svn.freebsd.org/changeset/base/221904
>> 
>> Log:
>> Fix the source address selection for boundall sockets
>> when sending INITs to a global IPv4 address having
>> only private IPv4 address.
>> Allow the usage of a private address and make sure
>> that no other private address will be used by the
>> association.
>> Initial work was done by rrs@.
>> 
>> MFC after: 1 week.
>> 
>> Modified:
>> head/sys/netinet/sctp_output.c
>> head/sys/netinet/sctp_output.h
>> 
>> Modified: head/sys/netinet/sctp_output.c
>> ==
>> --- head/sys/netinet/sctp_output.c   Sat May 14 18:22:08 2011
>> (r221903)
>> +++ head/sys/netinet/sctp_output.c   Sat May 14 18:22:14 2011
>> (r221904)
> 
> ...
> 
>> @@ -3068,19 +3112,81 @@ plan_d:
>>   * It is restricted for some
>>   * reason.. probably not yet added.
>>   */
>> +sifa = NULL;
>>  continue;
>>  }
>>  }
>> -atomic_add_int(&sifa->refcount, 1);
>> -return (sifa);
>> +goto out;
>>  }
>>  }
>> -/*
>> - * Ok we can find NO address to source from that is not on our
>> - * restricted list and non_asoc_address is NOT ok, or it is on our
>> - * restricted list. We can't source to it :-(
>> - */
>> -return (NULL);
>> +#ifdef INET
>> +if ((retried == 0) && (stcb->asoc.ipv4_local_scope == 0)) {
>> +stcb->asoc.ipv4_local_scope = 1;
>> +retried = 1;
>> +goto again_with_private_addresses_allowed;
>> +} else if (retried == 1) {
>> +stcb->asoc.ipv4_local_scope = 0;
>> +}
>> +#endif
>> +out:
>> +if (sifa) {
>> +#ifdef INET
> 
> either this needs to go outside the if() or ...
> 
>> +if (retried == 1) {
>> +LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
>> +if (dest_is_loop == 0 && 
>> SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) {
>> +/* wrong base scope */
>> +continue;
>> +}
>> +LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, 
>> next_ifa) {
>> +struct sctp_ifa *tmp_sifa;
>> +
>> +if ((sctp_ifa->localifa_flags & 
>> SCTP_ADDR_DEFER_USE) &&
>> +(non_asoc_addr_ok == 0))
>> +continue;
>> +tmp_sifa = 
>> sctp_is_ifa_addr_acceptable(sctp_ifa,
>> +dest_is_loop,
>> +dest_is_priv, fam);
>> +if (tmp_sifa == NULL) {
>> +continue;
>> +}
>> +if (tmp_sifa == sifa) {
>> +continue;
>> +}
>> +if (stcb) {
>> +if 
>> (sctp_is_address_in_scope(tmp_sifa,
>> +stcb->asoc.ipv4_addr_legal,
>> +stcb->asoc.ipv6_addr_legal,
>> +stcb->asoc.loopback_scope,
>> +stcb->asoc.ipv4_local_scope,
>> +stcb->asoc.local_scope,
>> +stcb->asoc.site_scope, 0) 
>> == 0) {
>> +continue;
>> +}
>> +if (((non_asoc_addr_ok == 0) &&
>> +
>> (sctp_is_addr_restricted(stcb, tmp_sifa))) ||
>> +(non_asoc_addr_ok &&
>> +
>> (sctp_is_addr_restricted(stcb, tmp_sifa)) &&
>> +
>> (!sctp_is_addr_pending(stcb, tmp_sifa {
>> +/*
>> + * It is restricted
>> + * for some 

svn commit: r222078 - head/usr.sbin/pc-sysinstall/backend

2011-05-18 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 18 20:29:07 2011
New Revision: 222078
URL: http://svn.freebsd.org/changeset/base/222078

Log:
  Extracting optional components requires mounting devfs
  
  Submitted by: Kris Moore 
  Approved by:  kib (mentor)
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh  Wed May 
18 19:49:39 2011(r222077)
+++ head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh  Wed May 
18 20:29:07 2011(r222078)
@@ -120,9 +120,11 @@ COMPTMPDIR=\"${COMPTMPDIR}\"
 export COMPTMPDIR
 CFILE=\"${CFILE}\"
 export CFILE
+mount -t devfs devfs /dev
 
 sh ${COMPTMPDIR}/install.sh
 
+umount /dev
 " >${FSMNT}/.componentwrapper.sh
   chmod 755 ${FSMNT}/.componentwrapper.sh

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


svn commit: r222079 - head/usr.sbin/pc-sysinstall/backend

2011-05-18 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 18 20:38:28 2011
New Revision: 222079
URL: http://svn.freebsd.org/changeset/base/222079

Log:
  Wipeout the end of disks, home to things like gmirror metadata, backup GPT 
tables,
  and other potential evil.
  
  Submitted by: Kris Moore 
  Approved by:  kib (mentor)
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Wed May 18 
20:29:07 2011(r222078)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Wed May 18 
20:38:28 2011(r222079)
@@ -582,17 +582,9 @@ stop_gjournal()
 # Function to wipe the potential backup gpt table from a disk
 clear_backup_gpt_table()
 {
-  # Get the disk block size
-  local dSize="`gpart show $1 | grep $1 | tr -s ' ' | cut -d ' ' -f 3`"
-
-  # Make sure this is a valid number
-  is_num "${dSize}" >/dev/null 2>/dev/null
-  [ $? -ne 0 ] && return
-
-  # Die backup label, DIE
   echo_log "Clearing gpt backup table location on disk"
-  rc_nohalt "dd if=/dev/zero of=${1} bs=512 seek=${dSize}"
-
+  rc_nohalt "dd if=/dev/zero of=${1} bs=1m count=1"
+  rc_nohalt "dd if=/dev/zero of=${1} bs=1m oseek=`diskinfo ${1} | awk '{print 
int($3 / (1024*1024)) - 4;}'`"
 } ;
 
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r222078 - head/usr.sbin/pc-sysinstall/backend

2011-05-18 Thread Garrett Cooper
On Wed, May 18, 2011 at 1:29 PM, Josh Paetzel  wrote:
> Author: jpaetzel
> Date: Wed May 18 20:29:07 2011
> New Revision: 222078
> URL: http://svn.freebsd.org/changeset/base/222078
>
> Log:
>  Extracting optional components requires mounting devfs
>
>  Submitted by: Kris Moore 
>  Approved by:  kib (mentor)
>  Sponsored by: iXsystems
>
> Modified:
>  head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
>
> Modified: head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
> ==
> --- head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh  Wed 
> May 18 19:49:39 2011        (r222077)
> +++ head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh  Wed 
> May 18 20:29:07 2011        (r222078)
> @@ -120,9 +120,11 @@ COMPTMPDIR=\"${COMPTMPDIR}\"
>  export COMPTMPDIR
>  CFILE=\"${CFILE}\"
>  export CFILE
> +mount -t devfs devfs /dev
>
>  sh ${COMPTMPDIR}/install.sh
>
> +umount /dev
>  " >${FSMNT}/.componentwrapper.sh
>   chmod 755 ${FSMNT}/.componentwrapper.sh

Is pc-sysinstall run with set -e anywhere?
Thanks!
-Garrett
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222080 - head/usr.bin/rpcgen

2011-05-18 Thread Ben Laurie
Author: benl
Date: Wed May 18 20:52:52 2011
New Revision: 222080
URL: http://svn.freebsd.org/changeset/base/222080

Log:
  Fix clang warnings.
  
  Note: these were actually bugs (printf with no format string).
  
  Approved by: philip (mentor)

Modified:
  head/usr.bin/rpcgen/rpc_hout.c
  head/usr.bin/rpcgen/rpc_svcout.c
  head/usr.bin/rpcgen/rpc_tblout.c

Modified: head/usr.bin/rpcgen/rpc_hout.c
==
--- head/usr.bin/rpcgen/rpc_hout.c  Wed May 18 20:38:28 2011
(r222079)
+++ head/usr.bin/rpcgen/rpc_hout.c  Wed May 18 20:52:52 2011
(r222080)
@@ -500,7 +500,7 @@ pdeclaration(const char *name, declarati
break;
}
}
-   f_print(fout, separator);
+   fputs(separator, fout);
 }
 
 static int

Modified: head/usr.bin/rpcgen/rpc_svcout.c
==
--- head/usr.bin/rpcgen/rpc_svcout.cWed May 18 20:38:28 2011
(r222079)
+++ head/usr.bin/rpcgen/rpc_svcout.cWed May 18 20:52:52 2011
(r222080)
@@ -349,7 +349,7 @@ write_real_program(definition *def)
f_print(fout, "(");
/* arg name */
if (proc->arg_num > 1)
-   f_print(fout, proc->args.argname);
+   fputs(proc->args.argname, fout);
else
ptype(proc->args.decls->decl.prefix,
  proc->args.decls->decl.type, 0);

Modified: head/usr.bin/rpcgen/rpc_tblout.c
==
--- head/usr.bin/rpcgen/rpc_tblout.cWed May 18 20:38:28 2011
(r222079)
+++ head/usr.bin/rpcgen/rpc_tblout.cWed May 18 20:52:52 2011
(r222080)
@@ -103,7 +103,7 @@ write_table(definition *def)
expected = 0;
} else {
expected = 1;
-   f_print(fout, null_entry);
+   fputs(null_entry, fout);
}
for (proc = vp->procs; proc != NULL; proc = proc->next) {
current = atoi(proc->proc_num);
@@ -141,7 +141,7 @@ write_table(definition *def)
}
 
/* print the table trailer */
-   f_print(fout, tbl_end);
+   fputs(tbl_end, fout);
f_print(fout, tbl_nproc, progvers, progvers, progvers);
}
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222081 - head/crypto/heimdal/lib/sl

2011-05-18 Thread Ben Laurie
Author: benl
Date: Wed May 18 20:57:23 2011
New Revision: 222081
URL: http://svn.freebsd.org/changeset/base/222081

Log:
  Fix clang warning (why is there nowhere yyparse() is declared?).
  
  Approved by:  philip (mentor)

Modified:
  head/crypto/heimdal/lib/sl/slc-gram.y

Modified: head/crypto/heimdal/lib/sl/slc-gram.y
==
--- head/crypto/heimdal/lib/sl/slc-gram.y   Wed May 18 20:52:52 2011
(r222080)
+++ head/crypto/heimdal/lib/sl/slc-gram.y   Wed May 18 20:57:23 2011
(r222081)
@@ -49,6 +49,7 @@ RCSID("$Id: slc-gram.y 20767 2007-06-01 
 #include "slc.h"
 extern FILE *yyin;
 extern struct assignment *assignment;
+extern int yyparse(void);
 %}
 
 %union {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222082 - head/contrib/gcc

2011-05-18 Thread Ben Laurie
Author: benl
Date: Wed May 18 21:00:27 2011
New Revision: 222082
URL: http://svn.freebsd.org/changeset/base/222082

Log:
  Fix clang warnings.
  
  Approved by:  philip (mentor)

Modified:
  head/contrib/gcc/genmodes.c

Modified: head/contrib/gcc/genmodes.c
==
--- head/contrib/gcc/genmodes.c Wed May 18 20:57:23 2011(r222081)
+++ head/contrib/gcc/genmodes.c Wed May 18 21:00:27 2011(r222082)
@@ -787,7 +787,7 @@ calc_wider_mode (void)
 
 #define tagged_printf(FMT, ARG, TAG) do {  \
   int count_;  \
-  printf ("  " FMT ",%n", ARG, &count_);   \
+  count_ = printf ("  " FMT ",", ARG); \
   printf ("%*s/* %s */\n", 27 - count_, "", TAG);  \
 } while (0)
 
@@ -822,7 +822,7 @@ enum machine_mode\n{");
 for (m = modes[c]; m; m = m->next)
   {
int count_;
-   printf ("  %smode,%n", m->name, &count_);
+   count_ = printf ("  %smode,", m->name);
printf ("%*s/* %s:%d */\n", 27 - count_, "",
 trim_filename (m->file), m->line);
   }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222083 - in head/contrib/groff/src: devices/grohtml libs/libdriver roff/troff utils/hpftodit

2011-05-18 Thread Ben Laurie
Author: benl
Date: Wed May 18 21:04:29 2011
New Revision: 222083
URL: http://svn.freebsd.org/changeset/base/222083

Log:
  Fix clang warnings.
  
  Note: possible minor security issues fixed (untrusted string used as
  printf format string).
  
  Approved by:  philip (mentor)

Modified:
  head/contrib/groff/src/devices/grohtml/post-html.cpp
  head/contrib/groff/src/libs/libdriver/input.cpp
  head/contrib/groff/src/roff/troff/mtsm.cpp
  head/contrib/groff/src/roff/troff/node.cpp
  head/contrib/groff/src/utils/hpftodit/hpftodit.cpp

Modified: head/contrib/groff/src/devices/grohtml/post-html.cpp
==
--- head/contrib/groff/src/devices/grohtml/post-html.cppWed May 18 
21:00:27 2011(r222082)
+++ head/contrib/groff/src/devices/grohtml/post-html.cppWed May 18 
21:04:29 2011(r222083)
@@ -1587,7 +1587,7 @@ void header_desc::write_headings (FILE *
 
  buffer += as_string(h);
  buffer += '\0';
- fprintf(f, buffer.contents());
+ fputs(buffer.contents(), f);
} else
  fputs(g->text_string, f);
h++;

Modified: head/contrib/groff/src/libs/libdriver/input.cpp
==
--- head/contrib/groff/src/libs/libdriver/input.cpp Wed May 18 21:00:27 
2011(r222082)
+++ head/contrib/groff/src/libs/libdriver/input.cpp Wed May 18 21:04:29 
2011(r222083)
@@ -995,7 +995,7 @@ next_command(void)
 inline bool
 odd(const int n)
 {
-  return (n & 1 == 1) ? true : false;
+  return ((n & 1) == 1) ? true : false;
 }
 
 //

Modified: head/contrib/groff/src/roff/troff/mtsm.cpp
==
--- head/contrib/groff/src/roff/troff/mtsm.cpp  Wed May 18 21:00:27 2011
(r222082)
+++ head/contrib/groff/src/roff/troff/mtsm.cpp  Wed May 18 21:04:29 2011
(r222083)
@@ -611,14 +611,16 @@ int state_set::is_in(int_value_state i)
   return (intset & (1 << (int)i)) != 0;
 }
 
+// Note: this used to have a bug s.t. it always tested for bit 0 (benl 18/5/11)
 int state_set::is_in(units_value_state u)
 {
-  return (unitsset & (1 << (int)u) != 0);
+  return (unitsset & (1 << (int)u)) != 0;
 }
 
+// Note: this used to have a bug s.t. it always tested for bit 0 (benl 18/5/11)
 int state_set::is_in(string_value_state s)
 {
-  return (stringset & (1 << (int)s) != 0);
+  return (stringset & (1 << (int)s)) != 0;
 }
 
 void state_set::add(units_value_state, int n)

Modified: head/contrib/groff/src/roff/troff/node.cpp
==
--- head/contrib/groff/src/roff/troff/node.cpp  Wed May 18 21:00:27 2011
(r222082)
+++ head/contrib/groff/src/roff/troff/node.cpp  Wed May 18 21:04:29 2011
(r222083)
@@ -2157,7 +2157,7 @@ void glyph_node::debug_node()
   if (c)
 fprintf(stderr, "%c", c);
   else
-fprintf(stderr, ci->nm.contents());
+fputs(ci->nm.contents(), stderr);
   if (push_state)
 fprintf(stderr, " ");
   if (state)

Modified: head/contrib/groff/src/utils/hpftodit/hpftodit.cpp
==
--- head/contrib/groff/src/utils/hpftodit/hpftodit.cpp  Wed May 18 21:00:27 
2011(r222082)
+++ head/contrib/groff/src/utils/hpftodit/hpftodit.cpp  Wed May 18 21:04:29 
2011(r222083)
@@ -870,9 +870,9 @@ output_charset(const int tfm_type)
   else if (!all_flag)
continue;
   else if (tfm_type == MSL)
-   printf(hp_msl_to_ucode_name(charcode));
+   fputs(hp_msl_to_ucode_name(charcode), stdout);
   else
-   printf(unicode_to_ucode_name(charcode));
+   fputs(unicode_to_ucode_name(charcode), stdout);
 
   printf("\t%d,%d",
 scale(char_table[i].width), scale(char_table[i].ascent));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222084 - head/contrib/gperf/src

2011-05-18 Thread Ben Laurie
Author: benl
Date: Wed May 18 21:06:20 2011
New Revision: 222084
URL: http://svn.freebsd.org/changeset/base/222084

Log:
  Fix clang warnings.
  
  Approved by:  philip (mentor)

Modified:
  head/contrib/gperf/src/gen-perf.cc
  head/contrib/gperf/src/key-list.cc
  head/contrib/gperf/src/options.cc

Modified: head/contrib/gperf/src/gen-perf.cc
==
--- head/contrib/gperf/src/gen-perf.cc  Wed May 18 21:04:29 2011
(r222083)
+++ head/contrib/gperf/src/gen-perf.cc  Wed May 18 21:06:20 2011
(r222084)
@@ -246,7 +246,7 @@ Gen_Perf::change (List_Node *prior, List
   {
 if (option[DEBUG])
   {
-fprintf (stderr, " by changing asso_value['%c'] (char #%d) to 
%d\n",
+fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to 
%d\n",
  *p, p - union_set + 1, asso_values[(unsigned char)(*p)]);
 fflush (stderr);
   }

Modified: head/contrib/gperf/src/key-list.cc
==
--- head/contrib/gperf/src/key-list.cc  Wed May 18 21:04:29 2011
(r222083)
+++ head/contrib/gperf/src/key-list.cc  Wed May 18 21:06:20 2011
(r222084)
@@ -497,8 +497,8 @@ Key_List::merge (List_Node *list1, List_
   *resultp = list1;
   break;
 }
-  if (occurrence_sort && list1->occurrence < list2->occurrence
-  || hash_sort && list1->hash_value > list2->hash_value)
+  if ((occurrence_sort && list1->occurrence < list2->occurrence)
+   || (hash_sort && list1->hash_value > list2->hash_value))
 {
   *resultp = list2;
   resultp = &list2->next; list2 = list1; list1 = *resultp;
@@ -1035,17 +1035,16 @@ Key_List::output_hash_function (void)
   if (option[CPLUSPLUS])
 printf ("%s::", option.get_class_name ());
   printf ("%s ", option.get_hash_name ());
-  printf (option[KRC] ?
- "(str, len)\n"
-" register char *str;\n"
-" register unsigned int len;\n" :
-  option[C] ?
- "(str, len)\n"
-" register const char *str;\n"
-" register unsigned int len;\n" :
-  option[ANSIC] | option[CPLUSPLUS] ?
- "(register const char *str, register unsigned int len)\n" :
-  "");
+  if (option[KRC] || option[C] || option [ANSIC] || option[CPLUSPLUS])
+printf (option[KRC] ?
+ "(str, len)\n"
+  " register char *str;\n"
+  " register unsigned int len;\n" :
+   option[C] ?
+ "(str, len)\n"
+  " register const char *str;\n"
+  " register unsigned int len;\n" :
+ "(register const char *str, register unsigned int len)\n");
 
   /* Note that when the hash function is called, it has already been verified
  that  min_key_len <= len <= max_key_len. */
@@ -1442,7 +1441,7 @@ Key_List::output_lookup_array (void)
 
   if (option[DEBUG])
 fprintf (stderr,
- "dup_ptr[%d]: hash_value = %d, index = %d, count = %d\n",
+ "dup_ptr[%zd]: hash_value = %d, index = %d, count = %d\n",
  dup_ptr - duplicates,
  dup_ptr->hash_value, dup_ptr->index, dup_ptr->count);
 
@@ -1986,17 +1985,16 @@ Key_List::output_lookup_function (void)
   if (option[CPLUSPLUS])
 printf ("%s::", option.get_class_name ());
   printf ("%s ", option.get_function_name ());
-  printf (option[KRC] ?
- "(str, len)\n"
-" register char *str;\n"
-" register unsigned int len;\n" :
-  option[C] ?
- "(str, len)\n"
-" register const char *str;\n"
-" register unsigned int len;\n" :
-  option[ANSIC] | option[CPLUSPLUS] ?
- "(register const char *str, register unsigned int len)\n" :
-  "");
+  if (option[KRC] || option[C] || option[ANSIC] || option[CPLUSPLUS])
+printf (option[KRC] ?
+ "(str, len)\n"
+  " register char *str;\n"
+  " register unsigned int len;\n" :
+   option[C] ?
+ "(str, len)\n"
+  " register const char *str;\n"
+  " register unsigned int len;\n" :
+   "(register const char *str, register unsigned int len)\n");
 
   /* Output the function's body. */
   printf ("{\n");

Modified: head/contrib/gperf/src/options.cc
==
--- head/contrib/gperf/src/options.cc   Wed May 18 21:04:29 2011
(r222083)
+++ head/contrib/gperf/src/options.cc   Wed May 18 21:06:20 2011
(r222084)
@@ -237,7 +237,7 @@ Options::print_options (void)
 {
   putchar (*arg);
   arg++;
-  if (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *

Re: svn commit: r222079 - head/usr.sbin/pc-sysinstall/backend

2011-05-18 Thread Pawel Jakub Dawidek
On Wed, May 18, 2011 at 08:38:29PM +, Josh Paetzel wrote:
> Author: jpaetzel
> Date: Wed May 18 20:38:28 2011
> New Revision: 222079
> URL: http://svn.freebsd.org/changeset/base/222079
> 
> Log:
>   Wipeout the end of disks, home to things like gmirror metadata, backup GPT 
> tables,
>   and other potential evil.

If geom_mirror.ko is loaded it won't work, as gmirror keeps its
components open for writing. But if this is GENERIC and geom_mirror.ko
is not loaded, you should be fine.

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://yomoli.com


pgpTslP35BbIm.pgp
Description: PGP signature


Re: svn commit: r222084 - head/contrib/gperf/src

2011-05-18 Thread Pawel Jakub Dawidek
On Wed, May 18, 2011 at 09:06:20PM +, Ben Laurie wrote:
> Author: benl
> Date: Wed May 18 21:06:20 2011
> New Revision: 222084
> URL: http://svn.freebsd.org/changeset/base/222084
> 
> Log:
>   Fix clang warnings.
>   
>   Approved by:philip (mentor)
[...]
> -fprintf (stderr, " by changing asso_value['%c'] (char #%d) to 
> %d\n",
> +fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to 
> %d\n",
>   *p, p - union_set + 1, asso_values[(unsigned 
> char)(*p)]);

Hmm, both 'p' and 'union_set' are 'char *' and %zd is for ssize_t. It is
a bit strange that it fixes the warning.

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://yomoli.com


pgpqtfHcv0ouD.pgp
Description: PGP signature


Re: svn commit: r222084 - head/contrib/gperf/src

2011-05-18 Thread Dimitry Andric

On 2011-05-18 23:16, Pawel Jakub Dawidek wrote:

On Wed, May 18, 2011 at 09:06:20PM +, Ben Laurie wrote:

Author: benl
Date: Wed May 18 21:06:20 2011
New Revision: 222084
URL: http://svn.freebsd.org/changeset/base/222084

Log:
   Fix clang warnings.

   Approved by: philip (mentor)

[...]

-fprintf (stderr, " by changing asso_value['%c'] (char #%d) to 
%d\n",
+fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to 
%d\n",
   *p, p - union_set + 1, asso_values[(unsigned char)(*p)]);


Hmm, both 'p' and 'union_set' are 'char *' and %zd is for ssize_t. It is
a bit strange that it fixes the warning.


If you subtract two pointers, such as in this case, you get a ptrdiff_t.

Strictly, this doesn't have to be exactly the same type as ssize_t, but
in practice it will almost always be.

You can also cast the result to intmax_t, and use %jd, then it will
always be correct, but possibly have some small overhead.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r222080 - head/usr.bin/rpcgen

2011-05-18 Thread Dimitry Andric

On 2011-05-18 22:52, Ben Laurie wrote:

Author: benl
Date: Wed May 18 20:52:52 2011
New Revision: 222080
URL: http://svn.freebsd.org/changeset/base/222080

Log:
   Fix clang warnings.

   Note: these were actually bugs (printf with no format string).


On 2011-05-18 22:52, Ben Laurie wrote:

Author: benl
Date: Wed May 18 20:52:52 2011
New Revision: 222080
URL: http://svn.freebsd.org/changeset/base/222080

Log:
   Fix clang warnings.

   Note: these were actually bugs (printf with no format string).


Thanks for fixing these, I had a bunch of similar fixes in a git branch
here, but never got to commit them... :)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r222084 - head/contrib/gperf/src

2011-05-18 Thread mdf
On Wed, May 18, 2011 at 2:31 PM, Dimitry Andric  wrote:
> On 2011-05-18 23:16, Pawel Jakub Dawidek wrote:
>>
>> On Wed, May 18, 2011 at 09:06:20PM +, Ben Laurie wrote:
>>>
>>> Author: benl
>>> Date: Wed May 18 21:06:20 2011
>>> New Revision: 222084
>>> URL: http://svn.freebsd.org/changeset/base/222084
>>>
>>> Log:
>>>   Fix clang warnings.
>>>
>>>   Approved by: philip (mentor)
>>
>> [...]
>>>
>>> -            fprintf (stderr, " by changing asso_value['%c'] (char #%d)
>>> to %d\n",
>>> +            fprintf (stderr, " by changing asso_value['%c'] (char #%zd)
>>> to %d\n",
>>>                       *p, p - union_set + 1, asso_values[(unsigned
>>> char)(*p)]);
>>
>> Hmm, both 'p' and 'union_set' are 'char *' and %zd is for ssize_t. It is
>> a bit strange that it fixes the warning.
>
> If you subtract two pointers, such as in this case, you get a ptrdiff_t.
>
> Strictly, this doesn't have to be exactly the same type as ssize_t, but
> in practice it will almost always be.
>
> You can also cast the result to intmax_t, and use %jd, then it will
> always be correct, but possibly have some small overhead.

Or you can use %td which is the C99 conversion specifier for ptrdiff_t.

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


svn commit: r222085 - head/sys/dev/cxgbe

2011-05-18 Thread Navdeep Parhar
Author: np
Date: Wed May 18 22:09:04 2011
New Revision: 222085
URL: http://svn.freebsd.org/changeset/base/222085

Log:
  - Enable per-channel congestion notification.
  - Enable PCIe relaxed ordering for all egress queues and rx data buffers.
  
  MFC after:3 days

Modified:
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cWed May 18 21:06:20 2011
(r222084)
+++ head/sys/dev/cxgbe/t4_main.cWed May 18 22:09:04 2011
(r222085)
@@ -366,7 +366,13 @@ t4_attach(device_t dev)
sc->mbox = sc->pf;
 
pci_enable_busmaster(dev);
-   pci_set_max_read_req(dev, 4096);
+   if (pci_find_cap(dev, PCIY_EXPRESS, &i) == 0) {
+   pci_set_max_read_req(dev, 4096);
+   v = pci_read_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, 2);
+   v |= PCIM_EXP_CTL_RELAXED_ORD_ENABLE;
+   pci_write_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, v, 2);
+   }
+
snprintf(sc->lockname, sizeof(sc->lockname), "%s",
device_get_nameunit(dev));
mtx_init(&sc->sc_lock, sc->lockname, 0, MTX_DEF);
@@ -3206,6 +3212,7 @@ filter_rpl(struct adapter *sc, const str
}
 }
 
+/* XXX: use pci_find_cap */
 int
 t4_os_find_pci_capability(struct adapter *sc, int cap)
 {

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Wed May 18 21:06:20 2011(r222084)
+++ head/sys/dev/cxgbe/t4_sge.c Wed May 18 22:09:04 2011(r222085)
@@ -100,7 +100,7 @@ static int alloc_ring(struct adapter *, 
 static int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
 void *);
 static int alloc_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *,
-int);
+int, int);
 static int free_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *);
 static int alloc_iq(struct sge_iq *, int);
 static int free_iq(struct sge_iq *);
@@ -1104,7 +1104,7 @@ free_ring(struct adapter *sc, bus_dma_ta
  */
 static int
 alloc_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl,
-int intr_idx)
+int intr_idx, int cong)
 {
int rc, i, cntxt_id;
size_t len;
@@ -1155,6 +1155,8 @@ alloc_iq_fl(struct port_info *pi, struct
V_FW_IQ_CMD_IQESIZE(ilog2(iq->esize) - 4));
c.iqsize = htobe16(iq->qsize);
c.iqaddr = htobe64(iq->ba);
+   if (cong >= 0)
+   c.iqns_to_fl0congen = htobe32(F_FW_IQ_CMD_IQFLINTCONGEN);
 
if (fl) {
mtx_init(&fl->fl_lock, fl->lockname, NULL, MTX_DEF);
@@ -1198,7 +1200,15 @@ alloc_iq_fl(struct port_info *pi, struct
fl->needed = fl->cap;
 
c.iqns_to_fl0congen =
-   htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE));
+   htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE) |
+   F_FW_IQ_CMD_FL0FETCHRO | F_FW_IQ_CMD_FL0DATARO |
+   F_FW_IQ_CMD_FL0PADEN);
+   if (cong >= 0) {
+   c.iqns_to_fl0congen |=
+   htobe32(V_FW_IQ_CMD_FL0CNGCHMAP(cong) |
+   F_FW_IQ_CMD_FL0CONGCIF |
+   F_FW_IQ_CMD_FL0CONGEN);
+   }
c.fl0dcaen_to_fl0cidxfthresh =
htobe16(V_FW_IQ_CMD_FL0FBMIN(X_FETCHBURSTMIN_64B) |
V_FW_IQ_CMD_FL0FBMAX(X_FETCHBURSTMAX_512B));
@@ -1325,7 +1335,7 @@ free_iq_fl(struct port_info *pi, struct 
 static int
 alloc_iq(struct sge_iq *iq, int intr_idx)
 {
-   return alloc_iq_fl(NULL, iq, NULL, intr_idx);
+   return alloc_iq_fl(NULL, iq, NULL, intr_idx, -1);
 }
 
 static int
@@ -1342,7 +1352,7 @@ alloc_rxq(struct port_info *pi, struct s
struct sysctl_oid_list *children;
char name[16];
 
-   rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx);
+   rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx, 1 << pi->tx_chan);
if (rc != 0)
return (rc);
 
@@ -1436,7 +1446,7 @@ alloc_ctrlq(struct adapter *sc, struct s
c.physeqid_pkd = htobe32(0);
c.fetchszm_to_iqid =
htobe32(V_FW_EQ_CTRL_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) |
-   V_FW_EQ_CTRL_CMD_PCIECHN(idx) |
+   V_FW_EQ_CTRL_CMD_PCIECHN(idx) | F_FW_EQ_CTRL_CMD_FETCHRO |
V_FW_EQ_CTRL_CMD_IQID(eq->iqid));
c.dcaen_to_eqsize =
htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) |
@@ -1561,7 +1571,7 @@ alloc_txq(struct port_info *pi, struct s
c.viid_pkd = htobe32(V_FW_EQ_ETH_CMD_VIID(pi->viid));
c.fetchszm_to_iqid =
htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) |
-   V_FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) |
+   V_FW_EQ_ETH_CMD_PCIECHN(

svn commit: r222086 - head/sys/kern

2011-05-18 Thread Konstantin Belousov
Author: kib
Date: Wed May 18 22:36:58 2011
New Revision: 222086
URL: http://svn.freebsd.org/changeset/base/222086

Log:
  The CDP_ACTIVE flag is cleared at the beginning of destroy_devl(),
  and destroy_devl() drops dev_mtx. The protection against the race
  with dev_rel(), introduced in r163328, should be extended to cover
  destroy_devl() calls for the children of the destroyed dev.
  
  Reported and tested by:   joerg
  MFC after:1 week

Modified:
  head/sys/kern/kern_conf.c

Modified: head/sys/kern/kern_conf.c
==
--- head/sys/kern/kern_conf.c   Wed May 18 22:09:04 2011(r222085)
+++ head/sys/kern/kern_conf.c   Wed May 18 22:36:58 2011(r222086)
@@ -981,6 +981,8 @@ destroy_devl(struct cdev *dev)
/* Remove name marking */
dev->si_flags &= ~SI_NAMED;
 
+   dev->si_refcount++; /* Avoid race with dev_rel() */
+
/* If we are a child, remove us from the parents list */
if (dev->si_flags & SI_CHILD) {
LIST_REMOVE(dev, si_siblings);
@@ -997,7 +999,6 @@ destroy_devl(struct cdev *dev)
dev->si_flags &= ~SI_CLONELIST;
}
 
-   dev->si_refcount++; /* Avoid race with dev_rel() */
csw = dev->si_devsw;
dev->si_devsw = NULL;   /* already NULL for SI_ALIAS */
while (csw != NULL && csw->d_purge != NULL && dev->si_threadcount) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222087 - head/sbin/hastd

2011-05-18 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed May 18 22:43:56 2011
New Revision: 222087
URL: http://svn.freebsd.org/changeset/base/222087

Log:
  - Add support for AF_INET6 sockets for %S format character.
  - Use inet_ntop(3) instead of reimplementing it.
  - Use %hhu for unsigned char instead of casting it to unsigned int and
using %u.
  
  MFC after:1 week

Modified:
  head/sbin/hastd/pjdlog.c

Modified: head/sbin/hastd/pjdlog.c
==
--- head/sbin/hastd/pjdlog.cWed May 18 22:36:58 2011(r222086)
+++ head/sbin/hastd/pjdlog.cWed May 18 22:43:56 2011(r222087)
@@ -31,8 +31,10 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -103,22 +105,39 @@ pjdlog_printf_render_sockaddr(struct __p
switch (ss->ss_family) {
case AF_INET:
{
+   char addr[INET_ADDRSTRLEN];
const struct sockaddr_in *sin;
-   in_addr_t ip;
unsigned int port;
 
sin = (const struct sockaddr_in *)ss;
-   ip = ntohl(sin->sin_addr.s_addr);
port = ntohs(sin->sin_port);
+   if (inet_ntop(ss->ss_family, &sin->sin_addr, addr,
+   sizeof(addr)) == NULL) {
+   PJDLOG_ABORT("inet_ntop(AF_INET) failed: %s.",
+   strerror(errno));
+   }
+   snprintf(buf, sizeof(buf), "%s:%u", addr, port);
+   break;
+   }
+   case AF_INET6:
+   {
+   char addr[INET6_ADDRSTRLEN];
+   const struct sockaddr_in6 *sin;
+   unsigned int port;
 
-   snprintf(buf, sizeof(buf), "%u.%u.%u.%u:%u",
-   ((ip >> 24) & 0xff), ((ip >> 16) & 0xff),
-   ((ip >> 8) & 0xff), (ip & 0xff), port);
+   sin = (const struct sockaddr_in6 *)ss;
+   port = ntohs(sin->sin6_port);
+   if (inet_ntop(ss->ss_family, &sin->sin6_addr, addr,
+   sizeof(addr)) == NULL) {
+   PJDLOG_ABORT("inet_ntop(AF_INET6) failed: %s.",
+   strerror(errno));
+   }
+   snprintf(buf, sizeof(buf), "[%s]:%u", addr, port);
break;
}
default:
-   snprintf(buf, sizeof(buf), "[unsupported family %u]",
-   (unsigned int)ss->ss_family);
+   snprintf(buf, sizeof(buf), "[unsupported family %hhu]",
+   ss->ss_family);
break;
}
ret = __printf_out(io, pi, buf, strlen(buf));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r222079 - head/usr.sbin/pc-sysinstall/backend

2011-05-18 Thread Kris Moore

On 05/18/11 17:12, Pawel Jakub Dawidek wrote:

On Wed, May 18, 2011 at 08:38:29PM +, Josh Paetzel wrote:

Author: jpaetzel
Date: Wed May 18 20:38:28 2011
New Revision: 222079
URL: http://svn.freebsd.org/changeset/base/222079

Log:
   Wipeout the end of disks, home to things like gmirror metadata, backup GPT 
tables,
   and other potential evil.


If geom_mirror.ko is loaded it won't work, as gmirror keeps its
components open for writing. But if this is GENERIC and geom_mirror.ko
is not loaded, you should be fine.



Before it gets to this point it does a check and stops / clears any 
gmirrors on the particular disk(s), so hopefully this wont be an issue.



--
Kris Moore
PC-BSD Software
iXsystems
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222088 - stable/8/sys/fs/nfsclient

2011-05-18 Thread Rick Macklem
Author: rmacklem
Date: Thu May 19 01:35:52 2011
New Revision: 222088
URL: http://svn.freebsd.org/changeset/base/222088

Log:
  MFC: r221467
  Fix the new NFS client so that it handles the 64bit fields
  that are now in "struct statfs" for NFSv3 and NFSv4. Since
  the ffiles value is uint64_t on the wire, I clip the value
  to INT64_MAX to avoid setting f_ffree negative.

Modified:
  stable/8/sys/fs/nfsclient/nfs_clport.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfsclient/nfs_clport.c
==
--- stable/8/sys/fs/nfsclient/nfs_clport.c  Wed May 18 22:43:56 2011
(r222087)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c  Thu May 19 01:35:52 2011
(r222088)
@@ -838,21 +838,33 @@ void
 nfscl_loadsbinfo(struct nfsmount *nmp, struct nfsstatfs *sfp, void *statfs)
 {
struct statfs *sbp = (struct statfs *)statfs;
-   nfsquad_t tquad;
 
if (nmp->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) {
sbp->f_bsize = NFS_FABLKSIZE;
-   tquad.qval = sfp->sf_tbytes;
-   sbp->f_blocks = (long)(tquad.qval / ((u_quad_t)NFS_FABLKSIZE));
-   tquad.qval = sfp->sf_fbytes;
-   sbp->f_bfree = (long)(tquad.qval / ((u_quad_t)NFS_FABLKSIZE));
-   tquad.qval = sfp->sf_abytes;
-   sbp->f_bavail = (long)(tquad.qval / ((u_quad_t)NFS_FABLKSIZE));
-   tquad.qval = sfp->sf_tfiles;
-   sbp->f_files = (tquad.lval[0] & 0x7fff);
-   tquad.qval = sfp->sf_ffiles;
-   sbp->f_ffree = (tquad.lval[0] & 0x7fff);
+   sbp->f_blocks = sfp->sf_tbytes / NFS_FABLKSIZE;
+   sbp->f_bfree = sfp->sf_fbytes / NFS_FABLKSIZE;
+   /*
+* Although sf_abytes is uint64_t and f_bavail is int64_t,
+* the value after dividing by NFS_FABLKSIZE is small
+* enough that it will fit in 63bits, so it is ok to
+* assign it to f_bavail without fear that it will become
+* negative.
+*/
+   sbp->f_bavail = sfp->sf_abytes / NFS_FABLKSIZE;
+   sbp->f_files = sfp->sf_tfiles;
+   /* Since f_ffree is int64_t, clip it to 63bits. */
+   if (sfp->sf_ffiles > INT64_MAX)
+   sbp->f_ffree = INT64_MAX;
+   else
+   sbp->f_ffree = sfp->sf_ffiles;
} else if ((nmp->nm_flag & NFSMNT_NFSV4) == 0) {
+   /*
+* The type casts to (int32_t) ensure that this code is
+* compatible with the old NFS client, in that it will
+* propagate bit31 to the high order bits. This may or may
+* not be correct for NFSv2, but since it is a legacy
+* environment, I'd rather retain backwards compatibility.
+*/
sbp->f_bsize = (int32_t)sfp->sf_bsize;
sbp->f_blocks = (int32_t)sfp->sf_blocks;
sbp->f_bfree = (int32_t)sfp->sf_bfree;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222089 - stable/8/sys/nfs

2011-05-18 Thread Rick Macklem
Author: rmacklem
Date: Thu May 19 01:56:46 2011
New Revision: 222089
URL: http://svn.freebsd.org/changeset/base/222089

Log:
  MFC: r221473
  Modify the NFS nfssvc(2) syscall so that it allows
  anyone to get the statistics for the new NFS subsystem.

Modified:
  stable/8/sys/nfs/nfs_nfssvc.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/nfs/nfs_nfssvc.c
==
--- stable/8/sys/nfs/nfs_nfssvc.c   Thu May 19 01:35:52 2011
(r222088)
+++ stable/8/sys/nfs/nfs_nfssvc.c   Thu May 19 01:56:46 2011
(r222089)
@@ -81,9 +81,12 @@ nfssvc(struct thread *td, struct nfssvc_
 
AUDIT_ARG_CMD(uap->flag);
 
-   error = priv_check(td, PRIV_NFS_DAEMON);
-   if (error)
-   return (error);
+   /* Allow anyone to get the stats. */
+   if ((uap->flag & ~NFSSVC_GETSTATS) != 0) {
+   error = priv_check(td, PRIV_NFS_DAEMON);
+   if (error != 0)
+   return (error);
+   }
error = EINVAL;
if ((uap->flag & (NFSSVC_ADDSOCK | NFSSVC_OLDNFSD | NFSSVC_NFSD)) &&
nfsd_call_nfsserver != NULL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"