Remove some now-unneeded VMS controls

Remove some now-unneeded VMS controls

Reviewed-by: Richard Levitte <5fb523282dd7956571c80524edc2dccfa0bd8234@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3875)

--- crypto/rand/randfile.c
+++ crypto/rand/randfile.c
@@ -48,23 +48,14 @@
 #endif

 #define RAND_FILE_SIZE 1024
+#define RFILE ".rnd"

 #ifdef OPENSSL_SYS_VMS
 /*
- * Misc hacks needed for specific cases.
- *
  * __FILE_ptr32 is a type provided by DEC C headers (types.h specifically)
  * to make sure the FILE* is a 32-bit pointer no matter what.  We know that
- * stdio function return this type (a study of stdio.h proves it).
- */
-# if __INITIAL_POINTER_SIZE == 64
-#  pragma pointer_size save
-#  pragma pointer_size 32
-typedef char *char_ptr32;
-#  pragma pointer_size restore
-# endif
-
-/*
+ * stdio functions return this type (a study of stdio.h proves it).
+ *
  * This declaration is a nasty hack to get around vms' extension to fopen for
  * passing in sharing options being disabled by /STANDARD=ANSI89
  */
@@ -72,11 +63,8 @@
         (__FILE_ptr32 (*)(const char *, const char *, ...))fopen;
 # define VMS_OPEN_ATTRS \
         "shr=get,put,upd,del","ctx=bin,stm","rfm=stm","rat=none","mrs=0"
-
-# define openssl_fopen(fname,mode) vms_fopen((fname), (mode), VMS_OPEN_ATTRS)
-#endif
-
-#define RFILE ".rnd"
+# define openssl_fopen(fname, mode) vms_fopen((fname), (mode), VMS_OPEN_ATTRS)
+#endif

 /*
  * Note that these functions are intended for seed files only. Entropy


Fixup order from previous commit

Fixup order from previous commit

--- tools/merovingian/daemon/client.c
+++ tools/merovingian/daemon/client.c
@@ -363,7 +363,7 @@
 			/* we need to let the client login in order not to violate
 			 * the protocol */
 			mnstr_printf(fout, "void:merovingian:9:%s:BIG:%s:",
-					MONETDB5_PASSWDHASH, algos);
+					algos, MONETDB5_PASSWDHASH);
 			mnstr_flush(fout);
 			mnstr_read_block(fdin, buf, 8095, 1); /* eat away client response */
 			mnstr_printf(fout, "!monetdbd: an internal error has occurred, refer to the logs for details, please try again later\n");


Test the result of CMS_RecipientInfo_ktri_get0_algs() before using its output in rsa_cms_encrypt().

CLA: trivial

Reviewed-by: Rich Salz <c04971a99e5a9ee80eaab4b1deb37e845b0bd697@openssl.org>
Reviewed-by: Ben Kaduk <b34e9dc3dd24827b45bb22e8b76cde1bcb413b0e@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/4966)

--- crypto/rsa/rsa_ameth.c
+++ crypto/rsa/rsa_ameth.c
@@ -967,7 +967,8 @@
     int pad_mode = RSA_PKCS1_PADDING, rv = 0, labellen;
     unsigned char *label;

-    CMS_RecipientInfo_ktri_get0_algs(ri, NULL, NULL, &alg);
+    if (CMS_RecipientInfo_ktri_get0_algs(ri, NULL, NULL, &alg) <= 0)
+        return 0;
     if (pkctx) {
         if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <= 0)
             return 0;


RT1909: Omit version for v1 certificates

When calling X509_set_version to set v1 certificate, that
should mean that the version number field is omitted.

Reviewed-by: Dr. Stephen Henson <9ce5770b3bb4b2a1d59be2d97e34379cd192299f@openssl.org>

--- crypto/x509/x509_set.c
+++ crypto/x509/x509_set.c
@@ -66,6 +66,12 @@
 int X509_set_version(X509 *x, long version)
 	{
 	if (x == NULL) return(0);
+	if (version == 0)
+		{
+		M_ASN1_INTEGER_free(x->cert_info->version);
+		x->cert_info->version = NULL;
+		return(1);
+		}
 	if (x->cert_info->version == NULL)
 		{
 		if ((x->cert_info->version=M_ASN1_INTEGER_new()) == NULL)


Don't miss files...

Don't miss files...

--- crypto/x509/x509_vfy.c
+++ crypto/x509/x509_vfy.c
@@ -1147,6 +1147,12 @@
 	ctx->flags |= X509_V_FLAG_USE_CHECK_TIME;
 	}

+void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
+				  int (*verify_cb)(int, X509_STORE_CTX *))
+	{
+	ctx->verify_cb=verify_cb;
+	}
+
 IMPLEMENT_STACK_OF(X509)
 IMPLEMENT_ASN1_SET_OF(X509)


We set the export flag for 512 *bit* keys, not 512 *byte* ones. PR: 587

--- crypto/x509/x509type.c
+++ crypto/x509/x509type.c
@@ -112,7 +112,8 @@
 		break;
 		}

-	if (EVP_PKEY_size(pk) <= 512)
+	if (EVP_PKEY_size(pk) <= 512/8)	/* /8 because it's 512 bits we look
+					   for, not bytes */
 		ret|=EVP_PKT_EXP;
 	if(pkey==NULL) EVP_PKEY_free(pk);
 	return(ret);


ykcs11: ignore more attributes when creating objects

--- ykcs11/objects.c
+++ ykcs11/objects.c
@@ -1335,6 +1335,8 @@
     case CKA_SUBJECT:
     case CKA_ISSUER:
     case CKA_CERTIFICATE_TYPE:
+    case CKA_PRIVATE:
+    case CKA_SERIAL_NUMBER:
       // Ignore other attributes
       break;


added base client class sketch

added base client class sketch

--- yojimbo_client.h
+++ yojimbo_client.h
@@ -34,11 +34,6 @@
 {
     /**
         The set of client states.
-
-        @see Client::GetClientState
-        @see Client::IsConnecting
-        @see Client::IsConnected
-        @see Client::ConnectedFailed
      */

     enum ClientState
@@ -50,7 +45,7 @@
     };

     /**
-        Interface common to all client implementations.
+        Client interface.
      */

     class ClientInterface
@@ -62,13 +57,11 @@
         /**
             Set the context for reading and writing packets.

-            This lets you pass in a pointer to some structure that you want to have available when reading and writing packets.
+            This is optional. It lets you pass in a pointer to some structure that you want to have available when reading and writing packets via Stream::GetContext.

             Typical use case is to pass in an array of min/max ranges for values determined by some data that is loaded from a toolchain vs. being known at compile time.

-            If you do use a user context, make sure the same context data is set on client and server, and include a checksum of the context data in the protocol id.
-
-            @see Stream::GetContext
+            If you do use a context, make sure the same context data is set on client and server, and include a checksum of the context data in the protocol id.
          */

         virtual void SetContext( void * context ) = 0;
@@ -158,12 +151,47 @@
         virtual int GetClientIndex() const = 0;

         /**
-            Gets the current client time.
+            Get the current client time.

             @see Client::AdvanceTime
          */

         virtual double GetTime() const = 0;
+
+        /**
+            Get the protocol id.
+         */
+
+        virtual uint64_t GetProtocolId() const = 0;
+    };
+
+    /**
+        Functionality shared across all client implementations.
+     */
+
+    class BaseClient : public ClientInterface
+    {
+    public:
+
+        /**
+            The base client constructor.
+
+            @param allocator The allocator for all memory used by the client.
+            @param config The base client/server configuration.
+            @param time The current time in seconds. See Client::AdvanceTime
+         */
+
+        explicit BaseClient( Allocator & allocator, const ClientServerConfig & config, double time );
+
+        // ...
+
+    protected:
+
+        // ...
+
+    private:
+
+        // ...
     };
 }


Documentation for dictionary category

Documentation for dictionary category

--- RDHJSONAccessors/RDHJSONAccessors.h
+++ RDHJSONAccessors/RDHJSONAccessors.h
@@ -8,10 +8,90 @@

 #import <Foundation/Foundation.h>

+/**
+ * Allows easy runtime checking and accessing of objects in a `NSDictionary` when deserialising JSON.
+ */
 @interface NSDictionary (RDHJSONAccessors)
+
+#pragma mark - Checking if an Object Exists
+/// @name Checking if an Object Exists
+
+/// @returns `YES` if an object entry exists for the key, `NO` otherwise.
+-(BOOL)objectExistsForKey:(NSString *)aKey;
+
+
+#pragma mark - Checking for null
+/// @name Checking for null
+
+/// @returns `YES` if the object entry for the key is `[NSNull null]`, `NO` otherwise.
+-(BOOL)isObjectNullForKey:(NSString *)aKey;
+
+/// @returns the object entry for the key, or `nil` if the entry is `[NSNull null]`.
+-(id)objectOrNilIfNSNullForKey:(NSString *)aKey;
+
+
+#pragma mark - Accessing String Objects
+/// @name Accessing String Objects
+
+/// @returns the string object for the key, or `nil` if either the object cannot be coerced as a `NSString` or no object is present.
+-(NSString *)stringForKey:(NSString *)aKey;
+
+/// @returns the string object for the key, or `defaultValue` if either the object cannot be coerced as a `NSString` or no object is present.
+-(NSString *)stringForKey:(NSString *)aKey defaultValue:(NSString *)defaultValue;
+
+
+#pragma mark - Accessing Numbers Objects
+/// @name Accessing Numbers Objects
+
+/// @returns the number object for the key, or `nil` if either the object is not a `NSNumber` or no object is present.
+-(NSNumber *)numberForKey:(NSString *)aKey;
+
+/// @returns the number object for the key, or `defaultValue` if either the object cannot be coerced as `NSNumber` or no object is present.
+-(NSNumber *)numberForKey:(NSString *)aKey defaultValue:(NSNumber *)defaultValue;
+
+
+#pragma mark - Accessing Decimal Numbers Objects
+/// @name Accessing Decimal Numbers Objects
+
+/// @returns the number object for the key, or `nil` if either the object cannot be coerced as a `NSDecimalNumber` or no object is present.
+-(NSDecimalNumber *)decimalNumberForKey:(NSString *)aKey;
+
+/// @returns the number object for the key, or `defaultValue` if either the object cannot be coerced as `NSDecimalNumber` or no object is present.
+-(NSDecimalNumber *)decimalNumberForKey:(NSString *)aKey defaultValue:(NSDecimalNumber *)defaultValue;
+
+
+#pragma mark - Accessing Collection Objects
+/// @name Accessing Collection Objects
+
+/// @returns the dictionary object for the key, or `nil` if either the object is not a `NSDictionary` or no object is present.
+-(NSDictionary *)dictionaryForKey:(NSString *)aKey;
+
+/// @returns the array object for the key, or `nil` if either the object is not a `NSArray` or no object is present.
+-(NSArray *)arrayForKey:(NSString *)aKey;
+
+
+#pragma mark - Accessing Objects by Class
+/// @name Accessing Objects by Class
+
+/**
+ * @returns the object for the key, or `nil` if either the object is not of the provided class, cannot be coerced to the provided class or no object is present.
+ * @warning `cls` must be one of `NSString`, `NSNumber`, `NSDecimalNumber`, `NSNull`, `NSDictionary` or `NSArray`.
+ */
+-(id)objectForKey:(NSString *)aKey ofClass:(Class)cls;
+
+/**
+ * @returns the object for the key, or `defaultValue` if either the object is not of the provided class, cannot be coerced to the provided class or no object is present.
+ * @warning `cls` must be one of `NSString`, `NSNumber`, `NSDecimalNumber`, `NSNull`, `NSDictionary` or `NSArray`.
+ * @warning `defaultValue` must be of the same class as the provided class.
+ */
+-(id)objectForKey:(NSString *)aKey ofClass:(Class)cls defaultValue:(id)defaultValue;

 @end

+
+/**
+ * Allows easy runtime checking and accessing of objects in a `NSArray` when deserialising JSON.
+ */
 @interface NSArray (RDHJSONAccessors)

 @end


loop: prevent information leak after failed read

If read was not fully successful we have to fail whole bio to prevent
information leak of old pages

##Testcase_begin
dd if=/dev/zero of=./file bs=1M count=1
losetup /dev/loop0 ./file -o 4096
truncate -s 0 ./file
# OOps loop offset is now beyond i_size, so read will silently fail.
# So bio's pages would not be cleared, may which result in information leak.
hexdump -C /dev/loop0
##testcase_end

Signed-off-by: Dmitry Monakhov <eecfa5af1016ca9db755569d9919e212ab6a1c94@openvz.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@kernel.dk>

--- drivers/block/loop.c
+++ drivers/block/loop.c
@@ -372,7 +372,8 @@

 	if (retval < 0)
 		return retval;
-
+	if (retval != bvec->bv_len)
+		return -EIO;
 	return 0;
 }


blk: fix wrong idr_pre_get() error check in loop.c

The idr_pre_get() function never returns a value < 0.  It returns 0 (no
memory) or 1 (OK).

