Implement Array::new, Array#[start,length] methods.

--- src/c_array.c
+++ src/c_array.c
@@ -383,6 +383,59 @@
 }

+//================================================================
+/*! method new
+*/
+static void c_array_new(mrb_vm *vm, mrb_value v[], int argc)
+{
+  /*
+    in case of new()
+  */
+  if( argc == 0 ) {
+    mrb_value ret = mrbc_array_new(vm, 0);
+    if( ret.array == NULL ) return;		// ENOMEM
+
+    SET_RETURN(ret);
+    return;
+  }
+
+  /*
+    in case of new(num)
+  */
+  if( argc == 1 && v[1].tt == MRB_TT_FIXNUM && v[1].i >= 0 ) {
+    mrb_value ret = mrbc_array_new(vm, v[1].i);
+    if( ret.array == NULL ) return;		// ENOMEM
+
+    mrb_value nil = mrb_nil_value();
+    if( v[1].i > 0 ) {
+      mrbc_array_set(&ret, v[1].i - 1, &nil);
+    }
+    SET_RETURN(ret);
+    return;
+  }
+
+  /*
+    in case of new(num, value)
+  */
+  if( argc == 2 && v[1].tt == MRB_TT_FIXNUM && v[1].i >= 0 ) {
+    mrb_value ret = mrbc_array_new(vm, v[1].i);
+    if( ret.array == NULL ) return;		// ENOMEM
+
+    int i;
+    for( i = 0; i < v[1].i; i++ ) {
+      mrbc_dup(&v[2]);
+      mrbc_array_set(&ret, i, &v[2]);
+    }
+    SET_RETURN(ret);
+    return;
+  }
+
+  /*
+    other case
+  */
+  console_print( "ArgumentError\n" );	// raise?
+}
+

 //================================================================
 /*! (operator) +
@@ -429,10 +482,10 @@
     in case of self[nth] -> object | nil
   */
   if( argc == 1 && v[1].tt == MRB_TT_FIXNUM ) {
-    mrb_value val = mrbc_array_get(v, v[1].i);
-    mrbc_dup(&val);
+    mrb_value ret = mrbc_array_get(v, v[1].i);
+    mrbc_dup(&ret);
     mrbc_release(v);
-    SET_RETURN(val);
+    SET_RETURN(ret);
     return;
   }

@@ -440,13 +493,39 @@
     in case of self[start, length] -> Array | nil
   */
   if( argc == 2 && v[1].tt == MRB_TT_FIXNUM && v[2].tt == MRB_TT_FIXNUM ) {
-    // TODO: not implement yet.
+    int len = mrbc_array_size(&v[0]);
+    int idx = v[1].i;
+    if( idx < 0 ) idx += len;
+    if( idx < 0 ) goto RETURN_NIL;
+
+    int size = (v[2].i < (len - idx)) ? v[2].i : (len - idx);
+					// min( v[2].i, (len - idx) )
+    if( size < 0 ) goto RETURN_NIL;
+
+    mrb_value ret = mrbc_array_new(vm, size);
+    if( ret.array == NULL ) return;		// ENOMEM
+
+    int i;
+    for( i = 0; i < size; i++ ) {
+      mrb_value val = mrbc_array_get(v, v[1].i + i);
+      mrbc_dup(&val);
+      mrbc_array_push(&ret, &val);
+    }
+
+    mrbc_release(v);
+    SET_RETURN(ret);
+    return;
   }

   /*
     other case
   */
   console_print( "Not support such case in Array#[].\n" );
+  return;
+
+ RETURN_NIL:
+  mrbc_release(v);
+  SET_NIL_RETURN();
 }

@@ -683,6 +762,7 @@
 {
   mrbc_class_array = mrbc_define_class(vm, "Array", mrbc_class_object);

+  mrbc_define_method(vm, mrbc_class_array, "new", c_array_new);
   mrbc_define_method(vm, mrbc_class_array, "+", c_array_add);
   mrbc_define_method(vm, mrbc_class_array, "[]", c_array_get);
   mrbc_define_method(vm, mrbc_class_array, "at", c_array_get);


gnrc pktbuf: satisfying my parentheses obsession

--- sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c
+++ sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c
@@ -395,7 +395,7 @@
 {
     _unused_t *prev = NULL, *ptr = _first_unused;
     size = (size < sizeof(_unused_t)) ? _align(sizeof(_unused_t)) : _align(size);
-    while (ptr && size > ptr->size) {
+    while (ptr && (size > ptr->size)) {
         prev = ptr;
         ptr = ptr->next;
     }


ASoC: TWL4030: Change the common playback volume controls

Add Playback volume controls for all four DACs.
All four paths has three levels of volume controls:
Digital Fine gain, Digital Coarse gain, Analog gain.

The controls are named to reflect their connection to the DACs.
Per DAC volume can be performed, if needed:
amixer sset 'DAC1 Analog'  5,10
DACL1 analog gain to 5
DACR1 analog gain to 10

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

--- sound/soc/codecs/twl4030.c
+++ sound/soc/codecs/twl4030.c
@@ -351,14 +351,20 @@
  * FGAIN volume control:
  * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB)
  */
-static DECLARE_TLV_DB_SCALE(master_tlv, -6300, 100, 1);
+static DECLARE_TLV_DB_SCALE(digital_fine_tlv, -6300, 100, 1);

 /*
  * CGAIN volume control:
  * 0 dB to 12 dB in 6 dB steps
  * value 2 and 3 means 12 dB
  */
-static DECLARE_TLV_DB_SCALE(master_coarse_tlv, 0, 600, 0);
+static DECLARE_TLV_DB_SCALE(digital_coarse_tlv, 0, 600, 0);
+
+/*
+ * Analog playback gain
+ * -24 dB to 12 dB in 2 dB steps
+ */
+static DECLARE_TLV_DB_SCALE(analog_tlv, -2400, 200, 0);

 /*
  * Capture gain after the ADCs
@@ -367,12 +373,27 @@
 static DECLARE_TLV_DB_SCALE(digital_capture_tlv, 0, 100, 0);

 static const struct snd_kcontrol_new twl4030_snd_controls[] = {
-	SOC_DOUBLE_R_TLV("Master Playback Volume",
-		 TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
-		0, 0x3f, 0, master_tlv),
-	SOC_DOUBLE_R_TLV("Master PCM Playback Volume",
-		 TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
-		6, 0x2, 0, master_coarse_tlv),
+	/* Common playback gain controls */
+	SOC_DOUBLE_R_TLV("DAC1 Digital Fine Playback Volume",
+		TWL4030_REG_ARXL1PGA, TWL4030_REG_ARXR1PGA,
+		0, 0x3f, 0, digital_fine_tlv),
+	SOC_DOUBLE_R_TLV("DAC2 Digital Fine Playback Volume",
+		TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
+		0, 0x3f, 0, digital_fine_tlv),
+
+	SOC_DOUBLE_R_TLV("DAC1 Digital Coarse Playback Volume",
+		TWL4030_REG_ARXL1PGA, TWL4030_REG_ARXR1PGA,
+		6, 0x2, 0, digital_coarse_tlv),
+	SOC_DOUBLE_R_TLV("DAC2 Digital Coarse Playback Volume",
+		TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
+		6, 0x2, 0, digital_coarse_tlv),
+
+	SOC_DOUBLE_R_TLV("DAC1 Analog Playback Volume",
+		TWL4030_REG_ARXL1_APGA_CTL, TWL4030_REG_ARXR1_APGA_CTL,
+		3, 0x12, 1, analog_tlv),
+	SOC_DOUBLE_R_TLV("DAC2 Analog Playback Volume",
+		TWL4030_REG_ARXL2_APGA_CTL, TWL4030_REG_ARXR2_APGA_CTL,
+		3, 0x12, 1, analog_tlv),

 	/* Common capture gain controls */
 	SOC_DOUBLE_R_TLV("Capture Volume",


ASoC: wcd9320: correct ANC calibration to register writes

ANC calibration data is sequence of register writes for configuring
and enabling ANC .So just write ANC registers with values read from
calibration file.

Change-Id: Iceac68601fb8927d75bf29d0b50da2d62d4921ac
Signed-off-by: Kiran Kandi <151b7975787944ef226ad549b2fc4b785b7027a7@codeaurora.org>

--- sound/soc/codecs/wcd9320.c
+++ sound/soc/codecs/wcd9320.c
@@ -1947,7 +1947,7 @@
 	int anc_size_remaining;
 	u32 *anc_ptr;
 	u16 reg;
-	u8 mask, val, old_val;
+	u8 mask, val;

 	pr_debug("%s %d\n", __func__, event);
 	switch (event) {
@@ -2014,9 +2014,7 @@
 		for (i = 0; i < anc_writes_size; i++) {
 			TAIKO_CODEC_UNPACK_ENTRY(anc_ptr[i], reg,
 				mask, val);
-			old_val = snd_soc_read(codec, reg);
-			snd_soc_write(codec, reg, (old_val & ~mask) |
-				(val & mask));
+			snd_soc_write(codec, reg, val);
 		}
 		release_firmware(fw);


Updated graphics/XWindows/jiggleMouse.c

Updated graphics/XWindows/jiggleMouse.c

 - Changed default parameters


add nullability annotations to BBMediaPickerViewModel.h

--- BBFrameworks/BBMediaPicker/BBMediaPickerViewModel.h
+++ BBFrameworks/BBMediaPicker/BBMediaPickerViewModel.h
@@ -18,6 +18,8 @@
 #import "BBMediaPickerDefines.h"
 #import "BBMediaPickerViewModelDelegate.h"

+NS_ASSUME_NONNULL_BEGIN
+
 @class BBMediaPickerAssetsGroupViewModel,BBMediaPickerAssetViewModel,BBMediaPickerViewController;
 @class RACCommand;

@@ -25,16 +27,16 @@

 + (BBMediaPickerAuthorizationStatus)authorizationStatus;

-@property (weak,nonatomic) id<BBMediaPickerViewModelDelegate> delegate;
+@property (weak,nonatomic,nullable) id<BBMediaPickerViewModelDelegate> delegate;

 @property (assign,nonatomic) BOOL allowsMultipleSelection;
 @property (assign,nonatomic) BOOL hidesEmptyMediaGroups;
 @property (assign,nonatomic) BOOL automaticallyDismissForSingleSelection;
-@property (copy,nonatomic) NSString *cancelBarButtonItemTitle;
+@property (copy,nonatomic,nullable) NSString *cancelBarButtonItemTitle;

 @property (assign,nonatomic) BBMediaPickerMediaTypes mediaTypes;

-@property (copy,nonatomic) BBMediaPickerMediaFilterBlock mediaFilterBlock;
+@property (copy,nonatomic,nullable) BBMediaPickerMediaFilterBlock mediaFilterBlock;

 @property (readonly,copy,nonatomic) NSString *selectedAssetString;

@@ -58,3 +60,5 @@
 - (RACSignal *)requestAssetsLibraryAuthorization;

 @end
+
+NS_ASSUME_NONNULL_END


ASoC: omap-dmic: Use devm_clk_get

ASoC: omap-dmic: Use devm_clk_get

This patch introduces the use of managed interfaces like devm_clk_get
and does away with the clk_puts in the probe and remove functions. A
label is also done away with.

Signed-off-by: Himangi Saraogi <23256c5b125c18bd580b7fa252de87dcf0c3a427@gmail.com>
Acked-by: Peter Ujfalusi <e5c0b4cdf99ae1d408b9c497159e74b54e02e008@ti.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@linaro.org>

--- sound/soc/omap/omap-dmic.c
+++ sound/soc/omap/omap-dmic.c
@@ -466,7 +466,7 @@

 	mutex_init(&dmic->mutex);

-	dmic->fclk = clk_get(dmic->dev, "fck");
+	dmic->fclk = devm_clk_get(dmic->dev, "fck");
 	if (IS_ERR(dmic->fclk)) {
 		dev_err(dmic->dev, "cant get fck\n");
 		return -ENODEV;
@@ -475,8 +475,7 @@
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
 	if (!res) {
 		dev_err(dmic->dev, "invalid dma memory resource\n");
-		ret = -ENODEV;
-		goto err_put_clk;
+		return -ENODEV;
 	}
 	dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;

@@ -484,34 +483,19 @@

 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
 	dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(dmic->io_base)) {
-		ret = PTR_ERR(dmic->io_base);
-		goto err_put_clk;
-	}
+	if (IS_ERR(dmic->io_base))
+		return PTR_ERR(dmic->io_base);

 	ret = devm_snd_soc_register_component(&pdev->dev,
 					      &omap_dmic_component,
 					      &omap_dmic_dai, 1);
 	if (ret)
-		goto err_put_clk;
+		return ret;

 	ret = omap_pcm_platform_register(&pdev->dev);
 	if (ret)
-		goto err_put_clk;
-
-	return 0;
-
-err_put_clk:
-	clk_put(dmic->fclk);
-	return ret;
-}
-
-static int asoc_dmic_remove(struct platform_device *pdev)
-{
-	struct omap_dmic *dmic = platform_get_drvdata(pdev);
-
-	clk_put(dmic->fclk);
+		return ret;

 	return 0;
 }
@@ -529,7 +513,6 @@
 		.of_match_table = omap_dmic_of_match,
 	},
 	.probe = asoc_dmic_probe,
-	.remove = asoc_dmic_remove,
 };

 module_platform_driver(asoc_dmic_driver);


drm/amdgpu: ignore scheduler fences from the same entity

We are going to submit them before the job anyway.

Signed-off-by: Christian König <c7ea837d7a46effe4232b086213468b8b31643bf@amd.com>
Reviewed-by: Chunming Zhou <331ec51bea57dab96050040a347da39906b1207b@amd.com>

--- drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -221,6 +221,12 @@
 		return NULL;

 	while ((entity->dependency = sched->ops->dependency(sched_job))) {
+
+		if (entity->dependency->context == entity->fence_context) {
+			/* We can ignore fences from ourself */
+			fence_put(entity->dependency);
+			continue;
+		}

 		if (fence_add_callback(entity->dependency, &entity->cb,
 				       amd_sched_entity_wakeup))


[media] media: davinci: vpif_capture: use vb2_fop_mmap/poll

No need to reinvent the wheel. Just use the already existing
functions for that.

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

--- drivers/media/platform/davinci/vpif_capture.c
+++ drivers/media/platform/davinci/vpif_capture.c
@@ -751,50 +751,6 @@
 }

 /**
- * vpif_mmap : It is used to map kernel space buffers into user spaces
- * @filep: file pointer
- * @vma: ptr to vm_area_struct
- */
-static int vpif_mmap(struct file *filep, struct vm_area_struct *vma)
-{
-	/* Get the channel object and file handle object */
-	struct vpif_fh *fh = filep->private_data;
-	struct channel_obj *ch = fh->channel;
-	struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]);
-	int ret;
-
-	vpif_dbg(2, debug, "vpif_mmap\n");
-
-	if (mutex_lock_interruptible(&common->lock))
-		return -ERESTARTSYS;
-	ret = vb2_mmap(&common->buffer_queue, vma);
-	mutex_unlock(&common->lock);
-	return ret;
-}
-
-/**
- * vpif_poll: It is used for select/poll system call
- * @filep: file pointer
- * @wait: poll table to wait
- */
-static unsigned int vpif_poll(struct file *filep, poll_table * wait)
-{
-	struct vpif_fh *fh = filep->private_data;
-	struct channel_obj *channel = fh->channel;
-	struct common_obj *common = &(channel->common[VPIF_VIDEO_INDEX]);
-	unsigned int res = 0;
-
-	vpif_dbg(2, debug, "vpif_poll\n");
-
-	if (common->started) {
-		mutex_lock(&common->lock);
-		res = vb2_poll(&common->buffer_queue, filep, wait);
-		mutex_unlock(&common->lock);
-	}
-	return res;
-}
-
-/**
  * vpif_open : vpif open handler
  * @filep: file ptr
  *
@@ -1797,8 +1753,8 @@
 	.open = vpif_open,
 	.release = vpif_release,
 	.unlocked_ioctl = video_ioctl2,
-	.mmap = vpif_mmap,
-	.poll = vpif_poll
+	.mmap = vb2_fop_mmap,
+	.poll = vb2_fop_poll
 };

 /* vpif video template */
