Linux-Development-Sys Digest #649, Volume #8     Tue, 17 Apr 01 11:13:15 EDT

Contents:
  Re: a newbie in linux device driver writing.
  Re: The reason for static... ("alan")
  Re: a newbie in linux device driver writing. ("alan")
  Re: The reason for static... ([EMAIL PROTECTED])
  using netif_rx with ip packets for eth device ("alan")
  Re: New directions for kernel development ("Steven J. Hathaway")
  Interrupt Relay to Userspace Process ("James T. Dennis")
  linux c++ problem (Robert Pond)
  Re: linux c++ problem (Alexander Viro)
  Re: Tizek.com is in dire need of a development team... (William Kendrick)
  Short Cut like Windows 98 Shortcut and Window Explorer ("ray")
  Re: checking for non ansi extensions ("O.Petzold")
  Re: Short Cut like Windows 98 Shortcut and Window Explorer ("ray")
  How do I initiate Gnome? ("ray")
  Re: Modifier keys in X (Sven Mascheck)
  PCI mapped memory ("Niels Sterrenburg")
  Re: Modifier keys in X (Mattias Engdegård)
  some question about initrd (lmc83)
  Re: How do I initiate Gnome? ([EMAIL PROTECTED])
  Re: The reason for static... (Grant Edwards)
  Re: checking for non ansi extensions (Greg Comeau)
  IO system throughput (William Morris)

----------------------------------------------------------------------------

From: [EMAIL PROTECTED] ()
Crossposted-To: fa.linux.kernel
Subject: Re: a newbie in linux device driver writing.
Date: Tue, 17 Apr 2001 03:13:49 -0000

In article <[EMAIL PROTECTED]>,
philip  <[EMAIL PROTECTED]> wrote:

>  I am quite new in writing linux device driver. But anyway I have to
>take over
>and maintain some serial board driver source which was written by
>someone else.
>  The program flow is ok for me this moment. But still got 2 questions
>here.
>   1.I found very hard to find the kernel level function specification
>which can support
>driver writing. for example, like "wake_up_interruptible" or event
>scheduling
>mechanism description, or "ioremap". Maybe I can find some clue from the
>kernel
>header files and organize its opertion by myself. But it is that a
>correct way?
>   Is there any place can give me such fucntion's example and
>explanation in one time?

Get yourself a copy of Linux Device Drivers by Alessandro Rubini:

 http://www.amazon.com/exec/obidos/ASIN/1565922921/ricksphotograpag/

--
http://www.spinics.net/linux/

------------------------------

From: "alan" <[EMAIL PROTECTED]>
Subject: Re: The reason for static...
Date: Tue, 17 Apr 2001 03:17:01 GMT

Basically, think of static as having two uses and it will all make sense...
First it can be used to allow a local variable to retain its value every
time its scope is (re)-entered..(it is automatically initialized to zero at
load time) and secondly on a global scale it restricts the namespace of a
variable/function to a single file (hence no global namespace pollution).
Its a global, but only to that file.





------------------------------

From: "alan" <[EMAIL PROTECTED]>
Crossposted-To: fa.linux.kernel
Subject: Re: a newbie in linux device driver writing.
Date: Tue, 17 Apr 2001 03:23:14 GMT

> Get yourself a copy of Linux Device Drivers by Alessandro Rubini:
>
but be careful if you have to support any kernel higher than 2.2 some of the
specifics in the book are out of date, but most of the general concepts hold
true (and it's still a good book), that's why there's going to be a second
edition...you can also get beta's of the new example source (which does
support 2.4) for the second edition from
ftp://ftp.linux.it/pub/People/rubini/ldd.samples-2.0-beta3.tar.gz



------------------------------

From: [EMAIL PROTECTED]
Subject: Re: The reason for static...
Date: Tue, 17 Apr 2001 03:28:55 GMT

[EMAIL PROTECTED] (David) writes:
> First of all, thanks to all who replied. Well, maybe I do not have a
> complete understanding of what "static" really does. I know that I
> have to use "static" if I want the variable to be remain in memory
> even after the function has exited. This also means increase in
> speed of execution as the variables do not have to be created next
> time the function is entered.

That's one use of "static."

> However, why would "static" help in preventing namespace pollution?
> Why would declaring "static" make a global variable visible only
> within one file? Can anyone please explain to me in greater detail?
> (My C programming textbook didn't mention anything more abt
> "static".)