Reported-by: Silva Paulo <fe9a1b16845ea4b1355afe721608465c6027dc67@yahoo.com>
[ Rewrote Silva's patch, but attributing it to Silva anyway  - Linus ]
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/block/loop.c
+++ drivers/block/loop.c
@@ -1597,14 +1597,12 @@
 	struct gendisk *disk;
 	int err;

+	err = -ENOMEM;
 	lo = kzalloc(sizeof(*lo), GFP_KERNEL);
-	if (!lo) {
-		err = -ENOMEM;
+	if (!lo)
 		goto out;
-	}
-
-	err = idr_pre_get(&loop_index_idr, GFP_KERNEL);
-	if (err < 0)
+
+	if (!idr_pre_get(&loop_index_idr, GFP_KERNEL))
 		goto out_free_dev;

 	if (i >= 0) {


NVMe: Add a kthread to handle the congestion list

Instead of trying to resubmit I/Os in the I/O completion path (in
interrupt context), wake up a kthread which will resubmit I/O from
user context.  This allows mke2fs to run to completion.

Signed-off-by: Matthew Wilcox <ed1245e46949b7b8f2bca25d41520ebc8aeefcf8@intel.com>

--- drivers/block/nvme.c
+++ drivers/block/nvme.c
@@ -26,6 +26,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/kdev_t.h>
+#include <linux/kthread.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -50,10 +51,15 @@
 static int use_threaded_interrupts;
 module_param(use_threaded_interrupts, int, 0);

+static DEFINE_SPINLOCK(dev_list_lock);
+static LIST_HEAD(dev_list);
+static struct task_struct *nvme_thread;
+
 /*
  * Represents an NVM Express device.  Each nvme_dev is a PCI function.
  */
 struct nvme_dev {
+	struct list_head node;
 	struct nvme_queue **queues;
 	u32 __iomem *dbs;
 	struct pci_dev *pci_dev;
@@ -97,6 +103,7 @@
 	dma_addr_t sq_dma_addr;
 	dma_addr_t cq_dma_addr;
 	wait_queue_head_t sq_full;
+	wait_queue_t sq_cong_wait;
 	struct bio_list sq_cong;
 	u32 __iomem *q_db;
 	u16 q_depth;
@@ -107,8 +114,6 @@
 	u16 cq_phase;
 	unsigned long cmdid_data[];
 };
-
-static void nvme_resubmit_bio(struct nvme_queue *nvmeq, struct bio *bio);

 /*
  * Check we didin't inadvertently grow the command struct
@@ -309,9 +314,6 @@
 			bio_data_dir(bio) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
 	free_nbio(nvmeq, nbio);
 	bio_endio(bio, status ? -EIO : 0);
-	bio = bio_list_pop(&nvmeq->sq_cong);
-	if (bio)
-		nvme_resubmit_bio(nvmeq, bio);
 }

 /* length is in bytes */
@@ -482,16 +484,6 @@
 	return result;
 }

-static void nvme_resubmit_bio(struct nvme_queue *nvmeq, struct bio *bio)
-{
-	struct nvme_ns *ns = bio->bi_bdev->bd_disk->private_data;
-	if (nvme_submit_bio_queue(nvmeq, ns, bio))
-		bio_list_add_head(&nvmeq->sq_cong, bio);
-	else if (bio_list_empty(&nvmeq->sq_cong))
-		blk_clear_queue_congested(ns->queue, rw_is_sync(bio->bi_rw));
-	/* XXX: Need to duplicate the logic from __freed_request here */
-}
-
 /*
  * NB: return value of non-zero would mean that we were a stacking driver.
  * make_request must always succeed.
@@ -774,6 +766,7 @@
 	nvmeq->cq_head = 0;
 	nvmeq->cq_phase = 1;
 	init_waitqueue_head(&nvmeq->sq_full);
+	init_waitqueue_entry(&nvmeq->sq_cong_wait, nvme_thread);
 	bio_list_init(&nvmeq->sq_cong);
 	nvmeq->q_db = &dev->dbs[qid * 2];
 	nvmeq->q_depth = depth;
@@ -1097,6 +1090,43 @@
 	.ioctl		= nvme_ioctl,
 };

+static void nvme_resubmit_bios(struct nvme_queue *nvmeq)
+{
+	while (bio_list_peek(&nvmeq->sq_cong)) {
+		struct bio *bio = bio_list_pop(&nvmeq->sq_cong);
+		struct nvme_ns *ns = bio->bi_bdev->bd_disk->private_data;
+		if (nvme_submit_bio_queue(nvmeq, ns, bio)) {
+			bio_list_add_head(&nvmeq->sq_cong, bio);
+			break;
+		}
+	}
+}
+
+static int nvme_kthread(void *data)
+{
+	struct nvme_dev *dev;
+
+	while (!kthread_should_stop()) {
+		__set_current_state(TASK_RUNNING);
+		spin_lock(&dev_list_lock);
+		list_for_each_entry(dev, &dev_list, node) {
+			int i;
+			for (i = 0; i < dev->queue_count; i++) {
+				struct nvme_queue *nvmeq = dev->queues[i];
+				spin_lock_irq(&nvmeq->q_lock);
+				if (nvme_process_cq(nvmeq))
+					printk("process_cq did something\n");
+				nvme_resubmit_bios(nvmeq);
+				spin_unlock_irq(&nvmeq->q_lock);
+			}
+		}
+		spin_unlock(&dev_list_lock);
+		set_current_state(TASK_INTERRUPTIBLE);
+		schedule_timeout(HZ);
+	}
+	return 0;
+}
+
 static struct nvme_ns *nvme_alloc_ns(struct nvme_dev *dev, int index,
 			struct nvme_id_ns *id, struct nvme_lba_range_type *rt)
 {
@@ -1307,6 +1337,10 @@
 {
 	struct nvme_ns *ns, *next;

+	spin_lock(&dev_list_lock);
+	list_del(&dev->node);
+	spin_unlock(&dev_list_lock);
+
 	/* TODO: wait all I/O finished or cancel them */

 	list_for_each_entry_safe(ns, next, &dev->namespaces, list) {
@@ -1406,6 +1440,11 @@
 	result = nvme_dev_add(dev);
 	if (result)
 		goto delete;
+
+	spin_lock(&dev_list_lock);
+	list_add(&dev->node, &dev_list);
+	spin_unlock(&dev_list_lock);
+
 	return 0;

  delete:
@@ -1479,17 +1518,25 @@

 static int __init nvme_init(void)
 {
-	int result;
+	int result = -EBUSY;
+
+	nvme_thread = kthread_run(nvme_kthread, NULL, "nvme");
+	if (IS_ERR(nvme_thread))
+		return PTR_ERR(nvme_thread);

 	nvme_major = register_blkdev(nvme_major, "nvme");
 	if (nvme_major <= 0)
-		return -EBUSY;
+		goto kill_kthread;

 	result = pci_register_driver(&nvme_driver);
-	if (!result)
-		return 0;
-
+	if (result)
+		goto unregister_blkdev;
+	return 0;
+
+ unregister_blkdev:
 	unregister_blkdev(nvme_major, "nvme");
+ kill_kthread:
+	kthread_stop(nvme_thread);
 	return result;
 }

@@ -1497,6 +1544,7 @@
 {
 	pci_unregister_driver(&nvme_driver);
 	unregister_blkdev(nvme_major, "nvme");
+	kthread_stop(nvme_thread);
 }

 MODULE_AUTHOR("Matthew Wilcox <willy@linux.intel.com>");


NVMe: Optimise memory usage for I/Os between 4k and 128k

Add a second memory pool for smaller I/Os.  We can pack 16 of these on a
single page instead of using an entire page for each one.

Signed-off-by: Matthew Wilcox <ed1245e46949b7b8f2bca25d41520ebc8aeefcf8@intel.com>

--- drivers/block/nvme.c
+++ drivers/block/nvme.c
@@ -58,6 +58,7 @@
 	u32 __iomem *dbs;
 	struct pci_dev *pci_dev;
 	struct dma_pool *prp_page_pool;
+	struct dma_pool *prp_small_pool;
 	int instance;
 	int queue_count;
 	u32 ctrl_config;
@@ -249,11 +250,6 @@
 	return 0;
 }

-static __le64 *alloc_prp_list(struct nvme_dev *dev, dma_addr_t *addr)
-{
-	return dma_pool_alloc(dev->prp_page_pool, GFP_ATOMIC, addr);
-}
-
 struct nvme_prps {
 	int npages;
 	dma_addr_t first_dma;
@@ -271,6 +267,9 @@
 		return;

 	prp_dma = prps->first_dma;
+
+	if (prps->npages == 0)
+		dma_pool_free(dev->prp_small_pool, prps->list[0], prp_dma);
 	for (i = 0; i < prps->npages; i++) {
 		__le64 *prp_list = prps->list[i];
 		dma_addr_t next_prp_dma = le64_to_cpu(prp_list[last_prp]);
@@ -322,6 +321,7 @@
 					struct scatterlist *sg, int length)
 {
 	struct nvme_dev *dev = nvmeq->dev;
+	struct dma_pool *pool;
 	int dma_len = sg_dma_len(sg);
 	u64 dma_addr = sg_dma_address(sg);
 	int offset = offset_in_page(dma_addr);
@@ -352,9 +352,16 @@
 	nprps = DIV_ROUND_UP(length, PAGE_SIZE);
 	npages = DIV_ROUND_UP(8 * nprps, PAGE_SIZE);
 	prps = kmalloc(sizeof(*prps) + sizeof(__le64 *) * npages, GFP_ATOMIC);
-	prps->npages = npages;
 	prp_page = 0;
-	prp_list = alloc_prp_list(dev, &prp_dma);
+	if (nprps <= (256 / 8)) {
+		pool = dev->prp_small_pool;
+		prps->npages = 0;
+	} else {
+		pool = dev->prp_page_pool;
+		prps->npages = npages;
+	}
+
+	prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma);
 	prps->list[prp_page++] = prp_list;
 	prps->first_dma = prp_dma;
 	cmd->prp2 = cpu_to_le64(prp_dma);
@@ -362,7 +369,7 @@
 	for (;;) {
 		if (i == PAGE_SIZE / 8 - 1) {
 			__le64 *old_prp_list = prp_list;
-			prp_list = alloc_prp_list(dev, &prp_dma);
+			prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma);
 			prps->list[prp_page++] = prp_list;
 			old_prp_list[i] = cpu_to_le64(prp_dma);
 			i = 0;
@@ -1313,12 +1320,20 @@
 	if (!dev->prp_page_pool)
 		return -ENOMEM;

+	/* Optimisation for I/Os between 4k and 128k */
+	dev->prp_small_pool = dma_pool_create("prp list 256", dmadev,
+						256, 256, 0);
+	if (!dev->prp_small_pool) {
+		dma_pool_destroy(dev->prp_page_pool);
+		return -ENOMEM;
+	}
 	return 0;
 }

 static void nvme_release_prp_pools(struct nvme_dev *dev)
 {
 	dma_pool_destroy(dev->prp_page_pool);
+	dma_pool_destroy(dev->prp_small_pool);
 }

 /* XXX: Use an ida or something to let remove / add work correctly */


hwmon: (lm77) Convert to use devm_ functions

Convert to use devm_ functions to reduce code size and simplify the code.

Signed-off-by: Guenter Roeck <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@roeck-us.net>
Acked-by: Jean Delvare <49ad6a9f5aa17024c23048df346d55bda6837e01@linux-fr.org>

--- drivers/hwmon/lm77.c
+++ drivers/hwmon/lm77.c
@@ -343,11 +343,9 @@
 	struct lm77_data *data;
 	int err;

-	data = kzalloc(sizeof(struct lm77_data), GFP_KERNEL);
-	if (!data) {
-		err = -ENOMEM;
-		goto exit;
-	}
+	data = devm_kzalloc(dev, sizeof(struct lm77_data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;

 	i2c_set_clientdata(client, data);
 	data->valid = 0;
@@ -359,7 +357,7 @@
 	/* Register sysfs hooks */
 	err = sysfs_create_group(&dev->kobj, &lm77_group);
 	if (err)
-		goto exit_free;
+		return err;

 	data->hwmon_dev = hwmon_device_register(dev);
 	if (IS_ERR(data->hwmon_dev)) {
@@ -371,9 +369,6 @@

 exit_remove:
 	sysfs_remove_group(&dev->kobj, &lm77_group);
-exit_free:
-	kfree(data);
-exit:
 	return err;
 }

@@ -382,7 +377,6 @@
 	struct lm77_data *data = i2c_get_clientdata(client);
 	hwmon_device_unregister(data->hwmon_dev);
 	sysfs_remove_group(&client->dev.kobj, &lm77_group);
-	kfree(data);
 	return 0;
 }


hwmon: (lm85) Use function to remove sysfs attribute files

Signed-off-by: Guenter Roeck <32ce62c5480002985aec58d7044038218061ef55@ericsson.com>
Acked-by: Jean Delvare <49ad6a9f5aa17024c23048df346d55bda6837e01@linux-fr.org>

--- drivers/hwmon/lm85.c
+++ drivers/hwmon/lm85.c
@@ -1281,6 +1281,15 @@
 	return 0;
 }

+static void lm85_remove_files(struct i2c_client *client, struct lm85_data *data)
+{
+	sysfs_remove_group(&client->dev.kobj, &lm85_group);
+	if (!data->has_vid5)
+		sysfs_remove_group(&client->dev.kobj, &lm85_group_in4);
+	if (data->type == emc6d100)
+		sysfs_remove_group(&client->dev.kobj, &lm85_group_in567);
+}
+
 static int lm85_probe(struct i2c_client *client,
 		      const struct i2c_device_id *id)
 {
@@ -1349,10 +1358,7 @@

 	/* Error out and cleanup code */
  err_remove_files:
-	sysfs_remove_group(&client->dev.kobj, &lm85_group);
-	sysfs_remove_group(&client->dev.kobj, &lm85_group_in4);
-	if (data->type == emc6d100)
-		sysfs_remove_group(&client->dev.kobj, &lm85_group_in567);
+	lm85_remove_files(client, data);
  err_kfree:
 	kfree(data);
 	return err;
@@ -1362,10 +1368,7 @@
 {
 	struct lm85_data *data = i2c_get_clientdata(client);
 	hwmon_device_unregister(data->hwmon_dev);
-	sysfs_remove_group(&client->dev.kobj, &lm85_group);
-	sysfs_remove_group(&client->dev.kobj, &lm85_group_in4);
-	if (data->type == emc6d100)
-		sysfs_remove_group(&client->dev.kobj, &lm85_group_in567);
+	lm85_remove_files(client, data);
 	kfree(data);
 	return 0;
 }


ide: BUG() on unknown flags in ide_disk_special()

Signed-off-by: Bartlomiej Zolnierkiewicz <248de9df611a028e5eceb9d893a2ed6c24c89ef4@gmail.com>

--- drivers/ide/ide-io.c
+++ drivers/ide/ide-io.c
@@ -201,12 +201,8 @@
 	} else if (s->b.set_multmode) {
 		s->b.set_multmode = 0;
 		ide_tf_set_setmult_cmd(drive, &cmd.tf);
-	} else if (s->all) {
-		int special = s->all;
-		s->all = 0;
-		printk(KERN_ERR "%s: bad special flag: 0x%02x\n", drive->name, special);
-		return ide_stopped;
-	}
+	} else
+		BUG();

 	cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
 	cmd.valid.in.tf  = IDE_VALID_IN_TF  | IDE_VALID_DEVICE;


serial: mfd: fix bug in serial_hsu_remove()

Medfield HSU driver deal with 4 pci devices(3 uart ports + 1 dma controller),
so in pci remove func, we need handle them differently

Signed-off-by: Feng Tang <7685a6702c33a8c01ef22193062cb8069601cb3e@intel.com>
Signed-off-by: Alan Cox <91e38e63b890fbb214c8914809fde03c73e7f24d@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/serial/mfd.c
+++ drivers/serial/mfd.c
@@ -1423,7 +1423,6 @@
 	}

 	phsu = hsu;