@@ -1884,6 +1840,7 @@
 static int vpif_probe_complete(void)
 {
 	struct common_obj *common;
+	struct video_device *vdev;
 	struct channel_obj *ch;
 	struct vb2_queue *q;
 	int i, j, err, k;
@@ -1931,7 +1888,9 @@

 		INIT_LIST_HEAD(&common->dma_queue);

-		err = video_register_device(ch->video_dev,
+		vdev = ch->video_dev;
+		vdev->queue = q;
+		err = video_register_device(vdev,
 					    VFL_TYPE_GRABBER, (j ? 1 : 0));
 		if (err)
 			goto probe_out;


V4L/DVB (5294): Make pvr2_encoder_prep_config() static

Signed-off-by: Adrian Bunk <0b86548ef377da0031a3ff3f0c4e06f016e20105@stusta.de>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@infradead.org>

--- drivers/media/video/pvrusb2/pvrusb2-encoder.c
+++ drivers/media/video/pvrusb2/pvrusb2-encoder.c
@@ -324,7 +324,7 @@

 /* This implements some extra setup for the encoder that seems to be
    specific to the PVR USB2 hardware. */
-int pvr2_encoder_prep_config(struct pvr2_hdw *hdw)
+static int pvr2_encoder_prep_config(struct pvr2_hdw *hdw)
 {
 	int ret = 0;
 	int encMisc3Arg = 0;


ixgbe: cleanup allocation and freeing of IRQ affinity hint

The allocation and freeing of the IRQ affinity hint needs some updates
since there are a number of spots where we run into possible issues with
the hint not being correctly updated.

Signed-off-by: Alexander Duyck <af56634f9be8457194a3461ec96c497f138af4ff@intel.com>
Tested-by: Phil Schmitt <e59a1cb13110d2d5848864a809262db69840c26d@intel.com>
Signed-off-by: Jeff Kirsher <87e35f5be20bb3e67f4ba6b86f5f6be3085b1b3a@intel.com>

--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1565,20 +1565,6 @@
 			q_vector->eitr = adapter->rx_eitr_param;

 		ixgbe_write_eitr(q_vector);
-		/* If ATR is enabled, set interrupt affinity */
-		if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
-			/*
-			 * Allocate the affinity_hint cpumask, assign the mask
-			 * for this vector, and set our affinity_hint for
-			 * this irq.
-			 */
-			if (!alloc_cpumask_var(&q_vector->affinity_mask,
-			                       GFP_KERNEL))
-				return;
-			cpumask_set_cpu(v_idx, q_vector->affinity_mask);
-			irq_set_affinity_hint(adapter->msix_entries[v_idx].vector,
-			                      q_vector->affinity_mask);
-		}
 	}

 	switch (adapter->hw.mac.type) {
@@ -2093,11 +2079,9 @@
 static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
 {
 	struct net_device *netdev = adapter->netdev;
-	int i, vector, q_vectors, err;
+	int q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;
+	int vector, err;
 	int ri = 0, ti = 0;
-
-	/* Decrement for Other and TCP Timer vectors */
-	q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;

 	err = ixgbe_map_rings_to_vectors(adapter);
 	if (err)
@@ -2105,6 +2089,7 @@

 	for (vector = 0; vector < q_vectors; vector++) {
 		struct ixgbe_q_vector *q_vector = adapter->q_vector[vector];
+		struct msix_entry *entry = &adapter->msix_entries[vector];

 		if (q_vector->tx.ring && q_vector->rx.ring) {
 			snprintf(q_vector->name, sizeof(q_vector->name) - 1,
@@ -2120,13 +2105,18 @@
 			/* skip this unused q_vector */
 			continue;
 		}
-		err = request_irq(adapter->msix_entries[vector].vector,
-				  &ixgbe_msix_clean_rings, 0, q_vector->name,
-				  q_vector);
+		err = request_irq(entry->vector, &ixgbe_msix_clean_rings, 0,
+				  q_vector->name, q_vector);
 		if (err) {
 			e_err(probe, "request_irq failed for MSIX interrupt "
 			      "Error: %d\n", err);
 			goto free_queue_irqs;
+		}
+		/* If Flow Director is enabled, set interrupt affinity */
+		if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
+			/* assign the mask for this irq */
+			irq_set_affinity_hint(entry->vector,
+					      q_vector->affinity_mask);
 		}
 	}

@@ -2141,9 +2131,13 @@
 	return 0;

 free_queue_irqs:
-	for (i = vector - 1; i >= 0; i--)
-		free_irq(adapter->msix_entries[--vector].vector,
-			 adapter->q_vector[i]);
+	while (vector) {
+		vector--;
+		irq_set_affinity_hint(adapter->msix_entries[vector].vector,
+				      NULL);
+		free_irq(adapter->msix_entries[vector].vector,
+			 adapter->q_vector[vector]);
+	}
 	adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
 	pci_disable_msix(adapter->pdev);
 	kfree(adapter->msix_entries);
@@ -2333,14 +2327,19 @@
 			    !adapter->q_vector[i]->tx.ring)
 				continue;

+			/* clear the affinity_mask in the IRQ descriptor */
+			irq_set_affinity_hint(adapter->msix_entries[i].vector,
+					      NULL);
+
 			free_irq(adapter->msix_entries[i].vector,
 				 adapter->q_vector[i]);
 		}
-
-		ixgbe_reset_q_vectors(adapter);
 	} else {
 		free_irq(adapter->pdev->irq, adapter);
 	}
+
+	/* clear q_vector state information */
+	ixgbe_reset_q_vectors(adapter);
 }

 /**
@@ -3879,7 +3878,6 @@
 	struct ixgbe_hw *hw = &adapter->hw;
 	u32 rxctrl;
 	int i;
-	int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;

 	/* signal that we are down to the interrupt handler */
 	set_bit(__IXGBE_DOWN, &adapter->state);
@@ -3922,15 +3920,6 @@
 		/* Mark all the VFs as inactive */
 		for (i = 0 ; i < adapter->num_vfs; i++)
 			adapter->vfinfo[i].clear_to_send = 0;
-	}
-
-	/* Cleanup the affinity_hint CPU mask memory and callback */
-	for (i = 0; i < num_q_vectors; i++) {
-		struct ixgbe_q_vector *q_vector = adapter->q_vector[i];
-		/* clear the affinity_mask in the IRQ descriptor */
-		irq_set_affinity_hint(adapter->msix_entries[i]. vector, NULL);
-		/* release the CPU mask memory */
-		free_cpumask_var(q_vector->affinity_mask);
 	}

 	/* disable transmits in the hardware now that interrupts are off */
@@ -4677,6 +4666,11 @@
 		q_vector->adapter = adapter;
 		q_vector->v_idx = v_idx;

+		/* Allocate the affinity_hint cpumask, configure the mask */
+		if (!alloc_cpumask_var(&q_vector->affinity_mask, GFP_KERNEL))
+			goto err_out;
+		cpumask_set_cpu(v_idx, q_vector->affinity_mask);
+
 		if (q_vector->tx.count && !q_vector->rx.count)
 			q_vector->eitr = adapter->tx_eitr_param;
 		else
@@ -4694,6 +4688,7 @@
 		v_idx--;
 		q_vector = adapter->q_vector[v_idx];
 		netif_napi_del(&q_vector->napi);
+		free_cpumask_var(q_vector->affinity_mask);
 		kfree(q_vector);
 		adapter->q_vector[v_idx] = NULL;
 	}
@@ -4710,17 +4705,18 @@
  **/
 static void ixgbe_free_q_vectors(struct ixgbe_adapter *adapter)
 {
-	int q_idx, num_q_vectors;
+	int v_idx, num_q_vectors;

 	if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED)
 		num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;
 	else
 		num_q_vectors = 1;

-	for (q_idx = 0; q_idx < num_q_vectors; q_idx++) {
-		struct ixgbe_q_vector *q_vector = adapter->q_vector[q_idx];
-		adapter->q_vector[q_idx] = NULL;
+	for (v_idx = 0; v_idx < num_q_vectors; v_idx++) {
+		struct ixgbe_q_vector *q_vector = adapter->q_vector[v_idx];
+		adapter->q_vector[v_idx] = NULL;
 		netif_napi_del(&q_vector->napi);
+		free_cpumask_var(q_vector->affinity_mask);
 		kfree(q_vector);
 	}
 }


ixgbe: cleanup ixgbe_setup_gpie() for X540

The X540 thermal sensor interrupt isn't a General Purpose Interrupt
so doesn't need to be enabled in ixgbe_setup_gpie().  Likewise X540 doesn't
use the SDP0 for thermal sensor so it doesn't need to be enabled for any
device other than 82599.

Signed-off-by: Don Skidmore <db552506339f77ba9019f0c6d9084f81cf1d1757@intel.com>
Tested-by: Phil Schmitt <e59a1cb13110d2d5848864a809262db69840c26d@intel.com>
Signed-off-by: Jeff Kirsher <87e35f5be20bb3e67f4ba6b86f5f6be3085b1b3a@intel.com>

--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3680,8 +3680,18 @@
 	}

 	/* Enable Thermal over heat sensor interrupt */
-	if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE)
-		gpie |= IXGBE_SDP0_GPIEN;
+	if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) {
+		switch (adapter->hw.mac.type) {
+		case ixgbe_mac_82599EB:
+			gpie |= IXGBE_SDP0_GPIEN;
+			break;
+		case ixgbe_mac_X540:
+			gpie |= IXGBE_EIMS_TS;
+			break;
+		default:
+			break;
+		}
+	}

 	/* Enable fan failure interrupt */
 	if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE)


Configure radio interrupts

Configure radio interrupts

--- mos/chips/cc1101/cc1101.c
+++ mos/chips/cc1101/cc1101.c
@@ -308,7 +308,16 @@
     { REG_SYNC1,    MSB(CC1101_SYNC_WORD) }, // Sync word
     { REG_SYNC0,    LSB(CC1101_SYNC_WORD) },
     { REG_MCSM1,    0x03 }, // Switch to RX after packet transmission
-    { REG_PATABLE,  CC1101_TXPOWER } // Default transmit power
+    { REG_PATABLE,  CC1101_TXPOWER }, // Default transmit power
+
+    // Interrupt setup
+#if CC1101_GDO_INTR != 0
+    { REG_GDO0,     0x2E }, // High impedance -- disable clock signal output
+#endif
+#define XREG_IOCFG(x) REG_IOCFG ## x
+#define REG_IOCFG(x)  XREG_IOCFG(x)
+    { REG_IOCFG(CC1101_GDO_INTR), 0x07 } // Assert when a packet has been
+                                         // received with CRC OK
 };

 void cc1101Init(void)
@@ -316,10 +325,7 @@
     size_t i;

     spiBusInit(CC1101_SPI_ID, SPI_MODE_MASTER);
-
     pinAsOutput(CC1101_CSN_PORT, CC1101_CSN_PIN);
-    pinEnableInt(CC1101_INTR_PORT, CC1101_INTR_PIN);
-    pinIntRising(CC1101_INTR_PORT, CC1101_INTR_PIN);

     chipSelect();

@@ -332,14 +338,10 @@
     {
         setreg(rfConfig[i][0], rfConfig[i][1]);
     }
-#if 0
-    setreg(REG_IOCFG0, IOCFG_HIGH_IMP);
-#define XREG_IOCFG(x) REG_IOCFG ## x
-#define REG_IOCFG(x)  XREG_IOCFG(x)
-    setreg(REG_IOCFG(CC1101_GDO_INTR), IOCFG_PACKET_CRC_OK);
-#undef REG_IOCFG
-#undef XREG_IOCFG
-#endif
+
+    // Enable radio interrupts
+    pinIntRising(CC1101_INTR_PORT, CC1101_INTR_PIN);
+    //pinEnableInt(CC1101_INTR_PORT, CC1101_INTR_PIN);

     // Wait for the user to enable RX
     strobe(STROBE_SPWD);


VLA asm commenting

VLA asm commenting

--- src/cc1/vla.c
+++ src/cc1/vla.c
@@ -160,19 +160,24 @@
 	assert(s && "no sym for vla");

 	/* save the stack pointer */
