svn commit: r253338 - head/sys/compat/linux

2013-07-14 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Jul 14 10:13:01 2013
New Revision: 253338
URL: http://svnweb.freebsd.org/changeset/base/253338

Log:
  Add some missing LIBUSB IOCTL conversion codes.

Modified:
  head/sys/compat/linux/linux_ioctl.c
  head/sys/compat/linux/linux_ioctl.h

Modified: head/sys/compat/linux/linux_ioctl.c
==
--- head/sys/compat/linux/linux_ioctl.c Sun Jul 14 07:58:10 2013
(r253337)
+++ head/sys/compat/linux/linux_ioctl.c Sun Jul 14 10:13:01 2013
(r253338)
@@ -3408,6 +3408,15 @@ linux_ioctl_fbsd_usb(struct thread *td, 
case FBSD_LUSB_SET_TEMPLATE:
args->cmd = USB_SET_TEMPLATE;
break;
+   case FBSD_LUSB_FS_OPEN_STREAM:
+   args->cmd = USB_FS_OPEN_STREAM;
+   break;
+   case FBSD_LUSB_GET_DEV_PORT_PATH:
+   args->cmd = USB_GET_DEV_PORT_PATH;
+   break;
+   case FBSD_LUSB_GET_POWER_USAGE:
+   args->cmd = USB_GET_POWER_USAGE;
+   break;
default:
error = ENOIOCTL;
}

