Has anyone found an example driver that uses the new-ish scatterlist API (dma_map_sg, etc, for 2.6.26+)?
I have lots of disjoint documentation but no example code. I'd rather not have to download the entire kernel tree and search for drivers which may, or may not, use the API correctly.
After several hours searching for PCIe drivers I've got the Altera Avalon code, which doesn't do anything complicated and which is a great example of keep-your-code-propietary-by-not-commenting-it, and the Opencores pexdrv, which doesn't use scatterlists. I couldn't find anything useful at Xilinx. Thanks.
EDIT
Before I get any more close votes, "how to use an API" is a perfectly legitimate programming question, and if the only concrete example is code which is out there somewhere, then surely "where is that example code" is also a legitimate question.
Related
Are filter drivers intended to extend system drivers?
Is this their main purpose?
Are they basically just an extra layer that sits between the driver and the user?
This seems overly simple an explanation and I am wondering if I am missing something.
Are there good ways to learn more?
The driver topic is a very advanced one.
To get an overview, you can have a closer look on the Windows Driver Kit (WDK) sides.
If you decide to get into this stuff, then you need a lot of time, frustration resistance and fanaticism.
The first thing you should do (befor you touch the WDK!) is, to start reading a good book.
If you want to develop for windows file system, read Rajeev Nagar's book "Windows NT File System Internals : A Developer's Guide". It's published in 1997, but it's something like the "bible" of NTFS.
For common driver developement you can find books like "Developing Drivers with the Windows Driver Foundation", written by Penny Orwick.
These books describes programming kernel mode software, which is done in C language. So, you should have a good base knowlege on C before you start.
Among others there are the OSR side (www.osr.com) and SysInternals on technet (http://technet.microsoft.com/de-DE/sysinternals), which are truely worth to have a closer look on.
More than the halfe time you spend on reading debug outputs and crash dumps, so it's wise to know what these things are meaning and how to get this information, but there are good books for windows debugging too.
I hope, I was able to give a short overview on the question for the ways to learn more.
In a way yes.
For example, if file system filter driver is for file encryption/compression/security, it is enhancing the file system functionality.
The filter driver does not handle talking to actual devices. They rely on lower level drivers to communicate with device. The filter drivers are add-on to the drivers to implement certain functionality. The active drivers which modify data/request are to enhance vanilla drivers while the passive filter drivers are just pass-throughs without any direct enhancements.
So I think your assumptions are correct.
Will like to hear different views though.
I'm faced with the need to write a new MIB description. Does anyone know of a good tutorial or reference? I seem to find lots of stuff about using SNMP and Net-SNMP has decent stuff about implementing an agent, but it seems like the only real sources on writing the MIBs are RFCs.
Mg Soft company is selling a very good tool called "Mib Browser" but they also edit a product called "Visual MIB Builder", which provide an easy way to build MIBs without dealling with ASN1 syntax.
Mibs are built on ASN1 syntax, you definitively not need to understand all ASN1 language. I wrote a few PPT slides to explain that, but they are in french.
Edited (1)
I built MIBs twelve years ago, and I learnt by myself with a couple of books (Practical Guide to Snmpv3 and Network Management, Essential SNMP).
On the semantic point of view the first three advices that come in my mind are :
Learn how tables are built and how they works (get-next usage and index)
Have a look to Textual Conventions, they mostly appears in SNMPv2 giving names to implicit usages in SNMPv1. For example you'll read how TestAndIncr provides the mutex semantic. They are improved in SNMPv3. But understand that you have to provide the code for doing that in your agent, they are just TCs.
I learnt a lot in understanding how RMON1 MIB was working, and especialy the usage of configuration tables.
Just an advice, SNMP is a nice protocol, it's a bit old, and except with SNMPV3 it still lives in a boudhist world. I just mean that V1 and V2 are just ignoring the security point of view. So be careful with writable leafs, you can deploy an active agent protecting SNMP ports with IPSec but it's 'expensive'.
Do you have a look to Web-Based Enterprise Management (WBEM) ? On Windows I play with WMI which is Microsoft adaptation of this standard, but on Linux you can play with OpenPegasus.
Is there some sort of thing like a layout/plan of the windows api? A clear overview of which api depends on another? Or a website where they are linked in a hierarchical way (starting with the most dependable, ending with the core function)
e.g Kerenel32.dll!CreateFile() -> ntdll.dll!ntCreateFIle() -> ntoskrnl32.exe!zwCreateFile()
I can link them all by hand with a dependency walker but it takes much time. So I was just wondering if something like this already existed.
I don't have the answer to your question, but I think an even more interesting road would be to read what Geoff Chappell has found out regarding the Windows Kernel and the Win32 API. I have not read those sections, but so far everything I've read on that website has filled me with wonder and awe at how thoroughly things can be analysed given a disciplined and talented investigator.
You can always take a look at ReactOS:
ReactOS® is a free, modern operating system based on the design of Windows® XP/2003. Written completely from scratch, it aims to follow the Windows-NT® architecture designed by Microsoft from the hardware level right through to the application level.
Simply search for whatever function in the documentation and look at its source. 99% of the time you can just pretend to be looking at the actual Windows source :) Very helpful when playing around with a debugger too.
I have been programming in C for a couple of years in Linux. Now I want to work on linux kernel and contribute to kernel, if possible. I have been looking on the internet for the information about a starting point but I couldn't find one. So can any one please tell me where to begin?
I'm not a kernel person at all but I work with a lot of people who are very much into the kernel. They all recommend Linux Kernel Development by Robert Love as a good book on the subject. I've bought the book myself and plan to, in my copious free time, go through it.
The Kernel Mentors mailing list related resources at http://kernelnewbies.org/KernelMentors is also a good place to look at.
I would also recommend the site lxr.linux.no as a browsable source code repository.
It contains version 0.0.1 an up. With the help of this site, it is very easy to search for keywords in the kernel source on different versions.
Basically venturing into kernel programming starts off with a need to fiddle with services provided by the kernel....Me for example ..i had a need to fiddle with the IP packets generated and arriving on the kernel network stack....so started of writing LKMs,.,,kernel modules.And understand becomes easier if you have good understand of general Operating System Concepts.For example there was this book which i referred during my engineering undergraduation days...Operating System Concepts Author Silberschatz Galvin..even though i never cracked my head understanding user space and kernel space..that book did look into core concept at a more naive level...and it looked in from general OS point of view not specific to linux as such..now that i am more into kernel space programming that i realize how beautifully that book ventured into both user space and kernel space concepts....it just starts off with NEED to get into kernel side...from user space
I'm sitting here writing a function that I'm positive has been written before, somewhere on earth. It's just too common to have not been attempted, and I'm wondering why I can't just go to a website and search for a function that I can then copy and paste into my project in 2 seconds, instead of wasting my day reinventing the wheel.
Sure there are certain libraries you can use, but where do you find these libraries and when they are absent, is there a site like I'm describing?
Possibly a wiki of some type that contains free code that anybody can edit and improve?
Edit: I can code things fine, I just don't know HOW to do them. So for example, right now, I'm trying to localize a robot/car/point in space. I KNOW there is a way to do it, just based off of range and distance. Triangulation and Trilateration. How to code that is a different story. A site that could have psuedo code, step by step how to do that would be ridiculously helpful. It would also ensure the optimal solution since everybody can edit it. I'm also writing in Matlab, which I hate because it's quirky, adding to my desire for creating a website like I describe.
StackOverflow.com. No, I'm not joking.
At its best, people come here saying "hasn't some library done X already", and very often the Collective Wisdom answers "yes". But the biggest obstacle is lack of a description language: even here, a big problem for many posters is describing the problem clearly enough for others to recognize it as something they've seen before.
And if people can't understand what you're trying to do, no search engine will.
Firstly, two caveats:
Copy and pasting code you don't understand is a bad idea. Make sure you understand exactly what the code does before you use it.
Make sure you respect the license of the code you are copying. This is important!
Those caveats aside, it's often language dependent. Languages with an open development ethos (not just an open source implementation, think Python as compared to Java) tend to have official archives of open source libraries. For example:
Perl (which probably started this trend) has CPAN
Python has PyPI and Python Cookbook
PHP has PEAR
C++ has boost
Ruby has gems
R has CRAN.
Haskell has Hoogle and Hackage
Furthermore, don't forget to look in your languages standard library. Some modern languages have massive standard libraries, which have often contained the functionality I am looking for:
Java has its API documentation
C# and VB.NET have the massive MSDN
Non-openly developed languages often have non-official community archives. For example:
C# tends to have a lot of code at CodePlex and CodeProject
MATLAB has the Matlab Central File Exchange
A third category of sites are language agnostic. They are often best search through POG (plain old-fashioned Google). For example:
Stack Overflow
SourceForge
The confusingly language agnostic Java2s
Planet source code
Github
Finally, a fourth category of sites that I find increasingly useful are source-code search engines:
Google Codesearch
Koders
You may also be able to find useful source code, or at least get help writing something, through various pastebins.
Pastebin is language-agnostic
HPaste is mostly Haskell, but has a little in other languages.
Often, at the end of the day it is easiest just to google it, though.
There is a wiki that contains free code that anybody can edit and improve:
Rosetta Code.
As a means of an overview there is the "Solutions by Programming Task" page.
From the former page:
"Rosetta Code is a programming chrestomathy site. The
idea is to present solutions to the same task in as
many different languages as possible, to demonstrate
how languages are similar and different, and to aid a
person with a grounding in one approach to a problem
in learning another."
Cutting and pasting code you find on the Internet into production code would be like chewing gum found in the street. - Mike Johnson
With that in mind, try sites that host opensource projects like GitHub, CodePlex, code.google.com, etc.
I'm not sure this question is language agnostic, but I use GitHub this way ;) Other languages may have places where this is possible.
Safari Bookshelf from O'Reilly has many, many books that contain many implementations from which to choose.
http://my.safaribooksonline.com/
I was a subscriber for a few years before coming to my current job, where we have a corporate account! It's one of the best perks, and one of the best resources I have available. I haven't bought a computer book in years.
Aside from sites like this (Stack Overflow) I don't think there's many, maybe CodePlex, but I almost marked you -1 for assuming that code found on the Internet is yours to copy.
I'd suggest reading about software licencing, I hope you'd at least comment where you got it from.