change how potentials are called to allow the interpolated potential to be called; add NULL pointers to the potentials that do not use the interpolation

--- galpy/actionAngle_src/actionAngle_c_ext/actionAngle.c
+++ galpy/actionAngle_src/actionAngle_c_ext/actionAngle.c
@@ -1,67 +1,106 @@
 #include <stdlib.h>
 #include <galpy_potentials.h>
 #include <actionAngle.h>
+#include <cubic_bspline_2d_coeffs.h>
 double evaluatePotentials(double R, double Z,
-			  int nargs, struct actionAngleArg * actionAngleArgs){
+			  int nargs, struct potentialArg * potentialArgs){
   int ii;
   double pot= 0.;
   for (ii=0; ii < nargs; ii++){
-    pot+= actionAngleArgs->potentialEval(R,Z,0.,0.,
-					 actionAngleArgs->nargs,
-					 actionAngleArgs->args);
-    actionAngleArgs++;
+    pot+= potentialArgs->potentialEval(R,Z,0.,0.,
+				       potentialArgs);
+    potentialArgs++;
   }
-  actionAngleArgs-= nargs;
+  potentialArgs-= nargs;
   return pot;
 }
 void parse_actionAngleArgs(int npot,
-			   struct actionAngleArg * actionAngleArgs,
+			   struct potentialArg * potentialArgs,
 			   int * pot_type,
 			   double * pot_args){
-  int ii,jj;
+  int ii,jj,kk,ll;
+  int nR, nz;
+  double * Rgrid, * zgrid, * potGrid_splinecoeffs, * row;
   for (ii=0; ii < npot; ii++){
     switch ( *pot_type++ ) {
     case 0: //LogarithmicHaloPotential, 3 arguments
-      actionAngleArgs->potentialEval= &LogarithmicHaloPotentialEval;
-      actionAngleArgs->nargs= 3;
+      potentialArgs->potentialEval= &LogarithmicHaloPotentialEval;
+      potentialArgs->nargs= 3;
+      potentialArgs->i2d= NULL;
+      potentialArgs->acc= NULL;
       break;
     case 5: //MiyamotoNagaiPotential, 3 arguments
-      actionAngleArgs->potentialEval= &MiyamotoNagaiPotentialEval;
-      actionAngleArgs->nargs= 3;
+      potentialArgs->potentialEval= &MiyamotoNagaiPotentialEval;
+      potentialArgs->nargs= 3;
+      potentialArgs->i2d= NULL;
+      potentialArgs->acc= NULL;
       break;
     case 7: //PowerSphericalPotential, 2 arguments
-      actionAngleArgs->potentialEval= &PowerSphericalPotentialEval;
-      actionAngleArgs->nargs= 2;
+      potentialArgs->potentialEval= &PowerSphericalPotentialEval;
+      potentialArgs->nargs= 2;
+      potentialArgs->i2d= NULL;
+      potentialArgs->acc= NULL;
       break;
     case 8: //HernquistPotential, 2 arguments
-      actionAngleArgs->potentialEval= &HernquistPotentialEval;
-      actionAngleArgs->nargs= 2;
+      potentialArgs->potentialEval= &HernquistPotentialEval;
+      potentialArgs->nargs= 2;
+      potentialArgs->i2d= NULL;
+      potentialArgs->acc= NULL;
       break;
     case 9: //NFWPotential, 2 arguments
-      actionAngleArgs->potentialEval= &NFWPotentialEval;
-      actionAngleArgs->nargs= 2;
+      potentialArgs->potentialEval= &NFWPotentialEval;
+      potentialArgs->nargs= 2;
+      potentialArgs->i2d= NULL;
+      potentialArgs->acc= NULL;
       break;
     case 10: //JaffePotential, 2 arguments
-      actionAngleArgs->potentialEval= &JaffePotentialEval;
-      actionAngleArgs->nargs= 2;
+      potentialArgs->potentialEval= &JaffePotentialEval;
+      potentialArgs->nargs= 2;
+      potentialArgs->i2d= NULL;
+      potentialArgs->acc= NULL;
       break;
     case 11: //DoubleExponentialDiskPotential, XX arguments
-      actionAngleArgs->potentialEval= &DoubleExponentialDiskPotentialEval;
+      potentialArgs->potentialEval= &DoubleExponentialDiskPotentialEval;
       //Look at pot_args to figure out the number of arguments
-      actionAngleArgs->nargs= 8 + 2 * *(pot_args+5) + 4 * ( *(pot_args+4) + 1);
+      potentialArgs->nargs= 8 + 2 * *(pot_args+5) + 4 * ( *(pot_args+4) + 1);
+      potentialArgs->i2d= NULL;
+      potentialArgs->acc= NULL;
       break;
     case 12: //FlattenedPowerPotential, 4 arguments
-      actionAngleArgs->potentialEval= &FlattenedPowerPotentialEval;
-      actionAngleArgs->nargs= 4;
+      potentialArgs->potentialEval= &FlattenedPowerPotentialEval;
+      potentialArgs->nargs= 4;
       break;
+    case 13: //interpRZPotential, XX arguments
+      //Grab the grids and the coefficients
+      nR= (int) *pot_args++;
+      nz= (int) *pot_args++;
+      Rgrid= (double *) malloc ( nR * sizeof ( double ) );
+      zgrid= (double *) malloc ( nz * sizeof ( double ) );
+      row= (double *) malloc ( nz * sizeof ( double ) );
+      potGrid_splinecoeffs= (double *) malloc ( nR * nz * sizeof ( double ) );
+      for (kk=0; kk < nR; kk++)
+	*(Rgrid+kk)= *pot_args++;
+      for (kk=0; kk < nz; kk++)
+	*(zgrid+kk)= *pot_args++;
+      for (kk=0; kk < nR; kk++){
+	for (ll=0; ll < nz; ll++)
+	  *(row+ll)= *pot_args++;
+	put_row(potGrid_splinecoeffs,kk,row,nz);
+      }
+      potentialArgs->i2d= interp_2d_alloc(nR,nz);
+      interp_2d_init(potentialArgs->i2d,Rgrid,zgrid,potGrid_splinecoeffs,
+		     INTERP_2D_LINEAR); //latter bc we already calculated the coeffs
+      potentialArgs->acc= gsl_interp_accel_alloc ();
+      potentialArgs->potentialEval= &interpRZPotentialEval;
+      potentialArgs->nargs= 2;
     }
-    actionAngleArgs->args= (double *) malloc( actionAngleArgs->nargs * sizeof(double));
-    for (jj=0; jj < actionAngleArgs->nargs; jj++){
-      *(actionAngleArgs->args)= *pot_args++;
-      actionAngleArgs->args++;
+    potentialArgs->args= (double *) malloc( potentialArgs->nargs * sizeof(double));
+    for (jj=0; jj < potentialArgs->nargs; jj++){
+      *(potentialArgs->args)= *pot_args++;
+      potentialArgs->args++;
     }
-    actionAngleArgs->args-= actionAngleArgs->nargs;
-    actionAngleArgs++;
+    potentialArgs->args-= potentialArgs->nargs;
+    potentialArgs++;
   }
-  actionAngleArgs-= npot;
+  potentialArgs-= npot;
 }


Style fix.

Style fix.

--- lib/librt/mq.c
+++ lib/librt/mq.c
@@ -229,5 +229,6 @@
 int
 __mq_oshandle(mqd_t mqd)
 {
-	return mqd->oshandle;
-}
+
+	return (mqd->oshandle);
+}


tests: adapt to the new number of fake stream infos

--- tests/fake.c
+++ tests/fake.c
@@ -349,7 +349,7 @@
 	g_assert_cmpint (n_output_buffers, ==, 0);

         n_infos = arv_stream_get_n_infos (stream);
-        g_assert_cmpint (n_infos, ==, 3);
+        g_assert_cmpint (n_infos, ==, 5);

         info_name = arv_stream_get_info_name (stream, 0);
         g_assert_cmpstr (info_name, ==, "n_completed_buffers");


ALSA: echoaudio: Deletion of a check before release_and_free_resource()

The release_and_free_resource() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <da4b4ed1d87736710c484a0ca84b2abc9f4ef095@users.sourceforge.net>
Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/pci/echoaudio/echoaudio.c
+++ sound/pci/echoaudio/echoaudio.c
@@ -1875,8 +1875,7 @@
 	if (chip->dsp_registers)
 		iounmap(chip->dsp_registers);

-	if (chip->iores)
-		release_and_free_resource(chip->iores);
+	release_and_free_resource(chip->iores);

 	pci_disable_device(chip->pci);


ASoC: wcd9xxx: Fix detection issue for headsets with threshold on MIC

Add additional check to see whether micbias is enabled
during DCE measurements and if it is enabled update the
condition so that plug type cannot be wrongly classified
as invalid plug type.

Change-Id: Id758e1bc553e1e6dbc81721f00f9c147b11cf390
Signed-off-by: Phani Kumar Uppalapati <0898c4e5c8d849879fa65e9f23cfa9cb45bd5a93@codeaurora.org>

--- sound/soc/codecs/wcd9xxx-mbhc.c
+++ sound/soc/codecs/wcd9xxx-mbhc.c
@@ -1409,7 +1409,7 @@
 		    (dgnd->_vdces + WCD9XXX_CS_GM_SWAP_THRES_MAX_MV >
 		     maxv))
 			type = PLUG_TYPE_GND_MIC_SWAP;
-		else if (dgnd->_type != PLUG_TYPE_HEADSET) {
+		else if (dgnd->_type != PLUG_TYPE_HEADSET && !dmicbias) {
 			pr_debug("%s: Invalid, inconsistent types\n", __func__);
 			type = PLUG_TYPE_INVALID;
 		}
@@ -2260,8 +2260,11 @@
 	usleep_range(generic->t_shutdown_plug_rem,
 		     generic->t_shutdown_plug_rem);

-	cs_enable = ((mbhc->mbhc_cfg->cs_enable_flags &
-		      (1 << MBHC_CS_ENABLE_REMOVAL)) != 0);
+	/* If micbias is enabled, don't enable current source */
+	cs_enable = (((mbhc->mbhc_cfg->cs_enable_flags &
+		      (1 << MBHC_CS_ENABLE_REMOVAL)) != 0) &&
+		     (!(snd_soc_read(codec,
+				     mbhc->mbhc_bias_regs.ctl_reg) & 0x80)));
 	if (cs_enable)
 		wcd9xxx_turn_onoff_current_source(mbhc, true, false);


Include missing #include in zmqnotificationinterface.h

--- src/zmq/zmqnotificationinterface.h
+++ src/zmq/zmqnotificationinterface.h
@@ -8,6 +8,7 @@
 #include "validationinterface.h"
 #include <string>
 #include <map>
+#include <list>

 class CBlockIndex;
 class CZMQAbstractNotifier;


AFS: Part of afs_end_call() is identical to code elsewhere, so split it

Split afs_end_call() into two pieces, one of which is identical to code in
afs_process_async_call().  Replace the latter with a call to the first part of
afs_end_call().

Signed-off-by: Nathaniel Wesley Filardo <92aaf101f206a427947829863940b139a41c991b@cs.jhu.edu>
Signed-off-by: David Howells <ebac1d06c1688626821bb0e574a037a7a5354e49@redhat.com>

--- fs/afs/rxrpc.c
+++ fs/afs/rxrpc.c
@@ -184,15 +184,24 @@
 }

 /*
- * End a call
- */
-static void afs_end_call(struct afs_call *call)
+ * End a call but do not free it
+ */
+static void afs_end_call_nofree(struct afs_call *call)
 {
 	if (call->rxcall) {
 		rxrpc_kernel_end_call(call->rxcall);
 		call->rxcall = NULL;
 	}
-	call->type->destructor(call);
+	if (call->type->destructor)
+		call->type->destructor(call);
+}
+
+/*
+ * End a call and free it
+ */
+static void afs_end_call(struct afs_call *call)
+{
+	afs_end_call_nofree(call);
 	afs_free_call(call);
 }

@@ -640,10 +649,7 @@
 		call->reply = NULL;

 		/* kill the call */
-		rxrpc_kernel_end_call(call->rxcall);
-		call->rxcall = NULL;
-		if (call->type->destructor)
-			call->type->destructor(call);
+		afs_end_call_nofree(call);

 		/* we can't just delete the call because the work item may be
 		 * queued */


ASoC: imx-pcm: Remove empty prepare callback

Signed-off-by: Lars-Peter Clausen <3318dc5ce3e4fb7c28a0b841b6801c884e1d0896@metafoo.de>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- sound/soc/imx/imx-pcm-dma-mx2.c
+++ sound/soc/imx/imx-pcm-dma-mx2.c
@@ -186,16 +186,6 @@
 	return 0;
 }

-static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct imx_pcm_dma_params *dma_params;
-
-	dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
-
-	return 0;
-}
-
 static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
@@ -291,7 +281,6 @@
 	.ioctl		= snd_pcm_lib_ioctl,
 	.hw_params	= snd_imx_pcm_hw_params,
 	.hw_free	= snd_imx_pcm_hw_free,
-	.prepare	= snd_imx_pcm_prepare,
 	.trigger	= snd_imx_pcm_trigger,
 	.pointer	= snd_imx_pcm_pointer,
 	.mmap		= snd_imx_pcm_mmap,


afs: fix sget() races, close leak on umount

* set ->s_fs_info in set() callback passed to sget()
* allocate the thing and set it up enough for afs_test_super() before
making it visible
* have it freed in ->kill_sb() (current tree simply leaks it)
* have ->put_super() leave ->s_fs_info->volume alone; it's too early for
dropping it; do that from ->kill_sb() after having called kill_anon_super().

Signed-off-by: Al Viro <de609eb4d5d70b1d38ec6642adbfc33a2781f63c@zeniv.linux.org.uk>

--- fs/afs/super.c
+++ fs/afs/super.c
@@ -31,8 +31,8 @@
 static void afs_i_init_once(void *foo);
 static struct dentry *afs_mount(struct file_system_type *fs_type,
 		      int flags, const char *dev_name, void *data);
+static void afs_kill_super(struct super_block *sb);
 static struct inode *afs_alloc_inode(struct super_block *sb);
-static void afs_put_super(struct super_block *sb);
 static void afs_destroy_inode(struct inode *inode);
 static int afs_statfs(struct dentry *dentry, struct kstatfs *buf);

