bpf: fix a style-o

bpf: fix a style-o

That would be a type-o which results in bad style :)

Signed-off-by: Paul Moore <88a1d58bf22a647dce58dd91f9595600dceabba9@redhat.com>

--- src/gen_bpf.c
+++ src/gen_bpf.c
@@ -382,7 +382,7 @@
 	}

 	if (_blk_resize(state, blk, 1) == NULL)
-	    return NULL;
+		return NULL;
 	memcpy(&blk->blks[blk->blk_cnt++], instr, sizeof(*instr));

 	return blk;
@@ -409,7 +409,7 @@
 		return _blk_append(state, blk, instr);

 	if (_blk_resize(state, blk, 1) == NULL)
-	    return NULL;
+		return NULL;
 	memmove(&blk->blks[1], &blk->blks[0], blk->blk_cnt++ * sizeof(*instr));
 	memcpy(&blk->blks[0], instr, sizeof(*instr));


Fix OpenCL compilation with the new brick texture

--- src/kernel/svm/svm_brick.h
+++ src/kernel/svm/svm_brick.h
@@ -112,7 +112,7 @@
 	}

 	if(stack_valid(color_offset))
-		stack_store_float3(stack, color_offset, lerp(color1, mortar, f));
+		stack_store_float3(stack, color_offset, color1*(1.0f-f) + mortar*f);
 	if(stack_valid(fac_offset))
 		stack_store_float(stack, fac_offset, f);
 }


Remove #ifdef DEBUG signal debugging code brought over from NetBSD with the original signal handling code.  It doesn't compile and it seems the rest of the infrastructure was never brought over from NetBSD.

--- sys/alpha/alpha/machdep.c
+++ sys/alpha/alpha/machdep.c
@@ -1424,11 +1424,6 @@
 		sfp = (struct sigframe *)(alpha_pal_rdusp() - rndfsize);
 	PROC_UNLOCK(p);

-#ifdef DEBUG
-	if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
-		printf("sendsig(%d): sig %d ssp %p usp %p\n", p->p_pid,
-		       sig, &sf, sfp);
-#endif
 	/* save the floating-point state, if necessary, then copy it. */
 	alpha_fpstate_save(td, 1);
 	sf.sf_uc.uc_mcontext.mc_ownedfp = td->td_md.md_flags & MDTD_FPUSED;
@@ -1447,11 +1442,6 @@
 	 * copy the frame out to userland.
 	 */
 	if (copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)) != 0) {
-#ifdef DEBUG
-		if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
-			printf("sendsig(%d): copyout failed on sig %d\n",
-			       p->p_pid, sig);
-#endif
 		/*
 		 * Process has trashed its stack; give it an illegal
 		 * instruction to halt it in its tracks.
@@ -1464,11 +1454,6 @@
 		psignal(p, SIGILL);
 		return;
 	}
-#ifdef DEBUG
-	if (sigdebug & SDB_FOLLOW)
-		printf("sendsig(%d): sig %d sfp %p code %lx\n", p->p_pid, sig,
-		    sfp, code);
-#endif

 	/*
 	 * Set up the registers to return to sigcode.
@@ -1491,15 +1476,6 @@
 	frame->tf_regs[FRAME_T12] = (u_int64_t)catcher;	/* t12 is pv */
 	frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */
 	alpha_pal_wrusp((unsigned long)sfp);
-
-#ifdef DEBUG
-	if (sigdebug & SDB_FOLLOW)
-		printf("sendsig(%d): pc %lx, catcher %lx\n", p->p_pid,
-		    frame->tf_regs[FRAME_PC], frame->tf_regs[FRAME_A3]);
-	if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
-		printf("sendsig(%d): sig %d returns\n",
-		    p->p_pid, sig);
-#endif
 }

 /*
@@ -1670,10 +1646,6 @@
 	pcb = td->td_pcb;
 	p = td->td_proc;

-#ifdef DEBUG
-	if (sigdebug & SDB_FOLLOW)
-	    printf("sigreturn: pid %d, scp %p\n", p->p_pid, ucp);
-#endif
 	/*
 	 * Fetch the entire context structure at once for speed.
 	 * Note that struct osigcontext is smaller than a ucontext_t,
@@ -1725,10 +1697,6 @@
 	      &td->td_pcb->pcb_fp, sizeof(struct fpreg));
 	td->td_pcb->pcb_fp_control = uc.uc_mcontext.mc_fp_control;

-#ifdef DEBUG
-	if (sigdebug & SDB_FOLLOW)
-		printf("sigreturn(%d): returns\n", p->p_pid);
-#endif
 	return (EJUSTRETURN);
 }


Removed 'pagesize' from tokudb_gen
Addresses #149

git-svn-id: 4b2652e19d8125fd9d24eff55f31fd1beb5a42e7@1048 c7de825b-a66e-492c-adef-691d508d4ae1

--- utils/tokudb_gen.c
+++ utils/tokudb_gen.c
@@ -236,7 +236,7 @@
       printf("VERSION=3\n"
              "format=%s\n"
              "type=btree\n"
-             "db_pagesize=4096\n"
+             //"db_pagesize=4096\n"  //Don't write pagesize which would be useless.
              "HEADER=END\n",
              g.plaintext ? "print" : "bytevalue");
    }


MFC r272193

MFC r272193

  Allow the PIC's IMR register to be read before ICW initialisation.

  As of git submit e179f6914152eca9, the Linux kernel does a simple
  probe of the PIC by writing a pattern to the IMR and then reading it
  back, prior to the init sequence of ICW words.

  The bhyve PIC emulation wasn't allowing the IMR to be read until
  the ICW sequence was complete. This limitation isn't required so
  relax the test.

  With this change, Linux kernels 3.15-rc2 and later won't hang
  on boot when calibrating the local APIC.

Approved by: re (gjb)


[PANDORA] Add fallback to 565 on glXChooseFBConfig if asking for 888x

--- src/glx/glx.c
+++ src/glx/glx.c
@@ -1580,7 +1580,7 @@
                 case GLX_SAMPLES:
                     tmp = attrib_list[i++];
                     attr[cur++] = EGL_SAMPLES;
-                    attr[cur++] = tmp;
+                    attr[cur++] = (tmp<0)?0:tmp;
                     DBG(printf("FBConfig multiSampleSize=%d\n", tmp);)
                     break;
                 case GLX_DOUBLEBUFFER:
@@ -1658,6 +1658,13 @@
                 attr[cr] = attr[cg] = attr[cb] = 5;
                 egl_eglChooseConfig(eglDisplay, attr, NULL, 0, count);
         }
+#ifdef PANDORA
+        if((*count==0) && (!globals4es.usepbuffer) && (attr[cr]>5 || attr[cg]>5 || attr[cb]>5)) {
+                DBG(printf("glXChooseFBConfig found 0 config with 8bits rgb, trying lowering bitness\n");)
+                attr[cr] = attr[cg] = attr[cb] = 5;
+                egl_eglChooseConfig(eglDisplay, attr, NULL, 0, count);
+        }
+#endif
         if(*count==0) {  // NO Config found....
             DBG(printf("glXChooseFBConfig found 0 config\n");)
             return NULL;


url-coding: use standard stdint instead of boost

Not sure what's going on here, but maybe it'll help fix the following
breakage when building the Kudu client library in the Impala build:

Change-Id: I9b3bf141d717d05a8d35aea277246ecff925449e
17:02:18 In file included from /data/jenkins/workspace/generic-package-ubuntu64-14-04-impala/Kudu-Packaging-Kimpala-2015-03-26_16-44-33/impala-2.1.2+cdh5.3.2+0-1.cdh5.3.2.p0.3~trusty/Kudu/src/kudu/util/url-coding.cc:16:0:
17:02:18 /data/jenkins/workspace/generic-package-ubuntu64-14-04-impala/Kudu-Packaging-Kimpala-2015-03-26_16-44-33/impala-2.1.2+cdh5.3.2+0-1.cdh5.3.2.p0.3~trusty/Kudu/src/kudu/util/url-coding.h:31:34: error: ‘uint8_t’ was not declared in this scope
17:02:18  void UrlEncode(const std::vector<uint8_t>& in, std::string* out,
17:02:18                                   ^
17:02:18 /data/jenkins/workspace/generic-package-ubuntu64-14-04-impala/Kudu-Packaging-Kimpala-2015-03-26_16-44-33/impala-2.1.2+cdh5.3.2+0-1.cdh5.3.2.p0.3~trusty/Kudu/src/kudu/util/url-coding.h:31:34: note: suggested alternative:
17:02:18 In file included from /data/jenkins/workspace/generic-package-ubuntu64-14-04-impala/Kudu-Packaging-Kimpala-2015-03-26_16-44-33/impala-2.1.2+cdh5.3.2+0-1.cdh5.3.2.p0.3~trusty/Kudu/src/kudu/util/url-coding.h:21:0,
17:02:18                  from /data/jenkins/workspace/generic-package-ubuntu64-14-04-impala/Kudu-Packaging-Kimpala-2015-03-26_16-44-33/impala-2.1.2+cdh5.3.2+0-1.cdh5.3.2.p0.3~trusty/Kudu/src/kudu/util/url-coding.cc:16:
17:02:18 /usr/include/boost/cstdint.hpp:211:30: note:   ‘boost::uint8_t’
17:02:18       typedef unsigned char   uint8_t;
17:02:18                               ^
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/6233
Tested-by: jenkins
Reviewed-by: Jean-Daniel Cryans <4bf4c125525b8623ac45dfd7774cbf531df19085@cloudera.com>

--- src/kudu/util/url-coding.h
+++ src/kudu/util/url-coding.h
@@ -16,9 +16,10 @@
 #ifndef UTIL_URL_CODING_H
 #define UTIL_URL_CODING_H

+#include <stdint.h>
+
 #include <string>
 #include <vector>
-#include <boost/cstdint.hpp>

 namespace kudu {


mm/ARM64: kill poison_init_mem()

mm/ARM64: kill poison_init_mem()

Use free_reserved_area() to poison initmem memory pages and kill
poison_init_mem() on ARM64.

Signed-off-by: Jiang Liu <68ee766e574f18b34b683085865827393efe88bd@huawei.com>
Acked-by: Catalin Marinas <15ce75b290ebaf27c3f9fd73ab848685ed3d8261@arm.com>
Cc: Will Deacon <b913f13ef92ac157955c954ccaaff7be065faba4@arm.com>
Cc: "H. Peter Anvin" <8a453bad9912ffe59bc0f0b8abe03df9be19379e@zytor.com>
Cc: "Michael S. Tsirkin" <255103e50249e3d658441816e0597170ebfc16ef@redhat.com>
Cc: <7216fcc9df1ef14ae8b4a367ccbd1addd6d7e1e9@aol.com>
Cc: Arnd Bergmann <f2c659f01951776204a6c5b902787d9019fbeebd@arndb.de>
Cc: Chris Metcalf <074881f6f5da4d3b5278870ff234d1077ee622c0@tilera.com>
Cc: David Howells <ebac1d06c1688626821bb0e574a037a7a5354e49@redhat.com>
Cc: Geert Uytterhoeven <0da414d9d963da4039c2a0525b1844228075aa58@linux-m68k.org>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@redhat.com>
Cc: Jeremy Fitzhardinge <b3f594e10a9edcf5413cf1190121d45078c62290@goop.org>
Cc: Jianguo Wu <bfa600f2f37bdb58cd7013a13133683dd75e8c4c@huawei.com>
Cc: Joonsoo Kim <d91a346a9a76eb1627d34d097d6cb4c8e5067100@gmail.com>
Cc: Kamezawa Hiroyuki <634f508bd7c47cf0ee4126243675c3e598920fbc@jp.fujitsu.com>
Cc: Konrad Rzeszutek Wilk <da3a51b335cef0eb0e2c329c5ef6bcd6acef687a@oracle.com>
Cc: Marek Szyprowski <2a0259761cc3e88db42be5300c1579a67c77e65e@samsung.com>
Cc: Mel Gorman <2f629c4d93e35c3d371f0463b040c6ef04a5c1e5@csn.ul.ie>
Cc: Michel Lespinasse <6a4cf9207bb95b1a4cf1be22c2e93f8b38036f65@google.com>
Cc: Minchan Kim <eee62f459f15dcddf87a8df69e8328e2a2562028@kernel.org>
Cc: Rik van Riel <a21938f5d463ddf41aa718934c205ca2cce8ebbc@redhat.com>
Cc: Rusty Russell <df9728c9e5104131c08c7adb03af425394842596@rustcorp.com.au>
Cc: Tang Chen <4f61c4810b5ff5aa3e373c07e6d9ef9c55e4952f@cn.fujitsu.com>
Cc: Tejun Heo <546b05909706652891a87f7bfe385ae147f61f91@kernel.org>
Cc: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: Wen Congyang <59c7438a9275f5dd0b96a91958b493a9d005ad46@cn.fujitsu.com>
Cc: Yasuaki Ishimatsu <9b26f769475fafc2d25107053b1bdd774d49438a@jp.fujitsu.com>
Cc: Yinghai Lu <0674548f4d596393408a51d6287a76ebba2f42aa@kernel.org>
Cc: Russell King <c2093e01fa868776d7876ac617ce6d2ac30cb904@arm.linux.org.uk>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- arch/arm64/mm/init.c
+++ arch/arm64/mm/init.c
@@ -197,14 +197,6 @@
 	max_pfn = max_low_pfn = max;
 }

-/*
- * Poison init memory with an undefined instruction (0x0).
- */
-static inline void poison_init_mem(void *s, size_t count)
-{
-	memset(s, 0, count);
-}
-
 #ifndef CONFIG_SPARSEMEM_VMEMMAP
 static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn)
 {
@@ -386,8 +378,7 @@

 void free_initmem(void)
 {
-	poison_init_mem(__init_begin, __init_end - __init_begin);
-	free_initmem_default(-1);
+	free_initmem_default(0);
 }

 #ifdef CONFIG_BLK_DEV_INITRD
@@ -396,10 +387,8 @@

 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-	if (!keep_initrd) {
-		poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
-		free_reserved_area((void *)start, (void *)end, -1, "initrd");
-	}
+	if (!keep_initrd)
+		free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }

 static int __init keepinitrd_setup(char *__unused)


MFC 1.68: remove smp_rendezvous() during shutdown

Approved by:    re

--- sys/dev/acpica/acpi_cpu.c
+++ sys/dev/acpica/acpi_cpu.c
@@ -501,11 +501,13 @@
     /* Allow children to shutdown first. */
     bus_generic_shutdown(dev);

-    /* Disable any entry to the idle function. */
+    /*
+     * Disable any entry to the idle function.  There is a small race where
+     * an idle thread have passed this check but not gone to sleep.  This
+     * is ok since device_shutdown() does not free the softc, otherwise
+     * we'd have to be sure all threads were evicted before returning.
+     */
     cpu_disable_idle = TRUE;
