microblaze: Remove duplicity from pgalloc.h

just file cleanup

Signed-off-by: Michal Simek <3a191dd2be46e826fee926d532b136ed65cb5318@monstr.eu>

--- arch/microblaze/include/asm/pgalloc.h
+++ arch/microblaze/include/asm/pgalloc.h
@@ -106,9 +106,6 @@
  */
 #define pmd_alloc_one_fast(mm, address)	({ BUG(); ((pmd_t *)1); })
 #define pmd_alloc_one(mm, address)	({ BUG(); ((pmd_t *)2); })
-/* FIXME two definition - look below */
-#define pmd_free(mm, x)			do { } while (0)
-#define pgd_populate(mm, pmd, pte)	BUG()

 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 		unsigned long address)
@@ -192,14 +189,14 @@
  * the pgd will always be present..
  */
 #define pmd_alloc_one(mm, address)	({ BUG(); ((pmd_t *)2); })
-/*#define pmd_free(mm, x)			do { } while (0)*/
-#define __pmd_free_tlb(tlb, x, addr)	do { } while (0)
+#define pmd_free(mm, x)			do { } while (0)
+#define __pmd_free_tlb(tlb, x, addr)	pmd_free((tlb)->mm, x)
 #define pgd_populate(mm, pmd, pte)	BUG()

 extern int do_check_pgt_cache(int, int);

 #endif /* CONFIG_MMU */

-#define check_pgt_cache()	do {} while (0)
+#define check_pgt_cache()		do { } while (0)

 #endif /* _ASM_MICROBLAZE_PGALLOC_H */


[MIPS] PB1100: Fix pile of warnings

[MIPS] PB1100: Fix pile of warnings

  CC      arch/mips/au1000/pb1100/board_setup.o
arch/mips/au1000/pb1100/board_setup.c: In function ‘board_setup’:
arch/mips/au1000/pb1100/board_setup.c:104: warning: passing argument 1 of ‘readb’ makes pointer from integer without a cast
arch/mips/au1000/pb1100/board_setup.c:105: warning: passing argument 1 of ‘readb’ makes pointer from integer without a cast
arch/mips/au1000/pb1100/board_setup.c:105: warning: passing argument 2 of ‘writeb’ makes pointer from integer without a cast
arch/mips/au1000/pb1100/board_setup.c:109: warning: passing argument 1 of ‘readb’ makes pointer from integer without a cast
arch/mips/au1000/pb1100/board_setup.c:110: warning: passing argument 1 of ‘readb’ makes pointer from integer without a cast
arch/mips/au1000/pb1100/board_setup.c:110: warning: passing argument 2 of ‘writeb’ makes pointer from integer without a cast
arch/mips/au1000/pb1100/board_setup.c:51: warning: unused variable ‘sys_clksrc’
arch/mips/au1000/pb1100/board_setup.c:51: warning: unused variable ‘sys_freqctrl’
arch/mips/au1000/pb1100/board_setup.c:50: warning: unused variable ‘pin_func’

Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>

--- arch/mips/au1000/pb1100/board_setup.c
+++ arch/mips/au1000/pb1100/board_setup.c
@@ -47,8 +47,7 @@

 void __init board_setup(void)
 {
-	u32 pin_func;
-	u32 sys_freqctrl, sys_clksrc;
+	volatile void __iomem * base = (volatile void __iomem *) 0xac000000UL;

 	// set AUX clock to 12MHz * 8 = 96 MHz
 	au_writel(8, SYS_AUXPLL);
@@ -56,58 +55,62 @@
 	udelay(100);

 #ifdef CONFIG_USB_OHCI
-	// configure pins GPIO[14:9] as GPIO
-	pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80);
+	{
+		u32 pin_func, sys_freqctrl, sys_clksrc;

-	/* zero and disable FREQ2 */
-	sys_freqctrl = au_readl(SYS_FREQCTRL0);
-	sys_freqctrl &= ~0xFFF00000;
-	au_writel(sys_freqctrl, SYS_FREQCTRL0);
+		// configure pins GPIO[14:9] as GPIO
+		pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80);

-	/* zero and disable USBH/USBD/IrDA clock */
-	sys_clksrc = au_readl(SYS_CLKSRC);
-	sys_clksrc &= ~0x0000001F;
-	au_writel(sys_clksrc, SYS_CLKSRC);
+		/* zero and disable FREQ2 */
+		sys_freqctrl = au_readl(SYS_FREQCTRL0);
+		sys_freqctrl &= ~0xFFF00000;
+		au_writel(sys_freqctrl, SYS_FREQCTRL0);

-	sys_freqctrl = au_readl(SYS_FREQCTRL0);
-	sys_freqctrl &= ~0xFFF00000;
+		/* zero and disable USBH/USBD/IrDA clock */
+		sys_clksrc = au_readl(SYS_CLKSRC);
+		sys_clksrc &= ~0x0000001F;
+		au_writel(sys_clksrc, SYS_CLKSRC);

-	sys_clksrc = au_readl(SYS_CLKSRC);
-	sys_clksrc &= ~0x0000001F;
+		sys_freqctrl = au_readl(SYS_FREQCTRL0);
+		sys_freqctrl &= ~0xFFF00000;

-	// FREQ2 = aux/2 = 48 MHz
-	sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20));
-	au_writel(sys_freqctrl, SYS_FREQCTRL0);
+		sys_clksrc = au_readl(SYS_CLKSRC);
+		sys_clksrc &= ~0x0000001F;

-	/*
-	 * Route 48MHz FREQ2 into USBH/USBD/IrDA
-	 */
-	sys_clksrc |= ((4<<2) | (0<<1) | 0 );
-	au_writel(sys_clksrc, SYS_CLKSRC);
+		// FREQ2 = aux/2 = 48 MHz
+		sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20));
+		au_writel(sys_freqctrl, SYS_FREQCTRL0);

-	/* setup the static bus controller */
-	au_writel(0x00000002, MEM_STCFG3);  /* type = PCMCIA */
-	au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
-	au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
+		/*
+		 * Route 48MHz FREQ2 into USBH/USBD/IrDA
+		 */
+		sys_clksrc |= ((4<<2) | (0<<1) | 0 );
+		au_writel(sys_clksrc, SYS_CLKSRC);

-	// get USB Functionality pin state (device vs host drive pins)
-	pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000);
-	// 2nd USB port is USB host
-	pin_func |= 0x8000;
-	au_writel(pin_func, SYS_PINFUNC);
+		/* setup the static bus controller */
+		au_writel(0x00000002, MEM_STCFG3);  /* type = PCMCIA */
+		au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
+		au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
+
+		// get USB Functionality pin state (device vs host drive pins)
+		pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000);
+		// 2nd USB port is USB host
+		pin_func |= 0x8000;
+		au_writel(pin_func, SYS_PINFUNC);
+	}
 #endif // defined (CONFIG_USB_OHCI)

 	/* Enable sys bus clock divider when IDLE state or no bus activity. */
 	au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);

 	// Enable the RTC if not already enabled