Modified: head/sys/compat/linux/linux_ioctl.h
==
--- head/sys/compat/linux/linux_ioctl.h Sun Jul 14 07:58:10 2013
(r253337)
+++ head/sys/compat/linux/linux_ioctl.h Sun Jul 14 10:13:01 2013
(r253338)
@@ -744,9 +744,12 @@ int linux_ifname(struct ifnet *, char 
 #defineFBSD_LUSB_SET_IMMED 0xffe2
 #defineFBSD_LUSB_SET_POWER_MODE0xffe1
 #defineFBSD_LUSB_SET_TEMPLATE  0xffe0
+#defineFBSD_LUSB_FS_OPEN_STREAM0xffdf
+#defineFBSD_LUSB_GET_DEV_PORT_PATH 0xffde
+#defineFBSD_LUSB_GET_POWER_USAGE   0xffdd
 
 #defineFBSD_LUSB_MAX   0x
-#defineFBSD_LUSB_MIN   0xffe0
+#defineFBSD_LUSB_MIN   0xffdd
 
 /*
  * Pluggable ioctl handlers
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253339 - head/lib/libusb

2013-07-14 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Jul 14 10:22:00 2013
New Revision: 253339
URL: http://svnweb.freebsd.org/changeset/base/253339

Log:
  Add some missing definitions to build a working FreeBSD's libusb under Linux.

Modified:
  head/lib/libusb/Makefile
  head/lib/libusb/libusb20.c
  head/lib/libusb/libusb20_ugen20.c
  head/lib/libusb/libusb_global_linux.h

Modified: head/lib/libusb/Makefile
==
--- head/lib/libusb/MakefileSun Jul 14 10:13:01 2013(r253338)
+++ head/lib/libusb/MakefileSun Jul 14 10:22:00 2013(r253339)
@@ -15,11 +15,12 @@ INCS+=  libusb20_desc.h
 MAN=   libusb.3 libusb20.3
 MKLINT=no
 NOGCCERROR=
+PTHREAD_LIBS?= -lpthread
 
 WARNS?=2
 
 DPADD= ${LIBPTHREAD}
-LDADD= -lpthread
+LDADD= ${PTHREAD_LIBS}
 
 MLINKS+=   libusb.3 usb.3
 
@@ -42,7 +43,17 @@ CFLAGS+= -DCOMPAT_32BIT
 #
 # Examples:
 # make LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h
-# make COMPAT_32BIT=YES LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h
+# make COMPAT_32BIT=YES \
+#   LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h \
+#   DEBUG_FLAGS="-g"
+#
+# From Ubuntu 10.04:
+# freebsd-make LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h \
+#PTHREAD_LIBS="-lpthread -lrt"
+# freebsd-make COMPAT32_BIT=YES \
+#LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h \
+#PTHREAD_LIBS="-lpthread -lrt"
+#
 #
 .if defined(LIBUSB_GLOBAL_INCLUDE_FILE)
 CFLAGS+=   -DLIBUSB_GLOBAL_INCLUDE_FILE=\"${LIBUSB_GLOBAL_INCLUDE_FILE}\"

Modified: head/lib/libusb/libusb20.c
==
--- head/lib/libusb/libusb20.c  Sun Jul 14 10:13:01 2013(r253338)
+++ head/lib/libusb/libusb20.c  Sun Jul 14 10:22:00 2013(r253339)
@@ -1202,27 +1202,13 @@ libusb20_be_alloc(const struct libusb20_
 struct libusb20_backend *
 libusb20_be_alloc_linux(void)
 {
-   struct libusb20_backend *pbe;
-
-#ifdef __linux__
-   pbe = libusb20_be_alloc(&libusb20_linux_backend);
-#else
-   pbe = NULL;
-#endif
-   return (pbe);
+   return (NULL);
 }
 
 struct libusb20_backend *
 libusb20_be_alloc_ugen20(void)
 {
-   struct libusb20_backend *pbe;
-
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-   pbe = libusb20_be_alloc(&libusb20_ugen20_backend);
-#else
-   pbe = NULL;
-#endif
-   return (pbe);
+   return (libusb20_be_alloc(&libusb20_ugen20_backend));
 }
 
 struct libusb20_backend *
@@ -1230,10 +1216,12 @@ libusb20_be_alloc_default(void)
 {
struct libusb20_backend *pbe;
 
+#ifdef __linux__
pbe = libusb20_be_alloc_linux();
if (pbe) {
return (pbe);
}
+#endif
pbe = libusb20_be_alloc_ugen20();
if (pbe) {
return (pbe);

Modified: head/lib/libusb/libusb20_ugen20.c
==
--- head/lib/libusb/libusb20_ugen20.c   Sun Jul 14 10:13:01 2013
(r253338)
+++ head/lib/libusb/libusb20_ugen20.c   Sun Jul 14 10:22:00 2013
(r253339)
@@ -46,6 +46,10 @@
 #include "libusb20_desc.h"
 #include "libusb20_int.h"
 
+#ifndefIOUSB
+#define IOUSB(a) a
+#endif
+
 static libusb20_init_backend_t ugen20_init_backend;
 static libusb20_open_device_t ugen20_open_device;
 static libusb20_close_device_t ugen20_close_device;
@@ -145,14 +149,14 @@ ugen20_enumerate(struct libusb20_device 
if (f < 0) {
return (LIBUSB20_ERROR_OTHER);
}
-   if (ioctl(f, USB_GET_PLUGTIME, &plugtime)) {
+   if (ioctl(f, IOUSB(USB_GET_PLUGTIME), &plugtime)) {
error = LIBUSB20_ERROR_OTHER;
goto done;
}
/* store when the device was plugged */
pdev->session_data.plugtime = plugtime;
 
-   if (ioctl(f, USB_GET_DEVICE_DESC, &ddesc)) {
+   if (ioctl(f, IOUSB(USB_GET_DEVICE_DESC), &ddesc)) {
error = LIBUSB20_ERROR_OTHER;
goto done;
}
@@ -167,7 +171,7 @@ ugen20_enumerate(struct libusb20_device 
error = LIBUSB20_ERROR_OTHER;
goto done;
}
-   if (ioctl(f, USB_GET_DEVICEINFO, &devinfo)) {
+   if (ioctl(f, IOUSB(USB_GET_DEVICEINFO), &devinfo)) {
error = LIBUSB20_ERROR_OTHER;
goto done;
}
@@ -241,7 +245,7 @@ repeat:
st->urd.urd_maxlen = sizeof(st->buf);
st->nparsed = 0;
 
-   if (ioctl(st->f, USB_READ_DIR, &st->urd)) {
+   if (ioctl(st->f, IOUSB(USB_READ_DIR), &st->urd)) {
return (EINVAL);
}
st->ptr = st->buf;
@@ -313,7 +317,7 @@ ugen20_tr_release(struct libusb20_device
/* release all pending USB transfers */
if (pdev->privBeData != NULL) {
memset(&fs_uninit, 0, sizeof(fs_uninit));
-   if (ioc

svn commit: r253340 - head/sys/dev/usb/wlan

2013-07-14 Thread Rui Paulo
Author: rpaulo
Date: Sun Jul 14 18:26:47 2013
New Revision: 253340
URL: http://svnweb.freebsd.org/changeset/base/253340

Log:
  Revert r252725 as it breaks WPA.
  
  We need to fix wpa_supplicant because it checks whether the card has
  ic_cryptocaps set. Since net80211 can do software encryption this check in
  wpa_supplicant is wrong.

Modified:
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_urtw.c
  head/sys/dev/usb/wlan/if_urtwn.c
  head/sys/dev/usb/wlan/if_zyd.c

Modified: head/sys/dev/usb/wlan/if_rum.c
==
--- head/sys/dev/usb/wlan/if_rum.c  Sun Jul 14 10:22:00 2013
(r253339)
+++ head/sys/dev/usb/wlan/if_rum.c  Sun Jul 14 18:26:47 2013
(r253340)
@@ -502,12 +502,6 @@ rum_attach(device_t self)
| IEEE80211_C_WPA   /* 802.11i */
;
 
-   ic->ic_cryptocaps =
-   IEEE80211_CRYPTO_WEP |
-   IEEE80211_CRYPTO_AES_CCM |
-   IEEE80211_CRYPTO_TKIPMIC |
-   IEEE80211_CRYPTO_TKIP;
-
bands = 0;
setbit(&bands, IEEE80211_MODE_11B);
setbit(&bands, IEEE80211_MODE_11G);

Modified: head/sys/dev/usb/wlan/if_uath.c
==
--- head/sys/dev/usb/wlan/if_uath.c Sun Jul 14 10:22:00 2013
(r253339)
+++ head/sys/dev/usb/wlan/if_uath.c Sun Jul 14 18:26:47 2013
(r253340)
@@ -457,12 +457,6 @@ uath_attach(device_t dev)
IEEE80211_C_BGSCAN |/* capable of bg scanning */
IEEE80211_C_TXFRAG; /* handle tx frags */
 
-   ic->ic_cryptocaps =
-   IEEE80211_CRYPTO_WEP |
-   IEEE80211_CRYPTO_AES_CCM |
-   IEEE80211_CRYPTO_TKIPMIC |
-   IEEE80211_CRYPTO_TKIP;
-
/* put a regulatory domain to reveal informations.  */
uath_regdomain = sc->sc_devcap.regDomain;
 

Modified: head/sys/dev/usb/wlan/if_upgt.c
==
--- head/sys/dev/usb/wlan/if_upgt.c Sun Jul 14 10:22:00 2013
(r253339)
+++ head/sys/dev/usb/wlan/if_upgt.c Sun Jul 14 18:26:47 2013
(r253340)
@@ -353,12 +353,6 @@ upgt_attach(device_t dev)
| IEEE80211_C_WPA   /* 802.11i */
;
 
-   ic->ic_cryptocaps =
-   IEEE80211_CRYPTO_WEP |
-   IEEE80211_CRYPTO_AES_CCM |
-   IEEE80211_CRYPTO_TKIPMIC |
-   IEEE80211_CRYPTO_TKIP;
-
bands = 0;
setbit(&bands, IEEE80211_MODE_11B);
setbit(&bands, IEEE80211_MODE_11G);

Modified: head/sys/dev/usb/wlan/if_ural.c
==
--- head/sys/dev/usb/wlan/if_ural.c Sun Jul 14 10:22:00 2013
(r253339)
+++ head/sys/dev/usb/wlan/if_ural.c Sun Jul 14 18:26:47 2013
(r253340)
@@ -487,12 +487,6 @@ ural_attach(device_t self)
| IEEE80211_C_WPA   /* 802.11i */
;
 
-   ic->ic_cryptocaps =
-   IEEE80211_CRYPTO_WEP |
-   IEEE80211_CRYPTO_AES_CCM |
-   IEEE80211_CRYPTO_TKIPMIC |
-   IEEE80211_CRYPTO_TKIP;
-
bands = 0;
setbit(&bands, IEEE80211_MODE_11B);
setbit(&bands, IEEE80211_MODE_11G);

Modified: head/sys/dev/usb/wlan/if_urtw.c
==
--- head/sys/dev/usb/wlan/if_urtw.c Sun Jul 14 10:22:00 2013
(r253339)
+++ head/sys/dev/usb/wlan/if_urtw.c Sun Jul 14 18:26:47 2013
(r253340)
@@ -893,12 +893,6 @@ urtw_attach(device_t dev)
IEEE80211_C_BGSCAN |/* capable of bg scanning */
IEEE80211_C_WPA;/* 802.11i */
 
-   ic->ic_cryptocaps =
-   IEEE80211_CRYPTO_WEP |
-   IEEE80211_CRYPTO_AES_CCM |
-   IEEE80211_CRYPTO_TKIPMIC |
-   IEEE80211_CRYPTO_TKIP;
-
bands = 0;
setbit(&bands, IEEE80211_MODE_11B);
setbit(&bands, IEEE80211_MODE_11G);

Modified: head/sys/dev/usb/wlan/if_urtwn.c
==
--- head/sys/dev/usb/wlan/if_urtwn.cSun Jul 14 10:22:00 2013
(r253339)
+++ head/sys/dev/usb/wlan/if_urtwn.cSun Jul 14 18:26:47 2013
(r253340)
@@ -419,12 +419,6 @@ urtwn_attach(device_t self)
| IEEE80211_C_WPA   /* 802.11i */
;
 
-   ic->ic_cryptocaps =
-   IEEE80211_CRYPTO_WEP |
-   IEEE80211_CRYPTO_AES_CCM |
-   IEEE80211_CRYPTO_TKIPMIC |
-   IEEE80211_CRYPTO_TKIP;
-
bands = 0;
setbit(&bands, IEEE80211_MODE_11B);
setbit(&bands, IEEE80211_MODE_11G);

Modified: head/sys/dev/usb/wlan/if_zyd.c
=

svn commit: r253341 - head/sys/ufs/ffs

2013-07-14 Thread Kirk McKusick
Author: mckusick
Date: Sun Jul 14 18:44:33 2013
New Revision: 253341
URL: http://svnweb.freebsd.org/changeset/base/253341

Log:
  Update to comments describing block allocation policy.
  
  Submitted by: Bruce Evans

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

Modified: head/sys/ufs/ffs/ffs_alloc.c
==
--- head/sys/ufs/ffs/ffs_alloc.cSun Jul 14 18:26:47 2013
(r253340)
+++ head/sys/ufs/ffs/ffs_alloc.cSun Jul 14 18:44:33 2013
(r253341)
@@ -1196,7 +1196,8 @@ ffs_dirpref(pip)
 /*
  * Select the desired position for the next block in a file.  The file is
  * logically divided into sections. The first section is composed of the
- * direct blocks. Each additional section contains fs_maxbpg blocks.
+ * direct blocks and the next fs_maxbpg blocks. Each additional section
+ * contains fs_maxbpg blocks.
  *
  * If no blocks have been allocated in the first section, the policy is to
  * request a block in the same cylinder group as the inode that describes
@@ -1214,14 +1215,12 @@ ffs_dirpref(pip)
  * cylinder group from which the previous allocation was made. The sweep
  * continues until a cylinder group with greater than the average number
  * of free blocks is found. If the allocation is for the first block in an
- * indirect block, the information on the previous allocation is unavailable;
- * here a best guess is made based upon the logical block number being
- * allocated.
+ * indirect block or the previous block is a hole, then the information on
+ * the previous allocation is unavailable; here a best guess is made based
+ * on the logical block number being allocated.
  *
  * If a section is already partially allocated, the policy is to
- * contiguously allocate fs_maxcontig blocks. The end of one of these
- * contiguous blocks and the beginning of the next is laid out
- * contiguously if possible.
+ * allocate blocks contiguously within the section if possible.
  */
 ufs2_daddr_t
 ffs_blkpref_ufs1(ip, lbn, indx, bap)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253342 - head

2013-07-14 Thread Rui Paulo
Author: rpaulo
Date: Sun Jul 14 20:22:16 2013
New Revision: 253342
URL: http://svnweb.freebsd.org/changeset/base/253342

Log:
  Fix a grammatical error.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Sun Jul 14 18:44:33 2013(r253341)
+++ head/UPDATING   Sun Jul 14 20:22:16 2013(r253342)
@@ -38,7 +38,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
 20130709:
Most of network statistics structures were changed to be able
keep 64-bits counters. Thus all tools, that work with networking
-   statistics, must be rebuilded (netstat(1), bsnmpd(1), etc.)
+   statistics, must be rebuilt (netstat(1), bsnmpd(1), etc.)
 
 20130629:
Fix targets that run multiple make's to use && rather than ;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253344 - head/sys/fs/fuse

2013-07-14 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jul 15 00:05:27 2013
New Revision: 253344
URL: http://svnweb.freebsd.org/changeset/base/253344

Log:
  Update fuse_kernel header.
  
  Bring in the changes from the FUSE kernel interface 7.10
  (available under a BSD license).
  
  After 7.10 the linux FUSE developers added support for a
  controversial CUSE driver and some linux especific
  features that are unlikely to find its way into FreeBSD.
  
  We currently don't implement any of the new features so we
  are *not* bumping the FUSE_KERNEL_MINOR_VERSION. The header
  should, nevertheless, serve  as a template to add the new
  features in a compatible manner.
  
  While here adopt some minor cleanups from the upstream version
  like removing FUSE_MAJOR and FUSE_MINOR which were never
  used. Also add multiple inclusion header guards,

Modified:
  head/sys/fs/fuse/fuse_kernel.h

Modified: head/sys/fs/fuse/fuse_kernel.h
==
--- head/sys/fs/fuse/fuse_kernel.h  Sun Jul 14 21:57:25 2013
(r253343)
+++ head/sys/fs/fuse/fuse_kernel.h  Mon Jul 15 00:05:27 2013
(r253344)
@@ -34,14 +34,32 @@
  * $FreeBSD$
  */
 
+/*
+ * This file defines the kernel interface of FUSE
+ *
+ * Protocol changelog:
+ *
+ * 7.9:
+ *  - new fuse_getattr_in input argument of GETATTR
+ *  - add lk_flags in fuse_lk_in
+ *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
+ *  - add blksize field to fuse_attr
+ *  - add file flags field to fuse_read_in and fuse_write_in
+ *
+ * 7.10
+ *  - add nonseekable open flag
+ */
+
+#ifndef _FS_FUSE_FUSE_KERNEL_H_
+#define _FS_FUSE_FUSE_KERNEL_H_
+
 #ifndef linux
 #include 
 #define __u64 uint64_t
 #define __u32 uint32_t
 #define __s32 int32_t
 #else
-#include 
-#include 
+#include 
 #endif
 
 /** Version number of this interface */
@@ -53,12 +71,6 @@
 /** The node ID of the root inode */
 #define FUSE_ROOT_ID 1
 
-/** The major number of the fuse character device */
-#define FUSE_MAJOR MISC_MAJOR
-
-/** The minor number of the fuse character device */
-#define FUSE_MINOR 229
-
 /* Make sure all structures are padded to 64bit boundary, so 32bit
userspace works under 64bit kernels */
 
@@ -79,7 +91,7 @@ struct fuse_attr {
__u32   uid;
__u32   gid;
__u32   rdev;
-   __u32   padding;
+   __u32   blksize;
 };
 
 struct fuse_kstatfs {
@@ -112,27 +124,62 @@ struct fuse_file_lock {
 #define FATTR_ATIME(1 << 4)
 #define FATTR_MTIME(1 << 5)
 #define FATTR_FH   (1 << 6)
+#define FATTR_ATIME_NOW(1 << 7)
+#define FATTR_MTIME_NOW(1 << 8)
+#define FATTR_LOCKOWNER(1 << 9)
 
 /**
  * Flags returned by the OPEN request
  *
  * FOPEN_DIRECT_IO: bypass page cache for this open file
  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
+ * FOPEN_NONSEEKABLE: the file is not seekable
  */
 #define FOPEN_DIRECT_IO(1 << 0)
 #define FOPEN_KEEP_CACHE   (1 << 1)
+#define FOPEN_NONSEEKABLE  (1 << 2)
 
 /**
  * INIT request/reply flags
+ *
+ * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
  */
 #define FUSE_ASYNC_READ(1 << 0)
 #define FUSE_POSIX_LOCKS   (1 << 1)
+#define FUSE_FILE_OPS  (1 << 2)
+#define FUSE_ATOMIC_O_TRUNC(1 << 3)
+#define FUSE_EXPORT_SUPPORT(1 << 4)
+#define FUSE_BIG_WRITES(1 << 5)
 
 /**
  * Release flags
  */
 #define FUSE_RELEASE_FLUSH (1 << 0)
 
+/**
+ * Getattr flags
+ */
+#define FUSE_GETATTR_FH(1 << 0)
+
+/**
+ * Lock flags
+ */
+#define FUSE_LK_FLOCK  (1 << 0)
+
+/**
+ * WRITE flags
+ *
+ * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
+ * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
+ */
+#define FUSE_WRITE_CACHE   (1 << 0)
+#define FUSE_WRITE_LOCKOWNER   (1 << 1)
+
+/**
+ * Read flags
+ */
+#define FUSE_READ_LOCKOWNER(1 << 1)
+
 enum fuse_opcode {
FUSE_LOOKUP= 1,
FUSE_FORGET= 2,  /* no reply */
@@ -175,6 +222,8 @@ enum fuse_opcode {
 /* The read buffer is required to be at least 8k, but may be much larger */
 #define FUSE_MIN_READ_BUFFER 8192
 
+#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
+
 struct fuse_entry_out {
__u64   nodeid; /* Inode ID */
__u64   generation; /* Inode generation: nodeid:gen must
@@ -190,6 +239,14 @@ struct fuse_forget_in {
__u64   nlookup;
 };
 
+struct fuse_getattr_in {
+   __u32   getattr_flags;
+   __u32   dummy;
+   __u64   fh;
+};
+
+#define FUSE_COMPAT_ATTR_OUT_SIZE 96
+
 struct fuse_attr_out {
__u64   attr_valid; /* Cache timeout for the attributes */
__u32   attr_valid_nsec;
@@ -197,6 +254,11 @@ struct fuse_attr_out {
struct fuse_attr attr;
 };
 
+struct fuse_mknod_in {
+   __u32   mode;
+   __u32   rdev;
+};
+
 struct fuse_mkdir_in {
__u32   mode;
__u32   padding;
@@ -215,7 +277,7 @@ struct fuse_setattr_in {
   

svn commit: r253346 - in head/sys: kern net netgraph netgraph/bluetooth/socket

2013-07-14 Thread Craig Rodrigues
Author: rodrigc
Date: Mon Jul 15 01:32:55 2013
New Revision: 253346
URL: http://svnweb.freebsd.org/changeset/base/253346

Log:
  PR: 168520 170096
  Submitted by: adrian, zec
  
  Fix multiple kernel panics when VIMAGE is enabled in the kernel.
  These fixes are based on patches submitted by Adrian Chadd and Marko Zec.
  
  (1)  Set curthread->td_vnet to vnet0 in device_probe_and_attach() just before 
calling
   device_attach().  This fixes multiple VIMAGE related kernel panics
   when trying to attach Bluetooth or USB Ethernet devices because
   curthread->td_vnet is NULL.
  
  (2)  Set curthread->td_vnet in if_detach().  This fixes kernel panics when 
detaching networking
   interfaces, especially USB Ethernet devices.
  
  (3)  Use VNET_DOMAIN_SET() in ng_btsocket.c
  
  (4)  In ng_unref_node() set curthread->td_vnet.  This fixes kernel panics
   when detaching Netgraph nodes.

Modified:
  head/sys/kern/subr_bus.c
  head/sys/net/if.c
  head/sys/netgraph/bluetooth/socket/ng_btsocket.c
  head/sys/netgraph/ng_base.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cMon Jul 15 00:49:10 2013(r253345)
+++ head/sys/kern/subr_bus.cMon Jul 15 01:32:55 2013(r253346)
@@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include 
@@ -2735,7 +2737,11 @@ device_probe_and_attach(device_t dev)
return (0);
else if (error != 0)
return (error);
-   return (device_attach(dev));
+
+   CURVNET_SET_QUIET(vnet0);
+   error = device_attach(dev);
+   CURVNET_RESTORE();
+   return error;
 }
 
 /**

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Mon Jul 15 00:49:10 2013(r253345)
+++ head/sys/net/if.c   Mon Jul 15 01:32:55 2013(r253346)
@@ -505,6 +505,7 @@ if_free(struct ifnet *ifp)
 
ifp->if_flags |= IFF_DYING; /* XXX: Locking */
 
+   CURVNET_SET_QUIET(ifp->if_vnet);
IFNET_WLOCK();
KASSERT(ifp == ifnet_byindex_locked(ifp->if_index),
("%s: freeing unallocated ifnet", ifp->if_xname));
@@ -512,9 +513,9 @@ if_free(struct ifnet *ifp)
ifindex_free_locked(ifp->if_index);
IFNET_WUNLOCK();
 
-   if (!refcount_release(&ifp->if_refcount))
-   return;
-   if_free_internal(ifp);
+   if (refcount_release(&ifp->if_refcount))
+   if_free_internal(ifp);
+   CURVNET_RESTORE();
 }
 
 /*
@@ -803,7 +804,9 @@ void
 if_detach(struct ifnet *ifp)
 {
 
+   CURVNET_SET_QUIET(ifp->if_vnet);
if_detach_internal(ifp, 0);
+   CURVNET_RESTORE();
 }
 
 static void

Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket.c
==
--- head/sys/netgraph/bluetooth/socket/ng_btsocket.cMon Jul 15 00:49:10 
2013(r253345)
+++ head/sys/netgraph/bluetooth/socket/ng_btsocket.cMon Jul 15 01:32:55 
2013(r253346)
@@ -46,6 +46,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -285,4 +287,4 @@ ng_btsocket_modevent(module_t mod, int e
return (error);
 } /* ng_btsocket_modevent */
 
-DOMAIN_SET(ng_btsocket_);
+VNET_DOMAIN_SET(ng_btsocket_);

Modified: head/sys/netgraph/ng_base.c
==
--- head/sys/netgraph/ng_base.c Mon Jul 15 00:49:10 2013(r253345)
+++ head/sys/netgraph/ng_base.c Mon Jul 15 01:32:55 2013(r253346)
@@ -789,6 +789,8 @@ ng_unref_node(node_p node)
if (node == &ng_deadnode)
return;
 
+   CURVNET_SET(node->nd_vnet);
+
if (refcount_release(&node->nd_refs)) { /* we were the last */
 
node->nd_type->refs--; /* XXX maybe should get types lock? */
@@ -807,6 +809,7 @@ ng_unref_node(node_p node)
mtx_destroy(&node->nd_input_queue.q_mtx);
NG_FREE_NODE(node);
}
+   CURVNET_RESTORE();
 }
 
 /
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2013-07-14 Thread Craig Rodrigues
Author: rodrigc
Date: Mon Jul 15 01:41:34 2013
New Revision: 253347
URL: http://svnweb.freebsd.org/changeset/base/253347

Log:
  PR: kern/168520
  
  Revert GRN 253255.  It is not needed now that GRN 253346 is committed.

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.cMon Jul 15 01:32:55 
2013(r253346)
+++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.cMon Jul 15 01:41:34 
2013(r253347)
@@ -109,9 +109,7 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 
 #include "usbdevs.h"
 #include 
@@ -125,7 +123,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -490,14 +487,13 @@ ubt_attach(device_t dev)
 
sc->sc_dev = dev;
sc->sc_debug = NG_UBT_WARN_LEVEL;
-   CURVNET_SET(TD_TO_VNET(curthread));
+
/* 
 * Create Netgraph node
 */
 
if (ng_make_node_common(&typestruct, &sc->sc_node) != 0) {
UBT_ALERT(sc, "could not create Netgraph node\n");
-   CURVNET_RESTORE();
return (ENXIO);
}
 
@@ -505,12 +501,10 @@ ubt_attach(device_t dev)
if (ng_name_node(sc->sc_node, device_get_nameunit(dev)) != 0) {
UBT_ALERT(sc, "could not name Netgraph node\n");
NG_NODE_UNREF(sc->sc_node);
-   CURVNET_RESTORE();
return (ENXIO);
}
NG_NODE_SET_PRIVATE(sc->sc_node, sc);
NG_NODE_FORCE_WRITER(sc->sc_node);
-   CURVNET_RESTORE();
 
/*
 * Initialize device softc structure
@@ -637,10 +631,8 @@ ubt_detach(device_t dev)
/* Destroy Netgraph node */
if (node != NULL) {
sc->sc_node = NULL;
-   CURVNET_SET(node->nd_vnet);
NG_NODE_REALLY_DIE(node);
ng_rmnode_self(node);
-   CURVNET_RESTORE();
}
 
/* Make sure ubt_task in gone */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253349 - head/share/man/man5

2013-07-14 Thread Hiroki Sato
Author: hrs
Date: Mon Jul 15 03:50:14 2013
New Revision: 253349
URL: http://svnweb.freebsd.org/changeset/base/253349

Log:
  Document options for .eli devices.
  
  Submitted by: ADAM David Alan Martin

Modified:
  head/share/man/man5/fstab.5

Modified: head/share/man/man5/fstab.5
==
--- head/share/man/man5/fstab.5 Mon Jul 15 02:19:38 2013(r253348)
+++ head/share/man/man5/fstab.5 Mon Jul 15 03:50:14 2013(r253349)
@@ -32,7 +32,7 @@
 .\" @(#)fstab.58.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd June 21, 2013
+.Dd July 15, 2013
 .Dt FSTAB 5
 .Os
 .Sh NAME
@@ -239,6 +239,18 @@ an
 .Xr md 4
 device is created with the specified file used as backing store,
 and then the new device is used as swap space.
+Swap entries on
+.Pa .eli
+devices will cause automatic creation of encrypted devices.
+The
+.Dq ealgo ,
+.Dq aalgo ,
+.Dq keylength ,
+and
+.Dq sectorsize
+options may be passed to control those
+.Xr geli 8
+parameters.
 The fields other than
 .Fa fs_spec
 and
@@ -372,6 +384,7 @@ resides in
 .Xr ccd 4 ,
 .Xr dump 8 ,
 .Xr fsck 8 ,
+.Xr geli 8 ,
 .Xr mount 8 ,
 .Xr quotacheck 8 ,
 .Xr quotaon 8 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253350 - head/usr.sbin/ypserv

2013-07-14 Thread Hiroki Sato
Author: hrs
Date: Mon Jul 15 05:09:13 2013
New Revision: 253350
URL: http://svnweb.freebsd.org/changeset/base/253350

Log:
  Fix compiler warnings.

Modified:
  head/usr.sbin/ypserv/yp_access.c
  head/usr.sbin/ypserv/yp_dnslookup.c

Modified: head/usr.sbin/ypserv/yp_access.c
==
--- head/usr.sbin/ypserv/yp_access.cMon Jul 15 03:50:14 2013
(r253349)
+++ head/usr.sbin/ypserv/yp_access.cMon Jul 15 05:09:13 2013
(r253350)
@@ -97,6 +97,10 @@ struct securenet *securenets;
 
 #define LINEBUFSZ 1024
 
+#ifdef TCP_WRAPPER
+int hosts_ctl(char *, char *, char *, char *);
+#endif
+
 /*
  * Read /var/yp/securenets file and initialize the securenets
  * list. If the file doesn't exist, we set up a dummy entry that

Modified: head/usr.sbin/ypserv/yp_dnslookup.c
==
--- head/usr.sbin/ypserv/yp_dnslookup.c Mon Jul 15 03:50:14 2013
(r253349)
+++ head/usr.sbin/ypserv/yp_dnslookup.c Mon Jul 15 05:09:13 2013
(r253350)
@@ -456,7 +456,7 @@ yp_async_lookup_name(struct svc_req *rqs
pending++;
 
if (debug)
-   yp_error("queueing async DNS name lookup (%d)", q->id);
+   yp_error("queueing async DNS name lookup (%lu)", q->id);
 
yp_prune_dnsq();
return(YP_TRUE);
@@ -544,7 +544,7 @@ yp_async_lookup_addr(struct svc_req *rqs
pending++;
 
if (debug)
-   yp_error("queueing async DNS address lookup (%d)", q->id);
+   yp_error("queueing async DNS address lookup (%lu)", q->id);
 
yp_prune_dnsq();
return(YP_TRUE);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253351 - in head: sys/arm/arm sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/aim sys/powerpc/booke sys/sparc64/sparc64 sys/sys usr.bin/netstat

2013-07-14 Thread Andrey V. Elsukov
Author: ae
Date: Mon Jul 15 06:16:57 2013
New Revision: 253351
URL: http://svnweb.freebsd.org/changeset/base/253351

Log:
  Introduce new structure sfstat for collecting sendfile's statistics
  and remove corresponding fields from struct mbstat. Use PCPU counters
  and SFSTAT_INC() macro for update these statistics.
  
  Discussed with:   glebius

Modified:
  head/sys/arm/arm/vm_machdep.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/uipc_syscalls.c
  head/sys/mips/mips/vm_machdep.c
  head/sys/powerpc/aim/vm_machdep.c
  head/sys/powerpc/booke/vm_machdep.c
  head/sys/sparc64/sparc64/vm_machdep.c
  head/sys/sys/mbuf.h
  head/sys/sys/sf_buf.h
  head/usr.bin/netstat/main.c
  head/usr.bin/netstat/mbuf.c

Modified: head/sys/arm/arm/vm_machdep.c
==
--- head/sys/arm/arm/vm_machdep.c   Mon Jul 15 05:09:13 2013
(r253350)
+++ head/sys/arm/arm/vm_machdep.c   Mon Jul 15 06:16:57 2013
(r253351)
@@ -251,7 +251,7 @@ sf_buf_alloc(struct vm_page *m, int flag
if (flags & SFB_NOWAIT)
goto done;
sf_buf_alloc_want++;
-   mbstat.sf_allocwait++;
+   SFSTAT_INC(sf_allocwait);
error = msleep(&sf_buf_freelist, &sf_buf_lock,
(flags & SFB_CATCH) ? PCATCH | PVM : PVM, "sfbufa", 0);
sf_buf_alloc_want--;

Modified: head/sys/i386/i386/vm_machdep.c
==
--- head/sys/i386/i386/vm_machdep.c Mon Jul 15 05:09:13 2013
(r253350)
+++ head/sys/i386/i386/vm_machdep.c Mon Jul 15 06:16:57 2013
(r253351)
@@ -833,7 +833,7 @@ sf_buf_alloc(struct vm_page *m, int flag
if (flags & SFB_NOWAIT)
goto done;
sf_buf_alloc_want++;
-   mbstat.sf_allocwait++;
+   SFSTAT_INC(sf_allocwait);
error = msleep(&sf_buf_freelist, &sf_buf_lock,
(flags & SFB_CATCH) ? PCATCH | PVM : PVM, "sfbufa", 0);
sf_buf_alloc_want--;

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Mon Jul 15 05:09:13 2013(r253350)
+++ head/sys/kern/kern_mbuf.c   Mon Jul 15 06:16:57 2013(r253351)
@@ -401,8 +401,6 @@ mbuf_init(void *dummy)
mbstat.m_numtypes = MT_NTYPES;
 
mbstat.m_mcfail = mbstat.m_mpfail = 0;
-   mbstat.sf_iocnt = 0;
-   mbstat.sf_allocwait = mbstat.sf_allocfail = 0;
 }
 SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL);
 

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Mon Jul 15 05:09:13 2013
(r253350)
+++ head/sys/kern/uipc_syscalls.c   Mon Jul 15 06:16:57 2013
(r253351)
@@ -115,6 +115,7 @@ static int getsockname1(struct thread *t
 static int getpeername1(struct thread *td, struct getpeername_args *uap,
int compat);
 
+counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)];
 /*
  * NSFBUFS-related variables and associated sysctls
  */
@@ -129,6 +130,27 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsp
 SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0,
 "Number of sendfile(2) sf_bufs in use");
 
+static void
+sfstat_init(const void *unused)
+{
+
+   COUNTER_ARRAY_ALLOC(sfstat, sizeof(struct sfstat) / sizeof(uint64_t),
+   M_WAITOK);
+}
+SYSINIT(sfstat, SI_SUB_MBUF, SI_ORDER_FIRST, sfstat_init, NULL);
+
+static int
+sfstat_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   struct sfstat s;
+
+   COUNTER_ARRAY_COPY(sfstat, &s, sizeof(s) / sizeof(uint64_t));
+   if (req->newptr)
+   COUNTER_ARRAY_ZERO(sfstat, sizeof(s) / sizeof(uint64_t));
+   return (SYSCTL_OUT(req, &s, sizeof(s)));
+}
+SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, CTLTYPE_OPAQUE | CTLFLAG_RW,
+NULL, 0, sfstat_sysctl, "I", "sendfile statistics");
 /*
  * Convert a user file descriptor to a kernel file entry and check if required
  * capability rights are present.
@@ -2241,7 +2263,7 @@ retry_space:
vm_page_io_finish(pg);
if (!error)
VM_OBJECT_WUNLOCK(obj);
-   mbstat.sf_iocnt++;
+   SFSTAT_INC(sf_iocnt);
}
if (error) {
vm_page_lock(pg);
@@ -2273,7 +2295,7 @@ retry_space:
sf = sf_buf_alloc(pg, (mnw || m != NULL) ? SFB_NOWAIT :
SFB_CATCH);
if (sf == NULL) {
-   mbstat.sf_allocfail++;
+   SFSTAT_INC(sf_allocfail);
   

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

2013-07-14 Thread Konstantin Belousov
Author: kib
Date: Mon Jul 15 06:30:57 2013
New Revision: 253352
URL: http://svnweb.freebsd.org/changeset/base/253352

Log:
  MFi386: add ddb "show sysregs" command.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Mon Jul 15 06:16:57 2013
(r253351)
+++ head/sys/amd64/amd64/machdep.c  Mon Jul 15 06:30:57 2013
(r253352)
@@ -1228,6 +1228,36 @@ DB_SHOW_COMMAND(idt, db_show_idt)
ip++;
}
 }
+
+/* Show privileged registers. */
+DB_SHOW_COMMAND(sysregs, db_show_sysregs)
+{
+   struct {
+   uint16_t limit;
+   uint64_t base;
+   } __packed idtr, gdtr;
+   uint16_t ldt, tr;
+
+   __asm __volatile("sidt %0" : "=m" (idtr));
+   db_printf("idtr\t0x%016lx/%04x\n",
+   (u_long)idtr.base, (u_int)idtr.limit);
+   __asm __volatile("sgdt %0" : "=m" (gdtr));
+   db_printf("gdtr\t0x%016lx/%04x\n",
+   (u_long)gdtr.base, (u_int)gdtr.limit);
+   __asm __volatile("sldt %0" : "=r" (ldt));
+   db_printf("ldtr\t0x%04x\n", ldt);
+   __asm __volatile("str %0" : "=r" (tr));
+   db_printf("tr\t0x%04x\n", tr);
+   db_printf("cr0\t0x%016lx\n", rcr0());
+   db_printf("cr2\t0x%016lx\n", rcr2());
+   db_printf("cr3\t0x%016lx\n", rcr3());
+   db_printf("cr4\t0x%016lx\n", rcr4());
+   db_printf("EFER\t%016lx\n", rdmsr(MSR_EFER));
+   db_printf("FEATURES_CTL\t%016lx\n", rdmsr(MSR_IA32_FEATURE_CONTROL));
+   db_printf("DEBUG_CTL\t%016lx\n", rdmsr(MSR_DEBUGCTLMSR));
+   db_printf("PAT\t%016lx\n", rdmsr(MSR_PAT));
+   db_printf("GSBASE\t%016lx\n", rdmsr(MSR_GSBASE));
+}
 #endif
 
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"