-
-    /* Signal and wait for all processors to exit acpi_cpu_idle(). */
-    smp_rendezvous(NULL, NULL, NULL, NULL);

     return_VALUE (0);
 }


remove dead code

remove dead code

--- src/glx/glx.c
+++ src/glx/glx.c
@@ -450,7 +450,6 @@

 void glXSwapBuffers(Display *dpy, GLXDrawable drawable) {
     FORWARD_IF_REMOTE(glXSwapBuffers);
-    static int frames = 0;
     if (g_showfps || g_liveinfo) {
         // framerate counter
         static float avg, fps = 0;


Set da_id to DIO_DEVICE_ID_IHPIB if this is an internal hpib controller. Prevents nhpib0 from getting probed as dca1 on an hp400.

--- arch/hp300/dev/dio.c
+++ arch/hp300/dev/dio.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: dio.c,v 1.5 1997/07/06 08:01:48 downsj Exp $	*/
+/*	$OpenBSD: dio.c,v 1.6 1997/10/06 06:44:49 millert Exp $	*/
 /*	$NetBSD: dio.c,v 1.7 1997/05/05 21:00:32 thorpej Exp $	*/

 /*-
@@ -148,7 +148,10 @@
 		/* Fill out attach args. */
 		bzero(&da, sizeof(da));
 		da.da_scode = scode;
-		da.da_id = DIO_ID(va);
+		if (scode == 7 && internalhpib)
+			da.da_id = DIO_DEVICE_ID_IHPIB;
+		else
+			da.da_id = DIO_ID(va);

 		if (DIO_ISFRAMEBUFFER(da.da_id))
 			da.da_secid = DIO_SECID(va);


acpi_cpu_notify: disable acpi_cpu_idle while updating C-state data

... to avoid any races or inconsistencies.
This should fix a regression introduced in r243404.

Also, remove a stale comment that has not been true for quite a while
now.

Pointyhat to:	avg
Teested by:	trociny, emaste, dumbbell (earlier version)
MFC after:	 1 week


use suitable name/class

use suitable name/class

--- xbyak/xbyak.h
+++ xbyak/xbyak.h
@@ -919,32 +919,32 @@

 class LabelManager {
 	// for string label
-	struct StrLabelVal {
+	struct SlabelVal {
 		size_t offset;
-		StrLabelVal(size_t offset) : offset(offset) {}
+		SlabelVal(size_t offset) : offset(offset) {}
 	};
-	typedef XBYAK_STD_UNORDERED_MAP<std::string, StrLabelVal> DefinedList;
-	typedef XBYAK_STD_UNORDERED_MULTIMAP<std::string, const JmpLabel> UndefinedList;
-	struct State {
-		DefinedList defList;
-		UndefinedList undefList;
+	typedef XBYAK_STD_UNORDERED_MAP<std::string, SlabelVal> SlabelDefList;
+	typedef XBYAK_STD_UNORDERED_MULTIMAP<std::string, const JmpLabel> SlabelUndefList;
+	struct SlabelState {
+		SlabelDefList defList;
+		SlabelUndefList undefList;
 	};
-	typedef std::list<State> StateList;
-	// global : stateList_.front(), local : stateList_.back()
-	StateList stateList_;
+	typedef std::list<SlabelState> StateList;
 	// for Label class
-	struct LabelClassVal {
-		LabelClassVal(size_t offset = 0) : offset(offset), refCount(1) {}
+	struct ClabelVal {
+		ClabelVal(size_t offset = 0) : offset(offset), refCount(1) {}
 		size_t offset;
 		int refCount;
 	};
-	typedef XBYAK_STD_UNORDERED_MAP<int, LabelClassVal> DefinedList2;
-	typedef XBYAK_STD_UNORDERED_MULTIMAP<int, const JmpLabel> UndefinedList2;
+	typedef XBYAK_STD_UNORDERED_MAP<int, ClabelVal> ClabelDefList;
+	typedef XBYAK_STD_UNORDERED_MULTIMAP<int, const JmpLabel> ClabelUndefList;
+
 	CodeArray *base_;
+	// global : stateList_.front(), local : stateList_.back()
+	StateList stateList_;
 	mutable int labelId_;
-
-	DefinedList2 definedList2_;
-	UndefinedList2 undefinedList2_;
+	ClabelDefList clabelDefList_;
+	ClabelUndefList clabelUndefList_;

 	int getId(const Label& label) const
 	{
@@ -993,13 +993,13 @@
 		return true;
 	}
 	friend class Label;
-	void incRefCount(int id) { definedList2_[id].refCount++; }
+	void incRefCount(int id) { clabelDefList_[id].refCount++; }
 	void decRefCount(int id)
 	{
-		DefinedList2::iterator i = definedList2_.find(id);
-		if (i == definedList2_.end()) return;
+		ClabelDefList::iterator i = clabelDefList_.find(id);
+		if (i == clabelDefList_.end()) return;
 		if (i->second.refCount == 1) {
-			definedList2_.erase(id);
+			clabelDefList_.erase(id);
 		} else {
 			--i->second.refCount;
 		}
@@ -1024,12 +1024,12 @@
 		base_ = 0;
 		labelId_ = 1;
 		stateList_.clear();
-		stateList_.push_back(State());
-		stateList_.push_back(State());
+		stateList_.push_back(SlabelState());
+		stateList_.push_back(SlabelState());
 	}
 	void enterLocal()
 	{
-		stateList_.push_back(State());
+		stateList_.push_back(SlabelState());
 	}
 	void leaveLocal()
 	{
@@ -1038,12 +1038,12 @@
 		stateList_.pop_back();
 	}
 	void set(CodeArray *base) { base_ = base; }
-	void define(std::string label)
+	void defineSlabel(std::string label)
 	{
 		if (label == "@b" || label == "@f") throw Error(ERR_BAD_LABEL_STR);
 		if (label == "@@") {
-			DefinedList& defList = stateList_.front().defList;
-			DefinedList::iterator i = defList.find("@f");
+			SlabelDefList& defList = stateList_.front().defList;
+			SlabelDefList::iterator i = defList.find("@f");
 			if (i != defList.end()) {
 				defList.erase(i);
 				label = "@b";
@@ -1055,24 +1055,24 @@
 				label = "@f";
 			}
 		}
-		State& st = *label.c_str() == '.' ? stateList_.back() : stateList_.front();
+		SlabelState& st = *label.c_str() == '.' ? stateList_.back() : stateList_.front();
 		define_inner(st.defList, st.undefList, label, base_->getSize());
 	}
-	void define2(const Label& label)
-	{
-		define_inner(definedList2_, undefinedList2_, getId(label), base_->getSize());
+	void defineClabel(const Label& label)
+	{
+		define_inner(clabelDefList_, clabelUndefList_, getId(label), base_->getSize());
 		label.mgr = this;
 	}
 	void assign(Label& dst, const Label& src)
 	{
-		DefinedList2::const_iterator i = definedList2_.find(src.id);
-		if (i == definedList2_.end()) throw Error(ERR_LABEL_ISNOT_SET_BY_L);
-		define_inner(definedList2_, undefinedList2_, dst.id, i->second.offset);
+		ClabelDefList::const_iterator i = clabelDefList_.find(src.id);
+		if (i == clabelDefList_.end()) throw Error(ERR_LABEL_ISNOT_SET_BY_L);
+		define_inner(clabelDefList_, clabelUndefList_, dst.id, i->second.offset);
 		dst.mgr = this;
 	}
 	bool getOffset(size_t *offset, std::string& label) const
 	{
-		const DefinedList& defList = stateList_.front().defList;
+		const SlabelDefList& defList = stateList_.front().defList;
 		if (label == "@b") {
 			if (defList.find("@f") != defList.end()) {
 				label = "@f";
@@ -1084,31 +1084,30 @@
 				label = "@b";
 			}
 		}
-		const State& st = *label.c_str() == '.' ? stateList_.back() : stateList_.front();
+		const SlabelState& st = *label.c_str() == '.' ? stateList_.back() : stateList_.front();
 		return getOffset_inner(st.defList, offset, label);
 	}
 	bool getOffset(size_t *offset, const Label& label) const
 	{
-		return getOffset_inner(definedList2_, offset, getId(label));
+		return getOffset_inner(clabelDefList_, offset, getId(label));
 	}
 	void addUndefinedLabel(const std::string& label, const JmpLabel& jmp)
 	{
-		State& st = *label.c_str() == '.' ? stateList_.back() : stateList_.front();
-		st.undefList.insert(UndefinedList::value_type(label, jmp));
+		SlabelState& st = *label.c_str() == '.' ? stateList_.back() : stateList_.front();
+		st.undefList.insert(SlabelUndefList::value_type(label, jmp));
 	}
 	void addUndefinedLabel(const Label& label, const JmpLabel& jmp)
 	{
-		undefinedList2_.insert(UndefinedList2::value_type(label.id, jmp));
-	}
-	bool hasUndefinedLabel() const
+		clabelUndefList_.insert(ClabelUndefList::value_type(label.id, jmp));
+	}
+	bool hasUndefSlabel() const
 	{
 		for (StateList::const_iterator i = stateList_.begin(), ie = stateList_.end(); i != ie; ++i) {
-			bool found = hasUndefinedLabel_inner(i->undefList);
-			if (found) return true;
+			if (hasUndefinedLabel_inner(i->undefList)) return true;
 		}
 		return false;
 	}
-	bool hasUndefinedLabel2() const { return hasUndefinedLabel_inner(undefinedList2_); }
+	bool hasUndefClabel() const { return hasUndefinedLabel_inner(clabelUndefList_); }
 };

 inline Label::Label(const Label& rhs)
@@ -1573,8 +1572,8 @@
 	const Ymm &ym8, &ym9, &ym10, &ym11, &ym12, &ym13, &ym14, &ym15;
 	const RegRip rip;
 #endif
-	void L(const std::string& label) { labelMgr_.define(label); }
-	void L(const Label& label) { labelMgr_.define2(label); }
+	void L(const std::string& label) { labelMgr_.defineSlabel(label); }
+	void L(const Label& label) { labelMgr_.defineClabel(label); }
 	/*
 		assign src to dst
 		require
@@ -1966,7 +1965,7 @@
 		labelMgr_.reset();
 		labelMgr_.set(this);
 	}
-	bool hasUndefinedLabel() const { return labelMgr_.hasUndefinedLabel() || labelMgr_.hasUndefinedLabel2(); }
+	bool hasUndefinedLabel() const { return labelMgr_.hasUndefSlabel() || labelMgr_.hasUndefClabel(); }
 	/*
 		call ready() to complete generating code on AutoGrow
 	*/


_HP300_INTR_H_PRIVATE is long dead.

_HP300_INTR_H_PRIVATE is long dead.

--- arch/hp300/dev/dio.c
+++ arch/hp300/dev/dio.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: dio.c,v 1.9 2004/09/29 07:35:52 miod Exp $	*/
+/*	$OpenBSD: dio.c,v 1.10 2004/12/26 21:41:32 miod Exp $	*/
 /*	$NetBSD: dio.c,v 1.7 1997/05/05 21:00:32 thorpej Exp $	*/

 /*-
@@ -41,8 +41,6 @@
  * Autoconfiguration and mapping support for the DIO bus.
  */

-#define	_HP300_INTR_H_PRIVATE
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>


Set recv.len to zero if we get no response.

--- sys/dev/firewire/fwohci.c
+++ sys/dev/firewire/fwohci.c
@@ -1091,12 +1091,15 @@
 					xfer->resp = err;
 					if (xfer->retry_req != NULL)
 						xfer->retry_req(xfer);
-					else
+					else {
+						xfer->recv.len = 0;
 						fw_xfer_done(xfer);
+					}
 				} else if (stat != FWOHCIEV_ACKPEND) {
 					if (stat != FWOHCIEV_ACKCOMPL)
 						xfer->state = FWXF_SENTERR;
 					xfer->resp = err;
+					xfer->recv.len = 0;
 					fw_xfer_done(xfer);
 				}
 			}


auth-master lookup: Give better error message on connect() EACCES errors.

--- src/lib-auth/auth-master.c
+++ src/lib-auth/auth-master.c
@@ -4,6 +4,7 @@
 #include "lib-signals.h"
 #include "array.h"
 #include "ioloop.h"
+#include "eacces-error.h"
 #include "network.h"
 #include "istream.h"
 #include "ostream.h"
@@ -281,8 +282,14 @@
 		usleep(((rand() % 10) + 1) * 10000);
 	}
 	if (fd == -1) {
-		i_error("userdb lookup: connect(%s) failed: %m",
-			conn->auth_socket_path);
+		if (errno == EACCES) {
+			i_error("userdb lookup: %s",
+				eacces_error_get("connect",
+						 conn->auth_socket_path));
+		} else {
+			i_error("userdb lookup: connect(%s) failed: %m",
+				conn->auth_socket_path);
+		}
 		return -1;
 	}
 	conn->fd = fd;


MIPS: Avoid destructive invalidation on partial cachelines.

See discussion e9c3a7c20901051031y528d0d31r18d44c5096c59e0@mail.gmail.com.

Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>

--- arch/mips/mm/c-r4k.c
+++ arch/mips/mm/c-r4k.c
@@ -618,15 +618,35 @@
 	if (cpu_has_inclusive_pcaches) {
 		if (size >= scache_size)
 			r4k_blast_scache();
-		else
+		else {
+			unsigned long lsize = cpu_scache_line_size();
+			unsigned long almask = ~(lsize - 1);
+
+			/*
+			 * There is no clearly documented alignment requirement
+			 * for the cache instruction on MIPS processors and
+			 * some processors, among them the RM5200 and RM7000
+			 * QED processors will throw an address error for cache
+			 * hit ops with insufficient alignment.  Solved by
+			 * aligning the address to cache line size.
+			 */
+			cache_op(Hit_Writeback_Inv_SD, addr & almask);
+			cache_op(Hit_Writeback_Inv_SD,
+				 (addr + size - 1) & almask);
 			blast_inv_scache_range(addr, addr + size);
+		}
 		return;
 	}

 	if (cpu_has_safe_index_cacheops && size >= dcache_size) {
 		r4k_blast_dcache();
 	} else {
+		unsigned long lsize = cpu_dcache_line_size();
+		unsigned long almask = ~(lsize - 1);
+
 		R4600_HIT_CACHEOP_WAR_IMPL;
+		cache_op(Hit_Writeback_Inv_D, addr & almask);
+		cache_op(Hit_Writeback_Inv_D, (addr + size - 1)  & almask);
 		blast_inv_dcache_range(addr, addr + size);
 	}


Fix definition of 'offsetof'

Fix definition of 'offsetof'

The definition of 'offsetof' must cast NULL to (type *), not (type).

Signed-off-by: Peter Mitsis <22bf95476f8cdbda3c8a9a9bf1bdda876f69ea7a@windriver.com>

--- lib/libc/minimal/include/stddef.h
+++ lib/libc/minimal/include/stddef.h
@@ -47,6 +47,6 @@
 #define NULL (void *) 0
 #endif

-#define offsetof(type, member) ((size_t) (&((type) NULL)->member))
+#define offsetof(type, member) ((size_t) (&((type *) NULL)->member))

 #endif /* __INC_stddef_h__ */


Don't be noisy in case of shared interrupts.


Versioning appearance easier to check.

Versioning appearance easier to check.

git-svn-id: cfe980af5ea9c2e8ec55361f9629c08651448aa3@204 9b4b2aa8-92f0-458a-8103-c3834d721760

--- src/gwd/gwd.c
+++ src/gwd/gwd.c
@@ -98,11 +98,12 @@

 void print_license()
 {
-    printf("Copyright 2002-2009 GridWay Team, Distributed Systems Architecture\n");
-    printf("Group, Universidad Complutense de Madrid\n");
-    printf("\n");
-    printf(GW_VERSION" is distributed and licensed for use under the terms of the\n");
-    printf("Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0).\n");
+  printf(GW_VERSION"\n");
+  printf("Copyright 2002-2009 GridWay Team,\n");
+  printf("Distributed Systems Architecture Group (http://dsa-research.org),\n")
+  printf("Universidad Complutense de Madrid\n\n");
+  printf("GridWay is distributed and licensed for use under the terms of the\n");
+  printf("Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0).\n");
 }

 /* -------------------------------------------------------------------------- */


dict-client: Improved broken iterate reply logging.

--- src/lib-dict/dict-client.c
+++ src/lib-dict/dict-client.c
@@ -651,7 +651,7 @@
 	struct client_dict_iterate_context *ctx =
 		(struct client_dict_iterate_context *)_ctx;
 	struct client_dict *dict = (struct client_dict *)_ctx->dict;
-	char *line, *value;
+	char *line, *key, *value;

 	if (ctx->failed)
 		return FALSE;
@@ -674,24 +674,26 @@

 	switch (*line) {
 	case DICT_PROTOCOL_REPLY_OK:
-		value = strchr(++line, '\t');
+		key = line+1;
+		value = strchr(key, '\t');
 		break;
 	case DICT_PROTOCOL_REPLY_FAIL:
 		ctx->failed = TRUE;
 		return FALSE;
 	default:
+		key = NULL;
 		value = NULL;
 		break;
 	}
 	if (value == NULL) {
 		/* broken protocol */
-		i_error("dict client (%s) sent broken reply", dict->path);
+		i_error("dict client (%s) sent broken iterate reply: %s", dict->path, line);
 		ctx->failed = TRUE;
 		return FALSE;
 	}
 	*value++ = '\0';

-	*key_r = p_strdup(ctx->pool, dict_client_unescape(line));
+	*key_r = p_strdup(ctx->pool, dict_client_unescape(key));
 	*value_r = p_strdup(ctx->pool, dict_client_unescape(value));
 	return TRUE;
 }


Revert "MIPS: microMIPS: Support dynamic ASID sizing."

This reverts commit f6b06d9361a008afb93b97fb3683a6e92d69d0f4.

The next revert depends on this one, so this has to go too.

Signed-off-by: David Daney <eec15f2dea0e7d114bf41a5bde8a2858b8f3e893@cavium.com>
Cc: 562397917b9a8bf316569a848858b12fb417723f@linux-mips.org
Cc: 2578944098299abf708b08eff6fcf60565553586@vger.kernel.org
Cc: "Steven J. Hill" <65de785d8c782d8fbc3c121e7b1bdd045e15ee49@imgtec.com>
Cc: David Daney <eec15f2dea0e7d114bf41a5bde8a2858b8f3e893@cavium.com>
Patchwork: https://patchwork.linux-mips.org/patch/5241/
Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>

--- arch/mips/mm/tlbex.c
+++ arch/mips/mm/tlbex.c
@@ -309,32 +309,13 @@
 static void __cpuinit insn_fixup(unsigned int **start, unsigned int **stop,
 					unsigned int i_const)
 {
-	unsigned int **p;
+	unsigned int **p, *ip;

 	for (p = start; p < stop; p++) {
-#ifndef CONFIG_CPU_MICROMIPS
-		unsigned int *ip;
-
 		ip = *p;
 		*ip = (*ip & 0xffff0000) | i_const;
-#else
-		unsigned short *ip;
-
-		ip = ((unsigned short *)((unsigned int)*p - 1));
-		if ((*ip & 0xf000) == 0x4000) {
-			*ip &= 0xfff1;
-			*ip |= (i_const << 1);
-		} else if ((*ip & 0xf000) == 0x6000) {
-			*ip &= 0xfff1;
-			*ip |= ((i_const >> 2) << 1);
-		} else {
-			ip++;
-			*ip = i_const;
-		}
-#endif
-		local_flush_icache_range((unsigned long)ip,
-					 (unsigned long)ip + sizeof(*ip));
-	}
+	}
+	local_flush_icache_range((unsigned long)*p, (unsigned long)((*p) + 1));
 }

 #define asid_insn_fixup(section, const)					\
