public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [patch] sync_file_range01 change for arm
@ 2010-10-18  2:13 lina.zhao
  2010-10-18 10:08 ` Garrett Cooper
  0 siblings, 1 reply; 5+ messages in thread
From: lina.zhao @ 2010-10-18  2:13 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

Hi,

arm use __NR_sync_file_range2 not __NR_sync_file_range for system call.
the test casecheck __NR_sync_file_range for arm,
So test react "System doesn't support" for arm.
but actually arm use __NR_sync_file_range2 to support the system call.

powerpc is big endian, arm is small endian, so the parameter dealing is 
different.

Thanks,
Lina

[-- Attachment #2: sync_file_range.patch --]
[-- Type: text/x-diff, Size: 1658 bytes --]

From c4c30c43eba9c7af025496f23bb5936f0e9f0b76 Mon Sep 17 00:00:00 2001
From: Lina Zhao <lina.zhao@windriver.com>
Date: Thu, 14 Oct 2010 16:21:12 +0800
Subject: [PATCH] arm use __NR_sync_file_range2 not __NR_sync_file_range for system call.

So test react "System doesn't support" for arm.
but actually arm use __NR_sync_file_range2 to support the system call.

signed-off-by: Lina Zhao <lina.zhao@windriver.com>
---
 .../syscalls/sync_file_range/sync_file_range01.c   |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
index 53619b5..be82de8 100644
--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
+++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
@@ -96,7 +96,7 @@
 #include "usctest.h"
 #include "linux_syscall_numbers.h"
 
-#if defined(__powerpc__) || defined(__powerpc64__)
+#if defined(__powerpc__) || defined(__powerpc64__) || defined(__arm__)
 #ifndef __NR_sync_file_range2
 #define __NR_sync_file_range2 -1	//DUMMY VALUE
 int arch_support = 0;		//Architecure is not supported
@@ -246,6 +246,12 @@ static inline long syncfilerange(int fd, off64_t offset, off64_t nbytes,
 #elif (defined(__powerpc64__) || defined(__powerpc__)) && (__WORDSIZE==64)
 
 	return syscall(__NR_sync_file_range2, fd, flags, offset, nbytes);
+
+#elif (defined(__arm__))
+
+	return syscall(__NR_sync_file_range2, fd, flags,(int)offset,
+			(int)(offset >> 32),(int)nbytes,(int)(nbytes >> 32));
+
 #else
 
 	return syscall(__NR_sync_file_range, fd, offset, nbytes, flags);
-- 
1.6.3.1


[-- Attachment #3: Type: text/plain, Size: 369 bytes --]

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [patch] sync_file_range01 change for arm
  2010-10-18  2:13 [LTP] [patch] sync_file_range01 change for arm lina.zhao
@ 2010-10-18 10:08 ` Garrett Cooper
  2010-10-19  5:12   ` lina.zhao
  2010-10-22 12:47   ` Cyril Hrubis
  0 siblings, 2 replies; 5+ messages in thread
From: Garrett Cooper @ 2010-10-18 10:08 UTC (permalink / raw)
  To: lina.zhao; +Cc: ltp-list

On Sun, Oct 17, 2010 at 7:13 PM, lina.zhao <lina.zhao@windriver.com> wrote:
> Hi,
>
> arm use __NR_sync_file_range2 not __NR_sync_file_range for system call.
> the test casecheck __NR_sync_file_range for arm,
> So test react "System doesn't support" for arm.
> but actually arm use __NR_sync_file_range2 to support the system call.
>
> powerpc is big endian, arm is small endian, so the parameter dealing is
> different.

    Not true. ARM can be biendian, just like MIPS...
    A better test needs to be derived for endianness than this.
-Garrett

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [patch] sync_file_range01 change for arm
  2010-10-18 10:08 ` Garrett Cooper
@ 2010-10-19  5:12   ` lina.zhao
  2010-10-19  6:36     ` Garrett Cooper
  2010-10-22 12:47   ` Cyril Hrubis
  1 sibling, 1 reply; 5+ messages in thread