@@ -40,7 +40,7 @@
 	.owner		= THIS_MODULE,
 	.name		= "afs",
 	.mount		= afs_mount,
-	.kill_sb	= kill_anon_super,
+	.kill_sb	= afs_kill_super,
 	.fs_flags	= 0,
 };

@@ -50,7 +50,6 @@
 	.drop_inode	= afs_drop_inode,
 	.destroy_inode	= afs_destroy_inode,
 	.evict_inode	= afs_evict_inode,
-	.put_super	= afs_put_super,
 	.show_options	= generic_show_options,
 };

@@ -282,42 +281,37 @@
  */
 static int afs_test_super(struct super_block *sb, void *data)
 {
-	struct afs_mount_params *params = data;
+	struct afs_super_info *as1 = data;
 	struct afs_super_info *as = sb->s_fs_info;

-	return as->volume == params->volume;
+	return as->volume == as1->volume;
+}
+
+static int afs_set_super(struct super_block *sb, void *data)
+{
+	sb->s_fs_info = data;
+	return set_anon_super(sb, NULL);
 }

 /*
  * fill in the superblock
  */
-static int afs_fill_super(struct super_block *sb, void *data)
-{
-	struct afs_mount_params *params = data;
-	struct afs_super_info *as = NULL;
+static int afs_fill_super(struct super_block *sb,
+			  struct afs_mount_params *params)
+{
+	struct afs_super_info *as = sb->s_fs_info;
 	struct afs_fid fid;
 	struct dentry *root = NULL;
 	struct inode *inode = NULL;
 	int ret;

 	_enter("");
-
-	/* allocate a superblock info record */
-	as = kzalloc(sizeof(struct afs_super_info), GFP_KERNEL);
-	if (!as) {
-		_leave(" = -ENOMEM");
-		return -ENOMEM;
-	}
-
-	afs_get_volume(params->volume);
-	as->volume = params->volume;

 	/* fill in the superblock */
 	sb->s_blocksize		= PAGE_CACHE_SIZE;
 	sb->s_blocksize_bits	= PAGE_CACHE_SHIFT;
 	sb->s_magic		= AFS_FS_MAGIC;
 	sb->s_op		= &afs_super_ops;
-	sb->s_fs_info		= as;
 	sb->s_bdi		= &as->volume->bdi;

 	/* allocate the root inode and dentry */
@@ -326,7 +320,7 @@
 	fid.unique	= 1;
 	inode = afs_iget(sb, params->key, &fid, NULL, NULL);
 	if (IS_ERR(inode))
-		goto error_inode;
+		return PTR_ERR(inode);

 	if (params->autocell)
 		set_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(inode)->flags);
@@ -342,16 +336,8 @@
 	_leave(" = 0");
 	return 0;

-error_inode:
-	ret = PTR_ERR(inode);
-	inode = NULL;
 error:
 	iput(inode);
-	afs_put_volume(as->volume);
-	kfree(as);
-
-	sb->s_fs_info = NULL;
-
 	_leave(" = %d", ret);
 	return ret;
 }
@@ -367,6 +353,7 @@
 	struct afs_volume *vol;
 	struct key *key;
 	char *new_opts = kstrdup(options, GFP_KERNEL);
+	struct afs_super_info *as;
 	int ret;

 	_enter(",,%s,%p", dev_name, options);
@@ -399,12 +386,22 @@
 		ret = PTR_ERR(vol);
 		goto error;
 	}
-	params.volume = vol;
+
+	/* allocate a superblock info record */
+	as = kzalloc(sizeof(struct afs_super_info), GFP_KERNEL);
+	if (!as) {
+		ret = -ENOMEM;
+		afs_put_volume(vol);
+		goto error;
+	}
+	as->volume = vol;

 	/* allocate a deviceless superblock */
-	sb = sget(fs_type, afs_test_super, set_anon_super, &params);
+	sb = sget(fs_type, afs_test_super, afs_set_super, as);
 	if (IS_ERR(sb)) {
 		ret = PTR_ERR(sb);
+		afs_put_volume(vol);
+		kfree(as);
 		goto error;
 	}

@@ -422,16 +419,16 @@
 	} else {
 		_debug("reuse");
 		ASSERTCMP(sb->s_flags, &, MS_ACTIVE);
-	}
-
-	afs_put_volume(params.volume);
+		afs_put_volume(vol);
+		kfree(as);
+	}
+
 	afs_put_cell(params.cell);
 	kfree(new_opts);
 	_leave(" = 0 [%p]", sb);
 	return dget(sb->s_root);

 error:
-	afs_put_volume(params.volume);
 	afs_put_cell(params.cell);
 	key_put(params.key);
 	kfree(new_opts);
@@ -439,18 +436,12 @@
 	return ERR_PTR(ret);
 }

-/*
- * finish the unmounting process on the superblock
- */
-static void afs_put_super(struct super_block *sb)
+static void afs_kill_super(struct super_block *sb)
 {
 	struct afs_super_info *as = sb->s_fs_info;
-
-	_enter("");
-
+	kill_anon_super(sb);
 	afs_put_volume(as->volume);
-
-	_leave("");
+	kfree(as);
 }

 /*


core: prevent crash in tee_mmu_final() on TA loading error

If the creation of the TA execution context fails before the mapping
directives are initialized, tee_mmu_final() will be called with the TA
context field mmu being NULL.

This change allows tee_mmu_final() to be called with uninitialized
mapping resources without crashing the core.

Signed-off-by: Etienne Carriere <f21bc5b8f3ea1962eb45af359f1abea6578cab94@linaro.org>
Reviewed-by: Jens Wiklander <7706914404370d7502c27a0eff493dcf491feb51@linaro.org>

--- core/arch/arm/mm/tee_mmu.c
+++ core/arch/arm/mm/tee_mmu.c
@@ -676,6 +676,9 @@
  */
 void tee_mmu_final(struct user_ta_ctx *utc)
 {
+	if (!utc->mmu)
+		return;
+
 	/* clear MMU entries to avoid clash when asid is reused */
 	tlbi_asid(utc->mmu->asid);


[ALSA] soc - s3c24xx-pcm - Fix checkpatch warnings

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/soc/s3c24xx/s3c24xx-pcm.c
+++ sound/soc/s3c24xx/s3c24xx-pcm.c
@@ -20,6 +20,7 @@

 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
@@ -30,7 +31,6 @@
 #include <sound/soc.h>

 #include <asm/dma.h>
-#include <asm/io.h>
 #include <asm/hardware.h>
 #include <asm/arch/dma.h>
 #include <asm/arch/audio.h>
@@ -93,7 +93,7 @@
 	while (prtd->dma_loaded < prtd->dma_limit) {
 		unsigned long len = prtd->dma_period;

-		DBG("dma_loaded: %d\n",prtd->dma_loaded);
+		DBG("dma_loaded: %d\n", prtd->dma_loaded);

 		if ((pos + len) > prtd->dma_end) {
 			len  = prtd->dma_end - pos;
@@ -101,7 +101,7 @@
 			       __func__, len);
 		}

-		ret = s3c2410_dma_enqueue(prtd->params->channel,
+		ret = s3c2410_dma_enqueue(prtd->params->channel,
 			substream, pos, len);

 		if (ret == 0) {
@@ -129,7 +129,7 @@
 		return;

 	prtd = substream->runtime->private_data;
-
+
 	if (substream)
 		snd_pcm_period_elapsed(substream);

@@ -150,7 +150,7 @@
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct s3c24xx_pcm_dma_params *dma = rtd->dai->cpu_dai->dma_data;
 	unsigned long totbytes = params_buffer_bytes(params);
-	int ret=0;
+	int ret = 0;

 	DBG("Entered %s\n", __func__);

@@ -223,7 +223,7 @@
 	/* return if this is a bufferless transfer e.g.
 	 * codec <--> BT codec or GSM modem -- lg FIXME */
 	if (!prtd->params)
-	 	return 0;
+		return 0;

 	/* channel needs configuring for mem=>device, increment memory addr,
 	 * sync to pclk, half-word transfers to the IIS-FIFO. */
@@ -293,8 +293,8 @@
 	return ret;
 }

-static snd_pcm_uframes_t
-	s3c24xx_pcm_pointer(struct snd_pcm_substream *substream)
+static snd_pcm_uframes_t
+s3c24xx_pcm_pointer(struct snd_pcm_substream *substream)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct s3c24xx_runtime_data *prtd = runtime->private_data;
@@ -313,7 +313,7 @@

 	spin_unlock(&prtd->lock);

-	DBG("Pointer %x %x\n",src,dst);
+	DBG("Pointer %x %x\n", src, dst);

 	/* we seem to be getting the odd error from the pcm library due
 	 * to out-of-bounds pointers. this is maybe due to the dma engine
@@ -355,10 +355,10 @@

 	DBG("Entered %s\n", __func__);

-	if (prtd)
-		kfree(prtd);
-	else
+	if (!prtd)
 		DBG("s3c24xx_pcm_close called with prtd == NULL\n");
+
+	kfree(prtd);

 	return 0;
 }
@@ -371,9 +371,9 @@
 	DBG("Entered %s\n", __func__);

 	return dma_mmap_writecombine(substream->pcm->card->dev, vma,
-                                     runtime->dma_area,
-                                     runtime->dma_addr,
-                                     runtime->dma_bytes);
+				     runtime->dma_area,
+				     runtime->dma_addr,
+				     runtime->dma_bytes);
 }

 static struct snd_pcm_ops s3c24xx_pcm_ops = {
@@ -432,7 +432,7 @@

 static u64 s3c24xx_pcm_dmamask = DMA_32BIT_MASK;

-static int s3c24xx_pcm_new(struct snd_card *card,
+static int s3c24xx_pcm_new(struct snd_card *card,
 	struct snd_soc_codec_dai *dai, struct snd_pcm *pcm)
 {
 	int ret = 0;
@@ -467,7 +467,6 @@
 	.pcm_new	= s3c24xx_pcm_new,
 	.pcm_free	= s3c24xx_pcm_free_dma_buffers,
 };
-
 EXPORT_SYMBOL_GPL(s3c24xx_soc_platform);

 MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");


blkdev_aio_read(): switch to generic_file_read_iter(), get rid of iov_shorten()

Signed-off-by: Al Viro <de609eb4d5d70b1d38ec6642adbfc33a2781f63c@zeniv.linux.org.uk>

--- fs/block_dev.c
+++ fs/block_dev.c
@@ -1538,14 +1538,17 @@
 	struct file *file = iocb->ki_filp;
 	struct inode *bd_inode = file->f_mapping->host;
 	loff_t size = i_size_read(bd_inode);
+	size_t count = iocb->ki_nbytes;
+	struct iov_iter to;
+
+	iov_iter_init(&to, READ, iov, nr_segs, count);

 	if (pos >= size)
 		return 0;

 	size -= pos;
-	if (size < iocb->ki_nbytes)
-		nr_segs = iov_shorten((struct iovec *)iov, nr_segs, size);
-	return generic_file_aio_read(iocb, iov, nr_segs, pos);
+	iov_iter_truncate(&to, size);
+	return generic_file_read_iter(iocb, &to);
 }

 /*


made debug log public

made debug log public

--- TerrainApps/Enviro/Enviro.h
+++ TerrainApps/Enviro/Enviro.h
@@ -186,6 +186,7 @@
 	vtString	m_msg;
 	FILE		*m_log;
 	void		_StartLog(const char *fname);
+public:
 	void		_Log(const char *str);
 };


core: bugfix teecore_init_*_ram()

core: bugfix teecore_init_*_ram()

Fixes confusion of virtual and physical addresses in
teecore_init_ta_ram() and teecore_init_pub_ram().

Reviewed-by: Jerome Forissier <ced78d268b4c9a0a20a59a9feeebd2ad90da03d3@linaro.org>
Reviewed-by: Pascal Brand <0b55292d2562685bad4ce52d64f802e8f1cd299e@linaro.org>
Signed-off-by: Jens Wiklander <7706914404370d7502c27a0eff493dcf491feb51@linaro.org>

--- core/arch/arm/mm/tee_mmu.c
+++ core/arch/arm/mm/tee_mmu.c
@@ -629,21 +629,27 @@
 {
 	vaddr_t s;
 	vaddr_t e;
+	paddr_t ps;
+	paddr_t pe;

 	/* get virtual addr/size of RAM where TA are loaded/executedNSec
 	 * shared mem allcated from teecore */
 	core_mmu_get_mem_by_type(MEM_AREA_TA_RAM, &s, &e);
-
-	TEE_ASSERT((s & (CORE_MMU_USER_CODE_SIZE - 1)) == 0);
-	TEE_ASSERT((e & (CORE_MMU_USER_CODE_SIZE - 1)) == 0);
+	ps = virt_to_phys((void *)s);
+	TEE_ASSERT(ps);
+	pe = virt_to_phys((void *)(e - 1)) + 1;
+	TEE_ASSERT(pe);
+
+	TEE_ASSERT((ps & (CORE_MMU_USER_CODE_SIZE - 1)) == 0);
+	TEE_ASSERT((pe & (CORE_MMU_USER_CODE_SIZE - 1)) == 0);
 	/* extra check: we could rely on  core_mmu_get_mem_by_type() */
-	TEE_ASSERT(tee_vbuf_is_sec(s, e - s) == true);
+	TEE_ASSERT(tee_pbuf_is_sec(ps, pe - ps) == true);

 	TEE_ASSERT(tee_mm_is_empty(&tee_mm_sec_ddr));

 	/* remove previous config and init TA ddr memory pool */
 	tee_mm_final(&tee_mm_sec_ddr);
-	tee_mm_init(&tee_mm_sec_ddr, s, e, CORE_MMU_USER_CODE_SHIFT,
+	tee_mm_init(&tee_mm_sec_ddr, ps, pe, CORE_MMU_USER_CODE_SHIFT,
 		    TEE_MM_POOL_NO_FLAGS);
 }

@@ -681,7 +687,7 @@
 	s += sizeof(uint32_t);		/* size of a pl310 mutex */
 #endif

-	default_nsec_shm_paddr = s;
+	default_nsec_shm_paddr = virt_to_phys((void *)s);
 	default_nsec_shm_size = e - s;
 }


tests: skip stat32-v.test on x32

tests: skip stat32-v.test on x32

Explicitly skip 32-bit stat test on x32 even if libc pretends
to support it.

* tests/stat.c (main) [__x86_64__ && __ILP32__]: Skip.

--- tests/stat.c
+++ tests/stat.c
@@ -123,11 +123,15 @@
 	struct stat stb;

 #ifdef NR_stat
+# if defined __x86_64__ && defined __ILP32__
+	return 77;	/* x32 stat is 64-bit */
+# else
 	if (sizeof(stb.st_size) > 4)
 		return 77;
 	assert(syscall(NR_stat, av[1], &stb) == 0);
 	if (!stb.st_mode)
 		return 77;
+# endif
 #else
 	assert(stat(av[1], &stb) == 0);
 #endif


ceph: make sure write caps are registered with auth MDS

Only auth MDS can issue write caps to clients, so don't consider
write caps registered with non-auth MDS as valid.

Signed-off-by: Yan, Zheng <45e2ee8c8b09e76a9d512320d4eb53c0cd9925c0@intel.com>

--- fs/ceph/caps.c
+++ fs/ceph/caps.c
@@ -885,7 +885,10 @@
 		cap = rb_entry(p, struct ceph_cap, ci_node);
 		if (!__cap_is_valid(cap))
 			continue;
-		mds_wanted |= cap->mds_wanted;
+		if (cap == ci->i_auth_cap)
+			mds_wanted |= cap->mds_wanted;
+		else
+			mds_wanted |= (cap->mds_wanted & ~CEPH_CAP_ANY_FILE_WR);
 	}
 	return mds_wanted;
 }


