svn commit: r230008 - stable/9/sys/kern

2012-01-12 Thread Peter Holm
Author: pho
Date: Thu Jan 12 08:03:26 2012
New Revision: 230008
URL: http://svn.freebsd.org/changeset/base/230008

Log:
  MFC: r227674
  
  Added check for negative seconds value. Found by syscall() fuzzing.

Modified:
  stable/9/sys/kern/kern_thr.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_thr.c
==
--- stable/9/sys/kern/kern_thr.cThu Jan 12 06:48:11 2012
(r230007)
+++ stable/9/sys/kern/kern_thr.cThu Jan 12 08:03:26 2012
(r230008)
@@ -473,7 +473,8 @@ kern_thr_suspend(struct thread *td, stru
}
 
if (tsp != NULL) {
-   if (tsp->tv_nsec < 0 || tsp->tv_nsec > 10)
+   if (tsp->tv_sec < 0 || tsp->tv_nsec < 0 ||
+   tsp->tv_nsec > 10)
return (EINVAL);
if (tsp->tv_sec == 0 && tsp->tv_nsec == 0)
error = EWOULDBLOCK;
___
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: r229997 - in head: share/examples/scsi_target sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/ctl

2012-01-12 Thread Hans Petter Selasky
Hi,

 

Does the cam target layer support attach/detach of logical units?

 

Can it be used with USB target mode?

 

--HPS
 
-Original message-
To:src-committ...@freebsd.org; svn-src-all@freebsd.org; 
svn-src-h...@freebsd.org; 
From:Kenneth D. Merry 
Sent:Thu 12-01-2012 01:35
Subject:svn commit: r229997 - in head: share/examples/scsi_target 
sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss 
sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/ctls...
Author: ken
Date: Thu Jan 12 00:34:33 2012
New Revision: 229997
URL: http://svn.freebsd.org/changeset/base/229997

Log:
 Add the CAM Target Layer (CTL).
 
 CTL is a disk and processor device emulation subsystem originally written
 for Copan Systems under Linux starting in 2003.  It has been shipping in
 Copan (now SGI) products since 2005.
 
 It was ported to FreeBSD in 2008, and thanks to an agreement between SGI
 (who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is
 available under a BSD-style license.  The intent behind the agreement was
 that Spectra would work to get CTL into the FreeBSD tree.
 
 Some CTL features:
 
  - Disk and processor device emulation.
  - Tagged queueing
  - SCSI task attribute support (ordered, head of queue, simple tags)
  - SCSI implicit command ordering support.  (e.g. if a read follows a mode
    select, the read will be blocked until the mode select completes.)
  - Full task management support (abort, LUN reset, target reset, etc.)
  - Support for multiple ports
  - Support for multiple simultaneous initiators
  - Support for multiple simultaneous backing stores
  - Persistent reservation support
  - Mode sense/select support
  - Error injection support
  - High Availability support (1)
  - All I/O handled in-kernel, no userland context switch overhead.
 
 (1) HA Support is just an API stub, and needs much more to be fully
     functional.
 
 ctl.c:The core of CTL.  Command handlers and processing,
 character driver, and HA support are here.
 
 ctl.h:Basic function declarations and data structures.
 
 ctl_backend.c,
 ctl_backend.h:The basic CTL backend API.
 
 ctl_backend_block.c,
 ctl_backend_block.h:The block and file backend.  This allows for using
 a disk or a file as the backing store for a LUN.
 Multiple threads are started to do I/O to the
 backing device, primarily because the VFS API
 requires that to get any concurrency.
 
 ctl_backend_ramdisk.c:A "fake" ramdisk backend.  It only allocates a
 small amount of memory to act as a source and sink
 for reads and writes from an initiator.  Therefore
 it cannot be used for any real data, but it can be
 used to test for throughput.  It can also be used
 to test initiators' support for extremely large LUNs.
 
 ctl_cmd_table.c:This is a table with all 256 possible SCSI opcodes,
 and command handler functions defined for supported
 opcodes.
 
 ctl_debug.h:Debugging support.
 
 ctl_error.c,
 ctl_error.h:CTL-specific wrappers around the CAM sense building
 functions.
 
 ctl_frontend.c,
 ctl_frontend.h:These files define the basic CTL frontend port API.
 
 ctl_frontend_cam_sim.c:This is a CTL frontend port that is also a CAM SIM.
 This frontend allows for using CTL without any
 target-capable hardware.  So any LUNs you create in
 CTL are visible in CAM via this port.
 
 ctl_frontend_internal.c,
 ctl_frontend_internal.h:
 This is a frontend port written for Copan to do
 some system-specific tasks that required sending
 commands into CTL from inside the kernel.  This
 isn't entirely relevant to FreeBSD in general,
 but can perhaps be repurposed.
 
 ctl_ha.h:This is a stubbed-out High Availability API.  Much
 more is needed for full HA support.  See the
 comments in the header and the description of what
 is needed in the README.ctl.txt file for more
 details.
 
 ctl_io.h:This defines most of the core CTL I/O structures.
 union ctl_io is conceptually very similar to CAM's
 union ccb.
 
 ctl_ioctl.h:This defines all ioctls available through the CTL
 character device, and the data structures needed
 for those ioctls.
 
 ctl_mem_pool.c,
 ctl_mem_pool.h:Generic memory pool implementation used by the
 internal frontend.
 
 ctl_private.h:Private data structres (e.g. CTL softc) and
 function prototypes.  This also includes the SCSI
 vendor and product names used by CTL.
 
 ctl_scsi_all.c,
 ctl_scsi_all.h:CTL wrappers around CAM sense printing functions.
 
 ctl_ser_table.c:Command serialization table.  This defines what
 happens when one type of command is followed by
 another type of command.
 
 ctl_util.c,
 ctl_util.h:CTL utility functions, primarily designed to be
 used from userland.  See ctladm for the primary
 consumer of these functions.  These include CDB
 building functions.
 
 scsi_ctl.c:CAM target peripheral driver and CTL frontend port.
 This is the path into CTL for commands from
 target-capable hardware/SIMs.
 
 README.ctl.txt:CTL code features, roadmap, to-do list.
 
 usr.sbin/Makefile:Add ctladm.
 
 ctladm/Makefile

Re: svn commit: r229988 - head/lib/libutil

2012-01-12 Thread Bruce Evans

On Wed, 11 Jan 2012, Guy Helmer wrote:


Log:
 Fix prototype formatting (indentation, long lines, and continued lines).

 Requested by bde.


Thanks.  This looks good.  Here are a few more fixes (mostly prototype
:ormatting, 2 lines struct member formatting and 1 and 1 missing underscore).

% Index: libutil.h
% ===
% RCS file: /home/ncvs/src/lib/libutil/libutil.h,v
% retrieving revision 1.64
% diff -u -r1.64 libutil.h
% --- libutil.h 11 Jan 2012 22:45:15 -  1.64
% +++ libutil.h 12 Jan 2012 09:49:29 -
% @@ -69,8 +69,8 @@
%  /* for properties.c */
%  typedef struct _property {
%   struct _property *next;
% - char *name;
% - char *value;
% + char*name;
% + char*value;
%  } *properties;
% 
%  #ifdef _SYS_PARAM_H_

% @@ -121,7 +121,7 @@
%  void properties_free(properties _list);
%  char *property_find(properties _list, const char *_name);
%  properties
% - properties_read(int fd);
% + properties_read(int _fd);
%  int  realhostname(char *_host, size_t _hsize, const struct in_addr *_ip);
%  int  realhostname_sa(char *_host, size_t _hsize, struct sockaddr *_addr,
%   int _addrlen);
% @@ -139,8 +139,10 @@
%  #endif
% 
%  #ifdef _PWD_H_

% -int  pw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct passwd 
*_old_pw);
% -struct passwd *pw_dup(const struct passwd *_pw);
% +int  pw_copy(int _ffd, int _tfd, const struct passwd *_pw,
% + struct passwd *_old_pw);
% +struct passwd
% + *pw_dup(const struct passwd *_pw);
%  int  pw_edit(int _notsetuid);
%  int  pw_equal(const struct passwd *_pw1, const struct passwd *_pw2);
%  void pw_fini(void);
% @@ -149,21 +151,26 @@
%  char *pw_make_v7(const struct passwd *_pw);
%  int  pw_mkdb(const char *_user);
%  int  pw_lock(void);
% -struct passwd *pw_scan(const char *_line, int _flags);
% -const char *pw_tempname(void);
% +struct passwd
% + *pw_scan(const char *_line, int _flags);
% +const char
% + *pw_tempname(void);
%  int  pw_tmp(int _mfd);
%  #endif
% 
%  #ifdef _GRP_H_

% -int  gr_copy(int __ffd, int _tfd, const struct group *_gr, struct group 
*_old_gr);
% -struct group *gr_dup(const struct group *_gr);
% +int  gr_copy(int __ffd, int _tfd, const struct group *_gr,
% + struct group *_old_gr);
% +struct group
% + *gr_dup(const struct group *_gr);
%  int  gr_equal(const struct group *_gr1, const struct group *_gr2);
%  void gr_fini(void);
%  int  gr_init(const char *_dir, const char *_master);
%  int  gr_lock(void);
%  char *gr_make(const struct group *_gr);
%  int  gr_mkdb(void);
% -struct group *gr_scan(const char *_line);
% +struct group
% + *gr_scan(const char *_line);
%  int  gr_tmp(int _mdf);
%  #endif
%

Bruce
___
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: r230009 - stable/9/release/picobsd/build

2012-01-12 Thread Luigi Rizzo
Author: luigi
Date: Thu Jan 12 11:08:21 2012
New Revision: 230009
URL: http://svn.freebsd.org/changeset/base/230009

Log:
  merge from head: support for building cross-arch versions of picobsd

Modified:
  stable/9/release/picobsd/build/Makefile.conf
  stable/9/release/picobsd/build/picobsd

Modified: stable/9/release/picobsd/build/Makefile.conf
==
--- stable/9/release/picobsd/build/Makefile.confThu Jan 12 08:03:26 
2012(r230008)
+++ stable/9/release/picobsd/build/Makefile.confThu Jan 12 11:08:21 
2012(r230009)
@@ -19,9 +19,9 @@ MODULES?=-DNO_MODULES # do not build the
 
 # These 3 variables determine where the kernel is built.
 # If config were smart enough, we could place the config
-# file in some other place than ${SRC}/sys/i386/conf, but
+# file in some other place than ${SRC}/sys/${TARGET_ARCH}/conf, but
 # at the moment (Oct.2001) this is not possible yet.
-CONF=${SRC}/sys/i386/conf
+CONF=${SRC}/sys/${TARGET_ARCH}/conf
 #CONF=${BUILDDIR}/conf # XXX does not work yet
 CONFFILE=PICOBSD-${name}
 
@@ -45,10 +45,10 @@ ${COMPILE}: ${CONF}/${CONFFILE}
(cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \
cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} depend )
 