@@ -354,14 +335,6 @@
 	extern asmlinkage void handle_ri_rdhwr_vivt(void);
 	unsigned long *vivt_exc;

-#ifdef CONFIG_CPU_MICROMIPS
-	/*
-	 * Worst case optimised microMIPS addiu instructions support
-	 * only a 3-bit immediate value.
-	 */
-	if(inc > 7)
-		panic("Invalid ASID increment value!");
-#endif
 	asid_insn_fixup(__asid_inc, inc);
 	asid_insn_fixup(__asid_mask, mask);
 	asid_insn_fixup(__asid_version_mask, version_mask);
@@ -369,9 +342,6 @@

 	/* Patch up the 'handle_ri_rdhwr_vivt' handler. */
 	vivt_exc = (unsigned long *) &handle_ri_rdhwr_vivt;
-#ifdef CONFIG_CPU_MICROMIPS
-	vivt_exc = (unsigned long *)((unsigned long) vivt_exc - 1);
-#endif
 	vivt_exc++;
 	*vivt_exc = (*vivt_exc & ~mask) | mask;


tidy psclog

tidy psclog

git-svn-id: f2acecaac6fbd5a03f3d4799db58dda434111981@22077 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- pfl/service.c
+++ pfl/service.c
@@ -439,20 +439,14 @@
 	timediff = cfs_timeval_sub(&work_end, &work_start, NULL);

 	if (timediff / 1000000 > PSCRPC_OBD_TIMEOUT)
-		CERROR("request %"PRIu64" opc %u from %s processed in %lds "
-		       "trans %"PRIu64" rc %d/%d\n",
-		       request->rq_xid, request->rq_reqmsg->opc,
-		       libcfs_id2str(request->rq_peer),
-		       cfs_timeval_sub(&work_end, &request->rq_arrival_time,
-			NULL) / 1000000,
-		       request->rq_repmsg ? request->rq_repmsg->transno :
-		       request->rq_transno, request->rq_status,
-		       request->rq_repmsg ?
-			  (int)request->rq_repmsg->status : -999);
+		DEBUG_REQ(PLL_ERROR, rq,
+		    "timeout, processed in %lds",
+		    cfs_timeval_sub(&work_end, &request->rq_arrival_time,
+		      NULL) / 1000000);
 	else
-		psclogs_diag(PSS_RPC, "request %"PRIu64" opc %u from %s "
+		psclog_diag("request %"PRIu64" opc %u from %s "
 		    "processed in %ldus (%ldus total) trans %"PRIu64" "
-		    "rc %d/%d\n",
+		    "rc %d/%d",
 		    request->rq_xid, request->rq_reqmsg->opc,
 		    libcfs_id2str(request->rq_peer), timediff,
 		    cfs_timeval_sub(&work_end,


fix minor numbers for multi-channel devices

Submitted by:	Alexander Matey <matey@cis.ohio-state.edu>

--- sys/dev/sound/pcm/sound.c
+++ sys/dev/sound/pcm/sound.c
@@ -59,14 +59,15 @@
 	/* bmaj */	-1
 };

-/* PROPOSAL:
+/*
+PROPOSAL:
 each unit needs:
 status, mixer, dsp, dspW, audio, sequencer, midi-in, seq2, sndproc = 9 devices
 dspW and audio are deprecated.
 dsp needs min 64 channels, will give it 256

-minor = (unit << 12) + (dev << 8) + channel
-currently minor = (channel << 8) + (unit << 4) + dev
+minor = (unit << 20) + (dev << 16) + channel
+currently minor = (channel << 16) + (unit << 4) + dev

 nomenclature:
 	/dev/pcmX/dsp.(0..255)
@@ -75,16 +76,13 @@
 	/dev/pcmX/status
 	/dev/pcmX/mixer
 	[etc.]
-
-currently:
-minor = (channel << 8) + (unit << 4) + dev
 */

 #define PCMMINOR(x) (minor(x))
-#define PCMCHAN(x) ((PCMMINOR(x) & 0x0000ff00) >> 8)
+#define PCMCHAN(x) ((PCMMINOR(x) & 0x0000ff00) >> 16)
 #define PCMUNIT(x) ((PCMMINOR(x) & 0x000000f0) >> 4)
 #define PCMDEV(x)   (PCMMINOR(x) & 0x0000000f)
-#define PCMMKMINOR(u, d, c) ((((c) & 0xff) << 8) | (((u) & 0x0f) << 4) | ((d) & 0x0f))
+#define PCMMKMINOR(u, d, c) ((((c) & 0xff) << 16) | (((u) & 0x0f) << 4) | ((d) & 0x0f))

 static devclass_t pcm_devclass;


minor change

minor change

--- src/handler.h
+++ src/handler.h
@@ -6,7 +6,7 @@
 	/**
  	 * Constructor
  	 */
-	Handler(Shell sh);
+	Handler(Shell *sh);

 	/**
 	 * Executes a command.


dict proxy client: Timeout lookups after 30 s, log warning if lookup takes >5 s.

--HG--
branch : HEAD

--- src/lib-dict/dict-client.c
+++ src/lib-dict/dict-client.c
@@ -18,6 +18,11 @@
    dict accesses, so it can handle only one client at a time. increasing the
    timeout increases number of idling dict processes. */
 #define DICT_CLIENT_TIMEOUT_MSECS 1000
+
+/* Abort dict lookup after this many seconds. */
+#define DICT_CLIENT_READ_TIMEOUT_SECS 30
+/* Log a warning if dict lookup takes longer than this many seconds. */
+#define DICT_CLIENT_READ_WARN_TIMEOUT_SECS 5

 struct client_dict {
 	struct dict dict;
@@ -265,15 +270,46 @@
 		io_remove(&dict->io);
 }

+static ssize_t client_dict_read_timeout(struct client_dict *dict)
+{
+	time_t now, timeout;
+	unsigned int diff;
+	ssize_t ret;
+
+	now = time(NULL);
+	timeout = now + DICT_CLIENT_READ_TIMEOUT_SECS;
+
+	do {
+		alarm(timeout - now);
+		ret = i_stream_read(dict->input);
+		alarm(0);
+		if (ret != 0)
+			break;
+
+		/* interrupted most likely because of timeout,
+		   but check anyway. */
+		now = time(NULL);
+	} while (now < timeout);
+
+	if (ret > 0) {
+		diff = time(NULL) - now;
+		if (diff >= DICT_CLIENT_READ_WARN_TIMEOUT_SECS) {
+			i_warning("read(%s): dict lookup took %u seconds",
+				  dict->path, diff);
+		}
+	}
+	return ret;
+}
+
 static int client_dict_read_one_line(struct client_dict *dict, char **line_r)
 {
 	unsigned int id;
 	char *line;
-	int ret;
+	ssize_t ret;

 	*line_r = NULL;
 	while ((line = i_stream_next_line(dict->input)) == NULL) {
-		ret = i_stream_read(dict->input);
+		ret = client_dict_read_timeout(dict);
 		switch (ret) {
 		case -1:
 			if (dict->input->stream_errno != 0)
@@ -286,6 +322,10 @@
 		case -2:
 			i_error("read(%s) returned too much data", dict->path);
 			return -1;
+		case 0:
+			i_error("read(%s) failed: Timeout after %u seconds",
+				dict->path, DICT_CLIENT_READ_TIMEOUT_SECS);
+			return -1;
 		default:
 			i_assert(ret > 0);
 			break;
@@ -373,7 +413,6 @@
 	net_set_nonblock(dict->fd, FALSE);

 	dict->input = i_stream_create_fd(dict->fd, (size_t)-1, FALSE);
-	dict->input->blocking = TRUE;
 	dict->output = o_stream_create_fd(dict->fd, 4096, FALSE);
 	dict->transaction_id_counter = 0;
 	dict->async_commits = 0;


MFC r197573

MFC r197573

 Add back endpoint swap detection that was disabled in an earlier driver
 conversion.

--- sys/dev/usb/serial/umct.c
+++ sys/dev/usb/serial/umct.c
@@ -115,6 +115,7 @@
 	uint8_t	sc_lcr;
 	uint8_t	sc_mcr;
 	uint8_t	sc_iface_no;
+	uint8_t sc_swap_cb;
 	uint8_t	sc_name[16];
 };

@@ -125,8 +126,10 @@
 static device_detach_t umct_detach;

 static usb_callback_t umct_intr_callback;
+static usb_callback_t umct_intr_callback_sub;
+static usb_callback_t umct_read_callback;
+static usb_callback_t umct_read_callback_sub;
 static usb_callback_t umct_write_callback;
-static usb_callback_t umct_read_callback;

 static void	umct_cfg_do_request(struct umct_softc *sc, uint8_t request,
 		    uint16_t len, uint32_t value);
@@ -240,7 +243,7 @@
 	struct usb_attach_arg *uaa = device_get_ivars(dev);
 	struct umct_softc *sc = device_get_softc(dev);
 	int32_t error;
-	//uint16_t maxp;
+	uint16_t maxp;
 	uint8_t iface_index;

 	sc->sc_udev = uaa->device;
@@ -263,13 +266,13 @@
 		    "transfers failed!\n");
 		goto detach;
 	}
+
 	/*
 	 * The real bulk-in endpoint is also marked as an interrupt.
 	 * The only way to differentiate it from the real interrupt
 	 * endpoint is to look at the wMaxPacketSize field.
 	 */
-#ifdef XXX
-	maxp = UGETW(sc->sc_xfer[UMCT_BULK_DT_RD]->endpoint->edesc->wMaxPacketSize);
+	maxp = usbd_xfer_max_framelen(sc->sc_xfer[UMCT_BULK_DT_RD]);
 	if (maxp == 0x2) {

 		/* guessed wrong - switch around endpoints */
@@ -278,11 +281,9 @@

 		sc->sc_xfer[UMCT_INTR_DT_RD] = sc->sc_xfer[UMCT_BULK_DT_RD];
 		sc->sc_xfer[UMCT_BULK_DT_RD] = temp;
-
-		sc->sc_xfer[UMCT_BULK_DT_RD]->callback = &umct_read_callback;
-		sc->sc_xfer[UMCT_INTR_DT_RD]->callback = &umct_intr_callback;
-	}
-#endif
+		sc->sc_swap_cb = 1;
+	}
+
 	sc->sc_obufsize = usbd_xfer_max_len(sc->sc_xfer[UMCT_BULK_DT_WR]);

 	if (uaa->info.idProduct == USB_PRODUCT_MCT_SITECOM_USB232) {
@@ -342,7 +343,7 @@
 }

 static void
-umct_intr_callback(struct usb_xfer *xfer, usb_error_t error)
+umct_intr_callback_sub(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct umct_softc *sc = usbd_xfer_softc(xfer);
 	struct usb_page_cache *pc;
@@ -547,6 +548,28 @@
 }

 static void
+umct_read_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+	struct umct_softc *sc = usbd_xfer_softc(xfer);
+
+	if (sc->sc_swap_cb)
+		umct_intr_callback_sub(xfer, error);
+	else
+		umct_read_callback_sub(xfer, error);
+}
+
+static void
+umct_intr_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+	struct umct_softc *sc = usbd_xfer_softc(xfer);
+
+	if (sc->sc_swap_cb)
+		umct_read_callback_sub(xfer, error);
+	else
+		umct_intr_callback_sub(xfer, error);
+}
+
+static void
 umct_write_callback(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct umct_softc *sc = usbd_xfer_softc(xfer);
@@ -577,7 +600,7 @@
 }

 static void