tests: skip stat32 test if struct stat is defined incorrectly

If stat.st_mode returned by syscall is 0, it means that the definition
of struct stat in <asm/stat.h> is incorrect.  This is the case e.g. on
mips n32 where the only available stat syscall is 64-bit but at the same
time struct stat defined by <asm/stat.h> is 32-bit.

* tests/stat.c (main) [NR_stat]: Return 77 if st_mode is 0.

--- tests/stat.c
+++ tests/stat.c
@@ -111,6 +111,8 @@
 	if (sizeof(stb.st_size) > 4)
 		return 77;
 	assert(syscall(NR_stat, av[1], &stb) == 0);
+	if (!stb.st_mode)
+		return 77;
 #else
 	assert(stat(av[1], &stb) == 0);
 #endif


GFS2: Mark functions as static in gfs2/rgrp.c

Mark functions as static in gfs2/rgrp.c because they are not used
outside this file.

This eliminates the following warning in gfs2/rgrp.c:
fs/gfs2/rgrp.c:1092:5: warning: no previous prototype for ‘gfs2_rgrp_bh_get’ [-Wmissing-prototypes]
fs/gfs2/rgrp.c:1157:5: warning: no previous prototype for ‘update_rgrp_lvb’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <62a2cbd3422b0d621dafb7ceeff40187aeaed4ed@gmail.com>
Reviewed-by: Josh Triplett <c028c213ed5efcf30c3f4fc7361dbde0c893c5b7@joshtriplett.org>
Signed-off-by: Steven Whitehouse <9801c4ef11586b619a1c43ac9377eea2aee672dd@redhat.com>

--- fs/gfs2/rgrp.c
+++ fs/gfs2/rgrp.c
@@ -1102,7 +1102,7 @@
  * Returns: errno
  */

-int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd)
+static int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd)
 {
 	struct gfs2_sbd *sdp = rgd->rd_sbd;
 	struct gfs2_glock *gl = rgd->rd_gl;
@@ -1169,7 +1169,7 @@
 	return error;
 }

-int update_rgrp_lvb(struct gfs2_rgrpd *rgd)
+static int update_rgrp_lvb(struct gfs2_rgrpd *rgd)
 {
 	u32 rl_flags;


Code cleanup

Code cleanup

--- tests/time.c
+++ tests/time.c
@@ -39,11 +39,11 @@

 	printf("%s: Testing getdate()\n", progname);
 	if(unsetenv("DATEMSK") != 0)
-		return 1;
+		return -1;
 	if(getdate(date) != NULL)
-		return 1;
+		return -1;
 	if(getdate_err != 1)
-		return 1;
+		return -1;
 	return 0;
 }


nfs: Add "lookupcache" to displayed mount options

Running "cat /proc/mounts" fails to display the "lookupcache" option.
This oversight cost me a bunch of wasted time recently.

The following simple patch fixes it.

CC: stable <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org>
Signed-off-by: Patrick LoPresti <eded8001528943a7bfbbbd89fa42ebc0f1947813@gmail.com>
Signed-off-by: Trond Myklebust <6a1f9db795c9fc44be97d66ab114c53193bd3d13@netapp.com>

--- fs/nfs/super.c
+++ fs/nfs/super.c
@@ -655,6 +655,13 @@

 	if (nfss->options & NFS_OPTION_FSCACHE)
 		seq_printf(m, ",fsc");
+
+	if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) {
+		if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
+			seq_printf(m, ",lookupcache=none");
+		else
+			seq_printf(m, ",lookupcache=pos");
+	}
 }

 /*


[PATCH] kobject_uevent.c has a typo in a comment

This patch changes trough to through in a comment in kobject_uevent.c.

Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- lib/kobject_uevent.c
+++ lib/kobject_uevent.c
@@ -54,7 +54,7 @@
 static struct sock *uevent_sock;

 /**
- * send_uevent - notify userspace by sending event trough netlink socket
+ * send_uevent - notify userspace by sending event through netlink socket
  *
  * @signal: signal name
  * @obj: object path (kobject)


NFS: check for req==NULL in nfs_try_to_update_request cleanup

Signed-off-by: Fred Isaman <ee6b45fd5e3f9d0d483b1acb0cf37186eab7613c@netapp.com>
Signed-off-by: Trond Myklebust <6a1f9db795c9fc44be97d66ab114c53193bd3d13@netapp.com>

--- fs/nfs/write.c
+++ fs/nfs/write.c
@@ -682,7 +682,8 @@
 		req->wb_bytes = rqend - req->wb_offset;
 out_unlock:
 	spin_unlock(&inode->i_lock);
-	nfs_clear_request_commit(req);
+	if (req)
+		nfs_clear_request_commit(req);
 	return req;
 out_flushme:
 	spin_unlock(&inode->i_lock);


Revert "kobject: don't block for each kobject_uevent".

This reverts commit f520360d93cdc37de5d972dac4bf3bdef6a7f6a7.

Tetsuo Handa, running a kernel with CONFIG_DEBUG_PAGEALLOC=y and
CONFIG_UEVENT_HELPER_PATH=/sbin/hotplug, has been hitting RCU detected
CPU stalls: it's been spinning in the loop where do_execve() counts up
the args (but why wasn't fixup_exception working? dunno).

The recent change, switching kobject_uevent_env() from UMH_WAIT_EXEC
to UMH_NO_WAIT, is broken: the exec uses args on the local stack here,
and an env which is kfreed as soon as call_usermodehelper() returns.
It very much needs to wait for the exec to be done.

An alternative would be to keep the UMH_NO_WAIT, and complicate the code
to allocate and free these resources correctly? but no, as GregKH
pointed out when making the commit, CONFIG_UEVENT_HELPER_PATH="" is a
much better optimization - though some distros are still saying
/sbin/hotplug in their .config, yet with no such binary in their initrd
or their root.

Reported-by: Tetsuo Handa <3d00b54ad717112934d0b63b7ac2975b44022a61@i-love.sakura.ne.jp>
Signed-off-by: Hugh Dickins <a6c5230a10c458028ff1bd5985dd47c394028d47@veritas.com>
Acked-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>
Acked-by: Arjan van de Ven <9043bf4b08f6c93a2cb55d98c3494b123858348f@linux.intel.com>
Acked-by: Will Newton <71feca22d1203964f870c694beb32f4f811c5219@gmail.com>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- lib/kobject_uevent.c
+++ lib/kobject_uevent.c
@@ -258,7 +258,7 @@
 			goto exit;

 		retval = call_usermodehelper(argv[0], argv,
-					     env->envp, UMH_NO_WAIT);
+					     env->envp, UMH_WAIT_EXEC);
 	}

 exit:


latencytop: fix kernel panic while reading latency proc file

Reading /proc/<pid>/latency or /proc/<pid>/task/<tid>/latency could cause
NULL pointer dereference.

In lstats_open(), get_proc_task() can return NULL, in which case the kernel
will oops at lstats_show_proc() because m->private is NULL.

When get_proc_task() returns NULL, the kernel should return -ENOENT.

This can be reproduced by the following script.
while :
do
        date
        bash -c 'ls > ls.$$' &
        pid=$!
        cat /proc/$pid/latency &
        cat /proc/$pid/latency &
        cat /proc/$pid/latency &
        cat /proc/$pid/latency
done

Signed-off-by: Hiroshi Shimamoto <db8c2e91c9f58451d767d75787c2de778d30f637@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- fs/proc/base.c
+++ fs/proc/base.c
@@ -350,6 +350,8 @@
 	struct seq_file *m;
 	struct task_struct *task = get_proc_task(inode);

+	if (!task)
+		return -ENOENT;
 	ret = single_open(file, lstats_show_proc, NULL);
 	if (!ret) {
 		m = file->private_data;


ufs_inode_getfrag(): split extending the partial blocks off

ufs_extend_tail() is handling that now.

Signed-off-by: Al Viro <de609eb4d5d70b1d38ec6642adbfc33a2781f63c@zeniv.linux.org.uk>

--- fs/ufs/inode.c
+++ fs/ufs/inode.c
@@ -205,6 +205,40 @@
 	goto again;
 }

+/*
+ * Unpacking tails: we have a file with partial final block and
+ * we had been asked to extend it.  If the fragment being written
+ * is within the same block, we need to extend the tail just to cover
+ * that fragment.  Otherwise the tail is extended to full block.
+ *
+ * Note that we might need to create a _new_ tail, but that will
+ * be handled elsewhere; this is strictly for resizing old
+ * ones.
+ */
+static bool
+ufs_extend_tail(struct inode *inode, u64 writes_to,
+		  int *err, struct page *locked_page)
+{
+	struct ufs_inode_info *ufsi = UFS_I(inode);
+	struct super_block *sb = inode->i_sb;
+	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
+	unsigned lastfrag = ufsi->i_lastfrag;	/* it's a short file, so unsigned is enough */
+	unsigned block = ufs_fragstoblks(lastfrag);
+	unsigned new_size;
+	void *p;
+	u64 tmp;
+
+	if (writes_to < (lastfrag | uspi->s_fpbmask))
+		new_size = (writes_to & uspi->s_fpbmask) + 1;
+	else
+		new_size = uspi->s_fpb;
+
+	p = ufs_get_direct_data_ptr(uspi, ufsi, block);
+	tmp = ufs_new_fragments(inode, p, lastfrag, ufs_data_ptr_to_cpu(sb, p),
+				new_size, err, locked_page);
+	return tmp != 0;
+}
+
 /**
  * ufs_inode_getfrag() - allocate new fragment(s)
  * @inode: pointer to inode
@@ -226,13 +260,10 @@
 	struct ufs_inode_info *ufsi = UFS_I(inode);
 	struct super_block *sb = inode->i_sb;
 	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
-	unsigned blockoff, lastblockoff;
-	u64 tmp, goal, lastfrag, block, lastblock;
-	void *p, *p2;
-
-	UFSD("ENTER, ino %lu, fragment %llu, new_fragment %llu, required %u, "
-	     "metadata %d\n", inode->i_ino, (unsigned long long)fragment,
-	     (unsigned long long)new_fragment, required, !phys);
+	unsigned blockoff;
+	u64 tmp, goal, lastfrag, block;
+	unsigned nfrags = uspi->s_fpb;
+	void *p;

         /* TODO : to be done for write support
         if ( (flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
@@ -242,66 +273,27 @@
 	block = ufs_fragstoblks (fragment);
 	blockoff = ufs_fragnum (fragment);
 	p = ufs_get_direct_data_ptr(uspi, ufsi, block);
+	tmp = ufs_data_ptr_to_cpu(sb, p);
+	if (tmp)
+		goto out;
+
+	lastfrag = ufsi->i_lastfrag;
+
+	/* will that be a new tail? */
+	if (new_fragment < UFS_NDIR_FRAGMENT && new_fragment >= lastfrag)
+		nfrags = (new_fragment & uspi->s_fpbmask) + 1;

 	goal = 0;
