Add more shims for --disable constraints builds

--- include/base/dof_map.h
+++ include/base/dof_map.h
@@ -2036,10 +2036,20 @@
                                                          std::vector<dof_id_type> &,
                                                          bool) const {}

+inline void DofMap::heterogenously_constrain_element_matrix_and_vector
+  (DenseMatrix<Number> &, DenseVector<Number> &,
+   std::vector<dof_id_type> &, bool, int) const {}
+
+inline void DofMap::heterogenously_constrain_element_vector
+  (const DenseMatrix<Number> &, DenseVector<Number> &,
+   std::vector<dof_id_type> &, bool, int) const {}
+
 inline void DofMap::constrain_element_dyad_matrix (DenseVector<Number> &,
                                                    DenseVector<Number> &,
                                                    std::vector<dof_id_type> &,
                                                    bool) const {}
+
+inline void DofMap::constrain_nothing (std::vector<dof_id_type> &) const {}

 inline void DofMap::enforce_constraints_exactly (const System &,
                                                  NumericVector<Number> *,


clock: decouple crystal stabilization from fault recheck delay

These are really two different things.  Now the code matches the comments.

--- include/bsp430/clock.h
+++ include/bsp430/clock.h
@@ -260,7 +260,7 @@
  * @platformdep
  */
 #ifndef BSP430_CLOCK_LFXT1_STABILIZATION_DELAY_CYCLES
-#define BSP430_CLOCK_LFXT1_STABILIZATION_DELAY_CYCLES (BSP430_CLOCK_FAULT_RECHECK_DELAY_US * 1000UL)
+#define BSP430_CLOCK_LFXT1_STABILIZATION_DELAY_CYCLES BSP430_CORE_MS_TO_TICKS(50, BSP430_CLOCK_PUC_MCLK_HZ)
 #endif /* BSP430_CLOCK_LFXT1_STABILIZATION_DELAY_CYCLES */

 /** Check whether the XT2 crystal has a fault condition.


Make it clearer what changed to a user using the old format of LSCOLORS.

--- bin/ls/print.c
+++ bin/ls/print.c
@@ -496,9 +496,9 @@
 				colors[i].num[j] = c[j] - '0';
 				if (!legacy_warn) {
 					fprintf(stderr,
-					    "warn: colors are now defined "
-					    "using a-h instead of 0-9. "
-					    "see manual page.\n");
+					    "warn: LSCOLOURS should use "
+					    "characters a-h instead of 0-9 ("
+					    "see the manual page)\n");
 				}
 				legacy_warn = 1;
 			} else if (c[j] >= 'a' && c[j] <= 'h')


adsr: fix for using int abs where float abs is needed.

--- include/c74_lib_adsr.h
+++ include/c74_lib_adsr.h
@@ -20,7 +20,7 @@
 		public:

 			void operator = (number percentage) {
-				m_is_linear = fabs(percentage) < 0.001;
+				m_is_linear = std::abs(percentage) < 0.001;
 				if (m_is_linear)
 					m_exp = 1.0;
 				else {
@@ -35,7 +35,7 @@
 			number operator()(number x) {
 				// Profile this: What's worse? branching or calculating even when linear?
 				if (m_curve > 0.0)
-					return 1.0 - pow(abs(x - 1.0), m_exp);
+					return 1.0 - pow(std::abs(x - 1.0), m_exp);
 				else
 					return pow(x, m_exp);
 			}


client fidc hash table size

client fidc hash table size

git-svn-id: ae92b08b608af1c8cefa3e10d2325ea527204e07@23363 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- include/cache_params.h
+++ include/cache_params.h
@@ -29,7 +29,7 @@

 #define FIDC_MDS_DEFSZ		79757			/* used to be (2 * 32 * 1024) */
 #define FIDC_ION_DEFSZ		21851			/* used to be (2 * 8 * 1024) */
-#define FIDC_CLI_DEFSZ		(2 * 1024)
+#define FIDC_CLI_DEFSZ		3271			/* used to be (2 * 1024) */

 #define SLASH_SLVRS_PER_BMAP	128
 #define SLASH_SLVR_SIZE		(1024 * (off_t)1024)


Added setter methods for Color and ColorA that are consistent with many other basic types.

--- include/cinder/Color.h
+++ include/cinder/Color.h
@@ -58,6 +58,16 @@
 	ColorT( const ColorT<FromT> &src )
 		: r( CHANTRAIT<T>::convert( src.r ) ), g( CHANTRAIT<T>::convert( src.g ) ), b( CHANTRAIT<T>::convert( src.b ) )
 	{}
+
+	void set( T ar, T ag, T ab )
+	{
+		r = ar; g = ag; b = ab;
+	}
+
+	void set( const ColorT<T> &rhs )
+	{
+		r = rhs.r; g = rhs.g; b = rhs.b;
+	}

 	void	set( ColorModel cm, const Vec3f &v );

@@ -230,6 +240,16 @@
 		: r( CHANTRAIT<T>::convert( src.r ) ), g( CHANTRAIT<T>::convert( src.g ) ), b( CHANTRAIT<T>::convert( src.b ) ), a( CHANTRAIT<T>::convert( src.a ) )
 	{}

+	void set( T ar, T ag, T ab , T aa )
+	{
+		r = ar; g = ag; b = ab; a = aa;
+	}
+
+	void set( const ColorAT<T> &rhs )
+	{
+		r = rhs.r; g = rhs.g; b = rhs.b; a = rhs.a;
+	}
+
 	ColorAT<T> operator=( const ColorAT<T>& rhs )
 	{
 		r = rhs.r;


Updating the names of the schemes

Updating the names of the schemes

--- include/codecfactory.h
+++ include/codecfactory.h
@@ -38,16 +38,16 @@
     schemes["copy"] = shared_ptr<IntegerCODEC> (new JustCopy());

     schemes["varint"] = shared_ptr<IntegerCODEC> (new VariableByte<true> ());
-    schemes["s-fastpfor-4"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-fastpfor-4"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec<SIMDFastPFor<CoarseDelta4SIMD> , leftovercodec > ());

-    schemes["s-fastpfor-m"]
+    schemes["s4-fastpfor-m"]
             = shared_ptr<IntegerCODEC> (
                     new CompositeCodec<SIMDFastPFor<Max4DeltaSIMD> ,
                             VariableByte<true> > ());
-    schemes["s-fastpfor-1"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-fastpfor-1"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec<SIMDFastPFor<RegularDeltaSIMD> , leftovercodec > ());
-    schemes["s-fastpfor-2"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-fastpfor-2"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec<SIMDFastPFor<CoarseDelta2SIMD> , leftovercodec > ());

     schemes["bp32"] = shared_ptr<IntegerCODEC> (
@@ -57,29 +57,29 @@
             new CompositeCodec<BinaryPacking<IntegratedBlockPacker> ,
             leftovercodec > ());

-    schemes["s-bp128+d1"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-bp128+d1"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec < SIMDBinaryPacking<SIMDBlockPacker<
                     RegularDeltaSIMD, true> > , leftovercodec > ());
-    schemes["s-bp128+d2"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-bp128+d2"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec < SIMDBinaryPacking<SIMDBlockPacker<
                     CoarseDelta2SIMD, true> >, leftovercodec > ());
-    schemes["s-bp128+d4"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-bp128+d4"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec < SIMDBinaryPacking<SIMDBlockPacker<
                     CoarseDelta4SIMD, true> >, leftovercodec > ());
-    schemes["s-bp128+dm"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-bp128+dm"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec < SIMDBinaryPacking<SIMDBlockPacker<
                     Max4DeltaSIMD, true> >, leftovercodec > ());

-    schemes["s-bp128-1"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-bp128-1"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec < SIMDBinaryPacking<SIMDIntegratedBlockPacker<
                     RegularDeltaSIMD, true> >, leftovercodec > ());
-    schemes["s-bp128-2"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-bp128-2"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec < SIMDBinaryPacking<SIMDIntegratedBlockPacker<
                     CoarseDelta2SIMD, true> >, leftovercodec > ());
-    schemes["s-bp128-4"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-bp128-4"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec < SIMDBinaryPacking<SIMDIntegratedBlockPacker<
                     CoarseDelta4SIMD, true> >, leftovercodec > ());
-    schemes["s-bp128-m"] = shared_ptr<IntegerCODEC> (
+    schemes["s4-bp128-m"] = shared_ptr<IntegerCODEC> (
             new CompositeCodec < SIMDBinaryPacking<SIMDIntegratedBlockPacker<
                     Max4DeltaSIMD, true> >, leftovercodec > ());


Increase version number to 0.7

Increase version number to 0.7

This will be the first version released on viproma.no.

--- include/coral/config.h
+++ include/coral/config.h
@@ -21,7 +21,7 @@
 #define CORAL_PROGRAM_NAME "Coral"

 #define CORAL_VERSION_MAJOR 0
-#define CORAL_VERSION_MINOR 6
+#define CORAL_VERSION_MINOR 7
 #define CORAL_VERSION_PATCH 0

 #define CORAL_VERSION_STRINGIFY(a, b, c) #a "." #b "." #c


Remove deprecated register

Remove deprecated register

In c++11, register has been deprecated, and
all of skia is now built as gnu++11

From the documentation:
A register specifier is a hint to the implementation
that the variable so declared will be heavily used.
[ Note: The hint can be ignored and in most implementations
it will be ignored if the address of the variable is taken.
This use is deprecated (see D.2) ]

Change-Id: Ic7432b034037fea273c4a9c09f0ca4a728f7eb88
Signed-off-by: DHOMD <66c6d6a7d8cc18849a70ebcf8e1cc023b95b02c2@dho.im>

--- include/core/SkFixed.h
+++ include/core/SkFixed.h
@@ -196,7 +196,7 @@
     */
     inline SkFixed SkFloatToFixed_arm(float x)
     {
-        register int32_t y, z;
+        int32_t y, z;
         asm("movs    %1, %3, lsl #1         \n"
             "mov     %2, #0x8E              \n"
             "sub     %1, %2, %1, lsr #24    \n"
@@ -213,7 +213,7 @@
     }
     inline SkFixed SkFixedMul_arm(SkFixed x, SkFixed y)
     {
-        register int32_t t;
+        int32_t t;
         asm("smull  %0, %2, %1, %3          \n"
             "mov    %0, %0, lsr #16         \n"
             "orr    %0, %0, %2, lsl #16     \n"
@@ -225,7 +225,7 @@
     }
     inline SkFixed SkFixedMulAdd_arm(SkFixed x, SkFixed y, SkFixed a)
     {
-        register int32_t t;
+        int32_t t;
         asm("smull  %0, %3, %1, %4          \n"
             "add    %0, %2, %0, lsr #16     \n"
             "add    %0, %0, %3, lsl #16     \n"
@@ -237,7 +237,7 @@
     }
     inline SkFixed SkFractMul_arm(SkFixed x, SkFixed y)
     {
-        register int32_t t;
+        int32_t t;
         asm("smull  %0, %2, %1, %3          \n"
             "mov    %0, %0, lsr #30         \n"
             "orr    %0, %0, %2, lsl #2      \n"


Changed some checks in properties routine.

--- profile.c
+++ profile.c
@@ -184,7 +184,7 @@
     double bc[6];
     double binfactor;
     double frecentrermin, frecentredist, frhobg;
-    double fcheckrvcmax, fcheckrstatic, fchecktruncated;
+    double fcheckrbgcrit, fcheckrvcmax, fcheckrstatic, fcheckrtruncindicator;
     double fexclude, slopertruncindicator;
     double Nsigmavrad, Nsigmaextreme, vraddispmin;
     COSMOLOGICAL_PARAMETERS cp;
@@ -380,6 +380,12 @@
 	    gi.frhobg = atof(argv[i]);
 	    i++;
 	    }
+	else if (strcmp(argv[i],"-fcheckrbgcrit") == 0) {
+	    i++;
+            if (i >= argc) usage();
+	    gi.fcheckrbgcrit = atof(argv[i]);
+	    i++;
+	    }
 	else if (strcmp(argv[i],"-fcheckrvcmax") == 0) {
 	    i++;
             if (i >= argc) usage();
@@ -392,10 +398,10 @@
 	    gi.fcheckrstatic = atof(argv[i]);
 	    i++;
 	    }
-	else if (strcmp(argv[i],"-fchecktruncated") == 0) {
-	    i++;
-            if (i >= argc) usage();
-	    gi.fchecktruncated = atof(argv[i]);
+	else if (strcmp(argv[i],"-fcheckrtruncindicator") == 0) {
+	    i++;
+            if (i >= argc) usage();
+	    gi.fcheckrtruncindicator = atof(argv[i]);
 	    i++;
 	    }
 	else if (strcmp(argv[i],"-fexclude") == 0) {
@@ -1348,9 +1354,10 @@
 	fprintf(stderr,"frecentrermin         : %.6e\n",gi.frecentrermin);
 	fprintf(stderr,"frecentredist         : %.6e\n",gi.frecentredist);
 	fprintf(stderr,"frhobg                : %.6e\n",gi.frhobg);
+	fprintf(stderr,"fcheckrbgcrit         : %.6e\n",gi.fcheckrbgcrit);
 	fprintf(stderr,"fcheckrvcmax          : %.6e\n",gi.fcheckrvcmax);
 	fprintf(stderr,"fcheckrstatic         : %.6e\n",gi.fcheckrstatic);
-	fprintf(stderr,"fchecktruncated       : %.6e\n",gi.fchecktruncated);
+	fprintf(stderr,"fcheckrtruncindicator : %.6e\n",gi.fcheckrtruncindicator);
 	fprintf(stderr,"fexclude              : %.6e\n",gi.fexclude);
 	fprintf(stderr,"slopertruncindicator  : %.6e\n",gi.slopertruncindicator);
 	fprintf(stderr,"vraddispmin           : %.6e VU (internal velocity) = %.6e km s^{-1} (peculiar)\n",gi.vraddispmin,gi.vraddispmin/(cosmo2internal_ct.V_usf*cosmo2internal_ct.V_cssf*ConversionFactors.km_per_s_2_kpc_per_Gyr));
@@ -1479,10 +1486,11 @@
     gi->frecentrermin = 5;
     gi->frecentredist = 2;
     gi->frhobg = 1.2;
+    gi->fcheckrbgcrit = 3;
     gi->fcheckrvcmax = 5;
     gi->fcheckrstatic = 3;
-    gi->fchecktruncated = 1.2;
-    gi->fexclude = 5;
+    gi->fcheckrtruncindicator = 1.2;
+    gi->fexclude = 3;
     gi->slopertruncindicator = -0.2;
     gi->vraddispmin = 2;
     gi->Nsigmavrad = 1.5;
@@ -2559,6 +2567,26 @@
 		    assert(hd[i].rbg > 0);
 		    assert(hd[i].Mrbg > 0);
 		    }
+		else {
+		    /*
+		    ** Check criteria
+		    */
+		    Qcheck = 0;
+		    Ncheck = 0;
+		    Scheck = 0;
+		    for (k = j; (hd[i].ps[k].rm <= gi.fcheckrbgcrit*rcheck) && (k < hd[i].NBin+1); k++) {
+			Ncheck++;
+			Qcomp = log(hd[i].ps[k].tot->Menc/hd[i].ps[k].Venc)-log(hd[i].ps[k-1].tot->Menc/hd[i].ps[k-1].Venc);
+			Qcomp /= log(hd[i].ps[k].ro)-log(hd[i].ps[k-1].ro);
+			if (Qcheck > Qcomp) Scheck++;
+			}
+		    if (Scheck == Ncheck) {
+			hd[i].rbg = rcheck;
+			hd[i].Mrbg = Mrcheck;
+			assert(hd[i].rbg > 0);
+			assert(hd[i].Mrbg > 0);
+			}
+		    }
 		}
 	    /*
 	    ** rcrit & Mrcrit
@@ -2570,11 +2598,32 @@
 		m = (log(Menc[1])-log(Menc[0]))/(log(radius[1])-log(radius[0]));
 		d = log(rcheck)-log(radius[0]);
 		Mrcheck = exp(log(Menc[0])+m*d);
+		Mrcheck = exp(log(Menc[0])+m*d);
 		if (rcheck >= rminok) {
 		    hd[i].rcrit = rcheck;
 		    hd[i].Mrcrit = Mrcheck;
 		    assert(hd[i].rcrit > 0);
 		    assert(hd[i].Mrcrit > 0);
+		    }
+		else {
+		    /*
+		    ** Check criteria
+		    */
+		    Qcheck = 0;
+		    Ncheck = 0;
+		    Scheck = 0;
+		    for (k = j; (hd[i].ps[k].rm <= gi.fcheckrbgcrit*rcheck) && (k < hd[i].NBin+1); k++) {
+			Ncheck++;
+			Qcomp = log(hd[i].ps[k].tot->Menc/hd[i].ps[k].Venc)-log(hd[i].ps[k-1].tot->Menc/hd[i].ps[k-1].Venc);
+			Qcomp /= log(hd[i].ps[k].ro)-log(hd[i].ps[k-1].ro);
+			if (Qcheck > Qcomp) Scheck++;
+			}
+		    if (Scheck == Ncheck) {
+			hd[i].rcrit = rcheck;
+			hd[i].Mrcrit = Mrcheck;
+			assert(hd[i].rcrit > 0);
+			assert(hd[i].Mrcrit > 0);
+			}
 		    }
 		}
 	    if ((hd[i].rbg != 0) && (hd[i].rcrit != 0)) break;
@@ -2811,12 +2860,13 @@
 		/*
 		** Check criteria
 		*/
-		Qcheck = Mrcheck/pow(rcheck,3);
+		Qcheck = gi.slopertruncindicator;
 		Ncheck = 0;
 		Scheck = 0;
-		for (k = j; (hd[i].ps[k].ro <= gi.fchecktruncated*rcheck) && (k < hd[i].NBin+1); k++) {
+		for (k = j+1; (hd[i].ps[k].rm <= gi.fcheckrtruncindicator*rcheck) && (k < hd[i].NBin+1); k++) {
 		    Ncheck++;
-		    Qcomp = hd[i].ps[k].tot->Menc/pow(hd[i].ps[k].ro,3);
+		    Qcomp = log(hd[i].ps[k].tot->Menc/hd[i].ps[k].Venc)-log(hd[i].ps[k-1].tot->Menc/hd[i].ps[k-1].Venc);
+		    Qcomp /= log(hd[i].ps[k].ro)-log(hd[i].ps[k-1].ro);
 		    if (Qcheck <= Qcomp) Scheck++;
 		    }
 		if ((Scheck == Ncheck) && (rcheck >= rminok) && (hd[i].ps[j-1].tot->M != 0)) {


Make SkAssertResult work with SK_WARN_UNUSED_RESULT in Release on gcc
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1962723003

Review-Url: https://codereview.chromium.org/1962723003

--- include/core/SkTypes.h
+++ include/core/SkTypes.h
@@ -149,8 +149,8 @@
     #define SkPARAM(var)

     // unlike SkASSERT, this guy executes its condition in the non-debug build.
-    // It casts to void to allow use with functions declared with SK_WARN_RESULT_UNUSED.
-    #define SkAssertResult(cond)        (void)(cond)
+    // The if is present so that this can be used with functions marked SK_WARN_UNUSED_RESULT.
+    #define SkAssertResult(cond)         if (cond) {} do {} while(false)
 #endif

 // Legacy macro names for SK_ABORT


introduce events

introduce events

--- include/dfu-internal.h
+++ include/dfu-internal.h
@@ -35,6 +35,8 @@
 	int (*reset_and_sync)(struct dfu_target *);
 	/* Let target run */
 	int (*run)(struct dfu_target *);
+	/* Interface event */
+	int (*on_interface_event)(struct dfu_target *);
 };

 struct dfu_binary_file {
@@ -74,11 +76,17 @@
 	return n <= end ? n : end + 1;
 }

+#define DFU_INTERFACE_EVENT	1
+#define DFU_FILE_EVENT		2
+#define DFU_TIMEOUT		4

 struct dfu_host_ops {
 	int (*init)(struct dfu_host *);
 	void (*udelay)(struct dfu_host *, unsigned long us);
-	void (*idle)(struct dfu_host *);
+	/* Returns int with last events flags set */
+	int (*idle)(struct dfu_host *);
+	int (*set_interface_event)(struct dfu_host *, void *);
+	int (*set_binary_file_event)(struct dfu_host *, void *);
 	int (*start_file_rx)(struct dfu_binary_file *, const char *method);
 };


std::sort ambiguity

std::sort ambiguity

std::sort ambiguity for int solved via explicit conversion to double

--- include/entanglement.h
+++ include/entanglement.h
@@ -149,7 +149,7 @@
 	if (!internal::_check_col_vector(rA))
 		throw Exception("gconcurrence", Exception::Type::MATRIX_NOT_CVECTOR);

-	std::size_t D = static_cast<std::size_t>((double)std::sqrt(A.rows()));
+	std::size_t D = static_cast<std::size_t>(std::sqrt((double)A.rows()));
 	if (D * D != static_cast<std::size_t>(A.rows()))
 		throw Exception("gconcurrence", Exception::Type::DIMS_NOT_EQUAL);


added #include<map>

added #include<map>

git-svn-id: ffc1bc5b3feaf8644044862cc38c386ade156493@213 434f946d-2f3d-0410-ba4c-cb9f52fb0dbf

--- include/fe_interface.h
+++ include/fe_interface.h
@@ -1,4 +1,4 @@
-// $Id: fe_interface.h,v 1.15 2003-04-02 14:55:05 benkirk Exp $
+// $Id: fe_interface.h,v 1.16 2003-04-02 15:18:05 benkirk Exp $

 // The Next Great Finite Element Library.
 // Copyright (C) 2002  Benjamin S. Kirk, John W. Peterson
@@ -24,6 +24,7 @@

 // C++ includes
 #include <vector>
+#include <map>

 // Local includes
 #include "point.h"


Use #pragma once instead of include guards.

This directive is also supported (even recommended) by MSVC.

--- include/franka/robot.h
+++ include/franka/robot.h
@@ -1,5 +1,4 @@
-#ifndef FRANKA_ROBOT_H_
-#define FRANKA_ROBOT_H_
+#pragma once

 #include <memory>
 #include <string>
@@ -51,5 +50,3 @@
 };

 }  // namespace franka
-
-#endif  // FRANKA_ROBOT_H_


Another missing #include

Another missing #include

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

--- include/iengine/halo.h
+++ include/iengine/halo.h
@@ -27,6 +27,7 @@
  * @{ */

 #include "csutil/scf.h"
+#include "csgeom/vector4.h"

 struct iMaterialWrapper;


export isl_schedule_constraints

export isl_schedule_constraints

Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>

--- include/isl/schedule.h
+++ include/isl/schedule.h
@@ -14,7 +14,7 @@
 extern "C" {
 #endif

-struct isl_schedule_constraints;
+struct __isl_export isl_schedule_constraints;
 typedef struct isl_schedule_constraints isl_schedule_constraints;

 isl_stat isl_options_set_schedule_max_coefficient(isl_ctx *ctx, int val);
@@ -72,18 +72,25 @@

 isl_ctx *isl_schedule_constraints_get_ctx(
 	__isl_keep isl_schedule_constraints *sc);
+__isl_export
 __isl_give isl_union_set *isl_schedule_constraints_get_domain(
 	__isl_keep isl_schedule_constraints *sc);
+__isl_export
 __isl_give isl_set *isl_schedule_constraints_get_context(
 	__isl_keep isl_schedule_constraints *sc);
+__isl_export
 __isl_give isl_union_map *isl_schedule_constraints_get_validity(
 	__isl_keep isl_schedule_constraints *sc);
+__isl_export
 __isl_give isl_union_map *isl_schedule_constraints_get_coincidence(
 	__isl_keep isl_schedule_constraints *sc);
+__isl_export
 __isl_give isl_union_map *isl_schedule_constraints_get_proximity(
 	__isl_keep isl_schedule_constraints *sc);
+__isl_export
 __isl_give isl_union_map *isl_schedule_constraints_get_conditional_validity(
 	__isl_keep isl_schedule_constraints *sc);
+__isl_export
 __isl_give isl_union_map *
 isl_schedule_constraints_get_conditional_validity_condition(
 	__isl_keep isl_schedule_constraints *sc);
@@ -92,6 +99,7 @@
 	__isl_take isl_schedule_constraints *sc,
 	__isl_take isl_union_map *umap);

+__isl_constructor
 __isl_give isl_schedule_constraints *isl_schedule_constraints_read_from_str(
 	isl_ctx *ctx, const char *str);
 __isl_give isl_schedule_constraints *isl_schedule_constraints_read_from_file(


ARM: KVM: fix non-VGIC compilation

ARM: KVM: fix non-VGIC compilation

Add a stub for kvm_vgic_addr when compiling without
CONFIG_KVM_ARM_VGIC. The usefulness of this configurarion is extremely
doubtful, but let's fix it anyway (until we decide that we'll always
support a VGIC).

Reported-by: Michele Paolino <078e121e0b2b5f37090589a16fdb445c0bb9af0f@virtualopensystems.com>
Cc: Paolo Bonzini <69d3ebcf5ee4e7f05a50dc23cd96655b730804b4@redhat.com>
Cc: Christoffer Dall <39e5ecfe2ecc327c3e39af72d8d83d1bd0709aad@linaro.org>
Signed-off-by: Marc Zyngier <a16cc0c82647c52d401177f8e50567df5499e36c@arm.com>
Signed-off-by: Paolo Bonzini <69d3ebcf5ee4e7f05a50dc23cd96655b730804b4@redhat.com>

--- include/kvm/arm_vgic.h
+++ include/kvm/arm_vgic.h
@@ -171,6 +171,11 @@
 	return 0;
 }

+static inline int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write)
+{
+	return -ENXIO;
+}
+
 static inline int kvm_vgic_init(struct kvm *kvm)
 {
 	return 0;


block: allow queue dma_alignment of zero

Let queue_dma_alignment return 0 if it was specifically set to 0.
This permits devices with no particular alignment restrictions to
use arbitrary user space buffers without copying.

Signed-off-by: Pete Wyckoff <1a91d62f7ca67399625a4368a6ab5d4a3baa6073@osc.edu>
Signed-off-by: Jens Axboe <165ab144a3ccfd9429d5c6466b275f24fafdb114@oracle.com>

--- include/linux/blkdev.h
+++ include/linux/blkdev.h
@@ -836,12 +836,7 @@

 static inline int queue_dma_alignment(struct request_queue *q)
 {
-	int retval = 511;
-
-	if (q && q->dma_alignment)
-		retval = q->dma_alignment;
-
-	return retval;
+	return q ? q->dma_alignment : 511;
 }

 /* assumes size > 256 */


Fix bug: re-registering a former service as task does not work

Signed-off-by: Joachim Wiberg <583c295fd7602c168ad814279bbc3894ba65f5d6@gmail.com>

--- src/service.c
+++ src/service.c
@@ -1260,6 +1260,9 @@
 		if (type == SVC_TYPE_SERVICE && manual)
 			svc_stop(svc);
 	} else {
+		/* update type, may have changed from service -> task */
+		svc->type = type;
+
 		/* e.g., if missing cmd or env before */
 		svc_unblock(svc);
 	}


rcu: Make task_subsys_state() RCU-lockdep checks handle boot-time use

It is apparently legal to invoke task_subsys_state() without RCU
protection during early boot time.  After all, there are no
concurrent tasks, so there can be no grace periods completing
concurrently.

But this does need an Acked-by from the cgroups folks.

Located-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Signed-off-by: Paul E. McKenney <1e0ce936bb9b355d257bf5790d2513c3f28be22b@linux.vnet.ibm.com>
Cc: 4c9eb49378914b743bdd32292c04df29b820d73e@cn.fujitsu.com
Cc: a6f1be4247cea11e3150b15872843079f20d7078@in.ibm.com
Cc: 007bef6a47fb57dff675bfa1b0b798b4bdfbfc25@polymtl.ca
Cc: c028c213ed5efcf30c3f4fc7361dbde0c893c5b7@joshtriplett.org
Cc: 6620bce6bfb8b2ba8b188f43804848d35a9a4d76@us.ibm.com
Cc: a103ef9226f51cd1e5e835b2f74c82dfb33d1ccb@us.ibm.com
Cc: 3fddac958924aef220f202ca567388ddab3f14a8@infradead.org
Cc: 43232e92d70cc7aa53504ad0397085ee47bad87f@goodmis.org
Cc: 183bdd1d6873c97a167cc4b441324ddf7a94dd06@vt.edu
Cc: ebac1d06c1688626821bb0e574a037a7a5354e49@redhat.com
LKML-Reference: <1267311188-16603-2-git-send-email-1e0ce936bb9b355d257bf5790d2513c3f28be22b@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- include/linux/cgroup.h
+++ include/linux/cgroup.h
@@ -489,6 +489,7 @@
 {
 	return rcu_dereference_check(task->cgroups->subsys[subsys_id],
 				     rcu_read_lock_held() ||
+				     !rcu_scheduler_active ||
 				     cgroup_lock_is_held());
 }


Do not misplace XdpSession with XdpImplSession

When XdpImplSession::closed is called, in the callback we treat it as XdpSession
and we actually never close the session properly when it's invoked from portal
backend implementation

--- src/session.c
+++ src/session.c
@@ -272,9 +272,9 @@
 }

 static void
-on_closed (XdpImplSession *object)
-{
-  Session *session = (Session *)object;
+on_closed (XdpImplSession *object, GObject *data)
+{
+  Session *session = (Session *)data;

   SESSION_AUTOLOCK_UNREF (g_object_ref (session));

@@ -339,7 +339,7 @@
       if (!impl_session)
         return FALSE;

-      g_signal_connect (impl_session, "closed", G_CALLBACK (on_closed), NULL);
+      g_signal_connect (impl_session, "closed", G_CALLBACK (on_closed), session);

       session->impl_session = g_steal_pointer (&impl_session);
     }


crypto: doc - ABLKCIPHER API documentation

The API function calls exported by the kernel crypto API for
asynchronous block ciphers to be used by consumers are documented.

Signed-off-by: Stephan Mueller <cc02df512ad79bcd2ad3264230580f113da4eba6@chronox.de>
Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>

--- include/linux/crypto.h
+++ include/linux/crypto.h
@@ -821,6 +821,50 @@
 	return mask;
 }

+/**
+ * DOC: Asynchronous Block Cipher API
+ *
+ * Asynchronous block cipher API is used with the ciphers of type
+ * CRYPTO_ALG_TYPE_ABLKCIPHER (listed as type "ablkcipher" in /proc/crypto).
+ *
+ * Asynchronous cipher operations imply that the function invocation for a
+ * cipher request returns immediately before the completion of the operation.
+ * The cipher request is scheduled as a separate kernel thread and therefore
+ * load-balanced on the different CPUs via the process scheduler. To allow
+ * the kernel crypto API to inform the caller about the completion of a cipher
+ * request, the caller must provide a callback function. That function is
+ * invoked with the cipher handle when the request completes.
+ *
+ * To support the asynchronous operation, additional information than just the
+ * cipher handle must be supplied to the kernel crypto API. That additional
+ * information is given by filling in the ablkcipher_request data structure.
+ *
+ * For the asynchronous block cipher API, the state is maintained with the tfm
+ * cipher handle. A single tfm can be used across multiple calls and in
+ * parallel. For asynchronous block cipher calls, context data supplied and
+ * only used by the caller can be referenced the request data structure in
+ * addition to the IV used for the cipher request. The maintenance of such
+ * state information would be important for a crypto driver implementer to
+ * have, because when calling the callback function upon completion of the
+ * cipher operation, that callback function may need some information about
+ * which operation just finished if it invoked multiple in parallel. This
+ * state information is unused by the kernel crypto API.
+ */
+
+/**
+ * crypto_alloc_ablkcipher() - allocate asynchronous block cipher handle
+ * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
+ *	      ablkcipher cipher
+ * @type: specifies the type of the cipher
+ * @mask: specifies the mask for the cipher
+ *
+ * Allocate a cipher handle for an ablkcipher. The returned struct
+ * crypto_ablkcipher is the cipher handle that is required for any subsequent
+ * API invocation for that ablkcipher.
+ *
+ * Return: allocated cipher handle in case of success; IS_ERR() is true in case
+ *	   of an error, PTR_ERR() returns the error code.
+ */
 struct crypto_ablkcipher *crypto_alloc_ablkcipher(const char *alg_name,
 						  u32 type, u32 mask);

@@ -830,11 +874,25 @@
 	return &tfm->base;
 }

+/**
+ * crypto_free_ablkcipher() - zeroize and free cipher handle
+ * @tfm: cipher handle to be freed
+ */
 static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
 {
 	crypto_free_tfm(crypto_ablkcipher_tfm(tfm));
 }

+/**
+ * crypto_has_ablkcipher() - Search for the availability of an ablkcipher.
+ * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
+ *	      ablkcipher
+ * @type: specifies the type of the cipher
+ * @mask: specifies the mask for the cipher
+ *
+ * Return: true when the ablkcipher is known to the kernel crypto API; false
+ *	   otherwise
+ */
 static inline int crypto_has_ablkcipher(const char *alg_name, u32 type,
 					u32 mask)
 {
@@ -848,12 +906,31 @@
 	return &crypto_ablkcipher_tfm(tfm)->crt_ablkcipher;
 }

+/**
+ * crypto_ablkcipher_ivsize() - obtain IV size
+ * @tfm: cipher handle
+ *
+ * The size of the IV for the ablkcipher referenced by the cipher handle is
+ * returned. This IV size may be zero if the cipher does not need an IV.
+ *
+ * Return: IV size in bytes
+ */
 static inline unsigned int crypto_ablkcipher_ivsize(
 	struct crypto_ablkcipher *tfm)
 {
 	return crypto_ablkcipher_crt(tfm)->ivsize;
 }

+/**
+ * crypto_ablkcipher_blocksize() - obtain block size of cipher
+ * @tfm: cipher handle
+ *
+ * The block size for the ablkcipher referenced with the cipher handle is
+ * returned. The caller may use that information to allocate appropriate
+ * memory for the data returned by the encryption or decryption operation
+ *
+ * Return: block size of cipher
+ */
 static inline unsigned int crypto_ablkcipher_blocksize(
 	struct crypto_ablkcipher *tfm)
 {
@@ -883,6 +960,22 @@
 	crypto_tfm_clear_flags(crypto_ablkcipher_tfm(tfm), flags);
 }

+/**
+ * crypto_ablkcipher_setkey() - set key for cipher
+ * @tfm: cipher handle
+ * @key: buffer holding the key
+ * @keylen: length of the key in bytes
+ *
+ * The caller provided key is set for the ablkcipher referenced by the cipher
+ * handle.
+ *
+ * Note, the key length determines the cipher type. Many block ciphers implement
+ * different cipher modes depending on the key size, such as AES-128 vs AES-192
+ * vs. AES-256. When providing a 16 byte key for an AES cipher handle, AES-128
+ * is performed.
+ *
+ * Return: 0 if the setting of the key was successful; < 0 if an error occurred
+ */
 static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
 					   const u8 *key, unsigned int keylen)
 {
@@ -891,12 +984,32 @@
 	return crt->setkey(crt->base, key, keylen);
 }

+/**
+ * crypto_ablkcipher_reqtfm() - obtain cipher handle from request
+ * @req: ablkcipher_request out of which the cipher handle is to be obtained
+ *
+ * Return the crypto_ablkcipher handle when furnishing an ablkcipher_request
+ * data structure.
+ *
+ * Return: crypto_ablkcipher handle
+ */
 static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm(
 	struct ablkcipher_request *req)
 {
 	return __crypto_ablkcipher_cast(req->base.tfm);
 }

+/**
+ * crypto_ablkcipher_encrypt() - encrypt plaintext
+ * @req: reference to the ablkcipher_request handle that holds all information
+ *	 needed to perform the cipher operation
+ *
+ * Encrypt plaintext data using the ablkcipher_request handle. That data
+ * structure and how it is filled with data is discussed with the
+ * ablkcipher_request_* functions.
+ *
+ * Return: 0 if the cipher operation was successful; < 0 if an error occurred
+ */
 static inline int crypto_ablkcipher_encrypt(struct ablkcipher_request *req)
 {
 	struct ablkcipher_tfm *crt =
@@ -904,6 +1017,17 @@
 	return crt->encrypt(req);
 }

+/**
+ * crypto_ablkcipher_decrypt() - decrypt ciphertext
+ * @req: reference to the ablkcipher_request handle that holds all information
+ *	 needed to perform the cipher operation
+ *
+ * Decrypt ciphertext data using the ablkcipher_request handle. That data
+ * structure and how it is filled with data is discussed with the
+ * ablkcipher_request_* functions.
+ *
+ * Return: 0 if the cipher operation was successful; < 0 if an error occurred
+ */
 static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
 {
 	struct ablkcipher_tfm *crt =
@@ -911,12 +1035,37 @@
 	return crt->decrypt(req);
 }

+/**
+ * DOC: Asynchronous Cipher Request Handle
+ *
+ * The ablkcipher_request data structure contains all pointers to data
+ * required for the asynchronous cipher operation. This includes the cipher
+ * handle (which can be used by multiple ablkcipher_request instances), pointer
+ * to plaintext and ciphertext, asynchronous callback function, etc. It acts
+ * as a handle to the ablkcipher_request_* API calls in a similar way as
+ * ablkcipher handle to the crypto_ablkcipher_* API calls.
+ */
+
+/**
+ * crypto_ablkcipher_reqsize() - obtain size of the request data structure
+ * @tfm: cipher handle
+ *
+ * Return: number of bytes
+ */
 static inline unsigned int crypto_ablkcipher_reqsize(
 	struct crypto_ablkcipher *tfm)
 {
 	return crypto_ablkcipher_crt(tfm)->reqsize;
 }

+/**
+ * ablkcipher_request_set_tfm() - update cipher handle reference in request
+ * @req: request handle to be modified
+ * @tfm: cipher handle that shall be added to the request handle
+ *
+ * Allow the caller to replace the existing ablkcipher handle in the request
+ * data structure with a different one.
+ */
 static inline void ablkcipher_request_set_tfm(
 	struct ablkcipher_request *req, struct crypto_ablkcipher *tfm)
 {
@@ -929,6 +1078,18 @@
 	return container_of(req, struct ablkcipher_request, base);
 }

+/**
+ * ablkcipher_request_alloc() - allocate request data structure
+ * @tfm: cipher handle to be registered with the request
+ * @gfp: memory allocation flag that is handed to kmalloc by the API call.
+ *
+ * Allocate the request data structure that must be used with the ablkcipher
+ * encrypt and decrypt API calls. During the allocation, the provided ablkcipher
+ * handle is registered in the request data structure.
+ *
+ * Return: allocated request handle in case of success; IS_ERR() is true in case
+ *	   of an error, PTR_ERR() returns the error code.
+ */
 static inline struct ablkcipher_request *ablkcipher_request_alloc(
 	struct crypto_ablkcipher *tfm, gfp_t gfp)
 {
@@ -943,11 +1104,40 @@
 	return req;
 }

+/**
+ * ablkcipher_request_free() - zeroize and free request data structure
+ * @req: request data structure cipher handle to be freed
+ */
 static inline void ablkcipher_request_free(struct ablkcipher_request *req)
 {
 	kzfree(req);
 }

+/**
+ * ablkcipher_request_set_callback() - set asynchronous callback function
+ * @req: request handle
+ * @flags: specify zero or an ORing of the flags
+ *         CRYPTO_TFM_REQ_MAY_BACKLOG the request queue may back log and
+ *	   increase the wait queue beyond the initial maximum size;
+ *	   CRYPTO_TFM_REQ_MAY_SLEEP the request processing may sleep
+ * @compl: callback function pointer to be registered with the request handle
+ * @data: The data pointer refers to memory that is not used by the kernel
+ *	  crypto API, but provided to the callback function for it to use. Here,
+ *	  the caller can provide a reference to memory the callback function can
+ *	  operate on. As the callback function is invoked asynchronously to the
+ *	  related functionality, it may need to access data structures of the
+ *	  related functionality which can be referenced using this pointer. The
+ *	  callback function can access the memory via the "data" field in the
+ *	  crypto_async_request data structure provided to the callback function.
+ *
+ * This function allows setting the callback function that is triggered once the
+ * cipher operation completes.
+ *
+ * The callback function is registered with the ablkcipher_request handle and
+ * must comply with the following template:
+ *
+ *	void callback_function(struct crypto_async_request *req, int error)
+ */
 static inline void ablkcipher_request_set_callback(
 	struct ablkcipher_request *req,
 	u32 flags, crypto_completion_t compl, void *data)
@@ -957,6 +1147,22 @@
 	req->base.flags = flags;
 }

+/**
+ * ablkcipher_request_set_crypt() - set data buffers
+ * @req: request handle
+ * @src: source scatter / gather list
+ * @dst: destination scatter / gather list
+ * @nbytes: number of bytes to process from @src
+ * @iv: IV for the cipher operation which must comply with the IV size defined
+ *      by crypto_ablkcipher_ivsize
+ *
+ * This function allows setting of the source data and destination data
+ * scatter / gather lists.
+ *
+ * For encryption, the source is treated as the plaintext and the
+ * destination is the ciphertext. For a decryption operation, the use is
+ * reversed: the source is the ciphertext and the destination is the plaintext.
+ */
 static inline void ablkcipher_request_set_crypt(
 	struct ablkcipher_request *req,
 	struct scatterlist *src, struct scatterlist *dst,


Add MXKErrorPresentable protocol for describing error to present on screen

error: pathspec 'MatrixKit/Utils/ErrorPresentation/MXKErrorPresentable.h' did not match any file(s) known to git

--- MatrixKit/Utils/ErrorPresentation/MXKErrorPresentable.h
+++ MatrixKit/Utils/ErrorPresentation/MXKErrorPresentable.h
@@ -0,0 +1,29 @@
+/*
+ Copyright 2018 New Vector Ltd
+
+ Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+/**
+ `MXKErrorPresentable` describe an error to display on screen.
+ */
+@protocol MXKErrorPresentable
+
+@required
+
+@property (strong, nonatomic, readonly) NSString *title;
+@property (strong, nonatomic, readonly) NSString *message;
+
+- (id)initWithTitle:(NSString*)title message:(NSString*)message;
+
+@end


session BUGFIX submodule features in capabilities

Fixes cesnet/netopeer2#573

--- src/session.c
+++ src/session.c
@@ -918,11 +918,65 @@
     ++(*count);
 }

+static struct lys_feature *
+nc_lys_next_feature(struct lys_feature *last, const struct lys_module *ly_mod, int *idx)
+{
+    uint8_t i;
+
+    assert(ly_mod);
+
+    /* find the (sub)module of the last feature */
+    if (last) {
+        for (i = 0; i < ly_mod->inc_size; ++i) {
+            if (*idx >= ly_mod->inc[i].submodule->features_size) {
+                /* not a feature from this submodule, skip */
+                continue;
+            }
+            if (last != ly_mod->inc[i].submodule->features + *idx) {
+                /* feature is not from this submodule */
+                continue;
+            }
+
+            /* we have found the submodule */
+            break;
+        }
+
+        /* feature not found in submodules, it must be in the main module */
+        assert((i < ly_mod->inc_size) || ((*idx < ly_mod->features_size) && (last == ly_mod->features + *idx)));
+
+        /* we want the next feature */
+        ++(*idx);
+    } else {
+        i = 0;
+        *idx = 0;
+    }
+
+    /* find the (sub)module of the next feature */
+    while ((i < ly_mod->inc_size) && (*idx == ly_mod->inc[i].submodule->features_size)) {
+        /* next submodule */
+        ++i;
+        *idx = 0;
+    }
+
+    /* get the next feature */
+    if (i < ly_mod->inc_size) {
+        last = ly_mod->inc[i].submodule->features + *idx;
+    } else if (*idx < ly_mod->features_size) {
+        last = ly_mod->features + *idx;
+    } else {
+        last = NULL;
+    }
+
+    return last;
+}
+
+
 API const char **
 nc_server_get_cpblts_version(struct ly_ctx *ctx, LYS_VERSION version)
 {
     const char **cpblts, *ver;
     const struct lys_module *mod, *devmod;
+    struct lys_feature *feat;
     int size = 10, count, features_count = 0, dev_count = 0, i, str_len, len;
     unsigned int u, v, module_set_id;
     char *s;
@@ -1055,29 +1109,29 @@
         str_len = sprintf(str, "%s?module=%s%s%s", mod->ns, mod->name,
                           mod->rev_size ? "&revision=" : "", mod->rev_size ? mod->rev[0].date : "");

-        if (mod->features_size) {
-            features_count = 0;
-            for (i = 0; i < mod->features_size; ++i) {
-                if (!(mod->features[i].flags & LYS_FENABLED)) {
-                    continue;
-                }
-                if (!features_count) {
-                    strcat(str, "&features=");
-                    str_len += 10;
-                }
-                len = strlen(mod->features[i].name);
-                if (str_len + 1 + len >= NC_CPBLT_BUF_LEN) {
-                    ERRINT;
-                    break;
-                }
-                if (features_count) {
-                    strcat(str, ",");
-                    ++str_len;
-                }
-                strcat(str, mod->features[i].name);
-                str_len += len;
-                features_count++;
-            }
+        features_count = 0;
+        i = 0;
+        feat = NULL;
+        while ((feat = nc_lys_next_feature(feat, mod, &i))) {
+            if (!(feat->flags & LYS_FENABLED)) {
+                continue;
+            }
+            if (!features_count) {
+                strcat(str, "&features=");
+                str_len += 10;
+            }
+            len = strlen(feat->name);
+            if (str_len + 1 + len >= NC_CPBLT_BUF_LEN) {
+                ERRINT;
+                break;
+            }
+            if (features_count) {
+                strcat(str, ",");
+                ++str_len;
+            }
+            strcat(str, feat->name);
+            str_len += len;
+            features_count++;
         }

         if (mod->deviated) {


include/linux: printk is needed in filter.h when CONFIG_BPF_JIT is defined

for make V=1 EXTRA_CFLAGS=-W ARCH=arm allmodconfig
    printk is need when CONFIG_BPF_JIT is defined
    or it will report pr_err and print_hex_dump are implicit declaration

Signed-off-by: Chen Gang <a683964d4489dfcd1de21d1566170b1d560c877b@asianux.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- include/linux/filter.h
+++ include/linux/filter.h
@@ -48,6 +48,9 @@
 extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len);

 #ifdef CONFIG_BPF_JIT
+#include <linux/linkage.h>
+#include <linux/printk.h>
+
 extern void bpf_jit_compile(struct sk_filter *fp);
 extern void bpf_jit_free(struct sk_filter *fp);


session BUGFIX first stop notification thread, then lock the session

--- src/session.c
+++ src/session.c
@@ -261,7 +261,16 @@
         return;
     }

-    /* mark session for closing */
+    /* stop notifications loop if any */
+    if (session->ntf_tid) {
+        tid = *session->ntf_tid;
+        free((pthread_t *)session->ntf_tid);
+        session->ntf_tid = NULL;
+        /* the thread now knows it should quit */
+
+        pthread_join(tid, NULL);
+    }
+
     if (session->ti_lock) {
         r = nc_timedlock(session->ti_lock, NC_READ_TIMEOUT * 1000);
         if (r == -1) {
@@ -272,16 +281,6 @@
         } else {
             locked = 1;
         }
-    }
-
-    /* stop notifications loop if any */
-    if (session->ntf_tid) {
-        tid = *session->ntf_tid;
-        free((pthread_t *)session->ntf_tid);
-        session->ntf_tid = NULL;
-        /* the thread now knows it should quit */
-
-        pthread_join(tid, NULL);
     }

     if ((session->side == NC_CLIENT) && (session->status == NC_STATUS_RUNNING) && locked) {
@@ -349,6 +348,7 @@
         data_free(session->data);
     }

+    /* mark session for closing */
     session->status = NC_STATUS_CLOSING;
     connected = nc_session_is_connected(session);


ENH: Set function getDirection as const

ENH: Set function getDirection as const

--- Modules/Core/Transform/include/otbSensorTransformBase.h
+++ Modules/Core/Transform/include/otbSensorTransformBase.h
@@ -76,7 +76,7 @@
   /** Check model validity */
   virtual bool IsValidSensorModel() const = 0;

-  TransformDirection getDirection() {
+  TransformDirection getDirection() const {
       return m_direction;
   };


printk_ratelimited(): fix uninitialized spinlock

ratelimit_state initialization of printk_ratelimited() seems broken.  This
fixes it by using DEFINE_RATELIMIT_STATE() to initialize spinlock
properly.

Signed-off-by: OGAWA Hirofumi <1dd685eef08048be95744a1b104ca593a93cc914@mail.parknet.co.jp>
Cc: Joe Perches <16a9a54ddf4259952e3c118c763138e83693d7fd@perches.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- include/linux/kernel.h
+++ include/linux/kernel.h
@@ -424,14 +424,13 @@
  * no local ratelimit_state used in the !PRINTK case
  */
 #ifdef CONFIG_PRINTK
-#define printk_ratelimited(fmt, ...)  ({		\
-	static struct ratelimit_state _rs = {		\
-		.interval = DEFAULT_RATELIMIT_INTERVAL, \
-		.burst = DEFAULT_RATELIMIT_BURST,       \
-	};                                              \
-							\
-	if (__ratelimit(&_rs))                          \
-		printk(fmt, ##__VA_ARGS__);		\
+#define printk_ratelimited(fmt, ...)  ({				\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+									\
+	if (__ratelimit(&_rs))						\
+		printk(fmt, ##__VA_ARGS__);				\
 })
 #else
 /* No effect, but we still get type checking even in the !PRINTK case: */


Fix warning regarding prototype of lsx_getopt

The ifdefs appear to be guarding against redefinition of getopt(), but that
shouldn't be a problem since we've renamed it to lsx_getopt.

--- src/sgetopt.h
+++ src/sgetopt.h
@@ -145,14 +145,7 @@
    `getopt'.  */

 #if (defined __STDC__ && __STDC__) || defined __cplusplus
-# ifdef __GNU_LIBRARY__
-/* Many other libraries have conflicting prototypes for getopt, with
-   differences in the consts, in stdlib.h.  To avoid compilation
-   errors, only prototype getopt for the GNU C library.  */
 extern int lsx_getopt (int ___argc, char *const *___argv, const char *__shortopts);
-# else /* not __GNU_LIBRARY__ */
-extern int lsx_getopt ();
-# endif /* __GNU_LIBRARY__ */

 # ifndef __need_getopt
 extern int lsx_getopt_long (int ___argc, char *const *___argv,


markers: add an if(0) to __mark_check_format()

Wrap __mark_check_format() into an if(0) to make sure that parameters such as

trace_mark(mm_page_alloc, "order %u pfn %lu", order, page?page_to_pfn(page):0);

(where page_to_pfn() has side-effects) won't generate code because of the
__mark_check_format().

Thanks to Jan Kiszka for reporting this.

Signed-off-by: Mathieu Desnoyers <007bef6a47fb57dff675bfa1b0b798b4bdfbfc25@polymtl.ca>
Cc: Jan Kiszka <a5b45c9af271d077f30d36aa7d9b988eed9d56eb@siemens.com>
Cc: "Frank Ch. Eigler" <0d9b258d3f4a2acc10aab45b5b8d6cc54368f801@redhat.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- include/linux/marker.h
+++ include/linux/marker.h
@@ -104,9 +104,15 @@
 #define MARK_NOARGS " "

 /* To be used for string format validity checking with gcc */
-static inline void __printf(1, 2) __mark_check_format(const char *fmt, ...)
+static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...)
 {
 }
+
+#define __mark_check_format(format, args...)				\
+	do {								\
+		if (0)							\
+			___mark_check_format(format, ## args);		\
+	} while (0)

 extern marker_probe_func __mark_empty_function;


some clean-up

some clean-up

--- src/sgs_fnt.c
+++ src/sgs_fnt.c
@@ -19,18 +19,7 @@
 {
 	return *tok == ST_KEYWORD && tok[ 1 ] == strlen( text ) && strncmp( (const char*) tok + 2, text, tok[ 1 ] ) == 0;
 }
-/*
-static char brace_opposite( char c )
-{
-	switch( c )
-	{
-	case '(':	return ')';
-	case '[':	return ']';
-	case '{':	return '}';
-	default:	return 0;
-	}
-}
-*/
+

 static FTNode* make_node( int type, TokenList token, FTNode* next, FTNode* child )
 {
@@ -152,80 +141,6 @@

-/*
-	FUNC / finds the logical expected end of an expression
-	ARGS / context, token stream, list of ending characters
-	ERRS / brace mismatch, end of expression
-*/
-/*
-static TokenList detect_exp( SGS_CTX, TokenList at, TokenList end, const char* ends, int superr )
-{
-	StrBuf stack = strbuf_create();
-	LineNum line = -1, fline;
-
-	FUNC_BEGIN;
-	FUNC_INFO( "Looking for %s\n", ends );
-
-	sgs_BreakIf( !C );
-	sgs_BreakIf( !at );
-
-	if( !*at )
-	{
-		if( !superr )
-		{
-			sgs_Printf( C, SGS_ERROR, -1, "End of expression '%s' not found", ends );
-			C->state |= SGS_HAS_ERRORS;
-		}
-		goto fail2;
-	}
-
-	fline = sgsT_LineNum( at );
-	while( at < end && *at && ( stack.size > 0 || !isoneof( *at, ends ) ) )
-	{
-		line = sgsT_LineNum( at );
-		if( isoneof( *at, "([{" ) )
-		{
-			strbuf_appbuf( &stack, &line, sizeof( LineNum ) );
-			strbuf_appchr( &stack, brace_opposite( *at ) );
-		}
-		if( isoneof( *at, ")]}" ) )
-		{
-			if( stack.size == 0 || *at != stack.ptr[ stack.size - 1 ] )
-			{
-				sgs_Printf( C, SGS_ERROR, stack.size > 0 ? ST_READLN( stack.ptr + stack.size - 1 - sizeof( LineNum ) ) : -1,
-							"Brace mismatch detected at line %d!", line );
-				C->state |= SGS_HAS_ERRORS;
-				goto fail;
-			}
-			else
-				strbuf_resize( &stack, stack.size - 1 - sizeof( LineNum ) );
-		}
-		at = sgsT_Next( at );
-	}
-
-	if( !*at || at >= end )
-	{
-		if( !superr )
-		{
-			sgs_Printf( C, SGS_ERROR, fline, "End of expression '%s' not found", ends );
-			C->state |= SGS_HAS_ERRORS;
-		}
-		goto fail;
-	}
-
-	strbuf_destroy( &stack );
-	FUNC_END;
-	return at;
-
-fail:
-	strbuf_destroy( &stack );
-fail2:
-	FUNC_END;
-	return NULL;
-}
-*/
-
-
 SFTRET parse_arg( SFTC, int argid, char end )
 {
 	FTNode* node = NULL;
@@ -699,7 +614,10 @@
 						curexpr = expr;

 						if( SFTC_IS( cend ) )
+						{
+							SFTC_NEXT;
 							break;
+						}

 						SFTC_NEXT;
 					}
@@ -764,7 +682,8 @@
 			}
 			else
 			{
-				sgs_Printf( F->C, SGS_ERROR, SFTC_LINENUM, "Unexpected token '%c' found!", *SFTC_AT );
+				sgs_Printf( F->C, SGS_ERROR, SFTC_LINENUM,
+					"Unexpected token '%c' found! (prev=%c)", *SFTC_AT, prev );
 				F->C->state |= SGS_MUST_STOP;
 			}
 		}
@@ -811,6 +730,8 @@
 	FTNode* curexp = NULL, *node;
 	char endtoklist[] = { ',', endtok, 0 };

+	FUNC_BEGIN;
+
 	for(;;)
 	{
 		if( SFTC_IS( endtok ) )
@@ -820,30 +741,34 @@
 		else if( SFTC_IS( 0 ) )
 		{
 			SFTC_UNEXP;
-			SFTC_SETERR;
-			sgsFT_Destroy( explist );
-			return NULL;
-		}
-		else if( SFTC_IS( ',' ) )
+			goto fail;
+		}
+		else if( SFTC_IS( ',' ) || SFTC_AT == explist->token )
 		{
 			node = parse_exp( F, endtoklist, 2 );
+			if( !node )
+				goto fail;
 			if( curexp )
 				curexp->next = node;
 			else
 				explist->child = node;
 			curexp = node;
-			SFTC_NEXT;
 		}
 		else
 		{
 			sgs_Printf( F->C, SGS_ERROR, SFTC_LINENUM, "Expected ',' or '%c'", endtok );
-			SFTC_SETERR;
-			sgsFT_Destroy( explist );
-			return NULL;
-		}
-	}
-
+			goto fail;
+		}
+	}
+
+	FUNC_END;
 	return explist;
+
+fail:
+	SFTC_SETERR;
+	sgsFT_Destroy( explist );
+	FUNC_END;
+	return NULL;
 }

 SFTRET parse_if( SFTC )
@@ -1242,6 +1167,7 @@
 	/* BLOCK OF STATEMENTS */
 	else if( SFTC_IS( ST_CBRKL ) )
 	{
+		SFTC_NEXT;
 		node = parse_stmtlist( F, '}' );
 		if( !node ) goto fail;


padata: add missing __percpu markup in include/linux/padata.h

parallel_data->queue is a percpu pointer but was missing __percpu markup.
Add it.

Signed-off-by: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@gmail.com>
Acked-by: Steffen Klassert <66deb1d63f85161cc287ce2bac0c65cb5ae958a7@secunet.com>
Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>

--- include/linux/padata.h
+++ include/linux/padata.h
@@ -127,8 +127,8 @@
  */
 struct parallel_data {
 	struct padata_instance		*pinst;
-	struct padata_parallel_queue	*pqueue;
-	struct padata_serial_queue	*squeue;
+	struct padata_parallel_queue	__percpu *pqueue;
+	struct padata_serial_queue	__percpu *squeue;
 	atomic_t			seq_nr;
 	atomic_t			reorder_objects;
 	atomic_t			refcnt;


ptrace: cleanup ptrace_init_task()->ptrace_link() path

No functional changes.

ptrace_init_task() looks confusing, as if we always auto-attach when "bool
ptrace" argument is true, while in fact we attach only if current is
traced.

Make the code more explicit and kill now unused ptrace_link().

Signed-off-by: Oleg Nesterov <20b70f0af00562e63758b9ee42012ecc96c58590@redhat.com>
Acked-by: Roland McGrath <0d270388f2f92757a5de0f4bd891d3b392c44c4f@redhat.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- include/linux/ptrace.h
+++ include/linux/ptrace.h
@@ -105,12 +105,7 @@
 {
 	return child->real_parent != child->parent;
 }
-static inline void ptrace_link(struct task_struct *child,
-			       struct task_struct *new_parent)
-{
-	if (unlikely(child->ptrace))
-		__ptrace_link(child, new_parent);
-}
+
 static inline void ptrace_unlink(struct task_struct *child)
 {
 	if (unlikely(child->ptrace))
@@ -169,9 +164,9 @@
 	INIT_LIST_HEAD(&child->ptraced);
 	child->parent = child->real_parent;
 	child->ptrace = 0;
-	if (unlikely(ptrace)) {
+	if (unlikely(ptrace) && (current->ptrace & PT_PTRACED)) {
 		child->ptrace = current->ptrace;
-		ptrace_link(child, current->parent);
+		__ptrace_link(child, current->parent);
 	}
 }


tools: Adopt rounddown_pow_of_two and deps

Will be used to make sure we pass a power of two when automatically
setting up the perf_mmap addr range length, as the kernel code
validating input on /proc/sys/kernel/perf_event_mlock_kb accepts any
integer, if we plain use it to set up the mmap lenght, we may get an
EINVAL when passing a non power of two.

Cc: Adrian Hunter <41bb5944f244750b7cf0394140496972a3f1bee3@intel.com>
Cc: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@suse.de>
Cc: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Cc: Don Zickus <3c9a8cec2f33672bf03519b05ce2324e6cf5717a@redhat.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Jiri Olsa <2c6594f608aa3d41e98d48846a6328831f7084ad@redhat.com>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Stephane Eranian <f199ae9781930a5b94b284ca2f471140752002a7@google.com>
Link: 64335245423c55738b12d132a1608766cf07a058@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>


Document parameter preconditions for the ARIA module

--- include/mbedtls/aria.h
+++ include/mbedtls/aria.h
@@ -91,14 +91,15 @@
  *                 It must be the first API called before using
  *                 the context.
  *
- * \param ctx      The ARIA context to initialize.
+ * \param ctx      The ARIA context to initialize. Must not be \c NULL.
  */
 void mbedtls_aria_init( mbedtls_aria_context *ctx );

 /**
  * \brief          This function releases and clears the specified ARIA context.
  *
- * \param ctx      The ARIA context to clear.
+ * \param ctx      The ARIA context to clear. May be \c NULL, in which
+ *                 case this function is a no-op.
  */
 void mbedtls_aria_free( mbedtls_aria_context *ctx );

@@ -106,14 +107,16 @@
  * \brief          This function sets the encryption key.
  *
  * \param ctx      The ARIA context to which the key should be bound.
- * \param key      The encryption key.
+ *                 Must be initialized.
+ * \param key      The encryption key. Must be a readable buffer
+ *                 of size \p keybits bits.
  * \param keybits  The size of data passed in bits. Valid options are:
  *

128 bits

  *
192 bits

  *
256 bits

  *
- * \return         \c 0 on success or #MBEDTLS_ERR_ARIA_BAD_INPUT_DATA
- *                 on failure.
+ * \return         \c 0 on success.
+ * \return         A negative error code on failure.
  */
 int mbedtls_aria_setkey_enc( mbedtls_aria_context *ctx,
                              const unsigned char *key,
@@ -123,13 +126,16 @@
  * \brief          This function sets the decryption key.
  *
  * \param ctx      The ARIA context to which the key should be bound.
- * \param key      The decryption key.
+ *                 Must be initialized.
+ * \param key      The decryption key. Must be a readable buffer
+ *                 of size \p keybits bits.
  * \param keybits  The size of data passed. Valid options are:
  *

128 bits

  *
192 bits

  *
256 bits

  *
- * \return         \c 0 on success, or #MBEDTLS_ERR_ARIA_BAD_INPUT_DATA on failure.
+ * \return         \c 0 on success.
+ * \return         A negative error code on failure.
  */
 int mbedtls_aria_setkey_dec( mbedtls_aria_context *ctx,
                              const unsigned char *key,
@@ -148,10 +154,12 @@
  *                 call to this API with the same context.
  *
  * \param ctx      The ARIA context to use for encryption or decryption.
+ *                 Must be initialized.
  * \param input    The 16-Byte buffer holding the input data.
  * \param output   The 16-Byte buffer holding the output data.

  * \return         \c 0 on success.
+ * \return         A negative error code on failure.
  */
 int mbedtls_aria_crypt_ecb( mbedtls_aria_context *ctx,
                             const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
@@ -183,16 +191,20 @@
  *
  *
  * \param ctx      The ARIA context to use for encryption or decryption.
+ *                 Must be initialized.
  * \param mode     The ARIA operation: #MBEDTLS_ARIA_ENCRYPT or
  *                 #MBEDTLS_ARIA_DECRYPT.
  * \param length   The length of the input data in Bytes. This must be a
  *                 multiple of the block size (16 Bytes).
  * \param iv       Initialization vector (updated after use).
+ *                 Must be a readable buffer of size 16 Bytes.
  * \param input    The buffer holding the input data.
+ *                 May be \c NULL if `length == 0`.
  * \param output   The buffer holding the output data.
- *
- * \return         \c 0 on success, or #MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH
- *                 on failure.
+ *                 May be \c NULL if `length == 0`.
+ *
+ * \return         \c 0 on success.
+ * \return         A negative error code on failure.
  */
 int mbedtls_aria_crypt_cbc( mbedtls_aria_context *ctx,
                             int mode,
@@ -227,15 +239,21 @@
  *
  *
  * \param ctx      The ARIA context to use for encryption or decryption.
+ *                 Must be initialized.
  * \param mode     The ARIA operation: #MBEDTLS_ARIA_ENCRYPT or
  *                 #MBEDTLS_ARIA_DECRYPT.
  * \param length   The length of the input data.
  * \param iv_off   The offset in IV (updated after use).
+ *                 Must not be larger than 15.
  * \param iv       The initialization vector (updated after use).
+ *                 Must be a readable buffer of size 16 Bytes.
  * \param input    The buffer holding the input data.
+ *                 May be \c NULL if `length == 0`.
  * \param output   The buffer holding the output data.
- *
- * \return         \c 0 on success.
+ *                 May be \c NULL if `length == 0`.
+ *
+ * \return         \c 0 on success.
+ * \return         A negative error code on failure.
  */
 int mbedtls_aria_crypt_cfb128( mbedtls_aria_context *ctx,
                                int mode,
@@ -305,17 +323,24 @@
  *             securely discarded as soon as it's no longer needed.
  *
  * \param ctx              The ARIA context to use for encryption or decryption.
+ *                         Must be initialized.
  * \param length           The length of the input data.
  * \param nc_off           The offset in the current \p stream_block, for
  *                         resuming within the current cipher stream. The
  *                         offset pointer should be 0 at the start of a stream.
- * \param nonce_counter    The 128-bit nonce and counter.
- * \param stream_block     The saved stream block for resuming. This is
- *                         overwritten by the function.
+ *                         Must not be larger than 15.
+ * \param nonce_counter    The 128-bit nonce and counter. Must point to
+ *                         an RW-buffer of length 16 bytes.
+ * \param stream_block     The saved stream block for resuming. Must point to
+ *                         an RW-buffer of length 16 bytes.
+ *                         This is overwritten by the function.
  * \param input            The buffer holding the input data.
+ *                         May be \c NULL if `length == 0`.
  * \param output           The buffer holding the output data.
- *
- * \return     \c 0 on success.
+ *                         May be \c NULL if `length == 0`.
+ *
+ * \return                 \c 0 on success.
+ * \return                 A negative error code on failure.
  */
 int mbedtls_aria_crypt_ctr( mbedtls_aria_context *ctx,
                             size_t length,


asn1: Remove dependency on X.509

asn1: Remove dependency on X.509

Doxygen will fail to build if we have references to files that don't
exist. Since we are planning on removing X.509 soon, we even need to
remove explicit Doxygen references to X.509 things as those will no
longer resolve once the X.509 files are deleted.

fixup! asn1: Remove dependency on X.509

--- include/mbedtls/asn1.h
+++ include/mbedtls/asn1.h
@@ -66,7 +66,7 @@
  * - 0x02 -- tag indicating INTEGER
  * - 0x01 -- length in octets
  * - 0x05 -- value
- * Such sequences are typically read into \c ::mbedtls_x509_buf.
+ * Such sequences are typically read into Mbed TLS's \c mbedtls_x509_buf.
  * \{
  */
 #define MBEDTLS_ASN1_BOOLEAN                 0x01


sub shm BUGFIX missing read and write unlock on error

Fixes #1878

--- src/shm_sub.c
+++ src/shm_sub.c
@@ -590,7 +590,7 @@
             /* remap sub SHM once we have the lock, it will do anything only on the first call */
             err_info = sr_shm_remap(&shm_sub, sizeof *multi_sub_shm + diff_lyb_len);
             if (err_info) {
-                goto cleanup;
+                goto cleanup_wrunlock;
             }
             multi_sub_shm = (sr_multi_sub_shm_t *)shm_sub.addr;

@@ -604,7 +604,7 @@
             /* notify using event pipe and wait until all the subscribers have processed the event */
             if ((err_info = sr_shmsub_change_notify_evpipe(mod_info->conn->ext_shm.addr, mod, mod_info->ds,
                     SR_SUB_EV_UPDATE, cur_priority))) {
-                goto cleanup;
+                goto cleanup_wrunlock;
             }

             /* SUB WRITE UNLOCK */
@@ -631,7 +631,7 @@

             /* remap sub SHM */
             if ((err_info = sr_shm_remap(&shm_sub, 0))) {
-                goto cleanup;
+                goto cleanup_rdunlock;
             }
             multi_sub_shm = (sr_multi_sub_shm_t *)shm_sub.addr;

@@ -641,7 +641,7 @@
             if (ly_errno) {
                 sr_errinfo_new_ly(&err_info, ly_ctx);
                 sr_errinfo_new(&err_info, SR_ERR_VALIDATION_FAILED, NULL, "Failed to parse \"update\" edit.");
-                goto cleanup;
+                goto cleanup_rdunlock;
             }

             /* event fully processed */
@@ -669,7 +669,15 @@
     }

     /* success */
-
+    goto cleanup;
+
+cleanup_wrunlock:
+    /* SUB WRITE UNLOCK */
+    sr_rwunlock(&multi_sub_shm->lock, SR_LOCK_WRITE, __func__);
+    goto cleanup;
+cleanup_rdunlock:
+    /* SUB READ UNLOCK */
+    sr_rwunlock(&multi_sub_shm->lock, SR_LOCK_READ, __func__);
 cleanup:
     free(diff_lyb);
     sr_shm_clear(&shm_sub);
@@ -1207,7 +1215,7 @@

     /* notify using event pipe and wait until the subscriber has processed the event */
     if ((err_info = sr_shmsub_notify_evpipe(evpipe_num))) {
-        goto cleanup;
+        goto cleanup_wrunlock;
     }

     /* SUB WRITE UNLOCK */


database: completed API documentation

database: completed API documentation

--- include/mpd/database.h
+++ include/mpd/database.h
@@ -26,6 +26,13 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+/*! \file
+ * \brief Database
+ *
+ * This file declares functions which query or update MPD's music
+ * database.
+ */
+
 #ifndef MPD_DATABASE_H
 #define MPD_DATABASE_H

@@ -38,31 +45,60 @@
 #endif

 /**
- * recursively fetches all songs/dir/playlists in "dir" (no metadata
- * is returned)
+ * Get a recursive list of all directories, songs and playlist from
+ * MPD.  They are returned without metadata.  This is a rather
+ * expensive operation, because the response may be large.
+ *
+ * @param connection the connection to MPD
+ * @param path an optional base path for the query
+ * @return true on success, false on error
  */
 bool
-mpd_send_listall(struct mpd_connection *connection, const char *dir);
+mpd_send_listall(struct mpd_connection *connection, const char *path);

 /**
- * same as mpd_send_listall(), but also metadata is returned
+ * Like #mpd_send_listall(), but return metadata.  This operation is
+ * even more expensive, because the response is larger.  If it is
+ * larger than a configurable server-side limit, MPD may disconnect
+ * you.
+ *
+ * @param connection the connection to MPD
+ * @param path an optional base path for the query
+ * @return true on success, false on error
  */
 bool
-mpd_send_listallinfo(struct mpd_connection *connection, const char *dir);
+mpd_send_listallinfo(struct mpd_connection *connection, const char *path);

 /**
- * non-recursive version of mpd_send_listallinfo()
+ * Get a list of all directories, songs and playlist in a directory
+ * from MPD, including metadata.
+ *
+ * @param connection the connection to MPD
+ * @param path the directory to be listed
+ * @return true on success, false on error
  */
 bool
-mpd_send_lsinfo(struct mpd_connection *connection, const char *dir);
+mpd_send_lsinfo(struct mpd_connection *connection, const char *path);

+/**
+ * Instructs MPD to update the music database: find new files, remove
+ * deleted files, update modified files.
+ *
+ * @param connection the connection to MPD
+ * @param path optional path to update; if NULL, then all of the music
+ * directory is updated
+ * @return true on success, false on error
+ */
 bool
 mpd_send_update(struct mpd_connection *connection, const char *path);

 /**
  * Receives the id the of the update job which was submitted by
  * mpd_send_update().
+ *
+ * @param connection the connection to MPD
+ * @return a positive job id on success, 0 on error
  */
 int
 mpd_recv_update_id(struct mpd_connection *connection);


shm sub BUGFIX handle dead subscriptions

... when publishing events for them.
Fixes #2787

--- src/shm_sub.c
+++ src/shm_sub.c
@@ -977,6 +977,17 @@
             continue;
         }

+        /* correctly start the loop, with fake last priority 1 higher than the actual highest */
+        if ((err_info = sr_shmsub_change_notify_next_subscription(mod_info->conn, mod, mod_info->ds, SR_SUB_EV_UPDATE,
+                cur_priority + 1, &cur_priority, &subscriber_count, NULL))) {
+            goto cleanup;
+        }
+
+        if (!subscriber_count) {
+            /* the subscription(s) was recovered just now so there are not any */
+            continue;
+        }
+
         /* prepare diff to write into SHM */
         if (!diff_lyb && lyd_print_mem(&diff_lyb, mod_info->diff, LYD_LYB, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS)) {
             sr_errinfo_new_ly(&err_info, ly_ctx);
@@ -990,12 +1001,6 @@
             goto cleanup;
         }
         multi_sub_shm = (sr_multi_sub_shm_t *)shm_sub.addr;
-
-        /* correctly start the loop, with fake last priority 1 higher than the actual highest */
-        if ((err_info = sr_shmsub_change_notify_next_subscription(mod_info->conn, mod, mod_info->ds, SR_SUB_EV_UPDATE,
-                cur_priority + 1, &cur_priority, &subscriber_count, NULL))) {
-            goto cleanup;
-        }

         /* SUB WRITE LOCK */
         if ((err_info = sr_shmsub_notify_new_wrlock((sr_sub_shm_t *)multi_sub_shm, mod->ly_mod->name, 0, cid))) {
@@ -1195,22 +1200,27 @@
             continue;
         }

-        /* prepare the diff to write into subscription SHM */
-        if (!diff_lyb && (err_info = sr_lyd_print_lyb(mod_info->diff, &diff_lyb, &diff_lyb_len))) {
-            goto cleanup;
-        }
-
-        /* open sub SHM and map it */
-        if ((err_info = sr_shmsub_open_map(mod->ly_mod->name, sr_ds2str(mod_info->ds), -1, &shm_sub))) {
-            goto cleanup;
-        }
-        multi_sub_shm = (sr_multi_sub_shm_t *)shm_sub.addr;
-
         /* correctly start the loop, with fake last priority 1 higher than the actual highest */
         if ((err_info = sr_shmsub_change_notify_next_subscription(mod_info->conn, mod, mod_info->ds, SR_SUB_EV_CHANGE,
                 cur_priority + 1, &cur_priority, &subscriber_count, &opts))) {
             goto cleanup;
         }
+
+        if (!subscriber_count) {
+            /* the subscription(s) was recovered just now so there are not any */
+            continue;
+        }
+
+        /* prepare the diff to write into subscription SHM */
+        if (!diff_lyb && (err_info = sr_lyd_print_lyb(mod_info->diff, &diff_lyb, &diff_lyb_len))) {
+            goto cleanup;
+        }
+
+        /* open sub SHM and map it */
+        if ((err_info = sr_shmsub_open_map(mod->ly_mod->name, sr_ds2str(mod_info->ds), -1, &shm_sub))) {
+            goto cleanup;
+        }
+        multi_sub_shm = (sr_multi_sub_shm_t *)shm_sub.addr;

         /* SUB WRITE LOCK */
         if ((err_info = sr_shmsub_notify_new_wrlock((sr_sub_shm_t *)multi_sub_shm, mod->ly_mod->name, 0, cid))) {
@@ -1315,22 +1325,27 @@
             continue;
         }

-        /* prepare the diff to write into subscription SHM */
-        if (!diff_lyb && (err_info = sr_lyd_print_lyb(mod_info->diff, &diff_lyb, &diff_lyb_len))) {
-            goto cleanup;
-        }
-
-        /* open sub SHM and map it */
-        if ((err_info = sr_shmsub_open_map(mod->ly_mod->name, sr_ds2str(mod_info->ds), -1, &shm_sub))) {
-            goto cleanup;
-        }
-        multi_sub_shm = (sr_multi_sub_shm_t *)shm_sub.addr;
-
         /* correctly start the loop, with fake last priority 1 higher than the actual highest */
         if ((err_info = sr_shmsub_change_notify_next_subscription(mod_info->conn, mod, mod_info->ds, SR_SUB_EV_DONE,
                 cur_priority + 1, &cur_priority, &subscriber_count, &opts))) {
             goto cleanup;
         }
+
+        if (!subscriber_count) {
+            /* the subscription(s) was recovered just now so there are not any */
+            continue;
+        }
+
+        /* prepare the diff to write into subscription SHM */
+        if (!diff_lyb && (err_info = sr_lyd_print_lyb(mod_info->diff, &diff_lyb, &diff_lyb_len))) {
+            goto cleanup;
+        }
+
+        /* open sub SHM and map it */
+        if ((err_info = sr_shmsub_open_map(mod->ly_mod->name, sr_ds2str(mod_info->ds), -1, &shm_sub))) {
+            goto cleanup;
+        }
+        multi_sub_shm = (sr_multi_sub_shm_t *)shm_sub.addr;

         /* SUB WRITE LOCK */
         if ((err_info = sr_shmsub_notify_new_wrlock((sr_sub_shm_t *)multi_sub_shm, mod->ly_mod->name, 0, cid))) {
@@ -1471,6 +1486,17 @@
             continue;
         }

+        /* correctly start the loop, with fake last priority 1 higher than the actual highest */
+        if ((err_info = sr_shmsub_change_notify_next_subscription(mod_info->conn, mod, mod_info->ds, SR_SUB_EV_ABORT,
+                cur_priority + 1, &cur_priority, &subscriber_count, NULL))) {
+            goto cleanup_wrunlock;
+        }
+
+        if (!subscriber_count) {
+            /* the subscription(s) was recovered just now so there are not any */
+            goto clear_shm;
+        }
+
         assert(mod_info->diff);

         /* prepare the diff to write into subscription SHM */
@@ -1488,20 +1514,15 @@
             lyd_free_all(abort_diff);
         }

-        /* correctly start the loop, with fake last priority 1 higher than the actual highest */
-        if ((err_info = sr_shmsub_change_notify_next_subscription(mod_info->conn, mod, mod_info->ds, SR_SUB_EV_ABORT,
-                cur_priority + 1, &cur_priority, &subscriber_count, NULL))) {
-            goto cleanup_wrunlock;
-        }
-        if (last_subscr && (err_priority == cur_priority)) {
-            /* do not notify subscribers that did not process the previous event */
-            subscriber_count -= err_subscriber_count;
-            if (!subscriber_count) {
-                goto clear_shm;
-            }
-        }
-
         do {
+            if (last_subscr && (err_priority == cur_priority)) {
+                /* do not notify subscribers that did not process the previous event */
+                subscriber_count -= err_subscriber_count;
+                if (!subscriber_count) {
+                    goto clear_shm;
+                }
+            }
+
             /* write "abort" event with the same LYB data trees */
             if ((err_info = sr_shmsub_multi_notify_write_event(multi_sub_shm, cid, mod->request_id, cur_priority,
                     SR_SUB_EV_ABORT, orig_name, orig_data, subscriber_count, &shm_data_sub, NULL, diff_lyb, diff_lyb_len,
@@ -1537,14 +1558,6 @@
             if ((err_info = sr_shmsub_change_notify_next_subscription(mod_info->conn, mod, mod_info->ds,
                     SR_SUB_EV_ABORT, cur_priority, &cur_priority, &subscriber_count, NULL))) {
                 goto cleanup_wrunlock;
-            }
-
-            if (last_subscr && (err_priority == cur_priority)) {
-                /* do not notify subscribers that did not process the previous event */
-                subscriber_count -= err_subscriber_count;
-                if (!subscriber_count) {
-                    goto clear_shm;
-                }
             }
         } while (subscriber_count);

@@ -1864,7 +1877,18 @@
     if (!sr_shmsub_rpc_notify_has_subscription(conn, shm_rpc, input, &cur_priority)) {
         sr_errinfo_new(&err_info, SR_ERR_UNSUPPORTED, "There are no matching subscribers for RPC/action \"%s\".",
                 op_path);
-        return err_info;
+        goto cleanup;
+    }
+
+    /* correctly start the loop, with fake last priority 1 higher than the actual highest */
+    if ((err_info = sr_shmsub_rpc_notify_next_subscription(conn, shm_rpc, input, cur_priority + 1, &cur_priority,
+            &evpipes, &subscriber_count, &opts))) {
+        goto cleanup;
+    }
+
+    if (!subscriber_count) {
+        /* the subscription(s) was recovered just now so there are not any */
+        goto cleanup;
     }

     /* print the input into LYB */
@@ -1879,12 +1903,6 @@
         goto cleanup;
     }
     multi_sub_shm = (sr_multi_sub_shm_t *)shm_sub.addr;
-
-    /* correctly start the loop, with fake last priority 1 higher than the actual highest */
-    if ((err_info = sr_shmsub_rpc_notify_next_subscription(conn, shm_rpc, input, cur_priority + 1, &cur_priority,
-            &evpipes, &subscriber_count, &opts))) {
-        goto cleanup;
-    }

     /* SUB WRITE LOCK */
     if ((err_info = sr_shmsub_notify_new_wrlock((sr_sub_shm_t *)multi_sub_shm, op_path, 0, conn->cid))) {
@@ -2038,16 +2056,16 @@
                 &evpipes, &subscriber_count, NULL))) {
             goto cleanup_wrunlock;
         }
-        if (err_priority == cur_priority) {
+        if (subscriber_count && (err_priority == cur_priority)) {
             /* do not notify subscribers that did not process the previous event */
             subscriber_count -= err_subscriber_count;
-            if (!subscriber_count) {
-                if (first_iter) {
-                    /* at least clear the SHM in this case */
-                    goto clear_shm;
-                } else {
-                    goto cleanup_wrunlock;
-                }
+        }
+        if (!subscriber_count) {
+            if (first_iter) {
+                /* at least clear the SHM in this case */
+                goto clear_shm;
+            } else {
+                goto cleanup_wrunlock;
             }
         }
         first_iter = 0;


tools: bpf_jit_disasm: ignore image address for disasm

seccomp filters use kernel JIT image addresses, so bpf_jit_enable=2 prints
[ 20.146438] flen=3 proglen=82 pass=0 image=0000000000000000
[ 20.146442] JIT code: 00000000: 55 48 89 e5 48 81 ec 28 02 00 00 ...

ignore image address, so that seccomp filters can be disassembled

Signed-off-by: Alexei Starovoitov <c24c0248770ae98831f8a654310d4c2e07514c61@plumgrid.com>
Acked-by: Daniel Borkmann <9ff04a02a69f376b2b9aeec27187017cbf3cf5f9@redhat.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


NetLabel: change netlbl_secattr_init() to return void

The netlbl_secattr_init() function would always return 0 making it pointless
to have a return value.  This patch changes the function to return void.

Signed-off-by: Paul Moore <0fd1bf839ec6540c47f8fc82b7605eea08b33a06@hp.com>
Signed-off-by: James Morris <10d11de3abc355eabe955bb734f0f8e71da56e16@namei.org>

--- include/net/netlabel.h
+++ include/net/netlabel.h
@@ -169,14 +169,12 @@
  * @secattr: the struct to initialize
  *
  * Description:
- * Initialize an already allocated netlbl_lsm_secattr struct.  Returns zero on
- * success, negative values on error.
- *
- */
-static inline int netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
+ * Initialize an already allocated netlbl_lsm_secattr struct.
+ *
+ */
+static inline void netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
 {
 	memset(secattr, 0, sizeof(*secattr));
-	return 0;
 }

 /**


Improve file system sync

Improve file system sync

Signed-off-by: Johnothan King <a8ddc7217a18e572ca3c72013b682efc8914e2df@protonmail.com>

--- cmd/init.c
+++ cmd/init.c
@@ -195,6 +195,10 @@

 			// Switch the current runlevel
 			else {
+				// Synchronize all file systems (Pass 1)
+				printf(CYAN "* " WHITE "Synchronizing all file systems (Pass 1)..." RESET "\n");
+				sync();
+
 				// Run rc.shutdown
 				sh("/etc/leaninit.d/rc.shutdown");
 				kill(-1, SIGKILL);
@@ -204,8 +208,8 @@
 				tty = open("/dev/console", O_RDWR);
 				login_tty(tty);

-				// Synchronize all file systems
-				printf(CYAN "* " WHITE "Synchronizing all file systems..." RESET "\n");
+				// Synchronize file systems again (Pass 2)
+				printf(CYAN "* " WHITE "Synchronizing all file systems (Pass 2)..." RESET "\n");
 				sync();

 				// Handle the given signal properly
@@ -213,14 +217,17 @@

 					// Halt
 					case SIGUSR1:
+						printf(CYAN "* " WHITE "The system will now halt!" RESET "\n");
 						return reboot(SYS_HALT);

 					// Poweroff
 					case SIGUSR2:
+						printf(CYAN "* " WHITE "The system will now poweroff!" RESET "\n");
 						return reboot(SYS_POWEROFF);

 					// Reboot
 					case SIGINT:
+						printf(CYAN "* " WHITE "The system will now reboot!" RESET "\n");
 						return reboot(RB_AUTOBOOT);

 					// Switch to single-user


Fixed warning on Windows.

Fixed warning on Windows.

--- src/runtime/json/common.h
+++ src/runtime/json/common.h
@@ -56,21 +56,24 @@

 typedef std::ostream& (*std_omanip_type)(std::ostream&);

-inline std::ostream& if_do( std::ostream &o, bool expr, std_omanip_type fn ) {
+inline std::ostream& if_do_impl( std::ostream &o, bool expr,
+                                 std_omanip_type fn ) {
   if ( expr )
     o << fn;
   return o;
 }
-DEF_OMANIP2( if_do, bool, std_omanip_type )
+DEF_OMANIP2( if_do_impl, bool, std_omanip_type )
+#define if_do(EXPR,FN) if_do_impl( !!(EXPR), (FN) )

 #define if_indent(WS,FN) if_do( (WS) == whitespace::indent, FN )

-inline std::ostream& if_emit( std::ostream &o, bool expr, char c ) {
+inline std::ostream& if_emit_impl( std::ostream &o, bool expr, char c ) {
   if ( expr )
     o << c;
   return o;
 }
-DEF_OMANIP2( if_emit, bool, char )
+DEF_OMANIP2( if_emit_impl, bool, char )
+#define if_emit(EXPR,C) if_emit_impl( !!(EXPR), (C) )

 ///////////////////////////////////////////////////////////////////////////////


bts.h: lchan_init_lapdm is listed twice, remove one

--- include/osmo-bts/bts.h
+++ include/osmo-bts/bts.h
@@ -18,8 +18,6 @@
 void bts_new_si(void *arg);
 void bts_setup_slot(struct gsm_bts_trx_ts *slot, uint8_t comb);

-int lchan_init_lapdm(struct gsm_lchan *lchan);
-
 int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg);
 struct msgb *bts_agch_dequeue(struct gsm_bts *bts);


- "arity" patch from Henning Bekel

- "arity" patch from Henning Bekel

--- cmd_exec.c
+++ cmd_exec.c
@@ -1,27 +1,35 @@
 #include "xdo_cmd.h"
 #include <errno.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/wait.h>

 int cmd_exec(context_t *context) {
+
+  char *cmd = *context->argv;
+  char **command = (char **) calloc(1, sizeof(char *));
+  int command_count = 0;
   int ret = EXIT_SUCCESS;
-  char *cmd = *context->argv;
   int opsync = 0;
+  int arity = -1;
+  char *terminator = calloc(1, sizeof(char));
+  int c, i;

-  int c;
   typedef enum {
-    opt_unused, opt_help, opt_sync
+    opt_unused, opt_help, opt_sync, opt_args, opt_terminator
   } optlist_t;
   static struct option longopts[] = {
     { "help", no_argument, NULL, opt_help },
     { "sync", no_argument, NULL, opt_sync },
+    { "args", required_argument, NULL, opt_args },
+    { "terminator", required_argument, NULL, opt_terminator },
     { 0, 0, 0, 0 },
   };
   static const char *usage =
-    "Usage: %s [options] command [arg1 arg2 ...]\n"
-    "--sync    - only exit when the command given finishes. The default"
-    "            is to fork a child process and continue.";
-
+    "Usage: %s [options] command [arg1 arg2 ...] [terminator]\n"
+    "--sync    - only exit when the command given finishes. The default\n"
+    "            is to fork a child process and continue.\n";
+
   int option_index;
   while ((c = getopt_long_only(context->argc, context->argv, "+h",
                                longopts, &option_index)) != -1) {
@@ -35,6 +43,13 @@
       case opt_sync:
         opsync = 1;
         break;
+      case opt_args:
+        arity = atoi(optarg);
+        break;
+      case opt_terminator:
+	terminator = realloc(terminator, (strlen(optarg)+1) * sizeof(char));
+	strncpy(terminator, optarg, strlen(optarg));
+	break;
       default:
         fprintf(stderr, usage, cmd);
         return EXIT_FAILURE;
@@ -44,15 +59,36 @@
   consume_args(context, optind);

   if (context->argc == 0) {
-    fprintf(stderr, "No arguments given.");
+    fprintf(stderr, "No arguments given.\n");
     fprintf(stderr, usage, cmd);
     return EXIT_FAILURE;
   }

+  if(arity > 0 && strlen(terminator) > 0) {
+    fprintf(stderr, "Don't use both --terminator and --args.\n");
+    return EXIT_FAILURE;
+  }
+
+  for (i=0; i<context->argc; i++) {
+
+    if (arity > 0 && i == arity)
+      break;
+
+    if (strlen(terminator) > 0 && strcmp(terminator, context->argv[i]) == 0) {
+      consume_args(context, 1);
+      break;
+    }
+
+    command = realloc(command, (command_count+1) * sizeof(char *));
+    command[command_count] = (char *) calloc(strlen(context->argv[i])+1, sizeof(char));
+    strncpy(command[command_count], context->argv[i], strlen(context->argv[i])+1);
+    command_count++;
+  }
+
   pid_t child;
   child = fork();
   if (child == 0) { /* child */
-    execvp(context->argv[0], context->argv);
+    execvp(command[0], command);

     /* if we get here, there was an error */
     perror("execvp failed");
@@ -65,6 +101,11 @@
     }
   }

-  consume_args(context, context->argc);
+  consume_args(context, command_count);
+  free(terminator);
+  for(i=0; i<command_count; i++) {
+    free(command[i]);
+  }
+  free(command);
   return ret;
 }


Added sceIoChstat cbit defines

Added sceIoChstat cbit defines

--- include/psp2/io/stat.h
+++ include/psp2/io/stat.h
@@ -72,6 +72,13 @@
 	unsigned int st_private[6];  //!< Device-specific data
 } SceIoStat;

+/** Defines for `sceIoChstat` and `sceIoChstatByFd` **/
+#define SCE_CST_MODE        0x0001
+#define SCE_CST_SIZE        0x0004
+#define SCE_CST_CT          0x0008
+#define SCE_CST_AT          0x0010
+#define SCE_CST_MT          0x0020
+
 /**
  * Make a directory file
  *
@@ -129,7 +136,7 @@
   *
   * @return < 0 on error.
   */
-int sceIoChstatByFd(SceUID fd, SceIoStat *stat, int bits);
+int sceIoChstatByFd(SceUID fd, const SceIoStat *buf, unsigned int cbit);

 #ifdef __cplusplus
 }


added is_frozen() to Dict

added is_frozen() to Dict

--- cnn/dict.h
+++ cnn/dict.h
@@ -31,18 +31,19 @@
   }

   void Freeze() { frozen = true; }
+  bool is_frozen() { return frozen; }

   inline int Convert(const std::string& word) {
     auto i = d_.find(word);
     if (i == d_.end()) {
       if (frozen) {
-	if (map_unk) {
-	  return unk_id;
-	}
-	else {
-	  std::cerr << "Unknown word encountered: " << word << std::endl;
-	  throw std::runtime_error("Unknown word encountered in frozen dictionary: " + word);
-	}
+        if (map_unk) {
+          return unk_id;
+        }
+        else {
+          std::cerr << "Unknown word encountered: " << word << std::endl;
+          throw std::runtime_error("Unknown word encountered in frozen dictionary: " + word);
+        }
       }
       words_.push_back(word);
       return d_[word] = words_.size() - 1;


perf scripting: Fix build

perf scripting: Fix build

Cc: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- tools/perf/builtin-trace.c
+++ tools/perf/builtin-trace.c
@@ -5,6 +5,8 @@
 #include "util/symbol.h"
 #include "util/thread.h"
 #include "util/header.h"
+#include "util/exec_cmd.h"
+#include "util/trace-event.h"

 static char const		*script_name;
 static char const		*generate_script_lang;


Add SceJpegEnc syscalls

Add SceJpegEnc syscalls

--- include/psp2/jpegenc.h
+++ include/psp2/jpegenc.h
@@ -156,6 +156,32 @@
  */
 int sceJpegEncoderSetHeaderMode(SceJpegEncoderContext context, int mode);

+// missing structs
+typedef struct SceJpegSplitDecodeCtrl SceJpegSplitDecodeCtrl;
+typedef struct SceJpegMJpegInitParam SceJpegMJpegInitParam;
+
+int _sceJpegCreateSplitDecoder(SceJpegSplitDecodeCtrl *ctrl);
+int _sceJpegCsc(void *rgba, const unsigned char *ycbcr, int xysize, int frame_width);
+int _sceJpegDecodeMJpeg(const unsigned char *jpeg, SceSize jpeg_size, void *rgba, SceSize rgba_size);
+int _sceJpegDecodeMJpegYCbCr(const unsigned char *jpeg, SceSize jpeg_size, unsigned char *ycbcr, SceSize ycbcr_size);
+int _sceJpegDeleteSplitDecoder(SceJpegSplitDecodeCtrl *ctrl);
+int _sceJpegEncoderCsc(SceJpegEncoderContext context, void *ycbcr, const void *rgba, int frame_width);
+int _sceJpegEncoderEncode(SceJpegEncoderContext context, const void *ycbcr);
+int _sceJpegEncoderEnd(SceJpegEncoderContext context);
+int _sceJpegEncoderGetContextSize(void);
+int _sceJpegEncoderInit(SceJpegEncoderContext context, int frame_width, int frame_height, int pixel_format);
+int _sceJpegEncoderInitWithParam(SceJpegEncoderContext context, const SceJpegEncoderInitParam *param);
+int _sceJpegEncoderSetCompressionRatio(SceJpegEncoderContext context, int compratio);
+int _sceJpegEncoderSetHeaderMode(SceJpegEncoderContext context, int mode);
+int _sceJpegEncoderSetOutputAddr(SceJpegEncoderContext context, void *jpeg, SceSize jpeg_size);
+int _sceJpegEncoderSetValidRegion(SceJpegEncoderContext context, int frame_width, int frame_height);
+int _sceJpegFinishMJpeg(void);
+int _sceJpegGetOutputInfo(const unsigned char *jpeg, SceSize jpeg_size, int output_format, int decode_mode);
+int _sceJpegInitMJpeg(int max_split_decoder);
+int _sceJpegInitMJpegWithParam(const SceJpegMJpegInitParam *param);
+int _sceJpegMJpegCsc(void *rgba, const unsigned char *ycbcr, int xysize, int frame_width);
+int _sceJpegSplitDecodeMJpeg(SceJpegSplitDecodeCtrl *ctrl);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */


Fixed JS object deletion crash

Fixed JS object deletion crash

git-svn-id: ab66a9de07fa9d47c5829c82992f5279466c775f@1721 63c20433-aa62-49bd-875c-5a186b69a8fb

--- src/scenegraph/dom_smjs.c
+++ src/scenegraph/dom_smjs.c
@@ -3564,6 +3564,7 @@
 		if (n) {
 			JS_SetPrivate(c, obj, NULL);
 			n->sgprivate->interact->js_binding->node=NULL;
+			gf_node_unregister(n, NULL);
 			JS_RemoveRoot(c, &(n->sgprivate->interact->js_binding->node));
 		}
 		gf_list_rem(sg->objects, 0);


py/repl: Don't read past the end of import_str.

asan considers that memcmp(p, q, N) is permitted to access N bytes at each
of p and q, even for values of p and q that have a difference earlier.
Accessing additional values is frequently done in practice, reading 4 or
more bytes from each input at a time for efficiency, so when completing
"non_exist<TAB>" in the repl, this causes a diagnostic:

    ==16938==ERROR: AddressSanitizer: global-buffer-overflow on
    address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
    READ of size 9 at 0x555555cd8dc8 thread T0
        #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
        #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
        #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
        #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
        #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
        #5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
        #6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
        #7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
        #8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

    0x555555cd8dc8 is located 0 bytes to the right of global variable
    'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
    size 8
      'import_str' is ascii string 'import '

Signed-off-by: Jeff Epler <623a871f32baaca066adfe0cac08d7aa7d34027d@gmail.com>

--- py/repl.c
+++ py/repl.c
@@ -297,7 +297,7 @@
     if (q_first == 0) {
         // If there're no better alternatives, and if it's first word
         // in the line, try to complete "import".
-        if (s_start == org_str && s_len > 0) {
+        if (s_start == org_str && s_len > 0 && s_len < sizeof(import_str) - 1) {
             if (memcmp(s_start, import_str, s_len) == 0) {
                 *compl_str = import_str + s_len;
                 return sizeof(import_str) - 1 - s_len;


Added aliases for bvec1, ivec1, uvec1

Added aliases for bvec1, ivec1, uvec1

--- include/shaderboiler.h
+++ include/shaderboiler.h
@@ -571,6 +571,9 @@
 	typedef mat4x4 mat4;

 	typedef vec1 Float;
+	typedef ivec1 Int;
+	typedef uvec1 UInt;
+	typedef bvec1 Bool;

 #define op_ariphm_allvecTypes(S1, S2, S3) \
 	op_ariphm(vec##S1, vec##S2, vec##S3) \


add virtual func

add virtual func

--- src/scheduler/scheduler.h
+++ src/scheduler/scheduler.h
@@ -22,7 +22,7 @@
     PodScaleCell();
     virtual void Score(){}
     virtual void Propose(std::vector<ScheduleInfo>* propose){}
-    ~PodScaleCell();
+    virtual ~PodScaleCell();
 };

 struct PodScaleUpCell : PodScaleCell {


Sigma derivative defined with offset, probably C+P

--- include/votca/xtp/gw.h
+++ include/votca/xtp/gw.h
@@ -125,8 +125,7 @@
     }
     double deriv(double frequency) const {
       return _sigma_c_func.CalcCorrelationDiagElementDerivative(_gw_level,
-                                                                frequency) +
-             _offset - frequency;
+                                                                frequency);
     }

    private:


Correct confusing error message when called as 'stty -sane'.

PR:		bin/3573

--- bin/stty/key.c
+++ bin/stty/key.c
@@ -29,12 +29,15 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- *	$Id$
  */

 #ifndef lint
-static char const sccsid[] = "@(#)key.c	8.3 (Berkeley) 4/2/94";
+#if 0
+static char sccsid[] = "@(#)key.c	8.3 (Berkeley) 4/2/94";
+#else
+static const char rcsid[] =
+	"$Id$";
+#endif
 #endif /* not lint */

 #include <sys/types.h>
@@ -122,11 +125,11 @@
 	    sizeof(keys)/sizeof(struct key), sizeof(struct key), c_key)))
 		return (0);
 	if (!(kp->flags & F_OFFOK) && ip->off) {
-		errx(1, "illegal option -- %s", name);
+		warnx("illegal option -- -%s", name);
 		usage();
 	}
 	if (kp->flags & F_NEEDARG && !(ip->arg = *++*argvp)) {
-		errx(1, "option requires an argument -- %s", name);
+		warnx("option requires an argument -- %s", name);
 		usage();
 	}
 	kp->f(ip);


Changing every 5 Iframes still blocks gstreamer

--- bin/testsave.c
+++ bin/testsave.c
@@ -1,8 +1,7 @@
 #include <gst/gst.h>
 #include <glib.h>

-/* FIXME: Figure out why changing this to 5 makes gstreamer issue a scary
-          warning but 4 and 6 works fine*/
+/* FIXME: Figure out why changing this to 5 makes the pipeline stall completely*/
 #define IFRAMES_PER_FILE 4

 typedef struct {


Fix problem while compiling: 'StorageHeaderHead' does not refer to a value

--- src/storage.h
+++ src/storage.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 deipi.com LLC and contributors. All rights reserved.
+ * Copyright (C) 2016 deipi.com LLC and contributors. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -136,7 +136,7 @@
 			if (fd == -1) {
 				throw StorageIOError();
 			}
-			memset(&header + sizeof(StorageHeader::StorageHeaderHead), 0, sizeof(header) - sizeof(StorageHeader::StorageHeaderHead));
+			memset(&header + sizeof(header.head), 0, sizeof(header) - sizeof(header.head));
 			strncpy(header.head.uuid, uuid, sizeof(header.head.uuid));
 			if (::pwrite(fd, &header, sizeof(header), 0) != sizeof(header)) {
 				throw StorageIOError();


Using io::close in Storage

Using io::close in Storage

--- src/storage.h
+++ src/storage.h
@@ -356,7 +356,7 @@
 			if (flags & STORAGE_WRITABLE) {
 				commit();
 			}
-			::close(fd);
+			io::close(fd);
 		}

 		fd = 0;


Add switch to toggle underscore parsing in numbers

In Python >= 3.6, fastnumbers treats underscores in numbers the same way
as python does, which is to allow them if the follow a certain set of
rules. It has been requested that this behavior be toggle-able. Here,
the function that does the conversion from a Python string object to a
character array now has a boolean to disable special handling of
underscores.

--- src/strings.c
+++ src/strings.c
@@ -457,7 +457,8 @@
  */
 static const char *
 convert_PyString_to_str(PyObject *input, const char **end,
-                        char **buffer, bool *must_raise, const bool based)
+                        char **buffer, bool *must_raise, const bool based,
+                        const bool allow_underscores)
 {
     const char *str = NULL;
     Py_ssize_t len = 0;
@@ -543,7 +544,7 @@
     /* Remove all "valid" underscores from the
      * string to simplify downstream parsing.
      */
-    if (len > 0 && memchr(str, '_', len)) {
+    if (allow_underscores && len > 0 && memchr(str, '_', len)) {
         if ((str = remove_valid_underscores((char *)str,
                                             end, buffer,
                                             len, based)) == NULL) {
@@ -568,7 +569,8 @@
     bool needs_raise = false;
     char *buf = NULL;
     const char *str = convert_PyString_to_str(obj, &end, &buf, &needs_raise,
-                                              !Options_Default_Base(options));
+                                              !Options_Default_Base(options),
+                                              true);
     if (needs_raise) {
         /* Never need to free buffer if needs_raise is true. */
         return NULL;
@@ -625,7 +627,8 @@
     bool result = false, needs_raise = false;
     char *buf = NULL;
     const char *str = convert_PyString_to_str(obj, &end, &buf, &needs_raise,
-                                              !Options_Default_Base(options));
+                                              !Options_Default_Base(options),
+                                              true);
     if (needs_raise) {
         /* Never need to free buffer if needs_raise is true. */
         return NULL;


libflatpak: Fix leak in FlatpakRemoteRef

--- lib/flatpak-remote-ref.c
+++ lib/flatpak-remote-ref.c
@@ -68,6 +68,9 @@
   FlatpakRemoteRefPrivate *priv = flatpak_remote_ref_get_instance_private (self);

   g_free (priv->remote_name);
+  g_free (priv->eol);
+  g_free (priv->eol_rebase);
+  g_clear_pointer (&priv->metadata, g_bytes_unref);

   G_OBJECT_CLASS (flatpak_remote_ref_parent_class)->finalize (object);
 }


- fix type of the counter used when waiting for signals in ata_reset. It may be > 0xff

--- bios/rombios.c
+++ bios/rombios.c
@@ -2192,8 +2192,8 @@
 {
   Bit16u ebda_seg=read_word(0x0040,0x000E);
   Bit16u iobase1, iobase2;
-  Bit8u  channel, slave, max;
-  Bit8u  sn, sc;
+  Bit8u  channel, slave, sn, sc;
+  Bit16u max;

   channel = device / 2;
   slave = device % 2;


CORE-377: Add test case

CORE-377: Add test case

--- bitcoin/test.c
+++ bitcoin/test.c
@@ -38,6 +38,7 @@
 #include "BRPeerManager.h"
 #include "BRChainParams.h"
 #include "bcash/BRBCashParams.h"
+#include "bcash/BRBCashAddr.h"
 #include "BRPaymentProtocol.h"
 #include "BRInt.h"
 #include "BRArray.h"
@@ -354,6 +355,21 @@
     l = BRBech32Encode(addr, "bc", b);
     if (l == 0 || strcmp(addr, "bc1zw508d6qejxtdg4y5r3zarvaryvg6kdaj"))
         r = 0, fprintf(stderr, "\n***FAILED*** %s: BRBech32Encode() test 3", __func__);
+
+    if (! r) fprintf(stderr, "\n                                    ");
+    return r;
+}
+
+int BRBCashAddrTests()
+{
+    int r = 1;
+    char *s, addr[36];
+    size_t l;
+
+    s = "77047ecdd5ae988f30d68e828dad668439ad3e5ebba05680089c80f0be82d889";
+    l = BRBCashAddrDecode(addr, s);
+    if (l != 0)
+        r = 0, fprintf(stderr, "\n***FAILED*** %s: BRBCashAddrDecode() test 1", __func__);

     if (! r) fprintf(stderr, "\n                                    ");
     return r;
@@ -2879,6 +2895,8 @@
     printf("%s\n", (BRBase58Tests()) ? "success" : (fail++, "***FAIL***"));
     printf("BRBech32Tests...                    ");
     printf("%s\n", (BRBech32Tests()) ? "success" : (fail++, "***FAIL***"));
+    printf("BRBCashAddrTests...                 ");
+    printf("%s\n", (BRBCashAddrTests()) ? "success" : (fail++, "***FAIL***"));
     printf("BRHashTests...                      ");
     printf("%s\n", (BRHashTests()) ? "success" : (fail++, "***FAIL***"));
     printf("BRMacTests...                       ");


* haven't done this in ages

* haven't done this in ages

git-svn-id: 0a6e3066f5d503b24e8e377b6d170815393887e2@3337 8ad44209-8f18-4ceb-bdfa-99d0be514da2