-umct_read_callback(struct usb_xfer *xfer, usb_error_t error)
+umct_read_callback_sub(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct umct_softc *sc = usbd_xfer_softc(xfer);
 	struct usb_page_cache *pc;


mail_cache_lock() crashed if index wasn't locked while it was called.

--- src/lib-index/mail-cache.c
+++ src/lib-index/mail-cache.c
@@ -265,17 +265,23 @@

 int mail_cache_lock(struct mail_cache *cache)
 {
+	unsigned int lock_id;
 	int i, ret;

 	i_assert(!cache->locked);

 	if (MAIL_CACHE_IS_UNUSABLE(cache))
 		return 0;
+
+	if (mail_index_lock_shared(cache->index, TRUE, &lock_id) < 0)
+		return -1;

 	if (cache->hdr->file_seq != cache->index->hdr->cache_file_seq) {
 		/* we want the latest cache file */
-		if ((ret = mail_cache_reopen(cache)) <= 0)
+		if ((ret = mail_cache_reopen(cache)) <= 0) {
+			mail_index_unlock(cache->index, lock_id);
 			return ret;
+		}
 	}

 	for (i = 0; i < 3; i++) {
@@ -293,13 +299,14 @@
 		/* okay, so it was just compressed. try again. */
 		mail_cache_unlock(cache);
 		if ((ret = mail_cache_reopen(cache)) <= 0)
-			return ret;
+			break;
 		ret = 0;
 	}

 	if (ret > 0)
 		cache->hdr_copy = *cache->hdr;

+	mail_index_unlock(cache->index, lock_id);
 	return ret;
 }


 - Assert that the lowervp is locked in null_hashget().
 - Simplify the logic dealing with recycled vnodes in null_hashget() and
   null_hashins().  Since we hold the lower node locked in both cases
   the null node can not be undergoing recycling unless reclaim somehow
   called null_nodeget().  The logic that was in place was not safe and
   was essentially dead code.

MFC After:	1 week


header fix

header fix

--HG--
branch : HEAD

--- src/lib-index/mail-cache.c
+++ src/lib-index/mail-cache.c
@@ -787,6 +787,7 @@

 	/* headers could have changed, reread them */
 	memset(cache->split_offsets, 0, sizeof(cache->split_offsets));
+	memset(cache->split_headers, 0, sizeof(cache->split_headers));

 	if (ret) {
 		cache->index->header->flags &=
@@ -1363,7 +1364,7 @@
 {
 	struct mail_cache *cache = ctx->cache;
 	uint32_t offset, update_offset, size;
-	const char *header_str;
+	const char *header_str, *prev_str;

 	i_assert(*headers != NULL);
 	i_assert(idx < MAIL_CACHE_HEADERS_COUNT);
@@ -1373,9 +1374,13 @@
 	t_push();

 	header_str = write_header_string(headers, &size);
-	i_assert(idx == 0 ||
-		 strcmp(mail_cache_get_header_fields_str(cache, idx-1),
-			header_str) != 0);
+	if (idx != 0) {
+		prev_str = mail_cache_get_header_fields_str(cache, idx-1);
+		if (prev_str == NULL)
+			return FALSE;
+
+		i_assert(strcmp(header_str, prev_str) != 0);
+	}

 	offset = mail_cache_append_space(ctx, size + sizeof(uint32_t));
 	if (offset != 0) {


* Add some KTR messages for IPIs. * Don't call ast() from interrupt() - if we switch, then we will miss   writing cr.eoi which will prevent the current cpu from receiving   interrupts until the current thread is resumed. The call to ast()   happens magically in exception_restore where it is safe. * Add DDB 'show irq' command to examine interrupt hardware state.

--- sys/ia64/ia64/interrupt.c
+++ sys/ia64/ia64/interrupt.c
@@ -56,6 +56,7 @@
 #include <machine/frame.h>
 #include <machine/intr.h>
 #include <machine/sapicvar.h>
+#include <machine/smp.h>

 #ifdef EVCNT_COUNTERS
 struct evcnt clock_intr_evcnt;	/* event counter for clock intrs. */
@@ -69,7 +70,6 @@
 #endif

 #ifdef SMP
-extern int mp_ipi_vector[];		/* XXX */
 extern int mp_ipi_test;
 #endif

@@ -123,13 +123,14 @@
 		critical_exit();
 #ifdef SMP
 	} else if (vector == mp_ipi_vector[IPI_AST]) {
-		if ((framep->tf_cr_ipsr & IA64_PSR_CPL) == IA64_PSR_CPL_USER)
-			ast(framep);
+		CTR1(KTR_SMP, "IPI_AST, cpuid=%d", PCPU_GET(cpuid));
 	} else if (vector == mp_ipi_vector[IPI_RENDEZVOUS]) {
+		CTR1(KTR_SMP, "IPI_RENDEZVOUS, cpuid=%d", PCPU_GET(cpuid));
 		smp_rendezvous_action();
 	} else if (vector == mp_ipi_vector[IPI_STOP]) {
 		u_int32_t mybit = PCPU_GET(cpumask);

+		CTR1(KTR_SMP, "IPI_STOP, cpuid=%d", PCPU_GET(cpuid));
 		savectx(PCPU_GET(pcb));
 		stopped_cpus |= mybit;
 		while ((started_cpus & mybit) == 0)
@@ -142,6 +143,7 @@
 			(*f)();
 		}
 	} else if (vector == mp_ipi_vector[IPI_TEST]) {
+		CTR1(KTR_SMP, "IPI_TEST, cpuid=%d", PCPU_GET(cpuid));
 		mp_ipi_test++;
 #endif
 	} else
@@ -331,3 +333,33 @@
 	KASSERT(error == 0, ("got an impossible stray interrupt"));
 }

+#ifdef DDB
+
+static void
+db_show_vector(int vector)
+{
+	int irq, i;
+
+	irq = vector - IA64_HARDWARE_IRQ_BASE;
+	for (i = 0; i < ia64_sapic_count; i++) {
+		struct sapic *sa = ia64_sapics[i];
+		if (irq >= sa->sa_base && irq <= sa->sa_limit)
+			sapic_print(sa, irq - sa->sa_base);
+	}
+}
+
+DB_SHOW_COMMAND(irq, db_show_irq)
+{
+	int vector;
+
+	if (have_addr) {
+		vector = ((addr >> 4) % 16) * 10 + (addr % 16);
+		db_show_vector(vector);
+	} else {
+		for (vector = IA64_HARDWARE_IRQ_BASE;
+		     vector < IA64_HARDWARE_IRQ_BASE + 64; vector++)
+			db_show_vector(vector);
+	}
+}
+
+#endif


FT81X_LIB Image Manager: Added some helper macros for generating display list commands.

--- common/libs/ft81x_lib/include/ft81x_image_manager.h
+++ common/libs/ft81x_lib/include/ft81x_image_manager.h
@@ -34,6 +34,51 @@
     uint32_t    lut_load_offset;    // offset of LUT in g_ram (if format is paletted)
 } FT81X_Image_Handle;

+// ----------------------------------------------------------------------------
+// Helper macros
+// ----------------------------------------------------------------------------
+#define FT81X_IMAGE_MANAGER_DL_INIT_IMAGE(image_properties, image_handle, filter, wrapx, wrapy)                         \
+    FT81X_DL_CMD_BITMAP_HANDLE((image_handle).bitmap_handle),                                                           \
+    FT81X_DL_CMD_BITMAP_LAYOUT((image_properties).format, (image_properties).linestride, (image_properties).height),    \
+    FT81X_DL_CMD_BITMAP_SIZE((filter), (wrapx), (wrapy), (image_properties).width, (image_properties).height),          \
+    FT81X_DL_CMD_BITMAP_SOURCE((image_handle).load_offset)
+
+
+#define FT81X_IMAGE_MANAGER_DL_DRAW_NON_PALETTED_IMAGE(image_handle, x, y)  \
+    FT81X_DL_CMD_BEGIN(FT81X_PRIMITIVE_BITMAP),                             \
+        FT81X_DL_CMD_VERTEX2II((x), (y), (image_handle).bitmap_handle, 0),  \
+    FT81X_DL_CMD_END()
+
+#define FT81X_IMAGE_MANAGER_DL_DRAW_PALETTED_IMAGE(image_handle, x, y)                              \
+    FT81X_DL_CMD_BEGIN((FT81X_PRIMITIVE_BITMAP)),                                                   \
+        /* save the context so we can restore it afterwards */                                      \
+        FT81X_DL_CMD_SAVE_CONTEXT(),                                                                \
+                                                                                \
+        /* alpha */                                                                                \
+        FT81X_DL_CMD_BLEND_FUNC(FT81X_BLEND_FUNC_ONE, FT81X_BLEND_FUNC_ZERO),                       \
+        FT81X_DL_CMD_COLOUR_MASK(0, 0, 0, 1),                                                       \
+        FT81X_DL_CMD_PALETTE_SOURCE((image_handle).lut_load_offset+3),                              \
+        FT81X_DL_CMD_VERTEX2II((x), (y), (image_handle).bitmap_handle, 0),                          \
+                                                                                \
+        /* colours */                                                                               \
+        FT81X_DL_CMD_BLEND_FUNC(FT81X_BLEND_FUNC_DST_ALPHA, FT81X_BLEND_FUNC_ONE_MINUS_DST_ALPHA),  \
+        /* red */                                                                                \
+        FT81X_DL_CMD_COLOUR_MASK(1, 0, 0, 0),                                                       \
+        FT81X_DL_CMD_PALETTE_SOURCE((image_handle).lut_load_offset+2),                              \
+        FT81X_DL_CMD_VERTEX2II((x), (y), (image_handle).bitmap_handle, 0),                          \
+        /* green */                                                                                \
+        FT81X_DL_CMD_COLOUR_MASK(0, 1, 0, 0),                                                       \
+        FT81X_DL_CMD_PALETTE_SOURCE((image_handle).lut_load_offset+1),                              \
+        FT81X_DL_CMD_VERTEX2II((x), (y), (image_handle).bitmap_handle, 0),                          \
+        /* blue */                                                                                \
+        FT81X_DL_CMD_COLOUR_MASK(0, 0, 1, 0),                                                       \
+        FT81X_DL_CMD_PALETTE_SOURCE((image_handle).lut_load_offset+0),                              \
+        FT81X_DL_CMD_VERTEX2II((x), (y), (image_handle).bitmap_handle, 0),                          \
+                                                                                \
+        /* revert the changes to colour mask and blend func */                                      \
+        FT81X_DL_CMD_RESTORE_CONTEXT(),                                                             \
+    FT81X_DL_CMD_END()
+
 // forward declarations for ft81x.h
 enum _ft81x_result;
 typedef enum _ft81x_result ft81x_result;


Bug20060827-1 참고

Bug20060827-1 참고


minor fixes

minor fixes

--- src/lib-index/mail-index.c
+++ src/lib-index/mail-index.c
@@ -212,7 +212,7 @@

 	for (i = 0; i < sizeof(fsync_fds)/sizeof(fsync_fds[0]); i++) {
 		if (fsync_fds[i] != -1 && fdatasync(fsync_fds[i]) < 0)
-			index_set_error(index, "fdatasync(%d) failed: %m", i);
+			index_set_error(index, "fdatasync(%u) failed: %m", i);
 	}

 	if (fsync(index->fd) < 0)
@@ -229,7 +229,7 @@
 		if (msync(index->mmap_base, size, MS_SYNC) < 0)
 			return index_set_syscall_error(index, "msync()");
 		if (fdatasync(index->fd) < 0)
-			return index_set_syscall_error(index, "fsync()");
+			return index_set_syscall_error(index, "fdatasync()");
 	}

 	return TRUE;


Fix a bug where the length of a FORWARD-TSN chunk was set incorrectly in
the chunk. This resulted in malformed frames.
Remove a duplicate assignment.

MFC after: 2 weeks

--- sys/netinet/sctp_output.c
+++ sys/netinet/sctp_output.c
@@ -2270,7 +2270,6 @@
     sa_family_t fam)
 {
 	uint8_t dest_is_global = 0;
-

 	/*
 	 * Here we determine if its a acceptable address. A acceptable
@@ -9800,7 +9799,8 @@
 			 * peer ack point
 			 */
 			advance_peer_ack_point = last->rec.data.TSN_seq;
-			space_needed -= (cnt_of_skipped * sizeof(struct sctp_strseq));
+			space_needed = sizeof(struct sctp_forward_tsn_chunk) +
+			    cnt_of_skipped * sizeof(struct sctp_strseq);
 		}
 		chk->send_size = space_needed;
 		/* Setup the chunk */
