Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0682490d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull UML fixes from Richard Weinberger.

* 'for-3.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
  um: uml_setup_stubs': warning: unused variable 'pages'
  um: Use asm-generic/switch_to.h
  um: Disintegrate asm/system.h
  um: switch cow_user.h to htobe{32,64}/betoh{32,64}
  um: several x86 hw-dependent crypto modules won't build on uml
  um: fix linker script generation
parents 3a48d1c0 657b12d3
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
@@ -3,41 +3,6 @@

#include <asm/types.h>

#if defined(__KERNEL__)

# include <asm/byteorder.h>

# if defined(__BIG_ENDIAN)
#	define ntohll(x) (x)
#	define htonll(x) (x)
# elif defined(__LITTLE_ENDIAN)
#	define ntohll(x)  be64_to_cpu(x)
#	define htonll(x)  cpu_to_be64(x)
# else
#	error "Could not determine byte order"
# endif

#else
/* For the definition of ntohl, htonl and __BYTE_ORDER */
#include <endian.h>
#include <netinet/in.h>
#if defined(__BYTE_ORDER)

#  if __BYTE_ORDER == __BIG_ENDIAN
#	define ntohll(x) (x)
#	define htonll(x) (x)
#  elif __BYTE_ORDER == __LITTLE_ENDIAN
#	define ntohll(x)  bswap_64(x)
#	define htonll(x)  bswap_64(x)
#  else
#	error "Could not determine byte order: __BYTE_ORDER uncorrectly defined"
#  endif

#else  /* ! defined(__BYTE_ORDER) */
#	error "Could not determine byte order: __BYTE_ORDER not defined"
#endif
#endif /* ! defined(__KERNEL__) */

extern int init_cow_file(int fd, char *cow_file, char *backing_file,
			 int sectorsize, int alignment, int *bitmap_offset_out,
			 unsigned long *bitmap_len_out, int *data_offset_out);
+21 −22
Original line number Diff line number Diff line
@@ -8,11 +8,10 @@
 * that.
 */
#include <unistd.h>
#include <byteswap.h>
#include <errno.h>
#include <string.h>
#include <arpa/inet.h>
#include <asm/types.h>
#include <endian.h>
#include "cow.h"
#include "cow_sys.h"

@@ -214,8 +213,8 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
			   "header\n");
		goto out;
	}
	header->magic = htonl(COW_MAGIC);
	header->version = htonl(COW_VERSION);
	header->magic = htobe32(COW_MAGIC);
	header->version = htobe32(COW_VERSION);

	err = -EINVAL;
	if (strlen(backing_file) > sizeof(header->backing_file) - 1) {
@@ -246,10 +245,10 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
		goto out_free;
	}

	header->mtime = htonl(modtime);
	header->size = htonll(*size);
	header->sectorsize = htonl(sectorsize);
	header->alignment = htonl(alignment);
	header->mtime = htobe32(modtime);
	header->size = htobe64(*size);
	header->sectorsize = htobe32(sectorsize);
	header->alignment = htobe32(alignment);
	header->cow_format = COW_BITMAP;

	err = cow_write_file(fd, header, sizeof(*header));
@@ -301,8 +300,8 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
	magic = header->v1.magic;
	if (magic == COW_MAGIC)
		version = header->v1.version;
	else if (magic == ntohl(COW_MAGIC))
		version = ntohl(header->v1.version);
	else if (magic == be32toh(COW_MAGIC))
		version = be32toh(header->v1.version);
	/* No error printed because the non-COW case comes through here */
	else goto out;

@@ -327,9 +326,9 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
				   "header\n");
			goto out;
		}
		*mtime_out = ntohl(header->v2.mtime);
		*size_out = ntohll(header->v2.size);
		*sectorsize_out = ntohl(header->v2.sectorsize);
		*mtime_out = be32toh(header->v2.mtime);
		*size_out = be64toh(header->v2.size);
		*sectorsize_out = be32toh(header->v2.sectorsize);
		*bitmap_offset_out = sizeof(header->v2);
		*align_out = *sectorsize_out;
		file = header->v2.backing_file;
@@ -341,10 +340,10 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
				   "header\n");
			goto out;
		}
		*mtime_out = ntohl(header->v3.mtime);
		*size_out = ntohll(header->v3.size);
		*sectorsize_out = ntohl(header->v3.sectorsize);
		*align_out = ntohl(header->v3.alignment);
		*mtime_out = be32toh(header->v3.mtime);
		*size_out = be64toh(header->v3.size);
		*sectorsize_out = be32toh(header->v3.sectorsize);
		*align_out = be32toh(header->v3.alignment);
		if (*align_out == 0) {
			cow_printf("read_cow_header - invalid COW header, "
				   "align == 0\n");
@@ -366,16 +365,16 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
		 * this was used until Dec2005 - 64bits are needed to represent
		 * 2038+. I.e. we can safely do this truncating cast.
		 *
		 * Additionally, we must use ntohl() instead of ntohll(), since
		 * Additionally, we must use be32toh() instead of be64toh(), since
		 * the program used to use the former (tested - I got mtime
		 * mismatch "0 vs whatever").
		 *
		 * Ever heard about bug-to-bug-compatibility ? ;-) */
		*mtime_out = (time32_t) ntohl(header->v3_b.mtime);
		*mtime_out = (time32_t) be32toh(header->v3_b.mtime);

		*size_out = ntohll(header->v3_b.size);
		*sectorsize_out = ntohl(header->v3_b.sectorsize);
		*align_out = ntohl(header->v3_b.alignment);
		*size_out = be64toh(header->v3_b.size);
		*sectorsize_out = be32toh(header->v3_b.sectorsize);
		*align_out = be32toh(header->v3_b.alignment);
		if (*align_out == 0) {
			cow_printf("read_cow_header - invalid COW header, "
				   "align == 0\n");
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <linux/workqueue.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <asm/switch_to.h>

#include "init.h"
#include "irq_kern.h"
+2 −1
Original line number Diff line number Diff line
generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h
generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h
generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h
generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
generic-y += switch_to.h
+4 −3
Original line number Diff line number Diff line
@@ -5,7 +5,8 @@

CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START)		\
                        -DELF_ARCH=$(LDS_ELF_ARCH)	\
                        -DELF_FORMAT=$(LDS_ELF_FORMAT)
                        -DELF_FORMAT=$(LDS_ELF_FORMAT)	\
			$(LDS_EXTRA)
extra-y := vmlinux.lds
clean-files :=

Loading