-
-	tmp = ufs_data_ptr_to_cpu(sb, p);
-
-	lastfrag = ufsi->i_lastfrag;
-	if (tmp && fragment < lastfrag)
-		goto out;
-
-	lastblock = ufs_fragstoblks (lastfrag);
-	lastblockoff = ufs_fragnum (lastfrag);
-	/*
-	 * We will extend file into new block beyond last allocated block
-	 */
-	if (lastblock < block) {
-		/*
-		 * We must reallocate last allocated block
-		 */
-		if (lastblockoff) {
-			p2 = ufs_get_direct_data_ptr(uspi, ufsi, lastblock);
-			tmp = ufs_new_fragments(inode, p2, lastfrag,
-						ufs_data_ptr_to_cpu(sb, p2),
-						uspi->s_fpb - lastblockoff,
-						err, locked_page);
-			if (!tmp)
-				return 0;
-			lastfrag = ufsi->i_lastfrag;
-		}
-		tmp = ufs_data_ptr_to_cpu(sb,
-					 ufs_get_direct_data_ptr(uspi, ufsi,
-								 lastblock));
-		if (tmp)
-			goal = tmp + uspi->s_fpb;
-		tmp = ufs_new_fragments (inode, p, fragment - blockoff,
-					 goal, required + blockoff,
-					 err,
-					 phys != NULL ? locked_page : NULL);
-	} else if (lastblock == block) {
-	/*
-	 * We will extend last allocated block
-	 */
-		tmp = ufs_new_fragments(inode, p, fragment -
-					(blockoff - lastblockoff),
-					ufs_data_ptr_to_cpu(sb, p),
-					required +  (blockoff - lastblockoff),
-					err, phys != NULL ? locked_page : NULL);
-	} else /* (lastblock > block) */ {
-	/*
-	 * We will allocate new block before last allocated block
-	 */
-		if (block) {
-			tmp = ufs_data_ptr_to_cpu(sb,
-						 ufs_get_direct_data_ptr(uspi, ufsi, block - 1));
-			if (tmp)
-				goal = tmp + uspi->s_fpb;
-		}
-		tmp = ufs_new_fragments(inode, p, fragment - blockoff,
-					goal, uspi->s_fpb, err,
-					phys != NULL ? locked_page : NULL);
-	}
+	if (block) {
+		goal = ufs_data_ptr_to_cpu(sb,
+				 ufs_get_direct_data_ptr(uspi, ufsi, block - 1));
+		if (goal)
+			goal += uspi->s_fpb;
+	}
+	tmp = ufs_new_fragments(inode, p, fragment - blockoff,
+				goal, uspi->s_fpb, err,
+				phys != NULL ? locked_page : NULL);
+
 	if (!tmp) {
 		*err = -ENOSPC;
 		return 0;
@@ -419,7 +411,6 @@
 	unsigned long ptr,phys;
 	u64 phys64 = 0;
 	unsigned frag = fragment & uspi->s_fpbmask;
-	unsigned mask = uspi->s_apbmask >> uspi->s_fpbshift;

 	if (!create) {
 		phys64 = ufs_frag_map(inode, offsets, depth);
@@ -444,6 +435,17 @@
 		goto abort_too_big;

 	err = 0;
+
+	if (UFS_I(inode)->i_lastfrag < UFS_NDIR_FRAGMENT) {
+		unsigned lastfrag = UFS_I(inode)->i_lastfrag;
+		unsigned tailfrags = lastfrag & uspi->s_fpbmask;
+		if (tailfrags && fragment >= lastfrag) {
+			if (!ufs_extend_tail(inode, fragment,
+					     &err, bh_result->b_page))
+				goto abort;
+		}
+	}
+
 	ptr = fragment;

 	if (depth == 1) {


whoops

whoops

--- player/player.c
+++ player/player.c
@@ -83,7 +83,7 @@
 {
   float move_speed = 1;
   vector_t stickInput = input_current_frame.analogue_input;
-
+#ifndef OLD_MOVEMENT
   if(player->is_moving == 0)
   {
     player->main_sprite->currentframe = 0;
@@ -163,6 +163,7 @@
     if(player->move_timer <= 0)
       player->is_moving = 0;
   }
+#endif

 #ifdef OLD_MOVEMENT
   vector_t stickInput = input_current_frame.analogue_input;


added comments for helper::Log

added comments for helper::Log

--- source/adios2/helper/adiosLog.h
+++ source/adios2/helper/adiosLog.h
@@ -23,8 +23,20 @@
     OUTPUT = 'o'
 };

+/**
+ * Print outputs, warnings, errors, and exceptions
+ * @param component: Engine, Transport, Operator, etc.
+ * @param source: class name of component
+ * @param activity: function name where this is called
+ * @param message: text message
+ * @param logRank: only print if(logRank==commRank)
+ * @param commRank: current MPI rank
+ * @param priority: only print if(priority<=verbosity)
+ * @param verbosity: engine parameter for engine wide verbosity level
+ * @param mode: OUTPUT, WARNING, ERROR, or EXCEPTION
+ */
 void Log(const std::string &component, const std::string &source,
-         const std::string &operation, const std::string &message,
+         const std::string &activity, const std::string &message,
          const int logRank, const int commRank, const int priority,
          const int verbosity, const LogMode mode);


add destination address selection support for getipnodebyname(3). though getipnodebyname(3) is obsoleted api, some major applications such as Mozilla are still using it.  so, it will help ipv4 users.

--- lib/libc/net/name6.c
+++ lib/libc/net/name6.c
@@ -102,6 +102,12 @@
 #include <sys/time.h>
 #include <sys/queue.h>
 #include <netinet/in.h>
+#ifdef INET6
+#include <net/if.h>
+#include <net/if_var.h>
+#include <sys/sysctl.h>
+#include <netinet6/in6_var.h>	/* XXX */
+#endif

 #include <arpa/inet.h>
 #include <arpa/nameser.h>
@@ -164,6 +170,14 @@
 #define	map_inaddr	map_addr_un.mau_inaddr
 };

+struct policyqueue {
+	TAILQ_ENTRY(policyqueue) pc_entry;
+#ifdef INET6
+	struct in6_addrpolicy pc_policy;
+#endif
+};
+TAILQ_HEAD(policyhead, policyqueue);
+
 static struct	 hostent *_hpcopy(struct hostent *hp, int *errp);
 static struct	 hostent *_hpaddr(int af, const char *name, void *addr, int *errp);
 static struct	 hostent *_hpmerge(struct hostent *hp1, struct hostent *hp2, int *errp);
@@ -174,6 +188,12 @@
 static struct	 hostent *_ghbyname(const char *name, int af, int flags, int *errp);
 static char	*_hgetword(char **pp);
 static int	 _mapped_addr_enabled(void);
+
+static struct	 hostent *_hpreorder(struct hostent *hp);
+static int	 get_addrselectpolicy(struct policyhead *);
+static void	 free_addrselectpolicy(struct policyhead *);
+static struct	 policyqueue *match_addrselectpolicy(struct sockaddr *,
+	struct policyhead *);

 static FILE	*_files_open(int *errp);
 static int	 _files_ghbyname(void *, void *, va_list);
@@ -356,7 +376,7 @@
 		}
 	}
 #endif
-	return _hpsort(hp);
+	return _hpreorder(_hpsort(hp));
 }

 struct hostent *
@@ -760,6 +780,210 @@
 	if (ret == NULL || *ret == '\0')
 		return NULL;
 	return ret;
+}
+
+/*
+ * _hpreorder: sort address by default address selection
+ */
+static struct hostent *
+_hpreorder(struct hostent *hp)
+{
+	int i, j, n;
+	u_char *ap, **pp;
+	struct policyqueue *dstpolicy[MAXADDRS], *t;
+	struct sockaddr_storage ss;
+	struct policyhead policyhead;
+
+	if (hp == NULL || hp->h_addr_list[1] == NULL)
+		return hp;
+
+	/* retrieve address selection policy from the kernel */
+	TAILQ_INIT(&policyhead);
+	if (!get_addrselectpolicy(&policyhead)) {
+		/* no policy is installed into kernel, we don't sort. */
+		return hp;
+	}
+
+	switch (hp->h_addrtype) {
+	case AF_INET:
+		for (i = 0; (ap = (u_char *)hp->h_addr_list[i]); i++) {
+			memset(&ss, 0, sizeof(ss));
+			ss.ss_family = AF_INET;
+			ss.ss_len = sizeof(struct sockaddr_in);
+			memcpy(&((struct sockaddr_in *)&ss)->sin_addr, ap,
+			    sizeof(struct in_addr));
+			dstpolicy[i] = match_addrselectpolicy(
+			    (struct sockaddr *)&ss, &policyhead);
+		}
+		break;
+#ifdef INET6
+	case AF_INET6:
+		for (i = 0; (ap = (u_char *)hp->h_addr_list[i]); i++) {
+			memset(&ss, 0, sizeof(ss));
+			if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) {
+				ss.ss_family = AF_INET;
+				ss.ss_len = sizeof(struct sockaddr_in);
+				memcpy(&((struct sockaddr_in *)&ss)->sin_addr,
+				    &ap[12], sizeof(struct in_addr));
+			} else {
+				ss.ss_family = AF_INET6;
+				ss.ss_len = sizeof(struct sockaddr_in6);
+				memcpy(
+				    &((struct sockaddr_in6 *)&ss)->sin6_addr,
+				    ap, sizeof(struct in6_addr));
+			}
+			dstpolicy[i] = match_addrselectpolicy(
+			    (struct sockaddr *)&ss, &policyhead);
+		}
+		break;
+#endif
+	default:
+		free_addrselectpolicy(&policyhead);
+		return hp;
+	}
+
+	/* perform sorting. */
+	n = i;
+	pp = (u_char **)hp->h_addr_list;
+	for (i = 0; i < n - 1; i++) {
+		for (j = i + 1; j < n; j++) {
+			if (dstpolicy[j] &&
+			    (dstpolicy[i] == NULL ||
+			     dstpolicy[j]->pc_policy.preced >
+			     dstpolicy[i]->pc_policy.preced)) {
+				ap = pp[i];
+				pp[i] = pp[j];
+				pp[j] = ap;
+				t = dstpolicy[i];
+				dstpolicy[i] = dstpolicy[j];
+				dstpolicy[j] = t;
+			}
+		}
+	}
+
+	/* cleanup and return */
+	free_addrselectpolicy(&policyhead);
+	return hp;
+}
+
+static int
+get_addrselectpolicy(head)
+	struct policyhead *head;
+{
+#ifdef INET6
+	int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_ADDRCTLPOLICY };
+	size_t l;
+	char *buf;
+	struct in6_addrpolicy *pol, *ep;
+
+	if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0)
+		return (0);
+	if ((buf = malloc(l)) == NULL)
+		return (0);
+	if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) {
+		free(buf);
+		return (0);
+	}
+
+	ep = (struct in6_addrpolicy *)(buf + l);
+	for (pol = (struct in6_addrpolicy *)buf; pol + 1 <= ep; pol++) {
+		struct policyqueue *new;
+
+		if ((new = malloc(sizeof(*new))) == NULL) {
+			free_addrselectpolicy(head); /* make the list empty */
+			break;
+		}
+		new->pc_policy = *pol;
+		TAILQ_INSERT_TAIL(head, new, pc_entry);
+	}
+
+	free(buf);
+	return (1);
+#else
+	return (0);
+#endif
+}
+
+static void
+free_addrselectpolicy(head)
+	struct policyhead *head;
+{
+	struct policyqueue *ent, *nent;
+
+	for (ent = TAILQ_FIRST(head); ent; ent = nent) {
+		nent = TAILQ_NEXT(ent, pc_entry);
+		TAILQ_REMOVE(head, ent, pc_entry);
+		free(ent);
+	}
+}
+
+static struct policyqueue *
+match_addrselectpolicy(addr, head)
+	struct sockaddr *addr;
+	struct policyhead *head;
+{
+#ifdef INET6
+	struct policyqueue *ent, *bestent = NULL;
+	struct in6_addrpolicy *pol;
+	int matchlen, bestmatchlen = -1;
+	u_char *mp, *ep, *k, *p, m;
+	struct sockaddr_in6 key;
+
+	switch(addr->sa_family) {
+	case AF_INET6:
+		key = *(struct sockaddr_in6 *)addr;
+		break;
+	case AF_INET:
+		/* convert the address into IPv4-mapped IPv6 address. */
+		memset(&key, 0, sizeof(key));
+		key.sin6_family = AF_INET6;
+		key.sin6_len = sizeof(key);
+		key.sin6_addr.s6_addr[10] = 0xff;
+		key.sin6_addr.s6_addr[11] = 0xff;
+		memcpy(&key.sin6_addr.s6_addr[12],
+		       &((struct sockaddr_in *)addr)->sin_addr, 4);
+		break;
+	default:
+		return(NULL);
+	}
+
+	for (ent = TAILQ_FIRST(head); ent; ent = TAILQ_NEXT(ent, pc_entry)) {
+		pol = &ent->pc_policy;
+		matchlen = 0;
+
+		mp = (u_char *)&pol->addrmask.sin6_addr;
+		ep = mp + 16;	/* XXX: scope field? */
+		k = (u_char *)&key.sin6_addr;
+		p = (u_char *)&pol->addr.sin6_addr;
+		for (; mp < ep && *mp; mp++, k++, p++) {
+			m = *mp;
+			if ((*k & m) != *p)
+				goto next; /* not match */
+			if (m == 0xff) /* short cut for a typical case */
+				matchlen += 8;
+			else {
+				while (m >= 0x80) {
+					matchlen++;
+					m <<= 1;
+				}
+			}
+		}
+
+		/* matched.  check if this is better than the current best. */
+		if (matchlen > bestmatchlen) {
+			bestent = ent;
+			bestmatchlen = matchlen;
+		}
+
+	  next:
+		continue;
+	}
+
+	return(bestent);
+#else
+	return(NULL);
+#endif
+
 }

 /*


simplify area select

simplify area select

--- display_X11.c
+++ display_X11.c
@@ -11,6 +11,10 @@
 #include "display.h"
 #include "display_X11.h"
 #include "options.h"
+
+#ifndef min
+#define min(x,y) (((x)<(y))?(x):(y))
+#endif

 Display *disp;
 Screen *scr;
@@ -47,19 +51,10 @@
 		case MotionNotify:
 			XDrawRectangle(disp, root, gc, area->x, area->y, area->width, area->height);

-			area->x = start_x;
-			area->y = start_y;
-			area->width = ev.xmotion.x - area->x;
-			area->height = ev.xmotion.y - area->y;
-
-			if (area->width < 0) {
-				area->x += area->width;
-				area->width = 0 - area->width;
-			}
-			if (area->height < 0) {
-				area->y += area->height;
-				area->height = 0 - area->height;
-			}
+			area->x = min(start_x, ev.xmotion.x);
+			area->y = min(start_y, ev.xmotion.y);
+			area->width = abs(ev.xmotion.x - start_x);
+			area->height = abs(ev.xmotion.y - start_y);

 			XDrawRectangle(disp, root, gc, area->x, area->y, area->width, area->height);
 			XFlush(disp);


stm32_etzpc: local validation functions may be unused

Local functions valid_decprot_id()  valid_tzma_id() are used only
in debug configuration. This adds a __maybe_unused attribute to
prevent compiler from warning with a trace like:

core/drivers/stm32_etzpc.c:100:13: warning: ‘valid_tzma_id’ defined but not used [-Wunused-function]
 static bool valid_tzma_id(unsigned int id)
             ^~~~~~~~~~~~~
core/drivers/stm32_etzpc.c:95:13: warning: ‘valid_decprot_id’ defined but not used [-Wunused-function]
 static bool valid_decprot_id(unsigned int id)
             ^~~~~~~~~~~~~~~~

Signed-off-by: Etienne Carriere <f21bc5b8f3ea1962eb45af359f1abea6578cab94@linaro.org>
Reviewed-by: Jerome Forissier <ced78d268b4c9a0a20a59a9feeebd2ad90da03d3@linaro.org>
Acked-by: Jens Wiklander <7706914404370d7502c27a0eff493dcf491feb51@linaro.org>

--- core/drivers/stm32_etzpc.c
+++ core/drivers/stm32_etzpc.c
@@ -92,12 +92,12 @@
 	return io_pa_or_va(&etzpc_dev.base);
 }

-static bool valid_decprot_id(unsigned int id)
+static bool __maybe_unused valid_decprot_id(unsigned int id)
 {
 	return id < etzpc_dev.num_per_sec;
 }

-static bool valid_tzma_id(unsigned int id)
+static bool __maybe_unused valid_tzma_id(unsigned int id)
 {
 	return id < etzpc_dev.num_tzma;
 }


added interface to work with 8 bytes

added interface to work with 8 bytes

--- Sketches/AM/xxtea/libxxtea/src/xxtea.c
+++ Sketches/AM/xxtea/libxxtea/src/xxtea.c
@@ -80,8 +80,8 @@
 #include <netinet/in.h>
 #include "xxtea.h"

-static long btea( int32_t * v, int32_t n , int32_t * k );
-
+
+static long btea( int32_t * v, int32_t n , int32_t * k );
 int xxtea_encrypt(char* in_file, char* out_file, char* key) {
     extern int errno;
     int c;
@@ -319,14 +319,16 @@
 }
 /*
 int main (int argc, char *argv[]) {
-	printf("encrypting \n");
-	encrypt("test","test.enc","12345678901234567890123456789012");
-	printf("encrypted \n");
-	printf("decrypting \n");
-	decrypt("test.enc","test.dec","12345678901234567890123456789012");
-	printf("decrypted \n");
+
+
 }
+
 */