You must have a _frightfully awful_ text on C if it didn't mention
the namespace issue.  You need to see about getting a better book.
-- 
(concatenate 'string "aa454" "@freenet.carleton.ca")
http://vip.hyperusa.com/~cbbrowne/resume.html
"A LISP programmer knows the value of everything, but the cost of
nothing." -- Alan Perlis

------------------------------

From: "alan" <[EMAIL PROTECTED]>
Subject: using netif_rx with ip packets for eth device
Date: Tue, 17 Apr 2001 03:29:37 GMT

I am writing a device driver for a network device and have set it up as an
ethernet device.  The data I will be receiving will be straight-up ip
packets, once I alloc a socket buffer can I just copy the ip packet to a skb
and then just run a netif_rx on it or do I have to do anything else to it
first, seeing that I don't have an ethernet header.  I have set the
IFF_NOARP flag for the device...Also, should I still call eth_trans_type
too...Thanks...



------------------------------

Date: Mon, 16 Apr 2001 20:28:36 -0800
From: "Steven J. Hathaway" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.advocacy,comp.os.linux.development
Subject: Re: New directions for kernel development

Linus Torvalds wrote:
Hi all <blah.blah.blah>
============

Besides the quote from Linus - I question that he wrote the diatribe - but
much of which was written can be seen in as originating in the university
subcultures of the uncouth claiming to be intellectual mystics.  Many of the
divergent philosophies and morally deplorable trappings have made their
appearances throughout our technocultures since the 60s.

What both Linux and I decry is the promiscuous promulgation of prostituted
morality and ethics, and to mention uncleanliness of manners and dress.
We would hope that the open-source community would take pride in the better
things in life and bring this uplifted attitude toward our endeavors. We do
not like the fruits of our labours being dragged through the trenches of
debauchery, profanity, and immorality, but would prefeer to see them proffered
by caring souls to enlighten the communies of intellectual thinkers and
problem solvers.

Many of our corporate bretheren, not barried in the code trenches, but
responsible for business, finance, and welfare of masses, see significant
value in products that are presented with dignity. This means that we may
need to scrub our demeanor and manners and adorn our attire with cleanliness,
and the accouterments of respect in order to enhance the dignity and acclaim
of our endeavors.

Instead of - Me Too - and likewise thinking , prepare yourselves for a
change in culture that is required for success in a new age as our labours
go from obscurity and have to survive in a world of scrutiny and
visibility. This world is new to many of you and offers little refuge
for those unwilling to put on cleaner robes.

I am an enthusiastic supporter of the Linux operating system, the GNU
and open-source unrestricted development philosophies, but perceptions
need to be improved if our labours are to be embrased by the larger
world outside of our cloistered computer cathederals and virtual
realities.


Sincerely,
Steven J. Hathaway



------------------------------

From: "James T. Dennis" <[EMAIL PROTECTED]>
Subject: Interrupt Relay to Userspace Process
Date: 17 Apr 2001 04:58:27 GMT


 If I wanted to build a custom application that relied on 
 interrupts generated over the EPP (LPT) port, would it be 
 possible to split the necessary functions into two parts:
 
 I think that the IRQ response must be done in kernel space.
 So I'd like to write a small device driver that simply 
 responds to IRQs on the given port by writing a character
 to a device node (/dev/eppirq_custom).

 If I did that, it seems like I could then write a user space
 application that would open /dev/eppirq_custom and perform
 blocking read() calls on it.  Every time I get a character
 (set the buffering off, of course) my program could then 
 process its data, and then go back to sleep.

 If I needed to monitor several ports it seems like I could
 use poll().  However, I'm not clear on one point.  ISTR that
 select() could only be used with network/socket descriptors;
 does this limitation apply to poll()?

 If I have such an IRQ_relay driver, could it work without 
 conflicting with the normal lp driver?  Would it be better
 to implement this as some sort of ioctl in the lp driver
 itself?

 BTW: I'm *NOT* a kernel programmer; though I've read a bit
 on the topic.


------------------------------

From: Robert Pond <[EMAIL PROTECTED]>
Subject: linux c++ problem
Date: Tue, 17 Apr 2001 02:48:44 -0400
Reply-To: [EMAIL PROTECTED]





linux c++

From:

Robert Pond <[EMAIL PROTECTED]>

Reply-To:

[EMAIL PROTECTED]

Date:

Tuesday 17 April 2001 02:46:47

Groups:

alt.os.linux



no references



Does anybody know why this snippet only creates one child process?

void main()
 {
                string direction[2] = {"north", "south"};
                int num_cars = 10;
                int status;
                int pid = 0;
                int dir = 0;
                pid = fork();
                char out[15];
                for(int id = 0; id < num_cars; id++)
                {
                        if(pid == 0)
                        {
                                dir = rand() % 2;
                                sprintf(out,"%d",id);

                                execlp("./car", "car", out, 
direction[dir].c_str(), NULL);

                        }
                        wait(&status);
                }
        }



------------------------------

From: [EMAIL PROTECTED] (Alexander Viro)
Subject: Re: linux c++ problem
Date: 17 Apr 2001 03:02:08 -0400

In article <9bgp2p$cdf$[EMAIL PROTECTED]>, Robert Pond  <[EMAIL PROTECTED]> wrote:

[snip]

>Does anybody know why this snippet only creates one child process?

Because you are calling fork() only once.

BTW, WTF does it have to C++ or Linux? comp.unix.programming is -> that
way...

-- 
"You're one of those condescending Unix computer users!"
"Here's a nickel, kid.  Get yourself a better computer" - Dilbert.

------------------------------

From: William Kendrick <[EMAIL PROTECTED]>
Subject: Re: Tizek.com is in dire need of a development team...
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Date: Tue, 17 Apr 2001 07:11:19 GMT

In comp.os.linux.misc [EMAIL PROTECTED] wrote:

: If the need is _SO_ desperate, and the destiny for greatness so
: certain, it would seem senseless NOT to spend some of the venture
: capital paying for competent programmers.

Speaking of alphaspamming.  I saw this spam (at least, the title) on
one of the slower _classic_Atari_ newsgroups I subscribe to.

Daahhhhhhhh okay!?

-bill!
[EMAIL PROTECTED]
http://www.lugod.org/
Linux Users' Group of Davis

------------------------------

From: "ray" <[EMAIL PROTECTED]>
Subject: Short Cut like Windows 98 Shortcut and Window Explorer
Date: Tue, 17 Apr 2001 16:19:23 +0800

How can I create shortcuts icons in Linux RedHat? I want to place the
command on the desktop instead of searching for it everytime in the
filesystem?

Is there another version of Windows Explorer in Linux RedHat?
Thanks for the tips.




------------------------------

From: "O.Petzold" <[EMAIL PROTECTED]>
Crossposted-To: comp.programming
Subject: Re: checking for non ansi extensions
Date: Tue, 17 Apr 2001 09:59:55 +0200

Raymond Limpus wrote:
> 
> long long is an ANSI type isn't it? in the C99 std.
It is, but as Richard wrote there are only a few compiler
c99 conform. long double is an another example (C99 ??)
I have to ifdef those types. For this I have to check
if they are supported on this XXX plattform. One way is
to use compiler Flags, like
#if defined(GCC >2.95.2) || defined(C99)
# define HAS_LONGLONG
#endif

#ifdef HAS_LONGLONG
...
#endif

What are those predefined compiler flags for several
compilers (especially gcc).
The other way could be autoconf/automake - is there a
check for this ?

Thanks
Olaf

------------------------------

From: "ray" <[EMAIL PROTECTED]>
Subject: Re: Short Cut like Windows 98 Shortcut and Window Explorer
Date: Tue, 17 Apr 2001 16:45:26 +0800

Yup, I got it, Use gnome.

"ray" <[EMAIL PROTECTED]> wrote in message
news:9bguil$k71$[EMAIL PROTECTED]...
> How can I create shortcuts icons in Linux RedHat? I want to place the
> command on the desktop instead of searching for it everytime in the
> filesystem?
>
> Is there another version of Windows Explorer in Linux RedHat?
> Thanks for the tips.
>
>
>



------------------------------

From: "ray" <[EMAIL PROTECTED]>
Subject: How do I initiate Gnome?
Date: Tue, 17 Apr 2001 16:56:42 +0800

How do I initiate a gnome from fvwm?
Thanks



------------------------------

From: Sven Mascheck <[EMAIL PROTECTED]>
Subject: Re: Modifier keys in X
Crossposted-To: comp.windows.x
Date: 17 Apr 2001 12:32:46 +0200

David Allen <[EMAIL PROTECTED]> wrote:

> [ Regardless of which slot (Mod1-5) XK_Mode_switch is in, xev reports
> a state of 0x2000 when Alt Gr is pressed with a character.

It shouldn't.  This always worked fine for me.

IMHO mod<x> is derived directly from this state anyway,
so have you confirmed your remappings with xmodmap(1)?
(But as you mentioned remapping also with xkeycaps(1), there
should be no problem with the exact way of clearing/adding modfifier.)

And as you mentioned, such a high state doesn't make sense for
mod<x> at all:  Perhaps you have activated the XKB extension
and it's interfering somehow?

Perhaps your xev(1) is even broken?

[keeping xpost alive. col.x perhaps would have suited better?]
Sven

------------------------------

From: "Niels Sterrenburg" <[EMAIL PROTECTED]>
Subject: PCI mapped memory
Date: Tue, 17 Apr 2001 13:40:11 +0200

I have a PCI Multimedia board with 32 MB SDRAM on it.

When I do a cat /proc/pci I see my board and I see that the memory is
mapped. My problem is that Linux only maps 8 MB instead of the full 32 MB
!!!!

The documentation says that in Winnt (of course the documentation is only
for microsoft people) the mapped SDRAM size can be enterred in the regestry,
so I think this can also be done in Linux but WHERE...... regedit is hard to
find in Linux ;-)

can anyone help me ????



------------------------------

From: [EMAIL PROTECTED] (Mattias Engdegård)
Crossposted-To: comp.windows.x
Subject: Re: Modifier keys in X
Date: 17 Apr 01 11:52:39 GMT

"David Allen" <[EMAIL PROTECTED]> writes:

>My question is, how do you tell which bit to set in the state field given 
>a modifier?

XGetModifierMapping(), and then XKeycodeToKeySym() for each of the returned
keycodes

  I've tried mappings several different ways, and it seems when
>I use an Alt Gr key (XK_Mode_switch) xev always reports that it makes the
>state field 0x2000, *regardless* of which slot in the XModifierKeymap it
>holds.

The high bits of the modifier is used by XKB, the X Keyboard Extension.
This means that if you call XLookupString() to translate keystrokes to
characters, you need to preserve all bits of the state word from the
received keyboard event


------------------------------

From: lmc83 <[EMAIL PROTECTED]>
Subject: some question about initrd
Date: Tue, 17 Apr 2001 22:00:24 +0800

hi,
    I have some question about initrd.
    If I have a compressed ramdisk image: initrd.gz put at a memory location
    for example: 0x00070000 (in fact, in my application, it is flash)

    1. what is the meaning of initrd_start in rd.c (linux-2.4.0)?
       Is it means 0x00070000?
       or is it means the initrd.gz will be decompressed to the
       location initrd_start?

    2. How to tell the kernel that I have a initrd who's image
       is located 0x00070000?
       I saw the Document/kernel-parameters.txt, is seems doesn't
       have suitable parameter for me to use.
       
       Should I modify the kernel source code to fit my requirement?
       I've saw the "How-To: make root/boot disk", it use floppy's
       specific sector as ramdisk image, 
       I think is's a little similar to my application,
       I will try to just specify memory location instead of 
       reading from floppy's specific sector.

    Thanks in advance for you help

    Liang Ming-Chung

------------------------------

From: [EMAIL PROTECTED]
Subject: Re: How do I initiate Gnome?
Date: Tue, 17 Apr 2001 14:13:49 GMT

"ray" <[EMAIL PROTECTED]> writes:
> How do I initiate a gnome from fvwm?

This is a nonsequitor.  Gnome is a set of libraries used to build some
"desktop" applications.  There is no single thing called Gnome that
you would initiate.

Do you want to run a spreadsheet?  Head to a shell and type
"gnumeric," or add gnumeric to the fvwm menu.

Do you want to run the Gnome "panel?"  s/gnumeric/panel/g
-- 
(concatenate 'string "cbbrowne" "@ntlug.org")
http://vip.hyperusa.com/~cbbrowne/resume.html
All syllogisms have three parts, therefore this is not a syllogism.

------------------------------

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: The reason for static...
Date: Tue, 17 Apr 2001 14:14:19 GMT

In article <[EMAIL PROTECTED]>, David wrote:

>However, why would "static" help in preventing namespace pollution?

In C, the keywaord "static" is used for two completely
independant things (a very bad language feature).  It is used
to control the storage class (and hence lifetime) of local
variables in functions.  Outside of functions, "static"
controls lexical scope by limiting the scope of an identifier
to the containing file -- "static" global variables are not
visible outside the file.

I second the recommendation of K&R as a good book on C.

-- 
Grant Edwards                   grante             Yow!  Is there something
                                  at               I should be DOING with a
                               visi.com            GLAZED DONUT??

------------------------------

From: [EMAIL PROTECTED] (Greg Comeau)
Crossposted-To: comp.programming
Subject: Re: checking for non ansi extensions
Date: 17 Apr 2001 10:23:15 -0400
Reply-To: [EMAIL PROTECTED]

In article <[EMAIL PROTECTED]>,
O.Petzold <[EMAIL PROTECTED]> wrote:
>Raymond Limpus wrote:
>> long long is an ANSI type isn't it? in the C99 std.
>It is, but as Richard wrote there are only a few compiler
>c99 conform. long double is an another example (C99 ??)

It is true.  There is NO conforming C99 implementation.
However, it is also true that compilers such as gcc and Comeau
support many C99isms, are both available on many platform,
and are both available at a reasonble cost.  This means
that a good portion of the language features of C99 is
reasonable accessible to anybody who wants it.

>I have to ifdef those types. For this I have to check
>if they are supported on this XXX plattform. One way is
>to use compiler Flags, like
>#if defined(GCC >2.95.2) || defined(C99)
># define HAS_LONGLONG
>#endif
>
>#ifdef HAS_LONGLONG
>...
>#endif
>
>What are those predefined compiler flags for several
>compilers (especially gcc).
>The other way could be autoconf/automake - is there a
>check for this ?

For gcc, use things like __GNUC__ >= 2 && __GNUC_MINOR__ >= 9

Comeau C/C++ use __COMO_VERSION__ >= 4245

Notwithstanding that, there is __STDC__VERSION__.  Consider:
C90: __STDC_VERSION__ == 199409L
C99: __STDC_VERSION__ == 199901L
-- 
Greg Comeau                 Comeau C/C++ 4.2.45.2 "it's so close"
ONLINE COMPILER ==>         http://www.comeaucomputing.com/tryitout
NEW: Try out libcomo!       NEW: Try out our C99 mode!
[EMAIL PROTECTED]  http://www.comeaucomputing.com

------------------------------

From: William Morris <[EMAIL PROTECTED]>
Subject: IO system throughput
Date: Tue, 17 Apr 2001 14:49:27 GMT

We are trying to achieve a disk transfer rate of 90-100MB/s using a pair of
Qlogic ISP2100 cards each attached to a fibrechannel disk array capable of
around 90MB/s each.  The required performance is possible on NT (using just
one disk) but on Linux is causing us problems. We can achieve around 70MB/s
from one disk but only 45MB/s each when both disks are active at the same
time. 

I have heard that "Linux splits any I/O transfer into 64kB blocks and 
this limits the maximum transfer rate of a single disk to between 60 and
70 MB/s".  Can anyone explain this statement and tell me if it is true.  If
untrue, what can we do to improve the trasfer rate over our 64bit PCI bus?

BTW: the driver in use is qla2x00 rev 2.23, patched to make 64bit mode compile
correctly (diffs below).

Thanks in advance


[root@tmphdstation scsi]# diff -cu qla2x00.c ~/qlogic/
diff: conflicting specifications of output style
--- qla2x00.c   Thu Apr 12 19:27:28 2001
+++ /root/qlogic/qla2x00.c      Sat Aug 19 19:53:15 2000
@@ -217,7 +217,7 @@
 * Compile time Options:
 *            0 - Disable and 1 - Enable
 */
-#define  QLA2100_64BIT_SUPPORT         1   /* 64-bit Support */
+#define  QLA2100_64BIT_SUPPORT         0   /* 64-bit Support */
 #define  QL2100_TARGET_MODE_SUPPORT    0   /* Target mode support */
 #define  MEMORY_MAPPED_IO              0
 #define  DEBUG_QLA2100_INTR            0
@@ -7126,7 +7126,6 @@
                 uint8_t         status = 0;
                 Scsi_Cmnd       *cmd = sp->cmd;
                 uint32_t        cnt, temp;
-                uint16_t        cdb_len;
                 cmd_entry_t     *pkt;
                 uint16_t        req_cnt;
                 uint16_t        seg_cnt;
@@ -7210,9 +7209,9 @@
                             pkt->control_flags |= BIT_3;
                              
                         /* Load SCSI command packet. */
-                        cdb_len = (uint16_t)CMD_CDBLEN(cmd);
+                        pkt->cdb_len = (uint16_t)CMD_CDBLEN(cmd);
                         data_ptr = (uint8_t *) &(CMD_CDBP(cmd));
-                        for( cnt = 0; cnt < cdb_len; cnt++ )
+                        for( cnt = 0; cnt < pkt->cdb_len; cnt++ )
                             pkt->scsi_cdb[cnt] = *data_ptr++;

                         /*
@@ -7380,7 +7379,7 @@
                 }

                 /* Release ring specific lock */
-                QLA2100_RING_UNLOCK(ha);
+                QLA1280_RING_UNLOCK(ha);

 #if defined(QL_DEBUG_LEVEL_2) || defined(QL_DEBUG_LEVEL_3)
                  if( status )
[root@tmphdstation scsi]# 


-- 
William Morris
[EMAIL PROTECTED]


------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list by posting to the
comp.os.linux.development.system newsgroup.

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-System Digest
******************************

Reply via email to