+	out_comment(octx, "save stack for %s", decl_to_str(d));
 	out_store(octx,
 			v_new_bp3_below(octx, NULL,
-				ptrsizety, d->sym->loc.stack_pos - pws),
+				ptrsizety, d->sym->loc.stack_pos + pws),
 			v_new_sp3(octx, NULL, sizety, 0));

+	out_comment(octx, "gen size for %s", decl_to_str(d));
 	v_sz = vla_gen_size_ty(d->ref, octx, sizety,
 			/* 2 * platform_word_size - once for vla pointer, once for saved $sp */
-			d->sym->loc.stack_pos - 2 * pws,
+			d->sym->loc.stack_pos + 2 * pws,
 			1);

 	v_sz = out_cast(octx, v_sz, sizety, 0);

+	out_comment(octx, "alloca for %s", decl_to_str(d));
 	v_ptr = out_alloca_push(octx, v_sz, type_align(d->ref, NULL));
+
+	out_comment(octx, "save ptr for %s", decl_to_str(d));
 	out_store(octx,
 			v_new_bp3_below(octx, NULL, ptrsizety, d->sym->loc.stack_pos),
 			v_ptr);
@@ -184,16 +189,18 @@

 	return out_deref(octx,
 			v_new_bp3_below(octx, NULL, ptr_to_vla_ty,
-				d->sym->loc.stack_pos - offset));
+				d->sym->loc.stack_pos + offset));
 }

 const out_val *vla_address(decl *d, out_ctx *octx)
 {
+	out_comment(octx, "vla address (%s)", decl_to_str(d));
 	return vla_read(d, octx, 0);
 }

 const out_val *vla_saved_ptr(decl *d, out_ctx *octx)
 {
+	out_comment(octx, "vla saved stack ptr (%s)", decl_to_str(d));
 	return vla_read(d, octx, platform_word_size());
 }

@@ -207,10 +214,12 @@
 		long stack_off = dynmap_get(type *, long, vlamap, t);

 		if(stack_off){
+			out_comment(octx, "vla saved size for %s", type_to_str(qual_t));
 			return out_deref(octx,
 					v_new_bp3_below(octx, NULL, ptrsizety, stack_off));
 		}
 	}
 	/* no cached size */
+	out_comment(octx, "vla gen size (%s)", type_to_str(qual_t));
 	return vla_gen_size(qual_t, octx);
 }


var name fix

var name fix

--- ngx_rtmpt_proxy_session.c
+++ ngx_rtmpt_proxy_session.c
@@ -151,6 +151,8 @@
 	session->chain_from_http_request = NULL;
 	session->chain_from_nginx = NULL;
 	session->out_pool = NULL;
+	session->interval_check_time=0;
+	session->interval_check_att=0;

 	put_session_in_hash(session);

@@ -226,10 +228,10 @@
 	remove_session_from_hash(session->name.data, session->name.len);
 	ngx_close_connection(session->connection);
 	ngx_destroy_pool(session->pool);
-	if (s->out_pool) {
-		ngx_destroy_pool(s->out_pool);
-		s->out_pool = NULL;
-	}
-}
-
-
+	if (session->out_pool) {
+		ngx_destroy_pool(session->out_pool);
+		session->out_pool = NULL;
+	}
+}
+
+


net/virtio-user: fix tapfds close

net/virtio-user: fix tapfds close

The valid tap file descriptor range should be equal or greater
than zero instead of non-zero

Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost")
Cc: stable@dpdk.org

Signed-off-by: Wenfeng Liu <1b331427c48461e9612688a3d074cbc037719d88@arraynetworks.com.cn>
Acked-by: Yuanhan Liu <5dcef21195e64c9c08aa779bb62b25e9133eaa33@linux.intel.com>

