Fix the test-file for Chacha20Poly1305

Fix the test-file for Chacha20Poly1305

--- code/chacha20poly1305/chacha20poly1305-test.c
+++ code/chacha20poly1305/chacha20poly1305-test.c
@@ -78,10 +78,8 @@
   uint8_t *mac
 );

-bool unit_test_aead(){
-  int a;
-  bool pass = true;
-
+int main(){
+  int res;
   uint8_t plaintext[114];
   memset(plaintext, 0, 114 * sizeof plaintext[0]);
   uint8_t ciphertext[114];
@@ -89,33 +87,28 @@
   uint8_t mac[16];
   memset(mac, 0, 16 * sizeof mac[0]);

-  Hacl_Chacha20Poly1305_aead_encrypt(aead_key, aead_nonce, 12, aead_ad, 114, aead_plaintext, ciphertext, mac);
-  a = memcmp(ciphertext, aead_ciphertext, 114 * sizeof (uint8_t));
-  if (a != 0){
-    pass = false;
+  printf("Testing HACL* Hacl_Chacha20Poly1305\n");
+  aead_encrypt(aead_key, aead_nonce, 12, aead_aad, 114, aead_plaintext, ciphertext, mac);
+  res = memcmp(ciphertext, aead_ciphertext, 114 * sizeof (uint8_t));
+  if (res != 0){
     printf("AEAD (Chacha20) failed on RFC test of size 114\n.");
-    goto result;
   }
-  a = memcmp(mac, aead_mac, 16 * sizeof (uint8_t));
-  if (a != 0){
-    pass = false;
+  res = memcmp(mac, aead_mac, 16 * sizeof (uint8_t));
+  if (res != 0){
     printf("AEAD (Poly1305) failed on RFC test of size 114\n.");
-    goto result;
   }

-  a = Hacl_Chacha20Poly1305_aead_decrypt(aead_key, aead_nonce, 12, aead_aad, 114, plaintext, aead_ciphertext, aead_mac);
-  if (a != 0){
-    pass = false;
+  res = aead_decrypt(aead_key, aead_nonce, 12, aead_aad, 114, plaintext, aead_ciphertext, aead_mac);
+  if (res != 0){
     printf("AEAD Decrypt (Chacha20/Poly1305) failed on RFC test of size 114\n.");
-    goto result;
   }
-  a = memcmp(plaintext, aead_plaintext, 114 * sizeof (uint8_t));
-  if (a != 0){
-    pass = false;
+  res = memcmp(plaintext, aead_plaintext, 114 * sizeof (uint8_t));
+  if (res != 0){
     printf("AEAD Decrypt (Chacha20/Poly1305) failed on RFC test of size 114\n.");
-    goto result;
   }
-
-result:
-  return pass;
+  if (res == 0){
+    printf("\nSuccess !\n");
+  } else {
+    printf("\nFailure !\n");
+  }
 }


Use helpers to set the gain step values

Use helpers to set the gain step values

--- Alc/ALu.c
+++ Alc/ALu.c
@@ -115,6 +115,69 @@
     vector[0] = temp[0]*matrix[0][0] + temp[1]*matrix[1][0] + temp[2]*matrix[2][0] + temp[3]*matrix[3][0];
     vector[1] = temp[0]*matrix[0][1] + temp[1]*matrix[1][1] + temp[2]*matrix[2][1] + temp[3]*matrix[3][1];
     vector[2] = temp[0]*matrix[0][2] + temp[1]*matrix[1][2] + temp[2]*matrix[2][2] + temp[3]*matrix[3][2];
+}
+
+
+static void UpdateDryStepping(DirectParams *params, ALuint num_chans)
+{
+    ALuint i, j;
+
+    if(!params->Moving)
+    {
+        for(i = 0;i < num_chans;i++)
+        {
+            MixGains *gains = params->Mix.Gains[i];
+            for(j = 0;j < MaxChannels;j++)
+            {
+                gains[j].Current = gains[j].Target;
+                gains[j].Step = 1.0f;
+            }
+        }
+        params->Moving = AL_TRUE;
+        params->Counter = 0;
+        return;
+    }
+
+    for(i = 0;i < num_chans;i++)
+    {
+        MixGains *gains = params->Mix.Gains[i];
+        for(j = 0;j < MaxChannels;j++)
+        {
+            ALfloat cur = maxf(gains[j].Current, FLT_EPSILON);
+            ALfloat trg = maxf(gains[j].Target, FLT_EPSILON);
+            if(fabs(trg - cur) >= GAIN_SILENCE_THRESHOLD)
+                gains[j].Step = powf(trg/cur, 1.0f/64.0f);
+            else
+                gains[j].Step = 1.0f;
+            gains[j].Current = cur;
+        }
+    }
+    params->Counter = 64;
+}
+
+static void UpdateWetStepping(SendParams *params)
+{
+    ALfloat cur, trg;
+
+    if(!params->Moving)
+    {
+        params->Gain.Current = params->Gain.Target;
+        params->Gain.Step = 1.0f;
+
+        params->Moving = AL_TRUE;
+        params->Counter = 0;
+        return;
+    }
+
+    cur = maxf(params->Gain.Current, FLT_EPSILON);
+    trg = maxf(params->Gain.Target, FLT_EPSILON);
+    if(fabs(trg - cur) >= GAIN_SILENCE_THRESHOLD)
+        params->Gain.Step = powf(trg/cur, 1.0f/64.0f);
+    else
+        params->Gain.Step = 1.0f;
+    params->Gain.Current = cur;
+
+    params->Counter = 64;
 }

@@ -351,13 +414,9 @@
         for(c = 0;c < num_channels;c++)
         {
             MixGains *gains = voice->Direct.Mix.Gains[c];
+
             for(j = 0;j < MaxChannels;j++)
                 gains[j].Target = 0.0f;
-        }
-
-        for(c = 0;c < num_channels;c++)
-        {
-            MixGains *gains = voice->Direct.Mix.Gains[c];
             for(i = 0;i < (ALint)Device->NumSpeakers;i++)
             {
                 enum Channel chan = Device->Speaker[i].ChanName;
@@ -368,39 +427,7 @@
                 }
             }
         }
-
-        if(!voice->Direct.Moving)
-        {
-            for(i = 0;i < num_channels;i++)
-            {
-                MixGains *gains = voice->Direct.Mix.Gains[i];
-                for(j = 0;j < MaxChannels;j++)
-                {
-                    gains[j].Current = gains[j].Target;
-                    gains[j].Step = 1.0f;
-                }
-            }
-            voice->Direct.Counter = 0;
-            voice->Direct.Moving  = AL_TRUE;
-        }
-        else
-        {
-            for(i = 0;i < num_channels;i++)
-            {
-                MixGains *gains = voice->Direct.Mix.Gains[i];
-                for(j = 0;j < MaxChannels;j++)
-                {
-                    ALfloat cur = maxf(gains[j].Current, FLT_EPSILON);
-                    ALfloat trg = maxf(gains[j].Target, FLT_EPSILON);
-                    if(fabs(trg - cur) >= GAIN_SILENCE_THRESHOLD)
-                        gains[j].Step = powf(trg/cur, 1.0f/64.0f);
-                    else
-                        gains[j].Step = 1.0f;
-                    gains[j].Current = cur;
-                }
-            }
-            voice->Direct.Counter = 64;
-        }
+        UpdateDryStepping(&voice->Direct, num_channels);

         voice->IsHrtf = AL_FALSE;
     }
@@ -437,13 +464,6 @@
     }
     else
     {
-        for(i = 0;i < num_channels;i++)
-        {
-            MixGains *gains = voice->Direct.Mix.Gains[i];
-            for(j = 0;j < MaxChannels;j++)
-                gains[j].Target = 0.0f;
-        }
-
         DryGain *= lerp(1.0f, 1.0f/sqrtf((float)Device->NumSpeakers), hwidth/F_PI);
         for(c = 0;c < num_channels;c++)
         {
@@ -453,6 +473,8 @@
             /* Special-case LFE */
             if(chans[c].channel == LFE)
             {
+                for(j = 0;j < MaxChannels;j++)
+                    gains[j].Target = 0.0f;
                 gains[chans[c].channel].Target = DryGain;
                 continue;
             }
@@ -460,63 +482,14 @@
             for(i = 0;i < MaxChannels;i++)
                 gains[i].Target = Target[i];
         }
-
-        if(!voice->Direct.Moving)
-        {
-            for(i = 0;i < num_channels;i++)
-            {
-                MixGains *gains = voice->Direct.Mix.Gains[i];
-                for(j = 0;j < MaxChannels;j++)
-                {
-                    gains[j].Current = gains[j].Target;
-                    gains[j].Step = 1.0f;
-                }
-            }
-            voice->Direct.Counter = 0;
-            voice->Direct.Moving  = AL_TRUE;
-        }
-        else
-        {
-            for(i = 0;i < num_channels;i++)
-            {
-                MixGains *gains = voice->Direct.Mix.Gains[i];
-                for(j = 0;j < MaxChannels;j++)
-                {
-                    ALfloat trg = maxf(gains[j].Target, FLT_EPSILON);
-                    ALfloat cur = maxf(gains[j].Current, FLT_EPSILON);
-                    if(fabs(trg - cur) >= GAIN_SILENCE_THRESHOLD)
-                        gains[j].Step = powf(trg/cur, 1.0f/64.0f);
-                    else
-                        gains[j].Step = 1.0f;
-                    gains[j].Current = cur;
-                }
-            }
-            voice->Direct.Counter = 64;
-        }
+        UpdateDryStepping(&voice->Direct, num_channels);

         voice->IsHrtf = AL_FALSE;
     }
     for(i = 0;i < NumSends;i++)
     {
         voice->Send[i].Gain.Target = WetGain[i];
-        if(!voice->Send[i].Moving)
-        {
-            voice->Send[i].Gain.Current = voice->Send[i].Gain.Target;
-            voice->Send[i].Gain.Step = 1.0f;
-            voice->Send[i].Counter = 0;
-            voice->Send[i].Moving  = AL_TRUE;
-        }
-        else
-        {
-            ALfloat cur = maxf(voice->Send[i].Gain.Current, FLT_EPSILON);
-            ALfloat trg = maxf(voice->Send[i].Gain.Target, FLT_EPSILON);
-            if(fabs(trg - cur) >= GAIN_SILENCE_THRESHOLD)
-                voice->Send[i].Gain.Step = powf(trg/cur, 1.0f/64.0f);
-            else
-                voice->Send[i].Gain.Step = 1.0f;
-            voice->Send[i].Gain.Current = cur;
-            voice->Send[i].Counter = 64;
-        }
+        UpdateWetStepping(&voice->Send[i]);
     }

     {
@@ -960,13 +933,12 @@
     {
         MixGains *gains = voice->Direct.Mix.Gains[0];

-        for(j = 0;j < MaxChannels;j++)
-            gains[j].Target = 0.0f;
-
         /* Normalize the length, and compute panned gains. */
         if(!(Distance > FLT_EPSILON))
         {
             ALfloat gain = 1.0f / sqrtf((float)Device->NumSpeakers);
+            for(j = 0;j < MaxChannels;j++)
+                gains[j].Target = 0.0f;
             for(i = 0;i < (ALint)Device->NumSpeakers;i++)
             {
                 enum Channel chan = Device->Speaker[i].ChanName;
@@ -986,55 +958,14 @@
             for(j = 0;j < MaxChannels;j++)
                 gains[j].Target = Target[j];
         }
-
-        if(!voice->Direct.Moving)
-        {
-            for(j = 0;j < MaxChannels;j++)
-            {
-                gains[j].Current = gains[j].Target;
-                gains[j].Step = 1.0f;
-            }
-            voice->Direct.Counter = 0;
-            voice->Direct.Moving  = AL_TRUE;
-        }
-        else
-        {
-            for(j = 0;j < MaxChannels;j++)
-            {
-                ALfloat cur = maxf(gains[j].Current, FLT_EPSILON);
-                ALfloat trg = maxf(gains[j].Target, FLT_EPSILON);
-                if(fabs(trg - cur) >= GAIN_SILENCE_THRESHOLD)
-                    gains[j].Step = powf(trg/cur, 1.0f/64.0f);
-                else
-                    gains[j].Step = 1.0f;
-                gains[j].Current = cur;
-            }
-            voice->Direct.Counter = 64;
-        }
+        UpdateDryStepping(&voice->Direct, 1);

         voice->IsHrtf = AL_FALSE;
     }
     for(i = 0;i < NumSends;i++)
     {
         voice->Send[i].Gain.Target = WetGain[i];
-        if(!voice->Send[i].Moving)
-        {
-            voice->Send[i].Gain.Current = voice->Send[i].Gain.Target;
-            voice->Send[i].Gain.Step = 1.0f;
-            voice->Send[i].Counter = 0;
-            voice->Send[i].Moving  = AL_TRUE;
-        }
-        else
-        {
-            ALfloat cur = maxf(voice->Send[i].Gain.Current, FLT_EPSILON);
-            ALfloat trg = maxf(voice->Send[i].Gain.Target, FLT_EPSILON);
-            if(fabs(trg - cur) >= GAIN_SILENCE_THRESHOLD)
-                voice->Send[i].Gain.Step = powf(trg/cur, 1.0f/64.0f);
-            else
-                voice->Send[i].Gain.Step = 1.0f;
-            voice->Send[i].Gain.Current = cur;
-            voice->Send[i].Counter = 64;
-        }
+        UpdateWetStepping(&voice->Send[i]);
     }

     {


Always fully normalize the position when using HRTF

--- Alc/ALu.c
+++ Alc/ALu.c
@@ -656,18 +656,18 @@
     }

     // Use energy-preserving panning algorithm for multi-speaker playback
-    length = __max(OrigDist, MinDist);
-    if(length > 0.0f)
-    {
-        ALfloat invlen = 1.0f/length;
-        Position[0] *= invlen;
-        Position[1] *= invlen;
-        Position[2] *= invlen;
-    }
-
     if((Device->Flags&DEVICE_USE_HRTF))
     {
         const ALshort *hrtf_left, *hrtf_right;
+
+        length = OrigDist;
+        if(length > 0.0f)
+        {
+            ALfloat invlen = 1.0f/length;
+            Position[0] *= invlen;
+            Position[1] *= invlen;
+            Position[2] *= invlen;
+        }

         GetHrtfCoeffs(asin(Position[1]) * (180.0/M_PI),
                       atan2(Position[0], -Position[2]*ZScale) * (180.0/M_PI),
@@ -682,6 +682,15 @@
     }
     else
     {
+        length = __max(OrigDist, MinDist);
+        if(length > 0.0f)
+        {
+            ALfloat invlen = 1.0f/length;
+            Position[0] *= invlen;
+            Position[1] *= invlen;
+            Position[2] *= invlen;
+        }
+
         pos = aluCart2LUTpos(-Position[2]*ZScale, Position[0]);
         SpeakerGain = &Device->PanningLUT[MAXCHANNELS * pos];


rinaperf: implement client timeout

rinaperf: implement client timeout

--- user/tools/rinaperf.c
+++ user/tools/rinaperf.c
@@ -515,15 +515,31 @@
     },
 };

+#define CLI_FA_TIMEOUT_SEC     5
+
 static void *
 client_worker_function(void *opaque)
 {
     struct worker *w = opaque;
+    struct pollfd pfd;
     int ret;

     /* We're the client: allocate a flow and run the perf function. */
-    w->fd = rina_flow_alloc(w->rp->dif_name, w->rp->cli_appl_name,
-                            w->rp->srv_appl_name, &w->rp->flowspec, 0);
+    pfd.fd = rina_flow_alloc(w->rp->dif_name, w->rp->cli_appl_name,
+                             w->rp->srv_appl_name, &w->rp->flowspec,
+                             RINA_F_NOWAIT);
+    pfd.events = POLLIN;
+    ret = poll(&pfd, 1, CLI_FA_TIMEOUT_SEC * 1000);
+    if (ret <= 0) {
+        if (ret < 0) {
+            perror("poll()");
+        } else {
+            printf("Flow allocation timed out\n");
+        }
+        close(pfd.fd);
+        return NULL;
+    }
+    w->fd = rina_flow_alloc_wait(pfd.fd);
     cli_flow_allocated = 1;
     if (w->fd < 0) {
         perror("rina_flow_alloc()");


tools: rinaperf: fix list manipulation bug

--- user/tools/rinaperf.c
+++ user/tools/rinaperf.c
@@ -585,7 +585,7 @@

         for (;;) {
             /* Try to join terminated threads. */
-            for (p = NULL, w = rp->workers_head; w; p = w, w = w->next) {
+            for (p = NULL, w = rp->workers_head; w; ) {
                 ret = pthread_tryjoin_np(w->th, NULL);
                 if (ret == 0) {
                     if (w == rp->workers_head) {
@@ -597,11 +597,20 @@
                     if (w == rp->workers_tail) {
                         rp->workers_tail = p;
                     }
-                    free(w);
+                    {
+                        struct worker *tmp;
+                        tmp = w;
+                        w = w->next;
+                        free(tmp);
+                    }
                     rp->workers_num --;

-                } else if (ret != EBUSY) {
-                    printf("Failed to tryjoin() pthread: %s\n", strerror(ret));
+                } else {
+                    if (ret != EBUSY) {
+                        printf("Failed to tryjoin() pthread: %s\n", strerror(ret));
+                    }
+                    p = w;
+                    w = w->next;
                 }
             }


Fix division by zero bug triggered by pointers to opaque structs.

git-svn-id: a68838e7bd575144b7122a20f5a950e65beaf589@30817 72102866-910b-0410-8b05-ffd578937521

--- encoding2.c
+++ encoding2.c
@@ -113,6 +113,11 @@

 inline static void round_up(size_t *v, size_t b)
 {
+        if (0 == b)
+	{
+		return;
+	}
+
 	if (*v % b)
 	{
 		*v += b - (*v % b);


Document copy operators

Document copy operators

--- common/formatting/layout_optimizer_internal.h
+++ common/formatting/layout_optimizer_internal.h
@@ -70,6 +70,8 @@
         must_wrap_(!tokens_.empty() && tokens_.front().before.break_decision ==
                                            SpacingOptions::MustWrap) {}

+  // Multiple LayoutFunctionSegments can store copies of the same layout.
+  // The objects are copied mostly in LayoutFunctionFactory::* functions.
   LayoutItem(const LayoutItem&) = default;
   LayoutItem& operator=(const LayoutItem&) = default;


removed c++ style comments

removed c++ style comments

--- common/source/programs/globus_is_local_user.c
+++ common/source/programs/globus_is_local_user.c
@@ -60,8 +60,9 @@
     }
     else
     {
-	// ToDo: This call is not defined in common\globus_libc.c for Win32
-    //       Do we need to add this to coommon?
+/*	 ToDo: This call is not defined in common\globus_libc.c for Win32
+           Do we need to add this to coommon?
+*/
 	#if !defined(TARGET_ARCH_WIN32)
 	rc = globus_libc_getpwnam_r( argv[1],
 				     &pwd,
@@ -73,8 +74,8 @@
 			    "NOTE: globus_libc_getpwnam_r not supported on Windowsn\n");
 	/* leave return code as undisturbed from previous tests */
 	#endif
-	// ~ToDo
-
+	/* ~ToDo
+	 */
 	if (rc == GLOBUS_SUCCESS)
 	    exit_code = 0;
     }


Convert ptrack back into linear amplitude instead of dB

--- modules/ptrack.c
+++ modules/ptrack.c
@@ -434,8 +434,8 @@
     pos++;

     *freq = p->cps;
-
-    *amp =  p->dbs[p->histcnt];
+    *amp =  exp(p->dbs[p->histcnt] / 20.0 * log(10.0));
+
     p->cnt = pos;

     return SP_OK;


BUG: Incompatible use of define/enum.

BUG: Incompatible use of define/enum.

This patch addresses bug 13233: http://www.vtk.org/Bug/view.php?id=13233

There is an enum/define conflict in vtkImplicitBoolean.h and
vtkBooleanOperationPolyDataFilter.h

ImplicitBoolean uses define's for VTK_UNION, VTK_INTERSECTION and
VTK_DIFFERENCE while BooleanOperationPolyDataFilter uses enum's for
the same names.

This patch changes ImplicitBoolean to use enum's.

There has been recent discussion about changing all vtk enum usage to
use the vtk namespace. This patch is restricted to just fix the
referenced bug.

Change-Id: I6a04947b2b1b749e87da45e68afe40cbdc7795e3

--- Common/DataModel/vtkImplicitBoolean.h
+++ Common/DataModel/vtkImplicitBoolean.h
@@ -37,16 +37,19 @@

 class vtkImplicitFunctionCollection;

-#define VTK_UNION 0
-#define VTK_INTERSECTION 1
-#define VTK_DIFFERENCE 2
-#define VTK_UNION_OF_MAGNITUDES 3
-
 class VTKCOMMONDATAMODEL_EXPORT vtkImplicitBoolean : public vtkImplicitFunction
 {
 public:
   vtkTypeMacro(vtkImplicitBoolean,vtkImplicitFunction);
   void PrintSelf(ostream& os, vtkIndent indent);
+
+  enum OperationType
+  {
+    VTK_UNION=0,
+    VTK_INTERSECTION,
+    VTK_DIFFERENCE,
+    VTK_UNION_OF_MAGNITUDES
+  };

   // Description:
   // Default boolean method is union.


Fixed misleading assigns in copy/move operators

--- ComponentTestbed/ComponentReference.h
+++ ComponentTestbed/ComponentReference.h
@@ -85,9 +85,9 @@
 		: _context( other._context )
 		, _control_block_tag( other._control_block_tag )
 	{
-		// Clear other's pointers
+		// Clear other
 		other._context = nullptr;
-		other._control_block_tag = nullptr;
+		other._control_block_tag = 0;
 	}

 	/**
@@ -109,7 +109,7 @@
 			*this = other;

 			// Clear values from other
-			other._context = 0;
+			other._context = nullptr;
 			other._control_block_tag = 0;
 		}

@@ -121,7 +121,7 @@
 	*/
 	ComponentReference& operator=( std::nullptr_t )
 	{
-		_context = 0;
+		_context = nullptr;
 		_control_block_tag = 0;

 		return *this;


Add support for retail white plastic remote (ID 0xD7)

--- lib/apple-remote/apple-remote.h
+++ lib/apple-remote/apple-remote.h
@@ -77,6 +77,15 @@
   #define APPLE_REMOTE_BUTTON_DOWN      APPLE_REMOTE_HC, APPLE_REMOTE_H0          // 0x0C
   #define APPLE_REMOTE_BUTTON_PLAY      APPLE_REMOTE_HF, APPLE_REMOTE_H5          // 0x5F
   #define APPLE_REMOTE_BUTTON_CENTER    APPLE_REMOTE_HC, APPLE_REMOTE_H5          // 0x5C
+#elif APPLE_REMOTE_MODEL == 0xd7
+  #define APPLE_REMOTE_ID               APPLE_REMOTE_H7, APPLE_REMOTE_HD          // 0xD7
+  #define APPLE_REMOTE_BUTTON_MENU      APPLE_REMOTE_H2, APPLE_REMOTE_H0          // 0x02
+  #define APPLE_REMOTE_BUTTON_RIGHT     APPLE_REMOTE_H7, APPLE_REMOTE_H0          // 0x07
+  #define APPLE_REMOTE_BUTTON_LEFT      APPLE_REMOTE_H8, APPLE_REMOTE_H0          // 0x08
+  #define APPLE_REMOTE_BUTTON_UP        APPLE_REMOTE_HB, APPLE_REMOTE_H0          // 0x0B
+  #define APPLE_REMOTE_BUTTON_DOWN      APPLE_REMOTE_HD, APPLE_REMOTE_H0          // 0x0D
+  #define APPLE_REMOTE_BUTTON_PLAY      APPLE_REMOTE_H4, APPLE_REMOTE_H0          // 0x04
+  #define APPLE_REMOTE_BUTTON_CENTER    APPLE_REMOTE_HC, APPLE_REMOTE_H5          // Not used
 #endif

 #define APPLE_REMOTE_SIGNAL(code) {APPLE_REMOTE_LEADER, APPLE_CUSTOM_CODE, code, APPLE_REMOTE_ID, APPLE_REMOTE_STOP }


revert main

revert main

--- apps/sensors_test/src/main.c
+++ apps/sensors_test/src/main.c
@@ -37,7 +37,22 @@
 #include <id/id.h>
 #include <os/os_time.h>
 #include <defs/error.h>
-#include <sensor/accel.h>
+
+#if MYNEWT_VAL(BNO055_CLI)
+#include <bno055/bno055.h>
+#endif
+
+#if MYNEWT_VAL(TSL2561_CLI)
+#include <tsl2561/tsl2561.h>
+#endif
+
+#if MYNEWT_VAL(TCS34725_CLI)
+#include <tcs34725/tcs34725.h>
+#endif
+
+#if MYNEWT_VAL(BME280_CLI)
+#include <bme280/bme280.h>
+#endif

 #if MYNEWT_VAL(SENSOR_OIC)
 #include <oic/oc_api.h>


correction orthographique

correction orthographique

--- DNAnalyzer/DNAnalyzerServer/Analyse.h
+++ DNAnalyzer/DNAnalyzerServer/Analyse.h
@@ -21,9 +21,9 @@

 //------------------------------------------------------------------------
 // Rle de la classe <Analyse>
-//  La classe Analyse permet Permet d'annaliser un gnome grace a 2 methode
-//  d'annalyse. L'une permet de verifier la prsence d'une maladie et
-//  l'autre de trouver les paladies potentielle
+//  La classe Analyse permet d'analyser un gnome grce  2 mthodes d'analyse.
+//  L'un permet de vrifier la prsence d'une seule maladie, l'autre de trouver
+//  l'ensemble des potentielles maladies
 //------------------------------------------------------------------------


notification-area: fix tray icons drawing

--- applets/notification_area/na-tray.c
+++ applets/notification_area/na-tray.c
@@ -533,11 +533,12 @@
     }
 }

-static void
+static gboolean
 na_tray_draw_box (GtkWidget *box,
 		  cairo_t   *cr)
 {
   gtk_container_foreach (GTK_CONTAINER (box), na_tray_draw_icon, cr);
+  return TRUE;
 }

 static void


horizontal output

horizontal output

--- battleship.c
+++ battleship.c
@@ -3,22 +3,28 @@
 #include <string.h>
 #include <time.h>

-void draw(char board[8][8])
+void draw(char comp_board[8][8], char user_board[8][8])
 {
     int i, j;

-    printf("  0 1 2 3 4 5 6 7\n");
+    printf("       You                 Computer\n");
+    printf("  0 1 2 3 4 5 6 7       0 1 2 3 4 5 6 7\n");

     for (i = 0; i <= 7; i++) {
         printf("%d ", i);
         for (j = 0; j <= 7; j++) {
-            printf("%c ", board[i][j]);
+            printf("%c ", user_board[i][j]);
+        }
+
+        printf("%d   %d ", i, i);
+        for (j = 0; j <= 7; j++) {
+            printf("%c ", comp_board[i][j]);
         }

         printf("%d\n", i);
     }

-    printf("  0 1 2 3 4 5 6 7\n");
+    printf("  0 1 2 3 4 5 6 7       0 1 2 3 4 5 6 7\n");
 }

 void place(char comp_board[8][8], char user_board[8][8])
@@ -37,7 +43,7 @@
     }

     for (i = 0; i <= 7; i++) {
-        draw(user_board);
+        draw(comp_board, user_board);
         printf("Place your ship.\n");
         scanf("%d %d", &row, &column);
         if (user_board[row][column] != '%') {
@@ -116,11 +122,7 @@
     place(comp_board, user_board);

     while (winner(user_board) == 0 && winner(comp_board) == 0) {
-        printf("\nComputer\n");
-        draw(comp_board);
-        printf("--------------------");
-        printf("\nYou\n");
-        draw(user_board);
+        draw(comp_board, user_board);
         fire(comp_board, user_board);
     }


Fix randombuffer C implementation

Fix randombuffer C implementation

--- lib/c/Lib_RandomBuffer_System.c
+++ lib/c/Lib_RandomBuffer_System.c
@@ -77,7 +77,6 @@

 #endif

-void randombytes(uint8_t *x, uint32_t len) {
-  if (!(read_random_bytes(len, x)))
-    exit(1);
+bool Lib_RandomBuffer_System_randombytes(uint8_t *x, uint32_t len) {
+  return read_random_bytes(len, x);
 }


This is a better name.

This is a better name.

--- beanstalkd.c
+++ beanstalkd.c
@@ -121,7 +121,7 @@
 }

 static void
-check_for_complete_job(conn c)
+maybe_enqueue_job(conn c)
 {
     job j = c->job;

@@ -190,7 +190,7 @@

         fill_extra_data(c);

-        check_for_complete_job(c);
+        maybe_enqueue_job(c);
         break;
     case OP_PEEK:
         reply_word(c, MSG_NOTFOUND, MSG_NOTFOUND_LEN);
@@ -272,7 +272,7 @@

             /* (j->data_read > j->data_size) can't happen */

-            check_for_complete_job(c);
+            maybe_enqueue_job(c);
             break;
         case STATE_SENDWORD:
             r = write(fd, c->reply+c->reply_sent, c->reply_len - c->reply_sent);


Warn if the size of the remote file isn't known.
If the -R option was specified, don't truncate the local file even if its
mtime is incorrect.

PR:		bin/23719

--- usr.bin/fetch/fetch.c
+++ usr.bin/fetch/fetch.c
@@ -305,12 +305,15 @@
 	goto success;
     }

+    if (us.size == -1)
+	warnx("%s: size of remote file is not known", path);
     if (v_level > 1) {
 	if (sb.st_size != -1)
 	    fprintf(stderr, "local size / mtime: %lld / %ld\n",
 		    sb.st_size, sb.st_mtime);
-	fprintf(stderr, "remote size / mtime: %lld / %ld\n",
-		us.size, us.mtime);
+	if (us.size != -1)
+	    fprintf(stderr, "remote size / mtime: %lld / %ld\n",
+		    us.size, us.mtime);
     }

     /* open output file */
@@ -322,6 +325,12 @@
 	if (!F_flag && us.mtime && sb.st_mtime != us.mtime) {
 	    /* no match! have to refetch */
 	    fclose(f);
+	    /* if precious, warn the user and give up */
+	    if (R_flag) {
+		warnx("%s: local modification time does not match remote",
+		      path);
+		goto failure_keep;
+	    }
 	    url->offset = 0;
 	    if ((f = fetchXGet(url, &us, flags)) == NULL) {
 		warnx("%s: %s", path, fetchLastErrString);


Add support for devfs.  In other words, for -CURRENT, make work at all again for normal device nodes.

--- usr.bin/fstat/fstat.c
+++ usr.bin/fstat/fstat.c
@@ -66,6 +66,7 @@
 #include <sys/file.h>
 #include <ufs/ufs/quota.h>
 #include <ufs/ufs/inode.h>
+#include <fs/devfs/devfs.h>
 #include <sys/mount.h>
 #undef _KERNEL
 #include <nfs/nfsproto.h>
@@ -142,6 +143,7 @@
 void vtrans __P((struct vnode *vp, int i, int flag));
 int  ufs_filestat __P((struct vnode *vp, struct filestat *fsp));
 int  nfs_filestat __P((struct vnode *vp, struct filestat *fsp));
+int  devfs_filestat __P((struct vnode *vp, struct filestat *fsp));
 char *getmnton __P((struct mount *m));
 void pipetrans __P((struct pipe *pi, int i, int flag));
 void socktrans __P((struct socket *sock, int i));
@@ -466,6 +468,12 @@
 			if (!ufs_filestat(&vn, &fst))
 				badtype = "error";
 			break;
+
+		case VT_DEVFS:
+			if (!devfs_filestat(&vn, &fst))
+				badtype = "error";
+			break;
+
 		case VT_NFS:
 			if (!nfs_filestat(&vn, &fst))
 				badtype = "error";
@@ -566,6 +574,39 @@
 	fsp->mode = (mode_t)inode.i_mode;
 	fsp->size = (u_long)inode.i_size;
 	fsp->rdev = inode.i_rdev;
+
+	return 1;
+}
+
+int
+devfs_filestat(vp, fsp)
+	struct vnode *vp;
+	struct filestat *fsp;
+{
+	struct devfs_dirent devfs_dirent;
+	struct mount mount;
+	struct vnode vnode;
+
+	if (!KVM_READ(vp->v_data, &devfs_dirent, sizeof (devfs_dirent))) {
+		dprintf(stderr, "can't read devfs_dirent at %p for pid %d\n",
+		    (void *)vp->v_data, Pid);
+		return 0;
+	}
+	if (!KVM_READ(vp->v_mount, &mount, sizeof (mount))) {
+		dprintf(stderr, "can't read mount at %p for pid %d\n",
+		    (void *)vp->v_mount, Pid);
+		return 0;
+	}
+	if (!KVM_READ(devfs_dirent.de_vnode, &vnode, sizeof (vnode))) {
+		dprintf(stderr, "can't read vnode at %p for pid %d\n",
+		    (void *)devfs_dirent.de_vnode, Pid);
+		return 0;
+	}
+	fsp->fsid = (long)mount.mnt_stat.f_fsid.val[0];
+	fsp->fileid = devfs_dirent.de_inode;
+	fsp->mode = (devfs_dirent.de_mode & ~S_IFMT) | S_IFCHR;
+	fsp->size = 0;
+	fsp->rdev = dev2udev((dev_t)vnode.v_rdev);

 	return 1;
 }


Back out rev 1.20; getbsize(3)'s original interface has been restored.

Approved by:	markm

--- usr.bin/systat/swap.c
+++ usr.bin/systat/swap.c
@@ -120,14 +120,12 @@
 {
 	char *header;
 	int row, i;
-	size_t tmp;

 	fetchswap();

 	row = 0;
 	wmove(wnd, row, 0); wclrtobot(wnd);
-	header = getbsize(&tmp, &blocksize);
-	hlen = (int)tmp;
+	header = getbsize(&hlen, &blocksize);
 	mvwprintw(wnd, row++, 0, "%-5s%*s%9s %55s",
 	    "Disk", hlen, header, "Used",
 	    "/0%  /10% /20% /30% /40% /50% /60% /70% /80% /90% /100");


When restoring files, use the mode for the mode.

Thanks to: Jun Kuriyama for pointing this out


make wall(1) work with pts.

make wall(1) work with pts.

--- usr.bin/wall/ttymsg.c
+++ usr.bin/wall/ttymsg.c
@@ -68,14 +68,18 @@
 	int cnt, fd;
 	static char device[MAXNAMLEN] = _PATH_DEV;
 	static char errbuf[1024];
+	char *p;
 	int forked;

 	forked = 0;
 	if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0])))
 		return ("too many iov's (change code in wall/ttymsg.c)");

-	strlcpy(device + sizeof(_PATH_DEV) - 1, line, sizeof(device));
-	if (strchr(device + sizeof(_PATH_DEV) - 1, '/')) {
+	p = device + sizeof(_PATH_DEV) - 1;
+	strlcpy(p, line, sizeof(device));
+	if (strncmp(p, "pts/", 4) == 0)
+		p += 4;
+	if (strchr(p, '/') != NULL) {
 		/* A slash is an attempt to break security... */
 		(void) snprintf(errbuf, sizeof(errbuf),
 		    "Too many '/' in \"%s\"", device);


Clean up this message a little bit.

Clean up this message a little bit.


fix building LSS master

fix building LSS master

--- CANopen.c
+++ CANopen.c
@@ -253,7 +253,7 @@
     CO->LSSslave                        = &CO0_LSSslave;
   #endif
   #if CO_NO_LSS_CLIENT == 1
-    CO->CO_LSSmaster                    = &CO0_LSSmaster;
+    CO->LSSmaster                       = &CO0_LSSmaster;
   #endif
   #if CO_NO_SDO_CLIENT == 1
     CO->SDOclient                       = &COO_SDOclient;


cryptodev: use C11 macro instead of direct attribute

This commit replaces __extension__ attribute with
RTE_STD_C11 in anonymous unions.

It makes API consistent in terms of usage of C11
feature macro.

Signed-off-by: Arek Kusztal <4bf5ef838d7576d5719b17cd64a25f70d57e7e5b@intel.com>
Acked-by: Akhil Goyal <c3c9da6f7a1dc963875aa67cfd85a4c94f75d526@marvell.com>

--- lib/cryptodev/rte_crypto_asym.h
+++ lib/cryptodev/rte_crypto_asym.h
@@ -222,7 +222,7 @@

 	enum rte_crypto_rsa_priv_key_type key_type;

-	__extension__
+	RTE_STD_C11
 	union {
 		rte_crypto_param d;
 		/**< d - Private key exponent
@@ -408,7 +408,7 @@
 	enum rte_crypto_asym_xform_type xform_type;
 	/**< Asymmetric crypto transform */

-	__extension__
+	RTE_STD_C11
 	union {
 		struct rte_crypto_rsa_xform rsa;
 		/**< RSA xform parameters */
@@ -642,7 +642,7 @@
 		/**< Session-less API crypto operation parameters */
 	};

-	__extension__
+	RTE_STD_C11
 	union {
 		struct rte_crypto_rsa_op_param rsa;
 		struct rte_crypto_mod_op_param modex;


drbd: Pass struct packet_info down to the receive functions

Signed-off-by: Philipp Reisner <35a55a4ac466b5abd81eb66f3f7d6a972dd0dc24@linbit.com>
Signed-off-by: Lars Ellenberg <31df9cacdc65c624cc60c2dcd22bbf92dc230e16@linbit.com>

--- drivers/block/drbd/drbd_receiver.c
+++ drivers/block/drbd/drbd_receiver.c
@@ -50,8 +50,8 @@

 struct packet_info {
 	enum drbd_packet cmd;
-	int size;
-	int vnr;
+	unsigned int size;
+	unsigned int vnr;
 };

 enum finish_epoch {
@@ -1540,8 +1540,7 @@
 	return NULL;
 }

-static int receive_DataReply(struct drbd_conf *mdev, enum drbd_packet cmd,
-			     unsigned int data_size)
+static int receive_DataReply(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	struct drbd_request *req;
 	sector_t sector;
@@ -1559,7 +1558,7 @@
 	/* hlist_del(&req->collision) is done in _req_may_be_done, to avoid
 	 * special casing it there for the various failure cases.
 	 * still no race with drbd_fail_pending_reads */
-	err = recv_dless_read(mdev, req, sector, data_size);
+	err = recv_dless_read(mdev, req, sector, pi->size);
 	if (!err)
 		req_mod(req, DATA_RECEIVED);
 	/* else: nothing. handled from drbd_disconnect...
@@ -1569,8 +1568,7 @@
 	return err;
 }

-static int receive_RSDataReply(struct drbd_conf *mdev, enum drbd_packet cmd,
-			       unsigned int data_size)
+static int receive_RSDataReply(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	sector_t sector;
 	int err;
@@ -1583,17 +1581,17 @@
 		/* data is submitted to disk within recv_resync_read.
 		 * corresponding put_ldev done below on error,
 		 * or in drbd_peer_request_endio. */
-		err = recv_resync_read(mdev, sector, data_size);
+		err = recv_resync_read(mdev, sector, pi->size);
 	} else {
 		if (__ratelimit(&drbd_ratelimit_state))
 			dev_err(DEV, "Can not write resync data to local disk.\n");

-		err = drbd_drain_block(mdev, data_size);
-
-		drbd_send_ack_dp(mdev, P_NEG_ACK, p, data_size);
-	}
-
-	atomic_add(data_size >> 9, &mdev->rs_sect_in);
+		err = drbd_drain_block(mdev, pi->size);
+
+		drbd_send_ack_dp(mdev, P_NEG_ACK, p, pi->size);
+	}
+
+	atomic_add(pi->size >> 9, &mdev->rs_sect_in);

 	return err;
 }
@@ -1958,8 +1956,7 @@
 }

 /* mirrored write */
-static int receive_Data(struct drbd_conf *mdev, enum drbd_packet cmd,
-			unsigned int data_size)
+static int receive_Data(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	sector_t sector;
 	struct drbd_peer_request *peer_req;
@@ -1973,9 +1970,9 @@
 		int err2;

 		err = wait_for_and_update_peer_seq(mdev, peer_seq);
-		drbd_send_ack_dp(mdev, P_NEG_ACK, p, data_size);
+		drbd_send_ack_dp(mdev, P_NEG_ACK, p, pi->size);
 		atomic_inc(&mdev->current_epoch->epoch_size);
-		err2 = drbd_drain_block(mdev, data_size);
+		err2 = drbd_drain_block(mdev, pi->size);
 		if (!err)
 			err = err2;
 		return err;
@@ -1988,7 +1985,7 @@
 	 */

 	sector = be64_to_cpu(p->sector);
-	peer_req = read_in_block(mdev, p->block_id, sector, data_size);
+	peer_req = read_in_block(mdev, p->block_id, sector, pi->size);
 	if (!peer_req) {
 		put_ldev(mdev);
 		return -EIO;
@@ -2138,8 +2135,7 @@
 }

-static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packet cmd,
-			       unsigned int digest_size)
+static int receive_DataRequest(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	sector_t sector;
 	const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
@@ -2165,7 +2161,7 @@

 	if (!get_ldev_if_state(mdev, D_UP_TO_DATE)) {
 		verb = 1;
-		switch (cmd) {
+		switch (pi->cmd) {
 		case P_DATA_REQUEST:
 			drbd_send_ack_rp(mdev, P_NEG_DREPLY, p);
 			break;
@@ -2187,7 +2183,7 @@
 			    "no local data.\n");

 		/* drain possibly payload */
-		return drbd_drain_block(mdev, digest_size);
+		return drbd_drain_block(mdev, pi->size);
 	}

 	/* GFP_NOIO, because we must not cause arbitrary write-out: in a DRBD
@@ -2199,7 +2195,7 @@
 		return -ENOMEM;
 	}

-	switch (cmd) {
+	switch (pi->cmd) {
 	case P_DATA_REQUEST:
 		peer_req->w.cb = w_e_end_data_req;
 		fault_type = DRBD_FAULT_DT_RD;
@@ -2216,25 +2212,25 @@
 	case P_OV_REPLY:
 	case P_CSUM_RS_REQUEST:
 		fault_type = DRBD_FAULT_RS_RD;
-		di = kmalloc(sizeof(*di) + digest_size, GFP_NOIO);
+		di = kmalloc(sizeof(*di) + pi->size, GFP_NOIO);
 		if (!di)
 			goto out_free_e;

-		di->digest_size = digest_size;
+		di->digest_size = pi->size;
 		di->digest = (((char *)di)+sizeof(struct digest_info));

 		peer_req->digest = di;
 		peer_req->flags |= EE_HAS_DIGEST;

-		if (drbd_recv(mdev->tconn, di->digest, digest_size) != digest_size)
+		if (drbd_recv_all(mdev->tconn, di->digest, pi->size))
 			goto out_free_e;

-		if (cmd == P_CSUM_RS_REQUEST) {
+		if (pi->cmd == P_CSUM_RS_REQUEST) {
 			D_ASSERT(mdev->tconn->agreed_pro_version >= 89);
 			peer_req->w.cb = w_e_end_csum_rs_req;
 			/* used in the sector offset progress display */
 			mdev->bm_resync_fo = BM_SECT_TO_BIT(sector);
-		} else if (cmd == P_OV_REPLY) {
+		} else if (pi->cmd == P_OV_REPLY) {
 			/* track progress, we may need to throttle */
 			atomic_add(size >> 9, &mdev->rs_sect_in);
 			peer_req->w.cb = w_e_end_ov_reply;
@@ -2860,8 +2856,7 @@
 	return 1;
 }

-static int receive_protocol(struct drbd_tconn *tconn, enum drbd_packet cmd,
-			    unsigned int data_size)
+static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
 {
 	struct p_protocol *p = tconn->data.rbuf;
 	int p_proto, p_after_sb_0p, p_after_sb_1p, p_after_sb_2p;
@@ -2915,7 +2910,7 @@
 		unsigned char *my_alg = tconn->net_conf->integrity_alg;
 		int err;

-		err = drbd_recv_all(tconn, p_integrity_alg, data_size);
+		err = drbd_recv_all(tconn, p_integrity_alg, pi->size);
 		if (err)
 			return err;

@@ -2962,8 +2957,7 @@
 	return tfm;
 }

-static int receive_SyncParam(struct drbd_conf *mdev, enum drbd_packet cmd,
-			     unsigned int packet_size)
+static int receive_SyncParam(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	struct p_rs_param_95 *p = mdev->tconn->data.rbuf;
 	unsigned int header_size, data_size, exp_max_sz;
@@ -2980,22 +2974,22 @@
 		    : apv <= 94 ? sizeof(struct p_rs_param_89)
 		    : /* apv >= 95 */ sizeof(struct p_rs_param_95);

-	if (packet_size > exp_max_sz) {
+	if (pi->size > exp_max_sz) {
 		dev_err(DEV, "SyncParam packet too long: received %u, expected <= %u bytes\n",
-		    packet_size, exp_max_sz);
+		    pi->size, exp_max_sz);
 		return -EIO;
 	}

 	if (apv <= 88) {
 		header_size = sizeof(struct p_rs_param) - sizeof(struct p_header);
-		data_size   = packet_size  - header_size;
+		data_size = pi->size - header_size;
 	} else if (apv <= 94) {
 		header_size = sizeof(struct p_rs_param_89) - sizeof(struct p_header);
-		data_size   = packet_size  - header_size;
+		data_size = pi->size - header_size;
 		D_ASSERT(data_size == 0);
 	} else {
 		header_size = sizeof(struct p_rs_param_95) - sizeof(struct p_header);
-		data_size   = packet_size  - header_size;
+		data_size = pi->size - header_size;
 		D_ASSERT(data_size == 0);
 	}

@@ -3134,8 +3128,7 @@
 		     (unsigned long long)a, (unsigned long long)b);
 }

-static int receive_sizes(struct drbd_conf *mdev, enum drbd_packet cmd,
-			 unsigned int data_size)
+static int receive_sizes(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	struct p_sizes *p = mdev->tconn->data.rbuf;
 	enum determine_dev_size dd = unchanged;
@@ -3232,8 +3225,7 @@
 	return 0;
 }

-static int receive_uuids(struct drbd_conf *mdev, enum drbd_packet cmd,
-			 unsigned int data_size)
+static int receive_uuids(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	struct p_uuids *p = mdev->tconn->data.rbuf;
 	u64 *p_uuid;
@@ -3328,8 +3320,7 @@
 	return ms;
 }

-static int receive_req_state(struct drbd_conf *mdev, enum drbd_packet cmd,
-			     unsigned int data_size)
+static int receive_req_state(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	struct p_req_state *p = mdev->tconn->data.rbuf;
 	union drbd_state mask, val;
@@ -3355,8 +3346,7 @@
 	return 0;
 }

-static int receive_req_conn_state(struct drbd_tconn *tconn, enum drbd_packet cmd,
-				  unsigned int data_size)
+static int receive_req_conn_state(struct drbd_tconn *tconn, struct packet_info *pi)
 {
 	struct p_req_state *p = tconn->data.rbuf;
 	union drbd_state mask, val;
@@ -3380,8 +3370,7 @@
 	return 0;
 }

-static int receive_state(struct drbd_conf *mdev, enum drbd_packet cmd,
-			 unsigned int data_size)
+static int receive_state(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	struct p_state *p = mdev->tconn->data.rbuf;
 	union drbd_state os, ns, peer_state;
@@ -3533,8 +3522,7 @@
 	return 0;
 }

-static int receive_sync_uuid(struct drbd_conf *mdev, enum drbd_packet cmd,
-			     unsigned int data_size)
+static int receive_sync_uuid(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	struct p_rs_uuid *p = mdev->tconn->data.rbuf;

@@ -3743,13 +3731,11 @@
    in order to be agnostic to the 32 vs 64 bits issue.

    returns 0 on failure, 1 if we successfully received it. */
-static int receive_bitmap(struct drbd_conf *mdev, enum drbd_packet cmd,
-			  unsigned int data_size)
+static int receive_bitmap(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	struct bm_xfer_ctx c;
 	int err;
 	struct p_header *h = mdev->tconn->data.rbuf;
-	struct packet_info pi;

 	drbd_bm_lock(mdev, "receive bitmap", BM_LOCKED_SET_ALLOWED);
 	/* you are supposed to send additional out-of-sync information
@@ -3761,48 +3747,46 @@
 	};

 	for(;;) {
-		if (cmd == P_BITMAP) {
-			err = receive_bitmap_plain(mdev, data_size, h, &c);
-		} else if (cmd == P_COMPRESSED_BITMAP) {
+		if (pi->cmd == P_BITMAP) {
+			err = receive_bitmap_plain(mdev, pi->size, h, &c);
+		} else if (pi->cmd == P_COMPRESSED_BITMAP) {
 			/* MAYBE: sanity check that we speak proto >= 90,
 			 * and the feature is enabled! */
 			struct p_compressed_bm *p;

-			if (data_size > BM_PACKET_PAYLOAD_BYTES) {
+			if (pi->size > BM_PACKET_PAYLOAD_BYTES) {
 				dev_err(DEV, "ReportCBitmap packet too large\n");
 				err = -EIO;
 				goto out;
 			}

 			p = mdev->tconn->data.rbuf;
-			err = drbd_recv_all(mdev->tconn, p->head.payload, data_size);
+			err = drbd_recv_all(mdev->tconn, p->head.payload, pi->size);
 			if (err)
 			       goto out;
-			if (data_size <= (sizeof(*p) - sizeof(p->head))) {
-				dev_err(DEV, "ReportCBitmap packet too small (l:%u)\n", data_size);
+			if (pi->size <= (sizeof(*p) - sizeof(p->head))) {
+				dev_err(DEV, "ReportCBitmap packet too small (l:%u)\n", pi->size);
 				err = -EIO;
 				goto out;
 			}
-			err = decode_bitmap_c(mdev, p, &c, data_size);
+			err = decode_bitmap_c(mdev, p, &c, pi->size);
 		} else {
-			dev_warn(DEV, "receive_bitmap: cmd neither ReportBitMap nor ReportCBitMap (is 0x%x)", cmd);
+			dev_warn(DEV, "receive_bitmap: cmd neither ReportBitMap nor ReportCBitMap (is 0x%x)", pi->cmd);
 			err = -EIO;
 			goto out;
 		}

-		c.packets[cmd == P_BITMAP]++;
-		c.bytes[cmd == P_BITMAP] += sizeof(struct p_header) + data_size;
+		c.packets[pi->cmd == P_BITMAP]++;
+		c.bytes[pi->cmd == P_BITMAP] += sizeof(struct p_header) + pi->size;

 		if (err <= 0) {
 			if (err < 0)
 				goto out;
 			break;
 		}
-		err = drbd_recv_header(mdev->tconn, &pi);
+		err = drbd_recv_header(mdev->tconn, pi);
 		if (err)
 			goto out;
-		cmd = pi.cmd;
-		data_size = pi.size;
 	}

 	INFO_bm_xfer_stats(mdev, "receive", &c);
@@ -3848,25 +3832,23 @@
 	return size ? -EIO : 0;
 }

-static int receive_skip(struct drbd_conf *mdev, enum drbd_packet cmd,
-			unsigned int data_size)
+static int receive_skip(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	dev_warn(DEV, "skipping unknown optional packet type %d, l: %d!\n",
-		 cmd, data_size);
-
-	return _tconn_receive_skip(mdev->tconn, data_size);
-}
-
-static int tconn_receive_skip(struct drbd_tconn *tconn, enum drbd_packet cmd, unsigned int data_size)
+		 pi->cmd, pi->size);
+
+	return _tconn_receive_skip(mdev->tconn, pi->size);
+}
+
+static int tconn_receive_skip(struct drbd_tconn *tconn, struct packet_info *pi)
 {
 	conn_warn(tconn, "skipping packet for non existing volume type %d, l: %d!\n",
-		  cmd, data_size);
-
-	return _tconn_receive_skip(tconn, data_size);
-}
-
-static int receive_UnplugRemote(struct drbd_conf *mdev, enum drbd_packet cmd,
-				unsigned int data_size)
+		  pi->cmd, pi->size);
+
+	return _tconn_receive_skip(tconn, pi->size);
+}
+
+static int receive_UnplugRemote(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	/* Make sure we've acked all the TCP data associated
 	 * with the data requests being unplugged */
@@ -3875,8 +3857,7 @@
 	return 0;
 }

-static int receive_out_of_sync(struct drbd_conf *mdev, enum drbd_packet cmd,
-			       unsigned int data_size)
+static int receive_out_of_sync(struct drbd_conf *mdev, struct packet_info *pi)
 {
 	struct p_block_desc *p = mdev->tconn->data.rbuf;

@@ -3900,10 +3881,8 @@
 	size_t pkt_size;
 	enum mdev_or_conn fa_type; /* first argument's type */
 	union {
-		int (*mdev_fn)(struct drbd_conf *, enum drbd_packet cmd,
-				  unsigned int to_receive);
-		int (*conn_fn)(struct drbd_tconn *, enum drbd_packet cmd,
-				  unsigned int to_receive);
+		int (*mdev_fn)(struct drbd_conf *, struct packet_info *);
+		int (*conn_fn)(struct drbd_tconn *, struct packet_info *);
 	};
 };

@@ -3963,15 +3942,16 @@
 			err = drbd_recv_all_warn(tconn, &header->payload, shs);
 			if (err)
 				goto err_out;
-		}
-
-		if (cmd->fa_type == CONN) {
-			err = cmd->conn_fn(tconn, pi.cmd, pi.size - shs);
-		} else {
+			pi.size -= shs;
+		}
+
+		if (cmd->fa_type == CONN)
+			err = cmd->conn_fn(tconn, &pi);
+		else {
 			struct drbd_conf *mdev = vnr_to_mdev(tconn, pi.vnr);
 			err = mdev ?
-				cmd->mdev_fn(mdev, pi.cmd, pi.size - shs) :
-				tconn_receive_skip(tconn, pi.cmd, pi.size - shs);
+				cmd->mdev_fn(mdev, &pi) :
+				tconn_receive_skip(tconn, &pi);
 		}

 		if (unlikely(err)) {


counter: callback null check to use NULL instead of numeric zero

Using 0 instead of NULL is a violation of MISRA rule 11.9.

Signed-off-by: Daniel Leung <d94e04d205b5962d7873a139ef298b03c1717f72@intel.com>

--- drivers/counter/counter_handlers.c
+++ drivers/counter/counter_handlers.c
@@ -81,7 +81,7 @@

 	Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, set_alarm));
 	Z_OOPS(z_user_from_copy(&cfg_copy, alarm_cfg, sizeof(cfg_copy)));
-	Z_OOPS(Z_SYSCALL_VERIFY_MSG(cfg_copy.callback == 0,
+	Z_OOPS(Z_SYSCALL_VERIFY_MSG(cfg_copy.callback == NULL,
 				    "callbacks may not be set from user mode"));
 	return z_impl_counter_set_channel_alarm((const struct device *)dev,
 						(uint8_t)chan_id,
@@ -107,7 +107,7 @@

 	Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, set_top_value));
 	Z_OOPS(z_user_from_copy(&cfg_copy, cfg, sizeof(cfg_copy)));
-	Z_OOPS(Z_SYSCALL_VERIFY_MSG(cfg_copy.callback == 0,
+	Z_OOPS(Z_SYSCALL_VERIFY_MSG(cfg_copy.callback == NULL,
 				    "callbacks may not be set from user mode"));
 	return z_impl_counter_set_top_value((const struct device *)dev,
 					    (const struct counter_top_cfg *)


add functions and variables

add functions and variables

--- CReader.h
+++ CReader.h
@@ -20,14 +20,25 @@
 #define TRUE	1
 #define BOOL	int

+#define MAP_SEGS_NUM 4
+#define MAP_ROWS 2
+#define MAP_COLS 2
+
+#define OCCUPANCY_OCCUPIED 1
+#define OCCUPANCY_FREE 0
+
 namespace ibeo{
 	class IbeoLaserAbstract;
 	class IbeoLaserDataAbstract;
 	namespace ibeoLUX  {class IbeoLUX;}
- }
+}

 using std::string;
 using namespace octomap;
+
+typedef struct {
+	int segment[MAP_ROWS][MAP_COLS];
+} MapSegment;

 class CReader
 {
@@ -43,8 +54,11 @@
 		unsigned short port;
 		float octo_res;
 		int layers;
+		int curr_segment;
+		int max_work_height;
 		ibeo::IbeoLaserAbstract *laserscanner;
 		boost::thread *tworker;
+		std::list <MapSegment*> map;

 		int64_t scancycles;
 		int state;
@@ -97,6 +111,8 @@
 		int getPosition(float *x, float *y, float *z);
 		int transformCoord(point3d spt, int *x, int *y, int *z);
 		int updateMapSegment();
+		int initMapSegment(MapSegment *map);
+		int addNewMapSegment();
 };

 #endif


drm/omap: gem sync: wait on correct events

A waiter of the type OMAP_GEM_READ should wait for a buffer to be completely
written, and only then proceed with reading it. A similar logic applies for
waiters with OMAP_GEM_WRITE flag.

Currently the function is_waiting() waits on the read_complete/read_target
counts in the sync object.

This should be the other way round, as a reader should wait for users who are
'writing' to this buffer, and vice versa.

Make readers of the buffer(OMAP_GEM_READ) wait on the write counters, and
writers to the buffer(OMAP_GEM_WRITE) wait on the read counters in is_waiting()

Signed-off-by: Archit Taneja <49f60fff7e48ce8acf4d32f930e8060f85030a2d@ti.com>
Signed-off-by: Tomi Valkeinen <e1ca4dbb8be1acaf20734fecd2da10ed1d46a9bb@ti.com>


fix 32/64 bits warning

fix 32/64 bits warning

--- applications/testapps/ts2udp/main.c
+++ applications/testapps/ts2udp/main.c
@@ -78,7 +78,7 @@
 int main(int argc, char **argv)
 {
 	u32 size = 0;
-	size_t fsize = 0, fdone = 0;
+	u64 fsize = 0, fdone = 0;
 	FILE *src = NULL;
 	GF_M2TS_Demuxer *ts = NULL;
 	GF_Thread *th = NULL;


drm/radeon: split busmaster enable out to a separate function

this is just a code cleanup from the kms tree.

Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

--- drivers/gpu/drm/radeon/radeon_cp.c
+++ drivers/gpu/drm/radeon/radeon_cp.c
@@ -191,6 +191,25 @@
 	}
 }

+static void radeon_enable_bm(struct drm_radeon_private *dev_priv)
+{
+	u32 tmp;
+	/* Turn on bus mastering */
+	if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
+	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) {
+		/* rs600/rs690/rs740 */
+		tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RS600_BUS_MASTER_DIS;
+		RADEON_WRITE(RADEON_BUS_CNTL, tmp);
+	} else if (((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV350) ||
+		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R420) ||
+		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS400) ||
+		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS480)) {
+		/* r1xx, r2xx, r300, r(v)350, r420/r481, rs400/rs480 */
+		tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RADEON_BUS_MASTER_DIS;
+		RADEON_WRITE(RADEON_BUS_CNTL, tmp);
+	} /* PCIE cards appears to not need this */
+}
+
 static int RADEON_READ_PLL(struct drm_device * dev, int addr)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -608,7 +627,6 @@
 {
 	struct drm_radeon_master_private *master_priv;
 	u32 ring_start, cur_read_ptr;
-	u32 tmp;

 	/* Initialize the memory controller. With new memory map, the fb location
 	 * is not changed, it should have been properly initialized already. Part
@@ -690,20 +708,7 @@

 	RADEON_WRITE(RADEON_SCRATCH_UMSK, 0x7);

-	/* Turn on bus mastering */
-	if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
-	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) {
-		/* rs600/rs690/rs740 */
-		tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RS600_BUS_MASTER_DIS;
-		RADEON_WRITE(RADEON_BUS_CNTL, tmp);
-	} else if (((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV350) ||
-		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R420) ||
-		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS400) ||
-		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS480)) {
-		/* r1xx, r2xx, r300, r(v)350, r420/r481, rs400/rs480 */
-		tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RADEON_BUS_MASTER_DIS;
-		RADEON_WRITE(RADEON_BUS_CNTL, tmp);
-	} /* PCIE cards appears to not need this */
+	radeon_enable_bm(dev_priv);

 	radeon_write_ring_rptr(dev_priv, RADEON_SCRATCHOFF(0), 0);
 	RADEON_WRITE(RADEON_LAST_FRAME_REG, 0);


drm/radeon: make sure ib bo is properly bound and up to date in vm space

Make sure that the ib bo is bound and is page table is up to date
in the virtual address space.

Signed-off-by: Jerome Glisse <0620d428a1bd3756b1319066bf466b3b8be0b2b2@redhat.com>
Reviewed-by: Christian König <c7ea837d7a46effe4232b086213468b8b31643bf@amd.com>

--- drivers/gpu/drm/radeon/radeon_cs.c
+++ drivers/gpu/drm/radeon/radeon_cs.c
@@ -372,10 +372,15 @@
 static int radeon_bo_vm_update_pte(struct radeon_cs_parser *parser,
 				   struct radeon_vm *vm)
 {
+	struct radeon_device *rdev = parser->rdev;
 	struct radeon_bo_list *lobj;
 	struct radeon_bo *bo;
 	int r;

+	r = radeon_vm_bo_update_pte(rdev, vm, rdev->ring_tmp_bo.bo, &rdev->ring_tmp_bo.bo->tbo.mem);
+	if (r) {
+		return r;
+	}
 	list_for_each_entry(lobj, &parser->validated, tv.head) {
 		bo = lobj->bo;
 		r = radeon_vm_bo_update_pte(parser->rdev, vm, bo, &bo->tbo.mem);


iio:trigger: Register sysfs file statically

The name sysfs attribute is the same for all triggers, so there is no need to
register them dynamically at runtime. Create a attribute group for it and set it
up for the bus attribute group. This also avoids a possible race condition
where the uevent for the device is sent before the name sysfs attribute has been
added.

Signed-off-by: Lars-Peter Clausen <3318dc5ce3e4fb7c28a0b841b6801c884e1d0896@metafoo.de>
Signed-off-by: Jonathan Cameron <09f65b71b7655725897b2fd41a09a0cefe2e1ace@kernel.org>


iio: hid-sensor-als: Fix return values

iio: hid-sensor-als: Fix return values

IIO_CHAN_INFO_SAMP_FREQ and IIO_CHAN_INFO_HYSTERESIS cases ignored
the actual return values (which could be -EINVAL) and instead
returned IIO_VAL_INT_PLUS_MICRO always. Return the actual value
obtained from the functions. Both functions return IIO_VAL_INT_PLUS_MICRO
upon success.

Signed-off-by: Sachin Kamat <1c3b1584a6008857f36c03c58f657c0fc16fc09e@samsung.com>
Cc: Srinivas Pandruvada <910e550f1c830a1d246b6c3ed4d6ca559ba95c19@linux.intel.com>
Signed-off-by: Jonathan Cameron <09f65b71b7655725897b2fd41a09a0cefe2e1ace@kernel.org>


iio: mlx90614: Support devices with dual IR sensor

The model is detected by reading the EEPROM configuration during
probing.

Signed-off-by: Vianney le Clément de Saint-Marcq <f402684173b9d31e3b78d9b367a2d7093deb2e3d@essensium.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <0a5e220122bc195b848436603de35259556d873f@mind.be>
Signed-off-by: Jonathan Cameron <09f65b71b7655725897b2fd41a09a0cefe2e1ace@kernel.org>


RDMA/nes: Change MDIO bus clock to 2.5MHz

Change the PHY clock divisor to make the MDIO clock 2.5MHz, instead of
3.5MHz (which is out of spec).

Signed-off-by: Tatyana Nikolova <80f5fcc66b0be1f72bfd43948411f5c4d1433b08@intel.com>
Signed-off-by: Faisal Latif <e7618a83d120495f2056c187ddaa1b7ba3ded88d@intel.com>
Signed-off-by: Roland Dreier <0d270388f2f92757a5de0f4bd891d3b392c44c4f@purestorage.com>

--- drivers/infiniband/hw/nes/nes_hw.c
+++ drivers/infiniband/hw/nes/nes_hw.c
@@ -1529,7 +1529,7 @@
 	} else {
 		/* setup 10G MDIO operation */
 		tx_config &= 0xFFFFFFE3;
-		tx_config |= 0x15;
+		tx_config |= 0x1D;
 	}
 	nes_write_indexed(nesdev, NES_IDX_MAC_TX_CONFIG, tx_config);


Fixed compilation issue with args macro definition

--- Classes.h
+++ Classes.h
@@ -97,7 +97,8 @@
 #define TemplateFunctionTypes3 typename Arg0, typename Arg1, typename Arg2
 #define TemplateFunctionTypes4 typename Arg0, typename Arg1, typename Arg2, typename Arg3
 #define TemplateFunctionTypes5 typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4
-#define TemplateFunctionTypes6 typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6
+#define TemplateFunctionTypes6 typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5
+#define TemplateFunctionTypes7 typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6

 //! Macro definitions for template function types
 #define TemplateFunctionArgs1 const Arg0& arg0
@@ -106,6 +107,7 @@
 #define TemplateFunctionArgs4 const Arg0& arg0, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3
 #define TemplateFunctionArgs5 const Arg0& arg0, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4
 #define TemplateFunctionArgs6 const Arg0& arg0, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5, const Arg6& arg6
+#define TemplateFunctionArgs7 const Arg0& arg0, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5, const Arg6& arg6

 //! Type for class index.
 typedef unsigned short  TypeIdx;


Input: gpio_keys - irq handling cleanup

Input: gpio_keys - irq handling cleanup

Cleanup IRQ handling in gpio_keys:  bail after handling the IRQ, and
report IRQ_NONE if we never handle it.

Signed-off-by: David Brownell <a0d09457d62acbdeb1fae1223575100ccbfffdf9@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <10a8c465cefc9bdd6c925e26964d23c90f1141cc@mail.ru>

--- drivers/input/keyboard/gpio_keys.c
+++ drivers/input/keyboard/gpio_keys.c
@@ -43,10 +43,11 @@

 			input_event(input, type, button->code, !!state);
 			input_sync(input);
-		}
-	}
-
-	return IRQ_HANDLED;
+			return IRQ_HANDLED;
+		}
+	}
+
+	return IRQ_NONE;
 }

 static int __devinit gpio_keys_probe(struct platform_device *pdev)