-
 	hsu_debugfs_init(hsu);
 	return;

@@ -1435,18 +1434,20 @@

 static void serial_hsu_remove(struct pci_dev *pdev)
 {
-	struct hsu_port *hsu;
-	int i;
-
-	hsu = pci_get_drvdata(pdev);
-	if (!hsu)
+	void *priv = pci_get_drvdata(pdev);
+	struct uart_hsu_port *up;
+
+	if (!priv)
 		return;

-	for (i = 0; i < 3; i++)
-		uart_remove_one_port(&serial_hsu_reg, &hsu->port[i].port);
+	/* For port 0/1/2, priv is the address of uart_hsu_port */
+	if (pdev->device != 0x081E) {
+		up = priv;
+		uart_remove_one_port(&serial_hsu_reg, &up->port);
+	}

 	pci_set_drvdata(pdev, NULL);
-	free_irq(hsu->irq, hsu);
+	free_irq(pdev->irq, priv);
 	pci_disable_device(pdev);
 }


xen: Use new irq_move functions

xen: Use new irq_move functions

These functions take irq_data as an argument and avoid a redundant
lookup in the sparse irq case.

Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: Ian Campbell <9be92b3dbbd6611e3e4c9209fb3d04b4919e7cca@citrix.com>
Cc: Jeremy Fitzhardinge <b3f594e10a9edcf5413cf1190121d45078c62290@goop.org>
Cc: Konrad Rzeszutek Wilk <da3a51b335cef0eb0e2c329c5ef6bcd6acef687a@oracle.com>

--- drivers/xen/events.c
+++ drivers/xen/events.c
@@ -585,7 +585,7 @@
 {
 	int evtchn = evtchn_from_irq(data->irq);

-	move_native_irq(data->irq);
+	irq_move_irq(data);

 	if (VALID_EVTCHN(evtchn)) {
 		mask_evtchn(evtchn);
@@ -1339,7 +1339,7 @@
 {
 	int evtchn = evtchn_from_irq(data->irq);

-	move_masked_irq(data->irq);
+	irq_move_masked_irq(data);

 	if (VALID_EVTCHN(evtchn))
 		unmask_evtchn(evtchn);


improve network error logging during gc

improve network error logging during gc

--- cvmfs/object_fetcher.h
+++ cvmfs/object_fetcher.h
@@ -592,10 +592,6 @@
     const bool success = (retval == download::kFailOk);
     fclose(f);

-    static int test_fail = 0;
-    if (test_fail++ == 6)
-      return BaseTN::kFailNetwork;
-
     // check if download worked and remove temporary file if not
     if (!success) {
       LogCvmfs(kLogDownload, kLogDebug, "failed to download file "
@@ -614,13 +610,18 @@
         case download::kFailProxyResolve:
         case download::kFailHostResolve:
         case download::kFailUnsupportedProtocol:
+          LogCvmfs(kLogDownload, kLogDebug | kLogStderr,
+                   "unsupported protocol: %s", url.c_str());
           return BaseTN::kFailNetwork;

         case download::kFailProxyHttp:
         case download::kFailHostHttp:
-          return (download_job.http_code == 404)
-            ? BaseTN::kFailNotFound
-            : BaseTN::kFailNetwork;
+          if (download_job.http_code == 404)
+            return BaseTN::kFailNotFound;
+          LogCvmfs(kLogDownload, kLogDebug | kLogStderr,
+                   "HTTP protocol error %d: %s (%d)",
+                   download_job.http_code, url.c_str(), retval);
+          return BaseTN::kFailNetwork;

         case download::kFailBadData:
         case download::kFailTooBig:
@@ -628,7 +629,11 @@

         default:
           if (download::IsProxyTransferError(retval) ||
-              download::IsHostTransferError(retval)) {
+              download::IsHostTransferError(retval))
+          {
+            LogCvmfs(kLogDownload, kLogDebug | kLogStderr,
+                     "HTTP transfer error %d (HTTP code %d): %s",
+                     retval, download_job.http_code, url.c_str());
             return BaseTN::kFailNetwork;
           }
           return BaseTN::kFailUnknown;


Fix sorting algorithm to add same pkgs with different transaction reasons.

--- lib/transaction_sortdeps.c
+++ lib/transaction_sortdeps.c
@@ -165,6 +165,7 @@
 				pkgdep_release(pd);
 				continue;
 			}
+			prop_array_add(sorted, pd->d);
 		}
 		pkgdep_release(pd);
 	}


ecalength: suppress a compiler warning

ecalength: suppress a compiler warning

Comparison of unsigned and signed integer.

--- ecatools/ecalength.c
+++ ecatools/ecalength.c
@@ -78,10 +78,10 @@

 int main(int argc, char *argv[]) {
   char cmd[512], fstring[16], status = 0, *optstr = "ftsmhbcra:u";
-  int curopt;
+  int curopt, curarg;
   unsigned char sec;
   float curfilelength, totlength = 0;
-  unsigned int min, curarg;
+  unsigned int min;
   FILE *file;
   struct options opts;


XdgAppInstallation: Add documentation

XdgAppInstallation: Add documentation

--- lib/xdg-app-installation.c
+++ lib/xdg-app-installation.c
@@ -33,6 +33,23 @@
 #include "xdg-app-run.h"
 #include "xdg-app-error.h"

+/**
+ * SECTION:xdg-app-installation
+ * @Title: XdgAppInstallation
+ * @Short_description: Installation information
+ *
+ * XdgAppInstallation is the toplevel object that software installers
+ * should use to operate on an xdg-apps.
+ *
+ * An XdgAppInstallation object provides information about an installation
+ * location for xdg-app applications. Typical installation locations are either
+ * system-wide (in /var/lib/xdg-app) or per-user (in ~/.local/share/xdg-app).
+ *
+ * XdgAppInstallation can list configured remotes as well as installed application
+ * and runtime references (in short: refs). It can also run, install, update and
+ * uninstall applications and runtimes.
+ */
+
 typedef struct _XdgAppInstallationPrivate XdgAppInstallationPrivate;

 struct _XdgAppInstallationPrivate
@@ -125,6 +142,15 @@
   return self;
 }

+/**
+ * xdg_app_installation_new_system:
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Creates a new #XdgAppInstallation for the system-wide installation.
+ *
+ * Returns: (transfer full): a new #XdgAppInstallation
+ */
 XdgAppInstallation *
 xdg_app_installation_new_system (GCancellable *cancellable,
                                  GError **error)
@@ -132,6 +158,15 @@
   return xdg_app_installation_new_for_dir (xdg_app_dir_get_system (), cancellable, error);
 }

+/**
+ * xdg_app_installation_new_user:
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Creates a new #XdgAppInstallation for the per-user installation.
+ *
+ * Returns: (transfer full): a new #XdgAppInstallation
+ */
 XdgAppInstallation *
 xdg_app_installation_new_user (GCancellable *cancellable,
                                GError **error)
@@ -139,6 +174,17 @@
   return xdg_app_installation_new_for_dir (xdg_app_dir_get_user (), cancellable, error);
 }

+/**
+ * xdg_app_installation_new_for_path:
+ * @path: a #GFile
+ * @user: whether this is a user-specific location
+ * @cancellable: (nullable): a #GCancellabel
+ * @error: return location for a #GError
+ *
+ * Creates a new #XdgAppInstallation for the installation at the given @path.
+ *
+ * Returns: (transfer full): a new #XdgAppInstallation
+ */
 XdgAppInstallation *
 xdg_app_installation_new_for_path (GFile *path, gboolean user,
                                    GCancellable *cancellable,
@@ -147,6 +193,14 @@
   return xdg_app_installation_new_for_dir (xdg_app_dir_new (path, user), cancellable, error);
 }

+/**
+ * xdg_app_installation_get_is_user:
+ * @self: a #XdgAppInstallation
+ *
+ * Returns whether the installation is for a user-specific location.
+ *
+ * Returns: %TRUE if @self is a per-user installation
+ */
 gboolean
 xdg_app_installation_get_is_user (XdgAppInstallation *self)
 {
@@ -156,7 +210,10 @@
 }

 /**
- * xdg_app_installation_get_path
+ * xdg_app_installation_get_path:
+ * @self: a #XdgAppInstallation
+ *
+ * Returns the installation location for @self.
  *
  * Returns: (transfer full): an #GFile
  */
@@ -173,7 +230,7 @@
  * @self: a #XdgAppInstallation
  * @name: name of the app to launch
  * @arch: (nullable): which architecture to launch (default: current architecture)
- * @branch: (nullable): which branch of the application (default: 'master')
+ * @branch: (nullable): which branch of the application (default: "master")
  * @commit: (nullable): the commit of @branch to launch
  * @cancellable: (nullable): a #GCancellable
  * @error: return location for a #GError
@@ -184,6 +241,7 @@
  * xdg_app_installation_get_current_installed_app() to find out what builds
  * are available, in order to get a value for @commit.
  *
+ * Returns: %TRUE, unless an error occurred
  */
 gboolean
 xdg_app_installation_launch (XdgAppInstallation  *self,
@@ -277,14 +335,14 @@
  * @kind: whether this is an app or runtime
  * @name: name of the app/runtime to fetch
  * @arch: (nullable): which architecture to fetch (default: current architecture)
- * @branch: (nullable): which branch to fetch (default: 'master')
- * @cancellable: (nullable): a #GCancellable
- * @error: return location for a #GError
- *
- * Returns information about an installed app or runtime, such as the
- * available builds, its size, location, etc.
- *
- * Returns: (transfer full): an #XdgAppInstalledRef
+ * @branch: (nullable): which branch to fetch (default: "master")
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Returns information about an installed ref, such as the available builds,
+ * its size, location, etc.
+ *
+ * Returns: (transfer full): an #XdgAppInstalledRef, or %NULL if an error occurred
  */
 XdgAppInstalledRef *
 xdg_app_installation_get_installed_ref (XdgAppInstallation *self,
@@ -327,9 +385,9 @@
  * @cancellable: (nullable): a #GCancellable
  * @error: return location for a #GError
  *
- * Get the last build of app @name that was installed with
- * xdg_app_installation_install(), or %NULL if the app has never been installed
- * locally.
+ * Get the last build of reference @name that was installed with
+ * xdg_app_installation_install(), or %NULL if the reference has
+ * never been installed locally.
  *
  * Returns: (transfer full): an #XdgAppInstalledRef
  */
@@ -531,7 +589,7 @@
  * @error: return location for a #GError
  *
  * Lists the remotes, in priority (highest first) order. For same priority,
- * earlier added remote comes before a later added one.
+ * an earlier added remote comes before a later added one.
  *
  * Returns: (transfer container) (element-type XdgAppRemote): an GPtrArray of
  *   #XdgAppRemote instances
@@ -593,6 +651,18 @@
   return NULL;
 }

+/**
+ * xdg_app_installation_load_app_overrides:
+ * @self: a #XdgAppInstallation
+ * @app_id: an application id
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Loads the metadata overrides file for an application.
+ *
+ * Returns: (transfer full): the contents of the overrides files,
+ *    or %NULL if an error occurred
+ */
 char *
 xdg_app_installation_load_app_overrides  (XdgAppInstallation *self,
                                           const char *app_id,
@@ -724,7 +794,7 @@
  * @cancellable: (nullable): a #GCancellable
  * @error: return location for a #GError
  *
- * Install a new ref from a bundle.
+ * Install an application or runtime from a bundle.
  *
  * Returns: (transfer full): The ref for the newly installed app or %NULL on failure
  */
@@ -867,7 +937,7 @@
  * @cancellable: (nullable): a #GCancellable
  * @error: return location for a #GError
  *
- * Install a new ref.
+ * Install a new application or runtime.
  *
  * Returns: (transfer full): The ref for the newly installed app or %NULL on failure
  */
@@ -991,7 +1061,7 @@
  * @cancellable: (nullable): a #GCancellable
  * @error: return location for a #GError
  *
- * Update a ref.
+ * Update an application or runtime.
  *
  * Returns: (transfer full): The ref for the newly updated app (or the same if no update) or %NULL on failure
  */
@@ -1109,7 +1179,7 @@
  * @cancellable: (nullable): a #GCancellable
  * @error: return location for a #GError
  *
- * Update a ref.
+ * Uninstall an application or runtime.
  *
  * Returns: %TRUE on success
  */
@@ -1205,7 +1275,22 @@
   return TRUE;
 }

-
+/**
+ * xdg_app_installation_fetch_remote_size_sync:
+ * @self: a #XdgAppInstallation
+ * @remote_name: the name of the remote
+ * @commit: the commit
+ * @download_size: (out): return location for the download size
+ * @installed_size: (out): return location for the installed size
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Gets information about the amount of data that needs to be transferred
+ * to pull a commit from a remote repository, and about the amount of
+ * local disk space that is required to check out this commit.
+ *
+ * Returns: %TRUE, unless an error occurred
+ */
 gboolean
 xdg_app_installation_fetch_remote_size_sync (XdgAppInstallation  *self,
                                              const char          *remote_name,
@@ -1226,6 +1311,19 @@
                                   error);
 }