-${CONF}/${CONFFILE}: PICOBSD
+${CONF}/${CONFFILE}: ${KERNCONF}
# -mkdir -p ${CONF} # XXX not needed yet.
cp ${.OODATE} ${.TARGET}
-   if [ -f PICOBSD.hints ] ; then cp PICOBSD.hints ${CONF}/PICOBSD.hints ; 
fi
+   [ -f PICOBSD.hints ] && cp PICOBSD.hints ${CONF}/
 
 # This part creates crunch1.conf and crunch.mk from crunch.conf
 ${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf

Modified: stable/9/release/picobsd/build/picobsd
==
--- stable/9/release/picobsd/build/picobsd  Thu Jan 12 08:03:26 2012
(r230008)
+++ stable/9/release/picobsd/build/picobsd  Thu Jan 12 11:08:21 2012
(r230009)
@@ -67,7 +67,7 @@
 # SRC points to your FreeBSD source tree.
 # l_usrtree points to the /usr subdir for the source tree.
 # Normally /usr or ${SRC}/../usr
-# l_objtree points to the obj tree. Normally ${l_usrtree}/obj-pico
+# l_objtree points to the obj tree. Normally ${l_usrtree}/obj-pico-${o_arch}
 # c_label is either bsdlabel or disklabel
 # PICO_TREE is where standard picobsd stuff resides.
 # Normally ${SRC}/release/picobsd
@@ -105,11 +105,6 @@ set_defaults() {   # no arguments
 EDITOR=${EDITOR:-vi}
 fd_size=${fd_size:-1440}
 
-o_use_loader="yes" # use /boot/loader
-   # You should not change it unless you are really short
-   # of space, and your kernel is small enough that the
-   # bootblocks manage to load it.
-
 o_all_in_mfs="yes" # put all files in mfs so you can boot
# and run the image via diskless boot.
 o_clean="" # set if you want to clean prev.builds.
@@ -121,6 +116,7 @@ set_defaults() {# no arguments
 o_no_devfs=# default is use devfs.
# You should only set it when building 4.x images
 o_do_modules=""# do not build modules
+o_arch=`uname -m`  # default to amd64 or i386 ...
 
 SRC="/usr/src" # default location for sources
 c_startdir=`pwd`   # directory where we start
@@ -165,20 +161,30 @@ set_defaults() {  # no arguments
 # and also to build a specific target
 create_includes_and_libraries2() { # opt_dir opt_target
 local no
-log "create_includes_and_libraries2() for ${SRC}"
+log "create_includes_and_libraries2() for ${SRC} $1"
 if [ ${OSVERSION} -ge 60 ] ; then
no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1"
 else
no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R"
 fi
-MAKEOBJDIRPREFIX=${l_objtree}
-export MAKEOBJDIRPREFIX
 ( cd ${SRC};
 # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld
 if [ -d "$1" ] ; then
cd $1 ; ${BINMAKE} ${o_par} $2  # specific target, e.g. ld-elf.so
 else
-   ${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries
+   MAKEOBJDIRPREFIX=${l_objtree}
+   export MAKEOBJDIRPREFIX
+   # export WITH_RESCUE=yes# build crunchide
+   # ${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries
+   (
+   # eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V BMAKEENV`
+   eval "export XMAKE=\"`cd ${SRC}; make -f Makefile -V XMAKE`\""
+   ${BINMAKE} ${o_par} _+_= $no toolchain
+   )
+eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
+   ${BINMAKE} ${o_par} _+_= $no _includes _libraries
+   [ ${o_arch} != `uname -m` ] && \
+   (cd ${l_objtree}; ln -s . ${o_arch}.${o_arch} || true )
 fi
 )
 }
@@ -241,16 +247,19 @@ set_type() {  # the_type the_site
 

Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx

2012-01-12 Thread John Baldwin
On Wednesday, January 11, 2012 4:17:14 pm Pedro F. Giffuni wrote:
> Author: pfg
> Date: Wed Jan 11 21:17:14 2012
> New Revision: 229981
> URL: http://svn.freebsd.org/changeset/base/229981
> 
> Log:
>   Replace GPL'd headers in the emu10kx snd driver code.
>   
>   This uses the emuxkireg.h already used in the emu10k1
>   snd driver. Special thanks go to Alexander Motin as
>   he was able to find some errors and reverse engineer
>   some wrong values in the emuxkireg header.
>   
>   The emu10kx driver is now free from the GPL.
>   
>   PR: 153901
>   Tested by:  mav, joel
>   Approved by:jhb (mentor)
>   MFC after:  2 weeks

Is the emu10kx driver a superset of em10k1 now (meaning does it support all
the em10k1 devices and should em10k1 be retired)?

Also, it seems we should definitely add 'snd_emu10kx' to GENERIC on x86
and possible 'snd_emu10k1'.

-- 
John Baldwin
___
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: r230007 - in head: etc etc/rc.d share/man/man8

2012-01-12 Thread John Baldwin
On Thursday, January 12, 2012 1:48:11 am Eygene Ryabinkin wrote:
> Author: rea (ports committer)
> Date: Thu Jan 12 06:48:11 2012
> New Revision: 230007
> URL: http://svn.freebsd.org/changeset/base/230007
> 
> Log:
>   rc.d: document 'quiet' prefix and fix dhclient/devd interaction
>   
>   Document the current semantics of the 'quiet' command prefix
>   in the rc.subr(8).
>   
>   Fix dhclient rc.d script: it should not call err() for
>   non-DHCP-enabled interface when it is called from devd, because the
>   latter just blindly calls 'service dhclient quietstart' on each "link
>   up" event.
>   
>   Since the 'quietstart' will silence the message "Cannot 'start' .
>   Set _enable to YES in /etc/rc.conf or use 'onestart' instead of
>   'start'." and running dhclient on the non-DHCP-enabled interface is
>   the same thing as running the service  without _enable set,
>   such modification is in sync with the current semantics of the 'quiet'
>   prefix.

Alternatively, devd could have invoked a wrapper script that only ran
/etc/rc.d/dhclient if dhcpif was true for the interface.  All other uses
of /etc/rc.d/dhclient in our system scripts are conditional on that check.

-- 
John Baldwin
___
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: r229986 - head/lib/libutil

2012-01-12 Thread Bruce Evans

On Thu, 12 Jan 2012, Kostik Belousov wrote:


On Wed, Jan 11, 2012 at 10:33:41PM +, Guy Helmer wrote:

Log:
  Fix namespace issues with prototype parameter names.
  Add missing prototype parameter names.

  Requested by bde.
...
Modified: head/lib/libutil/libutil.h
==
--- head/lib/libutil/libutil.h  Wed Jan 11 22:12:45 2012(r229985)
+++ head/lib/libutil/libutil.h  Wed Jan 11 22:33:41 2012(r229986)
@@ -93,7 +93,7 @@ struct termios;
 struct winsize;

 __BEGIN_DECLS
-char   *auth_getval(const char *name);
+char   *auth_getval(const char *_name);

The _[a-z].* names are still in the app namespace.

Only _[A-Z].* and __[a-z].* are reserved for the implementation.


No, _[a-z].* is reserved for the implementation in file scope mainly
for extern declarations).  For example, _exit is reserved for the
implementation, and _name is reserved for the implementation in exactly
the same contexts as _exit is.  This prevents the application #defining
_name as '_this is not a C identifier', which would break the above.
OTOH, _name is not reserved for the implementation in most other scopes,
so applications can do almost anything with it except #define it or
use it for a global or file-scope-static variable or function.

style(9) even gives the exact rule (it says "an underscore" instead
of "a single underscore", but uses only 1 in its example) to inhibit
excessive underscoring in prototypes.

Other details:
- prototypes start a new scope so names in them are not subject to
  the file scope rules
- similarly for struct scope.
- the scopes naturally prevent -Wshadow warnings.  E.g., names inside
  file-scope prototypes in implementation headers can't shadow
  application names, since the application names would have to be
  in file scope so they cannot have a single leading underscore.  I
  haven't thought about all cases for this.

Details from C99 (n869.txt):

%7.1.3  Reserved identifiers
% 
%  -- All  identifiers  that  begin  with  an  underscore are

% always reserved for use as identifiers with file  scope
% in both the ordinary and tag name spaces.
%...
%[#2]  No  other  identifiers  are  reserved.  If the program
%declares or defines an identifier in a context in  which  it
%is  reserved  (other than as allowed by 7.1.4), or defines a
%reserved  identifier  as  a  macro  name,  the  behavior  is
%undefined.

I think we only need the reservation of _[a-z]* (actually _[a-z0-9]*)
and the anti-definition rule for these to prove that the implementation's
use of _[a-z0-9]* in non-file scope cannot conflict with any application
use of _[a-z0-9]* any scope (can only be non-file scope).

See  for old examples of using the precise rules for avoiding
excessive underscoring, and complications in macros which require 2
underscores:
- struct __sbuf has 2 underscores since it's in file scope
- members in this struct and others have only 1 underscore since they
  are not in file scope
- __sgetc() has 2 underscores, since it is used in getc().  getc() is
  used in function scope where _sgetc is in the application namespace.
  Thus, the implementation cannot use _sgetc here.
- __sgetc() is implemented as an inline function.  The names of parameters
  and local variables in this must have at least 1 underscore so that
  the application cannot #define them, and 1 is enough and only 1 is
  used for the same reasons as for parameter names in prototypes.
- older implementations had an alternative definition of __sgetc() as
  a macro.  Here no underscores are needed (and none are used) for the
  parameter names, since macro parameters have their own namespace and
  so cannot be corrupted by application #define's of their names which
  are now possible.  These use the same single-undescored names for
  struct members.  When I started writing this, I misremembered a
  complication here.  I thought that some struct member names might
  need 2 underscores for such use.  But there is no problem -- (p)->_w
  is protected enough by the single underscore in _w, in the same way
  as for inline functioms.

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

2012-01-12 Thread Guy Helmer
Author: ghelmer
Date: Thu Jan 12 14:13:49 2012
New Revision: 230010
URL: http://svn.freebsd.org/changeset/base/230010

Log:
  pidfile_open() no longer uses fcntl() to set the close-on-exec flag.

Modified:
  head/lib/libutil/pidfile.3

Modified: head/lib/libutil/pidfile.3
==
--- head/lib/libutil/pidfile.3  Thu Jan 12 11:08:21 2012(r230009)
+++ head/lib/libutil/pidfile.3  Thu Jan 12 14:13:49 2012(r230010)
@@ -81,7 +81,7 @@ argument is
 file will be used.
 The
 .Fn pidfile_open
-function sets the FD_CLOEXEC close-on-exec flag on the open file descriptor.
+function sets the O_CLOEXEC close-on-exec flag when opening the pidfile.
 .Pp
 The
 .Fn pidfile_write
@@ -205,7 +205,6 @@ The
 function may also fail and set
 .Va errno
 for any errors specified for the
-.Xr fcntl 2 ,
 .Xr fstat 2 ,
 .Xr open 2 ,
 and
___
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: r230011 - head/lib/libutil

2012-01-12 Thread Guy Helmer
Author: ghelmer
Date: Thu Jan 12 14:40:25 2012
New Revision: 230011
URL: http://svn.freebsd.org/changeset/base/230011

Log:
  More prototype formatting fixes, struct member formatting fixes,
  and namespace fix for property_find() prototype.
  
  Provided by bde.

Modified:
  head/lib/libutil/libutil.h

Modified: head/lib/libutil/libutil.h
==
--- head/lib/libutil/libutil.h  Thu Jan 12 14:13:49 2012(r230010)
+++ head/lib/libutil/libutil.h  Thu Jan 12 14:40:25 2012(r230011)
@@ -69,8 +69,8 @@ typedef   __uid_t uid_t;
 /* for properties.c */
 typedef struct _property {
struct _property *next;
-   char *name;
-   char *value;
+   char*name;
+   char*value;
 } *properties;
 
 #ifdef _SYS_PARAM_H_
@@ -121,7 +121,7 @@ int openpty(int *_amaster, int *_aslave,
 void   properties_free(properties _list);
 char   *property_find(properties _list, const char *_name);
 properties
-   properties_read(int fd);
+   properties_read(int _fd);
 intrealhostname(char *_host, size_t _hsize, const struct in_addr *_ip);
 intrealhostname_sa(char *_host, size_t _hsize, struct sockaddr *_addr,
int _addrlen);
@@ -139,8 +139,10 @@ char   *fparseln(FILE *_fp, size_t *_len, 
 #endif
 
 #ifdef _PWD_H_
-intpw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct passwd 
*_old_pw);
-struct passwd *pw_dup(const struct passwd *_pw);
+intpw_copy(int _ffd, int _tfd, const struct passwd *_pw,
+   struct passwd *_old_pw);
+struct passwd
+   *pw_dup(const struct passwd *_pw);
 intpw_edit(int _notsetuid);
 intpw_equal(const struct passwd *_pw1, const struct passwd *_pw2);
 void   pw_fini(void);
@@ -149,21 +151,26 @@ char  *pw_make(const struct passwd *_pw);
 char   *pw_make_v7(const struct passwd *_pw);
 intpw_mkdb(const char *_user);
 intpw_lock(void);
-struct passwd *pw_scan(const char *_line, int _flags);
-const char *pw_tempname(void);
+struct passwd
+   *pw_scan(const char *_line, int _flags);
+const char
+   *pw_tempname(void);
 intpw_tmp(int _mfd);
 #endif
 
 #ifdef _GRP_H_
-intgr_copy(int __ffd, int _tfd, const struct group *_gr, struct group 
*_old_gr);
-struct group *gr_dup(const struct group *_gr);
+intgr_copy(int __ffd, int _tfd, const struct group *_gr,
+   struct group *_old_gr);
+struct group
+   *gr_dup(const struct group *_gr);
 intgr_equal(const struct group *_gr1, const struct group *_gr2);
 void   gr_fini(void);
 intgr_init(const char *_dir, const char *_master);
 intgr_lock(void);
 char   *gr_make(const struct group *_gr);
 intgr_mkdb(void);
-struct group *gr_scan(const char *_line);
+struct group
+   *gr_scan(const char *_line);
 intgr_tmp(int _mdf);
 #endif
 
___
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: r230012 - in stable/9: share/man/man9 sys/sys

2012-01-12 Thread John Baldwin
Author: jhb
Date: Thu Jan 12 14:43:52 2012
New Revision: 230012
URL: http://svn.freebsd.org/changeset/base/230012

Log:
  MFC 228715:
  Add a TASK_INITIALIZER() macro that can be used to statically
  initialize a task structure.

Modified:
  stable/9/share/man/man9/Makefile
  stable/9/share/man/man9/taskqueue.9
  stable/9/sys/sys/taskqueue.h
Directory Properties:
  stable/9/share/man/man9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/share/man/man9/Makefile
==
--- stable/9/share/man/man9/MakefileThu Jan 12 14:40:25 2012
(r230011)
+++ stable/9/share/man/man9/MakefileThu Jan 12 14:43:52 2012
(r230012)
@@ -1254,6 +1254,7 @@ MLINKS+=sysctl_ctx_init.9 sysctl_ctx_ent
sysctl_ctx_init.9 sysctl_ctx_free.9
 MLINKS+=SYSINIT.9 SYSUNINIT.9
 MLINKS+=taskqueue.9 TASK_INIT.9 \
+   taskqueue.9 TASK_INITIALIZER.9 \
taskqueue.9 taskqueue_cancel.9 \
taskqueue.9 taskqueue_create.9 \
taskqueue.9 taskqueue_create_fast.9 \

Modified: stable/9/share/man/man9/taskqueue.9
==
--- stable/9/share/man/man9/taskqueue.9 Thu Jan 12 14:40:25 2012
(r230011)
+++ stable/9/share/man/man9/taskqueue.9 Thu Jan 12 14:43:52 2012
(r230012)
@@ -80,6 +80,7 @@ struct timeout_task;
 .Ft void
 .Fn taskqueue_run "struct taskqueue *queue"
 .Fn TASK_INIT "struct task *task" "int priority" "task_fn_t func" "void 
*context"
+.Fn TASK_INITIALIZER "int priority" "task_fn_t func" "void *context"
 .Fn TASKQUEUE_DECLARE "name"
 .Fn TASKQUEUE_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" 
"init"
 .Fn TASKQUEUE_FAST_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void 
*context" "init"
@@ -243,9 +244,14 @@ A convenience macro,
 is provided to initialise a
 .Va task
 structure.
+The
+.Fn TASK_INITIALIZER
+macro generates an initializer for a task structure.
 A macro
 .Fn TIMEOUT_TASK_INIT "queue" "timeout_task" "priority" "func" "context"
-initializes the timeout_task structure.
+initializes the
+.Va timeout_task
+structure.
 The values of
 .Va priority ,
 .Va func ,

Modified: stable/9/sys/sys/taskqueue.h
==
--- stable/9/sys/sys/taskqueue.hThu Jan 12 14:40:25 2012
(r230011)
+++ stable/9/sys/sys/taskqueue.hThu Jan 12 14:43:52 2012
(r230012)
@@ -77,6 +77,12 @@ void taskqueue_block(struct taskqueue *q
 void   taskqueue_unblock(struct taskqueue *queue);
 inttaskqueue_member(struct taskqueue *queue, struct thread *td);
 
+#define TASK_INITIALIZER(priority, func, context)  \
+   { .ta_pending = 0,  \
+ .ta_priority = (priority),\
+ .ta_func = (func),\
+ .ta_context = (context) }
+
 /*
  * Functions for dedicated thread taskqueues
  */
___
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: r230013 - in stable/8: share/man/man9 sys/sys

2012-01-12 Thread John Baldwin
Author: jhb
Date: Thu Jan 12 14:44:14 2012
New Revision: 230013
URL: http://svn.freebsd.org/changeset/base/230013

Log:
  MFC 228715:
  Add a TASK_INITIALIZER() macro that can be used to statically
  initialize a task structure.

Modified:
  stable/8/share/man/man9/Makefile
  stable/8/share/man/man9/taskqueue.9
  stable/8/sys/sys/taskqueue.h
Directory Properties:
  stable/8/share/man/man9/   (props changed)
  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/share/man/man9/Makefile
==
--- stable/8/share/man/man9/MakefileThu Jan 12 14:43:52 2012
(r230012)
+++ stable/8/share/man/man9/MakefileThu Jan 12 14:44:14 2012
(r230013)
@@ -1218,6 +1218,7 @@ MLINKS+=sysctl_ctx_init.9 sysctl_ctx_ent
sysctl_ctx_init.9 sysctl_ctx_entry_find.9 \
sysctl_ctx_init.9 sysctl_ctx_free.9
 MLINKS+=taskqueue.9 TASK_INIT.9 \
+   taskqueue.9 TASK_INITIALIZER.9 \
taskqueue.9 taskqueue_create.9 \
taskqueue.9 TASKQUEUE_DECLARE.9 \
taskqueue.9 TASKQUEUE_DEFINE.9 \

Modified: stable/8/share/man/man9/taskqueue.9
==
--- stable/8/share/man/man9/taskqueue.9 Thu Jan 12 14:43:52 2012
(r230012)
+++ stable/8/share/man/man9/taskqueue.9 Thu Jan 12 14:44:14 2012
(r230013)
@@ -72,6 +72,7 @@ struct task {
 .Ft int
 .Fn taskqueue_member "struct taskqueue *queue" "struct thread *td"
 .Fn TASK_INIT "struct task *task" "int priority" "task_fn_t *func" "void 
*context"
+.Fn TASK_INITIALIZER "int priority" "task_fn_t func" "void *context"
 .Fn TASKQUEUE_DECLARE "name"
 .Fn TASKQUEUE_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" 
"init"
 .Fn TASKQUEUE_FAST_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void 
*context" "init"
@@ -193,6 +194,9 @@ A convenience macro,
 is provided to initialise a
 .Va task
 structure.
+The
+.Fn TASK_INITIALIZER
+macro generates an initializer for a task structure.
 The values of
 .Va priority ,
 .Va func ,

Modified: stable/8/sys/sys/taskqueue.h
==
--- stable/8/sys/sys/taskqueue.hThu Jan 12 14:43:52 2012
(r230012)
+++ stable/8/sys/sys/taskqueue.hThu Jan 12 14:44:14 2012
(r230013)
@@ -61,6 +61,12 @@ void taskqueue_block(struct taskqueue *q
 void   taskqueue_unblock(struct taskqueue *queue);
 inttaskqueue_member(struct taskqueue *queue, struct thread *td);
 
+#define TASK_INITIALIZER(priority, func, context)  \
+   { .ta_pending = 0,  \
+ .ta_priority = (priority),\
+ .ta_func = (func),\
+ .ta_context = (context) }
+
 /*
  * Functions for dedicated thread taskqueues
  */
___
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: r229997 - in head: share/examples/scsi_target sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/ctl

2012-01-12 Thread Kenneth D. Merry
On Thu, Jan 12, 2012 at 09:58:36 +0100, Hans Petter Selasky wrote:
> Hi,
> 
> ?
> 
> Does the cam target layer support attach/detach of logical units?

Yes, you can add and remove LUNs using ctladm.

> Can it be used with USB target mode?

If the USB driver supports the various CAM target mode CCBs, then it should
work.  CTL only talks SCSI, so it would be SCSI over USB.

The only driver I've tested it with is the isp(4) driver.

Ken

> -Original message-
> To:src-committ...@freebsd.org; svn-src-all@freebsd.org; 
> svn-src-h...@freebsd.org; 
> From:Kenneth D. Merry 
> Sent:Thu 12-01-2012 01:35
> Subject:svn commit: r229997 - in head: share/examples/scsi_target 
> sys/amd64/conf sys/cam/ctl sys/cam/scsi sys/conf sys/dev/ata sys/dev/ciss 
> sys/i386/conf sys/ia64/conf sys/sparc64/conf usr.bin usr.bin/ctls...
> Author: ken
> Date: Thu Jan 12 00:34:33 2012
> New Revision: 229997
> URL: http://svn.freebsd.org/changeset/base/229997
> 
> Log:
> ?Add the CAM Target Layer (CTL).
> ?
> ?CTL is a disk and processor device emulation subsystem originally written
> ?for Copan Systems under Linux starting in 2003. ?It has been shipping in
> ?Copan (now SGI) products since 2005.
> ?
> ?It was ported to FreeBSD in 2008, and thanks to an agreement between SGI
> ?(who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is
> ?available under a BSD-style license. ?The intent behind the agreement was
> ?that Spectra would work to get CTL into the FreeBSD tree.
> ?
> ?Some CTL features:
> ?
> ? - Disk and processor device emulation.
> ? - Tagged queueing
> ? - SCSI task attribute support (ordered, head of queue, simple tags)
> ? - SCSI implicit command ordering support. ?(e.g. if a read follows a mode
> ? ? select, the read will be blocked until the mode select completes.)
> ? - Full task management support (abort, LUN reset, target reset, etc.)
> ? - Support for multiple ports
> ? - Support for multiple simultaneous initiators
> ? - Support for multiple simultaneous backing stores
> ? - Persistent reservation support
> ? - Mode sense/select support
> ? - Error injection support
> ? - High Availability support (1)
> ? - All I/O handled in-kernel, no userland context switch overhead.
> ?
> ?(1) HA Support is just an API stub, and needs much more to be fully
> ? ? ?functional.
> ?
> ?ctl.c:The core of CTL. ?Command handlers and processing,
> ?character driver, and HA support are here.
> ?
> ?ctl.h:Basic function declarations and data structures.
> ?
> ?ctl_backend.c,
> ?ctl_backend.h:The basic CTL backend API.
> ?
> ?ctl_backend_block.c,
> ?ctl_backend_block.h:The block and file backend. ?This allows for using
> ?a disk or a file as the backing store for a LUN.
> ?Multiple threads are started to do I/O to the
> ?backing device, primarily because the VFS API
> ?requires that to get any concurrency.
> ?
> ?ctl_backend_ramdisk.c:A "fake" ramdisk backend. ?It only allocates a
> ?small amount of memory to act as a source and sink
> ?for reads and writes from an initiator. ?Therefore
> ?it cannot be used for any real data, but it can be
> ?used to test for throughput. ?It can also be used
> ?to test initiators' support for extremely large LUNs.
> ?
> ?ctl_cmd_table.c:This is a table with all 256 possible SCSI opcodes,
> ?and command handler functions defined for supported
> ?opcodes.
> ?
> ?ctl_debug.h:Debugging support.
> ?
> ?ctl_error.c,
> ?ctl_error.h:CTL-specific wrappers around the CAM sense building
> ?functions.
> ?
> ?ctl_frontend.c,
> ?ctl_frontend.h:These files define the basic CTL frontend port API.
> ?
> ?ctl_frontend_cam_sim.c:This is a CTL frontend port that is also a CAM SIM.
> ?This frontend allows for using CTL without any
> ?target-capable hardware. ?So any LUNs you create in
> ?CTL are visible in CAM via this port.
> ?
> ?ctl_frontend_internal.c,
> ?ctl_frontend_internal.h:
> ?This is a frontend port written for Copan to do
> ?some system-specific tasks that required sending
> ?commands into CTL from inside the kernel. ?This
> ?isn't entirely relevant to FreeBSD in general,
> ?but can perhaps be repurposed.
> ?
> ?ctl_ha.h:This is a stubbed-out High Availability API. ?Much
> ?more is needed for full HA support. ?See the
> ?comments in the header and the description of what
> ?is needed in the README.ctl.txt file for more
> ?details.
> ?
> ?ctl_io.h:This defines most of the core CTL I/O structures.
> ?union ctl_io is conceptually very similar to CAM's
> ?union ccb.
> ?
> ?ctl_ioctl.h:This defines all ioctls available through the CTL
> ?character device, and the data structures needed
> ?for those ioctls.
> ?
> ?ctl_mem_pool.c,
> ?ctl_mem_pool.h:Generic memory pool implementation used by the
> ?internal frontend.
> ?
> ?ctl_private.h:Private data structres (e.g. CTL softc) and
> ?function prototypes. ?This also includes the SCSI
> ?vendor and product names used by CTL.
> ?
> ?ctl_scsi_all.c,
> ?ctl_scsi_all.h:CTL wrappers around CAM sense printing functions.
> ?
> ?ctl_ser_table.c:Command serializat

svn commit: r230014 - stable/9/sys/cam/scsi

2012-01-12 Thread Alexander Motin
Author: mav
Date: Thu Jan 12 14:53:08 2012
New Revision: 230014
URL: http://svn.freebsd.org/changeset/base/230014

Log:
  MFC r228808, r228847, 229395:
  
  r228808, r228847:
  Make cd driver to handle Audio CDs, reporting their 2352 bytes sectors to
  GEOM and using READ CD command for reading data, same as acd driver does.
  Audio CDs identified by checking respective bit of the control field of
  the first track in TOC.
  
  229395:
  Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control
  sector size same as acd driver does. Together with r228808 and r228847 this
  allows existing multimedia/vlc to play Audio CDs via CAM cd driver.
  
  PR: ports/162190
  Sponsored by: iXsystems, Inc.

Modified:
  stable/9/sys/cam/scsi/scsi_all.h
  stable/9/sys/cam/scsi/scsi_cd.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/cam/scsi/scsi_all.h
==
--- stable/9/sys/cam/scsi/scsi_all.hThu Jan 12 14:44:14 2012
(r230013)
+++ stable/9/sys/cam/scsi/scsi_all.hThu Jan 12 14:53:08 2012
(r230014)
@@ -932,6 +932,7 @@ struct ata_pass_16 {
 #defineWRITE_120xAA
 #defineWRITE_VERIFY_12 0xAE
 #defineREAD_ELEMENT_STATUS 0xB8
+#defineREAD_CD 0xBE
 
 /* Maintenance In Service Action Codes */
 #defineREPORT_IDENTIFYING_INFRMATION   0x05

Modified: stable/9/sys/cam/scsi/scsi_cd.c
==
--- stable/9/sys/cam/scsi/scsi_cd.c Thu Jan 12 14:44:14 2012
(r230013)
+++ stable/9/sys/cam/scsi/scsi_cd.c Thu Jan 12 14:53:08 2012
(r230014)
@@ -1482,6 +1482,14 @@ cdstart(struct cam_periph *periph, union
/* dxfer_len */ bp->bio_bcount,
/* sense_len */ SSD_FULL_SIZE,
/* timeout */ 3);
+   /* Use READ CD command for audio tracks. */
+   if (softc->params.blksize == 2352) {
+   start_ccb->csio.cdb_io.cdb_bytes[0] = READ_CD;
+   start_ccb->csio.cdb_io.cdb_bytes[9] = 0xf8;
+   start_ccb->csio.cdb_io.cdb_bytes[10] = 0;
+   start_ccb->csio.cdb_io.cdb_bytes[11] = 0;
+   start_ccb->csio.cdb_len = 12;
+   }
start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO;
 

@@ -2676,6 +2684,16 @@ cdioctl(struct disk *dp, u_long cmd, voi
error = cdsetspeed(periph, CDR_MAX_SPEED, *(u_int32_t *)addr);
cam_periph_unlock(periph);
break;
+   case CDRIOCGETBLOCKSIZE:
+   *(int *)addr = softc->params.blksize;
+   break;
+   case CDRIOCSETBLOCKSIZE:
+   if (*(int *)addr <= 0) {
+   error = EINVAL;
+   break;
+   }
+   softc->disk->d_sectorsize = softc->params.blksize = *(int 
*)addr;
+   break;
case DVDIOCSENDKEY:
case DVDIOCREPORTKEY: {
struct dvd_authinfo *authinfo;
@@ -2879,6 +2897,13 @@ cdcheckmedia(struct cam_periph *periph)
 
softc->flags |= CD_FLAG_VALID_TOC;
 
+   /* If the first track is audio, correct sector size. */
+   if ((softc->toc.entries[0].control & 4) == 0) {
+   softc->disk->d_sectorsize = softc->params.blksize = 2352;
+   softc->disk->d_mediasize =
+   (off_t)softc->params.blksize * softc->params.disksize;
+   }
+
 bailout:
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r230007 - in head: etc etc/rc.d share/man/man8

2012-01-12 Thread Eygene Ryabinkin
Thu, Jan 12, 2012 at 07:48:28AM -0500, John Baldwin wrote:
> Alternatively, devd could have invoked a wrapper script that only
> ran /etc/rc.d/dhclient if dhcpif was true for the interface.  All
> other uses of /etc/rc.d/dhclient in our system scripts are
> conditional on that check.

True, and it was suggested by Doug Barton.  But why bother when
the 'quiet' keyword is reserved for such cases?
-- 
Eygene Ryabinkin,,,^..^,,,
[ Life's unfair - but root password helps!   | codelabs.ru ]
[ 82FE 06BC D497 C0DE 49EC  4FF0 16AF 9EAE 8152 ECFB | freebsd.org ]


pgpkWrGDZjCrH.pgp
Description: PGP signature


svn commit: r230015 - stable/8/sys/cam/scsi

2012-01-12 Thread Alexander Motin
Author: mav
Date: Thu Jan 12 15:02:51 2012
New Revision: 230015
URL: http://svn.freebsd.org/changeset/base/230015

Log:
  MFC r228808, r228847, 229395:
  
  r228808, r228847:
  Make cd driver to handle Audio CDs, reporting their 2352 bytes sectors to
  GEOM and using READ CD command for reading data, same as acd driver does.
  Audio CDs identified by checking respective bit of the control field of
  the first track in TOC.
  
  229395:
  Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control
  sector size same as acd driver does. Together with r228808 and r228847 this
  allows existing multimedia/vlc to play Audio CDs via CAM cd driver.
  
  PR:   ports/162190
  Sponsored by: iXsystems, Inc.

Modified:
  stable/8/sys/cam/scsi/scsi_all.h
  stable/8/sys/cam/scsi/scsi_cd.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/cam/scsi/scsi_all.h
==
--- stable/8/sys/cam/scsi/scsi_all.hThu Jan 12 14:53:08 2012
(r230014)
+++ stable/8/sys/cam/scsi/scsi_all.hThu Jan 12 15:02:51 2012
(r230015)
@@ -611,6 +611,7 @@ struct ata_pass_16 {
 #defineREAD_12 0xA8
 #defineWRITE_120xAA
 #defineREAD_ELEMENT_STATUS 0xB8
+#defineREAD_CD 0xBE
 
 /* Maintenance In Service Action Codes */
 #defineREPORT_IDENTIFYING_INFRMATION   0x05

Modified: stable/8/sys/cam/scsi/scsi_cd.c
==
--- stable/8/sys/cam/scsi/scsi_cd.c Thu Jan 12 14:53:08 2012
(r230014)
+++ stable/8/sys/cam/scsi/scsi_cd.c Thu Jan 12 15:02:51 2012
(r230015)
@@ -1475,6 +1475,14 @@ cdstart(struct cam_periph *periph, union
/* dxfer_len */ bp->bio_bcount,
/* sense_len */ SSD_FULL_SIZE,
/* timeout */ 3);
+   /* Use READ CD command for audio tracks. */
+   if (softc->params.blksize == 2352) {
+   start_ccb->csio.cdb_io.cdb_bytes[0] = READ_CD;
+   start_ccb->csio.cdb_io.cdb_bytes[9] = 0xf8;
+   start_ccb->csio.cdb_io.cdb_bytes[10] = 0;
+   start_ccb->csio.cdb_io.cdb_bytes[11] = 0;
+   start_ccb->csio.cdb_len = 12;
+   }
start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO;
 

@@ -2668,6 +2676,16 @@ cdioctl(struct disk *dp, u_long cmd, voi
error = cdsetspeed(periph, CDR_MAX_SPEED, *(u_int32_t *)addr);
cam_periph_unlock(periph);
break;
+   case CDRIOCGETBLOCKSIZE:
+   *(int *)addr = softc->params.blksize;
+   break;
+   case CDRIOCSETBLOCKSIZE:
+   if (*(int *)addr <= 0) {
+   error = EINVAL;
+   break;
+   }
+   softc->disk->d_sectorsize = softc->params.blksize = *(int 
*)addr;
+   break;
case DVDIOCSENDKEY:
case DVDIOCREPORTKEY: {
struct dvd_authinfo *authinfo;
@@ -2871,6 +2889,13 @@ cdcheckmedia(struct cam_periph *periph)
 
softc->flags |= CD_FLAG_VALID_TOC;
 
+   /* If the first track is audio, correct sector size. */
+   if ((softc->toc.entries[0].control & 4) == 0) {
+   softc->disk->d_sectorsize = softc->params.blksize = 2352;
+   softc->disk->d_mediasize =
+   (off_t)softc->params.blksize * softc->params.disksize;
+   }
+
 bailout:
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx

2012-01-12 Thread Pedro Giffuni
--- Gio 12/1/12, Joel Dahl  ha scritto:
...
> On 11-01-2012 21:17, Pedro F. Giffuni
> wrote:
> > Author: pfg
> > Date: Wed Jan 11 21:17:14 2012
> > New Revision: 229981
> > URL: http://svn.freebsd.org/changeset/base/229981
> > 
> > Log:
> >   Replace GPL'd headers in the emu10kx snd driver code.
> >   
> >   This uses the emuxkireg.h already used in the emu10k1
> >   snd driver. Special thanks go to Alexander Motin as
> >   he was able to find some errors and reverse engineer
> >   some wrong values in the emuxkireg header.
> >   
> >   The emu10kx driver is now free from the GPL.
> 
> Thank you for taking care of this.
> 

Welcome ... two more cards to go!

I could use some help with the CS46XX and the header from
OSS is nearly identical, in case someone is interested. ;)

cheers,

Pedro.

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

2012-01-12 Thread Guy Helmer
Author: ghelmer
Date: Thu Jan 12 15:45:08 2012
New Revision: 230016
URL: http://svn.freebsd.org/changeset/base/230016

Log:
  Fix disorder in MAN and MLINKS lists.
  
  Requested by bde.

Modified:
  head/lib/libutil/Makefile

Modified: head/lib/libutil/Makefile
==
--- head/lib/libutil/Makefile   Thu Jan 12 15:02:51 2012(r230015)
+++ head/lib/libutil/Makefile   Thu Jan 12 15:45:08 2012(r230016)
@@ -25,48 +25,48 @@ CFLAGS+= -DINET6
 
 CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libc/gen/
 
-MAN+=  kld.3 login_auth.3 login_tty.3 pty.3 \
-   login_cap.3 login_class.3 login_times.3 login_ok.3 \
-   _secure_path.3 uucplock.3 property.3 auth.3 realhostname.3 \
-   realhostname_sa.3 trimdomain.3 fparseln.3 humanize_number.3 \
-   pidfile.3 flopen.3 expand_number.3 hexdump.3 \
-   kinfo_getfile.3 kinfo_getallproc.3 kinfo_getproc.3 \
-   kinfo_getvmmap.3 quotafile.3
-MAN+=  login.conf.5 auth.conf.5
-MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3
-MLINKS+= property.3 properties_read.3  property.3 properties_free.3
-MLINKS+= property.3 property_find.3
+MAN+=  auth.3 expand_number.3 flopen.3 fparseln.3 hexdump.3 \
+   humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \
+   kinfo_getproc.3 kinfo_getvmmap.3 kld.3 login_auth.3 login_cap.3 \
+   login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \
+   property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \
+   _secure_path.3 trimdomain.3 uucplock.3
+MAN+=  auth.conf.5 login.conf.5
 MLINKS+= auth.3 auth_getval.3
-MLINKS+= pty.3 openpty.3  pty.3 forkpty.3
-MLINKS+=login_cap.3 login_getclassbyname.3 login_cap.3 login_close.3 \
-   login_cap.3 login_getclass.3 login_cap.3 login_getuserclass.3 \
-   login_cap.3 login_getcapstr.3 login_cap.3 login_getcaplist.3 \
-   login_cap.3 login_getstyle.3 login_cap.3 login_getcaptime.3 \
-   login_cap.3 login_getcapnum.3 login_cap.3 login_getcapsize.3 \
-   login_cap.3 login_getcapbool.3 login_cap.3 login_getpath.3 \
-   login_cap.3 login_getpwclass.3 login_cap.3 login_setcryptfmt.3
-MLINKS+=login_class.3 setusercontext.3 login_class.3 setclasscontext.3 \
-   login_class.3 setclassenvironment.3 login_class.3 setclassresources.3
-MLINKS+=login_times.3 parse_lt.3 login_times.3 in_ltm.3 \
-   login_times.3 in_lt.3 login_times.3 in_ltms.3 \
-   login_times.3 in_lts.3
-MLINKS+=login_ok.3 auth_ttyok.3 login_ok.3 auth_hostok.3 \
-   login_ok.3 auth_timeok.3
-MLINKS+=login_auth.3 auth_checknologin.3 login_auth.3 auth_cat.3
-MLINKS+=uucplock.3 uu_lock.3 uucplock.3 uu_lock_txfr.3 \
-   uucplock.3 uu_unlock.3 uucplock.3 uu_lockerr.3
-MLINKS+=pidfile.3 pidfile_open.3 \
-   pidfile.3 pidfile_write.3 \
-   pidfile.3 pidfile_close.3 \
+MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3
+MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3
+MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \
+   login_cap.3 login_getcaplist.3 login_cap.3 login_getcapnum.3 \
+   login_cap.3 login_getcapsize.3 login_cap.3 login_getcapstr.3 \
+   login_cap.3 login_getcaptime.3 login_cap.3 login_getclass.3 \
+   login_cap.3 login_getclassbyname.3 login_cap.3 login_getpath.3 \
+   login_cap.3 login_getpwclass.3 login_cap.3 login_getstyle.3 \
+   login_cap.3 login_getuserclass.3 login_cap.3 login_setcryptfmt.3
+MLINKS+=login_class.3 setclasscontext.3 login_class.3 setclassenvironment.3 \
+   login_class.3 setclassresources.3 login_class.3 setusercontext.3
+MLINKS+=login_ok.3 auth_hostok.3 login_ok.3 auth_timeok.3 \
+   login_ok.3 auth_ttyok.3
+MLINKS+=login_times.3 in_lt.3 login_times.3 in_ltm.3 \
+   login_times.3 in_ltms.3 \
+   login_times.3 in_lts.3 \
+   login_times.3 parse_lt.3
+MLINKS+=pidfile.3 pidfile_close.3 \
+   pidfile.3 pidfile_fileno.3 \
+   pidfile.3 pidfile_open.3 \
pidfile.3 pidfile_remove.3 \
-   pidfile.3 pidfile_fileno.3
-MLINKS+=quotafile.3 quota_open.3 \
+   pidfile.3 pidfile_write.3
+MLINKS+= property.3 property_find.3  property.3 properties_free.3
+MLINKS+= property.3 properties_read.3
+MLINKS+= pty.3 forkpty.3  pty.3 openpty.3
+MLINKS+=quotafile.3 quota_close.3 \
quotafile.3 quota_fsname.3 \
+   quotafile.3 quota_open.3 \
quotafile.3 quota_qfname.3 \
-   quotafile.3 quota_statfs.3 \
quotafile.3 quota_read.3 \
+   quotafile.3 quota_statfs.3 \
quotafile.3 quota_write_limits.3 \
-   quotafile.3 quota_write_usage.3 \
-   quotafile.3 quota_close.3
+   quotafile.3 quota_write_usage.3
+MLINKS+=uucplock.3 uu_lock.3 uucplock.3 uu_lock_txfr.3 \
+   uucplock.3 uu_lockerr.3 uucplock.3 uu_unlock.3 
 
 .include 
___
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: r230017 - stable/9/share/examples/scsi_target

2012-01-12 Thread Alexander Motin
Author: mav
Date: Thu Jan 12 15:49:06 2012
New Revision: 230017
URL: http://svn.freebsd.org/changeset/base/230017

Log:
  MFC r228462:
   - Fix different variable types use in different files after r121184,
causing problems on amd64.
   - s/%lud/%lu/.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/9/share/examples/scsi_target/scsi_cmds.c
Directory Properties:
  stable/9/share/examples/   (props changed)

Modified: stable/9/share/examples/scsi_target/scsi_cmds.c
==
--- stable/9/share/examples/scsi_target/scsi_cmds.c Thu Jan 12 15:45:08 
2012(r230016)
+++ stable/9/share/examples/scsi_target/scsi_cmds.c Thu Jan 12 15:49:06 
2012(r230017)
@@ -103,8 +103,8 @@ static struct targ_cdb_handlers cdb_hand
 static struct scsi_inquiry_data inq_data;
 static struct initiator_state istates[MAX_INITIATORS];
 extern int debug;
-extern uint64_tvolume_size;
-extern size_t  sector_size;
+extern off_t   volume_size;
+extern u_int   sector_size;
 extern size_t  buf_size;
 
 cam_status
@@ -609,7 +609,7 @@ start_io(struct ccb_accept_tio *atio, st
if (dir == CAM_DIR_IN) {
if (notaio) {
if (debug)
-   warnx("read sync %lud @ block " OFF_FMT,
+   warnx("read sync %lu @ block " OFF_FMT,
(unsigned long)
(ctio->dxfer_len / sector_size),
c_descr->offset / sector_size);
@@ -625,7 +625,7 @@ start_io(struct ccb_accept_tio *atio, st
}
} else {
if (debug)
-   warnx("read async %lud @ block " OFF_FMT,
+   warnx("read async %lu @ block " OFF_FMT,
(unsigned long)
(ctio->dxfer_len / sector_size),
c_descr->offset / sector_size);
@@ -725,7 +725,7 @@ tcmd_rdwr_done(struct ccb_accept_tio *at
a_descr->targ_req += ctio->dxfer_len;
if (notaio) {
if (debug)
-   warnx("write sync %lud @ block "
+   warnx("write sync %lu @ block "
OFF_FMT, (unsigned long)
(ctio->dxfer_len / sector_size),
c_descr->offset / sector_size);
@@ -742,7 +742,7 @@ tcmd_rdwr_done(struct ccb_accept_tio *at
tcmd_rdwr_done(atio, ctio, AIO_DONE);
} else {
if (debug)
-   warnx("write async %lud @ block "
+   warnx("write async %lu @ block "
OFF_FMT, (unsigned long)
(ctio->dxfer_len / sector_size),
c_descr->offset / sector_size);
___
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: r230018 - stable/8/share/examples/scsi_target

2012-01-12 Thread Alexander Motin
Author: mav
Date: Thu Jan 12 15:50:21 2012
New Revision: 230018
URL: http://svn.freebsd.org/changeset/base/230018

Log:
  MFC r228462:
   - Fix different variable types use in different files after r121184,
causing problems on amd64.
   - s/%lud/%lu/.
  
  Sponsored by:   iXsystems, Inc.

Modified:
  stable/8/share/examples/scsi_target/scsi_cmds.c
Directory Properties:
  stable/8/share/examples/   (props changed)
  stable/8/share/examples/cvsup/   (props changed)

Modified: stable/8/share/examples/scsi_target/scsi_cmds.c
==
--- stable/8/share/examples/scsi_target/scsi_cmds.c Thu Jan 12 15:49:06 
2012(r230017)
+++ stable/8/share/examples/scsi_target/scsi_cmds.c Thu Jan 12 15:50:21 
2012(r230018)
@@ -103,8 +103,8 @@ static struct targ_cdb_handlers cdb_hand
 static struct scsi_inquiry_data inq_data;
 static struct initiator_state istates[MAX_INITIATORS];
 extern int debug;
-extern uint64_tvolume_size;
-extern size_t  sector_size;
+extern off_t   volume_size;
+extern u_int   sector_size;
 extern size_t  buf_size;
 
 cam_status
@@ -609,7 +609,7 @@ start_io(struct ccb_accept_tio *atio, st
if (dir == CAM_DIR_IN) {
if (notaio) {
if (debug)
-   warnx("read sync %lud @ block " OFF_FMT,
+   warnx("read sync %lu @ block " OFF_FMT,
(unsigned long)
(ctio->dxfer_len / sector_size),
c_descr->offset / sector_size);
@@ -625,7 +625,7 @@ start_io(struct ccb_accept_tio *atio, st
}
} else {
if (debug)
-   warnx("read async %lud @ block " OFF_FMT,
+   warnx("read async %lu @ block " OFF_FMT,
(unsigned long)
(ctio->dxfer_len / sector_size),
c_descr->offset / sector_size);
@@ -725,7 +725,7 @@ tcmd_rdwr_done(struct ccb_accept_tio *at
a_descr->targ_req += ctio->dxfer_len;
if (notaio) {
if (debug)
-   warnx("write sync %lud @ block "
+   warnx("write sync %lu @ block "
OFF_FMT, (unsigned long)
(ctio->dxfer_len / sector_size),
c_descr->offset / sector_size);
@@ -742,7 +742,7 @@ tcmd_rdwr_done(struct ccb_accept_tio *at
tcmd_rdwr_done(atio, ctio, AIO_DONE);
} else {
if (debug)
-   warnx("write async %lud @ block "
+   warnx("write async %lu @ block "
OFF_FMT, (unsigned long)
(ctio->dxfer_len / sector_size),
c_descr->offset / sector_size);
___
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: r230019 - stable/9/sys/dev/isp

2012-01-12 Thread Alexander Motin
Author: mav
Date: Thu Jan 12 15:56:17 2012
New Revision: 230019
URL: http://svn.freebsd.org/changeset/base/230019

Log:
  MFC r228461:
  Fix few bugs in isp(4) target mode support:
   - in destroy_lun_state() assert hold == 1 instead of 0, as it should
  receive hold taken by the create_lun_state() or get_lun_statep() before;
   - fix hold count leak inside rls_lun_statep() that also fired above assert;
   - in destroy_lun_state() use SIM bus number instead of SIM path id for
  ISP_GET_PC_ADDR(), as it was before r196008;
   - make isp_disable_lun() to set status in CCB;
   - make isp_target_mark_aborted() set status into the proper CCB.
  
  Reviewed by:  mjacob
  Sponsored by: iXsystems, inc.

Modified:
  stable/9/sys/dev/isp/isp_freebsd.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/dev/isp/isp_freebsd.c
==
--- stable/9/sys/dev/isp/isp_freebsd.c  Thu Jan 12 15:50:21 2012
(r230018)
+++ stable/9/sys/dev/isp/isp_freebsd.c  Thu Jan 12 15:56:17 2012
(r230019)
@@ -1079,8 +1079,9 @@ static ISP_INLINE void
 destroy_lun_state(ispsoftc_t *isp, tstate_t *tptr)
 {
struct tslist *lhp;
-   KASSERT((tptr->hold == 0), ("tptr still held"));
-   ISP_GET_PC_ADDR(isp, xpt_path_path_id(tptr->owner), 
lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp);
+   KASSERT((tptr->hold != 0), ("tptr is not held"));
+   KASSERT((tptr->hold == 1), ("tptr still held (%d)", tptr->hold));
+   ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), 
lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp);
SLIST_REMOVE(lhp, tptr, tstate, next);
xpt_free_path(tptr->owner);
free(tptr, M_DEVBUF);
@@ -1308,12 +1309,13 @@ isp_disable_lun(ispsoftc_t *isp, union c
mtx_sleep(isp, &isp->isp_lock, PRIBIO, "want_isp_disable_lun", 
0);
}
isp->isp_osinfo.tmbusy = 1;
+   status = CAM_REQ_INPROG;
 
/*
 * Find the state pointer.
 */
if ((tptr = get_lun_statep(isp, bus, lun)) == NULL) {
-   ccb->ccb_h.status = CAM_PATH_INVALID;
+   status = CAM_PATH_INVALID;
goto done;
}
 
@@ -1333,13 +1335,13 @@ isp_disable_lun(ispsoftc_t *isp, union c
}
 
isp->isp_osinfo.rptr = &status;
-   status = CAM_REQ_INPROG;
if (isp_lun_cmd(isp, RQSTYPE_ENABLE_LUN, bus, lun, 0, 0)) {
status = CAM_RESRC_UNAVAIL;
} else {
mtx_sleep(ccb, &isp->isp_lock, PRIBIO, "isp_disable_lun", 0);
}
 done:
+   ccb->ccb_h.status = status;
if (status == CAM_REQ_CMP) {
xpt_print(ccb->ccb_h.path, "now disabled for target mode\n");
}
@@ -2941,23 +2943,25 @@ isp_target_mark_aborted(ispsoftc_t *isp,
 {
tstate_t *tptr;
atio_private_data_t *atp;
+   union ccb *accb = ccb->cab.abort_ccb;
 
-   tptr = get_lun_statep(isp, XS_CHANNEL(ccb), XS_LUN(ccb));
+   tptr = get_lun_statep(isp, XS_CHANNEL(accb), XS_LUN(accb));
if (tptr == NULL) {
-   tptr = get_lun_statep(isp, XS_CHANNEL(ccb), CAM_LUN_WILDCARD);
+   tptr = get_lun_statep(isp, XS_CHANNEL(accb), CAM_LUN_WILDCARD);
if (tptr == NULL) {
ccb->ccb_h.status = CAM_REQ_INVALID;
return;
}
}
 
-   atp = isp_get_atpd(isp, tptr, ccb->atio.tag_id);
+   atp = isp_get_atpd(isp, tptr, accb->atio.tag_id);
if (atp == NULL) {
ccb->ccb_h.status = CAM_REQ_INVALID;
-   return;
+   } else {
+   atp->dead = 1;
+   ccb->ccb_h.status = CAM_REQ_CMP;
}
-   atp->dead = 1;
-   ccb->ccb_h.status = CAM_REQ_CMP;
+   rls_lun_statep(isp, tptr);
 }
 
 static void
@@ -4511,7 +4515,7 @@ isp_action(struct cam_sim *sim, union cc
switch (accb->ccb_h.func_code) {
 #ifdef ISP_TARGET_MODE
case XPT_ACCEPT_TARGET_IO:
-   isp_target_mark_aborted(isp, accb);
+   isp_target_mark_aborted(isp, ccb);
break;
 #endif
case XPT_SCSI_IO:
___
svn-src-all@freebsd.org mailing list
h

svn commit: r230020 - stable/8/sys/dev/isp

2012-01-12 Thread Alexander Motin
Author: mav
Date: Thu Jan 12 15:57:03 2012
New Revision: 230020
URL: http://svn.freebsd.org/changeset/base/230020

Log:
  MFC r228461:
  Fix few bugs in isp(4) target mode support:
   - in destroy_lun_state() assert hold == 1 instead of 0, as it should
  receive hold taken by the create_lun_state() or get_lun_statep() before;
   - fix hold count leak inside rls_lun_statep() that also fired above assert;
   - in destroy_lun_state() use SIM bus number instead of SIM path id for
  ISP_GET_PC_ADDR(), as it was before r196008;
   - make isp_disable_lun() to set status in CCB;
   - make isp_target_mark_aborted() set status into the proper CCB.
  
  Reviewed by:  mjacob
  Sponsored by: iXsystems, inc.

Modified:
  stable/8/sys/dev/isp/isp_freebsd.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/dev/isp/isp_freebsd.c
==
--- stable/8/sys/dev/isp/isp_freebsd.c  Thu Jan 12 15:56:17 2012
(r230019)
+++ stable/8/sys/dev/isp/isp_freebsd.c  Thu Jan 12 15:57:03 2012
(r230020)
@@ -1037,8 +1037,9 @@ static ISP_INLINE void
 destroy_lun_state(ispsoftc_t *isp, tstate_t *tptr)
 {
struct tslist *lhp;
-   KASSERT((tptr->hold == 0), ("tptr still held"));
-   ISP_GET_PC_ADDR(isp, xpt_path_path_id(tptr->owner), 
lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp);
+   KASSERT((tptr->hold != 0), ("tptr is not held"));
+   KASSERT((tptr->hold == 1), ("tptr still held (%d)", tptr->hold));
+   ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), 
lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp);
SLIST_REMOVE(lhp, tptr, tstate, next);
xpt_free_path(tptr->owner);
free(tptr, M_DEVBUF);
@@ -1266,12 +1267,13 @@ isp_disable_lun(ispsoftc_t *isp, union c
mtx_sleep(isp, &isp->isp_lock, PRIBIO, "want_isp_disable_lun", 
0);
}
isp->isp_osinfo.tmbusy = 1;
+   status = CAM_REQ_INPROG;
 
/*
 * Find the state pointer.
 */
if ((tptr = get_lun_statep(isp, bus, lun)) == NULL) {
-   ccb->ccb_h.status = CAM_PATH_INVALID;
+   status = CAM_PATH_INVALID;
goto done;
}
 
@@ -1291,13 +1293,13 @@ isp_disable_lun(ispsoftc_t *isp, union c
}
 
isp->isp_osinfo.rptr = &status;
-   status = CAM_REQ_INPROG;
if (isp_lun_cmd(isp, RQSTYPE_ENABLE_LUN, bus, lun, 0, 0)) {
status = CAM_RESRC_UNAVAIL;
} else {
mtx_sleep(ccb, &isp->isp_lock, PRIBIO, "isp_disable_lun", 0);
}
 done:
+   ccb->ccb_h.status = status;
if (status == CAM_REQ_CMP) {
xpt_print(ccb->ccb_h.path, "now disabled for target mode\n");
}
@@ -2899,23 +2901,25 @@ isp_target_mark_aborted(ispsoftc_t *isp,
 {
tstate_t *tptr;
atio_private_data_t *atp;
+   union ccb *accb = ccb->cab.abort_ccb;
 
-   tptr = get_lun_statep(isp, XS_CHANNEL(ccb), XS_LUN(ccb));
+   tptr = get_lun_statep(isp, XS_CHANNEL(accb), XS_LUN(accb));
if (tptr == NULL) {
-   tptr = get_lun_statep(isp, XS_CHANNEL(ccb), CAM_LUN_WILDCARD);
+   tptr = get_lun_statep(isp, XS_CHANNEL(accb), CAM_LUN_WILDCARD);
if (tptr == NULL) {
ccb->ccb_h.status = CAM_REQ_INVALID;
return;
}
}
 
-   atp = isp_get_atpd(isp, tptr, ccb->atio.tag_id);
+   atp = isp_get_atpd(isp, tptr, accb->atio.tag_id);
if (atp == NULL) {
ccb->ccb_h.status = CAM_REQ_INVALID;
-   return;
+   } else {
+   atp->dead = 1;
+   ccb->ccb_h.status = CAM_REQ_CMP;
}
-   atp->dead = 1;
-   ccb->ccb_h.status = CAM_REQ_CMP;
+   rls_lun_statep(isp, tptr);
 }
 
 static void
@@ -4403,7 +4407,7 @@ isp_action(struct cam_sim *sim, union cc
switch (accb->ccb_h.func_code) {
 #ifdef ISP_TARGET_MODE
case XPT_ACCEPT_TARGET_IO:
-   isp_target_mark_aborted(isp, accb);
+   isp_target_mark_aborted(isp, ccb);
break;
 #endif
case XPT_SCSI_IO:
___
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: r230021 - head/contrib/compiler-rt/lib

2012-01-12 Thread Ed Schouten
Author: ed
Date: Thu Jan 12 16:51:56 2012
New Revision: 230021
URL: http://svn.freebsd.org/changeset/base/230021

Log:
  Add a workaround to prevent endless recursion in compiler-rt.
  
  SPARC and MIPS CPUs don't have special instructions to count
  leading/trailing zeroes. The compiler-rt library provides fallback
  rountines for these. The 64-bit routines, __clzdi2 and __ctzdi2, are
  implemented as simple wrappers around the compiler built-in
  __builtin_clz(), assuming these will expand to either 32-bit
  CPU instructions or calls to __clzsi2 and __ctzsi2.
  
  Unfortunately, our GCC 4.2 probably thinks that because the operand is
  stored in a 64-bit register, it might just be a better idea to invoke
  its 64-bit equivalent, simply resulting into endless recursion. Fix this
  by defining __builtin_clz and __builtin_ctz to __clzsi2 and __ctzsi2
  explicitly.

Modified:
  head/contrib/compiler-rt/lib/int_lib.h

Modified: head/contrib/compiler-rt/lib/int_lib.h
==
--- head/contrib/compiler-rt/lib/int_lib.h  Thu Jan 12 15:57:03 2012
(r230020)
+++ head/contrib/compiler-rt/lib/int_lib.h  Thu Jan 12 16:51:56 2012
(r230021)
@@ -43,4 +43,24 @@
 /* Include internal utility function declarations. */
 #include "int_util.h"
 
+/*
+ * Workaround for LLVM bug 11663.  Prevent endless recursion in
+ * __c?zdi2(), where calls to __builtin_c?z() are expanded to
+ * __c?zdi2() instead of __c?zsi2().
+ *
+ * Instead of placing this workaround in c?zdi2.c, put it in this
+ * global header to prevent other C files from making the detour
+ * through __c?zdi2() as well.
+ *
+ * This problem has only been observed on FreeBSD for sparc64 and
+ * mips64 with GCC 4.2.1.
+ */
+#if defined(__FreeBSD__) && (defined(__sparc64__) || \
+defined(__mips_n64) || defined(__mips_o64))
+si_int __clzsi2(si_int);
+si_int __ctzsi2(si_int);
+#define__builtin_clz   __clzsi2
+#define__builtin_ctz   __ctzsi2
+#endif
+
 #endif /* INT_LIB_H */
___
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: r213765 - head/sys/dev/aic7xxx/aicasm

2012-01-12 Thread Dimitry Andric

On 2010-10-14 21:23, Jung-uk Kim wrote:

On Thursday 14 October 2010 03:11 pm, Dmitry Morozovsky wrote:

On Thu, 14 Oct 2010, Jung-uk Kim wrote:

...

cc -O2 -pipe -nostdinc -I/usr/include -I.
-I/FreeBSD/src.current.svn/sys/dev/aic7xxx/aicasm -std=gnu99
-Wsystem-headers -Werror -Wall -Wno-format-y2k -W
-Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch
-Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c
aicasm_scan.c
cc1: warnings being treated as errors
/FreeBSD/src.current.svn/sys/dev/aic7xxx/aicasm/aicasm_scan.l:840:
warning: function declaration isn't a prototype

...

Hmm...  That means "make buildkernel" did not pick up newly built lex.
That's bad. :-(


I know it's very, very late to respond to this, but I just had an email
conversation with Peter Grehan, where he ran into this problem when
attempting to build -CURRENT on 8.1-RELEASE.  This doesn't have the
followup r214779 yet, where the needed update to lex is merged.

Of course, I also know that building -CURRENT on 8.1-RELEASE is
officially not supported, but if there is a relatively simple fix to
make it work, it should not be a problem to apply, right? :)

The root of the problem is that, even if buildworld is completed, the
"stage 2.3: build tools" (kernel-specific) part of Makefile.inc1 uses
lex and yacc from /usr/bin, *not* the ones built under ${WORLDTMP}
(usually in /usr/obj/usr/src/tmp/legacy/usr/bin).

Therefore, I propose to set PATH to ${BPATH}:${PATH} in this stage, so
the "good" versions of lex and yacc are used.  As per attached diff.

(NOTE: even with this diff applied, doing 'make buildkernel' without
first doing 'make buildworld' or 'make kernel-toolchain' will not work,
because there will be no copy of lex and yacc in /usr/obj.)
Index: Makefile.inc1
===
--- Makefile.inc1	(revision 229979)
+++ Makefile.inc1	(working copy)
@@ -832,6 +832,7 @@
 	@echo ">>> stage 2.3: build tools"
 	@echo "--"
 	cd ${KRNLOBJDIR}/${_kernel}; \
+	PATH=${BPATH}:${PATH} \
 	MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
 	${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \
 	-f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
@@ -839,6 +840,7 @@
 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
 .for target in obj depend all
 	cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
+	PATH=${BPATH}:${PATH} \
 	MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
 	${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target}
 .endfor
___
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: r230023 - head/sys/dev/e1000

2012-01-12 Thread Luigi Rizzo
Author: luigi
Date: Thu Jan 12 17:28:00 2012
New Revision: 230023
URL: http://svn.freebsd.org/changeset/base/230023

Log:
  fix the initialization of the rings when netmap is used,
  to adapt it to the changes in  228387 .
  Now the code is similar to the one used in other drivers.
  Not applicable to stable/9 and stable/8

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Thu Jan 12 17:06:46 2012(r230022)
+++ head/sys/dev/e1000/if_em.c  Thu Jan 12 17:28:00 2012(r230023)
@@ -4019,6 +4019,10 @@ em_setup_receive_ring(struct rx_ring *rx
struct em_buffer*rxbuf;
bus_dma_segment_t   seg[1];
int rsize, nsegs, error;
+#ifdef DEV_NETMAP
+   struct netmap_adapter *na = NA(adapter->ifp);
+   struct netmap_slot *slot;
+#endif
 
 
/* Clear the ring contents */
@@ -4026,6 +4030,9 @@ em_setup_receive_ring(struct rx_ring *rx
rsize = roundup2(adapter->num_rx_desc *
sizeof(struct e1000_rx_desc), EM_DBA_ALIGN);
bzero((void *)rxr->rx_base, rsize);
+#ifdef DEV_NETMAP
+   slot = netmap_reset(na, NR_RX, 0, 0);
+#endif
 
/*
** Free current RX buffer structs and their mbufs
@@ -4043,6 +4050,22 @@ em_setup_receive_ring(struct rx_ring *rx
/* Now replenish the mbufs */
 for (int j = 0; j != adapter->num_rx_desc; ++j) {
rxbuf = &rxr->rx_buffers[j];
+#ifdef DEV_NETMAP
+   if (slot) {
+   /* slot si is mapped to the j-th NIC-ring entry */
+   int si = j + na->rx_rings[0].nkr_hwofs;
+   uint64_t paddr;
+   void *addr;
+
+   if (si > na->num_rx_desc)
+   si -= na->num_rx_desc;
+   addr = PNMB(slot + si, &paddr);
+   netmap_load_map(rxr->rxtag, rxbuf->map, addr);
+   /* Update descriptor */
+   rxr->rx_base[j].buffer_addr = htole64(paddr);
+   continue;
+   }
+#endif /* DEV_NETMAP */
rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA,
M_PKTHDR, adapter->rx_mbuf_sz);
if (rxbuf->m_head == NULL) {
@@ -4073,63 +4096,6 @@ em_setup_receive_ring(struct rx_ring *rx
bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
-#ifdef DEV_NETMAP
-{
-   /*
-* This driver is slightly different from the standard:
-* it refills the rings in blocks of 8, so the while()
-* above completes any leftover work. Also, after if_init()
-* the ring starts at rxr->next_to_check instead of 0.
-*
-* Currently: we leave the mbufs allocated even in netmap
-* mode, and simply make the NIC ring point to the
-* correct buffer (netmap_buf or mbuf) depending on
-* the mode. To avoid mbuf leaks, when in netmap mode we
-* must make sure that next_to_refresh == next_to_check - 1
-* so that the above while() loop is never run on init.
-*
-* A better way would be to free the mbufs when entering
-* netmap mode, and set next_to_refresh/check in
-* a way that the mbufs are completely reallocated
-* when going back to standard mode.
-*/
-   struct netmap_adapter *na = NA(adapter->ifp);
-   struct netmap_slot *slot = netmap_reset(na,
-   NR_RX, rxr->me, rxr->next_to_check);
-   int sj = slot ? na->rx_rings[rxr->me].nkr_hwofs : 0;
-
-   /* slot sj corresponds to entry j in the NIC ring */
-   if (sj < 0)
-   sj += adapter->num_rx_desc;
-
-   for (int j = 0; j != adapter->num_rx_desc; j++, sj++) {
-   rxbuf = &rxr->rx_buffers[j];
-   /* no mbuf and regular mode -> skip this entry */
-   if (rxbuf->m_head == NULL && !slot)
-   continue;
-   /* Handle wrap. Cannot use "na" here, could be NULL */
-   if (sj >= adapter->num_rx_desc)
-   sj -= adapter->num_rx_desc;
-   /* see comment, set slot addr and map */
-   if (slot) {
-   uint64_t paddr;
-   void *addr = PNMB(slot + sj, &paddr);
-   netmap_load_map(rxr->rxtag, rxbuf->map, addr);
-   /* Update descriptor */
-   rxr->rx_base[j].buffer_addr = htole64(paddr);
-   } else {
-   /* Get the memory mapping */
-   bus_dmamap_load_mbuf_sg(rxr->rxtag,
-   rxbuf->map, rxbuf->m_head, seg,
-   &nsegs, BUS_DMA_NOWAIT);
-   /* Update descriptor */
-  

svn commit: r230024 - head/sys/dev/e1000

2012-01-12 Thread Luigi Rizzo
Author: luigi
Date: Thu Jan 12 17:30:44 2012
New Revision: 230024
URL: http://svn.freebsd.org/changeset/base/230024

Log:
  clear the pointer after freeing the mbuf. Without that, we
  risk a double free if the subsequent mbuf allocation fails.
  This bug is not netmap-related and was introduced in  rev. 228387

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Thu Jan 12 17:28:00 2012(r230023)
+++ head/sys/dev/e1000/if_em.c  Thu Jan 12 17:30:44 2012(r230024)
@@ -4044,6 +4044,7 @@ em_setup_receive_ring(struct rx_ring *rx
BUS_DMASYNC_POSTREAD);
bus_dmamap_unload(rxr->rxtag, rxbuf->map);
m_freem(rxbuf->m_head);
+   rxbuf->m_head = NULL; /* mark as freed */
}
}
 
___
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: r230025 - head/contrib/compiler-rt/lib/sparc64

2012-01-12 Thread Ed Schouten
Author: ed
Date: Thu Jan 12 17:55:22 2012
New Revision: 230025
URL: http://svn.freebsd.org/changeset/base/230025

Log:
  Add SPARC64 version of div/mod written in assembly.
  
  This version is similar to the code shipped with libgcc. It is based on
  the code from the SPARC64 architecture manual, provided without any
  restrictions.
  
  Tested by:flo@

Added:
  head/contrib/compiler-rt/lib/sparc64/
  head/contrib/compiler-rt/lib/sparc64/divmod.m4
  head/contrib/compiler-rt/lib/sparc64/divsi3.S
  head/contrib/compiler-rt/lib/sparc64/generate.sh
  head/contrib/compiler-rt/lib/sparc64/modsi3.S
  head/contrib/compiler-rt/lib/sparc64/udivsi3.S
  head/contrib/compiler-rt/lib/sparc64/umodsi3.S

Added: head/contrib/compiler-rt/lib/sparc64/divmod.m4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/compiler-rt/lib/sparc64/divmod.m4  Thu Jan 12 17:55:22 
2012(r230025)
@@ -0,0 +1,250 @@
+/*
+ * This m4 code has been taken from The SPARC Architecture Manual Version 8.
+ */
+
+/*
+ * Division/Remainder
+ *
+ * Input is:
+ *   dividend -- the thing being divided
+ *   divisor -- how many ways to divide it
+ * Important parameters:
+ *   N -- how many bits per iteration we try to get
+ *as our current guess: define(N, 4) define(TWOSUPN, 16)
+ *   WORDSIZE -- how many bits altogether we're talking about:
+ *   obviously: define(WORDSIZE, 32)
+ * A derived constant:
+ *   TOPBITS -- how many bits are in the top "decade" of a number:
+ *define(TOPBITS, eval( WORDSIZE - N*((WORDSIZE-1)/N) ) )
+ * Important variables are:
+ *   Q -- the partial quotient under development -- initially 0
+ *   R -- the remainder so far -- initially == the dividend
+ *   ITER -- number of iterations of the main division loop which will
+ *   be required. Equal to CEIL( lg2(quotient)/N )
+ *   Note that this is log_base_(2ˆN) of the quotient.
+ *   V -- the current comparand -- initially divisor*2ˆ(ITER*N-1)
+ * Cost:
+ *   current estimate for non-large dividend is
+ *CEIL( lg2(quotient) / N ) x ( 10 + 7N/2 ) + C
+ *   a large dividend is one greater than 2ˆ(31-TOPBITS) and takes a
+ *   different path, as the upper bits of the quotient must be developed
+ *   one bit at a time.
+ *   This uses the m4 and cpp macro preprocessors.
+ */
+
+define(dividend, `%o0')
+define(divisor,`%o1')
+define(Q, `%o2')
+define(R, `%o3')
+define(ITER, `%o4')
+define(V, `%o5')
+define(SIGN, `%g3')
+define(T, `%g1')
+define(SC,`%g2')
+/*
+ * This is the recursive definition of how we develop quotient digits.
+ * It takes three important parameters:
+ *   $1 -- the current depth, 1<=$1<=N
+ *   $2 -- the current accumulation of quotient bits
+ *   N -- max depth
+ * We add a new bit to $2 and either recurse or insert the bits in the 
quotient.
+ * Dynamic input:
+ *   R -- current remainder
+ *   Q -- current quotient
+ *   V -- current comparand
+ *   cc -- set on current value of R
+ * Dynamic output:
+ *   R', Q', V', cc'
+ */
+
+#include "../assembly.h"
+
+.text
+   .align 4
+
+define(DEVELOP_QUOTIENT_BITS,
+`  !depth $1, accumulated bits $2
+   bl  L.$1.eval(TWOSUPN+$2)
+   srl V,1,V
+   ! remainder is nonnegative
+   subcc   R,V,R
+   ifelse( $1, N,
+   `   b   9f
+   add Q, ($2*2+1), Q
+   ',` DEVELOP_QUOTIENT_BITS( incr($1), `eval(2*$2+1)')
+   ')
+L.$1.eval(TWOSUPN+$2):
+   ! remainder is negative
+   addcc   R,V,R
+   ifelse( $1, N,
+   `   b   9f
+   add Q, ($2*2-1), Q
+   ',` DEVELOP_QUOTIENT_BITS( incr($1), `eval(2*$2-1)')
+   ')
+   ifelse( $1, 1, `9:')
+')
+ifelse( ANSWER, `quotient', `
+DEFINE_COMPILERRT_FUNCTION(__udivsi3)
+   save%sp,-64,%sp ! do this for debugging
+   b   divide
+   mov 0,SIGN  ! result always nonnegative
+DEFINE_COMPILERRT_FUNCTION(__divsi3)
+   save%sp,-64,%sp ! do this for debugging
+   orccdivisor,dividend,%g0! are either dividend or divisor 
negative
+   bge divide  ! if not, skip this junk
+   xor divisor,dividend,SIGN   ! record sign of result in sign of SIGN
+   tst divisor
+   bge 2f
+   tst dividend
+   ! divisor < 0
+   bge divide
+   neg divisor
+   2:
+   ! dividend < 0
+   neg dividend
+   ! FALL THROUGH
+',`
+DEFINE_COMPILERRT_FUNCTION(__umodsi3)
+   save%sp,-64,%sp ! do this for debugging
+   b   divide
+   mov 0,SIGN  ! result always nonnegative
+DEFINE_COMPILERRT_FUNCTION(__modsi3)
+   save%sp,-64,%sp ! do this for debugging
+   orccdivisor,dividend,%g0! are either dividend or divisor 
negative
+   bge divide  ! if not, skip thi

svn commit: r230026 - head/sys/net

2012-01-12 Thread Robert Watson
Author: rwatson
Date: Thu Jan 12 18:39:37 2012
New Revision: 230026
URL: http://svn.freebsd.org/changeset/base/230026

Log:
  Clarify throughout the vlan(4) code the difference between a "tag" (the
  802.1q-defined 16-bit VID, CFI, and PCP field in host by order) and a
  VLAN ID (VID).  Tags go in packets.  VIDs identify VLANs.
  
  No functional change is intended, so this should be safe to MFC.  Further
  cleanup with functional changes will be committed separately (for example,
  renaming vlan_tag/vlan_tag_p, which modify the KPI and KBI).
  
  Reviewed by:  bz
  Sponsored by: ADARA Networks, Inc.
  MFC after:3 days

Modified:
  head/sys/net/if_vlan.c
  head/sys/net/if_vlan_var.h

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Thu Jan 12 17:55:22 2012(r230025)
+++ head/sys/net/if_vlan.c  Thu Jan 12 18:39:37 2012(r230026)
@@ -114,7 +114,7 @@ struct  ifvlan {
 #endif
 };
 #defineifv_proto   ifv_mib.ifvm_proto
-#defineifv_tag ifv_mib.ifvm_tag
+#defineifv_vid ifv_mib.ifvm_tag
 #defineifv_encaplenifv_mib.ifvm_encaplen
 #defineifv_mtufudgeifv_mib.ifvm_mtufudge
 #defineifv_mintu   ifv_mib.ifvm_mintu
@@ -178,7 +178,7 @@ static  int vlan_inshash(struct ifvlantru
 static int vlan_remhash(struct ifvlantrunk *trunk, struct ifvlan *ifv);
 static void vlan_growhash(struct ifvlantrunk *trunk, int howmuch);
 static __inline struct ifvlan * vlan_gethash(struct ifvlantrunk *trunk,
-   uint16_t tag);
+   uint16_t vid);
 #endif
 static void trunk_destroy(struct ifvlantrunk *trunk);
 
@@ -198,7 +198,7 @@ static  void vlan_link_state(struct ifnet
 static void vlan_capabilities(struct ifvlan *ifv);
 static void vlan_trunk_capabilities(struct ifnet *ifp);
 
-static struct ifnet *vlan_clone_match_ethertag(struct if_clone *,
+static struct ifnet *vlan_clone_match_ethervid(struct if_clone *,
 const char *, int *);
 static int vlan_clone_match(struct if_clone *, const char *);
 static int vlan_clone_create(struct if_clone *, char *, size_t, caddr_t);
@@ -266,9 +266,9 @@ vlan_inshash(struct ifvlantrunk *trunk, 
KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__));
 
b = 1 << trunk->hwidth;
-   i = HASH(ifv->ifv_tag, trunk->hmask);
+   i = HASH(ifv->ifv_vid, trunk->hmask);
LIST_FOREACH(ifv2, &trunk->hash[i], ifv_list)
-   if (ifv->ifv_tag == ifv2->ifv_tag)
+   if (ifv->ifv_vid == ifv2->ifv_vid)
return (EEXIST);
 
/*
@@ -278,7 +278,7 @@ vlan_inshash(struct ifvlantrunk *trunk, 
 */
if (trunk->refcnt > (b * b) / 2) {
vlan_growhash(trunk, 1);
-   i = HASH(ifv->ifv_tag, trunk->hmask);
+   i = HASH(ifv->ifv_vid, trunk->hmask);
}
LIST_INSERT_HEAD(&trunk->hash[i], ifv, ifv_list);
trunk->refcnt++;
@@ -296,7 +296,7 @@ vlan_remhash(struct ifvlantrunk *trunk, 
KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__));

b = 1 << trunk->hwidth;
-   i = HASH(ifv->ifv_tag, trunk->hmask);
+   i = HASH(ifv->ifv_vid, trunk->hmask);
LIST_FOREACH(ifv2, &trunk->hash[i], ifv_list)
if (ifv2 == ifv) {
trunk->refcnt--;
@@ -348,7 +348,7 @@ vlan_growhash(struct ifvlantrunk *trunk,
for (i = 0; i < n; i++)
while ((ifv = LIST_FIRST(&trunk->hash[i])) != NULL) {
LIST_REMOVE(ifv, ifv_list);
-   j = HASH(ifv->ifv_tag, n2 - 1);
+   j = HASH(ifv->ifv_vid, n2 - 1);
LIST_INSERT_HEAD(&hash2[j], ifv, ifv_list);
}
free(trunk->hash, M_VLAN);
@@ -362,14 +362,14 @@ vlan_growhash(struct ifvlantrunk *trunk,
 }
 
 static __inline struct ifvlan *
-vlan_gethash(struct ifvlantrunk *trunk, uint16_t tag)
+vlan_gethash(struct ifvlantrunk *trunk, uint16_t vid)
 {
struct ifvlan *ifv;
 
TRUNK_LOCK_RASSERT(trunk);
 
-   LIST_FOREACH(ifv, &trunk->hash[HASH(tag, trunk->hmask)], ifv_list)
-   if (ifv->ifv_tag == tag)
+   LIST_FOREACH(ifv, &trunk->hash[HASH(vid, trunk->hmask)], ifv_list)
+   if (ifv->ifv_vid == vid)
return (ifv);
return (NULL);
 }
@@ -393,19 +393,19 @@ vlan_dumphash(struct ifvlantrunk *trunk)
 #else
 
 static __inline struct ifvlan *
-vlan_gethash(struct ifvlantrunk *trunk, uint16_t tag)
+vlan_gethash(struct ifvlantrunk *trunk, uint16_t vid)
 {
 
-   return trunk->vlans[tag];
+   return trunk->vlans[vid];
 }
 
 static __inline int
 vlan_inshash(struct ifvlantrunk *trunk, struct ifvlan *ifv)
 {
 
-   if (trunk->vlans[ifv->ifv_tag] != NULL)
+   if (trunk->vlans[ifv->ifv_vid] != NULL)
return EEXIST;
-   trunk->vlans[ifv->ifv_tag] = ifv;
+   tru

Re: svn commit: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx

2012-01-12 Thread Pedro Giffuni
Hello;

--- Gio 12/1/12, John Baldwin  ha scritto:

> Da: John Baldwin 
> Oggetto: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci 
> gnu/dev/sound/pci modules/sound/driver/emu10kx
> A: "Pedro F. Giffuni" 
> Cc: src-committ...@freebsd.org, svn-src-all@freebsd.org, 
> svn-src-h...@freebsd.org, j...@freebsd.org
> Data: Giovedì 12 gennaio 2012, 07:43
> On Wednesday, January 11, 2012
> 4:17:14 pm Pedro F. Giffuni wrote:
> > Author: pfg
> > Date: Wed Jan 11 21:17:14 2012
> > New Revision: 229981
> > URL: http://svn.freebsd.org/changeset/base/229981
> >
...   
> >   The emu10kx driver is now free from the GPL.
> >   
> >   PR:        153901
> >   Tested by:    mav, joel
> >   Approved by:    jhb (mentor)
> >   MFC after:    2 weeks
> 
> Is the emu10kx driver a superset of em10k1 now (meaning
> does it support all
> the em10k1 devices and should em10k1 be retired)?
> 

Both device drivers seem to have diverged significantly
and while emu10kx seems to be superior, some people still
have problems with it:

http://docs.freebsd.org/cgi/mid.cgi?201201100024.q0A0OF24069073

so I suggest we keep both at least for a while.

> Also, it seems we should definitely add 'snd_emu10kx' to
> GENERIC on x86 and possible 'snd_emu10k1'.
> 

+1

Pedro.
___
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: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx

2012-01-12 Thread Garrett Cooper

On Jan 12, 2012, at 11:33 AM, Pedro Giffuni wrote:

> Hello;
> 
> --- Gio 12/1/12, John Baldwin  ha scritto:
> 
>> Da: John Baldwin 
>> Oggetto: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci 
>> gnu/dev/sound/pci modules/sound/driver/emu10kx
>> A: "Pedro F. Giffuni" 
>> Cc: src-committ...@freebsd.org, svn-src-all@freebsd.org, 
>> svn-src-h...@freebsd.org, j...@freebsd.org
>> Data: Giovedì 12 gennaio 2012, 07:43
>> On Wednesday, January 11, 2012
>> 4:17:14 pm Pedro F. Giffuni wrote:
>>> Author: pfg
>>> Date: Wed Jan 11 21:17:14 2012
>>> New Revision: 229981
>>> URL: http://svn.freebsd.org/changeset/base/229981
>>> 
> ...   
>>>The emu10kx driver is now free from the GPL.
>>>
>>>PR:153901
>>>Tested by:mav, joel
>>>Approved by:jhb (mentor)
>>>MFC after:2 weeks
>> 
>> Is the emu10kx driver a superset of em10k1 now (meaning
>> does it support all
>> the em10k1 devices and should em10k1 be retired)?
>> 
> 
> Both device drivers seem to have diverged significantly
> and while emu10kx seems to be superior, some people still
> have problems with it:
> 
> http://docs.freebsd.org/cgi/mid.cgi?201201100024.q0A0OF24069073
> 
> so I suggest we keep both at least for a while.
> 
>> Also, it seems we should definitely add 'snd_emu10kx' to
>> GENERIC on x86 and possible 'snd_emu10k1'.
>> 

SB Audigy chipsets are also treated differently for both cases. My 
Audigy 4 card for instance is detected with both drivers, but only the 10kx 
driver works with the card; similarly IIRC there are some things that work with 
the 10k1 driver that don't work the same with the 10kx.
So while this would be nice to have, I'm not sure if it's an effective 
use of FreeBSD's time to invest in as these chipsets are effectively obsolete.
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"


Re: svn commit: r230007 - in head: etc etc/rc.d share/man/man8

2012-01-12 Thread John Baldwin
On Thursday, January 12, 2012 9:35:05 am Eygene Ryabinkin wrote:
> Thu, Jan 12, 2012 at 07:48:28AM -0500, John Baldwin wrote:
> > Alternatively, devd could have invoked a wrapper script that only
> > ran /etc/rc.d/dhclient if dhcpif was true for the interface.  All
> > other uses of /etc/rc.d/dhclient in our system scripts are
> > conditional on that check.
> 
> True, and it was suggested by Doug Barton.  But why bother when
> the 'quiet' keyword is reserved for such cases?

Hmm, that's not quite how I see this.  Either /etc/rc.d/dhclient
should silently exit if dhcpif is not true for the given interface,
or it should always whine IMO.  Given that everywhere else uses
dhcpif to decide if dhclient should be run, it seems that an explicit
test of that should be used here as well, even if it means an extra
script.  In short, this approach is not consisent with all other
users of the dhclient script, and this seems a hackish approach whose
primary goal is to avoid having devd use a wrapper script.  Perhaps
that goal is worth the tradeoff, but it's not really clean.

By your argument, btw since we use quietstart during boot, ifn_start
shouldn't even check dhcpif at all now, but just always run the
dhclient script (and if you did make that change, I would protest that
it was very wrong).

-- 
John Baldwin
___
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: r230027 - head/usr.bin/printf

2012-01-12 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jan 12 20:30:20 2012
New Revision: 230027
URL: http://svn.freebsd.org/changeset/base/230027

Log:
  Style cleanups for printf.
  
  PR:   bin/152934
  Approved by:  jhb (mentor)
  Obtained from:Illumos
  MFC after:2 weeks

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

Modified: head/usr.bin/printf/printf.c
==
--- head/usr.bin/printf/printf.cThu Jan 12 18:39:37 2012
(r230026)
+++ head/usr.bin/printf/printf.cThu Jan 12 20:30:20 2012
(r230027)
@@ -66,21 +66,21 @@ static const char rcsid[] =
 #include "error.h"
 #endif
 
-#define PF(f, func) do { \
-   char *b = NULL; \
-   if (havewidth) \
-   if (haveprec) \
+#define PF(f, func) do {   \
+   char *b = NULL; \
+   if (havewidth)  \
+   if (haveprec)   \
(void)asprintf(&b, f, fieldwidth, precision, func); \
-   else \
-   (void)asprintf(&b, f, fieldwidth, func); \
-   else if (haveprec) \
-   (void)asprintf(&b, f, precision, func); \
-   else \
-   (void)asprintf(&b, f, func); \
-   if (b) { \
-   (void)fputs(b, stdout); \
-   free(b); \
-   } \
+   else\
+   (void)asprintf(&b, f, fieldwidth, func);\
+   else if (haveprec)  \
+   (void)asprintf(&b, f, precision, func); \
+   else\
+   (void)asprintf(&b, f, func);\
+   if (b) {\
+   (void)fputs(b, stdout); \
+   free(b);\
+   }   \
 } while (0)
 
 static int  asciicode(void);
@@ -357,10 +357,10 @@ mknum(char *str, char ch)
 static int
 escape(char *fmt, int percent, size_t *len)
 {
-   char *save, *store;
-   int value, c;
+   char *save, *store, c;
+   int value;
 
-   for (save = store = fmt; (c = *fmt); ++fmt, ++store) {
+   for (save = store = fmt; ((c = *fmt) != 0); ++fmt, ++store) {
if (c != '\\') {
*store = c;
continue;
@@ -414,7 +414,7 @@ escape(char *fmt, int percent, size_t *l
*store++ = '%';
*store = '%';
} else
-   *store = value;
+   *store = (char)value;
break;
default:
*store = *fmt;
___
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: r230028 - stable/9/share/man/man4

2012-01-12 Thread Christian Brueffer
Author: brueffer
Date: Thu Jan 12 20:39:54 2012
New Revision: 230028
URL: http://svn.freebsd.org/changeset/base/230028

Log:
  MFC: r229585
  
  Fix typo.

Modified:
  stable/9/share/man/man4/bce.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/bce.4
==
--- stable/9/share/man/man4/bce.4   Thu Jan 12 20:30:20 2012
(r230027)
+++ stable/9/share/man/man4/bce.4   Thu Jan 12 20:39:54 2012
(r230028)
@@ -251,7 +251,7 @@ status block.
 .It "bce%d: Could not allocate status block DMA memory!"
 The driver could not allocate DMA addressable memory for the controller's
 status block.
-.It "bce_d: Could not map status block DMA memory!"
+.It "bce%d: Could not map status block DMA memory!"
 The driver could not map the status block memory into the controller's DMA
 address space.
 .It "bce%d: Could not allocate statistics block DMA tag!"
___
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: r230029 - stable/8/share/man/man4

2012-01-12 Thread Christian Brueffer
Author: brueffer
Date: Thu Jan 12 20:45:56 2012
New Revision: 230029
URL: http://svn.freebsd.org/changeset/base/230029

Log:
  MFC: r229585
  
  Fix typo.

Modified:
  stable/8/share/man/man4/bce.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/bce.4
==
--- stable/8/share/man/man4/bce.4   Thu Jan 12 20:39:54 2012
(r230028)
+++ stable/8/share/man/man4/bce.4   Thu Jan 12 20:45:56 2012
(r230029)
@@ -251,7 +251,7 @@ status block.
 .It "bce%d: Could not allocate status block DMA memory!"
 The driver could not allocate DMA addressable memory for the controller's
 status block.
-.It "bce_d: Could not map status block DMA memory!"
+.It "bce%d: Could not map status block DMA memory!"
 The driver could not map the status block memory into the controller's DMA
 address space.
 .It "bce%d: Could not allocate statistics block DMA tag!"
___
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: r230030 - stable/7/share/man/man4

2012-01-12 Thread Christian Brueffer
Author: brueffer
Date: Thu Jan 12 20:51:01 2012
New Revision: 230030
URL: http://svn.freebsd.org/changeset/base/230030

Log:
  MFC: r229585
  
  Fix typo.

Modified:
  stable/7/share/man/man4/bce.4
Directory Properties:
  stable/7/share/man/man4/   (props changed)

Modified: stable/7/share/man/man4/bce.4
==
--- stable/7/share/man/man4/bce.4   Thu Jan 12 20:45:56 2012
(r230029)
+++ stable/7/share/man/man4/bce.4   Thu Jan 12 20:51:01 2012
(r230030)
@@ -251,7 +251,7 @@ status block.
 .It "bce%d: Could not allocate status block DMA memory!"
 The driver could not allocate DMA addressable memory for the controller's
 status block.
-.It "bce_d: Could not map status block DMA memory!"
+.It "bce%d: Could not map status block DMA memory!"
 The driver could not map the status block memory into the controller's DMA
 address space.
 .It "bce%d: Could not allocate statistics block DMA tag!"
___
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: r230032 - in head/sys/dev/usb: . controller

2012-01-12 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Jan 12 21:21:20 2012
New Revision: 230032
URL: http://svn.freebsd.org/changeset/base/230032

Log:
  - Try to fix support for USB 3.0 HUBs.
  - Try to fix support for USB 3.0 suspend and resume.
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/controller/xhci.c
  head/sys/dev/usb/usb.h
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_request.h

Modified: head/sys/dev/usb/controller/xhci.c
==
--- head/sys/dev/usb/controller/xhci.c  Thu Jan 12 21:12:16 2012
(r230031)
+++ head/sys/dev/usb/controller/xhci.c  Thu Jan 12 21:21:20 2012
(r230032)
@@ -2211,9 +2211,10 @@ xhci_configure_device(struct usb_device 
struct usb_device *hubdev;
uint32_t temp;
uint32_t route;
+   uint32_t rh_port;
uint8_t is_hub;
uint8_t index;
-   uint8_t rh_port;
+   uint8_t depth;
 
index = udev->controller_slot_id;
 
@@ -2235,6 +2236,8 @@ xhci_configure_device(struct usb_device 
if (hubdev->parent_hub == NULL)
break;
 
+   depth = hubdev->parent_hub->depth;
+
/*
 * NOTE: HS/FS/LS devices and the SS root HUB can have
 * more than 15 ports
@@ -2242,17 +2245,18 @@ xhci_configure_device(struct usb_device 
 
rh_port = hubdev->port_no;
 
-   if (hubdev->parent_hub->parent_hub == NULL)
+   if (depth == 0)
break;
 
-   route *= 16;
-
if (rh_port > 15)
-   route |= 15;
-   else
-   route |= rh_port;
+   rh_port = 15;
+
+   if (depth < 6)
+   route |= rh_port << (4 * (depth - 1));
}
 
+   DPRINTF("Route=0x%08x\n", route);
+
temp = XHCI_SCTX_0_ROUTE_SET(route);
 
switch (sc->sc_hw.devs[index].state) {
@@ -3063,6 +3067,7 @@ xhci_roothub_exec(struct usb_device *ude
case UHF_C_PORT_CONFIG_ERROR:
XWRITE4(sc, oper, port, v | XHCI_PS_CEC);
break;
+   case UHF_C_PORT_SUSPEND:
case UHF_C_PORT_LINK_STATE:
XWRITE4(sc, oper, port, v | XHCI_PS_PLC);
break;
@@ -3190,7 +3195,7 @@ xhci_roothub_exec(struct usb_device *ude
if (v & XHCI_PS_PR)
i |= UPS_RESET;
if (v & XHCI_PS_PP)
-   i |= UPS_PORT_POWER;
+   i |= UPS_PORT_POWER_SS;
USETW(sc->sc_hub_desc.ps.wPortStatus, i);
 
i = 0;

Modified: head/sys/dev/usb/usb.h
==
--- head/sys/dev/usb/usb.h  Thu Jan 12 21:12:16 2012(r230031)
+++ head/sys/dev/usb/usb.h  Thu Jan 12 21:21:20 2012(r230032)
@@ -688,6 +688,7 @@ struct usb_port_status {
 #defineUPS_PORT_LS_LOOPBACK0x0B
 #defineUPS_PORT_LS_RESUME  0x0F
 #defineUPS_PORT_POWER  0x0100
+#defineUPS_PORT_POWER_SS   0x0200  /* super-speed only */
 #defineUPS_LOW_SPEED   0x0200
 #defineUPS_HIGH_SPEED  0x0400
 #defineUPS_OTHER_SPEED 0x0600  /* currently FreeBSD 
specific */

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Thu Jan 12 21:12:16 2012(r230031)
+++ head/sys/dev/usb/usb_hub.c  Thu Jan 12 21:21:20 2012(r230032)
@@ -369,10 +369,25 @@ repeat:
}
/* check if there is no power on the port and print a warning */
 
-   if (!(sc->sc_st.port_status & UPS_PORT_POWER)) {
-   DPRINTF("WARNING: strange, connected port %d "
-   "has no power\n", portno);
+   switch (udev->speed) {
+   case USB_SPEED_HIGH:
+   case USB_SPEED_FULL:
+   case USB_SPEED_LOW:
+   if (!(sc->sc_st.port_status & UPS_PORT_POWER)) {
+   DPRINTF("WARNING: strange, connected port %d "
+   "has no power\n", portno);
+   }
+   break;
+   case USB_SPEED_SUPER:
+   if (!(sc->sc_st.port_status & UPS_PORT_POWER_SS)) {
+   DPRINTF("WARNING: strange, connected port %d "
+   "has no power\n", portno);
+   }
+   break;
+   default:
+   break;
}
+
/* check if the device is in Host Mode */
 
if (!(sc->sc_st.port_status & UPS_PORT_MODE_DEVICE)) {
@@ -611,6 +626,7 @@ uhub_suspend_resume_port(struct uhub_sof
switch (UPS_PORT_LINK_STATE_GET(sc->sc_st.port_status)) {
case UPS_PORT_LS_U0:

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

2012-01-12 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan 12 22:08:33 2012
New Revision: 230033
URL: http://svn.freebsd.org/changeset/base/230033

Log:
  Silence some unnecessary verbosity.
  
  Reported by:  mav
  MFC after:1 month

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

Modified: head/sys/cam/ctl/scsi_ctl.c
==
--- head/sys/cam/ctl/scsi_ctl.c Thu Jan 12 21:21:20 2012(r230032)
+++ head/sys/cam/ctl/scsi_ctl.c Thu Jan 12 22:08:33 2012(r230033)
@@ -305,8 +305,10 @@ ctlfeasync(void *callback_arg, uint32_t 
 
/* Don't attach if it doesn't support target mode */
if ((cpi->target_sprt & PIT_PROCESSOR) == 0) {
+#ifdef CTLFEDEBUG
printf("%s: SIM %s%d doesn't support target mode\n",
   __func__, cpi->dev_name, cpi->unit_number);
+#endif
break;
}
 
@@ -421,8 +423,10 @@ ctlfeasync(void *callback_arg, uint32_t 
 * XXX KDM need to figure out whether we're the master or
 * slave.
 */
+#ifdef CTLFEDEBUG
printf("%s: calling ctl_frontend_register() for %s%d\n",
   __func__, cpi->dev_name, cpi->unit_number);
+#endif
retval = ctl_frontend_register(fe, /*master_SC*/ 1);
if (retval != 0) {
printf("%s: ctl_frontend_register() failed with "
___
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: r230034 - head/usr.bin/ctlstat

2012-01-12 Thread Kenneth D. Merry
Author: ken
Date: Thu Jan 12 22:12:42 2012
New Revision: 230034
URL: http://svn.freebsd.org/changeset/base/230034

Log:
  Fix building ctlstat with clang.
  
  Submitted by: Dan McGregor 
  MFC after:1 month

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

Modified: head/usr.bin/ctlstat/ctlstat.c
==
--- head/usr.bin/ctlstat/ctlstat.c  Thu Jan 12 22:08:33 2012
(r230033)
+++ head/usr.bin/ctlstat/ctlstat.c  Thu Jan 12 22:12:42 2012
(r230034)
@@ -146,7 +146,7 @@ static void compute_stats(struct ctl_lun
 static void
 usage(int error)
 {
-   fprintf(error ? stderr : stdout, ctlstat_usage);
+   fputs(ctlstat_usage, error ? stderr : stdout);
 }
 
 static int
___
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: r230035 - head/sys/powerpc/powermac

2012-01-12 Thread Justin Hibbits
Author: jhibbits
Date: Thu Jan 12 22:21:20 2012
New Revision: 230035
URL: http://svn.freebsd.org/changeset/base/230035

Log:
  Add PWM monitoring sysctl to G4 MDD (Windtunnel) fan driver.  While there, 
clean
  up some style nits.
  
  Approved by:  nwhitehorn (mentor)
  MFC after:3 days

Modified:
  head/sys/powerpc/powermac/windtunnel.c

Modified: head/sys/powerpc/powermac/windtunnel.c
==
--- head/sys/powerpc/powermac/windtunnel.c  Thu Jan 12 22:12:42 2012
(r230034)
+++ head/sys/powerpc/powermac/windtunnel.c  Thu Jan 12 22:21:20 2012
(r230035)
@@ -59,8 +59,7 @@ struct adm1030_softc {
device_tsc_dev;
struct intr_config_hook enum_hook;
uint32_tsc_addr;
-   phandle_t   sc_thermostat_phandle;
-   device_tsc_thermostat_dev;
+   int sc_pwm;
 };
 
 /* Regular bus attachment functions */
@@ -70,7 +69,8 @@ static intadm1030_attach(device_t);
 /* Utility functions */
 static voidadm1030_start(void *xdev);
 static int adm1030_write_byte(device_t dev, uint32_t addr, uint8_t reg, 
uint8_t buf);
-static int adm1030_set(struct adm1030_softc *fan, int pwm);
+static int adm1030_set(struct adm1030_softc *fan, int pwm);
+static int adm1030_sysctl(SYSCTL_HANDLER_ARGS);
 
 static device_method_t adm1030_methods[] = {
/* Device interface */
@@ -151,6 +151,8 @@ static int
 adm1030_attach(device_t dev)
 {
struct adm1030_softc *sc;
+   struct sysctl_ctx_list *ctx;
+   struct sysctl_oid *tree;
 
sc = device_get_softc(dev);
 
@@ -158,17 +160,19 @@ adm1030_attach(device_t dev)
sc->enum_hook.ich_arg = dev;
 
/*
-* We have to wait until interrupts are enabled. I2C read and write
-* only works if the interrupts are available. The unin/i2c is
-* controlled by the htpic on unin. But this is not the master. The
-* openpic on mac-io is controlling the htpic. This one gets attached
-* after the mac-io probing and then the interrupts will be
-* available.
+* Wait until interrupts are available, which won't be until the 
openpic is
+* intialized.
 */
 
if (config_intrhook_establish(&sc->enum_hook) != 0)
return (ENOMEM);
 
+   ctx = device_get_sysctl_ctx(dev);
+   tree = device_get_sysctl_tree(dev);
+   SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "pwm",
+   CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, dev,
+   0, adm1030_sysctl, "I", "Fan PWM Rate");
+
return (0);
 }
 
@@ -188,7 +192,7 @@ adm1030_start(void *xdev)
 
/* Use the RPM fields as PWM duty cycles. */
sc->fan.min_rpm = 0;
-   sc->fan.max_rpm = 15;
+   sc->fan.max_rpm = 0x0F;
sc->fan.default_rpm = 2;
 
strcpy(sc->fan.name, "MDD Case fan");
@@ -211,6 +215,26 @@ static int adm1030_set(struct adm1030_so
if (adm1030_write_byte(fan->sc_dev, fan->sc_addr, 0x22, pwm) < 0)
return (-1);
 
+   fan->sc_pwm = pwm;
return (0);
 }
 
+static int
+adm1030_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   device_t adm1030;
+   struct adm1030_softc *sc;
+   int pwm, error;
+
+   adm1030 = arg1;
+   sc = device_get_softc(adm1030);
+
+   pwm = sc->sc_pwm;
+
+   error = sysctl_handle_int(oidp, &pwm, 0, req);
+
+   if (error || !req->newptr)
+   return (error);
+
+   return (adm1030_set(sc, pwm));
+}
___
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: r230037 - head/lib/libutil

2012-01-12 Thread Guy Helmer
Author: ghelmer
Date: Thu Jan 12 22:49:36 2012
New Revision: 230037
URL: http://svn.freebsd.org/changeset/base/230037

Log:
  Move struct pidfh definition into pidfile.c, and leave a forward declaration
  for pidfh in libutil.h in its place.
  This allows us to hide the contents of the pidfh structure, and also
  allowed removal of the "#ifdef _SYS_PARAM_H" guard from around the
  pidfile_* function prototypes.
  
  Suggested by pjd.

Modified:
  head/lib/libutil/libutil.h
  head/lib/libutil/pidfile.c

Modified: head/lib/libutil/libutil.h
==
--- head/lib/libutil/libutil.h  Thu Jan 12 22:30:41 2012(r230036)
+++ head/lib/libutil/libutil.h  Thu Jan 12 22:49:36 2012(r230037)
@@ -48,6 +48,11 @@ typedef  __gid_t gid_t;
 #define_GID_T_DECLARED
 #endif
 
+#ifndef _MODE_T_DECLARED
+typedef __mode_t   mode_t;
+#define _MODE_T_DECLARED
+#endif
+
 #ifndef _PID_T_DECLARED
 typedef__pid_t pid_t;
 #define_PID_T_DECLARED
@@ -73,21 +78,12 @@ typedef struct _property {
char*value;
 } *properties;
 
-#ifdef _SYS_PARAM_H_
-/* for pidfile.c */
-struct pidfh {
-   int pf_fd;
-   charpf_path[MAXPATHLEN + 1];
-   __dev_t pf_dev;
-   ino_t   pf_ino;
-};
-#endif
-
 /* Avoid pulling in all the include files for no need */
 struct in_addr;
 struct kinfo_file;
 struct kinfo_proc;
 struct kinfo_vmentry;
+struct pidfh;
 struct sockaddr;
 struct termios;
 struct winsize;
@@ -174,14 +170,12 @@ struct group
 intgr_tmp(int _mdf);
 #endif
 
-#ifdef _SYS_PARAM_H_
 intpidfile_close(struct pidfh *_pfh);
 intpidfile_fileno(const struct pidfh *_pfh);
 struct pidfh *
pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr);
 intpidfile_remove(struct pidfh *_pfh);
 intpidfile_write(struct pidfh *_pfh);
-#endif
 
 #ifdef _UFS_UFS_QUOTA_H_
 struct fstab;

Modified: head/lib/libutil/pidfile.c
==
--- head/lib/libutil/pidfile.c  Thu Jan 12 22:30:41 2012(r230036)
+++ head/lib/libutil/pidfile.c  Thu Jan 12 22:49:36 2012(r230037)
@@ -41,6 +41,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+struct pidfh {
+   int pf_fd;
+   charpf_path[MAXPATHLEN + 1];
+   dev_t   pf_dev;
+   ino_t   pf_ino;
+};
+
 static int _pidfile_remove(struct pidfh *pfh, int freeit);
 
 static int
___
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: r230025 - head/contrib/compiler-rt/lib/sparc64

2012-01-12 Thread Marius Strobl
On Thu, Jan 12, 2012 at 05:55:22PM +, Ed Schouten wrote:
> Author: ed
> Date: Thu Jan 12 17:55:22 2012
> New Revision: 230025
> URL: http://svn.freebsd.org/changeset/base/230025
> 
> Log:
>   Add SPARC64 version of div/mod written in assembly.
>   
>   This version is similar to the code shipped with libgcc. It is based on
>   the code from the SPARC64 architecture manual, provided without any
>   restrictions.
>   
>   Tested by:  flo@
> 

> +#include "../assembly.h"
> +
> +.text
> + .align 4
> +

<...>

> +ifelse( ANSWER, `quotient', `
> +DEFINE_COMPILERRT_FUNCTION(__udivsi3)
> + save%sp,-64,%sp ! do this for debugging

Uhm, these are V8-specific, for V9 the C compiler frame size should
be 192 instead of 64 and the function alignment should be 32 instead
of 4 bytes (at least with GCC and US1-optimizations enabled as we
default to on sparc64), see . However, given that
these functions only seem to obtain new register window for
debugging purposes you probably alternatively could just remove
the saves and the corresponding restores completely.

Marius

___
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: r230038 - stable/8/sys/kern

2012-01-12 Thread Eitan Adler
Author: eadler (ports committer)
Date: Fri Jan 13 00:38:00 2012
New Revision: 230038
URL: http://svn.freebsd.org/changeset/base/230038

Log:
  MFC r228470:
- Add a sysctl to allow non-root users the ability to set idle
  priorities.
- While here fix up some style nits.
  
  Approved by:  jhb

Modified:
  stable/8/sys/kern/kern_resource.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/kern/kern_resource.c
==
--- stable/8/sys/kern/kern_resource.c   Thu Jan 12 22:49:36 2012
(r230037)
+++ stable/8/sys/kern/kern_resource.c   Fri Jan 13 00:38:00 2012
(r230038)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -272,6 +273,10 @@ donice(struct thread *td, struct proc *p
return (0);
 }
 
+static int unprivileged_idprio;
+SYSCTL_INT(_security_bsd, OID_AUTO, unprivileged_idprio, CTLFLAG_RW,
+&unprivileged_idprio, 0, "Allow non-root users to set an idle priority");
+
 /*
  * Set realtime priority for LWP.
  */
@@ -322,18 +327,26 @@ rtprio_thread(struct thread *td, struct 
break;
 
/* Disallow setting rtprio in most cases if not superuser. */
-/*
- * Realtime priority has to be restricted for reasons which should be
- * obvious.  However, for idle priority, there is a potential for
- * system deadlock if an idleprio process gains a lock on a resource
- * that other processes need (and the idleprio process can't run
- * due to a CPU-bound normal process).  Fix me!  XXX
- */
-#if 0
-   if (RTP_PRIO_IS_REALTIME(rtp.type)) {
-#else
-   if (rtp.type != RTP_PRIO_NORMAL) {
-#endif
+
+   /*
+* Realtime priority has to be restricted for reasons which
+* should be obvious.  However, for idleprio processes, there is
+* a potential for system deadlock if an idleprio process gains
+* a lock on a resource that other processes need (and the
+* idleprio process can't run due to a CPU-bound normal
+* process).  Fix me!  XXX
+*
+* This problem is not only related to idleprio process.
+* A user level program can obtain a file lock and hold it
+* indefinitely.  Additionally, without idleprio processes it is
+* still conceivable that a program with low priority will never
+* get to run.  In short, allowing this feature might make it
+* easier to lock a resource indefinitely, but it is not the
+* only thing that makes it possible.
+*/
+   if (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_REALTIME ||
+   (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_IDLE &&
+   unprivileged_idprio == 0)) {
error = priv_check(td, PRIV_SCHED_RTPRIO);
if (error)
break;
@@ -426,19 +439,14 @@ rtprio(td, uap)
if ((error = p_cansched(td, p)) || (error = cierror))
break;
 
-   /* Disallow setting rtprio in most cases if not superuser. */
-/*
- * Realtime priority has to be restricted for reasons which should be
- * obvious.  However, for idle priority, there is a potential for
- * system deadlock if an idleprio process gains a lock on a resource
- * that other processes need (and the idleprio process can't run
- * due to a CPU-bound normal process).  Fix me!  XXX
- */
-#if 0
-   if (RTP_PRIO_IS_REALTIME(rtp.type)) {
-#else
-   if (rtp.type != RTP_PRIO_NORMAL) {
-#endif
+   /*
+* Disallow setting rtprio in most cases if not superuser.
+* See the comment in sys_rtprio_thread about idprio
+* threads holding a lock.
+*/
+   if (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_REALTIME ||
+   (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_IDLE &&
+   !unprivileged_idprio)) {
error = priv_check(td, PRIV_SCHED_RTPRIO);
if (error)
break;
___
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: r230039 - stable/9/sys/kern

2012-01-12 Thread Eitan Adler
Author: eadler (ports committer)
Date: Fri Jan 13 00:38:35 2012
New Revision: 230039
URL: http://svn.freebsd.org/changeset/base/230039

Log:
  MFC r228470:
- Add a sysctl to allow non-root users the ability to set idle
  priorities.
- While here fix up some style nits.
  
  Approved by:  jhb

Modified:
  stable/9/sys/kern/kern_resource.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_resource.c
==
--- stable/9/sys/kern/kern_resource.c   Fri Jan 13 00:38:00 2012
(r230038)
+++ stable/9/sys/kern/kern_resource.c   Fri Jan 13 00:38:35 2012
(r230039)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -273,6 +274,10 @@ donice(struct thread *td, struct proc *p
return (0);
 }
 
+static int unprivileged_idprio;
+SYSCTL_INT(_security_bsd, OID_AUTO, unprivileged_idprio, CTLFLAG_RW,
+&unprivileged_idprio, 0, "Allow non-root users to set an idle priority");
+
 /*
  * Set realtime priority for LWP.
  */
@@ -321,18 +326,26 @@ sys_rtprio_thread(struct thread *td, str
break;
 
/* Disallow setting rtprio in most cases if not superuser. */
-/*
- * Realtime priority has to be restricted for reasons which should be
- * obvious.  However, for idle priority, there is a potential for
- * system deadlock if an idleprio process gains a lock on a resource
- * that other processes need (and the idleprio process can't run
- * due to a CPU-bound normal process).  Fix me!  XXX
- */
-#if 0
-   if (RTP_PRIO_IS_REALTIME(rtp.type)) {
-#else
-   if (rtp.type != RTP_PRIO_NORMAL) {
-#endif
+
+   /*
+* Realtime priority has to be restricted for reasons which
+* should be obvious.  However, for idleprio processes, there is
+* a potential for system deadlock if an idleprio process gains
+* a lock on a resource that other processes need (and the
+* idleprio process can't run due to a CPU-bound normal
+* process).  Fix me!  XXX
+*
+* This problem is not only related to idleprio process.
+* A user level program can obtain a file lock and hold it
+* indefinitely.  Additionally, without idleprio processes it is
+* still conceivable that a program with low priority will never
+* get to run.  In short, allowing this feature might make it
+* easier to lock a resource indefinitely, but it is not the
+* only thing that makes it possible.
+*/
+   if (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_REALTIME ||
+   (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_IDLE &&
+   unprivileged_idprio == 0)) {
error = priv_check(td, PRIV_SCHED_RTPRIO);
if (error)
break;
@@ -417,19 +430,14 @@ sys_rtprio(td, uap)
if ((error = p_cansched(td, p)) || (error = cierror))
break;
 
-   /* Disallow setting rtprio in most cases if not superuser. */
-/*
- * Realtime priority has to be restricted for reasons which should be
- * obvious.  However, for idle priority, there is a potential for
- * system deadlock if an idleprio process gains a lock on a resource
- * that other processes need (and the idleprio process can't run
- * due to a CPU-bound normal process).  Fix me!  XXX
- */
-#if 0
-   if (RTP_PRIO_IS_REALTIME(rtp.type)) {
-#else
-   if (rtp.type != RTP_PRIO_NORMAL) {
-#endif
+   /*
+* Disallow setting rtprio in most cases if not superuser.
+* See the comment in sys_rtprio_thread about idprio
+* threads holding a lock.
+*/
+   if (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_REALTIME ||
+   (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_IDLE &&
+   !unprivileged_idprio)) {
error = priv_check(td, PRIV_SCHED_RTPRIO);
if (error)
break;
___
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: r230040 - head/sys/contrib/octeon-sdk

2012-01-12 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 13 02:33:55 2012
New Revision: 230040
URL: http://svn.freebsd.org/changeset/base/230040

Log:
  - Do not enumerate PCIe bus on CN56XX Pass 1 devices to avoid hard hang.
  There is known issue with this hardware.
  
  Submitted by: Andrew Duane 

Modified:
  head/sys/contrib/octeon-sdk/cvmx-pcie.c

Modified: head/sys/contrib/octeon-sdk/cvmx-pcie.c
==
--- head/sys/contrib/octeon-sdk/cvmx-pcie.c Fri Jan 13 00:38:35 2012
(r230039)
+++ head/sys/contrib/octeon-sdk/cvmx-pcie.c Fri Jan 13 02:33:55 2012
(r230040)
@@ -501,6 +501,12 @@ retry:
 }
 }
 
+/* Make sure a CN56XX pass 1 isn't trying to do anything; errata for PASS 
1 */
+if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)) {
+cvmx_dprintf ("PCIe port %d: CN56XX_PASS_1, skipping\n", pcie_port);
+return -1;
+}
+
 /* PCIe switch arbitration mode. '0' == fixed priority NPEI, PCIe0, then 
PCIe1. '1' == round robin. */
 npei_ctl_status.s.arb = 1;
 /* Allow up to 0x20 config retries */
___
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: r230007 - in head: etc etc/rc.d share/man/man8

2012-01-12 Thread Eygene Ryabinkin
Thu, Jan 12, 2012 at 02:38:16PM -0500, John Baldwin wrote:
> On Thursday, January 12, 2012 9:35:05 am Eygene Ryabinkin wrote:
> > True, and it was suggested by Doug Barton.  But why bother when
> > the 'quiet' keyword is reserved for such cases?
> 
> Hmm, that's not quite how I see this.  Either /etc/rc.d/dhclient
> should silently exit if dhcpif is not true for the given interface,
> or it should always whine IMO.

It should tell one why it won't start DHCP on the interface, so it
should whine at least for the ordinary usage (service dhclient start
), otherwise it will be hard to understand what's going on.

> Given that everywhere else uses dhcpif to decide if dhclient should
> be run, it seems that an explicit test of that should be used here
> as well, even if it means an extra script.  In short, this approach
> is not consisent with all other users of the dhclient script,

As I see, the only other conditional consumer of the dhclient script
is /etc/network.subr, procedure ifconfig_up.  And it has the other
reason to invoke dhcpif: it determines if dhclient should be run
synchronously and invokes it explicitely only in this case; for the
asynchronous dhclient it relies on the devd to do the work once the
interface will come up.

> and this seems a hackish approach whose primary goal is to avoid
> having devd use a wrapper script.  Perhaps that goal is worth the
> tradeoff, but it's not really clean.

Well, partly my reasoning for suppressing the error message was the
following one: 'quiet' will silence the messages about non-enabled
service (via _enabled) that is set via rc.conf and in DHCP case
we also have rc.conf knob (per-interface 'dhcp' keyword), so that's
not a different case.


But seems like the whole problem is that I used the err() function
instead of doing 'echo $errmsg; exit 1'.  Such code shouldn't be
conditionalized for the devd, since it is only syslog message that
worried people; devd doesn't care what is written to the standard
output or the standard error by the scripts it invokes once it become
the daemon, since everything goes to /dev/null after calling
daemon(3).

So, seems like that the following dhclient_pre_check() will make
everyone happy:
{{{
dhclient_pre_check()
{
if [ -z "${rc_force}" ] && ! dhcpif $ifn; then
echo "'$ifn' is not a DHCP-enabled interface"
exit 1
fi
}
}}}
Hadn't tested it yet, but will do it today.


> By your argument, btw since we use quietstart during boot, ifn_start
> shouldn't even check dhcpif at all now, but just always run the
> dhclient script (and if you did make that change, I would protest that
> it was very wrong).

Well, ifn_start (ifconfig_up to be precise) calls 'dhclient start'
and not the 'quietstart'.  Moreover, as I had explained, there is
other dance with syncdhcpif there, so it can't just invoke dhclient
unconditionally.


The related topic: in the process of grepping for dhclient within
/etc, I had found that /etc/netstart still wants to invoke it.  But it
will do a lone '/etc/rc.d/dhclient quietstart' and this will never
be useful in the current state of dhclient: it will refuse to process
any commands without the interface being specified.  And since we
have the invocation of /etc/rc.d/netif just two lines above, I think
that it will be good to remove call to dhclient from /etc/netstart.

At the time of the original addition of call to dhclient to /etc/netstart
(r114213), dhclient script had another form,
  
http://svnweb.freebsd.org/base/head/etc/rc.d/dhclient?revision=113759&view=markup&pathrev=114213
and it was really a normal rc.d script that requires only one argument.
Now it is more of a helper-type script.
.
Am I missing something important here or the removal can really be
done?

Thanks.
-- 
Eygene Ryabinkin,,,^..^,,,
[ Life's unfair - but root password helps!   | codelabs.ru ]
[ 82FE 06BC D497 C0DE 49EC  4FF0 16AF 9EAE 8152 ECFB | freebsd.org ]


pgpZmlj0ZCr1e.pgp
Description: PGP signature


Re: svn commit: r230005 - head/usr.sbin/tzsetup

2012-01-12 Thread Lawrence Stewart

On 01/12/12 16:50, Garrett Wollman wrote:

Author: wollman
Date: Thu Jan 12 05:50:32 2012
New Revision: 230005
URL: http://svn.freebsd.org/changeset/base/230005

Log:
   Use a reasonable-sized buffer when formatting error messages about
   installing zoneinfo.  While we're in the vicinity, add some missing
   error checking to eliminate an unhelpful error message when unlink()
   fails.

   /me is embarrassed by the quality of his 16-year-old code.
   The whole thing is awful and could stand a complete rewrite.

   PR:  164038
   Submitted by:Devin Teske (but implemented differently)

Modified:
   head/usr.sbin/tzsetup/tzsetup.c

Modified: head/usr.sbin/tzsetup/tzsetup.c
==
--- head/usr.sbin/tzsetup/tzsetup.c Thu Jan 12 05:47:28 2012
(r230004)
+++ head/usr.sbin/tzsetup/tzsetup.c Thu Jan 12 05:50:32 2012
(r230005)
@@ -57,6 +57,13 @@ __FBSDID("$FreeBSD$");
  #define   _PATH_DB"/var/db/zoneinfo"
  #define   _PATH_WALL_CMOS_CLOCK   "/etc/wall_cmos_clock"

+#ifdef PATH_MAX
+#defineSILLY_BUFFER_SIZE   2*PATH_MAX
+#else
+#warning "Somebody needs to fix this to dynamically size this buffer."
+#defineSILLY_BUFFER_SIZE   2048
+#endif



Would use of sbuf(9) (which is also built as a library for use by 
userspace code) solve the problem? When used with the SBUF_AUTOEXTEND 
flag, it's perfectly suited for this kind of use.


Cheers,
Lawrence
___
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: r230042 - head/share/misc

2012-01-12 Thread Maxim Konovalov
Author: maxim
Date: Fri Jan 13 06:14:03 2012
New Revision: 230042
URL: http://svn.freebsd.org/changeset/base/230042

Log:
  o Mac OS X 10.7 added (belatedly).  FreeBSD 9.0-RELEASE added.

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

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Fri Jan 13 03:38:08 2012
(r230041)
+++ head/share/misc/bsd-family-tree Fri Jan 13 06:14:03 2012
(r230042)
@@ -247,11 +247,14 @@ FreeBSD 5.2   |  |  
  |  FreeBSD  FreeBSD  |  | |   |
  |8.2  7.4|  | |   DragonFly 2.10.1
  | v  |  | OpenBSD 4.9 |
- ||  | |   |
- ||  | |   |
+ | Mac OS X  | |   |
+ |   10.7| |   |
  ||  | OpenBSD 5.0 |
+ +--FreeBSD   |  | |   |
+ |9.0 |  | |   |
+ | v  |  | |   |
  ||  | |   |
-FreeBSD 9 -current|  NetBSD -current  OpenBSD -current |
+FreeBSD 10 -current   |  NetBSD -current  OpenBSD -current |
  ||  | |   |
  vv  v v   v
 
@@ -537,7 +540,9 @@ FreeBSD 7.4 2011-02-24 [FBD]
 FreeBSD 8.22011-02-24 [FBD]
 DragonFly 2.10.1   2011-04-26 [DFB]
 OpenBSD 4.92011-05-01 [OBD]
+Mac OS X 10.7  2011-07-20 [APL]
 OpenBSD 5.02011-11-01 [OBD]
+FreeBSD 9.02012-01-12 [FBD]
 
 Bibliography
 
___
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: r230043 - head/share/misc

2012-01-12 Thread Maxim Konovalov
Author: maxim
Date: Fri Jan 13 06:18:23 2012
New Revision: 230043
URL: http://svn.freebsd.org/changeset/base/230043

Log:
  Copyright years updated.

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

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Fri Jan 13 06:14:03 2012
(r230042)
+++ head/share/misc/bsd-family-tree Fri Jan 13 06:18:23 2012
(r230043)
@@ -600,7 +600,7 @@ original BSD announcements from Usenet o
 Steven M. Schultz for providing 2.8BSD, 2.10BSD, 2.11BSD manual pages.
 
 --
-Copyright (c) 1997-2007 Wolfram Schneider 
+Copyright (c) 1997-2012 Wolfram Schneider 
 URL: http://cvsweb.freebsd.org/src/share/misc/bsd-family-tree
 
 $FreeBSD$
___
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: r230044 - in head: usr.bin/mail usr.bin/tftp usr.bin/unzip usr.sbin/config usr.sbin/lpr/lpc usr.sbin/timed/timedc

2012-01-12 Thread Kevin Lo
Author: kevlo
Date: Fri Jan 13 06:51:15 2012
New Revision: 230044
URL: http://svn.freebsd.org/changeset/base/230044

Log:
  fgets(3) returns a pointer, so compare against NULL, not integer 0.

Modified:
  head/usr.bin/mail/edit.c
  head/usr.bin/tftp/main.c
  head/usr.bin/unzip/unzip.c
  head/usr.sbin/config/mkmakefile.c
  head/usr.sbin/lpr/lpc/lpc.c
  head/usr.sbin/timed/timedc/timedc.c

Modified: head/usr.bin/mail/edit.c
==
--- head/usr.bin/mail/edit.cFri Jan 13 06:18:23 2012(r230043)
+++ head/usr.bin/mail/edit.cFri Jan 13 06:51:15 2012(r230044)
@@ -89,7 +89,7 @@ edit1(int *msgvec, int type)
char *p;
 
printf("Edit message %d [ynq]? ", msgvec[i]);
-   if (fgets(buf, sizeof(buf), stdin) == 0)
+   if (fgets(buf, sizeof(buf), stdin) == NULL)
break;
for (p = buf; *p == ' ' || *p == '\t'; p++)
;

Modified: head/usr.bin/tftp/main.c
==
--- head/usr.bin/tftp/main.cFri Jan 13 06:18:23 2012(r230043)
+++ head/usr.bin/tftp/main.cFri Jan 13 06:51:15 2012(r230044)
@@ -734,7 +734,7 @@ command(void)
 history(hist, &he, H_ENTER, bp);
} else {
line[0] = 0;
-   if (fgets(line, sizeof line , stdin) == 0) {
+   if (fgets(line, sizeof line , stdin) == NULL) {
if (feof(stdin)) {
exit(txrx_error);
} else {

Modified: head/usr.bin/unzip/unzip.c
==
--- head/usr.bin/unzip/unzip.c  Fri Jan 13 06:18:23 2012(r230043)
+++ head/usr.bin/unzip/unzip.c  Fri Jan 13 06:51:15 2012(r230044)
@@ -422,7 +422,7 @@ handle_existing_file(char **path)
fprintf(stderr,
"replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ",
*path);
-   if (fgets(buf, sizeof(buf), stdin) == 0) {
+   if (fgets(buf, sizeof(buf), stdin) == NULL) {
clearerr(stdin);
printf("NULL\n(EOF or read error, "
"treating as \"[N]one\"...)\n");

Modified: head/usr.sbin/config/mkmakefile.c
==
--- head/usr.sbin/config/mkmakefile.c   Fri Jan 13 06:18:23 2012
(r230043)
+++ head/usr.sbin/config/mkmakefile.c   Fri Jan 13 06:51:15 2012
(r230044)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1993, 19801990
+ * Copyright (c) 1980, 1993
  * The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -154,7 +154,7 @@ makefile(void)
fprintf(ofp, "PROFLEVEL=%d\n", profiling);
if (*srcdir != '\0')
fprintf(ofp,"S=%s\n", srcdir);
-   while (fgets(line, BUFSIZ, ifp) != 0) {
+   while (fgets(line, BUFSIZ, ifp) != NULL) {
if (*line != '%') {
fprintf(ofp, "%s", line);
continue;
@@ -204,7 +204,7 @@ makehints(void)
ifp = fopen(hint->hint_name, "r");
if (ifp == NULL)
err(1, "%s", hint->hint_name);
-   while (fgets(line, BUFSIZ, ifp) != 0) {
+   while (fgets(line, BUFSIZ, ifp) != NULL) {
/* zap trailing CR and/or LF */
while ((s = strrchr(line, '\n')) != NULL)
*s = '\0';
@@ -266,7 +266,7 @@ makeenv(void)
fprintf(ofp, "int envmode = %d;\n", envmode);
fprintf(ofp, "char static_env[] = {\n");
if (ifp) {
-   while (fgets(line, BUFSIZ, ifp) != 0) {
+   while (fgets(line, BUFSIZ, ifp) != NULL) {
/* zap trailing CR and/or LF */
while ((s = strrchr(line, '\n')) != NULL)
*s = '\0';

Modified: head/usr.sbin/lpr/lpc/lpc.c
==
--- head/usr.sbin/lpr/lpc/lpc.c Fri Jan 13 06:18:23 2012(r230043)
+++ head/usr.sbin/lpr/lpc/lpc.c Fri Jan 13 06:51:15 2012(r230044)
@@ -188,7 +188,7 @@ cmdscanner(void)
history(hist, &he, H_ENTER, bp);
 
} else {
-   if (fgets(cmdline, MAX_CMDLINE, stdin) == 0)
+   if (fgets(cmdline, MAX_CMDLINE, stdin) == NULL)
quit(0, NULL);
if (cmdline[0] == 0 || cmdline[0] == '\n')

svn commit: r230045 - head/sbin/routed

2012-01-12 Thread Kevin Lo
Author: kevlo
Date: Fri Jan 13 06:56:59 2012
New Revision: 230045
URL: http://svn.freebsd.org/changeset/base/230045

Log:
  Fix a style bug

Modified:
  head/sbin/routed/parms.c

Modified: head/sbin/routed/parms.c
==
--- head/sbin/routed/parms.cFri Jan 13 06:51:15 2012(r230044)
+++ head/sbin/routed/parms.cFri Jan 13 06:56:59 2012(r230045)
@@ -188,7 +188,7 @@ gwkludge(void)
}
 
for (lnum = 1; ; lnum++) {
-   if (0 == fgets(lbuf, sizeof(lbuf), fp))
+   if (fgets(lbuf, sizeof(lbuf), fp) == NULL)
break;
lptr = lbuf;
while (*lptr == ' ')
___
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: r230046 - head/sys/mips/mips

2012-01-12 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 13 07:00:47 2012
New Revision: 230046
URL: http://svn.freebsd.org/changeset/base/230046

Log:
  - Fix .rela case of R_MIPS_26 relocation. Addednds save diferently for
  .rel and .rela sections. It's shifted right two bits for former
 but saved as-is for latter.

Modified:
  head/sys/mips/mips/elf_machdep.c

Modified: head/sys/mips/mips/elf_machdep.c
==
--- head/sys/mips/mips/elf_machdep.cFri Jan 13 06:56:59 2012
(r230045)
+++ head/sys/mips/mips/elf_machdep.cFri Jan 13 07:00:47 2012
(r230046)
@@ -227,7 +227,11 @@ elf_reloc_internal(linker_file_t lf, Elf
return (-1);
 
addend &= 0x03ff;
-   addend <<= 2;
+   /*
+* Addendum for .rela R_MIPS_26 is not shifted right
+*/
+   if (rela == NULL)
+   addend <<= 2;
 
addr += ((Elf_Addr)where & 0xf000) | addend;
addr >>= 2;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r230047 - stable/9/sbin/dump

2012-01-12 Thread Kirk McKusick
Author: mckusick
Date: Fri Jan 13 07:08:21 2012
New Revision: 230047
URL: http://svn.freebsd.org/changeset/base/230047

Log:
  MFC: 226520
  
  The current /etc/dumpdates file restricts device names to 32 characters.
  With the addition of various GEOM layers some device names now exceed
  this length, for example /dev/mirror/encrypted.elig.journal. This
  change expands the field to 53 bytes which brings the /etc/dumpdates
  lines to 80 characters. Exceeding 80 characters makes the /etc/dumpdates
  file much less human readable. A test is added to dump so that it
  verifies that the device name will fit in the 53 character field
  failing the dump if it is too long.
  
  This change has been checked to verify that its /etc/dumpdates file
  is compatible with older versions of dump.
  
  Reported by: Martin Sugioarto 
  PR:  kern/160678

Modified:
  stable/9/sbin/dump/dump.h
  stable/9/sbin/dump/itime.c
Directory Properties:
  stable/9/sbin/dump/   (props changed)

Modified: stable/9/sbin/dump/dump.h
==
--- stable/9/sbin/dump/dump.h   Fri Jan 13 07:00:47 2012(r230046)
+++ stable/9/sbin/dump/dump.h   Fri Jan 13 07:08:21 2012(r230047)
@@ -171,9 +171,10 @@ void   putdumptime(void);
if (ddatev != NULL) \
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
 
-#defineDUMPOUTFMT  "%-32s %d %s"   /* for printf */
+#defineDUMPFMTLEN  53  /* max device pathname 
length */
+#defineDUMPOUTFMT  "%-*s %d %s"/* for printf */
/* name, level, ctime(date) */
-#defineDUMPINFMT   "%32s %d %[^\n]\n"  /* inverse for scanf */
+#defineDUMPINFMT   "%s %d %[^\n]\n"/* inverse for scanf */
 
 void   sig(int signo);
 

Modified: stable/9/sbin/dump/itime.c
==
--- stable/9/sbin/dump/itime.c  Fri Jan 13 07:00:47 2012(r230046)
+++ stable/9/sbin/dump/itime.c  Fri Jan 13 07:08:21 2012(r230047)
@@ -222,7 +222,10 @@ static void
 dumprecout(FILE *file, const struct dumpdates *what)
 {
 
-   if (fprintf(file, DUMPOUTFMT, what->dd_name,
+   if (strlen(what->dd_name) > DUMPFMTLEN)
+   quit("Name '%s' exceeds DUMPFMTLEN (%d) bytes\n",
+   what->dd_name, DUMPFMTLEN);
+   if (fprintf(file, DUMPOUTFMT, DUMPFMTLEN, what->dd_name,
  what->dd_level, ctime(&what->dd_ddate)) < 0)
quit("%s: %s\n", dumpdates, strerror(errno));
 }
___
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: r230048 - stable/8/sbin/dump

2012-01-12 Thread Kirk McKusick
Author: mckusick
Date: Fri Jan 13 07:10:52 2012
New Revision: 230048
URL: http://svn.freebsd.org/changeset/base/230048

Log:
  MFC: 226520
  
  The current /etc/dumpdates file restricts device names to 32 characters.
  With the addition of various GEOM layers some device names now exceed
  this length, for example /dev/mirror/encrypted.elig.journal. This
  change expands the field to 53 bytes which brings the /etc/dumpdates
  lines to 80 characters. Exceeding 80 characters makes the /etc/dumpdates
  file much less human readable. A test is added to dump so that it
  verifies that the device name will fit in the 53 character field
  failing the dump if it is too long.
  
  This change has been checked to verify that its /etc/dumpdates file
  is compatible with older versions of dump.
  
  Reported by: Martin Sugioarto 
  PR:  kern/160678

Modified:
  stable/8/sbin/dump/dump.h
  stable/8/sbin/dump/itime.c
Directory Properties:
  stable/8/sbin/dump/   (props changed)

Modified: stable/8/sbin/dump/dump.h
==
--- stable/8/sbin/dump/dump.h   Fri Jan 13 07:08:21 2012(r230047)
+++ stable/8/sbin/dump/dump.h   Fri Jan 13 07:10:52 2012(r230048)
@@ -171,9 +171,10 @@ void   putdumptime(void);
if (ddatev != NULL) \
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
 
-#defineDUMPOUTFMT  "%-32s %d %s"   /* for printf */
+#defineDUMPFMTLEN  53  /* max device pathname 
length */
+#defineDUMPOUTFMT  "%-*s %d %s"/* for printf */
/* name, level, ctime(date) */
-#defineDUMPINFMT   "%32s %d %[^\n]\n"  /* inverse for scanf */
+#defineDUMPINFMT   "%s %d %[^\n]\n"/* inverse for scanf */
 
 void   sig(int signo);
 

Modified: stable/8/sbin/dump/itime.c
==
--- stable/8/sbin/dump/itime.c  Fri Jan 13 07:08:21 2012(r230047)
+++ stable/8/sbin/dump/itime.c  Fri Jan 13 07:10:52 2012(r230048)
@@ -222,7 +222,10 @@ static void
 dumprecout(FILE *file, const struct dumpdates *what)
 {
 
-   if (fprintf(file, DUMPOUTFMT, what->dd_name,
+   if (strlen(what->dd_name) > DUMPFMTLEN)
+   quit("Name '%s' exceeds DUMPFMTLEN (%d) bytes\n",
+   what->dd_name, DUMPFMTLEN);
+   if (fprintf(file, DUMPOUTFMT, DUMPFMTLEN, what->dd_name,
  what->dd_level, ctime(&what->dd_ddate)) < 0)
quit("%s: %s\n", dumpdates, strerror(errno));
 }
___
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: r230049 - stable/9/sbin/newfs

2012-01-12 Thread Kirk McKusick
Author: mckusick
Date: Fri Jan 13 07:19:02 2012
New Revision: 230049
URL: http://svn.freebsd.org/changeset/base/230049

Log:
  MFC: 228794
  
  Reduce NFPI by half to keep the default number of inodes the same with
  the now default 32K/4K filesystem the same as the number of inodes in
  the previously default 16K/2K filesystem.
  
  PR:  bin/162659
  Reported by: Olivier Cochard-Labbe 

Modified:
  stable/9/sbin/newfs/newfs.h
Directory Properties:
  stable/9/sbin/newfs/   (props changed)

Modified: stable/9/sbin/newfs/newfs.h
==
--- stable/9/sbin/newfs/newfs.h Fri Jan 13 07:10:52 2012(r230048)
+++ stable/9/sbin/newfs/newfs.h Fri Jan 13 07:19:02 2012(r230049)
@@ -70,7 +70,7 @@
  * We allocate one inode slot per NFPI fragments, expecting this
  * to be far more than we will ever need.
  */
-#defineNFPI4
+#defineNFPI2
 
 /*
  * variables set up by front end.
___
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: r230050 - in head/sys/dev/usb: . controller

2012-01-12 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jan 13 07:28:34 2012
New Revision: 230050
URL: http://svn.freebsd.org/changeset/base/230050

Log:
  Correct use of USB 3.0 POWER bit in the port status register,
  hence it was overlapping the USB 3.0 root HUB's speed bits.
  
  Reported by:  Kohji Okuno
  MFC after:1 week

Modified:
  head/sys/dev/usb/controller/xhci.c
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/controller/xhci.c
==
--- head/sys/dev/usb/controller/xhci.c  Fri Jan 13 07:19:02 2012
(r230049)
+++ head/sys/dev/usb/controller/xhci.c  Fri Jan 13 07:28:34 2012
(r230050)
@@ -3194,8 +3194,13 @@ xhci_roothub_exec(struct usb_device *ude
i |= UPS_OVERCURRENT_INDICATOR;
if (v & XHCI_PS_PR)
i |= UPS_RESET;
-   if (v & XHCI_PS_PP)
-   i |= UPS_PORT_POWER_SS;
+   if (v & XHCI_PS_PP) {
+   /*
+* The USB 3.0 RH is using the
+* USB 2.0's power bit
+*/
+   i |= UPS_PORT_POWER;
+   }
USETW(sc->sc_hub_desc.ps.wPortStatus, i);
 
i = 0;

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Fri Jan 13 07:19:02 2012(r230049)
+++ head/sys/dev/usb/usb_hub.c  Fri Jan 13 07:28:34 2012(r230050)
@@ -327,6 +327,7 @@ uhub_reattach_port(struct uhub_softc *sc
enum usb_dev_speed speed;
enum usb_hc_mode mode;
usb_error_t err;
+   uint16_t power_mask;
uint8_t timeout;
 
DPRINTF("reattaching port %d\n", portno);
@@ -373,20 +374,22 @@ repeat:
case USB_SPEED_HIGH:
case USB_SPEED_FULL:
case USB_SPEED_LOW:
-   if (!(sc->sc_st.port_status & UPS_PORT_POWER)) {
-   DPRINTF("WARNING: strange, connected port %d "
-   "has no power\n", portno);
-   }
+   power_mask = UPS_PORT_POWER;
break;
case USB_SPEED_SUPER:
-   if (!(sc->sc_st.port_status & UPS_PORT_POWER_SS)) {
-   DPRINTF("WARNING: strange, connected port %d "
-   "has no power\n", portno);
-   }
+   if (udev->parent_hub == NULL)
+   power_mask = UPS_PORT_POWER;
+   else
+   power_mask = UPS_PORT_POWER_SS;
break;
default:
+   power_mask = 0;
break;
}
+   if (!(sc->sc_st.port_status & power_mask)) {
+   DPRINTF("WARNING: strange, connected port %d "
+   "has no power\n", portno);
+   }
 
/* check if the device is in Host Mode */
 
___
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: r229981 - in head/sys: conf dev/sound/pci gnu/dev/sound/pci modules/sound/driver/emu10kx

2012-01-12 Thread Joel Dahl
On 12-01-2012 11:33, Pedro Giffuni wrote:
> Hello;
> 
> --- Gio 12/1/12, John Baldwin  ha scritto:
> 
> > Da: John Baldwin 
> > Oggetto: Re: svn commit: r229981 - in head/sys: conf dev/sound/pci 
> > gnu/dev/sound/pci modules/sound/driver/emu10kx
> > A: "Pedro F. Giffuni" 
> > Cc: src-committ...@freebsd.org, svn-src-all@freebsd.org, 
> > svn-src-h...@freebsd.org, j...@freebsd.org
> > Data: Giovedì 12 gennaio 2012, 07:43
> > On Wednesday, January 11, 2012
> > 4:17:14 pm Pedro F. Giffuni wrote:
> > > Author: pfg
> > > Date: Wed Jan 11 21:17:14 2012
> > > New Revision: 229981
> > > URL: http://svn.freebsd.org/changeset/base/229981
> > >
> ...   
> > >   The emu10kx driver is now free from the GPL.
> > >   
> > >   PR:        153901
> > >   Tested by:    mav, joel
> > >   Approved by:    jhb (mentor)
> > >   MFC after:    2 weeks
> > 
> > Is the emu10kx driver a superset of em10k1 now (meaning
> > does it support all
> > the em10k1 devices and should em10k1 be retired)?
> > 
> 
> Both device drivers seem to have diverged significantly
> and while emu10kx seems to be superior, some people still
> have problems with it:
> 
> http://docs.freebsd.org/cgi/mid.cgi?201201100024.q0A0OF24069073

This has already been fixed and MFC'd, AFAIK.

-- 
Joel
___
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"