Input: tegra-kbc - enable key autorepeat

To support key repeats, keyboard needs to be setup as an autorepeating
device.

Signed-off-by: Rakesh Iyer <aa6691b4cda03ee7272a62db3ebf209188fe1f6a@nvidia.com>
Signed-off-by: Dmitry Torokhov <10a8c465cefc9bdd6c925e26964d23c90f1141cc@mail.ru>


V4L/DVB (11982): Add keymaps for TeVii and TBS USB DVB-S/S2 cards

Add keymaps for TeVii and TBS USB DVB-S/S2 cards
Also module parameter named keymap inserted for override default keymap.

Signed-off-by: Igor M. Liplianin <a3e53617fe56082b29fa287d5654f95ffb5b0b04@me.by>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>

--- drivers/media/dvb/dvb-usb/dw2102.c
+++ drivers/media/dvb/dvb-usb/dw2102.c
@@ -40,12 +40,9 @@
 #define DW2102_VOLTAGE_CTRL (0x1800)
 #define DW2102_RC_QUERY (0x1a00)

-struct dw210x_state {
-	u32 last_key_pressed;
-};
-struct dw210x_rc_keys {
-	u32 keycode;
-	u32 event;
+struct dvb_usb_rc_keys_table {
+	struct dvb_usb_rc_key *rc_keys;
+	int rc_keys_size;
 };

 /* debug */
@@ -54,6 +51,10 @@
 MODULE_PARM_DESC(debug, "set debugging level (1=info 2=xfer 4=rc(or-able))."
 						DVB_USB_DEBUG_STATUS);

+/* keymaps */
+static int ir_keymap;
+module_param_named(keymap, ir_keymap, int, 0644);
+MODULE_PARM_DESC(keymap, "set keymap 0=default 1=dvbworld 2=tevii 3=tbs  ...");

 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);

