[SCSI] isd200: use one-element sg list in issuing commands

  - This patch should be commited before:
    usb: transport - convert to accessors and !use_sg code path removal

  - isd200_action() was still using direct liniar pointers in issuing
    commands to the USB transport level. This is no longer supported,
    use one-element scatterlist instead.
  - Adjustment of command's length in the case of scsi-to-ata translation
    is now restored before return to queuecommand, since other wise it can
    leak BIOs.
  - isd200_action() return Error on unknown requests. Used to print an error
    but still try to send garbage cdb.
  - convert few places to scsi data accessors.
  - Todo: This file will need to be changed when scsi_cmnd changes to
    scsi_data_buffer or any other solution.

Signed-off-by: Boaz Harrosh <c7aa24d52dd751aba44a7843602dc14649cc8bce@panasas.com>
Acked-by: Matthew Dharm <42be133c224e25ddf475042382077d20a77549a4@one-eyed-alien.net>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@HansenPartnership.com>

--- drivers/usb/storage/isd200.c
+++ drivers/usb/storage/isd200.c
@@ -49,6 +49,7 @@
 #include <linux/slab.h>
 #include <linux/hdreg.h>
 #include <linux/ide.h>
+#include <linux/scatterlist.h>

 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -287,6 +288,7 @@
 	/* maximum number of LUNs supported */
 	unsigned char MaxLUNs;
 	struct scsi_cmnd srb;
+	struct scatterlist sg;
 };

@@ -398,6 +400,31 @@
  * Transport routines
  ***********************************************************************/

+/**************************************************************************
+ *  isd200_set_srb(), isd200_srb_set_bufflen()
+ *
+ * Two helpers to facilitate in initialization of scsi_cmnd structure
+ * Will need to change when struct scsi_cmnd changes
+ */
+static void isd200_set_srb(struct isd200_info *info,
+	enum dma_data_direction dir, void* buff, unsigned bufflen)
+{
+	struct scsi_cmnd *srb = &info->srb;
+
+	if (buff)
+		sg_init_one(&info->sg, buff, bufflen);
+
+	srb->sc_data_direction = dir;
+	srb->request_buffer = buff ? &info->sg : NULL;
+	srb->request_bufflen = bufflen;
+	srb->use_sg = buff ? 1 : 0;
+}
+
+static void isd200_srb_set_bufflen(struct scsi_cmnd *srb, unsigned bufflen)
+{
+	srb->request_bufflen = bufflen;
+}
+

 /**************************************************************************
  *  isd200_action
@@ -432,9 +459,7 @@
 		ata.generic.RegisterSelect =
 		  REG_CYLINDER_LOW | REG_CYLINDER_HIGH |
 		  REG_STATUS | REG_ERROR;
-		srb->sc_data_direction = DMA_FROM_DEVICE;
-		srb->request_buffer = pointer;
-		srb->request_bufflen = value;
+		isd200_set_srb(info, DMA_FROM_DEVICE, pointer, value);
 		break;

 	case ACTION_ENUM:
@@ -444,7 +469,7 @@
 					   ACTION_SELECT_5;
 		ata.generic.RegisterSelect = REG_DEVICE_HEAD;
 		ata.write.DeviceHeadByte = value;
-		srb->sc_data_direction = DMA_NONE;
+		isd200_set_srb(info, DMA_NONE, NULL, 0);
 		break;

 	case ACTION_RESET:
@@ -453,7 +478,7 @@
 					   ACTION_SELECT_3|ACTION_SELECT_4;
 		ata.generic.RegisterSelect = REG_DEVICE_CONTROL;
 		ata.write.DeviceControlByte = ATA_DC_RESET_CONTROLLER;
-		srb->sc_data_direction = DMA_NONE;
+		isd200_set_srb(info, DMA_NONE, NULL, 0);
 		break;

 	case ACTION_REENABLE:
@@ -462,7 +487,7 @@
 					   ACTION_SELECT_3|ACTION_SELECT_4;
 		ata.generic.RegisterSelect = REG_DEVICE_CONTROL;
 		ata.write.DeviceControlByte = ATA_DC_REENABLE_CONTROLLER;
-		srb->sc_data_direction = DMA_NONE;
+		isd200_set_srb(info, DMA_NONE, NULL, 0);
 		break;

 	case ACTION_SOFT_RESET:
@@ -471,21 +496,20 @@
 		ata.generic.RegisterSelect = REG_DEVICE_HEAD | REG_COMMAND;
 		ata.write.DeviceHeadByte = info->DeviceHead;
 		ata.write.CommandByte = WIN_SRST;
-		srb->sc_data_direction = DMA_NONE;
+		isd200_set_srb(info, DMA_NONE, NULL, 0);
 		break;

 	case ACTION_IDENTIFY:
 		US_DEBUGP("   isd200_action(IDENTIFY)\n");
 		ata.generic.RegisterSelect = REG_COMMAND;
 		ata.write.CommandByte = WIN_IDENTIFY;
-		srb->sc_data_direction = DMA_FROM_DEVICE;
-		srb->request_buffer = (void *) info->id;
-		srb->request_bufflen = sizeof(struct hd_driveid);
+		isd200_set_srb(info, DMA_FROM_DEVICE, info->id,
+		                                sizeof(struct hd_driveid));
 		break;

 	default:
 		US_DEBUGP("Error: Undefined action %d\n",action);
-		break;
+		return ISD200_ERROR;
 	}

 	memcpy(srb->cmnd, &ata, sizeof(ata.generic));
@@ -590,7 +614,7 @@
 		return;
 	}

-	if ((srb->resid > 0) &&
+	if ((scsi_get_resid(srb) > 0) &&
 	    !((srb->cmnd[0] == REQUEST_SENSE) ||
 	      (srb->cmnd[0] == INQUIRY) ||
 	      (srb->cmnd[0] == MODE_SENSE) ||
@@ -1217,7 +1241,6 @@
 	return(retStatus);
 }

-
 /**************************************************************************
  * isd200_scsi_to_ata
  *
@@ -1266,7 +1289,7 @@
 			ataCdb->generic.TransferBlockSize = 1;
 			ataCdb->generic.RegisterSelect = REG_COMMAND;
 			ataCdb->write.CommandByte = ATA_COMMAND_GET_MEDIA_STATUS;
-			srb->request_bufflen = 0;
+			isd200_srb_set_bufflen(srb, 0);
 		} else {
 			US_DEBUGP("   Media Status not supported, just report okay\n");
 			srb->result = SAM_STAT_GOOD;
@@ -1284,7 +1307,7 @@
 			ataCdb->generic.TransferBlockSize = 1;
 			ataCdb->generic.RegisterSelect = REG_COMMAND;
 			ataCdb->write.CommandByte = ATA_COMMAND_GET_MEDIA_STATUS;
-			srb->request_bufflen = 0;
+			isd200_srb_set_bufflen(srb, 0);
 		} else {
 			US_DEBUGP("   Media Status not supported, just report okay\n");
 			srb->result = SAM_STAT_GOOD;
@@ -1390,7 +1413,7 @@
 			ataCdb->generic.RegisterSelect = REG_COMMAND;
 			ataCdb->write.CommandByte = (srb->cmnd[4] & 0x1) ?
 				WIN_DOORLOCK : WIN_DOORUNLOCK;
-			srb->request_bufflen = 0;
+			isd200_srb_set_bufflen(srb, 0);
 		} else {
 			US_DEBUGP("   Not removeable media, just report okay\n");
 			srb->result = SAM_STAT_GOOD;
@@ -1416,7 +1439,7 @@
 			ataCdb->generic.TransferBlockSize = 1;
 			ataCdb->generic.RegisterSelect = REG_COMMAND;
 			ataCdb->write.CommandByte = ATA_COMMAND_GET_MEDIA_STATUS;
-			srb->request_bufflen = 0;
+			isd200_srb_set_bufflen(srb, 0);
 		} else {
 			US_DEBUGP("   Nothing to do, just report okay\n");
 			srb->result = SAM_STAT_GOOD;
@@ -1525,7 +1548,7 @@

 void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)
 {
-	int sendToTransport = 1;
+	int sendToTransport = 1, orig_bufflen;
 	union ata_cdb ataCdb;

 	/* Make sure driver was initialized */
@@ -1533,11 +1556,14 @@
 	if (us->extra == NULL)
 		US_DEBUGP("ERROR Driver not initialized\n");

-	/* Convert command */
-	srb->resid = 0;
+	scsi_set_resid(srb, 0);
+	/* scsi_bufflen might change in protocol translation to ata */
+	orig_bufflen = scsi_bufflen(srb);
 	sendToTransport = isd200_scsi_to_ata(srb, us, &ataCdb);

 	/* send the command to the transport layer */
 	if (sendToTransport)
 		isd200_invoke_transport(us, srb, &ataCdb);
-}
+
+	isd200_srb_set_bufflen(srb, orig_bufflen);
+}


uses 1 branch less to add a sieving prime to eratBig_

--- src/soe/SieveOfEratosthenes-inline.h
+++ src/soe/SieveOfEratosthenes-inline.h
@@ -42,11 +42,9 @@
     segmentLow_  += sieveSize_ * NUMBERS_PER_BYTE;
     segmentHigh_ += sieveSize_ * NUMBERS_PER_BYTE;
   }
-  if (prime > limitEratSmall_)
-    if (prime > limitEratMedium_)
-            eratBig_->add(prime, segmentLow_);
-    else eratMedium_->add(prime, segmentLow_);
-  else    eratSmall_->add(prime, segmentLow_);
+       if (prime > limitEratMedium_)    eratBig_->add(prime, segmentLow_);
+  else if (prime > limitEratSmall_)  eratMedium_->add(prime, segmentLow_);
+  else                                eratSmall_->add(prime, segmentLow_);
 }

 /// Reconstruct the prime number corresponding to the first set


USB: isd200.c: Remove unnecessary kmalloc cast

Signed-off-by: Joe Perches <16a9a54ddf4259952e3c118c763138e83693d7fd@perches.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/storage/isd200.c
+++ drivers/usb/storage/isd200.c
@@ -1456,8 +1456,7 @@
 	int retStatus = ISD200_GOOD;
 	struct isd200_info *info;

-	info = (struct isd200_info *)
-			kzalloc(sizeof(struct isd200_info), GFP_KERNEL);
+	info = kzalloc(sizeof(struct isd200_info), GFP_KERNEL);
 	if (!info)
 		retStatus = ISD200_ERROR;
 	else {


watchdog: fix GETTIMEOUT ioctl in booke_wdt

Commit dcfb748422 ([WATCHDOG] fix book E watchdog to take
WDIOC_SETTIMEOUT arg in seconds) fixed SETTIMEOUT ioctl
to use seconds as a parameter instead of some hardware-specific
"period", but missed to apply similar changes to GETTIMEOUT,
so it still returns "period" value. Let's fix it!
Also, while at it, make SETTIMEOUT ioctl return real timeout
value as it should do according to the documentation.

Signed-off-by: Dmitry Artamonow <456b7dca79c4dd7ef312e672ad3ed701c51aade8@inbox.ru>
Signed-off-by: Wim Van Sebroeck <5f65f6985de1ebf15dde04e0dc4668211868bafa@iguana.be>

--- drivers/watchdog/booke_wdt.c
+++ drivers/watchdog/booke_wdt.c
@@ -198,9 +198,13 @@
 		booke_wdt_period = tmp;
 #endif
 		booke_wdt_set();
-		return 0;
+		/* Fall */
 	case WDIOC_GETTIMEOUT:
+#ifdef	CONFIG_FSL_BOOKE
+		return put_user(period_to_sec(booke_wdt_period), p);
+#else
 		return put_user(booke_wdt_period, p);
+#endif
 	default:
 		return -ENOTTY;
 	}


unit: Add inquiry data from MacBook Air for testing


watchdog: Propagate Book E WDT period changes to all cores

When the watchdog period is changed, it needs to be propagated to all cores
in addition to the core that performed the change.

Signed-off-by: Randy Vinson <b7ad7c9950e21ae878aad7e9c783898ead0eb1eb@mvista.com>
Signed-off-by: Wim Van Sebroeck <5f65f6985de1ebf15dde04e0dc4668211868bafa@iguana.be>

--- drivers/watchdog/booke_wdt.c
+++ drivers/watchdog/booke_wdt.c
@@ -83,6 +83,22 @@
 			return period;
 	}
 	return 0;
+}
+
+static void __booke_wdt_set(void *data)
+{
+	u32 val;
+
+	val = mfspr(SPRN_TCR);
+	val &= ~WDTP_MASK;
+	val |= WDTP(booke_wdt_period);
+
+	mtspr(SPRN_TCR, val);
+}
+
+static void booke_wdt_set(void)
+{
+	on_each_cpu(__booke_wdt_set, NULL, 0);
 }

 static void __booke_wdt_ping(void *data)
@@ -181,8 +197,7 @@
 #else
 		booke_wdt_period = tmp;
 #endif
-		mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP_MASK) |
-						WDTP(booke_wdt_period));
+		booke_wdt_set();
 		return 0;
 	case WDIOC_GETTIMEOUT:
 		return put_user(booke_wdt_period, p);


Now uses comparator in unit test.

Now uses comparator in unit test.

git-svn-id: 862faeed78cded1e835205427955152ddd748d7d@149 5dfbf39a-1452-0410-8a97-9e58fedde8e3

--- unittest-list.c
+++ unittest-list.c
@@ -10,6 +10,7 @@

 #include "diminuto_list.h"
 #include "diminuto_countof.h"
+#include "diminuto_comparator.h"
 #include "diminuto_unittest.h"
 #include <stdio.h>
 #include <stdarg.h>
@@ -26,9 +27,7 @@
  */
 static int find(void * datap, void * contextp)
 {
-    return (datap != (void *)0)
-        ? strcmp((const char *)contextp, (const char *)datap)
-        : 0;
+    return datap ? diminuto_compare_strings(contextp, datap) : 0;
 }

 /*
@@ -36,12 +35,7 @@
  */
 static int count(void * datap, void * contextp)
 {
-    if (datap == (void *)0) {
-        return 0;
-    } else {
-        ++(*((int *)contextp));
-        return 1;
-    }
+    return datap ? (++(*((int *)contextp)), 1) : 0;
 }

 static void initialize(void)


context: do not leak error

context: do not leak error

--- gusb/gusb-context.c
+++ gusb/gusb-context.c
@@ -315,6 +315,7 @@
 	if (device == NULL) {
 		g_debug ("There was a problem creating the device: %s",
 		         error->message);
+		g_error_free (error);
 		goto out;
 	}


