svn commit: r338422 - in head/sys: dev/sound/midi dev/sound/pci modules/sound/driver/csa

2018-09-01 Thread Tai-hwa Liang
Author: avatar
Date: Sat Sep  1 11:26:53 2018
New Revision: 338422
URL: https://svnweb.freebsd.org/changeset/base/338422

Log:
  Adding support for CS46xx MIDI output. With this patch, users can
  play the MIDI files through /dev/sequencer device with tools like
  playmidi. The audio output will go through the external MIDI device
  such like wavetable synthesis card.
  
  Reviewed by:  matk (a long time ago), kib
  Approved by:  re (kib)
  Tested with:  Terratec SiXPack 5.1+ + Yamaha DB50XG
  MFC after:4 weeks

Added:
  head/sys/dev/sound/pci/csamidi.c   (contents, props changed)
Modified:
  head/sys/dev/sound/midi/midi.c
  head/sys/modules/sound/driver/csa/Makefile

Modified: head/sys/dev/sound/midi/midi.c
==
--- head/sys/dev/sound/midi/midi.c  Sat Sep  1 10:03:30 2018
(r338421)
+++ head/sys/dev/sound/midi/midi.c  Sat Sep  1 11:26:53 2018
(r338422)
@@ -1467,18 +1467,14 @@ midi_modevent(module_t mod, int type, void *data)
switch (type) {
case MOD_LOAD:
retval = midi_load();
-#if 0
if (retval == 0)
retval = seq_modevent(mod, type, data);
-#endif
break;
 
case MOD_UNLOAD:
retval = midi_unload();
-#if 0
if (retval == 0)
retval = seq_modevent(mod, type, data);
-#endif
break;
 
default:

Added: head/sys/dev/sound/pci/csamidi.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/sound/pci/csamidi.cSat Sep  1 11:26:53 2018
(r338422)
@@ -0,0 +1,290 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+
+ * Copyright (c) 2015-2018 Tai-hwa Liang 
+ * All rights reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef HAVE_KERNEL_OPTION_HEADERS
+#include "opt_snd.h"
+#endif
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "mpufoi_if.h"
+
+SND_DECLARE_FILE("$FreeBSD$");
+
+/* pulled from mpu401.c */
+#defineMPU_DATAPORT0
+#defineMPU_CMDPORT 1
+#defineMPU_STATPORT1
+#defineMPU_RESET   0xff
+#defineMPU_UART0x3f
+#defineMPU_ACK 0xfe
+#defineMPU_STATMASK0xc0
+#defineMPU_OUTPUTBUSY  0x40
+#defineMPU_INPUTBUSY   0x80
+
+/* device private data */
+struct csa_midi_softc {
+   /* hardware resources */
+   int io_rid; /* io rid */
+   struct resource *io;/* io */
+
+   struct mtx  mtx;
+   device_tdev;
+   struct mpu401   *mpu;
+   mpu401_intr_t   *mpu_intr;
+   int mflags; /* MIDI flags */
+};
+
+static struct kobj_class csamidi_mpu_class;
+static devclass_t midicsa_devclass;
+
+static u_int32_t
+csamidi_readio(struct csa_midi_softc *scp, u_long offset)
+{
+   if (offset < BA0_AC97_RESET)
+   return bus_space_read_4(rman_get_bustag(scp->io), 
rman_get_bushandle(scp->io), offset) & 0x;
+   else
+   return (0);
+}
+
+static void
+csamidi_writeio(struct csa_midi_softc *scp, u_long offset, u_int32_t data)
+{
+   if (offset < BA0_AC97_RESET)
+   bus_space_write_4(rman_get_bustag(scp->io), 
rman_get_bushandle(scp->io), offset, data);
+}
+
+static void
+csamidi_midi_intr(void *arg)
+{
+   struct csa_mid

svn commit: r338200 - head/sys/dev/sound/pci

2018-08-22 Thread Tai-hwa Liang
Author: avatar
Date: Wed Aug 22 14:06:31 2018
New Revision: 338200
URL: https://svnweb.freebsd.org/changeset/base/338200

Log:
  Adding device ID for Terratec SiXPack 5.1+.
  
  MFC after:3 days

Modified:
  head/sys/dev/sound/pci/csa.c

Modified: head/sys/dev/sound/pci/csa.c
==
--- head/sys/dev/sound/pci/csa.cWed Aug 22 13:47:06 2018
(r338199)
+++ head/sys/dev/sound/pci/csa.cWed Aug 22 14:06:31 2018
(r338200)
@@ -169,6 +169,7 @@ static struct csa_card cards_4614[] = {
{0x1014, 0x0132, "Thinkpad 570", amp_none, NULL, NULL, 0},
{0x1014, 0x0153, "Thinkpad 600X/A20/T20", amp_none, NULL, clkrun_hack, 
0},
{0x1014, 0x1010, "Thinkpad 600E (unsupported)", NULL, NULL, NULL, 0},
+   {0x153b, 0x1136, "Terratec SiXPack 5.1+", NULL, NULL, NULL, 0},
{0, 0, "Unknown/invalid SSID (CS4614)", NULL, NULL, NULL, 0},
 };
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r338038 - head/sys/dev/sound/pci

2018-08-18 Thread Tai-hwa Liang
Author: avatar
Date: Sun Aug 19 01:14:46 2018
New Revision: 338038
URL: https://svnweb.freebsd.org/changeset/base/338038

Log:
  Extending the delay cycles to give the codec more time to pump ADC data 
across the AC-link.
  
  Without this patch, some CS4614 cards will need users to reload the driver 
manually or
  the hardware won't be initialised properly. Something like:
  
# kldload snd_csa
# kldunload snd_csa
# kldload snd_csa
  
  Tested with:  Terratec SiXPack 5.1+

Modified:
  head/sys/dev/sound/pci/csa.c

Modified: head/sys/dev/sound/pci/csa.c
==
--- head/sys/dev/sound/pci/csa.cSun Aug 19 00:46:22 2018
(r338037)
+++ head/sys/dev/sound/pci/csa.cSun Aug 19 01:14:46 2018
(r338038)
@@ -710,7 +710,7 @@ csa_initialize(sc_p scp)
 * the codec is pumping ADC data across the AC-link.
 */
acisv = 0;
-   for (i = 0 ; i < 1000 ; i++) {
+   for (i = 0 ; i < 2000 ; i++) {
/*
 * First, lets wait a short while to let things settle out a 
bit,
 * and to prevent retrying the read too quickly.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-04-09 Thread Tai-hwa Liang
Author: avatar
Date: Sun Apr  9 15:27:04 2017
New Revision: 316658
URL: https://svnweb.freebsd.org/changeset/base/316658

Log:
  Adding SIOCGIFNAME support in Linuxulator.  This should silence the console 
warning associated
  with linux-opera:
linux: pid 23492 (opera): ioctl fd=5, cmd=0x8910 ('\M^I',16) is not 
implemented
linux: pid 23492 (opera): ioctl fd=28, cmd=0x8910 ('\M^I',16) is not 
implemented
...
  
  Reviewed by:  kib, marcel, dchagin
  Tested with:  linux-opera-12.16_3
  MFC after:1 month

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

Modified: head/sys/compat/linux/linux_ioctl.c
==
--- head/sys/compat/linux/linux_ioctl.c Sun Apr  9 15:17:55 2017
(r316657)
+++ head/sys/compat/linux/linux_ioctl.c Sun Apr  9 15:27:04 2017
(r316658)
@@ -2167,6 +2167,49 @@ ifname_linux_to_bsd(struct thread *td, c
 }
 
 /*
+ * Implement the SIOCGIFNAME ioctl
+ */
+
+static int
+linux_ioctl_ifname(struct thread *td, struct l_ifreq *uifr)
+{
+   struct l_ifreq ifr;
+   struct ifnet *ifp;
+   int error, ethno, index;
+
+   error = copyin(uifr, &ifr, sizeof(ifr));
+   if (error != 0)
+   return (error);
+
+   CURVNET_SET(TD_TO_VNET(curthread));
+   IFNET_RLOCK();
+   index = 1;  /* ifr.ifr_ifindex starts from 1 */
+   ethno = 0;
+   error = ENODEV;
+   TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
+   if (ifr.ifr_ifindex == index) {
+   if (IFP_IS_ETH(ifp))
+   snprintf(ifr.ifr_name, LINUX_IFNAMSIZ,
+   "eth%d", ethno);
+   else
+   strlcpy(ifr.ifr_name, ifp->if_xname,
+   LINUX_IFNAMSIZ);
+   error = 0;
+   break;
+   }
+   if (IFP_IS_ETH(ifp))
+   ethno++;
+   index++;
+   }
+   IFNET_RUNLOCK();
+   if (error == 0)
+   error = copyout(&ifr, uifr, sizeof(ifr));
+   CURVNET_RESTORE();
+
+   return (error);
+}
+
+/*
  * Implement the SIOCGIFCONF ioctl
  */
 
@@ -2393,6 +2436,7 @@ linux_ioctl_socket(struct thread *td, st
case LINUX_SIOCADDMULTI:
case LINUX_SIOCATMARK:
case LINUX_SIOCDELMULTI:
+   case LINUX_SIOCGIFNAME:
case LINUX_SIOCGIFCONF:
case LINUX_SIOCGPGRP:
case LINUX_SIOCSPGRP:
@@ -2478,6 +2522,10 @@ linux_ioctl_socket(struct thread *td, st
 
/* LINUX_SIOCGSTAMP */
 
+   case LINUX_SIOCGIFNAME:
+   error = linux_ioctl_ifname(td, (struct l_ifreq *)args->arg);
+   break;
+
case LINUX_SIOCGIFCONF:
error = linux_ifconf(td, (struct ifconf *)args->arg);
break;

Modified: head/sys/compat/linux/linux_ioctl.h
==
--- head/sys/compat/linux/linux_ioctl.h Sun Apr  9 15:17:55 2017
(r316657)
+++ head/sys/compat/linux/linux_ioctl.h Sun Apr  9 15:27:04 2017
(r316658)
@@ -226,6 +226,7 @@
 #defineLINUX_SIOCGPGRP 0x8904
 #defineLINUX_SIOCATMARK0x8905
 #defineLINUX_SIOCGSTAMP0x8906
+#defineLINUX_SIOCGIFNAME   0x8910
 #defineLINUX_SIOCGIFCONF   0x8912
 #defineLINUX_SIOCGIFFLAGS  0x8913
 #defineLINUX_SIOCGIFADDR   0x8915
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316644 - in head/sys: amd64/linux amd64/linux32 i386/linux

2017-04-08 Thread Tai-hwa Liang
Author: avatar
Date: Sat Apr  8 14:41:39 2017
New Revision: 316644
URL: https://svnweb.freebsd.org/changeset/base/316644

Log:
  Trying to be more compatible with Linux if.h definitions:
- renaming l_ifreq::ifru_metric to l_ifreq::ifru_ivalue;
- adding a definition for ifr_ifindex which points to 
l_ifreq::ifru_ivalue.
  
  A quick search indicates that Linux already got the above changes since 
2.1.14.
  
  Reviewed by:  kib, marcel, dchagin
  MFC after:1 week

Modified:
  head/sys/amd64/linux/linux.h
  head/sys/amd64/linux32/linux.h
  head/sys/i386/linux/linux.h

Modified: head/sys/amd64/linux/linux.h
==
--- head/sys/amd64/linux/linux.hSat Apr  8 14:16:42 2017
(r316643)
+++ head/sys/amd64/linux/linux.hSat Apr  8 14:41:39 2017
(r316644)
@@ -412,7 +412,7 @@ struct l_ifreq {
struct l_sockaddr   ifru_netmask;
struct l_sockaddr   ifru_hwaddr;
l_short ifru_flags[1];
-   l_int   ifru_metric;
+   l_int   ifru_ivalue;
l_int   ifru_mtu;
struct l_ifmap  ifru_map;
charifru_slave[LINUX_IFNAMSIZ];
@@ -422,6 +422,7 @@ struct l_ifreq {
 
 #defineifr_nameifr_ifrn.ifrn_name  /* Interface name */
 #defineifr_hwaddr  ifr_ifru.ifru_hwaddr/* MAC address */
+#defineifr_ifindex ifr_ifru.ifru_ivalue/* Interface index */
 
 struct l_ifconf {
int ifc_len;

Modified: head/sys/amd64/linux32/linux.h
==
--- head/sys/amd64/linux32/linux.h  Sat Apr  8 14:16:42 2017
(r316643)
+++ head/sys/amd64/linux32/linux.h  Sat Apr  8 14:41:39 2017
(r316644)
@@ -503,7 +503,7 @@ struct l_ifreq {
struct l_sockaddr   ifru_netmask;
struct l_sockaddr   ifru_hwaddr;
l_short ifru_flags[1];
-   l_int   ifru_metric;
+   l_int   ifru_ivalue;
l_int   ifru_mtu;
struct l_ifmap  ifru_map;
charifru_slave[LINUX_IFNAMSIZ];
@@ -513,6 +513,7 @@ struct l_ifreq {
 
 #defineifr_nameifr_ifrn.ifrn_name  /* Interface name */
 #defineifr_hwaddr  ifr_ifru.ifru_hwaddr/* MAC address */
+#defineifr_ifindex ifr_ifru.ifru_ivalue/* Interface index */
 
 struct l_ifconf {
int ifc_len;

Modified: head/sys/i386/linux/linux.h
==
--- head/sys/i386/linux/linux.h Sat Apr  8 14:16:42 2017(r316643)
+++ head/sys/i386/linux/linux.h Sat Apr  8 14:41:39 2017(r316644)
@@ -482,7 +482,7 @@ struct l_ifreq {
struct l_sockaddr   ifru_netmask;
struct l_sockaddr   ifru_hwaddr;
l_short ifru_flags[1];
-   l_int   ifru_metric;
+   l_int   ifru_ivalue;
l_int   ifru_mtu;
struct l_ifmap  ifru_map;
charifru_slave[LINUX_IFNAMSIZ];
@@ -492,6 +492,7 @@ struct l_ifreq {
 
 #defineifr_nameifr_ifrn.ifrn_name  /* Interface name */
 #defineifr_hwaddr  ifr_ifru.ifru_hwaddr/* MAC address */
+#defineifr_ifindex ifr_ifru.ifru_ivalue/* Interface index */
 
 /*
  * poll()
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289888 - head/sys/dev/sound/midi

2015-10-24 Thread Tai-hwa Liang
Author: avatar
Date: Sat Oct 24 19:40:03 2015
New Revision: 289888
URL: https://svnweb.freebsd.org/changeset/base/289888

Log:
  - Plugging a memory leak when malloc() failed during initialisation;
  - Plugging another memory leak inside the destructor.
  
  Reviewed by:  matk
  MFC after:3 weeks

Modified:
  head/sys/dev/sound/midi/midi.c

Modified: head/sys/dev/sound/midi/midi.c
==
--- head/sys/dev/sound/midi/midi.c  Sat Oct 24 19:39:41 2015
(r289887)
+++ head/sys/dev/sound/midi/midi.c  Sat Oct 24 19:40:03 2015
(r289888)
@@ -319,6 +319,8 @@ midi_init(kobj_class_t cls, int unit, in
goto err0;
 
m->synth = malloc(sizeof(*m->synth), M_MIDI, M_NOWAIT | M_ZERO);
+   if (m->synth == NULL)
+   goto err1;
kobj_init((kobj_t)m->synth, &midisynth_class);
m->synth->m = m;
kobj_init((kobj_t)m, cls);
@@ -327,7 +329,7 @@ midi_init(kobj_class_t cls, int unit, in
 
MIDI_DEBUG(1, printf("midiinit queues %d/%d.\n", inqsize, outqsize));
if (!inqsize && !outqsize)
-   goto err1;
+   goto err2;
 
mtx_init(&m->lock, "raw midi", NULL, 0);
mtx_init(&m->qlock, "q raw midi", NULL, 0);
@@ -352,7 +354,7 @@ midi_init(kobj_class_t cls, int unit, in
 
if ((inqsize && !MIDIQ_BUF(m->inq)) ||
(outqsize && !MIDIQ_BUF(m->outq)))
-   goto err2;
+   goto err3;
 
 
m->busy = 0;
@@ -362,7 +364,7 @@ midi_init(kobj_class_t cls, int unit, in
m->cookie = cookie;
 
if (MPU_INIT(m, cookie))
-   goto err2;
+   goto err3;
 
mtx_unlock(&m->lock);
mtx_unlock(&m->qlock);
@@ -378,13 +380,14 @@ midi_init(kobj_class_t cls, int unit, in
 
return m;
 
-err2:  mtx_destroy(&m->qlock);
+err3:  mtx_destroy(&m->qlock);
mtx_destroy(&m->lock);
 
if (MIDIQ_BUF(m->inq))
free(MIDIQ_BUF(m->inq), M_MIDI);
if (MIDIQ_BUF(m->outq))
free(MIDIQ_BUF(m->outq), M_MIDI);
+err2:  free(m->synth, M_MIDI);
 err1:  free(m, M_MIDI);
 err0:  mtx_unlock(&midistat_lock);
MIDI_DEBUG(1, printf("midi_init ended in error\n"));
@@ -1388,6 +1391,7 @@ midi_destroy(struct snd_midi *m, int mid
free(MIDIQ_BUF(m->outq), M_MIDI);
mtx_destroy(&m->qlock);
mtx_destroy(&m->lock);
+   free(m->synth, M_MIDI);
free(m, M_MIDI);
return 0;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r287698 - head/sys/gnu/fs/reiserfs

2015-09-11 Thread Tai-hwa Liang
Author: avatar
Date: Fri Sep 11 22:43:35 2015
New Revision: 287698
URL: https://svnweb.freebsd.org/changeset/base/287698

Log:
  Fixing a memory leak on module unloading.
  
  MFC after:3 weeks

Modified:
  head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c

Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
==
--- head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c  Fri Sep 11 22:42:26 2015
(r287697)
+++ head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c  Fri Sep 11 22:43:35 2015
(r287698)
@@ -1022,6 +1022,7 @@ uint32_t find_hash_out(struct reiserfs_m
}
} while (0);
 
+   free(ip, M_REISERFSNODE);
pathrelse(&path);
return (hash);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r286888 - head/sys/gnu/fs/reiserfs

2015-08-18 Thread Tai-hwa Liang
Author: avatar
Date: Tue Aug 18 13:16:23 2015
New Revision: 286888
URL: https://svnweb.freebsd.org/changeset/base/286888

Log:
  Using consistent coding style to deal with error inside the loop.
  
  MFC after:1 week

Modified:
  head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c

Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
==
--- head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c  Tue Aug 18 13:16:06 2015
(r286887)
+++ head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c  Tue Aug 18 13:16:23 2015
(r286888)
@@ -960,8 +960,8 @@ uint32_t find_hash_out(struct reiserfs_m
key.on_disk_key.k_objectid, key.on_disk_key.k_dir_id);
retval = search_by_entry_key(sbi, &key, &path, &de);
if (retval == IO_ERROR) {
-   pathrelse(&path);
-   return (UNSET_HASH);
+   hash = UNSET_HASH;
+   break;
}
if (retval == NAME_NOT_FOUND)
de.de_entry_num--;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r286887 - head/sys/dev/sound/midi

2015-08-18 Thread Tai-hwa Liang
Author: avatar
Date: Tue Aug 18 13:16:06 2015
New Revision: 286887
URL: https://svnweb.freebsd.org/changeset/base/286887

Log:
  Using the error return code documented in the comment.
  
  Though there is no direct midi_uninit() caller amongst existing drivers
  at this moment, a quick experiment indicates that EBUSY gives users more
  precise error message once drivers start to honour this result.  For example,
  emu_midi_detach() should check the result of mpu401_uninit() and block
  module unloading if there is any MIDI I/O in progress.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/sound/midi/midi.c

Modified: head/sys/dev/sound/midi/midi.c
==
--- head/sys/dev/sound/midi/midi.c  Tue Aug 18 12:50:46 2015
(r286886)
+++ head/sys/dev/sound/midi/midi.c  Tue Aug 18 13:16:06 2015
(r286887)
@@ -403,7 +403,7 @@ midi_uninit(struct snd_midi *m)
 {
int err;
 
-   err = ENXIO;
+   err = EBUSY;
mtx_lock(&midistat_lock);
mtx_lock(&m->lock);
if (m->busy) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r286886 - head/sys/dev/sound/midi

2015-08-18 Thread Tai-hwa Liang
Author: avatar
Date: Tue Aug 18 12:50:46 2015
New Revision: 286886
URL: https://svnweb.freebsd.org/changeset/base/286886

Log:
  Fixing typo as well as improving readability of a few comments.
  
  MFC after:3 days

Modified:
  head/sys/dev/sound/midi/midi.c

Modified: head/sys/dev/sound/midi/midi.c
==
--- head/sys/dev/sound/midi/midi.c  Tue Aug 18 12:27:21 2015
(r286885)
+++ head/sys/dev/sound/midi/midi.c  Tue Aug 18 12:50:46 2015
(r286886)
@@ -86,7 +86,7 @@ enum midi_states {
 };
 
 /*
- * The MPU interface current has init() uninit() inqsize(( outqsize()
+ * The MPU interface current has init() uninit() inqsize() outqsize()
  * callback() : fiddle with the tx|rx status.
  */
 
@@ -160,10 +160,15 @@ DEFINE_CLASS(midisynth, midisynth_method
 /*
  * Module Exports & Interface
  *
- * struct midi_chan *midi_init(MPU_CLASS cls, int unit, int chan) int
- * midi_uninit(struct snd_midi *) 0 == no error EBUSY or other error int
- * Midi_in(struct midi_chan *, char *buf, int count) int Midi_out(struct
- * midi_chan *, char *buf, int count)
+ * struct midi_chan *midi_init(MPU_CLASS cls, int unit, int chan,
+ * void *cookie)
+ * int midi_uninit(struct snd_midi *)
+ *
+ * 0 == no error
+ * EBUSY or other error
+ *
+ * int midi_in(struct snd_midi *, char *buf, int count)
+ * int midi_out(struct snd_midi *, char *buf, int count)
  *
  * midi_{in,out} return actual size transfered
  *
@@ -388,7 +393,7 @@ err0:   mtx_unlock(&midistat_lock);
 
 /*
  * midi_uninit does not call MIDI_UNINIT, as since this is the implementors
- * entry point. midi_unint if fact, does not send any methods. A call to
+ * entry point. midi_uninit if fact, does not send any methods. A call to
  * midi_uninit is a defacto promise that you won't manipulate ch anymore
  *
  */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r259938 - head/sys/sys

2013-12-26 Thread Tai-hwa Liang
Author: avatar
Date: Fri Dec 27 07:02:07 2013
New Revision: 259938
URL: http://svnweb.freebsd.org/changeset/base/259938

Log:
  Fixing build bustage.

Modified:
  head/sys/sys/gpt.h

Modified: head/sys/sys/gpt.h
==
--- head/sys/sys/gpt.h  Fri Dec 27 07:01:42 2013(r259937)
+++ head/sys/sys/gpt.h  Fri Dec 27 07:02:07 2013(r259938)
@@ -128,7 +128,7 @@ struct gpt_ent {
{0x9d275380,0x40ad,0x11db,0xbf,0x97,{0x00,0x0c,0x29,0x11,0xd1,0xb8}}
 #defineGPT_ENT_TYPE_VMRESERVED \
{0x9198effc,0x31c0,0x11db,0x8f,0x78,{0x00,0x0c,0x29,0x11,0xd1,0xb8}}
-#defineGPT_ENT_TYPE_VSANHDR\
+#defineGPT_ENT_TYPE_VMVSANHDR  \
{0x381cfccc,0x7288,0x11e0,0x92,0xee,{0x00,0x0c,0x29,0x11,0xd0,0xb2}}
 
 #defineGPT_ENT_TYPE_APPLE_BOOT \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238980 - head/sys/gnu/fs/reiserfs

2012-08-01 Thread Tai-hwa Liang
Author: avatar
Date: Wed Aug  1 23:05:57 2012
New Revision: 238980
URL: http://svn.freebsd.org/changeset/base/238980

Log:
Just like the other file systems found in /sys/fs, g_vfs_open()
  should be paried with g_vfs_close().  Though g_vfs_close() is a wrapper
  around g_wither_geom_close(), r206130 added the following test in
  g_vfs_open():
  
if (bo->bo_private != vp)
return (EBUSY);
  
Which will cause a 'Device busy' error inside reiserfs_mountfs() if
  the same file system is re-mounted again after umount or mounting failure:
  
(case 1, /dev/ad4s3 is not a valid REISERFS partition)
# mount -t reiserfs -o ro /dev/ad4s3 /mnt
mount: /dev/ad4s3: Invalid argument
# mount -t msdosfs -o ro /dev/ad4s3 /mnt
mount: /dev/ad4s3: Device busy
  
(case 2, /dev/ad4s3 is a valid REISERFS partition)
# mount -t reiserfs -o ro /dev/ad4s3 /mnt
# umount /mnt
# mount -t reiserfs -o ro /dev/ad4s3 /mnt
mount: /dev/ad4s3: Device busy
  
On the other hand, g_vfs_close() 'fixed' the above cases by doing an
  extra step to keep 'sc->sc_bo->bo_private' and 'cp->private' pointers
  synchronised.
  
  Reviewed by:  kib
  MFC after:1 month

Modified:
  head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c

Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
==
--- head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c  Wed Aug  1 19:27:12 2012
(r238979)
+++ head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c  Wed Aug  1 23:05:57 2012
(r238980)
@@ -227,7 +227,7 @@ reiserfs_unmount(struct mount *mp, int m
 
DROP_GIANT();
g_topology_lock();
-   g_wither_geom_close(rmp->rm_cp->geom, ENXIO);
+   g_vfs_close(rmp->rm_cp);
g_topology_unlock();
PICKUP_GIANT();
vrele(rmp->rm_devvp);
@@ -611,7 +611,7 @@ out:
if (cp != NULL) {
DROP_GIANT();
g_topology_lock();
-   g_wither_geom_close(cp->geom, ENXIO);
+   g_vfs_close(cp);
g_topology_unlock();
PICKUP_GIANT();
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238562 - head

2012-07-17 Thread Tai-hwa Liang
Author: avatar
Date: Wed Jul 18 05:50:40 2012
New Revision: 238562
URL: http://svn.freebsd.org/changeset/base/238562

Log:
  Removing bsd{ar,ranlib} found on my ancient installation.
  
  MFC after:3 weeks

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul 18 05:21:34 2012(r238561)
+++ head/ObsoleteFiles.inc  Wed Jul 18 05:50:40 2012(r238562)
@@ -1358,6 +1358,11 @@ OLD_FILES+=usr/share/man/man2/kse_thr_in
 OLD_FILES+=usr/share/man/man2/kse_wakeup.2.gz
 OLD_FILES+=usr/lib32/libkse.so
 OLD_LIBS+=usr/lib32/libkse.so.3
+# 20080225: bsdar/bsdranlib rename to ar/ranlib
+OLD_FILES+=usr/bin/bsdar
+OLD_FILES+=usr/bin/bsdranlib
+OLD_FILES+=usr/share/man/man1/bsdar.1.gz
+OLD_FILES+=usr/share/man/man1/bsdranlib.1.gz
 # 20080220: geom_lvm rename to geom_linux_lvm
 OLD_FILES+=usr/share/man/man4/geom_lvm.4.gz
 # 20080126: oldcard.4 removal
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r223905 - head/lib/libstand

2011-07-10 Thread Tai-hwa Liang
Author: avatar
Date: Sun Jul 10 07:25:34 2011
New Revision: 223905
URL: http://svn.freebsd.org/changeset/base/223905

Log:
  - Removing some unneeded definitions of NULL(cruft related to 1970's C).
In C90, NULL is guaranteed to be declared in  and also in
.  Though the correct way to define NULL in FreeBSD is to
include , other parts of libstand still require 
to build; therefore, we keep  in stand.h and add a note about
this;
  - Removing no longer used 'Prototype' definition.  Quote from bde@:
  
'Cruft related to getting incomplete struct declarations within
prototypes forward-declared before the structs.  It doesn't mean
"prototype" but only part of a prototype-related hack.  No longer
used.'
  
  - Replacing iaddr_t with uintptr_t;
  - Removing use of long double to determine alignment.  Use a fixed 16 byte
alignment instead;
  
  Reviewed by:  bde
  Obtained from:DragonFlyBSD (partially)
  MFC after:1 month

Modified:
  head/lib/libstand/stand.h
  head/lib/libstand/zalloc.c
  head/lib/libstand/zalloc_defs.h
  head/lib/libstand/zalloc_malloc.c
  head/lib/libstand/zalloc_mem.h
  head/lib/libstand/zalloc_protos.h

Modified: head/lib/libstand/stand.h
==
--- head/lib/libstand/stand.h   Sun Jul 10 07:14:32 2011(r223904)
+++ head/lib/libstand/stand.h   Sun Jul 10 07:25:34 2011(r223905)
@@ -65,15 +65,13 @@
 #include 
 #include 
 #include 
+
+/* this header intentionally exports NULL from  */
 #include 
 
 #define CHK(fmt, args...)  printf("%s(%d): " fmt "\n", __func__, __LINE__ 
, ##args)
 #define PCHK(fmt, args...) {printf("%s(%d): " fmt "\n", __func__, __LINE__ 
, ##args); getchar();}
 
-#ifndef NULL
-#defineNULL0
-#endif
-
 /* Avoid unwanted userlandish components */
 #define _KERNEL
 #include 

Modified: head/lib/libstand/zalloc.c
==
--- head/lib/libstand/zalloc.c  Sun Jul 10 07:14:32 2011(r223904)
+++ head/lib/libstand/zalloc.c  Sun Jul 10 07:25:34 2011(r223905)
@@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$");
  */
 
 void *
-znalloc(MemPool *mp, iaddr_t bytes)
+znalloc(MemPool *mp, uintptr_t bytes)
 {
 /*
  * align according to pool object size (can be 0).  This is
@@ -136,7 +136,7 @@ znalloc(MemPool *mp, iaddr_t bytes)
  */
 
 void
-zfree(MemPool *mp, void *ptr, iaddr_t bytes)
+zfree(MemPool *mp, void *ptr, uintptr_t bytes)
 {
 /*
  * align according to pool object size (can be 0).  This is
@@ -153,7 +153,7 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
 
 if ((char *)ptr < (char *)mp->mp_Base || 
(char *)ptr + bytes > (char *)mp->mp_End ||
-   ((iaddr_t)ptr & MEMNODE_SIZE_MASK) != 0)
+   ((uintptr_t)ptr & MEMNODE_SIZE_MASK) != 0)
panic("zfree(%p,%ju): wild pointer", ptr, (uintmax_t)bytes);
 
 /*
@@ -245,7 +245,7 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
  */
 
 void
-zextendPool(MemPool *mp, void *base, iaddr_t bytes)
+zextendPool(MemPool *mp, void *base, uintptr_t bytes)
 {
 if (mp->mp_Size == 0) {
mp->mp_Base = base;

Modified: head/lib/libstand/zalloc_defs.h
==
--- head/lib/libstand/zalloc_defs.h Sun Jul 10 07:14:32 2011
(r223904)
+++ head/lib/libstand/zalloc_defs.h Sun Jul 10 07:25:34 2011
(r223905)
@@ -39,20 +39,11 @@
 #define ZALLOCDEBUG
 
 #include 
-#include 
 #include "stand.h"
-
-typedef uintptr_t iaddr_t; /* unsigned int same size as pointer*/
-typedef intptr_t saddr_t;  /* signed int same size as pointer  */
 #include "zalloc_mem.h"
 
-#define Prototype extern
 #define Library extern
 
-#ifndef NULL
-#define NULL   ((void *)0)
-#endif
-
 /*
  * block extension for sbrk()
  */
@@ -61,8 +52,7 @@ typedef intptr_t saddr_t; /* signed int 
 #define BLKEXTENDMASK  (BLKEXTEND - 1)
 
 /*
- * required malloc alignment.  Use sizeof(long double) for architecture
- * independance.
+ * required malloc alignment.  Just hardwire to 16.
  *
  * Note: if we implement a more sophisticated realloc, we should ensure that
  * MALLOCALIGN is at least as large as MemNode.
@@ -73,10 +63,8 @@ typedef struct Guard {
 size_t ga_Magic;   /* must be at least 32 bits */
 } Guard;
 
-#define MATYPE long double
-#define MALLOCALIGN((sizeof(MATYPE) > sizeof(Guard)) ? sizeof(MATYPE) : 
sizeof(Guard))
+#define MALLOCALIGN16
 #define GAMAGIC0x55FF44FD
 #define GAFREE 0x5F54F4DF
 
 #include "zalloc_protos.h"
-

Modified: head/lib/libstand/zalloc_malloc.c
==
--- head/lib/libstand/zalloc_malloc.c   Sun Jul 10 07:14:32 2011
(r223904)
+++ head/lib/libstand/zalloc_malloc.c   Sun Jul 10 07:25:34 2011
(r223905)
@@ -126,7 +126,7 @@ Free(void *ptr, const char

svn commit: r223854 - head/lib/libstand

2011-07-07 Thread Tai-hwa Liang
Author: avatar
Date: Fri Jul  8 01:35:33 2011
New Revision: 223854
URL: http://svn.freebsd.org/changeset/base/223854

Log:
  Fixing building bustage on 32 bits platforms when WARNS >= 2.  Note that
  this fix only applies to zalloc.c, the other part of libstand such like
  qdivrem.c still gives compilation warnings on sparc64 tinderbox builds;
  therefore, WARNS level isn't changed for now.
  
  Submitted by: Garrett Cooper 
  Reviewed by:  bde

Modified:
  head/lib/libstand/zalloc.c
  head/lib/libstand/zalloc_defs.h

Modified: head/lib/libstand/zalloc.c
==
--- head/lib/libstand/zalloc.c  Fri Jul  8 01:32:04 2011(r223853)
+++ head/lib/libstand/zalloc.c  Fri Jul  8 01:35:33 2011(r223854)
@@ -154,7 +154,7 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
 if ((char *)ptr < (char *)mp->mp_Base || 
(char *)ptr + bytes > (char *)mp->mp_End ||
((iaddr_t)ptr & MEMNODE_SIZE_MASK) != 0)
-   panic("zfree(%p,%ju): wild pointer", ptr, bytes);
+   panic("zfree(%p,%ju): wild pointer", ptr, (uintmax_t)bytes);
 
 /*
  * free the segment
@@ -177,8 +177,10 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
/*
 * range check
 */
-   if ((char *)ptr + bytes > (char *)mn)
-   panic("zfree(%p,%ju): corrupt memlist1",ptr, bytes);
+   if ((char *)ptr + bytes > (char *)mn) {
+   panic("zfree(%p,%ju): corrupt memlist1", ptr,
+   (uintmax_t)bytes);
+   }
 
/*
 * merge against next area or create independant area
@@ -208,8 +210,10 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
return;
/* NOT REACHED */
}
-   if ((char *)ptr < (char *)mn + mn->mr_Bytes)
-   panic("zfree(%p,%ju): corrupt memlist2", ptr, bytes);
+   if ((char *)ptr < (char *)mn + mn->mr_Bytes) {
+   panic("zfree(%p,%ju): corrupt memlist2", ptr,
+   (uintmax_t)bytes);
+   }
}
/*
 * We are beyond the last MemNode, append new MemNode.  Merge against

Modified: head/lib/libstand/zalloc_defs.h
==
--- head/lib/libstand/zalloc_defs.h Fri Jul  8 01:32:04 2011
(r223853)
+++ head/lib/libstand/zalloc_defs.h Fri Jul  8 01:35:33 2011
(r223854)
@@ -39,6 +39,7 @@
 #define ZALLOCDEBUG
 
 #include 
+#include 
 #include "stand.h"
 
 typedef uintptr_t iaddr_t; /* unsigned int same size as pointer*/
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r223138 - head/sys/ufs/ffs

2011-06-16 Thread Tai-hwa Liang

On Fri, 17 Jun 2011, Bruce Evans wrote:

On Thu, 16 Jun 2011, Tai-hwa Liang wrote:

On Thu, 16 Jun 2011, Bruce Evans wrote:

It might be a style bug (like typedefing a struct) to use enums for
anything.  They are impossible to declare opaquely.


 Does that mean we have to #include  in userland 
makefs/ffs/ffs_bswap.c?


It means that you should implement headers properly, so that they don't
depend on other headers to begin with or grow dependencies on other
headers.  Though the should-be-kernel-only header  has some
parts including `enum vtype' that have already escaped to userland, other
headers shouldn't grow dependencies on these.


  How about wrapping offended sections with #ifdef _KERNEL? Should be less
intrusive IMHO:

Index: ffs_extern.h
===
--- ffs_extern.h(revision 223146)
+++ ffs_extern.h(working copy)
@@ -33,7 +33,6 @@
 #ifndef _UFS_FFS_EXTERN_H
 #define_UFS_FFS_EXTERN_H

-enum vtype;
 struct buf;
 struct cg;
 struct fid;
@@ -57,8 +56,10 @@
 intffs_balloc_ufs2(struct vnode *a_vp, off_t a_startoffset, int a_size,
 struct ucred *a_cred, int a_flags, struct buf **a_bpp);
 intffs_blkatoff(struct vnode *, off_t, char **, struct buf **);
+#ifdef _KERNEL
 void   ffs_blkfree(struct ufsmount *, struct fs *, struct vnode *,
ufs2_daddr_t, long, ino_t, enum vtype, struct workhead *);
+#endif /* _KERNEL */
 ufs2_daddr_t ffs_blkpref_ufs1(struct inode *, ufs_lbn_t, int, ufs1_daddr_t *);
 ufs2_daddr_t ffs_blkpref_ufs2(struct inode *, ufs_lbn_t, int, ufs2_daddr_t *);
 intffs_checkfreefile(struct fs *, struct vnode *, ino_t);
@@ -82,8 +83,10 @@
ufs2_daddr_t, int, int, int, struct ucred *, struct buf **);
 intffs_sbupdate(struct ufsmount *, int, int);
 void   ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
+#ifdef _KERNEL
 intffs_snapblkfree(struct fs *, struct vnode *, ufs2_daddr_t, long, ino_t,
enum vtype, struct workhead *);
+#endif /* _KERNEL */
 void   ffs_snapremove(struct vnode *vp);
 intffs_snapshot(struct mount *mp, char *snapfile);
 void   ffs_snapshot_mount(struct mount *mp);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r223151 - head/lib/libstand

2011-06-16 Thread Tai-hwa Liang
Author: avatar
Date: Thu Jun 16 15:35:12 2011
New Revision: 223151
URL: http://svn.freebsd.org/changeset/base/223151

Log:
  Using the correct format string(%zu) for size_t type.  This should fix 64
  bits builds.
  
  Submitted by: Garrett Cooper 

Modified:
  head/lib/libstand/zalloc_malloc.c

Modified: head/lib/libstand/zalloc_malloc.c
==
--- head/lib/libstand/zalloc_malloc.c   Thu Jun 16 12:57:33 2011
(r223150)
+++ head/lib/libstand/zalloc_malloc.c   Thu Jun 16 15:35:12 2011
(r223151)
@@ -110,7 +110,7 @@ Free(void *ptr, const char *file, int li
return;
}
if (*((signed char *)res + res->ga_Bytes - 1) != -2)
-   panic("free: guard2 fail @ %p + %d from %s:%d", ptr, res->ga_Bytes 
- MALLOCALIGN, file, line);
+   panic("free: guard2 fail @ %p + %zu from %s:%d", ptr, res->ga_Bytes 
- MALLOCALIGN, file, line);
*((signed char *)res + res->ga_Bytes - 1) = -1;
 #endif
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r223139 - head/lib/libstand

2011-06-16 Thread Tai-hwa Liang

On Thu, 16 Jun 2011, Bruce Evans wrote:


On Thu, 16 Jun 2011, Garrett Cooper wrote:

On Thu, Jun 16, 2011 at 12:19 AM, Garrett Cooper  
wrote:
On Thu, Jun 16, 2011 at 12:14 AM, Tai-hwa Liang  
wrote:

Author: avatar
Date: Thu Jun 16 07:14:55 2011
New Revision: 223139
URL: http://svn.freebsd.org/changeset/base/223139

Log:
�Unbreaking build on sparc64.


Why not fix it on all arches?  This seems to break it on all 32-bit arches.


�Submitted by: Garrett Cooper 

Modified:
�head/lib/libstand/zalloc.c

Modified: head/lib/libstand/zalloc.c
==
--- head/lib/libstand/zalloc.c �Thu Jun 16 05:26:03 2011 � � � �(r223138)
+++ head/lib/libstand/zalloc.c �Thu Jun 16 07:14:55 2011 � � � �(r223139)
@@ -154,7 +154,7 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
� � if ((char *)ptr < (char *)mp->mp_Base ||
� � � �(char *)ptr + bytes > (char *)mp->mp_End ||
� � � �((iaddr_t)ptr & MEMNODE_SIZE_MASK) != 0)
- � � � panic("zfree(%p,%d): wild pointer", ptr, bytes);
+ � � � panic("zfree(%p,%ju): wild pointer", ptr, bytes);


All of those need to be cast to (uintmax_t). Sorry :(..


Indeed.  There is no format letter for intptr_t, and perhaps iaddr_t is
supposed to be opaque anyway.


And you need to add #include  to stand.h in order to get
uintmax_t. Here's a proper patch for amd64..


This would add namespace pollution.  stand.h doesn't use anything in
.  It depends on normal namespace pollution in an XXX section
in  for the declaration of uintptr_t.  It and other headers
should use __uintptr_t instead.  Strangely,  declares
uintptr_t but not uintmax_t.


  What about casting to __uintmax_t instead?

Index: zalloc.c
===
--- zalloc.c(revision 223146)
+++ zalloc.c(working copy)
@@ -154,7 +154,7 @@
 if ((char *)ptr < (char *)mp->mp_Base ||
(char *)ptr + bytes > (char *)mp->mp_End ||
((iaddr_t)ptr & MEMNODE_SIZE_MASK) != 0)
-   panic("zfree(%p,%ju): wild pointer", ptr, bytes);
+   panic("zfree(%p,%ju): wild pointer", ptr, (__uintmax_t)bytes);

 /*
  * free the segment
@@ -177,8 +177,10 @@
/*
 * range check
 */
-   if ((char *)ptr + bytes > (char *)mn)
-   panic("zfree(%p,%ju): corrupt memlist1",ptr, bytes);
+   if ((char *)ptr + bytes > (char *)mn) {
+   panic("zfree(%p,%ju): corrupt memlist1", ptr,
+   (__uintmax_t)bytes);
+   }

/*
 * merge against next area or create independant area
@@ -208,8 +210,10 @@
return;
/* NOT REACHED */
}
-   if ((char *)ptr < (char *)mn + mn->mr_Bytes)
-   panic("zfree(%p,%ju): corrupt memlist2", ptr, bytes);
+   if ((char *)ptr < (char *)mn + mn->mr_Bytes) {
+   panic("zfree(%p,%ju): corrupt memlist2", ptr,
+   (__uintmax_t)bytes);
+   }
}
/*
 * We are beyond the last MemNode, append new MemNode.  Merge against___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r223138 - head/sys/ufs/ffs

2011-06-16 Thread Tai-hwa Liang

On Thu, 16 Jun 2011, Bruce Evans wrote:

On Thu, 16 Jun 2011, Stefan Farfeleder wrote:


Log:
  Fixing compilation bustage by introducing another forward declaration.

Modified:
  head/sys/ufs/ffs/ffs_extern.h

Modified: head/sys/ufs/ffs/ffs_extern.h
==
--- head/sys/ufs/ffs/ffs_extern.h	Thu Jun 16 02:27:05 2011 
(r223137)
+++ head/sys/ufs/ffs/ffs_extern.h	Thu Jun 16 05:26:03 2011 
(r223138)

@@ -33,6 +33,7 @@
 #ifndef _UFS_FFS_EXTERN_H
 #define_UFS_FFS_EXTERN_H

+enum vtype;
 struct buf;
 struct cg;
 struct fid;


This might unsort the declarations (it isn't clear if the declarations
should be sorted on tag name or keyword name).


This is not valid C code. For some reason GCC allows it (with our
compilation flags).


This is a bug in gcc-4.2.1.  gcc-3.3.3 generates a warning for it even
with no compilation flags, while gcc-4.2.1 doesn't generate a warning
even with -Wall -std-c99.  It takes -pedantic to generate the warning
with gcc-4.2.1.  TenDRA of course generates an error.

It might be a style bug (like typedefing a struct) to use enums for
anything.  They are impossible to declare opaquely.


  Does that mean we have to #include  in userland 
makefs/ffs/ffs_bswap.c?

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


svn commit: r223139 - head/lib/libstand

2011-06-16 Thread Tai-hwa Liang
Author: avatar
Date: Thu Jun 16 07:14:55 2011
New Revision: 223139
URL: http://svn.freebsd.org/changeset/base/223139

Log:
  Unbreaking build on sparc64.
  
  Submitted by: Garrett Cooper 

Modified:
  head/lib/libstand/zalloc.c

Modified: head/lib/libstand/zalloc.c
==
--- head/lib/libstand/zalloc.c  Thu Jun 16 05:26:03 2011(r223138)
+++ head/lib/libstand/zalloc.c  Thu Jun 16 07:14:55 2011(r223139)
@@ -154,7 +154,7 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
 if ((char *)ptr < (char *)mp->mp_Base || 
(char *)ptr + bytes > (char *)mp->mp_End ||
((iaddr_t)ptr & MEMNODE_SIZE_MASK) != 0)
-   panic("zfree(%p,%d): wild pointer", ptr, bytes);
+   panic("zfree(%p,%ju): wild pointer", ptr, bytes);
 
 /*
  * free the segment
@@ -178,7 +178,7 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
 * range check
 */
if ((char *)ptr + bytes > (char *)mn)
-   panic("zfree(%p,%d): corrupt memlist1",ptr, bytes);
+   panic("zfree(%p,%ju): corrupt memlist1",ptr, bytes);
 
/*
 * merge against next area or create independant area
@@ -209,7 +209,7 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
/* NOT REACHED */
}
if ((char *)ptr < (char *)mn + mn->mr_Bytes)
-   panic("zfree(%p,%d): corrupt memlist2", ptr, bytes);
+   panic("zfree(%p,%ju): corrupt memlist2", ptr, bytes);
}
/*
 * We are beyond the last MemNode, append new MemNode.  Merge against
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-06-15 Thread Tai-hwa Liang
Author: avatar
Date: Thu Jun 16 05:26:03 2011
New Revision: 223138
URL: http://svn.freebsd.org/changeset/base/223138

Log:
  Fixing compilation bustage by introducing another forward declaration.

Modified:
  head/sys/ufs/ffs/ffs_extern.h

Modified: head/sys/ufs/ffs/ffs_extern.h
==
--- head/sys/ufs/ffs/ffs_extern.h   Thu Jun 16 02:27:05 2011
(r223137)
+++ head/sys/ufs/ffs/ffs_extern.h   Thu Jun 16 05:26:03 2011
(r223138)
@@ -33,6 +33,7 @@
 #ifndef _UFS_FFS_EXTERN_H
 #define_UFS_FFS_EXTERN_H
 
+enum vtype;
 struct buf;
 struct cg;
 struct fid;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r223035 - head/usr.bin/find

2011-06-12 Thread Tai-hwa Liang
Author: avatar
Date: Mon Jun 13 05:22:07 2011
New Revision: 223035
URL: http://svn.freebsd.org/changeset/base/223035

Log:
  Using statfs.f_fstypename rather than statfs.f_type whilst performing fstype
  comparsion as nullfs will copy f_type from underlayer FS.
  
  PR:   bin/156258
  Submitted by: Marcin Wisnicki 
  MFC after:1 month

Modified:
  head/usr.bin/find/function.c

Modified: head/usr.bin/find/function.c
==
--- head/usr.bin/find/function.cMon Jun 13 04:55:29 2011
(r223034)
+++ head/usr.bin/find/function.cMon Jun 13 05:22:07 2011
(r223035)
@@ -846,7 +846,8 @@ f_fstype(PLAN *plan, FTSENT *entry)
static dev_t curdev;/* need a guaranteed illegal dev value */
static int first = 1;
struct statfs sb;
-   static int val_type, val_flags;
+   static int val_flags;
+   static char fstype[sizeof(sb.f_fstypename)];
char *p, save[2] = {0,0};
 
if ((plan->flags & F_MTMASK) == F_MTUNKNOWN)
@@ -888,13 +889,13 @@ f_fstype(PLAN *plan, FTSENT *entry)
 * always copy both of them.
 */
val_flags = sb.f_flags;
-   val_type = sb.f_type;
+   strlcpy(fstype, sb.f_fstypename, sizeof(fstype));
}
switch (plan->flags & F_MTMASK) {
case F_MTFLAG:
return val_flags & plan->mt_data;
case F_MTTYPE:
-   return val_type == plan->mt_data;
+   return (strncmp(fstype, plan->c_data, sizeof(fstype)) == 0);
default:
abort();
}
@@ -905,22 +906,11 @@ c_fstype(OPTION *option, char ***argvp)
 {
char *fsname;
PLAN *new;
-   struct xvfsconf vfc;
 
fsname = nextarg(option, argvp);
ftsoptions &= ~FTS_NOSTAT;
 
new = palloc(option);
-
-   /*
-* Check first for a filesystem name.
-*/
-   if (getvfsbyname(fsname, &vfc) == 0) {
-   new->flags |= F_MTTYPE;
-   new->mt_data = vfc.vfc_typenum;
-   return new;
-   }
-
switch (*fsname) {
case 'l':
if (!strcmp(fsname, "local")) {
@@ -938,12 +928,8 @@ c_fstype(OPTION *option, char ***argvp)
break;
}
 
-   /*
-* We need to make filesystem checks for filesystems
-* that exists but aren't in the kernel work.
-*/
-   fprintf(stderr, "Warning: Unknown filesystem type %s\n", fsname);
-   new->flags |= F_MTUNKNOWN;
+   new->flags |= F_MTTYPE;
+   new->c_data = fsname;
return new;
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r209022 - head/sys/net80211

2010-06-10 Thread Tai-hwa Liang
Author: avatar
Date: Fri Jun 11 01:32:42 2010
New Revision: 209022
URL: http://svn.freebsd.org/changeset/base/209022

Log:
  Fixing compilation bustage by adding the missing && back.

Modified:
  head/sys/net80211/ieee80211_sta.c

Modified: head/sys/net80211/ieee80211_sta.c
==
--- head/sys/net80211/ieee80211_sta.c   Thu Jun 10 22:47:04 2010
(r209021)
+++ head/sys/net80211/ieee80211_sta.c   Fri Jun 11 01:32:42 2010
(r209022)
@@ -584,7 +584,7 @@ sta_input(struct ieee80211_node *ni, str
}
IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);
ni->ni_noise = nf;
-   if (HAS_SEQ(type) !IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+   if (HAS_SEQ(type) && !IEEE80211_IS_MULTICAST(wh->i_addr1)) {
uint8_t tid = ieee80211_gettid(wh);
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"