-	if (!(readb(0xac000028) & 0x20)) {
-		writeb(readb(0xac000028) | 0x20, 0xac000028);
+	if (!(readb(base + 0x28) & 0x20)) {
+		writeb(readb(base + 0x28) | 0x20, base + 0x28);
 		au_sync();
 	}
 	// Put the clock in BCD mode
-	if (readb(0xac00002C) & 0x4) { /* reg B */
-		writeb(readb(0xac00002c) & ~0x4, 0xac00002c);
+	if (readb(base + 0x2C) & 0x4) { /* reg B */
+		writeb(readb(base + 0x2c) & ~0x4, base + 0x2c);
 		au_sync();
 	}
 }


sh: shx3: pinmux: Use driver-provided pinmux info

Pinmux info for the sh machines is now provided by pinmux drivers.
Remove the duplicate copy in arch code.

Signed-off-by: Laurent Pinchart <ae960578cc5eca7b9b1dbc37d9caa6cb634f35e0@ideasonboard.com>
Acked-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>
Signed-off-by: Simon Horman <9662bddcc379be37df16f02a449c344b4718c1a1@verge.net.au>

--- arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
+++ arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
@@ -9,580 +9,10 @@
  */
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/gpio.h>
 #include <cpu/pfc.h>
-#include <cpu/shx3.h>
-
-enum {
-	PINMUX_RESERVED = 0,
-
-	PINMUX_DATA_BEGIN,
-	PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA,
-	PA3_DATA, PA2_DATA, PA1_DATA, PA0_DATA,
-	PB7_DATA, PB6_DATA, PB5_DATA, PB4_DATA,
-	PB3_DATA, PB2_DATA, PB1_DATA, PB0_DATA,
-	PC7_DATA, PC6_DATA, PC5_DATA, PC4_DATA,
-	PC3_DATA, PC2_DATA, PC1_DATA, PC0_DATA,
-	PD7_DATA, PD6_DATA, PD5_DATA, PD4_DATA,
-	PD3_DATA, PD2_DATA, PD1_DATA, PD0_DATA,
-	PE7_DATA, PE6_DATA, PE5_DATA, PE4_DATA,
-	PE3_DATA, PE2_DATA, PE1_DATA, PE0_DATA,
-	PF7_DATA, PF6_DATA, PF5_DATA, PF4_DATA,
-	PF3_DATA, PF2_DATA, PF1_DATA, PF0_DATA,
-	PG7_DATA, PG6_DATA, PG5_DATA, PG4_DATA,
-	PG3_DATA, PG2_DATA, PG1_DATA, PG0_DATA,
-
-	PH5_DATA, PH4_DATA,
-	PH3_DATA, PH2_DATA, PH1_DATA, PH0_DATA,
-	PINMUX_DATA_END,
-
-	PINMUX_INPUT_BEGIN,
-	PA7_IN, PA6_IN, PA5_IN, PA4_IN,
-	PA3_IN, PA2_IN, PA1_IN, PA0_IN,
-	PB7_IN, PB6_IN, PB5_IN, PB4_IN,
-	PB3_IN, PB2_IN, PB1_IN, PB0_IN,
-	PC7_IN, PC6_IN, PC5_IN, PC4_IN,
-	PC3_IN, PC2_IN, PC1_IN, PC0_IN,
-	PD7_IN, PD6_IN, PD5_IN, PD4_IN,
-	PD3_IN, PD2_IN, PD1_IN, PD0_IN,
-	PE7_IN, PE6_IN, PE5_IN, PE4_IN,
-	PE3_IN, PE2_IN, PE1_IN, PE0_IN,
-	PF7_IN, PF6_IN, PF5_IN, PF4_IN,
-	PF3_IN, PF2_IN, PF1_IN, PF0_IN,
-	PG7_IN, PG6_IN, PG5_IN, PG4_IN,
-	PG3_IN, PG2_IN, PG1_IN, PG0_IN,
-
-	PH5_IN, PH4_IN,
-	PH3_IN, PH2_IN, PH1_IN, PH0_IN,
-	PINMUX_INPUT_END,
-
-	PINMUX_INPUT_PULLUP_BEGIN,
-	PA7_IN_PU, PA6_IN_PU, PA5_IN_PU, PA4_IN_PU,
-	PA3_IN_PU, PA2_IN_PU, PA1_IN_PU, PA0_IN_PU,
-	PB7_IN_PU, PB6_IN_PU, PB5_IN_PU, PB4_IN_PU,
-	PB3_IN_PU, PB2_IN_PU, PB1_IN_PU, PB0_IN_PU,
-	PC7_IN_PU, PC6_IN_PU, PC5_IN_PU, PC4_IN_PU,
-	PC3_IN_PU, PC2_IN_PU, PC1_IN_PU, PC0_IN_PU,
-	PD7_IN_PU, PD6_IN_PU, PD5_IN_PU, PD4_IN_PU,
-	PD3_IN_PU, PD2_IN_PU, PD1_IN_PU, PD0_IN_PU,
-	PE7_IN_PU, PE6_IN_PU, PE5_IN_PU, PE4_IN_PU,
-	PE3_IN_PU, PE2_IN_PU, PE1_IN_PU, PE0_IN_PU,
-	PF7_IN_PU, PF6_IN_PU, PF5_IN_PU, PF4_IN_PU,
-	PF3_IN_PU, PF2_IN_PU, PF1_IN_PU, PF0_IN_PU,
-	PG7_IN_PU, PG6_IN_PU, PG5_IN_PU, PG4_IN_PU,
-	PG3_IN_PU, PG2_IN_PU, PG1_IN_PU, PG0_IN_PU,
-
-	PH5_IN_PU, PH4_IN_PU,
-	PH3_IN_PU, PH2_IN_PU, PH1_IN_PU, PH0_IN_PU,
-	PINMUX_INPUT_PULLUP_END,
-
-	PINMUX_OUTPUT_BEGIN,
-	PA7_OUT, PA6_OUT, PA5_OUT, PA4_OUT,
-	PA3_OUT, PA2_OUT, PA1_OUT, PA0_OUT,
-	PB7_OUT, PB6_OUT, PB5_OUT, PB4_OUT,
-	PB3_OUT, PB2_OUT, PB1_OUT, PB0_OUT,
-	PC7_OUT, PC6_OUT, PC5_OUT, PC4_OUT,
-	PC3_OUT, PC2_OUT, PC1_OUT, PC0_OUT,
-	PD7_OUT, PD6_OUT, PD5_OUT, PD4_OUT,
-	PD3_OUT, PD2_OUT, PD1_OUT, PD0_OUT,
-	PE7_OUT, PE6_OUT, PE5_OUT, PE4_OUT,
-	PE3_OUT, PE2_OUT, PE1_OUT, PE0_OUT,
-	PF7_OUT, PF6_OUT, PF5_OUT, PF4_OUT,
-	PF3_OUT, PF2_OUT, PF1_OUT, PF0_OUT,
-	PG7_OUT, PG6_OUT, PG5_OUT, PG4_OUT,
-	PG3_OUT, PG2_OUT, PG1_OUT, PG0_OUT,
-
-	PH5_OUT, PH4_OUT,
-	PH3_OUT, PH2_OUT, PH1_OUT, PH0_OUT,
-	PINMUX_OUTPUT_END,
-
-	PINMUX_FUNCTION_BEGIN,
-	PA7_FN, PA6_FN, PA5_FN, PA4_FN,
-	PA3_FN, PA2_FN, PA1_FN, PA0_FN,
-	PB7_FN, PB6_FN, PB5_FN, PB4_FN,
-	PB3_FN, PB2_FN, PB1_FN, PB0_FN,
-	PC7_FN, PC6_FN, PC5_FN, PC4_FN,
-	PC3_FN, PC2_FN, PC1_FN, PC0_FN,
-	PD7_FN, PD6_FN, PD5_FN, PD4_FN,
-	PD3_FN, PD2_FN, PD1_FN, PD0_FN,
-	PE7_FN, PE6_FN, PE5_FN, PE4_FN,
-	PE3_FN, PE2_FN, PE1_FN, PE0_FN,
-	PF7_FN, PF6_FN, PF5_FN, PF4_FN,
-	PF3_FN, PF2_FN, PF1_FN, PF0_FN,
-	PG7_FN, PG6_FN, PG5_FN, PG4_FN,
-	PG3_FN, PG2_FN, PG1_FN, PG0_FN,
-
-	PH5_FN, PH4_FN,
-	PH3_FN, PH2_FN, PH1_FN, PH0_FN,
-	PINMUX_FUNCTION_END,
-
-	PINMUX_MARK_BEGIN,
-
-	D31_MARK, D30_MARK, D29_MARK, D28_MARK, D27_MARK, D26_MARK,
-	D25_MARK, D24_MARK, D23_MARK, D22_MARK, D21_MARK, D20_MARK,
-	D19_MARK, D18_MARK, D17_MARK, D16_MARK,
-
-	BACK_MARK, BREQ_MARK,
-	WE3_MARK, WE2_MARK,
-	CS6_MARK, CS5_MARK, CS4_MARK,
-	CLKOUTENB_MARK,
-
-	DACK3_MARK, DACK2_MARK, DACK1_MARK, DACK0_MARK,
-	DREQ3_MARK, DREQ2_MARK, DREQ1_MARK, DREQ0_MARK,
-
-	IRQ3_MARK, IRQ2_MARK, IRQ1_MARK, IRQ0_MARK,
-
-	DRAK3_MARK, DRAK2_MARK, DRAK1_MARK, DRAK0_MARK,
-
-	SCK3_MARK, SCK2_MARK, SCK1_MARK, SCK0_MARK,
-	IRL3_MARK, IRL2_MARK, IRL1_MARK, IRL0_MARK,
-	TXD3_MARK, TXD2_MARK, TXD1_MARK, TXD0_MARK,
-	RXD3_MARK, RXD2_MARK, RXD1_MARK, RXD0_MARK,
-
-	CE2B_MARK, CE2A_MARK, IOIS16_MARK,
-	STATUS1_MARK, STATUS0_MARK,
-
-	IRQOUT_MARK,
-
-	PINMUX_MARK_END,
-};
-
-static pinmux_enum_t shx3_pinmux_data[] = {
-
-	/* PA GPIO */
-	PINMUX_DATA(PA7_DATA, PA7_IN, PA7_OUT, PA7_IN_PU),
-	PINMUX_DATA(PA6_DATA, PA6_IN, PA6_OUT, PA6_IN_PU),
-	PINMUX_DATA(PA5_DATA, PA5_IN, PA5_OUT, PA5_IN_PU),
-	PINMUX_DATA(PA4_DATA, PA4_IN, PA4_OUT, PA4_IN_PU),
-	PINMUX_DATA(PA3_DATA, PA3_IN, PA3_OUT, PA3_IN_PU),
-	PINMUX_DATA(PA2_DATA, PA2_IN, PA2_OUT, PA2_IN_PU),
-	PINMUX_DATA(PA1_DATA, PA1_IN, PA1_OUT, PA1_IN_PU),
-	PINMUX_DATA(PA0_DATA, PA0_IN, PA0_OUT, PA0_IN_PU),
-
-	/* PB GPIO */
-	PINMUX_DATA(PB7_DATA, PB7_IN, PB7_OUT, PB7_IN_PU),
-	PINMUX_DATA(PB6_DATA, PB6_IN, PB6_OUT, PB6_IN_PU),
-	PINMUX_DATA(PB5_DATA, PB5_IN, PB5_OUT, PB5_IN_PU),
-	PINMUX_DATA(PB4_DATA, PB4_IN, PB4_OUT, PB4_IN_PU),
-	PINMUX_DATA(PB3_DATA, PB3_IN, PB3_OUT, PB3_IN_PU),
-	PINMUX_DATA(PB2_DATA, PB2_IN, PB2_OUT, PB2_IN_PU),
-	PINMUX_DATA(PB1_DATA, PB1_IN, PB1_OUT, PB1_IN_PU),
-	PINMUX_DATA(PB0_DATA, PB0_IN, PB0_OUT, PB0_IN_PU),
-
-	/* PC GPIO */
-	PINMUX_DATA(PC7_DATA, PC7_IN, PC7_OUT, PC7_IN_PU),
-	PINMUX_DATA(PC6_DATA, PC6_IN, PC6_OUT, PC6_IN_PU),
-	PINMUX_DATA(PC5_DATA, PC5_IN, PC5_OUT, PC5_IN_PU),
-	PINMUX_DATA(PC4_DATA, PC4_IN, PC4_OUT, PC4_IN_PU),
-	PINMUX_DATA(PC3_DATA, PC3_IN, PC3_OUT, PC3_IN_PU),
-	PINMUX_DATA(PC2_DATA, PC2_IN, PC2_OUT, PC2_IN_PU),
-	PINMUX_DATA(PC1_DATA, PC1_IN, PC1_OUT, PC1_IN_PU),
-	PINMUX_DATA(PC0_DATA, PC0_IN, PC0_OUT, PC0_IN_PU),
-
-	/* PD GPIO */
-	PINMUX_DATA(PD7_DATA, PD7_IN, PD7_OUT, PD7_IN_PU),
-	PINMUX_DATA(PD6_DATA, PD6_IN, PD6_OUT, PD6_IN_PU),
-	PINMUX_DATA(PD5_DATA, PD5_IN, PD5_OUT, PD5_IN_PU),
-	PINMUX_DATA(PD4_DATA, PD4_IN, PD4_OUT, PD4_IN_PU),
-	PINMUX_DATA(PD3_DATA, PD3_IN, PD3_OUT, PD3_IN_PU),
-	PINMUX_DATA(PD2_DATA, PD2_IN, PD2_OUT, PD2_IN_PU),
-	PINMUX_DATA(PD1_DATA, PD1_IN, PD1_OUT, PD1_IN_PU),
-	PINMUX_DATA(PD0_DATA, PD0_IN, PD0_OUT, PD0_IN_PU),
-
-	/* PE GPIO */
-	PINMUX_DATA(PE7_DATA, PE7_IN, PE7_OUT, PE7_IN_PU),
-	PINMUX_DATA(PE6_DATA, PE6_IN, PE6_OUT, PE6_IN_PU),
-	PINMUX_DATA(PE5_DATA, PE5_IN, PE5_OUT, PE5_IN_PU),
-	PINMUX_DATA(PE4_DATA, PE4_IN, PE4_OUT, PE4_IN_PU),
-	PINMUX_DATA(PE3_DATA, PE3_IN, PE3_OUT, PE3_IN_PU),
-	PINMUX_DATA(PE2_DATA, PE2_IN, PE2_OUT, PE2_IN_PU),
-	PINMUX_DATA(PE1_DATA, PE1_IN, PE1_OUT, PE1_IN_PU),
-	PINMUX_DATA(PE0_DATA, PE0_IN, PE0_OUT, PE0_IN_PU),
-
-	/* PF GPIO */
-	PINMUX_DATA(PF7_DATA, PF7_IN, PF7_OUT, PF7_IN_PU),
-	PINMUX_DATA(PF6_DATA, PF6_IN, PF6_OUT, PF6_IN_PU),
-	PINMUX_DATA(PF5_DATA, PF5_IN, PF5_OUT, PF5_IN_PU),
-	PINMUX_DATA(PF4_DATA, PF4_IN, PF4_OUT, PF4_IN_PU),
-	PINMUX_DATA(PF3_DATA, PF3_IN, PF3_OUT, PF3_IN_PU),
-	PINMUX_DATA(PF2_DATA, PF2_IN, PF2_OUT, PF2_IN_PU),
-	PINMUX_DATA(PF1_DATA, PF1_IN, PF1_OUT, PF1_IN_PU),
-	PINMUX_DATA(PF0_DATA, PF0_IN, PF0_OUT, PF0_IN_PU),
-
-	/* PG GPIO */
-	PINMUX_DATA(PG7_DATA, PG7_IN, PG7_OUT, PG7_IN_PU),
-	PINMUX_DATA(PG6_DATA, PG6_IN, PG6_OUT, PG6_IN_PU),
-	PINMUX_DATA(PG5_DATA, PG5_IN, PG5_OUT, PG5_IN_PU),
-	PINMUX_DATA(PG4_DATA, PG4_IN, PG4_OUT, PG4_IN_PU),
-	PINMUX_DATA(PG3_DATA, PG3_IN, PG3_OUT, PG3_IN_PU),
-	PINMUX_DATA(PG2_DATA, PG2_IN, PG2_OUT, PG2_IN_PU),
-	PINMUX_DATA(PG1_DATA, PG1_IN, PG1_OUT, PG1_IN_PU),
-	PINMUX_DATA(PG0_DATA, PG0_IN, PG0_OUT, PG0_IN_PU),
-
-	/* PH GPIO */
-	PINMUX_DATA(PH5_DATA, PH5_IN, PH5_OUT, PH5_IN_PU),
-	PINMUX_DATA(PH4_DATA, PH4_IN, PH4_OUT, PH4_IN_PU),
-	PINMUX_DATA(PH3_DATA, PH3_IN, PH3_OUT, PH3_IN_PU),
-	PINMUX_DATA(PH2_DATA, PH2_IN, PH2_OUT, PH2_IN_PU),
-	PINMUX_DATA(PH1_DATA, PH1_IN, PH1_OUT, PH1_IN_PU),
-	PINMUX_DATA(PH0_DATA, PH0_IN, PH0_OUT, PH0_IN_PU),
-
-	/* PA FN */
-	PINMUX_DATA(D31_MARK, PA7_FN),
-	PINMUX_DATA(D30_MARK, PA6_FN),
-	PINMUX_DATA(D29_MARK, PA5_FN),
-	PINMUX_DATA(D28_MARK, PA4_FN),
-	PINMUX_DATA(D27_MARK, PA3_FN),
-	PINMUX_DATA(D26_MARK, PA2_FN),
-	PINMUX_DATA(D25_MARK, PA1_FN),
-	PINMUX_DATA(D24_MARK, PA0_FN),
-
-	/* PB FN */
-	PINMUX_DATA(D23_MARK, PB7_FN),
-	PINMUX_DATA(D22_MARK, PB6_FN),
-	PINMUX_DATA(D21_MARK, PB5_FN),
-	PINMUX_DATA(D20_MARK, PB4_FN),
-	PINMUX_DATA(D19_MARK, PB3_FN),
-	PINMUX_DATA(D18_MARK, PB2_FN),
-	PINMUX_DATA(D17_MARK, PB1_FN),
-	PINMUX_DATA(D16_MARK, PB0_FN),
-
-	/* PC FN */
-	PINMUX_DATA(BACK_MARK,		PC7_FN),
-	PINMUX_DATA(BREQ_MARK,		PC6_FN),
-	PINMUX_DATA(WE3_MARK,		PC5_FN),
-	PINMUX_DATA(WE2_MARK,		PC4_FN),
-	PINMUX_DATA(CS6_MARK,		PC3_FN),
-	PINMUX_DATA(CS5_MARK,		PC2_FN),
-	PINMUX_DATA(CS4_MARK,		PC1_FN),
-	PINMUX_DATA(CLKOUTENB_MARK,	PC0_FN),
-
-	/* PD FN */
-	PINMUX_DATA(DACK3_MARK,	PD7_FN),
-	PINMUX_DATA(DACK2_MARK, PD6_FN),
-	PINMUX_DATA(DACK1_MARK, PD5_FN),
-	PINMUX_DATA(DACK0_MARK, PD4_FN),
-	PINMUX_DATA(DREQ3_MARK, PD3_FN),
-	PINMUX_DATA(DREQ2_MARK, PD2_FN),
-	PINMUX_DATA(DREQ1_MARK, PD1_FN),
-	PINMUX_DATA(DREQ0_MARK, PD0_FN),
-
-	/* PE FN */
-	PINMUX_DATA(IRQ3_MARK,	PE7_FN),
-	PINMUX_DATA(IRQ2_MARK,	PE6_FN),
-	PINMUX_DATA(IRQ1_MARK,	PE5_FN),
-	PINMUX_DATA(IRQ0_MARK,	PE4_FN),
-	PINMUX_DATA(DRAK3_MARK, PE3_FN),
-	PINMUX_DATA(DRAK2_MARK, PE2_FN),
-	PINMUX_DATA(DRAK1_MARK, PE1_FN),
-	PINMUX_DATA(DRAK0_MARK, PE0_FN),
-
-	/* PF FN */
-	PINMUX_DATA(SCK3_MARK, PF7_FN),
-	PINMUX_DATA(SCK2_MARK, PF6_FN),
-	PINMUX_DATA(SCK1_MARK, PF5_FN),
-	PINMUX_DATA(SCK0_MARK, PF4_FN),
-	PINMUX_DATA(IRL3_MARK, PF3_FN),
-	PINMUX_DATA(IRL2_MARK, PF2_FN),
-	PINMUX_DATA(IRL1_MARK, PF1_FN),
-	PINMUX_DATA(IRL0_MARK, PF0_FN),
-
-	/* PG FN */
-	PINMUX_DATA(TXD3_MARK, PG7_FN),
-	PINMUX_DATA(TXD2_MARK, PG6_FN),
-	PINMUX_DATA(TXD1_MARK, PG5_FN),
-	PINMUX_DATA(TXD0_MARK, PG4_FN),
-	PINMUX_DATA(RXD3_MARK, PG3_FN),
-	PINMUX_DATA(RXD2_MARK, PG2_FN),
-	PINMUX_DATA(RXD1_MARK, PG1_FN),
-	PINMUX_DATA(RXD0_MARK, PG0_FN),
-
-	/* PH FN */
-	PINMUX_DATA(CE2B_MARK,		PH5_FN),
-	PINMUX_DATA(CE2A_MARK,		PH4_FN),
-	PINMUX_DATA(IOIS16_MARK,	PH3_FN),
-	PINMUX_DATA(STATUS1_MARK,	PH2_FN),
-	PINMUX_DATA(STATUS0_MARK,	PH1_FN),
-	PINMUX_DATA(IRQOUT_MARK,	PH0_FN),
-};
-
-static struct pinmux_gpio shx3_pinmux_gpios[] = {
-	/* PA */
-	PINMUX_GPIO(GPIO_PA7, PA7_DATA),
-	PINMUX_GPIO(GPIO_PA6, PA6_DATA),
-	PINMUX_GPIO(GPIO_PA5, PA5_DATA),
-	PINMUX_GPIO(GPIO_PA4, PA4_DATA),
-	PINMUX_GPIO(GPIO_PA3, PA3_DATA),
-	PINMUX_GPIO(GPIO_PA2, PA2_DATA),
-	PINMUX_GPIO(GPIO_PA1, PA1_DATA),
-	PINMUX_GPIO(GPIO_PA0, PA0_DATA),
-
-	/* PB */
-	PINMUX_GPIO(GPIO_PB7, PB7_DATA),
-	PINMUX_GPIO(GPIO_PB6, PB6_DATA),
-	PINMUX_GPIO(GPIO_PB5, PB5_DATA),
-	PINMUX_GPIO(GPIO_PB4, PB4_DATA),
-	PINMUX_GPIO(GPIO_PB3, PB3_DATA),
-	PINMUX_GPIO(GPIO_PB2, PB2_DATA),
-	PINMUX_GPIO(GPIO_PB1, PB1_DATA),
-	PINMUX_GPIO(GPIO_PB0, PB0_DATA),
-
-	/* PC */
-	PINMUX_GPIO(GPIO_PC7, PC7_DATA),
-	PINMUX_GPIO(GPIO_PC6, PC6_DATA),
-	PINMUX_GPIO(GPIO_PC5, PC5_DATA),
-	PINMUX_GPIO(GPIO_PC4, PC4_DATA),
-	PINMUX_GPIO(GPIO_PC3, PC3_DATA),
-	PINMUX_GPIO(GPIO_PC2, PC2_DATA),
-	PINMUX_GPIO(GPIO_PC1, PC1_DATA),
-	PINMUX_GPIO(GPIO_PC0, PC0_DATA),
-
-	/* PD */
-	PINMUX_GPIO(GPIO_PD7, PD7_DATA),
-	PINMUX_GPIO(GPIO_PD6, PD6_DATA),
-	PINMUX_GPIO(GPIO_PD5, PD5_DATA),
-	PINMUX_GPIO(GPIO_PD4, PD4_DATA),
-	PINMUX_GPIO(GPIO_PD3, PD3_DATA),
-	PINMUX_GPIO(GPIO_PD2, PD2_DATA),
-	PINMUX_GPIO(GPIO_PD1, PD1_DATA),
-	PINMUX_GPIO(GPIO_PD0, PD0_DATA),
-
-	/* PE */
-	PINMUX_GPIO(GPIO_PE7, PE7_DATA),
-	PINMUX_GPIO(GPIO_PE6, PE6_DATA),
-	PINMUX_GPIO(GPIO_PE5, PE5_DATA),
-	PINMUX_GPIO(GPIO_PE4, PE4_DATA),
-	PINMUX_GPIO(GPIO_PE3, PE3_DATA),
-	PINMUX_GPIO(GPIO_PE2, PE2_DATA),
-	PINMUX_GPIO(GPIO_PE1, PE1_DATA),
-	PINMUX_GPIO(GPIO_PE0, PE0_DATA),
-
-	/* PF */
-	PINMUX_GPIO(GPIO_PF7, PF7_DATA),
-	PINMUX_GPIO(GPIO_PF6, PF6_DATA),
-	PINMUX_GPIO(GPIO_PF5, PF5_DATA),
-	PINMUX_GPIO(GPIO_PF4, PF4_DATA),
-	PINMUX_GPIO(GPIO_PF3, PF3_DATA),
-	PINMUX_GPIO(GPIO_PF2, PF2_DATA),
-	PINMUX_GPIO(GPIO_PF1, PF1_DATA),
-	PINMUX_GPIO(GPIO_PF0, PF0_DATA),
-
-	/* PG */
-	PINMUX_GPIO(GPIO_PG7, PG7_DATA),
-	PINMUX_GPIO(GPIO_PG6, PG6_DATA),
-	PINMUX_GPIO(GPIO_PG5, PG5_DATA),
-	PINMUX_GPIO(GPIO_PG4, PG4_DATA),
-	PINMUX_GPIO(GPIO_PG3, PG3_DATA),
-	PINMUX_GPIO(GPIO_PG2, PG2_DATA),
-	PINMUX_GPIO(GPIO_PG1, PG1_DATA),
-	PINMUX_GPIO(GPIO_PG0, PG0_DATA),
-
-	/* PH */
-	PINMUX_GPIO(GPIO_PH5, PH5_DATA),
-	PINMUX_GPIO(GPIO_PH4, PH4_DATA),
-	PINMUX_GPIO(GPIO_PH3, PH3_DATA),
-	PINMUX_GPIO(GPIO_PH2, PH2_DATA),
-	PINMUX_GPIO(GPIO_PH1, PH1_DATA),
-	PINMUX_GPIO(GPIO_PH0, PH0_DATA),
-
-	/* FN */
-	PINMUX_GPIO(GPIO_FN_D31,	D31_MARK),
-	PINMUX_GPIO(GPIO_FN_D30,	D30_MARK),
-	PINMUX_GPIO(GPIO_FN_D29,	D29_MARK),
-	PINMUX_GPIO(GPIO_FN_D28,	D28_MARK),
-	PINMUX_GPIO(GPIO_FN_D27,	D27_MARK),
-	PINMUX_GPIO(GPIO_FN_D26,	D26_MARK),
-	PINMUX_GPIO(GPIO_FN_D25,	D25_MARK),
-	PINMUX_GPIO(GPIO_FN_D24,	D24_MARK),
-	PINMUX_GPIO(GPIO_FN_D23,	D23_MARK),
-	PINMUX_GPIO(GPIO_FN_D22,	D22_MARK),
-	PINMUX_GPIO(GPIO_FN_D21,	D21_MARK),
-	PINMUX_GPIO(GPIO_FN_D20,	D20_MARK),
-	PINMUX_GPIO(GPIO_FN_D19,	D19_MARK),
-	PINMUX_GPIO(GPIO_FN_D18,	D18_MARK),
-	PINMUX_GPIO(GPIO_FN_D17,	D17_MARK),
-	PINMUX_GPIO(GPIO_FN_D16,	D16_MARK),
-	PINMUX_GPIO(GPIO_FN_BACK,	BACK_MARK),
-	PINMUX_GPIO(GPIO_FN_BREQ,	BREQ_MARK),
-	PINMUX_GPIO(GPIO_FN_WE3,	WE3_MARK),
-	PINMUX_GPIO(GPIO_FN_WE2,	WE2_MARK),
-	PINMUX_GPIO(GPIO_FN_CS6,	CS6_MARK),
-	PINMUX_GPIO(GPIO_FN_CS5,	CS5_MARK),
-	PINMUX_GPIO(GPIO_FN_CS4,	CS4_MARK),
-	PINMUX_GPIO(GPIO_FN_CLKOUTENB,	CLKOUTENB_MARK),
-	PINMUX_GPIO(GPIO_FN_DACK3,	DACK3_MARK),
-	PINMUX_GPIO(GPIO_FN_DACK2,	DACK2_MARK),
-	PINMUX_GPIO(GPIO_FN_DACK1,	DACK1_MARK),
-	PINMUX_GPIO(GPIO_FN_DACK0,	DACK0_MARK),
-	PINMUX_GPIO(GPIO_FN_DREQ3,	DREQ3_MARK),
-	PINMUX_GPIO(GPIO_FN_DREQ2,	DREQ2_MARK),
-	PINMUX_GPIO(GPIO_FN_DREQ1,	DREQ1_MARK),
-	PINMUX_GPIO(GPIO_FN_DREQ0,	DREQ0_MARK),
-	PINMUX_GPIO(GPIO_FN_IRQ3,	IRQ3_MARK),
-	PINMUX_GPIO(GPIO_FN_IRQ2,	IRQ2_MARK),
-	PINMUX_GPIO(GPIO_FN_IRQ1,	IRQ1_MARK),
-	PINMUX_GPIO(GPIO_FN_IRQ0,	IRQ0_MARK),
-	PINMUX_GPIO(GPIO_FN_DRAK3,	DRAK3_MARK),
-	PINMUX_GPIO(GPIO_FN_DRAK2,	DRAK2_MARK),
-	PINMUX_GPIO(GPIO_FN_DRAK1,	DRAK1_MARK),
-	PINMUX_GPIO(GPIO_FN_DRAK0,	DRAK0_MARK),
-	PINMUX_GPIO(GPIO_FN_SCK3,	SCK3_MARK),
-	PINMUX_GPIO(GPIO_FN_SCK2,	SCK2_MARK),
-	PINMUX_GPIO(GPIO_FN_SCK1,	SCK1_MARK),
-	PINMUX_GPIO(GPIO_FN_SCK0,	SCK0_MARK),
-	PINMUX_GPIO(GPIO_FN_IRL3,	IRL3_MARK),
-	PINMUX_GPIO(GPIO_FN_IRL2,	IRL2_MARK),
-	PINMUX_GPIO(GPIO_FN_IRL1,	IRL1_MARK),
-	PINMUX_GPIO(GPIO_FN_IRL0,	IRL0_MARK),
-	PINMUX_GPIO(GPIO_FN_TXD3,	TXD3_MARK),
-	PINMUX_GPIO(GPIO_FN_TXD2,	TXD2_MARK),
-	PINMUX_GPIO(GPIO_FN_TXD1,	TXD1_MARK),
-	PINMUX_GPIO(GPIO_FN_TXD0,	TXD0_MARK),
-	PINMUX_GPIO(GPIO_FN_RXD3,	RXD3_MARK),
-	PINMUX_GPIO(GPIO_FN_RXD2,	RXD2_MARK),
-	PINMUX_GPIO(GPIO_FN_RXD1,	RXD1_MARK),
-	PINMUX_GPIO(GPIO_FN_RXD0,	RXD0_MARK),
-	PINMUX_GPIO(GPIO_FN_CE2B,	CE2B_MARK),
-	PINMUX_GPIO(GPIO_FN_CE2A,	CE2A_MARK),
-	PINMUX_GPIO(GPIO_FN_IOIS16,	IOIS16_MARK),
-	PINMUX_GPIO(GPIO_FN_STATUS1,	STATUS1_MARK),
-	PINMUX_GPIO(GPIO_FN_STATUS0,	STATUS0_MARK),
-	PINMUX_GPIO(GPIO_FN_IRQOUT,	IRQOUT_MARK),
-};
-
-static struct pinmux_cfg_reg shx3_pinmux_config_regs[] = {
-	{ PINMUX_CFG_REG("PABCR", 0xffc70000, 32, 2) {
-		PA7_FN, PA7_OUT, PA7_IN, PA7_IN_PU,
-		PA6_FN, PA6_OUT, PA6_IN, PA6_IN_PU,
-		PA5_FN, PA5_OUT, PA5_IN, PA5_IN_PU,
-		PA4_FN, PA4_OUT, PA4_IN, PA4_IN_PU,
-		PA3_FN, PA3_OUT, PA3_IN, PA3_IN_PU,
-		PA2_FN, PA2_OUT, PA2_IN, PA2_IN_PU,
-		PA1_FN, PA1_OUT, PA1_IN, PA1_IN_PU,
-		PA0_FN, PA0_OUT, PA0_IN, PA0_IN_PU,
-		PB7_FN, PB7_OUT, PB7_IN, PB7_IN_PU,
-		PB6_FN, PB6_OUT, PB6_IN, PB6_IN_PU,
-		PB5_FN, PB5_OUT, PB5_IN, PB5_IN_PU,
-		PB4_FN, PB4_OUT, PB4_IN, PB4_IN_PU,
-		PB3_FN, PB3_OUT, PB3_IN, PB3_IN_PU,
-		PB2_FN, PB2_OUT, PB2_IN, PB2_IN_PU,
-		PB1_FN, PB1_OUT, PB1_IN, PB1_IN_PU,
-		PB0_FN, PB0_OUT, PB0_IN, PB0_IN_PU, },
-	},
-	{ PINMUX_CFG_REG("PCDCR", 0xffc70004, 32, 2) {
-		PC7_FN, PC7_OUT, PC7_IN, PC7_IN_PU,
-		PC6_FN, PC6_OUT, PC6_IN, PC6_IN_PU,
-		PC5_FN, PC5_OUT, PC5_IN, PC5_IN_PU,
-		PC4_FN, PC4_OUT, PC4_IN, PC4_IN_PU,
-		PC3_FN, PC3_OUT, PC3_IN, PC3_IN_PU,
-		PC2_FN, PC2_OUT, PC2_IN, PC2_IN_PU,
-		PC1_FN, PC1_OUT, PC1_IN, PC1_IN_PU,
-		PC0_FN, PC0_OUT, PC0_IN, PC0_IN_PU,
-		PD7_FN, PD7_OUT, PD7_IN, PD7_IN_PU,
-		PD6_FN, PD6_OUT, PD6_IN, PD6_IN_PU,
-		PD5_FN, PD5_OUT, PD5_IN, PD5_IN_PU,
-		PD4_FN, PD4_OUT, PD4_IN, PD4_IN_PU,
-		PD3_FN, PD3_OUT, PD3_IN, PD3_IN_PU,
-		PD2_FN, PD2_OUT, PD2_IN, PD2_IN_PU,
-		PD1_FN, PD1_OUT, PD1_IN, PD1_IN_PU,
-		PD0_FN, PD0_OUT, PD0_IN, PD0_IN_PU, },
-	},
-	{ PINMUX_CFG_REG("PEFCR", 0xffc70008, 32, 2) {
-		PE7_FN, PE7_OUT, PE7_IN, PE7_IN_PU,
-		PE6_FN, PE6_OUT, PE6_IN, PE6_IN_PU,
-		PE5_FN, PE5_OUT, PE5_IN, PE5_IN_PU,
-		PE4_FN, PE4_OUT, PE4_IN, PE4_IN_PU,
-		PE3_FN, PE3_OUT, PE3_IN, PE3_IN_PU,
-		PE2_FN, PE2_OUT, PE2_IN, PE2_IN_PU,
-		PE1_FN, PE1_OUT, PE1_IN, PE1_IN_PU,
-		PE0_FN, PE0_OUT, PE0_IN, PE0_IN_PU,
-		PF7_FN, PF7_OUT, PF7_IN, PF7_IN_PU,
-		PF6_FN, PF6_OUT, PF6_IN, PF6_IN_PU,
-		PF5_FN, PF5_OUT, PF5_IN, PF5_IN_PU,
-		PF4_FN, PF4_OUT, PF4_IN, PF4_IN_PU,
-		PF3_FN, PF3_OUT, PF3_IN, PF3_IN_PU,
-		PF2_FN, PF2_OUT, PF2_IN, PF2_IN_PU,
-		PF1_FN, PF1_OUT, PF1_IN, PF1_IN_PU,
-		PF0_FN, PF0_OUT, PF0_IN, PF0_IN_PU, },
-	},
-	{ PINMUX_CFG_REG("PGHCR", 0xffc7000c, 32, 2) {
-		PG7_FN, PG7_OUT, PG7_IN, PG7_IN_PU,
-		PG6_FN, PG6_OUT, PG6_IN, PG6_IN_PU,
-		PG5_FN, PG5_OUT, PG5_IN, PG5_IN_PU,
-		PG4_FN, PG4_OUT, PG4_IN, PG4_IN_PU,
-		PG3_FN, PG3_OUT, PG3_IN, PG3_IN_PU,
-		PG2_FN, PG2_OUT, PG2_IN, PG2_IN_PU,
-		PG1_FN, PG1_OUT, PG1_IN, PG1_IN_PU,
-		PG0_FN, PG0_OUT, PG0_IN, PG0_IN_PU,
-		0, 0, 0, 0,
-		0, 0, 0, 0,
-		PH5_FN, PH5_OUT, PH5_IN, PH5_IN_PU,
-		PH4_FN, PH4_OUT, PH4_IN, PH4_IN_PU,
-		PH3_FN, PH3_OUT, PH3_IN, PH3_IN_PU,
-		PH2_FN, PH2_OUT, PH2_IN, PH2_IN_PU,
-		PH1_FN, PH1_OUT, PH1_IN, PH1_IN_PU,
-		PH0_FN, PH0_OUT, PH0_IN, PH0_IN_PU, },
-	},
-	{ },
-};
-
-static struct pinmux_data_reg shx3_pinmux_data_regs[] = {
-	{ PINMUX_DATA_REG("PABDR", 0xffc70010, 32) {
-		0, 0, 0, 0, 0, 0, 0, 0,
-		PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA,
-		PA3_DATA, PA2_DATA, PA1_DATA, PA0_DATA,
-		0, 0, 0, 0, 0, 0, 0, 0,
-		PB7_DATA, PB6_DATA, PB5_DATA, PB4_DATA,
-		PB3_DATA, PB2_DATA, PB1_DATA, PB0_DATA, },
-	},
-	{ PINMUX_DATA_REG("PCDDR", 0xffc70014, 32) {
-		0, 0, 0, 0, 0, 0, 0, 0,
-		PC7_DATA, PC6_DATA, PC5_DATA, PC4_DATA,
-		PC3_DATA, PC2_DATA, PC1_DATA, PC0_DATA,
-		0, 0, 0, 0, 0, 0, 0, 0,
-		PD7_DATA, PD6_DATA, PD5_DATA, PD4_DATA,
-		PD3_DATA, PD2_DATA, PD1_DATA, PD0_DATA, },
-	},
-	{ PINMUX_DATA_REG("PEFDR", 0xffc70018, 32) {
-		0, 0, 0, 0, 0, 0, 0, 0,
-		PE7_DATA, PE6_DATA, PE5_DATA, PE4_DATA,
-		PE3_DATA, PE2_DATA, PE1_DATA, PE0_DATA,
-		0, 0, 0, 0, 0, 0, 0, 0,
-		PF7_DATA, PF6_DATA, PF5_DATA, PF4_DATA,
-		PF3_DATA, PF2_DATA, PF1_DATA, PF0_DATA, },
-	},
-	{ PINMUX_DATA_REG("PGHDR", 0xffc7001c, 32) {
-		0, 0, 0, 0, 0, 0, 0, 0,
-		PG7_DATA, PG6_DATA, PG5_DATA, PG4_DATA,
-		PG3_DATA, PG2_DATA, PG1_DATA, PG0_DATA,
-		0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, PH5_DATA, PH4_DATA,
-		PH3_DATA, PH2_DATA, PH1_DATA, PH0_DATA, },
-	},
-	{ },
-};
-
-static struct pinmux_info shx3_pinmux_info = {
-	.name		= "shx3_pfc",
-	.reserved_id	= PINMUX_RESERVED,
-	.data		= { PINMUX_DATA_BEGIN,	   PINMUX_DATA_END },
-	.input		= { PINMUX_INPUT_BEGIN,	   PINMUX_INPUT_END },
-	.input_pu	= { PINMUX_INPUT_PULLUP_BEGIN,
-			    PINMUX_INPUT_PULLUP_END },
-	.output		= { PINMUX_OUTPUT_BEGIN,   PINMUX_OUTPUT_END },
-	.mark		= { PINMUX_MARK_BEGIN,     PINMUX_MARK_END },
-	.function	= { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
-	.first_gpio	= GPIO_PA7,
-	.last_gpio	= GPIO_FN_STATUS0,
-	.gpios		= shx3_pinmux_gpios,
-	.gpio_data	= shx3_pinmux_data,
-	.gpio_data_size	= ARRAY_SIZE(shx3_pinmux_data),
-	.cfg_regs	= shx3_pinmux_config_regs,
-	.data_regs	= shx3_pinmux_data_regs,
-};

 static int __init shx3_pinmux_setup(void)
 {
-	return sh_pfc_register_info(NULL, NULL, 0, &shx3_pinmux_info);
+	return sh_pfc_register("pfc-shx3", NULL, 0);
 }
 arch_initcall(shx3_pinmux_setup);


Added a compile time chech to the MMC_SPI driver.

git-svn-id: de15d415ffb1bc5d91a165b5b7d2093897d104a2@5553 35acf78f-673a-0410-8e92-d51de3d6d3f4


os/wqueue : Fix build warning in work_process

I fixed build warning below.

work_process.c:220:4: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
    while (work_lock() < 0);
    ^~~~~
work_process.c:224:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'while'
     work = (FAR struct work_s *)wqueue->q.head;
     ^~~~

--- os/wqueue/work_process.c
+++ os/wqueue/work_process.c
@@ -205,9 +205,9 @@
 				 */

 #if defined(CONFIG_SCHED_USRWORK) && !defined(__KERNEL__)
-			work_unlock();
-#else
-			irqrestore(flags);
+				work_unlock();
+#else
+				irqrestore(flags);
 #endif
 				worker(arg);

@@ -217,9 +217,9 @@
 				 */

 #if defined(CONFIG_SCHED_USRWORK) && !defined(__KERNEL__)
-			while (work_lock() < 0);
-#else
-			flags = irqsave();
+				while (work_lock() < 0);
+#else
+				flags = irqsave();
 #endif
 				work = (FAR struct work_s *)wqueue->q.head;
 			} else {


Doco style.

Doco style.

--- Reducers/REDFilter.h
+++ Reducers/REDFilter.h
@@ -6,18 +6,16 @@

 /// A block which specifies a predicate over an object.
 ///
-/// \param subject The object to be predicated upon.
-///
-/// \return \c true if the object passes, \c false if it fails.
+/// \param subject  The object to be predicated upon.
+/// \return         \c true if the object passes, \c false if it fails.
 typedef bool (^REDPredicateBlock)(id subject);

 /// A reducer which filters a reducible.
 ///
-/// \param collection The collection to filter.
-/// \param predicate The predicate to apply to each element.
-///
-/// \return A reducible which, when reduced, produces the elements of \c collection which are matched by \c predicate.
+/// \param collection  The collection to filter.
+/// \param predicate   The predicate to apply to each element.
+/// \return            A reducible which, when reduced, produces the elements of \c collection which are matched by \c predicate.
 id<REDReducible> REDFilter(id<REDReducible> collection, REDPredicateBlock predicate);

@@ -42,22 +40,19 @@

 /// Returns a predicate which accepts objects equal to \c object.
 ///
-/// \param object The object to compare against. May be nil.
-///
-/// \return \c true iff the subject and object are equal as determined by \c -isEqual:.
+/// \param object  The object to compare against. May be nil.
+/// \return        \c true iff the subject and object are equal as determined by \c -isEqual:.
 REDPredicateBlock REDEqualityPredicate(id object);

 /// Returns a predicate which accepts objects identical to \c object.
 ///
-/// \param object The object to compare against. May be nil.
-///
-/// \return \c true iff the subject and object are identical as determined by pointer equality.
+/// \param object  The object to compare against. May be nil.
+/// \return        \c true iff the subject and object are identical as determined by pointer equality.
 REDPredicateBlock REDIdentityPredicate(id object);

 /// Returns a predicate which inverts the sense of \c predicate.
 ///
-/// \param predicate The predicate to apply and invert the sense of. Must not be nil.
-///
-/// \return \c true iff \c predicate returns \c false.
+/// \param predicate  The predicate to apply and invert the sense of. Must not be nil.
+/// \return           \c true iff \c predicate returns \c false.
 REDPredicateBlock REDNotPredicate(REDPredicateBlock predicate);


fix bug 184 (warning)

fix bug 184 (warning)

--- unsupported/Eigen/src/SparseExtra/UmfPackSupport.h
+++ unsupported/Eigen/src/SparseExtra/UmfPackSupport.h
@@ -248,14 +248,14 @@

     void* numeric = const_cast<void*>(dec().numeric());

-    int errorCode = 0;
+    EIGEN_UNUSED int errorCode = 0;
     for (int j=0; j<rhsCols; ++j)
-      {
- errorCode = umfpack_solve(UMFPACK_A,
-         dec().matrixLU()._outerIndexPtr(), dec().matrixLU()._innerIndexPtr(), dec().matrixLU()._valuePtr(),
-         &dst.col(j).coeffRef(0), &rhs().const_cast_derived().col(j).coeffRef(0), numeric, 0, 0);
- eigen_assert(!errorCode && "UmfPack could not solve the system.");
-      }
+    {
+      errorCode = umfpack_solve(UMFPACK_A,
+                                dec().matrixLU()._outerIndexPtr(), dec().matrixLU()._innerIndexPtr(), dec().matrixLU()._valuePtr(),
+                                &dst.col(j).coeffRef(0), &rhs().const_cast_derived().col(j).coeffRef(0), numeric, 0, 0);
+      eigen_assert(!errorCode && "UmfPack could not solve the system.");
+    }
   }

 };