repaired last nights oops

repaired last nights oops

--- gridftp/server-lib/src/globus_gridftp_server_control.c
+++ gridftp/server-lib/src/globus_gridftp_server_control.c
@@ -532,10 +532,6 @@
         if(op->gid_array)
         {
             globus_free(op->gid_array);
-        }
-        if(op->glob_match_str != NULL)
-        {
-            globus_free(fact_str);
         }

         GlobusLServerRefDec(op->server_handle);
@@ -4402,6 +4398,7 @@
     globus_i_gsc_transfer_cb_t          list_cb,
     void *                              user_arg)
 {
+    globus_bool_t                       free_fact = GLOBUS_FALSE;
     char *                              fact_str;
     globus_gridftp_server_control_list_cb_t user_cb;
     GlobusGridFTPServerName(globus_i_gsc_list);
@@ -4471,6 +4468,10 @@
             break;
     }

+    if(op->glob_match_str != NULL)
+    {
+        free_fact = GLOBUS_TRUE;
+    }
     if(user_cb != NULL)
     {
         user_cb(
@@ -4483,6 +4484,10 @@
     else
     {
         return GlobusGridFTPServerControlErrorSyntax();
+    }
+    if(free_fact)
+    {
+        globus_free(fact_str);
     }

     GlobusGridFTPServerDebugInternalExit();


add back google service

add back google service

--- ChatDemo-UI3.0/Class/AppDelegate.h
+++ ChatDemo-UI3.0/Class/AppDelegate.h
@@ -19,6 +19,6 @@
 @property (strong, nonatomic) MainViewController *mainViewController;

 /** Google Analytics **/
-//@property (strong, nonatomic) id<GAITracker> tracker;
+@property (strong, nonatomic) id<GAITracker> tracker;

 @end


ethernet: set DMA owner after all descriptors have configured

--- components/soc/src/esp32/emac_hal.c
+++ components/soc/src/esp32/emac_hal.c
@@ -467,44 +467,55 @@
     if (lastlen) {
         bufcount++;
     }
+    if (bufcount > CONFIG_ETH_DMA_TX_BUFFER_NUM) {
+        goto err;
+    }
+
+    eth_dma_tx_descriptor_t *desc_iter = hal->tx_desc;
     /* A frame is transmitted in multiple descriptor */
-    for (uint32_t i = 0; i < bufcount; i++) {
+    for (int i = 0; i < bufcount; i++) {
         /* Check if the descriptor is owned by the Ethernet DMA (when 1) or CPU (when 0) */
-        if (hal->tx_desc->TDES0.Own != EMAC_DMADESC_OWNER_CPU) {
+        if (desc_iter->TDES0.Own != EMAC_DMADESC_OWNER_CPU) {
             goto err;
         }
         /* Clear FIRST and LAST segment bits */
-        hal->tx_desc->TDES0.FirstSegment = 0;
-        hal->tx_desc->TDES0.LastSegment = 0;
+        desc_iter->TDES0.FirstSegment = 0;
+        desc_iter->TDES0.LastSegment = 0;
+        desc_iter->TDES0.InterruptOnComplete = 0;
         if (i == 0) {
             /* Setting the first segment bit */
-            hal->tx_desc->TDES0.FirstSegment = 1;
+            desc_iter->TDES0.FirstSegment = 1;
         }
         if (i == (bufcount - 1)) {
             /* Setting the last segment bit */
-            hal->tx_desc->TDES0.LastSegment = 1;
+            desc_iter->TDES0.LastSegment = 1;
             /* Enable transmit interrupt */
-            hal->tx_desc->TDES0.InterruptOnComplete = 1;
+            desc_iter->TDES0.InterruptOnComplete = 1;
             /* Program size */
-            hal->tx_desc->TDES1.TransmitBuffer1Size = lastlen;
+            desc_iter->TDES1.TransmitBuffer1Size = lastlen;
             /* copy data from uplayer stack buffer */
-            memcpy((void *)(hal->tx_desc->Buffer1Addr), buf + i * CONFIG_ETH_DMA_BUFFER_SIZE, lastlen);
+            memcpy((void *)(desc_iter->Buffer1Addr), buf + i * CONFIG_ETH_DMA_BUFFER_SIZE, lastlen);
             sentout += lastlen;
         } else {
             /* Program size */
-            hal->tx_desc->TDES1.TransmitBuffer1Size = CONFIG_ETH_DMA_BUFFER_SIZE;
+            desc_iter->TDES1.TransmitBuffer1Size = CONFIG_ETH_DMA_BUFFER_SIZE;
             /* copy data from uplayer stack buffer */
-            memcpy((void *)(hal->tx_desc->Buffer1Addr), buf + i * CONFIG_ETH_DMA_BUFFER_SIZE, CONFIG_ETH_DMA_BUFFER_SIZE);
+            memcpy((void *)(desc_iter->Buffer1Addr), buf + i * CONFIG_ETH_DMA_BUFFER_SIZE, CONFIG_ETH_DMA_BUFFER_SIZE);
             sentout += CONFIG_ETH_DMA_BUFFER_SIZE;
         }
-        /* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
+        /* Point to next descriptor */
+        desc_iter = (eth_dma_tx_descriptor_t *)(desc_iter->Buffer2NextDescAddr);
+    }
+
+    /* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
+    for (int i = 0; i < bufcount; i++) {
         hal->tx_desc->TDES0.Own = EMAC_DMADESC_OWNER_DMA;
-        /* Point to next descriptor */
         hal->tx_desc = (eth_dma_tx_descriptor_t *)(hal->tx_desc->Buffer2NextDescAddr);
     }
-err:
     hal->dma_regs->dmatxpolldemand = 0;
     return sentout;
+err:
+    return 0;
 }

 uint32_t emac_hal_receive_frame(emac_hal_context_t *hal, uint8_t *buf, uint32_t size, uint32_t *frames_remain, uint32_t *free_desc)


moving common code into function

moving common code into function

--- RoutingAlgorithms/ShortestPathRouting.h
+++ RoutingAlgorithms/ShortestPathRouting.h
@@ -33,6 +33,10 @@
     typedef BasicRoutingInterface<DataFacadeT> super;
     typedef SearchEngineData::QueryHeap QueryHeap;
     SearchEngineData & engine_working_data;
+
+    int ComputeEdgeOffset(const PhantomNode & phantom) {
+        return phantom.weight1 + (phantom.isBidirected() ? phantom.weight2 : 0);
+    }

 public:
     ShortestPathRouting(
@@ -142,8 +146,12 @@
                 );
                 // INFO("rv2: " << phantom_node_pair.targetPhantom.edgeBasedNode+1 << ", w;" << phantom_node_pair.targetPhantom.weight2 );
            }
-            const int forward_offset = phantom_node_pair.startPhantom.weight1 + (phantom_node_pair.startPhantom.isBidirected() ? phantom_node_pair.startPhantom.weight2 : 0);
-            const int reverse_offset = phantom_node_pair.targetPhantom.weight1 + (phantom_node_pair.targetPhantom.isBidirected() ? phantom_node_pair.targetPhantom.weight2 : 0);
+            const int forward_offset =  ComputeEdgeOffset(
+                                            phantom_node_pair.startPhantom
+                                        );
+            const int reverse_offset =  ComputeEdgeOffset(
+                                            phantom_node_pair.targetPhantom
+                                        );

             //run two-Target Dijkstra routing step.
             while(0 < (forward_heap1.Size() + reverse_heap1.Size() )){


Fixed deselection redraw.

Fixed deselection redraw.

--- wintable/new/select.h
+++ wintable/new/select.h
@@ -36,14 +36,15 @@
 	if (t->selectedColumn >= t->nColumns)
 		panic("sanity check failure: new Table selection invalid (column out of range)");

-	// only scroll if we selected something
-	if (t->selectedRow == -1 || t->selectedColumn == -1)
-		goto noScroll;
-
+	// do this even if we don't scroll before; noScroll depends on it
 	if (GetClientRect(t->hwnd, &client) == 0)
 		panic("error getting Table client rect in doselect()");
 	client.top += t->headerHeight;
 	height = rowht(t);
+
+	// only scroll if we selected something
+	if (t->selectedRow == -1 || t->selectedColumn == -1)
+		goto noScroll;

 	// first vertically scroll to the new row to make it fully visible (or as visible as possible)
 	if (t->selectedRow < t->vscrollpos)
@@ -83,7 +84,6 @@
 noScroll:
 	// now redraw the old and new /rows/
 	// we do this after scrolling so the rectangles to be invalidated make sense
-	// TODO this doesn't work correctly if we're deselecting
 	r.left = client.left;
 	r.right = client.right;
 	if (oldrow != -1 && oldrow >= t->vscrollpos) {


Fix for rgba images (based on the code from qimage_producer)

git-svn-id: 5ee9a2a761147e4d9fa32565ef7949b666b061d3@1004 d19143bc-622f-0410-bfdd-b5b2a6649095

--- src/modules/gtk2/producer_pixbuf.c
+++ src/modules/gtk2/producer_pixbuf.c
@@ -298,24 +298,45 @@
 	// The fault is not in the design of mlt, but in the implementation of the pixbuf producer...
 	if ( *buffer != NULL )
 	{
-		// Clone the image and the alpha
-		uint8_t *image_copy = mlt_pool_alloc( image_size );
-		uint8_t *alpha_copy = mlt_pool_alloc( alpha_size );
-
-		memcpy( image_copy, *buffer, image_size );
-
-		// Copy or default the alpha
-		if ( alpha != NULL )
-			memcpy( alpha_copy, alpha, alpha_size );
-		else
-			memset( alpha_copy, 255, alpha_size );
-
-		// Now update properties so we free the copy after
-		mlt_properties_set_data( properties, "image", image_copy, image_size, mlt_pool_release, NULL );
-		mlt_properties_set_data( properties, "alpha", alpha_copy, alpha_size, mlt_pool_release, NULL );
-
-		// We're going to pass the copy on
-		*buffer = image_copy;
+		if ( *format == mlt_image_yuv422 || *format == mlt_image_yuv420p )
+		{
+			// Clone the image and the alpha
+			uint8_t *image_copy = mlt_pool_alloc( image_size );
+			uint8_t *alpha_copy = mlt_pool_alloc( alpha_size );
+
+			memcpy( image_copy, *buffer, image_size );
+
+			// Copy or default the alpha
+			if ( alpha != NULL )
+				memcpy( alpha_copy, alpha, alpha_size );
+			else
+				memset( alpha_copy, 255, alpha_size );
+
+			// Now update properties so we free the copy after
+			mlt_properties_set_data( properties, "image", image_copy, image_size, mlt_pool_release, NULL );
+			mlt_properties_set_data( properties, "alpha", alpha_copy, alpha_size, mlt_pool_release, NULL );
+
+			// We're going to pass the copy on
+			*buffer = image_copy;
+		}
+		else if ( *format == mlt_image_rgb24a )
+		{
+			// Clone the image and the alpha
+			image_size = *width * ( *height + 1 ) * 4;
+			alpha_size = *width * ( *height + 1 );
+			uint8_t *image_copy = mlt_pool_alloc( image_size );
+			uint8_t *alpha_copy = mlt_pool_alloc( alpha_size );
+
+			mlt_convert_yuv422_to_rgb24a(*buffer, image_copy, (*width)*(*height));
+
+			// Now update properties so we free the copy after
+			mlt_properties_set_data( properties, "image", image_copy, image_size, mlt_pool_release, NULL );
+			mlt_properties_set_data( properties, "alpha", alpha_copy, alpha_size, mlt_pool_release, NULL );
+
+			// We're going to pass the copy on
+			*buffer = image_copy;
+		}
+
 	}
 	else
 	{


getter doesn't receive value

--- FTL/include/Property.h
+++ FTL/include/Property.h
@@ -154,12 +154,12 @@

 		InterfaceType get()
 		{
-			return getter(value);
+			return getter();
 		}

 		InterfaceType get() const
 		{
-			return getter(value);
+			return getter();
 		}

 		operator InterfaceType()


Delete FYAPPWheelViewLayout.h

Delete FYAPPWheelViewLayout.h

--- FYAPPWheelViewLayout.h
+++ FYAPPWheelViewLayout.h
@@ -1,5 +0,0 @@
-#import <UIKit/UIKit.h>
-
-@interface FYAPPWheelViewLayout : UICollectionViewFlowLayout
-
-@end


Minor change in memory alignment of tensors

--- Fastor/config/macros.h
+++ Fastor/config/macros.h
@@ -105,7 +105,7 @@
 #define FASTOR_DOUBLE_BITSIZE (sizeof(double)*8)
 #define FASTOR_SINGLE_BITSIZE (sizeof(float)*8)
 #ifndef FASTOR_SCALAR_BITSIZE
-#define FASTOR_SCALAR_BITSIZE FASTOR_DOUBLE_SIZE
+#define FASTOR_SCALAR_BITSIZE FASTOR_DOUBLE_BITSIZE
 #endif

@@ -124,12 +124,12 @@
 #endif

 /* User controllable alignment for Fastor containers */
-#define FASTOR_ALIGN alignas(FASTOR_MEMORY_ALIGNMENT_VALUE)
+#define FASTOR_ALIGN alignas((FASTOR_MEMORY_ALIGNMENT_VALUE))
 /* Strict non-controllable alignment for Fastor's internal use */
-#define FASTOR_ARCH_ALIGN alignas(FASTOR_MEMORY_ALIGNMENT_VALUE)
+#define FASTOR_ARCH_ALIGN alignas((FASTOR_MEMORY_ALIGNMENT_VALUE))

 // Conservative alignment for SIMD
-#if defined(FASTOR_CONSERVATIVE_ALIGN) || defined(FASTOR_DONT_VECTORISE)
+#if defined(FASTOR_DONT_ALIGN) || defined(FASTOR_DONT_VECTORISE)
     #define FASTOR_ALIGNED false
 #else
     #define FASTOR_ALIGNED true


add access to SPIFFS properties

add access to SPIFFS properties

--- hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h
+++ hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h
@@ -96,6 +96,13 @@
   bool create(const char *filepath);
   bool remove(const char *filepath);
   bool rename(const char *filename, const char *newname);
+  size_t size(){ return _filesystemStorageHandle.cfg.phys_size; }
+  size_t blockSize(){ return _filesystemStorageHandle.cfg.log_block_size; }
+  size_t totalBlocks(){ return _filesystemStorageHandle.block_count; }
+  size_t freeBlocks(){ return _filesystemStorageHandle.free_blocks; }
+  size_t pageSize(){ return _filesystemStorageHandle.cfg.log_page_size; }
+  size_t allocatedPages(){ return _filesystemStorageHandle.stats_p_allocated; }
+  size_t deletedPages(){ return _filesystemStorageHandle.stats_p_deleted; }

   FSFile open(const char *filename, uint8_t mode = FSFILE_READ);
   FSFile open(spiffs_dirent* entry, uint8_t mode = FSFILE_READ);


list.h: Use offsetof from stddef.h

list.h: Use offsetof from stddef.h

Instead of undefining an existing offsetof, include stddef.h which
provides offsetof.

Ref: #114

--- upnp/inc/list.h
+++ upnp/inc/list.h
@@ -1,5 +1,7 @@
 #ifndef _LINUX_LIST_H
 #define _LINUX_LIST_H
+
+#include <stddef.h> /* for offsetof */

 #include "poison.h"

@@ -18,9 +20,6 @@

 #undef WRITE_ONCE
 #define WRITE_ONCE(x,y) x = y
-
-#undef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)

 /**
  * container_of - cast a member of a structure out to the containing structure


Reduce debugging unless WOCKY_TLS_DEBUG_LEVEL exceeds the async detail level.

--- wocky/wocky-openssl.c
+++ wocky/wocky-openssl.c
@@ -330,7 +330,8 @@
   GOutputStream *output = g_io_stream_get_output_stream (session->stream);
   long wsize = BIO_get_mem_data (session->wbio, &wbuf);

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();

   g_output_stream_write_async (output, wbuf, wsize, prio, cancel,
                                wocky_tls_session_write_ready, session);
@@ -342,7 +343,9 @@
   GInputStream *input = g_io_stream_get_input_stream (session->stream);
   WockyTLSJob *handshake = (WockyTLSJob *) &session->job.handshake.job;

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();
+
   g_input_stream_read_async (input,
                              &(handshake->rbuf),
                              MAX_SSLV3_BLOCK_SIZE,
@@ -363,7 +366,8 @@
   gboolean done = session->job.handshake.done;
   gboolean fatal = FALSE;

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();

   if (!done)
     {
@@ -459,7 +463,8 @@
   gint prio = session->job.read.io_priority;
   GCancellable *cancel = session->job.read.cancellable;

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();

   g_input_stream_read_async (input, rbuf, MAX_SSLV3_BLOCK_SIZE, prio, cancel,
                              wocky_tls_session_read_ready, session);
@@ -474,7 +479,8 @@
   GOutputStream *output = g_io_stream_get_output_stream (session->stream);
   GCancellable *cancel = session->job.read.cancellable;

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();

   wsize = BIO_get_mem_data (session->wbio, &wbuf);

@@ -795,7 +801,6 @@
   X509_CINF *ci = cert->cert_info;
   static const long nid[] = { NID_commonName, NID_subject_alt_name, NID_undef };

-  DEBUG ();
   /* first, see if the x509 name contains the info we want: */
   for (i = 0; nid[i] != NID_undef; i++)
     {
@@ -1024,7 +1029,9 @@
 {
   WockyTLSSession *session = WOCKY_TLS_INPUT_STREAM (stream)->session;

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();
+
   wocky_tls_job_start (&session->job.read, stream,
                        io_priority, cancellable, callback, user_data,
                        wocky_tls_input_stream_read_async);
@@ -1041,7 +1048,8 @@
 {
   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();
   {
     GObject *source_object;

@@ -1104,7 +1112,8 @@
 {
   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();
   {
     GObject *source_object;

@@ -1261,7 +1270,8 @@
   gchar *buf = session->job.handshake.job.active ?
     session->job.handshake.job.rbuf : session->job.read.rbuf;

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();

   rsize = g_input_stream_read_finish (input, result, error);

@@ -1300,7 +1310,8 @@
   gint buffered = BIO_pending (session->wbio);
   gssize written;

-  DEBUG ();
+  if (tls_debug_level >= DEBUG_ASYNC_DETAIL_LEVEL)
+    DEBUG ();

   written = g_output_stream_write_finish (G_OUTPUT_STREAM (object), result,
                                           &(session->job.write.error));


Change halloc_set_allocator to only set on success.

--- halloc/src/halloc.c
+++ halloc/src/halloc.c
@@ -40,10 +40,8 @@
  *
  */
 realloc_t halloc_allocator = NULL;
-realloc_t halloc_wrapped_allocator = NULL;

 #define allocator halloc_allocator
-#define wrapped_allocator halloc_wrapped_allocator

 /*
  *	static methods
@@ -64,7 +62,10 @@
 	/* set up default allocator */
 	if (! allocator)
 	{
-		halloc_set_allocator(realloc);
+		if (halloc_set_allocator(realloc) == 0)
+		{
+			halloc_set_allocator(_realloc);
+		}
 		assert(allocator);
 	}

@@ -189,7 +190,6 @@
 	 *
 	 *	Thanks to Stan Tobias for pointing this tricky part out.
 	 */
-	allocator = realloc_func;
 	if (! (p = malloc(1)))
 		/* hmm */
 		return -1;
@@ -197,11 +197,10 @@
 	if ((p = realloc_func(p, 0)))
 	{
 		/* realloc_func cannot be used as free() */
-		allocator = _realloc;
-		wrapped_allocator = realloc_func;
 		free(p);
 		return 0;
 	}
+	allocator = realloc_func;
 	return 1;
 }

@@ -211,7 +210,7 @@
 	 *	free'ing realloc()
 	 */
 	if (n)
-		return wrapped_allocator(ptr, n);
+		return realloc(ptr, n);
 	free(ptr);
 	return NULL;
 }


Fix fencepost error in readlink; inspired by OpenBSD

--- gnu/usr.bin/tar/create.c
+++ gnu/usr.bin/tar/create.c
@@ -631,7 +631,7 @@
       int size;
       char *buf = alloca (PATH_MAX + 1);

-      size = readlink (p, buf, PATH_MAX + 1);
+      size = readlink (p, buf, PATH_MAX);
       if (size < 0)
 	goto badperror;
       buf[size] = '\0';


ssl_verify: comment X509_NAME undef

ssl_verify: comment X509_NAME undef

--- common/ssl_verify.h
+++ common/ssl_verify.h
@@ -29,7 +29,10 @@
 #include <openssl/x509.h>
 #include <openssl/ssl.h>
 #include <openssl/err.h>
+#ifdef X509_NAME
+/* wincrypt.h has already a different define... */
 #undef X509_NAME
+#endif
 #include <openssl/x509v3.h>

 #ifdef __cplusplus


Avances

Avances

--- native/nativelauncher.c
+++ native/nativelauncher.c
@@ -252,10 +252,9 @@
             val = sprintf(aux, "-cp %s ", p._class_path);
             aux += val;
         }
-        val = sprintf(aux, "%s", p._main_class);
-        aux += val;
-    }
-    printf("[%s]\n", buffer);
+        sprintf(aux, "%s", p._main_class);
+    }
+    printf("[%lu][%zu][%s]\n", sizeof (buffer), strlen(buffer), buffer);
 }

 static void error(char* error) {


Implement review comments from kkolinko on the original fix for BZ 58566
Quit as early as possible if no SNI callback method is available in the Java code
Ensure that Java long values always point to tcn_ssl_ctxt_t structures

git-svn-id: 9aee25b0727c23acc0dec90e5217993066ef893c@1711991 13f79535-47bb-0310-9956-ffa450edef68

--- native/src/sslcontext.c
+++ native/src/sslcontext.c
@@ -97,19 +97,21 @@
     const char *servername;
     jstring hostname;
     jlong original_ssl_context, new_ssl_context;
+    tcn_ssl_ctxt_t *new_c;
+
+    // Continue only if the static method exists
+    if (sni_java_callback == NULL) {
+        return SSL_TLSEXT_ERR_OK;
+    }
+
     (*javavm)->AttachCurrentThread(javavm, (void **)&env, NULL);

     // Get the host name presented by the client
     servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);

-    // Convert parameters ready for the method call
+    // Convert to Java compatible parameters ready for the method call
     hostname = (*env)->NewStringUTF(env, servername);
-    original_ssl_context = P2J(c->ctx);
-
-    // Make the call only if the static method exists
-    if (sni_java_callback == NULL) {
-        return SSL_TLSEXT_ERR_OK;
-    }
+    original_ssl_context = P2J(c);

     new_ssl_context = (*env)->CallStaticLongMethod(env,
                                                    ssl_context_class,
@@ -117,9 +119,10 @@
                                                    original_ssl_context,
                                                    hostname);

-    if (new_ssl_context != 0 && original_ssl_context != new_ssl_context) {
-        SSL_set_SSL_CTX(ssl, J2P(new_ssl_context, SSL_CTX *));
-    }
+    if (new_ssl_context != 0 && new_ssl_context != original_ssl_context) {
+        new_c = J2P(new_ssl_context, tcn_ssl_ctxt_t *);
+        SSL_set_SSL_CTX(ssl, new_c->ctx);
+	}

     return SSL_TLSEXT_ERR_OK;
 }


mac80211: add missing kernel-doc

mac80211: add missing kernel-doc

Add a few kernel-doc descriptions that were missed
during mesh development.

Reported-by: Randy Dunlap <6f29df8e90a57f1ba61ffd63b0468c86bb6d3a99@xenotime.net>
Signed-off-by: Ashok Nagarajan <9e0b93e9c5810aeb0f2c6945dc4891f6e9aba875@cozybit.com>
Acked-by: Randy Dunlap <6f29df8e90a57f1ba61ffd63b0468c86bb6d3a99@xenotime.net>
Signed-off-by: Johannes Berg <bff32994ff0f8d048f262a8388145a71b6071bfe@intel.com>

--- net/mac80211/sta_info.h
+++ net/mac80211/sta_info.h
@@ -271,6 +271,9 @@
  * @plink_timer: peer link watch timer
  * @plink_timer_was_running: used by suspend/resume to restore timers
  * @t_offset: timing offset relative to this host
+ * @t_offset_setpoint: reference timing offset of this sta to be used when
+ * 	calculating clockdrift
+ * @ch_type: peer's channel type
  * @debugfs: debug filesystem info
  * @dead: set to true when sta is unlinked
  * @uploaded: set to true when sta is uploaded to the driver


[NET]: Add preemption point in qdisc_run

The qdisc_run loop is currently unbounded and runs entirely in a
softirq.  This is bad as it may create an unbounded softirq run.

This patch fixes this by calling need_resched and breaking out if
necessary.

It also adds a break out if the jiffies value changes since that would
indicate we've been transmitting for too long which starves other
softirqs.

Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/sched/sch_generic.c
+++ net/sched/sch_generic.c
@@ -184,10 +184,22 @@

 void __qdisc_run(struct net_device *dev)
 {
-	do {
-		if (!qdisc_restart(dev))
+	unsigned long start_time = jiffies;
+
+	while (qdisc_restart(dev)) {
+		if (netif_queue_stopped(dev))
 			break;
-	} while (!netif_queue_stopped(dev));
+
+		/*
+		 * Postpone processing if
+		 * 1. another process needs the CPU;
+		 * 2. we've been doing it for too long.
+		 */
+		if (need_resched() || jiffies != start_time) {
+			netif_schedule(dev);
+			break;
+		}
+	}

 	clear_bit(__LINK_STATE_QDISC_RUNNING, &dev->state);
 }


Fix fatal compilation error

Fix fatal compilation error

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@32561 27541ba8-7e3a-0410-8455-c3a389f83636

--- cint/cint/src/dict/longif3.h
+++ cint/cint/src/dict/longif3.h
@@ -619,7 +619,7 @@
 }

 inline istream& operator>>(istream& ist,G__ulonglong& a) {
-  ist >> a.dat);
+  ist >> a.dat;
   return(ist);
 }
 #endif


Fix another warning.

Fix another warning.

--- sbr/encode_rfc2047.c
+++ sbr/encode_rfc2047.c
@@ -313,7 +313,7 @@
 {
     int prefixlen = name ? strlen(name) + 2 : 0, charsetlen = strlen(charset);
     int outlen = 0, numencode, curlen;
-    char *output = NULL, *p = *value, *q = NULL, *linestart;
+    char *output = NULL, *p = *value, *q = NULL, *linestart = NULL;

     /*
      * Skip over any leading white space.


randomsmalltriangle(): allow circles of any size up to delta.

--- shapeme.c
+++ shapeme.c
@@ -402,7 +402,7 @@
         r->type = TYPE_CIRCLE;
         r->u.c.x1 = x;
         r->u.c.y1 = y;
-        r->u.c.radius = delta;
+        r->u.c.radius = randbetween(1,delta);
     }
     r->r = random()%256;
     r->g = random()%256;


nodedev: ignore EINVAL from libudev in udevEventHandleThread

Certain udev entries might be of a size that makes libudev emit EINVAL
which right now leads to udevEventHandleThread exiting. Due to no more
handling events other elements of libvirt will start pushing for events
to be consumed which never happens causing a busy loop burning a cpu
without any gain.

After evaluation of the example case discussed in in #245 and a test
run ignoring EINVAL it was considered safe to add EINVAL to the ignored
errnos to not exit udevEventHandleThread giving it more resilience.

The root cause is in systemd and by now was discussed and fixed via
https://github.com/systemd/systemd/issues/24987, but hardening libvirt
to be able to better deal with EINVAL returned still is the right thing
to avoid the reported busy loops on systemd with older systemd versions.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/245

Signed-off-by: Christian Ehrhardt <48da28e2c2cd455d60e19b14c46925e20a3c5d5b@canonical.com>
Reviewed-by: Daniel P. Berrangé <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

--- src/node_device/node_device_udev.c
+++ src/node_device/node_device_udev.c
@@ -1865,10 +1865,12 @@
             }

             /* POSIX allows both EAGAIN and EWOULDBLOCK to be used
-             * interchangeably when the read would block or timeout was fired
+             * interchangeably when the read would block or timeout was fired.
+             * EINVAL might happen on too large udev entries, ignore those for
+             * the robustness of udevEventHandleThread.
              */
             VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR
-            if (errno != EAGAIN && errno != EWOULDBLOCK) {
+            if (errno != EAGAIN && errno != EWOULDBLOCK && errno != EINVAL) {
             VIR_WARNINGS_RESET
                 virReportSystemError(errno, "%s",
                                      _("failed to receive device from udev "


node_device_udev.h: Drop include of libudev.h

Nothing in the header file requires the include of libudev.h, as
the former header file is now empty.

Signed-off-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>
Reviewed-by: Jonathon Jongsma <c7254805a17bd5c41e24c3a278fcbf3afcdfb0fa@redhat.com>

--- src/node_device/node_device_udev.h
+++ src/node_device/node_device_udev.h
@@ -19,5 +19,3 @@
  */

 #pragma once
-
-#include <libudev.h>


cli: include missing `glib/gprintf.h' header

--- cli/qmicli.c
+++ cli/qmicli.c
@@ -26,6 +26,7 @@
 #include <string.h>

 #include <glib.h>
+#include <glib/gprintf.h>
 #include <gio/gio.h>

 #include <libqmi-glib.h>


Fix handle couldn't ping ipv4 addr in IPv4v6

Fix adds the missing ipv4 default gateway configuration when
data connection in ipv4v6 mode.

Resolves: LE1601M-8
Change-Id: I6345bcd4febe293602f5fcbee62a7f04a0473e45

--- components/dataConnectionService/dcsServer.c
+++ components/dataConnectionService/dcsServer.c
@@ -505,41 +505,65 @@
     le_mdc_ProfileRef_t profileRef
 )
 {
-    bool isIpv6 = false;
-    char gatewayAddr[100] = {0};
-    char interface[100] = {0};
-    le_result_t (*getGatewayFunction)(le_mdc_ProfileRef_t,char*,size_t) = NULL;
-
-    if ( le_mdc_IsIPv6(profileRef) ) {
-        isIpv6 = true;
-        getGatewayFunction = le_mdc_GetIPv6GatewayAddress;
-    }
-    else if ( le_mdc_IsIPv4(profileRef) )
-    {
-        isIpv6 = false;
-        getGatewayFunction = le_mdc_GetIPv4GatewayAddress;
-    }
-    else
+    bool isIpv6 = true;
+    char ipv6GatewayAddr[LE_MDC_IPV6_ADDR_MAX_BYTES] = {0};
+    char ipv4GatewayAddr[LE_MDC_IPV4_ADDR_MAX_BYTES] = {0};
+    char interface[LE_MDC_INTERFACE_NAME_MAX_BYTES] = {0};
+
+    if ( !( le_mdc_IsIPv6(profileRef) || le_mdc_IsIPv4(profileRef) ) )
     {
         LE_WARN("Profile is not using IPv4 nor IPv6");
         return LE_FAULT;
     }

-    if ( getGatewayFunction &&
-         (*getGatewayFunction)(profileRef, gatewayAddr, sizeof(gatewayAddr)) != LE_OK )
-    {
-        LE_INFO("le_mdc_GetGatewayAddress failed");
-        return LE_FAULT;
-    }
-
-    if ( le_mdc_GetInterfaceName(profileRef, interface, sizeof(interface)) != LE_OK )
-    {
-        LE_WARN("le_mdc_GetInterfaceName failed");
-        return LE_FAULT;
-    }
-
-    // Set the default gateway retrieved from modem.
-    return SetDefaultGateway(interface,gatewayAddr, isIpv6);
+
+    if ( le_mdc_IsIPv6(profileRef) )
+     {
+
+       if ( le_mdc_GetIPv6GatewayAddress(profileRef, ipv6GatewayAddr, sizeof(ipv6GatewayAddr)) != LE_OK )
+        {
+          LE_INFO("le_mdc_GetIPv6GatewayAddress failed");
+          return LE_FAULT;
+        }
+
+       if ( le_mdc_GetInterfaceName(profileRef, interface, sizeof(interface)) != LE_OK )
+        {
+          LE_WARN("le_mdc_GetInterfaceName failed");
+          return LE_FAULT;
+        }
+
+       // Set the default ipv6 gateway retrieved from modem.
+       if ( SetDefaultGateway(interface,ipv6GatewayAddr, isIpv6) != LE_OK )
+        {
+          LE_WARN("SetDefaultGateway for ipv6 gateway failed");
+          return LE_FAULT;
+       }
+     }
+
+    if ( le_mdc_IsIPv4(profileRef) )
+     {
+
+       if ( le_mdc_GetIPv4GatewayAddress(profileRef, ipv4GatewayAddr, sizeof(ipv4GatewayAddr)) != LE_OK )
+        {
+           LE_INFO("le_mdc_GetIPv4GatewayAddress failed");
+           return LE_FAULT;
+        }
+
+       if ( le_mdc_GetInterfaceName(profileRef, interface, sizeof(interface)) != LE_OK )
+        {
+           LE_WARN("le_mdc_GetInterfaceName failed");
+           return LE_FAULT;
+        }
+
+        // Set the default ipv4 gateway retrieved from modem.
+        if ( SetDefaultGateway(interface,ipv4GatewayAddr, !(isIpv6)) != LE_OK )
+         {
+           LE_WARN("SetDefaultGateway for ipv4 gateway failed");
+           return LE_FAULT;
+         }
+     }
+
+    return LE_OK;
 }

 //--------------------------------------------------------------------------------------------------


Final two commands, more minor changes

Final two commands, more minor changes

%% format now correctly handled.
More pretty password prompt disabling.

--- clibsecret.c
+++ clibsecret.c
@@ -34,6 +34,8 @@
     gboolean unlock;
     gboolean lock;
     gboolean show_keyring_info;
+    gboolean new_keyring;
+    gboolean delete_keyring;
     gboolean no_auto_unlock;
     gboolean new;
     gboolean delete;
@@ -56,8 +58,10 @@
         "Lock the keyring(s) when done", NULL },
       { "keyring-info", 'I', 0, G_OPTION_ARG_NONE, &options.show_keyring_info,
         "Print keyring info", NULL },
-      //new_keyring
-      //delete_keyring
+      { "new-keyring", 'N', 0, G_OPTION_ARG_NONE, &options.new_keyring,
+        "Create new keyring", NULL },
+      { "delete-keyring", 'D', 0, G_OPTION_ARG_NONE, &options.delete_keyring,
+        "Delete specified keyring", NULL },
       { "no-auto-unlock", 'U', 0, G_OPTION_ARG_NONE, &options.no_auto_unlock,
         "Exit with error if have to unlock anything", NULL },

@@ -149,10 +153,10 @@
         struct format_parsed *parse = g_new(struct format_parsed, 1);
         parse->option = **chunk;
         parse->delim = g_strdup(*chunk + 1);
-        format = g_list_append(format, parse);
+        format = g_list_prepend(format, parse);
       }
     g_strfreev(chunks);
-    return format;
+    return g_list_reverse(format);
 }

 static void
@@ -310,6 +314,32 @@
     if (free_item) g_object_unref(item);
 }

+static const gchar UNLOCK_ABORT[] = "Collection unlock requested; aborting\n";
+
+static GVariant *
+prompt_sync_dummy(SecretService *foo, SecretPrompt *bar, GCancellable *baz,
+                  const GVariantType *qux, GError **quux)
+{
+    g_critical(UNLOCK_ABORT);
+    return NULL;
+}
+
+static void
+prompt_async_dummy(SecretService *foo, SecretPrompt *bar,
+                   const GVariantType *baz, GCancellable *qux,
+                   GAsyncReadyCallback quux, gpointer corge)
+{
+    g_critical(UNLOCK_ABORT);
+    return;
+}
+
+static GVariant *
+prompt_finish_dummy(SecretService *foo, GAsyncResult *bar, GError **baz)
+{
+    g_critical(UNLOCK_ABORT);
+    return NULL;
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -332,14 +362,16 @@
     if (options.no_auto_unlock)
       {
         SecretServiceClass *class = SECRET_SERVICE_GET_CLASS(serv);
-        //extra hacky for now
-        class->prompt_sync = NULL;
-        class->prompt_async = NULL;
-        class->prompt_finish = NULL;
+        class->prompt_sync = &prompt_sync_dummy;
+        class->prompt_async = &prompt_async_dummy;
+        class->prompt_finish = &prompt_finish_dummy;
       }

     SecretCollection *collection = NULL;
-    if (options.alias)
+    if (options.new_keyring)
+        collection = secret_collection_create_sync(serv, options.keyring,
+                                                 options.alias, 0, NULL, NULL);
+    else if (options.alias)
         collection = secret_collection_for_alias_sync(serv, options.alias,
                                      SECRET_COLLECTION_LOAD_ITEMS, NULL, NULL);
     else if (options.keyring)
@@ -356,7 +388,8 @@
         secret_service_unlock_sync(serv, collections, NULL, NULL, NULL);

     if (options.show_keyring_info)
-        // header?
+      {
+        printf("label\tstate\tctime\t\t\tmtime\n");
         for (GList *elem = collections; elem; elem = elem->next)
           {
             const char UNKNOWN[] = "unknown\t\t";
@@ -373,6 +406,7 @@
             g_free(mtime);
             g_free(label);
           }
+      }

     if (options.read)
       {
@@ -505,6 +539,9 @@
     if (options.lock)
         secret_service_lock_sync(serv, collections, NULL, NULL, NULL);

+    if (options.delete_keyring)
+        secret_collection_delete_sync(collection, NULL, NULL);
+
     g_list_free_full(collections, &g_object_unref);
     secret_service_disconnect();
 }


esp_http_client: fix few coverity warnings

--- components/esp_http_client/lib/http_header.c
+++ components/esp_http_client/lib/http_header.c
@@ -159,9 +159,6 @@
     len = vasprintf(&buf, format, argptr);
     va_end(argptr);
     ESP_RETURN_ON_FALSE(buf, 0, TAG, "Memory exhausted");
-    if (buf == NULL) {
-        return 0;
-    }
     http_header_set(header, key, buf);
     free(buf);
     return len;


gdma: fix incorrect calculation of tx fifo size

--- components/hal/esp32s3/include/hal/gdma_ll.h
+++ components/hal/esp32s3/include/hal/gdma_ll.h
@@ -486,7 +486,7 @@
 static inline void gdma_ll_tx_extend_fifo_size_to(gdma_dev_t *dev, uint32_t channel, uint32_t size_in_bytes)
 {
     if (size_in_bytes > SOC_GDMA_L2_FIFO_BASE_SIZE) {
-        dev->sram_size[channel].out_size = size_in_bytes / 8;
+        dev->sram_size[channel].out_size =  (size_in_bytes - SOC_GDMA_L2_FIFO_BASE_SIZE) / 8;
     }
 }


解决了遇到类似如下信息 gcc: error: a.o: No such file or directory 导致 Segmentation fault 的问题

--- out_color_info.c
+++ out_color_info.c
@@ -108,6 +108,9 @@
 static void color_print_line(const char *line, const char *color, int b_cn)
 {
 	// color_comile.c:35:6: warning: unused variable ‘t’ [-Wunused-variable]
+	// arm-linux-gcc: error: xxx: No such file or directory
+	// gcc: 错误： test.c：没有那个文件或目录
+	// gcc: 致命错误： 没有输入文件
 	char *filename;
 	char *row;
 	char *col;
@@ -119,29 +122,62 @@
 	printf("%s%s%s%s:", color, BOLD, buf, COLOR_END);

 	row = index(filename + 1, ':');
-	snprintf(buf, row - filename, "%s", filename + 1);
-	printf("%s%s%s%s:", ROW_COLOR, BOLD, buf, COLOR_END);
+	if (row != NULL)
+	{
+		snprintf(buf, row - filename, "%s", filename + 1);
+		printf("%s%s%s%s:", ROW_COLOR, BOLD, buf, COLOR_END);
+	}
+	else
+	{
+		printf("%s\n", filename + 1);
+		return;
+	}
+

 	col = index(row + 1, ':');
-	snprintf(buf, col - row, "%s", row + 1);
-	printf("%s%s%s:", COL_COLOR, buf, COLOR_END);
+	if (col != NULL)
+	{
+		snprintf(buf, col - row, "%s", row + 1);
+		printf("%s%s%s:", COL_COLOR, buf, COLOR_END);
+	}
+	else
+	{
+		printf("%s\n", row + 1);
+		return;
+	}

 	if (FALSE == b_cn)
 	{
 		msg = index(col + 1, ':');
-		snprintf(buf, msg - col, "%s", col + 1);
-		printf("%s%s%s:", color, buf, COLOR_END);
-
-		printf("%s%s%s%s", color, BOLD, msg + 1, COLOR_END);
+		if (msg != NULL)
+		{
+			snprintf(buf, msg - col, "%s", col + 1);
+			printf("%s%s%s:", color, buf, COLOR_END);
+
+			printf("%s%s%s%s", color, BOLD, msg + 1, COLOR_END);
+		}
+		else
+		{
+			printf("%s\n", col + 1);
+		}
 	}
 	else
 	{
 		msg = strstr(col + 1, "：");
-		snprintf(buf, msg - col, "%s", col + 1);
-		printf("%s%s%s：", color, buf, COLOR_END);
-
-		printf("%s%s%s%s", color, BOLD, msg + strlen("："), COLOR_END);
-	}
+		if (msg != NULL)
+		{
+			snprintf(buf, msg - col, "%s", col + 1);
+			printf("%s%s%s：", color, buf, COLOR_END);
+
+			printf("%s%s%s%s", color, BOLD, msg + strlen("："), COLOR_END);
+		}
+		else
+		{
+			printf("%s\n", col + 1);
+		}
+	}
+
+	return;
 }

 static void color_print_make_error(const char *line)


ieee: Fix section index match in sectalign handler

Signed-off-by: Cyrill Gorcunov <7a1ea01eee6961eb1e372e3508c2670446d086f4@gmail.com>

--- output/outieee.c
+++ output/outieee.c
@@ -848,7 +848,7 @@
     struct ieeeSection *s;

     list_for_each(s, seghead) {
-        if (s->index == seg - 1)
+        if (s->index == seg)
             break;
     }


auth: Minor code cleanup.

auth: Minor code cleanup.

--HG--
branch : HEAD


casts can be constants if their sub-exp is


missing initialization

missing initialization


Imported external & Called function

Imported external & Called function


refine tasker out discard check

refine tasker out discard check


- Properly initialize the count_win when the user turns the info window
  back on (and count_win is recreated).
- Create info_win as the same size for all invocations.

PR:             37552
Submitted by:   Mark Valentine <mark@thuvia.demon.co.uk>
MFC after:      1 week

--- usr.bin/ee/ee.c
+++ usr.bin/ee/ee.c
@@ -3686,12 +3686,15 @@
 	idlok(text_win, TRUE);
 	werase(text_win);
 	info_window = TRUE;
-	info_win = newwin(6, COLS, 0, 0);
+	info_win = newwin(5, COLS, 0, 0);
 	werase(info_win);
 	info_type = CONTROL_KEYS;
 	midscreen(min(scr_vert, last_line), point);
 	clearok(info_win, TRUE);
 	paint_info_win();
+	count_win = newwin(1, COLS, 5, 0);
+	leaveok(count_win, TRUE);
+	wrefresh(count_win);
 	wrefresh(text_win);
 	clear_com_win = TRUE;
 }


Dump IR Volume event

Dump IR Volume event

--- mptevents.c
+++ mptevents.c
@@ -172,6 +172,30 @@
 			evt->Reserved2);
 }

+static const char *ir_volume_code_to_text(uint8_t rc)
+{
+	switch (rc) {
+		case MPI2_EVENT_IR_VOLUME_RC_SETTINGS_CHANGED: return "SETTINGS_CHANGED";
+		case MPI2_EVENT_IR_VOLUME_RC_STATUS_FLAGS_CHANGED: return "STATUS_FLAGS_CHANGED";
+		case MPI2_EVENT_IR_VOLUME_RC_STATE_CHANGED: return "STATE_CHANGED";
+	}
+
+	return "UNKNOWN";
+}
+
+static void dump_ir_volume(struct MPT2_IOCTL_EVENTS *event)
+{
+	MPI2_EVENT_DATA_IR_VOLUME *evt = (void*)&event->data;
+
+	syslog(LOG_INFO, "IR Volume: context=%u vol_dev_handle=%hx reason=%hu(%s) new_value=%u prev_value=%u reserved1=%hu",
+			event->context,
+			evt->VolDevHandle,
+			evt->ReasonCode, ir_volume_code_to_text(evt->ReasonCode),
+			evt->NewValue,
+			evt->PreviousValue,
+			evt->Reserved1);
+}
+
 static void dump_event(struct MPT2_IOCTL_EVENTS *event)
 {
 	switch (event->event) {
@@ -232,7 +256,7 @@
 			break;

 		case MPI2_EVENT_IR_VOLUME:
-			dump_name_only("IR Volume", event);
+			dump_ir_volume(event);
 			break;

 		case MPI2_EVENT_IR_PHYSICAL_DISK:


fix two conf space related hw erratas; dino-moh-humm

--- arch/hppa/dev/dino.c
+++ arch/hppa/dev/dino.c
@@ -1,7 +1,7 @@
-/*	$OpenBSD: dino.c,v 1.15 2004/09/18 07:02:23 mickey Exp $	*/
+/*	$OpenBSD: dino.c,v 1.16 2005/09/06 23:53:38 mickey Exp $	*/

 /*
- * Copyright (c) 2003 Michael Shalayeff
+ * Copyright (c) 2003-2005 Michael Shalayeff
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -186,9 +186,18 @@
 	struct dino_softc *sc = v;
 	volatile struct dino_regs *r = sc->sc_regs;
 	pcireg_t data;
+	u_int32_t pamr;
+
+	/* fix arbitration errata by disabling all pci devs on config read */
+	pamr = r->pamr;
+	r->pamr = 0;

 	r->pci_addr = tag | reg;
 	data = r->pci_conf_data;
+
+	/* restore arbitration */
+	r->pamr = pamr;
+
 	return (letoh32(data));
 }

@@ -198,13 +207,21 @@
 	struct dino_softc *sc = v;
 	volatile struct dino_regs *r = sc->sc_regs;
 	pcireg_t data1;
-
-	/* fix coalescing config writes errata by interleaving w/ a read */
+	u_int32_t pamr;
+
+	/* fix arbitration errata by disabling all pci devs on config read */
+	pamr = r->pamr;
+	r->pamr = 0;
+
+	r->pci_addr = tag | reg;
+	r->pci_conf_data = htole32(data);
+
+	/* fix coalescing config and io writes by interleaving w/ a read */
 	r->pci_addr = tag | PCI_ID_REG;
 	data1 = r->pci_conf_data;

-	r->pci_addr = tag | reg;
-	r->pci_conf_data = htole32(data);
+	/* restore arbitration */
+	r->pamr = pamr;
 }

 int


Do not play with the xmapmode register, for its layout seems to differ between
board revisions < 4 (found on Indigo) and >= 4 (found on Indy and Indigo2).

Paint the cursor as an inverted glyph, instead of exchanging bg and fg colours
(matching the current practice on other frame buffers).

Speed-up overlapping copy operations by attempting to perform them in
larger chunks whenever possible; this speeds up console jump scrolling.

--- arch/sgi/gio/grtwo.c
+++ arch/sgi/gio/grtwo.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: grtwo.c,v 1.8 2014/03/27 20:15:00 miod Exp $	*/
+/*	$OpenBSD: grtwo.c,v 1.9 2014/03/29 13:01:31 miod Exp $	*/
 /* $NetBSD: grtwo.c,v 1.11 2009/11/22 19:09:15 mbalmer Exp $	 */

 /*
@@ -101,6 +101,8 @@
 	bus_space_tag_t			iot;
 	bus_space_handle_t		ioh;

+	uint32_t			xmapmode;
+
 	uint8_t				boardrev;
 	uint8_t				backendrev;
 	int				hq2rev;
@@ -210,10 +212,8 @@
 grtwo_fillrect(struct grtwo_devconfig *dc, int x1, int y1, int x2,
     int y2, int bg)
 {
-	struct rasops_info *ri = &dc->dc_ri;
-
 	grtwo_wait_gfifo(dc);
-	grtwo_set_color(dc->iot, dc->ioh, ri->ri_devcmap[bg] & 0xff);
+	grtwo_set_color(dc->iot, dc->ioh, bg);

 	grtwo_wait_gfifo(dc);
 	bus_space_write_4(dc->iot, dc->ioh, GR2_FIFO_RECTI2D, x1);
@@ -265,7 +265,7 @@
 {
 	int i = 0;
 	uint8_t rd0, rd1, rd2, rd3;
-	uint32_t vc1, xmapmode;
+	uint32_t vc1;

 	rd0 = bus_space_read_1(dc->iot, dc->ioh, GR2_REVISION_RD0);
 	rd1 = bus_space_read_1(dc->iot, dc->ioh, GR2_REVISION_RD1);
@@ -321,11 +321,8 @@
 	bus_space_write_4(dc->iot, dc->ioh, VC1_SYSCTL,
 	    VC1_SYSCTL_VC1 | VC1_SYSCTL_DID);

-	xmapmode = bus_space_read_4(dc->iot, dc->ioh,
+	dc->xmapmode = bus_space_read_4(dc->iot, dc->ioh,
 	    XMAP5_BASEALL + XMAP5_MODE);
-	if ((xmapmode & 0x80000000) == 0)
-		bus_space_write_4(dc->iot, dc->ioh, XMAP5_BASEALL + XMAP5_MODE,
-		    (xmapmode & 0xf0f0f000) | 0x82828200);

 	/*
 	 * Setup Bt457 RAMDACs
@@ -505,7 +502,6 @@
 	ri->ri_stride = GRTWO_WIDTH;
 	ri->ri_width = GRTWO_WIDTH;
 	ri->ri_height = GRTWO_HEIGHT;
-
 	rasops_init(ri, 160, 160);

 	/*
@@ -536,7 +532,7 @@
 	dc->dc_wsd.capabilities = ri->ri_caps;

 	grtwo_fillrect(dc, 0, 0, GRTWO_WIDTH - 1, GRTWO_HEIGHT - 1,
-	    WSCOL_BLACK);
+	    ri->ri_devcmap[WSCOL_BLACK]);

 	return 0;
 }
@@ -557,11 +553,11 @@
 	if (on) {
 		/* redraw the existing character with inverted colors */
 		return grtwo_putchar_internal(ri, row, col, cell->uc,
-		    bg, fg, ul);
+		    ~ri->ri_devcmap[fg], ~ri->ri_devcmap[bg], ul);
 	} else {
 		/* redraw the existing character with correct colors */
 		return grtwo_putchar_internal(ri, row, col, cell->uc,
-		    fg, bg, ul);
+		    ri->ri_devcmap[fg], ri->ri_devcmap[bg], ul);
 	}
 }

@@ -579,7 +575,8 @@
 	cell->attr = attr;

 	ri->ri_ops.unpack_attr(ri, attr, &fg, &bg, &ul);
-	return grtwo_putchar_internal(ri, row, col, ch, fg, bg, ul);
+	return grtwo_putchar_internal(ri, row, col, ch, ri->ri_devcmap[fg],
+	    ri->ri_devcmap[bg], ul);
 }

 int
@@ -608,7 +605,7 @@

 	/* Set the drawing color */
 	grtwo_wait_gfifo(dc);
-	grtwo_set_color(dc->iot, dc->ioh, ri->ri_devcmap[fg] & 0xff);
+	grtwo_set_color(dc->iot, dc->ioh, fg);

 	/*
 	 * This character drawing operation apparently expects a 18 pixel
@@ -641,7 +638,7 @@
 				if (h != 0) {
 					bitmap -= font->stride;
 					if (ul && h == font->fontheight - 1)
-						pattern = 0xff00;
+						pattern = 0xff << 8;
 					else
 						pattern = *bitmap << 8;
 					h--;
@@ -682,19 +679,25 @@
 	struct wsdisplay_font *font = ri->ri_font;
 	struct wsdisplay_charcell *cell;
 	int y = ri->ri_yorigin + row * font->fontheight;
-	int i;
+	int delta, chunk;

 	/* Copy columns in backing store. */
 	cell = dc->dc_bs + row * ri->ri_cols;
 	memmove(cell + dst, cell + src, ncol * sizeof(*cell));

 	if (src > dst) {
-		/* may overlap, copy cell by cell */
-		for (i = 0; i < ncol; i++)
+		/* may overlap, copy in non-overlapping blocks */
+		delta = src - dst;
+		while (ncol > 0) {
+			chunk = ncol <= delta ? ncol : delta;
 			grtwo_copyrect(dc,
-			    ri->ri_xorigin + (src + i) * font->fontwidth, y,
-			    ri->ri_xorigin + (dst + i) * font->fontwidth, y,
-			    font->fontwidth, font->fontheight);
+			    ri->ri_xorigin + src * font->fontwidth, y,
+			    ri->ri_xorigin + dst * font->fontwidth, y,
+			    chunk * font->fontwidth, font->fontheight);
+			src += chunk;
+			dst += chunk;
+			ncol -= chunk;
+		}
 	} else {
 		grtwo_copyrect(dc,
 		    ri->ri_xorigin + src * font->fontwidth, y,
@@ -726,7 +729,7 @@

 	grtwo_fillrect(dc, ri->ri_xorigin + startcol * font->fontwidth, y,
 	    ri->ri_xorigin + (startcol + ncol) * font->fontwidth - 1,
-	    y + font->fontheight - 1, bg);
+	    y + font->fontheight - 1, ri->ri_devcmap[bg]);

 	return 0;
 }
@@ -738,7 +741,7 @@
 	struct grtwo_devconfig *dc = ri->ri_hw;
 	struct wsdisplay_font *font = ri->ri_font;
 	struct wsdisplay_charcell *cell;
-	int i;
+	int delta, chunk;

 	/* Copy rows in backing store. */
 	cell = dc->dc_bs + dst * ri->ri_cols;
@@ -746,13 +749,19 @@
 	    nrow * ri->ri_cols * sizeof(*cell));

 	if (src > dst) {
-		/* may overlap, copy row by row */
-		for (i = 0; i < nrow; i++)
+		/* may overlap, copy in non-overlapping blocks */
+		delta = src - dst;
+		while (nrow > 0) {
+			chunk = nrow <= delta ? nrow : delta;
 			grtwo_copyrect(dc, ri->ri_xorigin,
-			    ri->ri_yorigin + (src + i) * font->fontheight,
+			    ri->ri_yorigin + src * font->fontheight,
 			    ri->ri_xorigin,
-			    ri->ri_yorigin + (dst + i) * font->fontheight,
-			    ri->ri_emuwidth, font->fontheight);
+			    ri->ri_yorigin + dst * font->fontheight,
+			    ri->ri_emuwidth, chunk * font->fontheight);
+			src += chunk;
+			dst += chunk;
+			nrow -= chunk;
+		}
 	} else {
 		grtwo_copyrect(dc, ri->ri_xorigin,
 		    ri->ri_yorigin + src * font->fontheight, ri->ri_xorigin,
@@ -786,14 +795,16 @@
 	ri->ri_ops.unpack_attr(ri, attr, &fg, &bg, NULL);

 	if (nrow == ri->ri_rows && (ri->ri_flg & RI_FULLCLEAR)) {
-		grtwo_fillrect(dc, 0, 0, GRTWO_WIDTH - 1, GRTWO_HEIGHT - 1, bg);
+		grtwo_fillrect(dc, 0, 0, GRTWO_WIDTH - 1, GRTWO_HEIGHT - 1,
+		    ri->ri_devcmap[bg]);
 		return 0;
 	}

 	grtwo_fillrect(dc, ri->ri_xorigin,
 	    ri->ri_yorigin + startrow * font->fontheight,
 	    ri->ri_xorigin + ri->ri_emuwidth - 1,
-	    ri->ri_yorigin + (startrow + nrow) * font->fontheight - 1, bg);
+	    ri->ri_yorigin + (startrow + nrow) * font->fontheight - 1,
+	    ri->ri_devcmap[bg]);

 	return 0;
 }


mm/um: use free_highmem_page() to free highmem pages into buddy system

Use helper function free_highmem_page() to free highmem pages into
the buddy system.

Signed-off-by: Jiang Liu <68ee766e574f18b34b683085865827393efe88bd@huawei.com>
Cc: Jeff Dike <f9b6309e85863eba5d28138b6a0f35841ce976d0@addtoit.com>
Cc: Richard Weinberger <320bca71fc381a4a025636043ca86e734e31cf8b@nod.at>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- arch/um/kernel/mem.c
+++ arch/um/kernel/mem.c
@@ -42,17 +42,12 @@
 static void setup_highmem(unsigned long highmem_start,
 			  unsigned long highmem_len)
 {
-	struct page *page;
 	unsigned long highmem_pfn;
 	int i;

 	highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT;
-	for (i = 0; i < highmem_len >> PAGE_SHIFT; i++) {
-		page = &mem_map[highmem_pfn + i];
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-	}
+	for (i = 0; i < highmem_len >> PAGE_SHIFT; i++)
+		free_highmem_page(&mem_map[highmem_pfn + i]);
 }
 #endif

@@ -73,18 +68,13 @@
 	totalram_pages = free_all_bootmem();
 	max_low_pfn = totalram_pages;
 #ifdef CONFIG_HIGHMEM
-	totalhigh_pages = highmem >> PAGE_SHIFT;
-	totalram_pages += totalhigh_pages;
+	setup_highmem(end_iomem, highmem);
 #endif
 	num_physpages = totalram_pages;
 	max_pfn = totalram_pages;
 	printk(KERN_INFO "Memory: %luk available\n",
 	       nr_free_pages() << (PAGE_SHIFT-10));
 	kmalloc_ok = 1;
-
-#ifdef CONFIG_HIGHMEM
-	setup_highmem(end_iomem, highmem);
-#endif
 }

 /*


x86/vga: fix build with efi disabled.

x86/vga: fix build with efi disabled.

Reported by sfr on -next merge.

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

--- arch/x86/pci/fixup.c
+++ arch/x86/pci/fixup.c
@@ -6,8 +6,8 @@
 #include <linux/dmi.h>
 #include <linux/pci.h>
 #include <linux/init.h>
+#include <linux/vgaarb.h>
 #include <asm/pci_x86.h>
-#include <asm/vga.h>

 static void __devinit pci_fixup_i450nx(struct pci_dev *d)
 {


removed redundant comments (/refactorings/#R1).

--- src/appleseed/foundation/math/mis.h
+++ src/appleseed/foundation/math/mis.h
@@ -71,7 +71,6 @@
 // MIS heuristics implementation.
 //

-// Balance heuristic.
 template <typename T>
 inline T mis_balance(const T q1, const T q2)
 {
@@ -82,7 +81,6 @@
     return q1 / (q1 + q2);
 }

-// Power heuristic.
 template <typename T>
 inline T mis_power(const T q1, const T q2, const T beta)
 {
@@ -97,7 +95,6 @@
     return q1_pow / (q1_pow + q2_pow);
 }

-// Power heuristic with beta = 2.
 template <typename T>
 inline T mis_power2(const T q1, const T q2)
 {
@@ -111,7 +108,6 @@
     return q1_pow / (q1_pow + q2_pow);
 }

-// Cutoff heuristic.
 template <typename T>
 inline T mis_cutoff(const T q1, const T q2, const T alpha)
 {
@@ -130,7 +126,6 @@
     else return q1 / (q1 + q2);
 }

-// Maximum heuristic.
 template <typename T>
 inline T mis_maximum(const T q1, const T q2)
 {


Use #if 0 rather than comments to disable code.

Makes for nicer merge conflicts.

--- src/backend/access/transam/varsup.c
+++ src/backend/access/transam/varsup.c
@@ -77,15 +77,15 @@
 		 * To avoid swamping the postmaster with signals, we issue the
 		 * autovac request only once per 64K transaction starts.  This
 		 * still gives plenty of chances before we get into real trouble.
-		 *
-		 * if (IsUnderPostmaster && (xid % 65536) == 0)
-		 * {
-		 * 		elog(LOG, "GetNewTransactionId: requesting autovac (xid %u xidVacLimit %u)", xid, ShmemVariableCache->xidVacLimit);
-		 * 		SendPostmasterSignal(PMSIGNAL_START_AUTOVAC);
-		 * }
-		 *
-		 * MPP-19652: autovacuum disabled
 		 */
+		/* MPP-19652: autovacuum disabled */
+#if 0
+		if (IsUnderPostmaster && (xid % 65536) == 0)
+		{
+			elog(LOG, "GetNewTransactionId: requesting autovac (xid %u xidVacLimit %u)", xid, ShmemVariableCache->xidVacLimit);
+			SendPostmasterSignal(PMSIGNAL_START_AUTOVAC);
+		}
+#endif
 		if (IsUnderPostmaster &&
 		 TransactionIdFollowsOrEquals(xid, ShmemVariableCache->xidStopLimit))
 			ereport(ERROR,
@@ -274,14 +274,15 @@
 	 * assign hook (too many processes would try to execute the hook,
 	 * resulting in race conditions as well as crashes of those not connected
 	 * to shared memory).  Perhaps this can be improved someday.
-	 *
-	 * MPP-19652: autovacuum disabled
-	 *
-	 *	xidVacLimit = oldest_datfrozenxid + autovacuum_freeze_max_age;
-	 *	if (xidVacLimit < FirstNormalTransactionId)
-	 *		xidVacLimit += FirstNormalTransactionId;
-	 */
+	 */
+	/* MPP-19652: autovacuum disabled */
+#if 0
+	xidVacLimit = oldest_datfrozenxid + autovacuum_freeze_max_age;
+	if (xidVacLimit < FirstNormalTransactionId)
+		xidVacLimit += FirstNormalTransactionId;
+#else
 	xidVacLimit = xidWarnLimit;
+#endif

 	/* Grab lock for just long enough to set the new limit values */
 	LWLockAcquire(XidGenLock, LW_EXCLUSIVE);
@@ -305,9 +306,13 @@
 	 * database per invocation.  Once it's finished cleaning up the oldest
 	 * database, it'll call here, and we'll signal the postmaster to start
 	 * another iteration immediately if there are still any old databases.
-	 *
-	 * MPP-19652: autovacuum disabled
-	 */
+	 */
+	/* MPP-19652: autovacuum disabled */
+#if 0
+	if (TransactionIdFollowsOrEquals(curXid, xidVacLimit) &&
+		IsUnderPostmaster)
+		SendPostmasterSignal(PMSIGNAL_START_AUTOVAC_LAUNCHER);
+#endif

 	/* Give an immediate warning if past the wrap warn point */
 	if (TransactionIdFollowsOrEquals(curXid, xidWarnLimit))


Fixed Bug#7382 -Map crash with AB_CLEARANCE


define strerror_s

define strerror_s


Allow multiple bgworkers to be launched per postmaster iteration.

Previously, maybe_start_bgworker() would launch at most one bgworker
process per call, on the grounds that the postmaster might otherwise
neglect its other duties for too long.  However, that seems overly
conservative, especially since bad effects only become obvious when
many hundreds of bgworkers need to be launched at once.  On the other
side of the coin is that the existing logic could result in substantial
delay of bgworker launches, because ServerLoop isn't guaranteed to
iterate immediately after a signal arrives.  (My attempt to fix that
by using pselect(2) encountered too many portability question marks,
and in any case could not help on platforms without pselect().)
One could also question the wisdom of using an O(N^2) processing
method if the system is intended to support so many bgworkers.

As a compromise, allow that function to launch up to 100 bgworkers
per call (and in consequence, rename it to maybe_start_bgworkers).
This will allow any normal parallel-query request for workers
to be satisfied immediately during sigusr1_handler, avoiding the
question of whether ServerLoop will be able to launch more promptly.

There is talk of rewriting the postmaster to use a WaitEventSet to
avoid the signal-response-delay problem, but I'd argue that this change
should be kept even after that happens (if it ever does).

Backpatch to 9.6 where parallel query was added.  The issue exists
before that, but previous uses of bgworkers typically aren't as
sensitive to how quickly they get launched.

Discussion: f0ac7735602f7daf7df0ad9377035f09bf5e7d5a@sss.pgh.pa.us

--- src/backend/postmaster/postmaster.c
+++ src/backend/postmaster/postmaster.c
@@ -421,7 +421,7 @@

 static int	CountChildren(int target);
 static bool assign_backendlist_entry(RegisteredBgWorker *rw);
-static void maybe_start_bgworker(void);
+static void maybe_start_bgworkers(void);
 static bool CreateOptsFile(int argc, char *argv[], char *fullprogname);
 static pid_t StartChildProcess(AuxProcType type);
 static void StartAutovacuumWorker(void);
@@ -1346,7 +1346,7 @@
 	pmState = PM_STARTUP;

 	/* Some workers may be scheduled to start now */
-	maybe_start_bgworker();
+	maybe_start_bgworkers();

 	status = ServerLoop();

@@ -1813,7 +1813,7 @@

 		/* Get other worker processes running, if needed */
 		if (StartWorkerNeeded || HaveCrashedWorker)
-			maybe_start_bgworker();
+			maybe_start_bgworkers();

 #ifdef HAVE_PTHREAD_IS_THREADED_NP

@@ -2859,7 +2859,7 @@
 				PgStatPID = pgstat_start();

 			/* workers may be scheduled to start now */
-			maybe_start_bgworker();
+			maybe_start_bgworkers();

 			/* at this point we are really open for business */
 			ereport(LOG,
@@ -5026,7 +5026,7 @@
 	}

 	if (StartWorkerNeeded || HaveCrashedWorker)
-		maybe_start_bgworker();
+		maybe_start_bgworkers();

 	if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER) &&
 		PgArchPID != 0)
@@ -5726,22 +5726,23 @@
 }

 /*
- * If the time is right, start one background worker.
+ * If the time is right, start background worker(s).
  *
- * As a side effect, the bgworker control variables are set or reset whenever
- * there are more workers to start after this one, and whenever the overall
- * system state requires it.
+ * As a side effect, the bgworker control variables are set or reset
+ * depending on whether more workers may need to be started.
  *
- * The reason we start at most one worker per call is to avoid consuming the
+ * We limit the number of workers started per call, to avoid consuming the
  * postmaster's attention for too long when many such requests are pending.
  * As long as StartWorkerNeeded is true, ServerLoop will not block and will
  * call this function again after dealing with any other issues.
  */
 static void
-maybe_start_bgworker(void)
-{
+maybe_start_bgworkers(void)
+{
+#define MAX_BGWORKERS_TO_LAUNCH 100
+	int			num_launched = 0;
+	TimestampTz now = 0;
 	slist_mutable_iter iter;
-	TimestampTz now = 0;

 	/*
 	 * During crash recovery, we have no need to be called until the state
@@ -5826,12 +5827,16 @@
 			}

 			/*
-			 * Quit, but have ServerLoop call us again to look for additional
-			 * ready-to-run workers.  There might not be any, but we'll find
-			 * out the next time we run.
+			 * If we've launched as many workers as allowed, quit, but have
+			 * ServerLoop call us again to look for additional ready-to-run
+			 * workers.  There might not be any, but we'll find out the next
+			 * time we run.
 			 */
-			StartWorkerNeeded = true;
-			return;
+			if (++num_launched >= MAX_BGWORKERS_TO_LAUNCH)
+			{
+				StartWorkerNeeded = true;
+				return;
+			}
 		}
 	}
 }


ARM64: Fix the atomic type width in the 64bit Acquire_Load().

R=ulan@chromium.org

Review URL: https://codereview.chromium.org/220203012

git-svn-id: b158db1e4b4ab85d4c9e510fdef4b1e8c614b15b@20486 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

--- src/atomicops_internals_arm64_gcc.h
+++ src/atomicops_internals_arm64_gcc.h
@@ -309,7 +309,7 @@
 }

 inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
-  Atomic32 value;
+  Atomic64 value;

   __asm__ __volatile__ (  // NOLINT
     "ldar %x[value], %[ptr]  \n\t"


Fix reference to wrong function name

Fix reference to wrong function name

--- bin/tools/benchmark.c
+++ bin/tools/benchmark.c
@@ -201,7 +201,7 @@
     if (func == grab_frames_sync)
         g_print ("sync   ");
     else if (func == grab_frames_readout)
-        g_printf("rout   ");
+        g_print ("rout   ");
     else
         g_print ("async  ");


Have autovacuum workers listen to SIGHUP, too

They have historically ignored it, but it's been said to be useful at
times to change their settings mid-flight.

Author: Michael Paquier

--- src/backend/postmaster/autovacuum.c
+++ src/backend/postmaster/autovacuum.c
@@ -311,7 +311,7 @@
 						  PgStat_StatDBEntry *shared,
 						  PgStat_StatDBEntry *dbentry);
 static void autovac_report_activity(autovac_table *tab);
-static void avl_sighup_handler(SIGNAL_ARGS);
+static void av_sighup_handler(SIGNAL_ARGS);
 static void avl_sigusr2_handler(SIGNAL_ARGS);
 static void avl_sigterm_handler(SIGNAL_ARGS);
 static void autovac_refresh_stats(void);
@@ -419,7 +419,7 @@
 	 * backend, so we use the same signal handling.  See equivalent code in
 	 * tcop/postgres.c.
 	 */
-	pqsignal(SIGHUP, avl_sighup_handler);
+	pqsignal(SIGHUP, av_sighup_handler);
 	pqsignal(SIGINT, StatementCancelHandler);
 	pqsignal(SIGTERM, avl_sigterm_handler);

@@ -1329,7 +1329,7 @@

 /* SIGHUP: set flag to re-read config file at next convenient time */
 static void
-avl_sighup_handler(SIGNAL_ARGS)
+av_sighup_handler(SIGNAL_ARGS)
 {
 	int			save_errno = errno;

@@ -1460,11 +1460,8 @@
 	 * Set up signal handlers.  We operate on databases much like a regular
 	 * backend, so we use the same signal handling.  See equivalent code in
 	 * tcop/postgres.c.
-	 *
-	 * Currently, we don't pay attention to postgresql.conf changes that
-	 * happen during a single daemon iteration, so we can ignore SIGHUP.
-	 */
-	pqsignal(SIGHUP, SIG_IGN);
+	 */
+	pqsignal(SIGHUP, av_sighup_handler);

 	/*
 	 * SIGINT is used to signal canceling the current table's vacuum; SIGTERM
@@ -2164,6 +2161,22 @@
 		CHECK_FOR_INTERRUPTS();

 		/*
+		 * Check for config changes before processing each collected table.
+		 */
+		if (got_SIGHUP)
+		{
+			got_SIGHUP = false;
+			ProcessConfigFile(PGC_SIGHUP);
+
+			/*
+			 * You might be tempted to bail out if we see autovacuum is now
+			 * disabled.  Must resist that temptation -- this might be a
+			 * for-wraparound emergency worker, in which case that would be
+			 * entirely inappropriate.
+			 */
+		}
+
+		/*
 		 * hold schedule lock from here until we're sure that this table still
 		 * needs vacuuming.  We also need the AutovacuumLock to walk the
 		 * worker array, but we'll let go of that one quickly.


Have walsenders participate in procsignal infrastructure.

The non-participation in procsignal was a problem for both changes in
master, e.g. parallelism not working for normal statements run in
walsender backends, and older branches, e.g. recovery conflicts and
catchup interrupts not working for logical decoding walsenders.

This commit thus replaces the previous WalSndXLogSendHandler with
procsignal_sigusr1_handler.  In branches since db0f6cad48 that can
lead to additional SetLatch calls, but that only rarely seems to make
a difference.

Author: Andres Freund
Reviewed-By: Michael Paquier
Discussion: 87bdc045cec3c03ede62650541fc845c7bdcae82@alap3.anarazel.de
Backpatch: 9.4, earlier commits don't seem to benefit sufficiently

--- src/backend/replication/walsender.c
+++ src/backend/replication/walsender.c
@@ -212,7 +212,6 @@

 /* Signal handlers */
 static void WalSndSigHupHandler(SIGNAL_ARGS);
-static void WalSndXLogSendHandler(SIGNAL_ARGS);
 static void WalSndLastCycleHandler(SIGNAL_ARGS);

 /* Prototypes for private functions */
@@ -2857,17 +2856,6 @@
 	errno = save_errno;
 }

-/* SIGUSR1: set flag to send WAL records */
-static void
-WalSndXLogSendHandler(SIGNAL_ARGS)
-{
-	int			save_errno = errno;
-
-	latch_sigusr1_handler();
-
-	errno = save_errno;
-}
-
 /* SIGUSR2: set flag to do a last cycle and shut down afterwards */
 static void
 WalSndLastCycleHandler(SIGNAL_ARGS)
@@ -2901,7 +2889,7 @@
 	pqsignal(SIGQUIT, quickdie);	/* hard crash time */
 	InitializeTimeouts();		/* establishes SIGALRM handler */
 	pqsignal(SIGPIPE, SIG_IGN);
-	pqsignal(SIGUSR1, WalSndXLogSendHandler);	/* request WAL sending */
+	pqsignal(SIGUSR1, procsignal_sigusr1_handler);
 	pqsignal(SIGUSR2, WalSndLastCycleHandler);	/* request a last cycle and
 												 * shutdown */


Fix for 297735 . C_Initialize should return CKR_CANT_LOCK . r=wtchang,rrelyea

--- security/nss/lib/softoken/pkcs11.c
+++ security/nss/lib/softoken/pkcs11.c
@@ -2789,6 +2789,24 @@
     /* initialize the key and cert db's */
     nsslowkey_SetDefaultKeyDBAlg
 			     (SEC_OID_PKCS12_PBE_WITH_SHA1_AND_TRIPLE_DES_CBC);
+    if (init_args && (!(init_args->flags & CKF_OS_LOCKING_OK))) {
+        if (init_args->CreateMutex && init_args->DestroyMutex &&
+            init_args->LockMutex && init_args->UnlockMutex) {
+            /* softoken always uses NSPR (ie. OS locking), and doesn't know how
+             * to use the lock functions provided by the application.
+             */
+            crv = CKR_CANT_LOCK;
+            return crv;
+        }
+        if (init_args->CreateMutex || init_args->DestroyMutex ||
+            init_args->LockMutex || init_args->UnlockMutex) {
+            /* only some of the lock functions were provided by the
+             * application. This is invalid per PKCS#11 spec.
+             */
+            crv = CKR_ARGUMENTS_BAD;
+            return crv;
+        }
+    }
     crv = CKR_ARGUMENTS_BAD;
     if ((init_args && init_args->LibraryParameters)) {
 	sftk_parameters paramStrings;


Fix for pg_log bug

Fix for pg_log bug

Submitted by: "Vadim B. Mikheev" <vadim@sable.krasnoyarsk.su>

--- src/backend/storage/buffer/bufmgr.c
+++ src/backend/storage/buffer/bufmgr.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.2 1996/07/23 05:44:10 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.3 1996/09/19 19:50:48 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -280,7 +280,7 @@
 	 * the buffer can tell that the contents are invalid.
 	 */
 	bufHdr->flags |= BM_IO_ERROR;
-
+	bufHdr->flags &= ~BM_IO_IN_PROGRESS;
     } else {
 	/* IO Succeeded.  clear the flags, finish buffer update */

@@ -296,6 +296,9 @@
 #endif

     SpinRelease(BufMgrLock);
+
+    if (status == SM_FAIL)
+	return(InvalidBuffer);

     return(BufferDescriptorGetBuffer(bufHdr));
 }
@@ -387,6 +390,14 @@
 	/* GetFreeBuffer will abort if it can't find a free buffer */
 	buf = GetFreeBuffer();

+	/*
+	 * But it can return buf == NULL if we are in aborting
+	 * transaction now and so elog(WARN,...) in GetFreeBuffer
+	 * will not abort again.
+	 */
+	if ( buf == NULL )
+		return (NULL);
+
 	/*
 	 * There should be exactly one pin on the buffer after
 	 * it is allocated -- ours.  If it had a pin it wouldn't
@@ -399,6 +410,7 @@
 	PrivateRefCount[BufferDescriptorGetBuffer(buf) - 1] = 1;

 	if (buf->flags & BM_DIRTY) {
+	    bool smok;
 	    /*
 	     * Set BM_IO_IN_PROGRESS to keep anyone from doing anything
 	     * with the contents of the buffer while we write it out.
@@ -428,11 +440,38 @@
 	     * you on machines that don't have spinlocks.  If you don't
 	     * operate with much concurrency, well...
 	     */
-	    (void) BufferReplace(buf, true);
-	    BufferFlushCount++;
+	    smok = BufferReplace(buf, true);
 #ifndef OPTIMIZE_SINGLE
 	    SpinAcquire(BufMgrLock);
 #endif /* OPTIMIZE_SINGLE */
+
+	    if ( smok == FALSE )
+	    {
+		elog(NOTICE, "BufferAlloc: cannot write block %u for %s/%s",
+			 buf->tag.blockNum, buf->sb_dbname, buf->sb_relname);
+		inProgress = FALSE;
+		buf->flags |= BM_IO_ERROR;
+		buf->flags &= ~BM_IO_IN_PROGRESS;
+#ifdef HAS_TEST_AND_SET
+		S_UNLOCK(&(buf->io_in_progress_lock));
+#else /* !HAS_TEST_AND_SET */
+		if (buf->refcount > 1)
+		    SignalIO(buf);
+#endif /* !HAS_TEST_AND_SET */
+		PrivateRefCount[BufferDescriptorGetBuffer(buf) - 1] = 0;
+		buf->refcount--;
+		if ( buf->refcount == 0 )
+		{
+		    AddBufferToFreelist(buf);
+		    buf->flags |= BM_FREE;
+		}
+		buf = (BufferDesc *) NULL;
+	    }
+	    else
+	    {
+		BufferFlushCount++;
+		buf->flags &= ~BM_DIRTY;
+	    }

 	    /*
 	     * Somebody could have pinned the buffer while we were
@@ -445,7 +484,7 @@
 	     * no reason to think that we have an immediate disaster on
 	     * our hands.
 	     */
-	    if (buf->refcount > 1) {
+	    if (buf && buf->refcount > 1) {
 		inProgress = FALSE;
 		buf->flags &= ~BM_IO_IN_PROGRESS;
 #ifdef HAS_TEST_AND_SET
@@ -473,18 +512,6 @@
 		 * to do. We'll just handle this as if it were found in
 		 * the buffer pool in the first place.
 		 */
-
-		PinBuffer(buf2);
-		inProgress = (buf2->flags & BM_IO_IN_PROGRESS);
-
-		*foundPtr = TRUE;
-		if (inProgress) {
-		    WaitIO(buf2, BufMgrLock);
-		    if (buf2->flags & BM_IO_ERROR) {
-			*foundPtr = FALSE;
-		    }
-		}
-
 		if ( buf != NULL )
 		{
 #ifdef HAS_TEST_AND_SET
@@ -499,8 +526,18 @@
 			PrivateRefCount[BufferDescriptorGetBuffer(buf) - 1] = 0;
 			AddBufferToFreelist(buf);
 			buf->flags |= BM_FREE;
-			buf->flags &= ~BM_DIRTY;
 			buf->flags &= ~BM_IO_IN_PROGRESS;
+		}
+
+		PinBuffer(buf2);
+		inProgress = (buf2->flags & BM_IO_IN_PROGRESS);
+
+		*foundPtr = TRUE;
+		if (inProgress) {
+		    WaitIO(buf2, BufMgrLock);
+		    if (buf2->flags & BM_IO_ERROR) {
+			*foundPtr = FALSE;
+		    }
 		}

 		SpinRelease(BufMgrLock);
@@ -530,13 +567,6 @@
 	SpinRelease(BufMgrLock);
 	elog(FATAL,"buffer wasn't in the buffer table\n");

-    }
-
-    if (buf->flags & BM_DIRTY) {
-	/* must clear flag first because of wierd race
-	 * condition described below.
-	 */
-	buf->flags &= ~BM_DIRTY;
     }

     /* record the database name and relation name for this buffer */
@@ -813,6 +843,30 @@
 	    if (bufdb == MyDatabaseId || bufdb == (Oid) 0) {
 		reln = RelationIdCacheGetRelation(bufrel);

+		/*
+		 *  We have to pin buffer to keep anyone from stealing it
+		 *  from the buffer pool while we are flushing it or
+		 *  waiting in WaitIO. It's bad for GetFreeBuffer in
+		 *  BufferAlloc, but there is no other way to prevent
+		 *  writing into disk block data from some other buffer,
+		 *  getting smgr status of some other block and
+		 *  clearing BM_DIRTY of ...		- VAdim 09/16/96
+		 */
+		PinBuffer(bufHdr);
+		if (bufHdr->flags & BM_IO_IN_PROGRESS)
+		{
+		    WaitIO(bufHdr, BufMgrLock);
+		    UnpinBuffer(bufHdr);
+		    if (bufHdr->flags & BM_IO_ERROR)
+		    {
+			elog(WARN, "cannot write %u for %s",
+				bufHdr->tag.blockNum, bufHdr->sb_relname);
+		    }
+		    if (reln != (Relation)NULL)
+			RelationDecrementReferenceCount(reln);
+		    continue;
+		}
+
 		/*
 		 *  If we didn't have the reldesc in our local cache, flush this
 		 *  page out using the 'blind write' storage manager routine.  If
@@ -836,8 +890,10 @@
 		SpinAcquire(BufMgrLock);
 #endif /* OPTIMIZE_SINGLE */

+		UnpinBuffer(bufHdr);
 		if (status == SM_FAIL) {
-		    elog(WARN, "cannot write %d for %16s",
+		    bufHdr->flags |= BM_IO_ERROR;
+		    elog(WARN, "cannot write %u for %s",
 			 bufHdr->tag.blockNum, bufHdr->sb_relname);
 		}


Remove unused variable.

Remove unused variable.

--- src/backend/storage/buffer/bufmgr.c
+++ src/backend/storage/buffer/bufmgr.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.145 2003/11/19 15:55:07 wieck Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.146 2003/11/21 17:41:31 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1025,7 +1025,7 @@
 	 */
 	for (;;)
 	{
-		int			n, i;
+		int			n;

 		/*
 		 * Call BufferSync() with instructions to keep just the


Roster: coding style audit.

Roster: coding style audit.

--- ytstenut/yts-roster.c
+++ ytstenut/yts-roster.c
@@ -19,16 +19,6 @@
  *              Rob Staudinger <robsta@linux.intel.com>
  */

-/**
- * SECTION:yts-roster
- * @short_description: Represents a roster of devices and services
- * connected to the Ytstenut application mesh.
- *
- * #YtsRoster represents all known devices and services in the Ytstenut
- * application mesh.
- */
-
-#include <string.h>
 #include <telepathy-ytstenut-glib/telepathy-ytstenut-glib.h>

 #include "yts-client-internal.h"
@@ -39,50 +29,43 @@
 #include "yts-service-factory.h"
 #include "config.h"

-static void yts_roster_dispose (GObject *object);
-static void yts_roster_finalize (GObject *object);
-static void yts_roster_constructed (GObject *object);
-static void yts_roster_get_property (GObject    *object,
-                                      guint       property_id,
-                                      GValue     *value,
-                                      GParamSpec *pspec);
-static void yts_roster_set_property (GObject      *object,
-                                      guint         property_id,
-                                      const GValue *value,
-                                      GParamSpec   *pspec);
-
 G_DEFINE_TYPE (YtsRoster, yts_roster, G_TYPE_OBJECT);

 #define GET_PRIVATE(o) \
   (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_ROSTER, YtsRosterPrivate))

+/**
+ * SECTION:yts-roster
+ * @short_description: Represents a roster of devices and services
+ * connected to the Ytstenut application mesh.
+ *
+ * #YtsRoster represents all known devices and services in the Ytstenut
+ * application mesh.
+ */
+
+enum {
+  PROP_0,
+  PROP_CLIENT
+};
+
+enum {
+  SIG_CONTACT_ADDED,
+  SIG_CONTACT_REMOVED,
+
+  SIG_SERVICE_ADDED,
+  SIG_SERVICE_REMOVED,
+
+  N_SIGNALS
+};
+
 typedef struct {

   GHashTable *contacts; /* hash of YtsContact this roster holds */
   YtsClient *client;   /* back-reference to the client object that owns us */

-  guint disposed : 1;
-
 } YtsRosterPrivate;

-enum
-{
-  CONTACT_ADDED,
-  CONTACT_REMOVED,
-
-  SERVICE_ADDED,
-  SERVICE_REMOVED,
-
-  N_SIGNALS,
-};
-
-enum
-{
-  PROP_0,
-  PROP_CLIENT,
-};
-
-static guint signals[N_SIGNALS] = {0};
+static unsigned _signals[N_SIGNALS] = { 0, };

 static void
 _contact_send_message (YtsContact   *contact,
@@ -100,148 +83,160 @@
 }

 static void
-yts_roster_class_init (YtsRosterClass *klass)
-{
-  GParamSpec   *pspec;
-  GObjectClass *object_class = (GObjectClass *)klass;
-
-  g_type_class_add_private (klass, sizeof (YtsRosterPrivate));
-
-  object_class->dispose      = yts_roster_dispose;
-  object_class->finalize     = yts_roster_finalize;
-  object_class->constructed  = yts_roster_constructed;
-  object_class->get_property = yts_roster_get_property;
-  object_class->set_property = yts_roster_set_property;
-
-  /**
-   * YtsRoster:client:
-   *
-   * #YtsClient this roster represents.
-   */
-  pspec = g_param_spec_object ("client",
-                               "YtsClient",
-                               "YtsClient",
-                               YTS_TYPE_CLIENT,
-                               G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
-  g_object_class_install_property (object_class, PROP_CLIENT, pspec);
-
-  /**
-   * YtsRoster::contact-added:
-   * @self: object which emitted the signal.
-   * @contact: #YtsContact that was added.
-   *
-   * Emitted when contact is added to the roster.
-   *
-   * Since: 0.1
-   */
-  signals[CONTACT_ADDED] =
-    g_signal_new ("contact-added",
-                  G_TYPE_FROM_CLASS (object_class),
-                  G_SIGNAL_RUN_LAST,
-                  0,
-                  NULL, NULL,
-                  yts_marshal_VOID__OBJECT,
-                  G_TYPE_NONE, 1,
-                  YTS_TYPE_CONTACT);
-
-  /**
-   * YtsRoster::contact-removed:
-   * @self: object which emitted the signal.
-   * @contact: #YtsContact that was removed.
-   *
-   * Emitted when contact is removed from the roster. Applications that
-   * connected signal handlers to the contact, should disconnect them when this
-   * signal is emitted.
-   *
-   * Since: 0.1
-   */
-  signals[CONTACT_REMOVED] =
-    g_signal_new ("contact-removed",
-                  G_TYPE_FROM_CLASS (object_class),
-                  G_SIGNAL_RUN_LAST,
-                  0,
-                  NULL, NULL,
-                  yts_marshal_VOID__OBJECT,
-                  G_TYPE_NONE, 1,
-                  YTS_TYPE_CONTACT);
-
-  /**
-   * YtsRoster::service-added:
-   * @self: object which emitted the signal.
-   * @service: #YtsService that was added.
-   *
-   * Emitted when service is added to the roster.
-   *
-   * Since: 0.1
-   */
-  signals[SERVICE_ADDED] =
-    g_signal_new ("service-added",
-                  G_TYPE_FROM_CLASS (object_class),
-                  G_SIGNAL_RUN_LAST,
-                  0,
-                  NULL, NULL,
-                  yts_marshal_VOID__OBJECT,
-                  G_TYPE_NONE, 1,
-                  YTS_TYPE_SERVICE);
-
-  /**
-   * YtsRoster::service-removed:
-   * @self: object which emitted the signal.
-   * @service: #YtsService that was removed.
-   *
-   * Emitted when service is removed from the roster. Applications that
-   * connected signal handlers to the service, should disconnect them when this
-   * signal is emitted.
-   *
-   * Since: 0.1
-   */
-  signals[SERVICE_REMOVED] =
-    g_signal_new ("service-removed",
-                  G_TYPE_FROM_CLASS (object_class),
-                  G_SIGNAL_RUN_LAST,
-                  0,
-                  NULL, NULL,
-                  yts_marshal_VOID__OBJECT,
-                  G_TYPE_NONE, 1,
-                  YTS_TYPE_SERVICE);
-}
-
-static void
-yts_roster_constructed (GObject *object)
-{
-  if (G_OBJECT_CLASS (yts_roster_parent_class)->constructed)
-    G_OBJECT_CLASS (yts_roster_parent_class)->constructed (object);
-}
-
-static void
-yts_roster_get_property (GObject    *object,
-                          guint       property_id,
-                          GValue     *value,
-                          GParamSpec *pspec)
-{
-  switch (property_id)
-    {
+_get_property (GObject    *object,
+               unsigned    property_id,
+               GValue     *value,
+               GParamSpec *pspec)
+{
+  switch (property_id) {
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-    }
-}
-
-static void
-yts_roster_set_property (GObject      *object,
-                          guint         property_id,
-                          const GValue *value,
-                          GParamSpec   *pspec)
+  }
+}
+
+static void
+_set_property (GObject      *object,
+               unsigned      property_id,
+               const GValue *value,
+               GParamSpec   *pspec)
 {
   YtsRosterPrivate *priv = GET_PRIVATE (object);

-  switch (property_id)
-    {
+  switch (property_id) {
     case PROP_CLIENT:
       priv->client = g_value_get_object (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+  }
+}
+
+static void
+_dispose (GObject *object)
+{
+  YtsRosterPrivate *priv = GET_PRIVATE (object);
+
+  if (priv->client) {
+    /* no ownership */
+    priv->client = NULL;
+  }
+
+  if (priv->contacts) {
+
+    GHashTableIter iter;
+    char const *contact_id;
+    YtsContact *contact;
+
+    g_hash_table_iter_init (&iter, priv->contacts);
+    while (g_hash_table_iter_next (&iter,
+                                   (void **) &contact_id,
+                                   (void **) &contact)) {
+
+      g_signal_handlers_disconnect_by_func (contact,
+                                            _contact_send_message,
+                                            object);
     }
+
+    g_hash_table_destroy (priv->contacts);
+    priv->contacts = NULL;
+  }
+
+  G_OBJECT_CLASS (yts_roster_parent_class)->dispose (object);
+}
+
+static void
+yts_roster_class_init (YtsRosterClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GParamSpec   *pspec;
+
+  g_type_class_add_private (klass, sizeof (YtsRosterPrivate));
+
+  object_class->get_property = _get_property;
+  object_class->set_property = _set_property;
+  object_class->dispose = _dispose;
+
+  /**
+   * YtsRoster:client:
+   *
+   * #YtsClient this roster represents.
+   */
+  pspec = g_param_spec_object ("client", "", "",
+                               YTS_TYPE_CLIENT,
+                               G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
+  g_object_class_install_property (object_class, PROP_CLIENT, pspec);
+
+  /**
+   * YtsRoster::contact-added:
+   * @self: object which emitted the signal.
+   * @contact: #YtsContact that was added.
+   *
+   * Emitted when contact is added to the roster.
+   *
+   * Since: 0.1
+   */
+  _signals[SIG_CONTACT_ADDED] = g_signal_new ("contact-added",
+                                              G_TYPE_FROM_CLASS (object_class),
+                                              G_SIGNAL_RUN_LAST,
+                                              0, NULL, NULL,
+                                              yts_marshal_VOID__OBJECT,
+                                              G_TYPE_NONE, 1,
+                                              YTS_TYPE_CONTACT);
+
+  /**
+   * YtsRoster::contact-removed:
+   * @self: object which emitted the signal.
+   * @contact: #YtsContact that was removed.
+   *
+   * Emitted when contact is removed from the roster. Applications that
+   * connected signal handlers to the contact, should disconnect them when this
+   * signal is emitted.
+   *
+   * Since: 0.1
+   */
+  _signals[SIG_CONTACT_REMOVED] = g_signal_new ("contact-removed",
+                                                G_TYPE_FROM_CLASS (object_class),
+                                                G_SIGNAL_RUN_LAST,
+                                                0, NULL, NULL,
+                                                yts_marshal_VOID__OBJECT,
+                                                G_TYPE_NONE, 1,
+                                                YTS_TYPE_CONTACT);
+
+  /**
+   * YtsRoster::service-added:
+   * @self: object which emitted the signal.
+   * @service: #YtsService that was added.
+   *
+   * Emitted when service is added to the roster.
+   *
+   * Since: 0.1
+   */
+  _signals[SIG_SERVICE_ADDED] = g_signal_new ("service-added",
+                                              G_TYPE_FROM_CLASS (object_class),
+                                              G_SIGNAL_RUN_LAST,
+                                              0, NULL, NULL,
+                                              yts_marshal_VOID__OBJECT,
+                                              G_TYPE_NONE, 1,
+                                              YTS_TYPE_SERVICE);
+
+  /**
+   * YtsRoster::service-removed:
+   * @self: object which emitted the signal.
+   * @service: #YtsService that was removed.
+   *
+   * Emitted when service is removed from the roster. Applications that
+   * connected signal handlers to the service, should disconnect them when this
+   * signal is emitted.
+   *
+   * Since: 0.1
+   */
+  _signals[SIG_SERVICE_REMOVED] = g_signal_new ("service-removed",
+                                                G_TYPE_FROM_CLASS (object_class),
+                                                G_SIGNAL_RUN_LAST,
+                                                0, NULL, NULL,
+                                                yts_marshal_VOID__OBJECT,
+                                                G_TYPE_NONE, 1,
+                                                YTS_TYPE_SERVICE);
 }

 static void
@@ -254,43 +249,6 @@
                                           g_free,
                                           g_object_unref);
 }
-
-static void
-yts_roster_dispose (GObject *object)
-{
-  YtsRosterPrivate *priv = GET_PRIVATE (object);
-  GHashTableIter     iter;
-  char const        *contact_id;
-  YtsContact        *contact;
-
-  if (priv->disposed)
-    return;
-
-  priv->disposed = TRUE;
-
-  priv->client = NULL;
-
-  g_hash_table_iter_init (&iter, priv->contacts);
-  while (g_hash_table_iter_next (&iter,
-                                 (void **) &contact_id,
-                                 (void **) &contact)) {
-
-    g_signal_handlers_disconnect_by_func (contact,
-                                          _contact_send_message,
-                                          object);
-  }
-
-  g_hash_table_destroy (priv->contacts);
-
-  G_OBJECT_CLASS (yts_roster_parent_class)->dispose (object);
-}
-
-static void
-yts_roster_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (yts_roster_parent_class)->finalize (object);
-}
-

 /**
  * yts_roster_get_contacts:
@@ -322,9 +280,9 @@
  * For use by #YtsClient.
  */
 void
-yts_roster_remove_service_by_id (YtsRoster *self,
-                                   char const *contact_id,
-                                   char const *service_id)
+yts_roster_remove_service_by_id (YtsRoster  *self,
+                                 char const *contact_id,
+                                 char const *service_id)
 {
   YtsRosterPrivate *priv = GET_PRIVATE (self);
   YtsContact       *contact;
@@ -332,26 +290,24 @@

   g_return_if_fail (YTS_IS_ROSTER (self));

-  if (!(contact = (YtsContact*)yts_roster_find_contact_by_jid (self, contact_id)))
-    {
-      g_warning ("Contact for service not found");
-      return;
-    }
+  contact = yts_roster_find_contact_by_jid (self, contact_id);
+  if (!contact) {
+    g_critical ("Contact for service not found");
+    return;
+  }

   yts_contact_remove_service_by_id (contact, service_id);

   emit = yts_contact_is_empty (contact);
-
-  if (emit)
-    {
-      g_signal_handlers_disconnect_by_func (contact,
-                                            _contact_send_message,
-                                            self);
-      g_object_ref (contact);
-      g_hash_table_remove (priv->contacts, contact_id);
-      g_signal_emit (self, signals[CONTACT_REMOVED], 0, contact);
-      g_object_unref (contact);
-    }
+  if (emit) {
+    g_signal_handlers_disconnect_by_func (contact,
+                                          _contact_send_message,
+                                          self);
+    g_object_ref (contact);
+    g_hash_table_remove (priv->contacts, contact_id);
+    g_signal_emit (self, _signals[SIG_CONTACT_REMOVED], 0, contact);
+    g_object_unref (contact);
+  }
 }

 /*
@@ -364,8 +320,8 @@
  * Return value: (transfer none): #YtsContact if found, or %NULL.
  */
 YtsContact *
-yts_roster_find_contact_by_handle (YtsRoster *self,
-                                   guint handle)
+yts_roster_find_contact_by_handle (YtsRoster  *self,
+                                   guint       handle)
 {
   YtsRosterPrivate *priv = GET_PRIVATE (self);
   GHashTableIter     iter;
@@ -453,14 +409,14 @@

       g_hash_table_iter_remove (&iter);

-      g_signal_emit (self, signals[CONTACT_REMOVED], 0, contact);
+      g_signal_emit (self, _signals[SIG_CONTACT_REMOVED], 0, contact);
       g_object_run_dispose ((GObject*)contact);

       g_object_unref (contact);
     }
 }

-YtsRoster*
+YtsRoster *
 yts_roster_new (YtsClient *client)
 {
   return g_object_new (YTS_TYPE_ROSTER,
@@ -473,7 +429,7 @@
                                         YtsService *service,
                                         YtsRoster  *roster)
 {
-  g_signal_emit (roster, signals[SERVICE_REMOVED], 0, service);
+  g_signal_emit (roster, _signals[SIG_SERVICE_REMOVED], 0, service);
 }

 static void
@@ -481,17 +437,8 @@
                                       YtsService *service,
                                       YtsRoster  *roster)
 {
-  g_signal_emit (roster, signals[SERVICE_ADDED], 0, service);
-}
-
-typedef struct {
-  char const        *contact_id;
-  char const        *service_id;
-  char const        *type;
-  char const *const *caps;
-  GHashTable        *names;
-  GHashTable        *statuses;
-} ServiceData;
+  g_signal_emit (roster, _signals[SIG_SERVICE_ADDED], 0, service);
+}

 void
 yts_roster_add_service (YtsRoster           *self,
@@ -525,7 +472,7 @@
       g_hash_table_insert (priv->contacts, g_strdup (contact_id), contact);

       YTS_NOTE (ROSTER, "Emitting contact-added for new contact %s", contact_id);
-      g_signal_emit (self, signals[CONTACT_ADDED], 0, contact);
+      g_signal_emit (self, _signals[SIG_CONTACT_ADDED], 0, contact);

       g_signal_connect (contact, "send-message",
                         G_CALLBACK (_contact_send_message), self);


Add document-format-preferred and include image/urf in the TXT record.

--- scheduler/printers.c
+++ scheduler/printers.c
@@ -3610,6 +3610,8 @@
   ipp_attribute_t *attr;		/* document-format-supported attribute */
   char		mimetype[MIME_MAX_SUPER + MIME_MAX_TYPE + 2];
 					/* MIME type name */
+  const char	*preferred = "image/urf";
+					/* document-format-preferred value */

  /*
@@ -3655,6 +3657,9 @@

       cupsArrayDelete(filters);
       cupsArrayAdd(p->filetypes, type);
+
+      if (!strcasecmp(mimetype, "application/pdf"))
+        preferred = "application/pdf";
     }
     else
       cupsdLogMessage(CUPSD_LOG_DEBUG2,
@@ -3691,6 +3696,8 @@

     attr->values[i].string.text = _cupsStrAlloc(mimetype);
   }
+
+  ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_MIMETYPE), "document-format-preferred", NULL, preferred);

 #ifdef HAVE_DNSSD
   {
@@ -3739,6 +3746,8 @@
 	  strlcat(pdl, "image/png,", sizeof(pdl));
 	else if (!_cups_strcasecmp(type->type, "pwg-raster"))
 	  strlcat(pdl, "image/pwg-raster,", sizeof(pdl));
+	else if (!_cups_strcasecmp(type->type, "urf"))
+	  strlcat(pdl, "image/urf,", sizeof(pdl));
       }
     }