Hi,

--- On Mon, 12/22/08, Subrata Modak <[email protected]> wrote:

> From: Subrata Modak <[email protected]>
> Subject: Re: [LTP] [PATCH] Ioctl03: Various Fixes
> To: [email protected]
> Cc: [email protected]
> Date: Monday, December 22, 2008, 3:27 PM
> On Sun, 2008-12-21 at 05:59 -0800, CAI Qian wrote:
> > Hi,
> > 
> > The newly added test case ioctl03[1] introduces some
> problems.
> > 
> > First, compilation errors:
> > 
> > cc -I../../../../include -Wall    ioctl03.c 
> -L../../../../lib -lltp -o ioctl03
> > In file included from ioctl03.c:41:
> > /usr/include/sys/types.h:46: error: conflicting types
> for ‘loff_t’
> > /usr/include/linux/types.h:30: error: previous
> declaration of ‘loff_t’ was here
> > /usr/include/sys/types.h:62: error: conflicting types
> for ‘dev_t’
> > /usr/include/linux/types.h:13: error: previous
> declaration of ‘dev_t’ was here
> > In file included from /usr/include/sys/types.h:133,
> >                  from ioctl03.c:41:
> > /usr/include/time.h:105: error: conflicting types for
> ‘timer_t’
> > /usr/include/linux/types.h:22: error: previous
> declaration of ‘timer_t’ was here
> > In file included from ioctl03.c:41:
> > /usr/include/sys/types.h:198: error: conflicting types
> for ‘int64_t’
> > /usr/include/linux/types.h:98: error: previous
> declaration of ‘int64_t’ was here
> > /usr/include/sys/types.h:204: error: conflicting types
> for ‘u_int64_t’
> > /usr/include/linux/types.h:97: error: previous
> declaration of ‘u_int64_t’ was here
> > In file included from /usr/include/sys/types.h:220,
> >                  from ioctl03.c:41:
> > /usr/include/sys/select.h:78: error: conflicting types
> for ‘fd_set’
> > /usr/include/linux/types.h:12: error: previous
> declaration of ‘fd_set’ was here
> > In file included from ioctl03.c:41:
> > /usr/include/sys/types.h:235: error: conflicting types
> for ‘blkcnt_t’
> > /usr/include/linux/types.h:124: error: previous
> declaration of ‘blkcnt_t’ was here
> > make: *** [ioctl03] Error 1
> > 
> > Second, test failures and misuse of TCONF:
> > 
> > # ./ioctl03
> > ioctl03     0  INFO  :  Available features are: 
> > ioctl03     1  CONF  :  TUN 
> > ioctl03     2  CONF  :  TAP 
> > ioctl03     3  CONF  :  NO_PI 
> > ioctl03     4  CONF  :  ONE_QUEUE 
> > ioctl03     5  FAIL  :  (UNKNOWN 0x4000)
> > 
> > The following patch fixes them by changing an order of
> a header file and also checking 
> > IFF_VNET_HDR. It also tidy up the code and add some
> more information to test output.
> > 
> > Test result after applied the patch is,
> > 
> > # uname -ra
> > Linux localhost.localdomain
> 2.6.27-0.392.rc8.git7.fc10.x86_64 #1 SMP Sun Oct 5 22:42:31
> EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
> > 
> > # ./ioctl03
> > ioctl03     0  INFO  :  Available features are: 0x7003
> > ioctl03     0  INFO  :  TUN 0x1
> > ioctl03     0  INFO  :  TAP 0x2
> > ioctl03     0  INFO  :  NO_PI 0x1000
> > ioctl03     0  INFO  :  ONE_QUEUE 0x2000
> > ioctl03     0  INFO  :  VNET_HDR 0x4000
> > 
> > [1] http://article.gmane.org/gmane.linux.ltp/6615
> > 
> > Signed-off-by: CAI Qian <[email protected]>
> 
> Thanks for this Patch. However..........
> 
> > 
> > ---
> testcases/kernel/syscalls/ioctl/ioctl03.c.orig        2008-12-21
> 20:36:38.309680227 +0800
> > +++
> testcases/kernel/syscalls/ioctl/ioctl03.c     2008-12-21
> 21:57:53.406680851 +0800
> > @@ -37,13 +37,13 @@
> >  /*                      - Nov 28 2008 - Subrata
> <[email protected]>  */
> > 
> /******************************************************************************/
> >  
> > -#include <linux/if_tun.h>
> >  #include <sys/types.h>
> >  #include <sys/ioctl.h>
> >  #include <sys/stat.h>
> >  #include <fcntl.h>
> >  #include <errno.h>
> >  #include <stdio.h>
> > +#include <linux/if_tun.h>
> 
> Definition of IFF_VNET_HDR inside <linux/if_tun.h>
> has been added only
> recently in June 2008 by Rusty:
> https://lists.linux-foundation.org/pipermail/virtualization/2008-June/011176.html,
> 
> So, compilation will still fail in systems having old
> <linux/if_tun.h>.
> Hence, we also need to include the following:
> 
> #ifndef define