add malloc fail check & fix memory leak

add malloc fail check & fix memory leak

Signed-off-by: Hongze Zhu <hongze.zhu@gmail.com>

Reviewed-by: Rich Salz <c04971a99e5a9ee80eaab4b1deb37e845b0bd697@openssl.org>
Reviewed-by: Matt Caswell <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@openssl.org>

--- test/dhtest.c
+++ test/dhtest.c
@@ -86,13 +86,15 @@

 int main(int argc, char *argv[])
 {
-    BN_GENCB *_cb;
+    BN_GENCB *_cb = NULL;
     DH *a = NULL;
     DH *b = NULL;
-    char buf[12];
-    unsigned char *abuf = NULL, *bbuf = NULL;
-    int i, alen, blen, aout, bout, ret = 1;
-    BIO *out;
+    char buf[12] = {0};
+    unsigned char *abuf = NULL;
+    unsigned char *bbuf = NULL;
+    int i, alen, blen, aout, bout;
+    int ret = 1;
+    BIO *out = NULL;

     CRYPTO_malloc_debug_init();
     CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
@@ -110,12 +112,11 @@
     BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);

     _cb = BN_GENCB_new();
-    if (!_cb)
+    if (_cb == NULL)
         goto err;
     BN_GENCB_set(_cb, &cb, out);