--- drivers/net/virtio/virtio_user/vhost_kernel.c
+++ drivers/net/virtio/virtio_user/vhost_kernel.c
@@ -365,7 +365,7 @@
 	vhostfd = dev->vhostfds[pair_idx];

 	if (!enable) {
-		if (dev->tapfds[pair_idx]) {
+		if (dev->tapfds[pair_idx] >= 0) {
 			close(dev->tapfds[pair_idx]);
 			dev->tapfds[pair_idx] = -1;
 		}


gone

gone

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

--- mount_slash/mount_slash.h
+++ mount_slash/mount_slash.h
@@ -439,7 +439,6 @@

 extern struct psc_listcache	 slc_attrtimeoutq;
 extern struct psc_listcache	 slc_bmapflushq;
-extern struct psc_listcache	 slc_bmapreadaheadq;
 extern struct psc_listcache	 slc_bmaptimeoutq;
 extern struct psc_listcache	 slc_readaheadq;


ath9k_htc: Fix TKIP disconnect failure with HTC drivers

The following commit removed splitmic. But forgot to add
ATH_CRYPT_CAP_MIC_COMBINED flag for HTC drivers which causes
TKIP to fail.

Author: Bruno Randolf <br1@einfach.org>
Date:   Wed Sep 8 16:04:54 2010 +0900

    ath/ath9k: Replace common->splitmic with a flag

    Replace common->splitmic with ATH_CRYPT_CAP_MIC_COMBINED flag.

Signed-off-by: Rajkumar Manoharan <8d64cd287b2d73cf99e51d8062b25b7617ee99c1@atheros.com>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -561,6 +561,9 @@
 		common->keymax = ATH_KEYMAX;
 	}

+	if (priv->ah->misc_mode & AR_PCU_MIC_NEW_LOC_ENA)
+		common->crypt_caps |= ATH_CRYPT_CAP_MIC_COMBINED;
+
 	/*
 	 * Reset the key cache since some parts do not
 	 * reset the contents on initial power up.


staging : lustre : lustre : fid : lproc_fid.c: fixed warning

fixed warning for line over 80 characters by moving the initilation
onto a diff line.

Signed-off-by: Anil Belur <d6e0e5c3b4a843824d922e1d502b6f6e375bb604@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/lustre/lustre/fid/lproc_fid.c
+++ drivers/staging/lustre/lustre/fid/lproc_fid.c
@@ -98,9 +98,10 @@
 					   const char __user *buffer,
 					   size_t count, loff_t *off)
 {
-	struct lu_client_seq *seq = ((struct seq_file *)file->private_data)->private;
-	int rc;
-
+	struct lu_client_seq *seq;
+	int rc;
+
+	seq = ((struct seq_file *)file->private_data)->private;
 	LASSERT(seq != NULL);

 	mutex_lock(&seq->lcs_mutex);
@@ -135,10 +136,11 @@
 					   const char __user *buffer,
 					   size_t count, loff_t *off)
 {
-	struct lu_client_seq *seq = ((struct seq_file *)file->private_data)->private;
+	struct lu_client_seq *seq;
 	__u64  max;
 	int rc, val;

+	seq = ((struct seq_file *)file->private_data)->private;
 	LASSERT(seq != NULL);

 	rc = lprocfs_write_helper(buffer, count, &val);


Staging: lustre: lproc_osc: Change the variable to be checked

The variable rc is supposed to hold the value returned by function
kstrtoul which can either be 0, -EINVAL (-22) or -ERANGE (-34).
Therefore, the check must be performed on rc instead of val for error
values. Also, rc can never be greater than 0.

Signed-off-by: Shivani Bhardwaj <a6ef7103f2dd0ae991a89b196375727c658578f6@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -61,9 +61,7 @@
 	unsigned long val;

 	rc = kstrtoul(buffer, 10, &val);
-	if (rc)
-		return rc;
-	if (val < 0 || val > 1)
+	if (rc < 0)
 		return -ERANGE;

 	/* opposite senses */


Staging: lustre: lproc_osc: Add check on a variable

Variable rc is not tested for negative values and hence a check should
be included. Also, a check for variable val should be introduced.

Signed-off-by: Shivani Bhardwaj <a6ef7103f2dd0ae991a89b196375727c658578f6@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -61,7 +61,9 @@
 	unsigned long val;

 	rc = kstrtoul(buffer, 10, &val);
-	if (rc < 0)
+	if (rc)
+		return rc;
+	if (val > 1)
 		return -ERANGE;

 	/* opposite senses */


drivers: staging: media: easycap: easycap_ioctl: Include version.h header

The output of "make versioncheck" told us that:

drivers/staging/media/easycap/easycap_ioctl.c: 2442: need
linux/version.h

If we take a look at the code, we will see the macro KERNEL_VERSION be
used. So, we need this include.

Cc: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@infradead.org>
Cc: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>
Cc: <9535f332c1f8b5fdb007bc39fec5cd3f7ab4e729@vger.kernel.org>
Cc: <21a6cafaf0e9b0080692d699c1538d0dfa42b47a@driverdev.osuosl.org >
Signed-off-by: Marcos Paulo de Souza <0b4ebe3a213a49a2bc3457b98408e6d86812eb46@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


staging: rtl8723au: issue_beacon23a(): Fix another case issuing a corrupted beacon

Signed-off-by: Jes Sorensen <0e1e349bdba396f044a06b01fef702e072aa66d3@redhat.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -2420,6 +2420,7 @@
 	if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) {
 		u8 *iebuf;
 		int buflen;
+		pframe -= _BEACON_IE_OFFSET_;
 		/* DBG_8723A("ie len =%d\n", cur_network->IELength); */
 		memcpy(pframe, cur_network->IEs, cur_network->IELength);
 		len_diff = update_hidden_ssid(pframe + _BEACON_IE_OFFSET_,


VPP: Update DEINTERLACE_SAMPLER_STATE on IVB

Signed-off-by: Xiang, Haihao <8d677183e5993577d4fa73a419b76987913292d6@intel.com>
(cherry picked from commit b05729d0feea5ceb4217997f26442d5a8d94fa48)

--- src/i965_post_processing.c
+++ src/i965_post_processing.c
@@ -3688,43 +3688,43 @@

     /* sample dndi index 0 */
     index = 0;
-    sampler_dndi[index].dw0.denoise_asd_threshold = 0;
-    sampler_dndi[index].dw0.dnmh_delt = 8;
+    sampler_dndi[index].dw0.denoise_asd_threshold = 38;
+    sampler_dndi[index].dw0.dnmh_delt = 7;
     sampler_dndi[index].dw0.vdi_walker_y_stride = 0;
     sampler_dndi[index].dw0.vdi_walker_frame_sharing_enable = 0;
-    sampler_dndi[index].dw0.denoise_maximum_history = 128;      // 128-240
-    sampler_dndi[index].dw0.denoise_stad_threshold = 0;
-
-    sampler_dndi[index].dw1.denoise_threshold_for_sum_of_complexity_measure = 64;
-    sampler_dndi[index].dw1.denoise_moving_pixel_threshold = 0;
-    sampler_dndi[index].dw1.stmm_c2 = 0;
-    sampler_dndi[index].dw1.low_temporal_difference_threshold = 8;
-    sampler_dndi[index].dw1.temporal_difference_threshold = 16;
-
-    sampler_dndi[index].dw2.block_noise_estimate_noise_threshold = 15;   // 0-31
+    sampler_dndi[index].dw0.denoise_maximum_history = 192;      // 128-240
+    sampler_dndi[index].dw0.denoise_stad_threshold = 140;
+
+    sampler_dndi[index].dw1.denoise_threshold_for_sum_of_complexity_measure = 38;
+    sampler_dndi[index].dw1.denoise_moving_pixel_threshold = 1;
+    sampler_dndi[index].dw1.stmm_c2 = 2;
+    sampler_dndi[index].dw1.low_temporal_difference_threshold = 0;
+    sampler_dndi[index].dw1.temporal_difference_threshold = 0;
+
+    sampler_dndi[index].dw2.block_noise_estimate_noise_threshold = 20;   // 0-31
     sampler_dndi[index].dw2.bne_edge_th = 1;
     sampler_dndi[index].dw2.smooth_mv_th = 0;
     sampler_dndi[index].dw2.sad_tight_th = 5;
     sampler_dndi[index].dw2.cat_slope_minus1 = 9;
-    sampler_dndi[index].dw2.good_neighbor_th = 4;
-
-    sampler_dndi[index].dw3.maximum_stmm = 128;
-    sampler_dndi[index].dw3.multipler_for_vecm = 2;
-    sampler_dndi[index].dw3.blending_constant_across_time_for_small_values_of_stmm = 0;
+    sampler_dndi[index].dw2.good_neighbor_th = 12;
+
+    sampler_dndi[index].dw3.maximum_stmm = 150;
+    sampler_dndi[index].dw3.multipler_for_vecm = 30;
+    sampler_dndi[index].dw3.blending_constant_across_time_for_small_values_of_stmm = 125;
     sampler_dndi[index].dw3.blending_constant_across_time_for_large_values_of_stmm = 64;
     sampler_dndi[index].dw3.stmm_blending_constant_select = 0;

-    sampler_dndi[index].dw4.sdi_delta = 8;
-    sampler_dndi[index].dw4.sdi_threshold = 128;
-    sampler_dndi[index].dw4.stmm_output_shift = 7;                      // stmm_max - stmm_min = 2 ^ stmm_output_shift
-    sampler_dndi[index].dw4.stmm_shift_up = 0;
+    sampler_dndi[index].dw4.sdi_delta = 5;
+    sampler_dndi[index].dw4.sdi_threshold = 100;
+    sampler_dndi[index].dw4.stmm_output_shift = 5;                      // stmm_max - stmm_min = 2 ^ stmm_output_shift
+    sampler_dndi[index].dw4.stmm_shift_up = 1;
     sampler_dndi[index].dw4.stmm_shift_down = 0;
-    sampler_dndi[index].dw4.minimum_stmm = 0;
-
-    sampler_dndi[index].dw5.fmd_temporal_difference_threshold = 0;
-    sampler_dndi[index].dw5.sdi_fallback_mode_2_constant = 0;
-    sampler_dndi[index].dw5.sdi_fallback_mode_1_t2_constant = 0;
-    sampler_dndi[index].dw5.sdi_fallback_mode_1_t1_constant = 0;
+    sampler_dndi[index].dw4.minimum_stmm = 118;
+
+    sampler_dndi[index].dw5.fmd_temporal_difference_threshold = 175;
+    sampler_dndi[index].dw5.sdi_fallback_mode_2_constant = 37;
+    sampler_dndi[index].dw5.sdi_fallback_mode_1_t2_constant = 100;
+    sampler_dndi[index].dw5.sdi_fallback_mode_1_t1_constant = 50;
     sampler_dndi[index].dw6.dn_enable = 0;
     sampler_dndi[index].dw6.di_enable = 1;
     sampler_dndi[index].dw6.di_partial = 0;
@@ -3733,10 +3733,10 @@
     sampler_dndi[index].dw6.dndi_first_frame = 1;
     sampler_dndi[index].dw6.progressive_dn = 0;
     sampler_dndi[index].dw6.mcdi_enable = 0;
-    sampler_dndi[index].dw6.fmd_tear_threshold = 32;
+    sampler_dndi[index].dw6.fmd_tear_threshold = 2;
     sampler_dndi[index].dw6.cat_th1 = 0;
-    sampler_dndi[index].dw6.fmd2_vertical_difference_threshold = 32;
-    sampler_dndi[index].dw6.fmd1_vertical_difference_threshold = 32;
+    sampler_dndi[index].dw6.fmd2_vertical_difference_threshold = 100;
+    sampler_dndi[index].dw6.fmd1_vertical_difference_threshold = 16;

     sampler_dndi[index].dw7.sad_tha = 5;
     sampler_dndi[index].dw7.sad_thb = 10;


Prevent LEA for non-pointer types

Prevent LEA for non-pointer types

--- src/cc1/asm.c
+++ src/cc1/asm.c
@@ -190,6 +190,8 @@

 	asm_comment("%s%s", t == ASM_LEA ? "&" : "", dsp);

+	UCC_ASSERT(t != ASM_LEA || !reg->tt, "tree type for lea");
+
 	/* don't free resolved_type - it's needed by the asm_operand */
 }


qlcnic: Fix ethtool statistics length calculation

o Consider number of Tx queues while calculating the length of
  Tx statistics as part of ethtool stats.
o Calculate statistics lenght properly for 82xx and 83xx adapter

Signed-off-by: Shahed Shaikh <c3f28edf146fff1d494c60280c6c601216e56491@qlogic.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -167,27 +167,35 @@

 #define QLCNIC_TEST_LEN	ARRAY_SIZE(qlcnic_gstrings_test)

-static inline int qlcnic_82xx_statistics(void)
-{
-	return ARRAY_SIZE(qlcnic_device_gstrings_stats) +
-	       ARRAY_SIZE(qlcnic_83xx_mac_stats_strings);
-}
-
-static inline int qlcnic_83xx_statistics(void)
-{
-	return ARRAY_SIZE(qlcnic_83xx_tx_stats_strings) +
+static inline int qlcnic_82xx_statistics(struct qlcnic_adapter *adapter)
+{
+	return ARRAY_SIZE(qlcnic_gstrings_stats) +
 	       ARRAY_SIZE(qlcnic_83xx_mac_stats_strings) +
-	       ARRAY_SIZE(qlcnic_83xx_rx_stats_strings);
+	       QLCNIC_TX_STATS_LEN * adapter->drv_tx_rings;
+}
+
+static inline int qlcnic_83xx_statistics(struct qlcnic_adapter *adapter)
+{
+	return ARRAY_SIZE(qlcnic_gstrings_stats) +
+	       ARRAY_SIZE(qlcnic_83xx_tx_stats_strings) +
+	       ARRAY_SIZE(qlcnic_83xx_mac_stats_strings) +
+	       ARRAY_SIZE(qlcnic_83xx_rx_stats_strings) +
+	       QLCNIC_TX_STATS_LEN * adapter->drv_tx_rings;
 }

 static int qlcnic_dev_statistics_len(struct qlcnic_adapter *adapter)
 {
-	if (qlcnic_82xx_check(adapter))
-		return qlcnic_82xx_statistics();
-	else if (qlcnic_83xx_check(adapter))
-		return qlcnic_83xx_statistics();
-	else
-		return -1;
+	int len = -1;
+
+	if (qlcnic_82xx_check(adapter)) {
+		len = qlcnic_82xx_statistics(adapter);
+		if (adapter->flags & QLCNIC_ESWITCH_ENABLED)
+			len += ARRAY_SIZE(qlcnic_device_gstrings_stats);
+	} else if (qlcnic_83xx_check(adapter)) {
+		len = qlcnic_83xx_statistics(adapter);
+	}
+
+	return len;
 }

 #define	QLCNIC_TX_INTR_NOT_CONFIGURED	0X78563412
@@ -920,18 +928,13 @@

 static int qlcnic_get_sset_count(struct net_device *dev, int sset)
 {
-	int len;

 	struct qlcnic_adapter *adapter = netdev_priv(dev);
 	switch (sset) {
 	case ETH_SS_TEST:
 		return QLCNIC_TEST_LEN;
 	case ETH_SS_STATS:
-		len = qlcnic_dev_statistics_len(adapter) + QLCNIC_STATS_LEN;
-		if ((adapter->flags & QLCNIC_ESWITCH_ENABLED) ||
-		    qlcnic_83xx_check(adapter))
-			return len;
-		return qlcnic_82xx_statistics();
+		return qlcnic_dev_statistics_len(adapter);
 	default:
 		return -EOPNOTSUPP;
 	}


Add missing nullability specifier

Add missing nullability specifier

--- BlocksKit/QuickLook/QLPreviewController+BlocksKit.h
+++ BlocksKit/QuickLook/QLPreviewController+BlocksKit.h
@@ -10,7 +10,7 @@

 @interface QLPreviewController (BlocksKit)

-@property (nonatomic, copy, setter = bk_setFrameForPreviewItemInSourceView:, nullable) CGRect (^bk_frameForPreviewItem)(QLPreviewController *controller, id<QLPreviewItem>item, UIView **sourceView);
+@property (nonatomic, copy, setter = bk_setFrameForPreviewItemInSourceView:, nullable) CGRect (^bk_frameForPreviewItem)(QLPreviewController *controller, id<QLPreviewItem>item, UIView *_Nullable *_Nonnull);

 @property (nonatomic, copy, setter = bk_setTransitionImageForPreviewItem:, nullable) UIImage *(^bk_transitionImageForPreviewItem)(QLPreviewController *controller, id<QLPreviewItem> item, CGRect *contentRect);


py: win: fix compilation bug for win python

--- py/pypomelo.c
+++ py/pypomelo.c
@@ -7,6 +7,12 @@
 #include <Python.h>
 #include <pomelo.h>
 #include <string.h>
+
+#ifdef _WIN32
+#define PY_POMELO_EXPORT __declspec(dllexport)
+#else
+#define PY_POMELO_EXPORT
+#endif

 static void default_destructor(void* ex_data)
 {
@@ -263,6 +269,7 @@
     pc_client_t* client = NULL;
     PyObject* lc_callback = NULL;
     int ret;
+    pc_client_config_t config = PC_CLIENT_CONFIG_DEFAULT;

     if (!PyArg_ParseTuple(args, "|iiO:init", &tls, &polling, &lc_callback)) {
        return NULL;
@@ -272,8 +279,7 @@
         PyErr_SetString(PyExc_TypeError, "parameter lc_callback must be callable");
         return NULL;
     }
-
-    pc_client_config_t config = PC_CLIENT_CONFIG_DEFAULT;
+
     if (tls) {
         config.transport_name = PC_TR_NAME_UV_TLS;
     }
@@ -549,7 +555,7 @@
 extern "C" {
 #endif

-void initpypomelo()
+PY_POMELO_EXPORT void initpypomelo()
 {
     if (!PyEval_ThreadsInitialized()) {
         PyEval_InitThreads();


Added acceleration (experimental)

Added acceleration (experimental)

--- code/firmware/src/state.h
+++ code/firmware/src/state.h
@@ -123,6 +123,7 @@
 		void setFanRate(float rate);
 	private:
 		/* Used internally to communicate step event times with the scheduler when moving or homing */
+		float transformEventTime(float time, float moveDuration);
 		template <typename AxisStepperTypes> void scheduleAxisSteppers(AxisStepperTypes &iters, float duration);
 };

@@ -422,6 +423,19 @@
 	return resp;
 }

+template <typename Drv> float State<Drv>::transformEventTime(float time, float moveDuration) {
+	float Amax = 500;
+	float Vmax = 30;
+	float V0 = 0.1;
+	float k = 4*Amax/Vmax;
+	float c = V0 / (Vmax-V0);
+	if (time <= 0.5*moveDuration) {
+		return 1./k * log(1./c * ((1. + c)*exp(k/Vmax*time) - 1.));
+	} else {
+		return 2*transformEventTime(0.5*moveDuration, moveDuration) - transformEventTime(moveDuration-time, moveDuration);
+	}
+}
+
 template <typename Drv> template <typename AxisStepperTypes> void State<Drv>::scheduleAxisSteppers(AxisStepperTypes &iters, float duration) {
 	//Information on acceleration: http://reprap.org/wiki/Firmware/Linear_Acceleration
 	//Current implementation uses instantaneous acceleration, which is physically impossible.
@@ -439,6 +453,8 @@
 			break;
 		}
 		Event e = s.getEvent();
+		float transformedTime = transformEventTime(s.time, duration);
+		LOGV("Step transformed time: %f\n", transformedTime);
 		e.offset(baseTime);
 		scheduler.queue(e);
 		_destMechanicalPos[s.index()] += stepDirToSigned<int>(s.direction);


Properly gate the fft code

Properly gate the fft code

--- unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h
+++ unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h
@@ -10,8 +10,9 @@
 #ifndef EIGEN_CXX11_TENSOR_TENSOR_FFT_H
 #define EIGEN_CXX11_TENSOR_TENSOR_FFT_H

-// NVCC fails to compile this code
-#if !defined(__CUDACC__)
+// This code requires the ability to initialize arrays of constant
+// values directly inside a class.
+#ifdef EIGEN_HAS_CONSTEXPR

 namespace Eigen {

@@ -638,7 +639,7 @@

 }  // end namespace Eigen

-#endif  // __CUDACC__
+#endif  // EIGEN_HAS_CONSTEXPR

 #endif  // EIGEN_CXX11_TENSOR_TENSOR_FFT_H


compilers/pirc:
* add message for ignoring output file if no output type is specified.

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@18162 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- compilers/pirc/src/pirmain.c
+++ compilers/pirc/src/pirmain.c
@@ -84,7 +84,7 @@
     while (argc-- > 0) {
         char opt;

-        if (argv[0][0] != '-') break; /* stop if there's only a '-' */
+        if (argv[0][0] != '-') break; /* stop if there's not a '-' */
         else opt = argv[0][1];   /* get the option letter */

         switch (opt) {
@@ -146,6 +146,10 @@
         case OUTPUT_NONE:
             /* just create an empty vtable, the default implementation does nothing */
             vtable = new_pirvtable();
+
+            if (outputfile != NULL) /* if the user did specify an output file, this doesn't make sense */
+                fprintf(stderr, "No output specified: output file will be ignored\n");
+
             break;
         case OUTPUT_PIR:
             vtable = init_pir_vtable(outputfile);
@@ -181,8 +185,6 @@
     else {
         fprintf(stderr, "\nparsed successfully.\n");
     }
-
-    if (outputfile != NULL) printf("outputfile written to: '%s'\n", outputfile);

     /* clean up and exit */
     exit_parser(p);


mdbx-posix: rework LCK seize/destroy.

mdbx-posix: rework LCK seize/destroy.

--- src/lck-posix.c
+++ src/lck-posix.c
@@ -152,7 +152,8 @@
                        (env->me_flags & MDBX_RDONLY) ? F_RDLCK : F_WRLCK, 0,
                        OFF_T_MAX);
   if (rc == 0) {
-    /* got dxb-exclusive, try lck-exclusive */
+  continue_exclusive:
+    /* got dxb-exclusive, continue lck-exclusive */
     rc = mdbx_lck_op(env->me_lfd, OP_SETLKW, F_WRLCK, 0, OFF_T_MAX);
     if (rc == 0) {
       /* got both exclusive */
@@ -169,7 +170,14 @@
                      (env->me_flags & MDBX_RDONLY) ? F_RDLCK : F_WRLCK,
                      env->me_pid, 1);
     if (rc == 0) {
-      /* got dxb-shared, try lck-shared */
+      /* got dxb-shared, try again dxb-exclusive */
+      rc = mdbx_lck_op(env->me_fd, OP_SETLK,
+                       (env->me_flags & MDBX_RDONLY) ? F_RDLCK : F_WRLCK, 0,
+                       OFF_T_MAX);
+      if (rc == 0)
+        goto continue_exclusive;
+
+      /* continue lck-shared */
       rc = mdbx_lck_op(env->me_lfd, OP_SETLKW, F_RDLCK, 0, 1);
       if (rc == 0) {
         /* got both dxb and lck shared lock */
@@ -266,6 +274,9 @@
   if (env->me_lfd != INVALID_HANDLE_VALUE) {
     /* try get exclusive access */
     if (env->me_lck &&
+        mdbx_lck_op(env->me_fd, OP_SETLK,
+                    (env->me_flags & MDBX_RDONLY) ? F_RDLCK : F_WRLCK, 0,
+                    OFF_T_MAX) == 0 &&
         mdbx_lck_op(env->me_lfd, OP_SETLK, F_WRLCK, 0, OFF_T_MAX) == 0) {
       mdbx_info("%s: got exclusive, drown mutexes", mdbx_func_);
       int rc = pthread_mutex_destroy(&env->me_lck->mti_rmutex);
@@ -273,6 +284,7 @@
         rc = pthread_mutex_destroy(&env->me_lck->mti_wmutex);
       assert(rc == 0);
       (void)rc;
+      msync(env->me_lck, env->me_os_psize, MS_ASYNC);
     }
     (void)mdbx_lck_op(env->me_lfd, OP_SETLK, F_UNLCK, 0, OFF_T_MAX);
   }


HANDLE_JS_EXCEPTIONS: namespace issues (TRIVIAL)

--- js/js_utils.h
+++ js/js_utils.h
@@ -89,12 +89,12 @@
     exceptions. */
 #define HANDLE_JS_EXCEPTIONS                                    \
     catch (...) {                                               \
-        return translateCurrentException();                     \
+        return Datacratic::JS::translateCurrentException();     \
     }

 #define HANDLE_JS_EXCEPTIONS_SETTER                             \
     catch (...) {                                               \
-        translateCurrentException();                            \
+        Datacratic::JS::translateCurrentException();            \
         return;                                                 \
     }


Fix use-after-free error.

Fix use-after-free error.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@109288 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/Support/IRReader.h
+++ include/llvm/Support/IRReader.h
@@ -79,10 +79,10 @@
                   (const unsigned char *)Buffer->getBufferEnd())) {
       std::string ErrMsg;
       Module *M = ParseBitcodeFile(Buffer, Context, &ErrMsg);
+      if (M == 0)
+        Err = SMDiagnostic(Buffer->getBufferIdentifier(), ErrMsg);
       // ParseBitcodeFile does not take ownership of the Buffer.
       delete Buffer;
-      if (M == 0)
-        Err = SMDiagnostic(Buffer->getBufferIdentifier(), ErrMsg);
       return M;
     }


Add option for htrim min length 2

Add option for htrim min length 2

--- src/Options.h
+++ src/Options.h
@@ -25,9 +25,9 @@
 	bool interleavedInput, htrimAdapterRm, htrimMaxFirstOnly;

 	int cutLen_begin, cutLen_end, cutLen_read, a_tail_len, b_tail_len, p_min_overlap;
-	int qtrimThresh, qtrimWinSize, a_overhang, htrimMinLength, htrimMaxLength, a_cycles;
+	int qtrimThresh, qtrimWinSize, a_overhang, htrimMinLength, htrimMinLength2, htrimMaxLength;
 	int maxUncalled, min_readLen, a_min_overlap, b_min_overlap, nThreads, bundleSize;
-	int match, mismatch, gapCost, b_match, b_mismatch, b_gapCost;
+	int match, mismatch, gapCost, b_match, b_mismatch, b_gapCost, a_cycles;

 	float a_errorRate, b_errorRate, h_errorRate;

@@ -80,16 +80,17 @@
 		htrimAdapterRm    = false;
 		htrimMaxFirstOnly = false;

-		cutLen_begin   = 0;
-		cutLen_end     = 0;
-		cutLen_read    = 0;
-		qtrimThresh    = 0;
-		qtrimWinSize   = 0;
-		a_tail_len     = 0;
-		b_tail_len     = 0;
-		a_min_overlap  = 3;
-		b_min_overlap  = 0;
-		htrimMaxLength = 0;
+		cutLen_begin    = 0;
+		cutLen_end      = 0;
+		cutLen_read     = 0;
+		qtrimThresh     = 0;
+		qtrimWinSize    = 0;
+		a_tail_len      = 0;
+		b_tail_len      = 0;
+		a_min_overlap   = 3;
+		b_min_overlap   = 0;
+		htrimMinLength2 = 0;
+		htrimMaxLength  = 0;

 		format    = flexbar::FASTA;
 		qual      = flexbar::SANGER;
@@ -233,8 +234,9 @@
 	addOption(parser, ArgParseOption("X", "htrim-left", "Trim specific homopolymers on left read end after removal.", ARG::STRING));
 	addOption(parser, ArgParseOption("Y", "htrim-right", "Trim certain homopolymers on right read end after removal.", ARG::STRING));
 	addOption(parser, ArgParseOption("M", "htrim-min-length", "Minimum length of homopolymers at read ends.", ARG::INTEGER));
-	addOption(parser, ArgParseOption("L", "htrim-max-length", "Maximum length of homopolymers at read ends.", ARG::INTEGER));
-	addOption(parser, ArgParseOption("F", "htrim-max-first", "Max length of homopolymers only for first type."));
+	addOption(parser, ArgParseOption("I", "htrim-min-length2", "Minimum length for homopolymers specified after first one.", ARG::INTEGER));
+	addOption(parser, ArgParseOption("L", "htrim-max-length", "Maximum length of homopolymers at left and right read end.", ARG::INTEGER));
+	addOption(parser, ArgParseOption("F", "htrim-max-first", "Apply maximum length of homopolymers only for first one."));
 	addOption(parser, ArgParseOption("T", "htrim-error-rate", "Error rate threshold for mismatches.", ARG::DOUBLE));
 	addOption(parser, ArgParseOption("A", "htrim-adapter", "Trim only in case of adapter removal on same side."));

@@ -280,6 +282,7 @@
 	setAdvanced(parser, "qtrim-win-size");
 	setAdvanced(parser, "qtrim-post-removal");
 	setAdvanced(parser, "htrim-left");
+	setAdvanced(parser, "htrim-min-length2");
 	setAdvanced(parser, "htrim-max-length");
 	setAdvanced(parser, "htrim-max-first");
 	setAdvanced(parser, "htrim-adapter");
@@ -734,6 +737,14 @@
 			*out << "htrim-right:           " << o.htrimRight << endl;
 		}

+		getOptionValue(o.htrimMinLength, parser, "htrim-min-length");
+		*out << "htrim-min-length:      " << o.htrimMinLength << endl;
+
+		if(isSet(parser, "htrim-min-length2")){
+			getOptionValue(o.htrimMinLength2, parser, "htrim-min-length2");
+			*out << "htrim-min-length2:     " << o.htrimMinLength2 << endl;
+		}
+
 		if(isSet(parser, "htrim-max-length")){
 			getOptionValue(o.htrimMaxLength, parser, "htrim-max-length");
 			*out << "htrim-max-length:      " << o.htrimMaxLength << endl;
@@ -743,9 +754,6 @@
 				o.htrimMaxFirstOnly = true;
 			}
 		}
-
-		getOptionValue(o.htrimMinLength, parser, "htrim-min-length");
-		*out << "htrim-min-length:      " << o.htrimMinLength << endl;

 		getOptionValue(o.h_errorRate, parser, "htrim-error-rate");
 		*out << "htrim-error-rate:      " << o.h_errorRate << endl;


Cluster: clear NOADDR flag when updating node address.

--- src/cluster.c
+++ src/cluster.c
@@ -1243,6 +1243,7 @@
     memcpy(node->ip,ip,sizeof(ip));
     node->port = port;
     if (node->link) freeClusterLink(node->link);
+    node->flags &= ~REDIS_NODE_NOADDR;
     redisLog(REDIS_WARNING,"Address updated for node %.40s, now %s:%d",
         node->name, node->ip, node->port);


update write method

update write method

--- src/R_write.c
+++ src/R_write.c
@@ -103,6 +103,9 @@
     uint64_t adios_groupsize, adios_totalsize;
     int64_t m_adios_file;

+    // variable to store the value converted from integer
+    char str[256];
+
     // Define variables
     for(i = 0; i < nvars; i++) {
         const char *varname = CHAR(asChar(VECTOR_ELT(R_varname_list,i)));
@@ -131,22 +134,24 @@

             // j = 0
             j = 0;
+            sprintf(str, "%d", j);
+
             char* local = (char*)malloc(temp_var_length);
             strcpy(local, varname);
             strcat(local, "_nx_");
-            strcat(local, j);
+            strcat(local, str);
             strcat(local_var, local);

             char* global = (char*)malloc(temp_var_length);
             strcpy(global, varname);
             strcat(global, "_gx_");
-            strcat(global, j);
+            strcat(global, str);
             strcat(global_var, global);

             char* offset = (char*)malloc(temp_var_length);
             strcpy(offset, varname);
             strcat(offset, "_off_");
-            strcat(offset, j);
+            strcat(offset, str);
             strcat(offset_var, offset);

             // define local dim, global dim and offset for each dimension
@@ -162,25 +167,27 @@
             Free(offset);

             for(j = 1; j < vndim[0]; j++) {
+                sprintf(str, "%d", j);
+
                 strcat(local_var, ",");
                 char* local = (char*)malloc(temp_var_length);
                 strcpy(local, varname);
                 strcat(local, "_nx_");
-                strcat(local, j);
+                strcat(local, str);
                 strcat(local_var, local);

                 strcat(global_var, ",");
                 char* global = (char*)malloc(temp_var_length);
                 strcpy(global, varname);
                 strcat(global, "_gx_");
-                strcat(global, j);
+                strcat(global, str);
                 strcat(global_var, global);

                 strcat(offset_var, ",");
                 char* offset = (char*)malloc(temp_var_length);
                 strcpy(offset, varname);
                 strcat(offset, "_off_");
-                strcat(offset, j);
+                strcat(offset, str);
                 strcat(offset_var, offset);

                 // define local dim, global dim and offset for each dimension
@@ -258,20 +265,22 @@
             int temp_var_length = strlen(varname) + 8;

             for(j = 0; j < vndim[0]; j++) {
+                sprintf(str, "%d", j);
+
                 char* local = (char*)malloc(temp_var_length);
                 strcpy(local, varname);
                 strcat(local, "_nx_");
-                strcat(local, j);
+                strcat(local, str);

                 char* global = (char*)malloc(temp_var_length);
                 strcpy(global, varname);
                 strcat(global, "_gx_");
-                strcat(global, j);
+                strcat(global, str);

                 char* offset = (char*)malloc(temp_var_length);
                 strcpy(offset, varname);
                 strcat(offset, "_off_");
-                strcat(offset, j);
+                strcat(offset, str);

                 adios_write(m_adios_file, local, (void *) &(length[j]));

@@ -325,6 +334,9 @@
     uint64_t adios_groupsize, adios_totalsize;
     int64_t m_adios_file;

+    // variable to store the value converted from integer
+    char str[256];
+
     // Open ADIOS and append data
     adios_open (&m_adios_file, groupname, filename, "a", comm);

@@ -372,20 +384,22 @@
             int temp_var_length = strlen(varname) + 8;

             for(j = 0; j < vndim[0]; j++) {
+                sprintf(str, "%d", j);
+
                 char* local = (char*)malloc(temp_var_length);
                 strcpy(local, varname);
                 strcat(local, "_nx_");
-                strcat(local, j);
+                strcat(local, str);

                 char* global = (char*)malloc(temp_var_length);
                 strcpy(global, varname);
                 strcat(global, "_gx_");
-                strcat(global, j);
+                strcat(global, str);

                 char* offset = (char*)malloc(temp_var_length);
                 strcpy(offset, varname);
                 strcat(offset, "_off_");
-                strcat(offset, j);
+                strcat(offset, str);

                 adios_write(m_adios_file, local, (void *) &(length[j]));


echo-message-parts: stop using deprecated API

--- examples/cm/echo-message-parts/chan.c
+++ examples/cm/echo-message-parts/chan.c
@@ -61,15 +61,14 @@
       goto finally;
     }

-  received = tp_message_new (tp_base_channel_get_connection (base), 1, len);
+  received = tp_cm_message_new (tp_base_channel_get_connection (base), 1, len);

   /* Copy/modify the headers for the "received" message */
     {
       TpChannelTextMessageType message_type;
       gboolean valid;

-      tp_message_set_handle (received, 0, "message-sender",
-          TP_HANDLE_TYPE_CONTACT,
+      tp_cm_message_set_sender (received,
           tp_base_channel_get_target_handle (base));

       message_type = tp_asv_get_uint32 (tp_message_peek (message, 0),


Add UUID property to GATT service object

--- attrib/client.c
+++ attrib/client.c
@@ -941,6 +941,7 @@
 	DBusMessageIter dict;
 	GSList *l;
 	char **chars;
+	const char *uuid;
 	int i;

 	reply = dbus_message_new_method_return(msg);
@@ -963,6 +964,9 @@

 	dict_append_array(&dict, "Characteristics", DBUS_TYPE_OBJECT_PATH,
 								&chars, i);
+	uuid = prim->att->uuid;
+	dict_append_entry(&dict, "UUID", DBUS_TYPE_STRING, &uuid);
+
 	g_free(chars);

 	dbus_message_iter_close_container(&iter, &dict);


Forgot to reinherit the geometry library

--- mud/home/Game/obj/thing.c
+++ mud/home/Game/obj/thing.c
@@ -21,6 +21,7 @@
 #include <kotaka/paths/thing.h>

 inherit thing LIB_THING;
+inherit "~Geometry/lib/thing";
 inherit "../lib/thing/exit";
 inherit "../lib/thing/character";
 inherit "../lib/thing/living";


Warn when injecting XCCDF 1.1 results into an ARF

OpenSCAP can do it but the result won't be a valid ARF, only XCCDF 1.2
is allowed in ARFs.

--- src/DS/rds.c
+++ src/DS/rds.c
@@ -32,6 +32,7 @@
 #include "common/_error.h"
 #include "common/util.h"
 #include "common/list.h"
+#include "common/debug_priv.h"

 #include "ds_common.h"
 #include "ds_rds_session.h"
@@ -600,6 +601,13 @@
 		const char* report_request_id, struct oscap_htable *arf_report_mapping)
 {
 	xmlNodePtr root_element = xmlDocGetRootElement(xccdf_result_file_doc);
+
+	if (root_element->ns && root_element->ns->href &&
+			oscap_str_endswith((const char*)root_element->ns->href, "xccdf/1.1")) {
+		dW("Exporting ARF from XCCDF 1.1 is not allowed by SCAP specification. "
+		   "The resulting ARF will not validate. Convert the input to XCCDF 1.2 "
+		   "to get valid ARF results.");
+	}

 	// There are 2 possible scenarios here:


nimble/gap: Fix crash on create sync cancel

Cancelling create sync result in sync created event being generated
with error status (similar to LE Create Connection). Clearing
pending GAP op was triggering assert in event handler.

--- nimble/host/src/ble_gap.c
+++ nimble/host/src/ble_gap.c
@@ -1370,7 +1370,7 @@
 void
 ble_gap_rx_peroidic_adv_sync_estab(const struct ble_hci_ev_le_subev_periodic_adv_sync_estab *ev)
 {
-    uint16_t sync_handle = le16toh(ev->sync_handle);
+    uint16_t sync_handle;
     struct ble_gap_event event;
     ble_gap_event_fn *cb;
     void *cb_arg;
@@ -1385,6 +1385,8 @@
     BLE_HS_DBG_ASSERT(ble_gap_sync.psync);

     if (!ev->status) {
+        sync_handle = le16toh(ev->sync_handle);
+
         ble_gap_sync.psync->sync_handle = sync_handle;
         ble_gap_sync.psync->adv_sid = ev->sid;
         memcpy(ble_gap_sync.psync->advertiser_addr.val, ev->peer_addr, 6);
@@ -3504,14 +3506,6 @@
                         BLE_HCI_OCF_LE_PERIODIC_ADV_CREATE_SYNC_CANCEL);

     rc = ble_hs_hci_cmd_tx(opcode, NULL, 0, NULL, 0);
-
-    if (!rc) {
-        ble_gap_sync.op = BLE_GAP_OP_NULL;
-        ble_gap_sync.cb = NULL;
-        ble_gap_sync.cb_arg = NULL;
-        ble_hs_periodic_sync_free(ble_gap_sync.psync);
-        ble_gap_sync.psync = NULL;
-    }

     ble_hs_unlock();


Delete: src/ia64/Gget_fpreg-ia64.c

Delete: src/ia64/Gget_fpreg-ia64.c

}(Logical change 1.162)

--- src/ia64/Gget_fpreg-ia64.c
+++ src/ia64/Gget_fpreg-ia64.c
@@ -1,34 +0,0 @@
-/* libunwind - a platform-independent unwind library
-   Copyright (C) 2002 Hewlett-Packard Co
-	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
-
-This file is part of libunwind.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
-
-#include "unwind_i.h"
-
-PROTECTED int
-unw_get_fpreg (unw_cursor_t *cursor, int regnum, unw_fpreg_t *valp)
-{
-  struct cursor *c = (struct cursor *) cursor;
-
-  return ia64_access_fpreg (c, regnum, valp, 0);
-}


Channel.new was deprecated

Channel.new was deprecated

--- src/channel.c
+++ src/channel.c
@@ -119,13 +119,6 @@
     return obj;
 }

-PONE_FUNC(meth_chan_new) {
-    pone_int_t limit;
-    PONE_ARG("Channel#new", ":i", &limit);
-
-    return pone_chan_new(world, limit);
-}
-
 /**

 =head1 NAME
@@ -157,7 +150,6 @@
     pone_universe* universe = world->universe;

     pone_val* klass = pone_class_new(world, "Channel", strlen("Channel"));
-    pone_add_method_c(world, klass, "new", strlen("new"), meth_chan_new);
     pone_add_method_c(world, klass, "receive", strlen("receive"), meth_chan_receive);
     pone_add_method_c(world, klass, "send", strlen("send"), meth_chan_send);
     pone_class_compose(world, klass);


remove extra assignment

remove extra assignment

--- codecs/inter/ZH-STRINGS.c
+++ codecs/inter/ZH-STRINGS.c
@@ -97,7 +97,7 @@
 void cbconv(struct bsdconv_instance *ins){
 	struct bsdconv_phase *this_phase=CURRENT_PHASE(ins);
 	struct my_s *r=CURRENT_CODEC(ins)->priv;
-	unsigned char *data=data=this_phase->curr->data;
+	unsigned char *data=this_phase->curr->data;
 	uint32_t ucs=0;
 	int i;
 	int max=sizeof(zhrange) / sizeof(struct range) - 1;


Generalized MEMBER1() macro to also support non-const member-functions.

--- include/reflection/reflectors.h
+++ include/reflection/reflectors.h
@@ -169,9 +169,9 @@
       )                                                                                \
   }                                                                                \

-#define MEMBER1(member, REF_QUALIFIER, MOVE_FUNCTION)                                       \
+#define MEMBER1(member, CONST_QUALIFIER, REF_QUALIFIER, MOVE_FUNCTION)                      \
   template<typename... ExplicitArgs, typename... Args>                                      \
-  auto member(Args &&... args) const REF_QUALIFIER                                          \
+  auto member(Args &&... args) CONST_QUALIFIER REF_QUALIFIER                                \
     SFINAEABLE_RETURN(                                                                      \
       on_call(                                                                              \
         reflector(utils::delayed(*this, utils::type_list<ExplicitArgs...>{})),              \
@@ -207,28 +207,8 @@
     }                                                                                \
                                                                                \
   public:                                                                                \
-    template<typename... ExplicitArgs, typename... Args>                                                \
-    auto member(Args &&... args) &                                                                      \
-      SFINAEABLE_RETURN(                                                                                \
-        on_call(                                                                                \
-          reflector(utils::delayed(*this, utils::type_list<ExplicitArgs...>{})),                        \
-          derived(utils::delayed(*this, utils::type_list<ExplicitArgs...>{})),                          \
-          utils::type_list<ExplicitArgs...>{},                                                          \
-          std::forward<Args>(args)...                                                                   \
-        )                                                                                \
-      )                                                                                \
-                                                                                \
-    template<typename... ExplicitArgs, typename... Args>                                                \
-    auto member(Args &&... args) &&                                                                     \
-      SFINAEABLE_RETURN(                                                                                \
-        on_call(                                                                                \
-          reflector(utils::delayed(*this, utils::type_list<ExplicitArgs...>{})),                        \
-          derived(std::move(utils::delayed(*this, utils::type_list<ExplicitArgs...>{}))),               \
-          utils::type_list<ExplicitArgs...>{},                                                          \
-          std::forward<Args>(args)...                                                                   \
-        )                                                                                \
-      )                                                                                \
-                                                                                \
-    MEMBER1(member, & ,          )                                                                      \
-    MEMBER1(member, &&, std::move)                                                                      \
+    MEMBER1(member, const, & ,          )                                                               \
+    MEMBER1(member, const, &&, std::move)                                                               \
+    MEMBER1(member,      , & ,          )                                                               \
+    MEMBER1(member,      , &&, std::move)                                                               \
   }                                                                                \


Make JavascriptRootObjectWrapper internal to resolve compiler warning

--- CefSharp.BrowserSubprocess.Core/CefBrowserWrapper.h
+++ CefSharp.BrowserSubprocess.Core/CefBrowserWrapper.h
@@ -28,6 +28,9 @@
     {
     private:
         MCefRefPtr<CefBrowser> _cefBrowser;
+
+    internal:
+        property JavascriptRootObjectWrapper^ JavascriptRootObjectWrapper;

     public:
         CefBrowserWrapper(CefRefPtr<CefBrowser> cefBrowser)
@@ -66,8 +69,6 @@
         // The serialized registered object data waiting to be used.
         property JavascriptRootObject^ JavascriptRootObject;

-        property JavascriptRootObjectWrapper^ JavascriptRootObjectWrapper;
-
         // The WCF proxy to the parent process.
         property IBrowserProcess^ BrowserProcess;
     };


Fix clang warning in GMSampleView.h

Fix clang warning in GMSampleView.h

../../samplecode/GMSampleView.h:23:7: warning: field 'fGM' will be initialized after field 'fShowSize' [-Wreorder]

R=bsalomon@google.com

Review URL: https://codereview.appspot.com/6856063

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@6507 2bbb7eff-a529-9590-31e7-b0007b416f81

--- samplecode/GMSampleView.h
+++ samplecode/GMSampleView.h
@@ -20,7 +20,7 @@

 public:
     GMSampleView(GM* gm)
-    : fGM(gm), fShowSize(false) {}
+    : fShowSize(false), fGM(gm) {}

     virtual ~GMSampleView() {
         delete fGM;


Cluster: decrease ping/pong traffic by trusting other nodes reports.

Cluster of bigger sizes tend to have a lot of traffic in the cluster bus
just for failure detection: a node will try to get a ping reply from
another node no longer than when the half the node timeout would elapsed,
in order to avoid a false positive.

However this means that if we have N nodes and the node timeout is set
to, for instance M seconds, we'll have to ping N nodes every M/2
seconds. This N*M/2 pings will receive the same number of pongs, so
a total of N*M packets per node. However given that we have a total of N
nodes doing this, the total number of messages will be N*N*M.

In a 100 nodes cluster with a timeout of 60 seconds, this translates
to a total of 100*100*30 packets per second, summing all the packets
exchanged by all the nodes.

This is, as you can guess, a lot... So this patch changes the
implementation in a very simple way in order to trust the reports of
other nodes: if a node A reports a node B as alive at least up to
a given time, we update our view accordingly.

The problem with this approach is that it could result into a subset of
nodes being able to reach a given node X, and preventing others from
detecting that is actually not reachable from the majority of nodes.
So the above algorithm is refined by trusting other nodes only if we do
not have currently a ping pending for the node X, and if there are no
failure reports for that node.

Since each node, anyway, pings 10 other nodes every second (one node
every 100 milliseconds), anyway eventually even trusting the other nodes
reports, we will detect if a given node is down from our POV.

Now to understand the number of packets that the cluster would exchange
for failure detection with the patch, we can start considering the
random PINGs that the cluster sent anyway as base line:
Each node sends 10 packets per second, so the total traffic if no
additioal packets would be sent, including PONG packets, would be:

    Total messages per second = N*10*2

However by trusting other nodes gossip sections will not AWALYS prevent
pinging nodes for the "half timeout reached" rule all the times. The
math involved in computing the actual rate as N and M change is quite
complex and depends also on another parameter, which is the number of
entries in the gossip section of PING and PONG packets. However it is
possible to compare what happens in cluster of different sizes
experimentally. After applying this patch a very important reduction in
the number of packets exchanged is trivial to observe, without apparent
impacts on the failure detection performances.

Actual numbers with different cluster sizes should be published in the
Reids Cluster documentation in the future.

Related to #3929.

--- src/cluster.c
+++ src/cluster.c
@@ -1352,6 +1352,19 @@
                             sender->name, node->name);
                     }
                 }
+            }
+
+            /* If from our POV the node is up (no failure flags are set),
+             * we have no pending ping for the node, nor we have failure
+             * reports for this node, update the last pong time with the
+             * one we see from the other nodes. */
+            if (!(flags & (CLUSTER_NODE_FAIL|CLUSTER_NODE_PFAIL)) &&
+                node->ping_sent == 0 &&
+                clusterNodeFailureReportsCount(node) == 0)
+            {
+                uint32_t pongtime = ntohl(g->pong_received);
+                if (pongtime > node->pong_received)
+                    node->pong_received = pongtime;
             }

             /* If we already know this node, but it is not reachable, and


Improves qadic_sigma().

Improves qadic_sigma().

--- qadic/sigma.c
+++ qadic/sigma.c
@@ -96,7 +96,7 @@
     const long d = j[lena - 1];

     long *e, i, n;
-    fmpz *pow, *f1, *f2, *num, *den, *t;
+    fmpz *pow, *f1, *f2, *inv, *s, *t;

     n = FLINT_CLOG2(N) + 1;

@@ -105,10 +105,10 @@
         e[i + 1] = (e[i] + 1) / 2;

     pow = _fmpz_vec_init(n);
-    num = _fmpz_vec_init(d);
-    den = _fmpz_vec_init(d);
     f1  = _fmpz_vec_init(d + 1);
     f2  = _fmpz_vec_init(d);
+    inv = _fmpz_vec_init(2*d - 1);
+    s   = _fmpz_vec_init(2*d - 1);
     t   = _fmpz_vec_init(2*d - 1);

     /* Compute powers of p */
@@ -142,9 +142,8 @@

         for (k = 0; k < lena; k++)
             fmpz_set(f1 + j[k], a + k);
-        for (k = 0; k < lena; k++)
-            if (j[k] >= 1)
-                fmpz_mul_ui(f2 + (j[k] - 1), a + k, j[k]);
+        for (k = 1; k < lena; k++)
+            fmpz_mul_ui(f2 + (j[k] - 1), a + k, j[k]);
     }

     /* Run Newton iteration */
@@ -154,25 +153,45 @@

         fmpz_pow_ui(t, p, exp);
         _qadic_pow(rop, op, 2, t, a, j, lena, pow + i);
+
+        _fmpz_mod_poly_compose_mod(t, f2, d, rop, d, a, j, lena, pow + i);
+        _qadic_inv(inv, t, d, a, j, lena, p, 1);
     }
     for (i--; i >= 0; i--)
     {
-        /* z' := z - f(z) / f'(z) */
-        _fmpz_mod_poly_compose_mod(num, f1, d + 1, rop, d, a, j, lena, pow + i);
-        _fmpz_mod_poly_compose_mod(den, f2, d, rop, d, a, j, lena, pow + i);
-
-        _qadic_inv(den, den, d, a, j, lena, p, e[i]);
-
-        _fmpz_mod_poly_mul(t, num, d, den, d, pow + i);
-        _fmpz_mod_poly_reduce(t, 2*d - 1, a,j, lena, pow + i);
+        _fmpz_mod_poly_compose_mod(s, f1, d + 1, rop, d, a, j, lena, pow + i);
+        _fmpz_mod_poly_mul(t, s, d, inv, d, pow + i);
+        _fmpz_mod_poly_reduce(t, 2*d - 1, a, j, lena, pow + i);
         _fmpz_mod_poly_sub(rop, rop, d, t, d, pow + i);
+
+        if (i > 0)
+        {
+            _fmpz_mod_poly_compose_mod(s, f2, d, rop, d, a, j, lena, pow + i);
+            _fmpz_mod_poly_mul(t, inv, d, s, d, pow + i);
+            _fmpz_mod_poly_reduce(t, 2*d - 1, a, j, lena, pow + i);
+            fmpz_sub_ui(t, t, 2);
+            if (fmpz_sgn(t) < 0)
+                fmpz_add(t, t, pow + i);
+            _fmpz_mod_poly_neg(t, t, d, pow + i);
+            _fmpz_mod_poly_mul(s, inv, d, t, d, pow + i);
+            _fmpz_mod_poly_reduce(s, 2*d - 1, a, j, lena, pow + i);
+
+            /* SWAP(inv, s).  Requires the arrays to be of the same size. */
+            {
+                fmpz *__t;
+
+                __t = inv;
+                inv = s;
+                s   = __t;
+            }
+        }
     }

     _fmpz_vec_clear(pow, n);
-    _fmpz_vec_clear(num, d);
-    _fmpz_vec_clear(den, d);
     _fmpz_vec_clear(f1, d + 1);
     _fmpz_vec_clear(f2, d);
+    _fmpz_vec_clear(inv, 2*d - 1);
+    _fmpz_vec_clear(s, 2*d - 1);
     _fmpz_vec_clear(t, 2*d - 1);
     flint_free(e);
 }


Any type of garbage other than http is unwelcome in the httpd

--- mud/home/Http/sys/httpd.c
+++ mud/home/Http/sys/httpd.c
@@ -207,7 +207,7 @@
 		/* nothing suspicious */
 		break;

-	case "control":
+	default:
 		siteban(ip_of_connection(previous_object(2)), "Spam (" + garbage + ")");

 		return this_object();


[PECOFF] Do not wrap the linker internal file with an archive file.

We wrapped the linker internal file with a virtual archive file, so that the
linker internal file was linked only when it's actually used. This was to avoid
__ImageBase being included to the resulting executable. __ImageBase used to
occupy four bytes when emitted to executable.

And then it turned out that the implementation of __ImageBase was wrong -- it
shouldn't have been a regular atom but an absolute atom. Absolute atoms point
to some memory location, but they don't occupy disk space themselves. So it
wouldn't increase executable size (except the symbol table.) That means that
it's OK to link the linker internal file unconditionally.

So this patch does that, removing the wrapper archive file. Doing this
simplifies the code.

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@194127 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
+++ lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
@@ -8,87 +8,28 @@
 //===----------------------------------------------------------------------===//

 #include "Atoms.h"
-#include "GroupedSectionsPass.h"
-#include "IdataPass.h"

-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Allocator.h"
-#include "llvm/Support/Path.h"
-#include "lld/Core/ArchiveLibraryFile.h"
-#include "lld/Core/PassManager.h"
-#include "lld/Passes/LayoutPass.h"
 #include "lld/ReaderWriter/PECOFFLinkingContext.h"
-#include "lld/ReaderWriter/Reader.h"
 #include "lld/ReaderWriter/Simple.h"
-#include "lld/ReaderWriter/Writer.h"

 namespace lld {
 namespace coff {

-namespace {
-
 // A virtual file containing absolute symbol __ImageBase. __ImageBase (or
 // ___ImageBase on x86) is a linker-generated symbol whose address is the same
 // as the image base address.
-//
-// This is the only member file of LinkerGeneratedSymbolFile.
-class MemberFile : public SimpleFile {
+class LinkerGeneratedSymbolFile : public SimpleFile {
 public:
-  MemberFile(const PECOFFLinkingContext &ctx)
+  LinkerGeneratedSymbolFile(const PECOFFLinkingContext &ctx)
       : SimpleFile(ctx, "Member of the Linker Internal File"),
         _imageBaseAtom(*this, ctx.decorateSymbol("__ImageBase"),
                        Atom::scopeGlobal, ctx.getBaseAddress()) {
     addAtom(_imageBaseAtom);
   };

-  bool contains(StringRef name) const {
-    return _imageBaseAtom.name() == name;
-  }
-
 private:
   COFFAbsoluteAtom _imageBaseAtom;
 };

-} // anonymous namespace
-
-// A pseudo library file to wrap MemberFile, which in turn wraps ImageBaseAtom.
-// The file the core linker handle is this.
-//
-// The reason why we don't pass MemberFile to the core linker is because, if we
-// did so, ImageBaseAtom would always be emit to the resultant executable. By
-// wrapping the file by a library file, we made it to emit ImageBaseAtom only
-// when the atom is really referenced.
-class LinkerGeneratedSymbolFile : public ArchiveLibraryFile {
-public:
-  LinkerGeneratedSymbolFile(const PECOFFLinkingContext &context)
-      : ArchiveLibraryFile(context, "Linker Internal File"),
-        _memberFile(context) {};
-
-  virtual const File *find(StringRef name, bool dataSymbolOnly) const {
-    if (_memberFile.contains(name))
-      return &_memberFile;
-    return nullptr;
-  }
-
-  virtual const atom_collection<DefinedAtom> &defined() const {
-    return _noDefinedAtoms;
-  }
-
-  virtual const atom_collection<UndefinedAtom> &undefined() const {
-    return _noUndefinedAtoms;
-  }
-
-  virtual const atom_collection<SharedLibraryAtom> &sharedLibrary() const {
-    return _noSharedLibraryAtoms;
-  }
-
-  virtual const atom_collection<AbsoluteAtom> &absolute() const {
-    return _noAbsoluteAtoms;
-  }
-
-private:
-  MemberFile _memberFile;
-};
-
 } // end namespace coff
 } // end namespace lld


sds.c: Allow load components using xlink file:

--- src/DS/sds.c
+++ src/DS/sds.c
@@ -197,9 +197,19 @@
 	}
 }

-static int ds_sds_dump_component(const char* component_id, struct ds_sds_session *session, const char *target_filename_dirname, const char *relative_filepath)
-{
-	xmlDoc *doc = ds_sds_session_get_xmlDoc(session);
+static int ds_sds_dump_component(const char* external_file, const char* component_id, struct ds_sds_session *session, const char *target_filename_dirname, const char *relative_filepath)
+{
+	xmlDoc *doc;
+	struct oscap_source* source_file = NULL;
+
+	if (external_file != NULL) {
+
+		source_file = oscap_source_new_from_file(external_file);
+		doc = oscap_source_get_xmlDoc(source_file);
+	} else {
+		doc = ds_sds_session_get_xmlDoc(session);
+	}
+
 	xmlNodePtr component = _lookup_component_in_collection(doc, component_id);
 	if (component == NULL)
 	{
@@ -235,8 +245,9 @@
 		if (new_doc == NULL) {
 			return -1;
 		}
-		struct oscap_source *source = oscap_source_new_from_xmlDoc(new_doc, relative_filepath);
-		ds_sds_session_register_component_source(session, relative_filepath, source);
+
+		struct oscap_source *component_source = oscap_source_new_from_xmlDoc(new_doc, relative_filepath);
+		ds_sds_session_register_component_source(session, relative_filepath, component_source);
 	}

 	return 0;
@@ -261,15 +272,40 @@
 		return -1;
 	}

-	assert(xlink_href[0] == '#');
-	const char* component_id = xlink_href + 1;
+
+    const char* component_id;
+	const char* filename;
+
+	if (xlink_href[0] == '#')
+	{
+		filename = NULL;
+		component_id = xlink_href + 1;
+
+	} else if (oscap_str_startswith(xlink_href, "file:")){
+
+		char* sep = strchr(xlink_href, '#');
+		assert(sep != NULL);
+
+		filename = xlink_href + strlen("file:");
+		*sep = '\0';
+
+		component_id = sep + 1;
+
+	} else {
+		oscap_seterr(OSCAP_EFAMILY_XML, "Unsupported type of xlink:href attribute on given component-ref - '%s'.", xlink_href);
+		xmlFree(cref_id);
+		xmlFree(xlink_href);
+		return -1;
+	}
+
 	char* filename_cpy = oscap_sprintf("./%s", relative_filepath);
 	char* file_reldir = dirname(filename_cpy);

 	const char* target_filename_dirname = oscap_sprintf("%s/%s",sub_dir, file_reldir);
 	oscap_free(filename_cpy);

-	ds_sds_dump_component(component_id, session, target_filename_dirname, relative_filepath);
+	ds_sds_dump_component(filename, component_id, session, target_filename_dirname, relative_filepath);
+

 	xmlNodePtr catalog = node_get_child_element(component_ref, "catalog");
 	if (catalog)


Partial fix based on the patch and discussions in #2788319

--- src/channel.c
+++ src/channel.c
@@ -88,14 +88,23 @@
  * Locate a channel pointer by number
  */
 LIBSSH2_CHANNEL *
-_libssh2_channel_locate(LIBSSH2_SESSION * session, unsigned long channel_id)
-{
-    LIBSSH2_CHANNEL *channel = session->channels.head;
-    while (channel) {
-        if (channel->local.id == channel_id) {
+_libssh2_channel_locate(LIBSSH2_SESSION *session, unsigned long channel_id)
+{
+    LIBSSH2_CHANNEL *channel;
+    LIBSSH2_LISTENER *listener;
+
+    for(channel = session->channels.head; channel; channel = channel->next) {
+        if (channel->local.id == channel_id)
             return channel;
-        }
-        channel = channel->next;
+    }
+
+    /* We didn't find the channel in the session, let's then check its
+       listeners... */
+    for(listener = session->listeners; listener; listener = listener->next) {
+        for(channel = listener->queue; channel; channel = channel->next) {
+            if (channel->local.id == channel_id)
+                return channel;
+        }
     }

     return NULL;
@@ -779,6 +788,8 @@
         return channel;
     }

+    libssh2_error(listener->session, LIBSSH2_ERROR_CHANNEL_UNKNOWN,
+                  "Channel not found", 0);
     return NULL;
 }


fixed scheme/protocol "parser". updated debug log messages for parsing cookies

--- src/Request.c
+++ src/Request.c
@@ -32,6 +32,7 @@
 #include <unistd.h>
 #include <structmember.h>
 #include <fastcgi.h>
+#include <ctype.h> /* tolower() */

 #pragma mark Internal

@@ -480,35 +481,18 @@
       return NULL;

     // Scheme
-    if ((s = FCGX_GetParam("SERVER_PROTOCOL", self->envp))) {
-      old = self->url->scheme;
-      Py_ssize_t len = strlen(s);
-
-      // As this is called MANY times, this op is really worth it...
-      if (
-          (len > 3)
-            &&
-          (smisk_str4cmp(s, 'H','T','T','P') || smisk_str4cmp(s, 'h','t','t','p'))
-         )
-      {
-        if ( (len == 5) && (s[4]=='S'||s[4]=='s') ) {
-          self->url->scheme = kString_https;
-          Py_INCREF(kString_https);
-        }
-        else if (len == 4) {
-          self->url->scheme = kString_http;
-          Py_INCREF(kString_http);
-        }
-      }
-
-      if (self->url->scheme == old) {
-        if ((p = strchr(s, '/')))
-          len = (Py_ssize_t)(p-s);
-        self->url->scheme = PyString_FromStringAndSize(_strtolower(s), len);
-      }
-
-      Py_CLEAR(old);
-    }
+    old = self->url->scheme;
+    // env["HTTPS"] = "on" tells us SSL is active
+    if ( (s = FCGX_GetParam("HTTPS", self->envp))
+        && (strlen(s) > 1) && (tolower(s[0])=='o' && tolower(s[1])=='n') )
+    {
+      self->url->scheme = kString_https;
+    }
+    else {
+      self->url->scheme = kString_http;
+    }
+    Py_INCREF(self->url->scheme);
+    Py_CLEAR(old);

     // User
     if ((s = FCGX_GetParam("REMOTE_USER", self->envp))) {
@@ -628,13 +612,13 @@
       return NULL;

     if ((http_cookie = FCGX_GetParam("HTTP_COOKIE", self->envp))) {
-      log_debug("Parsing input data");
+      log_debug("Parsing cookies");
       if (smisk_parse_input_data(http_cookie, ";", 1, self->cookies) != 0) {
         Py_DECREF(self->cookies);
         self->cookies = NULL;
         return NULL;
       }
-      log_debug("Done parsing input data");
+      log_debug("Done parsing cookies");
     }
   }


turning method writePoseToFile into public

--- visual_odometry/optical_flow_visual_odometry.h
+++ visual_odometry/optical_flow_visual_odometry.h
@@ -61,9 +61,10 @@
      * Writes the last computed visual odometry pose to file.
      * @param time_stamp, the time that the pose was computed.
      */
+
+public:
     void writePoseToFile(const std::string& time_stamp);

-public:
     EIGEN_MAKE_ALIGNED_OPERATOR_NEW

     // Previous dense point cloud


Update cluster debug log to include human readable packet type (#9361)

--- src/cluster.c
+++ src/cluster.c
@@ -1786,8 +1786,8 @@

     if (type < CLUSTERMSG_TYPE_COUNT)
         server.cluster->stats_bus_messages_received[type]++;
-    serverLog(LL_DEBUG,"--- Processing packet of type %d, %lu bytes",
-        type, (unsigned long) totlen);
+    serverLog(LL_DEBUG,"--- Processing packet of type %s, %lu bytes",
+        clusterGetMessageTypeString(type), (unsigned long) totlen);

     /* Perform sanity checks */
     if (totlen < 16) return 1; /* At least signature, version, totlen, count. */


Add QExecThread class

Add QExecThread class

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

--- qexecthread.h
+++ qexecthread.h
@@ -0,0 +1,35 @@
+#ifndef QEXECTHREAD_H
+#define QEXECTHREAD_H
+
+
+#include <QObject>
+#include <QThread>
+
+
+
+
+
+class QExecThread : public QThread
+{
+    Q_OBJECT
+
+    public:
+
+        explicit QExecThread(QObject *parent = 0, bool autostart = false):
+                             QThread(parent){
+                                                if(autostart)
+                                                    start();
+                                            }
+
+
+    protected:
+
+        virtual void run() { exec(); }
+
+};
+
+
+
+
+
+#endif // QEXECTHREAD_H


Improved (but still work in progress) long tlv printing.

--- src/cli/cli.c
+++ src/cli/cli.c
@@ -317,9 +317,13 @@
         return status;
 }

-int cli_print_long_tlv(dz_t *dz, tlv_t *tlv, int indent, int lvl, int debug) {
+int cli_print_ltlv(dz_t *dz, tlv_t *tlv, int indent, int lvl, int debug) {
         int len, type;
         const char *type_str;
+        char *buf;
+        int buf_idx = 0;
+        tlv_t tlv_tmp;
+        off_t off;

         dz_read_tlv(dz, tlv, dz_get_offset(dz));

@@ -327,15 +331,45 @@
         type = ltlv_real_data_type(tlv);
         type_str = tlv_type2str(type);

-
-        for (int i = 0; i <= indent; i++) {
-                printf("--");
-        }
-
-        printf(" @[%10li]: %8s (%d bytes)\n", (unsigned long)dz_get_offset(dz),
-                type_str != NULL ? type_str : "unknown", len);
+        printf(" @[%10li]: %8s (%d bytes)\n",
+                dz_get_offset(dz),
+                type_str != NULL ? type_str : "unknown",
+                len);
+
+        if (type != TLV_COMPOUND && type != TLV_DATED) {
+                goto OUT;
+        }
+
+        if (tlv_init(&tlv_tmp) == -1) {
+                goto OUT;
+        }
+
+        buf = malloc(sizeof(*buf) * (len));
+
+        if (buf == NULL) {
+                ERROR("malloc", -1);
+        }
+
+        off = dz_next_tlv(dz, &tlv_tmp);
+
+        while (buf_idx != len) {
+                off = dz_next_tlv(dz, &tlv_tmp);
+                int tmp_len = tlv_get_length(&tlv_tmp);
+                dz_read_tlv(dz, &tlv_tmp, off);
+                memcpy(buf + buf_idx, tlv_get_value_ptr(&tlv_tmp), tmp_len);
+                buf_idx += tmp_len;
+        }
+
+        dz_t dz_tmp = {-1, 0, len, 0, 0, buf};
+
+        cli_print_dz(&dz_tmp, indent + 1, lvl - 1, debug);
+
+        free(buf);
+
+        if (tlv_destroy(&tlv_tmp) == -1) {
+        }
+OUT:
         return ltlv_get_total_length(tlv);
-
 }

 int cli_print_dz(dz_t *dz, int indent, int lvl, int debug) {
@@ -367,11 +401,9 @@
                         continue;
                 }

-                int len = tlv_get_length(&tlv);
-
                 if (type == TLV_LONGH) {
                         dz_set_offset(dz, off);
-                        off_t next = cli_print_long_tlv(
+                        off_t next = cli_print_ltlv(
                                 dz, &tlv, indent, lvl, debug);
                         dz_incr_offset(dz, next);
                         continue;
@@ -380,6 +412,9 @@
                 for (int i = 0; i <= indent; i++) {
                         printf("--");
                 }
+
+
+                int len = tlv_get_length(&tlv);

                 type_str = tlv_type2str(type);
                 printf(" @[%10li]: %8s (%d bytes)\n", (unsigned long)off,


Added a 5-arg extern macro.

Added a 5-arg extern macro.

--- src/Extern.h
+++ src/Extern.h
@@ -2,7 +2,7 @@
 #define HALIDE_EXTERN_H

 /** \file
- *
+ *
  * Convenience macros that lift functions that take C types into
  * functions that take and return exprs, and call the original
  * function at runtime under the hood. See test/c_function.cpp for
@@ -39,4 +39,14 @@
         return Halide::Internal::Call::make(Halide::type_of<rt>(), #name, vec(a1, a2, a3, a4), Halide::Internal::Call::Extern); \
   }

+#define HalideExtern_5(rt, name, t1, t2, t3, t4, t5)                       \
+    Halide::Expr name(Halide::Expr a1, Halide::Expr a2, Halide::Expr a3, Halide::Expr a4, Halide::Expr a5) { \
+        assert(a1.type() == Halide::type_of<t1>() && "Type mismatch for argument 1 of " #name); \
+        assert(a2.type() == Halide::type_of<t2>() && "Type mismatch for argument 2 of " #name); \
+        assert(a3.type() == Halide::type_of<t3>() && "Type mismatch for argument 3 of " #name); \
+        assert(a4.type() == Halide::type_of<t4>() && "Type mismatch for argument 4 of " #name); \
+        assert(a5.type() == Halide::type_of<t5>() && "Type mismatch for argument 5 of " #name); \
+        return Halide::Internal::Call::make(Halide::type_of<rt>(), #name, vec(a1, a2, a3, a4, a5), Halide::Internal::Call::Extern); \
+  }
+
 #endif


qmfb/example: vastly improving output plotting

--- examples/qmfb_crcf_analysis_example.c
+++ examples/qmfb_crcf_analysis_example.c
@@ -35,7 +35,7 @@

     // generate time-domain signal (windowed sinusoidal pulse)
     float theta=0.0f;
-    float d_theta = 0.22f*(2*M_PI);
+    float d_theta = 0.122f*(2*M_PI);
     for (i=0; i<n; i++) {
         if (i<num_samples) {
             x[2*i+0] = cexpf(_Complex_I*theta) * kaiser(2*i+0,2*num_samples,10.0f);
@@ -64,20 +64,26 @@
         //printf("y(%3u) = %8.4f + j*%8.4f;\n", i+1, crealf(y), cimagf(y));
     }

-    fprintf(fid,"nfft=512;\n");
-#if 0
-    fprintf(fid,"X=20*log10(abs((fft(x.*hamming(2*n)',nfft))));\n");
-    fprintf(fid,"Y0=20*log10(abs((fft(y(1,:).*hamming(n)',nfft))));\n");
-    fprintf(fid,"Y1=20*log10(abs((fft(y(2,:).*hamming(n)',nfft))));\n");
-#else
-    fprintf(fid,"X=20*log10(abs((fft(x,nfft))));\n");
-    fprintf(fid,"Y0=20*log10(abs((fft(y(1,:),nfft))));\n");
-    fprintf(fid,"Y1=20*log10(abs((fft(y(2,:),nfft))));\n");
-#endif
-    fprintf(fid,"f=[0:(nfft-1)]/nfft;\n");
-    fprintf(fid,"figure; plot(f,X,'Color',[0.5 0.5 0.5],f/2,Y0,'LineWidth',2,0.5+f/2,Y1,'LineWidth',2);\n");
+    // plot results
+    fprintf(fid,"nfft=512; %% must be even number\n");
+    fprintf(fid,"X=20*log10(abs(fftshift(fft(x/n,nfft))));\n");
+    fprintf(fid,"Y0=20*log10(abs(fftshift(fft(y(1,:)/n,nfft))));\n");
+    fprintf(fid,"Y1=20*log10(abs(fftshift(fft(y(2,:)/n,nfft))));\n");
+
+    // Y1 needs to be split into two regions
+    fprintf(fid,"f=[0:(nfft-1)]/nfft - 0.5;\n");
+    fprintf(fid,"t0 = [1]:[nfft/2];\n");
+    fprintf(fid,"t1 = [nfft/2+1]:[nfft];\n");
+    fprintf(fid,"figure;\n");
+    fprintf(fid,"hold on;\n");
+    fprintf(fid,"    plot(f,X,'Color',[0.5 0.5 0.5]);\n");
+    fprintf(fid,"    plot(f/2,Y0,'LineWidth',2,'Color',[0 0.5 0]);\n");
+    fprintf(fid,"    plot(f(t0)/2+0.5,Y1(t0),'LineWidth',2,'Color',[0.5 0 0]);\n");
+    fprintf(fid,"    plot(f(t1)/2-0.5,Y1(t1),'LineWidth',2,'Color',[0.5 0 0]);\n");
+    fprintf(fid,"hold off;\n");
     fprintf(fid,"grid on;\nxlabel('normalized frequency');\nylabel('PSD [dB]');\n");
     fprintf(fid,"legend('original','Y_0','Y_1',1);");
+    fprintf(fid,"axis([-0.5 0.5 -140 20]);\n");

     fclose(fid);
     printf("results written to %s\n", OUTPUT_FILENAME);


Inlining call to hash function in njs_property_query().

--- njs/njs_object_property.c
+++ njs/njs_object_property.c
@@ -49,7 +49,6 @@
     const njs_value_t *property)
 {
     uint32_t        index;
-    uint32_t        (*hash)(const void *, size_t);
     njs_ret_t       ret;
     njs_object_t    *obj;
     njs_value_t     prop;
@@ -63,8 +62,6 @@

         property = ∝
     }
-
-    hash = nxt_djb_hash;

     switch (object->type) {

@@ -140,7 +137,7 @@
     if (nxt_fast_path(ret == NXT_OK)) {

         njs_string_get(&pq->value, &pq->lhq.key);
-        pq->lhq.key_hash = hash(pq->lhq.key.start, pq->lhq.key.length);
+        pq->lhq.key_hash = nxt_djb_hash(pq->lhq.key.start, pq->lhq.key.length);

         if (obj == NULL) {
             pq->own = 1;


Refactor cluster flag printing

Refactor cluster flag printing

Less copy/paste code duplication.

Closes #952

--- src/cluster.c
+++ src/cluster.c
@@ -72,6 +72,39 @@
 void clusterCloseAllSlots(void);
 void clusterSetNodeAsMaster(clusterNode *n);
 void clusterDelNode(clusterNode *delnode);
+
+struct redisNodeFlags {
+    uint16_t flag;
+    char     *attr;
+};
+
+static struct redisNodeFlags nodeflags[] = {
+    {REDIS_NODE_MYSELF,    "myself,"},
+    {REDIS_NODE_MASTER,    "master,"},
+    {REDIS_NODE_SLAVE,     "slave,"},
+    {REDIS_NODE_PFAIL,     "fail?,"},
+    {REDIS_NODE_FAIL,      "fail,"},
+    {REDIS_NODE_HANDSHAKE, "handshake,"},
+    {REDIS_NODE_NOADDR,    "noaddr,"}
+};
+
+sds representRedisNodeFlags(sds ci, uint16_t flags) {
+    if (flags == 0) {
+        ci = sdscat(ci,"noflags");
+    } else {
+        int size = sizeof(nodeflags) / sizeof(struct redisNodeFlags);
+        for (int i=0; i < size; i++) {
+            struct redisNodeFlags *nodeflag = nodeflags + i;
+            if (flags & nodeflag->flag) {
+                ci = sdscat(ci, nodeflag->attr);
+            }
+        }
+
+        if (ci[sdslen(ci)-1] == ',') ci[sdslen(ci)-1] = ' ';
+    }
+
+    return ci;
+}

 /* -----------------------------------------------------------------------------
  * Initialization
@@ -1145,20 +1178,11 @@
     clusterNode *sender = link->node ? link->node : clusterLookupNode(hdr->sender);

     while(count--) {
-        sds ci = sdsempty();
         uint16_t flags = ntohs(g->flags);
         clusterNode *node;

-        if (flags == 0) ci = sdscat(ci,"noflags,");
-        if (flags & REDIS_NODE_MYSELF) ci = sdscat(ci,"myself,");
-        if (flags & REDIS_NODE_MASTER) ci = sdscat(ci,"master,");
-        if (flags & REDIS_NODE_SLAVE) ci = sdscat(ci,"slave,");
-        if (flags & REDIS_NODE_PFAIL) ci = sdscat(ci,"fail?,");
-        if (flags & REDIS_NODE_FAIL) ci = sdscat(ci,"fail,");
-        if (flags & REDIS_NODE_HANDSHAKE) ci = sdscat(ci,"handshake,");
-        if (flags & REDIS_NODE_NOADDR) ci = sdscat(ci,"noaddr,");
-        if (ci[sdslen(ci)-1] == ',') ci[sdslen(ci)-1] = ' ';
-
+        sds ci = sdsempty();
+        ci = representRedisNodeFlags(ci, flags);
         redisLog(REDIS_DEBUG,"GOSSIP %.40s %s:%d %s",
             g->nodename,
             g->ip,
@@ -3355,15 +3379,7 @@
         node->port);

     /* Flags */
-    if (node->flags == 0) ci = sdscat(ci,"noflags,");
-    if (node->flags & REDIS_NODE_MYSELF) ci = sdscat(ci,"myself,");
-    if (node->flags & REDIS_NODE_MASTER) ci = sdscat(ci,"master,");
-    if (node->flags & REDIS_NODE_SLAVE) ci = sdscat(ci,"slave,");
-    if (node->flags & REDIS_NODE_PFAIL) ci = sdscat(ci,"fail?,");
-    if (node->flags & REDIS_NODE_FAIL) ci = sdscat(ci,"fail,");
-    if (node->flags & REDIS_NODE_HANDSHAKE) ci =sdscat(ci,"handshake,");
-    if (node->flags & REDIS_NODE_NOADDR) ci = sdscat(ci,"noaddr,");
-    if (ci[sdslen(ci)-1] == ',') ci[sdslen(ci)-1] = ' ';
+    ci = representRedisNodeFlags(ci, node->flags);

     /* Slave of... or just "-" */
     if (node->slaveof)


* cli: use quoted text as single argument;


set empty_key as Key() for dense_hash by default

--- qsparsehash.h
+++ qsparsehash.h
@@ -90,7 +90,12 @@
 class QSparseHash: public QGoogleHash<google::sparse_hash_map<Key, T>, Key, T> {};

 template <class Key, class T>
-class QDenseHash: public QGoogleHash<google::dense_hash_map<Key, T>, Key, T> {};
+class QDenseHash: public QGoogleHash<google::dense_hash_map<Key, T>, Key, T> {
+public:
+    QDenseHash(const Key& empty_key = Key()) {
+        this->set_empty_key(empty_key);
+    }
+};

 /* Serialization and deserialization routines
  */


Fix type warnings

Fix type warnings

--- nassl/_nassl/nassl_X509.c
+++ nassl/_nassl/nassl_X509.c
@@ -177,7 +177,7 @@

 // Generic function to extract the list of X509_NAME_ENTRY from an X509_NAME.
 // Used to get the subject name entries and the issuer name entries. Returns a Python list
-static PyObject* generic_get_name_entries(X509_NAME * (*X509GetNameFunc)(X509 *a), nassl_X509_Object *self)
+static PyObject* generic_get_name_entries(X509_NAME * (*X509GetNameFunc)(const X509 *a), nassl_X509_Object *self)
 {
     unsigned int i=0;
     X509_NAME * x509Name = NULL;
@@ -227,13 +227,13 @@

 static PyObject* nassl_X509_get_issuer_name_entries(nassl_X509_Object *self, PyObject *args)
 {
-    return generic_get_name_entries(&X509_get_issuer_name, self);
+    return generic_get_name_entries((X509_NAME * (*)(const X509 *))&X509_get_issuer_name, self);
 }

 static PyObject* nassl_X509_get_subject_name_entries(nassl_X509_Object *self, PyObject *args)
 {
-    return generic_get_name_entries(&X509_get_subject_name, self);
+    return generic_get_name_entries((X509_NAME * (*)(const X509 *))&X509_get_subject_name, self);
 }


- removed unnecessary kprintf()

- removed unnecessary kprintf()

--- nlistview_mcc/NListview.c
+++ nlistview_mcc/NListview.c
@@ -206,7 +206,6 @@
   LEAVE();
 }

-void kprintf(const char *,...);
 static void AddHorizontalScroller(Object *obj, struct NLVData *data)
 {
   ENTER();