@@ -9809,8 +9809,6 @@
 		fwdtsn->ch.chunk_flags = 0;
 		fwdtsn->ch.chunk_type = SCTP_FORWARD_CUM_TSN;
 		fwdtsn->new_cumulative_tsn = htonl(advance_peer_ack_point);
-		chk->send_size = (sizeof(struct sctp_forward_tsn_chunk) +
-		    (cnt_of_skipped * sizeof(struct sctp_strseq)));
 		SCTP_BUF_LEN(chk->data) = chk->send_size;
 		fwdtsn++;
 		/*-


Another attempt to fix compiler problems. There's still an issue with cross references.

--- xml_extract.h
+++ xml_extract.h
@@ -1487,7 +1487,7 @@
 bhkRefObject::FixLinks( objects, link_stack, version ); \

 #define ABHK_CONSTRAINT_MEMBERS \
-vector<* > bodies; \
+vector<bhkShape * > bodies; \
 uint priority; \

 #define ABHK_CONSTRAINT_INCLUDE "bhkSerializable.h" \
@@ -1532,7 +1532,7 @@
 #define ABHK_CONSTRAINT_FIXLINKS \
 bhkSerializable::FixLinks( objects, link_stack, version ); \
 for (uint i0 = 0; i0 < numBodies; i0++) { \
-  bodies[i0] = DynamicCast<>(objects[link_stack.front()]); \
+  bodies[i0] = DynamicCast<bhkShape>(objects[link_stack.front()]); \
   link_stack.pop_front(); \
 }; \


Use unique callout in IntermudD

Use unique callout in IntermudD


mail_index_chown(): Check for fchown() failing with EPERM, not EACCES.

--- src/lib-index/mail-index.c
+++ src/lib-index/mail-index.c
@@ -751,7 +751,7 @@
 		   really matter. ignore silently. */
 		return;
 	}
-	if (errno != EACCES)
+	if (errno != EPERM)
 		mail_index_file_set_syscall_error(index, path, "fchown()");
 	else {
 		mail_index_set_error(index, "%s",


fix documentation

fix documentation

--- php_midgard_query_constraints.c
+++ php_midgard_query_constraints.c
@@ -343,7 +343,7 @@

 	php_midgard_query_constraint_class = zend_register_internal_class_ex(&php_midgard_query_constraint_class_entry, php_midgard_query_constraint_simple_class, "midgard_query_constraint_simple" TSRMLS_CC);
 	php_midgard_query_constraint_class->create_object = php_midgard_gobject_new;
-	php_midgard_query_constraint_class->doc_comment = strdup("Class for holding data-atom in midgard_query");
+	php_midgard_query_constraint_class->doc_comment = strdup("Class for holding simple constraint in midgard_query");

 	static function_entry midgard_query_constraint_group_methods[] = {


Cut-n-paste coding benefits - return was bad idea after this was refactored to it's own function a bit ago. Replaced with continue. (Effectively broke whole _update_a_local_links).

--- src/hncp_pa.c
+++ src/hncp_pa.c
@@ -6,8 +6,8 @@
  * Copyright (c) 2013 cisco Systems, Inc.
  *
  * Created:       Wed Dec  4 12:32:50 2013 mstenber
- * Last modified: Wed Apr  9 18:46:21 2014 mstenber
- * Edit time:     382 min
+ * Last modified: Wed Apr  9 19:03:00 2014 mstenber
+ * Edit time:     389 min
  *
  */

@@ -326,7 +326,7 @@
       hncp_node_for_each_tlv(n, a)
         {
           if (!(ah = hncp_tlv_ap(a)))
-            return;
+            continue;
           memset(&p, 0, sizeof(p));
           p.plen = ah->prefix_length_bits;
           int plen = ROUND_BITS_TO_BYTES(p.plen);
@@ -334,7 +334,10 @@
           l = _find_local_link(n, ah->link_id);
           struct pa_ap *ap = pa_ap_get(g->pa_data, &p, (struct pa_rid *)&n->node_identifier_hash, false);
           if (!ap)
-            continue;
+            {
+              L_DEBUG(" unable to find AP for %s", PREFIX_REPR(&p));
+              continue;
+            }
           struct pa_iface *iface = NULL;
           if (l)
             iface = pa_iface_get(g->pa_data, l->ifname, true);


KVM: s390: Simplify online vcpus counting for stsi

We don't need to loop over all cpus to get the number of
vcpus. Let's use the available counter online_vcpus instead.

Signed-off-by: Jens Freimann <2fb3f62a871452862a8fef4a376310c98ece9044@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <49712f635b03c16d7f4c43df70e49ec8c565813d@de.ibm.com>

--- arch/s390/kvm/priv.c
+++ arch/s390/kvm/priv.c
@@ -396,15 +396,10 @@

 static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem)
 {
-	struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
 	int cpus = 0;
 	int n;

-	spin_lock(&fi->lock);
-	for (n = 0; n < KVM_MAX_VCPUS; n++)
-		if (fi->local_int[n])
-			cpus++;
-	spin_unlock(&fi->lock);
+	cpus = atomic_read(&vcpu->kvm->online_vcpus);

 	/* deal with other level 3 hypervisors */
 	if (stsi(mem, 3, 2, 2))


another small bit for rsb refcounts

another small bit for rsb refcounts

--- dlm-kernel/src2/lock.c
+++ dlm-kernel/src2/lock.c
@@ -236,13 +236,6 @@
 	kref_get(&r->res_ref);
 }

-/* See comment on unhold_lkb. */
-
-void unhold_rsb(struct dlm_rsb *r)
-{
-	DLM_ASSERT(!kref_put(&r->res_ref, toss_rsb),);
-}
-
 void toss_rsb(struct kref *kref)
 {
 	struct dlm_rsb *r = container_of(kref, struct dlm_rsb, res_ref);
@@ -317,6 +310,8 @@
 	DLM_ASSERT(!lkb->lkb_status,);

 	list_del(&lkb->lkb_idtbl_list);
+
+	detach_lkb(lkb);

 	/* for local/process lkbs, lvbptr points to the caller's lksb */
 	if (lkb->lkb_lvbptr && is_master_copy(lkb))
@@ -390,7 +385,6 @@
 void add_lkb(struct dlm_rsb *r, struct dlm_lkb *lkb, int sts)
 {
 	kref_get(&lkb->lkb_ref);
-	hold_rsb(r);

 	DLM_ASSERT(!lkb->lkb_status,);

@@ -427,7 +421,23 @@
 	lkb->lkb_status = 0;
 	list_del(&lkb->lkb_statequeue);
 	unhold_lkb(lkb);
-	unhold_rsb(r);
+}
+
+/* Attaching/detaching lkb's from rsb's is for rsb reference counting.
+   The rsb must exist as long as any lkb's for it do. */
+
+void attach_lkb(struct dlm_rsb *r, struct dlm_lkb *lkb)
+{
+	hold_rsb(r);
+	lkb->lkb_resource = r;
+}
+
+void detach_lkb(struct dlm_lkb *lkb)
+{
+	if (lkb->lkb_resource) {
+		put_rsb(lkb->lkb_resource);
+		lkb->lkb_resource = NULL;
+	}
 }

 void add_ast_list(struct dlm_lkb *lkb, int type)
@@ -915,7 +925,7 @@

 	lock_rsb(r);

-	lkb->lkb_resource = r;
+	attach_lkb(r, lkb);
 	error = _request_lock(r, lkb);

 	unlock_rsb(r);
@@ -1886,7 +1896,7 @@

 	lock_rsb(r);

-	lkb->lkb_resource = r;
+	attach_lkb(r, lkb);
 	error = do_request(r, lkb);
 	send_request_reply(r, lkb, error);


ASoC: arizona: Add more clock rates

ASoC: arizona: Add more clock rates

Some devices support additional clock rates.

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>


6897978 zfs send should ignore unknown properties 6897980 zdb doesn't display correct name for TX_{CREATE,MKDIR}_ATTR 6897982 zfs_replay_create() needlessly sets 'name' for TX_MKXATTR 6897984 zdb shouldn't bother displaying name for TX_MKXATTR records

--- zfs_replay.c
+++ zfs_replay.c
@@ -498,7 +498,6 @@
 		    &vp, kcred, NULL, vflg, NULL);
 		break;
 	case TX_MKXATTR:
-		name = (char *)(lr + 1);
 		error = zfs_make_xattrdir(dzp, &xva.xva_vattr, &vp, kcred);
 		break;
 	case TX_SYMLINK:


MFC r197868. Use correct arguments when calling SCTP_RTALLOC(). Approved by: re, rrs (mentor)

--- sys/netinet/sctp_output.c
+++ sys/netinet/sctp_output.c
@@ -3570,7 +3570,7 @@
 				sctp_free_ifa(_lsrc);
 			} else {
 				ip->ip_src = over_addr->sin.sin_addr;
-				SCTP_RTALLOC((&ro->ro_rt), vrf_id);
+				SCTP_RTALLOC(ro, vrf_id);
 			}
 		}
 		if (port) {
@@ -3924,7 +3924,7 @@
 				sctp_free_ifa(_lsrc);
 			} else {
 				lsa6->sin6_addr = over_addr->sin6.sin6_addr;
-				SCTP_RTALLOC((&ro->ro_rt), vrf_id);
+				SCTP_RTALLOC(ro, vrf_id);
 			}
 			(void)sa6_recoverscope(sin6);
 		}


lib-index: MAIL_INDEX_SYNC_FLAG_DELETING_INDEX comment updated

--- src/lib-index/mail-index.h
+++ src/lib-index/mail-index.h
@@ -143,7 +143,8 @@
 	MAIL_INDEX_SYNC_FLAG_REQUIRE_CHANGES	= 0x08,
 	/* Create the transaction with FSYNC flag */
 	MAIL_INDEX_SYNC_FLAG_FSYNC		= 0x10,
-	/* If we see "delete index" request transaction, finish it */
+	/* If we see "delete index" request transaction, finish it.
+	   This flag also allows commiting more changes to a deleted index. */
 	MAIL_INDEX_SYNC_FLAG_DELETING_INDEX	= 0x20
 };


Remove programd defrag for now, it's only housekeeping

--- mudlib/mud/home/System/sys/programd.c
+++ mudlib/mud/home/System/sys/programd.c
@@ -145,14 +145,6 @@
 	}

 	bigready = 1;
-	call_out("defragment", 5);
-}
-
-static void defragment()
-{
-	call_out("defragment", 3600 + random(1800));
-
-	progdb->reindex();
 }

 private void deindex_inherits(int oindex, int *inh)


multiple minima handling in morse functions