-    if (((a = DH_new()) == NULL) || !DH_generate_parameters_ex(a, 64,
-                                                               DH_GENERATOR_5,
-                                                               _cb))
+    if (((a = DH_new()) == NULL)
+        || (!DH_generate_parameters_ex(a, 64, DH_GENERATOR_5, _cb)))
         goto err;

     if (!DH_check(a, &i))
@@ -166,6 +167,9 @@

     alen = DH_size(a);
     abuf = OPENSSL_malloc(alen);
+    if (abuf == NULL)
+        goto err;
+
     aout = DH_compute_key(abuf, b->pub_key, a);

     BIO_puts(out, "key1 =");
@@ -177,6 +181,9 @@

     blen = DH_size(b);
     bbuf = OPENSSL_malloc(blen);
+    if (bbuf == NULL)
+        goto err;
+
     bout = DH_compute_key(bbuf, a->pub_key, b);

     BIO_puts(out, "key2 =");
@@ -485,14 +492,22 @@
 static int run_rfc5114_tests(void)
 {
     int i;
+    DH *dhA = NULL;
+    DH *dhB = NULL;
+    unsigned char *Z1 = NULL;
+    unsigned char *Z2 = NULL;
+    const rfc5114_td *td = NULL;
+
     for (i = 0; i < (int)OSSL_NELEM(rfctd); i++) {
-        DH *dhA, *dhB;
-        unsigned char *Z1 = NULL, *Z2 = NULL;
-        const rfc5114_td *td = rfctd + i;
+        dhA = NULL;
+        dhB = NULL;
+        Z1 = NULL;
+        Z2 = NULL;
+        td = rfctd + i;
         /* Set up DH structures setting key components */
         dhA = td->get_param();
         dhB = td->get_param();
-        if (!dhA || !dhB)
+        if ((dhA == NULL) || (dhB == NULL))
             goto bad_err;

         dhA->priv_key = BN_bin2bn(td->xA, td->xA_len, NULL);
@@ -501,8 +516,8 @@
         dhB->priv_key = BN_bin2bn(td->xB, td->xB_len, NULL);
         dhB->pub_key = BN_bin2bn(td->yB, td->yB_len, NULL);

-        if (!dhA->priv_key || !dhA->pub_key
-            || !dhB->priv_key || !dhB->pub_key)
+        if ((dhA->priv_key == NULL) || (dhA->pub_key == NULL)
+            || (dhB->priv_key == NULL) || (dhB->pub_key == NULL))
             goto bad_err;

         if ((td->Z_len != (size_t)DH_size(dhA))
@@ -511,6 +526,8 @@

         Z1 = OPENSSL_malloc(DH_size(dhA));
         Z2 = OPENSSL_malloc(DH_size(dhB));
+        if ((Z1 == NULL) || (Z2 == NULL))
+            goto bad_err;
         /*
          * Work out shared secrets using both sides and compare with expected
          * values.
@@ -535,10 +552,20 @@
     }
     return 1;
  bad_err:
+    DH_free(dhA);
+    DH_free(dhB);
+    OPENSSL_free(Z1);
+    OPENSSL_free(Z2);
+
     fprintf(stderr, "Initalisation error RFC5114 set %d\n", i + 1);
     ERR_print_errors_fp(stderr);
     return 0;
  err:
+    DH_free(dhA);
+    DH_free(dhB);
+    OPENSSL_free(Z1);
+    OPENSSL_free(Z2);
+
     fprintf(stderr, "Test failed RFC5114 set %d\n", i + 1);
     return 0;
 }


drm/radeon: disable pll sharing for DP on DCE4.1

From Alex Deucher
2e673e623ba5a604c02fadcad9bf75e6a0ee9705 in ubuntu 3.8
9ef4e1d000a5b335fcebfcf8aef3405e59574c89 in mainline linux

--- dev/pci/drm/radeon/atombios_crtc.c
+++ dev/pci/drm/radeon/atombios_crtc.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: atombios_crtc.c,v 1.4 2014/02/15 14:23:10 jsg Exp $	*/
+/*	$OpenBSD: atombios_crtc.c,v 1.5 2014/03/30 02:17:50 jsg Exp $	*/
 /*
  * Copyright 2007-8 Advanced Micro Devices, Inc.
  * Copyright 2008 Red Hat Inc.
@@ -1660,6 +1660,20 @@
 			return ATOM_PPLL1;
 		DRM_ERROR("unable to allocate a PPLL\n");
 		return ATOM_PPLL_INVALID;
+	} else if (ASIC_IS_DCE41(rdev)) {
+		/* Don't share PLLs on DCE4.1 chips */
+		if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {
+			if (rdev->clock.dp_extclk)
+				/* skip PPLL programming if using ext clock */
+				return ATOM_PPLL_INVALID;
+		}
+		pll_in_use = radeon_get_pll_use_mask(crtc);
+		if (!(pll_in_use & (1 << ATOM_PPLL1)))
+			return ATOM_PPLL1;
+		if (!(pll_in_use & (1 << ATOM_PPLL2)))
+			return ATOM_PPLL2;
+		DRM_ERROR("unable to allocate a PPLL\n");
+		return ATOM_PPLL_INVALID;
 	} else if (ASIC_IS_DCE4(rdev)) {
 		/* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock,
 		 * depending on the asic:
@@ -1687,7 +1701,7 @@
 				if (pll != ATOM_PPLL_INVALID)
 					return pll;
 			}
-		} else if (!ASIC_IS_DCE41(rdev)) { /* Don't share PLLs on DCE4.1 chips */
+		} else {
 			/* use the same PPLL for all monitors with the same clock */
 			pll = radeon_get_shared_nondp_ppll(crtc);
 			if (pll != ATOM_PPLL_INVALID)


We need to defined this eina helper functions

--- src/include/enesim_eina.h
+++ src/include/enesim_eina.h
@@ -48,4 +48,25 @@
 	return eina_f16p16_sqrt(x);
 }

+/* round downn */
+static inline int eina_f16p16_floor(Eina_F16p16 v)
+{
+	return v >> 16;
+}
+
+/* round to nearest */
+static inline int eina_f16p16_round(Eina_F16p16 v)
+{
+	return eina_f16p16_floor(v + EINA_F16P16_HALF);
+}
+
+/* round towards zero */
+static inline int eina_f16p16_trunc(Eina_F16p16 v)
+{
+#if 0
+	if (v > 0) return eina_f16p16_floor(v);
+	else return eina_f16p16_ceil(v);
 #endif
+}
+
+#endif


cimpile

cimpile

Former-commit-id: 511ffe584fe1a6e7291f39b96708fe2f818fd4dc

--- src/uint256.h
+++ src/uint256.h
@@ -153,7 +153,7 @@
     {
         std::size_t operator()(const uint256& k) const
         {
-            return (std::size_t)ReadLE64(hash.begin()));
+            return (std::size_t)ReadLE64(hash.begin());
         }
     };
 }


dinit-util: include string header (FreeBSD build fix)

--- src/includes/dinit-util.h
+++ src/includes/dinit-util.h
@@ -1,5 +1,7 @@
 #ifndef DINIT_UTIL_H_INCLUDED
 #define DINIT_UTIL_H_INCLUDED 1
+
+#include <string>

 #include <cstddef>
 #include <cerrno>


vhost: copy host memory mapping to a new cuse file

Signed-off-by: Huawei Xie <3b3be4428106761300a2ee559c9f71ecdb091553@intel.com>
Acked-by: Tetsuya Mukawa <b347a9f5840345582b30d055e1e99ac6ac7bce3c@igel.co.jp>

error: pathspec 'lib/librte_vhost/vhost_cuse/virtio-net-cdev.c' did not match any file(s) known to git