+/**
+ * xdg_app_installation_fetch_remote_metadata_sync:
+ * @self: a #XdgAppInstallation
+ * @remote_name: the name of the remote
+ * @commit: the commit
+ * @cancellable: (nullable): a #GCancellable
+ * @error: return location for a #GError
+ *
+ * Obtains the metadata file from a commit.
+ *
+ * Returns: (transfer full): a #GBytes containing the xdg-app metadata file,
+ *   or %NULL if an error occurred
+ */
 GBytes *
 xdg_app_installation_fetch_remote_metadata_sync (XdgAppInstallation *self,
                                                  const char *remote_name,
@@ -1255,7 +1353,7 @@
  * @cancellable: (nullable): a #GCancellable
  * @error: return location for a #GError
  *
- * Lists all the refs in a remote.
+ * Lists all the applications and runtimes in a remote.
  *
  * Returns: (transfer container) (element-type XdgAppRemoteRef): an GPtrArray of
  *   #XdgAppRemoteRef instances
@@ -1421,7 +1519,9 @@
  * @cancellable: (nullable): a #GCancellable
  * @error: return location for a #GError
  *
- * Gets the current remote branch of a ref in the remote.
+ * Gets monitor object for the installation. The returned file monitor will
+ * emit the #GFileMonitor::changed signal whenever an application or runtime
+ * was installed, uninstalled or updated.
  *
  * Returns: (transfer full): a new #GFileMonitor instance, or %NULL on error
  */


trivial: Fix applications doing Icon=/usr/share/pixmaps/app.png

--- libappstream-glib/as-app.c
+++ libappstream-glib/as-app.c
@@ -3824,9 +3824,6 @@
 					     NULL);
 		if (tmp != NULL && tmp[0] != '\0') {
 			AsIcon *icon;
-			dot = g_strstr_len (tmp, -1, ".");
-			if (dot != NULL)
-				*dot = '\0';
 			icon = as_icon_new ();
 			as_icon_set_name (icon, tmp, -1);
 			dot = g_strstr_len (tmp, -1, ".");


Do not include <metadata> for pre-0.4 metadata

--- libappstream-glib/as-app.c
+++ libappstream-glib/as-app.c
@@ -2093,7 +2093,7 @@
 		as_app_node_insert_languages (app, node_app);

 	/* <metadata> */
-	if (g_hash_table_size (priv->metadata) > 0) {
+	if (g_hash_table_size (priv->metadata) > 0 && api_version >= 0.4) {
 		node_tmp = as_node_insert (node_app, "metadata", NULL, 0, NULL);
 		as_node_insert_hash (node_tmp, "value", "key", priv->metadata, FALSE);
 	}


reverted back because of side effects

reverted back because of side effects

--- libasn1parser/asn1p_list.h
+++ libasn1parser/asn1p_list.h
@@ -39,9 +39,10 @@

 /* MSVC does not have typeof(), cannot prevent side effects! */
 #define	TQ_ADD(head, xel, field) do {			\
-	assert(TQ_NEXT((xel), field) == 0);		\
-        *(head)->tq_tail = (xel);			\
-        (head)->tq_tail = &TQ_NEXT((xel), field);	\
+	typeof(xel) __el = (xel);			\
+	assert(TQ_NEXT((__el), field) == 0);		\
+        *(head)->tq_tail = (__el);			\
+        (head)->tq_tail = &TQ_NEXT((__el), field);	\
 	} while(0)

 /*


typo in the gcc handmade regalloc trigger

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@5297 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

--- libavcodec/ppc/gcc_fixes.h
+++ libavcodec/ppc/gcc_fixes.h
@@ -23,9 +23,9 @@
 #define AVV(x...) {x}

 #if (__GNUC__ < 4)
+# define REG_v(a)
+#else
 # define REG_v(a) asm ( #a )
-#else
-# define REG_v(a)
 #endif

 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 303)


Fixed #6989: Use X509_STORE_set_default_paths

--- libfreerdp/crypto/crypto.c
+++ libfreerdp/crypto/crypto.c
@@ -842,9 +842,7 @@
 	                    NULL);
 #endif

-	lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
-
-	if (lookup == NULL)
+	if (X509_STORE_set_default_paths(cert_ctx) != 1)
 		goto end;

 	lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());


libgnome-panel: increment GP_MODULE_ABI_VERSION

--- libgnome-panel/gp-module.h
+++ libgnome-panel/gp-module.h
@@ -28,7 +28,7 @@
  *
  * The version of the module system's ABI.
  */
-#define GP_MODULE_ABI_VERSION 0x0001
+#define GP_MODULE_ABI_VERSION 0x0002

 /**
  * GpGetAppletInfoFunc:


Fixed crash in gnutls: In case handshake will fail a further call to gnutls_bye function will lead in a crash. Therefore we free the ssl handle immediately after handshake failed.

--- libmariadb/secure/gnutls.c
+++ libmariadb/secure/gnutls.c
@@ -235,12 +235,14 @@
 static int ma_gnutls_set_ciphers(gnutls_session_t ssl, char *cipher_str)
 {
   const char *err;
-  char *token= strtok(cipher_str, ":");
+  char *token;
 #define PRIO_SIZE 1024
   char prio[PRIO_SIZE];

-  if (!token)
+  if (!cipher_str)
     return gnutls_priority_set_direct(ssl, "NORMAL", &err);
+
+  token= strtok(cipher_str, ":");

   strcpy(prio, "NONE:+VERS-TLS-ALL:+SIGN-ALL:+COMP-NULL");

@@ -386,6 +388,8 @@
   {
     ma_tls_set_error(mysql, ret);
     /* restore blocking mode */
+    gnutls_deinit((gnutls_session_t )ctls->ssl);
+    ctls->ssl= NULL;
     if (!blocking)
       pvio->methods->blocking(pvio, FALSE, 0);
     return 1;
@@ -407,10 +411,12 @@

 my_bool ma_tls_close(MARIADB_TLS *ctls)
 {
-  gnutls_bye((gnutls_session_t )ctls->ssl, GNUTLS_SHUT_WR);
-  gnutls_deinit((gnutls_session_t )ctls->ssl);
-  ctls->ssl= NULL;
-
+  if (ctls->ssl)
+  {
+    gnutls_bye((gnutls_session_t )ctls->ssl, GNUTLS_SHUT_WR);
+    gnutls_deinit((gnutls_session_t )ctls->ssl);
+    ctls->ssl= NULL;
+  }
   return 0;
 }


Fix for warning about "implicit declaration of function 'isblank'"
Patch by Justin Bronder

git-svn-id: 27e0aca8c7a52a9ae65dfba2e16879604119af8c@1967 93a4e39c-3214-0410-bb16-828d8e3bcd0f

--- libmetrics/linux/metrics.c
+++ libmetrics/linux/metrics.c
@@ -1,5 +1,8 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
+#ifndef __USE_ISOC99
+#define __USE_ISOC99
 #endif

 #include <stdio.h>


fix coding style issues

fix coding style issues

Signed-off-by: Jerry Yu <c6cd1413a9492a82cc7fe506fb3a273f7dc9927d@arm.com>

--- library/ssl_tls13_server.c
+++ library/ssl_tls13_server.c
@@ -1106,7 +1106,6 @@
     MBEDTLS_SSL_DEBUG_MSG(
         3, ( "switching to new transform spec for outbound data" ) );

-
     return( 0 );
 }

@@ -1124,6 +1123,7 @@
     unsigned char *p = buf;
     size_t extensions_len = 0;
     unsigned char *p_extensions_len;
+
     *out_len = 0;

     MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );


А если так

А если так

--- libs/compiler/expression.c
+++ libs/compiler/expression.c
@@ -17,37 +17,37 @@
 #include "expression.h"

-inline expression expression_create(const node expr)
+expression expression_create(const node expr)
 {
 	return (expression){ .is_valid = true, .nd = expr };
 }

-inline expression expression_broken(void)
+expression expression_broken(void)
 {
 	return (expression){ .is_valid = false };
 }

-inline bool expression_is_valid(const expression expr)
+bool expression_is_valid(const expression expr)
 {
    return expr.is_valid;
 }

-inline item_t expression_get_type(const expression expr)
+item_t expression_get_type(const expression expr)
 {
    return node_get_arg(&expr.nd, 0);
 }

-inline bool expression_is_lvalue(const expression expr)
+bool expression_is_lvalue(const expression expr)
 {
    return node_get_arg(&expr.nd, 1) == LVALUE;
 }

-inline location expression_get_location(const expression expr)
+location expression_get_location(const expression expr)
 {
    return (location){ (size_t)node_get_arg(&expr.nd, 2), (size_t)node_get_arg(&expr.nd, 3) };
 }

-inline node expression_get_node(const expression expr)
+node expression_get_node(const expression expr)
 {
 	return expr.nd;
 }


missing include

missing include

--- libvips/conversion/scale.c
+++ libvips/conversion/scale.c
@@ -54,6 +54,7 @@

 #include <stdio.h>
 #include <stdlib.h>
+#include <math.h>

 #include <vips/vips.h>


add note on profile types

add note on profile types