From: lina.zhao @ 2010-10-19  5:12 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

[-- Attachment #1: Type: text/plain, Size: 634 bytes --]

now endianness has been checked! see the patch
> On Sun, Oct 17, 2010 at 7:13 PM, lina.zhao <lina.zhao@windriver.com> wrote:
>   
>> Hi,
>>
>> arm use __NR_sync_file_range2 not __NR_sync_file_range for system call.
>> the test casecheck __NR_sync_file_range for arm,
>> So test react "System doesn't support" for arm.
>> but actually arm use __NR_sync_file_range2 to support the system call.
>>
>> powerpc is big endian, arm is small endian, so the parameter dealing is
>> different.
>>     
>
>     Not true. ARM can be biendian, just like MIPS...
>     A better test needs to be derived for endianness than this.
> -Garrett
>
>   


[-- Attachment #2: sync_file_rang01.patch --]
[-- Type: text/x-diff, Size: 3398 bytes --]

From cc07d890ae71837512731a0bf31006db8d717f8a Mon Sep 17 00:00:00 2001
From: Lina Zhao <lina.zhao@windriver.com>
Date: Tue, 19 Oct 2010 10:44:39 +0800
Subject: [PATCH] sync_file_rang01.c changed for arm

---
 .../syscalls/sync_file_range/sync_file_range01.c   |   36 ++++++++++++++------
 1 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
index 53619b5..a66ce85 100644
--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
+++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
@@ -96,12 +96,13 @@
 #include "usctest.h"
 #include "linux_syscall_numbers.h"
 
-#if defined(__powerpc__) || defined(__powerpc64__)
+#if defined(__powerpc__) || defined(__powerpc64__)|| defined(__arm__)
 #ifndef __NR_sync_file_range2
 #define __NR_sync_file_range2 -1	//DUMMY VALUE
 int arch_support = 0;		//Architecure is not supported
 #else
 int arch_support = 1;		//Architecture is supported
+char call_num = 1;		//Use __NR_sync_file_range2 as syscall
 #endif
 #else
 #ifndef __NR_sync_file_range
@@ -109,6 +110,7 @@ int arch_support = 1;		//Architecture is supported
 int arch_support = 0;
 #else
 int arch_support = 1;
+char call_num = 0;
 #endif
 #endif
 
@@ -139,7 +141,7 @@ struct test_data_t {
 	int error;
 } test_data[] = {
 	{
	&bfd, 0, 1, SYNC_FILE_RANGE_WRITE, EBADF}, {
 	&sfd, 0, 1, SYNC_FILE_RANGE_WAIT_AFTER, ESPIPE}, {
 	&filed, -1, 1, SYNC_FILE_RANGE_WAIT_BEFORE, EINVAL}, {
 	&filed, 0, -1, SYNC_FILE_RANGE_WRITE, EINVAL}, {
@@ -238,22 +240,33 @@ static inline long syncfilerange(int fd, off64_t offset, off64_t nbytes,
 				 unsigned int flags)
 {
 
-#if (defined(__powerpc64__) || defined(__powerpc__)) && (__WORDSIZE==32)
+	if (call_num){
+#if (__WORDSIZE==64)
 
-	return syscall(__NR_sync_file_range2, fd, flags, (int)(offset >> 32),
-		       (int)offset, (int)(nbytes >> 32), (int)nbytes);
+	return syscall(__NR_sync_file_range2, fd, flags, offset, nbytes);
 
-#elif (defined(__powerpc64__) || defined(__powerpc__)) && (__WORDSIZE==64)
+#elif (__WORDSIZE==32)
 
-	return syscall(__NR_sync_file_range2, fd, flags, offset, nbytes);
-#else
+	if (check_endian())	//little_endian 
+		return syscall(__NR_sync_file_range2, fd, flags,(int)offset,
+                	(int)(offset >> 32),(int)nbytes,(int)(nbytes >> 32));
+	else			//big_endian
+		return syscall(__NR_sync_file_range2, fd, flags, (int)(offset >> 32),
+			(int)offset, (int)(nbytes >> 32), (int)nbytes);
+#endif
+	else
 
 	return syscall(__NR_sync_file_range, fd, offset, nbytes, flags);
-#endif
 
-	return 0;
 }
 
+static int check_endian( void )
+{
+	int x = 1;
+	return ((char)(x) == x);
+}
+
+
 /******************************************************************************/
 /*                                                                            */
 /* Function:    main                                                          */
@@ -294,7 +307,8 @@ int main(int ac,		/* number of command line parameters                      */
 	}
 #else
 	/* For other archs, need kernel version > 2.6.16 */
-
+	if (arch_support)printf("arch supported!\n");
+	if (tst_kvercmp(2, 6, 17) < 0)printf("kernel cmp fail\n");
 	if (!arch_support || (tst_kvercmp(2, 6, 17) < 0)) {
 		tst_resm(TCONF, "System doesn't support execution of the test");
 		tst_exit();
-- 
1.6.3.1


[-- Attachment #3: Type: text/plain, Size: 369 bytes --]

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [patch] sync_file_range01 change for arm
  2010-10-19  5:12   ` lina.zhao
@ 2010-10-19  6:36     ` Garrett Cooper
  0 siblings, 0 replies; 5+ messages in thread
From: Garrett Cooper @ 2010-10-19  6:36 UTC (permalink / raw)
  To: lina.zhao; +Cc: ltp-list

On Oct 18, 2010, at 10:12 PM, lina.zhao wrote:

> now endianness has been checked! see the patch
>> On Sun, Oct 17, 2010 at 7:13 PM, lina.zhao <lina.zhao@windriver.com> wrote:
>>  
>>> Hi,
>>> 
>>> arm use __NR_sync_file_range2 not __NR_sync_file_range for system call.
>>> the test casecheck __NR_sync_file_range for arm,
>>> So test react "System doesn't support" for arm.
>>> but actually arm use __NR_sync_file_range2 to support the system call.
>>> 
>>> powerpc is big endian, arm is small endian, so the parameter dealing is
>>> different.
>>>    
>> 
>>    Not true. ARM can be biendian, just like MIPS...
>>    A better test needs to be derived for endianness than this.
>> -Garrett
>> 
>>  
> 
> From cc07d890ae71837512731a0bf31006db8d717f8a Mon Sep 17 00:00:00 2001
> From: Lina Zhao <lina.zhao@windriver.com>
> Date: Tue, 19 Oct 2010 10:44:39 +0800
> Subject: [PATCH] sync_file_rang01.c changed for arm
> 
> ---
> .../syscalls/sync_file_range/sync_file_range01.c   |   36 ++++++++++++++------
> 1 files changed, 25 insertions(+), 11 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
> index 53619b5..a66ce85 100644
> --- a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
> +++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c
> @@ -96,12 +96,13 @@
> #include "usctest.h"
> #include "linux_syscall_numbers.h"
> 
> -#if defined(__powerpc__) || defined(__powerpc64__)
> +#if defined(__powerpc__) || defined(__powerpc64__)|| defined(__arm__)
> #ifndef __NR_sync_file_range2
> #define __NR_sync_file_range2 -1	//DUMMY VALUE
> int arch_support = 0;		//Architecure is not supported
> #else
> int arch_support = 1;		//Architecture is supported
> +char call_num = 1;		//Use __NR_sync_file_range2 as syscall
> #endif
> #else
> #ifndef __NR_sync_file_range
> @@ -109,6 +110,7 @@ int arch_support = 1;		//Architecture is supported
> int arch_support = 0;
> #else
> int arch_support = 1;
> +char call_num = 0;
> #endif
> #endif
> 
> @@ -139,7 +141,7 @@ struct test_data_t {
> 	int error;
> } test_data[] = {
> 	{
> 	&bfd, 0, 1, SYNC_FILE_RANGE_WRITE, EBADF}, {
> 	&sfd, 0, 1, SYNC_FILE_RANGE_WAIT_AFTER, ESPIPE}, {
> 	&filed, -1, 1, SYNC_FILE_RANGE_WAIT_BEFORE, EINVAL}, {
> 	&filed, 0, -1, SYNC_FILE_RANGE_WRITE, EINVAL}, {
> @@ -238,22 +240,33 @@ static inline long syncfilerange(int fd, off64_t offset, off64_t nbytes,
> 				 unsigned int flags)
> {
> 
> -#if (defined(__powerpc64__) || defined(__powerpc__)) && (__WORDSIZE==32)
> +	if (call_num){
> +#if (__WORDSIZE==64)
> 
> -	return syscall(__NR_sync_file_range2, fd, flags, (int)(offset >> 32),
> -		       (int)offset, (int)(nbytes >> 32), (int)nbytes);
> +	return syscall(__NR_sync_file_range2, fd, flags, offset, nbytes);
> 
> -#elif (defined(__powerpc64__) || defined(__powerpc__)) && (__WORDSIZE==64)
> +#elif (__WORDSIZE==32)
> 
> -	return syscall(__NR_sync_file_range2, fd, flags, offset, nbytes);
> -#else
> +	if (check_endian())	//little_endian 
> +		return syscall(__NR_sync_file_range2, fd, flags,(int)offset,
> +                	(int)(offset >> 32),(int)nbytes,(int)(nbytes >> 32));
> +	else			//big_endian
> +		return syscall(__NR_sync_file_range2, fd, flags, (int)(offset >> 32),
> +			(int)offset, (int)(nbytes >> 32), (int)nbytes);
> +#endif
> +	else
> 
> 	return syscall(__NR_sync_file_range, fd, offset, nbytes, flags);
> -#endif
> 
> -	return 0;
> }
> 
> +static int check_endian( void )
> +{
> +	int x = 1;
> +	return ((char)(x) == x);
> +}
> +
> +
> /******************************************************************************/
> /*                                                                            */
> /* Function:    main                                                          */
> @@ -294,7 +307,8 @@ int main(int ac,		/* number of command line parameters                      */
> 	}
> #else
> 	/* For other archs, need kernel version > 2.6.16 */
> -
> +	if (arch_support)printf("arch supported!\n");
> +	if (tst_kvercmp(2, 6, 17) < 0)printf("kernel cmp fail\n");
> 	if (!arch_support || (tst_kvercmp(2, 6, 17) < 0)) {
> 		tst_resm(TCONF, "System doesn't support execution of the test");
> 		tst_exit();

	Close... here's one solution I've seen:

http://c-faq.com/misc/endiantest.html

	And FWIW this should be available as a generalized function / macro in include / lib .
Cheers,
-Garrett
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [patch] sync_file_range01 change for arm
  2010-10-18 10:08 ` Garrett Cooper
  2010-10-19  5:12   ` lina.zhao
@ 2010-10-22 12:47   ` Cyril Hrubis
  1 sibling, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2010-10-22 12:47 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

Hi!
> > arm use __NR_sync_file_range2 not __NR_sync_file_range for system call.
> > the test casecheck __NR_sync_file_range for arm,
> > So test react "System doesn't support" for arm.
> > but actually arm use __NR_sync_file_range2 to support the system call.
> >
> > powerpc is big endian, arm is small endian, so the parameter dealing is
> > different.
> 
>     Not true. ARM can be biendian, just like MIPS...
>     A better test needs to be derived for endianness than this.

Actually there seems to be some little endian PPC machines out there,
see: http://lwn.net/Articles/408340/

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2010-10-22 12:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-18  2:13 [LTP] [patch] sync_file_range01 change for arm lina.zhao
2010-10-18 10:08 ` Garrett Cooper
2010-10-19  5:12   ` lina.zhao
2010-10-19  6:36     ` Garrett Cooper
2010-10-22 12:47   ` Cyril Hrubis

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