Right, I have not tracked the change there. Do you mean

#ifndef IFF_VNET_HDR

here? If so, I cannot see any side effect after you modification.

CAI Qian

> #define IFF_VNET_HDR    0x4000
> #endif
> 
> Which i did after applying your patch.
> 
> Regards--
> Subrata
> 
> >  
> >  /* Harness Specific Include Files. */
> >  #include "test.h"
> > @@ -58,7 +58,7 @@
> >  extern char *TESTDIR;                /* temporary dir
> created by tst_tmpdir() */
> >  
> >  /* Global Variables */
> > -char *TCID     = "ioctl03"; /* test program
> identifier.          */
> > +char *TCID     = "ioctl03";          /*
> test program identifier.              */
> >  int  TST_TOTAL = 1;                  /* total number
> of tests in this file.   */
> >  
> >  /* Extern Global Functions */
> > @@ -84,7 +84,7 @@
> >    TEST_CLEANUP;
> >    tst_rmdir();
> >  
> > - /* Exit with appropriate return code. */
> > +  /* Exit with appropriate return code. */
> >    tst_exit();
> >  }
> >  
> > @@ -108,50 +108,50 @@
> >  /*                                                   
>                         */
> > 
> /******************************************************************************/
> >  void setup() {
> > - /* Capture signals if any */
> > - /* Create temporary directories */
> > - TEST_PAUSE;
> > - tst_tmpdir();
> > +  /* Capture signals if any */
> > +  /* Create temporary directories */
> > +  TEST_PAUSE;
> > +  tst_tmpdir();
> >  }
> >  
> > 
> >  static struct {
> > - unsigned int flag;
> > - const char *name;
> > +  unsigned int flag;
> > +  const char *name;
> >  } known_flags[] = {
> >                     { IFF_TUN, "TUN" },
> >                     { IFF_TAP, "TAP" },
> >                     { IFF_NO_PI, "NO_PI" },
> >                     { IFF_ONE_QUEUE,
> "ONE_QUEUE" },
> > +                   { IFF_VNET_HDR,
> "VNET_HDR"}
> >                    };
> >  
> >  int main() {
> > - unsigned int features, i;
> > +  unsigned int features, i;
> >  
> > - setup();
> > - if (geteuid()!=0) {
> > -     tst_brkm(TBROK, cleanup, "You need to be
> ROOT to run this test case");
> > -     tst_exit();
> > - }
> > - int netfd = open("/dev/net/tun", O_RDWR);
> > - if (netfd < 0)
> > +  setup();
> > +  if (geteuid()!=0) {
> > +    tst_brkm(TBROK, cleanup, "You need to be
> ROOT to run this test case");
> > +    tst_exit();
> > +  }
> > +  int netfd = open("/dev/net/tun", O_RDWR);
> > +  if (netfd < 0)
> >      tst_brkm(TBROK, cleanup, "Error Opening
> /dev/net/tun: %s", strerror(errno));
> >  
> > - if (ioctl(netfd, TUNGETFEATURES, &features) !=
> 0) {
> > - tst_resm(TCONF, "Kernel does not support
> TUNGETFEATURES");
> > - features =
> (IFF_TUN|IFF_TAP|IFF_NO_PI|IFF_ONE_QUEUE);
> > - cleanup();
> > - tst_exit();
> > - }
> > - tst_resm(TINFO,"Available features are:
> ");
> > - for (i = 0; i <
> sizeof(known_flags)/sizeof(known_flags[0]); i++) {
> > -      if (features & known_flags[i].flag) {
> > -          features &= ~known_flags[i].flag;
> > -          tst_resm(TCONF, "%s ",
> known_flags[i].name);
> > -      }
> > - }
> > - if (features)
> > - tst_resm(TFAIL, "(UNKNOWN %#x)",
> features);
> > - cleanup();
> > - tst_exit();
> > +  if (ioctl(netfd, TUNGETFEATURES, &features) !=
> 0) {
> > +    tst_resm(TCONF, "Kernel does not support
> TUNGETFEATURES");
> > +    cleanup();
> > +    tst_exit();
> > +  }
> > +  tst_resm(TINFO,"Available features are:
> %#x", features);
> > +  for (i = 0; i <
> sizeof(known_flags)/sizeof(known_flags[0]); i++) {
> > +    if (features & known_flags[i].flag) {
> > +      features &= ~known_flags[i].flag;
> > +      tst_resm(TINFO, "%s %#x",
> known_flags[i].name, known_flags[i].flag);
> > +    }
> > +  }
> > +  if (features)
> > +    tst_resm(TFAIL, "(UNKNOWN %#x)",
> features);
> > +  cleanup();
> > +  tst_exit();
> >  }
> > 
> >
> ------------------------------------------------------------------------------
> > _______________________________________________
> > Ltp-list mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to