--- lib/librte_vhost/vhost_cuse/virtio-net-cdev.c
+++ lib/librte_vhost/vhost_cuse/virtio-net-cdev.c
@@ -0,0 +1,257 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <dirent.h>
+#include <linux/vhost.h>
+#include <linux/virtio_net.h>
+#include <fuse/cuse_lowlevel.h>
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/eventfd.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <rte_log.h>
+
+#include "vhost-net.h"
+
+/* Line size for reading maps file. */
+static const uint32_t BUFSIZE = PATH_MAX;
+
+/* Size of prot char array in procmap. */
+#define PROT_SZ 5
+
+/* Number of elements in procmap struct. */
+#define PROCMAP_SZ 8
+
+/* Structure containing information gathered from maps file. */
+struct procmap {
+	uint64_t va_start;	/* Start virtual address in file. */
+	uint64_t len;		/* Size of file. */
+	uint64_t pgoff;		/* Not used. */
+	uint32_t maj;		/* Not used. */
+	uint32_t min;		/* Not used. */
+	uint32_t ino;		/* Not used. */
+	char prot[PROT_SZ];	/* Not used. */
+	char fname[PATH_MAX];	/* File name. */
+};
+
+/*
+ * Locate the file containing QEMU's memory space and
+ * map it to our address space.
+ */
+static int
+host_memory_map(struct virtio_net *dev, struct virtio_memory *mem,
+	pid_t pid, uint64_t addr)
+{
+	struct dirent *dptr = NULL;
+	struct procmap procmap;
+	DIR *dp = NULL;
+	int fd;
+	int i;
+	char memfile[PATH_MAX];
+	char mapfile[PATH_MAX];
+	char procdir[PATH_MAX];
+	char resolved_path[PATH_MAX];
+	char *path = NULL;
+	FILE *fmap;
+	void *map;
+	uint8_t found = 0;
+	char line[BUFSIZE];
+	char dlm[] = "-   :   ";
+	char *str, *sp, *in[PROCMAP_SZ];
+	char *end = NULL;
+
+	/* Path where mem files are located. */
+	snprintf(procdir, PATH_MAX, "/proc/%u/fd/", pid);
+	/* Maps file used to locate mem file. */
+	snprintf(mapfile, PATH_MAX, "/proc/%u/maps", pid);
+
+	fmap = fopen(mapfile, "r");
+	if (fmap == NULL) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+			"(%"PRIu64") Failed to open maps file for pid %d\n",
+			dev->device_fh, pid);
+		return -1;
+	}
+
+	/* Read through maps file until we find out base_address. */
+	while (fgets(line, BUFSIZE, fmap) != 0) {
+		str = line;
+		errno = 0;
+		/* Split line into fields. */
+		for (i = 0; i < PROCMAP_SZ; i++) {
+			in[i] = strtok_r(str, &dlm[i], &sp);
+			if ((in[i] == NULL) || (errno != 0)) {
+				fclose(fmap);
+				return -1;
+			}
+			str = NULL;
+		}
+
+		/* Convert/Copy each field as needed. */
+		procmap.va_start = strtoull(in[0], &end, 16);
+		if ((in[0] == '\0') || (end == NULL) || (*end != '\0') ||
+			(errno != 0)) {
+			fclose(fmap);
+			return -1;
+		}
+
+		procmap.len = strtoull(in[1], &end, 16);
+		if ((in[1] == '\0') || (end == NULL) || (*end != '\0') ||
+			(errno != 0)) {
+			fclose(fmap);
+			return -1;
+		}
+
+		procmap.pgoff = strtoull(in[3], &end, 16);
+		if ((in[3] == '\0') || (end == NULL) || (*end != '\0') ||
+			(errno != 0)) {
+			fclose(fmap);
+			return -1;
+		}
+
+		procmap.maj = strtoul(in[4], &end, 16);
+		if ((in[4] == '\0') || (end == NULL) || (*end != '\0') ||
+			(errno != 0)) {
+			fclose(fmap);
+			return -1;
+		}
+
+		procmap.min = strtoul(in[5], &end, 16);
+		if ((in[5] == '\0') || (end == NULL) || (*end != '\0') ||
+			(errno != 0)) {
+			fclose(fmap);
+			return -1;
+		}
+
+		procmap.ino = strtoul(in[6], &end, 16);
+		if ((in[6] == '\0') || (end == NULL) || (*end != '\0') ||
+			(errno != 0)) {
+			fclose(fmap);
+			return -1;
+		}
+
+		memcpy(&procmap.prot, in[2], PROT_SZ);
+		memcpy(&procmap.fname, in[7], PATH_MAX);
+
+		if (procmap.va_start == addr) {
+			procmap.len = procmap.len - procmap.va_start;
+			found = 1;
+			break;
+		}
+	}
+	fclose(fmap);
+
+	if (!found) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+			"(%"PRIu64") Failed to find memory file in pid %d maps file\n",
+			dev->device_fh, pid);
+		return -1;
+	}
+
+	/* Find the guest memory file among the process fds. */
+	dp = opendir(procdir);
+	if (dp == NULL) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+			"(%"PRIu64") Cannot open pid %d process directory\n",
+			dev->device_fh, pid);
+		return -1;
+	}
+
+	found = 0;
+
+	/* Read the fd directory contents. */
+	while (NULL != (dptr = readdir(dp))) {
+		snprintf(memfile, PATH_MAX, "/proc/%u/fd/%s",
+				pid, dptr->d_name);
+		path = realpath(memfile, resolved_path);
+		if ((path == NULL) && (strlen(resolved_path) == 0)) {
+			RTE_LOG(ERR, VHOST_CONFIG,
+				"(%"PRIu64") Failed to resolve fd directory\n",
+				dev->device_fh);
+			closedir(dp);
+			return -1;
+		}
+		if (strncmp(resolved_path, procmap.fname,
+			strnlen(procmap.fname, PATH_MAX)) == 0) {
+			found = 1;
+			break;
+		}
+	}
+
+	closedir(dp);
+
+	if (found == 0) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+			"(%"PRIu64") Failed to find memory file for pid %d\n",
+			dev->device_fh, pid);
+		return -1;
+	}
+	/* Open the shared memory file and map the memory into this process. */
+	fd = open(memfile, O_RDWR);
+
+	if (fd == -1) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+			"(%"PRIu64") Failed to open %s for pid %d\n",
+			dev->device_fh, memfile, pid);
+		return -1;
+	}
+
+	map = mmap(0, (size_t)procmap.len, PROT_READ|PROT_WRITE,
+		MAP_POPULATE|MAP_SHARED, fd, 0);
+	close(fd);
+
+	if (map == MAP_FAILED) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+			"(%"PRIu64") Error mapping the file %s for pid %d\n",
+			dev->device_fh, memfile, pid);
+		return -1;
+	}
+
+	/* Store the memory address and size in the device data structure */
+	mem->mapped_address = (uint64_t)(uintptr_t)map;
+	mem->mapped_size = procmap.len;
+
+	LOG_DEBUG(VHOST_CONFIG,
+		"(%"PRIu64") Mem File: %s->%s - Size: %llu - VA: %p\n",
+		dev->device_fh,
+		memfile, resolved_path,
+		(unsigned long long)mem->mapped_size, map);
+
+	return 0;
+}


unix: don't use req->loop in uv__fs_copyfile()

Pass NULL instead of req->loop to the various libuv functions
called from uv__fs_copyfile().

Refs: https://github.com/libuv/libuv/pull/1494
PR-URL: https://github.com/libuv/libuv/pull/1504
Reviewed-By: Ben Noordhuis <59bd0a3ff43b32849b319e645d4798d8a5d1e889@bnoordhuis.nl>

--- src/unix/fs.c
+++ src/unix/fs.c
@@ -793,7 +793,7 @@
   dstfd = -1;

   /* Open the source file. */
-  srcfd = uv_fs_open(req->loop, &fs_req, req->path, O_RDONLY, 0, NULL);
+  srcfd = uv_fs_open(NULL, &fs_req, req->path, O_RDONLY, 0, NULL);
   uv_fs_req_cleanup(&fs_req);

   if (srcfd < 0)
@@ -811,7 +811,7 @@
     dst_flags |= O_EXCL;

   /* Open the destination file. */
-  dstfd = uv_fs_open(req->loop,
+  dstfd = uv_fs_open(NULL,
                      &fs_req,
                      req->new_path,
                      dst_flags,
@@ -824,7 +824,7 @@
     goto out;
   }

-  err = uv_fs_sendfile(req->loop,
+  err = uv_fs_sendfile(NULL,
                        &fs_req,
                        dstfd,
                        srcfd,


bugfix expected difference between hitting 0 and hitting end of unlocks

--- src/unlocks.c
+++ src/unlocks.c
@@ -117,7 +117,10 @@
     }
     if (unlocks_command_index >= 32)
     {
-        unlocks_switch(0, UNLOCKS_LOOP);
+        if (unlocks_index == UNLOCKS_WIN)
+            run_stop(1);
+        else
+            unlocks_switch(0, UNLOCKS_LOOP);
         return;
     }
     uint8_t cmd = unlocks[unlocks_index][unlocks_command_index];
@@ -131,15 +134,11 @@
         case UNLOCKS_BREAK:
             if (param == 0)
             {
-                if (unlocks_index == UNLOCKS_WIN)
-                {
-                    run_stop(1);
-                    break;
-                }
-
-                unlocks_switch(0, UNLOCKS_LOOP);
-            }
-            wait = param;
+                unlocks_command_index = 32;
+                update_index = 0;
+            }
+            else
+                wait = param;
             break;
         case UNLOCKS_GRAVITY:
             gravity = 0.25*param;


update uoj1107

update uoj1107

--- src/uoj1107.c
+++ src/uoj1107.c
@@ -31,7 +31,7 @@

 	for (int j = 0; j < i; ++j)
 	{
-		printf("%s1",data[j]);
+		printf("%s",data[j]);
 		//fputs(data[j],outfile);
 	}
 	fclose(infile);


update uoj8580

update uoj8580

--- src/uoj8580.c
+++ src/uoj8580.c
@@ -1,5 +1,5 @@
-#include <stdio.h>
-#include <malloc.h>
+#include<stdio.h>
+#include<malloc.h>
 #define ERROR 0
 #define OK 1
 #define ElemType int
@@ -11,17 +11,16 @@
  struct LNode *next;
 }LNode,*LinkList;

