- Re-added the long word alignment check for MC68020 I didn't commit
  at home.

git-svn-id: 2bb8db730c750c20743bd1fa53c3f96cb40efdb0@14889 87f5fb63-7c3d-0410-a384-fd976d0f7a62

--- library/string_headers.h
+++ library/string_headers.h
@@ -1,5 +1,5 @@
 /*
- * $Id: string_headers.h,v 1.3 2005-01-02 09:07:19 obarthel Exp $
+ * $Id: string_headers.h,v 1.4 2005-03-15 11:18:32 obarthel Exp $
  *
  * :ts=4
  *
@@ -67,9 +67,9 @@
 /* Address is aligned to a long word boundary. For an 68030 and beyond the
    alignment does not matter. */
 #if defined(M68020)
+#define IS_LONG_ALIGNED(a) (1)
+#else
 #define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 3) == 0)
-#else
-#define IS_LONG_ALIGNED(a) (1)
 #endif /* M68020 */

 /****************************************************************************/


fix unsigned comparison

fix unsigned comparison

Summary:
compiler warns about this
probably shouldn't do it :)

Reviewed By: emma0303

Differential Revision: D8516717

fbshipit-source-id: b8709ce7af21b1e01755ca084ef81fb95afe060b

--- libredex/StringBuilder.h
+++ libredex/StringBuilder.h
@@ -48,7 +48,7 @@
   std::string str() const {
     std::string result;
     result.reserve(m_total_chars);
-    for (int i = 0; i < m_index; ++i) {
+    for (uint32_t i = 0; i < m_index; ++i) {
       result += m_strings[i];
     }
     return result;


Fix bug in "dotnet" module. Use "counter" instead of "i" where required.

--- libyara/modules/dotnet.c
+++ libyara/modules/dotnet.c
@@ -1002,7 +1002,7 @@

           if (name != NULL)
           {
-            set_string(name, pe->object, "modulerefs[%i]", i);
+            set_string(name, pe->object, "modulerefs[%i]", counter);
             counter++;
           }

@@ -1276,17 +1276,17 @@

           // Add 4 to skip the size.
           set_integer(resource_base + resource_offset + 4,
-              pe->object, "resources[%i].offset", i);
+              pe->object, "resources[%i].offset", counter);

           set_integer(resource_size,
-              pe->object, "resources[%i].length", i);
+              pe->object, "resources[%i].length", counter);

           name = pe_get_dotnet_string(pe,
               string_offset,
               DOTNET_STRING_INDEX(manifestresource_table->Name));

           if (name != NULL)
-            set_string(name, pe->object, "resources[%i].name", i);
+            set_string(name, pe->object, "resources[%i].name", counter);

           row_ptr += row_size;
           counter++;


utilities.c: Fix typos

utilities.c: Fix typos

--- link-grammar/utilities.c
+++ link-grammar/utilities.c
@@ -867,7 +867,7 @@
 void set_utf8_program_locale(void)
 {
 #ifndef _WIN32
-	/* The LG library doesn't use mbrtowc_l(), since it doesn't exists in
+	/* The LG library doesn't use mbrtowc_l(), since it doesn't exist in
 	 * the dynamic glibc (2.22). mbsrtowcs_l() could also be used, but for
 	 * some reason it exists only in the static glibc.
 	 * In order that mbrtowc() will work for any UTF-8 character, UTF-8
@@ -945,7 +945,7 @@
 		locale = ev;
 		lgdebug(D_USER_FILES, "Debug: Environment locale %s=%s\n", *evname, ev);
 #ifdef _WIN32
-		/* If compiled with MSVC/MSYS, we still support running under Cygwin. */
+		/* If compiled with MSVC/MinGW, we still support running under Cygwin. */
 		const char *ostype = getenv("OSTYPE");
 		if ((NULL != ostype) && (0 == strcmp(ostype, "cygwin")))
 		{


alpha: fix decoding of shmat syscall

alpha: fix decoding of shmat syscall

On alpha, shmat syscall is known as osf_shmat.

* linux/alpha/syscallent.h (osf_shmat): Fix sys_flags and sys_func.

--- linux/alpha/syscallent.h
+++ linux/alpha/syscallent.h
@@ -212,7 +212,7 @@
 [206] = { 3,	TI,		SEN(semop),			"semop"			},
 [207] = { 1,	0,		SEN(printargs),			"osf_utsname"		},
 [208] = { 3,	TF,		SEN(chown),			"lchown"		},
-[209] = { 3,	TI|TM,		SEN(printargs),			"osf_shmat"		},
+[209] = { 3,	TI|TM|SI,	SEN(shmat),			"osf_shmat"		},
 [210] = { 3,	TI,		SEN(shmctl),			"shmctl"		},
 [211] = { 1,	TI|TM|SI,	SEN(shmdt),			"shmdt"			},
 [212] = { 3,	TI,		SEN(shmget),			"shmget"		},


Disable debug prints

Disable debug prints

--- linux/freespace_hidraw.c
+++ linux/freespace_hidraw.c
@@ -43,9 +43,9 @@
  *    - support synchronous API
  */

-#define _FREESPACE_DEBUG
-#define _FREESPACE_WARN
-#define _FREESPACE_TRACE
+// #define _FREESPACE_DEBUG
+// #define _FREESPACE_WARN
+// #define _FREESPACE_TRACE

 #define LOGF(fmt, lvl, ...) fprintf(stderr, "libfreespace (%20s:%4d): " #lvl " " fmt "\n", __func__, __LINE__, ##__VA_ARGS__);


changed locks

changed locks

--- linux/libcometa/cometa.c
+++ linux/libcometa/cometa.c
@@ -307,7 +307,7 @@
 	handle = (struct cometa *)h;
 	usleep(handle->hz * 1000000);
 	do {
-		if ((ret = pthread_rwlock_rdlock(&handle->hlock)) != 0) {
+		if ((ret = pthread_rwlock_wrlock(&handle->hlock)) != 0) {
 	        fprintf(stderr, "ERROR: in send_heartbeat. Failed to get wrlock. ret = %d. Exiting.\r\n", ret);
 	        exit (-1);
 	    }
@@ -443,7 +443,7 @@
         debug_print("DEBUG: received from server:\r\n%s\n", handle->recvBuff);

 		/* invoke the user callback */
-        if (pthread_rwlock_rdlock(&(handle->hlock)) != 0) {
+        if (pthread_rwlock_wrlock(&(handle->hlock)) != 0) {
             fprintf(stderr, "ERROR: in message receive loop. Failed to get wrlock. Exiting.\r\n");
             exit (-1);
         }
@@ -1145,7 +1145,7 @@
         /* message too large */
         return COMETAR_PAR_ERROR;
     }
-    if ((ret = pthread_rwlock_rdlock(&handle->hlock)) != 0) {
+    if ((ret = pthread_rwlock_wrlock(&handle->hlock)) != 0) {
         fprintf(stderr, "ERROR: in send_heartbeat. Failed to get wrlock. ret = %d. Exiting.\r\n", ret);
         exit (-1);
     }


Add a -q (quiet) parameter to suppress displaying the raw signal (default off).

--- readpin.c
+++ readpin.c
@@ -42,6 +42,7 @@
 main(int argc, char **argv)
 {
 	int t, tlow, sec, res, opt, tunetime = 0;
+	int verbose = 1;
 	uint8_t p, bit, init, stv, newminute;
 	struct hardware *hw;
 	struct timespec tp0, tp1;
@@ -50,13 +51,16 @@
 	long twait;
 	float a, y, realfreq;

-	while ((opt = getopt(argc, argv, "t")) != -1) {
+	while ((opt = getopt(argc, argv, "qt")) != -1) {
 		switch (opt) {
+		case 'q' :
+			verbose = 0;
+			break;
 		case 't' :
 			tunetime = 1;
 			break;
 		default:
-			printf("usage: %s [-t]\n", argv[0]);
+			printf("usage: %s [-qt]\n", argv[0]);
 			return EX_USAGE;
 		}
 	}
@@ -99,7 +103,8 @@
 		y = y < 0 ? (float)p : y + a * (p - y);
 		if (stv == 2)
 			stv = p;
-		printf("%c", p == 0 ? '-' : p == 1 ? '+' : '?');
+		if (verbose == 1)
+			printf("%c", p == 0 ? '-' : p == 1 ? '+' : '?');

 		if (realfreq < hw->freq / 2) {
 			printf("<");


Fix banner connection loop detection

Fix banner connection loop detection

simta's greeting banner had the hostname in angle brackets, but RFC
2821 (and our connection code) expect it to be just a plain hostname:

DNS blackplanet.com: 2 MX Record Entries
DNS blackplanet.com: Entry 0: Trying MX preference 10: 127.0.0.1
Connect.out [127.0.0.1] blackplanet.com: Accepted: <charliesangels.mr.itd.umich.edu>: 220 <charliesangels.mr.itd.umich.edu> Simple Internet Message Transfer Agent ready
smtp_reply blackplanet.com EHLO: 250-charliesangels.mr.itd.umich.edu Hello charliesangels.mr.itd.umich.edu

After this patch:

DNS blackplanet.com: 2 MX Record Entries
DNS blackplanet.com: Entry 0: Trying MX preference 10: 127.0.0.1
Connect.out [127.0.0.1] blackplanet.com: Failed: banner mail loop: 220 charliesangels.mr.itd.umich.edu Simple Internet Message Transfer Agent ready

--- receive.c
+++ receive.c
@@ -549,7 +549,7 @@

     if ( hostname ) {
 	if ( arg != NULL ) {
-	    if ( snet_writef( r->r_snet, "%d <%s> %s: %s\r\n", reply_code,
+	    if ( snet_writef( r->r_snet, "%d %s %s: %s\r\n", reply_code,
 		    simta_hostname, msg ? msg : boilerplate, arg ) < 0 ) {
 		syslog( LOG_ERR, "Syserror: Receive [%s] %s: "
 			"smtp_banner_message: snet_writef: %m",
@@ -558,7 +558,7 @@
 	    }

 	} else {
-	    if ( snet_writef( r->r_snet, "%d <%s> %s\r\n", reply_code,
+	    if ( snet_writef( r->r_snet, "%d %s %s\r\n", reply_code,
 		    simta_hostname, msg ? msg : boilerplate ) < 0 ) {
 		syslog( LOG_ERR, "Syserror: Receive [%s] %s: "
 			"smtp_banner_message: snet_writef: %m",


Revert "Improve SMTP receive session responsiveness"

This reverts commit ac4f1fe40a2d9eb5bce83559297a6d5bba9e9cbe.

--- receive.c
+++ receive.c
@@ -356,15 +356,15 @@
     int
 reset( struct receive_data *r )
 {
+    if ( deliver_accepted( r ) != RECEIVE_OK ) {
+	return( RECEIVE_SYSERROR );
+    }
+
     if ( r->r_env != NULL ) {
-	if ( r->r_env->e_flags & ENV_FLAG_EFILE ) {
-	    queue_envelope( r->r_env );
-	} else {
-	    syslog( LOG_INFO, "Receive [%s] %s: %s: Message Failed: Abandoned",
-		    inet_ntoa( r->r_sin->sin_addr ), r->r_remote_hostname,
-		    r->r_env->e_id );
-	    env_free( r->r_env );
-	}
+	syslog( LOG_INFO, "Receive [%s] %s: %s: Message Failed: Abandoned",
+		inet_ntoa( r->r_sin->sin_addr ), r->r_remote_hostname,
+		r->r_env->e_id );
+	env_free( r->r_env );
 	r->r_env = NULL;
     }

@@ -2132,6 +2132,10 @@
 	    inet_ntoa( r->r_sin->sin_addr ), r->r_remote_hostname,
 	    r->r_smtp_command );

+    if ( deliver_accepted( r ) != RECEIVE_OK ) {
+	return( RECEIVE_SYSERROR );
+    }
+
     tarpit_sleep( r, 0 );

     return( smtp_write_banner( r, 250, "simta", version ));
@@ -2145,7 +2149,6 @@
 	    inet_ntoa( r->r_sin->sin_addr ), r->r_remote_hostname,
 	    r->r_smtp_command );

-    /* If they have time to ask for help, we have time to deliver */
     if ( deliver_accepted( r ) != RECEIVE_OK ) {
 	return( RECEIVE_SYSERROR );
     }
@@ -2186,6 +2189,10 @@
 	    inet_ntoa( r->r_sin->sin_addr ), r->r_remote_hostname,
 	    r->r_smtp_command );

+    if ( deliver_accepted( r ) != RECEIVE_OK ) {
+	return( RECEIVE_SYSERROR );
+    }
+
     tarpit_sleep( r, 0 );

     return( smtp_write_banner( r, 502, NULL, NULL ));
@@ -3171,7 +3178,6 @@
     }

     reset( &r );
-    deliver_accepted( &r );

 #ifdef HAVE_LIBSSL
     md_cleanup( &r.r_md );


If you have time to NOOP, we have time to deliver mail.

--- receive.c
+++ receive.c
@@ -1673,6 +1673,10 @@
 {
     if ( r->r_smtp_mode == SMTP_MODE_TARPIT ) {
 	tarpit_sleep( 0 );
+    }
+
+    if ( reset( r ) != 0 ) {
+	return( RECEIVE_SYSERROR );
     }

     if ( snet_writef( r->r_snet, "%d simta v%s\r\n", 250, version ) < 0 ) {


- Fix uninitialized pointer crash. - Add headers for some other integrators.

--- SimTKmath/Geometry/include/simmath/internal/GeodesicGeometry.h
+++ SimTKmath/Geometry/include/simmath/internal/GeodesicGeometry.h
@@ -32,6 +32,8 @@
 #include "SimTKcommon.h"
 #include "simmath/Differentiator.h"
 #include "simmath/RungeKutta3Integrator.h"
+#include "simmath/RungeKuttaMersonIntegrator.h"
+#include "simmath/RungeKuttaFeldbergIntegrator.h"
 #include "simmath/TimeStepper.h"
 #include "simmath/internal/Geodesic.h"
 #include "simmath/internal/ParticleOnSurfaceSystem.h"
@@ -164,12 +166,13 @@
 class SimTK_SIMMATH_EXPORT GeodesicGeometry {

 public:
-    GeodesicGeometry(const ContactGeometry& geom) :
-            geom(geom), ptOnSurfSys(geom), splitGeodErr(0) {
+    GeodesicGeometry(const ContactGeometry& geom)
+    :   geom(geom), ptOnSurfSys(geom),
+        geodHitPlaneEvent(0), vizReporter(0), splitGeodErr(0)
+    {
         geodHitPlaneEvent = new GeodHitPlaneEvent();
         ptOnSurfSys.addEventHandler(geodHitPlaneEvent); // takes ownership
         ptOnSurfSys.realizeTopology();
-
     }


Moved MATH_DEBUG to mathUtil. despot2 now tries to fit from multiple B0 starting points.

--- despot2_main.c
+++ despot2_main.c
@@ -11,15 +11,18 @@
 #include <time.h>
 #include <stdbool.h>
 #include <dispatch/dispatch.h>
+
 #ifdef __APPLE__
 	#include <libkern/OSAtomic.h>
 	#define AtomicAdd OSAtomicAdd32
 #else
 	#define AtomicAdd(x, y) (*y)++
 #endif
+
 #include "DESPOT.h"
 #include "nifti_tools.h"
 #include "znzlib.h"
+#include "mathArray.h"

 char *usage = "Usage is: despot2 [options] output_prefix T1_map ssfp_file1 [ssfp_fileN] \n\
 \
@@ -172,8 +175,8 @@

 		__block int voxCount = 0;
 		clock_t loopStart = clock();
-		for (size_t vox = 0; vox < voxelsPerSlice; vox++)
-		//void (^processVoxel)(size_t vox) = ^(size_t vox)
+		//for (size_t vox = 0; vox < voxelsPerSlice; vox++)
+		void (^processVoxel)(size_t vox) = ^(size_t vox)
 		{
 			double params[NR];
 			arraySet(params, 0., NR);
@@ -194,18 +197,22 @@
 						signals[p][img] = (double)ssfpData[p][voxelsPerSlice * img + vox];
 				}

-				if (nPhases == 1)
-					classicDESPOT2(ssfpAngles[0], signals[0], nSSFP[0], ssfpTR, T1, B1, params);
-				else
-				{
-					// Find the phase with highest mean
-					double means[nPhases];
-					size_t indxs[nPhases];
+				// Find the phase with highest mean, then classic DESPOT2
+				double means[nPhases];
+				size_t indxs[nPhases];
+				for (int p = 0; p < nPhases; p++)
+					means[p] = arrayMean(signals[p], nSSFP[p]);
+				arrayIndexSort(means, indxs, SORT_DESCEND, nPhases);
+				classicDESPOT2(ssfpAngles[indxs[0]], signals[indxs[0]],
+				               nSSFP[indxs[0]], ssfpTR, T1, B1, params);
+
+				if (params[1] > 0) // Only bother if we got a sensible guess from classic DESPOT
+				{	// Try fits with different B0 start and take lowest res
 					double *consts[nPhases];
-					eval_array_type *fs[nPhases];
+					eval_array_type *fs[nPhases];
+
 					for (int p = 0; p < nPhases; p++)
 					{
-						means[p] = arrayMean(signals[p], nSSFP[p]);
 						arrayScale(signals[p], signals[p], 1. / means[p], nSSFP[p]);

 						consts[p] = arrayAlloc(4);
@@ -216,17 +223,33 @@

 						fs[p] = &a1cSSFP;
 					}
-					arrayIndexSort(means, indxs, SORT_DESCEND, nPhases);
-					// Do classic DESPOT2 on the highest mean (shouldn't be a signal null)
-					classicDESPOT2(ssfpAngles[indxs[0]], signals[indxs[0]], nSSFP[indxs[0]], ssfpTR, T1, B1, params);
-					// Now do a local fit to all the data including off-resonance
 					extern int MATH_DEBUG;
 					MATH_DEBUG = 1;
-					if ((params[0] > 0.) && (params[1] > 0.))
-						levMar(&(params[1]), 2, consts, ssfpAngles, signals, fs, NULL, nSSFP, nPhases, true, &(params[3]));
-					//contractDESPOT2(nPhases, nSSFP, ssfpPhases, ssfpAngles, signals,
-					//			    ssfpTR, T1, B1, params + 1); // Skip M0
+					double res = DBL_MAX;
+					double T2guess = params[1];
+					for (int i = 0; i < 10; i++)
+					{
+						double tempParams[2] = { T2guess, i / (10. * ssfpTR) }, tempRes;
+						levMar(tempParams, 2, consts, ssfpAngles, signals, fs, NULL, nSSFP, nPhases, true, &tempRes);
+						if (tempRes < res)
+						{
+							res = tempRes;
+							params[1] = tempParams[0];
+							params[2] = tempParams[1];
+						}
+					}
+					params[3] = res;
 				}
+				if (params[0] < 0.) params[0] = 0.;
+				if (params[1] < 0.) params[1] = 0.;
+				if (params[1] > 250.) params[1] = 250.;
+				params[2] = fmod(params[2], 1./ssfpTR);
+				if (params[2] < -.5/ssfpTR)
+					params[2] += 1./ssfpTR;
+				if (params[2] >  .5/ssfpTR)
+					params[2] -= 1./ssfpTR;
+				params[2] *= 1.e3;           // Convert B0 to Hz
+				params[3] = indxs[0];

 				// Clean up memory
 				for (int p = 0; p < nPhases; p++)
@@ -235,8 +258,8 @@
 			for (int p = 0; p < NR; p++)
 				resultsSlices[p][vox]  = (float)params[p];
 		};
-		//dispatch_queue_t global_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
-		//dispatch_apply(voxelsPerSlice, global_queue, processVoxel);
+		dispatch_queue_t global_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
+		dispatch_apply(voxelsPerSlice, global_queue, processVoxel);

         clock_t loopEnd = clock();
         fprintf(stdout, "Finished slice %zu", slice);


Fix Frenglish transliteration.

Fix Frenglish transliteration.

NO CODE CHANGE.

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@808 0039d316-1c4b-4281-b951-d872f2087c98

--- base/thread.h
+++ base/thread.h
@@ -94,14 +94,14 @@
   // Signals the thread to exit in the near future.
   //
   // WARNING: This function is not meant to be commonly used. Use at your own
-  // risk. Calling this function will cause message_loop() being invalidated in
+  // risk. Calling this function will cause message_loop() to become invalid in
   // the near future. This function was created to workaround a specific
   // deadlock on Windows with printer worker thread. In any other case, Stop()
   // should be used.
   //
-  // StopSoon should not called multiple times and is risky to do so. It could
-  // cause a timing issue in message_loop() access. Call Stop() to reset the
-  // thread object once it is known that the thread has quit.
+  // StopSoon should not be called multiple times as it is risky to do so. It
+  // could cause a timing issue in message_loop() access. Call Stop() to reset
+  // the thread object once it is known that the thread has quit.
   void StopSoon();

   // Returns the message loop for this thread.  Use the MessageLoop's


Account for the aligned m_data when checking boundaries; from NetBSD. mickey and millert ok.

--- dev/ic/if_wi.c
+++ dev/ic/if_wi.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_wi.c,v 1.85 2002/10/18 03:35:56 fgsch Exp $	*/
+/*	$OpenBSD: if_wi.c,v 1.86 2002/10/18 03:46:35 fgsch Exp $	*/

 /*
  * Copyright (c) 1997, 1998, 1999
@@ -124,7 +124,7 @@

 #if !defined(lint) && !defined(__OpenBSD__)
 static const char rcsid[] =
-	"$OpenBSD: if_wi.c,v 1.85 2002/10/18 03:35:56 fgsch Exp $";
+	"$OpenBSD: if_wi.c,v 1.86 2002/10/18 03:46:35 fgsch Exp $";
 #endif	/* lint */

 #ifdef foo
@@ -466,7 +466,9 @@
 	struct ifnet		*ifp;
 	struct ether_header	*eh;
 	struct mbuf		*m;
+	caddr_t			olddata;
 	u_int16_t		msg_type;
+	int			maxlen;
 	int			id;

 	ifp = &sc->sc_arpcom.ac_if;
@@ -589,11 +591,13 @@
 			return;
 		}

+		olddata = m->m_data;
 		/* Align the data after the ethernet header */
 		m->m_data = (caddr_t)ALIGN(m->m_data +
 		    sizeof(struct ether_header)) - sizeof(struct ether_header);

 		eh = mtod(m, struct ether_header *);
+		maxlen = MCLBYTES - (m->m_data - olddata);
 		m->m_pkthdr.rcvif = ifp;

 		if (msg_type == WI_STAT_MGMT &&
@@ -601,7 +605,7 @@

 			u_int16_t rxlen = letoh16(rx_frame.wi_dat_len);

-			if ((WI_802_11_OFFSET_RAW + rxlen + 2) > MCLBYTES) {
+			if ((WI_802_11_OFFSET_RAW + rxlen + 2) > maxlen) {
 				printf("%s: oversized mgmt packet received in "
 				    "hostap mode (wi_dat_len=%d, "
 				    "wi_status=0x%x)\n", sc->sc_dev.dv_xname,
@@ -639,7 +643,7 @@
 		case WI_STAT_TUNNEL:
 		case WI_STAT_WMP_MSG:
 			if ((letoh16(rx_frame.wi_dat_len) + WI_SNAPHDR_LEN) >
-			    MCLBYTES) {
+			    maxlen) {
 				printf(WI_PRT_FMT ": oversized packet received "
 				    "(wi_dat_len=%d, wi_status=0x%x)\n",
 				    WI_PRT_ARG(sc),
@@ -669,7 +673,7 @@
 			break;
 		default:
 			if ((letoh16(rx_frame.wi_dat_len) +
-			    sizeof(struct ether_header)) > MCLBYTES) {
+			    sizeof(struct ether_header)) > maxlen) {
 				printf(WI_PRT_FMT ": oversized packet received "
 				    "(wi_dat_len=%d, wi_status=0x%x)\n",
 				    WI_PRT_ARG(sc),


drm/i915: Propagate invalid setcrtc cloning errors back to userspace

When invalid cloning configurations were detected during modeset, we
never copied the error code into the return value variable, leading us
to return 0 (success) to userspace.

This regression has been introduced in

commit 50f5275698df4490046cc5b4ed2018abb642a803
Author: Jesse Barnes <bc7add126c2dbb8382bf1c28ac262b9363a32706@virtuousgeek.org>
Date:   Fri Nov 7 13:11:00 2014 -0800

    drm/i915: use compute_config in set_config v4

Testcase: igt/kms_setmode
Signed-off-by: Matt Roper <f1605a76cb9f6387d99228a0a9260318379b62de@intel.com>
Reviewed-by: Ville Syrjälä <cd6e8d405ca90be3a03d5427c5b24fbd2d68dcc4@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86226
Reviewed-by: Jesse Barnes <bc7add126c2dbb8382bf1c28ac262b9363a32706@virtuousgeek.org>
Signed-off-by: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@ffwll.ch>

--- drivers/gpu/drm/i915/intel_display.c
+++ drivers/gpu/drm/i915/intel_display.c
@@ -11469,6 +11469,7 @@
 						   &prepare_pipes,
 						   &disable_pipes);
 	if (IS_ERR(pipe_config)) {
+		ret = PTR_ERR(pipe_config);
 		goto fail;
 	} else if (pipe_config) {
 		if (to_intel_crtc(set->crtc)->new_config->has_audio !=


Minor style fixup.

Minor style fixup.

--- dev/pci/ahci.c
+++ dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ahci.c,v 1.82 2007/03/20 07:09:42 pascoe Exp $ */
+/*	$OpenBSD: ahci.c,v 1.83 2007/03/20 07:36:21 pascoe Exp $ */

 /*
  * Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -1614,9 +1614,9 @@

 	sig = ahci_pread(ap, AHCI_PREG_SIG);
 	if ((sig & 0xffff0000) == 0xeb140000)
-		return ATA_PORT_T_ATAPI;
+		return (ATA_PORT_T_ATAPI);
 	else
-		return ATA_PORT_T_DISK;
+		return (ATA_PORT_T_DISK);
 }

 struct ata_xfer *


* packages/freebsd/apr/files/patch-apr-misc-unix-getopt.c
  patch up the getopt code to work around a crash when no long name is
  present.  this has already been committed upstream, and adding it as
  a patch is just a temporary fix to keep subversion from segfaulting
  when you do 'svn --version' until i have a chance to update the port
  to a newer version of apr.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@843014 13f79535-47bb-0310-9956-ffa450edef68

error: pathspec 'packages/freebsd/apr/files/patch-apr-misc-unix-getopt.c' did not match any file(s) known to git

--- packages/freebsd/apr/files/patch-apr-misc-unix-getopt.c
+++ packages/freebsd/apr/files/patch-apr-misc-unix-getopt.c
@@ -0,0 +1,15 @@
+--- apr/misc/unix/getopt.c.orig	Thu Nov 29 06:19:51 2001
++++ apr/misc/unix/getopt.c	Sun Aug 11 11:29:01 2002
+@@ -237,10 +237,12 @@
+ 	    for (i = 0; ; i++) {
+ 	        if (opts[i].optch == 0)             /* No match */
+ 		    return serr(os, "invalid option", p - 2, APR_BADCH);
++		if (opts[i].name) {
+ 		len = strlen(opts[i].name);
+ 		if (strncmp(p, opts[i].name, len) == 0
+ 		    && (p[len] == '\0' || p[len] == '='))
+ 		    break;
++		}
+ 	    }
+ 	    *optch = opts[i].optch;
+


drm/i915: Don't populate pipe_src_{w,h} multiple times

If we ever end up doing the retry loop due to bandwidth constraints, we
would rewrite pipe_src_{w,n} based on adjusted_mode timings. But by that
time the encoder may have already replaced the adjusted_mode with a
fixed panel mode, which would then corrupt pipe_src_{w,h}.

v2: Use requested_mode and slap on a big comment from Daniel

Signed-off-by: Ville Syrjälä <cd6e8d405ca90be3a03d5427c5b24fbd2d68dcc4@linux.intel.com>
Signed-off-by: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@ffwll.ch>

--- drivers/gpu/drm/i915/intel_display.c
+++ drivers/gpu/drm/i915/intel_display.c
@@ -8529,6 +8529,18 @@
 	if (plane_bpp < 0)
 		goto fail;

+	/*
+	 * Determine the real pipe dimensions. Note that stereo modes can
+	 * increase the actual pipe size due to the frame doubling and
+	 * insertion of additional space for blanks between the frame. This
+	 * is stored in the crtc timings. We use the requested mode to do this
+	 * computation to clearly distinguish it from the adjusted mode, which
+	 * can be changed by the connectors in the below retry loop.
+	 */
+	drm_mode_set_crtcinfo(&pipe_config->requested_mode, CRTC_STEREO_DOUBLE);
+	pipe_config->pipe_src_w = pipe_config->requested_mode.crtc_hdisplay;
+	pipe_config->pipe_src_h = pipe_config->requested_mode.crtc_vdisplay;
+
 encoder_retry:
 	/* Ensure the port clock defaults are reset when retrying. */
 	pipe_config->port_clock = 0;
@@ -8536,10 +8548,6 @@

 	/* Fill in default crtc timings, allow encoders to overwrite them. */
 	drm_mode_set_crtcinfo(&pipe_config->adjusted_mode, CRTC_STEREO_DOUBLE);
-
-	/* set_crtcinfo() may have adjusted hdisplay/vdisplay */
-	pipe_config->pipe_src_w = pipe_config->adjusted_mode.crtc_hdisplay;
-	pipe_config->pipe_src_h = pipe_config->adjusted_mode.crtc_vdisplay;

 	/* Pass our mode to the connectors and the CRTC to give them a chance to
 	 * adjust it according to limitations or connector properties, and also


Add degraded raid 1 io path code

Add degraded raid 1 io path code

--- dev/softraid.c
+++ dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.18 2007/04/12 03:31:54 marco Exp $ */
+/* $OpenBSD: softraid.c,v 1.19 2007/04/14 15:50:28 marco Exp $ */
 /*
  * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
  *
@@ -1246,12 +1246,18 @@
 	struct scsi_xfer	*xs = wu->swu_xs;
 	struct sr_workunit	*wup;
 	struct sr_ccb		*ccb;
-	int			rv = 1, ios, x, i, s;
+	struct sr_chunk		*scp;
+	int			ios, x, i, s, rt;
 	daddr64_t		blk;

 	DNPRINTF(SR_D_DIS, "%s: sr_raid1_rw 0x%02x\n", DEVNAME(sd->sd_sc),
 	    xs->cmd->opcode);

+	if (sd->sd_vol.sv_meta.svm_status == BIOC_SVOFFLINE) {
+		DNPRINTF(SR_D_DIS, "%s: sr_raid1_rw device offline\n",
+		    DEVNAME(sd->sd_sc));
+		goto bad;
+	}

 	if (xs->datalen == 0) {
 		printf("%s: %s: illegal block count\n",
@@ -1287,14 +1293,56 @@
 			goto bad;
 		}

-		if (xs->flags & SCSI_POLL) {
-			ccb->ccb_buf.b_flags = 0;
-			ccb->ccb_buf.b_iodone = NULL;
+		if (xs->flags & SCSI_DATA_IN) {
+			rt = 0;
+ragain:
+			/* interleave reads */
+			x = sd->mds.mdd_raid1.sr1_counter++ %
+				sd->sd_vol.sv_meta.svm_no_chunk;
+			scp = sd->sd_vol.sv_chunks[x];
+			switch (scp->src_meta.scm_status) {
+			case BIOC_SDONLINE:
+			case BIOC_SDSCRUB:
+				ccb->ccb_buf.b_flags |= B_READ;
+				break;
+
+			case BIOC_SDOFFLINE:
+			case BIOC_SDREBUILD:
+			case BIOC_SDHOTSPARE:
+				if (rt++ < sd->sd_vol.sv_meta.svm_no_chunk)
+					goto ragain;
+
+				/* FALLTHROUGH */
+			default:
+				/* volume offline */
+				printf("%s: is offline, can't read\n",
+				    DEVNAME(sd->sd_sc));
+				sr_put_ccb(ccb);
+				goto bad;
+			}
 		} else {
-			ccb->ccb_buf.b_flags = B_CALL;
-			ccb->ccb_buf.b_iodone = sr_raid1_intr;
-		}
-
+			/* writes go on all working disks */
+			x = i;
+			scp = sd->sd_vol.sv_chunks[x];
+			switch (scp->src_meta.scm_status) {
+			case BIOC_SDONLINE:
+			case BIOC_SDSCRUB:
+			case BIOC_SDREBUILD:
+				ccb->ccb_buf.b_flags |= B_WRITE;
+				break;
+
+			case BIOC_SDHOTSPARE: /* should never happen */
+			case BIOC_SDOFFLINE:
+				ios--;
+				sr_put_ccb(ccb);
+				continue;
+
+			default:
+				goto bad;
+			}
+
+		}
+		ccb->ccb_target = x;
 		ccb->ccb_buf.b_blkno = blk;
 		ccb->ccb_buf.b_bcount = xs->datalen;
 		ccb->ccb_buf.b_bufsize = xs->datalen;
@@ -1302,27 +1350,18 @@
 		ccb->ccb_buf.b_data = xs->data;
 		ccb->ccb_buf.b_error = 0;
 		ccb->ccb_buf.b_proc = curproc;
-
-		wu->swu_io_count = ios;
-		if (xs->flags & SCSI_DATA_IN) {
-			/* interleave reads */
-			x = sd->mds.mdd_raid1.sr1_counter %
-			    sd->sd_vol.sv_meta.svm_no_chunk;
-			sd->mds.mdd_raid1.sr1_counter++;
-			ccb->ccb_buf.b_flags |= B_READ;
-		} else {
-			/* writes go on all disks */
-			x = i;
-			ccb->ccb_buf.b_flags |= B_WRITE;
-		}
-
-		ccb->ccb_target = x;
+		ccb->ccb_wu = wu;
 		ccb->ccb_buf.b_dev = sd->sd_vol.sv_chunks[x]->src_dev_mm;
 		ccb->ccb_buf.b_vp = sd->sd_vol.sv_chunks[x]->src_dev_vn;
-
 		LIST_INIT(&ccb->ccb_buf.b_dep);

-		ccb->ccb_wu = wu;
+		if (xs->flags & SCSI_POLL) {
+			ccb->ccb_buf.b_flags = 0;
+			ccb->ccb_buf.b_iodone = NULL;
+		} else {
+			ccb->ccb_buf.b_flags = B_CALL;
+			ccb->ccb_buf.b_iodone = sr_raid1_intr;
+		}

 		TAILQ_INSERT_TAIL(&wu->swu_ccb, ccb, ccb_link);

@@ -1351,6 +1390,7 @@
 		}
 #endif
 	}
+	wu->swu_io_count = ios;

 	/* walk queue backwards and fill in collider if we have one */
 	s = splbio();
@@ -1377,10 +1417,10 @@

 queued:
 	splx(s);
-	rv = 0;
+	return (0);
 bad:
-	/* unwind the whole wu */
-	return (rv);
+	/* wu is unwound by sr_put_wu */
+	return (1);
 }

 void
@@ -1450,7 +1490,7 @@
 		pend = 0;
 		TAILQ_FOREACH(wup, &sd->sd_wu_pendq, swu_link) {
 			if (wu == wup) {
-				/* io on pendq, remove */
+				/* wu on pendq, remove */
 				TAILQ_REMOVE(&sd->sd_wu_pendq, wu, swu_link);
 				pend = 1;


(refactor) ide: Wrap code into cycle

(refactor) ide: Wrap code into cycle

--- src/drivers/block_dev/ide/ide_drive.c
+++ src/drivers/block_dev/ide/ide_drive.c
@@ -689,39 +689,30 @@
 	int masterif;
 	int slaveif;
 	int numhd;
+	int i;
+	int irq[] = {HDC0_IRQ, HDC1_IRQ};
+	int iobase[] = {HDC0_IOBASE, HDC1_IOBASE};
+
 	numhd = HD_DRIVES;

 	idedisk_idx = &harddisk_idx;

-	if (numhd >= 1)  {
-		rc = setup_controller(&hdctab[0], HDC0_IOBASE,
-				HDC0_IRQ, 0, &masterif, &slaveif);
+	for (i = 0; i < HD_CONTROLLERS; i++) {
+		if (numhd < i * 2 + 1)
+			break;
+
+		rc = setup_controller(&hdctab[i], iobase[i],
+				irq[i], 0, &masterif, &slaveif);
 		if (rc >= 0) {
-			if (numhd >= 1 && masterif > HDIF_UNKNOWN) {
-				setup_hd(&hdtab[0], &hdctab[0], HD0_DRVSEL,
-						BM_SR_DRV0, masterif, 0);
-			}
-			if (numhd >= 2 && slaveif > HDIF_UNKNOWN) {
-				setup_hd(&hdtab[1], &hdctab[0], HD1_DRVSEL,
-						BM_SR_DRV1, slaveif, 1);
-			}
-		}
-	}
-
-	if (numhd >= 3) {
-		rc = setup_controller(&hdctab[1], HDC1_IOBASE,
-				HDC1_IRQ, 0, &masterif, &slaveif);
-		if (rc >= 0) {
-			if (numhd >= 3 && masterif > HDIF_UNKNOWN) {
-				setup_hd(&hdtab[2], &hdctab[1], HD0_DRVSEL,
-						BM_SR_DRV0, masterif, 2);
-			}
-			if (numhd >= 4 && slaveif > HDIF_UNKNOWN) {
-				setup_hd(&hdtab[3], &hdctab[1], HD1_DRVSEL,
-						BM_SR_DRV1, slaveif, 3);
-			}
-		}
-	}
+			if (numhd >= i * 2 + 1 && masterif > HDIF_UNKNOWN)
+				setup_hd(&hdtab[i * 2], &hdctab[i], HD0_DRVSEL,
+						BM_SR_DRV0, masterif, i * 2);
+			if (numhd >= i * 2 + 2 && slaveif > HDIF_UNKNOWN)
+				setup_hd(&hdtab[i * 2 + 1], &hdctab[i], HD1_DRVSEL,
+						BM_SR_DRV1, slaveif, i * 2 + 1);
+		}
+	}
+
 	return 0;
 }


Fix clct(4) audio driver which was stuttering to the point of being useless. Tested on Thinkpad X21 by me. All the hard work was done by ratchov@. I just made some cosmetic fixes while here. ok ratchov@ deraadt@

--- dev/pci/cs4281.c
+++ dev/pci/cs4281.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: cs4281.c,v 1.33 2015/08/03 09:20:44 stsp Exp $ */
+/*	$OpenBSD: cs4281.c,v 1.34 2015/08/04 14:53:08 stsp Exp $ */
 /*	$Tera: cs4281.c,v 1.18 2000/12/27 14:24:45 tacha Exp $	*/

 /*
@@ -66,14 +66,12 @@
 struct cs4281_dma {
 	bus_dmamap_t map;
 	caddr_t addr;		/* real dma buffer */
-	caddr_t dum;		/* dummy buffer for audio driver */
 	bus_dma_segment_t segs[1];
 	int nsegs;
 	size_t size;
 	struct cs4281_dma *next;
 };
 #define DMAADDR(p) ((p)->map->dm_segs[0].ds_addr)
-#define BUFADDR(p)  ((void *)((p)->dum))
 #define KERNADDR(p) ((void *)((p)->addr))

 /*
@@ -95,19 +93,10 @@
 	/* DMA */
 	bus_dma_tag_t		sc_dmatag;
 	struct cs4281_dma	*sc_dmas;
-	size_t dma_size;
-	size_t dma_align;
-
-	int	hw_blocksize;

         /* playback */
 	void	(*sc_pintr)(void *);	/* dma completion intr handler */
 	void	*sc_parg;		/* arg for sc_intr() */
-	char	*sc_ps, *sc_pe, *sc_pn;
-	int	sc_pcount;
-	int	sc_pi;
-	struct cs4281_dma *sc_pdma;
-	char	*sc_pbuf;
 	int	(*halt_output)(void *);
 #ifdef DIAGNOSTIC
         char	sc_prun;
@@ -116,11 +105,6 @@
 	/* capturing */
 	void	(*sc_rintr)(void *);	/* dma completion intr handler */
 	void	*sc_rarg;		/* arg for sc_intr() */
-	char	*sc_rs, *sc_re, *sc_rn;
-	int	sc_rcount;
-	int	sc_ri;
-	struct	cs4281_dma *sc_rdma;
-	char	*sc_rbuf;
 	int	sc_rparam;		/* record format */
 	int	(*halt_input)(void *);
 #ifdef DIAGNOSTIC
@@ -151,6 +135,16 @@
 #define MAX_CHANNELS  (2)
 #define MAX_FIFO_SIZE 64 /* 128/2 channels */
 #endif
+
+/*
+ * Hardware imposes the buffer size to be twice the block size, this
+ * is OK, except that round_blocksize() is the only mean to expose
+ * this hardware constraint but it doesn't know the buffer size.
+ *
+ * So we've no other choice than hardcoding a buffer size
+ */
+#define DMA_SIZE	(1024 * 4 * 2)
+#define DMA_ALIGN	0x10

 int cs4281_match(struct device *, void *, void *);
 void cs4281_attach(struct device *, struct device *, void *);
@@ -333,7 +327,7 @@
 		printf("\n");
 		return;
 	}
-	printf(" %s\n", intrstr);
+	printf(": %s\n", intrstr);

 	/*
 	 * Sound System start-up
@@ -344,10 +338,6 @@
 	sc->halt_input  = cs4281_halt_input;
 	sc->halt_output = cs4281_halt_output;

-	sc->dma_size     = CS4281_BUFFER_SIZE / MAX_CHANNELS;
-	sc->dma_align    = 0x10;
-	sc->hw_blocksize = sc->dma_size / 2;
-
 	/* AC 97 attachment */
 	sc->host_if.arg = sc;
 	sc->host_if.attach = cs4281_attach_codec;
@@ -372,14 +362,13 @@
 {
 	struct cs4281_softc *sc = p;
 	u_int32_t intr, val;
-	char *empty_dma;

 	mtx_enter(&audio_lock);
 	intr = BA0READ4(sc, CS4281_HISR);
 	if (!(intr & (HISR_DMA0 | HISR_DMA1 | HISR_MIDI))) {
 		BA0WRITE4(sc, CS4281_HICR, HICR_IEV | HICR_CHGM);
 		mtx_leave(&audio_lock);
-		return (0);
+		return (-1);
 	}
 	DPRINTF(("cs4281_intr:"));

@@ -394,38 +383,26 @@
 		DPRINTF((" PB DMA 0x%x(%d)", (int)BA0READ4(sc, CS4281_DCA0),
 			 (int)BA0READ4(sc, CS4281_DCC0)));
 		if (sc->sc_pintr) {
-			if ((sc->sc_pi%sc->sc_pcount) == 0)
-				sc->sc_pintr(sc->sc_parg);
+			sc->sc_pintr(sc->sc_parg);
 		} else {
-			printf("unexpected play intr\n");
+#ifdef DIAGNOSTIC
+			printf("%s: unexpected play intr\n",
+			    sc->sc_dev.dv_xname);
+#endif
 		}
-		/* copy buffer */
-		++sc->sc_pi;
-		empty_dma = sc->sc_pdma->addr;
-		if (sc->sc_pi&1)
-			empty_dma += sc->hw_blocksize;
-		memcpy(empty_dma, sc->sc_pn, sc->hw_blocksize);
-		sc->sc_pn += sc->hw_blocksize;
-		if (sc->sc_pn >= sc->sc_pe)
-			sc->sc_pn = sc->sc_ps;
 	}
 	if (intr & HISR_DMA1) {
 		val = BA0READ4(sc, CS4281_HDSR1);
 		/* copy from dma */
 		DPRINTF((" CP DMA 0x%x(%d)", (int)BA0READ4(sc, CS4281_DCA1),
 			 (int)BA0READ4(sc, CS4281_DCC1)));
-		++sc->sc_ri;
-		empty_dma = sc->sc_rdma->addr;
-		if ((sc->sc_ri & 1) == 0)
-			empty_dma += sc->hw_blocksize;
-		memcpy(sc->sc_rn, empty_dma, sc->hw_blocksize);
-		if (sc->sc_rn >= sc->sc_re)
-			sc->sc_rn = sc->sc_rs;
 		if (sc->sc_rintr) {
-			if ((sc->sc_ri % sc->sc_rcount) == 0)
-				sc->sc_rintr(sc->sc_rarg);
+			sc->sc_rintr(sc->sc_rarg);
 		} else {
-			printf("unexpected record intr\n");
+#ifdef DIAGNOSTIC
+			printf("%s: unexpected record intr\n",
+			    sc->sc_dev.dv_xname);
+#endif
 		}
 	}
 	DPRINTF(("\n"));
@@ -586,7 +563,7 @@
 	struct audio_params *param;
 {
 	struct cs4281_softc *sc = addr;
-	u_int32_t fmt=0;
+	u_int32_t fmt = 0;
 	struct cs4281_dma *p;
 	int dma_count;

@@ -596,6 +573,14 @@
 	sc->sc_prun = 1;
 #endif

+	if ((char *)end - (char *)start != 2 * blksize) {
+#ifdef DIAGNOSTIC
+		printf("%s: play block size must be half the buffer size\n",
+		    sc->sc_dev.dv_xname);
+#endif
+		return EIO;
+	}
+
 	DPRINTF(("cs4281_trigger_output: sc=%p start=%p end=%p "
 		 "blksize=%d intr=%p(%p)\n", addr, start, end, blksize, intr, arg));
 	sc->sc_pintr = intr;
@@ -607,7 +592,7 @@
 	DPRINTF(("param: precision=%d channels=%d encoding=%d\n",
 	       param->precision, param->channels,
 	       param->encoding));
-	for (p = sc->sc_dmas; p != NULL && BUFADDR(p) != start; p = p->next)
+	for (p = sc->sc_dmas; p != NULL && KERNADDR(p) != start; p = p->next)
 		;
 	if (p == NULL) {
 		printf("cs4281_trigger_output: bad addr %p\n", start);
@@ -615,23 +600,7 @@
 		return (EINVAL);
 	}

-	sc->sc_pcount = blksize / sc->hw_blocksize;
-	sc->sc_ps = (char *)start;
-	sc->sc_pe = (char *)end;
-	sc->sc_pdma = p;
-	sc->sc_pbuf = KERNADDR(p);
-	sc->sc_pi = 0;
-	sc->sc_pn = sc->sc_ps;
-	if (blksize >= sc->dma_size) {
-		sc->sc_pn = sc->sc_ps + sc->dma_size;
-		memcpy(sc->sc_pbuf, start, sc->dma_size);
-		++sc->sc_pi;
-	} else {
-		sc->sc_pn = sc->sc_ps + sc->hw_blocksize;
-		memcpy(sc->sc_pbuf, start, sc->hw_blocksize);
-	}
-
-	dma_count = sc->dma_size;
+	dma_count = (char *)end - (char *)start;
 	if (param->precision != 8)
 		dma_count /= 2;   /* 16 bit */
 	if (param->channels > 1)
@@ -640,7 +609,7 @@
 	DPRINTF(("cs4281_trigger_output: DMAADDR(p)=0x%x count=%d\n",
 		 (int)DMAADDR(p), dma_count));
 	BA0WRITE4(sc, CS4281_DBA0, DMAADDR(p));
-	BA0WRITE4(sc, CS4281_DBC0, dma_count-1);
+	BA0WRITE4(sc, CS4281_DBC0, dma_count - 1);

 	/* set playback format */
 	fmt = BA0READ4(sc, CS4281_DMR0) & ~DMRn_FMTMSK;
@@ -693,8 +662,16 @@
 {
 	struct cs4281_softc *sc = addr;
 	struct cs4281_dma *p;
-	u_int32_t fmt=0;
+	u_int32_t fmt = 0;
 	int dma_count;
+
+	if ((char *)end - (char *)start != 2 * blksize) {
+#ifdef DIAGNOSTIC
+		printf("%s: rec block size must be half the buffer size\n",
+		    sc->sc_dev.dv_xname);
+#endif
+		return EIO;
+	}

 #ifdef DIAGNOSTIC
 	if (sc->sc_rrun)
@@ -709,23 +686,15 @@
 	/* stop recording DMA */
 	BA0WRITE4(sc, CS4281_DCR1, BA0READ4(sc, CS4281_DCR1) | DCRn_MSK);

-	for (p = sc->sc_dmas; p && BUFADDR(p) != start; p = p->next)
+	for (p = sc->sc_dmas; p && KERNADDR(p) != start; p = p->next)
 		;
 	if (!p) {
 		printf("cs4281_trigger_input: bad addr %p\n", start);
 		return (EINVAL);
 	}

-	sc->sc_rcount = blksize / sc->hw_blocksize;
-	sc->sc_rs = (char *)start;
-	sc->sc_re = (char *)end;
-	sc->sc_rdma = p;
-	sc->sc_rbuf = KERNADDR(p);
-	sc->sc_ri = 0;
-	sc->sc_rn = sc->sc_rs;
-
-	dma_count = sc->dma_size;
-	if (param->precision == 8)
+	dma_count = (char *)end - (char *)start;
+	if (param->precision != 8)
 		dma_count /= 2;
 	if (param->channels > 1)
 		dma_count /= 2;
@@ -1157,7 +1126,8 @@
 	while((BA0READ4(sc, CS4281_ACSTS) & ACSTS_CRDY) == 0) {
 		delay(100);
 		if (++n > 1000) {
-			printf("reset_codec: AC97 codec ready timeout\n");
+			printf("%s: AC97 codec ready timeout\n",
+			    sc->sc_dev.dv_xname);
 			return;
 		}
 	}
@@ -1244,20 +1214,7 @@
 int
 cs4281_round_blocksize(void *addr, int blk)
 {
-	struct cs4281_softc *sc;
-	int retval;
-
-	DPRINTFN(5,("cs4281_round_blocksize blk=%d -> ", blk));
-
-	sc=addr;
-	if (blk < sc->hw_blocksize)
-		retval = sc->hw_blocksize;
-	else
-		retval = blk & -(sc->hw_blocksize);
-
-	DPRINTFN(5,("%d\n", retval));
-
-	return (retval);
+	return DMA_SIZE / 2;
 }

 int
@@ -1313,7 +1270,7 @@

 	p->next = sc->sc_dmas;
 	sc->sc_dmas = p;
-	return (BUFADDR(p));
+	return (KERNADDR(p));
 }

@@ -1326,12 +1283,11 @@

 	sc = addr;
 	for (pp = &sc->sc_dmas; (p = *pp) != NULL; pp = &p->next) {
-		if (BUFADDR(p) == ptr) {
+		if (KERNADDR(p) == ptr) {
 			bus_dmamap_unload(sc->sc_dmatag, p->map);
 			bus_dmamap_destroy(sc->sc_dmatag, p->map);
 			bus_dmamem_unmap(sc->sc_dmatag, p->addr, p->size);
 			bus_dmamem_free(sc->sc_dmatag, p->segs, p->nsegs);
-			free(p->dum, pool, 0);
 			*pp = p->next;
 			free(p, pool, 0);
 			return;
@@ -1342,13 +1298,7 @@
 size_t
 cs4281_round_buffersize(void *addr, int direction, size_t size)
 {
-	/* The real dma buffersize are 4KB for CS4280
-	 * and 64kB/MAX_CHANNELS for CS4281.
-	 * But they are too small for high quality audio,
-	 * let the upper layer(audio) use a larger buffer.
-	 * (originally suggested by Lennart Augustsson.)
-	 */
-	return (size);
+	return (DMA_SIZE);
 }

 paddr_t
@@ -1361,7 +1311,7 @@
 	if (off < 0)
 		return -1;

-	for (p = sc->sc_dmas; p && BUFADDR(p) != mem; p = p->next)
+	for (p = sc->sc_dmas; p && KERNADDR(p) != mem; p = p->next)
 		;

 	if (!p) {
@@ -1471,15 +1421,17 @@
 		struct cs4281_dma *p)
 {
 	int error;
-	size_t align;
-
-	align   = sc->dma_align;
-	p->size = sc->dma_size;
+
+	if (size != DMA_SIZE) {
+		printf("%s: dma size is %zd should be %d\n",
+		    sc->sc_dev.dv_xname, size, DMA_SIZE);
+		return ENOMEM;
+
+	}
+	p->size = size;
+
 	/* allocate memory for upper audio driver */
-	p->dum  = malloc(size, pool, flags);
-	if (!p->dum)
-		return (1);
-	error = bus_dmamem_alloc(sc->sc_dmatag, p->size, align, 0,
+	error = bus_dmamem_alloc(sc->sc_dmatag, p->size, DMA_ALIGN, 0,
 				 p->segs, nitems(p->segs),
 				 &p->nsegs, BUS_DMA_NOWAIT);
 	if (error) {


Fix SSL_MODE_RELEASE_BUFFERS functionality

At some point in the past do_ssl3_write() used to return the number of
bytes written, or a value <= 0 on error. It now just returns a success/
error code and writes the number of bytes written to |tmpwrit|.

The SSL_MODE_RELEASE_BUFFERS code was still looking at the return code
for the number of bytes written rather than |tmpwrit|. This has the effect
that the buffers are not released when they are supposed to be.

Fixes #9490

Reviewed-by: Paul Dale <bc4a6b4cd7a8395c734c8eb5aef04a9c30188c85@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9505)

--- ssl/record/rec_layer_s3.c
+++ ssl/record/rec_layer_s3.c
@@ -639,8 +639,9 @@
              */
             s->s3.empty_fragment_done = 0;

-            if ((i == (int)n) && s->mode & SSL_MODE_RELEASE_BUFFERS &&
-                !SSL_IS_DTLS(s))
+            if (tmpwrit == n
+                    && (s->mode & SSL_MODE_RELEASE_BUFFERS) != 0
+                    && !SSL_IS_DTLS(s))
                 ssl3_release_write_buffer(s);

             *written = tot + tmpwrit;


macintosh/therm_windtunnel: Export I2C module alias information

The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the driver was matched using the I2C id_table or the
of_match_table. So the driver needs to export the I2C table and this
be built into the module or udev won't have the necessary information
to auto load the correct module when the device is added.

Signed-off-by: Javier Martinez Canillas <828c1a17681e8566a17a1a4801ea67306010b273@osg.samsung.com>
Signed-off-by: Michael Ellerman <864f124608374e06e4da1fa5d2e47ed839b95411@ellerman.id.au>


two more missing systrace_lock

two more missing systrace_lock

--- dev/systrace.c
+++ dev/systrace.c
@@ -275,7 +275,9 @@
 	if (ret)
 		return (ret);

+	systrace_lock();
 	lockmgr(&fst->lock, LK_EXCLUSIVE, NULL, curproc);
+	systrace_unlock();
 	if (pid) {
 		strp = systrace_findpid(fst, pid);
 		if (strp == NULL) {
@@ -396,7 +398,9 @@
 	struct str_process *strp;
 	struct str_policy *strpol;

+	systrace_lock();
 	lockmgr(&fst->lock, LK_EXCLUSIVE, NULL, curproc);
+	systrace_unlock();

 	/* Untrace all processes */
 	for (strp = TAILQ_FIRST(&fst->processes); strp;


Fix whitespace

Fix whitespace

--- src/drivers/hott_telemetry/messages.c
+++ src/drivers/hott_telemetry/messages.c
@@ -193,7 +193,7 @@
 		bool updated;
 		orb_check(home_sub, &updated);
 		if (updated) {
-		    /* get a local copy of the home position data */
+			/* get a local copy of the home position data */
 			struct home_position_s home;
 			memset(&home, 0, sizeof(home));
 			orb_copy(ORB_ID(home_position), home_sub, &home);
@@ -205,7 +205,7 @@

 		/* Distance from home */
 		if (home_position_set) {
-		    uint16_t dist = (uint16_t)get_distance_to_next_waypoint(home_lat, home_lon, lat, lon);
+			uint16_t dist = (uint16_t)get_distance_to_next_waypoint(home_lat, home_lon, lat, lon);

 			msg.distance_L = (uint8_t)dist & 0xff;
 			msg.distance_H = (uint8_t)(dist >> 8) & 0xff;
@@ -213,7 +213,7 @@
 			/* Direction back to home */
 			uint16_t bearing = (uint16_t)(get_bearing_to_next_waypoint(home_lat, home_lon, lat, lon) * M_RAD_TO_DEG_F);
 			msg.home_direction = (uint8_t)bearing >> 1;
-	    }
+		}
 	}

 	msg.stop = STOP_BYTE;
@@ -223,11 +223,11 @@
 void
 convert_to_degrees_minutes_seconds(double val, int *deg, int *min, int *sec)
 {
-    *deg = (int)val;
-
-    double delta = val - *deg;
-    const double min_d = delta * 60.0d;
-    *min = (int)min_d;
-    delta = min_d - *min;
-    *sec = (int)(delta * 10000.0d);
-}
+	*deg = (int)val;
+
+	double delta = val - *deg;
+	const double min_d = delta * 60.0d;
+	*min = (int)min_d;
+	delta = min_d - *min;
+	*sec = (int)(delta * 10000.0d);
+}


tell mii_attach where the phy is on the chip, rather than asking it to
probe every address and have bge_miibus_read fail at the wrong address.

needed to support recent chips which have phys in locations other than
phy address 1 (and removes a conditional in an io path).

--- dev/pci/if_bge.c
+++ dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_bge.c,v 1.311 2012/07/04 13:24:41 kettenis Exp $	*/
+/*	$OpenBSD: if_bge.c,v 1.312 2012/09/13 04:15:18 dlg Exp $	*/

 /*
  * Copyright (c) 2001 Wind River Systems
@@ -586,18 +586,6 @@
 	u_int32_t val, autopoll;
 	int i;

-	/*
-	 * Broadcom's own driver always assumes the internal
-	 * PHY is at GMII address 1. On some chips, the PHY responds
-	 * to accesses at all addresses, which could cause us to
-	 * bogusly attach the PHY 32 times at probe type. Always
-	 * restricting the lookup to address 1 is simpler than
-	 * trying to figure out which chips revisions should be
-	 * special-cased.
-	 */
-	if (phy != 1)
-		return (0);
-
 	/* Reading with autopolling on may trigger PCI errors */
 	autopoll = CSR_READ_4(sc, BGE_MI_MODE);
 	if (autopoll & BGE_MIMODE_AUTOPOLL) {
@@ -2253,8 +2241,8 @@
 		if (sc->bge_flags & BGE_PHY_FIBER_MII)
 			mii_flags |= MIIF_HAVEFIBER;
 		mii_attach(&sc->bge_dev, &sc->bge_mii, 0xffffffff,
-			   MII_PHY_ANY, MII_OFFSET_ANY, mii_flags);
-
+		    1, MII_OFFSET_ANY, mii_flags);
+
 		if (LIST_FIRST(&sc->bge_mii.mii_phys) == NULL) {
 			printf("%s: no PHY found!\n", sc->bge_dev.dv_xname);
 			ifmedia_add(&sc->bge_mii.mii_media,


[media] xc4000: check_firmware() cleanup

This patch makes the following fixes in check_firmware():
  - there is only one BASE and INIT1 firmware for XC4000
  - loading SCODE is needed also for FM radio

Signed-off-by: Istvan Varga <184568a4ab348c62b0aba78557ba56d26ba8119a@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>

--- drivers/media/common/tuners/xc4000.c
+++ drivers/media/common/tuners/xc4000.c
@@ -903,7 +903,7 @@
 	struct xc4000_priv         *priv = fe->tuner_priv;
 	struct firmware_properties new_fw;
 	int			   rc = 0, is_retry = 0;
-	u16			   version, hwmodel;
+	u16			   version = 0, hwmodel;
 	v4l2_std_id		   std0;
 	u8			   hw_major, hw_minor, fw_major, fw_minor;

@@ -945,8 +945,7 @@
 	}

 	/* No need to reload base firmware if it matches */
-	if (((BASE | new_fw.type) & BASE_TYPES) ==
-	    (priv->cur_fw.type & BASE_TYPES)) {
+	if (priv->cur_fw.type & BASE) {
 		dprintk(1, "BASE firmware not changed.\n");
 		goto skip_base;
 	}
@@ -961,7 +960,7 @@

 	/* BASE firmwares are all std0 */
 	std0 = 0;
-	rc = load_firmware(fe, BASE | new_fw.type, &std0);
+	rc = load_firmware(fe, BASE, &std0);
 	if (rc < 0) {
 		printk("Error %d while loading base firmware\n", rc);
 		goto fail;
@@ -970,10 +969,9 @@
 	/* Load INIT1, if needed */
 	dprintk(1, "Load init1 firmware, if exists\n");

-	rc = load_firmware(fe, BASE | INIT1 | new_fw.type, &std0);
+	rc = load_firmware(fe, BASE | INIT1, &std0);
 	if (rc == -ENOENT)
-		rc = load_firmware(fe, (BASE | INIT1 | new_fw.type) & ~F8MHZ,
-				   &std0);
+		rc = load_firmware(fe, BASE | INIT1, &std0);
 	if (rc < 0 && rc != -ENOENT) {
 		tuner_err("Error %d while loading init1 firmware\n",
 			  rc);
@@ -1006,9 +1004,6 @@
 		dprintk(1, "SCODE firmware already loaded.\n");
 		goto check_device;
 	}
-
-	if (new_fw.type & FM)
-		goto check_device;

 	/* Load SCODE firmware, if exists */
 	rc = load_scode(fe, new_fw.type | new_fw.scode_table, &new_fw.id,


comment fix: Two vendors sold same thing

--- dev/usb/ubsa.c
+++ dev/usb/ubsa.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ubsa.c,v 1.11 2005/08/01 05:36:48 brad Exp $ 	*/
+/*	$OpenBSD: ubsa.c,v 1.12 2005/10/29 23:35:20 deraadt Exp $ 	*/
 /*	$NetBSD: ubsa.c,v 1.5 2002/11/25 00:51:33 fvdl Exp $	*/
 /*-
  * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>.
@@ -228,7 +228,7 @@
 	{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U103 },
 	/* BELKIN F5U120 */
 	{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U120 },
-	/* GoHubs GO-COM232 */
+	/* GoHubs GO-COM232 , Belkin F5U003 */
 	{ USB_VENDOR_ETEK, USB_PRODUCT_ETEK_1COM },
 	/* GoHubs GO-COM232 */
 	{ USB_VENDOR_GOHUBS, USB_PRODUCT_GOHUBS_GOCOM232 },


Update docs

Update docs

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@30320 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- include/csplugincommon/rendermanager/svtraverse.h
+++ include/csplugincommon/rendermanager/svtraverse.h
@@ -19,6 +19,10 @@
 #ifndef __CS_CSPLUGINCOMMON_RENDERMANAGER_SVTRAVERSE_H__
 #define __CS_CSPLUGINCOMMON_RENDERMANAGER_SVTRAVERSE_H__

+/**\file
+ * Traversal of shader variables used in a render tree
+ */
+
 #include "csplugincommon/rendermanager/operations.h"
 #include "csutil/bitarray.h"

@@ -29,6 +33,12 @@
   /**
    * Traverser for all meshes in a tree, returning the set of used
    * shader variables for each mesh.
+   *
+   * Usage: together with ForEachMeshNode(). A functor must be provided
+   * in \a Fn which implements void operator() (RenderTree::MeshNode* node,
+   * size_t layer, RenderTree::MeshNode::SingleMesh& mesh, csBitArray names).
+   * The \a names bit array will have a bit set for each shader variable name
+   * used by the given mesh.
    */
   template<typename RenderTree, typename Fn>
   class TraverseUsedSVSets
@@ -83,6 +93,11 @@
   /**
    * Traverser for all meshes in a tree, calling the callback for each SV
    * used by each mesh.
+   *
+   * Usage: together with ForEachMeshNode(). A functor must be provided
+   * in \a Fn which implements void operator() (CS::ShaderVarStringID varName,
+   * csShaderVariable* sv). The functor will be called for each shader
+   * variable used in the traversed context.
    */
   template<typename RenderTree, typename Fn>
   class TraverseUsedSVs


Fix this by commiting the proper revision of the bge_encap() diff.

--- dev/pci/if_bge.c
+++ dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_bge.c,v 1.193 2006/10/26 22:41:10 brad Exp $	*/
+/*	$OpenBSD: if_bge.c,v 1.194 2006/10/26 22:57:17 brad Exp $	*/

 /*
  * Copyright (c) 2001 Wind River Systems
@@ -2683,7 +2683,7 @@
 bge_encap(struct bge_softc *sc, struct mbuf *m_head, u_int32_t *txidx)
 {
 	struct bge_tx_bd	*f = NULL;
-	u_int32_t		frag, cur, cnt = 0;
+	u_int32_t		frag, cur;
 	u_int16_t		csum_flags = 0;
 	struct txdmamap_pool_entry *dma;
 	bus_dmamap_t dmamap;
@@ -2738,6 +2738,13 @@
 	if (bus_dmamap_load_mbuf(sc->bge_dmatag, dmamap, m_head,
 	    BUS_DMA_NOWAIT))
 		return (ENOBUFS);
+
+	/*
+	 * Sanity check: avoid coming within 16 descriptors
+	 * of the end of the ring.
+	 */
+	if (dmamap->dm_nsegs > (BGE_TX_RING_CNT - sc->bge_txcnt - 16))
+		goto fail_unload;

 	for (i = 0; i < dmamap->dm_nsegs; i++) {
 		f = &sc->bge_rdata->bge_tx_ring[frag];
@@ -2754,15 +2761,8 @@
 			f->bge_vlan_tag = 0;
 		}
 #endif
-		/*
-		 * Sanity check: avoid coming within 16 descriptors
-		 * of the end of the ring.
-		 */
-		if ((BGE_TX_RING_CNT - (sc->bge_txcnt + cnt)) < 16)
-			goto fail_unload;
 		cur = frag;
 		BGE_INC(frag, BGE_TX_RING_CNT);
-		cnt++;
 	}

 	if (i < dmamap->dm_nsegs)
@@ -2778,7 +2778,7 @@
 	sc->bge_cdata.bge_tx_chain[cur] = m_head;
 	SLIST_REMOVE_HEAD(&sc->txdma_list, link);
 	sc->txdma[cur] = dma;
-	sc->bge_txcnt += cnt;
+	sc->bge_txcnt += dmamap->dm_nsegs;

 	*txidx = frag;


Finish hoedown.c

Finish hoedown.c

--- bin/hoedown.c
+++ bin/hoedown.c
@@ -212,7 +212,198 @@

   // Option parsing
-  show_time = 1; //TODO: option parsing
+  int just_args = 0;
+  int args_parsed = 0;
+  for (int i = 1; i < argc; i++) {
+    char *arg = argv[i];
+    if (!arg[0]) continue;
+
+    if (just_args || arg[0] != '-') {
+      // regular argument
+      if (args_parsed >= 1) {
+        fprintf(stderr, "Too many arguments.\n");
+        return 1;
+      }
+      args_parsed++;
+      filename = arg;
+      continue;
+    }
+
+    if (!arg[1]) {
+      // arg is "-"
+      if (args_parsed >= 1) {
+        fprintf(stderr, "Too many arguments.\n");
+        return 1;
+      }
+      args_parsed++;
+      filename = NULL;
+      continue;
+    }
+
+    if (arg[1] != '-') {
+      // parse short options
+      char opt;
+      const char *val;
+      for (size_t j = 1; (opt = arg[j]); j++) {
+        if (opt == 'h') {
+          print_help(argv[0]);
+          return 1;
+        }
+
+        if (opt == 'v') {
+          print_version();
+          return 1;
+        }
+
+        if (opt == 'T') {
+          show_time = 1;
+          continue;
+        }
+
+        /* options requiring value */
+        if (arg[++j]) val = arg + j;
+        else if (argv[++i]) val = argv[i];
+        else {
+          fprintf(stderr, "Wrong option '-%c' found.\n", opt);
+          return 1;
+        }
+
+        long int num;
+        int isNum = parse_int(val, &num);
+
+        if (opt == 'l' && isNum) {
+          levels = num;
+          break;
+        }
+
+        if (opt == 'n' && isNum) {
+          max_nesting = num;
+          break;
+        }
+
+        if (opt == 'a' && isNum) {
+          max_attributes = num;
+          break;
+        }
+
+        if (opt == 'i' && isNum) {
+          iunit = num;
+          break;
+        }
+
+        if (opt == 'o' && isNum) {
+          ounit = num;
+          break;
+        }
+
+        fprintf(stderr, "Wrong option '-%c' found.\n", opt);
+        return 1;
+      }
+      continue;
+    }
+
+    if (!arg[2]) {
+      // arg is "--"
+      just_args = 1;
+      continue;
+    }
+
+    // parse long option
+    char opt [100];
+    strncpy(opt, arg + 2, 100);
+    opt[99] = 0;
+
+    char *val = strchr(opt, '=');
+
+    long int num = 0;
+    int isNum = 0;
+
+    if (val) {
+      *val = 0;
+      val++;
+
+      if (*val)
+        isNum = parse_int(val, &num);
+    }
+
+    int opt_parsed = 0;
+
+    if (strcmp(opt, "time") == 0) {
+      opt_parsed = 1;
+      show_time = 1;
+    }
+
+    if (strcmp(opt, "help") == 0) {
+      print_help(argv[0]);
+      return 1;
+    }
+
+    if (strcmp(opt, "version") == 0) {
+      print_version();
+      return 1;
+    }
+
+    if (strcmp(opt, "levels") == 0 && isNum) {
+      opt_parsed = 1;
+      levels = num;
+    }
+    if (strcmp(opt, "max-nesting") == 0 && isNum) {
+      opt_parsed = 1;
+      max_nesting = num;
+    }
+    if (strcmp(opt, "max-attributes") == 0 && isNum) {
+      opt_parsed = 1;
+      max_attributes = num;
+    }
+    if (strcmp(opt, "input-unit") == 0 && isNum) {
+      opt_parsed = 1;
+      iunit = num;
+    }
+    if (strcmp(opt, "output-unit") == 0 && isNum) {
+      opt_parsed = 1;
+      ounit = num;
+    }
+
+    //const char *name;
+
+    // extensions
+    for (size_t i = 0; i < count_of(callbacks_info); i++) {
+      struct callback_entry *entry = &callbacks_info[i];
+      if (strcmp(opt, entry->option_name) == 0) {
+        opt_parsed = 1;
+        callback = entry->callback;
+        break;
+      }
+    }
+
+    // flags
+    for (size_t i = 0; i < count_of(flags_info); i++) {
+      struct flag_entry *entry = &flags_info[i];
+      if (strcmp(opt, entry->option_name) == 0) {
+        opt_parsed = 1;
+        flags |= entry->flag;
+        break;
+      }
+    }
+
+    // negations
+    const char *name = strprefix(opt, "no-");
+    if (name) {
+      for (size_t i = 0; i < count_of(flags_info); i++) {
+        struct flag_entry *entry = &flags_info[i];
+        if (strcmp(name, entry->option_name) == 0) {
+          opt_parsed = 1;
+          flags &= ~(entry->flag);
+          break;
+        }
+      }
+    }
+
+    if (!opt_parsed) {
+      fprintf(stderr, "Wrong option '%s' found.\n", arg);
+      return 1;
+    }
+  }

   // Create everything
@@ -233,8 +424,14 @@

   // Read input file
   FILE *file = stdin;
-  if (filename) file = fopen(filename, "rb");
-
+  if (filename) {
+    file = fopen(filename, "rb");
+    if (!file) {
+      fprintf(stderr, "Unable to open input file: %s\n", strerror(errno));
+      return 5;
+    }
+  }
+
   while (!feof(file) && !ferror(file)) {
     hoedown_buffer_grow(ib, ib->size + ib->unit);
     ib->size += fread(ib->data + ib->size, sizeof(uint8_t), ib->unit, file);


bnx2: Update version to 2.2.5.

bnx2: Update version to 2.2.5.

Signed-off-by: Michael Chan <6b52f9d672b6134057900fe608467612b789a84e@broadcom.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


nuke unused variable, from NetBSD

nuke unused variable, from NetBSD

--- dev/usb/umct.c
+++ dev/usb/umct.c
@@ -1,5 +1,5 @@
-/*	$OpenBSD: umct.c,v 1.7 2003/05/07 04:33:33 deraadt Exp $	*/
-/*	$NetBSD: umct.c,v 1.9 2002/09/23 05:51:23 simonb Exp $	*/
+/*	$OpenBSD: umct.c,v 1.8 2003/05/19 00:36:12 nate Exp $	*/
+/*	$NetBSD: umct.c,v 1.10 2003/02/23 04:20:07 simonb Exp $	*/
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -588,7 +588,7 @@
 {
 	struct umct_softc *sc = priv;
 	u_char *buf = sc->sc_intr_buf;
-	u_char mstatus, lstatus;
+	u_char mstatus;

 	if (sc->sc_dying)
 		return;
@@ -608,7 +608,6 @@

 	sc->sc_lsr = sc->sc_msr = 0;
 	mstatus = buf[0];
-	lstatus = buf[1];
 	if (ISSET(mstatus, MSR_DSR))
 		sc->sc_msr |= UMSR_DSR;
 	if (ISSET(mstatus, MSR_DCD))


constrained_linear_operator: use ConstraintMatrix iterators

--- include/deal.II/lac/constrained_linear_operator.h
+++ include/deal.II/lac/constrained_linear_operator.h
@@ -72,20 +72,27 @@
            dealii::ExcMessage("The domain and range vectors must be different "
                               "storage locations"));

-    for (auto i : v.locally_owned_elements())
+    // First, add vector u to v unconditionally and clean up constrained
+    // degrees of freedom later.
+    v += u;
+
+    const auto &locally_owned_elements = v.locally_owned_elements();
+    for (const auto &line : constraint_matrix.get_lines())
       {
-        if (constraint_matrix.is_constrained(i))
-          {
-            const auto *entries = constraint_matrix.get_constraint_entries(i);
-            for (types::global_dof_index j = 0; j < entries->size(); ++j)
+        const auto i = line.index;
+        if (locally_owned_elements.is_element(i))
+          {
+            v(i) -= u(i);
+            const auto &entries = line.entries;
+            for (types::global_dof_index j = 0; j < entries.size(); ++j)
               {
-                const auto pos = (*entries)[j].first;
-                v(i) += u(pos) * (*entries)[j].second;
+                const auto pos = entries[j].first;
+                v(i) += u(pos) * entries[j].second;
               }
           }
-        else
-          v(i) += u(i);
       }
+
+    v.compress(VectorOperation::add);
   };

   return_op.Tvmult_add = [&constraint_matrix](Domain &v, const Range &u)
@@ -94,20 +101,30 @@
            dealii::ExcMessage("The domain and range vectors must be different "
                               "storage locations"));

-    for (auto i : v.locally_owned_elements())
+    // First, add vector u to v unconditionally and clean up constrained
+    // degrees of freedom later.
+    v += u;
+
+    const auto &locally_owned_elements = v.locally_owned_elements();
+    for (const auto &line : constraint_matrix.get_lines())
       {
-        if (constraint_matrix.is_constrained(i))
-          {
-            const auto *entries = constraint_matrix.get_constraint_entries(i);
-            for (types::global_dof_index j = 0; j < entries->size(); ++j)
-              {
-                const auto pos = (*entries)[j].first;
-                v(pos) += u(i) * (*entries)[j].second;
-              }
-          }
-        else
-          v(i)+=u(i);
+        const auto i = line.index;
+
+        if (locally_owned_elements.is_element(i))
+          {
+            v(i) -= u(i);
+          }
+
+        const auto &entries = line.entries;
+        for (types::global_dof_index j = 0; j < entries.size(); ++j)
+          {
+            const auto pos = entries[j].first;
+            if (locally_owned_elements.is_element(pos))
+              v(pos) += u(i) * entries[j].second;
+          }
       }
+
+    v.compress(VectorOperation::add);
   };

   // lambda capture expressions are a C++14 feature...
@@ -150,39 +167,48 @@

   return_op.vmult_add = [&constraint_matrix](Range &v, const Domain &u)
   {
-    for (auto i : v.locally_owned_elements())
-      if (constraint_matrix.is_constrained(i))
-        v(i) += u(i);
+    const auto &locally_owned_elements = v.locally_owned_elements();
+    for (const auto &line : constraint_matrix.get_lines())
+      {
+        const auto i = line.index;
+        if (locally_owned_elements.is_element(i))
+          {
+            v(i) += u(i);
+          }
+      }
+
+    v.compress(VectorOperation::add);
   };

   return_op.Tvmult_add = [&constraint_matrix](Domain &v, const Range &u)
   {
-    for (auto i : v.locally_owned_elements())
-      if (constraint_matrix.is_constrained(i))
-        v(i) += u(i);
-  };
-
-  return_op.vmult = [&constraint_matrix](Range &v, const Domain &u)
-  {
-    Assert(!dealii::PointerComparison::equal(&v, &u),
-           dealii::ExcMessage("The domain and range vectors must be different "
-                              "storage locations"));
-
-    v = 0.;
-    for (auto i : v.locally_owned_elements())
-      if (constraint_matrix.is_constrained(i))
-        v(i) = u(i);
-  };
-
-  return_op.Tvmult = [&constraint_matrix](Domain &v, const Range &u)
-  {
-    Assert(!dealii::PointerComparison::equal(&v, &u),
-           dealii::ExcMessage("The domain and range vectors must be different "
-                              "storage locations"));
-    v = 0.;
-    for (auto i : v.locally_owned_elements())
-      if (constraint_matrix.is_constrained(i))
-        v(i) = u(i);
+    const auto &locally_owned_elements = v.locally_owned_elements();
+    for (const auto &line : constraint_matrix.get_lines())
+      {
+        const auto i = line.index;
+        if (locally_owned_elements.is_element(i))
+          {
+            v(i) += u(i);
+          }
+      }
+
+    v.compress(VectorOperation::add);
+  };
+
+  // lambda capture expressions are a C++14 feature...
+  const auto vmult_add = return_op.vmult_add;
+  return_op.vmult = [vmult_add](Range &v, const Domain &u)
+  {
+    v = 0.;
+    vmult_add(v, u);
+  };
+
+  // lambda capture expressions are a C++14 feature...
+  const auto Tvmult_add = return_op.Tvmult_add;
+  return_op.Tvmult = [Tvmult_add](Domain &v, const Range &u)
+  {
+    v = 0.;
+    Tvmult_add(v, u);
   };

   return return_op;


Fix use of uninitialized variable i

Fix use of uninitialized variable i

--- src/engine/client/rocketProgressBar.h
+++ src/engine/client/rocketProgressBar.h
@@ -114,7 +114,7 @@
 			GenerateGeometry();
 		}

-		for ( int i; i < NUM_GEOMETRIES; ++i )
+		for ( int i = 0; i < NUM_GEOMETRIES; ++i )
 		{
 			if ( renderFilter & 1 << i )
 			{


to quote from the gospel of bus_dma.9:

to quote from the gospel of bus_dma.9:

   Synchronization operations are expressed from the perspective of the host
   RAM, e.g., a device -> memory operation is a READ and a memory -> device
   operation is a WRITE.

the status block that the isr reads is written to by the device.
the chip writes to memory, it is therefore a READ.

this also adds the preread sync when the map is set up and the postread
sync when the map is torn down for better symmetry. there are probably
more issues like this in the code, but this is a start.

discovered while discussing another diff with claudio@

--- dev/pci/if_bnx.c
+++ dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_bnx.c,v 1.92 2011/04/05 18:01:21 henning Exp $	*/
+/*	$OpenBSD: if_bnx.c,v 1.93 2011/04/13 07:28:35 dlg Exp $	*/

 /*-
  * Copyright (c) 2006 Broadcom Corporation
@@ -2286,6 +2286,8 @@

 	/* Destroy the status block. */
 	if (sc->status_block != NULL && sc->status_map != NULL) {
+		bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0,
+		    sc->status_map->dm_mapsize, BUS_DMASYNC_POSTREAD);
 		bus_dmamap_unload(sc->bnx_dmatag, sc->status_map);
 		bus_dmamem_unmap(sc->bnx_dmatag, (caddr_t)sc->status_block,
 		    BNX_STATUS_BLK_SZ);
@@ -2423,6 +2425,9 @@
 		rc = ENOMEM;
 		goto bnx_dma_alloc_exit;
 	}
+
+	bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0,
+	    sc->status_map->dm_mapsize, BUS_DMASYNC_PREREAD);

 	sc->status_block_paddr = sc->status_map->dm_segs[0].ds_addr;

@@ -5152,7 +5157,7 @@
 	DBRUNIF(1, sc->interrupts_generated++);

 	bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0,
-	    sc->status_map->dm_mapsize, BUS_DMASYNC_POSTWRITE);
+	    sc->status_map->dm_mapsize, BUS_DMASYNC_POSTREAD);

 	/*
 	 * If the hardware status block index
@@ -5232,7 +5237,7 @@
 	}

 	bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0,
-	    sc->status_map->dm_mapsize, BUS_DMASYNC_PREWRITE);
+	    sc->status_map->dm_mapsize, BUS_DMASYNC_PREREAD);

 	/* Re-enable interrupts. */
 	REG_WR(sc, BNX_PCICFG_INT_ACK_CMD,


r8169: move rtl_set_rx_mode before its rtl_hw_start callers.

Signed-off-by: Francois Romieu <b6456b24ae82a7595be3173ae585c7a827f25f37@fr.zoreil.com>
Cc: Hayes Wang <2e4abddca5cd1005ec71becebc17a5257b0bced7@realtek.com>


VectorTools::interpolate changed

VectorTools::interpolate changed

--- include/deal.II/numerics/vector_tools.templates.h
+++ include/deal.II/numerics/vector_tools.templates.h
@@ -111,7 +111,7 @@
     for (unsigned int fe_index=0; fe_index<fe.size(); ++fe_index)
       {
         unit_support_points[fe_index] = fe[fe_index].get_unit_support_points();
-        Assert (unit_support_points[fe_index].size() != 0,
+        Assert ((unit_support_points[fe_index].size() != 0)||(fe[fe_index].dofs_per_cell == 0),
                 ExcNonInterpolatingFE());
       }

@@ -207,64 +207,66 @@
       if (cell->is_locally_owned())
         {
           const unsigned int fe_index = cell->active_fe_index();
-
-          // for each cell:
-          // get location of finite element
-          // support_points
-          fe_values.reinit(cell);
-          const std::vector<Point<spacedim> > &support_points =
-            fe_values.get_present_fe_values().get_quadrature_points();
-
-          // pick out the representative
-          // support points
-          rep_points.resize (dofs_of_rep_points[fe_index].size());
-          for (unsigned int j=0; j<dofs_of_rep_points[fe_index].size(); ++j)
-            rep_points[j] = support_points[dofs_of_rep_points[fe_index][j]];
-
-          // get indices of the dofs on this cell
-          dofs_on_cell.resize (fe[fe_index].dofs_per_cell);
-          cell->get_dof_indices (dofs_on_cell);
-
-
-          if (fe_is_system)
-            {
-              // get function values at
-              // these points. Here: get
-              // all components
-              function_values_system[fe_index]
-              .resize (n_rep_points[fe_index],
-                       Vector<double> (fe[fe_index].n_components()));
-              function.vector_value_list (rep_points,
-                                          function_values_system[fe_index]);
-              // distribute the function
-              // values to the global
-              // vector
-              for (unsigned int i=0; i<fe[fe_index].dofs_per_cell; ++i)
-                {
-                  const unsigned int component
-                    = fe[fe_index].system_to_component_index(i).first;
-                  const unsigned int rep_dof=dof_to_rep_index_table[fe_index][i];
-                  vec(dofs_on_cell[i])
-                    = function_values_system[fe_index][rep_dof](component);
-                }
-            }
-          else
-            {
-              // get first component only,
-              // which is the only component
-              // in the function anyway
-              function_values_scalar[fe_index].resize (n_rep_points[fe_index]);
-              function.value_list (rep_points,
-                                   function_values_scalar[fe_index],
-                                   0);
-              // distribute the function
-              // values to the global
-              // vector
-              for (unsigned int i=0; i<fe[fe_index].dofs_per_cell; ++i)
-                vec(dofs_on_cell[i])
-                  = function_values_scalar[fe_index][dof_to_rep_index_table[fe_index][i]];
-            }
-        }
+	  if (fe[fe_index].degree != 0)
+	    {
+		  // for each cell:
+		  // get location of finite element
+		  // support_points
+		  fe_values.reinit(cell);
+		  const std::vector<Point<spacedim> > &support_points =
+		    fe_values.get_present_fe_values().get_quadrature_points();
+
+		  // pick out the representative
+		  // support points
+		  rep_points.resize (dofs_of_rep_points[fe_index].size());
+		  for (unsigned int j=0; j<dofs_of_rep_points[fe_index].size(); ++j)
+		    rep_points[j] = support_points[dofs_of_rep_points[fe_index][j]];
+
+		  // get indices of the dofs on this cell
+		  dofs_on_cell.resize (fe[fe_index].dofs_per_cell);
+		  cell->get_dof_indices (dofs_on_cell);
+
+
+		  if (fe_is_system)
+		    {
+		      // get function values at
+		      // these points. Here: get
+		      // all components
+		      function_values_system[fe_index]
+		      .resize (n_rep_points[fe_index],
+		               Vector<double> (fe[fe_index].n_components()));
+		      function.vector_value_list (rep_points,
+		                                  function_values_system[fe_index]);
+		      // distribute the function
+		      // values to the global
+		      // vector
+		      for (unsigned int i=0; i<fe[fe_index].dofs_per_cell; ++i)
+		        {
+		          const unsigned int component
+		            = fe[fe_index].system_to_component_index(i).first;
+		          const unsigned int rep_dof=dof_to_rep_index_table[fe_index][i];
+		          vec(dofs_on_cell[i])
+		            = function_values_system[fe_index][rep_dof](component);
+		        }
+		    }
+		  else
+		    {
+		      // get first component only,
+		      // which is the only component
+		      // in the function anyway
+		      function_values_scalar[fe_index].resize (n_rep_points[fe_index]);
+		      function.value_list (rep_points,
+		                           function_values_scalar[fe_index],
+		                           0);
+		      // distribute the function
+		      // values to the global
+		      // vector
+		      for (unsigned int i=0; i<fe[fe_index].dofs_per_cell; ++i)
+		        vec(dofs_on_cell[i])
+		          = function_values_scalar[fe_index][dof_to_rep_index_table[fe_index][i]];
+		    }
+	    }
+	}
     vec.compress(VectorOperation::insert);
   }


fix nfe_txeof() to reset the wathdog timeout only when a full tx frame has been sent.

--- dev/pci/if_nfe.c
+++ dev/pci/if_nfe.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_nfe.c,v 1.46 2006/02/22 19:23:44 damien Exp $	*/
+/*	$OpenBSD: if_nfe.c,v 1.47 2006/02/22 21:05:13 damien Exp $	*/

 /*-
  * Copyright (c) 2006 Damien Bergamini <damien.bergamini@free.fr>
@@ -788,12 +788,10 @@
 	struct ifnet *ifp = &sc->sc_arpcom.ac_if;
 	struct nfe_desc32 *desc32;
 	struct nfe_desc64 *desc64;
-	struct nfe_tx_data *data;
+	struct nfe_tx_data *data = NULL;
 	uint16_t flags;

 	while (sc->txq.next != sc->txq.cur) {
-		data = &sc->txq.data[sc->txq.next];
-
 		if (sc->sc_flags & NFE_40BIT_ADDR) {
 			desc64 = &sc->txq.desc64[sc->txq.next];
 			nfe_txdesc64_sync(sc, desc64, BUS_DMASYNC_POSTREAD);
@@ -808,6 +806,8 @@

 		if (flags & NFE_TX_VALID)
 			break;
+
+		data = &sc->txq.data[sc->txq.next];

 		if ((sc->sc_flags & (NFE_JUMBO_SUP | NFE_40BIT_ADDR)) == 0) {
 			if (!(flags & NFE_TX_LASTFRAG_V1))
@@ -841,13 +841,16 @@
 		m_freem(data->m);
 		data->m = NULL;

+		ifp->if_timer = 0;
+
 skip:		sc->txq.queued--;
 		sc->txq.next = (sc->txq.next + 1) % NFE_TX_RING_COUNT;
 	}

-	ifp->if_timer = 0;
-	ifp->if_flags &= ~IFF_OACTIVE;
-	nfe_start(ifp);
+	if (data != NULL) {	/* at least one slot freed */
+		ifp->if_flags &= ~IFF_OACTIVE;
+		nfe_start(ifp);
+	}
 }

 int


staging: rtl8192u: Refactor heavy nesting

This patch fixes warnings raised by checkpatch.pl relating to heavily indented
lines in r8192U_dm.c by refactoring code to achieve the same outcome indented by
one less tab.

Signed-off-by: Lorenzo Stoakes <8a0e5e82e388c6fcb2f5d5e5b84207ecbe64dd35@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


minimap: fix zone selector going out of range

--- bin/minimap.c
+++ bin/minimap.c
@@ -306,10 +306,10 @@
                   int         y,
                   Eina_Bool   clicked)
 {
-   int bx, by, rw = 0, rh = 0, srw, srh, cx, cy, ox, oy;
+   int bx, by, rw = 0, rh = 0, srw, srh, cx, cy, ox, oy, ow, oh, tx, ty;

    evas_object_geometry_get(ed->minimap.rect, NULL, NULL, &rw, &rh);
-   evas_object_geometry_get(ed->minimap.map, &ox, &oy, NULL, NULL);
+   evas_object_geometry_get(ed->minimap.map, &ox, &oy, &ow, &oh);

    if (clicked)
      {
@@ -320,9 +320,13 @@
    if (x < 0) x = 0;
    if (y < 0) y = 0;

-   evas_object_move(ed->minimap.rect,
-                    (x * ed->minimap.ratio) + ox,
-                    (y * ed->minimap.ratio) + oy);
+   tx = (x * ed->minimap.ratio) + ox;
+   ty = (y * ed->minimap.ratio) + oy;
+
+   if (tx - ox + rw > ow) tx = ox + ow - rw;
+   if (ty - oy + rh > oh) ty = oy + oh - rh;
+
+   evas_object_move(ed->minimap.rect, tx, ty);

    if (clicked)
      {


remove empty line

remove empty line

--- src/midgard_connection.c
+++ src/midgard_connection.c
@@ -172,7 +172,6 @@
 		midgard_core_connection_disconnect_error_callback(self);

 	if (gda_cnc != NULL) {
-
 		g_object_unref(gda_cnc);
 		g_signal_emit(self, MIDGARD_CONNECTION_GET_CLASS(self)->signal_id_disconnected, 0);
 	}


make a stack of plate set works

make a stack of plate set works

--- stack-and-queues/stack-of-plates/stack-of-plates/main.c
+++ stack-and-queues/stack-of-plates/stack-of-plates/main.c
@@ -25,82 +25,84 @@
     int numberOfStacks;
     int *sizes[NUMBER_OF_STACKS];
     stack *stacks[NUMBER_OF_STACKS];
-} setOfStacks = {0, STACK_SIZE, NUMBER_OF_STACKS};
+} set = {0, STACK_SIZE, NUMBER_OF_STACKS};

 void initSet(void);
-stack *getActiveStack(void);
+void testSet(void);
 stack *createNode(void);
+int currentStackId(void);
 int pop(void);
 int peek(void);
 void push(int value);
 bool isEmpty(void);

+// initialize setOfStacks
 void initSet(void) {
-    for (int i = 0; i < setOfStacks.numberOfStacks; i++) {
-        setOfStacks.sizes[i] = (int *) calloc(1, sizeof(int));
-        setOfStacks.stacks[i] = STACK_END;
+    for (int i = 0; i < set.numberOfStacks; i++) {
+        set.sizes[i] = (int *) calloc(1, sizeof(int)); // the i-stack counter
+        set.stacks[i] = STACK_END; // create pointers for each of stacks in the set
     }
 }

-stack *getActiveStack() {
-    return setOfStacks.stacks[setOfStacks.currentStack];
+int currentStackId() {
+    return set.currentStack;
+};
+
+// if the first stack is empty, all the set is empty
+bool isEmpty() {
+    return set.stacks[0] == STACK_END;
 }

-bool isEmpty() {
-    return getActiveStack() == STACK_END;
-}
-
+// return value of the current top item
 int peek() {
     if (isEmpty()) {
         return EMPTY_STACK;
     }

-    return getActiveStack()->value;
+    return set.stacks[currentStackId()]->value;
 }

+// push value into a stack that can accept it (current or the next one)
 void push(int value) {
-    if (*setOfStacks.sizes[setOfStacks.currentStack] == STACK_SIZE) {
-        if (setOfStacks.currentStack == NUMBER_OF_STACKS) {
+    // check if the current stack is full
+    if (*set.sizes[currentStackId()] == STACK_SIZE) {
+        if (currentStackId() - 1 == NUMBER_OF_STACKS) { // do nothing if all stacks are full
             return;
         }

-        setOfStacks.currentStack++;
+        set.currentStack++; // move to the next stack in the set
     }

-    stack *node = getActiveStack();
+    // create a new node and add it to the current top
+    stack *newNode = createNode();
+    newNode->value = value;
+    newNode->next = set.stacks[currentStackId()];
+    set.stacks[currentStackId()] = newNode;

-    if (node == STACK_END) {
-        node = createNode();
-        node->value = value;
-    } else {
-        stack *newNode = createNode();
-        newNode->value = value;
-        newNode->next = node;
-        node = newNode;
-    }
-
-    *setOfStacks.sizes[setOfStacks.currentStack] += 1;
+    *set.sizes[currentStackId()] += 1;
 }

+// pop the top node from the set of stacks
 int pop(void) {
     if (isEmpty()) {
         return EMPTY_STACK;
     }

-    stack *currentTop = getActiveStack();
-    int value = currentTop->value;
-    stack *temp = currentTop;
-    currentTop = currentTop->next;
-    free(temp);
-    *setOfStacks.sizes[setOfStacks.currentStack] -= 1;
+    stack *top = set.stacks[currentStackId()]; // get the current top
+    int value = top->value; // store its value
+    set.stacks[currentStackId()] = top->next; // move the stack top
+    free(top); // free the old top memory

-    if (*setOfStacks.sizes[setOfStacks.currentStack] == 0 && setOfStacks.currentStack > 0) {
-        setOfStacks.currentStack--;
+    // decrease the current stack size and move to the previous stack if case if the current is empty
+    *set.sizes[currentStackId()] -= 1;
+    if (*set.sizes[currentStackId()] == 0 && currentStackId() > 0) {
+        set.currentStack--;
     }

     return value;
 }

+// helper function for creating a new stack element
 stack *createNode(void) {
     stack *node = (stack *) malloc(sizeof(stack));
     node->next = STACK_END;
@@ -110,6 +112,43 @@

 int main(void) {
     initSet();
-    int i = 0;
+    testSet();
+
     return 0;
 }
+
+void testSet(void) {
+    // tests
+    printf("After initialization: current stack set is %s, current stack is %i, current stack size is %i\n", isEmpty() ? "empty" : "not empty", currentStackId(), *set.sizes[currentStackId()]);
+    push(1); // {1->END}
+    printf("push(1): Expected: 1, actual: %i\n", peek());
+    push(2); // {2->1->END}
+    printf("push(2): Expected: 2, actual: %i\n", peek());
+    push(3); // {3->2->1->END}
+    printf("push(3): Expected: 3, actual: %i\n", peek());
+
+    //pop values()
+    printf("pop() test. Expected: 3, actual: %i\n", pop()); // {2->1->END}
+    printf("pop() test. Expected: 2, actual: %i\n", pop()); // {1->END}
+    printf("pop() test. Expected: 1, actual: %i\n", pop()); // {END}
+
+    // needs to be empty
+    printf("The set is empty: %s", isEmpty() ? "true" : "false");
+
+    // fill all the stacks with values 1-25
+    for(int i = 1; i < 26; i++) {
+        push(i);
+    }
+
+    printf("Efter pushing 25 values. The current set of stacks is %s, ", isEmpty() ? "empty" : "full");
+    printf("current stack id is: %i, and the current stack size is: %i\n", currentStackId(), *set.sizes[currentStackId()]);
+
+    // pop all the values
+    int value;
+    fputs("pop() till the end: ", stdout);
+    do {
+        value = pop();
+        printf("%i ", value);
+    } while(value != EMPTY_STACK);
+    putc('\n', stdout);
+}


convert to uniform tab indentation

convert to uniform tab indentation

git-svn-id: fc35eccb03ccef1c432fd0fcf5295fcceaca86a6@24308 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6

--- link-grammar/linkset.c
+++ link-grammar/linkset.c
@@ -1,15 +1,15 @@
-/********************************************************************************/
-/* Copyright (c) 2004                                                           */
-/* Daniel Sleator, David Temperley, and John Lafferty                           */
-/* All rights reserved                                                          */
-/*                                                                              */
-/* Use of the link grammar parsing system is subject to the terms of the        */
-/* license set forth in the LICENSE file included with this software,           */
-/* and also available at http://www.link.cs.cmu.edu/link/license.html           */
-/* This license allows free redistribution and use in source and binary         */
-/* forms, with or without modification, subject to certain conditions.          */
-/*                                                                              */
-/********************************************************************************/
+/*************************************************************************/
+/* Copyright (c) 2004                                                    */
+/* Daniel Sleator, David Temperley, and John Lafferty                    */
+/* All rights reserved                                                   */
+/*                                                                       */
+/* Use of the link grammar parsing system is subject to the terms of the */
+/* license set forth in the LICENSE file included with this software,    */
+/* and also available at http://www.link.cs.cmu.edu/link/license.html    */
+/* This license allows free redistribution and use in source and binary  */
+/* forms, with or without modification, subject to certain conditions.   */
+/*                                                                       */
+/*************************************************************************/

 #include <link-grammar/api.h>
 #include <memory.h>
@@ -24,192 +24,196 @@
 static int  take_a_unit(void);
 static int  compute_hash(const int unit, const char *str);
 static char *local_alloc (int nbytes);
-
+
 int linkset_open(const int size)
 {
-  int unit = take_a_unit();
-  initialize_unit(unit, size);
-  return unit;
+	int unit = take_a_unit();
+	initialize_unit(unit, size);
+	return unit;
 }

 void linkset_close(const int unit)
 {
-  if (!q_unit_is_used[unit]) return;
-  linkset_clear(unit);
-  free (ss[unit].hash_table);
-  q_unit_is_used[unit] = 0;
+	if (!q_unit_is_used[unit]) return;
+	linkset_clear(unit);
+	free (ss[unit].hash_table);
+	q_unit_is_used[unit] = 0;
 }

 void linkset_clear(const int unit)
 {
-  int i;
-  if (!q_unit_is_used[unit]) return;
-  for (i=0; i<ss[unit].hash_table_size; i++)
-    {
-      LINKSET_NODE *p=ss[unit].hash_table[i];
-      while (p!=0)
-	{
-	  LINKSET_NODE *q = p;
-	  p=p->next;
-	  if (q->solid) free (q->str);
-	  free(q);
-	}
-    }
-  clear_hash_table(unit);
+	int i;
+	if (!q_unit_is_used[unit]) return;
+	for (i=0; i<ss[unit].hash_table_size; i++)
+	{
+		LINKSET_NODE *p=ss[unit].hash_table[i];
+		while (p!=0)
+		{
+			LINKSET_NODE *q = p;
+			p=p->next;
+			if (q->solid) free (q->str);
+			free(q);
+		}
+	}
+	clear_hash_table(unit);
 }

 int linkset_add(const int unit, char *str)
 {
-    /* returns 0 if already there, 1 if new. Stores only the pointer. */
-    LINKSET_NODE *sn = linkset_add_internal(unit, str);
-    if (sn==NULL) return 0;
-    sn->solid = 0;
-    return 1;
+	/* returns 0 if already there, 1 if new. Stores only the pointer. */
+	LINKSET_NODE *sn = linkset_add_internal(unit, str);
+	if (sn==NULL) return 0;
+	sn->solid = 0;
+	return 1;
 }

 int linkset_add_solid(const int unit, char *str)
 {
-    /* returns 0 if already there, 1 if new. Copies string. */
-    LINKSET_NODE *sn = linkset_add_internal(unit, str);
-    if (sn==NULL) return 0;
-    sn->str = (char *) malloc ((1+strlen(str))*sizeof(char));
-    if (!sn->str) error("linkset: out of memory!");
-    strcpy(sn->str,str);
-    sn->solid = 1;
-    return 1;
-}
-
-int linkset_remove(const int unit, char *str)
-{
-  /* returns 1 if removed, 0 if not found */
-  int hashval;
-  LINKSET_NODE *p, *last;
-  hashval = compute_hash(unit, str);
-  last = ss[unit].hash_table[hashval];
-  if (!last) return 0;
-  if (!strcmp(last->str,str))
-    {
-	ss[unit].hash_table[hashval] = last->next;
-	if (last->solid) free(last->str);
-	free(last);
+	/* returns 0 if already there, 1 if new. Copies string. */
+	LINKSET_NODE *sn = linkset_add_internal(unit, str);
+	if (sn==NULL) return 0;
+	sn->str = (char *) malloc ((1+strlen(str))*sizeof(char));
+	if (!sn->str) error("linkset: out of memory!");
+	strcpy(sn->str,str);
+	sn->solid = 1;
 	return 1;
-    }
-  p = last->next;
-  while (p)
-    {
-	if (!strcmp(p->str,str))
-	  {
-	      last->next = p->next;
-	      if (last->solid) free(last->str);
-	      free(p);
-	      return 1;
-	  }
-	p=p->next;
-	last = last->next;
-    }
-  return 0;
-}
-
-
-int linkset_match(const int unit, char *str) {
-    int hashval;
-    LINKSET_NODE *p;
-    hashval = compute_hash(unit, str);
-    p = ss[unit].hash_table[hashval];
-    while(p!=0)
-      {
-	  if (post_process_match(p->str,str)) return 1;
-	  p=p->next;
-      }
-    return 0;
-}
-
-int linkset_match_bw(const int unit, char *str) {
-    int hashval;
-    LINKSET_NODE *p;
-    hashval = compute_hash(unit, str);
-    p = ss[unit].hash_table[hashval];
-    while(p!=0)
-      {
-	  if (post_process_match(str,p->str)) return 1;
-	  p=p->next;
-      }
-    return 0;
+}
+
+int linkset_remove(const int unit, char *str)
+{
+	/* returns 1 if removed, 0 if not found */
+	int hashval;
+	LINKSET_NODE *p, *last;
+	hashval = compute_hash(unit, str);
+	last = ss[unit].hash_table[hashval];
+	if (!last) return 0;
+	if (!strcmp(last->str,str))
+	{
+		ss[unit].hash_table[hashval] = last->next;
+		if (last->solid) free(last->str);
+		free(last);
+		return 1;
+	}
+	p = last->next;
+	while (p)
+	{
+		if (!strcmp(p->str,str))
+		{
+			last->next = p->next;
+			if (last->solid) free(last->str);
+			free(p);
+			return 1;
+		}
+		p=p->next;
+		last = last->next;
+	}
+	return 0;
+}
+
+int linkset_match(const int unit, char *str)
+{
+	int hashval;
+	LINKSET_NODE *p;
+	hashval = compute_hash(unit, str);
+	p = ss[unit].hash_table[hashval];
+	while(p!=0)
+	{
+		if (post_process_match(p->str,str)) return 1;
+		p=p->next;
+	}
+	return 0;
+}
+
+int linkset_match_bw(const int unit, char *str)
+{
+	int hashval;
+	LINKSET_NODE *p;
+	hashval = compute_hash(unit, str);
+	p = ss[unit].hash_table[hashval];
+	while(p!=0)
+	{
+		if (post_process_match(str,p->str)) return 1;
+		p=p->next;
+	}
+	return 0;
 }

 /***********************************************************************/
 static void clear_hash_table(const int unit)
 {
-  memset(ss[unit].hash_table, 0,
-	 ss[unit].hash_table_size*sizeof(LINKSET_NODE *));
-}
-
-static void initialize_unit(const int unit, const int size) {
-  if(size<=0) {
-     printf("size too small!");
-     abort();
-  }
-  ss[unit].hash_table_size = (int) ((float) size*LINKSET_SPARSENESS);
-  ss[unit].hash_table = (LINKSET_NODE**)
-	local_alloc (ss[unit].hash_table_size*sizeof(LINKSET_NODE *));
-  clear_hash_table(unit);
+	memset(ss[unit].hash_table, 0,
+				 ss[unit].hash_table_size*sizeof(LINKSET_NODE *));
+}
+
+static void initialize_unit(const int unit, const int size)
+{
+	if(size<=0) {
+		 printf("size too small!");
+		 abort();
+	}
+	ss[unit].hash_table_size = (int) ((float) size*LINKSET_SPARSENESS);
+	ss[unit].hash_table = (LINKSET_NODE**)
+				local_alloc (ss[unit].hash_table_size*sizeof(LINKSET_NODE *));
+	clear_hash_table(unit);
 }

 static LINKSET_NODE *linkset_add_internal(const int unit, char *str)
 {
-  LINKSET_NODE *p, *n;
-  int hashval;
-
-  /* look for str in set */
-  hashval = compute_hash(unit, str);
-  for (p=ss[unit].hash_table[hashval]; p!=0; p=p->next)
-    if (!strcmp(p->str,str)) return NULL;  /* already present */
-
-  /* create a new node for u; stick it at head of linked list */
-  n = (LINKSET_NODE *) local_alloc (sizeof(LINKSET_NODE));
-  n->next = ss[unit].hash_table[hashval];
-  n->str = str;
-  ss[unit].hash_table[hashval] = n;
-  return n;
-}
-
+	LINKSET_NODE *p, *n;
+	int hashval;
+
+	/* look for str in set */
+	hashval = compute_hash(unit, str);
+	for (p=ss[unit].hash_table[hashval]; p!=0; p=p->next)
+		if (!strcmp(p->str,str)) return NULL;	/* already present */
+
+	/* create a new node for u; stick it at head of linked list */
+	n = (LINKSET_NODE *) local_alloc (sizeof(LINKSET_NODE));
+	n->next = ss[unit].hash_table[hashval];
+	n->str = str;
+	ss[unit].hash_table[hashval] = n;
+	return n;
+}
+
+/** hash is computed from capitalized prefix only */
 static int compute_hash(const int unit, const char *str)
- {
-   /* hash is computed from capitalized prefix only */
-  int i, hashval;
-  hashval=LINKSET_DEFAULT_SEED;
-  for (i=0; isupper((int)str[i]); i++)
-    hashval = str[i] + 31*hashval;
-  hashval = hashval % ss[unit].hash_table_size;
-  if (hashval<0) hashval*=-1;
-  return hashval;
-}
-
-static int take_a_unit(void) {
-  /* hands out free units */
-  int i;
-  static int q_first = 1;
-  if (q_first) {
-    memset(q_unit_is_used, 0, LINKSET_MAX_SETS*sizeof(char));
-    q_first = 0;
-  }
-  for (i=0; i<LINKSET_MAX_SETS; i++)
-    if (!q_unit_is_used[i]) break;
-  if (i==LINKSET_MAX_SETS) {
-    printf("linkset.h: No more free units");
-    abort();
-  }
-  q_unit_is_used[i] = 1;
-  return i;
-}
-
-static char *local_alloc (int nbytes)  {
-   char * p;
-   p = (char *) malloc (nbytes);
-   if (!p) {
-        printf("linkset: out of memory");
-       abort();
-    }
-   return p;
-}
-
+{
+	int i, hashval;
+	hashval=LINKSET_DEFAULT_SEED;
+	for (i=0; isupper((int)str[i]); i++)
+		hashval = str[i] + 31*hashval;
+	hashval = hashval % ss[unit].hash_table_size;
+	if (hashval<0) hashval*=-1;
+	return hashval;
+}
+
+/** hands out free units */
+static int take_a_unit(void)
+{
+	int i;
+	static int q_first = 1;
+	if (q_first) {
+		memset(q_unit_is_used, 0, LINKSET_MAX_SETS*sizeof(char));
+		q_first = 0;
+	}
+	for (i=0; i<LINKSET_MAX_SETS; i++)
+		if (!q_unit_is_used[i]) break;
+	if (i==LINKSET_MAX_SETS) {
+		printf("linkset.h: No more free units");
+		abort();
+	}
+	q_unit_is_used[i] = 1;
+	return i;
+}
+
+static char *local_alloc (int nbytes)
+{
+	char * p;
+	p = (char *) malloc (nbytes);
+	if (!p) {
+		printf("linkset: out of memory");
+		abort();
+	}
+	return p;
+}
+


gallium/util: Remove comma at end of enumerator list.

--- src/gallium/auxiliary/util/u_format.h
+++ src/gallium/auxiliary/util/u_format.h
@@ -79,7 +79,7 @@
    UTIL_FORMAT_COLORSPACE_RGB = 0,
    UTIL_FORMAT_COLORSPACE_SRGB = 1,
    UTIL_FORMAT_COLORSPACE_YUV = 2,
-   UTIL_FORMAT_COLORSPACE_ZS = 3,
+   UTIL_FORMAT_COLORSPACE_ZS = 3
 };


Forget update file

Forget update file

--- include/fastrtps/attributes/PublisherAttributes.h
+++ include/fastrtps/attributes/PublisherAttributes.h
@@ -44,7 +44,7 @@
         PublisherAttributes(){
             m_userDefinedID = -1;
             m_entityID = -1;
-            historyMemoryPolicy = DYNAMIC_RESERVE_MEMORY_MODE;
+            historyMemoryPolicy = PREALLOCATED_MEMORY_MODE;
         };
         virtual ~PublisherAttributes(){};
         //!Topic Attributes for the Publisher


minor tweaks to the ioctl code

minor tweaks to the ioctl code

--- dev/pci/if_oce.c
+++ dev/pci/if_oce.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_oce.c,v 1.43 2012/11/07 12:46:49 mikeb Exp $	*/
+/*	$OpenBSD: if_oce.c,v 1.44 2012/11/07 19:43:33 mikeb Exp $	*/

 /*
  * Copyright (c) 2012 Mike Belopuhov
@@ -459,17 +459,6 @@
 			arp_ifinit(&sc->arpcom, ifa);
 #endif
 		break;
-	case SIOCGIFMEDIA:
-		error = ifmedia_ioctl(ifp, ifr, &sc->media, command);
-		break;
-	case SIOCSIFMTU:
-		if (ifr->ifr_mtu > OCE_MAX_MTU)
-			error = EINVAL;
-		else if (ifp->if_mtu != ifr->ifr_mtu) {
-			ifp->if_mtu = ifr->ifr_mtu;
-			oce_init(sc);
-		}
-		break;
 	case SIOCSIFFLAGS:
 		if (ifp->if_flags & IFF_UP) {
 			if (ifp->if_flags & IFF_RUNNING)
@@ -480,6 +469,18 @@
 			if (ifp->if_flags & IFF_RUNNING)
 				oce_stop(sc);
 		}
+		break;
+	case SIOCSIFMTU:
+		if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
+			error = EINVAL;
+		else if (ifp->if_mtu != ifr->ifr_mtu) {
+			ifp->if_mtu = ifr->ifr_mtu;
+			oce_init(sc);
+		}
+		break;
+	case SIOCGIFMEDIA:
+	case SIOCSIFMEDIA:
+		error = ifmedia_ioctl(ifp, ifr, &sc->media, command);
 		break;
 	default:
 		error = ether_ioctl(ifp, &sc->arpcom, command, data);


i915g: Fix possible null pointer deference in debug builds.

i915_buffer deferences buf in debug builds. Move declaration and
assignment to inside NULL check of buf.

--- src/gallium/drivers/i915/i915_state.c
+++ src/gallium/drivers/i915/i915_state.c
@@ -527,7 +527,6 @@
                                      struct pipe_resource *buf)
 {
    struct i915_context *i915 = i915_context(pipe);
-   struct i915_buffer *ir = i915_buffer(buf);
    draw_flush(i915->draw);

    assert(shader < PIPE_SHADER_TYPES);
@@ -543,6 +542,7 @@
     * N constants, leaving any extras from shader translation alone.
     */
    if (buf) {
+      struct i915_buffer *ir = i915_buffer(buf);
       memcpy(i915->current.constants[shader], ir->data, ir->b.b.width0);
       i915->current.num_user_constants[shader] = (ir->b.b.width0 /
 						  4 * sizeof(float));


Add missing header file

Add missing header file

error: pathspec 'include/libstoragemgmt/libstoragemgmt_nfsexport.h' did not match any file(s) known to git

--- include/libstoragemgmt/libstoragemgmt_nfsexport.h
+++ include/libstoragemgmt/libstoragemgmt_nfsexport.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2011-2012 Red Hat, Inc.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * Author: tasleson
+ */
+
+#ifndef LSM_NFS_EXPORT_H
+#define LSM_NFS_EXPORT_H
+
+#include "libstoragemgmt_types.h"
+
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#define ANON_UID_GID_NA     UINT64_MAX
+#define ANON_UID_GID_ERROR (ANON_UID_GID_NA - 1)
+
+/**
+ * Allocated memory for a NFS export record
+ * @param id            Export ID  (Set to NULL when creating new export)
+ * @param fs_id         File system ID that is exported
+ * @param auth          NFS client authentication type  (May be NULL)
+ * @param root          List of hosts that have root access (May be NULL)
+ * @param rw            List of hosts that have read/write access (May be NULL)
+ * @param ro            List of hosts that have read only access (May be NULL)
+ * @param anonuid       User id that should be mapped to anonymous
+ *                      (Valid or set to ANON_UID_GID_NA).
+ * @param anongid       Group id that should be mapped to anonymous
+ *                      (Valid or set to ANON_UID_GID_NA)
+ * @param options       String of options passed to array
+ * @return Valid lsmNfsExportPtr, else NULL on error.
+ */
+lsmNfsExportPtr LSM_DLL_EXPORT lsmNfsExportRecordAlloc( const char *id,
+                                                    const char *fs_id,
+                                                    const char *export_path,
+                                                    const char *auth,
+                                                    lsmStringListPtr root,
+                                                    lsmStringListPtr rw,
+                                                    lsmStringListPtr ro,
+                                                    uint64_t anonuid,
+                                                    uint64_t anongid,
+                                                    const char *options);
+
+/**
+ * Allocated the memory for an array of NFS export records.
+ * @param size          Number of elements
+ * @return Allocated memory, NULL on error
+ */
+lsmNfsExportPtr LSM_DLL_EXPORT *lsmNfsExportRecordAllocArray( uint32_t size );
+
+
+/**
+ * Frees the memory for a NFS export record.
+ * @param exp
+ */
+void LSM_DLL_EXPORT lsmNfsExportRecordFree( lsmNfsExportPtr exp );
+
+/**
+ * Frees the memory for the NFS export array and the memory for each entry
+ * @param exps          Memory to free
+ * @param size          Number of entries
+ */
+void LSM_DLL_EXPORT lsmNfsExportRecordFreeArray( lsmNfsExportPtr exps[],
+                                                    uint32_t size);
+
+/**
+ * Duplicates the source and returns the copy.
+ * @param source            Source record to copy
+ * @return Copy of source, else NULL one error.
+ */
+lsmNfsExportPtr LSM_DLL_EXPORT lsmNfsExportRecordCopy( lsmNfsExportPtr source );
+
+/**
+ * Returns the ID
+ * @param exp       Valid nfs export record
+ * @return Pointer to ID
+ */
+const char LSM_DLL_EXPORT *lsmNfsExportIdGet( lsmNfsExportPtr exp );
+int LSM_DLL_EXPORT lsmNfsExportIdSet(lsmNfsExportPtr exp, const char *ep );
+
+/**
+ * Returns the file system id
+ * @param exp       Valid nfs export record
+ * @return Pointer to file system id
+ */
+const char LSM_DLL_EXPORT *lsmNfsExportFsIdGet( lsmNfsExportPtr exp );
+int LSM_DLL_EXPORT lsmNfsExportFsIdSet(lsmNfsExportPtr exp, const char *fs_id);
+
+/**
+ * Returns the export path
+ * @param exp       Valid nfs export record
+ * @return Pointer to export path
+ */
+const char LSM_DLL_EXPORT *lsmNfsExportExportPathGet( lsmNfsExportPtr exp );
+int LSM_DLL_EXPORT lsmNfsExportExportPathSet( lsmNfsExportPtr exp,
+                                                const char *export_path);
+
+/**
+ * Returns the client authentication type
+ * @param exp       Valid nfs export record
+ * @return Pointer to authentication type
+ */
+const char LSM_DLL_EXPORT *lsmNfsExportAuthTypeGet( lsmNfsExportPtr exp );
+int LSM_DLL_EXPORT lsmNfsExportAuthTypeSet( lsmNfsExportPtr exp,
+                                            const char *value );
+
+/**
+ * Returns the list of hosts that have root access
+ * @param exp       Valid nfs export record
+ * @return list of hosts.
+ */
+lsmStringListPtr LSM_DLL_EXPORT lsmNfsExportRootGet( lsmNfsExportPtr exp);
+int LSM_DLL_EXPORT lsmNfsExportRootSet(lsmNfsExportPtr exp,
+                                        lsmStringListPtr value);
+
+/**
+ * Returns the list of hosts that have read/write access to export.
+ * @param exp       Valid nfs export record
+ * @return list of hosts.
+ */
+lsmStringListPtr LSM_DLL_EXPORT lsmNfsExportReadWriteGet( lsmNfsExportPtr exp);
+int LSM_DLL_EXPORT lsmNfsExportReadWriteSet( lsmNfsExportPtr exp,
+                                                lsmStringListPtr value);
+
+/**
+ * Returns the list of hosts that have read only access to export.
+ * @param exp       Valid nfs export record
+ * @return list of hosts
+ */
+lsmStringListPtr LSM_DLL_EXPORT lsmNfsExportReadOnlyGet( lsmNfsExportPtr exp );
+int LSM_DLL_EXPORT lsmNfsExportReadOnlySet( lsmNfsExportPtr exp,
+                                            lsmStringListPtr value);
+
+/**
+ * Returns the id which is to be mapped to anonymous id
+ * @param exp       Valid nfs export record
+ * @return ANON_UID_GID_NA value is returned when this isn't set, else value
+ * mapped to anonymous group id.  For errors ANON_UID_GID_ERROR is returned.
+ */
+uint64_t LSM_DLL_EXPORT lsmNfsExportAnonUidGet( lsmNfsExportPtr exp );
+int LSM_DLL_EXPORT lsmNfsExportAnonUidSet( lsmNfsExportPtr exp, uint64_t value);
+
+/**
+ * Returns the group id which is to be mapped to anonymous group
+ * @param exp       Valid nfs export record
+ * @return ANON_UID_GID_NA value is returned when this isn't set, else value
+ * mapped to anonymous group id.  For errors ANON_UID_GID_ERROR is returned.
+ */
+uint64_t LSM_DLL_EXPORT lsmNfsExportAnonGidGet( lsmNfsExportPtr exp );
+int LSM_DLL_EXPORT lsmNfsExportAnonGidSet( lsmNfsExportPtr exp, uint64_t value);
+
+/**
+ * Returns the options for this export.
+ * @param exp       Valid nfs export record
+ * @return Options value, NULL if not applicable.
+ */
+const char LSM_DLL_EXPORT *lsmNfsExportOptionsGet( lsmNfsExportPtr exp);
+int LSM_DLL_EXPORT lsmNfsExportOptionsSet( lsmNfsExportPtr exp,
+                                            const char *value);
+
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif


spelling in comment fix.

spelling in comment fix.

--- dev/pci/if_tht.c
+++ dev/pci/if_tht.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_tht.c,v 1.55 2007/04/23 11:24:07 dlg Exp $ */
+/*	$OpenBSD: if_tht.c,v 1.56 2007/04/23 11:27:32 dlg Exp $ */

 /*
  * Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -890,7 +890,7 @@
 			ifp->if_oerrors++;
 			break;
 		}
-		/* though shalt not use m after this point, only pkt->tp_m */
+		/* thou shalt not use m after this point, only pkt->tp_m */

 #if NBPFILTER > 0
 		if (ifp->if_bpf)