+
+long btea_8bytes(unsigned char* data, int rounds, unsigned char* key) {
+	btea((int32_t *)data, rounds, (int32_t*)key);
+}
+
 /* nearly all the following xxtea crypto */
 /* code from the post script             */
 /* by David Wheeler and Roger Needham    */


Small typo correction.

Small typo correction.

--- tetrisgame.h
+++ tetrisgame.h
@@ -13,7 +13,7 @@
 	// Draws the game.
 	void draw();

-	// Returns the width in piĵxels.
+	// Returns the width in pixels.
     double getWidth() const;

 	// Returns the width in pixels.


Scale window position/size values for multi-region sups.

--- src/Subtitles/subpicturebd.h
+++ src/Subtitles/subpicturebd.h
@@ -40,10 +40,76 @@

     SubPicture* copy();

+    virtual void setImageWidth(int w, double scaleFactor = 1)
+    {
+        if (scaleFactor != 1.0d)
+        {
+            for (int i = 0; i < scaledWindows.size(); ++i)
+            {
+                scaledWindows[i].setWidth((int)((scaledWindows[i].width() * scaleFactor) + 0.5));
+            }
+        }
+        else
+        {
+            scaledWindows = windows;
+        }
+        _imageWidth = w;
+    }
+
+    virtual void setImageHeight(int h, double scaleFactor = 1)
+    {
+        if (scaleFactor != 1.0d)
+        {
+            for (int i = 0; i < scaledWindows.size(); ++i)
+            {
+                scaledWindows[i].setHeight((int)((scaledWindows[i].height() * scaleFactor) + 0.5));
+            }
+        }
+        else
+        {
+            scaledWindows = windows;
+        }
+        _imageHeight = h;
+    }
+
+    virtual void setX(int ofs, double scaleFactor = 1)
+    {
+        if (scaleFactor != 1.0d)
+        {
+            for (int i = 0; i < scaledWindows.size(); ++i)
+            {
+                scaledWindows[i].setX((int)((scaledWindows[i].x() * scaleFactor) + 0.5));
+            }
+        }
+        else
+        {
+            scaledWindows = windows;
+        }
+        xOfs = ofs;
+    }
+
+    virtual void setY(int ofs, double scaleFactor = 1)
+    {
+        if (scaleFactor != 1.0d)
+        {
+            for (int i = 0; i < scaledWindows.size(); ++i)
+            {
+                scaledWindows[i].setY((int)((scaledWindows[i].y() * scaleFactor) + 0.5));
+            }
+        }
+        else
+        {
+            scaledWindows = windows;
+        }
+        yOfs = ofs;
+    }
+
     bool paletteUpdated() { return paletteUpdate; }
     void setPaletteUpdated(bool paletteUpdated) { paletteUpdate = paletteUpdated; }
+
     int numberOfWindows() { return numWindows; }
     void setNumberOfWindows(int numberOfWindows) { numWindows = numberOfWindows; }
+
     int subPictureType() { return type; }
     void setSubPictureType(int subPictureType) { type = subPictureType; }

@@ -76,7 +142,7 @@

     QVector<QVector<PaletteInfo>> palettes;

-    QVector<QRect> &windowSizes() { return windows; }
+    QVector<QRect> &windowSizes() { return scaledWindows; }
     void setWindowSizes(QVector<QRect> windowSizes) { windows = scaledWindows = windowSizes; }


Add Notifier base class, complements Observer

--- src/TantechEngine/observer.h
+++ src/TantechEngine/observer.h
@@ -1,5 +1,9 @@
 #ifndef TE_OBSERVER_H
 #define TE_OBSERVER_H
+
+#include <vector>
+#include <memory>
+#include <cassert>

 namespace te
 {
@@ -10,6 +14,29 @@
         virtual ~Observer() {}
         virtual void onNotify(const EventType& evt) = 0;
 	};
+
+    template <class EventType>
+    class Notifier
+    {
+    public:
+        virtual ~Notifier() {}
+        void addObserver(std::shared_ptr<Observer<EventType>> newObserver)
+        {
+            assert(newObserver);
+            if (std::find(mObservers.begin(), mObservers.end(), newObserver) == mObservers.end()) {
+                mObservers.push_back(newObserver);
+            }
+        }
+    protected:
+        void notify(const EventType& evt)
+        {
+            std::for_each(std::begin(mObservers), std::end(mObservers), [&evt](std::shared_ptr<Observer<EventType>>& pObserver) {
+                pObserver->onNotify(evt);
+            });
+        }
+    private:
+        std::vector<std::shared_ptr<Observer<EventType>>> mObservers;
+    };
 }

 #endif


selftests/powerpc: Update for ABIv2

selftests/powerpc: Update for ABIv2

Add some new definitions required to build the copyloop tests.

Signed-off-by: Anton Blanchard <14deb5e5e417133e888bf47bb6a3555c9bb7d81c@samba.org>

--- tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h
+++ tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h
@@ -46,12 +46,15 @@
 #define R20 r20
 #define R21 r21
 #define R22 r22
+#define R29 r29
+#define R30 r30
+#define R31 r31

 #define STACKFRAMESIZE	256
-#define STK_PARAM(i)	(48 + ((i)-3)*8)
 #define STK_REG(i)	(112 + ((i)-14)*8)

 #define _GLOBAL(A) FUNC_START(test_ ## A)
+#define _GLOBAL_TOC(A) _GLOBAL(A)

 #define PPC_MTOCRF(A, B)	mtocrf A, B


Added a pointer to a Transport object to the Phase class.  This allows a ThermoPhase object to know what Transport object it is associated with.

--- Cantera/src/thermo/Phase.h
+++ Cantera/src/thermo/Phase.h
@@ -26,6 +26,7 @@

 namespace Cantera {

+  class Transport; //forward declaration

   /**
    * @defgroup phases Models of Phases of Matter
@@ -221,6 +222,9 @@
      */
     void setName(std::string nm);

+    //! Attach a Transport object pointer to this Phase
+    void setTransport( Transport* tr ) { m_trans = tr; }
+
     //! Returns the index of the phase
     /*!
      * The index is used in the Python and matlab interfaces to
@@ -434,6 +438,9 @@
      */
     void getMoleFractionsByName(compositionMap& x) const;

+    //! Get a Transport object pointer attached to this Phase
+    Transport* getTransport( ) { return m_trans; }
+
     //! Return the mole fraction of a single species
     /*!
      * @param  k  String name of the species
@@ -515,6 +522,13 @@
      */
     int m_index;

+    /**
+     * A Transport object pointer attached to this Phase
+     */
+    Transport *m_trans;
+
+
+
   private:

     //! This stores the initial state of the system


Fixes

Fixes

--- Sources/Core/UI/MobilyPageController.h
+++ Sources/Core/UI/MobilyPageController.h
@@ -60,6 +60,7 @@

 @property(nonatomic, readwrite, assign) IBInspectable MobilyPageControllerOrientation orientation;
 @property(nonatomic, readwrite, strong) UIViewController< MobilyPageControllerDelegate >* controller;
+@property(nonatomic, readonly, assign, getter = isAnimating) BOOL animating;
 @property(nonatomic, readwrite, assign) IBInspectable BOOL userInteractionEnabled;
 @property(nonatomic, readwrite, assign) IBInspectable CGFloat draggingRate;
 @property(nonatomic, readwrite, assign) IBInspectable CGFloat bounceRate;


set status in the end (#3517)

set status in the end (#3517)

Signed-off-by: Chun-Wei Chen <3d21e1cad9aa0e4aa10838f859be24690cfc357c@gmail.com>

--- onnx/defs/operator_sets.h
+++ onnx/defs/operator_sets.h
@@ -989,8 +989,6 @@
 };

 inline void RegisterOnnxOperatorSetSchema() {
-  // 0 means all versions of ONNX schema have been loaded
-  OpSchemaRegistry::Instance()->SetLoadedSchemaVersion(0);
   RegisterOpSetSchema<OpSet_Onnx_ver1>();
   RegisterOpSetSchema<OpSet_Onnx_ver2>();
   RegisterOpSetSchema<OpSet_Onnx_ver3>();
@@ -1006,11 +1004,11 @@
   RegisterOpSetSchema<OpSet_Onnx_ver13>();
   RegisterOpSetSchema<OpSet_Onnx_ver14>();
   RegisterOpSetSchema<OpSet_Onnx_ver15>();
+  // 0 means all versions of ONNX schema have been loaded
+  OpSchemaRegistry::Instance()->SetLoadedSchemaVersion(0);
 }

 inline void RegisterOnnxOperatorSetSchema(int target_version) {
-  // Sets to record the loaded version and prevent the full operator check in Debug mode
-  OpSchemaRegistry::Instance()->SetLoadedSchemaVersion(target_version);
   // Update here if opset_version bumps
   // These calls for schema registration here are required to be in descending order for this to work correctly
   RegisterOpSetSchema<OpSet_Onnx_ver15>(target_version);
@@ -1028,6 +1026,8 @@
   RegisterOpSetSchema<OpSet_Onnx_ver3>(target_version);
   RegisterOpSetSchema<OpSet_Onnx_ver2>(target_version);
   RegisterOpSetSchema<OpSet_Onnx_ver1>(target_version);
+  // Sets to record the loaded version and prevent the full operator check in Debug mode
+  OpSchemaRegistry::Instance()->SetLoadedSchemaVersion(target_version);
 }

 } // namespace ONNX_NAMESPACE


Remove one unnecessary malloc() when emitting switches.

[r26643]

--- ir/be/ia32/ia32_emitter.c
+++ ir/be/ia32/ia32_emitter.c
@@ -1191,12 +1191,12 @@

 /* jump table for switch generation */
 typedef struct _jmp_tbl_t {
-	ir_node  *defProj;         /**< default target */
-	long      min_value;       /**< smallest switch case */
-	long      max_value;       /**< largest switch case */
-	long      num_branches;    /**< number of jumps */
-	char     *label;           /**< label of the jump table */
-	branch_t *branches;        /**< jump array */
+	ir_node  *defProj;                 /**< default target */
+	long      min_value;               /**< smallest switch case */
+	long      max_value;               /**< largest switch case */
+	long      num_branches;            /**< number of jumps */
+	char      label[SNPRINTF_BUF_LEN]; /**< label of the jump table */
+	branch_t *branches;                /**< jump array */
 } jmp_tbl_t;

 /**
@@ -1229,8 +1229,7 @@
 	const ir_edge_t    *edge;

 	/* fill the table structure */
-	tbl.label        = XMALLOCN(char, SNPRINTF_BUF_LEN);
-	tbl.label        = get_unique_label(tbl.label, SNPRINTF_BUF_LEN, ".TBL_");
+	get_unique_label(tbl.label, SNPRINTF_BUF_LEN, ".TBL_");
 	tbl.defProj      = NULL;
 	tbl.num_branches = get_irn_n_edges(node) - 1;
 	tbl.branches     = XMALLOCNZ(branch_t, tbl.num_branches);
@@ -1296,10 +1295,7 @@
 		ia32_emitf(tbl.branches[0].target, "\tjmp %L\n");
 	}

