mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] sandbox-unaligned: better usement of ifdef
@ 2012-09-11  5:30 Alexander Aring
  2012-09-11  5:30 ` [PATCH 2/3] sandbox: fix posix_types Alexander Aring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexander Aring @ 2012-09-11  5:30 UTC (permalink / raw)
  To: barebox

GCC versions below 4.6 don't set __BYTE_ORDER__
with __ORDER_LITTLE_ENDIAN__. So it's better to use
__BYTE_ORDER and __LITTLE_ENDIAN instead.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 arch/sandbox/include/asm/unaligned.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/include/asm/unaligned.h b/arch/sandbox/include/asm/unaligned.h
index 07c1ae4..d02da6e 100644
--- a/arch/sandbox/include/asm/unaligned.h
+++ b/arch/sandbox/include/asm/unaligned.h
@@ -8,7 +8,7 @@
 #include <linux/unaligned/access_ok.h>
 #include <linux/unaligned/generic.h>
 
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#if __BYTE_ORDER == __LITTLE_ENDIAN
 #define get_unaligned __get_unaligned_le
 #define put_unaligned __put_unaligned_le
 #else
-- 
1.7.12


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] sandbox: fix posix_types
  2012-09-11  5:30 [PATCH 1/3] sandbox-unaligned: better usement of ifdef Alexander Aring
@ 2012-09-11  5:30 ` Alexander Aring
  2012-09-11  5:30 ` [PATCH 3/3] sandbox: add missed case statement Alexander Aring
  2012-09-11  7:51 ` [PATCH 1/3] sandbox-unaligned: better usement of ifdef Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Aring @ 2012-09-11  5:30 UTC (permalink / raw)
  To: barebox

Fix setting of size_t ssize_t and ptrdiff_t for 32 bit and
64 bit systems.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 arch/sandbox/include/asm/posix_types.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/sandbox/include/asm/posix_types.h b/arch/sandbox/include/asm/posix_types.h
index 4345141..6985b8e 100644
--- a/arch/sandbox/include/asm/posix_types.h
+++ b/arch/sandbox/include/asm/posix_types.h
@@ -15,9 +15,23 @@ typedef int		__kernel_pid_t;
 typedef unsigned short	__kernel_ipc_pid_t;
 typedef unsigned short	__kernel_uid_t;
 typedef unsigned short	__kernel_gid_t;
+/*
+ * Most 32 bit architectures use "unsigned int" size_t,
+ * and all 64 bit architectures use "unsigned long" size_t.
+ *
+ * TODO: It's not clean to use __x86_64__ here. It's better
+ * to check on __BITS_PER_LONG here. But this is wrong set in
+ * arch/sandbox/include/asm/types.h.
+ */
+#ifdef __x86_64__
 typedef unsigned long	__kernel_size_t;
 typedef long		__kernel_ssize_t;
+typedef long		__kernel_ptrdiff_t;
+#else
+typedef unsigned int	__kernel_size_t;
+typedef int		__kernel_ssize_t;
 typedef int		__kernel_ptrdiff_t;
+#endif
 typedef long		__kernel_time_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
-- 
1.7.12


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] sandbox: add missed case statement
  2012-09-11  5:30 [PATCH 1/3] sandbox-unaligned: better usement of ifdef Alexander Aring
  2012-09-11  5:30 ` [PATCH 2/3] sandbox: fix posix_types Alexander Aring
@ 2012-09-11  5:30 ` Alexander Aring
  2012-09-11  7:51 ` [PATCH 1/3] sandbox-unaligned: better usement of ifdef Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Aring @ 2012-09-11  5:30 UTC (permalink / raw)
  To: barebox

Add missed case statement to ignore 'i' parameter
in first getopt loop.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 arch/sandbox/os/common.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index e296574..d2aea38 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -306,6 +306,8 @@ int main(int argc, char *argv[])
 		case 'm':
 			malloc_size = strtoul(optarg, NULL, 0);
 			break;
+		case 'i':
+			break;
 		case 'e':
 			sprintf(str, "env%d", envno);
 			ret = add_image(optarg, str);
@@ -343,7 +345,11 @@ int main(int argc, char *argv[])
 	}
 	mem_malloc_init(ram, ram + malloc_size - 1);
 
-	/* reset getopt */
+	/*
+	 * Reset getopt.
+	 * We need to run a second getopt to count -i parameters.
+	 * This is for /dev/fd# devices.
+	 */
 	optind = 1;
 
 	while (1) {
-- 
1.7.12


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] sandbox-unaligned: better usement of ifdef
  2012-09-11  5:30 [PATCH 1/3] sandbox-unaligned: better usement of ifdef Alexander Aring
  2012-09-11  5:30 ` [PATCH 2/3] sandbox: fix posix_types Alexander Aring
  2012-09-11  5:30 ` [PATCH 3/3] sandbox: add missed case statement Alexander Aring
@ 2012-09-11  7:51 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-09-11  7:51 UTC (permalink / raw)
  To: Alexander Aring; +Cc: barebox

On Tue, Sep 11, 2012 at 07:30:43AM +0200, Alexander Aring wrote:
> GCC versions below 4.6 don't set __BYTE_ORDER__
> with __ORDER_LITTLE_ENDIAN__. So it's better to use
> __BYTE_ORDER and __LITTLE_ENDIAN instead.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>

These fix some warnings on a 32bit sandbox build also for me.

Thanks, applied.

Sascha

> ---
>  arch/sandbox/include/asm/unaligned.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/sandbox/include/asm/unaligned.h b/arch/sandbox/include/asm/unaligned.h
> index 07c1ae4..d02da6e 100644
> --- a/arch/sandbox/include/asm/unaligned.h
> +++ b/arch/sandbox/include/asm/unaligned.h
> @@ -8,7 +8,7 @@
>  #include <linux/unaligned/access_ok.h>
>  #include <linux/unaligned/generic.h>
>  
> -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
>  #define get_unaligned __get_unaligned_le
>  #define put_unaligned __put_unaligned_le
>  #else
> -- 
> 1.7.12
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-11  7:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-11  5:30 [PATCH 1/3] sandbox-unaligned: better usement of ifdef Alexander Aring
2012-09-11  5:30 ` [PATCH 2/3] sandbox: fix posix_types Alexander Aring
2012-09-11  5:30 ` [PATCH 3/3] sandbox: add missed case statement Alexander Aring
2012-09-11  7:51 ` [PATCH 1/3] sandbox-unaligned: better usement of ifdef Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox