[PATCH] USB: wakeup flag updates (2/3) uhci-hcd

This makes UHCI stop using the HCD glue wakeup flags to report whether
the controller can wake the system.  The existing code was wrong anyway;
having a PCI PM capability doesn't imply it reports PME# is supported.

I skimmed Intel's ICH7 datasheet and that basically says the wakeup
signaling gets routed only through ACPI registers.  (On the other hand,
many VIA chips provide the PCI PM capabilities...)  I think that doing
this correctly with UHCI is going to require the ACPI folk to associate
the /proc/acpi/wakeup identifiers (and wakeup enable/disable flags)
with the relevant /sys/devices/pci*/...  devices.

From: David Brownell <a0d09457d62acbdeb1fae1223575100ccbfffdf9@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/host/uhci-hcd.c
+++ drivers/usb/host/uhci-hcd.c
@@ -478,8 +478,6 @@
 	struct dentry *dentry;

 	hcd->uses_new_polling = 1;
-	if (pci_find_capability(to_pci_dev(uhci_dev(uhci)), PCI_CAP_ID_PM))
-		hcd->can_wakeup = 1;		/* Assume it supports PME# */

 	dentry = debugfs_create_file(hcd->self.bus_name,
 			S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root, uhci,


OFConnectionManager: fix clang-analyzer warning

The analyzer wasn't convinced that cur_node would be non-NULL (and that the iov
would be initialized) if left > 0. I don't think there's an actual bug here,
but better to be safe.

--- modules/OFConnectionManager/module/src/cxn_instance.c
+++ modules/OFConnectionManager/module/src/cxn_instance.c
@@ -1269,12 +1269,12 @@
     int num_iovecs = 0;
     struct iovec iovecs[MAX_WRITE_MSGS];
     biglist_t *cur_node;
-    struct iovec *iov;
+    int i;

     /* Iterate over cxn->output_list adding buffers to iovecs */
     cur_node = cxn->output_list;
     while (cur_node != NULL && num_iovecs < MAX_WRITE_MSGS) {
-        iov = &iovecs[num_iovecs];
+        struct iovec *iov = &iovecs[num_iovecs];
         iov->iov_base = BIGLIST_CAST(void *, cur_node);
         iov->iov_len = of_message_length_get(iov->iov_base);
         if (num_iovecs == 0) {
@@ -1299,8 +1299,8 @@
      * sent messages.
      */
     left = written;
-    iov = iovecs;
-    while (left > 0) {
+    for (i = 0; i < num_iovecs; i++) {
+        struct iovec *iov = &iovecs[i];
         int to_write, bytes_out;
         cur_node = cxn->output_list;

@@ -1326,7 +1326,6 @@
         }

         left -= bytes_out;
-        iov++;
     }

     if (cxn->output_list == NULL) { /* Nothing (more) to send */


Get the Processer cache line size. This file contains processor and OS specific content. Currently it only works well with x86 and 64-bit PPC.

error: pathspec 'security/nss/lib/freebl/mpi/mpcpucache.c' did not match any file(s) known to git

--- security/nss/lib/freebl/mpi/mpcpucache.c
+++ security/nss/lib/freebl/mpi/mpcpucache.c
@@ -0,0 +1,760 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Netscape security libraries.
+ *
+ * The Initial Developer of the Original Code is
+ * Red Hat, Inc
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Robert Relyea <rrelyea@redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "mpi.h"
+
+/*
+ * This file implements a single function: mpi_getProcessorLineSize();
+ * mpi_getProcessorLineSize() returns the size in bytes of the cache line
+ * if a cache exists, or zero if there is no cache. If more than one
+ * cache line exists, it should return the smallest line size (which is
+ * usually the L1 cache).
+ *
+ * mp_modexp uses this information to make sure that private key information
+ * isn't being leaked through the cache.
+ *
+ * Currently the file returns good data for most modern x86 processors, and
+ * reasonable data on 64-bit ppc processors. All other processors are assumed
+ * to have a cache line size of 32 bytes unless modified by target.mk.
+ *
+ */
+
+#if defined(i386) || defined(__i386) || defined(__X86__) || defined (_M_IX86)
+/* X86 processors have special instructions that tell us about the cache */
+#include "string.h"
+
+/* Generic CPUID function */
+#ifndef _WIN32
+static void cpuid(unsigned long op, unsigned long *eax,
+	                 unsigned long *ebx, unsigned long *ecx,
+                         unsigned long *edx)
+{
+/* sigh GCC isn't smart enough to save the ebx PIC register on it's own
+ * in this case, so do it by hand. */
+	__asm__("pushl %%ebx\n\t"
+	        "cpuid\n\t"
+                "mov %%ebx,%1\n\t"
+                "popl %%ebx\n\t"
+		: "=a" (*eax),
+		  "=r" (*ebx),
+		  "=c" (*ecx),
+		  "=d" (*edx)
+		: "0" (op));
+}
+
+/*
+ * try flipping a processor flag to determine CPU type
+ */
+static unsigned long changeFlag(unsigned long flag)
+{
+	unsigned long changedFlags, originalFlags;
+	__asm__("pushfl\n\t"            /* get the flags */
+	        "popl %0\n\t"
+	        "movl %0,%1\n\t"	/* save the original flags */
+	        "xor %0,%2\n\t"	/* flip the but */
+		"pushl %0\n\t"	/* set the flags */
+	        "popfl\n\t"
+		"pushfl\n\t"		/* get the flags again (for return) */
+		"popl %0\n\t"
+		"pushl %1\n\t"		/* restore the original flags */
+		"popfl\n\t"
+		: "=r" (changedFlags),
+		  "=r" (originalFlags)
+		: "r" (flag));
+	return changedFlags ^ originalFlags;
+}
+
+#else
+
+/*
+ * windows versions of the above assembler
+ */
+#define wcpuid __asm __emit 0fh __asm __emit 0a2h
+static void cpuid(unsigned long op, unsigned long *Reax, unsigned long *Rebx,
+                                    unsigned long *Recx, unsigned long *Redx)
+{
+        unsigned long  Leax, Lebx, Lecx, Ledx;
+        __asm {
+        pushad
+        mov     eax,op
+        wcpuid
+        mov     Leax,eax
+        mov     Lebx,ebx
+        mov     Lecx,ecx
+        mov     Ledx,edx
+        popad
+        }
+        *Reax = Leax;
+        *Rebx = Lebx;
+        *Recx = Lecx;
+        *Redx = Ledx;
+}
+
+static unsigned long changeFlag(unsigned long flag)
+{
+	unsigned long changedFlags, originalFlags;
+	__asm {
+		pushad
+		pushfd 	                /* get the flags */
+	        pop  eax
+	        mov  ecx,eax            /* save the original flags */
+	        mov  originalFlags,ecx  /* save the original flags */
+		mov  ebx,flag
+	        xor  eax,ebx            /* flip the but */
+		push eax                /* set the flags */
+	        popfd
+		pushfd                  /* get the flags again (for return) */
+		pop  eax
+		push ecx                /* restore the original flags */
+		popfd
+		mov changedFlags,eax
+		popad
+	}
+	return changedFlags ^ originalFlags;
+}
+#endif
+
+#define AC_FLAG 0x40000
+#define ID_FLAG 0x200000
+
+/* 386 processors can't flip the AC_FLAG, intel AP Note AP-485 */
+static int is386()
+{
+    return changeFlag(AC_FLAG) == 0;
+}
+
+/* 486 processors can't flip the ID_FLAG, intel AP Note AP-485 */
+static int is486()
+{
+    return changeFlag(ID_FLAG) == 0;
+}
+
+
+/*
+ * table for Intel Cache.
+ * See Intel Application Note AP-485 for more information
+ */
+typedef enum {
+    Cache_NONE = 0,
+    Cache_UNKNOWN = 1,
+    Cache_TLB = 2,
+    Cache_Trace = 3,
+    Cache_L1 = 4,
+    Cache_L2 = 5 ,
+    Cache_L3 = 6
+} CacheType;
+
+#define DATA_INSTR 1
+#define DATA_DATA  2
+#define DATA_BOTH  3
+#define DATA_TRACE 4
+#define DATA_NONE  0
+
+#define TLB_4k	0x01
+#define TLB_2M  0x08
+#define TLB_4M  0x10
+#define TLB_4Mk 0x11
+#define TLB_ALL 0x19
+
+#define k * 1024
+#define M * (1024*1024)
+#define G * (1024*1024*1024)
+
+struct _cache {
+    CacheType type;
+    unsigned long data;
+#define pageSize size
+#define trcuops size
+    unsigned long size;
+    unsigned long association;
+#define tlbEntries lineSize
+    unsigned long lineSize;
+} CacheMap[] = {
+/* 00 */ {Cache_NONE,    DATA_NONE,    0,       0,    0   },
+/* 01 */ {Cache_TLB,     DATA_INSTR,   TLB_4k,  4,    32  },
+/* 02 */ {Cache_TLB,     DATA_INSTR,   TLB_4M,  0,    2   },
+/* 03 */ {Cache_TLB,     DATA_DATA,    TLB_4k,  4,    64  },
+/* 04 */ {Cache_TLB,     DATA_DATA,    TLB_4M,  4,    8   },
+/* 05 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 06 */ {Cache_L1,      DATA_INSTR,   8 k,     4,    32  },
+/* 07 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 08 */ {Cache_L1,      DATA_INSTR,   16 k,    4,    32  },
+/* 09 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 0a */ {Cache_L1,      DATA_DATA,    8 k,     4,    32  },
+/* 0b */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 0c */ {Cache_L1,      DATA_DATA,    16 k,    4,    32  },
+/* 0d */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 0e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 0f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 10 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 11 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 12 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 13 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 14 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 15 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 16 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 17 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 18 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 19 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 1a */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 1b */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 1c */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 1d */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 1e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 1f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 20 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 21 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 22 */ {Cache_L3,      DATA_BOTH,    512 k,   8,    64  },
+/* 23 */ {Cache_L3,      DATA_BOTH,    1 M,     8,    64  },
+/* 24 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 25 */ {Cache_L3,      DATA_BOTH,    2 M,     8,    64  },
+/* 26 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 27 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 28 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 29 */ {Cache_L3,      DATA_BOTH,    4 M,     8,    64  },
+/* 2a */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 2b */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 2c */ {Cache_L1,      DATA_DATA,    32 k,    8,    64  },
+/* 2d */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 2e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 2f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 30 */ {Cache_L1,      DATA_INSTR,   32 k,    8,    64  },
+/* 31 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 32 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 33 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 34 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 35 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 36 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 37 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 38 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 39 */ {Cache_L2,      DATA_BOTH,    128 k,   4,    64  },
+/* 3a */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 3b */ {Cache_L2,      DATA_BOTH,    128 k,   2,    64  },
+/* 3c */ {Cache_L2,      DATA_BOTH,    256 k,   4,    64  },
+/* 3d */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 3e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 3f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 40 */ {Cache_L2,      DATA_NONE,    0,       0,    0   },
+/* 41 */ {Cache_L2,      DATA_BOTH,    128 k,   4,    32  },
+/* 42 */ {Cache_L2,      DATA_BOTH,    256 k,   4,    32  },
+/* 43 */ {Cache_L2,      DATA_BOTH,    512 k,   4,    32  },
+/* 44 */ {Cache_L2,      DATA_BOTH,    1 M,     4,    32  },
+/* 45 */ {Cache_L2,      DATA_BOTH,    2 M,     4,    32  },
+/* 46 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 47 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 48 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 49 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 4a */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 4b */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 4c */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 4d */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 4e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 4f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 50 */ {Cache_TLB,     DATA_INSTR,   TLB_ALL, 0,    64  },
+/* 51 */ {Cache_TLB,     DATA_INSTR,   TLB_ALL, 0,    128 },
+/* 52 */ {Cache_TLB,     DATA_INSTR,   TLB_ALL, 0,    256 },
+/* 53 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 54 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 55 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 56 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 57 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 58 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 59 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 5a */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 5b */ {Cache_TLB,     DATA_DATA,    TLB_4Mk, 0,    64  },
+/* 5c */ {Cache_TLB,     DATA_DATA,    TLB_4Mk, 0,    128 },
+/* 5d */ {Cache_TLB,     DATA_DATA,    TLB_4Mk, 0,    256 },
+/* 5e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 5f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 60 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 61 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 62 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 63 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 64 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 65 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 66 */ {Cache_L1,      DATA_DATA,    8 k,     4,    64  },
+/* 67 */ {Cache_L1,      DATA_DATA,    16 k,    4,    64  },
+/* 68 */ {Cache_L1,      DATA_DATA,    32 k,    4,    64  },
+/* 69 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 6a */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 6b */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 6c */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 6d */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 6e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 6f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 70 */ {Cache_Trace,   DATA_TRACE,   12 k,    8,    1   },
+/* 71 */ {Cache_Trace,   DATA_TRACE,   16 k,    8,    1   },
+/* 72 */ {Cache_Trace,   DATA_TRACE,   32 k,    8,    1   },
+/* 73 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 74 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 75 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 76 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 77 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 78 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 79 */ {Cache_L2,      DATA_BOTH,    128 k,   8,    64  },
+/* 7a */ {Cache_L2,      DATA_BOTH,    256 k,   8,    64  },
+/* 7b */ {Cache_L2,      DATA_BOTH,    512 k,   8,    64  },
+/* 7c */ {Cache_L2,      DATA_BOTH,    1 M,     8,    64  },
+/* 7d */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 7e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 7f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 80 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 81 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 82 */ {Cache_L2,      DATA_BOTH,    256 k,   8,    32  },
+/* 83 */ {Cache_L2,      DATA_BOTH,    512 k,   8,    32  },
+/* 84 */ {Cache_L2,      DATA_BOTH,    1 M,     8,    32  },
+/* 85 */ {Cache_L2,      DATA_BOTH,    2 M,     8,    32  },
+/* 86 */ {Cache_L2,      DATA_BOTH,    512 k,   4,    64  },
+/* 87 */ {Cache_L2,      DATA_BOTH,    1 M,     8,    64  },
+/* 88 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 89 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 8a */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 8b */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 8c */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 8d */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 8e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 8f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 90 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 91 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 92 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 93 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 94 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 95 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 96 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 97 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 98 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 99 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 9a */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 9b */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 9c */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 9d */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 9e */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* 9f */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a0 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a1 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a2 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a3 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a4 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a5 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a6 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a7 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a8 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* a9 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* aa */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ab */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ac */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ad */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ae */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* af */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* b0 */ {Cache_TLB,     DATA_INSTR,   TLB_4k,  4,    128 },
+/* b1 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* b2 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* b3 */ {Cache_TLB,     DATA_DATA,    TLB_4k,  4,    128 },
+/* b4 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* b5 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* b6 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* b7 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* b8 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* b9 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ba */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* bb */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* bc */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* bd */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* be */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* bf */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c0 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c1 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c2 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c3 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c4 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c5 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c6 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c7 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c8 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* c9 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ca */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* cb */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* cc */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* cd */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ce */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* cf */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d0 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d1 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d2 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d3 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d4 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d5 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d6 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d7 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d8 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* d9 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* da */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* db */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* dc */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* dd */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* de */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* df */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e0 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e1 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e2 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e3 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e4 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e5 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e6 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e7 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e8 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* e9 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ea */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* eb */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ec */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ed */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ee */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ef */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f0 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f1 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f2 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f3 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f4 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f5 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f6 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f7 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f8 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* f9 */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* fa */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* fb */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* fc */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* fd */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* fe */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   },
+/* ff */ {Cache_UNKNOWN, DATA_NONE,    0,       0,    0   }
+};
+
+
+/*
+ * use the above table to determine the CacheEntryLineSize.
+ */
+static void
+getIntelCacheEntryLineSize(unsigned long val, int *level,
+						unsigned long *lineSize)
+{
+    CacheType type;
+
+    type = CacheMap[val].type;
+    /* only interested in data caches */
+    /* NOTE val = 0x40 is a special value that means no L2 or L3 cache.
+     * this data check has the side effect of rejecting that entry. If
+     * that wasn't the case, we could have to reject it explicitly */
+    if ((CacheMap[val].data & DATA_DATA) != DATA_DATA) {
+	return;
+    }
+    /* look at the caches, skip types we aren't interested in.
+     * if we already have a value for a lower level cache, skip the
+     * current entry */
+    if (type == Cache_L1) {
+	*level = 1;
+	*lineSize = CacheMap[val].lineSize;
+    } else if ((*level >= 2) && type == Cache_L2) {
+	*level = 2;
+	*lineSize = CacheMap[val].lineSize;
+    } else if ((*level >= 3) && type == Cache_L3) {
+	*level = 3;
+	*lineSize = CacheMap[val].lineSize;
+    }
+    return;
+}
+
+
+static void
+getIntelRegisterCacheLineSize(unsigned long val,
+			int *level, unsigned long *lineSize)
+{
+    getIntelCacheEntryLineSize(val >> 24 & 0xff, level, lineSize);
+    getIntelCacheEntryLineSize(val >> 16 & 0xff, level, lineSize);
+    getIntelCacheEntryLineSize(val >> 8 & 0xff, level, lineSize);
+    getIntelCacheEntryLineSize(val & 0xff, level, lineSize);
+}
+
+/*
+ * returns '0' if no recognized cache is found, or if the cache
+ * information is supported by this processor
+ */
+static unsigned long
+getIntelCacheLineSize(int cpuidLevel)
+{
+    int level = 4;
+    unsigned long lineSize = 0;
+    unsigned long eax, ebx, ecx, edx;
+    int repeat, count;
+
+    if (cpuidLevel < 2) {
+	return 0;
+    }
+
+    /* command '2' of the cpuid is intel's cache info call. Each byte of the
+     * 4 registers contain a potential descriptor for the cache. The CacheMap
+     * table maps the cache entry with the processor cache. Register 'al'
+     * contains a count value that cpuid '2' needs to be called in order to
+     * find all the cache descriptors. Only registers with the high bit set
+     * to 'zero' have valid descriptors. This code loops through all the
+     * required calls to cpuid '2' and passes any valid descriptors it finds
+     * to the getIntelRegisterCacheLineSize code, which breaks the registers
+     * down into their component descriptors. In the end the lineSize of the
+     * lowest level cache data cache is returned. */
+    cpuid(2, &eax, &ebx, &ecx, &edx);
+    repeat = eax & 0xf;
+    for (count = 0; count < repeat; count++) {
+	if ((eax & 0x80000000) == 0) {
+	    getIntelRegisterCacheLineSize(eax & 0xffffff00, &level, &lineSize);
+	}
+	if ((ebx & 0x80000000) == 0) {
+	    getIntelRegisterCacheLineSize(ebx, &level, &lineSize);
+	}
+	if ((ecx & 0x80000000) == 0) {
+	    getIntelRegisterCacheLineSize(ecx, &level, &lineSize);
+	}
+	if ((edx & 0x80000000) == 0) {
+	    getIntelRegisterCacheLineSize(edx, &level, &lineSize);
+	}
+	if (count+1 != repeat) {
+	    cpuid(2, &eax, &ebx, &ecx, &edx);
+	}
+    }
+    return lineSize;
+}
+
+/*
+ * returns '0' if the cache info is not supported by this processor.
+ * This is based on the AMD extended cache commands for cpuid.
+ * (see "AMD Processor Recognition Application Note" Publication 20734).
+ * Some other processors use the identical scheme.
+ * (see "Processor Recognition, Transmeta Corporation").
+ */
+static unsigned long
+getOtherCacheLineSize(unsigned long cpuidLevel)
+{
+    unsigned long lineSize = 0;
+    unsigned long eax, ebx, ecx, edx;
+
+    /* get the Extended CPUID level */
+    cpuid(0x80000000, &eax, &ebx, &ecx, &edx);
+    cpuidLevel = eax;
+
+    if (cpuidLevel >= 0x80000005) {
+	cpuid(0x80000005, &eax, &ebx, &ecx, &edx);
+	lineSize = ecx & 0xff; /* line Size, L1 Data Cache */
+    }
+    return lineSize;
+}
+
+char *manMap[] = {
+#define INTEL     0
+    "GenuineIntel",
+#define AMD       1
+    "AuthenticAMD",
+#define CYRIX     2
+    "CyrixInstead",
+#define CENTAUR   2
+    "CentaurHauls",
+#define NEXGEN    3
+    "NexGenDriven",
+#define TRANSMETA 4
+    "GenuineTMx86",
+#define RISE      5
+    "RiseRiseRise",
+#define UMC       6
+    "UMC UMC UMC ",
+#define SIS       7
+    "Sis Sis Sis ",
+#define NATIONAL  8
+    "Geode by NSC",
+};
+
+int n_manufacturers = sizeof(manMap)/sizeof(manMap[0]);
+
+#define MAN_UNKNOWN 9
+
+
+unsigned long
+mpi_getProcessorLineSize()
+{
+    unsigned long eax, ebx, ecx, edx;
+    unsigned long cpuidLevel;
+    unsigned long cacheLineSize = 0;
+    int manufacturer = MAN_UNKNOWN;
+    int i;
+    char string[65];
+
+    if (is386()) {
+	return 0; /* 386 had no cache */
+    } if (is486()) {
+	return 32; /* really? need more info */
+    }
+
+    /* Pentium, cpuid command is available */
+    cpuid(0, &eax, &ebx, &ecx, &edx);
+    cpuidLevel = eax;
+    *(int *)string = ebx;
+    *(int *)&string[4] = edx;
+    *(int *)&string[8] = ecx;
+    string[12] = 0;
+
+    manufacturer = MAN_UNKNOWN;
+    for (i=0; i < n_manufacturers; i++) {
+	if ( strcmp(manMap[i],string) == 0) {
+	    manufacturer = i;
+	}
+    }
+
+    if (manufacturer == INTEL) {
+	cacheLineSize = getIntelCacheLineSize(cpuidLevel);
+    } else {
+	cacheLineSize = getOtherCacheLineSize(cpuidLevel);
+    }
+    /* doesn't support cache info based on cpuid. This means
+     * an old pentium class processor, which have cache lines of
+     * 32. If we learn differently, we can use a switch based on
+     * the Manufacturer id  */
+    if (cacheLineSize == 0) {
+	cacheLineSize = 32;
+    }
+    return cacheLineSize;
+}
+#define MPI_GET_PROCESSER_LINE_SIZE_DEFINED 1
+#endif
+
+#if defined(__ppc64__)
+/*
+ *  Sigh, The PPC has some really nice features to help us determine cache
+ *  size, since it had lots of direct control functions to do so. The POWER
+ *  processor even has an instruction to do this, but it was dropped in
+ *  PowerPC. Unfortunately most of them are not available in user mode.
+ *
+ *  The dcbz function would be a great way to determine cache line size except
+ *  1) it only works on write-back memory (it throws an exception otherwise),
+ *  and 2) because so many mac programs 'knew' the processor cache size was
+ *  32 bytes, they used this instruction as a fast 'zero 32 bytes'. Now the new
+ *  G5 processor has 128 byte cache, but dcbz only clears 32 bytes to keep
+ *  these programs happy. dcbzl work if 64 bit instructions are supported.
+ *  If you know 64 bit instructions are supported, and that stack is
+ *  write-back, you can use this code.
+ */
+#include "memory.h"
+
+/* clear the cache line that contains 'array' */
+static inline void dcbzl(char *array)
+{
+	register char *a asm("r2") = array;
+	__asm__ __volatile__( "dcbzl %0,r0" : "=r" (a): "0"(a) );
+}
+
+
+#define PPC_DO_ALIGN(x,y) ((char *)\
+			((((long long) (x))+((y)-1))&~((y)-1)))
+
+#define PPC_MAX_LINE_SIZE 256
+unsigned long
+mpi_getProcessorLineSize()
+{
+    char testArray[2*PPC_MAX_LINE_SIZE+1];
+    char *test;
+    int i;
+
+    /* align the array on a maximum line size boundary, so we
+     * know we are starting to clear from the first address */
+    test = PPC_DO_ALIGN(testArray, PPC_MAX_LINE_SIZE);
+    /* set all the values to 1's */
+    memset(test, 0xff, PPC_MAX_LINE_SIZE);
+    /* clear one cache block starting at 'test' */
+    dcbzl(test);
+
+    /* find the size of the cleared area, that's our block size */
+    for (i=PPC_MAX_LINE_SIZE; i != 0; i = i/2) {
+	if (test[i-1] == 0) {
+	    return i;
+	}
+    }
+    return 0;
+}
+
+#define MPI_GET_PROCESSER_LINE_SIZE_DEFINED 1
+#endif
+
+
+/*
+ * put other processor and platform specific cache code here
+ * return the smallest cache line size in bytes on the processor
+ * (usually the L1 cache). If the OS has a call, this would be
+ * a greate place to put it.
+ *
+ * If there is no cache, return 0;
+ *
+ * define MPI_GET_PROCESSOR_LINE_SIZE_DEFINED so the generic functions
+ * below aren't compiled.
+ *
+ */
+
+
+/* target.mk can define LINE_SIZE if it's common for the family or OS */
+#if defined(LINE_SIZE) && !defined(MPI_GET_PROCESSOR_LINE_SIZE_DEFINED)
+
+unsigned long
+mpi_getProcessorLineSize()
+{
+   return LINE_SIZE;
+}
+#define MPI_GET_PROCESSER_LINE_SIZE_DEFINED 1
+#endif
+
+
+/* If no way to get the processor cache line size has been defined, assume
+ * it's 32 bytes (most common value, does not significantly impact performance
+ */
+#ifndef MPI_GET_PROCESSER_LINE_SIZE_DEFINED
+unsigned long
+mpi_getProcessorLineSize()
+{
+   return 32;
+}
+#endif
+
+#ifdef TEST_IT
+#include <stdio.h>
+
+main()
+{
+    printf("line size = %d\n", mpi_getProcessorLineSize());
+}
+#endif


deltas: Add an if0'd bit to print bsdiff objects

I used this to find the bsdiff'd objects.

Closes: #1314
Approved by: jlebon

--- src/libostree/ostree-repo-static-delta-compilation.c
+++ src/libostree/ostree-repo-static-delta-compilation.c
@@ -905,6 +905,20 @@
       g_string_append_c (current_part->operations, (gchar)OSTREE_STATIC_DELTA_OP_BSPATCH);
       _ostree_write_varuint64 (current_part->operations, current_part->payload->len);
       _ostree_write_varuint64 (current_part->operations, payload_size);
+
+      /* A bit too verbose to print by default...but leaving this #if 0'd out to
+       * use later. One approach I've been thinking about is to optionally
+       * output e.g. a JSON file as we build the deltas. Alternatively, we could
+       * try to reverse engineer things more in the "show" path, but that gets
+       * hard/messy as it's quite optimized for execution now.
+       */
+#if 0
+      g_printerr ("bspatch %s [%llu] → %s [%llu] bsdiff:%llu (%f)\n",
+                  bsdiff_content->from_checksum, (unsigned long long)tmp_from_len,
+                  to_checksum, (unsigned long long)tmp_to_len,
+                  (unsigned long long)payload_size,
+                  ((double)payload_size)/tmp_to_len);
+#endif

       g_string_append_len (current_part->payload, payload, payload_size);
     }


cleanup_decimal_str() updated to handle negative values

and remove trailing . if no decimals

--- user/utils.c
+++ user/utils.c
@@ -194,10 +194,10 @@
 }

 ICACHE_FLASH_ATTR void cleanup_decimal_str(char *decimal_str, char *cleaned_up_str, unsigned int length) {
-	uint32_t value_int, value_frac;
+	int32_t value_int, value_frac;
 	char *pos;
 	uint8_t decimals = 0;
-	uint8_t prepend_zeroes;
+	int8_t prepend_zeroes;
 	char zeroes[8];

 	memcpy(cleaned_up_str, decimal_str, length);
@@ -207,7 +207,7 @@
 	if (pos == NULL) {
 		// non fractional number
 		value_int = atoi(cleaned_up_str);
-		tfp_snprintf(cleaned_up_str, length, "%u", value_int);
+		tfp_snprintf(cleaned_up_str, length, "%d", value_int);
 	}
 	else {
 		// parse frac
@@ -216,19 +216,26 @@
 			decimals++;
 		}
 		value_frac = atoi(pos + 1);
-		prepend_zeroes = decimals - decimal_number_length(atoi(pos + 1));
+		if (value_frac) {
+			prepend_zeroes = decimals - decimal_number_length(atoi(pos + 1));

-		zeroes[0] = 0;	// null terminate
-		while (prepend_zeroes--) {
-			strcat(zeroes, "0");
-		}
-
+			zeroes[0] = 0;	// null terminate
+			while (prepend_zeroes-- > 0) {
+				strcat(zeroes, "0");
+			}
+		}
+
 		// parse int
 		strncpy(cleaned_up_str, decimal_str, (pos - cleaned_up_str));
 		cleaned_up_str[cleaned_up_str - pos] = 0;	// null terminate
 		value_int = atoi(cleaned_up_str);
-
-		tfp_snprintf(cleaned_up_str, length, "%u.%s%u", value_int, zeroes, value_frac);
+
+		if (value_frac) {
+			tfp_snprintf(cleaned_up_str, length, "%d.%s%u", value_int, zeroes, value_frac);
+		}
+		else {
+			tfp_snprintf(cleaned_up_str, length, "%d", value_int);
+		}
 	}
 }


common.c: clean up includes

common.c: clean up includes

--- src/common.c
+++ src/common.c
@@ -1,22 +1,15 @@
 #include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <strings.h>
 #include <sys/time.h>

 #include <bsd/string.h>

-#include <nanomsg/nn.h>
-#include <nanomsg/inproc.h>
-#include <nanomsg/ipc.h>
-#include <nanomsg/tcp.h>
-#include <nanomsg/pair.h>
-#include <nanomsg/pubsub.h>
-#include <nanomsg/reqrep.h>
-#include <nanomsg/pipeline.h>
-#include <nanomsg/survey.h>
-#include <nanomsg/bus.h>
-
 #include <pcap/pcap.h>
+
+#include <rte_log.h>

 #include "common.h"
 #include "sdn_sensor.h"


Begin addressing non-blocking/chunked behavior

--- src/coap/encoder/streambuf.h
+++ src/coap/encoder/streambuf.h
@@ -18,6 +18,8 @@
 // experimental replacement for netbuf encoder.  it's possible streambufs
 // are an all around replacement for netbufs, or at least most of the time
 // TODO: Still need to address partial (chunked) writes
+// NOTE: header and token no chunking is not planned, we'd have to employ HeaderEncoder and
+// TokenEncoder.  That use case is an edge case, since maximum size of header + token = 12 bytes
 template <class TStreambuf>
 class StreambufEncoder
 {
@@ -44,6 +46,7 @@

 protected:
     typedef typename streambuf_type::char_type char_type;
+    typedef typename streambuf_type::traits_type traits_type;

     TStreambuf streambuf;
     moducom::coap::OptionEncoder option_encoder;
@@ -86,6 +89,7 @@
     void header(const moducom::coap::Header& header)
     {
         _assert(state_type::Uninitialized);
+        // TODO: Chunked not handled, but we could still check for fail to write
         sputn(header.bytes, 4);
         state(state_type::HeaderDone);
     }
@@ -94,6 +98,7 @@
     // NOTE: token size must have already been specified in header!
     void token(const estd::const_buffer token)
     {
+        // TODO: Chunked not handled, but we could still check for fail to write
         sputn(token.data(), token.size());
     }

@@ -106,7 +111,10 @@
         token(ctx.token());
     }

-    void option(moducom::coap::Option::Numbers number, uint16_t length = 0)
+    // returns false if chunking is needed
+    // returns true if entire data was output
+    // NOTE: interrogating option state may be a better way to ascertain that info
+    bool option(moducom::coap::Option::Numbers number, uint16_t length = 0)
     {
         option_type option(number);

@@ -120,40 +128,59 @@
         do
         {
             result = option_encoder.generate_iterate();
-            if(result != -1) rdbuf()->sputc(result);
+            if(result != -1)
+            {
+                if(rdbuf()->sputc(result) == traits_type::eof())
+                {
+                    return false;
+                }
+            }

         }   while(
                 (option_encoder.state() != option_encoder.OptionDeltaAndLengthDone) &&
                 (option_encoder.state() != option_encoder.OptionLengthDone));

+        return true;
     }

     template <class TImpl>
-    void option(moducom::coap::Option::Numbers number, estd::internal::allocated_array<TImpl>& a)
-    {
-        option(number, a.size());
-
+    bool option(moducom::coap::Option::Numbers number, estd::internal::allocated_array<TImpl>& a)
+    {
+        if(!option(number, a.size())) return false;
+
+        // FIX: following code is limited.  Firstly, we do it to avoid
+        // having to do a lock/unlock on a, but really, is it that big a deal?
+        // Secondly, since we're interacting with buffers directly, no sync/underflow
+        // and friends get to run, so something like a netbuf-expand never can happen
         streambuf_type* sb = rdbuf();

         int copied = a.copy(sb->pptr(), remaining());

         sb->pubseekoff(copied, estd::ios_base::cur, estd::ios_base::out);
-    }
-
-    void option(moducom::coap::Option::Numbers number, const char* str)
+
+        // FIX: we definitely don't have gaurunteed success here
+        // and we don't address chunking yet at all (I don't remember if OptionsEncoder helped us
+        // with that... I think it does)
+        return true;
+    }
+
+    bool option(moducom::coap::Option::Numbers number, const char* str)
     {
         int n = strlen(str);
         option(number, n);
-        rdbuf()->sputn(str, n);
+        estd::streamsize written = rdbuf()->sputn(str, n);
+        // FIX: we don't address chunking yet at all, even with this (how does it know
+        // where in the string to resume from?)
+        return written == n;
     }

     // NOTE: Only generates payload marker
     // TODO: Make state machine participate too, maybe with a default flag to turn off if we really really don't
     // want those extra few bytes generated