--- libvips/foreign/heifload.c
+++ libvips/foreign/heifload.c
@@ -178,24 +178,22 @@
 static int
 vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
 {
-	guint width;
-	guint height;
-	gboolean has_alpha;
-	guint bands;
+	enum heif_color_profile_type profile_type =
+		heif_image_handle_get_color_profile_type( heif->handle );
+	int width = heif_image_handle_get_width( heif->handle );
+	int height = heif_image_handle_get_height( heif->handle );
+	/* FIXME none of the Nokia test images seem to set this true.
+	 */
+	gboolean has_alpha =
+		heif_image_handle_has_alpha_channel( heif->handle );
+	int bands = has_alpha ? 4 : 3;
+
 	/* Surely, 16 will be enough for anyone.
 	 */
 	heif_item_id id[16];
 	int n_metadata;
 	int i;
 	struct heif_error error;
-
-	width = heif_image_handle_get_width( heif->handle );
-	height = heif_image_handle_get_height( heif->handle );
-
-	/* FIXME none of the Nokia test images seem to set this true.
-	 */
-	has_alpha = heif_image_handle_has_alpha_channel( heif->handle );
-	bands = has_alpha ? 4 : 3;

 	vips_image_pipelinev( out, VIPS_DEMAND_STYLE_SMALLTILE, NULL );
 	vips_image_init_fields( out,
@@ -247,6 +245,31 @@
 			(void) vips__exif_parse( out );
 	}

+	switch( profile_type ) {
+	case heif_color_profile_type_not_present:
+		printf( "no profile\n" );
+		break;
+
+	case heif_color_profile_type_nclx:
+		printf( "nclx profile\n" );
+		break;
+
+	case heif_color_profile_type_rICC:
+		printf( "rICC profile\n" );
+		break;
+
+	case heif_color_profile_type_prof:
+		printf( "prof profile\n" );
+		break;
+
+	default:
+		printf( "unknown profile type\n" );
+		break;
+	}
+
+	/* FIXME should probably check the profile type ... lcms seems to be
+	 * able to load at least rICC and prof.
+	 */
 	if( heif_image_handle_get_color_profile_type( heif->handle ) ) {
 		size_t length = heif_image_handle_get_raw_color_profile_size(
 			heif->handle );


works with fflaflas 111

works with fflaflas 111

--- linbox/linbox/util/debug.h
+++ linbox/linbox/util/debug.h
@@ -242,86 +242,7 @@
 #include <linbox/util/debug.C>
 #endif

-namespace std
-{
-	/*! Prints a vector on output.
-	 * @param o output stream
-	 * @param v vector
-	 * @warning <<(ostream&,T&) exists !
-	 */
-	template<class T>
-	std::ostream & operator<<(std::ostream&o, const std::vector<T> & v)
-	{
-		o << '[' ;
-		if (v.size()) {
-			size_t i = 0  ;
-			for (; i < v.size()-1 ; ++i)
-				o << v[i] << ',' ;
-			o <<  v[i] ;
-		}
-		return o << ']' ;
-	}
-
-
-	/*! Prints a pair.
-	 * @param o output stream
-	 * @param C a pair
-	 * @warning <<(ostream&,T&) exists !
-	 */
-	template<class S, class T>
-	std::ostream& operator<<(std::ostream& o, const std::pair<S, T> & C)
-	{
-		o << '(' << C.first << ", " << C.second << ')';
-		return o ;
-	}
-
-	/*! Prints a list.
-	 * @param o output stream
-	 * @param C a pair
-	 * @warning <<(ostream&,T&) exists !
-	 */
-	template<class T>
-	std::ostream& operator<< (std::ostream& o, const std::list<T> & L)
-	{
-		typename std::list<T>::const_iterator it = L.begin() ;
-		o << '{' ;
-		if (it != L.end() )
-			while(true) {
-				o << *it ;
-				if (++it != L.end())
-					o << ", " ;
-				else
-					break;
-			}
-		return o << '}' ;
-	}
-
-#if 0
-	std::ostream &operator << (std::ostream &out, const std::vector<bool> &S)
-	{
-		std::vector<bool>::const_iterator i;
-
-		for (i = S.begin (); i != S.end (); ++i) {
-			out << ((*i) ? "1" : "0");
-			if (i != S.end () - 1)
-				out << ", ";
-		}
-
-		return out;
-	}
-
-	template<class T, template <class T> class Container>
-	std::ostream& operator<< (std::ostream& o, const Container<T>& C)
-	{
-		for(typename Container<T>::const_iterator refs =  C.begin();
-		    refs != C.end() ;
-		    ++refs )
-			o << (*refs) << " " ;
-		return o << std::endl;
-	}
-
-#endif
-}
+#include "fflas-ffpack/utils/print-utils.h"

 #endif // __LINBOX_util_debug_H


mark_connector_sequence_for_dequeue(): Rename to mark_jet_for_dequeue()

--- link-grammar/parse/prune.c
+++ link-grammar/parse/prune.c
@@ -623,7 +623,7 @@
 	return foundmatch;
 }

-static void mark_connector_sequence_for_dequeue(Connector *c, bool mark_bad_word)
+static void mark_jet_for_dequeue(Connector *c, bool mark_bad_word)
 {
 	for (; NULL != c; c = c->next)
 	{
@@ -679,8 +679,8 @@
 				bool bad = is_bad(d->left);
 				if (bad || left_connector_list_update(&pc, d->left, w, true) < 0)
 				{
-					mark_connector_sequence_for_dequeue(d->left, true);
-					mark_connector_sequence_for_dequeue(d->right, false);
+					mark_jet_for_dequeue(d->left, true);
+					mark_jet_for_dequeue(d->right, false);

 					/* discard the current disjunct */
 					*dd = d->next; /* NEXT - set current disjunct to the next one */
@@ -716,8 +716,8 @@
 				bool bad = is_bad(d->right);
 				if (bad || right_connector_list_update(&pc, d->right, w, true) >= sent->length)
 				{
-					mark_connector_sequence_for_dequeue(d->right, true);
-					mark_connector_sequence_for_dequeue(d->left, false);
+					mark_jet_for_dequeue(d->right, true);
+					mark_jet_for_dequeue(d->left, false);

 					/* Discard the current disjunct. */
 					*dd = d->next; /* NEXT - set current disjunct to the next one */


Added stb_image_tester for when SOIL needs to be out of the way.

--- SDL_gpu/OpenGL/SOIL/stb_image_aug.h
+++ SDL_gpu/OpenGL/SOIL/stb_image_aug.h
@@ -5,9 +5,7 @@
 #ifndef HEADER_STB_IMAGE_AUGMENTED
 #define HEADER_STB_IMAGE_AUGMENTED

-#define STBI_HEADER_FILE_ONLY
-#include "stb_image.c"
-
+#include "stb_image.h"
 #include "stb_image_write.h"

 #endif


[IMP] disable status return 0

[IMP] disable status return 0

--- ngx_http_dyabt_module.c
+++ ngx_http_dyabt_module.c
@@ -628,6 +628,9 @@
     if(dmcf->enable == NGX_CONF_UNSET){
         dmcf->enable = 0;
     }
+    if(!dmcf->enable){
+        return NGX_CONF_OK;
+    }
     /* initializ shared memory*/
     ngx_memzero(&shm,sizeof(ngx_shm_t));
     ngx_str_set(&shm.name,"ngx_http_dyabt_shm");
@@ -736,13 +739,20 @@
 static ngx_int_t
 ngx_http_dyabt_set_handler(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data)
 {
-    ngx_int_t                           result;
-    ngx_str_t                           value;
+    ngx_int_t                            result;
+    ngx_str_t                            value;
     ngx_http_dyabt_set_conf_t           *scf;
     ngx_http_dyabt_testing_t            *testing;
     ngx_http_dyabt_case_t               *cases;
-    ngx_int_t                           size;
-    ngx_int_t                           testing_result = -1;
+    ngx_int_t                            size;
+    ngx_int_t                            testing_result = -1;
+    ngx_http_dyabt_main_conf_t          *dmcf;
+    dmcf = ngx_http_get_module_main_conf(r, ngx_http_dyabt_module);
+    if(!dmcf->enable){
+        v->data = (u_char*)"0";
+        v->len  = 1;
+        return NGX_OK;
+    }
     scf = (ngx_http_dyabt_set_conf_t*)data;
     if(scf->values_count){
         if (ngx_http_script_run(r, &value, scf->lengths->elts, 0, scf->values->elts) == NULL)
@@ -903,13 +913,18 @@
 static ngx_int_t ngx_http_dyabt_init_process(ngx_cycle_t *cycle)
 {
     ngx_event_t                 *timer;
-    ngx_int_t                   result;
+    ngx_int_t                    result;
     ngx_pool_t                  *temp_pool;
     ngx_hash_key_t              *parser;
     ngx_shm_zone_t              *shm_zone;
-    ngx_shm_t                   shm;
-    ngx_array_t                 parsers;
-    ngx_hash_init_t             parser_hash_init;
+    ngx_shm_t                    shm;
+    ngx_array_t                  parsers;
+    ngx_hash_init_t              parser_hash_init;
+    ngx_http_dyabt_main_conf_t  *dmcf;
+    dmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_dyabt_module);
+    if(!dmcf->enable){
+        return NGX_OK;
+    }
     ngx_http_dyabt_global_ctx.global_pool = ngx_create_pool(
         (NGX_DEFAULT_POOL_SIZE*1024),cycle->log);
     ngx_memzero(&parsers,sizeof(ngx_array_t));


fix bug

fix bug

--- ngx_http_range_module.c
+++ ngx_http_range_module.c
@@ -535,8 +535,10 @@
 				ctx->range.start, ctx->range.end, ctx->content_range.total) - content_range.data;

 		ngx_http_subrange_set_header(r, &r->headers_out.headers, content_range_key, content_range, NULL);
+		ctx->done = 0;
 	}
 	if(ctx->content_range.end + 1 == ctx->content_range.total){
+		ctx->done = 1;
 		return ngx_http_next_header_filter(r);
 	}
 	ctx->offset = ctx->content_range.end + 1;
@@ -549,7 +551,7 @@

 	ctx = ngx_http_get_module_ctx(r->main, ngx_http_subrange_filter_module);
 	if(r != r->main || ctx == NULL || !ctx->touched){
-		if(ctx && ctx->done){
+		if(ctx && ctx->done && in){
 			/*nginx set last_buf to 0 if this is a subrequest , fix it to send not buffer the last subrequest*/
 			for (cl = in; cl->next; cl = cl->next){/* void */}
 			cl->buf->last_buf = 1;
@@ -562,12 +564,13 @@
 		if (cl->buf->last_buf) {
 			cl->buf->last_buf = 0;
 			cl->buf->sync = 1;
+			cl->buf->flush = 1;
 			last = 1;
 			break;
 		}
 	}
 	rc = ngx_http_next_body_filter(r, in);
-	if(rc == NGX_ERROR || !last){
+	if(rc == NGX_ERROR || !last || ctx->done){
 		return rc;
 	}

@@ -575,9 +578,9 @@
 	ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log,0, "http subrange filter: p:%ui,last:%ui",ctx->processed, last);
 	if(!ctx->processed){
 		/*if there is only one request , we should set ctx->done to 1*/
-		if(ctx->content_range.end + 1 >= ctx->content_range.total){
+		/*if(ctx->content_range.end + 1 >= ctx->content_range.total){
 			ctx->done = 1;
-		}
+		}*/
 		if(ngx_http_subrange_create_subrequest(r->main, ctx) != NGX_OK){
 			return NGX_ERROR;
 		}
@@ -588,19 +591,24 @@
 static  ngx_int_t ngx_http_subrange_post_subrequest(ngx_http_request_t *r, void *data, ngx_int_t rc){
 	ngx_http_subrange_filter_ctx_t *ctx;
 	ctx = ngx_http_get_module_ctx(r->main, ngx_http_subrange_filter_module);
+	if(rc != NGX_OK){
+		return rc;
+	}
 	if(ctx == NULL){
 		return NGX_ERROR;
 	}
 	if(ctx->done){
 		return NGX_OK;
 	}
-	if(ctx->content_range.end + 1 >= ctx->content_range.total){
+	/*if(ctx->content_range.end + 1 >= ctx->content_range.total){
 		ctx->done = 1;
-	}
-	if(ngx_http_subrange_create_subrequest(r, ctx) != NGX_OK){
+		r->post_subrequest = NULL;
+		return NGX_OK;
+	}*/
+	if(ngx_http_subrange_create_subrequest(r->main, ctx) != NGX_OK){
 		return NGX_ERROR;
 	}
-	ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log,0, "http subrange filter: post subrequest:c:%ud",r->main->count);
+	ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log,0, "http subrange filter: post subrequest:c:%ui,rc:%i",r->main->count, rc);
 	r->post_subrequest = NULL;
 	return NGX_OK;
 }


plat-vexpress: Configure secure UART interrupt in qemu_virt startup

Configure the secure UART interrupt for the qemu_virt platform
flavour, rather than letting it default to non-secure.

Signed-off-by: Peter Maydell <313afa09ce093b19ae1dd74f57c1ebd94508584c@linaro.org>
Reviewed-by: Jens Wiklander <7706914404370d7502c27a0eff493dcf491feb51@linaro.org>

--- core/arch/arm/plat-vexpress/main.c
+++ core/arch/arm/plat-vexpress/main.c
@@ -103,6 +103,10 @@
 {
 	/* Initialize GIC */
 	gic_init(GIC_BASE + GICC_OFFSET, GIC_BASE + GICD_OFFSET);
+	gic_it_add(IT_CONSOLE_UART);
+	gic_it_set_cpu_mask(IT_CONSOLE_UART, 0x1);
+	gic_it_set_prio(IT_CONSOLE_UART, 0x1);
+	gic_it_enable(IT_CONSOLE_UART);
 }
 #endif


core arm sta: 64bit print fix

core arm sta: 64bit print fix

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

--- core/arch/arm/sta/sta_self_tests.c
+++ core/arch/arm/sta/sta_self_tests.c
@@ -25,6 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <compiler.h>
+#include <types_ext.h>
 #include <user_ta_header.h>
 #include <trace.h>
 #include <tee_api_types.h>
@@ -135,7 +136,7 @@
 		return TEE_SUCCESS;
 	}

-	DMSG("expect memref params: %p/%zu - %p/%zu - %p/%zu - %p/%zu",
+	DMSG("expect memref params: %p/%" PRIu32 " - %p/%" PRIu32 "zu - %p/%" PRIu32 "zu - %p/%" PRIu32 "zu",
 			p[0].memref.buffer, p[0].memref.size,
 			p[1].memref.buffer, p[1].memref.size,
 			p[2].memref.buffer, p[2].memref.size,


just a clarifying comment

just a clarifying comment

--- logger/include/cpp-utilities/logger.h
+++ logger/include/cpp-utilities/logger.h
@@ -271,6 +271,9 @@

 		ss << msg;

+		// we render the whole message into the buffer above
+		// so that the lock is held for the shortest amount of
+		// time possible
 		std::unique_lock<std::mutex> lock(log_mutex);
 		std::clog << ss.str() << std::endl;
 	}


MAMAC TESTTOOLS: Additional logging to indicate processing in capture replay

When reading the playback file during startup, capture replay may sit for several
minutes (when reading a large file), without any indication that it is processing
data. This patch adds some additional logging to make it clear that the file
continues to be processed, as well as giving a clearer indication as to the number
of symbols discovered.

Signed-off-by: Damian Maguire <21930bd10afdadbc1f53edcd2634e8f66a5e6d7a@nyx.com>

--- mama/c_cpp/src/testtools/capturereplay/c/capturereplayc.c
+++ mama/c_cpp/src/testtools/capturereplay/c/capturereplayc.c
@@ -530,11 +530,13 @@
 static void readSymbolsFromFile (void)
 {
     mamaPlaybackFileParser  fileParser;
-    char*           headerString = NULL;
-    char*           temp = NULL;
-    char * source = NULL;
-    int             symbolIndex = 0, i=0;
-    mamaMsg        newMessage;
+    char*                   headerString    = NULL;
+    char*                   temp            = NULL;
+    char*                   source          = NULL;
+    int                     symbolIndex     = 0;
+    int                     i               = 0;
+    int                     iterations      = 0;
+    mamaMsg                 newMessage;

     gSubscriptionList = (pubCache*)calloc (MAX_SUBSCRIPTIONS,
                                                    sizeof (pubCache));
@@ -542,7 +544,8 @@
     mamaPlaybackFileParser_allocate (&fileParser);
     mamaPlaybackFileParser_openFile(fileParser, (char*)gFilename);

-    while (mamaPlaybackFileParser_getNextHeader(fileParser, &headerString))
+    mama_log (MAMA_LOG_LEVEL_NORMAL, "Continuing.");
+    while (mamaPlaybackFileParser_getNextHeader (fileParser, &headerString))
     {
         if (mamaPlaybackFileParser_getNextMsg (fileParser,
                                                 &newMessage))
@@ -567,12 +570,42 @@
                                                        sizeof (char));
                 strncpy (gSubscriptionList[symbolIndex].symbol, source, temp-source);
                 symbolIndex++;
+
+                if (0 == (symbolIndex % 20))
+                {
+                    mama_log (MAMA_LOG_LEVEL_NORMAL,
+                              "Read %d symbols from playback file.\n"
+                              "Continuing.",
+                              symbolIndex);
+                }
+            }
+
+            /*
+             * Just some additional logging to help make it clear the application
+             * hasn't frozen when processing large files.
+             */
+            iterations++;
+            if (0 == (iterations % 5000))
+            {
+                printf (".");
+                fflush (stdout);
+
+                if (0 == (iterations % 50000))
+                {
+                    printf(".\n");
+                    mama_log (MAMA_LOG_LEVEL_NORMAL, "Continuing.");
+                }
             }
         }
     }
     gNumSymbols = symbolIndex;

-    mamaPlaybackFileParser_closeFile(fileParser);
+    /* End logging. */
+    mama_log (MAMA_LOG_LEVEL_NORMAL,
+              "Symbols read from playback file. Total symbols:\t%d",
+              gNumSymbols);
+
+    mamaPlaybackFileParser_closeFile  (fileParser);
     mamaPlaybackFileParser_deallocate (fileParser);
 }


procfs can use vop_generic_bmap too;

procfs can use vop_generic_bmap too;

--- miscfs/procfs/procfs_vnops.c
+++ miscfs/procfs/procfs_vnops.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: procfs_vnops.c,v 1.43 2008/05/08 17:45:45 thib Exp $	*/
+/*	$OpenBSD: procfs_vnops.c,v 1.44 2008/05/09 10:22:50 thib Exp $	*/
 /*	$NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $	*/

 /*
@@ -130,7 +130,6 @@
 int	procfs_readlink(void *);
 int	procfs_inactive(void *);
 int	procfs_reclaim(void *);
-int	procfs_bmap(void *);
 int	procfs_print(void *);
 int	procfs_pathconf(void *);

@@ -168,7 +167,7 @@
 	{ &vop_reclaim_desc, procfs_reclaim },		/* reclaim */
 	{ &vop_lock_desc, nullop },			/* lock */
 	{ &vop_unlock_desc, nullop },			/* unlock */
-	{ &vop_bmap_desc, procfs_bmap },		/* bmap */
+	{ &vop_bmap_desc, vop_generic_bmap },		/* bmap */
 	{ &vop_strategy_desc, procfs_badop },		/* strategy */
 	{ &vop_print_desc, procfs_print },		/* print */
 	{ &vop_islocked_desc, nullop },			/* islocked */
@@ -270,28 +269,6 @@
 {

 	return (ENOTTY);
-}
-
-/*
- * do block mapping for pfsnode (vp).
- * since we don't use the buffer cache
- * for procfs this function should never
- * be called.  in any case, it's not clear
- * what part of the kernel ever makes use
- * of this function.  for sanity, this is the
- * usual no-op bmap, although returning
- * (EIO) would be a reasonable alternative.
- */
-int
-procfs_bmap(void *v)
-{
-	struct vop_bmap_args *ap = v;
-
-	if (ap->a_vpp != NULL)
-		*ap->a_vpp = ap->a_vp;
-	if (ap->a_bnp != NULL)
-		*ap->a_bnp = ap->a_bn;
-	return (0);
 }

 /*


Also unref instead of destroying the hash table in grl_browse_cb

--- mafw-grilo-source/mafw-grilo-source.c
+++ mafw-grilo-source/mafw-grilo-source.c
@@ -724,7 +724,7 @@
   g_free (mafw_object_id);
   if (mafw_metadata_keys)
     {
-      g_hash_table_destroy (mafw_metadata_keys);
+      g_hash_table_unref (mafw_metadata_keys);
     }

   if (!remaining || error)


gunicorn: Fix ADDTCPSVR command example

gunicorn: Fix ADDTCPSVR command example

--- main/c_gunicorn_server/gunicorn_tcp.c
+++ main/c_gunicorn_server/gunicorn_tcp.c
@@ -49,8 +49,8 @@
 venv = /home/user/project/.venv ; Path to where virtual environment is located.

 Register it like so:
- ADDTCPSVR SVRSPCVAL(*GUNICORN) PGM(STRPYSRVR) SVRNAME('GUNICORN') +
-  SVRTYPE('GUNICORN') TEXT('Python gunicorn servers')
+ ADDTCPSVR SVRSPCVAL(*GUNICORN) PGM(OSSILE/GUNICORNTCP)
+ SVRNAME('GUNICORN') SVRTYPE('GUNICORN') TEXT('Python gunicorn servers')
 */

 #include <stdio.h>


adpcm: do not abuse fmt_in.p_extra, fix double free

(cherry picked from commit 85a205b487c0dce7257d42c7e5046f48745a5030)

--- modules/codec/adpcm.c
+++ modules/codec/adpcm.c
@@ -72,6 +72,7 @@
     size_t              i_samplesperblock;

     date_t              end_date;
+    int16_t            *prev;
 };

 static void DecodeAdpcmMs    ( decoder_t *, int16_t *, uint8_t * );
@@ -164,9 +165,11 @@
     }

     /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_dec->p_sys = p_sys =
-          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
+    p_sys = malloc(sizeof(*p_sys));
+    if( unlikely(p_sys == NULL) )
         return VLC_ENOMEM;
+
+    p_sys->prev = NULL;

     switch( p_dec->fmt_in.i_codec )
     {
@@ -187,9 +190,9 @@
             break;
         case VLC_FOURCC('X','A','J', 0): /* EA ADPCM */
             p_sys->codec = ADPCM_EA;
-            p_dec->fmt_in.p_extra = calloc( 2 * p_dec->fmt_in.audio.i_channels,
-                                            sizeof( int16_t ) );
-            if( p_dec->fmt_in.p_extra == NULL )
+            p_sys->prev = calloc( 2 * p_dec->fmt_in.audio.i_channels,
+                                  sizeof( int16_t ) );
+            if( unlikely(p_sys->prev == NULL) )
             {
                 free( p_sys );
                 return VLC_ENOMEM;
@@ -245,6 +248,7 @@
              p_dec->fmt_in.audio.i_bitspersample, p_sys->i_block,
              p_sys->i_samplesperblock );

+    p_dec->p_sys = p_sys;
     p_dec->fmt_out.i_cat = AUDIO_ES;
     p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
     p_dec->fmt_out.audio.i_rate = p_dec->fmt_in.audio.i_rate;
@@ -349,8 +353,7 @@
     decoder_t *p_dec = (decoder_t *)p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;

-    if( p_sys->codec == ADPCM_EA )
-        free( p_dec->fmt_in.p_extra );
+    free( p_sys->prev );
     free( p_sys );
 }

@@ -741,7 +744,7 @@

     unsigned chans = p_dec->fmt_in.audio.i_channels;
     const uint8_t *p_end = &p_buffer[p_sys->i_block];
-    int16_t *prev = (int16_t *)p_dec->fmt_in.p_extra;
+    int16_t *prev = p_sys->prev;
     int16_t *cur = prev + chans;

     for (unsigned c = 0; c < chans; c++)


Implement seed_js_dbus_emit_signal

Implement seed_js_dbus_emit_signal

--- modules/dbus/module.c
+++ modules/dbus/module.c
@@ -750,6 +750,75 @@
 }

 static SeedValue
+seed_js_dbus_emit_signal(SeedContext ctx,
+			 SeedObject function,
+			 SeedObject this_object,
+			 size_t argument_count,
+			 const SeedValue arguments[],
+			 SeedException * exception)
+{
+    DBusConnection *bus_connection;
+    DBusMessage *message;
+    DBusMessageIter arg_iter;
+    DBusSignatureIter sig_iter;
+    const char *object_path;
+    const char *iface;
+    const char *signal;
+    const char *in_signature;
+    DBusBusType bus_type;
+
+    if (argument_count < 4)
+    {
+      seed_make_exception(ctx, exception, "ArgumentError", "Not enough args, need object path, interface and signal and the arguments");
+      return seed_make_null (ctx);
+    }
+
+    if (!seed_value_is_object (ctx, arguments[4]))
+      {
+	seed_make_exception(ctx, exception, "ArgumentError", "5th argument should be an array of arguments");
+	return seed_make_null (ctx);
+      }
+
+    bus_type = get_bus_type_from_object (ctx, this_object, exception);
+
+    object_path = seed_value_to_string(ctx, arguments[0], exception);
+    iface = seed_value_to_string(ctx, arguments[1], exception);
+    signal = seed_value_to_string(ctx, arguments[2], exception);
+    in_signature = seed_value_to_string(ctx, arguments[3], exception);
+
+    if (!bus_check(ctx, bus_type, exception))
+      return seed_make_null (ctx);
+
+    //    big_debug(BIG_DEBUG_JS_DBUS,
+    //        "Emitting signal %s %s %s",
+    //        object_path,
+    //        iface,
+    //        signal);
+
+    bus_connection = DBUS_CONNECTION_FROM_TYPE(bus_type);
+
+    message = dbus_message_new_signal(object_path,
+                                      iface,
+                                      signal);
+
+    dbus_message_iter_init_append(message, &arg_iter);
+
+    dbus_signature_iter_init(&sig_iter, in_signature);
+
+    if (!seed_js_values_to_dbus(ctx, 0, arguments[4], &arg_iter, &sig_iter, exception))
+      {
+        dbus_message_unref(message);
+	return seed_make_null (ctx);
+      }
+
+    dbus_connection_send(bus_connection, message, NULL);
+
+    dbus_message_unref(message);
+
+    return seed_make_undefined (ctx);
+}
+
+static SeedValue
 seed_js_dbus_signature_length (SeedContext ctx,
 			       SeedObject function,
 			       SeedObject this_object,


add num_codons()

add num_codons()

--- Ymir/src/codon_table.h
+++ Ymir/src/codon_table.h
@@ -145,6 +145,14 @@
         }

+        int num_codons(char aminoacid) const {
+            auto codon = Codons(_aa2codon.equal_range(aminoacid));
+            int res = 1;
+            while (codon.next()) { ++res; }
+            return res;
+        }
+
+
         std::string translate(const std::string &nuc_seq) const {
             if (nuc_seq.size() % 3 == 0 && !nuc_seq.empty()) {
                 std::string res = "";


ncurses: input item are equal if they are equal...

If we have two valid input item pointers, then they are the same if
and only if the pointers are equal. No need to compare input item IDs.

--- modules/gui/ncurses.c
+++ modules/gui/ncurses.c
@@ -501,7 +501,7 @@

     playlist_item_t *p_played_item = playlist_CurrentPlayingItem(p_playlist);
     if (p_played_item && item->p_input && p_played_item->p_input)
-        return item->p_input->i_id == p_played_item->p_input->i_id;
+        return item->p_input == p_played_item->p_input;

     return false;
 }


Fix debugging reference from non-GSS to optional GSS code.

From: Nick Alcock <42741493f9004d057a199c0b77104482057f7cec@oracle.com>

AUTH_DESTROY() and auth_destroy() are pulling in log_debug() from
authgss_prot.c, but are used from outside the GSS code, thus preventing
libtirpc
from being used if compiled without GSS support.

The (somewhat ugly) fix here defines a new macro to do the job. Because
we're
not compiling as C99, I use the GNU C variadic macro extension: if we
mean to
be compiled with other compilers, this needs to change.

Signed-off-by: Nick Alcock <42741493f9004d057a199c0b77104482057f7cec@oracle.com>
Signed-off-by: Steve Dickson <305cc9d5027c0f4e08c2697d4cabde07a8221669@redhat.com>

--- tirpc/rpc/auth.h
+++ tirpc/rpc/auth.h
@@ -51,6 +51,7 @@
 #include <sys/cdefs.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+#include <stdio.h>

 #define MAX_AUTH_BYTES	400
@@ -248,12 +249,18 @@
 #define auth_refresh(auth, msg)		\
 		((*((auth)->ah_ops->ah_refresh))(auth, msg))

+#if defined(__GNUC__) && defined(DEBUG)
+#define auth_log_debug(fmt,args...) printf(stderr, fmt, args)
+#else
+#define auth_log_debug(fmt,args...)
+#endif
+
 #define AUTH_DESTROY(auth)						\
 		do {							\
 			int refs;					\
 			if ((refs = auth_put((auth))) == 0)		\
 				((*((auth)->ah_ops->ah_destroy))(auth));\
-			log_debug("%s: auth_put(), refs %d\n",		\
+			auth_log_debug("%s: auth_put(), refs %d\n",	\
 				__func__, refs);			\
 		} while (0)

@@ -262,7 +269,7 @@
 			int refs;					\
 			if ((refs = auth_put((auth))) == 0)		\
 				((*((auth)->ah_ops->ah_destroy))(auth));\
-			log_debug("%s: auth_put(), refs %d\n",		\
+			auth_log_debug("%s: auth_put(), refs %d\n",	\
 				__func__, refs);			\
 		} while (0)


Don't access memory before checking the correct length in aesni_cbc_hmac_sha256_ctrl in case EVP_CTRL_AEAD_TLS1_AAD.

Reviewed-by: Andy Polyakov <015edf36635e030d5e009e08808a59984e629740@openssl.org>
Reviewed-by: Richard Levitte <5fb523282dd7956571c80524edc2dccfa0bd8234@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3023)

--- crypto/evp/e_aes_cbc_hmac_sha256.c
+++ crypto/evp/e_aes_cbc_hmac_sha256.c
@@ -777,10 +777,12 @@
     case EVP_CTRL_AEAD_TLS1_AAD:
         {
             unsigned char *p = ptr;
-            unsigned int len = p[arg - 2] << 8 | p[arg - 1];
+            unsigned int len;

             if (arg != EVP_AEAD_TLS1_AAD_LEN)
                 return -1;
+
+            len = p[arg - 2] << 8 | p[arg - 1];

             if (EVP_CIPHER_CTX_encrypting(ctx)) {
                 key->payload_length = len;


added note about BUF_SIZE

added note about BUF_SIZE

--- iOS/CustomAudioUnit.h
+++ iOS/CustomAudioUnit.h
@@ -16,6 +16,8 @@

 #include "../include/Mixer3D.h"

+// NOTE: a BUF_SIZE of 1024 will sound bad in the simulator but good on the device.
+// the opposite is true for a BUF_SIZE of 512
 #define BUF_SIZE 1024
 #define BIT_DEPTH 16
 #define SAMPLE_RATE 44100


nulldrv: Fix compiler issues

nulldrv: Fix compiler issues

--- icd/nulldrv/nulldrv.c
+++ icd/nulldrv/nulldrv.c
@@ -131,9 +131,6 @@
 {
     uint32_t i;

-    if (!count)
-        return VK_ERROR_INVALID_POINTER;
-
     for (i = 0; i < count; i++) {
         const VkDeviceQueueCreateInfo *q = &queues[i];
         VkResult ret = VK_SUCCESS;
@@ -141,9 +138,6 @@
         if (q->queueCount == 1 && !dev->queues[q->queueFamilyIndex]) {
             ret = nulldrv_queue_create(dev, q->queueFamilyIndex,
                     &dev->queues[q->queueFamilyIndex]);
-        }
-        else {
-            ret = VK_ERROR_INVALID_POINTER;
         }

         if (ret != VK_SUCCESS) {
@@ -879,7 +873,7 @@
     return VK_SUCCESS;
 }

-ICD_EXPORT void VKAPI vkDestroySwapChainKHR(
+ICD_EXPORT VkResult VKAPI vkDestroySwapchainKHR(
     VkDevice                                device,
     VkSwapchainKHR                          swapchain)
 {
@@ -1571,10 +1565,6 @@
 {
     uint32_t copy_size;

-    if (pCount == NULL) {
-        return VK_ERROR_INVALID_POINTER;
-    }
-
     if (pProperties == NULL) {
         *pCount = NULLDRV_EXT_COUNT;
         return VK_SUCCESS;
@@ -1602,10 +1592,6 @@
     uint32_t*                                   pCount,
     VkExtensionProperties*                      pProperties)
 {
-
-    if (pCount == NULL) {
-        return VK_ERROR_INVALID_POINTER;
-    }

     *pCount = 0;

@@ -1896,7 +1882,7 @@
     VkPipelineCache                             pipelineCache)
 {
     NULLDRV_LOG_FUNC;
-    return VK_ERROR_UNAVAILABLE;
+    return 0;
 }

 ICD_EXPORT VkResult VKAPI vkGetPipelineCacheData(
@@ -1905,7 +1891,7 @@
     void*                                       pData)
 {
     NULLDRV_LOG_FUNC;
-    return VK_ERROR_UNAVAILABLE;
+    return VK_ERROR_INITIALIZATION_FAILED;
 }

 ICD_EXPORT VkResult VKAPI vkMergePipelineCaches(
@@ -1915,7 +1901,7 @@
     const VkPipelineCache*                      pSrcCaches)
 {
     NULLDRV_LOG_FUNC;
-    return VK_ERROR_UNAVAILABLE;
+    return VK_ERROR_INITIALIZATION_FAILED;
 }
 ICD_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(
     VkDevice                                  device,
@@ -2115,7 +2101,7 @@
     struct nulldrv_dev *dev = nulldrv_dev(device);

     return nulldrv_line_width_state_create(dev, pCreateInfo,
-            (struct nulldrv_dynamic_rs_line **) pState);
+            (struct nulldrv_dynamic_line_width **) pState);
 }

 ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthBiasState(
@@ -2127,7 +2113,7 @@
     struct nulldrv_dev *dev = nulldrv_dev(device);

     return nulldrv_depth_bias_state_create(dev, pCreateInfo,
-            (struct nulldrv_dynamic_rs_depth_bias **) pState);
+            (struct nulldrv_dynamic_depth_bias **) pState);
 }

 ICD_EXPORT void VKAPI vkDestroyDynamicLineWidthState(
@@ -2155,7 +2141,7 @@
     struct nulldrv_dev *dev = nulldrv_dev(device);

     return nulldrv_blend_state_create(dev, pCreateInfo,
-            (struct nulldrv_dynamic_cb **) pState);
+            (struct nulldrv_dynamic_blend **) pState);
 }

 ICD_EXPORT void VKAPI vkDestroyDynamicBlendState(
@@ -2175,7 +2161,7 @@
     struct nulldrv_dev *dev = nulldrv_dev(device);

     return nulldrv_depth_bounds_state_create(dev, pCreateInfo,
-            (struct nulldrv_dynamic_depth **) pState);
+            (struct nulldrv_dynamic_depth_bounds **) pState);
 }

 ICD_EXPORT void VKAPI vkDestroyDynamicDepthBoundsState(
@@ -2489,5 +2475,5 @@
     VkImageUsageFlags                           usage,
     VkImageFormatProperties*                    pImageFormatProperties)
 {
-    return VK_ERROR_UNAVAILABLE;
-}
+    return VK_ERROR_INITIALIZATION_FAILED;
+}


Added in documentation for all of the IOCTL calls.

--- src/software/axidma/axidma_ioctl.h
+++ src/software/axidma/axidma_ioctl.h
@@ -87,27 +87,157 @@
 // The magic number used to distinguish IOCTL's for our device
 #define AXIDMA_IOCTL_MAGIC              'W'

-// Returns the number of DMA/VDMA channels available
+/**
+ * Returns the number of available DMA channels in the system.
+ *
+ * This writes to the structure given as input by the user, telling the
+ * numbers for all DMA channels in the system.
+ *
+ * Outputs:
+ *  - num_channels - The total number of DMA channels in the system.
+ *  - num_dma_tx_channels - The number of transmit AXI DMA channels
+ *  - num_dma_rx_channels - The number of receive AXI DMA channels
+ *  - num_vdma_tx_channels - The number of transmit AXI VDMA channels
+ *  - num_vdma_rx_channels - The number of receive AXI VDMA channels
+ **/
 #define AXIDMA_GET_NUM_DMA_CHANNELS     _IOW(AXIDMA_IOCTL_MAGIC, 0, \
                                              struct axidma_num_channels)
-// Returns all available DMA/VDMA channel ids to the user
+
+/**
+ * Returns information on all DMA channels in the system.
+ *
+ * This function writes to the array specified in the pointer given to the
+ * struct structures representing all data about a given DMA channel (device id,
+ * direction, etc.). The array must be able to hold at least the number of
+ * elements returned by AXIDMA_GET_NUM_DMA_CHANNELS.
+ *
+ * The important piece of information returned in the id for the channels.
+ * This, along with the direction and type, uniquely identifies a DMA channel
+ * in the system, and this is how you refer to a channel in later calls.
+ *
+ * Inputs:
+ *  - channels - A pointer to a region of memory that can hold at least
+ *               num_channels * sizeof(struct axidma_chan) bytes.
+ *
+ * Outputs:
+ *  - channels - An array of structures of the following format:
+ *  - An array of structures with the following fields:
+ *       - dir - The direction of the channel (either read or write).
+ *       - type - The type of the channel (either normal DMA or video DMA).
+ *       - channel_id - The (not necessarily unqiue) integer id for the channel.
+ *       - chan - This field has no meaning and can be safely ignored.
+ **/
 #define AXIDMA_GET_DMA_CHANNELS         _IOR(AXIDMA_IOCTL_MAGIC, 1, \
                                              struct axidma_channel_info)
-// Receives data from the PL fabric
+
+/**
+ * Receives the data from the logic fabric into the processing system.
+ *
+ * This function receives data from a device on the PL fabric through
+ * AXI DMA into memory. The device id should be an id that is returned by the
+ * get dma channels ioctl. The user can specify if the call should wait for the
+ * transfer to complete, or if it should return immediately.
+ *
+ * The specified buffer must be within an address range that was allocated by a
+ * call to mmap with the AXI DMA device. Also, the buffer must be able to hold
+ * at least `buf_len` bytes.
+ *
+ * Inputs:
+ *  - wait - Indicates if the call should be blocking or non-blocking
+ *  - channel_id - The id for the channel you want receive data over.
+ *  - buf - The address of the buffer you want to receive the data in.
+ *  - buf_len - The number of bytes to receive.
+ **/
 #define AXIDMA_DMA_READ                 _IOR(AXIDMA_IOCTL_MAGIC, 2, \
                                              struct axidma_transaction)
-// Send data out over the PL fabric
+
+/**
+ * Sends the given data from the processing system to the logic fabric.
+ *
+ * This function sends data from memory to a device on the PL fabric through
+ * AXI DMA. The device id should be an id that is returned by the get dma
+ * channels ioctl. The user can specify if the call should wait for the transfer
+ * to complete, or if it should return immediately.
+ *
+ * The specified buffer must be within an address range that was allocated by a
+ * call to mmap with the AXI DMA device. Also, the buffer must be able to hold
+ * at least `buf_len` bytes.
+ *
+ * Inputs:
+ *  - wait - Indicates if the call should be blocking or non-blocking
+ *  - channel_id - The id for the channel you want to send data over.
+ *  - buf - The address of the data you want to send.
+ *  - buf_len - The number of bytes to send.
+ **/
 #define AXIDMA_DMA_WRITE                _IOR(AXIDMA_IOCTL_MAGIC, 3, \
                                              struct axidma_transaction)
-// Sends data out over the PL fabric, and then receives data back
+
+/**
+ * Performs a two-way transfer between the logic fabric and processing system.
+ *
+ * This function both sends data to the PL and receives data from the PL fabric.
+ * It is intended for DMA transfers that are tightly coupled together
+ * (e.g. converting an image to grayscale on the PL fabric). The device id's for
+ * both channels should be ones that are returned by the get dma ioctl. The user
+ * can specify if the call should block. If it blocks, it will wait until the
+ * receive transaction completes.
+ *
+ * The specified buffers must be within an address range that was allocated by a
+ * call to mmap with the AXI DMA device. Also, each buffer must be able to hold
+ * at least the number of bytes that are being transfered.
+ *
+ * Inputs:
+ *  - wait - Indicates if the call should be blocking or non-blocking
+ *  - tx_channel_id - The id for the channel you want transmit data on.
+ *  - tx_buf - The address of the data you want to send.
+ *  - tx_buf_len - The number of bytes you want to send.
+ *  - rx_buf - The address of the buffer you want to receive data in.
+ *  - rx_buf_len - The number of bytes you want to receive.
+ **/
 #define AXIDMA_DMA_READWRITE            _IOR(AXIDMA_IOCTL_MAGIC, 4, \
                                              struct axidma_inout_transaction)