-	if (tbl.label)
-		free(tbl.label);
-	if (tbl.branches)
-		free(tbl.branches);
+	free(tbl.branches);
 }

 /**


spherical_sld: using cephes erf function, OpenCL works with Intel CPU on Mac

--- sasmodels/kernel_header.c
+++ sasmodels/kernel_header.c
@@ -13,12 +13,14 @@
 #  else
 #    define SINCOS(angle,svar,cvar) do {const double _t_=angle; svar=sin(_t_);cvar=cos(_t_);} while (0)
 #  endif
+   // Intel CPU on Mac gives strange values for erf(), so maybe don't use it
+   #define NEED_ERF
    // OpenCL only has type generic math
    #define expf exp
-   #define erff erf
-   #define erfcf erfc
-   // Intel CPU on Mac gives strange values for erf(), so maybe don't use it
-   //#define NEED_ERF
+   #ifndef NEED_ERF
+   #  define erff erf
+   #  define erfcf erfc
+   #endif
 #else // !USE_OPENCL
 // Use SAS_DOUBLE to force the use of double even for float kernels
 #  define SAS_DOUBLE dou ## ble


CorebootModulePkg/PciBusNoEnumerationDxe: Remove white space

Remove trailing white space from PciEnumeratorSupport.c.

Change-Id: Ia2f354151d46c09b140e2b42609d76fbbf8333f9
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Lee Leahy <5db40003354dc1c142019712d90bc051b3fe1c17@intel.com>
Reviewed-by: Prince Agyeman <8266ea0dc7dcfed116b38f79ac994d74bf6c7216@intel.com>

--- CorebootModulePkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c
+++ CorebootModulePkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c
@@ -2,18 +2,18 @@

 Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.

 (C) Copyright 2015 Hewlett Packard Enterprise Development LP

-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

 Module Name:

   PciEnumeratorSupport.c
-
+
 Abstract:

   PCI Bus Driver
@@ -24,17 +24,17 @@

 #include "PciBus.h"

-EFI_STATUS
+EFI_STATUS
 InitializePPB (
-  IN PCI_IO_DEVICE *PciIoDevice
+  IN PCI_IO_DEVICE *PciIoDevice
 );

-EFI_STATUS
+EFI_STATUS
 InitializeP2C (
-  IN PCI_IO_DEVICE *PciIoDevice
+  IN PCI_IO_DEVICE *PciIoDevice
 );

-PCI_IO_DEVICE*
+PCI_IO_DEVICE*
 CreatePciIoDevice (
   IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  *PciRootBridgeIo,
   IN PCI_TYPE00                       *Pci,
@@ -72,12 +72,12 @@
 );

-EFI_STATUS
+EFI_STATUS
 DetermineDeviceAttribute (
   IN PCI_IO_DEVICE                      *PciIoDevice
 );

-EFI_STATUS
+EFI_STATUS
 BarExisted (
   IN PCI_IO_DEVICE *PciIoDevice,
   IN UINTN         Offset,
@@ -90,10 +90,10 @@
 EFI_DEVICE_PATH_PROTOCOL*
 CreatePciDevicePath(
   IN  EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
-  IN  PCI_IO_DEVICE            *PciIoDevice
+  IN  PCI_IO_DEVICE            *PciIoDevice
 );

-PCI_IO_DEVICE*
+PCI_IO_DEVICE*
 GatherDeviceInfo (
   IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  *PciRootBridgeIo,
   IN PCI_TYPE00                       *Pci,
@@ -102,7 +102,7 @@
   UINT8                               Func
 );

-PCI_IO_DEVICE*
+PCI_IO_DEVICE*
 GatherPPBInfo (
   IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  *PciRootBridgeIo,
   IN PCI_TYPE00                       *Pci,
@@ -255,7 +255,7 @@
           if (EFI_ERROR (Status)) {
             return Status;
           }
-
+
           //
           // If the PCI bridge is initialized then enumerate the next level bus
           //
@@ -368,15 +368,15 @@
   if (!PciIoDevice) {
     return EFI_OUT_OF_RESOURCES;
   }
-
+
   //
   // Create a device path for this PCI device and store it into its private data
   //
   CreatePciDevicePath(
     Bridge->DevicePath,
-    PciIoDevice
+    PciIoDevice
     );
-
+
   //
   // Detect this function has option rom
   //
@@ -389,8 +389,8 @@
     }

     ResetPowerManagementFeature (PciIoDevice);
-
-  }
+
+  }
   else {
     PciRomGetRomResourceFromPciOptionRomTable (
       &gPciBusDriverBinding,
@@ -399,7 +399,7 @@
       );
   }

-
+
   //
   // Insert it into a global tree for future reference
   //
@@ -509,7 +509,7 @@
   if (!PciIoDevice) {
     return NULL;
   }
-
+
   if (gFullEnumeration) {
     PciDisableCommandRegister (PciIoDevice, EFI_PCI_COMMAND_BITS_OWNED);

@@ -593,7 +593,7 @@
 --*/
 {
   PCI_IO_DEVICE         *PciIoDevice;
-
+
   PciIoDevice = CreatePciIoDevice (
                   PciRootBridgeIo,
                   Pci,
@@ -619,7 +619,7 @@
   // P2C only has one bar that is in 0x10
   //
   PciParseBar(PciIoDevice, 0x10, 0);
-
+
   PciIoDevice->Decodes = EFI_BRIDGE_MEM32_DECODE_SUPPORTED  |
                          EFI_BRIDGE_PMEM32_DECODE_SUPPORTED |
                          EFI_BRIDGE_IO32_DECODE_SUPPORTED;
@@ -742,7 +742,7 @@
 /*++

 Routine Description:
-
+
   Determine the related attributes of all devices under a Root Bridge

 Arguments:
@@ -799,7 +799,7 @@

   PciReadCommandRegister(PciIoDevice, &Command);

-
+
   if (Command & EFI_PCI_COMMAND_IO_SPACE) {
     PciIoDevice->Attributes |= EFI_PCI_IO_ATTRIBUTE_IO;
   }
@@ -812,7 +812,7 @@
     PciIoDevice->Attributes |= EFI_PCI_IO_ATTRIBUTE_BUS_MASTER;
   }

-  if (IS_PCI_BRIDGE (&(PciIoDevice->Pci)) ||
+  if (IS_PCI_BRIDGE (&(PciIoDevice->Pci)) ||
       IS_CARDBUS_BRIDGE (&(PciIoDevice->Pci))){

     //
@@ -825,12 +825,12 @@
     //
     // Determine whether the ISA bit is set
     // If ISA Enable on Bridge is set, the PPB
-    // will block forwarding 0x100-0x3ff for each 1KB in the
+    // will block forwarding 0x100-0x3ff for each 1KB in the
     // first 64KB I/O range.
     //
     if ((BridgeControl & EFI_PCI_BRIDGE_CONTROL_ISA) != 0) {
       PciIoDevice->Attributes |= EFI_PCI_IO_ATTRIBUTE_ISA_IO;
-    }
+    }

     //
     // Determine whether the VGA bit is set
@@ -844,13 +844,13 @@
     }

     //
-    // if the palette snoop bit is set, then the brige is set to
+    // if the palette snoop bit is set, then the brige is set to
     // decode palette IO write
     //
     if (Command & EFI_PCI_COMMAND_VGA_PALETTE_SNOOP) {
       PciIoDevice->Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO;
     }
-  }
+  }

   return EFI_SUCCESS;
 }
@@ -997,7 +997,7 @@
       //
       // Fix the length to support some spefic 64 bit BAR
       //
-      Value |= ((UINT32)(-1) << HighBitSet32 (Value));
+      Value |= ((UINT32)(-1) << HighBitSet32 (Value));

       //
       // Calculate the size of 64bit bar
@@ -1021,7 +1021,7 @@
       break;
     }
   }
-
+
   //
   // Check the length again so as to keep compatible with some special bars
   //
@@ -1030,7 +1030,7 @@
     PciIoDevice->PciBar[BarIndex].BaseAddress = 0;
     PciIoDevice->PciBar[BarIndex].Alignment   = 0;
   }
-
+
   //
   // Increment number of bar
   //
@@ -1220,7 +1220,7 @@

 Routine Description:

-  This routine is used to enumerate entire pci bus system
+  This routine is used to enumerate entire pci bus system
   in a given platform

 Arguments:
@@ -1255,11 +1255,11 @@
   // Open the IO Abstraction(s) needed to perform the supported test
   //
   Status = gBS->OpenProtocol (
-                  Controller      ,
-                  &gEfiDevicePathProtocolGuid,
+                  Controller      ,
+                  &gEfiDevicePathProtocolGuid,
                   (VOID **)&ParentDevicePath,
-                  gPciBusDriverBinding.DriverBindingHandle,
-                  Controller,
+                  gPciBusDriverBinding.DriverBindingHandle,
+                  Controller,
                   EFI_OPEN_PROTOCOL_BY_DRIVER
                   );
   if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
@@ -1282,7 +1282,7 @@
   }

   //
-  // Load all EFI Drivers from all PCI Option ROMs behind the PCI Root Bridge
+  // Load all EFI Drivers from all PCI Option ROMs behind the PCI Root Bridge
   //
   Status = PciRomLoadEfiDriversFromOptionRomTable (&gPciBusDriverBinding, PciRootBridgeIo);

@@ -1353,9 +1353,9 @@
   MinBus          - The min bus.
   MaxBus          - The max bus.
   BusRange        - The bus range.
-
-Returns:
-
+
+Returns:
+
   Status Code.

 --*/


Fix OP::ENTER in breaker

Fix OP::ENTER in breaker

--- iv/lv5/breaker/compiler.h
+++ iv/lv5/breaker/compiler.h
@@ -752,7 +752,7 @@
       asm_->mov(rsi, ptr[r13 + kJSValSize * Reg(railgun::FrameConstant<>::kThisOffset)]);  // NOLINT

       asm_->mov(rdi, detail::jsval64::kValueMask);
-      asm_->and(rdi, rsi);
+      asm_->test(rdi, rsi);
       asm_->jnz(".not_cell", Xbyak::CodeGenerator::T_NEAR);

       // object or string
@@ -772,6 +772,7 @@
       }

       asm_->L(".not_cell"); {
+        asm_->mov(rdi, rsi);
         asm_->and(rdi, -9);
         asm_->cmp(rdi, detail::jsval64::kNull);
         asm_->jne(".object_initialization");


Purge illegal side-effect on global instantiation

--- iv/lv5/railgun/compiler.h
+++ iv/lv5/railgun/compiler.h
@@ -327,8 +327,9 @@
       data_ = core_->data();
       data_->reserve(4 * core::Size::KB);
       code = new Code(ctx_, script_, global, core_, Code::GLOBAL);
-      EmitFunctionCode<Code::GLOBAL>(global, code,
-                                     std::shared_ptr<VariableScope>());
+      EmitFunctionCode<Code::GLOBAL>(
+          global, code,
+          std::shared_ptr<VariableScope>());
     }
     CompileEpilogue(code);
     return code;
@@ -863,7 +864,7 @@
     EmitError(Error::Type, builder.BuildPiece());
   }

-  void FunctionInstantiation(const FunctionLiteral& lit, bool is_eval_decl) {
+  bool FunctionInstantiation(const FunctionLiteral& lit, bool is_eval_decl) {
     FunctionScope* env =
         static_cast<FunctionScope*>(current_variable_scope_.get());
     registers_.Clear(env->stack_size(), env->heap_size());
@@ -921,9 +922,11 @@

     code_->set_heap_size(registers_.heap_size());
     code_->set_stack_size(registers_.stack_size());
-  }
-
-  void EvalInstantiation(const FunctionLiteral& lit) {
+
+    return true;
+  }
+
+  bool EvalInstantiation(const FunctionLiteral& lit) {
     // not create new environment
     // simply use given it.
     //   for example,
@@ -962,9 +965,11 @@
             Instruction::UInt32(index, flag));
       }
     }
-  }
-
-  void GlobalInstantiation(const FunctionLiteral& lit) {
+
+    return true;
+  }
+
+  bool GlobalInstantiation(const FunctionLiteral& lit) {
     registers_.Clear(0, 0);

     JSGlobal* global = ctx()->global_obj();
@@ -987,12 +992,12 @@
           if (slot.attributes().IsAccessor()) {
             // report error
             EmitError(Error::Type, "create mutable function binding failed");
-            continue;
+            return false;
           }
           assert(slot.attributes().IsData());
           if (!slot.attributes().IsWritable() || !slot.attributes().IsEnumerable()) {
             EmitError(Error::Type, "create mutable function binding failed");
-            continue;
+            return false;
           }
           // OK. We can remove this property safety and set global register.
           Error::Dummy dummy;
@@ -1007,7 +1012,7 @@
         StoredSlot& slot(global->PointAt(entry));
         if (!slot.attributes().IsWritable() || !slot.attributes().IsEnumerable()) {
           EmitError(Error::Type, "create mutable function binding failed");
-          continue;
+          return false;
         }
         slot.set_value(func);
       }
@@ -1029,6 +1034,8 @@
             name, JSUndefined, Attributes::CreateData(ATTR::W | ATTR::E));
       }
     }
+
+    return true;
   }

   template<Code::CodeType TYPE>


whatever

whatever

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

--- mount_slash/bmap_cli.c
+++ mount_slash/bmap_cli.c
@@ -191,7 +191,7 @@
 		 * bother with further retry attempts.
 		 */
 		if (rc == -SLERR_ION_OFFLINE)
-			bmap_2_bci(b)->bci_nreassigns = SLERR_ION_OFFLINE;
+			bmap_2_bci(b)->bci_nreassigns = SLERR_ION_OFFLINE; /* XXX wtf is this */
 		OPSTAT_INCR(SLC_OPST_BMAP_REASSIGN_FAIL);
 	} else {
 		memcpy(&bmap_2_bci(b)->bci_sbd, &mp->sbd,
@@ -908,7 +908,7 @@
 struct slashrpc_cservice *
 msl_bmap_to_csvc(struct bmap *b, int exclusive)
 {
-	int i, j, locked, rc, allzeroes, hasdata;
+	int i, j, locked, rc, allvalid, hasdataflag;
 	struct slashrpc_cservice *csvc;
 	struct fcmh_cli_info *fci;
 	struct psc_multiwait *mw;
@@ -940,7 +940,7 @@
 		psc_multiwait_reset(mw);
 		psc_multiwait_entercritsect(mw);

-		allzeroes = 1;
+		hasvalid = 0;
 		for (i = 0; i < fci->fci_inode.nrepls; i++) {
 			rc = msl_try_get_replica_res(b,
 			    fci->fcif_idxmap[i], j, &csvc);
@@ -949,19 +949,19 @@
 				return (csvc);
 			}
 			if (rc == -1)
-				allzeroes = 0;
+				hasvalid = 0;
 		}

-		hasdata = !!(bmap_2_sbd(b)->sbd_flags &
+		hasdataflag = !!(bmap_2_sbd(b)->sbd_flags &
 		    SRM_LEASEBMAPF_DATA);
 		if (psc_dynarray_len(&mw->mw_conds))
-			psc_assert(!allzeroes && hasdata);
+			psc_assert(hasvalid && hasdataflag);
 		else {
 			/*
 			 * Residency scan revealed no VALID replicas.
 			 * I.e. a hole in the file.
 			 */
-			psc_assert(allzeroes && !hasdata);
+			//psc_assert(!hasvalid && !hasdataflag);
 			continue;
 		}


more preogress

more preogress

--- mount_slash/dircache.c
+++ mount_slash/dircache.c
@@ -373,6 +373,8 @@
 			continue;
 		}

+		INIT_PSC_LISTENTRY(&dce->dce_entry);
+		psclist_add_tail(&dce->dce_entry, &fci->fcid_entlist);

 		fgp = &e->sstb.sst_fg;
 		psc_assert(fgp->fg_fid == dirent->pfd_ino);
@@ -454,47 +456,14 @@
 		if (dce->dce_age + 30 > now.tv_sec) {
 			*ino = dce->dce_ino;
 			dce = NULL;
-		} else
+		} else {
 			psc_hashbkt_del_item(&msl_namecache_hashtbl, b, dce);
+			psc_pool_return(dircache_ent_pool, dce);
+		}
 	}
 	psc_hashbkt_put(&msl_namecache_hashtbl, b);