-    void payload()
-    {
-        rdbuf()->sputc(COAP_PAYLOAD_MARKER);
+    bool payload()
+    {
+        return rdbuf()->sputc(COAP_PAYLOAD_MARKER) != traits_type::eof();
     }

     this_type& operator<<(this_type& (*__pf)(this_type&))


Update MP tables comments in rombios

Update MP tables comments in rombios

--- bios/rombios.c
+++ bios/rombios.c
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////
-// $Id: rombios.c,v 1.136 2005/04/30 11:10:12 vruppert Exp $
+// $Id: rombios.c,v 1.137 2005/05/04 16:05:05 sshwarts Exp $
 /////////////////////////////////////////////////////////////////////////
 //
 //  Copyright (C) 2002  MandrakeSoft S.A.
@@ -933,10 +933,10 @@

 #endif // BX_ELTORITO_BOOT

-static char bios_cvs_version_string[] = "$Revision: 1.136 $";
-static char bios_date_string[] = "$Date: 2005/04/30 11:10:12 $";
-
-static char CVSID[] = "$Id: rombios.c,v 1.136 2005/04/30 11:10:12 vruppert Exp $";
+static char bios_cvs_version_string[] = "$Revision: 1.137 $";
+static char bios_date_string[] = "$Date: 2005/05/04 16:05:05 $";
+
+static char CVSID[] = "$Id: rombios.c,v 1.137 2005/05/04 16:05:05 sshwarts Exp $";

 /* Offset to skip the CVS $Id: prefix */
 #define bios_version_string  (CVSID + 4)
@@ -10375,7 +10375,7 @@
   db 0 ;; entry type=processor
   db 0 ;; local APIC id
   db 0x11 ;; local APIC version number
-  db 3 ;; cpu flags: enabled
+  db 3 ;; cpu flags: enabled, bootstrap processor
   db 0,6,0,0 ;; cpu signature
   dw 0x201,0 ;; feature flags
   dw 0,0 ;; reserved
@@ -10537,7 +10537,7 @@
   db 0 ;; entry type=processor
   db 0 ;; local APIC id
   db 0x11 ;; local APIC version number
-  db 3 ;; cpu flags: bootstrap cpu
+  db 3 ;; cpu flags: enabled, bootstrap processor
   db 0,6,0,0 ;; cpu signature
   dw 0x201,0 ;; feature flags
   dw 0,0 ;; reserved


usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers

When a device with an isochronous endpoint is plugged into the Intel
xHCI host controller, and the driver submits multiple frames per URB,
the xHCI driver will set the Block Event Interrupt (BEI) flag on all
but the last TD for the URB. This causes the host controller to place
an event on the event ring, but not send an interrupt. When the last
TD for the URB completes, BEI is cleared, and we get an interrupt for
the whole URB.

However, under Intel xHCI host controllers, if the event ring is full
of events from transfers with BEI set,  an "Event Ring is Full" event
will be posted to the last entry of the event ring,  but no interrupt
is generated. Host will cease all transfer and command executions and
wait until software completes handling the pending events in the event
ring.  That means xHC stops, but event of "event ring is full" is not
notified. As the result, the xHC looks like dead to user.

This patch is to apply XHCI_AVOID_BEI quirk to Intel xHC devices. And
it should be backported to kernels as old as 3.0, that contains the
commit 69e848c2090a ("Intel xhci: Support EHCI/xHCI port switching.").

Signed-off-by: Lu Baolu <0e8503a5d55e00d5d2190cff62ef5fd449aa2247@linux.intel.com>
Tested-by: Alistair Grant <df8e111b95186458e65b3f4a6227144a4849805f@gmail.com>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Signed-off-by: Mathias Nyman <2d4473c5e67eb83655334d4e9a7757f781607241@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/usb/host/xhci-pci.c
+++ drivers/usb/host/xhci-pci.c
@@ -115,6 +115,7 @@
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
 		xhci->quirks |= XHCI_LPM_SUPPORT;
 		xhci->quirks |= XHCI_INTEL_HOST;
+		xhci->quirks |= XHCI_AVOID_BEI;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 			pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
@@ -130,7 +131,6 @@
 		 * PPT chipsets.
 		 */
 		xhci->quirks |= XHCI_SPURIOUS_REBOOT;
-		xhci->quirks |= XHCI_AVOID_BEI;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 		pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) {


pango-render: set CLAMP_TO_EDGE wrap mode on glyph_material

The pango renderer was causing lots of override materials to be allocated
because the vertex_buffer API converts AUTOMATIC mode into REPEAT for
backwards compatibility. By explicitly setting the wrap mode to
CLAMP_TO_EDGE when creating the glyph_material then the vertex_buffer
API will leave it untouched.

--- pango/cogl-pango-render.c
+++ pango/cogl-pango-render.c
@@ -139,6 +139,8 @@
   cogl_material_set_layer_combine (priv->glyph_material, 0, /* layer */
                                    "RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
                                    NULL);
+  cogl_material_set_layer_wrap_mode (priv->glyph_material, 0,
+                                     COGL_MATERIAL_WRAP_MODE_CLAMP_TO_EDGE);

   priv->solid_material = cogl_material_new ();


base: CONCAT macros for token merge

base: CONCAT macros for token merge

--- usual/base.h
+++ usual/base.h
@@ -90,6 +90,22 @@
 #define FLEX_ARRAY 1
 #endif

+/** Make string token from C expression */
+#define STR(x) _STR_(x)
+#define _STR_(x) #x
+
+/** Make single C token from 2 separate tokens */
+#define CONCAT(a, b)    _CONCAT_(a, b)
+#define _CONCAT_(a, b)  a ## b
+
+/** Make single C token from 3 separate tokens */
+#define CONCAT3(a, b, c)     _CONCAT3_(a, b, c)
+#define _CONCAT3_(a, b, c)  a ## b ## c
+
+/** Make single C token from 4 separate tokens */
+#define CONCAT4(a, b, c, d)    _CONCAT4_(a, b, c, d)
+#define _CONCAT4_(a, b, c, d)  a ## b ## c ## d
+
 /**
  * @name Compiler attributes.
  */
@@ -185,9 +201,5 @@
 int posix_memalign(void **ptr_p, size_t align, size_t len);
 #endif

-/** cpp expr -> string */
-#define STR(x) _STR_(x)
-#define _STR_(x) #x
-
-#endif
-
+#endif
+


common.c: Add STLINK_CHIPID_STM32_F410 for correct flash loader selection

--- src/common.c
+++ src/common.c
@@ -1617,9 +1617,16 @@
             || sl->chip_id == STLINK_CHIPID_STM32_F334) {
         loader_code = loader_code_stm32vl;
         loader_size = sizeof(loader_code_stm32vl);
-    } else if (sl->chip_id == STLINK_CHIPID_STM32_F2 || sl->chip_id == STLINK_CHIPID_STM32_F4 || (sl->chip_id == STLINK_CHIPID_STM32_F4_DE) ||
-            sl->chip_id == STLINK_CHIPID_STM32_F4_LP || sl->chip_id == STLINK_CHIPID_STM32_F4_HD || (sl->chip_id == STLINK_CHIPID_STM32_F411RE) ||
-            (sl->chip_id == STLINK_CHIPID_STM32_F446) || (sl->chip_id == STLINK_CHIPID_STM32_F4_DSI)){
+    } else if (sl->chip_id == STLINK_CHIPID_STM32_F2      ||
+		sl->chip_id == STLINK_CHIPID_STM32_F4     ||
+		sl->chip_id == STLINK_CHIPID_STM32_F4_DE  ||
+		sl->chip_id == STLINK_CHIPID_STM32_F4_LP  ||
+		sl->chip_id == STLINK_CHIPID_STM32_F4_HD  ||
+		sl->chip_id == STLINK_CHIPID_STM32_F4_DSI ||
+		sl->chip_id == STLINK_CHIPID_STM32_F410   ||
+		sl->chip_id == STLINK_CHIPID_STM32_F411RE ||
+		sl->chip_id == STLINK_CHIPID_STM32_F446
+		) {
         int voltage = stlink_target_voltage(sl);
         if (voltage == -1) {
             printf("Failed to read Target voltage\n");


actually use inversion method in parameter object

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@24346 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/include/deal.II/lac/relaxation_block.templates.h
+++ deal.II/include/deal.II/lac/relaxation_block.templates.h
@@ -63,6 +63,7 @@
 //  Assert (M.m() == M.n(), ExcNotQuadratic());
   A = &M;
   additional_data = &parameters;
+  this->inversion = parameters.inversion;

   this->reinit(additional_data->block_list.size(), 0, additional_data->same_diagonal,
 	       additional_data->inversion);


usb: musb: disable OTG AUTOIDLE only with omap3430

Omap3 MUSB AUTOIDLE functionality configured through OTG_SYSCONFIG
register prevents the device from going into retention.
This is a workaround (by Richard Woodruff/TI), as his comment :
> A new MUSB bug which is a match to data below was identified very
> recently (on hardware and in simulation).
> This bug is in 3430 and not 3630.
> As a priority test (and as new default) you should have engineers
> disable autoidle for MUSB block.
> This is the workaround which will show up in next errata.

Signed-off-by: Niilo Minkkinen <445c737babfef66ccf1fedf71ba9cb7a8ded7fe5@nokia.com>
Signed-off-by: Richard Woodruff <d8b9d570e15139334144aba9361d2590e55fc625@ti.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/musb/omap2430.c
+++ drivers/usb/musb/omap2430.c
@@ -227,7 +227,12 @@
 	l &= ~AUTOIDLE;		/* disable auto idle */
 	l &= ~NOIDLE;		/* remove possible noidle */
 	l |= SMARTIDLE;		/* enable smart idle */
-	l |= AUTOIDLE;		/* enable auto idle */
+	/*
+	 * MUSB AUTOIDLE don't work in 3430.
+	 * Workaround by Richard Woodruff/TI
+	 */
+	if (!cpu_is_omap3430())
+		l |= AUTOIDLE;		/* enable auto idle */
 	omap_writel(l, OTG_SYSCONFIG);

 	l = omap_readl(OTG_INTERFSEL);


Made posit compile for GNU g++ with C++11

--- bitblock/ubb.h
+++ bitblock/ubb.h
@@ -169,8 +169,10 @@
 		constexpr BaseBitset() noexcept
 			: M_w() { }

-
-		constexpr BaseBitset(unsigned long long val) noexcept
+#if __cplusplus >= 201402L
+    constexpr
+#endif
+		BaseBitset(unsigned long long val) noexcept
 		{
 			for (size_t i = 0; i < Nw; ++i) {
 				M_w[i] = WordT(val);


Play with span size a bit.

Play with span size a bit.

Signed-off-by: Michael Lippautz <0d543840881a2c189b4f7636b15eebd6a8f60ace@gmail.com>

--- src/common.h
+++ src/common.h
@@ -20,7 +20,7 @@
 #define TLS_MODE __attribute__((tls_model ("initial-exec")))

 // Number of system pages forming a block
-const size_t kPageMultiple = 16;
+const size_t kPageMultiple = 4;

 const size_t kMinAlignment = 16;


USB: option.c remove duplicate device ids now supported in hso.c

Remove duplicate device ids which are now supported by drivers/usb/net/hso.c

Signed-off-by: Denis Joseph Barrow <da3a69db47edb26548831fecf9552063bddcad04@option.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/serial/option.c
+++ drivers/usb/serial/option.c
@@ -79,27 +79,16 @@
 #define OPTION_PRODUCT_VIPER			0x6600
 #define OPTION_PRODUCT_VIPER_BUS		0x6601
 #define OPTION_PRODUCT_GT_MAX_READY		0x6701
-#define OPTION_PRODUCT_GT_MAX			0x6711
 #define OPTION_PRODUCT_FUJI_MODEM_LIGHT		0x6721
 #define OPTION_PRODUCT_FUJI_MODEM_GT		0x6741
 #define OPTION_PRODUCT_FUJI_MODEM_EX		0x6761
-#define OPTION_PRODUCT_FUJI_NETWORK_LIGHT	0x6731
-#define OPTION_PRODUCT_FUJI_NETWORK_GT		0x6751
-#define OPTION_PRODUCT_FUJI_NETWORK_EX		0x6771
 #define OPTION_PRODUCT_KOI_MODEM		0x6800
-#define OPTION_PRODUCT_KOI_NETWORK		0x6811
 #define OPTION_PRODUCT_SCORPION_MODEM		0x6901
-#define OPTION_PRODUCT_SCORPION_NETWORK		0x6911
 #define OPTION_PRODUCT_ETNA_MODEM		0x7001
-#define OPTION_PRODUCT_ETNA_NETWORK		0x7011
 #define OPTION_PRODUCT_ETNA_MODEM_LITE		0x7021
 #define OPTION_PRODUCT_ETNA_MODEM_GT		0x7041
 #define OPTION_PRODUCT_ETNA_MODEM_EX		0x7061
-#define OPTION_PRODUCT_ETNA_NETWORK_LITE	0x7031
-#define OPTION_PRODUCT_ETNA_NETWORK_GT		0x7051
-#define OPTION_PRODUCT_ETNA_NETWORK_EX		0x7071
 #define OPTION_PRODUCT_ETNA_KOI_MODEM		0x7100
-#define OPTION_PRODUCT_ETNA_KOI_NETWORK		0x7111

 #define HUAWEI_VENDOR_ID			0x12D1
 #define HUAWEI_PRODUCT_E600			0x1001
@@ -239,27 +228,16 @@
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER_BUS) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GT_MAX_READY) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GT_MAX) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_LIGHT) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_GT) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_EX) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_LIGHT) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_GT) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_EX) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_KOI_MODEM) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_KOI_NETWORK) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_SCORPION_MODEM) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_SCORPION_NETWORK) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_LITE) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_GT) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_EX) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_LITE) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_GT) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) },
-	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },


Input checks.

Input checks.

--- efpmd/parse.c
+++ efpmd/parse.c
@@ -272,38 +272,36 @@
 	return false;
 }

+static bool int_gt_zero(void *val)
+{
+	return *(int *)val > 0;
+}
+
+static bool double_gt_zero(void *val)
+{
+	return *(double *)val > 0.0;
+}
+
 static const struct {
 	const char *name;
 	const char *default_value;
 	bool (*parse_fn)(char **, void *);
+	bool (*check_fn)(void *);
 	size_t member_offset;
 } config_list[] = {
-	{ "run_type",     "sp",
-		parse_string,    offsetof(struct config, run_type)     },
-	{ "coord",        "xyzabc",
-		parse_coord,     offsetof(struct config, coord_type)   },
-	{ "units",        "angs",
-		parse_units,     offsetof(struct config, units_factor) },
-	{ "terms",        "elec pol disp xr",
-		parse_terms,     offsetof(struct config, terms)        },
-	{ "elec_damp",    "screen",
-		parse_elec_damp, offsetof(struct config, elec_damp)    },
-	{ "disp_damp",    "tt",
-		parse_disp_damp, offsetof(struct config, disp_damp)    },
-	{ "max_steps",    "100",
-		parse_int,       offsetof(struct config, max_steps)    },
-	{ "print_step",   "1",
-		parse_int,       offsetof(struct config, print_step)   },
-	{ "temperature",  "300.0",
-		parse_double,    offsetof(struct config, temperature)  },
-	{ "time_step",    "1.0",
-		parse_double,    offsetof(struct config, time_step)    },
-	{ "opt_tol",      "1.0e-4",
-		parse_double,    offsetof(struct config, opt_tol)      },
-	{ "fraglib_path", ".",
-		parse_string,    offsetof(struct config, fraglib_path) },
-	{ "userlib_path", ".",
-		parse_string,    offsetof(struct config, userlib_path) }
+	{ "run_type",     "sp",               parse_string,    NULL,           offsetof(struct config, run_type)     },
+	{ "coord",        "xyzabc",           parse_coord,     NULL,           offsetof(struct config, coord_type)   },
+	{ "units",        "angs",             parse_units,     NULL,           offsetof(struct config, units_factor) },
+	{ "terms",        "elec pol disp xr", parse_terms,     NULL,           offsetof(struct config, terms)        },
+	{ "elec_damp",    "screen",           parse_elec_damp, NULL,           offsetof(struct config, elec_damp)    },
+	{ "disp_damp",    "tt",               parse_disp_damp, NULL,           offsetof(struct config, disp_damp)    },
+	{ "max_steps",    "100",              parse_int,       int_gt_zero,    offsetof(struct config, max_steps)    },
+	{ "print_step",   "1",                parse_int,       int_gt_zero,    offsetof(struct config, print_step)   },
+	{ "temperature",  "300.0",            parse_double,    double_gt_zero, offsetof(struct config, temperature)  },
+	{ "time_step",    "1.0",              parse_double,    double_gt_zero, offsetof(struct config, time_step)    },
+	{ "opt_tol",      "1.0e-4",           parse_double,    double_gt_zero, offsetof(struct config, opt_tol)      },
+	{ "fraglib_path", ".",                parse_string,    NULL,           offsetof(struct config, fraglib_path) },
+	{ "userlib_path", ".",                parse_string,    NULL,           offsetof(struct config, userlib_path) }
 };

 static void parse_field(struct stream *stream, struct config *config)