+
 int CreateLink_L(LinkList &L,int n){
 // 创建含有n个元素的单链表
   LinkList p,q;
   int i;
-   printf("g");
   ElemType e;
   L = (LinkList)malloc(sizeof(LNode));
-  printf("g");
   L->next = NULL;              // 先建立一个带头结点的单链表
+  q = (LinkList)malloc(sizeof(LNode));
   q = L;
-  printf("g");
   for (i=0; i<n; i++) {
 	 scanf("%d", &e);
     p = (LinkList)malloc(sizeof(LNode));
@@ -117,11 +116,11 @@
 {
 	 int n,m;

-	 scanf("%d",n);
+	 scanf("%d",&n);
 	 LinkList A;
 	 CreateLink_L(A,n);
 	 LoadLink_L(A);
-	 scanf("%d",m);
+	 scanf("%d",&m);
 	 LinkList B,C;
 	 CreateLink_L(B,m);
 LoadLink_L(B);


use macro for sha digest length

use macro for sha digest length

--- src/interface/csum/sha1.c
+++ src/interface/csum/sha1.c
@@ -49,5 +49,5 @@
 static int
 mqar_digest_size_sha1()
 {
-    return 20;
+    return SHA_DIGEST_LENGTH;
 }


Using 'override' keyword in dtlstransport.h.
Chromium FYI trybots were complaining about virtual methods not being marked override.

R=henrikg@webrtc.org
TBR=henrikg@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1318983002 .

Cr-Original-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#9799}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 31545685c7ecd8e4cb5f6762904f1f09ff231468

--- p2p/base/dtlstransport.h
+++ p2p/base/dtlstransport.h
@@ -57,14 +57,14 @@
     return true;
   }

-  virtual bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version) {
+  bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version) override {
     DCHECK(Base::worker_thread()->IsCurrent());
     ssl_max_version_ = version;
     return true;
   }

-  virtual bool ApplyLocalTransportDescription_w(TransportChannelImpl* channel,
-                                                std::string* error_desc) {
+  bool ApplyLocalTransportDescription_w(TransportChannelImpl* channel,
+                                        std::string* error_desc) override {
     DCHECK(Base::worker_thread()->IsCurrent());
     rtc::SSLFingerprint* local_fp =
         Base::local_description()->identity_fingerprint.get();
@@ -103,8 +103,8 @@
     return Base::ApplyLocalTransportDescription_w(channel, error_desc);
   }

-  virtual bool NegotiateTransportDescription_w(ContentAction local_role,
-                                               std::string* error_desc) {
+  bool NegotiateTransportDescription_w(ContentAction local_role,
+                                       std::string* error_desc) override {
     DCHECK(Base::worker_thread()->IsCurrent());
     if (!Base::local_description() || !Base::remote_description()) {
       const std::string msg = "Local and Remote description must be set before "
@@ -205,14 +205,14 @@
     return Base::NegotiateTransportDescription_w(local_role, error_desc);
   }

-  virtual DtlsTransportChannelWrapper* CreateTransportChannel(int component) {
+  DtlsTransportChannelWrapper* CreateTransportChannel(int component) override {
     DtlsTransportChannelWrapper* channel = new DtlsTransportChannelWrapper(
         this, Base::CreateTransportChannel(component));
     channel->SetSslMaxProtocolVersion(ssl_max_version_);
     return channel;
   }

-  virtual void DestroyTransportChannel(TransportChannelImpl* channel) {
+  void DestroyTransportChannel(TransportChannelImpl* channel) override {
     // Kind of ugly, but this lets us do the exact inverse of the create.
     DtlsTransportChannelWrapper* dtls_channel =
         static_cast<DtlsTransportChannelWrapper*>(channel);
@@ -221,7 +221,7 @@
     Base::DestroyTransportChannel(base_channel);
   }

-  virtual bool GetSslRole_w(rtc::SSLRole* ssl_role) const {
+  bool GetSslRole_w(rtc::SSLRole* ssl_role) const override {
     DCHECK(Base::worker_thread()->IsCurrent());
     ASSERT(ssl_role != NULL);
     *ssl_role = secure_role_;
@@ -229,9 +229,9 @@
   }

  private:
-  virtual bool ApplyNegotiatedTransportDescription_w(
+  bool ApplyNegotiatedTransportDescription_w(
       TransportChannelImpl* channel,
-      std::string* error_desc) {
+      std::string* error_desc) override {
     DCHECK(Base::worker_thread()->IsCurrent());
     // Set ssl role. Role must be set before fingerprint is applied, which
     // initiates DTLS setup.


fix typo

fix typo

--- src/isomedia/drm_sample.c
+++ src/isomedia/drm_sample.c
@@ -1210,7 +1210,7 @@
 		u8 size = ((*sai)->IV_size != 0) ? (*sai)->IV_size : 8/*default for modern PIFF/CENC with AES-CTR*/;
 		memmove((*sai)->IV, a_sai->IV, size);
 		(*sai)->subsample_count = a_sai->subsample_count;
-		if ((*sai)->subsamples > 0) {
+		if ((*sai)->subsample_count > 0) {
 			(*sai)->subsamples = (GF_CENCSubSampleEntry*)gf_malloc(sizeof(GF_CENCSubSampleEntry)*(*sai)->subsample_count);
 			memmove((*sai)->subsamples, a_sai->subsamples, sizeof(GF_CENCSubSampleEntry)*(*sai)->subsample_count);
 		}


faster C linear blend & interpolate deinterlacers

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

--- libavcodec/libpostproc/postprocess_template.c
+++ libavcodec/libpostproc/postprocess_template.c
@@ -1562,15 +1562,20 @@
 		: "%eax", "%ecx"
 	);
 #else
-	int x;
+	int a, b, x;
 	src+= 4*stride;
-	for(x=0; x<8; x++)
-	{
-		src[stride]   = (src[0]        + src[stride*2])>>1;
-		src[stride*3] = (src[stride*2] + src[stride*4])>>1;
-		src[stride*5] = (src[stride*4] + src[stride*6])>>1;
-		src[stride*7] = (src[stride*6] + src[stride*8])>>1;
-		src++;
+
+	for(x=0; x<2; x++){
+		a= *(uint32_t*)&src[stride*0];
+		b= *(uint32_t*)&src[stride*2];
+		*(uint32_t*)&src[stride*1]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
+		a= *(uint32_t*)&src[stride*4];
+		*(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
+		b= *(uint32_t*)&src[stride*6];
+		*(uint32_t*)&src[stride*5]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
+		a= *(uint32_t*)&src[stride*8];
+		*(uint32_t*)&src[stride*7]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
+		src += 4;
 	}
 #endif
 }
@@ -1875,19 +1880,45 @@
 		: "%eax", "%edx"
 	);
 #else
-	int x;
+	int a, b, c, x;
 	src+= 4*stride;
-	for(x=0; x<8; x++)
-	{
-		src[0       ] = (src[0       ] + 2*src[stride  ] + src[stride*2])>>2;
-		src[stride  ] = (src[stride  ] + 2*src[stride*2] + src[stride*3])>>2;
-		src[stride*2] = (src[stride*2] + 2*src[stride*3] + src[stride*4])>>2;
-		src[stride*3] = (src[stride*3] + 2*src[stride*4] + src[stride*5])>>2;
-		src[stride*4] = (src[stride*4] + 2*src[stride*5] + src[stride*6])>>2;
-		src[stride*5] = (src[stride*5] + 2*src[stride*6] + src[stride*7])>>2;
-		src[stride*6] = (src[stride*6] + 2*src[stride*7] + src[stride*8])>>2;
-		src[stride*7] = (src[stride*7] + 2*src[stride*8] + src[stride*9])>>2;
-		src++;
+
+	for(x=0; x<2; x++){
+		a= *(uint32_t*)&src[stride*0];
+		b= *(uint32_t*)&src[stride*1];
+		c= *(uint32_t*)&src[stride*2];
+		a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
+		*(uint32_t*)&src[stride*0]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
+
+		a= *(uint32_t*)&src[stride*3];
+		b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
+		*(uint32_t*)&src[stride*1]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
+
+		b= *(uint32_t*)&src[stride*4];
+		c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
+		*(uint32_t*)&src[stride*2]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
+
+		c= *(uint32_t*)&src[stride*5];
+		a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
+		*(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
+
+		a= *(uint32_t*)&src[stride*6];
+		b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
+		*(uint32_t*)&src[stride*4]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
+
+		b= *(uint32_t*)&src[stride*7];
+		c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
+		*(uint32_t*)&src[stride*5]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
+
+		c= *(uint32_t*)&src[stride*8];
+		a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
+		*(uint32_t*)&src[stride*6]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
+
+		a= *(uint32_t*)&src[stride*9];
+		b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
+		*(uint32_t*)&src[stride*7]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
+
+		src += 4;
 	}
 #endif
 }


libc: Fix common-generic stat.h for BE

libc: Fix common-generic stat.h for BE

Signed-off-by: Mischa Jonker <17dd7bf52eefcca323aba1679f480e7f18d70ddd@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <ce1ac9e9ad16abccd7821f371ad381197b4768ac@gmail.com>

--- libc/sysdeps/linux/common-generic/bits/stat.h
+++ libc/sysdeps/linux/common-generic/bits/stat.h
@@ -59,7 +59,7 @@
     unsigned int st_uid;			/* User ID of the file's owner.	*/
     unsigned int st_gid;			/* Group ID of the file's group.*/
     unsigned long __pad3;
-    unsigned long st_rdev			/* Device number, if device.  */
+    unsigned long st_rdev;			/* Device number, if device.  */
     unsigned long long __pad4;
     long __pad5;
     long st_size;				/* Size of file, in bytes. */


Fix: add QVector to includes

Fix: add QVector to includes


unix: uv_read_start should fail if UV_CLOSING set

--- src/uv-unix.c
+++ src/uv-unix.c
@@ -1255,6 +1255,11 @@
 int uv_read_start(uv_stream_t* stream, uv_alloc_cb alloc_cb, uv_read_cb read_cb) {
   assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE);

+  if (stream->flags & UV_CLOSING) {
+    uv_err_new((uv_handle_t*)stream, EINVAL);
+    return -1;
+  }
+
   /* The UV_READING flag is irrelevant of the state of the tcp - it just
    * expresses the desired state of the user.
    */


v1.1 add -v to dhclient parameter arguments

This patch improves the ability to understand what is happening
with dchlient and is obviously optional.

--- libvirt-sandbox/libvirt-sandbox-init-common.c
+++ libvirt-sandbox/libvirt-sandbox-init-common.c
@@ -111,7 +111,7 @@

 static gboolean start_dhcp(const gchar *devname, GError **error)
 {
-    const gchar *argv[] = { "/sbin/dhclient", "--no-pid", devname, NULL };
+    const gchar *argv[] = { "/sbin/dhclient", "-v", "--no-pid", devname, NULL };
     gboolean ret;
     sigset_t newset;
     sigset_t oldset;


Printing out a prompt

Printing out a prompt

--- test-parser.c
+++ test-parser.c
@@ -26,7 +26,6 @@
     if (atom_eval(sexp, root_env, &result, error) == 0)
     {
 	elvin_error_fprintf(stderr, error);
-	return 1;
     }
     else
     {
@@ -34,8 +33,14 @@
 	atom_print(result); printf("\n");

 	/* Free it */
-	return atom_free(result, error);
+	if (atom_free(result, error) == 0)
+	{
+	    return 0;
+	}
     }
+
+    printf("> "); fflush(stdout);
+    return 1;
 }

 /* Parse a file */
@@ -99,6 +104,9 @@
     /* If we have no args, then read from stdin */
     if (argc < 2)
     {
+	/* Print the prompt */
+	printf("> "); fflush(stdout);
+
 	if (! parse_file(parser, STDIN_FILENO, "[stdin]", error))
 	{
 	    fprintf(stderr, "parse_file(): failed\n");


Using KSI_snprintf instead of snprintf.

Using KSI_snprintf instead of snprintf.

--- src/ksi/multi_signature.c
+++ src/ksi/multi_signature.c
@@ -1865,7 +1865,7 @@

 	fd = fopen(fileName, "rb");
 	if (fd == NULL) {
-		snprintf(buf, sizeof(buf), "Unable to open file '%s'", fileName);
+		KSI_snprintf(buf, sizeof(buf), "Unable to open file '%s'", fileName);
 		KSI_pushError(ctx, res = KSI_IO_ERROR, buf);
 		goto cleanup;
 	}


Fixed a bug with all synchronous palette fading methods (regression)

--- src/vdp_pal.c
+++ src/vdp_pal.c
@@ -5,6 +5,7 @@
 #include "vdp_pal.h"

 #include "sys.h"
+#include "timer.h"

 #define PALETTEFADE_FRACBITS    8
@@ -188,6 +189,7 @@
 static u16 fading_from;
 static u16 fading_to;
 static s16 fading_cnt;
+static u32 last_vtimer = 0;

 // forward
@@ -243,9 +245,9 @@

     if (!inVInt)
     {
-        // wait for VSync if not already in blank
-        if (!GET_VDPSTATUS(VDP_VBLANK_FLAG))
-            VDP_waitVSync();
+        // wait for VSync if not already in blank and be sure to wait at least 1 frame between fade palette call
+        if (!GET_VDPSTATUS(VDP_VBLANK_FLAG) || (last_vtimer == vtimer))
+            VDP_waitVInt();
         // disable interrupts to not conflict with VInt accesses
         SYS_disableInts();
     }
@@ -280,10 +282,14 @@
     }

     if (!inVInt)
+    {
         SYS_enableInts();
-}
-
-u16 VDP_doFadingStep()
+        // keep track of last update
+        last_vtimer = vtimer;
+    }
+}
+
+bool VDP_doFadingStep()
 {
     // last step --> just recopy the final palette
     if (--fading_cnt <= 0)
@@ -293,17 +299,19 @@
             VDP_setPaletteColors(fading_from, (u16*) final_pal + fading_from, (fading_to - fading_from) + 1);
         else
         {
-            // wait for VSync if not already in blank
-            if (!GET_VDPSTATUS(VDP_VBLANK_FLAG))
-                VDP_waitVSync();
+            // wait for VSync if not already in blank and be sure to wait at least 1 frame between fade palette call
+            if (!GET_VDPSTATUS(VDP_VBLANK_FLAG) || (last_vtimer == vtimer))
+                VDP_waitVInt();
             // disable interrupts to not conflict with VInt accesses
             SYS_disableInts();
             // ans set the palette
             VDP_setPaletteColors(fading_from, (u16*) final_pal + fading_from, (fading_to - fading_from) + 1);
             SYS_enableInts();
+            // keep track of last update
+            last_vtimer = vtimer;
         }

-        return 0;
+        return FALSE;
     }

     s16 *palR;
@@ -335,10 +343,10 @@
     setFadePalette();

 //    if (--fading_cnt <= 0) return 0;
-    return 1;
-}
-
-u16 VDP_initFading(u16 fromcol, u16 tocol, const u16 *palsrc, const u16 *paldst, u16 numframe)
+    return TRUE;
+}
+
+bool VDP_initFading(u16 fromcol, u16 tocol, const u16 *palsrc, const u16 *paldst, u16 numframe)
 {
     const u16 *src;
     const u16 *dst;
@@ -352,7 +360,7 @@
     u16 i;

     // can't do a fade on 0 frame !
-    if (numframe == 0) return 0;
+    if (numframe == 0) return FALSE;

     fading_from = fromcol;
     fading_to = tocol;
@@ -393,7 +401,7 @@
     // set current fade palette
     setFadePalette();

-    return 1;
+    return TRUE;
 }


Bump PROTOCOL_VERSION to 60001, thereby enabling BIP31

--- src/version.h
+++ src/version.h
@@ -29,7 +29,7 @@
 // network protocol versioning
 //

-static const int PROTOCOL_VERSION = 60000;
+static const int PROTOCOL_VERSION = 60001;

 // earlier versions not supported as of Feb 2012, and are disconnected
 static const int MIN_PROTO_VERSION = 209;


Notching back min proto version.

Notching back min proto version.

Risk for sync issues, will need to update later.

--- src/version.h
+++ src/version.h
@@ -32,7 +32,7 @@
 static const int INIT_PROTO_VERSION = 209;

 // disconnect from peers older than this proto version
-static const int MIN_PEER_PROTO_VERSION = 70002;
+static const int MIN_PEER_PROTO_VERSION = 70001;

 // nTime field added to CAddress, starting with this version;
 // if possible, avoid requesting addresses nodes older than this


version 1.1.4.5

version 1.1.4.5

--- src/version.h
+++ src/version.h
@@ -46,7 +46,7 @@

 #define DISPLAY_VERSION_MAJOR       1
 #define DISPLAY_VERSION_MINOR       1
-#define DISPLAY_VERSION_REVISION    4
+#define DISPLAY_VERSION_REVISION    5
 #define DISPLAY_VERSION_BUILD       1

 #endif


Update version to 2.0.5.3

Update version to 2.0.5.3

--- src/version.h
+++ src/version.h
@@ -48,6 +48,6 @@
 #define DISPLAY_VERSION_MAJOR       2
 #define DISPLAY_VERSION_MINOR       0
 #define DISPLAY_VERSION_REVISION    5
-#define DISPLAY_VERSION_BUILD       2
+#define DISPLAY_VERSION_BUILD       3

 #endif


increase version number

increase version number

--- src/version.h
+++ src/version.h
@@ -11,7 +11,7 @@
 #endif /* OPENUDC */
 #endif /* SOFTWARE_NAME */

-#define SOFTWARE_VERSION "0.3.1 06Jan2014"
+#define SOFTWARE_VERSION "0.3.2 13Jan2014"
 #define SOFTWARE_ADDRESS "http://openudc.org/"

 #endif /* _VERSION_H_ */


imap_match(): "foo/bar/%" pattern matching to "foo/" should return CHILDREN
instead of NO.

--HG--
branch : HEAD

--- src/lib-imap/imap-match.c
+++ src/lib-imap/imap-match.c
@@ -185,16 +185,27 @@
 	  const char **pattern_p)
 {
 	enum imap_match_result ret, match;
+	unsigned int i;
 	const char *data = *data_p, *pattern = *pattern_p;

 	/* match all non-wildcards */
-	while (*pattern != '\0' && *pattern != '*' && *pattern != '%') {
-		if (!CMP_CUR_CHR(ctx, data, pattern)) {
-			return *data == '\0' && *pattern == ctx->sep ?
-				IMAP_MATCH_CHILDREN : IMAP_MATCH_NO;
-		}
-		data++; pattern++;
-	}
+	i = 0;
+	while (pattern[i] != '\0' && pattern[i] != '*' && pattern[i] != '%') {
+		if (!CMP_CUR_CHR(ctx, data+i, pattern+i)) {
+			if (data[i] != '\0')
+				return IMAP_MATCH_NO;
+			if (pattern[i] == ctx->sep)
+				return IMAP_MATCH_CHILDREN;
+			if (i > 0 && pattern[i-1] == ctx->sep) {
+				/* data="foo/" pattern = "foo/bar/%" */
+				return IMAP_MATCH_CHILDREN;
+			}
+			return IMAP_MATCH_NO;
+		}
+		i++;
+	}
+	data += i;
+	pattern += i;

         match = IMAP_MATCH_NO;
 	while (*pattern == '%') {


Brain fart--

Brain fart--

git-svn-id: 70cf712206e5b8426a8d7451e052914a94f8fa22@20513 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/lib/ecore/ecore_exe.c
+++ src/lib/ecore/ecore_exe.c
@@ -1381,7 +1381,7 @@
    int count;

    /* check whether we need to write anything at all. */
-   if ((!exe->child_fd_write != -1) && (!exe->write_data_buf))   return;
+   if ((exe->child_fd_write == -1) || (!exe->write_data_buf))   return;
    if (exe->write_data_size == exe->write_data_offset)     return;

    count = write(exe->child_fd_write,


Keep track of max handlers_num using the handlers_num, not LASTEvent

SVN revision: 21101

--- src/lib/ecore_x/ecore_x.c
+++ src/lib/ecore_x/ecore_x.c
@@ -170,18 +170,19 @@
    if (!_ecore_x_disp) return 0;
    _ecore_x_error_handler_init();
    _ecore_x_event_handlers_num = LASTEvent;
-
+
    if (XShapeQueryExtension(_ecore_x_disp, &shape_base, &shape_err_base))
      _ecore_x_event_shape_id = shape_base + ShapeNotify;
-   if (_ecore_x_event_shape_id >= LASTEvent)
+   if (_ecore_x_event_shape_id >= _ecore_x_event_handlers_num)
      _ecore_x_event_handlers_num = _ecore_x_event_shape_id + 1;
+
 #ifdef ECORE_XSS
    if (XScreenSaverQueryExtension(_ecore_x_disp, &screensaver_base, &screensaver_err_base))
      _ecore_x_event_screensaver_id = screensaver_base + ScreenSaverNotify;
 #endif
-   if (_ecore_x_event_screensaver_id >= LASTEvent)
+   if (_ecore_x_event_screensaver_id >= _ecore_x_event_handlers_num)
      _ecore_x_event_handlers_num = _ecore_x_event_screensaver_id + 1;
-
+
    if (XSyncQueryExtension(_ecore_x_disp, &sync_base, &sync_err_base))
      {
 	int major, minor;
@@ -190,13 +191,13 @@
 	if (!XSyncInitialize(_ecore_x_disp, &major, &minor))
 	  _ecore_x_event_sync_id = 0;
      }
-   if (_ecore_x_event_sync_id + XSyncAlarmNotify >= LASTEvent)
+   if (_ecore_x_event_sync_id + XSyncAlarmNotify >= _ecore_x_event_handlers_num)
      _ecore_x_event_handlers_num = _ecore_x_event_sync_id + XSyncAlarmNotify + 1;
-
+
 #ifdef ECORE_XRANDR
    if (XRRQueryExtension(_ecore_x_disp, &randr_base, &randr_err_base))
      _ecore_x_event_randr_id = randr_base + RRScreenChangeNotify;
-   if (_ecore_x_event_randr_id >= LASTEvent)
+   if (_ecore_x_event_randr_id >= _ecore_x_event_handlers_num)
      _ecore_x_event_handlers_num = _ecore_x_event_randr_id + 1;
 #endif


Hide cli peer command port option

Hide cli peer command port option

Signed-off-by: shishir gowda <shishirng@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

BUG: 1261 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1261

--- cli/src/cli-cmd-peer.c
+++ cli/src/cli-cmd-peer.c
@@ -40,19 +40,19 @@
 void
 cli_cmd_probe_usage ()
 {
-        cli_out ("Usage: probe <hostname> [port]");
+        cli_out ("Usage: probe <hostname>");
 }

 void
 cli_cmd_deprobe_usage ()
 {
-        cli_out ("Usage: detach <hostname> [port]");
+        cli_out ("Usage: detach <hostname>");
 }

 void
 cli_cmd_peer_status_usage ()
 {
-        cli_out ("Usage: peer status <hostname> [port]");
+        cli_out ("Usage: peer status");
 }

 int
@@ -64,7 +64,7 @@
         call_frame_t            *frame = NULL;
         dict_t                  *dict = NULL;

-        if (!((wordcount == 4) || (wordcount == 3))) {
+        if (!(wordcount == 3)) {
                 cli_cmd_probe_usage ();
                 goto out;
         }
@@ -83,12 +83,12 @@
         if (ret)
                 goto out;

-        if (words[3]) {
+/*        if (words[3]) {
                 ret = dict_set_str (dict, "port", (char *)words[3]);
                 if (ret)
                         goto out;
         }
-
+*/
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, dict);
         }
@@ -109,7 +109,7 @@
         call_frame_t         *frame = NULL;
         dict_t               *dict  = NULL;

-        if (!((wordcount == 3) || (wordcount == 4))) {
+        if (!(wordcount == 3) ) {
                 cli_cmd_deprobe_usage ();
                 goto out;
         }
@@ -126,12 +126,12 @@
         if (ret)
                 goto out;

-        if (words[3]) {
+/*        if (words[3]) {
                 ret = dict_set_str (dict, "port", (char *)words[3]);
                 if (ret)
                         goto out;
         }
-
+*/
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, dict);
         }
@@ -173,7 +173,7 @@
 }

 struct cli_cmd cli_probe_cmds[] = {
-        { "peer probe <HOSTNAME> [PORT]",
+        { "peer probe <HOSTNAME>",
           cli_cmd_peer_probe_cbk,
           "probe peer specified by <HOSTNAME>"},


FreeBSD NFS workarounds: We called fchown() with random UID. It shouldn't have really mattered though, because the call failed always anyway.

--- src/lib/nfs-workarounds.c
+++ src/lib/nfs-workarounds.c
@@ -195,6 +195,8 @@
 		return TRUE;
 	}
 	uid = st.st_uid;
+#else
+	uid = (uid_t)-1;
 #endif
 	if (fchown(fd, uid, (gid_t)-1) < 0) {
 		if (errno == ESTALE)


Added missing test-hex-binary.c from earlier commit.

error: pathspec 'src/lib/test-hex-binary.c' did not match any file(s) known to git

--- src/lib/test-hex-binary.c
+++ src/lib/test-hex-binary.c
@@ -0,0 +1,61 @@
+/* Copyright (c) 2009 Dovecot authors, see the included COPYING file */
+
+#include "test-lib.h"
+#include "buffer.h"
+#include "str.h"
+#include "hex-binary.h"
+
+static void test_binary_to_hex(void)
+{
+	static unsigned char input[] = { 0xff, 0x00, 0x01, 0xb3 };
+	static char *output_lcase = "ff0001b3";
+	static char *output_ucase = "FF0001B3";
+	string_t *str;
+
+	test_begin("binary to hex");
+	test_assert(strcmp(binary_to_hex(input, sizeof(input)), output_lcase) == 0);
+	test_end();
+
+	test_begin("binary to hex ucase");
+	test_assert(strcmp(binary_to_hex_ucase(input, sizeof(input)), output_ucase) == 0);
+	test_end();
+
+	test_begin("binary to hex ucase");
+	str = t_str_new(32);
+	str_append_c(str, '<');
+	binary_to_hex_append(str, input, sizeof(input));
+	str_append_c(str, '>');
+	test_assert(strcmp(str_c(str), t_strconcat("<", output_lcase, ">", NULL)) == 0);
+	test_end();
+}
+
+static void test_hex_to_binary(void)
+{
+	static const char *ok_input = "0001fEFf";
+	static unsigned char ok_output[] = { 0x00, 0x01, 0xfe, 0xff };
+	static const char *error_input[] = {
+		"00 01",
+		"0x01",
+		"0g"
+	};
+	buffer_t *buf = buffer_create_dynamic(pool_datastack_create(), 10);
+	unsigned int i;
+
+	test_begin("hex to binary");
+	test_assert(hex_to_binary("", buf) == 0);
+	test_assert(buf->used == 0);
+
+	test_assert(hex_to_binary(ok_input, buf) == 0);
+	test_assert(buf->used == N_ELEMENTS(ok_output));
+	test_assert(memcmp(buf->data, ok_output, buf->used) == 0);
+
+	for (i = 0; i < N_ELEMENTS(error_input); i++)
+		test_assert(hex_to_binary(error_input[i], buf) == -1);
+	test_end();
+}
+
+void test_hex_binary(void)
+{
+	test_binary_to_hex();
+	test_hex_to_binary();
+}


Make libguess_validate_utf8() available.

--- src/libguess/guess_impl.c
+++ src/libguess/guess_impl.c
@@ -58,7 +58,7 @@
 /* include DFA table generated by guess.scm */
 #include "guess_tab.c"

-int dfa_validate_utf8(const char *buf, int buflen)
+int libguess_validate_utf8(const char *buf, int buflen)
 {
     int i;
     guess_dfa utf8 = DFA_INIT(guess_utf8_st, guess_utf8_ar, "UTF-8");


fix(library/blast/state): bad style warnings

--- src/library/blast/state.h
+++ src/library/blast/state.h
@@ -251,7 +251,7 @@
     hypothesis const * get_hypothesis_decl(expr const & h) const { return get_hypothesis_decl(href_index(h)); }

     void for_each_hypothesis(std::function<void(hypothesis_idx, hypothesis const &)> const & fn) const { m_branch.m_hyp_decls.for_each(fn); }
-    optional<unsigned> find_active_hypothesis(std::function<bool(hypothesis_idx, hypothesis const &)> const & fn) const { // NOLINT
+    optional<hypothesis_idx> find_active_hypothesis(std::function<bool(hypothesis_idx, hypothesis const &)> const & fn) const { // NOLINT
         return m_branch.m_active.find_if([&](hypothesis_idx hidx) {
                 return fn(hidx, *get_hypothesis_decl(hidx));
             });


Add support for pere file logs in lio_inspect

--- src/lio/bin/lio_inspect.c
+++ src/lio/bin/lio_inspect.c
@@ -42,6 +42,7 @@
 #include <tbx/iniparse.h>
 #include <tbx/list.h>
 #include <tbx/log.h>
+#include <tbx/type_malloc.h>
 #include <tbx/stack.h>
 #include <tbx/stdinarray_iter.h>
 #include <tbx/string_token.h>
@@ -73,6 +74,7 @@

 typedef struct {
     char *name;
+    char *log;
     double delta;
     double tolerance;
     int delta_mode;
@@ -89,6 +91,8 @@
     char *set_key;
     char *set_success;
     char *set_fail;
+    char *log_name;
+    int  id;
     int  get_exnode;
     int  set_success_size;
     int  set_fail_size;
@@ -735,6 +739,8 @@
 gop_op_status_t inspect_task(void *arg, int id)
 {
     inspect_t *w = (inspect_t *)arg;
+    tbx_log_fd_t  *lfd;
+    FILE *fd;
     gop_op_status_t status;
     gop_op_generic_t *gop;
     lio_exnode_t *ex;
@@ -743,17 +749,32 @@
     char *keys[7];
     char *val[7];
     char buf[32], ebuf[128];
-    char *dsegid, *ptr, *exnode2;
+    char *dsegid, *ptr, *exnode2, *msg;
     lio_segment_errors_t serr;
     int v_size[7], n, repair_mode;
     int whattodo, count, err;
     tbx_inip_file_t *ifd;
     lio_inspect_args_t args;

+    msg ="";
     whattodo = global_whattodo;
     keys[6] = NULL;

     log_printf(15, "inspecting fname=%s global_whattodo=%d\n", w->fname, global_whattodo);
+
+    if (w->log_name) {  //** Using individual log files
+        fd = fopen(w->log_name, "w+");
+        if (fd == NULL) {
+            info_printf(lio_ifd, 0, "ERROR: Unable to open log file: %s\n", w->log_name);
+            log_printf(0, "ERROR: Unable to open log file: %s\n", w->log_name);
+            return(gop_failure_status);
+        }
+
+        lfd = tbx_info_create(fd, INFO_HEADER_NONE, 20);
+    } else {
+        lfd = lio_ifd;
+        fd = NULL;
+    }

     if (w->get_exnode == 1) {
         count = - lio_gc->max_attr;
@@ -761,9 +782,9 @@
     }

     if (w->exnode == NULL) {
-        info_printf(lio_ifd, 0, "ERROR  Failed with file %s (ftype=%d). No exnode!\n", w->fname, w->ftype);
-        free(w->fname);
-        return(gop_failure_status);
+        msg = " No exnode!";
+        status = gop_failure_status;
+        goto fini_1;
     }

     //** Kind of kludgy to load the ex twice but this is more of a prototype fn
@@ -771,10 +792,10 @@
     dsegid = tbx_inip_get_string(ifd, "view", "default", NULL);
     tbx_inip_destroy(ifd);
     if (dsegid == NULL) {
-        info_printf(lio_ifd, 0, "ERROR  Failed with file %s (ftype=%d). No default segment!\n", w->fname, w->ftype);
+        msg = "No default segment!";
         free(w->exnode);
-        free(w->fname);
-        return(gop_failure_status);
+        status = gop_failure_status;
+        goto fini_1;
     }

     apr_thread_mutex_lock(lock);
@@ -785,11 +806,11 @@
     tbx_log_flush();
     if (ptr != NULL) {
         apr_thread_mutex_unlock(lock);
-        info_printf(lio_ifd, 0, "Skipping file %s (ftype=%d). Already loaded/processed.\n", w->fname, w->ftype);
+        info_printf(lfd, 0, "Skipping file %s (ftype=%d). Already loaded/processed.\n", w->fname, w->ftype);
         free(dsegid);
         free(w->exnode);
-        free(w->fname);
-        return(gop_success_status);
+        status = gop_failure_status;
+        goto fini_1;
     }
     tbx_list_insert(seg_index, dsegid, dsegid);
     apr_thread_mutex_unlock(lock);
@@ -799,7 +820,7 @@
     exp = lio_lio_exnode_exchange_text_parse(w->exnode);
     ex = lio_exnode_create();
     if (lio_exnode_deserialize(ex, exp, lio_gc->ess) != 0) {
-        info_printf(lio_ifd, 0, "ERROR  Failed with file %s (ftype=%d). Problem parsing exnode!\n", w->fname, w->ftype);
+        info_printf(lfd, 0, "ERROR  Failed with file %s (ftype=%d). Problem parsing exnode!\n", w->fname, w->ftype);
         status = gop_failure_status;
         goto finished;
     }
@@ -812,12 +833,12 @@
     //** Get the default view to use
     seg = lio_exnode_default_get(ex);
     if (seg == NULL) {
-        info_printf(lio_ifd, 0, "ERROR  Failed with file %s (ftype=%d). No default segment!\n", w->fname, w->ftype);
+        info_printf(lfd, 0, "ERROR  Failed with file %s (ftype=%d). No default segment!\n", w->fname, w->ftype);
         status = gop_failure_status;
         goto finished;
     }

-    info_printf(lio_ifd, 1, XIDT ": Inspecting file %s\n", segment_id(seg), w->fname);
+    info_printf(lfd, 1, XIDT ": Inspecting file %s\n", segment_id(seg), w->fname);

     log_printf(15, "whattodo=%d\n", whattodo);
     //** Execute the inspection operation
@@ -827,10 +848,11 @@
     args.query = query;
     args.qs = gop_opque_new();
     args.qf = gop_opque_new();
-    gop = segment_inspect(seg, lio_gc->da, lio_ifd, whattodo, bufsize, &args, lio_gc->timeout);
+    gop = segment_inspect(seg, lio_gc->da, lfd, whattodo, bufsize, &args, lio_gc->timeout);
     if (gop == NULL) {
         printf("File not found.\n");
-        return(gop_failure_status);
+        status = gop_failure_status;
+        goto finished;
     }

     log_printf(15, "fname=%s inspect_gid=%d whattodo=%d bufsize=" XOT "\n", w->fname, gop_id(gop), whattodo, bufsize);
@@ -852,24 +874,6 @@
     case (INSPECT_SCAN_REPAIR):
     case (INSPECT_FULL_REPAIR):
         repair_mode= 1;
-    case (INSPECT_QUICK_CHECK):
-    case (INSPECT_SCAN_CHECK):
-    case (INSPECT_FULL_CHECK):
-    case (INSPECT_MIGRATE):
-        if (status.op_status == OP_STATE_SUCCESS) {
-            info_printf(lio_ifd, 0, "Success with file %s\n", w->fname);
-        } else {
-            info_printf(lio_ifd, 0, "ERROR: Failed with file %s  status=%d error_code=%d\n", w->fname, status.op_status, status.error_code);
-        }
-        break;
-    case (INSPECT_SOFT_ERRORS):
-    case (INSPECT_HARD_ERRORS):
-        if (status.op_status == OP_STATE_SUCCESS) {
-            info_printf(lio_ifd, 0, "Success with file %s\n", w->fname);
-        } else {
-            info_printf(lio_ifd, 0, "ERROR  Failed with file %s  status=%d error_code=%d\n", w->fname, status.op_status, status.error_code);
-        }
-        break;
     }

     //** NOTE:  if status.error_code & INSPECT_RESULT_FULL_CHECK that means the underlying segment inspect did a full byte level check.
@@ -904,7 +908,7 @@
                 count = strcmp(exnode2, exp->text.text);
                 free(exnode2);
                 if (count != 0) {
-                    info_printf(lio_ifd, 0, "WARN Exnode changed during inspection for file %s (ftype=%d). Aborting exnode update\n", w->fname, w->ftype);
+                    info_printf(lfd, 0, "WARN Exnode changed during inspection for file %s (ftype=%d). Aborting exnode update\n", w->fname, w->ftype);
                 } else {
                     val[n] = exp_out->text.text;
                     v_size[n]= strlen(val[n]);
@@ -964,7 +968,7 @@
                     count = strcmp(exnode2, exp->text.text);
                     free(exnode2);
                     if (count != 0) {
-                        info_printf(lio_ifd, 0, "WARN Exnode changed during inspection for file %s (ftype=%d). Aborting exnode update\n", w->fname, w->ftype);
+                        info_printf(lfd, 0, "WARN Exnode changed during inspection for file %s (ftype=%d). Aborting exnode update\n", w->fname, w->ftype);
                     } else {
                         val[n] = exp_out->text.text;
                         v_size[n]= strlen(val[n]);
@@ -1009,7 +1013,29 @@

     lio_exnode_destroy(ex);

+fini_1:
+
+    if (fd) {
+        snprintf(ebuf, sizeof(ebuf), "[%d] ", w->id);
+    } else {
+        ebuf[0] = 0;
+    }
+
+    if (status.op_status == OP_STATE_SUCCESS) {
+        info_printf(lfd, 0, "%sSuccess with file %s\n", ebuf, w->fname);
+        if (fd) info_printf(lio_ifd, 0, "%sSuccess with file %s\n", ebuf, w->fname);
+    } else {
+        info_printf(lfd, 0, "%sERROR: Failed with file %s status=%d error_code=%d%s\n", ebuf, w->fname, status.op_status, status.error_code, msg);
+        if (fd) info_printf(lio_ifd, 0, "%sERROR: Failed with file %s status=%d error_code=%d%s\n", ebuf, w->fname, status.op_status, status.error_code, msg);
+    }
+
     free(w->fname);
+
+    if (fd) {
+        tbx_info_destroy(lfd);
+        fclose(fd);
+        free(w->log_name);
+    }

     return(status);
 }
@@ -1019,10 +1045,10 @@

 int main(int argc, char **argv)
 {
-    int i, j,  start_option, rg_mode, ftype, prefix_len, err;
+    int i, j,  start_option, rg_mode, ftype, prefix_len, err, log_prefix_len;
     int force_repair, option;
     char ppbuf[32];
-    char *fname, *qstr, *path, *pool_cfg;
+    char *fname, *qstr, *path, *pool_cfg, *logname, *log_prefix;
     rs_query_t *rsq;
     apr_pool_t *mpool;
     gop_opque_t *q;
@@ -1053,6 +1079,8 @@
     check_iter = 100;
     todo_mode = 0;
     select_mode = INT_MIN;
+    log_prefix = NULL;  //** Disable individual logs by default
+    log_prefix_len = 0;

     if (argc < 2) {
         printf("\n");
@@ -1061,6 +1089,9 @@
         lio_print_options(stdout);
         lio_print_path_options(stdout);
         printf("    -rd recurse_depth  - Max recursion depth on directories. Defaults to %d\n", recurse_depth);
+        printf("    -1 log_prefix      - Have information logs for each file.\n");
+        printf("                         The log naming convention used will be ${log_prefix}.N where N corresponds\n");
+        printf("                         to the index provided in the Success/Failure line printed to the global information log.\n");
         printf("    -b bufsize         - Buffer size to use for *each* inspect. Units supported (Default=%s)\n", tbx_stk_pretty_print_int_with_scale(bufsize, ppbuf));
         printf("    -s                 - Report soft errors, like a missing RID in the config file but the allocation is good.\n");
         printf("                         The default is to ignore these type of errors.\n");
@@ -1137,6 +1168,11 @@
             i++;
             recurse_depth = atoi(argv[i]);
             i++;
+        } else if (strcmp(argv[i], "-1") == 0) {  //** Enable individual log files
+            i++;
+            log_prefix = argv[i];
+            log_prefix_len = strlen(log_prefix);
+            i++;
         } else if (strcmp(argv[i], "-b") == 0) {  //** Get the buffer size
             i++;
             bufsize = tbx_stk_string_get_integer(argv[i]);
@@ -1477,6 +1513,15 @@
                 w[slot].set_fail = set_fail;
                 w[slot].set_fail_size = set_fail_size;

+                if (log_prefix != NULL) {
+                    tbx_type_malloc(logname, char, log_prefix_len + 20);
+                    snprintf(logname, log_prefix_len + 20, "%s." XOT, log_prefix, iter);
+                    w[slot].id = iter;
+                    w[slot].log_name = logname;
+                } else {
+                    w[slot].log_name = NULL;
+                }
+
                 vals[0] = NULL;
                 fname = NULL;


Lock for writing properly in watcher

Lock for writing properly in watcher

--- src/watcher.c
+++ src/watcher.c
@@ -27,6 +27,18 @@
 	int rc = pthread_rwlock_rdlock(l);
 	if (rc != 0) {
 		pgr_logf(stderr, LOG_ERR, "[watcher] failed to acquire %s/%d read lock: %s (errno %d)",
+				what, idx, strerror(rc), rc);
+		return rc;
+	}
+	return 0;
+}
+
+static int wrlock(pthread_rwlock_t *l, const char *what, int idx)
+{
+	pgr_logf(stderr, LOG_DEBUG, "[watcher] acquiring %s/%d write lock %p", what, idx, l);
+	int rc = pthread_rwlock_wrlock(l);
+	if (rc != 0) {
+		pgr_logf(stderr, LOG_ERR, "[watcher] failed to acquire %s/%d write lock: %s (errno %d)",
 				what, idx, strerror(rc), rc);
 		return rc;
 	}
@@ -200,7 +212,7 @@
 		}

 		/* now, loop over the backends and update them with our findings */
-		*rc = rdlock(&c->lock, "context", 0);
+		*rc = wrlock(&c->lock, "context", 0);
 		if (*rc != 0) {
 			return (void*)rc;
 		}
@@ -219,7 +231,7 @@
 		}

 		for (i = 0; i < NUM_BACKENDS; i++) {
-			*rc = rdlock(&c->backends[i].lock, "backend", i);
+			*rc = wrlock(&c->backends[i].lock, "backend", i);
 			if (*rc != 0) {
 				unlock(&c->lock, "context", 0);
 				return (void*)rc;


buffer.h: Only allow Init() to be called once.

Change-Id: I041c8b6f314802833c5287a176dbfeec9461b08e

--- test/buffer.h
+++ test/buffer.h
@@ -95,6 +95,7 @@
   bool CheckValues(const Buffer<T> &a) const;

   bool Init() {
+    if (raw_buffer_ != NULL) return false;
     EXPECT_GT(width_, 0);
     EXPECT_GT(height_, 0);
     EXPECT_GE(top_padding_, 0);


win,tty: improve SIGWINCH support

win,tty: improve SIGWINCH support

Add SetWinEventHook for EVENT_CONSOLE_LAYOUT for better detection of
console resize events.

Ref: https://github.com/nodejs/node/issues/13197
PR-URL: https://github.com/libuv/libuv/pull/1408
Reviewed-By: Saúl Ibarra Corretgé <8a7991f6950ea189abf159d6ec98d2fcc13dc5f6@gmail.com>

--- src/win/tty.c
+++ src/win/tty.c
@@ -112,13 +112,29 @@
 static int uv_tty_virtual_height = -1;
 static int uv_tty_virtual_width = -1;

+/* The console window size
+ * We keep this separate from uv_tty_virtual_*. We use those values to only
+ * handle signalling SIGWINCH
+ */
+
+static HANDLE uv__tty_console_handle = INVALID_HANDLE_VALUE;
+static int uv__tty_console_height = -1;
+static int uv__tty_console_width = -1;
+
+static DWORD WINAPI uv__tty_console_resize_message_loop_thread(void* param);
+static void CALLBACK uv__tty_console_resize_event(HWINEVENTHOOK hWinEventHook,
+                                                  DWORD event,
+                                                  HWND hwnd,
+                                                  LONG idObject,
+                                                  LONG idChild,
+                                                  DWORD dwEventThread,
+                                                  DWORD dwmsEventTime);
+
 /* We use a semaphore rather than a mutex or critical section because in some
    cases (uv__cancel_read_console) we need take the lock in the main thread and
    release it in another thread. Using a semaphore ensures that in such
    scenario the main thread will still block when trying to acquire the lock. */
 static uv_sem_t uv_tty_output_lock;
-
-static HANDLE uv_tty_output_handle = INVALID_HANDLE_VALUE;

 static WORD uv_tty_default_text_attributes =
     FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
@@ -141,6 +157,18 @@
 void uv_console_init(void) {
   if (uv_sem_init(&uv_tty_output_lock, 1))
     abort();
+  uv__tty_console_handle = CreateFileW(L"CONOUT$",
+                                       GENERIC_READ | GENERIC_WRITE,
+                                       FILE_SHARE_WRITE,
+                                       0,
+                                       OPEN_EXISTING,
+                                       0,
+                                       0);
+  if (uv__tty_console_handle != NULL) {
+    QueueUserWorkItem(uv__tty_console_resize_message_loop_thread,
+                      NULL,
+                      WT_EXECUTELONGFUNCTION);
+  }
 }

@@ -183,11 +211,6 @@

     if (uv__vterm_state == UV_UNCHECKED)
       uv__determine_vterm_state(handle);
-
-    /* Store the global tty output handle. This handle is used by TTY read */
-    /* streams to update the virtual window when a CONSOLE_BUFFER_SIZE_EVENT */
-    /* is received. */
-    uv_tty_output_handle = handle;

     /* Remember the original console text attributes. */
     uv_tty_capture_initial_style(&screen_buffer_info);
@@ -705,25 +728,7 @@
       }
       records_left--;

-      /* If the window was resized, recompute the virtual window size. This */
-      /* will trigger a SIGWINCH signal if the window size changed in an */
-      /* way that matters to libuv. */
-      if (handle->tty.rd.last_input_record.EventType == WINDOW_BUFFER_SIZE_EVENT) {
-        CONSOLE_SCREEN_BUFFER_INFO info;
-
-        uv_sem_wait(&uv_tty_output_lock);
-
-        if (uv_tty_output_handle != INVALID_HANDLE_VALUE &&
-            GetConsoleScreenBufferInfo(uv_tty_output_handle, &info)) {
-          uv_tty_update_virtual_window(&info);
-        }
-
-        uv_sem_post(&uv_tty_output_lock);
-
-        continue;
-      }
-
-      /* Ignore other events that are not key or resize events. */
+      /* Ignore other events that are not key events. */
       if (handle->tty.rd.last_input_record.EventType != KEY_EVENT) {
         continue;
       }
@@ -1124,14 +1129,6 @@
   }
   if (uv_tty_virtual_offset < 0) {
     uv_tty_virtual_offset = 0;
-  }
-
-  /* If the virtual window size changed, emit a SIGWINCH signal. Don't emit */
-  /* if this was the first time the virtual window size was computed. */
-  if (old_virtual_width != -1 && old_virtual_height != -1 &&
-      (uv_tty_virtual_width != old_virtual_width ||
-       uv_tty_virtual_height != old_virtual_height)) {
-    uv__signal_dispatch(SIGWINCH);
   }
 }

@@ -2280,3 +2277,52 @@

   uv__vterm_state = UV_SUPPORTED;
 }
+
+static DWORD WINAPI uv__tty_console_resize_message_loop_thread(void* param) {
+  CONSOLE_SCREEN_BUFFER_INFO sb_info;
+  MSG msg;
+
+  if (!GetConsoleScreenBufferInfo(uv__tty_console_handle, &sb_info))
+    return 0;
+
+  uv__tty_console_width = sb_info.dwSize.X;
+  uv__tty_console_height = sb_info.srWindow.Bottom - sb_info.srWindow.Top + 1;
+
+  if (!SetWinEventHook(EVENT_CONSOLE_LAYOUT,
+                       EVENT_CONSOLE_LAYOUT,
+                       NULL,
+                       uv__tty_console_resize_event,
+                       0,
+                       0,
+                       WINEVENT_OUTOFCONTEXT))
+    return 0;
+
+  while (GetMessage(&msg, NULL, 0, 0)) {
+    TranslateMessage(&msg);
+    DispatchMessage(&msg);
+  }
+  return 0;
+}
+
+static void CALLBACK uv__tty_console_resize_event(HWINEVENTHOOK hWinEventHook,
+                                                  DWORD event,
+                                                  HWND hwnd,
+                                                  LONG idObject,
+                                                  LONG idChild,
+                                                  DWORD dwEventThread,
+                                                  DWORD dwmsEventTime) {
+  CONSOLE_SCREEN_BUFFER_INFO sb_info;
+  int width, height;
+
+  if (!GetConsoleScreenBufferInfo(uv__tty_console_handle, &sb_info))
+    return;
+
+  width = sb_info.dwSize.X;
+  height = sb_info.srWindow.Bottom - sb_info.srWindow.Top + 1;
+
+  if (width != uv__tty_console_width || height != uv__tty_console_height) {
+    uv__tty_console_width = width;
+    uv__tty_console_height = height;
+    uv__signal_dispatch(SIGWINCH);
+  }
+}


删除Windows的BOM文本标记

删除Windows的BOM文本标记

--- test/common.c
+++ test/common.c
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <stdio.h>
 #include <check.h>

 #include "zsr/common.h"


Win: utf-8 decoder bug when compiling with gcc

--- src/win/tty.c
+++ src/win/tty.c
@@ -1258,7 +1258,8 @@
 #ifdef _MSC_VER /* msvc */
         if (_BitScanReverse(&first_zero_bit, not_c)) {
 #else /* assume gcc */
-        if (first_zero_bit = __builtin_clzl(not_c), c != 0) {
+        if (c != 0) {
+          first_zero_bit = (sizeof(int) * 8) - 1 - __builtin_clz(not_c);
 #endif
           if (first_zero_bit == 7) {
             /* Ascii - pass right through */


windows: add invert ANSI (7 / 27) emulation

--- src/win/tty.c
+++ src/win/tty.c
@@ -1117,6 +1117,14 @@
   return 0;
 }

+#define FLIP_FGBG                                                             \
+    do {                                                                      \
+      WORD fg = info.wAttributes & 0xF;                                       \
+      WORD bg = info.wAttributes & 0xF0;                                      \
+      info.wAttributes &= 0xFF00;                                             \
+      info.wAttributes |= fg << 4;                                            \
+      info.wAttributes |= bg >> 4;                                            \
+    } while (0)

 static int uv_tty_set_style(uv_tty_t* handle, DWORD* error) {
   unsigned short argc = handle->ansi_csi_argc;
@@ -1126,6 +1134,7 @@

   char fg_color = -1, bg_color = -1;
   char fg_bright = -1, bg_bright = -1;
+  char inverse = -1;

   if (argc == 0) {
     /* Reset mode */
@@ -1133,6 +1142,7 @@
     bg_color = 0;
     fg_bright = 0;
     bg_bright = 0;
+    inverse = 0;
   }

   for (i = 0; i < argc; i++) {
@@ -1144,6 +1154,7 @@
       bg_color = 0;
       fg_bright = 0;
       bg_bright = 0;
+      inverse = 0;

     } else if (arg == 1) {
       /* Foreground bright on */
@@ -1158,6 +1169,10 @@
       /* Background bright on */
       bg_bright = 1;

+    } else if (arg == 7) {
+      /* Inverse: on */
+      inverse = 1;
+
     } else if (arg == 21 || arg == 22) {
       /* Foreground bright off */
       fg_bright = 0;
@@ -1165,6 +1180,10 @@
     } else if (arg == 25) {
       /* Background bright off */
       bg_bright = 0;
+
+    } else if (arg == 27) {
+      /* Inverse: off */
+      inverse = 0;

     } else if (arg >= 30 && arg <= 37) {
       /* Set foreground color */
@@ -1198,7 +1217,7 @@
   }

   if (fg_color == -1 && bg_color == -1 && fg_bright == -1 &&
-      bg_bright == -1) {
+      bg_bright == -1 && inverse == -1) {
     /* Nothing changed */
     return 0;
   }
@@ -1206,6 +1225,10 @@
   if (!GetConsoleScreenBufferInfo(handle->handle, &info)) {
     *error = GetLastError();
     return -1;
+  }
+
+  if ((info.wAttributes & COMMON_LVB_REVERSE_VIDEO) > 0) {
+    FLIP_FGBG;
   }

   if (fg_color != -1) {
@@ -1236,6 +1259,18 @@
     } else {
       info.wAttributes &= ~BACKGROUND_INTENSITY;
     }
+  }
+
+  if (inverse != -1) {
+    if (inverse) {
+      info.wAttributes |= COMMON_LVB_REVERSE_VIDEO;
+    } else {
+      info.wAttributes &= ~COMMON_LVB_REVERSE_VIDEO;
+    }
+  }
+
+  if ((info.wAttributes & COMMON_LVB_REVERSE_VIDEO) > 0) {
+    FLIP_FGBG;
   }

   if (!SetConsoleTextAttribute(handle->handle, info.wAttributes)) {


Fix return value in lock manager hotplug methods

Refactoring of the lock manager hotplug methods lost the
ret = 0 assignment for successful return path

* src/locking/domain_lock.c: Add missing ret = 0 assignments

--- src/locking/domain_lock.c
+++ src/locking/domain_lock.c
@@ -221,6 +221,8 @@
     if (virLockManagerAcquire(lock, NULL, 0) < 0)
         goto cleanup;

+    ret = 0;
+
 cleanup:
     virLockManagerFree(lock);

@@ -240,6 +242,8 @@
     if (virLockManagerRelease(lock, NULL, 0) < 0)
         goto cleanup;

+    ret = 0;
+
 cleanup:
     virLockManagerFree(lock);

@@ -260,6 +264,8 @@
     if (virLockManagerAcquire(lock, NULL, 0) < 0)
         goto cleanup;

+    ret = 0;
+
 cleanup:
     virLockManagerFree(lock);

@@ -279,8 +285,10 @@
     if (virLockManagerRelease(lock, NULL, 0) < 0)
         goto cleanup;

-cleanup:
-    virLockManagerFree(lock);
-
-    return ret;
-}
+    ret = 0;
+
+cleanup:
+    virLockManagerFree(lock);
+
+    return ret;
+}


hciemu: Fix wrong error code in host control

--- test/hciemu.c
+++ test/hciemu.c
@@ -783,7 +783,7 @@
 		break;

 	default:
-		command_status(ogf, ocf, status);
+		command_status(ogf, ocf, 0x01);
 		break;
 	}
 }


Add a Hash() method to the object wrapper.

--- src/wrapper.h
+++ src/wrapper.h
@@ -56,6 +56,11 @@
     {
         return p;
     }
+
+    Py_hash_t Hash()
+    {
+        return PyObject_Hash(this->Get());
+    }
 };