···1414 - S3C24XX: See Documentation/arm/Samsung-S3C24XX/Overview.txt for full list1515 - S3C64XX: S3C6400 and S3C64101616 - S5P64401717- - S5P64421817 - S5PC1001918 - S5PC110 / S5PV2102019···3536 unifying all the SoCs into one kernel.36373738 s5p6440_defconfig - S5P6440 specific default configuration3838- s5p6442_defconfig - S5P6442 specific default configuration3939 s5pc100_defconfig - S5PC100 specific default configuration4040 s5pc110_defconfig - S5PC110 specific default configuration4141 s5pv210_defconfig - S5PV210 specific default configuration
+2-2
Documentation/flexible-arrays.txt
···6666entering atomic context, using:67676868 int flex_array_prealloc(struct flex_array *array, unsigned int start,6969- unsigned int end, gfp_t flags);6969+ unsigned int nr_elements, gfp_t flags);70707171This function will ensure that memory for the elements indexed in the range7272-defined by start and end has been allocated. Thereafter, a7272+defined by start and nr_elements has been allocated. Thereafter, a7373flex_array_put() call on an element in that range is guaranteed not to7474block.7575
···77config ARM_VIC_NR88 int99 default 4 if ARCH_S5PV2101010- default 3 if ARCH_S5P6442 || ARCH_S5PC1001010+ default 3 if ARCH_S5PC1001111 default 21212 depends on ARM_VIC1313 help
+48
arch/arm/configs/at91x40_defconfig
···11+CONFIG_EXPERIMENTAL=y22+CONFIG_LOG_BUF_SHIFT=1433+CONFIG_EMBEDDED=y44+# CONFIG_HOTPLUG is not set55+# CONFIG_ELF_CORE is not set66+# CONFIG_FUTEX is not set77+# CONFIG_TIMERFD is not set88+# CONFIG_VM_EVENT_COUNTERS is not set99+# CONFIG_COMPAT_BRK is not set1010+CONFIG_SLAB=y1111+# CONFIG_LBDAF is not set1212+# CONFIG_BLK_DEV_BSG is not set1313+# CONFIG_IOSCHED_DEADLINE is not set1414+# CONFIG_IOSCHED_CFQ is not set1515+# CONFIG_MMU is not set1616+CONFIG_ARCH_AT91=y1717+CONFIG_ARCH_AT91X40=y1818+CONFIG_MACH_AT91EB01=y1919+CONFIG_AT91_EARLY_USART0=y2020+CONFIG_CPU_ARM7TDMI=y2121+CONFIG_SET_MEM_PARAM=y2222+CONFIG_DRAM_BASE=0x010000002323+CONFIG_DRAM_SIZE=0x004000002424+CONFIG_FLASH_MEM_BASE=0x014000002525+CONFIG_PROCESSOR_ID=0x140000402626+CONFIG_ZBOOT_ROM_TEXT=0x02727+CONFIG_ZBOOT_ROM_BSS=0x02828+CONFIG_BINFMT_FLAT=y2929+# CONFIG_SUSPEND is not set3030+# CONFIG_FW_LOADER is not set3131+CONFIG_MTD=y3232+CONFIG_MTD_PARTITIONS=y3333+CONFIG_MTD_CHAR=y3434+CONFIG_MTD_BLOCK=y3535+CONFIG_MTD_RAM=y3636+CONFIG_MTD_ROM=y3737+CONFIG_BLK_DEV_RAM=y3838+# CONFIG_INPUT is not set3939+# CONFIG_SERIO is not set4040+# CONFIG_VT is not set4141+# CONFIG_DEVKMEM is not set4242+# CONFIG_HW_RANDOM is not set4343+# CONFIG_HWMON is not set4444+# CONFIG_USB_SUPPORT is not set4545+CONFIG_EXT2_FS=y4646+# CONFIG_DNOTIFY is not set4747+CONFIG_ROMFS_FS=y4848+# CONFIG_ENABLE_MUST_CHECK is not set
-65
arch/arm/configs/s5p6442_defconfig
···11-CONFIG_EXPERIMENTAL=y22-CONFIG_SYSFS_DEPRECATED_V2=y33-CONFIG_BLK_DEV_INITRD=y44-CONFIG_KALLSYMS_ALL=y55-CONFIG_MODULES=y66-CONFIG_MODULE_UNLOAD=y77-# CONFIG_BLK_DEV_BSG is not set88-CONFIG_ARCH_S5P6442=y99-CONFIG_S3C_LOWLEVEL_UART_PORT=11010-CONFIG_MACH_SMDK6442=y1111-CONFIG_CPU_32v6K=y1212-CONFIG_AEABI=y1313-CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc"1414-CONFIG_FPE_NWFPE=y1515-CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"1616-# CONFIG_PREVENT_FIRMWARE_BUILD is not set1717-CONFIG_BLK_DEV_LOOP=y1818-CONFIG_BLK_DEV_RAM=y1919-CONFIG_BLK_DEV_RAM_SIZE=81922020-# CONFIG_MISC_DEVICES is not set2121-CONFIG_SCSI=y2222-CONFIG_BLK_DEV_SD=y2323-CONFIG_CHR_DEV_SG=y2424-CONFIG_INPUT_EVDEV=y2525-# CONFIG_INPUT_KEYBOARD is not set2626-# CONFIG_INPUT_MOUSE is not set2727-CONFIG_INPUT_TOUCHSCREEN=y2828-CONFIG_SERIAL_8250=y2929-CONFIG_SERIAL_8250_NR_UARTS=33030-CONFIG_SERIAL_SAMSUNG=y3131-CONFIG_SERIAL_SAMSUNG_CONSOLE=y3232-CONFIG_HW_RANDOM=y3333-# CONFIG_HWMON is not set3434-# CONFIG_VGA_CONSOLE is not set3535-# CONFIG_HID_SUPPORT is not set3636-# CONFIG_USB_SUPPORT is not set3737-CONFIG_EXT2_FS=y3838-CONFIG_INOTIFY=y3939-CONFIG_MSDOS_FS=y4040-CONFIG_VFAT_FS=y4141-CONFIG_TMPFS=y4242-CONFIG_TMPFS_POSIX_ACL=y4343-CONFIG_CRAMFS=y4444-CONFIG_ROMFS_FS=y4545-CONFIG_PARTITION_ADVANCED=y4646-CONFIG_BSD_DISKLABEL=y4747-CONFIG_SOLARIS_X86_PARTITION=y4848-CONFIG_NLS_CODEPAGE_437=y4949-CONFIG_NLS_ASCII=y5050-CONFIG_NLS_ISO8859_1=y5151-CONFIG_MAGIC_SYSRQ=y5252-CONFIG_DEBUG_KERNEL=y5353-CONFIG_DEBUG_RT_MUTEXES=y5454-CONFIG_DEBUG_SPINLOCK=y5555-CONFIG_DEBUG_MUTEXES=y5656-CONFIG_DEBUG_SPINLOCK_SLEEP=y5757-CONFIG_DEBUG_INFO=y5858-# CONFIG_RCU_CPU_STALL_DETECTOR is not set5959-CONFIG_SYSCTL_SYSCALL_CHECK=y6060-# CONFIG_ARM_UNWIND is not set6161-CONFIG_DEBUG_USER=y6262-CONFIG_DEBUG_ERRORS=y6363-CONFIG_DEBUG_LL=y6464-CONFIG_DEBUG_S3C_UART=16565-CONFIG_CRC_CCITT=y
+8
arch/arm/kernel/ptrace.c
···767767768768#ifdef CONFIG_HAVE_HW_BREAKPOINT769769 case PTRACE_GETHBPREGS:770770+ if (ptrace_get_breakpoints(child) < 0)771771+ return -ESRCH;772772+770773 ret = ptrace_gethbpregs(child, addr,771774 (unsigned long __user *)data);775775+ ptrace_put_breakpoints(child);772776 break;773777 case PTRACE_SETHBPREGS:778778+ if (ptrace_get_breakpoints(child) < 0)779779+ return -ESRCH;780780+774781 ret = ptrace_sethbpregs(child, addr,775782 (unsigned long __user *)data);783783+ ptrace_put_breakpoints(child);776784 break;777785#endif778786
···11-/* linux/arch/arm/mach-s5p6442/dev-spi.c22- *33- * Copyright (C) 2010 Samsung Electronics Co. Ltd.44- * Jaswinder Singh <jassi.brar@samsung.com>55- *66- * This program is free software; you can redistribute it and/or modify77- * it under the terms of the GNU General Public License version 2 as88- * published by the Free Software Foundation.99- */1010-1111-#include <linux/platform_device.h>1212-#include <linux/dma-mapping.h>1313-#include <linux/gpio.h>1414-1515-#include <mach/dma.h>1616-#include <mach/map.h>1717-#include <mach/irqs.h>1818-#include <mach/spi-clocks.h>1919-2020-#include <plat/s3c64xx-spi.h>2121-#include <plat/gpio-cfg.h>2222-2323-static char *spi_src_clks[] = {2424- [S5P6442_SPI_SRCCLK_PCLK] = "pclk",2525- [S5P6442_SPI_SRCCLK_SCLK] = "spi_epll",2626-};2727-2828-/* SPI Controller platform_devices */2929-3030-/* Since we emulate multi-cs capability, we do not touch the CS.3131- * The emulated CS is toggled by board specific mechanism, as it can3232- * be either some immediate GPIO or some signal out of some other3333- * chip in between ... or some yet another way.3434- * We simply do not assume anything about CS.3535- */3636-static int s5p6442_spi_cfg_gpio(struct platform_device *pdev)3737-{3838- switch (pdev->id) {3939- case 0:4040- s3c_gpio_cfgpin(S5P6442_GPB(0), S3C_GPIO_SFN(2));4141- s3c_gpio_setpull(S5P6442_GPB(0), S3C_GPIO_PULL_UP);4242- s3c_gpio_cfgall_range(S5P6442_GPB(2), 2,4343- S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);4444- break;4545-4646- default:4747- dev_err(&pdev->dev, "Invalid SPI Controller number!");4848- return -EINVAL;4949- }5050-5151- return 0;5252-}5353-5454-static struct resource s5p6442_spi0_resource[] = {5555- [0] = {5656- .start = S5P6442_PA_SPI,5757- .end = S5P6442_PA_SPI + 0x100 - 1,5858- .flags = IORESOURCE_MEM,5959- },6060- [1] = {6161- .start = DMACH_SPI0_TX,6262- .end = DMACH_SPI0_TX,6363- .flags = IORESOURCE_DMA,6464- },6565- [2] = {6666- .start = DMACH_SPI0_RX,6767- .end = DMACH_SPI0_RX,6868- .flags = IORESOURCE_DMA,6969- },7070- [3] = {7171- .start = IRQ_SPI0,7272- .end = IRQ_SPI0,7373- .flags = IORESOURCE_IRQ,7474- },7575-};7676-7777-static struct s3c64xx_spi_info s5p6442_spi0_pdata = {7878- .cfg_gpio = s5p6442_spi_cfg_gpio,7979- .fifo_lvl_mask = 0x1ff,8080- .rx_lvl_offset = 15,8181-};8282-8383-static u64 spi_dmamask = DMA_BIT_MASK(32);8484-8585-struct platform_device s5p6442_device_spi = {8686- .name = "s3c64xx-spi",8787- .id = 0,8888- .num_resources = ARRAY_SIZE(s5p6442_spi0_resource),8989- .resource = s5p6442_spi0_resource,9090- .dev = {9191- .dma_mask = &spi_dmamask,9292- .coherent_dma_mask = DMA_BIT_MASK(32),9393- .platform_data = &s5p6442_spi0_pdata,9494- },9595-};9696-9797-void __init s5p6442_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)9898-{9999- struct s3c64xx_spi_info *pd;100100-101101- /* Reject invalid configuration */102102- if (!num_cs || src_clk_nr < 0103103- || src_clk_nr > S5P6442_SPI_SRCCLK_SCLK) {104104- printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);105105- return;106106- }107107-108108- switch (cntrlr) {109109- case 0:110110- pd = &s5p6442_spi0_pdata;111111- break;112112- default:113113- printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",114114- __func__, cntrlr);115115- return;116116- }117117-118118- pd->num_cs = num_cs;119119- pd->src_clk_nr = src_clk_nr;120120- pd->src_clk_name = spi_src_clks[src_clk_nr];121121-}
-105
arch/arm/mach-s5p6442/dma.c
···11-/*22- * Copyright (C) 2010 Samsung Electronics Co. Ltd.33- * Jaswinder Singh <jassi.brar@samsung.com>44- *55- * This program is free software; you can redistribute it and/or modify66- * it under the terms of the GNU General Public License as published by77- * the Free Software Foundation; either version 2 of the License, or88- * (at your option) any later version.99- *1010- * This program is distributed in the hope that it will be useful,1111- * but WITHOUT ANY WARRANTY; without even the implied warranty of1212- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313- * GNU General Public License for more details.1414- *1515- * You should have received a copy of the GNU General Public License1616- * along with this program; if not, write to the Free Software1717- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1818- */1919-2020-#include <linux/platform_device.h>2121-#include <linux/dma-mapping.h>2222-2323-#include <plat/devs.h>2424-#include <plat/irqs.h>2525-2626-#include <mach/map.h>2727-#include <mach/irqs.h>2828-2929-#include <plat/s3c-pl330-pdata.h>3030-3131-static u64 dma_dmamask = DMA_BIT_MASK(32);3232-3333-static struct resource s5p6442_pdma_resource[] = {3434- [0] = {3535- .start = S5P6442_PA_PDMA,3636- .end = S5P6442_PA_PDMA + SZ_4K,3737- .flags = IORESOURCE_MEM,3838- },3939- [1] = {4040- .start = IRQ_PDMA,4141- .end = IRQ_PDMA,4242- .flags = IORESOURCE_IRQ,4343- },4444-};4545-4646-static struct s3c_pl330_platdata s5p6442_pdma_pdata = {4747- .peri = {4848- [0] = DMACH_UART0_RX,4949- [1] = DMACH_UART0_TX,5050- [2] = DMACH_UART1_RX,5151- [3] = DMACH_UART1_TX,5252- [4] = DMACH_UART2_RX,5353- [5] = DMACH_UART2_TX,5454- [6] = DMACH_MAX,5555- [7] = DMACH_MAX,5656- [8] = DMACH_MAX,5757- [9] = DMACH_I2S0_RX,5858- [10] = DMACH_I2S0_TX,5959- [11] = DMACH_I2S0S_TX,6060- [12] = DMACH_I2S1_RX,6161- [13] = DMACH_I2S1_TX,6262- [14] = DMACH_MAX,6363- [15] = DMACH_MAX,6464- [16] = DMACH_SPI0_RX,6565- [17] = DMACH_SPI0_TX,6666- [18] = DMACH_MAX,6767- [19] = DMACH_MAX,6868- [20] = DMACH_PCM0_RX,6969- [21] = DMACH_PCM0_TX,7070- [22] = DMACH_PCM1_RX,7171- [23] = DMACH_PCM1_TX,7272- [24] = DMACH_MAX,7373- [25] = DMACH_MAX,7474- [26] = DMACH_MAX,7575- [27] = DMACH_MSM_REQ0,7676- [28] = DMACH_MSM_REQ1,7777- [29] = DMACH_MSM_REQ2,7878- [30] = DMACH_MSM_REQ3,7979- [31] = DMACH_MAX,8080- },8181-};8282-8383-static struct platform_device s5p6442_device_pdma = {8484- .name = "s3c-pl330",8585- .id = -1,8686- .num_resources = ARRAY_SIZE(s5p6442_pdma_resource),8787- .resource = s5p6442_pdma_resource,8888- .dev = {8989- .dma_mask = &dma_dmamask,9090- .coherent_dma_mask = DMA_BIT_MASK(32),9191- .platform_data = &s5p6442_pdma_pdata,9292- },9393-};9494-9595-static struct platform_device *s5p6442_dmacs[] __initdata = {9696- &s5p6442_device_pdma,9797-};9898-9999-static int __init s5p6442_dma_init(void)100100-{101101- platform_add_devices(s5p6442_dmacs, ARRAY_SIZE(s5p6442_dmacs));102102-103103- return 0;104104-}105105-arch_initcall(s5p6442_dma_init);
-35
arch/arm/mach-s5p6442/include/mach/debug-macro.S
···11-/* linux/arch/arm/mach-s5p6442/include/mach/debug-macro.S22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * Based on arch/arm/mach-s3c6400/include/mach/debug-macro.S77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-/* pull in the relevant register and map files. */1414-1515-#include <mach/map.h>1616-#include <plat/regs-serial.h>1717-1818- .macro addruart, rp, rv1919- ldr \rp, = S3C_PA_UART2020- ldr \rv, = S3C_VA_UART2121-#if CONFIG_DEBUG_S3C_UART != 02222- add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)2323- add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)2424-#endif2525- .endm2626-2727-#define fifo_full fifo_full_s5pv2102828-#define fifo_level fifo_level_s5pv2102929-3030-/* include the reset of the code which will do the work, we're only3131- * compiling for a single cpu processor type so the default of s3c24403232- * will be fine with us.3333- */3434-3535-#include <plat/debug-macro.S>
-26
arch/arm/mach-s5p6442/include/mach/dma.h
···11-/*22- * Copyright (C) 2010 Samsung Electronics Co. Ltd.33- * Jaswinder Singh <jassi.brar@samsung.com>44- *55- * This program is free software; you can redistribute it and/or modify66- * it under the terms of the GNU General Public License as published by77- * the Free Software Foundation; either version 2 of the License, or88- * (at your option) any later version.99- *1010- * This program is distributed in the hope that it will be useful,1111- * but WITHOUT ANY WARRANTY; without even the implied warranty of1212- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313- * GNU General Public License for more details.1414- *1515- * You should have received a copy of the GNU General Public License1616- * along with this program; if not, write to the Free Software1717- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1818- */1919-2020-#ifndef __MACH_DMA_H2121-#define __MACH_DMA_H2222-2323-/* This platform uses the common S3C DMA API driver for PL330 */2424-#include <plat/s3c-dma-pl330.h>2525-2626-#endif /* __MACH_DMA_H */
-48
arch/arm/mach-s5p6442/include/mach/entry-macro.S
···11-/* linux/arch/arm/mach-s5p6442/include/mach/entry-macro.S22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * Low-level IRQ helper macros for the Samsung S5P644277- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#include <asm/hardware/vic.h>1414-#include <mach/map.h>1515-#include <plat/irqs.h>1616-1717- .macro disable_fiq1818- .endm1919-2020- .macro get_irqnr_preamble, base, tmp2121- ldr \base, =VA_VIC02222- .endm2323-2424- .macro arch_ret_to_user, tmp1, tmp22525- .endm2626-2727- .macro get_irqnr_and_base, irqnr, irqstat, base, tmp2828-2929- @ check the vic03030- mov \irqnr, # S5P_IRQ_OFFSET + 313131- ldr \irqstat, [ \base, # VIC_IRQ_STATUS ]3232- teq \irqstat, #03333-3434- @ otherwise try vic13535- addeq \tmp, \base, #(VA_VIC1 - VA_VIC0)3636- addeq \irqnr, \irqnr, #323737- ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]3838- teqeq \irqstat, #03939-4040- @ otherwise try vic24141- addeq \tmp, \base, #(VA_VIC2 - VA_VIC0)4242- addeq \irqnr, \irqnr, #324343- ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]4444- teqeq \irqstat, #04545-4646- clzne \irqstat, \irqstat4747- subne \irqnr, \irqnr, \irqstat4848- .endm
-123
arch/arm/mach-s5p6442/include/mach/gpio.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/gpio.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * S5P6442 - GPIO lib support77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#ifndef __ASM_ARCH_GPIO_H1414-#define __ASM_ARCH_GPIO_H __FILE__1515-1616-#define gpio_get_value __gpio_get_value1717-#define gpio_set_value __gpio_set_value1818-#define gpio_cansleep __gpio_cansleep1919-#define gpio_to_irq __gpio_to_irq2020-2121-/* GPIO bank sizes */2222-#define S5P6442_GPIO_A0_NR (8)2323-#define S5P6442_GPIO_A1_NR (2)2424-#define S5P6442_GPIO_B_NR (4)2525-#define S5P6442_GPIO_C0_NR (5)2626-#define S5P6442_GPIO_C1_NR (5)2727-#define S5P6442_GPIO_D0_NR (2)2828-#define S5P6442_GPIO_D1_NR (6)2929-#define S5P6442_GPIO_E0_NR (8)3030-#define S5P6442_GPIO_E1_NR (5)3131-#define S5P6442_GPIO_F0_NR (8)3232-#define S5P6442_GPIO_F1_NR (8)3333-#define S5P6442_GPIO_F2_NR (8)3434-#define S5P6442_GPIO_F3_NR (6)3535-#define S5P6442_GPIO_G0_NR (7)3636-#define S5P6442_GPIO_G1_NR (7)3737-#define S5P6442_GPIO_G2_NR (7)3838-#define S5P6442_GPIO_H0_NR (8)3939-#define S5P6442_GPIO_H1_NR (8)4040-#define S5P6442_GPIO_H2_NR (8)4141-#define S5P6442_GPIO_H3_NR (8)4242-#define S5P6442_GPIO_J0_NR (8)4343-#define S5P6442_GPIO_J1_NR (6)4444-#define S5P6442_GPIO_J2_NR (8)4545-#define S5P6442_GPIO_J3_NR (8)4646-#define S5P6442_GPIO_J4_NR (5)4747-4848-/* GPIO bank numbers */4949-5050-/* CONFIG_S3C_GPIO_SPACE allows the user to select extra5151- * space for debugging purposes so that any accidental5252- * change from one gpio bank to another can be caught.5353-*/5454-5555-#define S5P6442_GPIO_NEXT(__gpio) \5656- ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)5757-5858-enum s5p_gpio_number {5959- S5P6442_GPIO_A0_START = 0,6060- S5P6442_GPIO_A1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_A0),6161- S5P6442_GPIO_B_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_A1),6262- S5P6442_GPIO_C0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_B),6363- S5P6442_GPIO_C1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_C0),6464- S5P6442_GPIO_D0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_C1),6565- S5P6442_GPIO_D1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_D0),6666- S5P6442_GPIO_E0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_D1),6767- S5P6442_GPIO_E1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_E0),6868- S5P6442_GPIO_F0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_E1),6969- S5P6442_GPIO_F1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F0),7070- S5P6442_GPIO_F2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F1),7171- S5P6442_GPIO_F3_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F2),7272- S5P6442_GPIO_G0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F3),7373- S5P6442_GPIO_G1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_G0),7474- S5P6442_GPIO_G2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_G1),7575- S5P6442_GPIO_H0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_G2),7676- S5P6442_GPIO_H1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H0),7777- S5P6442_GPIO_H2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H1),7878- S5P6442_GPIO_H3_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H2),7979- S5P6442_GPIO_J0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H3),8080- S5P6442_GPIO_J1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J0),8181- S5P6442_GPIO_J2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J1),8282- S5P6442_GPIO_J3_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J2),8383- S5P6442_GPIO_J4_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J3),8484-};8585-8686-/* S5P6442 GPIO number definitions. */8787-#define S5P6442_GPA0(_nr) (S5P6442_GPIO_A0_START + (_nr))8888-#define S5P6442_GPA1(_nr) (S5P6442_GPIO_A1_START + (_nr))8989-#define S5P6442_GPB(_nr) (S5P6442_GPIO_B_START + (_nr))9090-#define S5P6442_GPC0(_nr) (S5P6442_GPIO_C0_START + (_nr))9191-#define S5P6442_GPC1(_nr) (S5P6442_GPIO_C1_START + (_nr))9292-#define S5P6442_GPD0(_nr) (S5P6442_GPIO_D0_START + (_nr))9393-#define S5P6442_GPD1(_nr) (S5P6442_GPIO_D1_START + (_nr))9494-#define S5P6442_GPE0(_nr) (S5P6442_GPIO_E0_START + (_nr))9595-#define S5P6442_GPE1(_nr) (S5P6442_GPIO_E1_START + (_nr))9696-#define S5P6442_GPF0(_nr) (S5P6442_GPIO_F0_START + (_nr))9797-#define S5P6442_GPF1(_nr) (S5P6442_GPIO_F1_START + (_nr))9898-#define S5P6442_GPF2(_nr) (S5P6442_GPIO_F2_START + (_nr))9999-#define S5P6442_GPF3(_nr) (S5P6442_GPIO_F3_START + (_nr))100100-#define S5P6442_GPG0(_nr) (S5P6442_GPIO_G0_START + (_nr))101101-#define S5P6442_GPG1(_nr) (S5P6442_GPIO_G1_START + (_nr))102102-#define S5P6442_GPG2(_nr) (S5P6442_GPIO_G2_START + (_nr))103103-#define S5P6442_GPH0(_nr) (S5P6442_GPIO_H0_START + (_nr))104104-#define S5P6442_GPH1(_nr) (S5P6442_GPIO_H1_START + (_nr))105105-#define S5P6442_GPH2(_nr) (S5P6442_GPIO_H2_START + (_nr))106106-#define S5P6442_GPH3(_nr) (S5P6442_GPIO_H3_START + (_nr))107107-#define S5P6442_GPJ0(_nr) (S5P6442_GPIO_J0_START + (_nr))108108-#define S5P6442_GPJ1(_nr) (S5P6442_GPIO_J1_START + (_nr))109109-#define S5P6442_GPJ2(_nr) (S5P6442_GPIO_J2_START + (_nr))110110-#define S5P6442_GPJ3(_nr) (S5P6442_GPIO_J3_START + (_nr))111111-#define S5P6442_GPJ4(_nr) (S5P6442_GPIO_J4_START + (_nr))112112-113113-/* the end of the S5P6442 specific gpios */114114-#define S5P6442_GPIO_END (S5P6442_GPJ4(S5P6442_GPIO_J4_NR) + 1)115115-#define S3C_GPIO_END S5P6442_GPIO_END116116-117117-/* define the number of gpios we need to the one after the GPJ4() range */118118-#define ARCH_NR_GPIOS (S5P6442_GPJ4(S5P6442_GPIO_J4_NR) + \119119- CONFIG_SAMSUNG_GPIO_EXTRA + 1)120120-121121-#include <asm-generic/gpio.h>122122-123123-#endif /* __ASM_ARCH_GPIO_H */
-18
arch/arm/mach-s5p6442/include/mach/hardware.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/hardware.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * S5P6442 - Hardware support77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#ifndef __ASM_ARCH_HARDWARE_H1414-#define __ASM_ARCH_HARDWARE_H __FILE__1515-1616-/* currently nothing here, placeholder */1717-1818-#endif /* __ASM_ARCH_HARDWARE_H */
-17
arch/arm/mach-s5p6442/include/mach/io.h
···11-/* arch/arm/mach-s5p6442/include/mach/io.h22- *33- * Copyright 2008-2010 Ben Dooks <ben-linux@fluff.org>44- *55- * Default IO routines for S5P644266- */77-88-#ifndef __ASM_ARM_ARCH_IO_H99-#define __ASM_ARM_ARCH_IO_H1010-1111-/* No current ISA/PCI bus support. */1212-#define __io(a) __typesafe_io(a)1313-#define __mem_pci(a) (a)1414-1515-#define IO_SPACE_LIMIT (0xFFFFFFFF)1616-1717-#endif
-87
arch/arm/mach-s5p6442/include/mach/irqs.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/irqs.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * S5P6442 - IRQ definitions77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#ifndef __ASM_ARCH_IRQS_H1414-#define __ASM_ARCH_IRQS_H __FILE__1515-1616-#include <plat/irqs.h>1717-1818-/* VIC0 */1919-#define IRQ_EINT16_31 S5P_IRQ_VIC0(16)2020-#define IRQ_BATF S5P_IRQ_VIC0(17)2121-#define IRQ_MDMA S5P_IRQ_VIC0(18)2222-#define IRQ_PDMA S5P_IRQ_VIC0(19)2323-#define IRQ_TIMER0_VIC S5P_IRQ_VIC0(21)2424-#define IRQ_TIMER1_VIC S5P_IRQ_VIC0(22)2525-#define IRQ_TIMER2_VIC S5P_IRQ_VIC0(23)2626-#define IRQ_TIMER3_VIC S5P_IRQ_VIC0(24)2727-#define IRQ_TIMER4_VIC S5P_IRQ_VIC0(25)2828-#define IRQ_SYSTIMER S5P_IRQ_VIC0(26)2929-#define IRQ_WDT S5P_IRQ_VIC0(27)3030-#define IRQ_RTC_ALARM S5P_IRQ_VIC0(28)3131-#define IRQ_RTC_TIC S5P_IRQ_VIC0(29)3232-#define IRQ_GPIOINT S5P_IRQ_VIC0(30)3333-3434-/* VIC1 */3535-#define IRQ_PMU S5P_IRQ_VIC1(0)3636-#define IRQ_ONENAND S5P_IRQ_VIC1(7)3737-#define IRQ_UART0 S5P_IRQ_VIC1(10)3838-#define IRQ_UART1 S5P_IRQ_VIC1(11)3939-#define IRQ_UART2 S5P_IRQ_VIC1(12)4040-#define IRQ_SPI0 S5P_IRQ_VIC1(15)4141-#define IRQ_IIC S5P_IRQ_VIC1(19)4242-#define IRQ_IIC1 S5P_IRQ_VIC1(20)4343-#define IRQ_IIC2 S5P_IRQ_VIC1(21)4444-#define IRQ_OTG S5P_IRQ_VIC1(24)4545-#define IRQ_MSM S5P_IRQ_VIC1(25)4646-#define IRQ_HSMMC0 S5P_IRQ_VIC1(26)4747-#define IRQ_HSMMC1 S5P_IRQ_VIC1(27)4848-#define IRQ_HSMMC2 S5P_IRQ_VIC1(28)4949-#define IRQ_COMMRX S5P_IRQ_VIC1(29)5050-#define IRQ_COMMTX S5P_IRQ_VIC1(30)5151-5252-/* VIC2 */5353-#define IRQ_LCD0 S5P_IRQ_VIC2(0)5454-#define IRQ_LCD1 S5P_IRQ_VIC2(1)5555-#define IRQ_LCD2 S5P_IRQ_VIC2(2)5656-#define IRQ_LCD3 S5P_IRQ_VIC2(3)5757-#define IRQ_ROTATOR S5P_IRQ_VIC2(4)5858-#define IRQ_FIMC0 S5P_IRQ_VIC2(5)5959-#define IRQ_FIMC1 S5P_IRQ_VIC2(6)6060-#define IRQ_FIMC2 S5P_IRQ_VIC2(7)6161-#define IRQ_JPEG S5P_IRQ_VIC2(8)6262-#define IRQ_3D S5P_IRQ_VIC2(10)6363-#define IRQ_Mixer S5P_IRQ_VIC2(11)6464-#define IRQ_MFC S5P_IRQ_VIC2(14)6565-#define IRQ_TVENC S5P_IRQ_VIC2(15)6666-#define IRQ_I2S0 S5P_IRQ_VIC2(16)6767-#define IRQ_I2S1 S5P_IRQ_VIC2(17)6868-#define IRQ_RP S5P_IRQ_VIC2(19)6969-#define IRQ_PCM0 S5P_IRQ_VIC2(20)7070-#define IRQ_PCM1 S5P_IRQ_VIC2(21)7171-#define IRQ_ADC S5P_IRQ_VIC2(23)7272-#define IRQ_PENDN S5P_IRQ_VIC2(24)7373-#define IRQ_KEYPAD S5P_IRQ_VIC2(25)7474-#define IRQ_SSS_INT S5P_IRQ_VIC2(27)7575-#define IRQ_SSS_HASH S5P_IRQ_VIC2(28)7676-#define IRQ_VIC_END S5P_IRQ_VIC2(31)7777-7878-#define S5P_IRQ_EINT_BASE (IRQ_VIC_END + 1)7979-8080-#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))8181-#define S5P_EINT_BASE2 (S5P_IRQ_EINT_BASE)8282-8383-/* Set the default NR_IRQS */8484-8585-#define NR_IRQS (IRQ_EINT(31) + 1)8686-8787-#endif /* __ASM_ARCH_IRQS_H */
-76
arch/arm/mach-s5p6442/include/mach/map.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/map.h22- *33- * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * S5P6442 - Memory map definitions77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#ifndef __ASM_ARCH_MAP_H1414-#define __ASM_ARCH_MAP_H __FILE__1515-1616-#include <plat/map-base.h>1717-#include <plat/map-s5p.h>1818-1919-#define S5P6442_PA_SDRAM 0x200000002020-2121-#define S5P6442_PA_I2S0 0xC0B000002222-#define S5P6442_PA_I2S1 0xF22000002323-2424-#define S5P6442_PA_CHIPID 0xE00000002525-2626-#define S5P6442_PA_SYSCON 0xE01000002727-2828-#define S5P6442_PA_GPIO 0xE02000002929-3030-#define S5P6442_PA_VIC0 0xE40000003131-#define S5P6442_PA_VIC1 0xE41000003232-#define S5P6442_PA_VIC2 0xE42000003333-3434-#define S5P6442_PA_SROMC 0xE70000003535-3636-#define S5P6442_PA_MDMA 0xE80000003737-#define S5P6442_PA_PDMA 0xE90000003838-3939-#define S5P6442_PA_TIMER 0xEA0000004040-4141-#define S5P6442_PA_SYSTIMER 0xEA1000004242-4343-#define S5P6442_PA_WATCHDOG 0xEA2000004444-4545-#define S5P6442_PA_UART 0xEC0000004646-4747-#define S5P6442_PA_IIC0 0xEC1000004848-4949-#define S5P6442_PA_SPI 0xEC3000005050-5151-#define S5P6442_PA_PCM0 0xF24000005252-#define S5P6442_PA_PCM1 0xF25000005353-5454-/* Compatibiltiy Defines */5555-5656-#define S3C_PA_IIC S5P6442_PA_IIC05757-#define S3C_PA_WDT S5P6442_PA_WATCHDOG5858-5959-#define S5P_PA_CHIPID S5P6442_PA_CHIPID6060-#define S5P_PA_SDRAM S5P6442_PA_SDRAM6161-#define S5P_PA_SROMC S5P6442_PA_SROMC6262-#define S5P_PA_SYSCON S5P6442_PA_SYSCON6363-#define S5P_PA_TIMER S5P6442_PA_TIMER6464-6565-/* UART */6666-6767-#define S3C_PA_UART S5P6442_PA_UART6868-6969-#define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET))7070-#define S5P_PA_UART0 S5P_PA_UART(0)7171-#define S5P_PA_UART1 S5P_PA_UART(1)7272-#define S5P_PA_UART2 S5P_PA_UART(2)7373-7474-#define S5P_SZ_UART SZ_2567575-7676-#endif /* __ASM_ARCH_MAP_H */
-19
arch/arm/mach-s5p6442/include/mach/memory.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/memory.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * S5P6442 - Memory definitions77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#ifndef __ASM_ARCH_MEMORY_H1414-#define __ASM_ARCH_MEMORY_H1515-1616-#define PLAT_PHYS_OFFSET UL(0x20000000)1717-#define CONSISTENT_DMA_SIZE SZ_8M1818-1919-#endif /* __ASM_ARCH_MEMORY_H */
-70
arch/arm/mach-s5p6442/include/mach/pwm-clock.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/pwm-clock.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * Copyright 2008 Openmoko, Inc.77- * Copyright 2008 Simtec Electronics88- * Ben Dooks <ben@simtec.co.uk>99- * http://armlinux.simtec.co.uk/1010- *1111- * Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h1212- *1313- * S5P6442 - pwm clock and timer support1414- *1515- * This program is free software; you can redistribute it and/or modify1616- * it under the terms of the GNU General Public License version 2 as1717- * published by the Free Software Foundation.1818-*/1919-2020-#ifndef __ASM_ARCH_PWMCLK_H2121-#define __ASM_ARCH_PWMCLK_H __FILE__2222-2323-/**2424- * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk2525- * @tcfg: The timer TCFG1 register bits shifted down to 0.2626- *2727- * Return true if the given configuration from TCFG1 is a TCLK instead2828- * any of the TDIV clocks.2929- */3030-static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)3131-{3232- return tcfg == S3C64XX_TCFG1_MUX_TCLK;3333-}3434-3535-/**3636- * tcfg_to_divisor() - convert tcfg1 setting to a divisor3737- * @tcfg1: The tcfg1 setting, shifted down.3838- *3939- * Get the divisor value for the given tcfg1 setting. We assume the4040- * caller has already checked to see if this is not a TCLK source.4141- */4242-static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)4343-{4444- return 1 << tcfg1;4545-}4646-4747-/**4848- * pwm_tdiv_has_div1() - does the tdiv setting have a /14949- *5050- * Return true if we have a /1 in the tdiv setting.5151- */5252-static inline unsigned int pwm_tdiv_has_div1(void)5353-{5454- return 1;5555-}5656-5757-/**5858- * pwm_tdiv_div_bits() - calculate TCFG1 divisor value.5959- * @div: The divisor to calculate the bit information for.6060- *6161- * Turn a divisor into the necessary bit field for TCFG1.6262- */6363-static inline unsigned long pwm_tdiv_div_bits(unsigned int div)6464-{6565- return ilog2(div);6666-}6767-6868-#define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK6969-7070-#endif /* __ASM_ARCH_PWMCLK_H */
···11-/* linux/arch/arm/mach-s5p6442/include/mach/regs-irq.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * S5P6442 - IRQ register definitions77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#ifndef __ASM_ARCH_REGS_IRQ_H1414-#define __ASM_ARCH_REGS_IRQ_H __FILE__1515-1616-#include <asm/hardware/vic.h>1717-#include <mach/map.h>1818-1919-#endif /* __ASM_ARCH_REGS_IRQ_H */
-17
arch/arm/mach-s5p6442/include/mach/spi-clocks.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/spi-clocks.h22- *33- * Copyright (C) 2010 Samsung Electronics Co. Ltd.44- * Jaswinder Singh <jassi.brar@samsung.com>55- *66- * This program is free software; you can redistribute it and/or modify77- * it under the terms of the GNU General Public License version 2 as88- * published by the Free Software Foundation.99- */1010-1111-#ifndef __S5P6442_PLAT_SPI_CLKS_H1212-#define __S5P6442_PLAT_SPI_CLKS_H __FILE__1313-1414-#define S5P6442_SPI_SRCCLK_PCLK 01515-#define S5P6442_SPI_SRCCLK_SCLK 11616-1717-#endif /* __S5P6442_PLAT_SPI_CLKS_H */
-23
arch/arm/mach-s5p6442/include/mach/system.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/system.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * S5P6442 - system support header77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#ifndef __ASM_ARCH_SYSTEM_H1414-#define __ASM_ARCH_SYSTEM_H __FILE__1515-1616-#include <plat/system-reset.h>1717-1818-static void arch_idle(void)1919-{2020- /* nothing here yet */2121-}2222-2323-#endif /* __ASM_ARCH_SYSTEM_H */
-26
arch/arm/mach-s5p6442/include/mach/tick.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/tick.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * Based on arch/arm/mach-s3c6400/include/mach/tick.h77- *88- * S5P6442 - Timer tick support definitions99- *1010- * This program is free software; you can redistribute it and/or modify1111- * it under the terms of the GNU General Public License version 2 as1212- * published by the Free Software Foundation.1313-*/1414-1515-#ifndef __ASM_ARCH_TICK_H1616-#define __ASM_ARCH_TICK_H __FILE__1717-1818-static inline u32 s3c24xx_ostimer_pending(void)1919-{2020- u32 pend = __raw_readl(VA_VIC0 + VIC_RAW_STATUS);2121- return pend & (1 << (IRQ_TIMER4_VIC - S5P_IRQ_VIC0(0)));2222-}2323-2424-#define TICK_MAX (0xffffffff)2525-2626-#endif /* __ASM_ARCH_TICK_H */
-24
arch/arm/mach-s5p6442/include/mach/timex.h
···11-/* arch/arm/mach-s5p6442/include/mach/timex.h22- *33- * Copyright (c) 2003-2010 Simtec Electronics44- * Ben Dooks <ben@simtec.co.uk>55- *66- * S5P6442 - time parameters77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#ifndef __ASM_ARCH_TIMEX_H1414-#define __ASM_ARCH_TIMEX_H1515-1616-/* CLOCK_TICK_RATE needs to be evaluatable by the cpp, so making it1717- * a variable is useless. It seems as long as we make our timers an1818- * exact multiple of HZ, any value that makes a 1->1 correspondence1919- * for the time conversion functions to/from jiffies is acceptable.2020-*/2121-2222-#define CLOCK_TICK_RATE 120000002323-2424-#endif /* __ASM_ARCH_TIMEX_H */
-24
arch/arm/mach-s5p6442/include/mach/uncompress.h
···11-/* linux/arch/arm/mach-s5p6442/include/mach/uncompress.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * S5P6442 - uncompress code77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-#ifndef __ASM_ARCH_UNCOMPRESS_H1414-#define __ASM_ARCH_UNCOMPRESS_H1515-1616-#include <mach/map.h>1717-#include <plat/uncompress.h>1818-1919-static void arch_detect_cpu(void)2020-{2121- /* we do not need to do any cpu detection here at the moment. */2222-}2323-2424-#endif /* __ASM_ARCH_UNCOMPRESS_H */
-17
arch/arm/mach-s5p6442/include/mach/vmalloc.h
···11-/* arch/arm/mach-s5p6442/include/mach/vmalloc.h22- *33- * Copyright 2010 Ben Dooks <ben-linux@fluff.org>44- *55- * This program is free software; you can redistribute it and/or modify66- * it under the terms of the GNU General Public License version 2 as77- * published by the Free Software Foundation.88- *99- * S5P6442 vmalloc definition1010-*/1111-1212-#ifndef __ASM_ARCH_VMALLOC_H1313-#define __ASM_ARCH_VMALLOC_H1414-1515-#define VMALLOC_END 0xF6000000UL1616-1717-#endif /* __ASM_ARCH_VMALLOC_H */
-44
arch/arm/mach-s5p6442/init.c
···11-/* linux/arch/arm/mach-s5p6442/s5p6442-init.c22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * This program is free software; you can redistribute it and/or modify77- * it under the terms of the GNU General Public License version 2 as88- * published by the Free Software Foundation.99-*/1010-1111-#include <linux/kernel.h>1212-#include <linux/types.h>1313-#include <linux/init.h>1414-#include <linux/serial_core.h>1515-1616-#include <plat/cpu.h>1717-#include <plat/devs.h>1818-#include <plat/s5p6442.h>1919-#include <plat/regs-serial.h>2020-2121-static struct s3c24xx_uart_clksrc s5p6442_serial_clocks[] = {2222- [0] = {2323- .name = "pclk",2424- .divisor = 1,2525- .min_baud = 0,2626- .max_baud = 0,2727- },2828-};2929-3030-/* uart registration process */3131-void __init s5p6442_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)3232-{3333- struct s3c2410_uartcfg *tcfg = cfg;3434- u32 ucnt;3535-3636- for (ucnt = 0; ucnt < no; ucnt++, tcfg++) {3737- if (!tcfg->clocks) {3838- tcfg->clocks = s5p6442_serial_clocks;3939- tcfg->clocks_size = ARRAY_SIZE(s5p6442_serial_clocks);4040- }4141- }4242-4343- s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no);4444-}
-102
arch/arm/mach-s5p6442/mach-smdk6442.c
···11-/* linux/arch/arm/mach-s5p6442/mach-smdk6442.c22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * This program is free software; you can redistribute it and/or modify77- * it under the terms of the GNU General Public License version 2 as88- * published by the Free Software Foundation.99-*/1010-1111-#include <linux/kernel.h>1212-#include <linux/types.h>1313-#include <linux/init.h>1414-#include <linux/serial_core.h>1515-#include <linux/i2c.h>1616-1717-#include <asm/mach/arch.h>1818-#include <asm/mach/map.h>1919-#include <asm/setup.h>2020-#include <asm/mach-types.h>2121-2222-#include <mach/map.h>2323-#include <mach/regs-clock.h>2424-2525-#include <plat/regs-serial.h>2626-#include <plat/s5p6442.h>2727-#include <plat/devs.h>2828-#include <plat/cpu.h>2929-#include <plat/iic.h>3030-3131-/* Following are default values for UCON, ULCON and UFCON UART registers */3232-#define SMDK6442_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \3333- S3C2410_UCON_RXILEVEL | \3434- S3C2410_UCON_TXIRQMODE | \3535- S3C2410_UCON_RXIRQMODE | \3636- S3C2410_UCON_RXFIFO_TOI | \3737- S3C2443_UCON_RXERR_IRQEN)3838-3939-#define SMDK6442_ULCON_DEFAULT S3C2410_LCON_CS84040-4141-#define SMDK6442_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \4242- S5PV210_UFCON_TXTRIG4 | \4343- S5PV210_UFCON_RXTRIG4)4444-4545-static struct s3c2410_uartcfg smdk6442_uartcfgs[] __initdata = {4646- [0] = {4747- .hwport = 0,4848- .flags = 0,4949- .ucon = SMDK6442_UCON_DEFAULT,5050- .ulcon = SMDK6442_ULCON_DEFAULT,5151- .ufcon = SMDK6442_UFCON_DEFAULT,5252- },5353- [1] = {5454- .hwport = 1,5555- .flags = 0,5656- .ucon = SMDK6442_UCON_DEFAULT,5757- .ulcon = SMDK6442_ULCON_DEFAULT,5858- .ufcon = SMDK6442_UFCON_DEFAULT,5959- },6060- [2] = {6161- .hwport = 2,6262- .flags = 0,6363- .ucon = SMDK6442_UCON_DEFAULT,6464- .ulcon = SMDK6442_ULCON_DEFAULT,6565- .ufcon = SMDK6442_UFCON_DEFAULT,6666- },6767-};6868-6969-static struct platform_device *smdk6442_devices[] __initdata = {7070- &s3c_device_i2c0,7171- &samsung_asoc_dma,7272- &s5p6442_device_iis0,7373- &s3c_device_wdt,7474-};7575-7676-static struct i2c_board_info smdk6442_i2c_devs0[] __initdata = {7777- { I2C_BOARD_INFO("wm8580", 0x1b), },7878-};7979-8080-static void __init smdk6442_map_io(void)8181-{8282- s5p_init_io(NULL, 0, S5P_VA_CHIPID);8383- s3c24xx_init_clocks(12000000);8484- s3c24xx_init_uarts(smdk6442_uartcfgs, ARRAY_SIZE(smdk6442_uartcfgs));8585-}8686-8787-static void __init smdk6442_machine_init(void)8888-{8989- s3c_i2c0_set_platdata(NULL);9090- i2c_register_board_info(0, smdk6442_i2c_devs0,9191- ARRAY_SIZE(smdk6442_i2c_devs0));9292- platform_add_devices(smdk6442_devices, ARRAY_SIZE(smdk6442_devices));9393-}9494-9595-MACHINE_START(SMDK6442, "SMDK6442")9696- /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */9797- .boot_params = S5P_PA_SDRAM + 0x100,9898- .init_irq = s5p6442_init_irq,9999- .map_io = smdk6442_map_io,100100- .init_machine = smdk6442_machine_init,101101- .timer = &s3c24xx_timer,102102-MACHINE_END
-28
arch/arm/mach-s5p6442/setup-i2c0.c
···11-/* linux/arch/arm/mach-s5p6442/setup-i2c0.c22- *33- * Copyright (c) 2009 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * I2C0 GPIO configuration.77- *88- * Based on plat-s3c64xx/setup-i2c0.c99- *1010- * This program is free software; you can redistribute it and/or modify1111- * it under the terms of the GNU General Public License version 2 as1212- * published by the Free Software Foundation.1313-*/1414-1515-#include <linux/kernel.h>1616-#include <linux/types.h>1717-#include <linux/gpio.h>1818-1919-struct platform_device; /* don't need the contents */2020-2121-#include <plat/gpio-cfg.h>2222-#include <plat/iic.h>2323-2424-void s3c_i2c0_cfg_gpio(struct platform_device *dev)2525-{2626- s3c_gpio_cfgall_range(S5P6442_GPD1(0), 2,2727- S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);2828-}
+1-1
arch/arm/plat-s5p/Kconfig
···7788config PLAT_S5P99 bool1010- depends on (ARCH_S5P64X0 || ARCH_S5P6442 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS4)1010+ depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS4)1111 default y1212 select ARM_VIC if !ARCH_EXYNOS41313 select ARM_GIC if ARCH_EXYNOS4
···11-/* arch/arm/plat-s5p/include/plat/s5p6442.h22- *33- * Copyright (c) 2010 Samsung Electronics Co., Ltd.44- * http://www.samsung.com/55- *66- * Header file for s5p6442 cpu support77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111-*/1212-1313-/* Common init code for S5P6442 related SoCs */1414-1515-extern void s5p6442_common_init_uarts(struct s3c2410_uartcfg *cfg, int no);1616-extern void s5p6442_register_clocks(void);1717-extern void s5p6442_setup_clocks(void);1818-1919-#ifdef CONFIG_CPU_S5P64422020-2121-extern int s5p6442_init(void);2222-extern void s5p6442_init_irq(void);2323-extern void s5p6442_map_io(void);2424-extern void s5p6442_init_clocks(int xtal);2525-2626-#define s5p6442_init_uarts s5p6442_common_init_uarts2727-2828-#else2929-#define s5p6442_init_clocks NULL3030-#define s5p6442_init_uarts NULL3131-#define s5p6442_map_io NULL3232-#define s5p6442_init NULL3333-#endif
···11111212#include <plat/regs-serial.h>13131414-/* The S5PV210/S5PC110 and S5P6442 implementations are as belows. */1414+/* The S5PV210/S5PC110 implementations are as belows. */15151616 .macro fifo_level_s5pv210 rd, rx1717 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
···194194#define S3C64XX_UINTSP 0x34195195#define S3C64XX_UINTM 0x38196196197197-/* Following are specific to S5PV210 and S5P6442 */197197+/* Following are specific to S5PV210 */198198#define S5PV210_UCON_CLKMASK (1<<10)199199#define S5PV210_UCON_PCLK (0<<10)200200#define S5PV210_UCON_UCLK (1<<10)
-1
arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
···6969extern void s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);7070extern void s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);7171extern void s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);7272-extern void s5p6442_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);73727473#endif /* __S3C64XX_PLAT_SPI_H */
+11-1
arch/powerpc/kernel/ptrace.c
···933933 if (data && !(data & DABR_TRANSLATION))934934 return -EIO;935935#ifdef CONFIG_HAVE_HW_BREAKPOINT936936+ if (ptrace_get_breakpoints(task) < 0)937937+ return -ESRCH;938938+936939 bp = thread->ptrace_bps[0];937940 if ((!data) || !(data & (DABR_DATA_WRITE | DABR_DATA_READ))) {938941 if (bp) {939942 unregister_hw_breakpoint(bp);940943 thread->ptrace_bps[0] = NULL;941944 }945945+ ptrace_put_breakpoints(task);942946 return 0;943947 }944948 if (bp) {···952948 (DABR_DATA_WRITE | DABR_DATA_READ),953949 &attr.bp_type);954950 ret = modify_user_hw_breakpoint(bp, &attr);955955- if (ret)951951+ if (ret) {952952+ ptrace_put_breakpoints(task);956953 return ret;954954+ }957955 thread->ptrace_bps[0] = bp;956956+ ptrace_put_breakpoints(task);958957 thread->dabr = data;959958 return 0;960959 }···972965 ptrace_triggered, task);973966 if (IS_ERR(bp)) {974967 thread->ptrace_bps[0] = NULL;968968+ ptrace_put_breakpoints(task);975969 return PTR_ERR(bp);976970 }971971+972972+ ptrace_put_breakpoints(task);977973978974#endif /* CONFIG_HAVE_HW_BREAKPOINT */979975
···608608 unsigned len, type;609609 struct perf_event *bp;610610611611+ if (ptrace_get_breakpoints(tsk) < 0)612612+ return -ESRCH;613613+611614 data &= ~DR_CONTROL_RESERVED;612615 old_dr7 = ptrace_get_dr7(thread->ptrace_bps);613616restore:···658655 }659656 goto restore;660657 }658658+659659+ ptrace_put_breakpoints(tsk);660660+661661 return ((orig_ret < 0) ? orig_ret : rc);662662}663663···674668675669 if (n < HBP_NUM) {676670 struct perf_event *bp;671671+672672+ if (ptrace_get_breakpoints(tsk) < 0)673673+ return -ESRCH;674674+677675 bp = thread->ptrace_bps[n];678676 if (!bp)679679- return 0;680680- val = bp->hw.info.address;677677+ val = 0;678678+ else679679+ val = bp->hw.info.address;680680+681681+ ptrace_put_breakpoints(tsk);681682 } else if (n == 6) {682683 val = thread->debugreg6;683684 } else if (n == 7) {···699686 struct perf_event *bp;700687 struct thread_struct *t = &tsk->thread;701688 struct perf_event_attr attr;689689+ int err = 0;690690+691691+ if (ptrace_get_breakpoints(tsk) < 0)692692+ return -ESRCH;702693703694 if (!t->ptrace_bps[nr]) {704695 ptrace_breakpoint_init(&attr);···726709 * writing for the user. And anyway this is the previous727710 * behaviour.728711 */729729- if (IS_ERR(bp))730730- return PTR_ERR(bp);712712+ if (IS_ERR(bp)) {713713+ err = PTR_ERR(bp);714714+ goto put;715715+ }731716732717 t->ptrace_bps[nr] = bp;733718 } else {734734- int err;735735-736719 bp = t->ptrace_bps[nr];737720738721 attr = bp->attr;739722 attr.bp_addr = addr;740723 err = modify_user_hw_breakpoint(bp, &attr);741741- if (err)742742- return err;743724 }744725745745-746746- return 0;726726+put:727727+ ptrace_put_breakpoints(tsk);728728+ return err;747729}748730749731/*
+2-2
drivers/block/rbd.c
···777777 ops,778778 false,779779 GFP_NOIO, pages, bio);780780- if (IS_ERR(req)) {780780+ if (!req) {781781 up_read(&header->snap_rwsem);782782- ret = PTR_ERR(req);782782+ ret = -ENOMEM;783783 goto done_pages;784784 }785785
+27-16
drivers/firewire/ohci.c
···21992199{22002200 struct fw_ohci *ohci;22012201 unsigned long flags;22022202- int ret = -EBUSY;22032202 __be32 *next_config_rom;22042203 dma_addr_t uninitialized_var(next_config_rom_bus);22052204···2239224022402241 spin_lock_irqsave(&ohci->lock, flags);2241224222432243+ /*22442244+ * If there is not an already pending config_rom update,22452245+ * push our new allocation into the ohci->next_config_rom22462246+ * and then mark the local variable as null so that we22472247+ * won't deallocate the new buffer.22482248+ *22492249+ * OTOH, if there is a pending config_rom update, just22502250+ * use that buffer with the new config_rom data, and22512251+ * let this routine free the unused DMA allocation.22522252+ */22532253+22422254 if (ohci->next_config_rom == NULL) {22432255 ohci->next_config_rom = next_config_rom;22442256 ohci->next_config_rom_bus = next_config_rom_bus;22452245-22462246- copy_config_rom(ohci->next_config_rom, config_rom, length);22472247-22482248- ohci->next_header = config_rom[0];22492249- ohci->next_config_rom[0] = 0;22502250-22512251- reg_write(ohci, OHCI1394_ConfigROMmap,22522252- ohci->next_config_rom_bus);22532253- ret = 0;22572257+ next_config_rom = NULL;22542258 }2255225922602260+ copy_config_rom(ohci->next_config_rom, config_rom, length);22612261+22622262+ ohci->next_header = config_rom[0];22632263+ ohci->next_config_rom[0] = 0;22642264+22652265+ reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus);22662266+22562267 spin_unlock_irqrestore(&ohci->lock, flags);22682268+22692269+ /* If we didn't use the DMA allocation, delete it. */22702270+ if (next_config_rom != NULL)22712271+ dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,22722272+ next_config_rom, next_config_rom_bus);2257227322582274 /*22592275 * Now initiate a bus reset to have the changes take···22772263 * controller could need to access it before the bus reset22782264 * takes effect.22792265 */22802280- if (ret == 0)22812281- fw_schedule_bus_reset(&ohci->card, true, true);22822282- else22832283- dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,22842284- next_config_rom, next_config_rom_bus);2285226622862286- return ret;22672267+ fw_schedule_bus_reset(&ohci->card, true, true);22682268+22692269+ return 0;22872270}2288227122892272static void ohci_send_request(struct fw_card *card, struct fw_packet *packet)
···5154515451555155 I915_WRITE(DSPCNTR(plane), dspcntr);51565156 POSTING_READ(DSPCNTR(plane));51575157- if (!HAS_PCH_SPLIT(dev))51585158- intel_enable_plane(dev_priv, plane, pipe);5159515751605158 ret = intel_pipe_set_base(crtc, x, y, old_fb);51615159···56035605 intel_clock_t clock;5604560656055607 if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0)56065606- fp = FP0(pipe);56085608+ fp = I915_READ(FP0(pipe));56075609 else56085608- fp = FP1(pipe);56105610+ fp = I915_READ(FP1(pipe));5609561156105612 clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT;56115613 if (IS_PINEVIEW(dev)) {···65776579 return ERR_PTR(-ENOENT);6578658065796581 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);65806580- if (!intel_fb)65826582+ if (!intel_fb) {65836583+ drm_gem_object_unreference_unlocked(&obj->base);65816584 return ERR_PTR(-ENOMEM);65856585+ }6582658665836587 ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj);65846588 if (ret) {
+15-2
drivers/gpu/drm/i915/intel_dp.c
···1470147014711471 if (!HAS_PCH_CPT(dev) &&14721472 I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) {14731473- struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc);14731473+ struct drm_crtc *crtc = intel_dp->base.base.crtc;14741474+14741475 /* Hardware workaround: leaving our transcoder select14751476 * set to transcoder B while it's off will prevent the14761477 * corresponding HDMI output on transcoder A.···14861485 /* Changes to enable or select take place the vblank14871486 * after being written.14881487 */14891489- intel_wait_for_vblank(dev, intel_crtc->pipe);14881488+ if (crtc == NULL) {14891489+ /* We can arrive here never having been attached14901490+ * to a CRTC, for instance, due to inheriting14911491+ * random state from the BIOS.14921492+ *14931493+ * If the pipe is not running, play safe and14941494+ * wait for the clocks to stabilise before14951495+ * continuing.14961496+ */14971497+ POSTING_READ(intel_dp->output_reg);14981498+ msleep(50);14991499+ } else15001500+ intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe);14901501 }1491150214921503 I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN);
+3
drivers/gpu/drm/i915/intel_lvds.c
···539539 struct drm_device *dev = dev_priv->dev;540540 struct drm_connector *connector = dev_priv->int_lvds_connector;541541542542+ if (dev->switch_power_state != DRM_SWITCH_POWER_ON)543543+ return NOTIFY_OK;544544+542545 /*543546 * check and update the status of LVDS connector after receiving544547 * the LID nofication event.
···431431 }432432 }433433434434- /* Acer laptop (Acer TravelMate 5730G) has an HDMI port434434+ /* Acer laptop (Acer TravelMate 5730/5730G) has an HDMI port435435 * on the laptop and a DVI port on the docking station and436436 * both share the same encoder, hpd pin, and ddc line.437437 * So while the bios table is technically correct,···440440 * with different crtcs which isn't possible on the hardware441441 * side and leaves no crtcs for LVDS or VGA.442442 */443443- if ((dev->pdev->device == 0x95c4) &&443443+ if (((dev->pdev->device == 0x95c4) || (dev->pdev->device == 0x9591)) &&444444 (dev->pdev->subsystem_vendor == 0x1025) &&445445 (dev->pdev->subsystem_device == 0x013c)) {446446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&
+27-2
drivers/gpu/drm/radeon/radeon_atpx_handler.c
···1515#define ATPX_VERSION 01616#define ATPX_GPU_PWR 21717#define ATPX_MUX_SELECT 31818+#define ATPX_I2C_MUX_SELECT 41919+#define ATPX_SWITCH_START 52020+#define ATPX_SWITCH_END 618211922#define ATPX_INTEGRATED 02023#define ATPX_DISCRETE 1···152149 return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id);153150}154151152152+static int radeon_atpx_switch_i2c_mux(acpi_handle handle, int mux_id)153153+{154154+ return radeon_atpx_execute(handle, ATPX_I2C_MUX_SELECT, mux_id);155155+}156156+157157+static int radeon_atpx_switch_start(acpi_handle handle, int gpu_id)158158+{159159+ return radeon_atpx_execute(handle, ATPX_SWITCH_START, gpu_id);160160+}161161+162162+static int radeon_atpx_switch_end(acpi_handle handle, int gpu_id)163163+{164164+ return radeon_atpx_execute(handle, ATPX_SWITCH_END, gpu_id);165165+}155166156167static int radeon_atpx_switchto(enum vga_switcheroo_client_id id)157168{169169+ int gpu_id;170170+158171 if (id == VGA_SWITCHEROO_IGD)159159- radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 0);172172+ gpu_id = ATPX_INTEGRATED;160173 else161161- radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 1);174174+ gpu_id = ATPX_DISCRETE;175175+176176+ radeon_atpx_switch_start(radeon_atpx_priv.atpx_handle, gpu_id);177177+ radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, gpu_id);178178+ radeon_atpx_switch_i2c_mux(radeon_atpx_priv.atpx_handle, gpu_id);179179+ radeon_atpx_switch_end(radeon_atpx_priv.atpx_handle, gpu_id);180180+162181 return 0;163182}164183
+3-3
drivers/gpu/drm/radeon/radeon_cursor.c
···167167 return -EINVAL;168168 }169169170170- radeon_crtc->cursor_width = width;171171- radeon_crtc->cursor_height = height;172172-173170 obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);174171 if (!obj) {175172 DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id);···176179 ret = radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &gpu_addr);177180 if (ret)178181 goto fail;182182+183183+ radeon_crtc->cursor_width = width;184184+ radeon_crtc->cursor_height = height;179185180186 radeon_lock_cursor(crtc, true);181187 /* XXX only 27 bit offset for legacy cursor */
+2
drivers/media/dvb/dvb-usb/Kconfig
···356356 select DVB_TDA826X if !DVB_FE_CUSTOMISE357357 select DVB_STV0288 if !DVB_FE_CUSTOMISE358358 select DVB_IX2505V if !DVB_FE_CUSTOMISE359359+ select DVB_STV0299 if !DVB_FE_CUSTOMISE360360+ select DVB_PLL if !DVB_FE_CUSTOMISE359361 help360362 Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 .361363
···376376 v4l_info(client, "chip found @ 0x%02x (%s)\n",377377 client->addr << 1, client->adapter->name);378378379379- state = kmalloc(sizeof(struct saa7706h_state), GFP_KERNEL);379379+ state = kzalloc(sizeof(struct saa7706h_state), GFP_KERNEL);380380 if (state == NULL)381381 return -ENOMEM;382382 sd = &state->sd;
+1-1
drivers/media/radio/tef6862.c
···176176 v4l_info(client, "chip found @ 0x%02x (%s)\n",177177 client->addr << 1, client->adapter->name);178178179179- state = kmalloc(sizeof(struct tef6862_state), GFP_KERNEL);179179+ state = kzalloc(sizeof(struct tef6862_state), GFP_KERNEL);180180 if (state == NULL)181181 return -ENOMEM;182182 state->freq = TEF6862_LO_FREQ;
+27-4
drivers/media/rc/imon.c
···4646#define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>"4747#define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display"4848#define MOD_NAME "imon"4949-#define MOD_VERSION "0.9.2"4949+#define MOD_VERSION "0.9.3"50505151#define DISPLAY_MINOR_BASE 1445252#define DEVICE_NAME "lcd%d"···460460}461461462462/**463463- * Sends a packet to the device -- this function must be called464464- * with ictx->lock held.463463+ * Sends a packet to the device -- this function must be called with464464+ * ictx->lock held, or its unlock/lock sequence while waiting for tx465465+ * to complete can/will lead to a deadlock.465466 */466467static int send_packet(struct imon_context *ictx)467468{···992991 * the iMON remotes, and those used by the Windows MCE remotes (which is993992 * really just RC-6), but only one or the other at a time, as the signals994993 * are decoded onboard the receiver.994994+ *995995+ * This function gets called two different ways, one way is from996996+ * rc_register_device, for initial protocol selection/setup, and the other is997997+ * via a userspace-initiated protocol change request, either by direct sysfs998998+ * prodding or by something like ir-keytable. In the rc_register_device case,999999+ * the imon context lock is already held, but when initiated from userspace,10001000+ * it is not, so we must acquire it prior to calling send_packet, which10011001+ * requires that the lock is held.9951002 */9961003static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)9971004{9981005 int retval;9991006 struct imon_context *ictx = rc->priv;10001007 struct device *dev = ictx->dev;10081008+ bool unlock = false;10011009 unsigned char ir_proto_packet[] = {10021010 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 };10031011···1039102910401030 memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet));1041103110321032+ if (!mutex_is_locked(&ictx->lock)) {10331033+ unlock = true;10341034+ mutex_lock(&ictx->lock);10351035+ }10361036+10421037 retval = send_packet(ictx);10431038 if (retval)10441039 goto out;···10521037 ictx->pad_mouse = false;1053103810541039out:10401040+ if (unlock)10411041+ mutex_unlock(&ictx->lock);10421042+10551043 return retval;10561044}10571045···21522134 goto rdev_setup_failed;21532135 }2154213621372137+ mutex_unlock(&ictx->lock);21552138 return ictx;2156213921572140rdev_setup_failed:···22242205 goto urb_submit_failed;22252206 }2226220722082208+ mutex_unlock(&ictx->lock);22272209 return ictx;2228221022292211urb_submit_failed:···23192299 usb_set_intfdata(interface, ictx);2320230023212301 if (ifnum == 0) {23022302+ mutex_lock(&ictx->lock);23032303+23222304 if (product == 0xffdc && ictx->rf_device) {23232305 sysfs_err = sysfs_create_group(&interface->dev.kobj,23242306 &imon_rf_attr_group);···2331230923322310 if (ictx->display_supported)23332311 imon_init_display(ictx, interface);23122312+23132313+ mutex_unlock(&ictx->lock);23342314 }2335231523362316 dev_info(dev, "iMON device (%04x:%04x, intf%d) on "23372317 "usb<%d:%d> initialized\n", vendor, product, ifnum,23382318 usbdev->bus->busnum, usbdev->devnum);2339231923402340- mutex_unlock(&ictx->lock);23412320 mutex_unlock(&driver_lock);2342232123432322 return 0;
···400400static void scsi_run_queue(struct request_queue *q)401401{402402 struct scsi_device *sdev = q->queuedata;403403- struct Scsi_Host *shost = sdev->host;403403+ struct Scsi_Host *shost;404404 LIST_HEAD(starved_list);405405 unsigned long flags;406406407407+ /* if the device is dead, sdev will be NULL, so no queue to run */408408+ if (!sdev)409409+ return;410410+411411+ shost = sdev->host;407412 if (scsi_target(sdev)->single_lun)408413 scsi_single_lun_run(sdev);409414
···777777 if (t1 != t2)778778 xhci_writel(xhci, t2, port_array[port_index]);779779780780- if (DEV_HIGHSPEED(t1)) {780780+ if (hcd->speed != HCD_USB3) {781781 /* enable remote wake up for USB 2.0 */782782 u32 __iomem *addr;783783 u32 tmp;···866866 temp |= PORT_LINK_STROBE | XDEV_U0;867867 xhci_writel(xhci, temp, port_array[port_index]);868868 }869869+ /* wait for the port to enter U0 and report port link870870+ * state change.871871+ */872872+ spin_unlock_irqrestore(&xhci->lock, flags);873873+ msleep(20);874874+ spin_lock_irqsave(&xhci->lock, flags);875875+876876+ /* Clear PLC */877877+ temp = xhci_readl(xhci, port_array[port_index]);878878+ if (temp & PORT_PLC) {879879+ temp = xhci_port_state_to_neutral(temp);880880+ temp |= PORT_PLC;881881+ xhci_writel(xhci, temp, port_array[port_index]);882882+ }883883+869884 slot_id = xhci_find_slot_id_by_port(hcd,870885 xhci, port_index + 1);871886 if (slot_id)···888873 } else889874 xhci_writel(xhci, temp, port_array[port_index]);890875891891- if (DEV_HIGHSPEED(temp)) {876876+ if (hcd->speed != HCD_USB3) {892877 /* disable remote wake up for USB 2.0 */893878 u32 __iomem *addr;894879 u32 tmp;
+2-4
drivers/usb/musb/musb_gadget.c
···18871887 otg_set_vbus(musb->xceiv, 1);1888188818891889 hcd->self.uses_pio_for_control = 1;18901890-18911891- if (musb->xceiv->last_event == USB_EVENT_NONE)18921892- pm_runtime_put(musb->controller);18931893-18941890 }18911891+ if (musb->xceiv->last_event == USB_EVENT_NONE)18921892+ pm_runtime_put(musb->controller);1895189318961894 return 0;18971895
+1-1
drivers/usb/musb/omap2430.c
···270270 DBG(4, "VBUS Disconnect\n");271271272272#ifdef CONFIG_USB_GADGET_MUSB_HDRC273273- if (is_otg_enabled(musb))273273+ if (is_otg_enabled(musb) || is_peripheral_enabled(musb))274274 if (musb->gadget_driver)275275#endif276276 {
···13311331}1332133213331333/*13341334- * Mark caps dirty. If inode is newly dirty, add to the global dirty13351335- * list.13341334+ * Mark caps dirty. If inode is newly dirty, return the dirty flags.13351335+ * Caller is then responsible for calling __mark_inode_dirty with the13361336+ * returned flags value.13361337 */13371337-void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)13381338+int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)13381339{13391340 struct ceph_mds_client *mdsc =13401341 ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;···13581357 list_add(&ci->i_dirty_item, &mdsc->cap_dirty);13591358 spin_unlock(&mdsc->cap_dirty_lock);13601359 if (ci->i_flushing_caps == 0) {13611361- igrab(inode);13601360+ ihold(inode);13621361 dirty |= I_DIRTY_SYNC;13631362 }13641363 }···13661365 if (((was | ci->i_flushing_caps) & CEPH_CAP_FILE_BUFFER) &&13671366 (mask & CEPH_CAP_FILE_BUFFER))13681367 dirty |= I_DIRTY_DATASYNC;13691369- if (dirty)13701370- __mark_inode_dirty(inode, dirty);13711368 __cap_delay_requeue(mdsc, ci);13691369+ return dirty;13721370}1373137113741372/*···19911991 ci->i_wr_ref++;19921992 if (got & CEPH_CAP_FILE_BUFFER) {19931993 if (ci->i_wrbuffer_ref == 0)19941994- igrab(&ci->vfs_inode);19941994+ ihold(&ci->vfs_inode);19951995 ci->i_wrbuffer_ref++;19961996 dout("__take_cap_refs %p wrbuffer %d -> %d (?)\n",19971997 &ci->vfs_inode, ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref);
+4-1
fs/ceph/file.c
···734734 }735735 }736736 if (ret >= 0) {737737+ int dirty;737738 spin_lock(&inode->i_lock);738738- __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR);739739+ dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR);739740 spin_unlock(&inode->i_lock);741741+ if (dirty)742742+ __mark_inode_dirty(inode, dirty);740743 }741744742745out:
+5-1
fs/ceph/inode.c
···15671567 int release = 0, dirtied = 0;15681568 int mask = 0;15691569 int err = 0;15701570+ int inode_dirty_flags = 0;1570157115711572 if (ceph_snap(inode) != CEPH_NOSNAP)15721573 return -EROFS;···17261725 dout("setattr %p ATTR_FILE ... hrm!\n", inode);1727172617281727 if (dirtied) {17291729- __ceph_mark_dirty_caps(ci, dirtied);17281728+ inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied);17301729 inode->i_ctime = CURRENT_TIME;17311730 }1732173117331732 release &= issued;17341733 spin_unlock(&inode->i_lock);17341734+17351735+ if (inode_dirty_flags)17361736+ __mark_inode_dirty(inode, inode_dirty_flags);1735173717361738 if (mask) {17371739 req->r_inode = igrab(inode);
+1-1
fs/ceph/super.h
···506506{507507 return ci->i_dirty_caps | ci->i_flushing_caps;508508}509509-extern void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask);509509+extern int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask);510510511511extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask);512512extern int __ceph_caps_used(struct ceph_inode_info *ci);
+8-4
fs/ceph/xattr.c
···703703 struct ceph_inode_xattr *xattr = NULL;704704 int issued;705705 int required_blob_size;706706+ int dirty;706707707708 if (ceph_snap(inode) != CEPH_NOSNAP)708709 return -EROFS;···764763 dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued));765764 err = __set_xattr(ci, newname, name_len, newval,766765 val_len, 1, 1, 1, &xattr);767767- __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);766766+ dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);768767 ci->i_xattrs.dirty = true;769768 inode->i_ctime = CURRENT_TIME;770769 spin_unlock(&inode->i_lock);771771-770770+ if (dirty)771771+ __mark_inode_dirty(inode, dirty);772772 return err;773773774774do_sync:···812810 struct ceph_vxattr_cb *vxattrs = ceph_inode_vxattrs(inode);813811 int issued;814812 int err;813813+ int dirty;815814816815 if (ceph_snap(inode) != CEPH_NOSNAP)817816 return -EROFS;···836833 goto do_sync;837834838835 err = __remove_xattr_by_name(ceph_inode(inode), name);839839- __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);836836+ dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);840837 ci->i_xattrs.dirty = true;841838 inode->i_ctime = CURRENT_TIME;842839843840 spin_unlock(&inode->i_lock);844844-841841+ if (dirty)842842+ __mark_inode_dirty(inode, dirty);845843 return err;846844do_sync:847845 spin_unlock(&inode->i_lock);
+68-54
fs/cifs/connect.c
···274274 char *data_area_of_target;275275 char *data_area_of_buf2;276276 int remaining;277277- __u16 byte_count, total_data_size, total_in_buf, total_in_buf2;277277+ unsigned int byte_count, total_in_buf;278278+ __u16 total_data_size, total_in_buf2;278279279280 total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount);280281···288287 remaining = total_data_size - total_in_buf;289288290289 if (remaining < 0)291291- return -EINVAL;290290+ return -EPROTO;292291293292 if (remaining == 0) /* nothing to do, ignore */294293 return 0;···309308 data_area_of_target += total_in_buf;310309311310 /* copy second buffer into end of first buffer */312312- memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2);313311 total_in_buf += total_in_buf2;312312+ /* is the result too big for the field? */313313+ if (total_in_buf > USHRT_MAX)314314+ return -EPROTO;314315 put_unaligned_le16(total_in_buf, &pSMBt->t2_rsp.DataCount);316316+317317+ /* fix up the BCC */315318 byte_count = get_bcc_le(pTargetSMB);316319 byte_count += total_in_buf2;320320+ /* is the result too big for the field? */321321+ if (byte_count > USHRT_MAX)322322+ return -EPROTO;317323 put_bcc_le(byte_count, pTargetSMB);318324319325 byte_count = pTargetSMB->smb_buf_length;320326 byte_count += total_in_buf2;321321-322322- /* BB also add check that we are not beyond maximum buffer size */323323-327327+ /* don't allow buffer to overflow */328328+ if (byte_count > CIFSMaxBufSize)329329+ return -ENOBUFS;324330 pTargetSMB->smb_buf_length = byte_count;331331+332332+ memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2);325333326334 if (remaining == total_in_buf2) {327335 cFYI(1, "found the last secondary response");···617607 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {618608 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);619609620620- if ((mid_entry->mid == smb_buffer->Mid) &&621621- (mid_entry->midState == MID_REQUEST_SUBMITTED) &&622622- (mid_entry->command == smb_buffer->Command)) {623623- if (length == 0 &&624624- check2ndT2(smb_buffer, server->maxBuf) > 0) {625625- /* We have a multipart transact2 resp */626626- isMultiRsp = true;627627- if (mid_entry->resp_buf) {628628- /* merge response - fix up 1st*/629629- if (coalesce_t2(smb_buffer,630630- mid_entry->resp_buf)) {631631- mid_entry->multiRsp =632632- true;633633- break;634634- } else {635635- /* all parts received */636636- mid_entry->multiEnd =637637- true;638638- goto multi_t2_fnd;639639- }610610+ if (mid_entry->mid != smb_buffer->Mid ||611611+ mid_entry->midState != MID_REQUEST_SUBMITTED ||612612+ mid_entry->command != smb_buffer->Command) {613613+ mid_entry = NULL;614614+ continue;615615+ }616616+617617+ if (length == 0 &&618618+ check2ndT2(smb_buffer, server->maxBuf) > 0) {619619+ /* We have a multipart transact2 resp */620620+ isMultiRsp = true;621621+ if (mid_entry->resp_buf) {622622+ /* merge response - fix up 1st*/623623+ length = coalesce_t2(smb_buffer,624624+ mid_entry->resp_buf);625625+ if (length > 0) {626626+ length = 0;627627+ mid_entry->multiRsp = true;628628+ break;640629 } else {641641- if (!isLargeBuf) {642642- cERROR(1, "1st trans2 resp needs bigbuf");643643- /* BB maybe we can fix this up, switch644644- to already allocated large buffer? */645645- } else {646646- /* Have first buffer */647647- mid_entry->resp_buf =648648- smb_buffer;649649- mid_entry->largeBuf =650650- true;651651- bigbuf = NULL;652652- }630630+ /* all parts received or631631+ * packet is malformed632632+ */633633+ mid_entry->multiEnd = true;634634+ goto multi_t2_fnd;653635 }654654- break;636636+ } else {637637+ if (!isLargeBuf) {638638+ /*639639+ * FIXME: switch to already640640+ * allocated largebuf?641641+ */642642+ cERROR(1, "1st trans2 resp "643643+ "needs bigbuf");644644+ } else {645645+ /* Have first buffer */646646+ mid_entry->resp_buf =647647+ smb_buffer;648648+ mid_entry->largeBuf = true;649649+ bigbuf = NULL;650650+ }655651 }656656- mid_entry->resp_buf = smb_buffer;657657- mid_entry->largeBuf = isLargeBuf;658658-multi_t2_fnd:659659- if (length == 0)660660- mid_entry->midState =661661- MID_RESPONSE_RECEIVED;662662- else663663- mid_entry->midState =664664- MID_RESPONSE_MALFORMED;665665-#ifdef CONFIG_CIFS_STATS2666666- mid_entry->when_received = jiffies;667667-#endif668668- list_del_init(&mid_entry->qhead);669669- mid_entry->callback(mid_entry);670652 break;671653 }672672- mid_entry = NULL;654654+ mid_entry->resp_buf = smb_buffer;655655+ mid_entry->largeBuf = isLargeBuf;656656+multi_t2_fnd:657657+ if (length == 0)658658+ mid_entry->midState = MID_RESPONSE_RECEIVED;659659+ else660660+ mid_entry->midState = MID_RESPONSE_MALFORMED;661661+#ifdef CONFIG_CIFS_STATS2662662+ mid_entry->when_received = jiffies;663663+#endif664664+ list_del_init(&mid_entry->qhead);665665+ mid_entry->callback(mid_entry);666666+ break;673667 }674668 spin_unlock(&GlobalMid_Lock);675669
+4-15
fs/cifs/sess.c
···276276}277277278278static void279279-decode_unicode_ssetup(char **pbcc_area, __u16 bleft, struct cifsSesInfo *ses,279279+decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,280280 const struct nls_table *nls_cp)281281{282282 int len;283283 char *data = *pbcc_area;284284285285 cFYI(1, "bleft %d", bleft);286286-287287- /*288288- * Windows servers do not always double null terminate their final289289- * Unicode string. Check to see if there are an uneven number of bytes290290- * left. If so, then add an extra NULL pad byte to the end of the291291- * response.292292- *293293- * See section 2.7.2 in "Implementing CIFS" for details294294- */295295- if (bleft % 2) {296296- data[bleft] = 0;297297- ++bleft;298298- }299286300287 kfree(ses->serverOS);301288 ses->serverOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp);···916929 }917930918931 /* BB check if Unicode and decode strings */919919- if (smb_buf->Flags2 & SMBFLG2_UNICODE) {932932+ if (bytes_remaining == 0) {933933+ /* no string area to decode, do nothing */934934+ } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) {920935 /* unicode string area must be word-aligned */921936 if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) {922937 ++bcc_ptr;
-1
fs/hpfs/Kconfig
···11config HPFS_FS22 tristate "OS/2 HPFS file system support"33 depends on BLOCK44- depends on BROKEN || !PREEMPT54 help65 OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS76 is the file system used for organizing files on OS/2 hard disk
+43-75
fs/hpfs/alloc.c
···8899#include "hpfs_fn.h"10101111-static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec);1212-1311/*1412 * Check if a sector is allocated in bitmap1513 * This is really slow. Turned on only if chk==2···1618static int chk_if_allocated(struct super_block *s, secno sec, char *msg)1719{1820 struct quad_buffer_head qbh;1919- unsigned *bmp;2121+ u32 *bmp;2022 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail;2121- if ((bmp[(sec & 0x3fff) >> 5] >> (sec & 0x1f)) & 1) {2323+ if ((cpu_to_le32(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f)) & 1) {2224 hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec);2325 goto fail1;2426 }···2628 if (sec >= hpfs_sb(s)->sb_dirband_start && sec < hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dirband_size) {2729 unsigned ssec = (sec - hpfs_sb(s)->sb_dirband_start) / 4;2830 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto fail;2929- if ((bmp[ssec >> 5] >> (ssec & 0x1f)) & 1) {3131+ if ((le32_to_cpu(bmp[ssec >> 5]) >> (ssec & 0x1f)) & 1) {3032 hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec);3133 goto fail1;3234 }···7375 hpfs_error(s, "Bad allocation size: %d", n);7476 return 0;7577 }7676- lock_super(s);7778 if (bs != ~0x3fff) {7879 if (!(bmp = hpfs_map_bitmap(s, near >> 14, &qbh, "aib"))) goto uls;7980 } else {···8285 ret = bs + nr;8386 goto rt;8487 }8585- /*if (!tstbits(bmp, nr + n, n + forward)) {8686- ret = bs + nr + n;8787- goto rt;8888- }*/8988 q = nr + n; b = 0;9089 while ((a = tstbits(bmp, q, n + forward)) != 0) {9190 q += a;···98105 goto rt;99106 }100107 nr >>= 5;101101- /*for (i = nr + 1; i != nr; i++, i &= 0x1ff) {*/108108+ /*for (i = nr + 1; i != nr; i++, i &= 0x1ff) */102109 i = nr;103110 do {104104- if (!bmp[i]) goto cont;105105- if (n + forward >= 0x3f && bmp[i] != -1) goto cont;111111+ if (!le32_to_cpu(bmp[i])) goto cont;112112+ if (n + forward >= 0x3f && le32_to_cpu(bmp[i]) != 0xffffffff) goto cont;106113 q = i<<5;107114 if (i > 0) {108108- unsigned k = bmp[i-1];115115+ unsigned k = le32_to_cpu(bmp[i-1]);109116 while (k & 0x80000000) {110117 q--; k <<= 1;111118 }···125132 } while (i != nr);126133 rt:127134 if (ret) {128128- if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (bmp[(ret & 0x3fff) >> 5] | ~(((1 << n) - 1) << (ret & 0x1f))) != 0xffffffff)) {135135+ if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (le32_to_cpu(bmp[(ret & 0x3fff) >> 5]) | ~(((1 << n) - 1) << (ret & 0x1f))) != 0xffffffff)) {129136 hpfs_error(s, "Allocation doesn't work! Wanted %d, allocated at %08x", n, ret);130137 ret = 0;131138 goto b;132139 }133133- bmp[(ret & 0x3fff) >> 5] &= ~(((1 << n) - 1) << (ret & 0x1f));140140+ bmp[(ret & 0x3fff) >> 5] &= cpu_to_le32(~(((1 << n) - 1) << (ret & 0x1f)));134141 hpfs_mark_4buffers_dirty(&qbh);135142 }136143 b:137144 hpfs_brelse4(&qbh);138145 uls:139139- unlock_super(s);140146 return ret;141147}142148···147155 * sectors148156 */149157150150-secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward, int lock)158158+secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward)151159{152160 secno sec;153161 int i;···159167 forward = -forward;160168 f_p = 1;161169 }162162- if (lock) hpfs_lock_creation(s);163170 n_bmps = (sbi->sb_fs_size + 0x4000 - 1) >> 14;164171 if (near && near < sbi->sb_fs_size) {165172 if ((sec = alloc_in_bmp(s, near, n, f_p ? forward : forward/4))) goto ret;···205214 ret:206215 if (sec && f_p) {207216 for (i = 0; i < forward; i++) {208208- if (!hpfs_alloc_if_possible_nolock(s, sec + i + 1)) {217217+ if (!hpfs_alloc_if_possible(s, sec + i + 1)) {209218 hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, sec, i);210219 sec = 0;211220 break;212221 }213222 }214223 }215215- if (lock) hpfs_unlock_creation(s);216224 return sec;217225}218226219219-static secno alloc_in_dirband(struct super_block *s, secno near, int lock)227227+static secno alloc_in_dirband(struct super_block *s, secno near)220228{221229 unsigned nr = near;222230 secno sec;···226236 nr = sbi->sb_dirband_start + sbi->sb_dirband_size - 4;227237 nr -= sbi->sb_dirband_start;228238 nr >>= 2;229229- if (lock) hpfs_lock_creation(s);230239 sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0);231231- if (lock) hpfs_unlock_creation(s);232240 if (!sec) return 0;233241 return ((sec & 0x3fff) << 2) + sbi->sb_dirband_start;234242}235243236244/* Alloc sector if it's free */237245238238-static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec)246246+int hpfs_alloc_if_possible(struct super_block *s, secno sec)239247{240248 struct quad_buffer_head qbh;241241- unsigned *bmp;242242- lock_super(s);249249+ u32 *bmp;243250 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end;244244- if (bmp[(sec & 0x3fff) >> 5] & (1 << (sec & 0x1f))) {245245- bmp[(sec & 0x3fff) >> 5] &= ~(1 << (sec & 0x1f));251251+ if (le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) & (1 << (sec & 0x1f))) {252252+ bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f)));246253 hpfs_mark_4buffers_dirty(&qbh);247254 hpfs_brelse4(&qbh);248248- unlock_super(s);249255 return 1;250256 }251257 hpfs_brelse4(&qbh);252258 end:253253- unlock_super(s);254259 return 0;255255-}256256-257257-int hpfs_alloc_if_possible(struct super_block *s, secno sec)258258-{259259- int r;260260- hpfs_lock_creation(s);261261- r = hpfs_alloc_if_possible_nolock(s, sec);262262- hpfs_unlock_creation(s);263263- return r;264260}265261266262/* Free sectors in bitmaps */···254278void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n)255279{256280 struct quad_buffer_head qbh;257257- unsigned *bmp;281281+ u32 *bmp;258282 struct hpfs_sb_info *sbi = hpfs_sb(s);259283 /*printk("2 - ");*/260284 if (!n) return;···262286 hpfs_error(s, "Trying to free reserved sector %08x", sec);263287 return;264288 }265265- lock_super(s);266289 sbi->sb_max_fwd_alloc += n > 0xffff ? 0xffff : n;267290 if (sbi->sb_max_fwd_alloc > 0xffffff) sbi->sb_max_fwd_alloc = 0xffffff;268291 new_map:269292 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "free"))) {270270- unlock_super(s);271293 return;272294 } 273295 new_tst:274274- if ((bmp[(sec & 0x3fff) >> 5] >> (sec & 0x1f) & 1)) {296296+ if ((le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f) & 1)) {275297 hpfs_error(s, "sector %08x not allocated", sec);276298 hpfs_brelse4(&qbh);277277- unlock_super(s);278299 return;279300 }280280- bmp[(sec & 0x3fff) >> 5] |= 1 << (sec & 0x1f);301301+ bmp[(sec & 0x3fff) >> 5] |= cpu_to_le32(1 << (sec & 0x1f));281302 if (!--n) {282303 hpfs_mark_4buffers_dirty(&qbh);283304 hpfs_brelse4(&qbh);284284- unlock_super(s);285305 return;286306 } 287307 if (!(++sec & 0x3fff)) {···299327 int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14;300328 int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff;301329 int i, j;302302- unsigned *bmp;330330+ u32 *bmp;303331 struct quad_buffer_head qbh;304332 if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) {305333 for (j = 0; j < 512; j++) {306334 unsigned k;307307- if (!bmp[j]) continue;308308- for (k = bmp[j]; k; k >>= 1) if (k & 1) if (!--n) {335335+ if (!le32_to_cpu(bmp[j])) continue;336336+ for (k = le32_to_cpu(bmp[j]); k; k >>= 1) if (k & 1) if (!--n) {309337 hpfs_brelse4(&qbh);310338 return 0;311339 }···324352 chk_bmp:325353 if (bmp) {326354 for (j = 0; j < 512; j++) {327327- unsigned k;328328- if (!bmp[j]) continue;355355+ u32 k;356356+ if (!le32_to_cpu(bmp[j])) continue;329357 for (k = 0xf; k; k <<= 4)330330- if ((bmp[j] & k) == k) {358358+ if ((le32_to_cpu(bmp[j]) & k) == k) {331359 if (!--n) {332360 hpfs_brelse4(&qbh);333361 return 0;···351379 hpfs_free_sectors(s, dno, 4);352380 } else {353381 struct quad_buffer_head qbh;354354- unsigned *bmp;382382+ u32 *bmp;355383 unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4;356356- lock_super(s);357384 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) {358358- unlock_super(s);359385 return;360386 }361361- bmp[ssec >> 5] |= 1 << (ssec & 0x1f);387387+ bmp[ssec >> 5] |= cpu_to_le32(1 << (ssec & 0x1f));362388 hpfs_mark_4buffers_dirty(&qbh);363389 hpfs_brelse4(&qbh);364364- unlock_super(s);365390 }366391}367392368393struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near,369369- dnode_secno *dno, struct quad_buffer_head *qbh,370370- int lock)394394+ dnode_secno *dno, struct quad_buffer_head *qbh)371395{372396 struct dnode *d;373397 if (hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_dmap) > FREE_DNODES_ADD) {374374- if (!(*dno = alloc_in_dirband(s, near, lock)))375375- if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock))) return NULL;398398+ if (!(*dno = alloc_in_dirband(s, near)))399399+ if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) return NULL;376400 } else {377377- if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock)))378378- if (!(*dno = alloc_in_dirband(s, near, lock))) return NULL;401401+ if (!(*dno = hpfs_alloc_sector(s, near, 4, 0)))402402+ if (!(*dno = alloc_in_dirband(s, near))) return NULL;379403 }380404 if (!(d = hpfs_get_4sectors(s, *dno, qbh))) {381405 hpfs_free_dnode(s, *dno);382406 return NULL;383407 }384408 memset(d, 0, 2048);385385- d->magic = DNODE_MAGIC;386386- d->first_free = 52;409409+ d->magic = cpu_to_le32(DNODE_MAGIC);410410+ d->first_free = cpu_to_le32(52);387411 d->dirent[0] = 32;388412 d->dirent[2] = 8;389413 d->dirent[30] = 1;390414 d->dirent[31] = 255;391391- d->self = *dno;415415+ d->self = cpu_to_le32(*dno);392416 return d;393417}394418···392424 struct buffer_head **bh)393425{394426 struct fnode *f;395395- if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD, 1))) return NULL;427427+ if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD))) return NULL;396428 if (!(f = hpfs_get_sector(s, *fno, bh))) {397429 hpfs_free_sectors(s, *fno, 1);398430 return NULL;399431 } 400432 memset(f, 0, 512);401401- f->magic = FNODE_MAGIC;402402- f->ea_offs = 0xc4;433433+ f->magic = cpu_to_le32(FNODE_MAGIC);434434+ f->ea_offs = cpu_to_le16(0xc4);403435 f->btree.n_free_nodes = 8;404404- f->btree.first_free = 8;436436+ f->btree.first_free = cpu_to_le16(8);405437 return f;406438}407439···409441 struct buffer_head **bh)410442{411443 struct anode *a;412412- if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD, 1))) return NULL;444444+ if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD))) return NULL;413445 if (!(a = hpfs_get_sector(s, *ano, bh))) {414446 hpfs_free_sectors(s, *ano, 1);415447 return NULL;416448 }417449 memset(a, 0, 512);418418- a->magic = ANODE_MAGIC;419419- a->self = *ano;450450+ a->magic = cpu_to_le32(ANODE_MAGIC);451451+ a->self = cpu_to_le32(*ano);420452 a->btree.n_free_nodes = 40;421453 a->btree.n_used_nodes = 0;422422- a->btree.first_free = 8;454454+ a->btree.first_free = cpu_to_le16(8);423455 return a;424456}
+69-69
fs/hpfs/anode.c
···2222 if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, a, &c1, &c2, "hpfs_bplus_lookup")) return -1;2323 if (btree->internal) {2424 for (i = 0; i < btree->n_used_nodes; i++)2525- if (btree->u.internal[i].file_secno > sec) {2626- a = btree->u.internal[i].down;2525+ if (le32_to_cpu(btree->u.internal[i].file_secno) > sec) {2626+ a = le32_to_cpu(btree->u.internal[i].down);2727 brelse(bh);2828 if (!(anode = hpfs_map_anode(s, a, &bh))) return -1;2929 btree = &anode->btree;···3434 return -1;3535 }3636 for (i = 0; i < btree->n_used_nodes; i++)3737- if (btree->u.external[i].file_secno <= sec &&3838- btree->u.external[i].file_secno + btree->u.external[i].length > sec) {3939- a = btree->u.external[i].disk_secno + sec - btree->u.external[i].file_secno;3737+ if (le32_to_cpu(btree->u.external[i].file_secno) <= sec &&3838+ le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) > sec) {3939+ a = le32_to_cpu(btree->u.external[i].disk_secno) + sec - le32_to_cpu(btree->u.external[i].file_secno);4040 if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, a, 1, "data")) {4141 brelse(bh);4242 return -1;4343 }4444 if (inode) {4545 struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);4646- hpfs_inode->i_file_sec = btree->u.external[i].file_secno;4747- hpfs_inode->i_disk_sec = btree->u.external[i].disk_secno;4848- hpfs_inode->i_n_secs = btree->u.external[i].length;4646+ hpfs_inode->i_file_sec = le32_to_cpu(btree->u.external[i].file_secno);4747+ hpfs_inode->i_disk_sec = le32_to_cpu(btree->u.external[i].disk_secno);4848+ hpfs_inode->i_n_secs = le32_to_cpu(btree->u.external[i].length);4949 }5050 brelse(bh);5151 return a;···8383 return -1;8484 }8585 if (btree->internal) {8686- a = btree->u.internal[n].down;8787- btree->u.internal[n].file_secno = -1;8686+ a = le32_to_cpu(btree->u.internal[n].down);8787+ btree->u.internal[n].file_secno = cpu_to_le32(-1);8888 mark_buffer_dirty(bh);8989 brelse(bh);9090 if (hpfs_sb(s)->sb_chk)···9494 goto go_down;9595 }9696 if (n >= 0) {9797- if (btree->u.external[n].file_secno + btree->u.external[n].length != fsecno) {9797+ if (le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length) != fsecno) {9898 hpfs_error(s, "allocated size %08x, trying to add sector %08x, %cnode %08x",9999- btree->u.external[n].file_secno + btree->u.external[n].length, fsecno,9999+ le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length), fsecno,100100 fnod?'f':'a', node);101101 brelse(bh);102102 return -1;103103 }104104- if (hpfs_alloc_if_possible(s, se = btree->u.external[n].disk_secno + btree->u.external[n].length)) {105105- btree->u.external[n].length++;104104+ if (hpfs_alloc_if_possible(s, se = le32_to_cpu(btree->u.external[n].disk_secno) + le32_to_cpu(btree->u.external[n].length))) {105105+ btree->u.external[n].length = cpu_to_le32(le32_to_cpu(btree->u.external[n].length) + 1);106106 mark_buffer_dirty(bh);107107 brelse(bh);108108 return se;···115115 }116116 se = !fnod ? node : (node + 16384) & ~16383;117117 } 118118- if (!(se = hpfs_alloc_sector(s, se, 1, fsecno*ALLOC_M>ALLOC_FWD_MAX ? ALLOC_FWD_MAX : fsecno*ALLOC_M<ALLOC_FWD_MIN ? ALLOC_FWD_MIN : fsecno*ALLOC_M, 1))) {118118+ if (!(se = hpfs_alloc_sector(s, se, 1, fsecno*ALLOC_M>ALLOC_FWD_MAX ? ALLOC_FWD_MAX : fsecno*ALLOC_M<ALLOC_FWD_MIN ? ALLOC_FWD_MIN : fsecno*ALLOC_M))) {119119 brelse(bh);120120 return -1;121121 }122122- fs = n < 0 ? 0 : btree->u.external[n].file_secno + btree->u.external[n].length;122122+ fs = n < 0 ? 0 : le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length);123123 if (!btree->n_free_nodes) {124124- up = a != node ? anode->up : -1;124124+ up = a != node ? le32_to_cpu(anode->up) : -1;125125 if (!(anode = hpfs_alloc_anode(s, a, &na, &bh1))) {126126 brelse(bh);127127 hpfs_free_sectors(s, se, 1);128128 return -1;129129 }130130 if (a == node && fnod) {131131- anode->up = node;131131+ anode->up = cpu_to_le32(node);132132 anode->btree.fnode_parent = 1;133133 anode->btree.n_used_nodes = btree->n_used_nodes;134134 anode->btree.first_free = btree->first_free;···137137 btree->internal = 1;138138 btree->n_free_nodes = 11;139139 btree->n_used_nodes = 1;140140- btree->first_free = (char *)&(btree->u.internal[1]) - (char *)btree;141141- btree->u.internal[0].file_secno = -1;142142- btree->u.internal[0].down = na;140140+ btree->first_free = cpu_to_le16((char *)&(btree->u.internal[1]) - (char *)btree);141141+ btree->u.internal[0].file_secno = cpu_to_le32(-1);142142+ btree->u.internal[0].down = cpu_to_le32(na);143143 mark_buffer_dirty(bh);144144 } else if (!(ranode = hpfs_alloc_anode(s, /*a*/0, &ra, &bh2))) {145145 brelse(bh);···153153 btree = &anode->btree;154154 }155155 btree->n_free_nodes--; n = btree->n_used_nodes++;156156- btree->first_free += 12;157157- btree->u.external[n].disk_secno = se;158158- btree->u.external[n].file_secno = fs;159159- btree->u.external[n].length = 1;156156+ btree->first_free = cpu_to_le16(le16_to_cpu(btree->first_free) + 12);157157+ btree->u.external[n].disk_secno = cpu_to_le32(se);158158+ btree->u.external[n].file_secno = cpu_to_le32(fs);159159+ btree->u.external[n].length = cpu_to_le32(1);160160 mark_buffer_dirty(bh);161161 brelse(bh);162162 if ((a == node && fnod) || na == -1) return se;163163 c2 = 0;164164- while (up != -1) {164164+ while (up != (anode_secno)-1) {165165 struct anode *new_anode;166166 if (hpfs_sb(s)->sb_chk)167167 if (hpfs_stop_cycles(s, up, &c1, &c2, "hpfs_add_sector_to_btree #2")) return -1;···174174 }175175 if (btree->n_free_nodes) {176176 btree->n_free_nodes--; n = btree->n_used_nodes++;177177- btree->first_free += 8;178178- btree->u.internal[n].file_secno = -1;179179- btree->u.internal[n].down = na;180180- btree->u.internal[n-1].file_secno = fs;177177+ btree->first_free = cpu_to_le16(le16_to_cpu(btree->first_free) + 8);178178+ btree->u.internal[n].file_secno = cpu_to_le32(-1);179179+ btree->u.internal[n].down = cpu_to_le32(na);180180+ btree->u.internal[n-1].file_secno = cpu_to_le32(fs);181181 mark_buffer_dirty(bh);182182 brelse(bh);183183 brelse(bh2);184184 hpfs_free_sectors(s, ra, 1);185185 if ((anode = hpfs_map_anode(s, na, &bh))) {186186- anode->up = up;186186+ anode->up = cpu_to_le32(up);187187 anode->btree.fnode_parent = up == node && fnod;188188 mark_buffer_dirty(bh);189189 brelse(bh);190190 }191191 return se;192192 }193193- up = up != node ? anode->up : -1;194194- btree->u.internal[btree->n_used_nodes - 1].file_secno = /*fs*/-1;193193+ up = up != node ? le32_to_cpu(anode->up) : -1;194194+ btree->u.internal[btree->n_used_nodes - 1].file_secno = cpu_to_le32(/*fs*/-1);195195 mark_buffer_dirty(bh);196196 brelse(bh);197197 a = na;198198 if ((new_anode = hpfs_alloc_anode(s, a, &na, &bh))) {199199 anode = new_anode;200200- /*anode->up = up != -1 ? up : ra;*/200200+ /*anode->up = cpu_to_le32(up != -1 ? up : ra);*/201201 anode->btree.internal = 1;202202 anode->btree.n_used_nodes = 1;203203 anode->btree.n_free_nodes = 59;204204- anode->btree.first_free = 16;205205- anode->btree.u.internal[0].down = a;206206- anode->btree.u.internal[0].file_secno = -1;204204+ anode->btree.first_free = cpu_to_le16(16);205205+ anode->btree.u.internal[0].down = cpu_to_le32(a);206206+ anode->btree.u.internal[0].file_secno = cpu_to_le32(-1);207207 mark_buffer_dirty(bh);208208 brelse(bh);209209 if ((anode = hpfs_map_anode(s, a, &bh))) {210210- anode->up = na;210210+ anode->up = cpu_to_le32(na);211211 mark_buffer_dirty(bh);212212 brelse(bh);213213 }214214 } else na = a;215215 }216216 if ((anode = hpfs_map_anode(s, na, &bh))) {217217- anode->up = node;217217+ anode->up = cpu_to_le32(node);218218 if (fnod) anode->btree.fnode_parent = 1;219219 mark_buffer_dirty(bh);220220 brelse(bh);···232232 }233233 btree = &fnode->btree;234234 }235235- ranode->up = node;236236- memcpy(&ranode->btree, btree, btree->first_free);235235+ ranode->up = cpu_to_le32(node);236236+ memcpy(&ranode->btree, btree, le16_to_cpu(btree->first_free));237237 if (fnod) ranode->btree.fnode_parent = 1;238238 ranode->btree.n_free_nodes = (ranode->btree.internal ? 60 : 40) - ranode->btree.n_used_nodes;239239 if (ranode->btree.internal) for (n = 0; n < ranode->btree.n_used_nodes; n++) {240240 struct anode *unode;241241- if ((unode = hpfs_map_anode(s, ranode->u.internal[n].down, &bh1))) {242242- unode->up = ra;241241+ if ((unode = hpfs_map_anode(s, le32_to_cpu(ranode->u.internal[n].down), &bh1))) {242242+ unode->up = cpu_to_le32(ra);243243 unode->btree.fnode_parent = 0;244244 mark_buffer_dirty(bh1);245245 brelse(bh1);···248248 btree->internal = 1;249249 btree->n_free_nodes = fnod ? 10 : 58;250250 btree->n_used_nodes = 2;251251- btree->first_free = (char *)&btree->u.internal[2] - (char *)btree;252252- btree->u.internal[0].file_secno = fs;253253- btree->u.internal[0].down = ra;254254- btree->u.internal[1].file_secno = -1;255255- btree->u.internal[1].down = na;251251+ btree->first_free = cpu_to_le16((char *)&btree->u.internal[2] - (char *)btree);252252+ btree->u.internal[0].file_secno = cpu_to_le32(fs);253253+ btree->u.internal[0].down = cpu_to_le32(ra);254254+ btree->u.internal[1].file_secno = cpu_to_le32(-1);255255+ btree->u.internal[1].down = cpu_to_le32(na);256256 mark_buffer_dirty(bh);257257 brelse(bh);258258 mark_buffer_dirty(bh2);···279279 go_down:280280 d2 = 0;281281 while (btree1->internal) {282282- ano = btree1->u.internal[pos].down;282282+ ano = le32_to_cpu(btree1->u.internal[pos].down);283283 if (level) brelse(bh);284284 if (hpfs_sb(s)->sb_chk)285285 if (hpfs_stop_cycles(s, ano, &d1, &d2, "hpfs_remove_btree #1"))···290290 pos = 0;291291 }292292 for (i = 0; i < btree1->n_used_nodes; i++)293293- hpfs_free_sectors(s, btree1->u.external[i].disk_secno, btree1->u.external[i].length);293293+ hpfs_free_sectors(s, le32_to_cpu(btree1->u.external[i].disk_secno), le32_to_cpu(btree1->u.external[i].length));294294 go_up:295295 if (!level) return;296296 brelse(bh);···298298 if (hpfs_stop_cycles(s, ano, &c1, &c2, "hpfs_remove_btree #2")) return;299299 hpfs_free_sectors(s, ano, 1);300300 oano = ano;301301- ano = anode->up;301301+ ano = le32_to_cpu(anode->up);302302 if (--level) {303303 if (!(anode = hpfs_map_anode(s, ano, &bh))) return;304304 btree1 = &anode->btree;305305 } else btree1 = btree;306306 for (i = 0; i < btree1->n_used_nodes; i++) {307307- if (btree1->u.internal[i].down == oano) {307307+ if (le32_to_cpu(btree1->u.internal[i].down) == oano) {308308 if ((pos = i + 1) < btree1->n_used_nodes)309309 goto go_down;310310 else···411411 if (fno) {412412 btree->n_free_nodes = 8;413413 btree->n_used_nodes = 0;414414- btree->first_free = 8;414414+ btree->first_free = cpu_to_le16(8);415415 btree->internal = 0;416416 mark_buffer_dirty(bh);417417 } else hpfs_free_sectors(s, f, 1);···421421 while (btree->internal) {422422 nodes = btree->n_used_nodes + btree->n_free_nodes;423423 for (i = 0; i < btree->n_used_nodes; i++)424424- if (btree->u.internal[i].file_secno >= secs) goto f;424424+ if (le32_to_cpu(btree->u.internal[i].file_secno) >= secs) goto f;425425 brelse(bh);426426 hpfs_error(s, "internal btree %08x doesn't end with -1", node);427427 return;428428 f:429429 for (j = i + 1; j < btree->n_used_nodes; j++)430430- hpfs_ea_remove(s, btree->u.internal[j].down, 1, 0);430430+ hpfs_ea_remove(s, le32_to_cpu(btree->u.internal[j].down), 1, 0);431431 btree->n_used_nodes = i + 1;432432 btree->n_free_nodes = nodes - btree->n_used_nodes;433433- btree->first_free = 8 + 8 * btree->n_used_nodes;433433+ btree->first_free = cpu_to_le16(8 + 8 * btree->n_used_nodes);434434 mark_buffer_dirty(bh);435435- if (btree->u.internal[i].file_secno == secs) {435435+ if (btree->u.internal[i].file_secno == cpu_to_le32(secs)) {436436 brelse(bh);437437 return;438438 }439439- node = btree->u.internal[i].down;439439+ node = le32_to_cpu(btree->u.internal[i].down);440440 brelse(bh);441441 if (hpfs_sb(s)->sb_chk)442442 if (hpfs_stop_cycles(s, node, &c1, &c2, "hpfs_truncate_btree"))···446446 } 447447 nodes = btree->n_used_nodes + btree->n_free_nodes;448448 for (i = 0; i < btree->n_used_nodes; i++)449449- if (btree->u.external[i].file_secno + btree->u.external[i].length >= secs) goto ff;449449+ if (le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) >= secs) goto ff;450450 brelse(bh);451451 return;452452 ff:453453- if (secs <= btree->u.external[i].file_secno) {453453+ if (secs <= le32_to_cpu(btree->u.external[i].file_secno)) {454454 hpfs_error(s, "there is an allocation error in file %08x, sector %08x", f, secs);455455 if (i) i--;456456 }457457- else if (btree->u.external[i].file_secno + btree->u.external[i].length > secs) {458458- hpfs_free_sectors(s, btree->u.external[i].disk_secno + secs -459459- btree->u.external[i].file_secno, btree->u.external[i].length460460- - secs + btree->u.external[i].file_secno); /* I hope gcc optimizes this :-) */461461- btree->u.external[i].length = secs - btree->u.external[i].file_secno;457457+ else if (le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) > secs) {458458+ hpfs_free_sectors(s, le32_to_cpu(btree->u.external[i].disk_secno) + secs -459459+ le32_to_cpu(btree->u.external[i].file_secno), le32_to_cpu(btree->u.external[i].length)460460+ - secs + le32_to_cpu(btree->u.external[i].file_secno)); /* I hope gcc optimizes this :-) */461461+ btree->u.external[i].length = cpu_to_le32(secs - le32_to_cpu(btree->u.external[i].file_secno));462462 }463463 for (j = i + 1; j < btree->n_used_nodes; j++)464464- hpfs_free_sectors(s, btree->u.external[j].disk_secno, btree->u.external[j].length);464464+ hpfs_free_sectors(s, le32_to_cpu(btree->u.external[j].disk_secno), le32_to_cpu(btree->u.external[j].length));465465 btree->n_used_nodes = i + 1;466466 btree->n_free_nodes = nodes - btree->n_used_nodes;467467- btree->first_free = 8 + 12 * btree->n_used_nodes;467467+ btree->first_free = cpu_to_le16(8 + 12 * btree->n_used_nodes);468468 mark_buffer_dirty(bh);469469 brelse(bh);470470}···480480 struct extended_attribute *ea_end;481481 if (!(fnode = hpfs_map_fnode(s, fno, &bh))) return;482482 if (!fnode->dirflag) hpfs_remove_btree(s, &fnode->btree);483483- else hpfs_remove_dtree(s, fnode->u.external[0].disk_secno);483483+ else hpfs_remove_dtree(s, le32_to_cpu(fnode->u.external[0].disk_secno));484484 ea_end = fnode_end_ea(fnode);485485 for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea))486486 if (ea->indirect)487487 hpfs_ea_remove(s, ea_sec(ea), ea->anode, ea_len(ea));488488- hpfs_ea_ext_remove(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l);488488+ hpfs_ea_ext_remove(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l));489489 brelse(bh);490490 hpfs_free_sectors(s, fno, 1);491491}
+8-16
fs/hpfs/buffer.c
···99#include <linux/slab.h>1010#include "hpfs_fn.h"11111212-void hpfs_lock_creation(struct super_block *s)1313-{1414-#ifdef DEBUG_LOCKS1515- printk("lock creation\n");1616-#endif1717- mutex_lock(&hpfs_sb(s)->hpfs_creation_de);1818-}1919-2020-void hpfs_unlock_creation(struct super_block *s)2121-{2222-#ifdef DEBUG_LOCKS2323- printk("unlock creation\n");2424-#endif2525- mutex_unlock(&hpfs_sb(s)->hpfs_creation_de);2626-}2727-2812/* Map a sector into a buffer and return pointers to it and to the buffer. */29133014void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp,3115 int ahead)3216{3317 struct buffer_head *bh;1818+1919+ hpfs_lock_assert(s);34203521 cond_resched();3622···3549{3650 struct buffer_head *bh;3751 /*return hpfs_map_sector(s, secno, bhp, 0);*/5252+5353+ hpfs_lock_assert(s);38543955 cond_resched();4056···5769{5870 struct buffer_head *bh;5971 char *data;7272+7373+ hpfs_lock_assert(s);60746175 cond_resched();6276···114124 struct quad_buffer_head *qbh)115125{116126 cond_resched();127127+128128+ hpfs_lock_assert(s);117129118130 if (secno & 3) {119131 printk("HPFS: hpfs_get_4sectors: unaligned read\n");
+10-12
fs/hpfs/dir.c
···8888 hpfs_error(inode->i_sb, "not a directory, fnode %08lx",8989 (unsigned long)inode->i_ino);9090 }9191- if (hpfs_inode->i_dno != fno->u.external[0].disk_secno) {9191+ if (hpfs_inode->i_dno != le32_to_cpu(fno->u.external[0].disk_secno)) {9292 e = 1;9393- hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, fno->u.external[0].disk_secno);9393+ hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, le32_to_cpu(fno->u.external[0].disk_secno));9494 }9595 brelse(bh);9696 if (e) {···156156 goto again;157157 }158158 tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3);159159- if (filldir(dirent, tempname, de->namelen, old_pos, de->fnode, DT_UNKNOWN) < 0) {159159+ if (filldir(dirent, tempname, de->namelen, old_pos, le32_to_cpu(de->fnode), DT_UNKNOWN) < 0) {160160 filp->f_pos = old_pos;161161 if (tempname != de->name) kfree(tempname);162162 hpfs_brelse4(&qbh);···221221 * Get inode number, what we're after.222222 */223223224224- ino = de->fnode;224224+ ino = le32_to_cpu(de->fnode);225225226226 /*227227 * Go find or make an inode.···236236 hpfs_init_inode(result);237237 if (de->directory)238238 hpfs_read_inode(result);239239- else if (de->ea_size && hpfs_sb(dir->i_sb)->sb_eas)239239+ else if (le32_to_cpu(de->ea_size) && hpfs_sb(dir->i_sb)->sb_eas)240240 hpfs_read_inode(result);241241 else {242242 result->i_mode |= S_IFREG;···250250 hpfs_result = hpfs_i(result);251251 if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino;252252253253- hpfs_decide_conv(result, name, len);254254-255253 if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) {256254 hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures");257255 goto bail1;···261263 */262264263265 if (!result->i_ctime.tv_sec) {264264- if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, de->creation_date)))266266+ if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date))))265267 result->i_ctime.tv_sec = 1;266268 result->i_ctime.tv_nsec = 0;267267- result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, de->write_date);269269+ result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date));268270 result->i_mtime.tv_nsec = 0;269269- result->i_atime.tv_sec = local_to_gmt(dir->i_sb, de->read_date);271271+ result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date));270272 result->i_atime.tv_nsec = 0;271271- hpfs_result->i_ea_size = de->ea_size;273273+ hpfs_result->i_ea_size = le32_to_cpu(de->ea_size);272274 if (!hpfs_result->i_ea_mode && de->read_only)273275 result->i_mode &= ~0222;274276 if (!de->directory) {275277 if (result->i_size == -1) {276276- result->i_size = de->file_size;278278+ result->i_size = le32_to_cpu(de->file_size);277279 result->i_data.a_ops = &hpfs_aops;278280 hpfs_i(result)->mmu_private = result->i_size;279281 /*
+84-90
fs/hpfs/dnode.c
···1414 struct hpfs_dirent *de_end = dnode_end_de(d);1515 int i = 1;1616 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) {1717- if (de == fde) return ((loff_t) d->self << 4) | (loff_t)i;1717+ if (de == fde) return ((loff_t) le32_to_cpu(d->self) << 4) | (loff_t)i;1818 i++;1919 }2020 printk("HPFS: get_pos: not_found\n");2121- return ((loff_t)d->self << 4) | (loff_t)1;2121+ return ((loff_t)le32_to_cpu(d->self) << 4) | (loff_t)1;2222}23232424void hpfs_add_pos(struct inode *inode, loff_t *pos)···130130{131131 struct hpfs_dirent *de;132132 if (!(de = dnode_last_de(d))) {133133- hpfs_error(s, "set_last_pointer: empty dnode %08x", d->self);133133+ hpfs_error(s, "set_last_pointer: empty dnode %08x", le32_to_cpu(d->self));134134 return;135135 }136136 if (hpfs_sb(s)->sb_chk) {137137 if (de->down) {138138 hpfs_error(s, "set_last_pointer: dnode %08x has already last pointer %08x",139139- d->self, de_down_pointer(de));139139+ le32_to_cpu(d->self), de_down_pointer(de));140140 return;141141 }142142- if (de->length != 32) {143143- hpfs_error(s, "set_last_pointer: bad last dirent in dnode %08x", d->self);142142+ if (le16_to_cpu(de->length) != 32) {143143+ hpfs_error(s, "set_last_pointer: bad last dirent in dnode %08x", le32_to_cpu(d->self));144144 return;145145 }146146 }147147 if (ptr) {148148- if ((d->first_free += 4) > 2048) {149149- hpfs_error(s,"set_last_pointer: too long dnode %08x", d->self);150150- d->first_free -= 4;148148+ d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) + 4);149149+ if (le32_to_cpu(d->first_free) > 2048) {150150+ hpfs_error(s, "set_last_pointer: too long dnode %08x", le32_to_cpu(d->self));151151+ d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) - 4);151152 return;152153 }153153- de->length = 36;154154+ de->length = cpu_to_le16(36);154155 de->down = 1;155155- *(dnode_secno *)((char *)de + 32) = ptr;156156+ *(dnode_secno *)((char *)de + 32) = cpu_to_le32(ptr);156157 }157158}158159···169168 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) {170169 int c = hpfs_compare_names(s, name, namelen, de->name, de->namelen, de->last);171170 if (!c) {172172- hpfs_error(s, "name (%c,%d) already exists in dnode %08x", *name, namelen, d->self);171171+ hpfs_error(s, "name (%c,%d) already exists in dnode %08x", *name, namelen, le32_to_cpu(d->self));173172 return NULL;174173 }175174 if (c < 0) break;···177176 memmove((char *)de + d_size, de, (char *)de_end - (char *)de);178177 memset(de, 0, d_size);179178 if (down_ptr) {180180- *(int *)((char *)de + d_size - 4) = down_ptr;179179+ *(dnode_secno *)((char *)de + d_size - 4) = cpu_to_le32(down_ptr);181180 de->down = 1;182181 }183183- de->length = d_size;184184- if (down_ptr) de->down = 1;182182+ de->length = cpu_to_le16(d_size);185183 de->not_8x3 = hpfs_is_name_long(name, namelen);186184 de->namelen = namelen;187185 memcpy(de->name, name, namelen);188188- d->first_free += d_size;186186+ d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) + d_size);189187 return de;190188}191189···194194 struct hpfs_dirent *de)195195{196196 if (de->last) {197197- hpfs_error(s, "attempt to delete last dirent in dnode %08x", d->self);197197+ hpfs_error(s, "attempt to delete last dirent in dnode %08x", le32_to_cpu(d->self));198198 return;199199 }200200- d->first_free -= de->length;201201- memmove(de, de_next_de(de), d->first_free + (char *)d - (char *)de);200200+ d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) - le16_to_cpu(de->length));201201+ memmove(de, de_next_de(de), le32_to_cpu(d->first_free) + (char *)d - (char *)de);202202}203203204204static void fix_up_ptrs(struct super_block *s, struct dnode *d)205205{206206 struct hpfs_dirent *de;207207 struct hpfs_dirent *de_end = dnode_end_de(d);208208- dnode_secno dno = d->self;208208+ dnode_secno dno = le32_to_cpu(d->self);209209 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de))210210 if (de->down) {211211 struct quad_buffer_head qbh;212212 struct dnode *dd;213213 if ((dd = hpfs_map_dnode(s, de_down_pointer(de), &qbh))) {214214- if (dd->up != dno || dd->root_dnode) {215215- dd->up = dno;214214+ if (le32_to_cpu(dd->up) != dno || dd->root_dnode) {215215+ dd->up = cpu_to_le32(dno);216216 dd->root_dnode = 0;217217 hpfs_mark_4buffers_dirty(&qbh);218218 }···262262 kfree(nname);263263 return 1;264264 }265265- if (d->first_free + de_size(namelen, down_ptr) <= 2048) {265265+ if (le32_to_cpu(d->first_free) + de_size(namelen, down_ptr) <= 2048) {266266 loff_t t;267267 copy_de(de=hpfs_add_de(i->i_sb, d, name, namelen, down_ptr), new_de);268268 t = get_pos(d, de);···286286 kfree(nname);287287 return 1;288288 } 289289- memcpy(nd, d, d->first_free);289289+ memcpy(nd, d, le32_to_cpu(d->first_free));290290 copy_de(de = hpfs_add_de(i->i_sb, nd, name, namelen, down_ptr), new_de);291291 for_all_poss(i, hpfs_pos_ins, get_pos(nd, de), 1);292292 h = ((char *)dnode_last_de(nd) - (char *)nd) / 2 + 10;293293- if (!(ad = hpfs_alloc_dnode(i->i_sb, d->up, &adno, &qbh1, 0))) {293293+ if (!(ad = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &adno, &qbh1))) {294294 hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted");295295 hpfs_brelse4(&qbh);296296 kfree(nd);···313313 down_ptr = adno;314314 set_last_pointer(i->i_sb, ad, de->down ? de_down_pointer(de) : 0);315315 de = de_next_de(de);316316- memmove((char *)nd + 20, de, nd->first_free + (char *)nd - (char *)de);317317- nd->first_free -= (char *)de - (char *)nd - 20;318318- memcpy(d, nd, nd->first_free);316316+ memmove((char *)nd + 20, de, le32_to_cpu(nd->first_free) + (char *)nd - (char *)de);317317+ nd->first_free = cpu_to_le32(le32_to_cpu(nd->first_free) - ((char *)de - (char *)nd - 20));318318+ memcpy(d, nd, le32_to_cpu(nd->first_free));319319 for_all_poss(i, hpfs_pos_del, (loff_t)dno << 4, pos);320320 fix_up_ptrs(i->i_sb, ad);321321 if (!d->root_dnode) {322322- dno = ad->up = d->up;322322+ ad->up = d->up;323323+ dno = le32_to_cpu(ad->up);323324 hpfs_mark_4buffers_dirty(&qbh);324325 hpfs_brelse4(&qbh);325326 hpfs_mark_4buffers_dirty(&qbh1);326327 hpfs_brelse4(&qbh1);327328 goto go_up;328329 }329329- if (!(rd = hpfs_alloc_dnode(i->i_sb, d->up, &rdno, &qbh2, 0))) {330330+ if (!(rd = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &rdno, &qbh2))) {330331 hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted");331332 hpfs_brelse4(&qbh);332333 hpfs_brelse4(&qbh1);···339338 i->i_blocks += 4;340339 rd->root_dnode = 1;341340 rd->up = d->up;342342- if (!(fnode = hpfs_map_fnode(i->i_sb, d->up, &bh))) {341341+ if (!(fnode = hpfs_map_fnode(i->i_sb, le32_to_cpu(d->up), &bh))) {343342 hpfs_free_dnode(i->i_sb, rdno);344343 hpfs_brelse4(&qbh);345344 hpfs_brelse4(&qbh1);···348347 kfree(nname);349348 return 1;350349 }351351- fnode->u.external[0].disk_secno = rdno;350350+ fnode->u.external[0].disk_secno = cpu_to_le32(rdno);352351 mark_buffer_dirty(bh);353352 brelse(bh);354354- d->up = ad->up = hpfs_i(i)->i_dno = rdno;353353+ hpfs_i(i)->i_dno = rdno;354354+ d->up = ad->up = cpu_to_le32(rdno);355355 d->root_dnode = ad->root_dnode = 0;356356 hpfs_mark_4buffers_dirty(&qbh);357357 hpfs_brelse4(&qbh);···375373376374int hpfs_add_dirent(struct inode *i,377375 const unsigned char *name, unsigned namelen,378378- struct hpfs_dirent *new_de, int cdepth)376376+ struct hpfs_dirent *new_de)379377{380378 struct hpfs_inode_info *hpfs_inode = hpfs_i(i);381379 struct dnode *d;···405403 }406404 }407405 hpfs_brelse4(&qbh);408408- if (!cdepth) hpfs_lock_creation(i->i_sb);409406 if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_ADD)) {410407 c = 1;411408 goto ret;···412411 i->i_version++;413412 c = hpfs_add_to_dnode(i, dno, name, namelen, new_de, 0);414413 ret:415415- if (!cdepth) hpfs_unlock_creation(i->i_sb);416414 return c;417415}418416···437437 return 0;438438 if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 0;439439 if (hpfs_sb(i->i_sb)->sb_chk) {440440- if (dnode->up != chk_up) {440440+ if (le32_to_cpu(dnode->up) != chk_up) {441441 hpfs_error(i->i_sb, "move_to_top: up pointer from %08x should be %08x, is %08x",442442- dno, chk_up, dnode->up);442442+ dno, chk_up, le32_to_cpu(dnode->up));443443 hpfs_brelse4(&qbh);444444 return 0;445445 }···455455 hpfs_brelse4(&qbh);456456 }457457 while (!(de = dnode_pre_last_de(dnode))) {458458- dnode_secno up = dnode->up;458458+ dnode_secno up = le32_to_cpu(dnode->up);459459 hpfs_brelse4(&qbh);460460 hpfs_free_dnode(i->i_sb, dno);461461 i->i_size -= 2048;···474474 hpfs_brelse4(&qbh);475475 return 0;476476 }477477- dnode->first_free -= 4;478478- de->length -= 4;477477+ dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) - 4);478478+ de->length = cpu_to_le16(le16_to_cpu(de->length) - 4);479479 de->down = 0;480480 hpfs_mark_4buffers_dirty(&qbh);481481 dno = up;···483483 t = get_pos(dnode, de);484484 for_all_poss(i, hpfs_pos_subst, t, 4);485485 for_all_poss(i, hpfs_pos_subst, t + 1, 5);486486- if (!(nde = kmalloc(de->length, GFP_NOFS))) {486486+ if (!(nde = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) {487487 hpfs_error(i->i_sb, "out of memory for dirent - directory will be corrupted");488488 hpfs_brelse4(&qbh);489489 return 0;490490 }491491- memcpy(nde, de, de->length);491491+ memcpy(nde, de, le16_to_cpu(de->length));492492 ddno = de->down ? de_down_pointer(de) : 0;493493 hpfs_delete_de(i->i_sb, dnode, de);494494 set_last_pointer(i->i_sb, dnode, ddno);···517517 try_it_again:518518 if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "delete_empty_dnode")) return;519519 if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return;520520- if (dnode->first_free > 56) goto end;521521- if (dnode->first_free == 52 || dnode->first_free == 56) {520520+ if (le32_to_cpu(dnode->first_free) > 56) goto end;521521+ if (le32_to_cpu(dnode->first_free) == 52 || le32_to_cpu(dnode->first_free) == 56) {522522 struct hpfs_dirent *de_end;523523 int root = dnode->root_dnode;524524- up = dnode->up;524524+ up = le32_to_cpu(dnode->up);525525 de = dnode_first_de(dnode);526526 down = de->down ? de_down_pointer(de) : 0;527527 if (hpfs_sb(i->i_sb)->sb_chk) if (root && !down) {···545545 return;546546 }547547 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) {548548- d1->up = up;548548+ d1->up = cpu_to_le32(up);549549 d1->root_dnode = 1;550550 hpfs_mark_4buffers_dirty(&qbh1);551551 hpfs_brelse4(&qbh1);552552 }553553 if ((fnode = hpfs_map_fnode(i->i_sb, up, &bh))) {554554- fnode->u.external[0].disk_secno = down;554554+ fnode->u.external[0].disk_secno = cpu_to_le32(down);555555 mark_buffer_dirty(bh);556556 brelse(bh);557557 }···570570 for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, ((loff_t)up << 4) | p);571571 if (!down) {572572 de->down = 0;573573- de->length -= 4;574574- dnode->first_free -= 4;573573+ de->length = cpu_to_le16(le16_to_cpu(de->length) - 4);574574+ dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) - 4);575575 memmove(de_next_de(de), (char *)de_next_de(de) + 4,576576- (char *)dnode + dnode->first_free - (char *)de_next_de(de));576576+ (char *)dnode + le32_to_cpu(dnode->first_free) - (char *)de_next_de(de));577577 } else {578578 struct dnode *d1;579579 struct quad_buffer_head qbh1;580580- *(dnode_secno *) ((void *) de + de->length - 4) = down;580580+ *(dnode_secno *) ((void *) de + le16_to_cpu(de->length) - 4) = down;581581 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) {582582- d1->up = up;582582+ d1->up = cpu_to_le32(up);583583 hpfs_mark_4buffers_dirty(&qbh1);584584 hpfs_brelse4(&qbh1);585585 }586586 }587587 } else {588588- hpfs_error(i->i_sb, "delete_empty_dnode: dnode %08x, first_free == %03x", dno, dnode->first_free);588588+ hpfs_error(i->i_sb, "delete_empty_dnode: dnode %08x, first_free == %03x", dno, le32_to_cpu(dnode->first_free));589589 goto end;590590 }591591···596596 struct quad_buffer_head qbh1;597597 if (!de_next->down) goto endm;598598 ndown = de_down_pointer(de_next);599599- if (!(de_cp = kmalloc(de->length, GFP_NOFS))) {599599+ if (!(de_cp = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) {600600 printk("HPFS: out of memory for dtree balancing\n");601601 goto endm;602602 }603603- memcpy(de_cp, de, de->length);603603+ memcpy(de_cp, de, le16_to_cpu(de->length));604604 hpfs_delete_de(i->i_sb, dnode, de);605605 hpfs_mark_4buffers_dirty(&qbh);606606 hpfs_brelse4(&qbh);607607 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, 4);608608 for_all_poss(i, hpfs_pos_del, ((loff_t)up << 4) | p, 1);609609 if (de_cp->down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de_cp), &qbh1))) {610610- d1->up = ndown;610610+ d1->up = cpu_to_le32(ndown);611611 hpfs_mark_4buffers_dirty(&qbh1);612612 hpfs_brelse4(&qbh1);613613 }···635635 struct hpfs_dirent *del = dnode_last_de(d1);636636 dlp = del->down ? de_down_pointer(del) : 0;637637 if (!dlp && down) {638638- if (d1->first_free > 2044) {638638+ if (le32_to_cpu(d1->first_free) > 2044) {639639 if (hpfs_sb(i->i_sb)->sb_chk >= 2) {640640 printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n");641641 printk("HPFS: warning: terminating balancing operation\n");···647647 printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n");648648 printk("HPFS: warning: goin'on\n");649649 }650650- del->length += 4;650650+ del->length = cpu_to_le16(le16_to_cpu(del->length) + 4);651651 del->down = 1;652652- d1->first_free += 4;652652+ d1->first_free = cpu_to_le32(le32_to_cpu(d1->first_free) + 4);653653 }654654 if (dlp && !down) {655655- del->length -= 4;655655+ del->length = cpu_to_le16(le16_to_cpu(del->length) - 4);656656 del->down = 0;657657- d1->first_free -= 4;657657+ d1->first_free = cpu_to_le32(le32_to_cpu(d1->first_free) - 4);658658 } else if (down)659659- *(dnode_secno *) ((void *) del + del->length - 4) = down;659659+ *(dnode_secno *) ((void *) del + le16_to_cpu(del->length) - 4) = cpu_to_le32(down);660660 } else goto endm;661661- if (!(de_cp = kmalloc(de_prev->length, GFP_NOFS))) {661661+ if (!(de_cp = kmalloc(le16_to_cpu(de_prev->length), GFP_NOFS))) {662662 printk("HPFS: out of memory for dtree balancing\n");663663 hpfs_brelse4(&qbh1);664664 goto endm;665665 }666666 hpfs_mark_4buffers_dirty(&qbh1);667667 hpfs_brelse4(&qbh1);668668- memcpy(de_cp, de_prev, de_prev->length);668668+ memcpy(de_cp, de_prev, le16_to_cpu(de_prev->length));669669 hpfs_delete_de(i->i_sb, dnode, de_prev);670670 if (!de_prev->down) {671671- de_prev->length += 4;671671+ de_prev->length = cpu_to_le16(le16_to_cpu(de_prev->length) + 4);672672 de_prev->down = 1;673673- dnode->first_free += 4;673673+ dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) + 4);674674 }675675- *(dnode_secno *) ((void *) de_prev + de_prev->length - 4) = ndown;675675+ *(dnode_secno *) ((void *) de_prev + le16_to_cpu(de_prev->length) - 4) = cpu_to_le32(ndown);676676 hpfs_mark_4buffers_dirty(&qbh);677677 hpfs_brelse4(&qbh);678678 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | (p - 1), 4);679679 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, ((loff_t)up << 4) | (p - 1));680680 if (down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de), &qbh1))) {681681- d1->up = ndown;681681+ d1->up = cpu_to_le32(ndown);682682 hpfs_mark_4buffers_dirty(&qbh1);683683 hpfs_brelse4(&qbh1);684684 }···701701{702702 struct dnode *dnode = qbh->data;703703 dnode_secno down = 0;704704- int lock = 0;705704 loff_t t;706705 if (de->first || de->last) {707706 hpfs_error(i->i_sb, "hpfs_remove_dirent: attempt to delete first or last dirent in dnode %08x", dno);···709710 }710711 if (de->down) down = de_down_pointer(de);711712 if (depth && (de->down || (de == dnode_first_de(dnode) && de_next_de(de)->last))) {712712- lock = 1;713713- hpfs_lock_creation(i->i_sb);714713 if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_DEL)) {715714 hpfs_brelse4(qbh);716716- hpfs_unlock_creation(i->i_sb);717715 return 2;718716 }719717 }···723727 dnode_secno a = move_to_top(i, down, dno);724728 for_all_poss(i, hpfs_pos_subst, 5, t);725729 if (a) delete_empty_dnode(i, a);726726- if (lock) hpfs_unlock_creation(i->i_sb);727730 return !a;728731 }729732 delete_empty_dnode(i, dno);730730- if (lock) hpfs_unlock_creation(i->i_sb);731733 return 0;732734}733735···745751 ptr = 0;746752 go_up:747753 if (!(dnode = hpfs_map_dnode(s, dno, &qbh))) return;748748- if (hpfs_sb(s)->sb_chk) if (odno && odno != -1 && dnode->up != odno)749749- hpfs_error(s, "hpfs_count_dnodes: bad up pointer; dnode %08x, down %08x points to %08x", odno, dno, dnode->up);754754+ if (hpfs_sb(s)->sb_chk) if (odno && odno != -1 && le32_to_cpu(dnode->up) != odno)755755+ hpfs_error(s, "hpfs_count_dnodes: bad up pointer; dnode %08x, down %08x points to %08x", odno, dno, le32_to_cpu(dnode->up));750756 de = dnode_first_de(dnode);751757 if (ptr) while(1) {752758 if (de->down) if (de_down_pointer(de) == ptr) goto process_de;···770776 if (!de->first && !de->last && n_items) (*n_items)++;771777 if ((de = de_next_de(de)) < dnode_end_de(dnode)) goto next_de;772778 ptr = dno;773773- dno = dnode->up;779779+ dno = le32_to_cpu(dnode->up);774780 if (dnode->root_dnode) {775781 hpfs_brelse4(&qbh);776782 return;···818824 return d;819825 if (!(de = map_nth_dirent(s, d, 1, &qbh, NULL))) return dno;820826 if (hpfs_sb(s)->sb_chk)821821- if (up && ((struct dnode *)qbh.data)->up != up)822822- hpfs_error(s, "hpfs_de_as_down_as_possible: bad up pointer; dnode %08x, down %08x points to %08x", up, d, ((struct dnode *)qbh.data)->up);827827+ if (up && le32_to_cpu(((struct dnode *)qbh.data)->up) != up)828828+ hpfs_error(s, "hpfs_de_as_down_as_possible: bad up pointer; dnode %08x, down %08x points to %08x", up, d, le32_to_cpu(((struct dnode *)qbh.data)->up));823829 if (!de->down) {824830 hpfs_brelse4(&qbh);825831 return d;···868874 /* Going up */869875 if (dnode->root_dnode) goto bail;870876871871- if (!(up_dnode = hpfs_map_dnode(inode->i_sb, dnode->up, &qbh0)))877877+ if (!(up_dnode = hpfs_map_dnode(inode->i_sb, le32_to_cpu(dnode->up), &qbh0)))872878 goto bail;873879874880 end_up_de = dnode_end_de(up_dnode);···876882 for (up_de = dnode_first_de(up_dnode); up_de < end_up_de;877883 up_de = de_next_de(up_de)) {878884 if (!(++c & 077)) hpfs_error(inode->i_sb,879879- "map_pos_dirent: pos crossed dnode boundary; dnode = %08x", dnode->up);885885+ "map_pos_dirent: pos crossed dnode boundary; dnode = %08x", le32_to_cpu(dnode->up));880886 if (up_de->down && de_down_pointer(up_de) == dno) {881881- *posp = ((loff_t) dnode->up << 4) + c;887887+ *posp = ((loff_t) le32_to_cpu(dnode->up) << 4) + c;882888 hpfs_brelse4(&qbh0);883889 return de;884890 }885891 }886892887893 hpfs_error(inode->i_sb, "map_pos_dirent: pointer to dnode %08x not found in parent dnode %08x",888888- dno, dnode->up);894894+ dno, le32_to_cpu(dnode->up));889895 hpfs_brelse4(&qbh0);890896891897 bail:···10111017 /*name2[15] = 0xff;*/10121018 name1len = 15; name2len = 256;10131019 }10141014- if (!(upf = hpfs_map_fnode(s, f->up, &bh))) {10201020+ if (!(upf = hpfs_map_fnode(s, le32_to_cpu(f->up), &bh))) {10151021 kfree(name2);10161022 return NULL;10171023 } 10181024 if (!upf->dirflag) {10191025 brelse(bh);10201020- hpfs_error(s, "fnode %08x has non-directory parent %08x", fno, f->up);10261026+ hpfs_error(s, "fnode %08x has non-directory parent %08x", fno, le32_to_cpu(f->up));10211027 kfree(name2);10221028 return NULL;10231029 }10241024- dno = upf->u.external[0].disk_secno;10301030+ dno = le32_to_cpu(upf->u.external[0].disk_secno);10251031 brelse(bh);10261032 go_down:10271033 downd = 0;···10431049 return NULL;10441050 }10451051 next_de:10461046- if (de->fnode == fno) {10521052+ if (le32_to_cpu(de->fnode) == fno) {10471053 kfree(name2);10481054 return de;10491055 }···10591065 goto go_down;10601066 }10611067 f:10621062- if (de->fnode == fno) {10681068+ if (le32_to_cpu(de->fnode) == fno) {10631069 kfree(name2);10641070 return de;10651071 }···10681074 if ((de = de_next_de(de)) < de_end) goto next_de;10691075 if (d->root_dnode) goto not_found;10701076 downd = dno;10711071- dno = d->up;10771077+ dno = le32_to_cpu(d->up);10721078 hpfs_brelse4(qbh);10731079 if (hpfs_sb(s)->sb_chk)10741080 if (hpfs_stop_cycles(s, downd, &d1, &d2, "map_fnode_dirent #2")) {
+69-67
fs/hpfs/ea.c
···2424 }2525 if (hpfs_ea_read(s, a, ano, pos, 4, ex)) return;2626 if (ea->indirect) {2727- if (ea->valuelen != 8) {2727+ if (ea_valuelen(ea) != 8) {2828 hpfs_error(s, "ea->indirect set while ea->valuelen!=8, %s %08x, pos %08x",2929 ano ? "anode" : "sectors", a, pos);3030 return;···3333 return;3434 hpfs_ea_remove(s, ea_sec(ea), ea->anode, ea_len(ea));3535 }3636- pos += ea->namelen + ea->valuelen + 5;3636+ pos += ea->namelen + ea_valuelen(ea) + 5;3737 }3838 if (!ano) hpfs_free_sectors(s, a, (len+511) >> 9);3939 else {···7676 unsigned pos;7777 int ano, len;7878 secno a;7979+ char ex[4 + 255 + 1 + 8];7980 struct extended_attribute *ea;8081 struct extended_attribute *ea_end = fnode_end_ea(fnode);8182 for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea))8283 if (!strcmp(ea->name, key)) {8384 if (ea->indirect)8485 goto indirect;8585- if (ea->valuelen >= size)8686+ if (ea_valuelen(ea) >= size)8687 return -EINVAL;8787- memcpy(buf, ea_data(ea), ea->valuelen);8888- buf[ea->valuelen] = 0;8888+ memcpy(buf, ea_data(ea), ea_valuelen(ea));8989+ buf[ea_valuelen(ea)] = 0;8990 return 0;9091 }9191- a = fnode->ea_secno;9292- len = fnode->ea_size_l;9292+ a = le32_to_cpu(fnode->ea_secno);9393+ len = le32_to_cpu(fnode->ea_size_l);9394 ano = fnode->ea_anode;9495 pos = 0;9596 while (pos < len) {9696- char ex[4 + 255 + 1 + 8];9797 ea = (struct extended_attribute *)ex;9898 if (pos + 4 > len) {9999 hpfs_error(s, "EAs don't end correctly, %s %08x, len %08x",···106106 if (!strcmp(ea->name, key)) {107107 if (ea->indirect)108108 goto indirect;109109- if (ea->valuelen >= size)109109+ if (ea_valuelen(ea) >= size)110110 return -EINVAL;111111- if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea->valuelen, buf))111111+ if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea_valuelen(ea), buf))112112 return -EIO;113113- buf[ea->valuelen] = 0;113113+ buf[ea_valuelen(ea)] = 0;114114 return 0;115115 }116116- pos += ea->namelen + ea->valuelen + 5;116116+ pos += ea->namelen + ea_valuelen(ea) + 5;117117 }118118 return -ENOENT;119119indirect:···138138 if (!strcmp(ea->name, key)) {139139 if (ea->indirect)140140 return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea));141141- if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_NOFS))) {141141+ if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) {142142 printk("HPFS: out of memory for EA\n");143143 return NULL;144144 }145145- memcpy(ret, ea_data(ea), ea->valuelen);146146- ret[ea->valuelen] = 0;145145+ memcpy(ret, ea_data(ea), ea_valuelen(ea));146146+ ret[ea_valuelen(ea)] = 0;147147 return ret;148148 }149149- a = fnode->ea_secno;150150- len = fnode->ea_size_l;149149+ a = le32_to_cpu(fnode->ea_secno);150150+ len = le32_to_cpu(fnode->ea_size_l);151151 ano = fnode->ea_anode;152152 pos = 0;153153 while (pos < len) {···164164 if (!strcmp(ea->name, key)) {165165 if (ea->indirect)166166 return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea));167167- if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_NOFS))) {167167+ if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) {168168 printk("HPFS: out of memory for EA\n");169169 return NULL;170170 }171171- if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea->valuelen, ret)) {171171+ if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea_valuelen(ea), ret)) {172172 kfree(ret);173173 return NULL;174174 }175175- ret[ea->valuelen] = 0;175175+ ret[ea_valuelen(ea)] = 0;176176 return ret;177177 }178178- pos += ea->namelen + ea->valuelen + 5;178178+ pos += ea->namelen + ea_valuelen(ea) + 5;179179 }180180 return NULL;181181}···202202 if (ea->indirect) {203203 if (ea_len(ea) == size)204204 set_indirect_ea(s, ea->anode, ea_sec(ea), data, size);205205- } else if (ea->valuelen == size) {205205+ } else if (ea_valuelen(ea) == size) {206206 memcpy(ea_data(ea), data, size);207207 }208208 return;209209 }210210- a = fnode->ea_secno;211211- len = fnode->ea_size_l;210210+ a = le32_to_cpu(fnode->ea_secno);211211+ len = le32_to_cpu(fnode->ea_size_l);212212 ano = fnode->ea_anode;213213 pos = 0;214214 while (pos < len) {···228228 set_indirect_ea(s, ea->anode, ea_sec(ea), data, size);229229 }230230 else {231231- if (ea->valuelen == size)231231+ if (ea_valuelen(ea) == size)232232 hpfs_ea_write(s, a, ano, pos + 4 + ea->namelen + 1, size, data);233233 }234234 return;235235 }236236- pos += ea->namelen + ea->valuelen + 5;236236+ pos += ea->namelen + ea_valuelen(ea) + 5;237237 }238238- if (!fnode->ea_offs) {239239- /*if (fnode->ea_size_s) {238238+ if (!le16_to_cpu(fnode->ea_offs)) {239239+ /*if (le16_to_cpu(fnode->ea_size_s)) {240240 hpfs_error(s, "fnode %08x: ea_size_s == %03x, ea_offs == 0",241241- inode->i_ino, fnode->ea_size_s);241241+ inode->i_ino, le16_to_cpu(fnode->ea_size_s));242242 return;243243 }*/244244- fnode->ea_offs = 0xc4;244244+ fnode->ea_offs = cpu_to_le16(0xc4);245245 }246246- if (fnode->ea_offs < 0xc4 || fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s > 0x200) {246246+ if (le16_to_cpu(fnode->ea_offs) < 0xc4 || le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) > 0x200) {247247 hpfs_error(s, "fnode %08lx: ea_offs == %03x, ea_size_s == %03x",248248 (unsigned long)inode->i_ino,249249- fnode->ea_offs, fnode->ea_size_s);249249+ le32_to_cpu(fnode->ea_offs), le16_to_cpu(fnode->ea_size_s));250250 return;251251 }252252- if ((fnode->ea_size_s || !fnode->ea_size_l) &&253253- fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s + strlen(key) + size + 5 <= 0x200) {252252+ if ((le16_to_cpu(fnode->ea_size_s) || !le32_to_cpu(fnode->ea_size_l)) &&253253+ le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) + strlen(key) + size + 5 <= 0x200) {254254 ea = fnode_end_ea(fnode);255255 *(char *)ea = 0;256256 ea->namelen = strlen(key);257257- ea->valuelen = size;257257+ ea->valuelen_lo = size;258258+ ea->valuelen_hi = size >> 8;258259 strcpy(ea->name, key);259260 memcpy(ea_data(ea), data, size);260260- fnode->ea_size_s += strlen(key) + size + 5;261261+ fnode->ea_size_s = cpu_to_le16(le16_to_cpu(fnode->ea_size_s) + strlen(key) + size + 5);261262 goto ret;262263 }263264 /* Most the code here is 99.9993422% unused. I hope there are no bugs.264265 But what .. HPFS.IFS has also bugs in ea management. */265265- if (fnode->ea_size_s && !fnode->ea_size_l) {266266+ if (le16_to_cpu(fnode->ea_size_s) && !le32_to_cpu(fnode->ea_size_l)) {266267 secno n;267268 struct buffer_head *bh;268269 char *data;269269- if (!(n = hpfs_alloc_sector(s, fno, 1, 0, 1))) return;270270+ if (!(n = hpfs_alloc_sector(s, fno, 1, 0))) return;270271 if (!(data = hpfs_get_sector(s, n, &bh))) {271272 hpfs_free_sectors(s, n, 1);272273 return;273274 }274274- memcpy(data, fnode_ea(fnode), fnode->ea_size_s);275275- fnode->ea_size_l = fnode->ea_size_s;276276- fnode->ea_size_s = 0;277277- fnode->ea_secno = n;278278- fnode->ea_anode = 0;275275+ memcpy(data, fnode_ea(fnode), le16_to_cpu(fnode->ea_size_s));276276+ fnode->ea_size_l = cpu_to_le32(le16_to_cpu(fnode->ea_size_s));277277+ fnode->ea_size_s = cpu_to_le16(0);278278+ fnode->ea_secno = cpu_to_le32(n);279279+ fnode->ea_anode = cpu_to_le32(0);279280 mark_buffer_dirty(bh);280281 brelse(bh);281282 }282282- pos = fnode->ea_size_l + 5 + strlen(key) + size;283283- len = (fnode->ea_size_l + 511) >> 9;283283+ pos = le32_to_cpu(fnode->ea_size_l) + 5 + strlen(key) + size;284284+ len = (le32_to_cpu(fnode->ea_size_l) + 511) >> 9;284285 if (pos >= 30000) goto bail;285286 while (((pos + 511) >> 9) > len) {286287 if (!len) {287287- if (!(fnode->ea_secno = hpfs_alloc_sector(s, fno, 1, 0, 1)))288288- goto bail;288288+ secno q = hpfs_alloc_sector(s, fno, 1, 0);289289+ if (!q) goto bail;290290+ fnode->ea_secno = cpu_to_le32(q);289291 fnode->ea_anode = 0;290292 len++;291293 } else if (!fnode->ea_anode) {292292- if (hpfs_alloc_if_possible(s, fnode->ea_secno + len)) {294294+ if (hpfs_alloc_if_possible(s, le32_to_cpu(fnode->ea_secno) + len)) {293295 len++;294296 } else {295297 /* Aargh... don't know how to create ea anodes :-( */···300298 anode_secno a_s;301299 if (!(anode = hpfs_alloc_anode(s, fno, &a_s, &bh)))302300 goto bail;303303- anode->up = fno;301301+ anode->up = cpu_to_le32(fno);304302 anode->btree.fnode_parent = 1;305303 anode->btree.n_free_nodes--;306304 anode->btree.n_used_nodes++;307307- anode->btree.first_free += 12;308308- anode->u.external[0].disk_secno = fnode->ea_secno;309309- anode->u.external[0].file_secno = 0;310310- anode->u.external[0].length = len;305305+ anode->btree.first_free = cpu_to_le16(le16_to_cpu(anode->btree.first_free) + 12);306306+ anode->u.external[0].disk_secno = cpu_to_le32(le32_to_cpu(fnode->ea_secno));307307+ anode->u.external[0].file_secno = cpu_to_le32(0);308308+ anode->u.external[0].length = cpu_to_le32(len);311309 mark_buffer_dirty(bh);312310 brelse(bh);313311 fnode->ea_anode = 1;314314- fnode->ea_secno = a_s;*/312312+ fnode->ea_secno = cpu_to_le32(a_s);*/315313 secno new_sec;316314 int i;317317- if (!(new_sec = hpfs_alloc_sector(s, fno, 1, 1 - ((pos + 511) >> 9), 1)))315315+ if (!(new_sec = hpfs_alloc_sector(s, fno, 1, 1 - ((pos + 511) >> 9))))318316 goto bail;319317 for (i = 0; i < len; i++) {320318 struct buffer_head *bh1, *bh2;321319 void *b1, *b2;322322- if (!(b1 = hpfs_map_sector(s, fnode->ea_secno + i, &bh1, len - i - 1))) {320320+ if (!(b1 = hpfs_map_sector(s, le32_to_cpu(fnode->ea_secno) + i, &bh1, len - i - 1))) {323321 hpfs_free_sectors(s, new_sec, (pos + 511) >> 9);324322 goto bail;325323 }···333331 mark_buffer_dirty(bh2);334332 brelse(bh2);335333 }336336- hpfs_free_sectors(s, fnode->ea_secno, len);337337- fnode->ea_secno = new_sec;334334+ hpfs_free_sectors(s, le32_to_cpu(fnode->ea_secno), len);335335+ fnode->ea_secno = cpu_to_le32(new_sec);338336 len = (pos + 511) >> 9;339337 }340338 }341339 if (fnode->ea_anode) {342342- if (hpfs_add_sector_to_btree(s, fnode->ea_secno,340340+ if (hpfs_add_sector_to_btree(s, le32_to_cpu(fnode->ea_secno),343341 0, len) != -1) {344342 len++;345343 } else {···351349 h[1] = strlen(key);352350 h[2] = size & 0xff;353351 h[3] = size >> 8;354354- if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l, 4, h)) goto bail;355355- if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l + 4, h[1] + 1, key)) goto bail;356356- if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l + 5 + h[1], size, data)) goto bail;357357- fnode->ea_size_l = pos;352352+ if (hpfs_ea_write(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l), 4, h)) goto bail;353353+ if (hpfs_ea_write(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l) + 4, h[1] + 1, key)) goto bail;354354+ if (hpfs_ea_write(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l) + 5 + h[1], size, data)) goto bail;355355+ fnode->ea_size_l = cpu_to_le32(pos);358356 ret:359357 hpfs_i(inode)->i_ea_size += 5 + strlen(key) + size;360358 return;361359 bail:362362- if (fnode->ea_secno)363363- if (fnode->ea_anode) hpfs_truncate_btree(s, fnode->ea_secno, 1, (fnode->ea_size_l + 511) >> 9);364364- else hpfs_free_sectors(s, fnode->ea_secno + ((fnode->ea_size_l + 511) >> 9), len - ((fnode->ea_size_l + 511) >> 9));365365- else fnode->ea_secno = fnode->ea_size_l = 0;360360+ if (le32_to_cpu(fnode->ea_secno))361361+ if (fnode->ea_anode) hpfs_truncate_btree(s, le32_to_cpu(fnode->ea_secno), 1, (le32_to_cpu(fnode->ea_size_l) + 511) >> 9);362362+ else hpfs_free_sectors(s, le32_to_cpu(fnode->ea_secno) + ((le32_to_cpu(fnode->ea_size_l) + 511) >> 9), len - ((le32_to_cpu(fnode->ea_size_l) + 511) >> 9));363363+ else fnode->ea_secno = fnode->ea_size_l = cpu_to_le32(0);366364}367365
···1919 For definitive information on HPFS, ask somebody else -- this is guesswork.2020 There are certain to be many mistakes. */21212222+#if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)2323+#error unknown endian2424+#endif2525+2226/* Notation */23272424-typedef unsigned secno; /* sector number, partition relative */2828+typedef u32 secno; /* sector number, partition relative */25292630typedef secno dnode_secno; /* sector number of a dnode */2731typedef secno fnode_secno; /* sector number of an fnode */···42384339struct hpfs_boot_block4440{4545- unsigned char jmp[3];4646- unsigned char oem_id[8];4747- unsigned char bytes_per_sector[2]; /* 512 */4848- unsigned char sectors_per_cluster;4949- unsigned char n_reserved_sectors[2];5050- unsigned char n_fats;5151- unsigned char n_rootdir_entries[2];5252- unsigned char n_sectors_s[2];5353- unsigned char media_byte;5454- unsigned short sectors_per_fat;5555- unsigned short sectors_per_track;5656- unsigned short heads_per_cyl;5757- unsigned int n_hidden_sectors;5858- unsigned int n_sectors_l; /* size of partition */5959- unsigned char drive_number;6060- unsigned char mbz;6161- unsigned char sig_28h; /* 28h */6262- unsigned char vol_serno[4];6363- unsigned char vol_label[11];6464- unsigned char sig_hpfs[8]; /* "HPFS " */6565- unsigned char pad[448];6666- unsigned short magic; /* aa55 */4141+ u8 jmp[3];4242+ u8 oem_id[8];4343+ u8 bytes_per_sector[2]; /* 512 */4444+ u8 sectors_per_cluster;4545+ u8 n_reserved_sectors[2];4646+ u8 n_fats;4747+ u8 n_rootdir_entries[2];4848+ u8 n_sectors_s[2];4949+ u8 media_byte;5050+ u16 sectors_per_fat;5151+ u16 sectors_per_track;5252+ u16 heads_per_cyl;5353+ u32 n_hidden_sectors;5454+ u32 n_sectors_l; /* size of partition */5555+ u8 drive_number;5656+ u8 mbz;5757+ u8 sig_28h; /* 28h */5858+ u8 vol_serno[4];5959+ u8 vol_label[11];6060+ u8 sig_hpfs[8]; /* "HPFS " */6161+ u8 pad[448];6262+ u16 magic; /* aa55 */6763};68646965···75717672struct hpfs_super_block7773{7878- unsigned magic; /* f995 e849 */7979- unsigned magic1; /* fa53 e9c5, more magic? */8080- /*unsigned huh202;*/ /* ?? 202 = N. of B. in 1.00390625 S.*/8181- char version; /* version of a filesystem usually 2 */8282- char funcversion; /* functional version - oldest version7474+ u32 magic; /* f995 e849 */7575+ u32 magic1; /* fa53 e9c5, more magic? */7676+ u8 version; /* version of a filesystem usually 2 */7777+ u8 funcversion; /* functional version - oldest version8378 of filesystem that can understand8479 this disk */8585- unsigned short int zero; /* 0 */8080+ u16 zero; /* 0 */8681 fnode_secno root; /* fnode of root directory */8782 secno n_sectors; /* size of filesystem */8888- unsigned n_badblocks; /* number of bad blocks */8383+ u32 n_badblocks; /* number of bad blocks */8984 secno bitmaps; /* pointers to free space bit maps */9090- unsigned zero1; /* 0 */8585+ u32 zero1; /* 0 */9186 secno badblocks; /* bad block list */9292- unsigned zero3; /* 0 */8787+ u32 zero3; /* 0 */9388 time32_t last_chkdsk; /* date last checked, 0 if never */9494- /*unsigned zero4;*/ /* 0 */9595- time32_t last_optimize; /* date last optimized, 0 if never */8989+ time32_t last_optimize; /* date last optimized, 0 if never */9690 secno n_dir_band; /* number of sectors in dir band */9791 secno dir_band_start; /* first sector in dir band */9892 secno dir_band_end; /* last sector in dir band */9993 secno dir_band_bitmap; /* free space map, 1 dnode per bit */100100- char volume_name[32]; /* not used */9494+ u8 volume_name[32]; /* not used */10195 secno user_id_table; /* 8 preallocated sectors - user id */102102- unsigned zero6[103]; /* 0 */9696+ u32 zero6[103]; /* 0 */10397};1049810599···109107110108struct hpfs_spare_block111109{112112- unsigned magic; /* f991 1849 */113113- unsigned magic1; /* fa52 29c5, more magic? */110110+ u32 magic; /* f991 1849 */111111+ u32 magic1; /* fa52 29c5, more magic? */114112115115- unsigned dirty: 1; /* 0 clean, 1 "improperly stopped" */116116- /*unsigned flag1234: 4;*/ /* unknown flags */117117- unsigned sparedir_used: 1; /* spare dirblks used */118118- unsigned hotfixes_used: 1; /* hotfixes used */119119- unsigned bad_sector: 1; /* bad sector, corrupted disk (???) */120120- unsigned bad_bitmap: 1; /* bad bitmap */121121- unsigned fast: 1; /* partition was fast formatted */122122- unsigned old_wrote: 1; /* old version wrote to partion */123123- unsigned old_wrote_1: 1; /* old version wrote to partion (?) */124124- unsigned install_dasd_limits: 1; /* HPFS386 flags */125125- unsigned resynch_dasd_limits: 1;126126- unsigned dasd_limits_operational: 1;127127- unsigned multimedia_active: 1;128128- unsigned dce_acls_active: 1;129129- unsigned dasd_limits_dirty: 1;130130- unsigned flag67: 2;131131- unsigned char mm_contlgulty;132132- unsigned char unused;113113+#ifdef __LITTLE_ENDIAN114114+ u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */115115+ u8 sparedir_used: 1; /* spare dirblks used */116116+ u8 hotfixes_used: 1; /* hotfixes used */117117+ u8 bad_sector: 1; /* bad sector, corrupted disk (???) */118118+ u8 bad_bitmap: 1; /* bad bitmap */119119+ u8 fast: 1; /* partition was fast formatted */120120+ u8 old_wrote: 1; /* old version wrote to partion */121121+ u8 old_wrote_1: 1; /* old version wrote to partion (?) */122122+#else123123+ u8 old_wrote_1: 1; /* old version wrote to partion (?) */124124+ u8 old_wrote: 1; /* old version wrote to partion */125125+ u8 fast: 1; /* partition was fast formatted */126126+ u8 bad_bitmap: 1; /* bad bitmap */127127+ u8 bad_sector: 1; /* bad sector, corrupted disk (???) */128128+ u8 hotfixes_used: 1; /* hotfixes used */129129+ u8 sparedir_used: 1; /* spare dirblks used */130130+ u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */131131+#endif132132+133133+#ifdef __LITTLE_ENDIAN134134+ u8 install_dasd_limits: 1; /* HPFS386 flags */135135+ u8 resynch_dasd_limits: 1;136136+ u8 dasd_limits_operational: 1;137137+ u8 multimedia_active: 1;138138+ u8 dce_acls_active: 1;139139+ u8 dasd_limits_dirty: 1;140140+ u8 flag67: 2;141141+#else142142+ u8 flag67: 2;143143+ u8 dasd_limits_dirty: 1;144144+ u8 dce_acls_active: 1;145145+ u8 multimedia_active: 1;146146+ u8 dasd_limits_operational: 1;147147+ u8 resynch_dasd_limits: 1;148148+ u8 install_dasd_limits: 1; /* HPFS386 flags */149149+#endif150150+151151+ u8 mm_contlgulty;152152+ u8 unused;133153134154 secno hotfix_map; /* info about remapped bad sectors */135135- unsigned n_spares_used; /* number of hotfixes */136136- unsigned n_spares; /* number of spares in hotfix map */137137- unsigned n_dnode_spares_free; /* spare dnodes unused */138138- unsigned n_dnode_spares; /* length of spare_dnodes[] list,155155+ u32 n_spares_used; /* number of hotfixes */156156+ u32 n_spares; /* number of spares in hotfix map */157157+ u32 n_dnode_spares_free; /* spare dnodes unused */158158+ u32 n_dnode_spares; /* length of spare_dnodes[] list,139159 follows in this block*/140160 secno code_page_dir; /* code page directory block */141141- unsigned n_code_pages; /* number of code pages */142142- /*unsigned large_numbers[2];*/ /* ?? */143143- unsigned super_crc; /* on HPFS386 and LAN Server this is161161+ u32 n_code_pages; /* number of code pages */162162+ u32 super_crc; /* on HPFS386 and LAN Server this is144163 checksum of superblock, on normal145164 OS/2 unused */146146- unsigned spare_crc; /* on HPFS386 checksum of spareblock */147147- unsigned zero1[15]; /* unused */165165+ u32 spare_crc; /* on HPFS386 checksum of spareblock */166166+ u32 zero1[15]; /* unused */148167 dnode_secno spare_dnodes[100]; /* emergency free dnode list */149149- unsigned zero2[1]; /* room for more? */168168+ u32 zero2[1]; /* room for more? */150169};151170152171/* The bad block list is 4 sectors long. The first word must be zero,···202179203180struct code_page_directory204181{205205- unsigned magic; /* 4945 21f7 */206206- unsigned n_code_pages; /* number of pointers following */207207- unsigned zero1[2];182182+ u32 magic; /* 4945 21f7 */183183+ u32 n_code_pages; /* number of pointers following */184184+ u32 zero1[2];208185 struct {209209- unsigned short ix; /* index */210210- unsigned short code_page_number; /* code page number */211211- unsigned bounds; /* matches corresponding word186186+ u16 ix; /* index */187187+ u16 code_page_number; /* code page number */188188+ u32 bounds; /* matches corresponding word212189 in data block */213190 secno code_page_data; /* sector number of a code_page_data214191 containing c.p. array */215215- unsigned short index; /* index in c.p. array in that sector*/216216- unsigned short unknown; /* some unknown value; usually 0;192192+ u16 index; /* index in c.p. array in that sector*/193193+ u16 unknown; /* some unknown value; usually 0;217194 2 in Japanese version */218195 } array[31]; /* unknown length */219196};···224201225202struct code_page_data226203{227227- unsigned magic; /* 8945 21f7 */228228- unsigned n_used; /* # elements used in c_p_data[] */229229- unsigned bounds[3]; /* looks a bit like204204+ u32 magic; /* 8945 21f7 */205205+ u32 n_used; /* # elements used in c_p_data[] */206206+ u32 bounds[3]; /* looks a bit like230207 (beg1,end1), (beg2,end2)231208 one byte each */232232- unsigned short offs[3]; /* offsets from start of sector209209+ u16 offs[3]; /* offsets from start of sector233210 to start of c_p_data[ix] */234211 struct {235235- unsigned short ix; /* index */236236- unsigned short code_page_number; /* code page number */237237- unsigned short unknown; /* the same as in cp directory */238238- unsigned char map[128]; /* upcase table for chars 80..ff */239239- unsigned short zero2;212212+ u16 ix; /* index */213213+ u16 code_page_number; /* code page number */214214+ u16 unknown; /* the same as in cp directory */215215+ u8 map[128]; /* upcase table for chars 80..ff */216216+ u16 zero2;240217 } code_page[3];241241- unsigned char incognita[78];218218+ u8 incognita[78];242219};243220244221···278255#define DNODE_MAGIC 0x77e40aae279256280257struct dnode {281281- unsigned magic; /* 77e4 0aae */282282- unsigned first_free; /* offset from start of dnode to258258+ u32 magic; /* 77e4 0aae */259259+ u32 first_free; /* offset from start of dnode to283260 first free dir entry */284284- unsigned root_dnode:1; /* Is it root dnode? */285285- unsigned increment_me:31; /* some kind of activity counter?286286- Neither HPFS.IFS nor CHKDSK cares261261+#ifdef __LITTLE_ENDIAN262262+ u8 root_dnode: 1; /* Is it root dnode? */263263+ u8 increment_me: 7; /* some kind of activity counter? */264264+ /* Neither HPFS.IFS nor CHKDSK cares287265 if you change this word */266266+#else267267+ u8 increment_me: 7; /* some kind of activity counter? */268268+ /* Neither HPFS.IFS nor CHKDSK cares269269+ if you change this word */270270+ u8 root_dnode: 1; /* Is it root dnode? */271271+#endif272272+ u8 increment_me2[3];288273 secno up; /* (root dnode) directory's fnode289274 (nonroot) parent dnode */290275 dnode_secno self; /* pointer to this dnode */291291- unsigned char dirent[2028]; /* one or more dirents */276276+ u8 dirent[2028]; /* one or more dirents */292277};293278294279struct hpfs_dirent {295295- unsigned short length; /* offset to next dirent */296296- unsigned first: 1; /* set on phony ^A^A (".") entry */297297- unsigned has_acl: 1;298298- unsigned down: 1; /* down pointer present (after name) */299299- unsigned last: 1; /* set on phony \377 entry */300300- unsigned has_ea: 1; /* entry has EA */301301- unsigned has_xtd_perm: 1; /* has extended perm list (???) */302302- unsigned has_explicit_acl: 1;303303- unsigned has_needea: 1; /* ?? some EA has NEEDEA set280280+ u16 length; /* offset to next dirent */281281+282282+#ifdef __LITTLE_ENDIAN283283+ u8 first: 1; /* set on phony ^A^A (".") entry */284284+ u8 has_acl: 1;285285+ u8 down: 1; /* down pointer present (after name) */286286+ u8 last: 1; /* set on phony \377 entry */287287+ u8 has_ea: 1; /* entry has EA */288288+ u8 has_xtd_perm: 1; /* has extended perm list (???) */289289+ u8 has_explicit_acl: 1;290290+ u8 has_needea: 1; /* ?? some EA has NEEDEA set304291 I have no idea why this is305292 interesting in a dir entry */306306- unsigned read_only: 1; /* dos attrib */307307- unsigned hidden: 1; /* dos attrib */308308- unsigned system: 1; /* dos attrib */309309- unsigned flag11: 1; /* would be volume label dos attrib */310310- unsigned directory: 1; /* dos attrib */311311- unsigned archive: 1; /* dos attrib */312312- unsigned not_8x3: 1; /* name is not 8.3 */313313- unsigned flag15: 1;293293+#else294294+ u8 has_needea: 1; /* ?? some EA has NEEDEA set295295+ I have no idea why this is296296+ interesting in a dir entry */297297+ u8 has_explicit_acl: 1;298298+ u8 has_xtd_perm: 1; /* has extended perm list (???) */299299+ u8 has_ea: 1; /* entry has EA */300300+ u8 last: 1; /* set on phony \377 entry */301301+ u8 down: 1; /* down pointer present (after name) */302302+ u8 has_acl: 1;303303+ u8 first: 1; /* set on phony ^A^A (".") entry */304304+#endif305305+306306+#ifdef __LITTLE_ENDIAN307307+ u8 read_only: 1; /* dos attrib */308308+ u8 hidden: 1; /* dos attrib */309309+ u8 system: 1; /* dos attrib */310310+ u8 flag11: 1; /* would be volume label dos attrib */311311+ u8 directory: 1; /* dos attrib */312312+ u8 archive: 1; /* dos attrib */313313+ u8 not_8x3: 1; /* name is not 8.3 */314314+ u8 flag15: 1;315315+#else316316+ u8 flag15: 1;317317+ u8 not_8x3: 1; /* name is not 8.3 */318318+ u8 archive: 1; /* dos attrib */319319+ u8 directory: 1; /* dos attrib */320320+ u8 flag11: 1; /* would be volume label dos attrib */321321+ u8 system: 1; /* dos attrib */322322+ u8 hidden: 1; /* dos attrib */323323+ u8 read_only: 1; /* dos attrib */324324+#endif325325+314326 fnode_secno fnode; /* fnode giving allocation info */315327 time32_t write_date; /* mtime */316316- unsigned file_size; /* file length, bytes */328328+ u32 file_size; /* file length, bytes */317329 time32_t read_date; /* atime */318330 time32_t creation_date; /* ctime */319319- unsigned ea_size; /* total EA length, bytes */320320- unsigned char no_of_acls : 3; /* number of ACL's */321321- unsigned char reserver : 5;322322- unsigned char ix; /* code page index (of filename), see331331+ u32 ea_size; /* total EA length, bytes */332332+ u8 no_of_acls; /* number of ACL's (low 3 bits) */333333+ u8 ix; /* code page index (of filename), see323334 struct code_page_data */324324- unsigned char namelen, name[1]; /* file name */335335+ u8 namelen, name[1]; /* file name */325336 /* dnode_secno down; btree down pointer, if present,326337 follows name on next word boundary, or maybe it327338 precedes next dirent, which is on a word boundary. */···375318376319struct bplus_leaf_node377320{378378- unsigned file_secno; /* first file sector in extent */379379- unsigned length; /* length, sectors */321321+ u32 file_secno; /* first file sector in extent */322322+ u32 length; /* length, sectors */380323 secno disk_secno; /* first corresponding disk sector */381324};382325383326struct bplus_internal_node384327{385385- unsigned file_secno; /* subtree maps sectors < this */328328+ u32 file_secno; /* subtree maps sectors < this */386329 anode_secno down; /* pointer to subtree */387330};388331389332struct bplus_header390333{391391- unsigned hbff: 1; /* high bit of first free entry offset */392392- unsigned flag1: 1;393393- unsigned flag2: 1;394394- unsigned flag3: 1;395395- unsigned flag4: 1;396396- unsigned fnode_parent: 1; /* ? we're pointed to by an fnode,334334+#ifdef __LITTLE_ENDIAN335335+ u8 hbff: 1; /* high bit of first free entry offset */336336+ u8 flag1234: 4;337337+ u8 fnode_parent: 1; /* ? we're pointed to by an fnode,397338 the data btree or some ea or the398339 main ea bootage pointer ea_secno */399340 /* also can get set in fnodes, which400341 may be a chkdsk glitch or may mean401342 this bit is irrelevant in fnodes,402343 or this interpretation is all wet */403403- unsigned binary_search: 1; /* suggest binary search (unused) */404404- unsigned internal: 1; /* 1 -> (internal) tree of anodes344344+ u8 binary_search: 1; /* suggest binary search (unused) */345345+ u8 internal: 1; /* 1 -> (internal) tree of anodes405346 0 -> (leaf) list of extents */406406- unsigned char fill[3];407407- unsigned char n_free_nodes; /* free nodes in following array */408408- unsigned char n_used_nodes; /* used nodes in following array */409409- unsigned short first_free; /* offset from start of header to347347+#else348348+ u8 internal: 1; /* 1 -> (internal) tree of anodes349349+ 0 -> (leaf) list of extents */350350+ u8 binary_search: 1; /* suggest binary search (unused) */351351+ u8 fnode_parent: 1; /* ? we're pointed to by an fnode,352352+ the data btree or some ea or the353353+ main ea bootage pointer ea_secno */354354+ /* also can get set in fnodes, which355355+ may be a chkdsk glitch or may mean356356+ this bit is irrelevant in fnodes,357357+ or this interpretation is all wet */358358+ u8 flag1234: 4;359359+ u8 hbff: 1; /* high bit of first free entry offset */360360+#endif361361+ u8 fill[3];362362+ u8 n_free_nodes; /* free nodes in following array */363363+ u8 n_used_nodes; /* used nodes in following array */364364+ u16 first_free; /* offset from start of header to410365 first free node in array */411366 union {412367 struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving···438369439370struct fnode440371{441441- unsigned magic; /* f7e4 0aae */442442- unsigned zero1[2]; /* read history */443443- unsigned char len, name[15]; /* true length, truncated name */372372+ u32 magic; /* f7e4 0aae */373373+ u32 zero1[2]; /* read history */374374+ u8 len, name[15]; /* true length, truncated name */444375 fnode_secno up; /* pointer to file's directory fnode */445445- /*unsigned zero2[3];*/446376 secno acl_size_l;447377 secno acl_secno;448448- unsigned short acl_size_s;449449- char acl_anode;450450- char zero2; /* history bit count */451451- unsigned ea_size_l; /* length of disk-resident ea's */378378+ u16 acl_size_s;379379+ u8 acl_anode;380380+ u8 zero2; /* history bit count */381381+ u32 ea_size_l; /* length of disk-resident ea's */452382 secno ea_secno; /* first sector of disk-resident ea's*/453453- unsigned short ea_size_s; /* length of fnode-resident ea's */383383+ u16 ea_size_s; /* length of fnode-resident ea's */454384455455- unsigned flag0: 1;456456- unsigned ea_anode: 1; /* 1 -> ea_secno is an anode */457457- unsigned flag2: 1;458458- unsigned flag3: 1;459459- unsigned flag4: 1;460460- unsigned flag5: 1;461461- unsigned flag6: 1;462462- unsigned flag7: 1;463463- unsigned dirflag: 1; /* 1 -> directory. first & only extent385385+#ifdef __LITTLE_ENDIAN386386+ u8 flag0: 1;387387+ u8 ea_anode: 1; /* 1 -> ea_secno is an anode */388388+ u8 flag234567: 6;389389+#else390390+ u8 flag234567: 6;391391+ u8 ea_anode: 1; /* 1 -> ea_secno is an anode */392392+ u8 flag0: 1;393393+#endif394394+395395+#ifdef __LITTLE_ENDIAN396396+ u8 dirflag: 1; /* 1 -> directory. first & only extent464397 points to dnode. */465465- unsigned flag9: 1;466466- unsigned flag10: 1;467467- unsigned flag11: 1;468468- unsigned flag12: 1;469469- unsigned flag13: 1;470470- unsigned flag14: 1;471471- unsigned flag15: 1;398398+ u8 flag9012345: 7;399399+#else400400+ u8 flag9012345: 7;401401+ u8 dirflag: 1; /* 1 -> directory. first & only extent402402+ points to dnode. */403403+#endif472404473405 struct bplus_header btree; /* b+ tree, 8 extents or 12 subtrees */474406 union {···477407 struct bplus_internal_node internal[12];478408 } u;479409480480- unsigned file_size; /* file length, bytes */481481- unsigned n_needea; /* number of EA's with NEEDEA set */482482- char user_id[16]; /* unused */483483- unsigned short ea_offs; /* offset from start of fnode410410+ u32 file_size; /* file length, bytes */411411+ u32 n_needea; /* number of EA's with NEEDEA set */412412+ u8 user_id[16]; /* unused */413413+ u16 ea_offs; /* offset from start of fnode484414 to first fnode-resident ea */485485- char dasd_limit_treshhold;486486- char dasd_limit_delta;487487- unsigned dasd_limit;488488- unsigned dasd_usage;489489- /*unsigned zero5[2];*/490490- unsigned char ea[316]; /* zero or more EA's, packed together415415+ u8 dasd_limit_treshhold;416416+ u8 dasd_limit_delta;417417+ u32 dasd_limit;418418+ u32 dasd_usage;419419+ u8 ea[316]; /* zero or more EA's, packed together491420 with no alignment padding.492421 (Do not use this name, get here493422 via fnode + ea_offs. I think.) */···499430500431struct anode501432{502502- unsigned magic; /* 37e4 0aae */433433+ u32 magic; /* 37e4 0aae */503434 anode_secno self; /* pointer to this anode */504435 secno up; /* parent anode or fnode */505436···509440 struct bplus_internal_node internal[60];510441 } u;511442512512- unsigned fill[3]; /* unused */443443+ u32 fill[3]; /* unused */513444};514445515446···530461531462struct extended_attribute532463{533533- unsigned indirect: 1; /* 1 -> value gives sector number464464+#ifdef __LITTLE_ENDIAN465465+ u8 indirect: 1; /* 1 -> value gives sector number534466 where real value starts */535535- unsigned anode: 1; /* 1 -> sector is an anode467467+ u8 anode: 1; /* 1 -> sector is an anode536468 that points to fragmented value */537537- unsigned flag2: 1;538538- unsigned flag3: 1;539539- unsigned flag4: 1;540540- unsigned flag5: 1;541541- unsigned flag6: 1;542542- unsigned needea: 1; /* required ea */543543- unsigned char namelen; /* length of name, bytes */544544- unsigned short valuelen; /* length of value, bytes */545545- unsigned char name[0];469469+ u8 flag23456: 5;470470+ u8 needea: 1; /* required ea */471471+#else472472+ u8 needea: 1; /* required ea */473473+ u8 flag23456: 5;474474+ u8 anode: 1; /* 1 -> sector is an anode475475+ that points to fragmented value */476476+ u8 indirect: 1; /* 1 -> value gives sector number477477+ where real value starts */478478+#endif479479+ u8 namelen; /* length of name, bytes */480480+ u8 valuelen_lo; /* length of value, bytes */481481+ u8 valuelen_hi; /* length of value, bytes */482482+ u8 name[0];546483 /*547547- unsigned char name[namelen]; ascii attrib name548548- unsigned char nul; terminating '\0', not counted549549- unsigned char value[valuelen]; value, arbitrary484484+ u8 name[namelen]; ascii attrib name485485+ u8 nul; terminating '\0', not counted486486+ u8 value[valuelen]; value, arbitrary550487 if this.indirect, valuelen is 8 and the value is551551- unsigned length; real length of value, bytes488488+ u32 length; real length of value, bytes552489 secno secno; sector address where it starts553490 if this.anode, the above sector number is the root of an anode tree554491 which points to the value.
+37-43
fs/hpfs/hpfs_fn.h
···1313#include <linux/pagemap.h>1414#include <linux/buffer_head.h>1515#include <linux/slab.h>1616+#include <asm/unaligned.h>16171718#include "hpfs.h"1819···5251 unsigned i_disk_sec; /* (files) minimalist cache of alloc info */5352 unsigned i_n_secs; /* (files) minimalist cache of alloc info */5453 unsigned i_ea_size; /* size of extended attributes */5555- unsigned i_conv : 2; /* (files) crlf->newline hackery */5654 unsigned i_ea_mode : 1; /* file's permission is stored in ea */5755 unsigned i_ea_uid : 1; /* file's uid is stored in ea */5856 unsigned i_ea_gid : 1; /* file's gid is stored in ea */5957 unsigned i_dirty : 1;6060- struct mutex i_mutex;6161- struct mutex i_parent_mutex;6258 loff_t **i_rddir_off;6359 struct inode vfs_inode;6460};65616662struct hpfs_sb_info {6363+ struct mutex hpfs_mutex; /* global hpfs lock */6764 ino_t sb_root; /* inode number of root dir */6865 unsigned sb_fs_size; /* file system size, sectors */6966 unsigned sb_bitmaps; /* sector number of bitmap list */···7374 uid_t sb_uid; /* uid from mount options */7475 gid_t sb_gid; /* gid from mount options */7576 umode_t sb_mode; /* mode from mount options */7676- unsigned sb_conv : 2; /* crlf->newline hackery */7777 unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */7878 unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */7979 unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */···8587 unsigned *sb_bmp_dir; /* main bitmap directory */8688 unsigned sb_c_bitmap; /* current bitmap */8789 unsigned sb_max_fwd_alloc; /* max forwad allocation */8888- struct mutex hpfs_creation_de; /* when creating dirents, nobody else8989- can alloc blocks */9090- /*unsigned sb_mounting : 1;*/9190 int sb_timeshift;9291};9393-9494-/*9595- * conv= options9696- */9797-9898-#define CONV_BINARY 0 /* no conversion */9999-#define CONV_TEXT 1 /* crlf->newline */100100-#define CONV_AUTO 2 /* decide based on file contents */1019210293/* Four 512-byte buffers and the 2k block obtained by concatenating them */10394···100113static inline dnode_secno de_down_pointer (struct hpfs_dirent *de)101114{102115 CHKCOND(de->down,("HPFS: de_down_pointer: !de->down\n"));103103- return *(dnode_secno *) ((void *) de + de->length - 4);116116+ return le32_to_cpu(*(dnode_secno *) ((void *) de + le16_to_cpu(de->length) - 4));104117}105118106119/* The first dir entry in a dnode */···114127115128static inline struct hpfs_dirent *dnode_end_de (struct dnode *dnode)116129{117117- CHKCOND(dnode->first_free>=0x14 && dnode->first_free<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %d\n",(int)dnode->first_free));118118- return (void *) dnode + dnode->first_free;130130+ CHKCOND(le32_to_cpu(dnode->first_free)>=0x14 && le32_to_cpu(dnode->first_free)<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %x\n",(unsigned)le32_to_cpu(dnode->first_free)));131131+ return (void *) dnode + le32_to_cpu(dnode->first_free);119132}120133121134/* The dir entry after dir entry de */122135123136static inline struct hpfs_dirent *de_next_de (struct hpfs_dirent *de)124137{125125- CHKCOND(de->length>=0x20 && de->length<0x800,("HPFS: de_next_de: de->length = %d\n",(int)de->length));126126- return (void *) de + de->length;138138+ CHKCOND(le16_to_cpu(de->length)>=0x20 && le16_to_cpu(de->length)<0x800,("HPFS: de_next_de: de->length = %x\n",(unsigned)le16_to_cpu(de->length)));139139+ return (void *) de + le16_to_cpu(de->length);127140}128141129142static inline struct extended_attribute *fnode_ea(struct fnode *fnode)130143{131131- return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s);144144+ return (struct extended_attribute *)((char *)fnode + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s));132145}133146134147static inline struct extended_attribute *fnode_end_ea(struct fnode *fnode)135148{136136- return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s);149149+ return (struct extended_attribute *)((char *)fnode + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s));150150+}151151+152152+static unsigned ea_valuelen(struct extended_attribute *ea)153153+{154154+ return ea->valuelen_lo + 256 * ea->valuelen_hi;137155}138156139157static inline struct extended_attribute *next_ea(struct extended_attribute *ea)140158{141141- return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea->valuelen);159159+ return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea_valuelen(ea));142160}143161144162static inline secno ea_sec(struct extended_attribute *ea)145163{146146- return *(secno *)((char *)ea + 9 + ea->namelen);164164+ return le32_to_cpu(get_unaligned((secno *)((char *)ea + 9 + ea->namelen)));147165}148166149167static inline secno ea_len(struct extended_attribute *ea)150168{151151- return *(secno *)((char *)ea + 5 + ea->namelen);169169+ return le32_to_cpu(get_unaligned((secno *)((char *)ea + 5 + ea->namelen)));152170}153171154172static inline char *ea_data(struct extended_attribute *ea)···178186 dst->not_8x3 = n;179187}180188181181-static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n)189189+static inline unsigned tstbits(u32 *bmp, unsigned b, unsigned n)182190{183191 int i;184192 if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n;185185- if (!((bmp[(b & 0x3fff) >> 5] >> (b & 0x1f)) & 1)) return 1;193193+ if (!((le32_to_cpu(bmp[(b & 0x3fff) >> 5]) >> (b & 0x1f)) & 1)) return 1;186194 for (i = 1; i < n; i++)187187- if (/*b+i < 0x4000 &&*/ !((bmp[((b+i) & 0x3fff) >> 5] >> ((b+i) & 0x1f)) & 1))195195+ if (!((le32_to_cpu(bmp[((b+i) & 0x3fff) >> 5]) >> ((b+i) & 0x1f)) & 1))188196 return i + 1;189197 return 0;190198}···192200/* alloc.c */193201194202int hpfs_chk_sectors(struct super_block *, secno, int, char *);195195-secno hpfs_alloc_sector(struct super_block *, secno, unsigned, int, int);203203+secno hpfs_alloc_sector(struct super_block *, secno, unsigned, int);196204int hpfs_alloc_if_possible(struct super_block *, secno);197205void hpfs_free_sectors(struct super_block *, secno, unsigned);198206int hpfs_check_free_dnodes(struct super_block *, int);199207void hpfs_free_dnode(struct super_block *, secno);200200-struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *, int);208208+struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *);201209struct fnode *hpfs_alloc_fnode(struct super_block *, secno, fnode_secno *, struct buffer_head **);202210struct anode *hpfs_alloc_anode(struct super_block *, secno, anode_secno *, struct buffer_head **);203211···214222215223/* buffer.c */216224217217-void hpfs_lock_creation(struct super_block *);218218-void hpfs_unlock_creation(struct super_block *);219225void *hpfs_map_sector(struct super_block *, unsigned, struct buffer_head **, int);220226void *hpfs_get_sector(struct super_block *, unsigned, struct buffer_head **);221227void *hpfs_map_4sectors(struct super_block *, unsigned, struct quad_buffer_head *, int);···237247struct hpfs_dirent *hpfs_add_de(struct super_block *, struct dnode *,238248 const unsigned char *, unsigned, secno);239249int hpfs_add_dirent(struct inode *, const unsigned char *, unsigned,240240- struct hpfs_dirent *, int);250250+ struct hpfs_dirent *);241251int hpfs_remove_dirent(struct inode *, dnode_secno, struct hpfs_dirent *, struct quad_buffer_head *, int);242252void hpfs_count_dnodes(struct super_block *, dnode_secno, int *, int *, int *);243253dnode_secno hpfs_de_as_down_as_possible(struct super_block *, dnode_secno dno);···293303 const unsigned char *, unsigned, int);294304int hpfs_is_name_long(const unsigned char *, unsigned);295305void hpfs_adjust_length(const unsigned char *, unsigned *);296296-void hpfs_decide_conv(struct inode *, const unsigned char *, unsigned);297306298307/* namei.c */299308···335346/*336347 * Locking:337348 *338338- * hpfs_lock() is a leftover from the big kernel lock.339339- * Right now, these functions are empty and only left340340- * for documentation purposes. The file system no longer341341- * works on SMP systems, so the lock is not needed342342- * any more.349349+ * hpfs_lock() locks the whole filesystem. It must be taken350350+ * on any method called by the VFS.343351 *344344- * If someone is interested in making it work again, this345345- * would be the place to start by adding a per-superblock346346- * mutex and fixing all the bugs and performance issues347347- * caused by that.352352+ * We don't do any per-file locking anymore, it is hard to353353+ * review and HPFS is not performance-sensitive anyway.348354 */349355static inline void hpfs_lock(struct super_block *s)350356{357357+ struct hpfs_sb_info *sbi = hpfs_sb(s);358358+ mutex_lock(&sbi->hpfs_mutex);351359}352360353361static inline void hpfs_unlock(struct super_block *s)354362{363363+ struct hpfs_sb_info *sbi = hpfs_sb(s);364364+ mutex_unlock(&sbi->hpfs_mutex);365365+}366366+367367+static inline void hpfs_lock_assert(struct super_block *s)368368+{369369+ struct hpfs_sb_info *sbi = hpfs_sb(s);370370+ WARN_ON(!mutex_is_locked(&sbi->hpfs_mutex));355371}
···10161016 /*10171017 * FIXME: do that only when needed, using sched_exit tracepoint10181018 */10191019- flush_ptrace_hw_breakpoint(tsk);10191019+ ptrace_put_breakpoints(tsk);1020102010211021 exit_notify(tsk, group_dead);10221022#ifdef CONFIG_NUMA
···232232233233/**234234 * flex_array_prealloc - guarantee that array space exists235235- * @fa: the flex array for which to preallocate parts236236- * @start: index of first array element for which space is allocated237237- * @end: index of last (inclusive) element for which space is allocated238238- * @flags: page allocation flags235235+ * @fa: the flex array for which to preallocate parts236236+ * @start: index of first array element for which space is allocated237237+ * @nr_elements: number of elements for which space is allocated238238+ * @flags: page allocation flags239239 *240240 * This will guarantee that no future calls to flex_array_put()241241 * will allocate memory. It can be used if you are expecting to···245245 * Locking must be provided by the caller.246246 */247247int flex_array_prealloc(struct flex_array *fa, unsigned int start,248248- unsigned int end, gfp_t flags)248248+ unsigned int nr_elements, gfp_t flags)249249{250250 int start_part;251251 int end_part;252252 int part_nr;253253+ unsigned int end;253254 struct flex_array_part *part;254255255255- if (start >= fa->total_nr_elements || end >= fa->total_nr_elements)256256+ if (!start && !nr_elements)257257+ return 0;258258+ if (start >= fa->total_nr_elements)259259+ return -ENOSPC;260260+ if (!nr_elements)261261+ return 0;262262+263263+ end = start + nr_elements - 1;264264+265265+ if (end >= fa->total_nr_elements)256266 return -ENOSPC;257267 if (elements_fit_in_base(fa))258268 return 0;···353343 int part_nr;354344 int ret = 0;355345346346+ if (!fa->total_nr_elements)347347+ return 0;356348 if (elements_fit_in_base(fa))357349 return ret;358350 for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) {
+8-11
mm/memory.c
···13591359 */13601360 mark_page_accessed(page);13611361 }13621362- if (flags & FOLL_MLOCK) {13621362+ if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) {13631363 /*13641364 * The preliminary mapping check is mainly to avoid the13651365 * pointless overhead of lock_page on the ZERO_PAGE···1412141214131413static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr)14141414{14151415- return (vma->vm_flags & VM_GROWSDOWN) &&14161416- (vma->vm_start == addr) &&14171417- !vma_stack_continue(vma->vm_prev, addr);14151415+ return stack_guard_page_start(vma, addr) ||14161416+ stack_guard_page_end(vma, addr+PAGE_SIZE);14181417}1419141814201419/**···15501551 continue;15511552 }1552155315531553- /*15541554- * If we don't actually want the page itself,15551555- * and it's the stack guard page, just skip it.15561556- */15571557- if (!pages && stack_guard_page(vma, start))15581558- goto next_page;15591559-15601554 do {15611555 struct page *page;15621556 unsigned int foll_flags = gup_flags;···15661574 int ret;15671575 unsigned int fault_flags = 0;1568157615771577+ /* For mlock, just skip the stack guard page. */15781578+ if (foll_flags & FOLL_MLOCK) {15791579+ if (stack_guard_page(vma, start))15801580+ goto next_page;15811581+ }15691582 if (foll_flags & FOLL_WRITE)15701583 fault_flags |= FAULT_FLAG_WRITE;15711584 if (nonblocking)
+1-4
mm/mlock.c
···162162 VM_BUG_ON(end > vma->vm_end);163163 VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));164164165165- gup_flags = FOLL_TOUCH;165165+ gup_flags = FOLL_TOUCH | FOLL_MLOCK;166166 /*167167 * We want to touch writable mappings with a write fault in order168168 * to break COW, except for shared mappings because these don't COW···177177 */178178 if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))179179 gup_flags |= FOLL_FORCE;180180-181181- if (vma->vm_flags & VM_LOCKED)182182- gup_flags |= FOLL_MLOCK;183180184181 return __get_user_pages(current, mm, addr, nr_pages, gup_flags,185182 NULL, NULL, nonblocking);
···19401940 * Since this is without lock semantics the protection is only against19411941 * code executing on this cpu *not* from access by other cpus.19421942 */19431943- if (unlikely(!this_cpu_cmpxchg_double(19431943+ if (unlikely(!irqsafe_cpu_cmpxchg_double(19441944 s->cpu_slab->freelist, s->cpu_slab->tid,19451945 object, tid,19461946 get_freepointer(s, object), next_tid(tid)))) {···21452145 set_freepointer(s, object, c->freelist);2146214621472147#ifdef CONFIG_CMPXCHG_LOCAL21482148- if (unlikely(!this_cpu_cmpxchg_double(21482148+ if (unlikely(!irqsafe_cpu_cmpxchg_double(21492149 s->cpu_slab->freelist, s->cpu_slab->tid,21502150 c->freelist, tid,21512151 object, next_tid(tid)))) {
···249249 int ret;250250 char *str;251251252252- if (machine_is_smdkc100() || machine_is_smdk6442()252252+ if (machine_is_smdkc100()253253 || machine_is_smdkv210() || machine_is_smdkc110()) {254254 smdk.num_links = 3;255255 /* Secondary is at offset SAMSUNG_I2S_SECOFF from Primary */