On Tue, 2008-09-16 at 14:27 +0200, Daniel Gollub wrote:
> Hi,
> 
> with 2.6.27-rc1(?) linux/dirent.h got removed Kbuild headers_install targe 
> and 
> dirent struct got removed:
> 
> 
> commit cf6ae8b50e0ee3f764392dadd1970e3f03c40773
> Author: Adrian Bunk <[EMAIL PROTECTED]>
> Date:   Fri Jul 25 01:46:46 2008 -0700
> 
>     remove the in-kernel struct dirent{,64}
>     
>     The kernel struct dirent{,64} were different from the ones in
>     userspace.
>     
>     Even worse, we exported the kernel ones to userspace.
>     
>     But after the fat usages are fixed we can remove the conflicting
>     kernel versions.
> 
> 
> This broke the build of some LTP syscalls testcases for "getdents", since the 
> <linux/dirent.h> include is missing and the "internal" dirent struct get/got 
> used in:
> 
> testcases/kernel/syscalls/getdents/getdents01.c  
> testcases/kernel/syscalls/getdents/getdents03.c
> testcases/kernel/syscalls/getdents/getdents02.c  
> testcases/kernel/syscalls/getdents/getdents04.c
> 
> http://ltp.cvs.sourceforge.net/ltp/ltp/testcases/kernel/syscalls/getdents/
> 
> Is it safe to use the userspace dirent struct from <dirent.h> to fix the 
> build 
> of this? Or what should be used for testing the getdents interface instead?

Yes, it is. There are numerous test cases in LTP which use:
        struct dirent,
by including /usr/include/dirent.h. The interesting part is, this guy
(/usr/include/dirent.h) in turn includes /usr/include/bits/dirent.h,
where the definition of struct resides. Following is the patch which
solves this issue along with page.h header file removal from 2.6.25
onwards, reported by Garret earlier.

Signed-of-by: Subrata Modak <[EMAIL PROTECTED]>

diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/controllers/io-throttle/iobw.c 
ltp-intermediate-20080919/testcases/kernel/controllers/io-throttle/iobw.c
---
ltp-intermediate-20080919-orig/testcases/kernel/controllers/io-throttle/iobw.c  
2008-09-23 23:31:00.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/controllers/io-throttle/iobw.c       
2008-09-23 23:41:54.000000000 +0530
@@ -30,14 +30,14 @@
 #include <signal.h>
 #include <string.h>
 #include <unistd.h>
+#include <limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/wait.h>
-#include <asm/page.h>
 
 #ifndef PAGE_SIZE
-#define PAGE_SIZE getpagesize()
+#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
 #endif
 
 #define align(x,a)             __align_mask(x,(typeof(x))(a)-1)
diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/module/create_module/create_module02.c
 
ltp-intermediate-20080919/testcases/kernel/module/create_module/create_module02.c
---
ltp-intermediate-20080919-orig/testcases/kernel/module/create_module/create_module02.c
  2008-09-23 23:30:57.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/module/create_module/create_module02.c
       2008-09-23 23:42:49.000000000 +0530
@@ -86,12 +86,17 @@
 #include <errno.h>
 #include <pwd.h>
 #include <sys/types.h>
-#include <asm/page.h>
+#include <unistd.h>
+#include <limits.h>
 #include <asm/atomic.h>
 #include <linux/module.h>
 #include "test.h"
 #include "usctest.h"
 
+#ifndef PAGE_SIZE 
+#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
+#endif
+
 extern int Tst_count;
 
 #define MODSIZE 10000                  /* Arbitrarily selected MODSIZE */
diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/module/delete_module/delete_module02.c
 
ltp-intermediate-20080919/testcases/kernel/module/delete_module/delete_module02.c
---
ltp-intermediate-20080919-orig/testcases/kernel/module/delete_module/delete_module02.c
  2008-09-23 23:30:57.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/module/delete_module/delete_module02.c
       2008-09-23 23:45:13.000000000 +0530
@@ -82,12 +82,17 @@
 #include <errno.h>
 #include <pwd.h>
 #include <sys/types.h>
-#include <asm/page.h>
+#include <unistd.h>
+#include <limits.h>
 //#include <linux/module.h>
 #include <sys/mman.h>
 #include "test.h"
 #include "usctest.h"
 
+#ifndef PAGE_SIZE 
+#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
+#endif
+
 extern int Tst_count;
 
 #define NULLMODNAME ""
diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/module/query_module/query_module01.c
 ltp-intermediate-20080919/testcases/kernel/module/query_module/query_module01.c
---
ltp-intermediate-20080919-orig/testcases/kernel/module/query_module/query_module01.c
    2008-09-23 23:30:57.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/module/query_module/query_module01.c 
2008-09-23 23:43:36.000000000 +0530
@@ -88,12 +88,17 @@
 #include <errno.h>
 #include <pwd.h>
 #include <sys/types.h>
-#include <asm/page.h>
+#include <unistd.h>
+#include <limits.h>
 #include <asm/atomic.h>
 #include <linux/module.h>
 #include "test.h"
 #include "usctest.h"
 
+#ifndef PAGE_SIZE 
+#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
+#endif
+
 #define LONGMODNAMECHAR        'm'             /* Arbitrarily selected */
 #define MODNAMEMAX     (PAGE_SIZE + 1)
 #define EXP_RET_VAL    0
diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/module/query_module/query_module02.c
 ltp-intermediate-20080919/testcases/kernel/module/query_module/query_module02.c
---
ltp-intermediate-20080919-orig/testcases/kernel/module/query_module/query_module02.c
    2008-09-23 23:30:57.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/module/query_module/query_module02.c 
2008-09-23 23:44:02.000000000 +0530
@@ -77,12 +77,17 @@
 #include <errno.h>
 #include <pwd.h>
 #include <sys/types.h>
-#include <asm/page.h>
+#include <unistd.h>
+#include <limits.h>
 #include <asm/atomic.h>
 #include <linux/module.h>
 #include "test.h"
 #include "usctest.h"
 
+#ifndef PAGE_SIZE 
+#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
+#endif
+
 #define NULLMODNAME    ""
 #define LONGMODNAMECHAR        'm'             /* Arbitrarily selected */
 #define MODNAMEMAX     (PAGE_SIZE + 1)
diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/module/query_module/query_module03.c
 ltp-intermediate-20080919/testcases/kernel/module/query_module/query_module03.c
---
ltp-intermediate-20080919-orig/testcases/kernel/module/query_module/query_module03.c
    2008-09-23 23:30:57.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/module/query_module/query_module03.c 
2008-09-23 23:44:32.000000000 +0530
@@ -85,13 +85,18 @@
 #include <errno.h>
 #include <pwd.h>
 #include <sys/types.h>
-#include <asm/page.h>
+#include <unistd.h>
+#include <limits.h>
 #include <asm/atomic.h>
 #include <linux/module.h>
 #include <sys/mman.h>
 #include "test.h"
 #include "usctest.h"
 
+#ifndef PAGE_SIZE 
+#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
+#endif
+
 #define EXP_RET_VAL    -1
 #define DUMMY_MOD      "dummy_query_mod"
 #define SMALLBUFSIZE   1
diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/syscalls/getdents/getdents01.c 
ltp-intermediate-20080919/testcases/kernel/syscalls/getdents/getdents01.c
---
ltp-intermediate-20080919-orig/testcases/kernel/syscalls/getdents/getdents01.c  
2008-09-23 23:31:00.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/syscalls/getdents/getdents01.c       
2008-09-23 23:38:31.000000000 +0530
@@ -61,7 +61,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <linux/types.h>
-#include <linux/dirent.h>
+#include <dirent.h>
 #include <linux/unistd.h>
 #include <unistd.h>
 
diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/syscalls/getdents/getdents02.c 
ltp-intermediate-20080919/testcases/kernel/syscalls/getdents/getdents02.c
---
ltp-intermediate-20080919-orig/testcases/kernel/syscalls/getdents/getdents02.c  
2008-09-23 23:31:00.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/syscalls/getdents/getdents02.c       
2008-09-23 23:38:52.000000000 +0530
@@ -57,7 +57,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <linux/types.h>
-#include <linux/dirent.h>
+#include <dirent.h>
 #include <linux/unistd.h>
 #include <unistd.h>
 
diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/syscalls/getdents/getdents03.c 
ltp-intermediate-20080919/testcases/kernel/syscalls/getdents/getdents03.c
---
ltp-intermediate-20080919-orig/testcases/kernel/syscalls/getdents/getdents03.c  
2008-09-23 23:31:00.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/syscalls/getdents/getdents03.c       
2008-09-23 23:39:15.000000000 +0530
@@ -60,7 +60,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <linux/types.h>
-#include <linux/dirent.h>
+#include <dirent.h>
 #include <linux/unistd.h>
 #include <unistd.h>
 
diff -uprN
ltp-intermediate-20080919-orig/testcases/kernel/syscalls/getdents/getdents04.c 
ltp-intermediate-20080919/testcases/kernel/syscalls/getdents/getdents04.c
---
ltp-intermediate-20080919-orig/testcases/kernel/syscalls/getdents/getdents04.c  
2008-09-23 23:31:00.000000000 +0530
+++
ltp-intermediate-20080919/testcases/kernel/syscalls/getdents/getdents04.c       
2008-09-23 23:39:27.000000000 +0530
@@ -60,7 +60,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <linux/types.h>
-#include <linux/dirent.h>
+#include <dirent.h>
 #include <linux/unistd.h>
 #include <unistd.h>
 #include <sys/stat.h>
diff -uprN ltp-intermediate-20080919-orig/tools/top-LTP/proc/devname.c
ltp-intermediate-20080919/tools/top-LTP/proc/devname.c
--- ltp-intermediate-20080919-orig/tools/top-LTP/proc/devname.c
2008-09-23 23:30:54.000000000 +0530
+++ ltp-intermediate-20080919/tools/top-LTP/proc/devname.c      2008-09-23
23:41:08.000000000 +0530
@@ -16,13 +16,13 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <limits.h>
 #include <sys/sysmacros.h>
 #include "version.h"
 #include "devname.h"
 
-#include <asm/page.h>
-#ifndef PAGE_SIZE
-#define PAGE_SIZE (sizeof(long)*1024)
+#ifndef PAGE_SIZE 
+#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
 #endif
 
 /* Who uses what:

Regards--
Subrata


> 
> best regards,
> Daniel
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to