-/* Repeatedly sends out the given double frame buffer over the PL fabirc, until
- * it is told to stop. Used to stream video out to a display device. */
+
+/**
+ * Performs frame-buffer based transfers to a display on the logic fabric.
+ *
+ * This function performs a video transfer to the logic fabric. It sends
+ * the given buffers to logic fabric (intended for a display pipeline). When it
+ * reaches the end of the buffers, it loops back and re-sends the first buffer.
+ * This is used for frame-buffer based graphics.
+ *
+ * All of the frame buffers must be within an address range that was allocated
+ * by a call to mmap with the AXI DMA device. Also, each buffer must
+ * be able to hold a frame (width * height * depth bytes). The input array of
+ * buffers must be a memory location that can holds `num_frame_buffers`
+ * addresses.
+ *
+ * This call is always non-blocking as the DMA engine will run forever. In order
+ * to end the transaction, you must make a call to the stop dma channel ioctl.
+ *
+ * Inputs:
+ *  - channel_id - The id for the channel you want to send data over.
+ *  - num_frame_buffers - The number of frame buffers you're using.
+ *  - frame_buffers - An array of the frame buffer addresses.
+ *  - width - The width of the frame (image) in pixels.
+ *  - height - The height of the frame in lines.
+ *  - depth - The size of each pixel in the frame in bytes.
+ **/
 #define AXIDMA_DMA_VIDEO_WRITE          _IOR(AXIDMA_IOCTL_MAGIC, 5, \
                                              struct axidma_video_transaction)