@@ -318,6 +316,11 @@

 			if (!config_list[i].parse_fn(&stream->ptr, (char *)config + offset))
 				error("UNABLE TO READ OPTION %s", name);
+
+			bool (*check_fn)(void *) = config_list[i].check_fn;
+
+			if (check_fn && !check_fn((char *)config + offset))
+				error("OPTION %s HAS OUT OF RANGE VALUE", name);

 			return;
 		}


common BUGFIX wrong string format used

common BUGFIX wrong string format used

--- src/common.h
+++ src/common.h
@@ -103,15 +103,15 @@
 #define LY_CHECK_ARG_RET(CTX, ...) GETMACRO4(__VA_ARGS__, LY_CHECK_ARG_RET3, LY_CHECK_ARG_RET2, LY_CHECK_ARG_RET1)(CTX, __VA_ARGS__)

 #define LY_VCODE_INCHAR      LYVE_SYNTAX, "Invalid character 0x%x."
-#define LY_VCODE_INSTREXP    LYVE_SYNTAX, "Invalid character sequence \"%.*s\", expected \"%s\"."
+#define LY_VCODE_INSTREXP    LYVE_SYNTAX, "Invalid character sequence \"%.*s\", expected %s."
 #define LY_VCODE_EOF         LYVE_SYNTAX, "Unexpected end-of-file."
 #define LY_VCODE_INSTMT      LYVE_SYNTAX_YANG, "Invalid keyword \"%s\"."
 #define LY_VCODE_INCHILDSTMT LYVE_SYNTAX_YANG, "Invalid keyword \"%s\" as a child of \"%s\"."
 #define LY_VCODE_DUPSTMT     LYVE_SYNTAX_YANG, "Duplicate keyword \"%s\"."
-#define LY_VCODE_INVAL       LYVE_SYNTAX_YANG, "Invalid value \"%*.s\" of \"%s\"."
+#define LY_VCODE_INVAL       LYVE_SYNTAX_YANG, "Invalid value \"%.*s\" of \"%s\"."
 #define LY_VCODE_MISSTMT     LYVE_SYNTAX_YANG, "Missing mandatory keyword \"%s\" as a child of \"%s\"."
 #define LY_VCODE_INORD       LYVE_SYNTAX_YANG, "Invalid keyword \"%s\", it cannot appear after \"%s\"."
-#define LY_VCODE_OOB         LYVE_SYNTAX_YANG, "Value \"%*.s\" is out of \"%s\" bounds."
+#define LY_VCODE_OOB         LYVE_SYNTAX_YANG, "Value \"%.*s\" is out of \"%s\" bounds."
 #define LY_VCODE_INDEV       LYVE_SYNTAX_YANG, "Deviate \"%s\" does not support keyword \"%s\"."

 /*


USB: option: TLAYTECH TUE800 support

USB: option: TLAYTECH TUE800 support

Add ID for Tlaytech TUE800 CDMA modem to the option driver.

Signed-off-by: Bryan Wu <465f0e91e61585f5bc1128e7fe63296c33a56926@canonical.com>
Acked-By: Matthias Urlichs <e388d34fd3c0456122779e95f262c0d70198a168@urlichs.de>
Cc: stable <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/serial/option.c
+++ drivers/usb/serial/option.c
@@ -315,6 +315,9 @@
 #define QISDA_PRODUCT_H20_4515			0x4515
 #define QISDA_PRODUCT_H20_4519			0x4519

+/* TLAYTECH PRODUCTS */
+#define TLAYTECH_VENDOR_ID			0x20B9
+#define TLAYTECH_PRODUCT_TEU800			0x1682

 /* TOSHIBA PRODUCTS */
 #define TOSHIBA_VENDOR_ID			0x0930
@@ -593,6 +596,7 @@
 	{ USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) },
 	{ USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
+	{ USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
 	{ } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);


update common.h

update common.h

--- src/common.h
+++ src/common.h
@@ -7,7 +7,7 @@
 */

 #pragma once
-#include <stringstream>
+#include <sstream>
 #include <string>
 #include <string.h>
 #include <stdexcept>


provide a FreeBusy visitor for CanDeleteIncidenceVisitor.
this eliminates a hidden virtual warning.

svn path=/trunk/KDE/kdepim/; revision=776382

--- korganizer/calendarview.h
+++ korganizer/calendarview.h
@@ -118,6 +118,7 @@
         bool visit( Event *event ) { return mView->deleteEvent( event ); }
         bool visit( Todo *todo ) { return mView->deleteTodo( todo ); }
         bool visit( Journal *journal ) { return mView->deleteJournal( journal ); }
+        bool visit( FreeBusy * ) { return false; }
     };

     void setCalendar( Calendar * );


USB: option: Remove unused variable

USB: option: Remove unused variable

After commit f092c240494f2d807401d93f95f683909b90af96 ("USB: option:
remove unnecessary and erroneous code") the variable 'serial' becomes
unused, as gcc-4.3.2 points out:

drivers/usb/serial/option.c: In function 'option_instat_callback':
drivers/usb/serial/option.c:834: warning: unused variable 'serial'
drivers/usb/serial/option.c: In function 'option_open':
drivers/usb/serial/option.c:930: warning: unused variable 'serial'

So I removed it.

Signed-off-by: Carlos R. Mafra <cf1689817972fafea96902fa9a4e7da1203c343f@aei.mpg.de>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/serial/option.c
+++ drivers/usb/serial/option.c
@@ -831,7 +831,6 @@
 	int status = urb->status;
 	struct usb_serial_port *port =  urb->context;
 	struct option_port_private *portdata = usb_get_serial_port_data(port);
-	struct usb_serial *serial = port->serial;

 	dbg("%s", __func__);
 	dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata);