-	if (dce) {
-		psc_pool_return(dircache_ent_pool, dce);
-	}
 	DIRCACHE_ULOCK(d);
-}
-
-int
-dircache_insert_index(struct fidc_membh *d)
-{
-	int i;
-	struct timeval now;
-	struct psc_hashbkt *b;
-	struct fcmh_cli_info *fci;
-	struct dircache_ent  *tmp;
-
-	fci = fcmh_get_pri(d);
-	if (psc_dynarray_len(&fci->fcid_ents) < msl_max_namecache_per_directory)
-		return (psc_dynarray_pos(&fci->fcid_ents));
-
-	PFL_GETTIMEVAL(&now);
-	DYNARRAY_FOREACH(tmp, i, &fci->fcid_ents) {
-		if (!tmp)
-			return (i);
-
-		if (tmp->dce_age - 30 > now.tv_sec)
-			continue;
-		b = psc_hashent_getbucket(&msl_namecache_hashtbl, tmp);
-		psc_hashbkt_del_item(&msl_namecache_hashtbl, b, tmp);
-		psc_hashbkt_put(&msl_namecache_hashtbl, b);
-		if (!(tmp->dce_flag & DIRCACHE_F_SHORT))
-			PSCFREE(tmp->dce_name);
-		psc_pool_return(dircache_ent_pool, tmp);
-
-		return (i);
-	}
-	return (-1);
 }

 /*
@@ -514,12 +483,6 @@

 	fci = fcmh_get_pri(d);
 	DIRCACHE_WRLOCK(d);
-
-	index = dircache_insert_index(d);
-	if (index == -1) {
-		DIRCACHE_ULOCK(d);
-		return;
-	}

 	dce = psc_pool_get(dircache_ent_pool);

@@ -559,6 +522,8 @@
 		psc_pool_return(dircache_ent_pool, tmpdce);
 	}

+	INIT_PSC_LISTENTRY(&dce->dce_entry);
+	psclist_add_tail(&dce->dce_entry, &fci->fcid_entlist);
 	psc_hashbkt_add_item(&msl_namecache_hashtbl, b, dce);
 	psc_hashbkt_put(&msl_namecache_hashtbl, b);


even more

even more

--- mount_slash/dircache.c
+++ mount_slash/dircache.c
@@ -369,6 +369,7 @@
 			continue;
 		}

+		fci->fcid_count++;
 		INIT_PSC_LISTENTRY(&dce->dce_entry);
 		psclist_add_tail(&dce->dce_entry, &fci->fcid_entlist);

@@ -481,7 +482,7 @@
 	fci = fcmh_get_pri(d);
 	DIRCACHE_WRLOCK(d);
 	if (fci->fcid_count > msl_max_namecache_per_directory) {
-		OPSTAT("dircache-limit");
+		OPSTAT_INCR("dircache-limit");
 		DIRCACHE_ULOCK(d);
 		return;
 	}
@@ -554,13 +555,13 @@
 	tmpdce.dce_pino = fcmh_2_fid(d);
 	tmpdce.dce_key = dircache_hash(tmpdce.dce_pino, name, len);

-	psclist_del(&dce->dce_entry, &fci->fcid_entlist);
-
 	b = psc_hashbkt_get(&msl_namecache_hashtbl, &tmpdce.dce_key);
 	dce = _psc_hashbkt_search(&msl_namecache_hashtbl, b, 0,
 		dircache_ent_cmp, &tmpdce, NULL, NULL, &tmpdce.dce_key);
 	if (dce) {
+		fci->fcid_count--;
 		OPSTAT_INCR("msl.dircache-delete-hash");
+		psclist_del(&dce->dce_entry, &fci->fcid_entlist);
 		psc_hashbkt_del_item(&msl_namecache_hashtbl, b, dce);
 	} else
 		OPSTAT_INCR("msl.dircache-delete-noop");


temp fix for SLFID_NS, should probably set siteid of the fcmh.

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

--- mount_slash/fidc_cli.c
+++ mount_slash/fidc_cli.c
@@ -218,7 +218,7 @@
 	INIT_PSC_LISTENTRY(&fci->fci_lentry);
 	siteid = FID_GET_SITEID(fcmh_2_fid(f));

-	if (fcmh_2_fid(f) != SLFID_ROOT &&
+	if (fcmh_2_fid(f) != SLFID_ROOT && fcmh_2_fid(f) != SLFID_NS &&
 	    siteid != slc_rmc_resm->resm_siteid) {
 		s = libsl_siteid2site(siteid);
 		if (s == NULL) {


[draggable] Use ::captured-event instead of bubbled signals

The current dragging machinery is implemented through bubble-phase
signals for both motion and release. This prevents having the pointer
device from ever leaving the dragged actor, which is usually not what
you want.

Instead of using grabs we can use the capture-phase event handling
by simply attaching a handler to the ::captured-event signal on the
stage that contains a draggable actor.

The dragging must still be initiated by a ::button-press-event on
the draggable actor, but then it's all deferred to the ::captured-event
handler.

--- nbtk/nbtk-draggable.c
+++ nbtk/nbtk-draggable.c
@@ -28,7 +28,8 @@
   gfloat last_x;
   gfloat last_y;

-  guint emit_press : 1;
+  guint emit_delayed_press : 1;
+  guint in_drag            : 1;
 };

 enum
@@ -43,26 +44,22 @@
 static GQuark quark_draggable_context = 0;
 static guint draggable_signals[LAST_SIGNAL] = { 0, };

-static gboolean on_draggable_press   (ClutterActor       *actor,
-                                      ClutterButtonEvent *event,
-                                      gpointer            dummy);
-static gboolean on_draggable_motion  (ClutterActor       *actor,
-                                      ClutterMotionEvent *event,
-                                      gpointer            dummy);
-static gboolean on_draggable_release (ClutterActor       *actor,
-                                      ClutterButtonEvent *event,
-                                      gpointer            dummy);
+static gboolean on_stage_capture (ClutterActor *stage,
+                                  ClutterEvent *event,
+                                  DragContext  *context);

 static gboolean
-on_draggable_release (ClutterActor       *actor,
-                      ClutterButtonEvent *event,
-                      gpointer            data)
-{
-  DragContext *context = data;
+draggable_release (DragContext        *context,
+                   ClutterButtonEvent *event)
+{
+  ClutterActor *actor = CLUTTER_ACTOR (context->draggable);
+  ClutterActor *stage;
   ClutterUnit event_x, event_y;
   ClutterUnit actor_x, actor_y;
-  ClutterActor *stage;
   gboolean res;
+
+  if (!context->in_drag)
+    return FALSE;

   event_x = CLUTTER_UNITS_FROM_DEVICE (event->x);
   event_y = CLUTTER_UNITS_FROM_DEVICE (event->y);
@@ -75,37 +72,39 @@
   if (!res)
     return FALSE;

+  stage = clutter_actor_get_stage (actor);
+
   context->last_x = CLUTTER_UNITS_TO_FLOAT (actor_x);
   context->last_y = CLUTTER_UNITS_TO_FLOAT (actor_y);

-  g_signal_handlers_disconnect_by_func (actor,
-                                        G_CALLBACK (on_draggable_motion),
-                                        data);
-  g_signal_handlers_disconnect_by_func (actor,
-                                        G_CALLBACK (on_draggable_release),
-                                        data);
+  context->in_drag = FALSE;
+
+  g_signal_handlers_disconnect_by_func (stage,
+                                        G_CALLBACK (on_stage_capture),
+                                        context);

   g_signal_emit (context->draggable, draggable_signals[DRAG_END], 0,
                  context->last_x,
                  context->last_y);

-  stage = clutter_actor_get_stage (actor);
   g_object_set_data (G_OBJECT (stage), "nbtk-drag-actor", NULL);

   return FALSE;
 }

 static gboolean
-on_draggable_motion (ClutterActor       *actor,
-                     ClutterMotionEvent *event,
-                     gpointer            data)
-{
-  DragContext *context = data;
+draggable_motion (DragContext        *context,
+                  ClutterMotionEvent *event)
+{
+  NbtkDraggable *draggable = NBTK_DRAGGABLE (context->draggable);
+  ClutterActor *actor = CLUTTER_ACTOR (draggable);
   ClutterUnit event_x, event_y;
   ClutterUnit actor_x, actor_y;
   gfloat delta_x, delta_y;
-  ClutterActor *stage;
   gboolean res;
+
+  if (!context->in_drag)
+    return FALSE;

   event_x = CLUTTER_UNITS_FROM_DEVICE (event->x);
   event_y = CLUTTER_UNITS_FROM_DEVICE (event->y);
@@ -136,13 +135,13 @@
         delta_y = context->last_y - context->press_y;
     }

-  if (context->emit_press)
+  if (context->emit_delayed_press)
     {
       if (delta_x >= context->threshold || delta_y >= context->threshold)
         {
           ClutterActor *stage;

-          context->emit_press = FALSE;
+          context->emit_delayed_press = FALSE;

           g_signal_emit (context->draggable, draggable_signals[DRAG_BEGIN], 0,
                          context->press_x,
@@ -165,12 +164,36 @@
 }

 static gboolean
+on_stage_capture (ClutterActor *stage,
+                  ClutterEvent *event,
+                  DragContext  *context)
+{
+  switch (event->type)
+    {
+    case CLUTTER_MOTION:
+      if (context->in_drag)
+        return draggable_motion (context, (ClutterMotionEvent *) event);
+      break;
+
+    case CLUTTER_BUTTON_RELEASE:
+      if (context->in_drag)
+        return draggable_release (context, (ClutterButtonEvent *) event);
+      break;
+
+    default:
+      break;
+    }
+
+  return FALSE;
+}
+
+static gboolean
 on_draggable_press (ClutterActor       *actor,
                     ClutterButtonEvent *event,
-                    gpointer            dummy)
-{
-  NbtkDraggable *draggable = NBTK_DRAGGABLE (actor);
-  DragContext *context;
+                    DragContext        *context)
+{
+  NbtkDraggable *draggable = context->draggable;
+  ClutterActor *stage;
   ClutterUnit event_x, event_y;
   ClutterUnit actor_x, actor_y;
   gboolean res;
@@ -186,14 +209,15 @@
   if (!res)
     return FALSE;

-  context = g_object_get_qdata (G_OBJECT (draggable), quark_draggable_context);
+  stage = clutter_actor_get_stage (actor);
+
   context->press_x = CLUTTER_UNITS_TO_FLOAT (actor_x);
   context->press_y = CLUTTER_UNITS_TO_FLOAT (actor_y);
   context->last_x = context->press_x;
   context->last_y = context->press_y;
   context->press_button = event->button;
   context->press_modifiers = event->modifier_state;
-  context->emit_press = FALSE;
+  context->emit_delayed_press = FALSE;

   g_object_get (G_OBJECT (draggable),
                 "drag-threshold", &context->threshold,
@@ -202,28 +226,24 @@
                 "containment-area", &context->containment_area,
                 NULL);

-  g_signal_connect (actor,
-                    "motion-event", G_CALLBACK (on_draggable_motion),
-                    context);
-  g_signal_connect (actor,
-                    "button-release-event", G_CALLBACK (on_draggable_release),
-                    context);
-
   if (context->threshold == 0)
     {
-      ClutterActor *stage;
-
       g_signal_emit (draggable, draggable_signals[DRAG_BEGIN], 0,
                      context->press_x,
                      context->press_y,
                      context->press_button,
                      context->press_modifiers);

-      stage = clutter_actor_get_stage (actor);
       g_object_set_data (G_OBJECT (stage), "nbtk-drag-actor", actor);
     }
   else
-    context->emit_press = TRUE;
+    context->emit_delayed_press = TRUE;
+
+  context->in_drag = TRUE;
+
+  g_signal_connect_after (stage,
+                          "captured-event", G_CALLBACK (on_stage_capture),
+                          context);

   return FALSE;
 }
@@ -235,6 +255,8 @@
     {
       DragContext *context = data;

+      g_object_unref (context->draggable);
+
       if (context->containment_area)
         g_boxed_free (CLUTTER_TYPE_ACTOR_BOX, context->containment_area);

@@ -249,12 +271,15 @@

   context = g_slice_new (DragContext);

-  context->draggable = draggable;
+  context->draggable = g_object_ref (draggable);
   context->threshold = 0;
   context->axis = 0;
   context->containment = NBTK_DISABLE_CONTAINMENT;
   context->containment_area = NULL;
-
+  context->in_drag = FALSE;
+  context->emit_delayed_press = FALSE;
+
+  /* attach the context to the draggable */
   g_object_set_qdata_full (G_OBJECT (draggable), quark_draggable_context,
                            context,
                            drag_context_free);
