Re: LIS build limitation

Dan Gora <[email protected]> Fri, 24 Jun 2005 10:34:42 -0700 (PDT)
Newsgroups gmane.linux.kernel.streams
Message-ID <[email protected]>

Hi Jerry,

One more patch.  It looks like the pci_find_class,
pci_dma_sync_single and pci_dma_sync_sg functions were removed from
the kernel.  It's kind of hard to tell in what version exactly it got
removed.  I guessed 2.6.9 from this:
http://lwn.net/Articles/107231/

But it's mentioned in the patch list for 2.6.10RC1:
http://kerneltrap.org/node/4044

However "Cross Referencing Linux" doesn't show it in the 2.6.10
kernel:
http://lxr.linux.no/ident?v=2.6.10;i=pci_dma_sync_sg

Does anyone know if these functions exist in 2.6.9 kernels?

If so, then this patch may have to be tweaked.

--- osif.c.old  2005-02-21 18:21:59.000000000 -0300
+++ osif.c      2005-06-24 10:54:37.000000000 -0300
@@ -252,7 +252,11 @@
 struct pci_dev  * _RP lis_osif_pci_find_class(unsigned int class,
                                         struct pci_dev *from)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
     return(pci_find_class(class, from)) ;
+#else
+    return(NULL);
+#endif
 }

 struct pci_dev  * _RP lis_osif_pci_find_slot(unsigned int bus,
unsigned int dev
fn)
@@ -388,13 +392,17 @@
 void  _RP lis_osif_pci_dma_sync_single(struct pci_dev *hwdev,
                           dma_addr_t dma_handle, size_t size, int
direction)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
     pci_dma_sync_single(hwdev, dma_handle, size, direction) ;
+#endif
 }

 void  _RP lis_osif_pci_dma_sync_sg(struct pci_dev *hwdev,
                           struct scatterlist *sg, int nelems, int
direction)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
     pci_dma_sync_sg(hwdev, sg, nelems, direction) ;
+#endif
 }

 int  _RP lis_osif_pci_dma_supported(struct pci_dev *hwdev, u64 mask)


--- Dan Gora <[email protected]> wrote:

> Hi Jerry,
> 
> If you want to use a LGPL version of LiS, you cannot use Brian's
> version, since his is GPL.  I am porting the GCOM (LGPL) version of
> LiS right now to SuSE 9.3 which uses a 2.6.11.4-20a kernel.  I ran
> into the same compile problem which I fixed with the patches below.
> 
> Also it looks like you are suppling the wrong directory for the
> directory to the kernel source.  Usually this is /usr/src/linux,
> but
> some distros don't have that link set up.  On my SuSE 9.3 machine
> here it's /usr/src/linux-2.6.11.4-20a (note: for SuSE distros you
> have to explicitly set this directory because the method to guess
> the
> kernel source directory in the configure script is broken on 2.6
> SuSE
> distros, it guesses /usr/src/linux-2.6.11.4-20a-obj, which doesn't
> work.).
> 
> This first compile time problem is because they have changed the
> pipe
> structure in /usr/src/linux/include/linux/pipe_fs_i.h in
> 2.6.10-RC10:
> Note: This may break pipe operation (I doubt it, but maybe...).  I
> haven't tested it yet because we don't use it.
> 
> --- linux-mdep.c.old    2005-06-23 16:10:48.000000000 -0300
> +++ linux-mdep.c        2005-06-23 16:13:38.000000000 -0300
> @@ -2576,8 +2576,11 @@
>      i->i_pipe = kmalloc(sizeof(struct pipe_inode_info),
> GFP_KERNEL);
>      if (i->i_pipe) {
>         init_waitqueue_head(PIPE_WAIT(*i));
> -       PIPE_BASE(*i) = NULL;;
> -       PIPE_START(*i) = PIPE_LEN(*i) = 0;
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
> +       PIPE_BASE(*i) = NULL;
> +       PIPE_LEN(*i) = 0;
> +#endif
> +       PIPE_START(*i) = 0;
>         PIPE_READERS(*i) = PIPE_WRITERS(*i) = 0;
>  #if !defined(KERNEL_2_5)
>         PIPE_WAITING_READERS(*i) = PIPE_WAITING_WRITERS(*i) = 0;
> 
> You also have to change head/linux/exports.c because they finally
> removed the definition of EXPORT_SYMBOL_NOVERS in 2.6.11:
> 
> --- exports.c.old       2005-06-23 16:24:19.000000000 -0300
> +++ exports.c   2005-06-23 16:25:12.000000000 -0300
> @@ -48,6 +48,11 @@
>  #define __NO_VERSION__ 1       /* 2.2 kernel needs this */
>  #include <linux/module.h>
> 
> +#ifndef EXPORT_SYMBOL_NOVERS
> +/* This was finally ripped out of the Linux Kernel in 2.6.11 */
> +#define EXPORT_SYMBOL_NOVERS(sym) EXPORT_SYMBOL(sym)
> +#endif
> +
>  #include <sys/stream.h>
>  #include <sys/poll.h>
>  #include <sys/lislocks.h>
> 
> You'll probably have to patch these by hand rather than using these
> patch files because the old file is not the original LiS 2.18.0
> file
> but a file that had already been modified by us (Adax, Inc).
> 
> We are still planning on contributing all of our changes to LiS
> 2.18.0 to the LGPL LiS release, but some minor things have been
> broken along the way to make things work on the various kernel
> versions.  All of the major functionality works and in fact all of
> our product line on Linux uses it.  Some things we just don't use
> however, like all of the TLI library, pipes, etc and have not
> tested.
>  I'd like to get a version cleaned up that at least preserves all
> of
> the old LiS functionality on 2.4 kernels before doing a public
> release of all of our changes.
> 
> If you look in the archives however I've been posting the changes
> that we've been making in bits in pieces, so hopefully you can get
> something together that works.
> 
> Hope this helps
> 
> -dan
> 
> --- Jerry Stahl <[email protected]> wrote:
> 
> > Hi,
> >  
> > I have an application that was originally developed on Sun
> Solaris
> > and is currently in the process of being ported to Fedora Core 3
> > Linux (FC3).  The application will require the Linux streams
> > library, in particular, there are parts of the application that
> use
> > the fattach() function. I have 2 kernel releases (2.6.9-1.667 and
> > 2.6.11-1.27.FC3) loaded in FC3 that I have tried to build the LIS
> > streams library against and for each kernel used, I have run into
> > errors during each build attempt.  I have followed the web site
> > instructions specifically for the 2.6 kernels.
> > Any help or suggestions on what should be done to get a
> successful
> > build would be appreciated.  Below is my system output from
> running
> > "make" on the library.
> >  
> >  
> > Thanks
> >  
> > J.S.
> >  
> >
>
*********************************************************************************************************
> > 
> > [root@KLASS-DEV LiS-2.18]# make
> > 
> > LiS Configure script version 2.100 10/11/04 invoked from main
> > makefile
> > 
> > CONFIG=/usr/src/LiS-2.18/config.in
> > 
> > package=LiS
> > 
> > prefix=/usr
> > 
> > execprefix=/usr
> > 
> > includedir=/usr/include
> > 
> > libdir=/usr/lib
> > 
> > bindir=/usr/bin
> > 
> > sbindir=/usr/sbin
> > 
> > sysconfdir=/etc
> > 
> > datadir=/usr/share
> > 
> > pkgincludedir=/usr/include/LiS
> > 
> > pkglibdir=/usr/lib/LiS
> > 
> > pkgdatadir=/usr/share/LiS
> > 
> > pkgsrcdir=/usr/src/LiS
> > 
> > mandir=/usr/share/man
> > 
> > modsubdir=misc
> > 
> >  
> > 
> > How do you want to configure STREAMS?
> > 
> > l = to run in the Linux kernel
> > 
> > u = to run in user level
> > 
> > q = to run under QNX (may not work)
> > 
> > Please enter your choice [default: l] l
> > 
> > Are you using the native Linux C compiler (y) or are you
> > cross-compiling using a different compiler (n)?
> > 
> > Native C (y) or cross-compile (n)? [default: y] y
> > 
> > Do you intend to run LiS on this machine with the currently
> running
> > kernel? [default: y] n
> > 
> > Enter directory location of your kernel source
> > 
> > [default: /usr/src/linux] /lib/modules/2.6.11-1.27_FC3/build
> > 
> > In file included from <command line>:1:
> > 
> > /lib/modules/2.6.11-1.27_FC3/build/include/linux/config.h:6:2:
> > #error including kernel header in userspace; use the glibc
> headers
> > instead!
> > 
> > No kernel support for SMP detected.
> > 
> > In file included from <command line>:1:
> > 
> > /lib/modules/2.6.11-1.27_FC3/build/include/linux/config.h:6:2:
> > #error including kernel header in userspace; use the glibc
> headers
> > instead!
> > 
> > In file included from <command line>:1:
> > 
> > /lib/modules/2.6.11-1.27_FC3/build/include/linux/config.h:6:2:
> > #error including kernel header in userspace; use the glibc
> headers
> > instead!
> > 
> > Kernel support for mod-versions detected.
> > 
> > In file included from <command line>:1:
> > 
> > /lib/modules/2.6.11-1.27_FC3/build/include/linux/config.h:6:2:
> > #error including kernel header in userspace; use the glibc
> headers
> > instead!
> > 
> > Kernel support for IP version 6 detected.
> > 
> > In file included from <command line>:1:
> > 
> > /lib/modules/2.6.11-1.27_FC3/build/include/linux/config.h:6:2:
> > #error including kernel header in userspace; use the glibc
> headers
> > instead!
> > 
> > Kernel support for IP version 6 modules detected.
> > 
> > In file included from <command line>:1:
> > 
> > /lib/modules/2.6.11-1.27_FC3/build/include/linux/config.h:6:2:
> > #error including kernel header in userspace; use the glibc
> headers
> > instead!
> > 
> > Kernel compiled using register passing for parameters
> > 
> > Which version of the kernel are you building for? [default:
> > 
> > 2.6.11-1.27_FC3]
> > 
> > After building STREAMS, do you want kernel loadable modules
> > installed?
> > 
> > This allows you to load it by typing in "insmod streams".
> > 
> > y = install it for module loading
> > 
> > n = just leave modules for later "make modules_install"
> > 
> > Please enter y or n [default: y] y
> > 
> > Module installation directory will be
> > /lib/modules/2.6.11-1.27_FC3/misc
> > 
> > When you make STREAMS, do you want to use backward compatible
> > constants in the file stropts.h? If you answer No (the default)
> you
> > will get constants that are compatible with UnixWare and Solaris,
> > but which differ somewhat from previous versions of LiS. If you
> > answer Yes you will get constants that are compatible with
> previous
> > versions of LiS but somewhat incompatible with UnixWare and
> > Solaris. If you intend to run application programs that were
> > compiled with LiS-2.6 or earlier then they have the old constants
> > compiled into them and you should answer Yes to this question.
> > 
> > y = LiS backward compatible constants in stropts.h
> > 
> > n = UnixWare/Solaris compatible constants in stropts.h Please
> enter
> > y or n [default: n] n
> > 
> > When you make STREAMS, do you want to use Solaris style cmn_err?
> > 
> > In Solaris the newline goes on the end of the message. For SVR4
> > style cmn_err the newline goes on the beginning.
> > 
> > y = Solaris style cmn_err
> > 
> > n = SVR4 style cmn_err
> > 
> > Please enter y or n [default: n] y
> > 
> > When you make STREAMS, do you want to compile for source level
> > debugging?
> > 
> > This is most useful when STREAMS is linked into the kernel and
> the
> > gdbstub patch is installed in the kernel for kernel source level
> > debugging.
> > 
> > y = set up for source level debugging
> > 
> > n = no source level debugging
> > 
> > Please enter y or n [default: n] y
> > 
> > Do you want to use shared libraries?
> > 
> > If you select static linking, you will get larger binaries that
> run
> > by themselves. If you select dynamic linking, the binaries will
> be
> > smaller but you will have to install the shared libraries in a
> > directory that is in your LD_LIBRARY_PATH environment variable.
> > 
> > y = use dynamic linking with shared libraries
> > 
> > n = use static linking
> > 
> > Please enter y or n [default: y] y
> > 
> > When you make STREAMS, do you want to use int type for CPU flags?
> > 
> > Responding 'n' is more portable but may cause warnings when you
> > compile your driver code.
> > 
> > y = int type for CPU flags
> > 
> > n = unsigned long type for CPU flags Please enter y or n
> [default:
> > y] y
> > 
> > When you make STREAMS, do you want LiS to be compiled in
> production
> > mode?
> > 
> > In this mode LiS will not audit queue, msg pointer, and internal
> > LiS queue structure sanity for every STREAMs function call. It
> will
> > also use faster kernel allocations for messages.
> > 
> > Responding 'y' is more appropriate for production environments
> > Responding 'n' is more appropriate for development environments
> > with verified modules/drivers.
> > 
> > y = Production mode
> > 
> > n = Development mode
> > 
> > Please enter y or n [default: y] y
> > 
> > Using "gcc -O2 -mpreferred-stack-boundary=2" 3.4.3 as the C
> > compiler
> > 
> > GET_EMPTY_INODE=new_inode((LIS_SB))
> > 
> > CLEAN libc/linux
> > 
> > CLEAN head/linux
> > 
> > CLEAN drivers/str/linux
> > 
> > CLEAN util/linux
> > 
> > CLEAN pkg
> > 
> > CLEAN modules
> > 
> > CC util/linux/strconf
> > 
> > STRCONF include/sys/LiS/config.h
> > 
> > DEP libc/linux
> > 
> > DEP head/linux
> > 
> > DEP drivers/str/linux
> > 
> > DEP util/linux
> > 
> > DEP libc/linux
> > 
> > DEP head/linux
> > 
> > DEP drivers/str/linux
> > 
> > DEP util/linux
> > 
> > <WD> libc/linux
> > 
> > <CC> gcc -c -Wall -Wstrict-prototypes -fno-strict-aliasing -Wno-
> > 
> > sign-compare -fno-common -ggdb -O -mpreferred-stack-boundary=2 -
> > DLISMODVERS -I/usr/src/LiS-2.18/include -
> > I/lib/modules/2.6.11-1.27_FC3/build/include -
> > I/lib/modules/2.6.11-1.27_FC3/build/include/asm/mach-generic -
> > I/lib/modules/2.6.11-1.27_FC3/build/include/asm/mach-default
> > -DRCVOID - DSOLARIS_STYLE_CMN_ERR -DUSE_KMEM_CACHE
> -DUSE_KMEM_TIMER
> > - D__KERNEL_SYSCALLS__
> > 
> > CC libc/linux/getpmsg.o
> > 
> > CC libc/linux/getmsg.o
> > 
> > CC libc/linux/putpmsg.o
> > 
> > CC libc/linux/putmsg.o
> > 
> > CC libc/linux/fattach.o
> > 
> > CC libc/linux/fdetach.o
> > 
> > CC libc/linux/isastream.o
> > 
> > CC libc/linux/pipe.o
> > 
> > LD libc/libLiS.so
> > 
> > LD libc/libpLiS.so
> > 
> > AR libc/libLiS.a
> > 
> > ar: creating /usr/src/LiS-2.18/libc/libLiS.a
> > 
> > RANLIB libc/libLiS.a
> > 
> > <WD> util/linux
> > 
> > <CC> gcc -DLINUX -Wall -Wstrict-prototypes -fno-strict-aliasing -
> > 
> > Wno-sign-compare -fno-common -ggdb -O
> -mpreferred-stack-boundary=2
> > - DLISMODVERS -I/usr/src/LiS-2.18/include -
> > I/lib/modules/2.6.11-1.27_FC3/build/include -
> > I/lib/modules/2.6.11-1.27_FC3/build/include/asm/mach-generic -
> > I/lib/modules/2.6.11-1.27_FC3/build/include/asm/mach-default
> > -DRCVOID - DSOLARIS_STYLE_CMN_ERR -DUSE_KMEM_CACHE
> -DUSE_KMEM_TIMER
> > 
> > CC util/linux/streams
> > 
> > CC util/linux/makenodes
> > 
> > CC util/linux/timetst
> > 
> > CC util/linux/strtst
> > 
> > CC util/linux/polltst
> > 
> > CC util/linux/ldltest
> > 
> > CC util/linux/ldlconfig
> > 
> > CC util/linux/test
> > 
> > CC util/linux/test2
> > 
> > CC util/linux/fattach
> > 
> > CC util/linux/fdetach
> > 
> > CC util/linux/oc
> > 
> > CC util/linux/rwf
> > 
> > CC util/linux/mkfifo
> > 
> > CC util/linux/psfd
> > 
> > CC util/linux/pafd
> > 
> > CC util/linux/thrtst
> > 
> > <WD> drivers/str/linux
> > 
> > <CC> gcc -DLiS -mregparm=3 -DLINUX -D__KERNEL__ -DMODVERSIONS
> -Wall
> > 
> > -Wstrict-prototypes -fno-strict-aliasing -Wno-sign-compare
> > -fno-common - ggdb -O -mpreferred-stack-boundary=2 -DLISMODVERS -
> > I/usr/src/LiS-2.18/include
> > -I/lib/modules/2.6.11-1.27_FC3/build/include
> > 
> > -I/lib/modules/2.6.11-1.27_FC3/build/include/asm/mach-generic -
> > I/lib/modules/2.6.11-1.27_FC3/build/include/asm/mach-default
> > -DRCVOID - DSOLARIS_STYLE_CMN_ERR -DUSE_KMEM_CACHE
> -DUSE_KMEM_TIMER
> > 
> > CC drivers/str/linux/relay.o
> > 
> > CC drivers/str/linux/clone.o
> > 
> > CC drivers/str/linux/fifo.o
> > 
> > CC drivers/str/linux/loop.o
> > 
> > CC drivers/str/linux/minimux.o
> > 
> > CC drivers/str/linux/printk.o
> > 
> > CC drivers/str/linux/sad.o
> > 
> > CC drivers/str/linux/connld.o
> > 
> > CC drivers/str/linux/ip_strm_mod.o
> > 
> > LD drivers/str/linux/drivers.o
> > 
> > <WD> head/linux
> > 
> > <CC> gcc -DLiS -D__KERNEL__ -DVERSION_2 -mregparm=3 -Wall
> -Wstrict-
> > 
> > prototypes -fno-strict-aliasing -Wno-sign-compare -fno-common
> -ggdb
> > -O -
> > 
> > mpreferred-stack-boundary=2 -DLISMODVERS
> > -I/usr/src/LiS-2.18/include -
> > I/lib/modules/2.6.11-1.27_FC3/build/include -
> > I/lib/modules/2.6.11-1.27_FC3/build/include/asm/mach-generic -
> > I/lib/modules/2.6.11-1.27_FC3/build/include/asm/mach-default
> > -DRCVOID - DSOLARIS_STYLE_CMN_ERR -DUSE_KMEM_CACHE
> -DUSE_KMEM_TIMER
> > -DLINUX - DUSE_KTHREAD -DMODVERSIONS -DMODULE
> > 
> > CC head/linux/head.o
> > 
> > CC head/linux/dki.o
> > 
> > CC head/linux/msg.o
> > 
> > CC head/linux/mod.o
> > 
> > /usr/src/LiS-2.18/head/mod.c: In function `lis_find_strdev':
> > 
> > /usr/src/LiS-2.18/head/mod.c:1252: warning: `inter_module_put' is
> > deprecated (declared at
> > /lib/modules/2.6.11-1.27_FC3/build/include/linux/module.h:581)
> > 
> > CC head/linux/buffcall.o
> > 
> > CC head/linux/mdep.o
> > 
> > In file included from /usr/src/LiS-2.18/head/mdep.c:26:
> > 
> > /usr/src/LiS-2.18/head/linux-mdep.c: In function
> > `lis_fifo_info_new':
> > 
> > /usr/src/LiS-2.18/head/linux-mdep.c:2546: error: structure has no
> > member named `base'
> > 
> > /usr/src/LiS-2.18/head/linux-mdep.c:2547: error: structure has no
> > member named `len'
> > 
> > make[2]: *** [mdep.o] Error 1
> > 
> > make[1]: *** [/usr/src/LiS-2.18/head/linux/streamshead.o] Error 2
> > 
> > make: *** [.config_mk] Error 2
> > 
> > [root@KLASS-DEV LiS-2.18]#
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around 
> > http://mail.yahoo.com 
> 
> _______________________________________________
> Linux-streams mailing list
> [email protected]
> http://gsyc.escet.urjc.es/mailman/listinfo/linux-streams
> 
> 
>