-/* Stops the all transactions on the specified DMA channel. The channel must
- * be currently running an Video transaction. */
+
+/**
+ * Stops all transactions on the given DMA channel.
+ *
+ * This function flushes all in-progress transactions, and discards all pending
+ * transactions on the given DMA channel. The specified id should be one that
+ * was returned by the get dma channels ioctl.
+ *
+ * Inputs:
+ *  - dir - The direction of the channel (either read or write).
+ *  - type - The type of the channel (either normal DMA or video DMA).
+ *  - channel_id - The (not necessarily unqiue) integer id for the channel.
+ *  - chan - This field is unused an can be safely left uninitialized.
+ */
 #define AXIDMA_STOP_DMA_CHANNEL         _IOR(AXIDMA_IOCTL_MAGIC, 6, \
                                              struct axidma_chan)


storage: Add startPool and stopPool for scsi backend

startPool creates the vHBA if it's not existed yet, stopPool destroys
the vHBA. Also to support autostart, checkPool will creates the vHBA
if it's not existed yet.

--- src/storage/storage_backend_scsi.c
+++ src/storage/storage_backend_scsi.c
@@ -645,6 +645,62 @@
 }

 static int
+createVport(virStoragePoolSourceAdapter adapter)
+{
+    unsigned int parent_host;
+    char *name = NULL;
+
+    if (adapter.type != VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST)
+        return 0;
+
+    /* This filters either HBA or already created vHBA */
+    if ((name = virGetFCHostNameByWWN(NULL, adapter.data.fchost.wwnn,
+                                      adapter.data.fchost.wwpn))) {
+        VIR_FREE(name);
+        return 0;
+    }
+
+    if (!adapter.data.fchost.parent) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("'parent' for vHBA must be specified"));
+        return -1;
+    }
+
+    if (getHostNumber(adapter.data.fchost.parent, &parent_host) < 0)
+        return -1;
+
+    if (virManageVport(parent_host, adapter.data.fchost.wwnn,
+                       adapter.data.fchost.wwpn, VPORT_CREATE) < 0)
+        return -1;
+
+    virFileWaitForDevices();
+    return 0;
+}
+
+static int
+deleteVport(virStoragePoolSourceAdapter adapter)
+{
+    unsigned int parent_host;
+
+    if (adapter.type != VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST)
+        return 0;
+
+    if (!(virGetFCHostNameByWWN(NULL, adapter.data.fchost.wwnn,
+                                adapter.data.fchost.wwpn)))
+        return -1;
+
+    if (getHostNumber(adapter.data.fchost.parent, &parent_host) < 0)
+        return -1;
+
+    if (virManageVport(parent_host, adapter.data.fchost.wwnn,
+                       adapter.data.fchost.wwpn, VPORT_DELETE) < 0)
+        return -1;
+
+    return 0;
+}
+
+
+static int
 virStorageBackendSCSICheckPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                virStoragePoolObjPtr pool,
                                bool *isActive)
@@ -706,10 +762,27 @@
     return ret;
 }

+static int
+virStorageBackendSCSIStartPool(virConnectPtr conn ATTRIBUTE_UNUSED,
+                               virStoragePoolObjPtr pool)
+{
+    virStoragePoolSourceAdapter adapter = pool->def->source.adapter;
+    return createVport(adapter);
+}
+
+static int
+virStorageBackendSCSIStopPool(virConnectPtr conn ATTRIBUTE_UNUSED,
+                              virStoragePoolObjPtr pool)
+{
+    virStoragePoolSourceAdapter adapter = pool->def->source.adapter;
+    return deleteVport(adapter);
+}

 virStorageBackend virStorageBackendSCSI = {
     .type = VIR_STORAGE_POOL_SCSI,

     .checkPool = virStorageBackendSCSICheckPool,
     .refreshPool = virStorageBackendSCSIRefreshPool,
+    .startPool = virStorageBackendSCSIStartPool,
+    .stopPool = virStorageBackendSCSIStopPool,
 };


Generate larger than 8x8 dual satd functions with macro

--- src/strategies/avx2/picture-avx2.c
+++ src/strategies/avx2/picture-avx2.c
@@ -429,25 +429,31 @@
   *sum0 = (*sum0 + 2) >> 2;
   *sum1 = (*sum1 + 2) >> 2;
 }
-/*
+
 // Function macro for defining hadamard calculating functions
 // for fixed size blocks. They calculate hadamard for integer
 // multiples of 8x8 with the 8x8 hadamard function.
-#define SATD_NXN_AVX2(n) \
-static unsigned satd_8bit_ ## n ## x ## n ## _dual_avx2( \
-  const kvz_pixel * const block1, const kvz_pixel * const block2) \
+#define SATD_NXN_DUAL_AVX2(n) \
+static void satd_8bit_ ## n ## x ## n ## _dual_avx2( \
+  const pred_buffer preds, const kvz_pixel * const orig, unsigned num_modes, unsigned *satds_out)  \
 { \
   unsigned x, y; \
-  unsigned sum = 0; \
+  satds_out[0] = 0; \
+  satds_out[1] = 0; \
+  unsigned sum1 = 0; \
+  unsigned sum2 = 0; \
   for (y = 0; y < (n); y += 8) { \
   unsigned row = y * (n); \
   for (x = 0; x < (n); x += 8) { \
-  sum += kvz_satd_8bit_8x8_general_avx2(&block1[row + x], (n), &block2[row + x], (n); \
+  kvz_satd_8bit_8x8_general_dual_avx2(&preds[0][row + x], (n), &preds[1][row + x], (n), &orig[row + x], (n), &sum1, &sum2); \
+  satds_out[0] += sum1; \
+  satds_out[1] += sum2; \
     } \
     } \
-  return sum>>(KVZ_BIT_DEPTH-8); \
-}
-*/
+  satds_out[0] >>= (KVZ_BIT_DEPTH-8); \
+  satds_out[1] >>= (KVZ_BIT_DEPTH-8); \
+}
+
 static void satd_8bit_8x8_dual_avx2(
   const pred_buffer preds, const kvz_pixel * const orig, unsigned num_modes, unsigned *satds_out)
 {
@@ -464,15 +470,15 @@
   satds_out[1] += sum2;
       }
       }