@@ -266,10 +291,19 @@
 nbtk_draggable_real_enable (NbtkDraggable *draggable)
 {
   DragContext *context;
+  ClutterActor *stage;

   context = g_object_get_qdata (G_OBJECT (draggable), quark_draggable_context);
   if (G_UNLIKELY (context != NULL))
     return;
+
+  stage = clutter_actor_get_stage (CLUTTER_ACTOR (draggable));
+  if (G_UNLIKELY (stage == NULL))
+    {
+      g_warning ("Draggable actors can only be enabled when they "
+                 "on the stage");
+      return;
+    }

   context = drag_context_create (draggable);
   g_signal_connect (draggable,
@@ -283,19 +317,19 @@
 nbtk_draggable_real_disable (NbtkDraggable *draggable)
 {
   DragContext *context;
+  ClutterActor *stage;

   context = g_object_get_qdata (G_OBJECT (draggable), quark_draggable_context);
   if (G_UNLIKELY (context == NULL))
     return;

+  stage = clutter_actor_get_stage (CLUTTER_ACTOR (draggable));
+
   g_signal_handlers_disconnect_by_func (draggable,
                                         G_CALLBACK (on_draggable_press),
                                         context);
-  g_signal_handlers_disconnect_by_func (draggable,
-                                        G_CALLBACK (on_draggable_motion),
-                                        context);
-  g_signal_handlers_disconnect_by_func (draggable,
-                                        G_CALLBACK (on_draggable_release),
+  g_signal_handlers_disconnect_by_func (stage,
+                                        G_CALLBACK (on_stage_capture),
                                         context);

   g_object_set_qdata (G_OBJECT (draggable), quark_draggable_context, NULL);


try fix

try fix

--- mount_slash/fidc_cli.c
+++ mount_slash/fidc_cli.c
@@ -129,7 +129,10 @@
 			goto out;
 		}
 		if (fcmh_2_gen(f) < sstb->sst_gen) {
+#if 0
 			f->fcmh_flags |= FCMH_CLI_NEW_GENERATION;
+#endif
+			slc_fcmh_invalidate_bmap(f);
 			OPSTAT_INCR("msl.generation-forwards");
 			DEBUG_FCMH(PLL_DIAG, f, "attempt to set attr with "
 			    "gen %"PRIu64" from old gen %"PRIu64,


>  compile U201414800 sabertazimi Linux 17aa0d73d5e3 4.8.0-46-generic #49~16.04.1-Ubuntu SMP Fri Mar 31 14:51:03 UTC 2017 x86_64 GNU/Linux  03:04:46 up 2 days,  2:55,  3 users,  load average: 0.41, 0.45, 0.41 93b294222732f5d5e56d2579448257ad5d7bcfe

--- nemu/include/common.h
+++ nemu/include/common.h
@@ -2,7 +2,7 @@
 #define __COMMON_H__

 #define DEBUG
-#define DIFF_TEST
+// #define DIFF_TEST

 /* You will define this macro in PA2 */
 //#define HAS_IOE


batman-adv: Rm empty line from is_my_mac() in main.c

Signed-off-by: Martin Hundebøll <54669547a225ff20cba8b75a4adca540eef25858@hundeboll.net>
Signed-off-by: Marek Lindner <104240d543ffdbcddd3f116d866dc6166bffcd7a@yahoo.de>

--- net/batman-adv/main.c
+++ net/batman-adv/main.c
@@ -170,7 +170,6 @@
 	}
 	rcu_read_unlock();
 	return 0;
-
 }

 module_init(batman_init);


bluetooth: handle l2cap_create_connless_pdu() errors

l2cap_create_connless_pdu() can sometimes return ERR_PTR(-ENOMEM) or
ERR_PTR(-EFAULT).

Signed-off-by: Dan Carpenter <72501f147b2753e6660fdce744d9ac3084854f5e@gmail.com>
Acked-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/bluetooth/l2cap.c
+++ net/bluetooth/l2cap.c
@@ -1626,7 +1626,10 @@
 	/* Connectionless channel */
 	if (sk->sk_type == SOCK_DGRAM) {
 		skb = l2cap_create_connless_pdu(sk, msg, len);
-		err = l2cap_do_send(sk, skb);
+		if (IS_ERR(skb))
+			err = PTR_ERR(skb);
+		else
+			err = l2cap_do_send(sk, skb);
 		goto done;
 	}


libceph: set page alignment in start_request()

The page alignment field for a request is currently set in
ceph_osdc_build_request().  It's not needed at that point
nor do either of its callers need that value assigned at
any point before they call ceph_osdc_start_request().

So move that assignment into ceph_osdc_start_request().

Signed-off-by: Alex Elder <f429030cf5c0faf36fac3d102073b6e63a647baa@inktank.com>
Reviewed-by: Josh Durgin <51652c783f70f5b272ebd02f1fd20d3af7a2449f@inktank.com>

--- net/ceph/osd_client.c
+++ net/ceph/osd_client.c
@@ -399,7 +399,6 @@
 		data_len += len;
 	}
 	req->r_request->hdr.data_len = cpu_to_le32(data_len);
-	req->r_request->page_alignment = req->r_page_alignment;

 	BUG_ON(p > msg->front.iov_base + msg->front.iov_len);
 	msg_size = p - msg->front.iov_base;
@@ -1743,6 +1742,7 @@

 	req->r_request->pages = req->r_pages;
 	req->r_request->page_count = req->r_num_pages;
+	req->r_request->page_alignment = req->r_page_alignment;
 #ifdef CONFIG_BLOCK
 	req->r_request->bio = req->r_bio;
 #endif


tcp: fix corner case issue in segmentation during rexmitting

If cur_mss grew very recently so that the previously G/TSOed skb
now fits well into a single segment it would get send up in
parts unless we calculate # of segments again. This corner-case
could happen eg. after mtu probe completes or less than
previously sack blocks are required for the opposite direction.

Signed-off-by: Ilpo Järvinen <5801dcaebe162b451612454667e6a167cf0222c1@helsinki.fi>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/ipv4/tcp_output.c
+++ net/ipv4/tcp_output.c
@@ -1921,6 +1921,8 @@
 	if (skb->len > cur_mss) {
 		if (tcp_fragment(sk, skb, cur_mss, cur_mss))
 			return -ENOMEM; /* We'll try again later. */
+	} else {
+		tcp_init_tso_segs(sk, skb, cur_mss);
 	}

 	tcp_retrans_try_collapse(sk, skb, cur_mss);


rpc_pipefs: allow rpc_purge_list to take a NULL waitq pointer

In the event that we don't have a dentry for a rpc_pipefs pipe, we still
need to allow the queue_timeout job to clean out the queue. There's just
no waitq to wake up in that event.

Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org
Reported-by: Hans de Bruin <9f0aa46566224de49595f7e8eb4295c0de91d7d5@xmsnet.nl>
Reported-by: Joerg Platte <27ee6ecc1a7094fc3a72464b18d8f78fff8631eb@naasa.net>
Signed-off-by: Jeff Layton <4376fbf8623cd7b7c0232225289bb91cedc0a27f@redhat.com>
Signed-off-by: Trond Myklebust <6a1f9db795c9fc44be97d66ab114c53193bd3d13@netapp.com>

--- net/sunrpc/rpc_pipe.c
+++ net/sunrpc/rpc_pipe.c
@@ -71,7 +71,9 @@
 		msg->errno = err;
 		destroy_msg(msg);
 	} while (!list_empty(head));
-	wake_up(waitq);
+
+	if (waitq)
+		wake_up(waitq);
 }

 static void
@@ -91,11 +93,9 @@
 	}
 	dentry = dget(pipe->dentry);
 	spin_unlock(&pipe->lock);
-	if (dentry) {
-		rpc_purge_list(&RPC_I(dentry->d_inode)->waitq,
-			       &free_list, destroy_msg, -ETIMEDOUT);
-		dput(dentry);
-	}
+	rpc_purge_list(dentry ? &RPC_I(dentry->d_inode)->waitq : NULL,
+			&free_list, destroy_msg, -ETIMEDOUT);
+	dput(dentry);
 }

 ssize_t rpc_pipe_generic_upcall(struct file *filp, struct rpc_pipe_msg *msg,


SUNRPC: Use conventional switch statement when reclassifying sockets

Clean up.

Defensive coding: If "family" is ever something that is neither
AF_INET nor AF_INET6, xs_reclassify_socket6() is not the appropriate
default action.  Choose to do nothing in that case.

Introduced by commit 6bc9638a.

Signed-off-by: Chuck Lever <e7d8216bf9b1956703857d0050bd04192118f43d@oracle.com>
Signed-off-by: J. Bruce Fields <51738506c1b2ccb0761f23bdc612c93babf738ea@redhat.com>

--- net/sunrpc/xprtsock.c
+++ net/sunrpc/xprtsock.c
@@ -1558,7 +1558,7 @@
 			nloop++;
 	} while (err == -EADDRINUSE && nloop != 2);

-	if (myaddr.ss_family == PF_INET)
+	if (myaddr.ss_family == AF_INET)
 		dprintk("RPC:       %s %pI4:%u: %s (%d)\n", __func__,
 				&((struct sockaddr_in *)&myaddr)->sin_addr,
 				port, err ? "failed" : "ok", err);
@@ -1594,10 +1594,14 @@

 static inline void xs_reclassify_socket(int family, struct socket *sock)
 {
-	if (family == PF_INET)
+	switch (family) {
+	case AF_INET:
 		xs_reclassify_socket4(sock);
-	else
+		break;
+	case AF_INET6:
 		xs_reclassify_socket6(sock);
+		break;
+	}
 }
 #else
 static inline void xs_reclassify_socket4(struct socket *sock)


[XFRM] AUDIT: Fix flowlabel text format ambibuity.

Flowlabel text format was not correct and thus ambiguous.
For example, 0x00123 or 0x01203 are formatted as 0x123.
This is not what audit tools want.

Signed-off-by: YOSHIFUJI Hideaki <948b80da4254122ea1e8973dd9930d46b7654cf3@linux-ipv6.org>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/xfrm/xfrm_state.c
+++ net/xfrm/xfrm_state.c
@@ -2112,7 +2112,7 @@
 		iph6 = ipv6_hdr(skb);
 		audit_log_format(audit_buf,
 				 " src=" NIP6_FMT " dst=" NIP6_FMT
-				 " flowlbl=0x%x%x%x",
+				 " flowlbl=0x%x%02x%02x",
 				 NIP6(iph6->saddr),
 				 NIP6(iph6->daddr),
 				 iph6->flow_lbl[0] & 0x0f,


scheduler-nufa: fix initialization of refresh-interval

- refresh-interval was being reported as not provided in the options
    even when configured.
  - fixes bug reported in rt #1007

Signed-off-by: Anand V. Avati <6a1810c170bd423868ce2e225ecea39d80cade0f@amp.gluster.com>

--- scheduler/nufa/src/nufa.c
+++ scheduler/nufa/src/nufa.c
@@ -89,14 +89,16 @@
 		nufa_buf->min_free_disk = NUFA_LIMITS_MIN_FREE_DISK_DEFAULT;
 	}
 	data = dict_get (xl->options, "scheduler.refresh-interval");
-	if (data && (gf_string2time (data->data,
-				    &nufa_buf->refresh_interval) != 0)) {
-		gf_log ("nufa", GF_LOG_ERROR,
-			"invalid number format \"%s\" of "
-			"\"option scheduler.refresh-interval\"",
-			data->data);
-		return -1;
-	} else {
+	if (data != NULL) {
+                if (gf_string2time (data->data,
+				    &nufa_buf->refresh_interval) != 0) {
+                        gf_log ("nufa", GF_LOG_ERROR,
+                                "invalid number format \"%s\" of "
+                                "\"option scheduler.refresh-interval\"",
+                                data->data);
+                        return -1;
+                }
+        } else {
 		gf_log ("nufa", GF_LOG_WARNING,
 			"No option for scheduler.refresh-interval given, "
 			"defaulting it to 30");


Create IBuyer.h

Create IBuyer.h

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

--- src/IBuyer.h
+++ src/IBuyer.h
@@ -0,0 +1,48 @@
+/*
+ * IBuyer.h
+ *
+ *  Created on: Apr 16, 2014
+ *      Author: wilfeli
+ */
+
+#ifndef IBUYER_H_
+#define IBUYER_H_
+
+#include "PaymentSystem.h"
+
+class ContractHK;
+class Message;
+class MessageMarketLCheckBid;
+class MessageGoodC;
+
+
+class IBuyer: virtual public IPSAgent{
+public:
+
+	virtual ~IBuyer() {};
+	virtual double _mas_q_buy(Message*){return 0.0;}
+	virtual double get_status() = 0;
+};
+
+
+class IBuyerL: public IBuyer{
+public:
+	virtual Bid* ac_L() = 0;
+	virtual double _mas_q_buy(MessageMarketLCheckBid*) = 0;
+	virtual void _buy_asCHK(ContractHK*) = 0;
+	virtual ~IBuyerL() {};
+
+
+};
+
+class IBuyerC: public IBuyer{
+public:
+	virtual Bid* ac_C() = 0;
+	virtual double _mas_q_buy(MessageMarketCCheckBid*) = 0;
+	virtual ~IBuyerC() {};
+	virtual bool _PS_send_payment(MessagePSSendPayment*) = 0;
+	virtual void _buy_asGC(MessageGoodC*) = 0;
+
+};
+
+#endif /* IBUYER_H_ */


Rect bug fix

Rect bug fix

--- SOCEngine/SOCEngine/Math/Rect.h
+++ SOCEngine/SOCEngine/Math/Rect.h
@@ -14,7 +14,7 @@
 struct Rect
 {
 public:
-	Rect() : x(0), y(0) { }
+	Rect() : x(0), y(0), size(0, 0) { }
 	Rect(Type _x, Type _y, Type _w, Type _h) : x(_x), y(_y), size(_w, _h) { }

 public:


Fixing typos (refs #000)

Fixing typos (refs #000)

r23358

--- framework/include/postprocessors/PostprocessorInterface.h
+++ framework/include/postprocessors/PostprocessorInterface.h
@@ -37,7 +37,7 @@
    *
    * The name required by this method is the name that is hard-coded into
    * your source code. For example, if you have a Kernel that requires
-   * a Postprocessure you may have an input file with "pp = my_pp", this function
+   * a Postprocessor you may have an input file with "pp = my_pp", this function
    * requires the "pp" name as input (see .../moose_test/functions/PostprocessorFunction.C)
    *
    * see getPostprocessorValueOld getPostprocessorValueByName getPostprocessorValueOldByName
@@ -50,7 +50,7 @@
    * @return A reference to the desired value
    *
    * The name required by this method is the name defined in the input file. For example,
-   * if you have a Kernel that requires a Postprocesser you may have an input file with
+   * if you have a Kernel that requires a Postprocessor you may have an input file with
    * "pp = my_pp", this method requires the "my_pp" name as input
    * (see .../moose_test/functions/PostprocessorFunction.C)
    *
@@ -92,7 +92,7 @@
   THREAD_ID _pi_tid;

   /// PostprocessorInterface Parameters
-  InputParameters  _ppi_params;
+  InputParameters _ppi_params;
 };

 #endif //POSTPROCESSORINTERFACE_H


CMD fork

CMD fork

--- Server/src/process_function_2.c
+++ Server/src/process_function_2.c
@@ -70,6 +70,7 @@
   init_egg(&egg, this, info->t);
   list_push_front_new(info->egg, &egg, sizeof(egg));
   msgout_fork(this->cm.out);
+  pfk(this->monitor, this->id);
   return (TRUE);
 }