@@ -927,7 +926,6 @@
 			struct usb_serial_port *port, struct file *filp)
 {
 	struct option_port_private *portdata;
-	struct usb_serial *serial = port->serial;
 	int i, err;
 	struct urb *urb;


Use Postgres for item lookups when available.

--- quilt/item.c
+++ quilt/item.c
@@ -40,12 +40,52 @@
 	SPARQL *sparql;
 	SPARQLRES *res;
 	SPARQLROW *row;
+	SQL_STATEMENT *rs;
 	librdf_node *node;
 	librdf_uri *uri;
 	const char *uristr;
 	size_t l;
-	char *buf;
-
+	const char *t;
+	char *buf, *p;
+
+	if(spindle_db)
+	{
+		rs = sql_queryf(spindle_db, "SELECT \"id\" FROM \"proxy\" WHERE %Q = ANY(\"sameas\")", target);
+		if(!rs)
+		{
+			return 500;
+		}
+		if(sql_stmt_eof(rs))
+		{
+			sql_stmt_destroy(rs);
+			return 404;
+		}
+		buf = (char *) calloc(1, 1 + 32 + 4 + 1);
+		if(!buf)
+		{
+			quilt_logf(LOG_CRIT, QUILT_PLUGIN_NAME ": failed to allocate buffer for redirect URL\n");
+			sql_stmt_destroy(rs);
+			return 500;
+		}
+		buf[0] = '/';
+		p = &(buf[1]);
+		for(t = sql_stmt_str(rs, 0); *t; t++)
+		{
+			if(isalnum(*t))
+			{
+				*p = *t;
+				p++;
+			}
+		}
+		strcpy(p, "#id");
+		sql_stmt_destroy(rs);
+		quilt_request_printf(request, "Status: 303 See other\n"
+							 "Server: Quilt/" PACKAGE_VERSION "\n"
+							 "Location: %s\n"
+							 "\n", buf);
+		free(buf);
+		return 0;
+	}
 	sparql = quilt_sparql();
 	if(!sparql)
 	{


use singly-linked list

use singly-linked list

--- src/config.c
+++ src/config.c
@@ -32,8 +32,8 @@
 static const char* CJK_WIDTH_NARROW = "narrow";
 static const char* CJK_WIDTH_WIDE = "wide";

-static GList* str_config_fields = NULL;
-static GList* int_config_fields = NULL;
+static GSList* str_config_fields = NULL;
+static GSList* int_config_fields = NULL;

 void init_config_fields() {
   const char* base_str_config_fields[] = {
@@ -58,26 +58,26 @@

   // Initialize string fields
   for (unsigned i = 0; i < sizeof(base_str_config_fields) / sizeof(char*); i++) {
-    str_config_fields = g_list_append(str_config_fields, g_strdup(base_str_config_fields[i]));
+    str_config_fields = g_slist_append(str_config_fields, g_strdup(base_str_config_fields[i]));
   }
   // Append `color_123` field
   char numbered_color_key[10];
   for (unsigned i = 0; i < 256; i++) {
     sprintf(numbered_color_key, "color_%d", i);
-    str_config_fields = g_list_append(str_config_fields, g_strdup(numbered_color_key));
+    str_config_fields = g_slist_append(str_config_fields, g_strdup(numbered_color_key));
   }

   // Initialize integer fields
   for (unsigned i = 0; i < sizeof(base_int_config_fields) / sizeof(char*); i++) {
-    int_config_fields = g_list_append(int_config_fields, g_strdup(base_int_config_fields[i]));
+    int_config_fields = g_slist_append(int_config_fields, g_strdup(base_int_config_fields[i]));
   }
 }

 void close_config_fields() {
-  g_list_foreach(str_config_fields, (GFunc)g_free, NULL);
-  g_list_foreach(int_config_fields, (GFunc)g_free, NULL);
-  g_list_free(str_config_fields);
-  g_list_free(int_config_fields);
+  g_slist_foreach(str_config_fields, (GFunc)g_free, NULL);
+  g_slist_foreach(int_config_fields, (GFunc)g_free, NULL);
+  g_slist_free(str_config_fields);
+  g_slist_free(int_config_fields);
 }

 char* get_default_shell() {
@@ -198,7 +198,7 @@
   config_set_str(c, "font", "");
   config_set_str(c, "cjk_width", CJK_WIDTH_NARROW);
   config_set_str(c, "cursor_blink_mode", CURSOR_BLINK_MODE_SYSTEM);
-  for (GList* li = str_config_fields; li != NULL; li = li->next) {
+  for (GSList* li = str_config_fields; li != NULL; li = li->next) {
     const char* key = (char *)li->data;
     // Set empty value if start with "color_"
     if (0 == g_ascii_strncasecmp(key, "color_", 6)) {
@@ -230,7 +230,7 @@

   lua_newtable(l);
   // Push string fields
-  for (GList* li = str_config_fields; li != NULL; li = li->next) {
+  for (GSList* li = str_config_fields; li != NULL; li = li->next) {
     const char* key = (char*)li->data;
     const char* value = config_get_str(c, key);
     lua_pushstring(l, key);
@@ -238,7 +238,7 @@
     lua_settable(l, -3);
   }
   // Push int fields
-  for (GList* li = int_config_fields; li != NULL; li = li->next) {
+  for (GSList* li = int_config_fields; li != NULL; li = li->next) {
     const char* key = (char*)li->data;
     int value = config_get_int(c, key);
     lua_pushstring(l, key);
@@ -259,14 +259,14 @@

   lua_getglobal(l, "config");
   // Store string fields
-  for (GList* li = str_config_fields; li != NULL; li = li->next) {
+  for (GSList* li = str_config_fields; li != NULL; li = li->next) {
     const char* key = (char *)li->data;
     lua_getfield(l, -1, key);
     config_set_str(c, key, lua_tostring(l, -1));
     lua_pop(l, 1);
   }
   // Store int fields
-  for (GList* li = int_config_fields; li != NULL; li = li->next) {
+  for (GSList* li = int_config_fields; li != NULL; li = li->next) {
     const char* key = (char *)li->data;
     lua_getfield(l, -1, key);
     config_set_int(c, key, lua_tointeger(l, -1));


USB: sierra: remove unused variable

USB: sierra: remove unused variable

Remove unused variable from sierra_release_urb.

Signed-off-by: Johan Hovold <6a430eed381e126d51a8cce8db662f765ce314bc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/usb/serial/sierra.c
+++ drivers/usb/serial/sierra.c
@@ -419,9 +419,7 @@

 static void sierra_release_urb(struct urb *urb)
 {
-	struct usb_serial_port *port;
 	if (urb) {
-		port = urb->context;
 		kfree(urb->transfer_buffer);
 		usb_free_urb(urb);
 	}


oops, wrong input WCS to SIP tweak

oops, wrong input WCS to SIP tweak

git-svn-id: a4967eeb46e72ec0d67de3341f099b34cc11cf18@14930 03a3cea6-2c03-0410-ac9b-9271b1c66c29

--- blind/tweak2.c
+++ blind/tweak2.c
@@ -98,7 +98,6 @@
 			int besti, Nmatch;
 			int* theta;
 			double* odds;
-			tan_t newtan;

 			// Anneal
 			gamma = pow(0.9, step);
@@ -218,7 +217,7 @@
 					dl_append(wts, weights[i]);
 				}
 				tweak_push_correspondence_indices(t, imginds, refinds, NULL, wts);
-				tweak_push_wcs_tan(t, &newtan);
+				tweak_push_wcs_tan(t, &sipout->wcstan);
 				t->sip->a_order = t->sip->b_order = t->sip->ap_order = t->sip->bp_order = order;
 				t->weighted_fit = TRUE;
 				for (i=0; i<10; i++) {


Spacing

Spacing

--- src/config.c
+++ src/config.c
@@ -880,7 +880,7 @@
 	return (KORE_RESULT_OK);
 }

-#endif /* ! KORE_NO_HTTP */
+#endif /* !KORE_NO_HTTP */

 static int
 configure_chroot(char **argv)


fix indent

fix indent

--- src/config.c
+++ src/config.c
@@ -586,7 +586,7 @@
 	const char *rv = oidc_parse_enc_kid_key_tuple(cmd->pool, arg, &kid, &fname,
 			&fname_len, FALSE);
 	if (rv != NULL)
-	return rv;
+		return rv;

 	if (oidc_jwk_parse_rsa_private_key(cmd->pool, kid, fname, &jwk, &err) == FALSE) {
 		return apr_psprintf(cmd->pool,


blk-mq: allow setting of per-request timeouts

Currently blk-mq uses the queue timeout for all requests. But
for some commands, drivers may want to set a specific timeout
for special requests. Allow this to be passed in through
request->timeout, and use it if set.

Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@fb.com>

--- block/blk-mq.c
+++ block/blk-mq.c
@@ -454,9 +454,13 @@
 	/*
 	 * Just mark start time and set the started bit. Due to memory
 	 * ordering, we know we'll see the correct deadline as long as
-	 * REQ_ATOMIC_STARTED is seen.
-	 */
-	rq->deadline = jiffies + q->rq_timeout;
+	 * REQ_ATOMIC_STARTED is seen. Use the default queue timeout,
+	 * unless one has been set in the request.
+	 */
+	if (!rq->timeout)
+		rq->deadline = jiffies + q->rq_timeout;
+	else
+		rq->deadline = jiffies + rq->timeout;

 	/*
 	 * Mark us as started and clear complete. Complete might have been


fix field limiters in move part of config parsing

--- src/config.c
+++ src/config.c
@@ -42,8 +42,8 @@
 					continue;
 				}
 			} else if (!strcmp(cmd, "move")) {
-				char *cx = strtok(NULL, "\t\n");
-				char *cy = strtok(NULL, "\t\n");
+				char *cx = strtok(NULL, " \t\n");
+				char *cy = strtok(NULL, " \t\n");

 				if (!cx || !cy) {
 					warn("Failed to register move bind");


Code cleanup

Code cleanup

--- src/config.c
+++ src/config.c
@@ -134,12 +134,12 @@

 int config_load(Config * config, char const * filename)
 {
+	int ret = 0;
 	FILE * fp;
 	char * section;
 	char * variable = NULL;
 	int c;
 	char * str;
-	int ret = 0;

 	if((section = string_new("")) == NULL)
 		return 1;
@@ -175,7 +175,8 @@
 	free(variable);
 	if(!feof(fp))
 		ret = error_set_code(1, "%s: %s", filename, "Syntax error");
-	fclose(fp);
+	if(fclose(fp) != 0)
+		ret = error_set_code(1, "%s: %s", filename, strerror(errno));
 	return ret;
 }


little style fixes, part 2

little style fixes, part 2

--- src/config.c
+++ src/config.c
@@ -54,9 +54,9 @@
         /* no match, or many wildcard matches are bad */
         if (res == GLOB_NOMATCH || globbuf.gl_pathc != 1)
                 result = sstrdup(path);
-        else if (res != 0)
+        else if (res != 0) {
                 die("glob() failed");
-        else {
+        } else {
                 head = globbuf.gl_pathv[0];
                 result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1);
                 strncpy(result, head, strlen(head));


Updated copyright information

Updated copyright information

--- src/config.c
+++ src/config.c
@@ -1,5 +1,5 @@
 /* $Id$ */
-/* Copyright (c) 2008 Pierre Pronchery <khorben@defora.org> */
+/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
 /* This file is part of DeforaOS System libSystem */
 /* This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by


Fix for a typo left after merging.

Fix for a typo left after merging.

--- src/config.c
+++ src/config.c
@@ -657,6 +657,8 @@
     if (stringmatch(pattern,"lua-time-limit",0)) {
         addReplyBulkCString(c,"lua-time-limit");
         addReplyBulkLongLong(c,server.lua_time_limit);
+        matches++;
+    }
     if (stringmatch(pattern,"slowlog-log-slower-than",0)) {
         addReplyBulkCString(c,"slowlog-log-slower-than");
         addReplyBulkLongLong(c,server.slowlog_log_slower_than);


increase version to 1.1.4

increase version to 1.1.4

--- src/config.h
+++ src/config.h
@@ -5,7 +5,7 @@
 #ifndef _MICRORL_CONFIG_H_
 #define _MICRORL_CONFIG_H_

-#define MICRORL_LIB_VER "1.3"
+#define MICRORL_LIB_VER "1.4"

 /*********** CONFIG SECTION **************/
 /*


Fix the wrong detection of sync_file_range system call (#9371)

If we want to check `defined(SYNC_FILE_RANGE_WAIT_BEFORE)`, we should include fcntl.h.
otherwise, SYNC_FILE_RANGE_WAIT_BEFORE is not defined, and there is alway not `sync_file_range` system call.
Introduced by #8532

(cherry picked from commit 8edc3cd62c0d0508b68c887610ca53b632b8165b)

--- src/config.h
+++ src/config.h
@@ -36,6 +36,7 @@

 #ifdef __linux__
 #include <features.h>
+#include <fcntl.h>
 #endif

 /* Define redis_fstat to fstat or fstat64() */


Drop the sample rate until I'm sure the timing is going to work

--- src/config.h
+++ src/config.h
@@ -1,7 +1,7 @@
 #ifndef H_CONFIG
 #define H_CONFIG

-#define SAMPLE_RATE 256
+#define SAMPLE_RATE 32
 #define SAMPLE_INTERVAL (1024/SAMPLE_RATE) // close enough

 #define CHANNELS 1


Drop floats from coords.h.

Drop floats from coords.h.

--- src/coords.h
+++ src/coords.h
@@ -66,29 +66,6 @@

 typedef coord vc3[3];
 typedef coord_offset vo3[3];
-typedef float vf4[4];
-
-static inline float c2f(coord c) {
-  return c / (float)METRE;
-}
-
-static inline float o2f(coord_offset c) {
-  return c / (float)METRE;
-}
-
-static inline void c2fv4(vf4 dst, const vc3 src) {
-  dst[0] = c2f(src[0]);
-  dst[1] = c2f(src[1]);
-  dst[2] = c2f(src[2]);
-  dst[3] = 1.0f;
-}
-
-static inline void o2fv4(vf4 dst, const vo3 src) {
-  dst[0] = c2f(src[0]);
-  dst[1] = c2f(src[1]);
-  dst[2] = c2f(src[2]);
-  dst[3] = 1.0f;
-}

 static inline coord_offset torus_dist(coord_offset base_off, coord wrap_point) {
   /* By definition, abs(base_off) < wrap_point. If abs(base_off) <=


accommodate new void return from sqlite3PagerPagecount

--- src/crypto.c
+++ src/crypto.c
@@ -545,7 +545,7 @@
       **    note: don't deallocate rekey since it may be used in a subsequent iteration
       */
       rc = sqlite3BtreeBeginTrans(pDb->pBt, 1); /* begin write transaction */
-      rc = sqlite3PagerPagecount(pPager, &page_count);
+      sqlite3PagerPagecount(pPager, &page_count);
       for(pgno = 1; rc == SQLITE_OK && pgno <= page_count; pgno++) { /* pgno's start at 1 see pager.c:pagerAcquire */
         if(!sqlite3pager_is_mj_pgno(pPager, pgno)) { /* skip this page (see pager.c:pagerAcquire for reasoning) */
           rc = sqlite3PagerGet(pPager, pgno, &page);


staging/trivial: fix typos concerning "function"

Signed-off-by: Uwe Kleine-König <181323dd666a182bc2d953e52d0ac3ab54cd8391@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/intel_sst/intel_sst_stream_encoded.c
+++ drivers/staging/intel_sst/intel_sst_stream_encoded.c
@@ -171,7 +171,7 @@
 }

 /**
-* sst_get_vol - This fuction allows to get the premix gain or gain of a stream
+* sst_get_vol - This function allows to get the premix gain or gain of a stream
 *
 * @get_vol: this is an output param through which the volume
 *	structure is passed back to user
@@ -221,7 +221,7 @@
 }

 /**
-* sst_set_vol - This fuction allows to set the premix gain or gain of a stream
+* sst_set_vol - This function allows to set the premix gain or gain of a stream
 *
 * @set_vol:	this holds the volume structure that needs to be set
 *
@@ -263,7 +263,7 @@
 }

 /**
-* sst_set_mute - This fuction sets premix mute or soft mute of a stream
+* sst_set_mute - This function sets premix mute or soft mute of a stream
 *
 * @set_mute:	this holds the mute structure that needs to be set
 *
@@ -450,7 +450,7 @@
 }

 /**
- * sst_target_device_select - This fuction sets the target device configurations
+ * sst_target_device_select - This function sets the target device configurations
  *
  * @target: this parameter holds the configurations to be set
  *


comment on cache behavior

comment on cache behavior

--- src/apache2/mod_imgmin.c
+++ src/apache2/mod_imgmin.c
@@ -200,6 +200,10 @@
     unsigned char *blob;
     size_t bloblen;

+    /*
+     * calculate the cache path based on the original image contents
+     * and attempt to load its cached results
+     */
     mw = NULL;
     if (cache_path(ctx->buffer, ctx->buflen, path))
     {


Include bstrlib correctly in hashmap tests

--- tests/src/hashmap-test.c
+++ tests/src/hashmap-test.c
@@ -1,9 +1,9 @@
 #include <assert.h>
-#include <bstrlib.h>

 #include "minunit.h"
 #include "dbg.h"
 #include "hashmap.h"
+#include "bstrlib.h"

 Hashmap *map = NULL;
 static int traverse_called = 0;


builder: Note don't actually implement bloom filters

--- gvdb-builder.c
+++ gvdb-builder.c
@@ -340,6 +340,13 @@
 #undef chunk

   memset (*bloom_filter, 0, n_bloom_words * sizeof (guint32_le));
+
+  /* NOTE - the code to actually fill in the bloom filter here is missing.
+   * Patches welcome!
+   *
+   * http://en.wikipedia.org/wiki/Bloom_filter
+   * http://0pointer.de/blog/projects/bloom.html
+   */
 }

 static void


test-scroll-view: Swallow button events on the scroll-view

Due to behaviour changes in the kinetic scroll-view, dragging inside the
view was moving the window. Fix this by swallowing button events on the
scroll-view, so that they don't bubble down to the stage.

--- tests/test-scroll-view.c
+++ tests/test-scroll-view.c
@@ -41,6 +41,12 @@
   mx_adjustment_set_elastic (vadjust, on);
 }

+static gboolean
+true_cb ()
+{
+  return TRUE;
+}
+
 void
 scroll_view_main (ClutterContainer *stage)
 {
@@ -49,6 +55,12 @@
   ClutterActor *label, *elastic, *overshoot, *scroll, *kinetic, *view, *texture;

   scroll = mx_scroll_view_new ();
+
+  /* Make sure something underneath the kinetic scroll view swallows events
+   * so that we don't end up moving the window.
+   */
+  g_signal_connect (scroll, "button-press-event", G_CALLBACK (true_cb), NULL);
+
   kinetic = mx_kinetic_scroll_view_new ();

   clutter_container_add_actor (stage, scroll);


made operator<< and >> visible in the header

--- Child/Code/tArray/tArray.h
+++ Child/Code/tArray/tArray.h
@@ -14,12 +14,18 @@
 **  argument passed to the constructor or by assignment of one array
 **  to another.
 **
-**  $Id: tArray.h,v 1.14 2002-12-12 13:50:23 childcvs Exp $
+**  $Id: tArray.h,v 1.15 2002-12-12 14:47:14 childcvs Exp $
 \***************************************************************************/

 #ifndef TARRAY_H
 #define TARRAY_H

+#if !defined(HAVE_NO_NAMESPACE)
+# include <iostream>
+using namespace std;
+#else
+# include <iostream.h>
+#endif

 /***************************************************************************\
 **
@@ -56,6 +62,11 @@
     T * avalue; // the array itself
 };

+template< class T >                                               //tArray
+ostream &operator<<( ostream &output, const tArray< T > &a );
+template< class T >                                               //tArray
+ostream &operator<<( ostream &output, const tArray< T > &a );
+
 /*
 ** The following is designed to allow for compiling under the Borland-style
 ** template instantiation used by the Linux/GNU and Solaris versions of GCC


fixed problem with convertBinData() not converting root name correctly

--- pygetdns_util.c
+++ pygetdns_util.c
@@ -373,7 +373,19 @@

     size_t i;
-
+
+
+    // the root
+    if (data->size == 1 && data->data[0] == 0) {
+        PyObject *a_string;
+
+        if ((a_string = PyString_FromString(".")) == NULL)  {
+            PyErr_SetString(getdns_error, GETDNS_RETURN_GENERIC_ERROR_TEXT);
+            return NULL;
+        }
+        return(a_string);
+    }
+
     int printable = 1;
     for (i = 0; i < data->size; ++i) {
         if (!isprint(data->data[i])) {
@@ -396,16 +408,6 @@
         return(a_string);
     }

-    // the root
-    if (data->size == 1 && data->data[0] == 0) {
-        PyObject *a_string;
-
-        if ((a_string = PyString_FromString(".")) == NULL)  {
-            PyErr_SetString(getdns_error, GETDNS_RETURN_GENERIC_ERROR_TEXT);
-            return NULL;
-        }
-        return(a_string);
-    }

     // dname
     if (priv_getdns_bindata_is_dname(data)) {


Let the user know how many bytes were successfully loaded

git-svn-id: dd14d189f2554b0b3f4c2209a95c13d2029e3fe8@389 96dfbd92-d197-e211-9ca9-00110a534b34

--- v6502/main.c
+++ v6502/main.c
@@ -19,7 +19,8 @@
 #include "reverse.h"
 #include "linectl.h"

-#define MAX_COMMAND_LEN		80
+#define MAX_COMMAND_LEN			80
+#define MAX_INSTRUCTION_LEN		32

 static void fault(void *ctx, const char *error) {
 	fprintf(stderr, "fault: ");
@@ -43,6 +44,8 @@
 	while (fread(&byte, 1, 1, f)) {
 		mem->bytes[0x600 + (offset++)] = byte;
 	}
+
+	printf("Loaded %u bytes.\n", offset);

 	fclose(f);
 }
@@ -106,10 +109,10 @@
 			start = (high << 8) | low;
 		}

-		char instruction[32];
+		char instruction[MAX_INSTRUCTION_LEN];
 		int instructionLength;
 		for (int i = 0; i < 10; i++) {
-			as6502_stringForInstruction(instruction, 32, cpu->memory->bytes[start], cpu->memory->bytes[start + 2], cpu->memory->bytes[start + 1]);
+			as6502_stringForInstruction(instruction, MAX_INSTRUCTION_LEN, cpu->memory->bytes[start], cpu->memory->bytes[start + 2], cpu->memory->bytes[start + 1]);
 			instructionLength = v6502_instructionLengthForOpcode(cpu->memory->bytes[start]);

 			printf("0x%04x: ", start);


custom.c: Simplify code

custom.c: Simplify code

Signed-off-by: Lukas Fleischer <af90e31281d8305af43dc616c5aaca3c7165f8a7@cryptocrack.de>

--- src/custom.c
+++ src/custom.c
@@ -599,24 +599,22 @@

 	if (hilt)
 		custom_apply_attr(win, ATTR_HIGHEST);
+	mvwprintw(win, y, XPOS, "%s", opt[i]);

 	switch (i) {
 	case 0:
-		mvwprintw(win, y, XPOS, "%s", opt[AUTO_SAVE]);
 		print_bool_option_incolor(win, conf.auto_save, y,
 					  XPOS + strlen(opt[AUTO_SAVE]));
 		mvwaddstr(win, y + XPOS, 1,
 			  _("(if set to YES, automatic save is done when quitting)"));
 		break;
 	case 1:
-		mvwprintw(win, y, XPOS, "%s", opt[AUTO_GC]);
 		print_bool_option_incolor(win, conf.auto_gc, y,
 					  XPOS + strlen(opt[AUTO_GC]));
 		mvwaddstr(win, y + 1, XPOS,
 			  _("(run the garbage collector when quitting)"));
 		break;
 	case 2:
-		mvwprintw(win, y, XPOS, "%s", opt[PERIODIC_SAVE]);
 		custom_apply_attr(win, ATTR_HIGHEST);
 		mvwprintw(win, y, XPOS + strlen(opt[PERIODIC_SAVE]), "%d",
 			  conf.periodic_save);
@@ -626,14 +624,12 @@
 			   "minutes)"));
 		break;
 	case 3:
-		mvwprintw(win, y, XPOS, "%s", opt[CONFIRM_QUIT]);
 		print_bool_option_incolor(win, conf.confirm_quit, y,
 					  XPOS + strlen(opt[CONFIRM_QUIT]));
 		mvwaddstr(win, y + 1, XPOS,
 			  _("(if set to YES, confirmation is required before quitting)"));
 		break;
 	case 4:
-		mvwprintw(win, y, XPOS, "%s", opt[CONFIRM_DELETE]);
 		print_bool_option_incolor(win, conf.confirm_delete, y,
 					  XPOS + strlen(opt[CONFIRM_DELETE]));
 		mvwaddstr(win, y + 1, XPOS,
@@ -641,7 +637,6 @@
 			    "before deleting an event)"));
 		break;
 	case 5:
-		mvwprintw(win, y, XPOS, "%s", opt[SYSTEM_DIAGS]);
 		print_bool_option_incolor(win, conf.system_dialogs, y,
 					  XPOS + strlen(opt[SYSTEM_DIAGS]));
 		mvwaddstr(win, y + 1, XPOS,
@@ -649,7 +644,6 @@
 			    "and saved data will be displayed)"));
 		break;
 	case 6:
-		mvwprintw(win, y, XPOS, "%s", opt[PROGRESS_BAR]);
 		print_bool_option_incolor(win, conf.progress_bar, y,
 					  XPOS + strlen(opt[PROGRESS_BAR]));
 		mvwaddstr(win, y + 1, XPOS,
@@ -657,7 +651,6 @@
 			    "when saving data)"));
 		break;
 	case 7:
-		mvwprintw(win, y, XPOS, "%s", opt[FIRST_DAY_OF_WEEK]);
 		custom_apply_attr(win, ATTR_HIGHEST);
 		mvwaddstr(win, y, XPOS + strlen(opt[FIRST_DAY_OF_WEEK]),
 			  ui_calendar_week_begins_on_monday()? _("Monday") :
@@ -667,7 +660,6 @@
 			  _("(specifies the first day of week in the calendar view)"));
 		break;
 	case 8:
-		mvwprintw(win, y, XPOS, "%s", opt[OUTPUT_DATE_FMT]);
 		custom_apply_attr(win, ATTR_HIGHEST);
 		mvwaddstr(win, y, XPOS + strlen(opt[OUTPUT_DATE_FMT]),
 			  conf.output_datefmt);
@@ -676,7 +668,6 @@
 			  _("(Format of the date to be displayed in non-interactive mode)"));
 		break;
 	case 9:
-		mvwprintw(win, y, XPOS, "%s", opt[INPUT_DATE_FMT]);
 		custom_apply_attr(win, ATTR_HIGHEST);
 		mvwprintw(win, y, XPOS + strlen(opt[INPUT_DATE_FMT]), "%d",
 			  conf.input_datefmt);


daemon.h: GNU-C printf-attributes

daemon.h: GNU-C printf-attributes

--- src/daemon.h
+++ src/daemon.h
@@ -24,8 +24,10 @@
 extern int daemon_daemonize(const daemon_loop daemon_main, void *data);
 extern void daemon_print(const char *message);
 extern void daemon_print_level(int level, const char *message);
-extern void daemon_printf(const char *message_fmt, ...);
-extern void daemon_printf_level(int level, const char *message_fmt, ...);
+extern void daemon_printf(const char *message_fmt, ...)
+    __attribute__((format(printf, 1, 2)));
+extern void daemon_printf_level(int level, const char *message_fmt, ...)
+    __attribute__((format(printf, 2, 3)));
 extern void daemon_perror(const char *message);

 #endif


MB-17154: Handle error in `couch_dbdump` case properly

Change-Id: I513adbf7d9e3c483a85c65082e0cd8c1de0e7d7d
Reviewed-on: http://review.couchbase.org/58047
Reviewed-by: Abhishek Singh <0731fdeb307910eeaae4e58897b7baaba45e054b@couchbase.com>
Reviewed-by: Dave Rigby <a09264da4832c7ff1d3bf1608a19f4b870f93750@couchbase.com>
Reviewed-by: Harsha H S <b9c539375b0159a59a005865dce169c407c7d034@gmail.com>
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

--- src/dbdump.c
+++ src/dbdump.c
@@ -574,6 +574,11 @@
     }

     errcode = decode_index_header(header_buf, (size_t) header_len, &header);
+    if (errcode != COUCHSTORE_SUCCESS) {
+        fprintf(stderr, "Unable to decode header \"%s\": %s\n",
+                file, couchstore_strerror(errcode));
+        return -1;
+    }
     free(header_buf);
     printf("Num views: %d\n", header->num_views);


Fixed a bug that caused any triggered event action to go into an infinite loop allocating memory

--- engine/core.c
+++ engine/core.c
@@ -2603,6 +2603,7 @@
     ib_mpool_t *pool = log->mp;
     ib_tx_t *tx = log->tx;
     ib_list_t *list;
+    ib_list_t *field_list;
     ib_list_node_t *node;
     ib_field_t *f;
     ib_status_t rc;
@@ -2629,19 +2630,19 @@
     }

     // @todo Remove mutable once list is const correct.
-    rc = ib_field_mutable_value(f, ib_ftype_list_mutable_out(&list));
+    rc = ib_field_mutable_value(f, ib_ftype_list_mutable_out(&field_list));
     if (rc != IB_OK) {
         IB_FTRACE_RET_STATUS(rc);
     }
     IB_LIST_LOOP(list, node) {
-        ib_list_push(list, ib_list_node_data(node));
+        ib_list_push(field_list, ib_list_node_data(node));
     }

     /* Add the part to the auditlog. */
     rc = ib_auditlog_part_add(log,
                               "http-request-headers",
                               "application/octet-stream",
-                              list,
+                              field_list,
                               ib_auditlog_gen_headers_flist,
                               NULL);

@@ -2686,6 +2687,7 @@
     ib_mpool_t *pool = log->mp;
     ib_tx_t *tx = log->tx;
     ib_list_t *list;
+    ib_list_t *field_list;
     ib_list_node_t *node;
     ib_field_t *f;
     ib_status_t rc;
@@ -2712,20 +2714,20 @@
     }

     // @todo Remove mutable once list is const correct.
-    rc = ib_field_mutable_value(f, ib_ftype_list_mutable_out(&list));
+    rc = ib_field_mutable_value(f, ib_ftype_list_mutable_out(&field_list));
     if (rc != IB_OK) {
         IB_FTRACE_RET_STATUS(rc);
     }

     IB_LIST_LOOP(list, node) {
-        ib_list_push(list, ib_list_node_data(node));
+        ib_list_push(field_list, ib_list_node_data(node));
     }

     /* Add the part to the auditlog. */
     rc = ib_auditlog_part_add(log,
                               "http-response-headers",
                               "application/octet-stream",
-                              list,
+                              field_list,
                               ib_auditlog_gen_headers_flist,
                               NULL);


Hash lookup now correctly returns IB_ENOENT instead of IB_EINVAL for a field not in the hash.

--- engine/core.c
+++ engine/core.c
@@ -984,6 +984,7 @@
                         IB_FTRACE_RET_STATUS(IB_OK);
                     }
                 }
+                IB_FTRACE_RET_STATUS(IB_ENOENT);
             }

             ib_log_error(dpi->pr->ib, 1, "Trying to lookup subkey in non-list.");


Alias ARGS fields (for now).

Alias ARGS fields (for now).

--- engine/core.c
+++ engine/core.c
@@ -2171,6 +2171,7 @@
     IB_FTRACE_INIT(parser_hook_req_header);
     ib_provider_inst_t *pi = ib_parser_provider_get_instance(tx->ctx);
     IB_PROVIDER_IFACE_TYPE(parser) *iface = pi?(IB_PROVIDER_IFACE_TYPE(parser) *)pi->pr->iface:NULL;
+    ib_field_t *f;
     ib_status_t rc;

     if (iface == NULL) {
@@ -2182,7 +2183,25 @@
     /* This function is required, so no NULL check. */

     rc = iface->gen_request_header_fields(pi, tx);
-    IB_FTRACE_RET_STATUS(rc);
+    if (rc != IB_OK) {
+        IB_FTRACE_RET_STATUS(rc);
+    }
+
+
+    /* Alias ARGS fields */
+    rc = ib_data_get(tx->dpi, "request_uri_params", &f);
+    if (rc == IB_OK) {
+        rc = ib_data_add_named(tx->dpi, f, "args", 4);
+        if (rc != IB_OK) {
+            ib_log_debug(ib, 4, "Failed to alias ARGS: %d", rc);
+        }
+        rc = ib_data_add_named(tx->dpi, f, "args_get", 8);
+        if (rc != IB_OK) {
+            ib_log_debug(ib, 4, "Failed to alias ARGS_GET: %d", rc);
+        }
+    }
+
+    IB_FTRACE_RET_STATUS(IB_OK);
 }

 /**


lib/vsprintf.c: improve sanity check in vsnprintf()

On 64 bit, size may very well be huge even if bit 31 happens to be 0.
Somehow it doesn't feel right that one can pass a 5 GiB buffer but not a
3 GiB one.  So cap at INT_MAX as was probably the intention all along.
This is also the made-up value passed by sprintf and vsprintf.

Signed-off-by: Rasmus Villemoes <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@rasmusvillemoes.dk>
Cc: Jiri Kosina <ed58f755cc8caaf10c3e8c731a8b86fb8f13d6cb@suse.cz>
Cc: Randy Dunlap <6f29df8e90a57f1ba61ffd63b0468c86bb6d3a99@infradead.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


Installer bugfix

Installer bugfix

--- gxsetup/user.c
+++ gxsetup/user.c
@@ -131,8 +131,9 @@
 	// create the home directory and set the owner to be the new user
 	char homedir[256];
 	sprintf(homedir, "/mnt/home/%s", username);
-	mkdir(homedir, 0755);
+	mkdir(homedir, 0700);
 	chown(homedir, 1000, 1000);
+	chmod(homedir, 0700);

 	// create the /etc/passwd file
 	FILE *fp = fopen("/mnt/etc/passwd", "w");


Avoid calling hp_inline_hash twice for every function call, which is the most expensive exclusive fn.

--- qafooprofiler.c
+++ qafooprofiler.c
@@ -243,6 +243,7 @@
 	/* Function that determines the transaction name and callback */
 	hp_string       *transaction_function;
 	hp_string		*transaction_name;
+	char			*root;

 	/*       ----------   Mode specific attributes:  -----------       */

@@ -858,7 +859,7 @@
 static inline uint8 hp_inline_hash(char * arKey)
 {
 	size_t nKeyLength = strlen(arKey);
-	register uint8 hash = 5381;
+	register uint8 hash = 0;

 	/* variant with the hash unrolled eight times */
 	for (; nKeyLength >= 8; nKeyLength -= 8) {
@@ -1152,12 +1153,15 @@
  *        CALLING FUNCTION OR BY CALLING TSRMLS_FETCH()
  *        TSRMLS_FETCH() IS RELATIVELY EXPENSIVE.
  */
-#define BEGIN_PROFILING(entries, symbol, profile_curr)							\
+#define BEGIN_PROFILING(entries, symbol, profile_curr, execute_data)			\
 	do {																		\
 		/* Use a hash code to filter most of the string comparisons. */			\
 		uint8 hash_code  = hp_inline_hash(symbol);								\
 		profile_curr = !hp_filter_entry(hash_code, symbol);						\
 		if (profile_curr) {														\
+			if (execute_data != NULL && hp_argument_entry(hash_code, symbol)) {	\
+				symbol = hp_get_function_argument_summary(symbol, execute_data TSRMLS_CC); \
+			}																	\
 			hp_entry_t *cur_entry = hp_fast_alloc_hprof_entry();				\
 			(cur_entry)->hash_code = hash_code;									\
 			(cur_entry)->name_hprof = symbol;									\
@@ -1742,7 +1746,6 @@
 	char              *ret = NULL;
 	int                len;
 	zend_function      *curr_func;
-	uint8 hash_code;

 	if (data) {
 		/* shared meta data for function on the call stack */
@@ -1770,12 +1773,6 @@
 				ret = hp_concat_char(cls, strlen(cls), func, strlen(func), sep, 2);
 			} else {
 				ret = estrdup(func);
-			}
-
-			hash_code  = hp_inline_hash(ret);
-
-			if (hp_argument_entry(hash_code, ret)) {
-				ret = hp_get_function_argument_summary(ret, data TSRMLS_CC);
 			}

 		} else {
@@ -2639,7 +2636,7 @@

 	hp_detect_transaction_name(func, real_execute_data TSRMLS_CC);

-	BEGIN_PROFILING(&hp_globals.entries, func, hp_profile_flag);
+	BEGIN_PROFILING(&hp_globals.entries, func, hp_profile_flag, real_execute_data);
 #if PHP_VERSION_ID < 50500
 	_zend_execute(ops TSRMLS_CC);
 #else
@@ -2678,7 +2675,7 @@
 	func = hp_get_function_name(execute_data TSRMLS_CC);

 	if (func) {
-		BEGIN_PROFILING(&hp_globals.entries, func, hp_profile_flag);
+		BEGIN_PROFILING(&hp_globals.entries, func, hp_profile_flag, execute_data);
 	}

 	if (!_zend_execute_internal) {
@@ -2722,7 +2719,7 @@
 	func      = (char *)emalloc(len);
 	snprintf(func, len, "load::%s", filename);

-	BEGIN_PROFILING(&hp_globals.entries, func, hp_profile_flag);
+	BEGIN_PROFILING(&hp_globals.entries, func, hp_profile_flag, NULL);
 	ret = _zend_compile_file(file_handle, type TSRMLS_CC);
 	if (hp_globals.entries) {
 		END_PROFILING(&hp_globals.entries, hp_profile_flag);
@@ -2747,7 +2744,7 @@
 	func = (char *)emalloc(len);
 	snprintf(func, len, "eval::%s", filename);

-	BEGIN_PROFILING(&hp_globals.entries, func, hp_profile_flag);
+	BEGIN_PROFILING(&hp_globals.entries, func, hp_profile_flag, NULL);
 	ret = _zend_compile_string(source_string, filename TSRMLS_CC);
 	if (hp_globals.entries) {
 		END_PROFILING(&hp_globals.entries, hp_profile_flag);
@@ -2850,7 +2847,8 @@
 		hp_init_profiler_state(level TSRMLS_CC);

 		/* start profiling from fictitious main() */
-		BEGIN_PROFILING(&hp_globals.entries, ROOT_SYMBOL, hp_profile_flag);
+		hp_globals.root = estrdup(ROOT_SYMBOL);
+		BEGIN_PROFILING(&hp_globals.entries, hp_globals.root, hp_profile_flag, NULL);
 	}
 }

@@ -2884,6 +2882,11 @@
 	/* End any unfinished calls */
 	while (hp_globals.entries) {
 		END_PROFILING(&hp_globals.entries, hp_profile_flag);
+	}
+
+	if (hp_globals.root) {
+		efree(hp_globals.root);
+		hp_globals.root = NULL;
 	}

 	/* Remove proxies, restore the originals */


ERR: warning.

ERR: warning.

--- Code/Common/itkDirectory.h
+++ Code/Common/itkDirectory.h
@@ -58,7 +58,7 @@
   bool Load(const char* dir);

   /** Return the number of files in the current directory. */
-  int GetNumberOfFiles() { return m_Files.size();}
+  unsigned int GetNumberOfFiles() { return m_Files.size();}

   /** Return the file at the given index, the indexing is 0 based */
   const char* GetFile(unsigned int index);


Comment unused function to make Travis pass

--- src/decode.c
+++ src/decode.c
@@ -584,10 +584,8 @@
 // operand processing handlers

 // put M of RM encoding in op 1
-static void parseM1(DContext* c)
-{
-    parseModRM(c, c->vt, RT_G, &c->o1, 0, 0);
-}
+//static void parseM1(DContext* c) { parseModRM(c, c->vt, RT_G, &c->o1, 0, 0); }
+

 // RM encoding for 2 GP registers
 static void parseRM(DContext* c)


Intel 82580: unset PSP flag in TCTL register

allows transmitting short frames.

this obviously needs refactoring. it currently just works by
coincidence on our NICs (register don't overlap)

--- src/device.c
+++ src/device.c
@@ -113,6 +113,9 @@
 	hlReg0 &= ~(1 << 10); // TXPADEN
 	hlReg0 |= (1 << 2); // JUMBOEN
 	write_reg32(port, 0x4240, hlReg0);
+	uint32_t tctl = read_reg32(port, 0x0400);
+	tctl &= ~(1 << 3); // PSP
+	write_reg32(port, 0x0400, tctl);
 	return rc;
 }


core: Add provision for terminating an ATT connection

In order to terminate any existing ATT connection from the client side
existing function device_request_disconnect has been updated.

--- src/device.c
+++ src/device.c
@@ -790,6 +790,14 @@
 		browse_request_cancel(device->browse);
 	}

+	if (device->attrib) {
+		GIOChannel *io = g_attrib_get_channel(device->attrib);
+		if (io) {
+			g_io_channel_shutdown(io, FALSE, NULL);
+			g_io_channel_unref(io);
+		}
+	}
+
 	if (msg)
 		device->disconnects = g_slist_append(device->disconnects,
 						dbus_message_ref(msg));


core/device: Don't overwrite SDP record cache

btd_device_get_record should not overwrite existing cache if record
cannot be found since the cache should alway be up to date as it is
reloaded from file if the cache is empty.

--- src/device.c
+++ src/device.c
@@ -5545,21 +5545,12 @@
 const sdp_record_t *btd_device_get_record(struct btd_device *device,
 							const char *uuid)
 {
-	if (device->tmp_records) {
-		const sdp_record_t *record;
-
-		record = find_record_in_list(device->tmp_records, uuid);
-		if (record != NULL)
-			return record;
-
-		sdp_list_free(device->tmp_records,
-					(sdp_free_func_t) sdp_record_free);
-		device->tmp_records = NULL;
-	}
-
-	device->tmp_records = read_device_records(device);
-	if (!device->tmp_records)
-		return NULL;
+	/* Load records from storage if there is nothing in cache */
+	if (!device->tmp_records) {
+		device->tmp_records = read_device_records(device);
+		if (!device->tmp_records)
+			return NULL;
+	}

 	return find_record_in_list(device->tmp_records, uuid);
 }


core/device: Fix not emitting Paired property

Even if bt_gatt_client fails to discover services it should still call
device_svc_resolved so the Paired propery is updated if pending and the
device is properly stored, and at the end it still calls
browse_request_complete to free up the resources.

--- src/device.c
+++ src/device.c
@@ -4188,13 +4188,7 @@
 	DBG("status: %s, error: %u", success ? "success" : "failed", att_ecode);

 	if (!success) {
-		if (device->browse) {
-			struct browse_req *req = device->browse;
-
-			device->browse = NULL;
-			browse_request_complete(req, device->bdaddr_type, -EIO);
-		}
-
+		device_svc_resolved(device, device->bdaddr_type, -EIO);
 		return;
 	}