-  satds_out[0] = satds_out[0] >>(KVZ_BIT_DEPTH-8);
-  satds_out[1] = satds_out[1] >>(KVZ_BIT_DEPTH-8);
-}
-/*
-//SATD_NXN_AVX2(8) //Use the non-macro version
-SATD_NXN_AVX2(16)
-SATD_NXN_AVX2(32)
-SATD_NXN_AVX2(64)
-*/
+  satds_out[0] >>= (KVZ_BIT_DEPTH-8);
+  satds_out[1] >>= (KVZ_BIT_DEPTH-8);
+}
+
+//SATD_NXN_DUAL_AVX2(8) //Use the non-macro version
+SATD_NXN_DUAL_AVX2(16)
+SATD_NXN_DUAL_AVX2(32)
+SATD_NXN_DUAL_AVX2(64)
+
 void kvz_pixels_blit_avx2(const kvz_pixel * const orig, kvz_pixel * const dst,
                          const unsigned width, const unsigned height,
                          const unsigned orig_stride, const unsigned dst_stride)
@@ -578,9 +584,9 @@
     success &= kvz_strategyselector_register(opaque, "satd_64x64", "avx2", 40, &satd_8bit_64x64_avx2);

     success &= kvz_strategyselector_register(opaque, "satd_8x8_dual", "avx2", 40, &satd_8bit_8x8_dual_avx2);
-    //success &= kvz_strategyselector_register(opaque, "satd_16x16_dual", "avx2", 40, &satd_8bit_16x16_dual_avx2);
-    //success &= kvz_strategyselector_register(opaque, "satd_32x32_dual", "avx2", 40, &satd_8bit_32x32_dual_avx2);
-    //success &= kvz_strategyselector_register(opaque, "satd_64x64_dual", "avx2", 40, &satd_8bit_64x64_dual_avx2);
+    success &= kvz_strategyselector_register(opaque, "satd_16x16_dual", "avx2", 40, &satd_8bit_16x16_dual_avx2);
+    success &= kvz_strategyselector_register(opaque, "satd_32x32_dual", "avx2", 40, &satd_8bit_32x32_dual_avx2);
+    success &= kvz_strategyselector_register(opaque, "satd_64x64_dual", "avx2", 40, &satd_8bit_64x64_dual_avx2);

     success &= kvz_strategyselector_register(opaque, "pixels_blit", "avx2", 40, &kvz_pixels_blit_avx2);
   }


Comment out testing data

Comment out testing data

--- lib/facil/core/types/fiobj/fiobj_hash.c
+++ lib/facil/core/types/fiobj/fiobj_hash.c
@@ -34,6 +34,7 @@

 /* seeks the hash's position in the map */
 static map_info_s *fio_hash_seek(fio_hash_s *h, uintptr_t hash) {
+  /* TODO: consider implementing Robing Hood reordering during seek */
   map_info_s *pos = h->map.data + (hash & h->mask);
   map_info_s *end = pos + fio_map_cuckoo_steps(FIOBJ_HASH_MAX_MAP_SEEK);
   uintptr_t i = 0;
@@ -88,10 +89,10 @@
 /* attempts to rehash the hashmap. */
 void fiobj_hash_rehash(fiobj_s *h_) {
   fio_hash_s *h = obj2hash(h_);
-  fprintf(stderr,
-          "- Rehash with "
-          "length/capacity == %lu/%lu\n",
-          h->count, h->map.capa);
+// fprintf(stderr,
+//         "- Rehash with "
+//         "length/capacity == %lu/%lu\n",
+//         h->count, h->map.capa);
 retry_rehashing:
   h->mask = ((h->mask) << 1) | 1;
   fio_map_reset(&h->map, h->mask);


Place NaN and Infinity ins Strings (promise validity)

--- lib/facil/core/types/fiobj/fiobj_json.c
+++ lib/facil/core/types/fiobj/fiobj_json.c
@@ -244,12 +244,12 @@
     break;
   case FIOBJ_T_FLOAT:
     if (isnan(obj2float(obj)->f))
-      fiobj_str_write(data->buffer, "NaN", 3);
+      fiobj_str_write(data->buffer, "\"NaN\"", 5);
     else if (isinf(obj2float(obj)->f)) {
       if (obj2float(obj)->f > 0)
-        fiobj_str_write(data->buffer, "Infinity", 8);
+        fiobj_str_write(data->buffer, "\"Infinity\"", 10);
       else
-        fiobj_str_write(data->buffer, "-Infinity", 9);
+        fiobj_str_write(data->buffer, "\"-Infinity\"", 11);
     } else {
       char *start = obj2str(data->buffer)->str + obj2str(data->buffer)->len;
       fiobj_str_write2(data->buffer, "%g", obj2float(obj)->f);


ADD menu button struct

ADD menu button struct

--- SSPSolution/SSPSolution/MenuState.h
+++ SSPSolution/SSPSolution/MenuState.h
@@ -7,9 +7,39 @@
 	public GameState
 {
 private:
+	struct MenuButton {
+		UIComponent* m_uiComp;
+		TextComponent* m_textComp;
+
+		void SetHovered(bool hovered)
+		{
+			if (hovered)
+			{
+				m_uiComp->scale = 1.25f;
+				m_textComp->scale = DirectX::XMFLOAT2(1.25f, 1.25f);
+			}
+			else
+			{
+				m_uiComp->scale = 1.f;
+				m_textComp->scale = DirectX::XMFLOAT2(1.f, 1.f);
+			}
+		}
+		void SetActive(bool active)
+		{
+			if (active)
+			{
+				m_uiComp->active = 1;
+				m_textComp->active = 1;
+			}
+			else
+			{
+				m_uiComp->active = 0;
+				m_textComp->active = 0;
+			}
+		}
+	};
 	const static int m_NR_OF_MENU_ITEMS = 2;
-	UIComponent* m_uiComps[m_NR_OF_MENU_ITEMS];
-	TextComponent* m_textComps[m_NR_OF_MENU_ITEMS];
+	MenuButton m_menuButtons[m_NR_OF_MENU_ITEMS];
 	ComponentHandler* m_cHandlerPtr;
 	Camera* m_cameraRef;
 	DirectX::XMVECTOR m_lockTarget;


GnuTLS: fix typo

GnuTLS: fix typo

(cherry picked from commit db67b0a660b57141f53f6aec1bc9f427e0f129e4)
Signed-off-by: Jean-Baptiste Kempf <7b85a41a628204b76aba4326273a3ccc74bd009a@videolan.org>

--- modules/misc/gnutls.c
+++ modules/misc/gnutls.c
@@ -96,7 +96,7 @@
         msg_Err (obj, "unsupported GnuTLS version");
         return -1;
     }
-    msg_Dbg (obj, "using GnuTLS verson %s", version);
+    msg_Dbg (obj, "using GnuTLS version %s", version);
     return 0;
 }

@@ -116,7 +116,7 @@
         msg_Err (obj, "unsupported GnuTLS version");
         return -1;
     }
-    msg_Dbg (obj, "using GnuTLS verson %s", version);
+    msg_Dbg (obj, "using GnuTLS version %s", version);

     if (gnutls_check_version ("3.3.0") == NULL)
     {


minor cleanup

minor cleanup

--- modules/system/main.c
+++ modules/system/main.c
@@ -93,10 +93,10 @@
 unsigned int walk(struct system_node *self, unsigned int count, const char *path)
 {

-    if (count)
-        return 0;
-
-    return (unsigned int)self;
+    if (!count)
+        return (unsigned int)self;
+
+    return 0;

 }


Fix errors

Fix errors

--- SkimmingTools/interface/EtaPhiMap.h
+++ SkimmingTools/interface/EtaPhiMap.h
@@ -1,5 +1,5 @@
 #ifndef CROMBIE_ETAPHIMAP_H
-#defind CROMBIE_ETAPHIMAP_H 1
+#define CROMBIE_ETAPHIMAP_H 1

 #include <vector>
 #include <cmath>
@@ -7,17 +7,21 @@
 #include "TMath.h"
 #include "TVector2.h"

-#include "PlotTools/include/KinematicFunctions.h"
+#include "PlotTools/interface/KinematicFunctions.h"

 template<typename T>
 class EtaPhiMap {
  public:
   EtaPhiMap (double spacing, double maxeta = 5.0,
-             std::function<double(const T*)> eta = [](const T* p){ return p.eta(); },
-             std::function<double(const T*)> phi = [](const T* p){ return p.phi(); });
+             std::function<double(const T*)> eta = [](const T* p){ return p->eta(); },
+             std::function<double(const T*)> phi = [](const T* p){ return p->phi(); })
+    : _spacing{spacing}, _maxeta{maxeta},
+      n_etabins{2 * (static_cast<unsigned>(std::ceil(_maxeta/_spacing)) + 1)}, // Add one for over/underflow and times two for positive and negative
+      n_phibins{static_cast<unsigned>(std::ceil(TMath::TwoPi()/_spacing))},    // Always transform phi into [0, 2pi) in bin
+      particles(n_etabins * n_phibins), geteta{eta}, getphi{phi} {}

   /// Add a collection of particles to the grid. Call once per event, because this gets cleared
-  template<C> AddParticles (C& collection);
+  template<typename C> void AddParticles (C& collection);

   /// Get particles within dr of a given eta, phi
   std::vector<const T*> GetParticles(double eta, double phi, double dr);
@@ -25,7 +29,7 @@
  private:

   /// Stores all of the particles
-  std::vector<std::vector<const T*>> _particles;
+  std::vector<std::vector<const T*>> particles;
   /// Spacing of each grid
   double _spacing;
   /// Max eta of grid (has overflow and underflow bins)
@@ -53,14 +57,9 @@
 };

-EtaPhiMap::EtaPhiMap(double spacing, double maxeta)
-: _spacing{spacing}, _maxeta{maxeta},
-  n_etabins{2 * (std::ceil(_maxeta/_spacing) + 1)}, // Add one for over/underflow and times two for positive and negative
-  n_phibins{std::ceil(TMath::TwoPi()/_spacing)},    // Always transform phi into [0, 2pi) in bin
-  particles(n_etabins * n_phibins) { }
-
-
-template<C> void EtaPhiMap::AddParticles (C& collection) {
+template<typename T>
+template<typename C>
+void EtaPhiMap<T>::AddParticles (C& collection) {

   // Only call this function when adding a full collection
   clear();
@@ -73,10 +72,11 @@
 }

-std::vector<T*> EtaPhiMap::GetParticles(double eta, double phi, double dr) {
+template<typename T>
+std::vector<const T*> EtaPhiMap<T>::GetParticles(double eta, double phi, double dr) {
   double dr2 = std::pow(dr, 2);

-  std::vector<T*> output;
+  std::vector<const T*> output;

   auto max_eta = eta + dr;
   auto max_phi = phi + dr;
@@ -84,12 +84,14 @@
   auto running_eta = eta - dr;
   while (running_eta <= max_eta) {
     auto running_phi = phi - dr;
-    while (running_phi <= max_phi) {
+    while (running_phi <= max_phi) {  // This is the easiest way to not worry about phi wrapping
       for (auto* particle : particles[bin(running_eta, running_phi)]) {
         if (deltaR2(eta, phi, geteta(particle), getphi(particle)) < dr2)
           output.push_back(particle);
       }
+      running_phi += _spacing;
     }
+    running_eta += _spacing;
   }

   return output;
@@ -97,27 +99,32 @@
 }

-unsigned EtaPhiMap::bin(double eta, double phi) {
+template<typename T>
+unsigned EtaPhiMap<T>::bin(double eta, double phi) {
   return bin(etabin(eta), phibin(phi));
 }

-unsigned EtaPhiMap::bin(unsigned etab, unsigned phib) {
+template<typename T>
+unsigned EtaPhiMap<T>::bin(unsigned etab, unsigned phib) {
   return n_etabins * phib + etab;
 }

-unsigned EtaPhiMap::etabin(double eta) {
+template<typename T>
+unsigned EtaPhiMap<T>::etabin(double eta) {
   return std::max(0u, std::min(n_etabins - 1, n_etabins/2 + static_cast<unsigned>(eta/_spacing)));
 }

-unsigned EtaPhiMap::phibin(double phi) {
+template<typename T>
+unsigned EtaPhiMap<T>::phibin(double phi) {
   return TVector2::Phi_0_2pi(phi)/_spacing;
 }

-void EtaPhiMap::clear() {
+template<typename T>
+void EtaPhiMap<T>::clear() {
   for (auto& grid : particles)
     grid.clear();
 }


remove KeyError checks after PyDict_SetItem

--- traits/ctraits.c
+++ traits/ctraits.c
@@ -2143,8 +2143,6 @@
         if ( PyString_Check( name ) ) {
             if ( PyDict_SetItem( dict, name, value ) >= 0 )
                 return 0;
-                if ( PyErr_ExceptionMatches( PyExc_KeyError ) )
-                        PyErr_SetObject( PyExc_AttributeError, name );
             return -1;
         }
 #ifdef Py_USING_UNICODE
@@ -2156,7 +2154,7 @@
             return invalid_attribute_error();

         rc = PyDict_SetItem( dict, name, value );
-        if ( (rc < 0) && PyErr_ExceptionMatches( PyExc_KeyError ) )
+        if (rc < 0)
              PyErr_SetObject( PyExc_AttributeError, name );
         Py_DECREF( name );

@@ -2590,8 +2588,6 @@
     }

     if ( PyDict_SetItem( dict, name, new_value ) < 0 ) {
-        if ( PyErr_ExceptionMatches( PyExc_KeyError ) )
-            PyErr_SetObject( PyExc_AttributeError, name );
         Py_XDECREF( old_value );
         Py_DECREF( name );
         Py_DECREF( value );


Add nullability annotation for CSSSelectorParser's parse method

--- Sources/include/CSSSelectorParser.h
+++ Sources/include/CSSSelectorParser.h
@@ -29,7 +29,7 @@

  @see CSSelector
  */
-+ (CSSSelector *)parseSelector:(NSString *)string error:(NSError **)error;
++ (nullable CSSSelector *)parseSelector:(NSString *)string error:(NSError **)error;

 @end