--- cgogn/topology/algos/distance_field.h
+++ cgogn/topology/algos/distance_field.h
@@ -187,16 +187,18 @@
 	/**
 	 * Compute a morse function from a scalar field.
 	 * The morse function has disctinct values in each vertex.
-	 * Its maxima are the same than those of the scalar field and has only one minima.
-	 * The morse function regularize the critical points of the scalar field.
-	 * @param[in] source the vertex that minimize the scalar field
+	 * Its maxima are the same than those of the scalar field.
+	 * Its minima are given.
+	 * The morse function regularizes the other critical points of the scalar field.
+	 * @param[in] minima the vertices that minimize the scalar field
 	 * @param[in] scalar_field : the scalar field
 	 * @param[out] morse_function : the values of the morse function
 	 * The algorithm makes a dijkstra flood of the graph using the scalar field values
-	 * in place of the shortest path distance computed in dijkstra_compute_distances()
+	 * in place of the shortest path distance computed in dijkstra_compute_distances().
+	 * The vertices are traversed in increasing value of their scalar field.
 	 */
 	void dijkstra_to_morse_function(
-			Vertex source,
+			std::vector<Vertex> minima,
 			const VertexAttribute<Scalar>& scalar_field,
 			VertexAttribute<Scalar>& morse_function)
 	{
@@ -208,7 +210,8 @@

 		my_queue vertex_queue;

-		vertex_queue.push(std::make_pair(Scalar(0), source.dart.index));
+		for (auto source : minima)
+			vertex_queue.push(std::make_pair(Scalar(0), source.dart.index));

 		// Run dijkstra using distance_to_source in place of the estimated geodesic distances
 		// and fill the morse function with i/n where i is index of distance_to_source
@@ -337,17 +340,27 @@
 	 */
 	void morse_distance_to_boundary(VertexAttribute<Scalar>& morse_function)
 	{
-		VertexAttribute<Scalar> scalar_field =
-				map_.template add_attribute<Scalar, Vertex::ORBIT>("__scalar_field__");
-
-		// Compute the shortest paths to sources
-		distance_to_boundary(scalar_field);
-
-		// Search for the vertices that minimize the distance to the sources
-		Vertex min_vertex = find_minimum(scalar_field);
-
-		dijkstra_to_morse_function(min_vertex, scalar_field, morse_function);
-		map_.remove_attribute(scalar_field);
+		VertexAttribute<Scalar> distance_to_boundary =
+				map_.template add_attribute<Scalar, Vertex::ORBIT>("__distance_to_boundary__");
+
+		std::vector<Vertex> boundary_vertices;
+
+		map_.foreach_cell([&](Vertex v)
+		{
+			if (map_.is_incident_to_boundary(v))
+				boundary_vertices.push_back(v);
+		});
+
+		if (boundary_vertices.size() == 0u)
+		{
+			cgogn_log_error("distance_to_boundary") << "No boundary found";
+			return;
+		}
+
+		dijkstra_compute_distances(boundary_vertices, distance_to_boundary);
+
+		dijkstra_to_morse_function(boundary_vertices, distance_to_boundary, morse_function);
+		map_.remove_attribute(distance_to_boundary);
 	}

 	/**
@@ -360,22 +373,22 @@
 	void morse_distance_to_features(const std::vector<Vertex>& features,
 									VertexAttribute<Scalar>& morse_function)
 	{
-		VertexAttribute<Scalar> scalar_field =
-				map_.template add_attribute<Scalar, Vertex::ORBIT>("__scalar_field__");
+		VertexAttribute<Scalar> distance_to_features =
+				map_.template add_attribute<Scalar, Vertex::ORBIT>("__distance_to_features__");

 		// Compute the shortest paths to sources
-		dijkstra_compute_distances(features, scalar_field);
+		dijkstra_compute_distances(features, distance_to_features);

 		// Search for the vertices that maximize the distance to the sources
-		Vertex max_vertex = find_maximum(scalar_field);
-		Scalar max_distance = scalar_field[max_vertex];
-
-		// Inverse the distances so that the maxima are on the sources
-		for (auto& d : scalar_field)
+		Vertex max_vertex = find_maximum(distance_to_features);
+		Scalar max_distance = distance_to_features[max_vertex];
+
+		// Inverse the distances so that the maxima are on the features
+		for (auto& d : distance_to_features)
 			d = max_distance - d;

-		dijkstra_to_morse_function(max_vertex, scalar_field, morse_function);
-		map_.remove_attribute(scalar_field);
+		dijkstra_to_morse_function({max_vertex}, distance_to_features, morse_function);
+		map_.remove_attribute(distance_to_features);
 	}

 private:


sh: Populate initial secondary CPU info from boot_cpu_data.

The secondary CPU info was seeing corrupted results due to not entering
all of the setup paths taken by the boot CPU. So we just memcpy() the
boot cpu data over directly, and then fix up the per-CPU bits.

Signed-off-by: Paul Mundt <38b52dbb5f0b63d149982b6c5de788ec93a89032@linux-sh.org>

--- arch/sh/kernel/smp.c
+++ arch/sh/kernel/smp.c
@@ -35,6 +35,8 @@
 {
 	struct sh_cpuinfo *c = cpu_data + cpu;

+	memcpy(c, &boot_cpu_data, sizeof(struct sh_cpuinfo));
+
 	c->loops_per_jiffy = loops_per_jiffy;
 }


fake http_open had bad definition

fake http_open had bad definition

git-svn-id: 793bb72743a407948e3701719c462b6a765bc435@506 35dc7657-300d-0410-a2e5-dc2837fedb53

--- src/httpget.c
+++ src/httpget.c
@@ -700,7 +700,7 @@

 #define ACCEPT_HEAD "Accept: audio/mpeg, audio/x-mpegurl, */*\r\n"

-int http_open (char *url)
+int http_open (char* url, char** content_type)
 {
 }
 #endif


ASoC: sti-sas: Fix checking return value for ERR_PTR

Both devm_regmap_init and syscon_regmap_lookup_by_phandle return ERR_PTR
on failure.

Signed-off-by: Axel Lin <b6ffd6973e972cb999e8e535ab74da7fee0c035f@ingics.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>


Make clang happy about missing format string

--- pkg/convert.c
+++ pkg/convert.c
@@ -67,7 +67,7 @@
 	struct sbuf *deinstall_script = sbuf_new_auto();

 	if (mkdir(pkg_add_dbdir, 0755) != 0 && errno != EEXIST)
-		err(EX_CANTCREAT, pkg_add_dbdir);
+		err(EX_CANTCREAT, "%s", pkg_add_dbdir);

 	if (pkgdb_open(&db, PKGDB_DEFAULT) != EPKG_OK) {
 		pkgdb_close(db);
@@ -233,7 +233,7 @@
 	struct pkgdb *db = NULL;

 	if ((d = opendir(pkg_add_dbdir)) == NULL)
-		err(EX_NOINPUT, pkg_add_dbdir);
+		err(EX_NOINPUT, "%s", pkg_add_dbdir);

 	if (pkgdb_open(&db, PKGDB_DEFAULT) != EPKG_OK) {
 		return (EX_IOERR);


format

format

--- src/backend/concurrency/speculative_read_txn_manager.h
+++ src/backend/concurrency/speculative_read_txn_manager.h
@@ -19,7 +19,11 @@
 namespace concurrency {

 struct SpecTxnContext {
-  SpecTxnContext() : begin_cid_(MAX_CID), inner_dep_set_changeable_(true), outer_dep_count_(0), is_cascading_abort_(false) {}
+  SpecTxnContext()
+      : begin_cid_(MAX_CID),
+        inner_dep_set_changeable_(true),
+        outer_dep_count_(0),
+        is_cascading_abort_(false) {}

   void SetBeginCid(const cid_t &begin_cid) {
     assert(begin_cid_ == MAX_CID);
@@ -39,10 +43,10 @@
   }

   cid_t begin_cid_;
-
+
   // outer_dep_set is thread_local, and is safe to modify it.
   std::unordered_set<txn_id_t> outer_dep_set_;
-
+
   // inner_dep_set is modified by other transactions. so lock is required.
   Spinlock inner_dep_set_lock_;
   std::unordered_set<txn_id_t> inner_dep_set_;
@@ -102,7 +106,7 @@
     Transaction *txn = new Transaction(txn_id, begin_cid);
     current_txn = txn;
     spec_txn_context.SetBeginCid(begin_cid);
-
+
     cid_t bucket_id = txn_id % RUNNING_TXN_BUCKET_NUM;
     assert(running_txn_buckets_[bucket_id].contains(txn_id) == false);
     running_txn_buckets_[bucket_id][txn_id] = &spec_txn_context;
@@ -150,27 +154,30 @@
     }

     bool changeable = true;
-    bool ret = running_txn_buckets_[dst_txn_id % RUNNING_TXN_BUCKET_NUM].update_fn(dst_txn_id, [&changeable, &src_txn_id](SpecTxnContext *context){
+    bool ret =
+        running_txn_buckets_[dst_txn_id % RUNNING_TXN_BUCKET_NUM].update_fn(
+            dst_txn_id, [&changeable, &src_txn_id](SpecTxnContext * context) {
       context->inner_dep_set_lock_.Lock();
       if (context->inner_dep_set_changeable_ == true) {
-        assert(context->inner_dep_set_.find(src_txn_id) == context->inner_dep_set_.end());
+        assert(context->inner_dep_set_.find(src_txn_id) ==
+               context->inner_dep_set_.end());
         context->inner_dep_set_.insert(src_txn_id);
       } else {
         changeable = false;
       }
       context->inner_dep_set_lock_.Unlock();
     });
-
-	  if (changeable == false || ret == false) {
-		  return false;
-	  }
+
+    if (changeable == false || ret == false) {
+      return false;
+    }
     spec_txn_context.outer_dep_set_.insert(dst_txn_id);
     spec_txn_context.outer_dep_count_++;
     return true;
   }

   bool IsCommittable() {
-	  while (true) {
+    while (true) {
       if (spec_txn_context.outer_dep_count_ == 0) {
         return true;
       }
@@ -188,7 +195,8 @@
     {
       spec_txn_context.inner_dep_set_lock_.Lock();
       for (auto &child_txn_id : spec_txn_context.inner_dep_set_) {
-        running_txn_buckets_[child_txn_id % RUNNING_TXN_BUCKET_NUM].update_fn(child_txn_id, [](SpecTxnContext *context){
+        running_txn_buckets_[child_txn_id % RUNNING_TXN_BUCKET_NUM]
+            .update_fn(child_txn_id, [](SpecTxnContext * context) {
           assert(context->outer_dep_count_ > 0);
           context->outer_dep_count_--;
         });
@@ -202,10 +210,10 @@
     // some other transactions may also modify my inner dep set.
     // so lock first.
     {
-      //auto iter = spec_txn_context.inner_dep_set_.lock_table();
       spec_txn_context.inner_dep_set_lock_.Lock();
       for (auto &child_txn_id : spec_txn_context.inner_dep_set_) {
-        running_txn_buckets_[child_txn_id % RUNNING_TXN_BUCKET_NUM].update_fn(child_txn_id, [](SpecTxnContext *context){
+        running_txn_buckets_[child_txn_id % RUNNING_TXN_BUCKET_NUM]
+            .update_fn(child_txn_id, [](SpecTxnContext * context) {
           assert(context->outer_dep_count_ > 0);
           context->is_cascading_abort_ = true;
         });
@@ -221,7 +229,8 @@

  private:
   // records all running transactions.
-  cuckoohash_map<txn_id_t, SpecTxnContext *> running_txn_buckets_[RUNNING_TXN_BUCKET_NUM];
+  cuckoohash_map<txn_id_t, SpecTxnContext *>
+      running_txn_buckets_[RUNNING_TXN_BUCKET_NUM];
 };
 }
 }


clean up comments.

clean up comments.

--- drake/solvers/Optimization.h
+++ drake/solvers/Optimization.h
@@ -81,35 +81,12 @@
     return s;
   }

-  // Quick notes about this design:
-  // need to have lists of constraints (if not functions), so I want a (non-templated) base class.
-  // would be nice to have templated types for specialized functions.  Not strictly required.
-  // approach: let functions be templated, and use lambda closures/std::function to wrap them into the constraint classes.
-
-  /**
-   * @defgroup function_concept Function Concept
-   * @ingroup concepts
-   * @{
-   * @brief Describes a mapping from one Vector to another Vector y = f(x)
+
+  /* Constraint
+   * @brief A constraint is a function + lower and upper bounds, and (currently) an association to decision variables of an optimization problem.
    *
-   * @nbsp
-   *
-   * | Every model of this concept must implement |  |
-   * ---------------------|------------------------------------------------------------|
-   * | X::InputVector     | type for the input to the system, which models the Vector<ScalarType> concept |
-   * | X::OutputVector    | type for the output from the system, which models the Vector<ScalarType> concept |
-   * | template <ScalarType> OutputVector<ScalarType> operator()(const InputVector<ScalarType>& x) | the actual function |
-   * | InputOutputRelation getProperties() | |
-   * | size_t getNumInputs() | only required if the input vector is dynamically-sized |
-   * | size_t getNumOutputs() | only required if the output vector is dynamically-sized |
-   *
-   * (always try to label your methods with const if possible)
-   *
-   * @}
-   */
-
-  /*
-   * some thoughts: a constraint is a function + lower and upper bounds.  it should support evaluating the constraint, adding it to an optimization problem,
+   * Some thoughts:
+   * It should support evaluating the constraint, adding it to an optimization problem,
    * and have support for constraints that require slack variables (adding additional decision variables to the problem).  There
    * should also be some notion of parameterized constraints:  e.g. the acceleration constraints in the rigid body dynamics are constraints
    * on vdot and f, but are "parameterized" by q and v.


closer to standard {PKG}_OPTIONS.h file (but with AD_CONFIG.h); +fix some comments.

--- pkg/autodiff/AUTODIFF_OPTIONS.h
+++ pkg/autodiff/AUTODIFF_OPTIONS.h
@@ -2,24 +2,28 @@
 C $Name$

 CBOP
-C     !ROUTINE: AUTODIFF_CPPOPTIONS.h
-C     !INTERFACE:
-C     include "AUTODIFF_CPPOPTIONS.h "
-C     !DESCRIPTION:
-C     *==========================================================*
-C     | CPP_EEMACROS.h
-C     *==========================================================*
-C     CPP flags controlling which code is included in the files
-C     that will be compiled.
-C     These macros have been shifted to the common header file
-C     ECCO_CPPOPTIONS.h
+C !ROUTINE: AUTODIFF_OPTIONS.h
+C !INTERFACE:
+C #include "AUTODIFF_OPTIONS.h"
+
+C !DESCRIPTION:
+C *==================================================================*
+C | CPP options file for AUTODIFF package:
+C | Control which optional features to compile in this package code.
+C *==================================================================*
 CEOP

 #ifndef AUTODIFF_OPTIONS_H
 #define AUTODIFF_OPTIONS_H
-
 #include "PACKAGES_CONFIG.h"
 #include "AD_CONFIG.h"
+#ifdef ALLOW_AUTODIFF
+
 #include "CPP_OPTIONS.h"

-#endif /* AUTODIFF_CPPOPTIONS_H */
+C-- Package-specific options go here
+C   Note: most of these options have been shifted to the common header
+C         file ECCO_CPPOPTIONS.h
+
+#endif /* ALLOW_AUTODIFF */
+#endif /* AUTODIFF_OPTIONS_H */


MFC of  206151

MFC of  206151


lib-lda: Don't alow %variables for hostname setting after all. I was thinking maybe %d could be used there, but with LMTP the hostname is used already in the greeting message before any RCPT TO is even done.

--- src/lib-lda/lda-settings.c
+++ src/lib-lda/lda-settings.c
@@ -19,7 +19,7 @@

 static const struct setting_define lda_setting_defines[] = {
 	DEF(SET_STR_VARS, postmaster_address),
-	DEF(SET_STR_VARS, hostname),
+	DEF(SET_STR, hostname),
 	DEF(SET_STR_VARS, submission_host),
 	DEF(SET_STR_VARS, sendmail_path),
 	DEF(SET_STR, rejection_subject),


Fix documentation issues appear in Xcode9

--- Pod/Classes/BAFluidView.h
+++ Pod/Classes/BAFluidView.h
@@ -96,7 +96,7 @@

  @param aRect
  Frame for the fluid object to fill
- @param startElevation
+ @param aStartElevation
  The starting point of the fluid animation
  @return a fluid view object with the properties defined
  */
@@ -107,13 +107,13 @@

  @param aRect
  Frame for the fluid object to fill
- @param maxAmplitude
+ @param aMaxAmplitude
  Max wave crest
- @param minAmplitude
+ @param aMinAmplitude
  Min wave crest
- @param amplitudeIncrement
+ @param aAmplitudeIncrement
  Lets you chose the interval between Max and Min the random function will use
- @param startElevation
+ @param aStartElevation
  The starting point of the fluid animation
  @return a fluid view object with the properties defined
  */


[PATCH] Generic ioremap_page_range: sh conversion

Convert SH to use generic ioremap_page_range()

Signed-off-by: Haavard Skinnemoen <de7418319212d7eab32260a76732c1f83e514852@atmel.com>
Signed-off-by: Paul Mundt <38b52dbb5f0b63d149982b6c5de788ec93a89032@linux-sh.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- arch/sh/mm/ioremap.c
+++ arch/sh/mm/ioremap.c
@@ -16,96 +16,12 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/pci.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/addrspace.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-
-static inline void remap_area_pte(pte_t * pte, unsigned long address,
-	unsigned long size, unsigned long phys_addr, unsigned long flags)
-{
-	unsigned long end;
-	unsigned long pfn;
-	pgprot_t pgprot = __pgprot(pgprot_val(PAGE_KERNEL_NOCACHE) | flags);
-
-	address &= ~PMD_MASK;
-	end = address + size;
-	if (end > PMD_SIZE)
-		end = PMD_SIZE;
-	if (address >= end)
-		BUG();
-	pfn = phys_addr >> PAGE_SHIFT;
-	do {
-		if (!pte_none(*pte)) {
-			printk("remap_area_pte: page already exists\n");
-			BUG();
-		}
-		set_pte(pte, pfn_pte(pfn, pgprot));
-		address += PAGE_SIZE;
-		pfn++;
-		pte++;
-	} while (address && (address < end));
-}
-
-static inline int remap_area_pmd(pmd_t * pmd, unsigned long address,
-	unsigned long size, unsigned long phys_addr, unsigned long flags)
-{
-	unsigned long end;
-
-	address &= ~PGDIR_MASK;
-	end = address + size;
-	if (end > PGDIR_SIZE)
-		end = PGDIR_SIZE;
-	phys_addr -= address;
-	if (address >= end)
-		BUG();
-	do {
-		pte_t * pte = pte_alloc_kernel(pmd, address);
-		if (!pte)
-			return -ENOMEM;
-		remap_area_pte(pte, address, end - address, address + phys_addr, flags);
-		address = (address + PMD_SIZE) & PMD_MASK;
-		pmd++;
-	} while (address && (address < end));
-	return 0;
-}
-
-int remap_area_pages(unsigned long address, unsigned long phys_addr,
-		     unsigned long size, unsigned long flags)
-{
-	int error;
-	pgd_t * dir;
-	unsigned long end = address + size;
-
-	phys_addr -= address;
-	dir = pgd_offset_k(address);
-	flush_cache_all();
-	if (address >= end)
-		BUG();
-	do {
-		pud_t *pud;
-		pmd_t *pmd;
-
-		error = -ENOMEM;
-
-		pud = pud_alloc(&init_mm, dir, address);
-		if (!pud)
-			break;
-		pmd = pmd_alloc(&init_mm, pud, address);
-		if (!pmd)
-			break;
-		if (remap_area_pmd(pmd, address, end - address,
-					phys_addr + address, flags))
-			break;
-		error = 0;
-		address = (address + PGDIR_SIZE) & PGDIR_MASK;
-		dir++;
-	} while (address && (address < end));
-	flush_tlb_all();
-	return error;
-}

 /*
  * Remap an arbitrary physical address space into the kernel virtual
@@ -121,6 +37,7 @@
 {
 	struct vm_struct * area;
 	unsigned long offset, last_addr, addr, orig_addr;
+	pgprot_t pgprot;

 	/* Don't allow wraparound or zero size */
 	last_addr = phys_addr + size - 1;
@@ -190,8 +107,9 @@
 	}
 #endif

+	pgprot = __pgprot(pgprot_val(PAGE_KERNEL_NOCACHE) | flags);
 	if (likely(size))
-		if (remap_area_pages(addr, phys_addr, size, flags)) {
+		if (ioremap_page_range(addr, addr + size, phys_addr, pgprot)) {
 			vunmap((void *)orig_addr);
 			return NULL;
 		}


clean up tests

clean up tests


ASoC: twl6040: Correct supported number of playback channels

twl6040 supports 5 playback, and 2 capture channels

Signed-off-by: Peter Ujfalusi <e5c0b4cdf99ae1d408b9c497159e74b54e02e008@ti.com>
Acked-by: Liam Girdwood <a57ef363056e61beffa2efa59c68550d40db03b0@ti.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>


refactor extract distributed insert values rte (#3287)

--- src/backend/distributed/planner/multi_router_planner.c
+++ src/backend/distributed/planner/multi_router_planner.c
@@ -2642,7 +2642,6 @@
 ExtractDistributedInsertValuesRTE(Query *query)
 {
 	ListCell *rteCell = NULL;
-	RangeTblEntry *valuesRTE = NULL;

 	if (query->commandType != CMD_INSERT)
 	{
@@ -2655,12 +2654,10 @@

 		if (rte->rtekind == RTE_VALUES)
 		{
-			valuesRTE = rte;
-			break;
-		}
-	}
-
-	return valuesRTE;
+			return rte;
+		}
+	}
+	return NULL;
 }


better output for upgrade :)

better output for upgrade :)

--- pkg/upgrade.c
+++ pkg/upgrade.c
@@ -72,7 +72,16 @@
 	}

 	while ((retcode = pkgdb_it_next(it, &pkg, PKG_LOAD_BASIC|PKG_LOAD_NEWVERSION)) == EPKG_OK) {
-		printf("%s: %s -> %s\n", pkg_get(pkg, PKG_NAME), pkg_get(pkg, PKG_VERSION), pkg_get(pkg, PKG_NEWVERSION));
+		switch (pkg_version_cmp(pkg_get(pkg, PKG_VERSION), pkg_get(pkg, PKG_NEWVERSION))) {
+			case -1:
+				printf("%s: upgrade from %s to %s\n", pkg_get(pkg, PKG_NAME),
+						pkg_get(pkg, PKG_VERSION), pkg_get(pkg, PKG_NEWVERSION));
+				break;
+			case 1:
+				printf("%s: downgraded from %s to %s\n", pkg_get(pkg, PKG_NAME),
+						pkg_get(pkg, PKG_VERSION), pkg_get(pkg, PKG_NEWVERSION));
+				break;
+		}
 	}

 	cleanup:


Added some Doxygen comments to LinearSystem.h.

--- drake/systems/LinearSystem.h
+++ drake/systems/LinearSystem.h
@@ -5,14 +5,19 @@

 namespace drake {

-/** AffineSystem<StateVector, InputVector, OutputVector>
- * @brief Builds an affine system from its state-space matrix coefficients
+/**
+ * Builds an affine system from its state-space matrix coefficients *A*, *B*,
+ * *C*, and *D*. This is done by implementing the following equations:
+ *
+ * @f[
+ *   \dot{x} = Ax + Bu + \dot{x}_0 \\
+ *   y = Cx + Du + y_0
+ * @f]
+ *
+ * Where *x* is the system state, *u* is the system inputs, and *y* is the
+ * system output.
+ *
  * @concept{system_concept}
- *
- * Implements @f[
- *   \dot{x} = Ax + B*u + \dot{x}_0 \\
- *   y = Cx + Du + y_0
- *  @f]
  */

 template <template <typename> class StateVec,
@@ -27,6 +32,26 @@
   template <typename ScalarType>
   using InputVector = InputVec<ScalarType>;

+  /**
+   * A constructor that creates an Affine System based on its state-space matrix
+   * coefficients.
+   *
+   * @param[in] A The matrix coefficients of the system state *x* in the
+   * equation for the first derivative of the system's state *xdot*.
+   *
+   * @param[in] B The matrix coefficients of the system input *u* in the
+   * equation for the first derivative of the system's state *xdot*.
+   *
+   * @param[in] xdot0 The initial value of the system state's first derivative.
+   *
+   * @param[in] C The matrix coefficients of the system state *x* in the
+   * equation for the system's output *y*.
+   *
+   * @param[in] D The matrix coefficients of the system input *u* in the
+   * equation for the system's output *y*.
+   *
+   * @param[in] y0 The initial value of the system's output.
+   */
   template <typename DerivedA, typename DerivedB, typename Derivedxdot0,
             typename DerivedC, typename DerivedD, typename Derivedy0>
   AffineSystem(const Eigen::MatrixBase<DerivedA>& A,
@@ -61,6 +86,12 @@
   }

   bool isTimeVarying() const { return false; }
+
+  /**
+   * A system is direct feedthrough if the outputs of the system (*y*) directly
+   * depend on the inputs of the system (*u*). In this case, *y* will directly
+   * depend on *u* only if *D* is non-zero.
+   */
   bool isDirectFeedthrough() const { return !D_.isZero(); }
   size_t getNumStates() const { return static_cast<size_t>(A_.cols()); }
   size_t getNumInputs() const { return static_cast<size_t>(B_.cols()); }
@@ -80,6 +111,10 @@
                                    // sizes.
 };

+/**
+ * This is a specialization of AffineSystem where the initial first derivative
+ * of the system inputs (*xdot0*) and the system outputs (*y0*) are both zero.
+ */
 template <template <typename> class StateVec,
           template <typename> class InputVec,
           template <typename> class OutputVec>
@@ -92,6 +127,22 @@
   template <typename ScalarType>
   using InputVector = InputVec<ScalarType>;

+  /**
+   * A constructor that simply instantiates an AffineSystem where *xdot0* and
+   * *y0* are zero.
+   *
+   * @param[in] A The matrix coefficients of the system state *x* in the
+   * equation for the first derivative of the system's state *xdot*.
+   *
+   * @param[in] B The matrix coefficients of the system input *u* in the
+   * equation for the first derivative of the system's state *xdot*.
+   *
+   * @param[in] C The matrix coefficients of the system state *x* in the
+   * equation for the system's output *y*.
+   *
+   * @param[in] D The matrix coefficients of the system input *u* in the
+   * equation for the system's output *y*.
+   */
   template <typename DerivedA, typename DerivedB, typename DerivedC,
             typename DerivedD>
   LinearSystem(const Eigen::MatrixBase<DerivedA>& A,
@@ -103,6 +154,16 @@
             Eigen::VectorXd::Zero(C.rows())) {}
 };

+/**
+ * A specialization of LinearSystem in which *A*, *B*, and *C* are all zero.
+ * In other words, this system implements:
+ *
+ *
+ * @f[ y = Du @f]
+ *
+ * Where *y* is the system's output, *u* is the system's input, and *D* is the
+ * matrix coefficient for *u*.
+ */
 template <template <typename> class InputVec,
           template <typename> class OutputVec>
 class Gain : public LinearSystem<NullVector, InputVec, OutputVec> {
@@ -114,6 +175,13 @@
   template <typename ScalarType>
   using InputVector = InputVec<ScalarType>;

+  /**
+   * The constructor that simply instantiates a LinearSystem where the
+   * coefficient matrices *A*, *B*, and *C* are all zero.
+   *
+   * @param[in] D The matrix coefficients of the system input *u* in the
+   * equation for the system's output *y*.
+   */
   template <typename Derived>
   explicit Gain(const Eigen::MatrixBase<Derived>& D)
       : LinearSystem<NullVector, InputVec, OutputVec>(


try working around panic by validating rt and lle

MFC after:	3 days

--- sys/netinet6/ip6_output.c
+++ sys/netinet6/ip6_output.c
@@ -486,7 +486,8 @@
 		 */
 		if ((fle = flowtable_lookup_mbuf(V_ip6_ft, m, AF_INET6)) != NULL) {
 			flow_to_route_in6(fle, ro);
-			flevalid = 1;
+			if (ro->ro_rt != NULL && ro->ro_lle != NULL)
+				flevalid = 1;
 		}
 	}
 #endif


mysql: Fixed assert-crashing on transaction commits.

--HG--
branch : HEAD

--- src/lib-sql/driver-mysql.c
+++ src/lib-sql/driver-mysql.c
@@ -459,8 +459,9 @@
 		callback(NULL, context);
 }

-static int transaction_send_query(struct mysql_transaction_context *ctx,
-				  const char *query)
+static int
+transaction_send_query(struct mysql_transaction_context *ctx, const char *query,
+		       unsigned int *affected_rows_r)
 {
 	struct sql_result *result;
 	my_ulonglong rows;
@@ -474,13 +475,12 @@
 		ctx->error = sql_result_get_error(result);
 		ctx->failed = TRUE;
 		ret = -1;
-	} else if (ctx->ctx.head != NULL &&
-		   ctx->ctx.head->affected_rows != NULL) {
+	} else if (affected_rows_r != NULL) {
 		struct mysql_db *db = (struct mysql_db *)result->db;

 		rows = mysql_affected_rows(db->mysql);
 		i_assert(rows != (my_ulonglong)-1);
-		*ctx->ctx.head->affected_rows = rows;
+		*affected_rows_r = rows;
 	}
 	sql_result_unref(result);
 	return ret;
@@ -499,13 +499,14 @@
 	if (_ctx->head != NULL) {
 		/* try to use a transaction in any case,
 		   even if it doesn't work. */
-		(void)transaction_send_query(ctx, "BEGIN");
+		(void)transaction_send_query(ctx, "BEGIN", NULL);
 		while (_ctx->head != NULL) {
-			if (transaction_send_query(ctx, _ctx->head->query) < 0)
+			if (transaction_send_query(ctx, _ctx->head->query,
+						   _ctx->head->affected_rows) < 0)
 				break;
 			_ctx->head = _ctx->head->next;
 		}
-		ret = transaction_send_query(ctx, "COMMIT");
+		ret = transaction_send_query(ctx, "COMMIT", NULL);
 		*error_r = ctx->error;
 	}
 	sql_transaction_rollback(&_ctx);


[#61] Removed outdated comment.

[#61] Removed outdated comment.

--- arch/translate-all.c
+++ arch/translate-all.c
@@ -74,8 +74,7 @@
     j = tcg_gen_code_search_pc(s, (uint8_t *)tc_ptr, searched_pc - tc_ptr);
     if (j < 0)
         return -1;
-    /* now find start of instruction before (or after) */
-
+    /* now find start of instruction before */
     while (ctx->gen_opc_instr_start[j] == 0)
         j--;

@@ -83,4 +82,3 @@

     return 0;
 }
-


ASoC: twl6040: Switch to use system workqueue for jack reporting

There's no need to create a queue for this anymore

Signed-off-by: Peter Ujfalusi <e5c0b4cdf99ae1d408b9c497159e74b54e02e008@ti.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- sound/soc/codecs/twl6040.c
+++ sound/soc/codecs/twl6040.c
@@ -75,7 +75,6 @@
 	u16 hf_right_step;
 	struct twl6040_jack_data hs_jack;
 	struct snd_soc_codec *codec;
-	struct workqueue_struct *workqueue;
 	struct mutex mutex;
 };

@@ -404,8 +403,7 @@
 	struct snd_soc_codec *codec = data;
 	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);

-	queue_delayed_work(priv->workqueue, &priv->hs_jack.work,
-			   msecs_to_jiffies(200));
+	schedule_delayed_work(&priv->hs_jack.work, msecs_to_jiffies(200));

 	return IRQ_HANDLED;
 }
@@ -1162,10 +1160,6 @@
 		return -EINVAL;
 	}

-	priv->workqueue = alloc_workqueue("twl6040-codec", 0, 0);
-	if (!priv->workqueue)
-		return -ENOMEM;
-
 	INIT_DELAYED_WORK(&priv->hs_jack.work, twl6040_accessory_work);

 	mutex_init(&priv->mutex);
@@ -1175,27 +1169,18 @@
 					"twl6040_irq_plug", codec);
 	if (ret) {
 		dev_err(codec->dev, "PLUG IRQ request failed: %d\n", ret);
-		goto err;
+		return ret;
 	}

 	twl6040_init_chip(codec);

 	/* power on device */
-	ret = twl6040_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-	if (!ret)
-		return 0;
-
-err:
-	destroy_workqueue(priv->workqueue);
-	return ret;
+	return twl6040_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 }

 static int twl6040_remove(struct snd_soc_codec *codec)
 {
-	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
-
 	twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF);
-	destroy_workqueue(priv->workqueue);

 	return 0;
 }


test_simple: mass of additional stuff flying in loose formation

it is unclear if setsockopt of tos/ttl/etc is needed on sending,
or it can be done properly with a fd or if a raw socket with
ip addrs and ports is needed.

it seems clear that setsockopt is needed for tcp transfers.

but the future is foggy. No wonder nobody does socket programming
at this level.

--- test_simple.c
+++ test_simple.c
@@ -17,11 +17,14 @@
 #include <netinet/ip.h>

 #include "ringbuffer.h"
+#include "twd_time.h"
 #include "protocol.h"
 #include "log.h"
 #include "test_control.h"
-
-/* This defines the simplest 3 tests we can run, testing for
+#include "dscp.h"
+#include "parse_addr.h"
+
+/* This defines the simplest 3 tests we can run, testing for
  * tos, diffserv, & ecn awareness.
  */

@@ -53,12 +56,12 @@
 */

 int create_timerfds(fd_set *exceptfds) {
-  struct itimerspec new_value;
-  struct itimerspec ms10_interval;
-  struct itimerspec ms100_interval;
-  struct itimerspec old_value;
-  struct timespec now;
-  struct timespec watchdog;
+  itimerspec_t new_value;
+  itimerspec_t ms10_interval;
+  itimerspec_t ms100_interval;
+  itimerspec_t old_value;
+  timespec_t now;
+  timespec_t watchdog;
   sigset_t sigmask, empty_mask;
   struct sigaction sa;
   fd_set origfds;
@@ -369,10 +372,18 @@
   dscp_t dscp;
 } tos_t;

-typedef struct timespec timespec_t;
-typedef struct timeval timeval_t;
-
 typedef struct {
+  sockaddr__u from;
+  sockaddr__u to;
+  uint16_t sport;
+  uint16_t dport;
+  tos_t tos;
+  uint8_t tos;
+  uint32_t flow;
+} ip_header_t;
+
+typedef struct {
+  int flags;
   timespec_t ts;
   timespec_t rtt;
   uint32_t seqno;
@@ -383,10 +394,10 @@
 typedef struct  {
   int fd;
   int type;
-  int tos;
-  int ttl;
+  ip_header_t header;
   int size;
   int ts_type;
+  uint32_t seqno;
   int64_t nonce;
   timespec_t ts;
 } pbuffer_t;
@@ -397,11 +408,11 @@
   switch(type)
   {
   default:
-  IPPROTO_IP: rc = setsockopt(p, IPPROTO_IP, IP_TOS, (char *) dscp,
+  IPPROTO_IP: rc = setsockopt(p, IPPROTO_IP, IP_TOS, (char *) &dscp,
 			    sizeof(dscp));
            break;
   IPPROTO_IPV6: rc = setsockopt(p,IPPROTO_IPV6, IPV6_TCLASS, (int *)
-				dscp,  sizeof(dscp));
+				&dscp,  sizeof(dscp));
 	   break;
   }
   return(rc);
@@ -431,6 +442,7 @@
 */

 int recv_setup(pbuffer_t *p) {
+  int set = 1; // FIXME: check what this should be
   switch(p->type) {
   case IPPROTO_IP:
     if(setsockopt(p->fd, IPPROTO_IP, IP_RECVTOS, &set,sizeof(set))<0) { }
@@ -447,7 +459,7 @@
     {
 #endif
     if(setsockopt(p->fd, IPPROTO_IPV6, SO_TIMESTAMP, &set,sizeof(set))<0) {
-      ts->ts_type = 2; // usec resolution
+      p->ts_type = 2; // usec resolution
     } else {
       p->ts_type = 0;
     }
@@ -460,29 +472,82 @@

 }

-/* FIXME get these from the right clock */
-
-int twd_gettime(timespec_t *t1) {
-}
-
-int convert_timeval2timespec(timespec_t *t1, timeval_t *t2)
-{
-  t1->tv_sec = t2->tv_sec;
-  t1->tv_nsec = t2->tv_usec * 1000L;
-  return 0;
-}
-
-int recv_pbuffer(pbuffer_t *p, void * data)
-{
-  struct msghdr msg;
-  struct iovec iov[1];
-  memset(&msg, '\0', sizeof(msg));
+#define MAX_MTU 1500
+//        int  on = 64;
+//       setsockopt(fd, IPPROTO_IPV6, IPV6_HOPLIMIT, &on, sizeof(on));
+
+//int send_packet(connections_t, headers_t, results_t, void *data);
+
+int send_packet(pbuffer_t *p, ip_header_t *h, char *data, int size) {
+  struct msghdr msg = {0};
+  struct cmsghdr *c;
+  struct iovec iov[3] = {0};
+  char pkt[MAX_MTU];
   msg.msg_iov = iov;
   msg.msg_iovlen = 3;
   iov[0].iov_base = (char *) &pkt;
   iov[0].iov_len = sizeof(pkt);
-  p->ttl = 0;
-  p->tos = 0;
+
+  msg.msg_control=pkt;
+  msg.msg_controllen=1500;
+  c=CMSG_FIRSTHDR(&msg);
+  assert(c);
+
+// if using raw sockets (ipv4mapped(p->from);
+
+  if(p->type == IPPROTO_IP)
+    {
+      c->cmsg_level=IPPROTO_IP;
+      c->cmsg_type=IP_TOS;
+      c->cmsg_len=CMSG_LEN(sizeof(int));
+      *(int*)CMSG_DATA(c)=h->tos;
+      msg.msg_controllen=c->cmsg_len;
+      c=CMSG_NXTHDR(&msg,&c);
+      c->cmsg_level=IPPROTO_IP;
+      c->cmsg_type=IP_TTL;
+      c->cmsg_len=CMSG_LEN(sizeof(int));
+      *(int*)CMSG_DATA(c)=h->ttl;
+      msg.msg_controllen+=c->cmsg_len;
+      // c=CMSG_NEXTHDR(&msg);
+    } else {
+    if(p-> type = IPPROTO_IPV6) {
+      c->cmsg_level=IPPROTO_IPV6;
+      c->cmsg_type=IPV6_TCLASS;
+      c->cmsg_len=CMSG_LEN(sizeof(int));
+      *(int*)CMSG_DATA(c)=h->tos;
+      msg.msg_controllen=c->cmsg_len;
+      c=CMSG_NXTHDR(&msg,&c);
+      c->cmsg_level=IPPROTO_IPV6;
+      c->cmsg_type=IPV6_HOPLIMIT;
+      c->cmsg_len=CMSG_LEN(sizeof(int));
+      *(int*)CMSG_DATA(c)=h->ttl;
+      msg.msg_controllen+=c->cmsg_len;
+      //      c=CMSG_NEXTHDR(&msg);
+    }
+  }
+
+  sendmsg(p->fd,msg,0);
+}
+
+/*
+ if (cmsg->cmsg_level == SOL_IP - might be needed
+ && cmsg->cmsg_type == IP_TTL)
+ return (int)CMSG_DATA(cmsg);
+
+ */
+
+int recv_pbuffer(pbuffer_t *p, void * data)
+{
+  struct msghdr msg;
+  struct iovec iov[4];
+  char pkt[MAX_MTU];
+  memset(&msg, '\0', sizeof(msg));
+  msg.msg_iov = iov;
+  msg.msg_iovlen = 4;
+  iov[0].iov_base = (char *) &pkt;
+  iov[0].iov_len = sizeof(pkt);
+  p->header.ttl = 0;
+  p->header.tos = 0;
   p->ts = {0};
   /* FIXME: wrong */

@@ -493,6 +558,7 @@
   msg.msg_controllen = sizeof(buf); //just initializing it

   int nRet = recvmsg(udpSocket, &msg, packet_size);
+  p->ts = {0};
   if (nRet > 0) {
 	struct cmsghdr *cmsg;
 	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg,cmsg)) {
@@ -500,17 +566,17 @@
 	  switch(cmsg->cmsg_level)
 	    {
 	    case IPPROTO_IP: if(cmsg->cmsg_len) switch (cmg->cmsg_type) {
-		case IP_TTL: p->ttl = (int *) CMSG_DATA(cmsg); break;
-		case IP_TOS: p->tos = (int *) CMSG_DATA(cmsg); break;
-		case SO_TIMESTAMP: p->ts = (timeval *) CMSG_DATA(cmsg); break;
-		case SO_TIMESTAMPNS: p->ts = (timespec *) CMSG_DATA(cmsg); break;
+		case IP_TTL: p->header.ttl = (int *) CMSG_DATA(cmsg); break;
+		case IP_TOS: p->header.tos = (int *) CMSG_DATA(cmsg); break;
+		case SO_TIMESTAMP: converttimeval2timespec((timeval_t *) CMSG_DATA(cmsg), p->ts); break;
+		case SO_TIMESTAMPNS: memcpy(&p->ts,CMSG_DATA(cmsg),sizeof(timespec_t)); break;
 		}
 	      break;
 	    case IPPROTO_IPV6: if(cmsg->cmsg_len) switch (cmg->cmsg_type) {
-		case IPV6_HOPLIMIT: p->ttl = (int *) CMSG_DATA(cmsg); break;
-		case IPV6_TCLASS: p->tos = (int *) CMSG_DATA(cmsg); break;
-		case SO_TIMESTAMP: converttimeval2timespec((timeval *) CMSG_DATA(cmsg), p->ts); break;
-		case SO_TIMESTAMPNS: p->ts = (timespec *) CMSG_DATA(cmsg); break;
+		case IPV6_HOPLIMIT: p->header.ttl = (int *) CMSG_DATA(cmsg); break;
+		case IPV6_TCLASS: p->header.tos = (int *) CMSG_DATA(cmsg); break;
+		case SO_TIMESTAMP: converttimeval2timespec((timeval_t *) CMSG_DATA(cmsg), p->ts); break;
+		case SO_TIMESTAMPNS: memcpy(&p->ts,CMSG_DATA(cmsg),sizeof(timespec_t)); break;
 		}
 	      break;
 	    default: // FIXME: It's data now
@@ -519,15 +585,16 @@
   }
   /* if we didn't get a timestamp with the packet, fill out the ts
      field portably. */
-     if(p->ts.sec == 0 and p->ts.nsec == 0)
-       twd_gettime(p->ts);
+     if(p->ts.tv_sec == 0 && p->ts.tv_nsec == 0)
+       twd_gettime(&p->ts);
 }

 int send_setup(pbuffer_t *p)
 {
+   int dscp;
         if (setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (char *)&dscp,
                        sizeof(dscp)) == SOCKET_ERROR) {
-
+	}
 }

 int send_pbuffer(pbuffer_t *p)
@@ -554,7 +621,7 @@

 /* TOS Test */
 int test_tos() {
-  per_packet_info results[64];
+  per_packet_info_t results[64];
 }

 /* ECN Test */
@@ -565,42 +632,65 @@

 }

+ringbuffer__s collector;
+
+/* We try to size the collector ring so large that it will never
+   block, but... */
+
+void send_result_to(ringbuffer__s rbuf; per_packet_info_t *p)
+{
+  while(!ringbuffer_write(rbuf,p,sizeof(*p))) sched_yield();
+}
+
+
 // FIXME, this assumes we are only getting one packet
-// per seqno, which is sort of right at this level
-
- int recv_dscp(pbuffer_t *p)
-{
-  per_packet_info_t results[23];
+// per seqno, which is sort of right at this point
+// (need to work in the nonce)
+
+int recv_dscp(pbuffer_t *p, ringbuffer__s collector)
+  {
+  per_packet_info_t results = {0};
   pbuffer_t l = {*p};
   int rc;
   char buf[MAX_MTU];
-  for(int i = 0; i < 24; i++)
-    {
-      if(rc = recv_pbuffer(&l,&buf)) {
-	results[i].seqno = l->seqno;
-	results[i].ttl = l->ttl;
-	results[i].ts = l->ts;
-	results[i].tos = l->tos;
-	send_result_to(&collector,&results[i]);
-      } else {
-	// do sane things on timeouts and errors etc
-      }
-    }
-  return 0;
-}
-
-int test_dscp(pbuffer_t *p) {
+  while((rc = recv_pbuffer(&l,&buf,sizeof(buf)) > 0))
+  {
+    results.seqno = l.seqno;
+    results.ttl = l.ttl;
+    results.ts = l.ts;
+    results.tos = l.tos;
+    send_result_to(&collector,&results);
+    if(l.flags != 0) break;
+  }
+  if (rc < -1)
+  { // something went wrong
+  }
+  return l.flags;
+}
+
+int send_dscp(pbuffer_t *p) {
   pbuffer_t l = {*p};
   char data[MAX_MTU];
-  for(int i = 0; i < 24 && ipqos[i].name != NULL; i++) {
-    l.tos.tos = ipqos[i].value;
+  results_t l = {0};
+  for(int i = 0; ipqos[i].name != NULL; i++) {
+    l.tos = ipqos[i].value;
     // these two should move to send_packet
     l.seqno++;
     twd_gettime(&l.ts);
     send_packet(&l,&data);
   }
-}
-
+  l.flags = 1;
+  send_packet(&l,&data);
+  return l.flags;
+}
+
+void test_setup_dscp()
+{
+  /*
+     create related threads
+
+   */
+}
 int main(void)
 {
   ringbuffer__s rbuf;


MFp4: use the function to fix the packet header length instead of rolling our own...

--- sys/nfsclient/krpc_subr.c
+++ sys/nfsclient/krpc_subr.c
@@ -299,13 +299,7 @@
 	/*
 	 * Setup packet header
 	 */
-	len = 0;
-	m = mhead;
-	while (m) {
-		len += m->m_len;
-		m = m->m_next;
-	}
-	mhead->m_pkthdr.len = len;
+	m_fixhdr(mhead);
 	mhead->m_pkthdr.rcvif = NULL;

 	/*


x86: pcie: Fix calling pcie_mm_init()

x86: pcie: Fix calling pcie_mm_init()

Commit 5632ee26f37 introduced an issue where in order to use MMIO
configuration:

 - do_pcie_mmio_cfg is required to be true
 - Only set to true in pcie_mm_init()
 - Which is only called from pcie_mm_conf()
 - Which is only called from pcie_conf() if do_pcie_mmio_cfg is
   already true!

The end result is that MMIO configuration will never be used.

Fix the situation by moving the initialization check to pcie_conf().

Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>

--- arch/x86/core/pcie.c
+++ arch/x86/core/pcie.c
@@ -61,14 +61,6 @@
 static inline void pcie_mm_conf(pcie_bdf_t bdf, unsigned int reg,
 				bool write, uint32_t *data)
 {
-	if (bus_segs[0].mmio == NULL) {
-		pcie_mm_init();
-	}
-
-	if (do_pcie_mmio_cfg == false) {
-		return;
-	}
-
 	for (int i = 0; i < ARRAY_SIZE(bus_segs); i++) {
 		int off = PCIE_BDF_TO_BUS(bdf) - bus_segs[i].start_bus;

@@ -133,6 +125,10 @@

 {
 #ifdef CONFIG_PCIE_MMIO_CFG
+	if (bus_segs[0].mmio == NULL) {
+		pcie_mm_init();
+	}
+
 	if (do_pcie_mmio_cfg) {
 		pcie_mm_conf(bdf, reg, write, data);
 	} else


Adding HKS K palette

Adding HKS K palette