summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--arch/arm/configs/at91sam9m10g45ek_defconfig2
-rw-r--r--arch/arm/configs/eukrea_cpuimx25_defconfig1
-rw-r--r--arch/arm/configs/eukrea_cpuimx35_defconfig1
-rw-r--r--arch/arm/configs/eukrea_cpuimx51_defconfig1
-rw-r--r--arch/arm/configs/usb_a9260_defconfig1
-rw-r--r--arch/arm/configs/usb_a9263_128mib_defconfig3
-rw-r--r--arch/arm/configs/usb_a9263_defconfig2
-rw-r--r--arch/arm/configs/usb_a9g20_128mib_defconfig3
-rw-r--r--arch/arm/configs/usb_a9g20_defconfig1
-rw-r--r--arch/arm/mach-imx/iim.c8
-rw-r--r--arch/arm/mach-mxs/ocotp.c4
-rw-r--r--arch/blackfin/include/asm/bitops.h3
-rw-r--r--arch/blackfin/lib/Makefile1
-rw-r--r--arch/blackfin/lib/ashrdi3.c36
-rw-r--r--arch/mips/include/asm/bitops.h3
-rw-r--r--arch/nios2/include/asm/bitops.h5
-rw-r--r--arch/openrisc/Makefile4
-rw-r--r--arch/sandbox/board/hostfile.c4
-rw-r--r--arch/x86/include/asm/bitops.h7
-rw-r--r--commands/Kconfig14
-rw-r--r--commands/Makefile2
-rw-r--r--commands/basename.c47
-rw-r--r--commands/crc.c4
-rw-r--r--commands/digest.c4
-rw-r--r--commands/dirname.c47
-rw-r--r--commands/flash.c4
-rw-r--r--commands/ls.c2
-rw-r--r--commands/mem.c49
-rw-r--r--commands/uncompress.c4
-rw-r--r--common/block.c6
-rw-r--r--common/partitions.c29
-rw-r--r--defaultenv-2/base/bin/ifup12
-rw-r--r--defaultenv-2/base/bin/init2
-rw-r--r--defaultenv-2/base/boot/initrd5
-rw-r--r--defaultenv-2/base/boot/net6
-rw-r--r--defaultenv-2/base/init/automount11
-rw-r--r--defaultenv-2/base/init/general3
-rw-r--r--drivers/ata/disk_ata_drive.c2
-rw-r--r--drivers/base/driver.c2
-rw-r--r--drivers/base/resource.c2
-rw-r--r--drivers/eeprom/at25.c8
-rw-r--r--drivers/mfd/lp3972.c2
-rw-r--r--drivers/mfd/mc13xxx.c4
-rw-r--r--drivers/mfd/mc34704.c4
-rw-r--r--drivers/mfd/mc34708.c6
-rw-r--r--drivers/mfd/mc9sdz60.c4
-rw-r--r--drivers/mfd/twl-core.c4
-rw-r--r--drivers/mtd/core.c20
-rw-r--r--drivers/mtd/mtdoob.c3
-rw-r--r--drivers/mtd/mtdraw.c9
-rw-r--r--drivers/mtd/nand/nand-bb.c30
-rw-r--r--drivers/mtd/ubi/cdev.c8
-rw-r--r--drivers/net/miidev.c4
-rw-r--r--drivers/nor/cfi_flash.c18
-rw-r--r--drivers/nor/m25p80.c16
-rw-r--r--fs/cramfs/cramfs.c2
-rw-r--r--fs/devfs-core.c17
-rw-r--r--fs/devfs.c10
-rw-r--r--fs/fat/fat.c6
-rw-r--r--fs/fs.c12
-rw-r--r--fs/nfs.c2
-rw-r--r--fs/ramfs.c2
-rw-r--r--fs/tftp.c2
-rw-r--r--include/common.h23
-rw-r--r--include/cramfs/cramfs_fs.h8
-rw-r--r--include/driver.h28
-rw-r--r--include/envfs.h22
-rw-r--r--include/fs.h12
-rw-r--r--include/linux/byteorder/generic.h7
-rw-r--r--include/linux/stat.h2
-rw-r--r--include/partition.h2
-rw-r--r--include/usb/usb.h6
-rw-r--r--lib/lzo/modules.builtin2
-rw-r--r--lib/misc.c24
-rw-r--r--lib/vsprintf.c1
-rw-r--r--lib/zlib_inflate/modules.builtin1
77 files changed, 435 insertions, 245 deletions
diff --git a/Makefile b/Makefile
index 9294049204..63da4778da 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
VERSION = 2012
-PATCHLEVEL = 06
+PATCHLEVEL = 07
SUBLEVEL = 0
EXTRAVERSION =
NAME = Amissive Actinocutious Kiwi
diff --git a/arch/arm/configs/at91sam9m10g45ek_defconfig b/arch/arm/configs/at91sam9m10g45ek_defconfig
index b72e964d7f..e22f80a9d7 100644
--- a/arch/arm/configs/at91sam9m10g45ek_defconfig
+++ b/arch/arm/configs/at91sam9m10g45ek_defconfig
@@ -1,5 +1,4 @@
CONFIG_ARCH_AT91SAM9G45=y
-CONFIG_MACH_AT91SAM9M10G45EK=y
CONFIG_AEABI=y
# CONFIG_CMD_ARM_CPUINFO is not set
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
@@ -75,3 +74,4 @@ CONFIG_LED_TRIGGERS=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
+CONFIG_LZO_DECOMPRESS=y
diff --git a/arch/arm/configs/eukrea_cpuimx25_defconfig b/arch/arm/configs/eukrea_cpuimx25_defconfig
index 94ae6700e3..f7207e8b89 100644
--- a/arch/arm/configs/eukrea_cpuimx25_defconfig
+++ b/arch/arm/configs/eukrea_cpuimx25_defconfig
@@ -8,6 +8,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_SIZE=0x800000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_TLSF=y
CONFIG_LONGHELP=y
CONFIG_GLOB=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/eukrea_cpuimx35_defconfig b/arch/arm/configs/eukrea_cpuimx35_defconfig
index a888765d99..880beb6f19 100644
--- a/arch/arm/configs/eukrea_cpuimx35_defconfig
+++ b/arch/arm/configs/eukrea_cpuimx35_defconfig
@@ -9,6 +9,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_SIZE=0x800000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_TLSF=y
CONFIG_LONGHELP=y
CONFIG_GLOB=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/eukrea_cpuimx51_defconfig b/arch/arm/configs/eukrea_cpuimx51_defconfig
index f6fd7bcb37..7261796b33 100644
--- a/arch/arm/configs/eukrea_cpuimx51_defconfig
+++ b/arch/arm/configs/eukrea_cpuimx51_defconfig
@@ -7,6 +7,7 @@ CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_SIZE=0x2000000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_TLSF=y
CONFIG_LONGHELP=y
CONFIG_GLOB=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/arm/configs/usb_a9260_defconfig b/arch/arm/configs/usb_a9260_defconfig
index 85e7878207..a9574c497e 100644
--- a/arch/arm/configs/usb_a9260_defconfig
+++ b/arch/arm/configs/usb_a9260_defconfig
@@ -6,6 +6,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_TLSF=y
CONFIG_PROMPT="USB-9G20:"
CONFIG_LONGHELP=y
CONFIG_GLOB=y
diff --git a/arch/arm/configs/usb_a9263_128mib_defconfig b/arch/arm/configs/usb_a9263_128mib_defconfig
index 23bc3d7fb7..d31057fcdb 100644
--- a/arch/arm/configs/usb_a9263_128mib_defconfig
+++ b/arch/arm/configs/usb_a9263_128mib_defconfig
@@ -1,12 +1,13 @@
CONFIG_ARCH_AT91SAM9263=y
CONFIG_MACH_USB_A9263=y
+CONFIG_AT91_HAVE_SRAM_128M=y
CONFIG_AEABI=y
# CONFIG_CMD_ARM_CPUINFO is not set
-CONFIG_AT91_HAVE_SRAM_128M=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_TLSF=y
CONFIG_PROMPT="USB-9263:"
CONFIG_LONGHELP=y
CONFIG_GLOB=y
diff --git a/arch/arm/configs/usb_a9263_defconfig b/arch/arm/configs/usb_a9263_defconfig
index 96ea3e1879..b57c300167 100644
--- a/arch/arm/configs/usb_a9263_defconfig
+++ b/arch/arm/configs/usb_a9263_defconfig
@@ -6,6 +6,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_TLSF=y
CONFIG_PROMPT="USB-9263:"
CONFIG_LONGHELP=y
CONFIG_GLOB=y
@@ -22,7 +23,6 @@ CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/usb-a926x/env"
CONFIG_CMD_EDIT=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_SAVEENV=y
-CONFIG_CMD_LOADENV=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_PRINTENV=y
CONFIG_CMD_READLINE=y
diff --git a/arch/arm/configs/usb_a9g20_128mib_defconfig b/arch/arm/configs/usb_a9g20_128mib_defconfig
index c25d7dec57..6b02342f9f 100644
--- a/arch/arm/configs/usb_a9g20_128mib_defconfig
+++ b/arch/arm/configs/usb_a9g20_128mib_defconfig
@@ -1,12 +1,13 @@
CONFIG_ARCH_AT91SAM9G20=y
CONFIG_MACH_USB_A9G20=y
+CONFIG_AT91_HAVE_SRAM_128M=y
CONFIG_AEABI=y
# CONFIG_CMD_ARM_CPUINFO is not set
-CONFIG_AT91_HAVE_SRAM_128M=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_TLSF=y
CONFIG_PROMPT="USB-9G20:"
CONFIG_LONGHELP=y
CONFIG_GLOB=y
diff --git a/arch/arm/configs/usb_a9g20_defconfig b/arch/arm/configs/usb_a9g20_defconfig
index d645adb618..30bf380458 100644
--- a/arch/arm/configs/usb_a9g20_defconfig
+++ b/arch/arm/configs/usb_a9g20_defconfig
@@ -6,6 +6,7 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
+CONFIG_MALLOC_TLSF=y
CONFIG_PROMPT="USB-9G20:"
CONFIG_LONGHELP=y
CONFIG_GLOB=y
diff --git a/arch/arm/mach-imx/iim.c b/arch/arm/mach-imx/iim.c
index f2ace8aa0f..0da8ea062b 100644
--- a/arch/arm/mach-imx/iim.c
+++ b/arch/arm/mach-imx/iim.c
@@ -84,7 +84,7 @@ static int do_fuse_sense(void __iomem *reg_base, unsigned int bank,
}
static ssize_t imx_iim_cdev_read(struct cdev *cdev, void *buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
ulong size, i;
struct iim_priv *priv = cdev->priv;
@@ -94,7 +94,7 @@ static ssize_t imx_iim_cdev_read(struct cdev *cdev, void *buf, size_t count,
if ((sense_param = dev_get_param(cdev->dev, "explicit_sense_enable")))
explicit_sense = simple_strtoul(sense_param, NULL, 0);
- size = min((ulong)count, priv->banksize - offset);
+ size = min((loff_t)count, priv->banksize - offset);
if (explicit_sense) {
for (i = 0; i < size; i++) {
int row_val;
@@ -176,7 +176,7 @@ out:
#endif /* CONFIG_IMX_IIM_FUSE_BLOW */
static ssize_t imx_iim_cdev_write(struct cdev *cdev, const void *buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
ulong size, i;
struct iim_priv *priv = cdev->priv;
@@ -186,7 +186,7 @@ static ssize_t imx_iim_cdev_write(struct cdev *cdev, const void *buf, size_t cou
if ((write_param = dev_get_param(cdev->dev, "permanent_write_enable")))
blow_enable = simple_strtoul(write_param, NULL, 0);
- size = min((ulong)count, priv->banksize - offset);
+ size = min((loff_t)count, priv->banksize - offset);
#ifdef CONFIG_IMX_IIM_FUSE_BLOW
if (blow_enable) {
for (i = 0; i < size; i++) {
diff --git a/arch/arm/mach-mxs/ocotp.c b/arch/arm/mach-mxs/ocotp.c
index 38f9ffde16..86e63dc7de 100644
--- a/arch/arm/mach-mxs/ocotp.c
+++ b/arch/arm/mach-mxs/ocotp.c
@@ -40,11 +40,11 @@ struct ocotp_priv {
};
static ssize_t mxs_ocotp_cdev_read(struct cdev *cdev, void *buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct ocotp_priv *priv = cdev->priv;
void __iomem *base = priv->base;
- size_t size = min((ulong)count, cdev->size - offset);
+ size_t size = min((loff_t)count, cdev->size - offset);
uint64_t start;
int i;
diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h
index cdcb2f8e5d..623ddfb394 100644
--- a/arch/blackfin/include/asm/bitops.h
+++ b/arch/blackfin/include/asm/bitops.h
@@ -268,7 +268,10 @@ static __inline__ int find_next_zero_bit(void *addr, int size, int offset)
return result + ffz(tmp);
}
+#include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/fls.h>
#include <asm-generic/bitops/hweight.h>
static __inline__ int ext2_set_bit(int nr, volatile void *addr)
diff --git a/arch/blackfin/lib/Makefile b/arch/blackfin/lib/Makefile
index 2f7731824b..cefb4dc89f 100644
--- a/arch/blackfin/lib/Makefile
+++ b/arch/blackfin/lib/Makefile
@@ -8,6 +8,7 @@ obj-y += smulsi3_highpart.o
obj-y += umodsi3.o
obj-y += lshrdi3.o
obj-y += ashldi3.o
+obj-y += ashrdi3.o
obj-y += divsi3.o
obj-y += modsi3.o
obj-y += cpu.o
diff --git a/arch/blackfin/lib/ashrdi3.c b/arch/blackfin/lib/ashrdi3.c
new file mode 100644
index 0000000000..b5b351e82e
--- /dev/null
+++ b/arch/blackfin/lib/ashrdi3.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004-2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include "gcclib.h"
+
+#ifdef CONFIG_ARITHMETIC_OPS_L1
+DItype __ashrdi3(DItype u, word_type b)__attribute__((l1_text));
+#endif
+
+DItype __ashrdi3(DItype u, word_type b)
+{
+ DIunion w;
+ word_type bm;
+ DIunion uu;
+
+ if (b == 0)
+ return u;
+
+ uu.ll = u;
+
+ bm = (sizeof(SItype) * BITS_PER_UNIT) - b;
+ if (bm <= 0) {
+ /* w.s.high = 1..1 or 0..0 */
+ w.s.high = uu.s.high >> (sizeof(SItype) * BITS_PER_UNIT - 1);
+ w.s.low = uu.s.high >> -bm;
+ } else {
+ USItype carries = (USItype) uu.s.high << bm;
+ w.s.high = uu.s.high >> b;
+ w.s.low = ((USItype) uu.s.low >> b) | carries;
+ }
+
+ return w.ll;
+}
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index 001ebf2e72..bf1ac6e58a 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -28,5 +28,8 @@
#define _ASM_MIPS_BITOPS_H_
#include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/__fls.h>
+#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/fls.h>
#endif /* _ASM_MIPS_BITOPS_H_ */
diff --git a/arch/nios2/include/asm/bitops.h b/arch/nios2/include/asm/bitops.h
index ab0e3d5ff7..07128451c1 100644
--- a/arch/nios2/include/asm/bitops.h
+++ b/arch/nios2/include/asm/bitops.h
@@ -1,4 +1,9 @@
#ifndef _ASM_BITOPS_H
#define _ASM_BITOPS_H
+#include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/__fls.h>
+#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/fls.h>
+
#endif /* _ASM_BITOPS_H */
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
index fd8bbbf4d7..1f4b1755d4 100644
--- a/arch/openrisc/Makefile
+++ b/arch/openrisc/Makefile
@@ -1,5 +1,7 @@
CPPFLAGS += -D__OR1K__ -ffixed-r10 -mhard-mul -mhard-div
+LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
+
board-$(CONFIG_GENERIC) := generic
KALLSYMS += --symbol-prefix=_
@@ -18,4 +20,6 @@ common-y += $(BOARD)
common-y += arch/openrisc/lib/
common-y += arch/openrisc/cpu/
+common-y += $(LIBGCC)
+
lds-y += arch/openrisc/cpu/barebox.lds
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 90a97413b7..96fa100011 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -34,7 +34,7 @@ struct hf_priv {
struct hf_platform_data *pdata;
};
-static ssize_t hf_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags)
+static ssize_t hf_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
{
struct hf_platform_data *hf = cdev->priv;
int fd = hf->fd;
@@ -45,7 +45,7 @@ static ssize_t hf_read(struct cdev *cdev, void *buf, size_t count, ulong offset,
return linux_read(fd, buf, count);
}
-static ssize_t hf_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags)
+static ssize_t hf_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
{
struct hf_platform_data *hf = cdev->priv;
int fd = hf->fd;
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index b43afa3f99..830b1a5510 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -27,6 +27,11 @@
#ifndef _ASM_X86_BITOPS_H_
#define _ASM_X86_BITOPS_H_
-/* nothing special yet */
+#define BITS_PER_LONG 32
+
+#include <asm-generic/bitops/__fls.h>
+#include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/ffs.h>
#endif /* _ASM_X86_BITOPS_H_ */
diff --git a/commands/Kconfig b/commands/Kconfig
index 52e1f171bb..4555b71893 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -198,6 +198,20 @@ config CMD_AUTOMOUNT
this directory available (discover USB devices, bring network interface
up and finally mount the filesystem).
+config CMD_BASENAME
+ tristate
+ prompt "basename"
+ help
+ Strip directory and suffix from filenames and store the result in a
+ environment variable
+
+config CMD_DIRNAME
+ tristate
+ prompt "dirname"
+ help
+ Strip last component of file name and store the result in a
+ environment variable
+
endmenu
menu "console "
diff --git a/commands/Makefile b/commands/Makefile
index 4c8a0a9595..3f5f166de1 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -66,3 +66,5 @@ obj-$(CONFIG_CMD_IOMEM) += iomem.o
obj-$(CONFIG_CMD_LINUX_EXEC) += linux_exec.o
obj-$(CONFIG_CMD_AUTOMOUNT) += automount.o
obj-$(CONFIG_CMD_GLOBAL) += global.o
+obj-$(CONFIG_CMD_BASENAME) += basename.o
+obj-$(CONFIG_CMD_DIRNAME) += dirname.o
diff --git a/commands/basename.c b/commands/basename.c
new file mode 100644
index 0000000000..b47ff8ca9c
--- /dev/null
+++ b/commands/basename.c
@@ -0,0 +1,47 @@
+/*
+ * basename.c - strip directory and suffix from filenames
+ *
+ * Copyright (c) 2012 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#include <libgen.h>
+#include <environment.h>
+
+static int do_basename(int argc, char *argv[])
+{
+ if (argc != 3)
+ return COMMAND_ERROR_USAGE;
+
+ setenv(argv[2], basename(argv[1]));
+
+ return 0;
+}
+
+BAREBOX_CMD_HELP_START(basename)
+BAREBOX_CMD_HELP_USAGE("basename NAME BASENAME\n")
+BAREBOX_CMD_HELP_SHORT("strip NAME and store into $BASENAME\n")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(basename)
+ .cmd = do_basename,
+ .usage = "strip directory and suffix from filenames",
+ BAREBOX_CMD_HELP(cmd_basename_help)
+BAREBOX_CMD_END
diff --git a/commands/crc.c b/commands/crc.c
index df229410f6..09af6aa3f9 100644
--- a/commands/crc.c
+++ b/commands/crc.c
@@ -84,8 +84,8 @@ out:
static int do_crc(int argc, char *argv[])
{
- ulong start = 0, size = ~0, total = 0;
- ulong crc = 0, vcrc = 0;
+ loff_t start = 0, size = ~0;
+ ulong crc = 0, vcrc = 0, total = 0;
char *filename = "/dev/mem";
#ifdef CONFIG_CMD_CRC_CMP
char *vfilename = NULL;
diff --git a/commands/digest.c b/commands/digest.c
index 84329144c7..07cbec9907 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -51,7 +51,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
argv++;
while (*argv) {
char *filename = "/dev/mem";
- ulong start = 0, size = ~0;
+ loff_t start = 0, size = ~0;
/* arguments are either file, file+area or area */
if (parse_area_spec(*argv, &start, &size)) {
@@ -66,7 +66,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
for (i = 0; i < d->length; i++)
printf("%02x", hash[i]);
- printf(" %s\t0x%08lx ... 0x%08lx\n", filename, start, start + size);
+ printf(" %s\t0x%08llx ... 0x%08llx\n", filename, start, start + size);
argv++;
}
diff --git a/commands/dirname.c b/commands/dirname.c
new file mode 100644
index 0000000000..cf1d0a022d
--- /dev/null
+++ b/commands/dirname.c
@@ -0,0 +1,47 @@
+/*
+ * dirname.c - strip directory and suffix from filenames
+ *
+ * Copyright (c) 2012 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#include <libgen.h>
+#include <environment.h>
+
+static int do_dirname(int argc, char *argv[])
+{
+ if (argc != 3)
+ return COMMAND_ERROR_USAGE;
+
+ setenv(argv[2], dirname(argv[1]));
+
+ return 0;
+}
+
+BAREBOX_CMD_HELP_START(dirname)
+BAREBOX_CMD_HELP_USAGE("dirname NAME DIRNAME\n")
+BAREBOX_CMD_HELP_SHORT("strip last componext of NAME and store into $DIRNAME\n")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(dirname)
+ .cmd = do_dirname,
+ .usage = "strip last component from file name",
+ BAREBOX_CMD_HELP(cmd_dirname_help)
+BAREBOX_CMD_END
diff --git a/commands/flash.c b/commands/flash.c
index 1fcb1cff00..d71349a192 100644
--- a/commands/flash.c
+++ b/commands/flash.c
@@ -41,7 +41,7 @@ static int do_flerase(int argc, char *argv[])
int fd;
char *filename = NULL;
struct stat s;
- unsigned long start = 0, size = ~0;
+ loff_t start = 0, size = ~0;
int ret = 0;
if (argc == 1)
@@ -109,7 +109,7 @@ static int do_protect(int argc, char *argv[])
char *filename = NULL;
struct stat s;
int prot = 1;
- unsigned long start = 0, size = ~0;
+ loff_t start = 0, size = ~0;
int ret = 0, err;
if (argc == 1)
diff --git a/commands/ls.c b/commands/ls.c
index ad609f3133..fbcbadcd08 100644
--- a/commands/ls.c
+++ b/commands/ls.c
@@ -35,7 +35,7 @@ static void ls_one(const char *path, struct stat *s)
unsigned int namelen = strlen(path);
mkmodestr(s->st_mode, modestr);
- printf("%s %10lu %*.*s\n", modestr, s->st_size, namelen, namelen, path);
+ printf("%s %10llu %*.*s\n", modestr, s->st_size, namelen, namelen, path);
}
int ls(const char *path, ulong flags)
diff --git a/commands/mem.c b/commands/mem.c
index 080bfdef3f..b8e3bc43b8 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -43,7 +43,7 @@
#define PRINTF(fmt,args...)
#endif
-#define RW_BUF_SIZE (ulong)4096
+#define RW_BUF_SIZE 4096
static char *rw_buf;
static char *DEVMEM = "/dev/mem";
@@ -55,7 +55,7 @@ static char *DEVMEM = "/dev/mem";
*/
#define DISP_LINE_LEN 16
-int memory_display(char *addr, ulong offs, ulong nbytes, int size)
+int memory_display(char *addr, loff_t offs, ulong nbytes, int size)
{
ulong linebytes, i;
u_char *cp;
@@ -72,7 +72,7 @@ int memory_display(char *addr, ulong offs, ulong nbytes, int size)
u_char *ucp = (u_char *)linebuf;
uint count = 52;
- printf("%08lx:", offs);
+ printf("%08llx:", offs);
linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
for (i = 0; i < linebytes; i += size) {
@@ -108,7 +108,7 @@ int memory_display(char *addr, ulong offs, ulong nbytes, int size)
return 0;
}
-static int open_and_lseek(const char *filename, int mode, off_t pos)
+static int open_and_lseek(const char *filename, int mode, loff_t pos)
{
int fd, ret;
@@ -163,7 +163,7 @@ static int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
static int do_mem_md(int argc, char *argv[])
{
- ulong start = 0, size = 0x100;
+ loff_t start = 0, size = 0x100;
int r, now;
int ret = 0;
int fd;
@@ -187,7 +187,7 @@ static int do_mem_md(int argc, char *argv[])
return 1;
do {
- now = min(size, RW_BUF_SIZE);
+ now = min(size, (loff_t)RW_BUF_SIZE);
r = read(fd, rw_buf, now);
if (r < 0) {
perror("read");
@@ -240,7 +240,7 @@ static int do_mem_mw(int argc, char *argv[])
int fd;
char *filename = DEVMEM;
int mode = O_RWSIZE_4;
- ulong adr;
+ loff_t adr;
if (mem_parse_options(argc, argv, "bwld:", &mode, NULL, &filename) < 0)
return 1;
@@ -248,7 +248,7 @@ static int do_mem_mw(int argc, char *argv[])
if (optind + 1 >= argc)
return COMMAND_ERROR_USAGE;
- adr = strtoul_suffix(argv[optind++], NULL, 0);
+ adr = strtoull_suffix(argv[optind++], NULL, 0);
fd = open_and_lseek(filename, mode | O_WRONLY, adr);
if (fd < 0)
@@ -300,7 +300,7 @@ BAREBOX_CMD_END
static int do_mem_cmp(int argc, char *argv[])
{
- ulong addr1, addr2, count = ~0;
+ loff_t addr1, addr2, count = ~0;
int mode = O_RWSIZE_1;
char *sourcefile = DEVMEM;
char *destfile = DEVMEM;
@@ -316,8 +316,8 @@ static int do_mem_cmp(int argc, char *argv[])
if (optind + 2 > argc)
return COMMAND_ERROR_USAGE;
- addr1 = strtoul_suffix(argv[optind], NULL, 0);
- addr2 = strtoul_suffix(argv[optind + 1], NULL, 0);
+ addr1 = strtoull_suffix(argv[optind], NULL, 0);
+ addr2 = strtoull_suffix(argv[optind + 1], NULL, 0);
if (optind + 2 == argc) {
if (sourcefile == DEVMEM) {
@@ -330,7 +330,7 @@ static int do_mem_cmp(int argc, char *argv[])
}
count = statbuf.st_size - addr1;
} else {
- count = strtoul_suffix(argv[optind + 2], NULL, 0);
+ count = strtoull_suffix(argv[optind + 2], NULL, 0);
}
sourcefd = open_and_lseek(sourcefile, mode | O_RDONLY, addr1);
@@ -348,7 +348,7 @@ static int do_mem_cmp(int argc, char *argv[])
while (count > 0) {
int now, r1, r2, i;
- now = min(RW_BUF_SIZE, count);
+ now = min((loff_t)RW_BUF_SIZE, count);
r1 = read(sourcefd, rw_buf, now);
if (r1 < 0) {
@@ -409,8 +409,7 @@ BAREBOX_CMD_END
static int do_mem_cp(int argc, char *argv[])
{
- ulong count;
- ulong dest, src;
+ loff_t count, dest, src;
char *sourcefile = DEVMEM;
char *destfile = DEVMEM;
int sourcefd, destfd;
@@ -424,8 +423,8 @@ static int do_mem_cp(int argc, char *argv[])
if (optind + 2 > argc)
return COMMAND_ERROR_USAGE;
- src = strtoul_suffix(argv[optind], NULL, 0);
- dest = strtoul_suffix(argv[optind + 1], NULL, 0);
+ src = strtoull_suffix(argv[optind], NULL, 0);
+ dest = strtoull_suffix(argv[optind + 1], NULL, 0);
if (optind + 2 == argc) {
if (sourcefile == DEVMEM) {
@@ -438,7 +437,7 @@ static int do_mem_cp(int argc, char *argv[])
}
count = statbuf.st_size - src;
} else {
- count = strtoul_suffix(argv[optind + 2], NULL, 0);
+ count = strtoull_suffix(argv[optind + 2], NULL, 0);
}
sourcefd = open_and_lseek(sourcefile, mode | O_RDONLY, src);
@@ -454,7 +453,7 @@ static int do_mem_cp(int argc, char *argv[])
while (count > 0) {
int now, r, w, tmp;
- now = min(RW_BUF_SIZE, count);
+ now = min((loff_t)RW_BUF_SIZE, count);
r = read(sourcefd, rw_buf, now);
if (r < 0) {
@@ -516,7 +515,7 @@ BAREBOX_CMD_END
static int do_memset(int argc, char *argv[])
{
- ulong s, c, n;
+ loff_t s, c, n;
int fd;
char *buf;
int mode = O_RWSIZE_1;
@@ -529,9 +528,9 @@ static int do_memset(int argc, char *argv[])
if (optind + 3 > argc)
return COMMAND_ERROR_USAGE;
- s = strtoul_suffix(argv[optind], NULL, 0);
- c = strtoul_suffix(argv[optind + 1], NULL, 0);
- n = strtoul_suffix(argv[optind + 2], NULL, 0);
+ s = strtoull_suffix(argv[optind], NULL, 0);
+ c = strtoull_suffix(argv[optind + 1], NULL, 0);
+ n = strtoull_suffix(argv[optind + 2], NULL, 0);
fd = open_and_lseek(file, mode | O_WRONLY, s);
if (fd < 0)
@@ -543,7 +542,7 @@ static int do_memset(int argc, char *argv[])
while (n > 0) {
int now;
- now = min(RW_BUF_SIZE, n);
+ now = min((loff_t)RW_BUF_SIZE, n);
ret = write(fd, buf, now);
if (ret < 0) {
@@ -624,7 +623,7 @@ static int mem_init(void)
device_initcall(mem_init);
-static ssize_t zero_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags)
+static ssize_t zero_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
{
memset(buf, 0, count);
return count;
diff --git a/commands/uncompress.c b/commands/uncompress.c
index e96928b4c3..179d525749 100644
--- a/commands/uncompress.c
+++ b/commands/uncompress.c
@@ -1,5 +1,5 @@
/*
- * uncompress.c - uncompress a lzo compressed file
+ * uncompress.c - uncompress a compressed file
*
* Copyright (c) 2010 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
*
@@ -64,7 +64,7 @@ static const __maybe_unused char cmd_uncompress_help[] =
BAREBOX_CMD_START(uncompress)
.cmd = do_uncompress,
- .usage = "lzop <infile> <outfile>",
+ .usage = "uncompress a compressed file",
BAREBOX_CMD_HELP(cmd_uncompress_help)
BAREBOX_CMD_END
diff --git a/common/block.c b/common/block.c
index f3bcdc8181..7ad5ecc2f4 100644
--- a/common/block.c
+++ b/common/block.c
@@ -180,7 +180,7 @@ static void *block_get(struct block_device *blk, int block)
}
static ssize_t block_read(struct cdev *cdev, void *buf, size_t count,
- unsigned long offset, unsigned long flags)
+ loff_t offset, unsigned long flags)
{
struct block_device *blk = cdev->priv;
unsigned long mask = BLOCKSIZE(blk) - 1;
@@ -257,7 +257,7 @@ static int block_put(struct block_device *blk, const void *buf, int block)
}
static ssize_t block_write(struct cdev *cdev, const void *buf, size_t count,
- unsigned long offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct block_device *blk = cdev->priv;
unsigned long mask = BLOCKSIZE(blk) - 1;
@@ -339,7 +339,7 @@ static struct file_operations block_ops = {
int blockdevice_register(struct block_device *blk)
{
- size_t size = blk->num_blocks * BLOCKSIZE(blk);
+ loff_t size = (loff_t)blk->num_blocks * BLOCKSIZE(blk);
int ret;
int i;
diff --git a/common/partitions.c b/common/partitions.c
index 3d92838948..dc91933890 100644
--- a/common/partitions.c
+++ b/common/partitions.c
@@ -44,23 +44,6 @@ struct partition_desc {
};
/**
- * Reject values which cannot be used in Barebox
- * @param val Value to be check
- * @return 0 if value can be used in Barebox, -EINVAL if not
- *
- * @note this routine can be removed when Barebox uses file offsets larger
- * than 32 bit
- */
-static int check_offset_value(uint64_t val)
-{
-#if 1 /* until Barebox can handle 64 bit offsets */
- if (val > (__INT_MAX__ / SECTOR_SIZE))
- return -EINVAL;
-#endif
- return 0;
-}
-
-/**
* Guess the size of the disk, based on the partition table entries
* @param dev device to create partitions for
* @param table partition table
@@ -77,12 +60,6 @@ static int disk_guess_size(struct device_d *dev, struct partition_entry *table)
size += get_unaligned(&table[i].partition_size);
}
}
- /* limit disk sector counts we can't handle due to 32 bit limits */
- if (check_offset_value(size) != 0) {
- dev_warn(dev, "Warning: Sector count limited due to 31 bit"
- "contraints\n");
- size = __INT_MAX__ / SECTOR_SIZE;
- }
return (int)size;
}
@@ -127,12 +104,6 @@ static void __maybe_unused try_dos_partition(struct block_device *blk,
pentry.first_sec = get_unaligned(&table[i].partition_start);
pentry.size = get_unaligned(&table[i].partition_size);
- /* do we have to ignore this partition due to limitations? */
- if (check_offset_value(pentry.first_sec) != 0)
- continue;
- if (check_offset_value(pentry.size) != 0)
- continue;
-
if (pentry.first_sec != 0) {
pd->parts[pd->used_entries].first_sec = pentry.first_sec;
pd->parts[pd->used_entries].size = pentry.size;
diff --git a/defaultenv-2/base/bin/ifup b/defaultenv-2/base/bin/ifup
index 9f6fd6bc49..37b986c44b 100644
--- a/defaultenv-2/base/bin/ifup
+++ b/defaultenv-2/base/bin/ifup
@@ -51,9 +51,17 @@ if [ "$ip" = static ]; then
${interface}.netmask=$netmask
${interface}.serverip=$serverip
${interface}.gateway=$gateway
+ ret=0
elif [ "$ip" = dhcp ]; then
dhcp
- exit $?
+ ret=$?
+ if [ $ret = 0 -a -n "$serverip" ]; then
+ ${interface}.serverip=$serverip
+ fi
+fi
+
+if [ $ret = 0 ]; then
+ echo -o /tmp/network/$interface up
fi
-echo -o /tmp/network/$interface up
+exit $ret
diff --git a/defaultenv-2/base/bin/init b/defaultenv-2/base/bin/init
index e293c62b01..9d7eb2eea7 100644
--- a/defaultenv-2/base/bin/init
+++ b/defaultenv-2/base/bin/init
@@ -4,8 +4,6 @@ export PATH=/env/bin
global hostname=generic
global user=none
-global tftp.server
-global tftp.path=/mnt/tftp-dhcp
global autoboot_timeout=3
global boot.default=net
global allow_color=true
diff --git a/defaultenv-2/base/boot/initrd b/defaultenv-2/base/boot/initrd
index 1a1e629bcf..79a353a10a 100644
--- a/defaultenv-2/base/boot/initrd
+++ b/defaultenv-2/base/boot/initrd
@@ -5,8 +5,9 @@ if [ "$1" = menu ]; then
exit
fi
-global.bootm.image="${global.tftp.path}/${global.user}-linux-${global.hostname}"
-global.bootm.initrd="${global.tftp.path}/initramfs"
+path="/mnt/tftp"
+global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
+global.bootm.initrd="${path}/initramfs"
bootargs-root-initrd
#global.bootm.oftree=<path to oftree>
diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net
index 2684c20a6c..922bef12bb 100644
--- a/defaultenv-2/base/boot/net
+++ b/defaultenv-2/base/boot/net
@@ -5,8 +5,10 @@ if [ "$1" = menu ]; then
exit
fi
-global.bootm.image="${global.tftp.path}/${global.user}-linux-${global.hostname}"
-#global.bootm.oftree="${global.tftp.path}/${global.user}-oftree-${global.hostname}"
+path="/mnt/tftp"
+
+global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
+#global.bootm.oftree="${path}/${global.user}-oftree-${global.hostname}"
nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
bootargs-ip
bootargs-root-nfs -n "$nfsroot"
diff --git a/defaultenv-2/base/init/automount b/defaultenv-2/base/init/automount
index 63099f9c38..7b533094ff 100644
--- a/defaultenv-2/base/init/automount
+++ b/defaultenv-2/base/init/automount
@@ -5,10 +5,10 @@ if [ "$1" = menu ]; then
exit
fi
-# automount server returned from dhcp server
+# automount tftp server based on $eth0.serverip
-mkdir -p /mnt/tftp-dhcp
-automount /mnt/tftp-dhcp 'ifup eth0 && mount $eth0.serverip tftp /mnt/tftp-dhcp'
+mkdir -p /mnt/tftp
+automount /mnt/tftp 'ifup eth0 && mount $eth0.serverip tftp /mnt/tftp'
# automount nfs server example
@@ -16,11 +16,6 @@ automount /mnt/tftp-dhcp 'ifup eth0 && mount $eth0.serverip tftp /mnt/tftp-dhcp'
#mkdir -p /mnt/${nfshost}
#automount /mnt/$nfshost "ifup eth0 && mount ${nfshost}:/tftpboot nfs /mnt/${nfshost}"
-# static tftp server example
-
-#mkdir -p /mnt/tftp
-#automount -d /mnt/tftp 'ifup eth0 && mount $serverip tftp /mnt/tftp'
-
# FAT on usb disk example
#mkdir -p /mnt/fat
diff --git a/defaultenv-2/base/init/general b/defaultenv-2/base/init/general
index ad6c8600a0..98a92d1b80 100644
--- a/defaultenv-2/base/init/general
+++ b/defaultenv-2/base/init/general
@@ -13,6 +13,3 @@ global.autoboot_timeout=3
# default boot entry (one of /env/boot/*)
global.boot.default=net
-
-# default tftp path
-global.tftp.path=/mnt/tftp-dhcp
diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c
index 4602af3c0d..d5c583790c 100644
--- a/drivers/ata/disk_ata_drive.c
+++ b/drivers/ata/disk_ata_drive.c
@@ -231,7 +231,7 @@ static void __maybe_unused ata_dump_id(uint16_t *id)
*/
static void ata_fix_endianess(uint16_t *buf, unsigned wds)
{
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef __BIG_ENDIAN
unsigned u;
for (u = 0; u < wds; u++)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 81cedca1db..a5c6fb9293 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -339,7 +339,7 @@ static int do_devinfo_subtree(struct device_d *dev, int depth)
list_for_each_entry(cdev, &dev->cdevs, devices_list) {
for (i = 0; i < depth + 1; i++)
printf(" ");
- printf("`---- 0x%08lx-0x%08lx: /dev/%s\n",
+ printf("`---- 0x%08llx-0x%08llx: /dev/%s\n",
cdev->offset,
cdev->offset + cdev->size - 1,
cdev->name);
diff --git a/drivers/base/resource.c b/drivers/base/resource.c
index 347b2f01f0..9844d1abb3 100644
--- a/drivers/base/resource.c
+++ b/drivers/base/resource.c
@@ -113,7 +113,7 @@ struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
res = xzalloc(sizeof(struct resource) * 2);
res[0].start = hccr;
- res[0].size = 0x40;
+ res[0].size = 0x10;
res[0].flags = IORESOURCE_MEM;
res[1].start = hcor;
res[1].size = 0xc0;
diff --git a/drivers/eeprom/at25.c b/drivers/eeprom/at25.c
index 8a979d53a1..03d191eb90 100644
--- a/drivers/eeprom/at25.c
+++ b/drivers/eeprom/at25.c
@@ -67,7 +67,7 @@ struct at25_data {
static ssize_t at25_ee_read(struct cdev *cdev,
void *buf,
size_t count,
- ulong offset,
+ loff_t offset,
ulong flags)
{
u8 command[EE_MAXADDRLEN + 1];
@@ -117,7 +117,7 @@ static ssize_t at25_ee_read(struct cdev *cdev,
*/
status = spi_sync(at25->spi, &m);
dev_dbg(at25->cdev.dev,
- "read %d bytes at %lu --> %d\n",
+ "read %d bytes at %llu --> %d\n",
count, offset, (int) status);
return status ? status : count;
@@ -126,7 +126,7 @@ static ssize_t at25_ee_read(struct cdev *cdev,
static ssize_t at25_ee_write(struct cdev *cdev,
const void *buf,
size_t count,
- ulong off,
+ loff_t off,
ulong flags)
{
ssize_t status = 0;
@@ -232,7 +232,7 @@ static ssize_t at25_ee_write(struct cdev *cdev,
return written ? written : status;
}
-static off_t at25_ee_lseek(struct cdev *cdev, off_t off)
+static loff_t at25_ee_lseek(struct cdev *cdev, loff_t off)
{
return off;
}
diff --git a/drivers/mfd/lp3972.c b/drivers/mfd/lp3972.c
index 98266990dc..0f3093bd15 100644
--- a/drivers/mfd/lp3972.c
+++ b/drivers/mfd/lp3972.c
@@ -58,7 +58,7 @@ static u32 lp_read_reg(struct lp_priv *lp, int reg)
return buf;
}
-static ssize_t lp_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t lp_read(struct cdev *cdev, void *_buf, size_t count, loff_t offset, ulong flags)
{
struct lp_priv *priv = to_lp_priv(cdev);
int i = count;
diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index f9477a3540..2934e9d9bd 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -160,7 +160,7 @@ int mc13xxx_set_bits(struct mc13xxx *mc13xxx, u8 reg, u32 mask, u32 val)
}
EXPORT_SYMBOL(mc13xxx_set_bits);
-static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, loff_t offset, ulong flags)
{
struct mc13xxx *priv = to_mc13xxx(cdev);
u32 *buf = _buf;
@@ -181,7 +181,7 @@ static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset
return count;
}
-static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, loff_t offset, ulong flags)
{
struct mc13xxx *mc13xxx = to_mc13xxx(cdev);
const u32 *buf = _buf;
diff --git a/drivers/mfd/mc34704.c b/drivers/mfd/mc34704.c
index a2171b35d1..20c01e2be6 100644
--- a/drivers/mfd/mc34704.c
+++ b/drivers/mfd/mc34704.c
@@ -65,7 +65,7 @@ int mc34704_reg_write(struct mc34704 *mc34704, u8 reg, u8 val)
EXPORT_SYMBOL(mc34704_reg_write)
static ssize_t mc34704_read(struct cdev *cdev, void *_buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct mc34704 *priv = to_mc34704(cdev);
u8 *buf = _buf;
@@ -85,7 +85,7 @@ static ssize_t mc34704_read(struct cdev *cdev, void *_buf, size_t count,
}
static ssize_t mc34704_write(struct cdev *cdev, const void *_buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct mc34704 *mc34704 = to_mc34704(cdev);
const u8 *buf = _buf;
diff --git a/drivers/mfd/mc34708.c b/drivers/mfd/mc34708.c
index e7f40c02b7..02c58a997d 100644
--- a/drivers/mfd/mc34708.c
+++ b/drivers/mfd/mc34708.c
@@ -163,7 +163,8 @@ int mc34708_set_bits(struct mc34708 *mc34708, enum mc34708_reg reg, u32 mask, u3
}
EXPORT_SYMBOL(mc34708_set_bits);
-static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count,
+ loff_t offset, ulong flags)
{
struct mc34708 *priv = to_mc34708(cdev);
u32 *buf = _buf;
@@ -184,7 +185,8 @@ static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset
return count;
}
-static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count,
+ loff_t offset, ulong flags)
{
struct mc34708 *mc34708 = to_mc34708(cdev);
const u32 *buf = _buf;
diff --git a/drivers/mfd/mc9sdz60.c b/drivers/mfd/mc9sdz60.c
index db208ec2db..0cd5007e1c 100644
--- a/drivers/mfd/mc9sdz60.c
+++ b/drivers/mfd/mc9sdz60.c
@@ -78,7 +78,7 @@ int mc9sdz60_set_bits(struct mc9sdz60 *mc9sdz60, enum mc9sdz60_reg reg, u8 mask,
}
EXPORT_SYMBOL(mc9sdz60_set_bits);
-static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, loff_t offset, ulong flags)
{
struct mc9sdz60 *mc9sdz60 = to_mc9sdz60(cdev);
u8 *buf = _buf;
@@ -97,7 +97,7 @@ static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset
return count;
}
-static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, loff_t offset, ulong flags)
{
struct mc9sdz60 *mc9sdz60 = to_mc9sdz60(cdev);
const u8 *buf = _buf;
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index cb2c03dfca..20bde2cf89 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -112,7 +112,7 @@ int twlcore_set_bits(struct twlcore *twlcore, u16 reg, u8 mask, u8 val)
EXPORT_SYMBOL(twlcore_set_bits);
static ssize_t twl_read(struct cdev *cdev, void *_buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct twlcore *priv = to_twlcore(cdev);
u8 *buf = _buf;
@@ -131,7 +131,7 @@ static ssize_t twl_read(struct cdev *cdev, void *_buf, size_t count,
}
static ssize_t twl_write(struct cdev *cdev, const void *_buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct twlcore *twlcore = to_twlcore(cdev);
const u8 *buf = _buf;
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 87dcba6801..5510439a87 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -31,11 +31,12 @@
static LIST_HEAD(mtd_register_hooks);
static ssize_t mtd_read(struct cdev *cdev, void* buf, size_t count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtd_info *mtd = cdev->priv;
size_t retlen;
int ret;
+ unsigned long offset = _offset;
debug("mtd_read: 0x%08lx 0x%08x\n", offset, count);
@@ -64,13 +65,14 @@ static int all_ff(const void *buf, int len)
}
static ssize_t mtd_write(struct cdev* cdev, const void *buf, size_t _count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtd_info *mtd = cdev->priv;
size_t retlen, now;
int ret = 0;
void *wrbuf = NULL;
size_t count = _count;
+ unsigned long offset = _offset;
if (NOTALIGNED(offset)) {
printf("offset 0x%0lx not page aligned\n", offset);
@@ -123,16 +125,17 @@ int mtd_ioctl(struct cdev *cdev, int request, void *buf)
struct mtd_ecc_stats *ecc = buf;
#endif
struct region_info_user *reg = buf;
+ loff_t *offset = buf;
switch (request) {
case MEMGETBADBLOCK:
- dev_dbg(cdev->dev, "MEMGETBADBLOCK: 0x%08lx\n", (off_t)buf);
- ret = mtd->block_isbad(mtd, (off_t)buf);
+ dev_dbg(cdev->dev, "MEMGETBADBLOCK: 0x%08llx\n", *offset);
+ ret = mtd->block_isbad(mtd, *offset);
break;
#ifdef CONFIG_MTD_WRITE
case MEMSETBADBLOCK:
- dev_dbg(cdev->dev, "MEMSETBADBLOCK: 0x%08lx\n", (off_t)buf);
- ret = mtd->block_markbad(mtd, (off_t)buf);
+ dev_dbg(cdev->dev, "MEMSETBADBLOCK: 0x%08llx\n", *offset);
+ ret = mtd->block_markbad(mtd, *offset);
break;
#endif
case MEMGETINFO:
@@ -156,9 +159,10 @@ int mtd_ioctl(struct cdev *cdev, int request, void *buf)
#endif
case MEMGETREGIONINFO:
if (cdev->mtd) {
+ unsigned long size = cdev->size;
reg->offset = cdev->offset;
reg->erasesize = cdev->mtd->erasesize;
- reg->numblocks = cdev->size/reg->erasesize;
+ reg->numblocks = size / reg->erasesize;
reg->regionindex = cdev->mtd->index;
}
break;
@@ -170,7 +174,7 @@ int mtd_ioctl(struct cdev *cdev, int request, void *buf)
}
#ifdef CONFIG_MTD_WRITE
-static ssize_t mtd_erase(struct cdev *cdev, size_t count, unsigned long offset)
+static ssize_t mtd_erase(struct cdev *cdev, size_t count, loff_t offset)
{
struct mtd_info *mtd = cdev->priv;
struct erase_info erase;
diff --git a/drivers/mtd/mtdoob.c b/drivers/mtd/mtdoob.c
index be656a4d33..e4dd1a00c8 100644
--- a/drivers/mtd/mtdoob.c
+++ b/drivers/mtd/mtdoob.c
@@ -38,11 +38,12 @@ static struct mtd_info *to_mtd(struct cdev *cdev)
}
static ssize_t mtd_read_oob(struct cdev *cdev, void *buf, size_t count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtd_info *mtd = to_mtd(cdev);
struct mtd_oob_ops ops;
int ret;
+ unsigned long offset = _offset;
if (count < mtd->oobsize)
return -EINVAL;
diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
index 7abe2351a5..24f7358098 100644
--- a/drivers/mtd/mtdraw.c
+++ b/drivers/mtd/mtdraw.c
@@ -116,12 +116,13 @@ err:
}
static ssize_t mtdraw_read(struct cdev *cdev, void *buf, size_t count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtd_info *mtd = to_mtd(cdev);
ssize_t retlen = 0, ret = 1, toread;
ulong numpage;
int skip;
+ unsigned long offset = _offset;
numpage = offset / (mtd->writesize + mtd->oobsize);
skip = offset % (mtd->writesize + mtd->oobsize);
@@ -167,13 +168,14 @@ static void mtdraw_fillbuf(struct mtdraw *mtdraw, const void *src, int nbbytes)
}
static ssize_t mtdraw_write(struct cdev *cdev, const void *buf, size_t count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtdraw *mtdraw = to_mtdraw(cdev);
struct mtd_info *mtd = to_mtd(cdev);
int bsz = mtd->writesize + mtd->oobsize;
ulong numpage;
size_t retlen = 0, tofill;
+ unsigned long offset = _offset;
int ret = 0;
if (mtdraw->write_fill &&
@@ -220,10 +222,11 @@ static ssize_t mtdraw_write(struct cdev *cdev, const void *buf, size_t count,
}
}
-static ssize_t mtdraw_erase(struct cdev *cdev, size_t count, ulong offset)
+static ssize_t mtdraw_erase(struct cdev *cdev, size_t count, loff_t _offset)
{
struct mtd_info *mtd = to_mtd(cdev);
struct erase_info erase;
+ unsigned long offset = _offset;
int ret;
offset = offset / (mtd->writesize + mtd->oobsize) * mtd->writesize;
diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
index bd30438958..d27274924a 100644
--- a/drivers/mtd/nand/nand-bb.c
+++ b/drivers/mtd/nand/nand-bb.c
@@ -42,9 +42,9 @@ struct nand_bb {
struct mtd_info_user info;
- size_t raw_size;
- size_t size;
- off_t offset;
+ loff_t raw_size;
+ loff_t size;
+ loff_t offset;
unsigned long flags;
void *writebuf;
@@ -54,7 +54,7 @@ struct nand_bb {
};
static ssize_t nand_bb_read(struct cdev *cdev, void *buf, size_t count,
- unsigned long offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct nand_bb *bb = cdev->priv;
struct cdev *parent = bb->cdev_parent;
@@ -63,18 +63,18 @@ static ssize_t nand_bb_read(struct cdev *cdev, void *buf, size_t count,
debug("%s %d %d\n", __func__, offset, count);
while(count) {
- ret = cdev_ioctl(parent, MEMGETBADBLOCK, (void *)bb->offset);
+ ret = cdev_ioctl(parent, MEMGETBADBLOCK, &bb->offset);
if (ret < 0)
return ret;
if (ret) {
- printf("skipping bad block at 0x%08lx\n", bb->offset);
+ printf("skipping bad block at 0x%08llx\n", bb->offset);
bb->offset += bb->info.erasesize;
continue;
}
now = min(count, (size_t)(bb->info.erasesize -
- (bb->offset % bb->info.erasesize)));
+ ((size_t)bb->offset % bb->info.erasesize)));
ret = cdev_read(parent, buf, now, bb->offset, 0);
if (ret < 0)
return ret;
@@ -96,10 +96,10 @@ static int nand_bb_write_buf(struct nand_bb *bb, size_t count)
int ret, now;
struct cdev *parent = bb->cdev_parent;
void *buf = bb->writebuf;
- int cur_ofs = bb->offset & ~(BB_WRITEBUF_SIZE - 1);
+ off_t cur_ofs = bb->offset & ~(BB_WRITEBUF_SIZE - 1);
while (count) {
- ret = cdev_ioctl(parent, MEMGETBADBLOCK, (void *)cur_ofs);
+ ret = cdev_ioctl(parent, MEMGETBADBLOCK, &cur_ofs);
if (ret < 0)
return ret;
@@ -123,12 +123,12 @@ static int nand_bb_write_buf(struct nand_bb *bb, size_t count)
}
static ssize_t nand_bb_write(struct cdev *cdev, const void *buf, size_t count,
- unsigned long offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct nand_bb *bb = cdev->priv;
int bytes = count, now, wroffs, ret;
- debug("%s offset: 0x%08x count: 0x%08x\n", __func__, offset, count);
+ debug("%s offset: 0x%08llx count: 0x%08x\n", __func__, offset, count);
while (count) {
wroffs = bb->offset % BB_WRITEBUF_SIZE;
@@ -152,7 +152,7 @@ static ssize_t nand_bb_write(struct cdev *cdev, const void *buf, size_t count,
return bytes;
}
-static int nand_bb_erase(struct cdev *cdev, size_t count, unsigned long offset)
+static int nand_bb_erase(struct cdev *cdev, size_t count, loff_t offset)
{
struct nand_bb *bb = cdev->priv;
@@ -197,11 +197,11 @@ static int nand_bb_close(struct cdev *cdev)
static int nand_bb_calc_size(struct nand_bb *bb)
{
- ulong pos = 0;
+ loff_t pos = 0;
int ret;
while (pos < bb->raw_size) {
- ret = cdev_ioctl(bb->cdev_parent, MEMGETBADBLOCK, (void *)pos);
+ ret = cdev_ioctl(bb->cdev_parent, MEMGETBADBLOCK, &pos);
if (ret < 0)
return ret;
if (!ret)
@@ -213,7 +213,7 @@ static int nand_bb_calc_size(struct nand_bb *bb)
return 0;
}
-static off_t nand_bb_lseek(struct cdev *cdev, off_t __offset)
+static loff_t nand_bb_lseek(struct cdev *cdev, loff_t __offset)
{
struct nand_bb *bb = cdev->priv;
unsigned long raw_pos = 0;
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 95bef1f9e0..c99b64db21 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -12,7 +12,7 @@ struct ubi_volume_cdev_priv {
};
static ssize_t ubi_volume_cdev_read(struct cdev *cdev, void *buf, size_t size,
- unsigned long offset, unsigned long flags)
+ loff_t offset, unsigned long flags)
{
struct ubi_volume_cdev_priv *priv = cdev->priv;
struct ubi_volume *vol = priv->vol;
@@ -23,7 +23,7 @@ static ssize_t ubi_volume_cdev_read(struct cdev *cdev, void *buf, size_t size,
loff_t offp = offset;
int usable_leb_size = vol->usable_leb_size;
- printf("%s: %d @ 0x%08lx\n", __func__, size, offset);
+ printf("%s: %d @ 0x%08llx\n", __func__, size, offset);
len = size > usable_leb_size ? usable_leb_size : size;
@@ -56,7 +56,7 @@ static ssize_t ubi_volume_cdev_read(struct cdev *cdev, void *buf, size_t size,
}
static ssize_t ubi_volume_cdev_write(struct cdev* cdev, const void *buf,
- size_t size, unsigned long offset, unsigned long flags)
+ size_t size, loff_t offset, unsigned long flags)
{
struct ubi_volume_cdev_priv *priv = cdev->priv;
struct ubi_volume *vol = priv->vol;
@@ -121,7 +121,7 @@ static int ubi_volume_cdev_close(struct cdev *cdev)
return 0;
}
-static off_t ubi_volume_cdev_lseek(struct cdev *cdev, off_t ofs)
+static loff_t ubi_volume_cdev_lseek(struct cdev *cdev, loff_t ofs)
{
struct ubi_volume_cdev_priv *priv = cdev->priv;
diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
index f47fc9e65b..d23775b5a4 100644
--- a/drivers/net/miidev.c
+++ b/drivers/net/miidev.c
@@ -180,7 +180,7 @@ int miidev_print_status(struct mii_device *mdev)
return 0;
}
-static ssize_t miidev_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t miidev_read(struct cdev *cdev, void *_buf, size_t count, loff_t offset, ulong flags)
{
int i = count;
uint16_t *buf = _buf;
@@ -196,7 +196,7 @@ static ssize_t miidev_read(struct cdev *cdev, void *_buf, size_t count, ulong of
return count;
}
-static ssize_t miidev_write(struct cdev *cdev, const void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t miidev_write(struct cdev *cdev, const void *_buf, size_t count, loff_t offset, ulong flags)
{
int i = count;
const uint16_t *buf = _buf;
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index 654e6470c1..16885c0af9 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -82,9 +82,9 @@ static void flash_add_byte (struct flash_info *info, cfiword_t * cword, uchar c)
return;
}
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef __BIG_ENDIAN
*cword = (*cword << 8) | c;
-#else
+#elif defined __LITTLE_ENDIAN
if (bankwidth_is_2(info))
*cword = (*cword >> 8) | (u16)c << 8;
@@ -92,6 +92,8 @@ static void flash_add_byte (struct flash_info *info, cfiword_t * cword, uchar c)
*cword = (*cword >> 8) | (u32)c << 24;
else if (bankwidth_is_8(info))
*cword = (*cword >> 8) | (u64)c << 56;
+#else
+#error "could not determine byte order"
#endif
}
@@ -167,7 +169,7 @@ static void flash_printqry (struct cfi_qry *qry)
uchar flash_read_uchar (struct flash_info *info, uint offset)
{
uchar *cp = flash_make_addr(info, 0, offset);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined __LITTLE_ENDIAN
return flash_read8(cp);
#else
return flash_read8(cp + info->portwidth - 1);
@@ -195,7 +197,7 @@ static ulong flash_read_long (struct flash_info *info, flash_sect_t sect, uint o
debug ("addr[%x] = 0x%x\n", x, flash_read8(addr + x));
}
#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined __LITTLE_ENDIAN
retval = ((flash_read8(addr) << 16) |
(flash_read8(addr + info->portwidth) << 24) |
(flash_read8(addr + 2 * info->portwidth)) |
@@ -456,7 +458,7 @@ flash_sect_t find_sector (struct flash_info *info, ulong addr)
return sector;
}
-static int __cfi_erase(struct cdev *cdev, size_t count, unsigned long offset,
+static int __cfi_erase(struct cdev *cdev, size_t count, loff_t offset,
int verbose)
{
struct flash_info *finfo = (struct flash_info *)cdev->priv;
@@ -491,7 +493,7 @@ out:
return ret;
}
-static int cfi_erase(struct cdev *cdev, size_t count, unsigned long offset)
+static int cfi_erase(struct cdev *cdev, size_t count, loff_t offset)
{
return __cfi_erase(cdev, count, offset, 1);
}
@@ -628,7 +630,7 @@ static int flash_real_protect (struct flash_info *info, long sector, int prot)
return retcode;
}
-static int cfi_protect(struct cdev *cdev, size_t count, unsigned long offset, int prot)
+static int cfi_protect(struct cdev *cdev, size_t count, loff_t offset, int prot)
{
struct flash_info *finfo = (struct flash_info *)cdev->priv;
unsigned long start, end;
@@ -651,7 +653,7 @@ out:
return ret;
}
-static ssize_t cfi_write(struct cdev *cdev, const void *buf, size_t count, unsigned long offset, ulong flags)
+static ssize_t cfi_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
{
struct flash_info *finfo = (struct flash_info *)cdev->priv;
int ret;
diff --git a/drivers/nor/m25p80.c b/drivers/nor/m25p80.c
index 77669c2808..14402270bc 100644
--- a/drivers/nor/m25p80.c
+++ b/drivers/nor/m25p80.c
@@ -194,13 +194,14 @@ static int erase_sector(struct m25p *flash, u32 offset)
* Erase an address range on the flash chip. The address range may extend
* one or more erase sectors. Return an error is there is a problem erasing.
*/
-static ssize_t m25p80_erase(struct cdev *cdev, size_t count, unsigned long offset)
+static ssize_t m25p80_erase(struct cdev *cdev, size_t count, loff_t offset)
{
struct m25p *flash = cdev->priv;
u32 addr, len;
u32 start_sector;
u32 end_sector;
u32 progress = 0;
+ int eraseshift = ffs(flash->erasesize) - 1;
dev_dbg(&flash->spi->dev, "%s %s 0x%llx, len %lld\n",
__func__, "at", (long long)offset, (long long)count);
@@ -212,8 +213,8 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, unsigned long offse
addr = offset;
len = count;
- start_sector = offset / flash->erasesize;
- end_sector = (offset + count - 1) / flash->erasesize;
+ start_sector = offset >> eraseshift;
+ end_sector = (offset + count - 1) >> eraseshift;
init_progression_bar(end_sector - start_sector + 1);
/* whole-chip erase? */
@@ -250,7 +251,8 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, unsigned long offse
return 0;
}
-ssize_t m25p80_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags)
+ssize_t m25p80_read(struct cdev *cdev, void *buf, size_t count, loff_t offset,
+ ulong flags)
{
struct m25p *flash = cdev->priv;
struct spi_transfer t[2];
@@ -302,7 +304,8 @@ ssize_t m25p80_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ul
return retlen;
}
-ssize_t m25p80_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags)
+ssize_t m25p80_write(struct cdev *cdev, const void *buf, size_t count,
+ loff_t offset, ulong flags)
{
struct m25p *flash = cdev->priv;
struct spi_transfer t[2];
@@ -381,7 +384,8 @@ ssize_t m25p80_write(struct cdev *cdev, const void *buf, size_t count, ulong off
return retlen;
}
#ifdef CONFIG_MTD_SST25L
-ssize_t sst_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags)
+ssize_t sst_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset,
+ ulong flags)
{
struct m25p *flash = cdev->priv;
struct spi_transfer t[2];
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
index c7c798b238..99f6d49c2c 100644
--- a/fs/cramfs/cramfs.c
+++ b/fs/cramfs/cramfs.c
@@ -358,7 +358,7 @@ static int cramfs_read(struct device_d *_dev, FILE *f, void *buf, size_t size)
return outsize;
}
-static off_t cramfs_lseek(struct device_d *dev, FILE *f, off_t pos)
+static loff_t cramfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
{
f->pos = pos;
return f->pos;
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index ff6a97627a..cdb8f79336 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -96,7 +96,7 @@ void cdev_close(struct cdev *cdev)
cdev->ops->close(cdev);
}
-ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags)
+ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
{
if (!cdev->ops->read)
return -ENOSYS;
@@ -104,7 +104,7 @@ ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulon
return cdev->ops->read(cdev, buf, count, cdev->offset +offset, flags);
}
-ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags)
+ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
{
if (!cdev->ops->write)
return -ENOSYS;
@@ -123,15 +123,15 @@ int cdev_flush(struct cdev *cdev)
static int partition_ioctl(struct cdev *cdev, int request, void *buf)
{
int ret = 0;
- size_t offset;
+ loff_t offset, *_buf = buf;
struct mtd_info_user *user = buf;
switch (request) {
case MEMSETBADBLOCK:
case MEMGETBADBLOCK:
- offset = (off_t)buf;
+ offset = *_buf;
offset += cdev->offset;
- ret = cdev->ops->ioctl(cdev, request, (void *)offset);
+ ret = cdev->ops->ioctl(cdev, request, &offset);
break;
case MEMGETINFO:
if (cdev->mtd) {
@@ -165,10 +165,11 @@ static int partition_ioctl(struct cdev *cdev, int request, void *buf)
case MEMGETREGIONINFO:
if (cdev->mtd) {
struct region_info_user *reg = buf;
+ int erasesize_shift = ffs(cdev->mtd->erasesize) - 1;
reg->offset = cdev->offset;
reg->erasesize = cdev->mtd->erasesize;
- reg->numblocks = cdev->size/reg->erasesize;
+ reg->numblocks = cdev->size >> erasesize_shift;
reg->regionindex = cdev->mtd->index;
}
break;
@@ -191,7 +192,7 @@ int cdev_ioctl(struct cdev *cdev, int request, void *buf)
return cdev->ops->ioctl(cdev, request, buf);
}
-int cdev_erase(struct cdev *cdev, size_t count, unsigned long offset)
+int cdev_erase(struct cdev *cdev, size_t count, loff_t offset)
{
if (!cdev->ops->erase)
return -ENOSYS;
@@ -226,7 +227,7 @@ int devfs_remove(struct cdev *cdev)
return 0;
}
-int devfs_add_partition(const char *devname, unsigned long offset, size_t size,
+int devfs_add_partition(const char *devname, loff_t offset, loff_t size,
int flags, const char *name)
{
struct cdev *cdev, *new;
diff --git a/fs/devfs.c b/fs/devfs.c
index ae48451b6c..5aace362e2 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -52,10 +52,10 @@ static int devfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t s
return cdev_write(cdev, buf, size, f->pos, f->flags);
}
-static off_t devfs_lseek(struct device_d *_dev, FILE *f, off_t pos)
+static loff_t devfs_lseek(struct device_d *_dev, FILE *f, loff_t pos)
{
struct cdev *cdev = f->inode;
- off_t ret = -1;
+ loff_t ret = -1;
if (cdev->ops->lseek)
ret = cdev->ops->lseek(cdev, pos + cdev->offset);
@@ -66,7 +66,7 @@ static off_t devfs_lseek(struct device_d *_dev, FILE *f, off_t pos)
return ret - cdev->offset;
}
-static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, unsigned long offset)
+static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, loff_t offset)
{
struct cdev *cdev = f->inode;
@@ -79,7 +79,7 @@ static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, unsigned lo
return cdev->ops->erase(cdev, count, offset + cdev->offset);
}
-static int devfs_protect(struct device_d *_dev, FILE *f, size_t count, unsigned long offset, int prot)
+static int devfs_protect(struct device_d *_dev, FILE *f, size_t count, loff_t offset, int prot)
{
struct cdev *cdev = f->inode;
@@ -100,7 +100,7 @@ static int devfs_memmap(struct device_d *_dev, FILE *f, void **map, int flags)
ret = cdev->ops->memmap(cdev, map, flags);
if (!ret)
- *map = (void *)((unsigned long)*map + cdev->offset);
+ *map = (void *)((unsigned long)*map + (unsigned long)cdev->offset);
return ret;
}
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 21464bde95..5e6c81c358 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -49,7 +49,7 @@ DRESULT disk_read(FATFS *fat, BYTE *buf, DWORD sector, BYTE count)
debug("%s: sector: %ld count: %d\n", __func__, sector, count);
- ret = cdev_read(priv->cdev, buf, count << 9, sector * 512, 0);
+ ret = cdev_read(priv->cdev, buf, count << 9, (loff_t)sector * 512, 0);
if (ret != count << 9)
return ret;
@@ -64,7 +64,7 @@ DRESULT disk_write(FATFS *fat, const BYTE *buf, DWORD sector, BYTE count)
debug("%s: buf: %p sector: %ld count: %d\n",
__func__, buf, sector, count);
- ret = cdev_write(priv->cdev, buf, count << 9, sector * 512, 0);
+ ret = cdev_write(priv->cdev, buf, count << 9, (loff_t)sector * 512, 0);
if (ret != count << 9)
return ret;
@@ -271,7 +271,7 @@ static int fat_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
return outsize;
}
-static off_t fat_lseek(struct device_d *dev, FILE *f, off_t pos)
+static loff_t fat_lseek(struct device_d *dev, FILE *f, loff_t pos)
{
FIL *f_file = f->inode;
int ret;
diff --git a/fs/fs.c b/fs/fs.c
index af73c8c8aa..7dd6c03816 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -692,12 +692,12 @@ int flush(int fd)
return ret;
}
-off_t lseek(int fildes, off_t offset, int whence)
+loff_t lseek(int fildes, loff_t offset, int whence)
{
struct device_d *dev;
struct fs_driver_d *fsdrv;
FILE *f = &files[fildes];
- off_t pos;
+ loff_t pos;
int ret;
if (check_fd(fildes))
@@ -1243,7 +1243,7 @@ static void memcpy_sz(void *_dst, const void *_src, ulong count, ulong rwsize)
}
}
-ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags)
+ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
{
ulong size;
struct device_d *dev;
@@ -1252,13 +1252,13 @@ ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong
return -1;
dev = cdev->dev;
- size = min((ulong)count, dev->resource[0].size - offset);
+ size = min((loff_t)count, dev->resource[0].size - offset);
memcpy_sz(buf, dev_get_mem_region(dev, 0) + offset, size, flags & O_RWSIZE_MASK);
return size;
}
EXPORT_SYMBOL(mem_read);
-ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags)
+ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
{
ulong size;
struct device_d *dev;
@@ -1267,7 +1267,7 @@ ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, ulong offset
return -1;
dev = cdev->dev;
- size = min((ulong)count, dev->resource[0].size - offset);
+ size = min((loff_t)count, dev->resource[0].size - offset);
memcpy_sz(dev_get_mem_region(dev, 0) + offset, buf, size, flags & O_RWSIZE_MASK);
return size;
}
diff --git a/fs/nfs.c b/fs/nfs.c
index 75a8f25066..79e667f489 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -805,7 +805,7 @@ static int nfs_read(struct device_d *dev, FILE *file, void *buf, size_t insize)
return outsize;
}
-static off_t nfs_lseek(struct device_d *dev, FILE *file, off_t pos)
+static loff_t nfs_lseek(struct device_d *dev, FILE *file, loff_t pos)
{
struct file_priv *priv = file->inode;
diff --git a/fs/ramfs.c b/fs/ramfs.c
index cec5e769b0..91d06b8d3a 100644
--- a/fs/ramfs.c
+++ b/fs/ramfs.c
@@ -428,7 +428,7 @@ static int ramfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t i
return insize;
}
-static off_t ramfs_lseek(struct device_d *dev, FILE *f, off_t pos)
+static loff_t ramfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
{
f->pos = pos;
return f->pos;
diff --git a/fs/tftp.c b/fs/tftp.c
index 6586270e35..b58d6fcf56 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -569,7 +569,7 @@ static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize)
return outsize;
}
-static off_t tftp_lseek(struct device_d *dev, FILE *f, off_t pos)
+static loff_t tftp_lseek(struct device_d *dev, FILE *f, loff_t pos)
{
/* not implemented in tftp protocol */
return -ENOSYS;
diff --git a/include/common.h b/include/common.h
index d2347f8629..c7707bae50 100644
--- a/include/common.h
+++ b/include/common.h
@@ -34,6 +34,24 @@
#include <linux/stddef.h>
#include <asm/common.h>
+/*
+ * sanity check. The Linux Kernel defines only one of __LITTLE_ENDIAN and
+ * __BIG_ENDIAN. Endianess can then be tested with #ifdef __xx_ENDIAN. Userspace
+ * always defined both __LITTLE_ENDIAN and __BIG_ENDIAN and byteorder can then
+ * be tested with #if __BYTE_ORDER == __xx_ENDIAN.
+ *
+ * As we tend to use a lot of Kernel code in barebox we use the kernel way of
+ * determing the byte order. Make sure here that architecture code properly
+ * defines it.
+ */
+#include <asm/byteorder.h>
+#if defined __LITTLE_ENDIAN && defined __BIG_ENDIAN
+#error "both __LITTLE_ENDIAN and __BIG_ENDIAN are defined"
+#endif
+#if !defined __LITTLE_ENDIAN && !defined __BIG_ENDIAN
+#error "None of __LITTLE_ENDIAN and __BIG_ENDIAN are defined"
+#endif
+
#define pr_info(fmt, arg...) printf(fmt, ##arg)
#define pr_notice(fmt, arg...) printf(fmt, ##arg)
#define pr_err(fmt, arg...) printf(fmt, ##arg)
@@ -138,10 +156,11 @@ struct memarea_info {
unsigned long flags;
};
-int parse_area_spec(const char *str, ulong *start, ulong *size);
+int parse_area_spec(const char *str, loff_t *start, loff_t *size);
/* Just like simple_strtoul(), but this one honors a K/M/G suffix */
unsigned long strtoul_suffix(const char *str, char **endp, int base);
+unsigned long long strtoull_suffix(const char *str, char **endp, int base);
void start_barebox(void);
void shutdown_barebox(void);
@@ -210,7 +229,7 @@ int run_shell(void);
#define PAGE_SIZE 4096
#define PAGE_SHIFT 12
-int memory_display(char *addr, ulong offs, ulong nbytes, int size);
+int memory_display(char *addr, loff_t offs, ulong nbytes, int size);
extern const char version_string[];
#ifdef CONFIG_BANNER
diff --git a/include/cramfs/cramfs_fs.h b/include/cramfs/cramfs_fs.h
index af2940be05..8c53fc737d 100644
--- a/include/cramfs/cramfs_fs.h
+++ b/include/cramfs/cramfs_fs.h
@@ -84,11 +84,7 @@ struct cramfs_super {
| CRAMFS_FLAG_WRONG_SIGNATURE \
| CRAMFS_FLAG_SHIFTED_ROOT_OFFSET )
-#ifndef __BYTE_ORDER
-#error "No byte order defined in __BYTE_ORDER"
-#endif
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
#define CRAMFS_16(x) (x)
#define CRAMFS_24(x) (x)
#define CRAMFS_32(x) (x)
@@ -96,7 +92,7 @@ struct cramfs_super {
#define CRAMFS_GET_OFFSET(x) ((x)->offset)
#define CRAMFS_SET_OFFSET(x,y) ((x)->offset = (y))
#define CRAMFS_SET_NAMELEN(x,y) ((x)->namelen = (y))
-#elif __BYTE_ORDER ==__BIG_ENDIAN
+#elif defined __BIG_ENDIAN
#ifdef __KERNEL__
#define CRAMFS_16(x) swab16(x)
#define CRAMFS_24(x) ((swab32(x)) >> 8)
diff --git a/include/driver.h b/include/driver.h
index 09dd1e45c0..eacd8e6813 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -301,8 +301,8 @@ struct cdev;
int dev_protect(struct device_d *dev, size_t count, unsigned long offset, int prot);
/* These are used by drivers which work with direct memory accesses */
-ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags);
-ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags);
+ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags);
+ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags);
int mem_memmap(struct cdev *cdev, void **map, int flags);
/* Use this if you have nothing to do in your drivers probe function */
@@ -316,7 +316,7 @@ void devices_shutdown(void);
int generic_memmap_ro(struct cdev *dev, void **map, int flags);
int generic_memmap_rw(struct cdev *dev, void **map, int flags);
-static inline off_t dev_lseek_default(struct cdev *cdev, off_t ofs)
+static inline loff_t dev_lseek_default(struct cdev *cdev, loff_t ofs)
{
return ofs;
}
@@ -373,18 +373,18 @@ extern struct bus_type platform_bus;
struct file_operations {
/*! Called in response of reading from this device. Required */
- ssize_t (*read)(struct cdev*, void* buf, size_t count, ulong offset, ulong flags);
+ ssize_t (*read)(struct cdev*, void* buf, size_t count, loff_t offset, ulong flags);
/*! Called in response of write to this device. Required */
- ssize_t (*write)(struct cdev*, const void* buf, size_t count, ulong offset, ulong flags);
+ ssize_t (*write)(struct cdev*, const void* buf, size_t count, loff_t offset, ulong flags);
int (*ioctl)(struct cdev*, int, void *);
- off_t (*lseek)(struct cdev*, off_t);
+ loff_t (*lseek)(struct cdev*, loff_t);
int (*open)(struct cdev*, unsigned long flags);
int (*close)(struct cdev*);
int (*flush)(struct cdev*);
- int (*erase)(struct cdev*, size_t count, unsigned long offset);
- int (*protect)(struct cdev*, size_t count, unsigned long offset, int prot);
+ int (*erase)(struct cdev*, size_t count, loff_t offset);
+ int (*protect)(struct cdev*, size_t count, loff_t offset, int prot);
int (*memmap)(struct cdev*, void **map, int flags);
};
@@ -395,8 +395,8 @@ struct cdev {
struct list_head list;
struct list_head devices_list;
char *name;
- unsigned long offset;
- size_t size;
+ loff_t offset;
+ loff_t size;
unsigned int flags;
int open;
struct mtd_info *mtd;
@@ -409,16 +409,16 @@ struct cdev *cdev_by_name(const char *filename);
struct cdev *cdev_open(const char *name, unsigned long flags);
void cdev_close(struct cdev *cdev);
int cdev_flush(struct cdev *cdev);
-ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags);
-ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags);
+ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags);
+ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags);
int cdev_ioctl(struct cdev *cdev, int cmd, void *buf);
-int cdev_erase(struct cdev *cdev, size_t count, unsigned long offset);
+int cdev_erase(struct cdev *cdev, size_t count, loff_t offset);
#define DEVFS_PARTITION_FIXED (1 << 0)
#define DEVFS_PARTITION_READONLY (1 << 1)
#define DEVFS_IS_PARTITION (1 << 2)
-int devfs_add_partition(const char *devname, unsigned long offset, size_t size,
+int devfs_add_partition(const char *devname, loff_t offset, loff_t size,
int flags, const char *name);
int devfs_del_partition(const char *name);
diff --git a/include/envfs.h b/include/envfs.h
index 67b890222c..ba976d6d13 100644
--- a/include/envfs.h
+++ b/include/envfs.h
@@ -34,11 +34,25 @@ struct envfs_super {
uint32_t sb_crc; /* crc for the superblock */
};
-#ifndef __BYTE_ORDER
-#error "No byte order defined in __BYTE_ORDER"
+#ifdef __BAREBOX__
+# ifdef __LITTLE_ENDIAN
+# define ENVFS_ORDER_LITTLE
+# elif defined __BIG_ENDIAN
+# define ENVFS_ORDER_BIG
+# else
+# error "could not determine byte order"
+# endif
+#else
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define ENVFS_ORDER_LITTLE
+# elif __BYTE_ORDER == __BIG_ENDIAN
+# define ENVFS_ORDER_BIG
+# else
+# error "could not determine byte order"
+# endif
#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef ENVFS_ORDER_LITTLE
#define ENVFS_16(x) (x)
#define ENVFS_24(x) (x)
#define ENVFS_32(x) (x)
@@ -46,7 +60,7 @@ struct envfs_super {
#define ENVFS_GET_OFFSET(x) ((x)->offset)
#define ENVFS_SET_OFFSET(x,y) ((x)->offset = (y))
#define ENVFS_SET_NAMELEN(x,y) ((x)->namelen = (y))
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#elif defined ENVFS_ORDER_BIG
#ifdef __KERNEL__
#define ENVFS_16(x) swab16(x)
#define ENVFS_24(x) ((swab32(x)) >> 8)
diff --git a/include/fs.h b/include/fs.h
index d82f02626a..2b1023e453 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -23,8 +23,8 @@ typedef struct dir {
typedef struct filep {
struct device_d *dev; /* The device this FILE belongs to */
- ulong pos; /* current position in stream */
- ulong size; /* The size of this inode */
+ loff_t pos; /* current position in stream */
+ loff_t size; /* The size of this inode */
ulong flags; /* the O_* flags from open */
void *inode; /* private to the filesystem driver */
@@ -54,7 +54,7 @@ struct fs_driver_d {
int (*read)(struct device_d *dev, FILE *f, void *buf, size_t size);
int (*write)(struct device_d *dev, FILE *f, const void *buf, size_t size);
int (*flush)(struct device_d *dev, FILE *f);
- off_t (*lseek)(struct device_d *dev, FILE *f, off_t pos);
+ loff_t (*lseek)(struct device_d *dev, FILE *f, loff_t pos);
struct dir* (*opendir)(struct device_d *dev, const char *pathname);
struct dirent* (*readdir)(struct device_d *dev, struct dir *dir);
@@ -63,9 +63,9 @@ struct fs_driver_d {
int (*ioctl)(struct device_d *dev, FILE *f, int request, void *buf);
int (*erase)(struct device_d *dev, FILE *f, size_t count,
- unsigned long offset);
+ loff_t offset);
int (*protect)(struct device_d *dev, FILE *f, size_t count,
- unsigned long offset, int prot);
+ loff_t offset, int prot);
int (*memmap)(struct device_d *dev, FILE *f, void **map, int flags);
@@ -109,7 +109,7 @@ ssize_t write(int fd, const void *buf, size_t count);
#define SEEK_CUR 2
#define SEEK_END 3
-off_t lseek(int fildes, off_t offset, int whence);
+loff_t lseek(int fildes, loff_t offset, int whence);
int mkdir (const char *pathname, mode_t mode);
/* Create a directory and its parents */
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index aab8f4b6bf..2d68d99fa4 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -78,13 +78,6 @@
*
*/
-#ifndef __LITTLE_ENDIAN
-#define __LITTLE_ENDIAN 1234
-#endif
-#ifndef __BIG_ENDIAN
-#define __BIG_ENDIAN 4321
-#endif
-
#if defined(__KERNEL__)
/*
* inside the kernel, we can use nicknames;
diff --git a/include/linux/stat.h b/include/linux/stat.h
index bc7dce4508..af022c5c79 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -52,7 +52,7 @@ struct stat {
unsigned short st_gid;
unsigned short st_rdev;
unsigned short __pad2;
- unsigned long st_size;
+ loff_t st_size;
unsigned long st_blksize;
unsigned long st_blocks;
unsigned long st_atime;
diff --git a/include/partition.h b/include/partition.h
index 0827bb40c6..8ad7490d85 100644
--- a/include/partition.h
+++ b/include/partition.h
@@ -8,7 +8,7 @@ struct partition {
int flags;
- unsigned long offset;
+ loff_t offset;
struct device_d *physdev;
struct device_d device;
diff --git a/include/usb/usb.h b/include/usb/usb.h
index f273983f5f..19b092ea65 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -271,12 +271,14 @@ void usb_rescan(void);
((x_ & 0xFF000000UL) >> 24)); \
})
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
# define swap_16(x) (x)
# define swap_32(x) (x)
-#else
+#elif defined BIG_ENDIAN
# define swap_16(x) __swap_16(x)
# define swap_32(x) __swap_32(x)
+#else
+#error "could not determine byte order"
#endif
/*
diff --git a/lib/lzo/modules.builtin b/lib/lzo/modules.builtin
deleted file mode 100644
index d86056282a..0000000000
--- a/lib/lzo/modules.builtin
+++ /dev/null
@@ -1,2 +0,0 @@
-kernel/lib/lzo/lzo_compress.ko
-kernel/lib/lzo/lzo_decompress.ko
diff --git a/lib/misc.c b/lib/misc.c
index 549b9601c9..8a95396eda 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -27,15 +27,15 @@
#include <linux/ctype.h>
/*
- * Like simple_strtoul() but handles an optional G, M, K or k
+ * Like simple_strtoull() but handles an optional G, M, K or k
* suffix for Gigabyte, Megabyte or Kilobyte
*/
-unsigned long strtoul_suffix(const char *str, char **endp, int base)
+unsigned long long strtoull_suffix(const char *str, char **endp, int base)
{
- unsigned long val;
+ unsigned long long val;
char *end;
- val = simple_strtoul(str, &end, base);
+ val = simple_strtoull(str, &end, base);
switch (*end) {
case 'G':
@@ -55,6 +55,12 @@ unsigned long strtoul_suffix(const char *str, char **endp, int base)
return val;
}
+EXPORT_SYMBOL(strtoull_suffix);
+
+unsigned long strtoul_suffix(const char *str, char **endp, int base)
+{
+ return strtoull_suffix(str, endp, base);
+}
EXPORT_SYMBOL(strtoul_suffix);
/*
@@ -69,15 +75,15 @@ EXPORT_SYMBOL(strtoul_suffix);
* 0x1000 -> start = 0x1000, size = ~0
* 1M+1k -> start = 0x100000, size = 0x400
*/
-int parse_area_spec(const char *str, ulong *start, ulong *size)
+int parse_area_spec(const char *str, loff_t *start, loff_t *size)
{
char *endp;
- ulong end;
+ loff_t end;
if (!isdigit(*str))
return -1;
- *start = strtoul_suffix(str, &endp, 0);
+ *start = strtoull_suffix(str, &endp, 0);
str = endp;
@@ -89,7 +95,7 @@ int parse_area_spec(const char *str, ulong *start, ulong *size)
if (*str == '-') {
/* beginning and end given */
- end = strtoul_suffix(str + 1, NULL, 0);
+ end = strtoull_suffix(str + 1, NULL, 0);
if (end < *start) {
printf("end < start\n");
return -1;
@@ -100,7 +106,7 @@ int parse_area_spec(const char *str, ulong *start, ulong *size)
if (*str == '+') {
/* beginning and size given */
- *size = strtoul_suffix(str + 1, NULL, 0);
+ *size = strtoull_suffix(str + 1, NULL, 0);
return 0;
}
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 9763515130..17c197334a 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -83,6 +83,7 @@ unsigned long long simple_strtoull (const char *cp, char **endp, unsigned int ba
*endp = (char *) cp;
return result;
}
+EXPORT_SYMBOL(simple_strtoll);
/* we use this so that we can do without the ctype library */
#define is_digit(c) ((c) >= '0' && (c) <= '9')
diff --git a/lib/zlib_inflate/modules.builtin b/lib/zlib_inflate/modules.builtin
deleted file mode 100644
index 720622562c..0000000000
--- a/lib/zlib_inflate/modules.builtin
+++ /dev/null
@@ -1 +0,0 @@
-kernel/lib/zlib_inflate/zlib_inflate.ko