@@ -462,6 +463,7 @@
 }

 static struct dvb_usb_device_properties dw2102_properties;
+static struct dvb_usb_device_properties dw2104_properties;

 static int dw2102_frontend_attach(struct dvb_usb_adapter *d)
 {
@@ -546,14 +548,103 @@
 	{ 0xf8, 0x40, KEY_F },		/*full*/
 	{ 0xf8, 0x1e, KEY_W },		/*tvmode*/
 	{ 0xf8, 0x1b, KEY_B },		/*recall*/
-
-};
-
-
+};
+
+static struct dvb_usb_rc_key tevii_rc_keys[] = {
+	{ 0xf8, 0x0a, KEY_POWER },
+	{ 0xf8, 0x0c, KEY_MUTE },
+	{ 0xf8, 0x11, KEY_1 },
+	{ 0xf8, 0x12, KEY_2 },
+	{ 0xf8, 0x13, KEY_3 },
+	{ 0xf8, 0x14, KEY_4 },
+	{ 0xf8, 0x15, KEY_5 },
+	{ 0xf8, 0x16, KEY_6 },
+	{ 0xf8, 0x17, KEY_7 },
+	{ 0xf8, 0x18, KEY_8 },
+	{ 0xf8, 0x19, KEY_9 },
+	{ 0xf8, 0x10, KEY_0 },
+	{ 0xf8, 0x1c, KEY_MENU },
+	{ 0xf8, 0x0f, KEY_VOLUMEDOWN },
+	{ 0xf8, 0x1a, KEY_LAST },
+	{ 0xf8, 0x0e, KEY_OPEN },
+	{ 0xf8, 0x04, KEY_RECORD },
+	{ 0xf8, 0x09, KEY_VOLUMEUP },
+	{ 0xf8, 0x08, KEY_CHANNELUP },
+	{ 0xf8, 0x07, KEY_PVR },
+	{ 0xf8, 0x0b, KEY_TIME },
+	{ 0xf8, 0x02, KEY_RIGHT },
+	{ 0xf8, 0x03, KEY_LEFT },
+	{ 0xf8, 0x00, KEY_UP },
+	{ 0xf8, 0x1f, KEY_OK },
+	{ 0xf8, 0x01, KEY_DOWN },
+	{ 0xf8, 0x05, KEY_TUNER },
+	{ 0xf8, 0x06, KEY_CHANNELDOWN },
+	{ 0xf8, 0x40, KEY_PLAYPAUSE },
+	{ 0xf8, 0x1e, KEY_REWIND },
+	{ 0xf8, 0x1b, KEY_FAVORITES },
+	{ 0xf8, 0x1d, KEY_BACK },
+	{ 0xf8, 0x4d, KEY_FASTFORWARD },
+	{ 0xf8, 0x44, KEY_EPG },
+	{ 0xf8, 0x4c, KEY_INFO },
+	{ 0xf8, 0x41, KEY_AB },
+	{ 0xf8, 0x43, KEY_AUDIO },
+	{ 0xf8, 0x45, KEY_SUBTITLE },
+	{ 0xf8, 0x4a, KEY_LIST },
+	{ 0xf8, 0x46, KEY_F1 },
+	{ 0xf8, 0x47, KEY_F2 },
+	{ 0xf8, 0x5e, KEY_F3 },
+	{ 0xf8, 0x5c, KEY_F4 },
+	{ 0xf8, 0x52, KEY_F5 },
+	{ 0xf8, 0x5a, KEY_F6 },
+	{ 0xf8, 0x56, KEY_MODE },
+	{ 0xf8, 0x58, KEY_SWITCHVIDEOMODE },
+};
+
+static struct dvb_usb_rc_key tbs_rc_keys[] = {
+	{ 0xf8,	0x84, KEY_POWER },
+	{ 0xf8,	0x94, KEY_MUTE },
+	{ 0xf8,	0x87, KEY_1 },
+	{ 0xf8,	0x86, KEY_2 },
+	{ 0xf8,	0x85, KEY_3 },
+	{ 0xf8,	0x8b, KEY_4 },
+	{ 0xf8,	0x8a, KEY_5 },
+	{ 0xf8,	0x89, KEY_6 },
+	{ 0xf8,	0x8f, KEY_7 },
+	{ 0xf8,	0x8e, KEY_8 },
+	{ 0xf8,	0x8d, KEY_9 },
+	{ 0xf8, 0x92, KEY_0 },
+	{ 0xf8, 0x96, KEY_CHANNELUP },
+	{ 0xf8, 0x91, KEY_CHANNELDOWN },
+	{ 0xf8, 0x93, KEY_VOLUMEUP },
+	{ 0xf8, 0x8c, KEY_VOLUMEDOWN },
+	{ 0xf8, 0x83, KEY_RECORD },
+	{ 0xf8, 0x98, KEY_PAUSE  },
+	{ 0xf8, 0x99, KEY_OK },
+	{ 0xf8, 0x9a, KEY_SHUFFLE },
+	{ 0xf8, 0x81, KEY_UP },
+	{ 0xf8, 0x90, KEY_LEFT },
+	{ 0xf8, 0x82, KEY_RIGHT },
+	{ 0xf8, 0x88, KEY_DOWN },
+	{ 0xf8, 0x95, KEY_FAVORITES },
+	{ 0xf8, 0x97, KEY_SUBTITLE },
+	{ 0xf8, 0x9d, KEY_ZOOM },
+	{ 0xf8, 0x9f, KEY_EXIT },
+	{ 0xf8, 0x9e, KEY_MENU },
+	{ 0xf8, 0x9c, KEY_EPG },
+	{ 0xf8, 0x80, KEY_PREVIOUS },
+	{ 0xf8, 0x9b, KEY_MODE }
+};
+
+static struct dvb_usb_rc_keys_table keys_tables[] = {
+	{ dw210x_rc_keys, ARRAY_SIZE(dw210x_rc_keys) },
+	{ tevii_rc_keys, ARRAY_SIZE(tevii_rc_keys) },
+	{ tbs_rc_keys, ARRAY_SIZE(tbs_rc_keys) },
+};

 static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 {
-	struct dw210x_state *st = d->priv;
+	struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
+	int keymap_size = d->props.rc_key_map_size;
 	u8 key[2];
 	struct i2c_msg msg = {
 		.addr = DW2102_RC_QUERY,
@@ -562,19 +653,21 @@
 		.len = 2
 	};
 	int i;
+	/* override keymap */
+	if ((ir_keymap > 0) && (ir_keymap <= ARRAY_SIZE(keys_tables))) {
+		keymap = keys_tables[ir_keymap - 1].rc_keys ;
+		keymap_size = keys_tables[ir_keymap - 1].rc_keys_size;
+	}

 	*state = REMOTE_NO_KEY_PRESSED;
 	if (dw2102_i2c_transfer(&d->i2c_adap, &msg, 1) == 1) {
-		for (i = 0; i < ARRAY_SIZE(dw210x_rc_keys); i++) {
-			if (dw210x_rc_keys[i].data == msg.buf[0]) {
+		for (i = 0; i < keymap_size ; i++) {
+			if (keymap[i].data == msg.buf[0]) {
 				*state = REMOTE_KEY_PRESSED;
-				*event = dw210x_rc_keys[i].event;
-				st->last_key_pressed =
-					dw210x_rc_keys[i].event;
+				*event = keymap[i].event;
 				break;
 			}

-		st->last_key_pressed = 0;
 		}

 		if ((*state) == REMOTE_KEY_PRESSED)
@@ -655,8 +748,11 @@
 		}
 		/* init registers */
 		switch (dev->descriptor.idProduct) {
+		case 0xd650:
+			dw2104_properties.rc_key_map = tevii_rc_keys;
+			dw2104_properties.rc_key_map_size =
+					ARRAY_SIZE(tevii_rc_keys);
 		case USB_PID_DW2104:
-		case 0xd650:
 			reset = 1;
 			dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1,
 					DW210X_WRITE_MSG);
@@ -713,7 +809,6 @@
 	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
 	.usb_ctrl = DEVICE_SPECIFIC,
 	.firmware = "dvb-usb-dw2102.fw",
-	.size_of_priv = sizeof(struct dw210x_state),
 	.no_reconnect = 1,

 	.i2c_algo = &dw2102_serit_i2c_algo,
@@ -765,7 +860,6 @@
 	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
 	.usb_ctrl = DEVICE_SPECIFIC,
 	.firmware = "dvb-usb-dw2104.fw",
-	.size_of_priv = sizeof(struct dw210x_state),
 	.no_reconnect = 1,

 	.i2c_algo = &dw2104_i2c_algo,


[media] vp702x: fix locking of usb operations

Otherwise it is not obvious that vp702x_usb_in_op or vp702x_usb_out_op
will not interfere with any vp702x_usb_inout_op.

Note: This change is tested to compile only, as I don't have the
hardware.

Signed-off-by: Florian Mickler <73262ad0334ab37227b2f7a0205f51db1e606681@mickler.org>
Cc: Patrick Boettcher <b1fa6f10731cf1ed4ca572143842214ca57c6d16@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>


added Reviewed comment

added Reviewed comment


[media] timblogiw: fix two sparse warnings

drivers/media/platform/timblogiw.c:763:43: warning: incorrect type in initializer (incompatible argument 3 (different signedness))
drivers/media/platform/timblogiw.c:764:43: warning: incorrect type in initializer (incompatible argument 3 (different signedness))

Signed-off-by: Hans Verkuil <3a513708f73c27e7d36ebc496aa41dad6a3153ea@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <0cae1d1e981e84d16b82ca3d17be8a7f826608d3@samsung.com>


[media] s2255: Add ENUM_FRAMESIZES support

Signed-off-by: Hans Verkuil <3a513708f73c27e7d36ebc496aa41dad6a3153ea@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>


base class ExecutionBlock methods for skip and skipSome.

--- arangod/Aql/ExecutionBlock.h
+++ arangod/Aql/ExecutionBlock.h
@@ -493,54 +493,61 @@
           return false;
         }

-        virtual bool skip (size_t number) {
+        // skip between atLeast and atMost using the same setup as getSome,
+        // returns the number actually skipped . . .
+        // will only return less than atLeast if there aren't atLeast many
+        // things to skip overall.
+        virtual size_t skipSome (size_t atLeast, size_t atMost) {
+
+          size_t skipped = 0;
+
           if (_done) {
-            return false;
-          }
-
-          // Here, if _buffer.size() is > 0 then _pos points to a valid place
-          // in it.
-
-          size_t skipped = 0;
-          std::vector<AqlItemBlock*> collector;
-          while (skipped < number) {
+            return skipped;
+          }
+
+          while (skipped < atLeast) {
             if (_buffer.empty()) {
-              if (! getBlock(number - skipped, number - skipped)) {
+              if (! getBlock(atLeast - skipped,
+                    std::max(atMost - skipped, DefaultBatchSize))) {
                 _done = true;
-                return false;
+                break;
               }
               _pos = 0;
             }
+            // get the current block
             AqlItemBlock* cur = _buffer.front();
-            if (cur->size() - _pos + skipped > number) {
-              // The current block is too large:
-              _pos += number - skipped;
-              skipped = number;
-            }
-            else {
-              // The current block fits into our result, but it might be
-              // half-eaten already:
+
+            if (cur->size() - _pos + skipped > atMost) {
+              // eat just enough of the current block . . .
+              _pos += atMost - skipped;
+              skipped = atMost;
+            }
+            else {
+              // eat the rest of the current block and then proceed to the next
+              // course if any . . .
               skipped += cur->size() - _pos;
               delete cur;
               _buffer.pop_front();
               _pos = 0;
             }
           }
-
-          // When we get here, we have skipped enough documents and
-          // kept our data structures OK.
-          // If _buffer.size() == 0, we have to try to get another block
-          // just to be sure to get the return value right:
-          if (! _buffer.empty()) {
+          return skipped;
+        }
+
+        // skip exactly <number> outputs, returns <true> if _done after
+        // skipping, and <false> otherwise . . .
+        bool skip (size_t number) {
+          size_t skipped = skipSome(number, number);
+          size_t nr = skipped;
+
+          while ( nr != 0 && skipped < number ){
+            nr = skipSome(number - skipped, number - skipped);
+            skipped += nr;
+          }
+          if (nr == 0) {
             return true;
-          }
-
-          if (! getBlock(DefaultBatchSize, DefaultBatchSize)) {
-            _done = true;
-            return false;
-          }
-
-          return true;
+          }
+          return !hasMore();
         }

         virtual int64_t count () {
@@ -1083,6 +1090,7 @@
           AqlValue inVarReg = cur->getValue(_pos, _inVarRegId);
           size_t sizeInVar;

+          // get the size of the thing we are looping over
           switch (inVarReg._type) {
             case AqlValue::JSON: {
               if(!inVarReg._json->isList()){
@@ -1147,6 +1155,97 @@
           }
           return res;
         }
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief skip a number of outputs, return true if there is nothing further to
+//  come and false otherwise or if convenient.
+////////////////////////////////////////////////////////////////////////////////
+
+/*        bool skip (size_t number) {
+          if (_done) {
+            return true;
+          }
+
+          if (_buffer.empty()) {
+            if (! ExecutionBlock::getBlock(DefaultBatchSize, DefaultBatchSize)) {
+              _done = true;
+              return true;
+            }
+            _pos = 0;           // this is in the first block
+          }
+
+          // if we make it here, then _buffer.front() exists
+          AqlItemBlock* cur = _buffer.front();
+
+          // get the thing we are looping over
+          AqlValue inVarReg = cur->getValue(_pos, _inVarRegId);
+          size_t sizeInVar;
+
+          // get the size of the thing we are looping over
+          switch (inVarReg._type) {
+            case AqlValue::JSON: {
+              if(!inVarReg._json->isList()){
+                THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
+              }
+              sizeInVar = inVarReg._json->size();
+              break;
+            }
+            case AqlValue::RANGE: {
+              sizeInVar = inVarReg._range->_high - inVarReg._range->_low;
+              break;
+            }
+            case AqlValue::DOCVEC: {
+                if( _index == 0){// this is a (maybe) new DOCVEC
+                  _DOCVECsize = 0;
+                  //we require the total number of items
+                  for (size_t i = 0; i < inVarReg._vector->size(); i++) {
+                    _DOCVECsize += inVarReg._vector->at(i)->size();
+                  }
+                }
+                sizeInVar = _DOCVECsize;
+              break;
+            }
+            default: {
+              THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
+            }
+          }
+
+          size_t toSkip = std::min(number, sizeInVar - _index);
+
+          //create the result
+          auto res = new AqlItemBlock(toSend, _varOverview->nrRegs[_depth]);
+
+          inheritRegisters(cur, res, _pos);
+
+          // we don't have a collection
+          res->setDocumentCollection(cur->getNrRegs(), nullptr);
+
+          for (size_t j = 0; j < toSend; j++) {
+            if (j > 0) {
+              // re-use already copied aqlvalues
+              for (RegisterId i = 0; i < cur->getNrRegs(); i++) {
+                res->setValue(j, i, res->getValue(0, i));
+              }
+            }
+            // add the new register value . . .
+            res->setValue(j, cur->getNrRegs(), getAqlValue(inVarReg));
+            // deep copy of the inVariable.at(_pos) with correct memory
+            // requirements
+            ++_index;
+          }
+          if (_index == sizeInVar) {
+            _index = 0;
+            _thisblock = 0;
+            _seen = 0;
+            // advance read position in the current block . . .
+            if (++_pos == cur->size() ) {
+              delete cur;
+              _buffer.pop_front();
+              _pos = 0;
+            }
+          }
+          return res;
+        } */

 ////////////////////////////////////////////////////////////////////////////////
 /// @brief create an AqlValue from the inVariable using the current _index


V4L/DVB (10427): gspca - sonixj: Sensor sp80708 added for webcam 0c45:6143.

Signed-off-by: Jean-Francois Moine <e5394ce9c4b9ae7d2c4686830c5ac5f3b9028b6a@free.fr>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>


added TODO marker

added TODO marker


Support inputs with multiple outputs

Support inputs with multiple outputs

--- pixelmap/input.h
+++ pixelmap/input.h
@@ -9,28 +9,28 @@
   public:
     Input(){};
     virtual void update()=0;
-    virtual float getInput()=0;
+    virtual float getInput(int index = 0)=0;
 };

 class NullInput : public Input {
   public:
     NullInput(){};
     void update() {};
-    float getInput() { return 0.0; }
+    float getInput(int index = 0) { return 0.0; }
 };

 class FullInput : public Input {
   public:
     FullInput(){};
     void update() {};
-    float getInput() { return 1.0; }
+    float getInput(int index = 0) { return 1.0; }
 };

 class ConstantInput : public Input {
   public:
     ConstantInput(float value) : value_(value) {};
     void update() {};
-    float getInput() { return value_; }
+    float getInput(int index = 0) { return value_; }
   private:
     float value_;
 };
@@ -39,7 +39,11 @@
   public:
     WaveInput(float seconds = 1.0) : millis_(seconds * 1000.0) {};
     void update() {};
-    float getInput() { return (sin(2.0 * 3.14 * (millis() % millis_) / (float)millis_) + 1.0) / 2.0; }
+    float getInput(int index = 0) {
+      return
+        (sin(2.0 * 3.14 * (millis() % millis_) / (float)millis_) + 1.0)
+        / 2.0;
+    }
   private:
     int millis_;
 };
@@ -48,14 +52,14 @@
   public:
     RandomInput(){};
     void update() {};
-    float getInput() { return (float) rand() / (float) RAND_MAX; }
+    float getInput(int index = 0) { return (float) rand() / (float) RAND_MAX; }
 };

 class SwitchInput : public Input {
   public:
     SwitchInput(int pin) : pin_(pin) { pinMode(pin_, INPUT); };
     void update() {};
-    float getInput() { return digitalRead(pin_) == HIGH; }
+    float getInput(int index = 0) { return digitalRead(pin_) == HIGH; }
   private:
     int pin_;
     bool released_;
@@ -67,7 +71,7 @@
   public:
     ButtonInput(int pin) : pin_(pin), released_(true) {};
     void update() {};
-    float getInput() {
+    float getInput(int index = 0) {
       if (digitalRead(pin_) == HIGH) {
         if (released_ == true) {
           released_ = false;


[M68K] Coverity fixup : remove old/dead code.

if(info) should be removed as it's an old part of the code that has been forgotten before merging.

Didn't cause any Bug as info is always true.
Related to issue #494

Signed-off-by: Nicolas PLANEL <2ba60255afd05ede961f6b959482fc724759f990@gmail.com>

--- arch/M68K/M68KDisassembler.c
+++ arch/M68K/M68KDisassembler.c
@@ -1048,9 +1048,7 @@
 			break;
 			// All
 		case 3:
-			if (info) {
-				ext->op_count = 1;
-			}
+			ext->op_count = 1;
 			MCInst_setOpcode(info->inst, op_offset + 2);
 			break;
 	}


net/virtio: add speed capability

net/virtio: add speed capability

The chosen fake capability (10G) is consistent with the reported
link speed in virtio_dev_link_update():
	link.link_speed = SPEED_10G;

The feature is not marked in doc/guides/nics/features/virtio.ini
because it is only a fake value.

Signed-off-by: Ido Barnea <3a6e28cf60eb2f9d9d6e5ab6275926d9a599fe66@cisco.com>
[Thomas: comments added]
Acked-by: Thomas Monjalon <ee2fa8b2681c737f775687e475dcbf2028a412f1@6wind.com>

--- drivers/net/virtio/virtio_ethdev.c
+++ drivers/net/virtio/virtio_ethdev.c
@@ -1835,6 +1835,8 @@
 	uint64_t tso_mask, host_features;
 	struct virtio_hw *hw = dev->data->dev_private;

+	dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
+
 	dev_info->pci_dev = dev->device ? RTE_DEV_TO_PCI(dev->device) : NULL;
 	dev_info->max_rx_queues =
 		RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);


rtlwifi: Add missing DMA buffer unmapping for PCI drivers

In https://bugzilla.kernel.org/show_bug.cgi?id=42976, a system with driver
rtl8192se used as an AP suffers from "Out of SW-IOMMU space" errors. These
are caused by the DMA buffers used for beacons never being unmapped.

This bug was also reported at
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/961618

Reported-and-Tested-by: Da Xue <cdd4f874095045f4ae6670038cbbd05fac9d4802@lessconfused.com>
Signed-off-by: Larry Finger <ed0f1d78b8c21b2970494a178da4bdfa8beba2a7@lwfinger.net>
Cc: Stable <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>


dell-laptop: Port to new backlight interface selection API

Port the backlight selection logic to the new backlight interface
selection API.

Signed-off-by: Hans de Goede <9fa1be1a5b5729e4c6b404f34c9ce49ff4882fd8@redhat.com>
Acked-by: Pali Rohár <271b10744f2b592adf8fde144d536c86b011b93c@gmail.com>
Acked-by: Darren Hart <38f9eaa30910c40b06f5a60020b1222f2a953801@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <27ffc44a8ec6a212fba98cfc3246c6ce8ab131e0@intel.com>


dell-laptop: Fix errors on failure and exit paths

Make sure that work is cancelled after removing the i8042 filter, and
unregister the platform device rather than deleting it.

Signed-off-by: Matthew Garrett <4cf8d479716eba9bc68e0146d95320fcb138b96b@redhat.com>
Cc: Dmitry Torokhov <6b8646d310837fed93a129ed3c979b90c7f2674f@gmail.com>

--- drivers/platform/x86/dell-laptop.c
+++ drivers/platform/x86/dell-laptop.c
@@ -580,6 +580,7 @@

 fail_backlight:
 	i8042_remove_filter(dell_laptop_i8042_filter);
+	cancel_delayed_work_sync(&dell_rfkill_work);
 fail_filter:
 	dell_cleanup_rfkill();
 fail_rfkill:
@@ -597,12 +598,12 @@

 static void __exit dell_exit(void)
 {
+	i8042_remove_filter(dell_laptop_i8042_filter);
 	cancel_delayed_work_sync(&dell_rfkill_work);
-	i8042_remove_filter(dell_laptop_i8042_filter);
 	backlight_device_unregister(dell_backlight_device);
 	dell_cleanup_rfkill();
 	if (platform_device) {
-		platform_device_del(platform_device);
+		platform_device_unregister(platform_device);
 		platform_driver_unregister(&platform_driver);
 	}
 	kfree(da_tokens);


sony-laptop: fixe typos in sony_laptop_input_keycode_map

Signed-off-by: Stephen Gildea <86f86a8f471cf6593a548cbaeb83786593deede1@gildea.com>
Signed-off-by: Mattia Dongili <564ea3fba55f6e029e83434fb6b3f3b9c7ed334e@linux.it>
Signed-off-by: Matthew Garrett <d1dada306f6f6bc535ec5238317ee8d221588a1a@nebula.com>


power-supply: Check for failures only when we can fail

In power_supply_show_property() routine, we call ->get_property() conditionally
and should check for failure in that case only. There is no point comparing
'ret' for errors when 'ret' is surely zero.

Signed-off-by: Viresh Kumar <5ff32272b3d9f86512eddc8e0af523fc6f7924e5@linaro.org>
Signed-off-by: Sebastian Reichel <1ea78bda3cb6d36efdb8fc89aad6555e21b4887e@kernel.org>


Fixed the header file comment.

Fixed the header file comment.

--- CDEvent.h
+++ CDEvent.h
@@ -30,7 +30,8 @@
  * @headerfile CDEvent.h CDEvents/CDEvent.h
  * A class that wraps the data from a FSEvents event callback.
  *
- * Inspired by the open source project SCEvents created by Stuart Connolly
+ * A class that wraps the data from a FSEvents event callback. Inspired and
+ * based upon the open source project SCEvents created by Stuart Connolly
  * http://stuconnolly.com/projects/code/
  */


Cosmetic fix

Cosmetic fix

--- modules/access/rtmp/rtmp_amf_flv.c
+++ modules/access/rtmp/rtmp_amf_flv.c
@@ -741,7 +741,7 @@
     /* Build bytes read packet */
     rtmp_body = rtmp_body_new( -1 );

-    tmp_buffer = (uint8_t *) malloc( sizeof( uint32_t ) * sizeof( uint8_t ) );
+    tmp_buffer = (uint8_t *) malloc( sizeof( uint32_t ) );
     if( !tmp_buffer ) return NULL;

     reply = hton32( reply );


CDRIVER-1888 mock server detects duplicate keys, try 2

This reverts commit 5d880a361719df91aa5414418ee61ddcaba5a0b2.

--- tests/mock_server/mock-server.c
+++ tests/mock_server/mock-server.c
@@ -732,15 +732,67 @@
 }

+static bool
+find_key (void *current, void *key)
+{
+   return !strcmp ((const char *) current, (const char *) key);
+}
+
+
+static void
+key_dtor (void *item, void *ctx)
+{
+   /* mongoc_set_t requires a dtor, there's nothing to destroy */
+}
+
+
+static void
+assert_no_duplicate_keys (request_t *request)
+{
+   mongoc_set_t *keys;
+   size_t n_documents;
+   int i;
+   bson_iter_t iter;
+
+   n_documents = request->docs.len;
+
+   for (i = 0; i < n_documents; i++) {
+      keys = mongoc_set_new (8, key_dtor, NULL);
+      BSON_ASSERT (bson_iter_init (&iter, request_get_doc (request, i)));
+
+      while (bson_iter_next (&iter)) {
+         if (mongoc_set_find_item (
+                keys, find_key, (void *) bson_iter_key (&iter))) {
+            fprintf (stderr,
+                     "Duplicate key \"%s\" in document:\n%s",
+                     bson_iter_key (&iter),
+                     bson_as_json (request_get_doc (request, i), NULL));
+            abort ();
+         }
+
+         mongoc_set_add (keys, 0 /* index */, (void *) bson_iter_key (&iter));
+      }
+
+      mongoc_set_destroy (keys);
+   }
+}
+
+
 request_t *
 mock_server_receives_request (mock_server_t *server)
 {
    sync_queue_t *q;
    int64_t request_timeout_msec;
+   request_t *r;

    q = mock_server_get_queue (server);
    request_timeout_msec = mock_server_get_request_timeout_msec (server);
-   return (request_t *) q_get (q, request_timeout_msec);
+   r = (request_t *) q_get (q, request_timeout_msec);
+   if (r) {
+      assert_no_duplicate_keys (r);
+   }
+
+   return r;
 }


add singleton implements

add singleton implements

error: pathspec 'utilities/singleton.h' did not match any file(s) known to git

--- utilities/singleton.h
+++ utilities/singleton.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2014 ASMlover. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list ofconditions and the following disclaimer.
+//
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in
+//    the documentation and/or other materialsprovided with the
+//    distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+#ifndef __UTIL_SINGLETON_HEADER_H__
+#define __UTIL_SINGLETON_HEADER_H__
+
+// Singleton class implements.
+template <typename Object, typename Locker = SpinLock>
+class Singleton : private UnCopyable {
+public:
+  static Object& Instance(void) {
+    static Object*  s_instance = NULL;
+    static Locker   s_locker;
+
+    if (NULL == s_instance) {
+      LockerGuard<Locker> guard(s_locker);
+
+      if (NULL == s_instance) {
+        static Object s_object;
+        s_instance = &s_object;
+      }
+    }
+
+    return *s_instance;
+  }
+};
+
+#endif  // __UTIL_SINGLETON_HEADER_H__


fix same for handling of on-the-fly gateway routes

--- src/linux/kernel_routes.c
+++ src/linux/kernel_routes.c
@@ -294,7 +294,9 @@
     FIBM_FLAT != olsr_cnf->fib_metric ? ((RTM_NEWROUTE == cmd) ? rt->rt_best->rtp_metric.hops : rt->rt_metric.hops)
     : RT_METRIC_DEFAULT : 65535;
   const struct rt_nexthop *nexthop = ((cmd != RTM_NEWRULE) || (cmd != RTM_DELRULE)) ?
-    ((RTM_NEWROUTE == cmd)||(( (RTM_DELROUTE == cmd) && (RT_DELETE_SIMILAR_ROUTE == flag) ))) ? &rt->rt_best->rtp_nexthop : &rt->rt_nexthop : NULL;
+                                           ( ( ( (RTM_DELROUTE == cmd) && ( RT_DELETE_SIMILAR_AUTO_ROUTE == flag || RT_DELETE_SIMILAR_ROUTE == flag ) ) )
+                                           || (RTM_NEWROUTE == cmd) ) ? &rt->rt_best->rtp_nexthop : &rt->rt_nexthop
+                                     : NULL;

   memset(&req, 0, sizeof(req));
   req.n.nlmsg_len = NLMSG_LENGTH(sizeof(req.r));


The debug printf in malo_newstate() is too verbose so require debug level 2 to print it.

--- dev/ic/malo.c
+++ dev/ic/malo.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: malo.c,v 1.64 2007/03/14 08:23:09 claudio Exp $ */
+/*	$OpenBSD: malo.c,v 1.65 2007/04/17 19:45:20 claudio Exp $ */

 /*
  * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -1128,7 +1128,7 @@
 	uint8_t chan;
 	int rate;

-	DPRINTF(("%s: %s\n", sc->sc_dev.dv_xname, __func__));
+	DPRINTFN(2, ("%s: %s\n", sc->sc_dev.dv_xname, __func__));

 	ostate = ic->ic_state;
 	timeout_del(&sc->sc_scan_to);


Missing the inclusion of the heade "hardware.h" .

--- modules/base/include/openma/base.h
+++ modules/base/include/openma/base.h
@@ -40,6 +40,7 @@
 #include "openma/base/enums.h"
 #include "openma/base/event.h"
 #include "openma/base/exception.h"
+#include "openma/base/hardware.h"
 #include "openma/base/logger.h"
 #include "openma/base/node.h"
 #include "openma/base/object.h"


Updated consent method parameter types

Updated consent method parameter types

--- Countly.h
+++ Countly.h
@@ -112,7 +112,7 @@
  * @discussion If @c requiresConsent flag is not set on initial configuration, calling this method will have no effect.
  * @param featureName Feature name to give consent to
  */
-- (void)giveConsentForFeature:(NSString *)featureName;
+- (void)giveConsentForFeature:(CLYConsent)featureName;

 /**
  * Grants consent to given features and starts them.
@@ -120,7 +120,7 @@
  * @discussion Inner workings of @c giveConsentForFeature: method applies for this method as well.
  * @param features Array of feature names to give consent to
  */
-- (void)giveConsentForFeatures:(NSArray *)features;
+- (void)giveConsentForFeatures:(NSArray<CLYConsent> *)features;

 /**
  * Grants consent to all features and starts them.
@@ -136,7 +136,7 @@
  * @discussion If @c requiresConsent flag is not set on initial configuration, calling this method will have no effect.
  * @param featureName Feature name to cancel consent to
  */
-- (void)cancelConsentForFeature:(NSString *)featureName;
+- (void)cancelConsentForFeature:(CLYConsent)featureName;

 /**
  * Cancels consent to given features and stops them.
@@ -144,7 +144,7 @@
  * @discussion Inner workings of @c cancelConsentForFeature: method applies for this method as well.
  * @param features Array of feature names to cancel consent to
  */
-- (void)cancelConsentForFeatures:(NSArray *)features;
+- (void)cancelConsentForFeatures:(NSArray<CLYConsent> *)features;

 /**
  * Cancels consent to all features and stops them.


  o RooRealVar

    - Fix Windows compilation problem

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@24287 27541ba8-7e3a-0410-8455-c3a389f83636

--- roofit/roofitcore/inc/RooRealVar.h
+++ roofit/roofitcore/inc/RooRealVar.h
@@ -81,15 +81,6 @@
   inline void removeMax(const char* name=0) { getBinning(name).setMax(RooNumber::infinity()) ; }
   inline void removeRange(const char* name=0) { getBinning(name).setRange(-RooNumber::infinity(),RooNumber::infinity()) ; }

-  // Backward compatibility functions
-  void setFitBins(Int_t nBins) ;
-  void setFitMin(Double_t value) ;
-  void setFitMax(Double_t value) ;
-  void setFitRange(Double_t min, Double_t max) ;
-  void removeFitMin() ;
-  void removeFitMax() ;
-  void removeFitRange() ;
-
   // I/O streaming interface (machine readable)
   virtual Bool_t readFromStream(istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
   virtual void writeToStream(ostream& os, Bool_t compact) const ;


Patch 2525593: make methods of TerrainZone virtual

--- PlugIns/OctreeZone/include/OgreTerrainZone.h
+++ PlugIns/OctreeZone/include/OgreTerrainZone.h
@@ -100,44 +100,44 @@
 									 const String& typeName = StringUtil::BLANK);

 		/** Returns the height at the given terrain coordinates. */
-		float getHeightAt( float x, float y );
-
-
-		bool intersectSegment( const Vector3 & start, const Vector3 & end, Vector3 * result );
+		virtual float getHeightAt( float x, float y );
+
+
+		virtual bool intersectSegment( const Vector3 & start, const Vector3 & end, Vector3 * result );

 		/** Sets the texture to use for the main world texture. */
-		void setWorldTexture(const String& textureName);
+		virtual void setWorldTexture(const String& textureName);
 		/** Sets the texture to use for the detail texture. */
-		void setDetailTexture(const String& textureName);
+		virtual void setDetailTexture(const String& textureName);
 		/** Sets the number of times per tile the detail texture should be repeated. */
-		void setDetailTextureRepeat(int repeat);
+		virtual void setDetailTextureRepeat(int repeat);
 		/** Sets the dimensions of each tile (must be power of 2 + 1) */
-		void setTileSize(int size);
+		virtual void setTileSize(int size);
 		/** Sets the dimensions of each page (must be power of 2 + 1) */
-		void setPageSize(int size);
+		virtual void setPageSize(int size);
 		/** Sets the maximum screen space pixel error.  */
-		void setMaxPixelError(int pixelError);
+		virtual void setMaxPixelError(int pixelError);
 		/** Sets how to scale the terrain data. */
-		void setScale(const Vector3& scale);
+		virtual void setScale(const Vector3& scale);
 		/** Sets the maximum geomipmap level to allow. */
-		void setMaxGeoMipMapLevel(int maxMip);
+		virtual void setMaxGeoMipMapLevel(int maxMip);

 		/** Gets the texture to use for the main world texture. */
-		const String& getWorldTexture(void) { return mWorldTextureName; }
+		virtual const String& getWorldTexture(void) { return mWorldTextureName; }
 		/** Gets the texture to use for the detail texture. */
-		const String& getDetailTexture(void) { return mDetailTextureName; }
+		virtual const String& getDetailTexture(void) { return mDetailTextureName; }
 		/** Gets the number of times per tile the detail texture should be repeated. */
-		int getDetailTextureRepeat(void);
+		virtual int getDetailTextureRepeat(void);
 		/** Gets the dimensions of each tile (must be power of 2 + 1) */
-		int getTileSize(void);
+		virtual int getTileSize(void);
 		/** Gets the dimensions of each page (must be power of 2 + 1) */
-		int getPageSize(void);
+		virtual int getPageSize(void);
 		/** Gets the maximum screen space pixel error.  */
-		int getMaxPixelError(void);
+		virtual int getMaxPixelError(void);
 		/** Gets how to scale the terrain data. */
-		const Vector3& getScale(void);
+		virtual const Vector3& getScale(void);
 		/** Gets the maximum geomipmap level to allow. */
-		int getMaxGeoMipMapLevel(void);
+		virtual int getMaxGeoMipMapLevel(void);

@@ -145,14 +145,14 @@
 		@remarks
 			The default is not, in which case it uses triangle lists.
 		*/
-		void setUseTriStrips(bool useStrips);
+		virtual void setUseTriStrips(bool useStrips);
 		/** Sets whether or not terrain tiles should be morphed between LODs
 		(NB requires vertex program support). */
-		void setUseLODMorph(bool useMorph);
+		virtual void setUseLODMorph(bool useMorph);
 		/** Sets whether vertex normals will be generated for the terrain. */
-		void setUseVertexNormals(bool useNormals);
+		virtual void setUseVertexNormals(bool useNormals);
 		/** Sets whether vertex colours will be used. */
-		void setUseVertexColours(bool useColours);
+		virtual void setUseVertexColours(bool useColours);

 		/** Sets the name of a custom material to use to shade the landcape.
 		@remarks
@@ -179,7 +179,7 @@
 					(@see setCustomMaterialMorphFactorParam)</li>
 			</ul>
 		*/
-		void setCustomMaterial(const String& materialName);
+		virtual void setCustomMaterial(const String& materialName);
 		/** Sets the name of the vertex program parameter to which to pass the
 			LOD morph factor.
 		@remarks
@@ -198,7 +198,7 @@
 			which allows you to set the parameter index for low-level assembler programs.
 		@param paramName The name of the parameter which will receive the morph factor
 		*/
-		void setCustomMaterialMorphFactorParam(const String& paramName);
+		virtual void setCustomMaterialMorphFactorParam(const String& paramName);
 		/** Sets the index of the vertex program parameter to which to pass the
 			LOD morph factor.
 		@remarks
@@ -217,10 +217,10 @@
 			which allows you to set the parameter name for high-level programs.
 		@param paramName The name of the parameter which will receive the morph factor
 		*/
-		void setCustomMaterialMorphFactorParam(size_t paramIndex);
+		virtual void setCustomMaterialMorphFactorParam(size_t paramIndex);
 		/** Sets the distance at which the LOD will start to morph downwards, as
 		a proportion of the distance between the LODs. */
-		void setLODMorphStart(Real morphStart);
+		virtual void setLODMorphStart(Real morphStart);

 		/** Returns the TerrainRenderable that contains the given pt.
 			If no tile exists at the point, it returns 0;
@@ -243,7 +243,7 @@
 		virtual void notifyCameraCreated( Camera* c );

 		/// Gets the terrain options
-		const TerrainZoneOptions& getOptions(void) { return mOptions; }
+		virtual const TerrainZoneOptions& getOptions(void) { return mOptions; }

 		/** Sets the 'primary' camera, i.e. the one which will be used to determine
 			the 'home' terrain page, and to calculate the error metrics.
@@ -255,7 +255,7 @@
 		/// Iterator over all page sources
 		typedef ConstMapIterator<PageSourceMap> PageSourceIterator;
 		/// Get an iterator over all page sources
-		PageSourceIterator getPageSourceIterator(void);
+		virtual PageSourceIterator getPageSourceIterator(void);
 		/** Registers a TerrainZonePageSource class and associates it with a named type
 			of source.
 		@remarks
@@ -294,28 +294,28 @@
 		*/
 		virtual void attachPage(ushort pageX, ushort pageZ, TerrainZonePage* page);
 		/// Get a pointer to the material being used for the terrain
-		MaterialPtr& getTerrainMaterial(void);
+		virtual MaterialPtr& getTerrainMaterial(void);
 		// Called when a _renderScene is called in the SceneManager
-		void notifyBeginRenderScene(void);
+		virtual void notifyBeginRenderScene(void);

 		/// Get the SceneNode under which all terrain nodes are attached.
-		PCZSceneNode* getTerrainRootNode(void) const { return mTerrainRoot; }
+		virtual PCZSceneNode* getTerrainRootNode(void) const { return mTerrainRoot; }
 		/** clear structures for the zone */
-		void clearZone(void);
+		virtual void clearZone(void);
 		/* called by PCZSM during setWorldGeometryRenderQueue() */
-		void notifyWorldGeometryRenderQueue(uint8 qid);
+		virtual void notifyWorldGeometryRenderQueue(uint8 qid);

 		/// Get the shared list of indexes cached (internal use only)
-		TerrainBufferCache& _getIndexCache(void) {return mIndexCache;}
+		virtual TerrainBufferCache& _getIndexCache(void) {return mIndexCache;}

 		/// Get the shared level index list (internal use only)
-		LevelArray& _getLevelIndex(void) { return mLevelIndex; }
+		virtual LevelArray& _getLevelIndex(void) { return mLevelIndex; }

 		/// Get the current page count (internal use only)
-		size_t _getPageCount(void) { return mTerrainZonePages.size(); }
+		virtual size_t _getPageCount(void) { return mTerrainZonePages.size(); }

 		/// Shutdown cleanly before we get destroyed
-		void shutdown(void);
+		virtual void shutdown(void);

 	protected:

@@ -367,16 +367,16 @@
 		LevelArray mLevelIndex;

 		/// Internal method for loading configurations settings
-		void loadConfig(DataStreamPtr& stream);
+		virtual void loadConfig(DataStreamPtr& stream);

 		/// Sets up the terrain material
-		void setupTerrainMaterial(void);
+		virtual void setupTerrainMaterial(void);
 		/// Sets up the terrain page slots
-		void setupTerrainZonePages(PCZSceneNode * parentNode);
+		virtual void setupTerrainZonePages(PCZSceneNode * parentNode);
 		/// Initialise level indexes
-		void initLevelIndexes(void);
+		virtual void initLevelIndexes(void);
 		/// Destroy level indexes
-		void destroyLevelIndexes(void);
+		virtual void destroyLevelIndexes(void);

 		/// Map of source type -> TerrainZonePageSource