You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
This commit is contained in:
@@ -0,0 +1,356 @@
|
|||||||
|
|
||||||
|
NOTE! This copyright does *not* cover user programs that use kernel
|
||||||
|
services by normal system calls - this is merely considered normal use
|
||||||
|
of the kernel, and does *not* fall under the heading of "derived work".
|
||||||
|
Also note that the GPL below is copyrighted by the Free Software
|
||||||
|
Foundation, but the instance of code that it refers to (the Linux
|
||||||
|
kernel) is copyrighted by me and others who actually wrote it.
|
||||||
|
|
||||||
|
Also note that the only valid version of the GPL as far as the kernel
|
||||||
|
is concerned is _this_ particular version of the license (ie v2, not
|
||||||
|
v2.2 or v3.x or whatever), unless explicitly otherwise stated.
|
||||||
|
|
||||||
|
Linus Torvalds
|
||||||
|
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
@@ -0,0 +1,294 @@
|
|||||||
|
|
||||||
|
This is a brief list of all the files in ./linux/Documentation and what
|
||||||
|
they contain. If you add a documentation file, please list it here in
|
||||||
|
alphabetical order as well, or risk being hunted down like a rabid dog.
|
||||||
|
Please try and keep the descriptions small enough to fit on one line.
|
||||||
|
Thanks -- Paul G.
|
||||||
|
|
||||||
|
Following translations are available on the WWW:
|
||||||
|
|
||||||
|
- Japanese, maintained by the JF Project (JF@linux.or.jp), at
|
||||||
|
http://www.linux.or.jp/JF/
|
||||||
|
|
||||||
|
00-INDEX
|
||||||
|
- this file.
|
||||||
|
BK-usage/
|
||||||
|
- directory with info on BitKeeper.
|
||||||
|
BUG-HUNTING
|
||||||
|
- brute force method of doing binary search of patches to find bug.
|
||||||
|
Changes
|
||||||
|
- list of changes that break older software packages.
|
||||||
|
CodingStyle
|
||||||
|
- how the boss likes the C code in the kernel to look.
|
||||||
|
DMA-API.txt
|
||||||
|
- DMA API, pci_ API & extensions for non-consistent memory machines.
|
||||||
|
DMA-mapping.txt
|
||||||
|
- info for PCI drivers using DMA portably across all platforms.
|
||||||
|
DocBook/
|
||||||
|
- directory with DocBook templates etc. for kernel documentation.
|
||||||
|
IO-mapping.txt
|
||||||
|
- how to access I/O mapped memory from within device drivers.
|
||||||
|
IPMI.txt
|
||||||
|
- info on Linux Intelligent Platform Management Interface (IPMI) Driver.
|
||||||
|
IRQ-affinity.txt
|
||||||
|
- how to select which CPU(s) handle which interrupt events on SMP.
|
||||||
|
ManagementStyle
|
||||||
|
- how to (attempt to) manage kernel hackers.
|
||||||
|
MSI-HOWTO.txt
|
||||||
|
- the Message Signaled Interrupts (MSI) Driver Guide HOWTO and FAQ.
|
||||||
|
RCU/
|
||||||
|
- directory with info on RCU (read-copy update).
|
||||||
|
README.DAC960
|
||||||
|
- info on Mylex DAC960/DAC1100 PCI RAID Controller Driver for Linux.
|
||||||
|
SAK.txt
|
||||||
|
- info on Secure Attention Keys.
|
||||||
|
SubmittingDrivers
|
||||||
|
- procedure to get a new driver source included into the kernel tree.
|
||||||
|
SubmittingPatches
|
||||||
|
- procedure to get a source patch included into the kernel tree.
|
||||||
|
VGA-softcursor.txt
|
||||||
|
- how to change your VGA cursor from a blinking underscore.
|
||||||
|
arm/
|
||||||
|
- directory with info about Linux on the ARM architecture.
|
||||||
|
basic_profiling.txt
|
||||||
|
- basic instructions for those who wants to profile Linux kernel.
|
||||||
|
binfmt_misc.txt
|
||||||
|
- info on the kernel support for extra binary formats.
|
||||||
|
block/
|
||||||
|
- info on the Block I/O (BIO) layer.
|
||||||
|
cachetlb.txt
|
||||||
|
- describes the cache/TLB flushing interfaces Linux uses.
|
||||||
|
cciss.txt
|
||||||
|
- info, major/minor #'s for Compaq's SMART Array Controllers.
|
||||||
|
cdrom/
|
||||||
|
- directory with information on the CD-ROM drivers that Linux has.
|
||||||
|
cli-sti-removal.txt
|
||||||
|
- cli()/sti() removal guide.
|
||||||
|
computone.txt
|
||||||
|
- info on Computone Intelliport II/Plus Multiport Serial Driver.
|
||||||
|
cpqarray.txt
|
||||||
|
- info on using Compaq's SMART2 Intelligent Disk Array Controllers.
|
||||||
|
cpu-freq/
|
||||||
|
- info on CPU frequency and voltage scaling.
|
||||||
|
cris/
|
||||||
|
- directory with info about Linux on CRIS architecture.
|
||||||
|
crypto/
|
||||||
|
- directory with info on the Crypto API.
|
||||||
|
debugging-modules.txt
|
||||||
|
- some notes on debugging modules after Linux 2.6.3.
|
||||||
|
device-mapper/
|
||||||
|
- directory with info on Device Mapper.
|
||||||
|
devices.txt
|
||||||
|
- plain ASCII listing of all the nodes in /dev/ with major minor #'s.
|
||||||
|
digiepca.txt
|
||||||
|
- info on Digi Intl. {PC,PCI,EISA}Xx and Xem series cards.
|
||||||
|
dnotify.txt
|
||||||
|
- info about directory notification in Linux.
|
||||||
|
driver-model/
|
||||||
|
- directory with info about Linux driver model.
|
||||||
|
dvb/
|
||||||
|
- info on Linux Digital Video Broadcast (DVB) subsystem.
|
||||||
|
early-userspace/
|
||||||
|
- info about initramfs, klibc, and userspace early during boot.
|
||||||
|
eisa.txt
|
||||||
|
- info on EISA bus support.
|
||||||
|
exception.txt
|
||||||
|
- how Linux v2.2 handles exceptions without verify_area etc.
|
||||||
|
fb/
|
||||||
|
- directory with info on the frame buffer graphics abstraction layer.
|
||||||
|
filesystems/
|
||||||
|
- directory with info on the various filesystems that Linux supports.
|
||||||
|
firmware_class/
|
||||||
|
- request_firmware() hotplug interface info.
|
||||||
|
floppy.txt
|
||||||
|
- notes and driver options for the floppy disk driver.
|
||||||
|
ftape.txt
|
||||||
|
- notes about the floppy tape device driver.
|
||||||
|
hayes-esp.txt
|
||||||
|
- info on using the Hayes ESP serial driver.
|
||||||
|
highuid.txt
|
||||||
|
- notes on the change from 16 bit to 32 bit user/group IDs.
|
||||||
|
hpet.txt
|
||||||
|
- High Precision Event Timer Driver for Linux.
|
||||||
|
hw_random.txt
|
||||||
|
- info on Linux support for random number generator in i8xx chipsets.
|
||||||
|
i2c/
|
||||||
|
- directory with info about the I2C bus/protocol (2 wire, kHz speed).
|
||||||
|
i2o/
|
||||||
|
- directory with info about the Linux I2O subsystem.
|
||||||
|
i386/
|
||||||
|
- directory with info about Linux on Intel 32 bit architecture.
|
||||||
|
ia64/
|
||||||
|
- directory with info about Linux on Intel 64 bit architecture.
|
||||||
|
ide.txt
|
||||||
|
- important info for users of ATA devices (IDE/EIDE disks and CD-ROMS).
|
||||||
|
initrd.txt
|
||||||
|
- how to use the RAM disk as an initial/temporary root filesystem.
|
||||||
|
input/
|
||||||
|
- info on Linux input device support.
|
||||||
|
io_ordering.txt
|
||||||
|
- info on ordering I/O writes to memory-mapped addresses.
|
||||||
|
ioctl-number.txt
|
||||||
|
- how to implement and register device/driver ioctl calls.
|
||||||
|
iostats.txt
|
||||||
|
- info on I/O statistics Linux kernel provides.
|
||||||
|
isapnp.txt
|
||||||
|
- info on Linux ISA Plug & Play support.
|
||||||
|
isdn/
|
||||||
|
- directory with info on the Linux ISDN support, and supported cards.
|
||||||
|
java.txt
|
||||||
|
- info on the in-kernel binary support for Java(tm).
|
||||||
|
kbuild/
|
||||||
|
- directory with info about the kernel build process.
|
||||||
|
kernel-doc-nano-HOWTO.txt
|
||||||
|
- mini HowTo on generation and location of kernel documentation files.
|
||||||
|
kernel-docs.txt
|
||||||
|
- listing of various WWW + books that document kernel internals.
|
||||||
|
kernel-parameters.txt
|
||||||
|
- summary listing of command line / boot prompt args for the kernel.
|
||||||
|
kobject.txt
|
||||||
|
- info of the kobject infrastructure of the Linux kernel.
|
||||||
|
laptop-mode.txt
|
||||||
|
- How to conserve battery power using laptop-mode.
|
||||||
|
ldm.txt
|
||||||
|
- a brief description of LDM (Windows Dynamic Disks).
|
||||||
|
locks.txt
|
||||||
|
- info on file locking implementations, flock() vs. fcntl(), etc.
|
||||||
|
logo.gif
|
||||||
|
- Full colour GIF image of Linux logo (penguin).
|
||||||
|
logo.txt
|
||||||
|
- Info on creator of above logo & site to get additional images from.
|
||||||
|
m68k/
|
||||||
|
- directory with info about Linux on Motorola 68k architecture.
|
||||||
|
magic-number.txt
|
||||||
|
- list of magic numbers used to mark/protect kernel data structures.
|
||||||
|
mandatory.txt
|
||||||
|
- info on the Linux implementation of Sys V mandatory file locking.
|
||||||
|
mca.txt
|
||||||
|
- info on supporting Micro Channel Architecture (e.g. PS/2) systems.
|
||||||
|
md.txt
|
||||||
|
- info on boot arguments for the multiple devices driver.
|
||||||
|
memory.txt
|
||||||
|
- info on typical Linux memory problems.
|
||||||
|
mips/
|
||||||
|
- directory with info about Linux on MIPS architecture.
|
||||||
|
mono.txt
|
||||||
|
- how to execute Mono-based .NET binaries with the help of BINFMT_MISC.
|
||||||
|
moxa-smartio
|
||||||
|
- info on installing/using Moxa multiport serial driver.
|
||||||
|
mtrr.txt
|
||||||
|
- how to use PPro Memory Type Range Registers to increase performance.
|
||||||
|
nbd.txt
|
||||||
|
- info on a TCP implementation of a network block device.
|
||||||
|
networking/
|
||||||
|
- directory with info on various aspects of networking with Linux.
|
||||||
|
nfsroot.txt
|
||||||
|
- short guide on setting up a diskless box with NFS root filesystem.
|
||||||
|
nmi_watchdog.txt
|
||||||
|
- info on NMI watchdog for SMP systems.
|
||||||
|
numastat.txt
|
||||||
|
- info on how to read Numa policy hit/miss statistics in sysfs.
|
||||||
|
oops-tracing.txt
|
||||||
|
- how to decode those nasty internal kernel error dump messages.
|
||||||
|
paride.txt
|
||||||
|
- information about the parallel port IDE subsystem.
|
||||||
|
parisc/
|
||||||
|
- directory with info on using Linux on PA-RISC architecture.
|
||||||
|
parport.txt
|
||||||
|
- how to use the parallel-port driver.
|
||||||
|
parport-lowlevel.txt
|
||||||
|
- description and usage of the low level parallel port functions.
|
||||||
|
pci.txt
|
||||||
|
- info on the PCI subsystem for device driver authors.
|
||||||
|
pm.txt
|
||||||
|
- info on Linux power management support.
|
||||||
|
pnp.txt
|
||||||
|
- Linux Plug and Play documentation.
|
||||||
|
power/
|
||||||
|
- directory with info on Linux PCI power management.
|
||||||
|
powerpc/
|
||||||
|
- directory with info on using Linux with the PowerPC.
|
||||||
|
preempt-locking.txt
|
||||||
|
- info on locking under a preemptive kernel.
|
||||||
|
ramdisk.txt
|
||||||
|
- short guide on how to set up and use the RAM disk.
|
||||||
|
riscom8.txt
|
||||||
|
- notes on using the RISCom/8 multi-port serial driver.
|
||||||
|
rocket.txt
|
||||||
|
- info on the Comtrol RocketPort multiport serial driver.
|
||||||
|
rpc-cache.txt
|
||||||
|
- introduction to the caching mechanisms in the sunrpc layer.
|
||||||
|
rtc.txt
|
||||||
|
- notes on how to use the Real Time Clock (aka CMOS clock) driver.
|
||||||
|
s390/
|
||||||
|
- directory with info on using Linux on the IBM S390.
|
||||||
|
sched-coding.txt
|
||||||
|
- reference for various scheduler-related methods in the O(1) scheduler.
|
||||||
|
sched-design.txt
|
||||||
|
- goals, design and implementation of the Linux O(1) scheduler.
|
||||||
|
sched-domains.txt
|
||||||
|
- information on scheduling domains.
|
||||||
|
sched-stats.txt
|
||||||
|
- information on schedstats (Linux Scheduler Statistics).
|
||||||
|
scsi/
|
||||||
|
- directory with info on Linux scsi support.
|
||||||
|
serial/
|
||||||
|
- directory with info on the low level serial API.
|
||||||
|
serial-console.txt
|
||||||
|
- how to set up Linux with a serial line console as the default.
|
||||||
|
sgi-visws.txt
|
||||||
|
- short blurb on the SGI Visual Workstations.
|
||||||
|
sh/
|
||||||
|
- directory with info on porting Linux to a new architecture.
|
||||||
|
smart-config.txt
|
||||||
|
- description of the Smart Config makefile feature.
|
||||||
|
smp.txt
|
||||||
|
- a few notes on symmetric multi-processing.
|
||||||
|
sonypi.txt
|
||||||
|
- info on Linux Sony Programmable I/O Device support.
|
||||||
|
sound/
|
||||||
|
- directory with info on sound card support.
|
||||||
|
sparc/
|
||||||
|
- directory with info on using Linux on Sparc architecture.
|
||||||
|
specialix.txt
|
||||||
|
- info on hardware/driver for specialix IO8+ multiport serial card.
|
||||||
|
spinlocks.txt
|
||||||
|
- info on using spinlocks to provide exclusive access in kernel.
|
||||||
|
stallion.txt
|
||||||
|
- info on using the Stallion multiport serial driver.
|
||||||
|
svga.txt
|
||||||
|
- short guide on selecting video modes at boot via VGA BIOS.
|
||||||
|
sx.txt
|
||||||
|
- info on the Specialix SX/SI multiport serial driver.
|
||||||
|
sysctl/
|
||||||
|
- directory with info on the /proc/sys/* files.
|
||||||
|
sysrq.txt
|
||||||
|
- info on the magic SysRq key.
|
||||||
|
telephony/
|
||||||
|
- directory with info on telephony (e.g. voice over IP) support.
|
||||||
|
time_interpolators.txt
|
||||||
|
- info on time interpolators.
|
||||||
|
tipar.txt
|
||||||
|
- information about Parallel link cable for Texas Instruments handhelds.
|
||||||
|
tty.txt
|
||||||
|
- guide to the locking policies of the tty layer.
|
||||||
|
unicode.txt
|
||||||
|
- info on the Unicode character/font mapping used in Linux.
|
||||||
|
uml/
|
||||||
|
- directory with infomation about User Mode Linux.
|
||||||
|
usb/
|
||||||
|
- directory with info regarding the Universal Serial Bus.
|
||||||
|
video4linux/
|
||||||
|
- directory with info regarding video/TV/radio cards and linux.
|
||||||
|
vm/
|
||||||
|
- directory with info on the Linux vm code.
|
||||||
|
voyager.txt
|
||||||
|
- guide to running Linux on the Voyager architecture.
|
||||||
|
watchdog/
|
||||||
|
- how to auto-reboot Linux if it has "fallen and can't get up". ;-)
|
||||||
|
x86_64/
|
||||||
|
- directory with info on Linux support for AMD x86-64 (Hammer) machines.
|
||||||
|
xterm-linux.xpm
|
||||||
|
- XPM image of penguin logo (see logo.txt) sitting on an xterm.
|
||||||
|
zorro.txt
|
||||||
|
- info on writing drivers for Zorro bus devices found on Amigas.
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
bk-kernel-howto.txt: Description of kernel workflow under BitKeeper
|
||||||
|
|
||||||
|
bk-make-sum: Create summary of changesets in one repository and not
|
||||||
|
another, typically in preparation to be sent to an upstream maintainer.
|
||||||
|
Typical usage:
|
||||||
|
cd my-updated-repo
|
||||||
|
bk-make-sum ~/repo/original-repo
|
||||||
|
mv /tmp/linus.txt ../original-repo.txt
|
||||||
|
|
||||||
|
bksend: Create readable text output containing summary of changes, GNU
|
||||||
|
patch of the changes, and BK metadata of changes (as needed for proper
|
||||||
|
importing into BitKeeper by an upstream maintainer). This output is
|
||||||
|
suitable for emailing BitKeeper changes. The recipient of this output
|
||||||
|
may pipe it directly to 'bk receive'.
|
||||||
|
|
||||||
|
bz64wrap: helper script. Uncompressed input is piped to this script,
|
||||||
|
which compresses its input, and then outputs the uu-/base64-encoded
|
||||||
|
version of the compressed input.
|
||||||
|
|
||||||
|
cpcset: Copy changeset between unrelated repositories.
|
||||||
|
Attempts to preserve changeset user, user address, description, in
|
||||||
|
addition to the changeset (the patch) itself.
|
||||||
|
Typical usage:
|
||||||
|
cd my-updated-repo
|
||||||
|
bk changes # looking for a changeset...
|
||||||
|
cpcset 1.1511 . ../another-repo
|
||||||
|
|
||||||
|
csets-to-patches: Produces a delta of two BK repositories, in the form
|
||||||
|
of individual files, each containing a single cset as a GNU patch.
|
||||||
|
Output is several files, each with the filename "/tmp/rev-$REV.patch"
|
||||||
|
Typical usage:
|
||||||
|
cd my-updated-repo
|
||||||
|
bk changes -L ~/repo/original-repo 2>&1 | \
|
||||||
|
perl csets-to-patches
|
||||||
|
|
||||||
|
cset-to-linus: Produces a delta of two BK repositories, in the form of
|
||||||
|
changeset descriptions, with 'diffstat' output created for each
|
||||||
|
individual changset.
|
||||||
|
Typical usage:
|
||||||
|
cd my-updated-repo
|
||||||
|
bk changes -L ~/repo/original-repo 2>&1 | \
|
||||||
|
perl cset-to-linus > summary.txt
|
||||||
|
|
||||||
|
gcapatch: Generates patch containing changes in local repository.
|
||||||
|
Typical usage:
|
||||||
|
cd my-updated-repo
|
||||||
|
gcapatch > foo.patch
|
||||||
|
|
||||||
|
unbz64wrap: Reverse an encoded, compressed data stream created by
|
||||||
|
bz64wrap into an uncompressed, typically text/plain output.
|
||||||
|
|
||||||
@@ -0,0 +1,283 @@
|
|||||||
|
|
||||||
|
Doing the BK Thing, Penguin-Style
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
This set of notes is intended mainly for kernel developers, occasional
|
||||||
|
or full-time, but sysadmins and power users may find parts of it useful
|
||||||
|
as well. It assumes at least a basic familiarity with CVS, both at a
|
||||||
|
user level (use on the cmd line) and at a higher level (client-server model).
|
||||||
|
Due to the author's background, an operation may be described in terms
|
||||||
|
of CVS, or in terms of how that operation differs from CVS.
|
||||||
|
|
||||||
|
This is -not- intended to be BitKeeper documentation. Always run
|
||||||
|
"bk help <command>" or in X "bk helptool <command>" for reference
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
|
||||||
|
BitKeeper Concepts
|
||||||
|
------------------
|
||||||
|
|
||||||
|
In the true nature of the Internet itself, BitKeeper is a distributed
|
||||||
|
system. When applied to revision control, this means doing away with
|
||||||
|
client-server, and changing to a parent-child model... essentially
|
||||||
|
peer-to-peer. On the developer's end, this also represents a
|
||||||
|
fundamental disruption in the standard workflow of changes, commits,
|
||||||
|
and merges. You will need to take a few minutes to think about
|
||||||
|
how to best work under BitKeeper, and re-optimize things a bit.
|
||||||
|
In some sense it is a bit radical, because it might described as
|
||||||
|
tossing changes out into a maelstrom and having them magically
|
||||||
|
land at the right destination... but I'm getting ahead of myself.
|
||||||
|
|
||||||
|
Let's start with this progression:
|
||||||
|
Each BitKeeper source tree on disk is a repository unto itself.
|
||||||
|
Each repository has a parent (except the root/original, of course).
|
||||||
|
Each repository contains a set of a changesets ("csets").
|
||||||
|
Each cset is one or more changed files, bundled together.
|
||||||
|
|
||||||
|
Each tree is a repository, so all changes are checked into the local
|
||||||
|
tree. When a change is checked in, all modified files are grouped
|
||||||
|
into a logical unit, the changeset. Internally, BK links these
|
||||||
|
changesets in a tree, representing various converging and diverging
|
||||||
|
lines of development. These changesets are the bread and butter of
|
||||||
|
the BK system.
|
||||||
|
|
||||||
|
After the concept of changesets, the next thing you need to get used
|
||||||
|
to is having multiple copies of source trees lying around. This -really-
|
||||||
|
takes some getting used to, for some people. Separate source trees
|
||||||
|
are the means in BitKeeper by which you delineate parallel lines
|
||||||
|
of development, both minor and major. What would be branches in
|
||||||
|
CVS become separate source trees, or "clones" in BitKeeper [heh,
|
||||||
|
or Star Wars] terminology.
|
||||||
|
|
||||||
|
Clones and changesets are the tools from which most of the power of
|
||||||
|
BitKeeper is derived. As mentioned earlier, each clone has a parent,
|
||||||
|
the tree used as the source when the new clone was created. In a
|
||||||
|
CVS-like setup, the parent would be a remote server on the Internet,
|
||||||
|
and the child is your local clone of that tree.
|
||||||
|
|
||||||
|
Once you have established a common baseline between two source trees --
|
||||||
|
a common parent -- then you can merge changesets between those two
|
||||||
|
trees with ease. Merging changes into a tree is called a "pull", and
|
||||||
|
is analagous to 'cvs update'. A pull downloads all the changesets in
|
||||||
|
the remote tree you do not have, and merges them. Sending changes in
|
||||||
|
one tree to another tree is called a "push". Push sends all changes
|
||||||
|
in the local tree the remote does not yet have, and merges them.
|
||||||
|
|
||||||
|
From these concepts come some initial command examples:
|
||||||
|
|
||||||
|
1) bk clone -q http://linux.bkbits.net/linux-2.5 linus-2.5
|
||||||
|
Download a 2.5 stock kernel tree, naming it "linus-2.5" in the local dir.
|
||||||
|
The "-q" disables listing every single file as it is downloaded.
|
||||||
|
|
||||||
|
2) bk clone -ql linus-2.5 alpha-2.5
|
||||||
|
Create a separate source tree for the Alpha AXP architecture.
|
||||||
|
The "-l" uses hard links instead of copying data, since both trees are
|
||||||
|
on the local disk. You can also replace the above with "bk lclone -q ..."
|
||||||
|
|
||||||
|
You only clone a tree -once-. After cloning the tree lives a long time
|
||||||
|
on disk, being updating by pushes and pulls.
|
||||||
|
|
||||||
|
3) cd alpha-2.5 ; bk pull http://gkernel.bkbits.net/alpha-2.5
|
||||||
|
Download changes in "alpha-2.5" repository which are not present
|
||||||
|
in the local repository, and merge them into the source tree.
|
||||||
|
|
||||||
|
4) bk -r co -q
|
||||||
|
Because every tree is a repository, files must be checked out before
|
||||||
|
they will be in their standard places in the source tree.
|
||||||
|
|
||||||
|
5) bk vi fs/inode.c # example change...
|
||||||
|
bk citool # checkin, using X tool
|
||||||
|
bk push bk://gkernel@bkbits.net/alpha-2.5 # upload change
|
||||||
|
Typical example of a BK sequence that would replace the analagous CVS
|
||||||
|
situation,
|
||||||
|
vi fs/inode.c
|
||||||
|
cvs commit
|
||||||
|
|
||||||
|
As this is just supposed to be a quick BK intro, for more in-depth
|
||||||
|
tutorials, live working demos, and docs, see http://www.bitkeeper.com/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BK and Kernel Development Workflow
|
||||||
|
----------------------------------
|
||||||
|
Currently the latest 2.5 tree is available via "bk clone $URL"
|
||||||
|
and "bk pull $URL" at http://linux.bkbits.net/linux-2.5
|
||||||
|
This should change in a few weeks to a kernel.org URL.
|
||||||
|
|
||||||
|
|
||||||
|
A big part of using BitKeeper is organizing the various trees you have
|
||||||
|
on your local disk, and organizing the flow of changes among those
|
||||||
|
trees, and remote trees. If one were to graph the relationships between
|
||||||
|
a desired BK setup, you are likely to see a few-many-few graph, like
|
||||||
|
this:
|
||||||
|
|
||||||
|
linux-2.5
|
||||||
|
|
|
||||||
|
merge-to-linus-2.5
|
||||||
|
/ | |
|
||||||
|
/ | |
|
||||||
|
vm-hacks bugfixes filesys personal-hacks
|
||||||
|
\ | | /
|
||||||
|
\ | | /
|
||||||
|
\ | | /
|
||||||
|
testing-and-validation
|
||||||
|
|
||||||
|
Since a "bk push" sends all changes not in the target tree, and
|
||||||
|
since a "bk pull" receives all changes not in the source tree, you want
|
||||||
|
to make sure you are only pushing specific changes to the desired tree,
|
||||||
|
not all changes from "peer parent" trees. For example, pushing a change
|
||||||
|
from the testing-and-validation tree would probably be a bad idea,
|
||||||
|
because it will push all changes from vm-hacks, bugfixes, filesys, and
|
||||||
|
personal-hacks trees into the target tree.
|
||||||
|
|
||||||
|
One would typically work on only one "theme" at a time, either
|
||||||
|
vm-hacks or bugfixes or filesys, keeping those changes isolated in
|
||||||
|
their own tree during development, and only merge the isolated with
|
||||||
|
other changes when going upstream (to Linus or other maintainers) or
|
||||||
|
downstream (to your "union" trees, like testing-and-validation above).
|
||||||
|
|
||||||
|
It should be noted that some of this separation is not just recommended
|
||||||
|
practice, it's actually [for now] -enforced- by BitKeeper. BitKeeper
|
||||||
|
requires that changesets maintain a certain order, which is the reason
|
||||||
|
that "bk push" sends all local changesets the remote doesn't have. This
|
||||||
|
separation may look like a lot of wasted disk space at first, but it
|
||||||
|
helps when two unrelated changes may "pollute" the same area of code, or
|
||||||
|
don't follow the same pace of development, or any other of the standard
|
||||||
|
reasons why one creates a development branch.
|
||||||
|
|
||||||
|
Small development branches (clones) will appear and disappear:
|
||||||
|
|
||||||
|
-------- A --------- B --------- C --------- D -------
|
||||||
|
\ /
|
||||||
|
-----short-term devel branch-----
|
||||||
|
|
||||||
|
While long-term branches will parallel a tree (or trees), with period
|
||||||
|
merge points. In this first example, we pull from a tree (pulls,
|
||||||
|
"\") periodically, such as what occurs when tracking changes in a
|
||||||
|
vendor tree, never pushing changes back up the line:
|
||||||
|
|
||||||
|
-------- A --------- B --------- C --------- D -------
|
||||||
|
\ \ \
|
||||||
|
----long-term devel branch-----------------
|
||||||
|
|
||||||
|
And then a more common case in Linux kernel development, a long term
|
||||||
|
branch with periodic merges back into the tree (pushes, "/"):
|
||||||
|
|
||||||
|
-------- A --------- B --------- C --------- D -------
|
||||||
|
\ \ / \
|
||||||
|
----long-term devel branch-----------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Submitting Changes to Linus
|
||||||
|
---------------------------
|
||||||
|
There's a bit of an art, or style, of submitting changes to Linus.
|
||||||
|
Since Linus's tree is now (you might say) fully integrated into the
|
||||||
|
distributed BitKeeper system, there are several prerequisites to
|
||||||
|
properly submitting a BitKeeper change. All these prereq's are just
|
||||||
|
general cleanliness of BK usage, so as people become experts at BK, feel
|
||||||
|
free to optimize this process further (assuming Linus agrees, of
|
||||||
|
course).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
0) Make sure your tree was originally cloned from the linux-2.5 tree
|
||||||
|
created by Linus. If your tree does not have this as its ancestor, it
|
||||||
|
is impossible to reliably exchange changesets.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1) Pay attention to your commit text. The commit message that
|
||||||
|
accompanies each changeset you submit will live on forever in history,
|
||||||
|
and is used by Linus to accurately summarize the changes in each
|
||||||
|
pre-patch. Remember that there is no context, so
|
||||||
|
"fix for new scheduler changes"
|
||||||
|
would be too vague, but
|
||||||
|
"fix mips64 arch for new scheduler switch_to(), TIF_xxx semantics"
|
||||||
|
would be much better.
|
||||||
|
|
||||||
|
You can and should use the command "bk comment -C<rev>" to update the
|
||||||
|
commit text, and improve it after the fact. This is very useful for
|
||||||
|
development: poor, quick descriptions during development, which get
|
||||||
|
cleaned up using "bk comment" before issuing the "bk push" to submit the
|
||||||
|
changes.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2) Include an Internet-available URL for Linus to pull from, such as
|
||||||
|
|
||||||
|
Pull from: http://gkernel.bkbits.net/net-drivers-2.5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
3) Include a summary and "diffstat -p1" of each changeset that will be
|
||||||
|
downloaded, when Linus issues a "bk pull". The author auto-generates
|
||||||
|
these summaries using "bk changes -L <parent>", to obtain a listing
|
||||||
|
of all the pending-to-send changesets, and their commit messages.
|
||||||
|
|
||||||
|
It is important to show Linus what he will be downloading when he issues
|
||||||
|
a "bk pull", to reduce the time required to sift the changes once they
|
||||||
|
are downloaded to Linus's local machine.
|
||||||
|
|
||||||
|
IMPORTANT NOTE: One of the features of BK is that your repository does
|
||||||
|
not have to be up to date, in order for Linus to receive your changes.
|
||||||
|
It is considered a courtesy to keep your repository fairly recent, to
|
||||||
|
lessen any potential merge work Linus may need to do.
|
||||||
|
|
||||||
|
|
||||||
|
4) Split up your changes. Each maintainer<->Linus situation is likely
|
||||||
|
to be slightly different here, so take this just as general advice. The
|
||||||
|
author splits up changes according to "themes" when merging with Linus.
|
||||||
|
Simultaneous pushes from local development go to special trees which
|
||||||
|
exist solely to house changes "queued" for Linus. Example of the trees:
|
||||||
|
|
||||||
|
net-drivers-2.5 -- on-going net driver maintenance
|
||||||
|
vm-2.5 -- VM-related changes
|
||||||
|
fs-2.5 -- filesystem-related changes
|
||||||
|
|
||||||
|
Linus then has much more freedom for pulling changes. He could (for
|
||||||
|
example) issue a "bk pull" on vm-2.5 and fs-2.5 trees, to merge their
|
||||||
|
changes, but hold off net-drivers-2.5 because of a change that needs
|
||||||
|
more discussion.
|
||||||
|
|
||||||
|
Other maintainers may find that a single linus-pull-from tree is
|
||||||
|
adequate for passing BK changesets to him.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Frequently Answered Questions
|
||||||
|
-----------------------------
|
||||||
|
1) How do I change the e-mail address shown in the changelog?
|
||||||
|
A. When you run "bk citool" or "bk commit", set environment
|
||||||
|
variables BK_USER and BK_HOST to the desired username
|
||||||
|
and host/domain name.
|
||||||
|
|
||||||
|
|
||||||
|
2) How do I use tags / get a diff between two kernel versions?
|
||||||
|
A. Pass the tags Linus uses to 'bk export'.
|
||||||
|
|
||||||
|
ChangeSets are in a forward-progressing order, so it's pretty easy
|
||||||
|
to get a snapshot starting and ending at any two points in time.
|
||||||
|
Linus puts tags on each release and pre-release, so you could use
|
||||||
|
these two examples:
|
||||||
|
|
||||||
|
bk export -tpatch -hdu -rv2.5.4,v2.5.5 | less
|
||||||
|
# creates patch-2.5.5 essentially
|
||||||
|
bk export -tpatch -du -rv2.5.5-pre1,v2.5.5 | less
|
||||||
|
# changes from pre1 to final
|
||||||
|
|
||||||
|
A tag is just an alias for a specific changeset... and since changesets
|
||||||
|
are ordered, a tag is thus a marker for a specific point in time (or
|
||||||
|
specific state of the tree).
|
||||||
|
|
||||||
|
|
||||||
|
3) Is there an easy way to generate One Big Patch versus mainline,
|
||||||
|
for my long-lived kernel branch?
|
||||||
|
A. Yes. This requires BK 3.x, though.
|
||||||
|
|
||||||
|
bk export -tpatch -r`bk repogca bk://linux.bkbits.net/linux-2.5`,+
|
||||||
|
|
||||||
Executable
+34
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
# DIR=$HOME/BK/axp-2.5
|
||||||
|
# cd $DIR
|
||||||
|
|
||||||
|
LINUS_REPO=$1
|
||||||
|
DIRBASE=`basename $PWD`
|
||||||
|
|
||||||
|
{
|
||||||
|
cat <<EOT
|
||||||
|
Please do a
|
||||||
|
|
||||||
|
bk pull bk://gkernel.bkbits.net/$DIRBASE
|
||||||
|
|
||||||
|
This will update the following files:
|
||||||
|
|
||||||
|
EOT
|
||||||
|
|
||||||
|
bk export -tpatch -hdu -r`bk repogca $LINUS_REPO`,+ | diffstat -p1 2>/dev/null
|
||||||
|
|
||||||
|
cat <<EOT
|
||||||
|
|
||||||
|
through these ChangeSets:
|
||||||
|
|
||||||
|
EOT
|
||||||
|
|
||||||
|
bk changes -L -d'$unless(:MERGE:){ChangeSet|:CSETREV:\n}' $LINUS_REPO |
|
||||||
|
bk -R prs -h -d'$unless(:MERGE:){<:P:@:HOST:> (:D: :I:)\n$each(:C:){ (:C:)\n}\n}' -
|
||||||
|
|
||||||
|
} > /tmp/linus.txt
|
||||||
|
|
||||||
|
cat <<EOT
|
||||||
|
Mail text in /tmp/linus.txt; please check and send using your favourite
|
||||||
|
mailer.
|
||||||
|
EOT
|
||||||
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# A script to format BK changeset output in a manner that is easy to read.
|
||||||
|
# Andreas Dilger <adilger@turbolabs.com> 13/02/2002
|
||||||
|
#
|
||||||
|
# Add diffstat output after Changelog <adilger@turbolabs.com> 21/02/2002
|
||||||
|
|
||||||
|
PROG=bksend
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "usage: $PROG -r<rev>"
|
||||||
|
echo -e "\twhere <rev> is of the form '1.23', '1.23..', '1.23..1.27',"
|
||||||
|
echo -e "\tor '+' to indicate the most recent revision"
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
-r) REV=$2; shift ;;
|
||||||
|
-r*) REV=`echo $1 | sed 's/^-r//'` ;;
|
||||||
|
*) echo "$PROG: no revision given, you probably don't want that";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[ -z "$REV" ] && usage
|
||||||
|
|
||||||
|
echo "You can import this changeset into BK by piping this whole message to:"
|
||||||
|
echo "'| bk receive [path to repository]' or apply the patch as usual."
|
||||||
|
|
||||||
|
SEP="\n===================================================================\n\n"
|
||||||
|
echo -e $SEP
|
||||||
|
env PAGER=/bin/cat bk changes -r$REV
|
||||||
|
echo
|
||||||
|
bk export -tpatch -du -h -r$REV | diffstat
|
||||||
|
echo; echo
|
||||||
|
bk export -tpatch -du -h -r$REV
|
||||||
|
echo -e $SEP
|
||||||
|
bk send -wgzip_uu -r$REV -
|
||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# bz64wrap - the sending side of a bzip2 | base64 stream
|
||||||
|
# Andreas Dilger <adilger@clusterfs.com> Jan 2002
|
||||||
|
|
||||||
|
|
||||||
|
PATH=$PATH:/usr/bin:/usr/local/bin:/usr/freeware/bin
|
||||||
|
|
||||||
|
# A program to generate base64 encoding on stdout
|
||||||
|
BASE64_ENCODE="uuencode -m /dev/stdout"
|
||||||
|
BASE64_BEGIN=
|
||||||
|
BASE64_END=
|
||||||
|
|
||||||
|
BZIP=NO
|
||||||
|
BASE64=NO
|
||||||
|
|
||||||
|
# Test if we have the bzip program installed
|
||||||
|
bzip2 -c /dev/null > /dev/null 2>&1 && BZIP=YES
|
||||||
|
|
||||||
|
# Test if uuencode can handle the -m (MIME) encoding option
|
||||||
|
$BASE64_ENCODE < /dev/null > /dev/null 2>&1 && BASE64=YES
|
||||||
|
|
||||||
|
if [ $BASE64 = NO ]; then
|
||||||
|
BASE64_ENCODE=mimencode
|
||||||
|
BASE64_BEGIN="begin-base64 644 -"
|
||||||
|
BASE64_END="===="
|
||||||
|
|
||||||
|
$BASE64_ENCODE < /dev/null > /dev/null 2>&1 && BASE64=YES
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $BZIP = NO -o $BASE64 = NO ]; then
|
||||||
|
echo "$0: can't use bz64 encoding: bzip2=$BZIP, $BASE64_ENCODE=$BASE64"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sadly, mimencode does not appear to have good "begin" and "end" markers
|
||||||
|
# like uuencode does, and it is picky about getting the right start/end of
|
||||||
|
# the base64 stream, so we handle this internally.
|
||||||
|
echo "$BASE64_BEGIN"
|
||||||
|
bzip2 -9 | $BASE64_ENCODE
|
||||||
|
echo "$BASE64_END"
|
||||||
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Purpose: Copy changeset patch and description from one
|
||||||
|
# repository to another, unrelated one.
|
||||||
|
#
|
||||||
|
# usage: cpcset [revision] [from-repository] [to-repository]
|
||||||
|
#
|
||||||
|
|
||||||
|
REV=$1
|
||||||
|
FROM=$2
|
||||||
|
TO=$3
|
||||||
|
TMPF=/tmp/cpcset.$$
|
||||||
|
|
||||||
|
rm -f $TMPF*
|
||||||
|
|
||||||
|
CWD_SAVE=`pwd`
|
||||||
|
cd $FROM
|
||||||
|
bk changes -r$REV | \
|
||||||
|
grep -v '^ChangeSet' | \
|
||||||
|
sed -e 's/^ //g' > $TMPF.log
|
||||||
|
|
||||||
|
USERHOST=`bk changes -r$REV | grep '^ChangeSet' | awk '{print $4}'`
|
||||||
|
export BK_USER=`echo $USERHOST | awk '-F@' '{print $1}'`
|
||||||
|
export BK_HOST=`echo $USERHOST | awk '-F@' '{print $2}'`
|
||||||
|
|
||||||
|
bk export -tpatch -hdu -r$REV > $TMPF.patch && \
|
||||||
|
cd $CWD_SAVE && \
|
||||||
|
cd $TO && \
|
||||||
|
bk import -tpatch -CFR -y"`cat $TMPF.log`" $TMPF.patch . && \
|
||||||
|
bk commit -y"`cat $TMPF.log`"
|
||||||
|
|
||||||
|
rm -f $TMPF*
|
||||||
|
|
||||||
|
echo changeset $REV copied.
|
||||||
|
echo ""
|
||||||
|
|
||||||
Executable
+49
@@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
my ($lhs, $rev, $tmp, $rhs, $s);
|
||||||
|
my @cset_text = ();
|
||||||
|
my @pipe_text = ();
|
||||||
|
my $have_cset = 0;
|
||||||
|
|
||||||
|
while (<>) {
|
||||||
|
next if /^---/;
|
||||||
|
|
||||||
|
if (($lhs, $tmp, $rhs) = (/^(ChangeSet\@)([^,]+)(, .*)$/)) {
|
||||||
|
&cset_rev if ($have_cset);
|
||||||
|
|
||||||
|
$rev = $tmp;
|
||||||
|
$have_cset = 1;
|
||||||
|
|
||||||
|
push(@cset_text, $_);
|
||||||
|
}
|
||||||
|
|
||||||
|
elsif ($have_cset) {
|
||||||
|
push(@cset_text, $_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&cset_rev if ($have_cset);
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
|
||||||
|
sub cset_rev {
|
||||||
|
my $empty_cset = 0;
|
||||||
|
|
||||||
|
open PIPE, "bk export -tpatch -hdu -r $rev | diffstat -p1 2>/dev/null |" or die;
|
||||||
|
while ($s = <PIPE>) {
|
||||||
|
$empty_cset = 1 if ($s =~ /0 files changed/);
|
||||||
|
push(@pipe_text, $s);
|
||||||
|
}
|
||||||
|
close(PIPE);
|
||||||
|
|
||||||
|
if (! $empty_cset) {
|
||||||
|
print @cset_text;
|
||||||
|
print @pipe_text;
|
||||||
|
print "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@pipe_text = ();
|
||||||
|
@cset_text = ();
|
||||||
|
}
|
||||||
|
|
||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
my ($lhs, $rev, $tmp, $rhs, $s);
|
||||||
|
my @cset_text = ();
|
||||||
|
my @pipe_text = ();
|
||||||
|
my $have_cset = 0;
|
||||||
|
|
||||||
|
while (<>) {
|
||||||
|
next if /^---/;
|
||||||
|
|
||||||
|
if (($lhs, $tmp, $rhs) = (/^(ChangeSet\@)([^,]+)(, .*)$/)) {
|
||||||
|
&cset_rev if ($have_cset);
|
||||||
|
|
||||||
|
$rev = $tmp;
|
||||||
|
$have_cset = 1;
|
||||||
|
|
||||||
|
push(@cset_text, $_);
|
||||||
|
}
|
||||||
|
|
||||||
|
elsif ($have_cset) {
|
||||||
|
push(@cset_text, $_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&cset_rev if ($have_cset);
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
|
||||||
|
sub cset_rev {
|
||||||
|
my $empty_cset = 0;
|
||||||
|
|
||||||
|
system("bk export -tpatch -du -r $rev > /tmp/rev-$rev.patch");
|
||||||
|
|
||||||
|
if (! $empty_cset) {
|
||||||
|
print @cset_text;
|
||||||
|
print @pipe_text;
|
||||||
|
print "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@pipe_text = ();
|
||||||
|
@cset_text = ();
|
||||||
|
}
|
||||||
|
|
||||||
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Purpose: Generate GNU diff of local changes versus canonical top-of-tree
|
||||||
|
#
|
||||||
|
# Usage: gcapatch > foo.patch
|
||||||
|
#
|
||||||
|
|
||||||
|
bk export -tpatch -hdu -r`bk repogca bk://linux.bkbits.net/linux-2.5`,+
|
||||||
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# unbz64wrap - the receiving side of a bzip2 | base64 stream
|
||||||
|
# Andreas Dilger <adilger@clusterfs.com> Jan 2002
|
||||||
|
|
||||||
|
# Sadly, mimencode does not appear to have good "begin" and "end" markers
|
||||||
|
# like uuencode does, and it is picky about getting the right start/end of
|
||||||
|
# the base64 stream, so we handle this explicitly here.
|
||||||
|
|
||||||
|
PATH=$PATH:/usr/bin:/usr/local/bin:/usr/freeware/bin
|
||||||
|
|
||||||
|
if mimencode -u < /dev/null > /dev/null 2>&1 ; then
|
||||||
|
SHOW=
|
||||||
|
while read LINE; do
|
||||||
|
case $LINE in
|
||||||
|
begin-base64*) SHOW=YES ;;
|
||||||
|
====) SHOW= ;;
|
||||||
|
*) [ "$SHOW" ] && echo "$LINE" ;;
|
||||||
|
esac
|
||||||
|
done | mimencode -u | bunzip2
|
||||||
|
exit $?
|
||||||
|
else
|
||||||
|
cat - | uudecode -o /dev/stdout | bunzip2
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
[Sat Mar 2 10:32:33 PST 1996 KERNEL_BUG-HOWTO lm@sgi.com (Larry McVoy)]
|
||||||
|
|
||||||
|
This is how to track down a bug if you know nothing about kernel hacking.
|
||||||
|
It's a brute force approach but it works pretty well.
|
||||||
|
|
||||||
|
You need:
|
||||||
|
|
||||||
|
. A reproducible bug - it has to happen predictably (sorry)
|
||||||
|
. All the kernel tar files from a revision that worked to the
|
||||||
|
revision that doesn't
|
||||||
|
|
||||||
|
You will then do:
|
||||||
|
|
||||||
|
. Rebuild a revision that you believe works, install, and verify that.
|
||||||
|
. Do a binary search over the kernels to figure out which one
|
||||||
|
introduced the bug. I.e., suppose 1.3.28 didn't have the bug, but
|
||||||
|
you know that 1.3.69 does. Pick a kernel in the middle and build
|
||||||
|
that, like 1.3.50. Build & test; if it works, pick the mid point
|
||||||
|
between .50 and .69, else the mid point between .28 and .50.
|
||||||
|
. You'll narrow it down to the kernel that introduced the bug. You
|
||||||
|
can probably do better than this but it gets tricky.
|
||||||
|
|
||||||
|
. Narrow it down to a subdirectory
|
||||||
|
|
||||||
|
- Copy kernel that works into "test". Let's say that 3.62 works,
|
||||||
|
but 3.63 doesn't. So you diff -r those two kernels and come
|
||||||
|
up with a list of directories that changed. For each of those
|
||||||
|
directories:
|
||||||
|
|
||||||
|
Copy the non-working directory next to the working directory
|
||||||
|
as "dir.63".
|
||||||
|
One directory at time, try moving the working directory to
|
||||||
|
"dir.62" and mv dir.63 dir"time, try
|
||||||
|
|
||||||
|
mv dir dir.62
|
||||||
|
mv dir.63 dir
|
||||||
|
find dir -name '*.[oa]' -print | xargs rm -f
|
||||||
|
|
||||||
|
And then rebuild and retest. Assuming that all related
|
||||||
|
changes were contained in the sub directory, this should
|
||||||
|
isolate the change to a directory.
|
||||||
|
|
||||||
|
Problems: changes in header files may have occurred; I've
|
||||||
|
found in my case that they were self explanatory - you may
|
||||||
|
or may not want to give up when that happens.
|
||||||
|
|
||||||
|
. Narrow it down to a file
|
||||||
|
|
||||||
|
- You can apply the same technique to each file in the directory,
|
||||||
|
hoping that the changes in that file are self contained.
|
||||||
|
|
||||||
|
. Narrow it down to a routine
|
||||||
|
|
||||||
|
- You can take the old file and the new file and manually create
|
||||||
|
a merged file that has
|
||||||
|
|
||||||
|
#ifdef VER62
|
||||||
|
routine()
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
routine()
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
And then walk through that file, one routine at a time and
|
||||||
|
prefix it with
|
||||||
|
|
||||||
|
#define VER62
|
||||||
|
/* both routines here */
|
||||||
|
#undef VER62
|
||||||
|
|
||||||
|
Then recompile, retest, move the ifdefs until you find the one
|
||||||
|
that makes the difference.
|
||||||
|
|
||||||
|
Finally, you take all the info that you have, kernel revisions, bug
|
||||||
|
description, the extent to which you have narrowed it down, and pass
|
||||||
|
that off to whomever you believe is the maintainer of that section.
|
||||||
|
A post to linux.dev.kernel isn't such a bad idea if you've done some
|
||||||
|
work to narrow it down.
|
||||||
|
|
||||||
|
If you get it down to a routine, you'll probably get a fix in 24 hours.
|
||||||
|
|
||||||
|
My apologies to Linus and the other kernel hackers for describing this
|
||||||
|
brute force approach, it's hardly what a kernel hacker would do. However,
|
||||||
|
it does work and it lets non-hackers help fix bugs. And it is cool
|
||||||
|
because Linux snapshots will let you do this - something that you can't
|
||||||
|
do with vendor supplied releases.
|
||||||
|
|
||||||
@@ -0,0 +1,410 @@
|
|||||||
|
Intro
|
||||||
|
=====
|
||||||
|
|
||||||
|
This document is designed to provide a list of the minimum levels of
|
||||||
|
software necessary to run the 2.6 kernels, as well as provide brief
|
||||||
|
instructions regarding any other "Gotchas" users may encounter when
|
||||||
|
trying life on the Bleeding Edge. If upgrading from a pre-2.4.x
|
||||||
|
kernel, please consult the Changes file included with 2.4.x kernels for
|
||||||
|
additional information; most of that information will not be repeated
|
||||||
|
here. Basically, this document assumes that your system is already
|
||||||
|
functional and running at least 2.4.x kernels.
|
||||||
|
|
||||||
|
This document is originally based on my "Changes" file for 2.0.x kernels
|
||||||
|
and therefore owes credit to the same people as that file (Jared Mauch,
|
||||||
|
Axel Boldt, Alessandro Sigala, and countless other users all over the
|
||||||
|
'net).
|
||||||
|
|
||||||
|
The latest revision of this document, in various formats, can always
|
||||||
|
be found at <http://cyberbuzz.gatech.edu/kaboom/linux/Changes-2.4/>.
|
||||||
|
|
||||||
|
Feel free to translate this document. If you do so, please send me a
|
||||||
|
URL to your translation for inclusion in future revisions of this
|
||||||
|
document.
|
||||||
|
|
||||||
|
Smotrite file <http://oblom.rnc.ru/linux/kernel/Changes.ru>, yavlyaushisya
|
||||||
|
russkim perevodom dannogo documenta.
|
||||||
|
|
||||||
|
Visite <http://www2.adi.uam.es/~ender/tecnico/> para obtener la traducción
|
||||||
|
al español de este documento en varios formatos.
|
||||||
|
|
||||||
|
Eine deutsche Version dieser Datei finden Sie unter
|
||||||
|
<http://www.stefan-winter.de/Changes-2.4.0.txt>.
|
||||||
|
|
||||||
|
Last updated: October 29th, 2002
|
||||||
|
|
||||||
|
Chris Ricker (kaboom@gatech.edu or chris.ricker@genetics.utah.edu).
|
||||||
|
|
||||||
|
Current Minimal Requirements
|
||||||
|
============================
|
||||||
|
|
||||||
|
Upgrade to at *least* these software revisions before thinking you've
|
||||||
|
encountered a bug! If you're unsure what version you're currently
|
||||||
|
running, the suggested command should tell you.
|
||||||
|
|
||||||
|
Again, keep in mind that this list assumes you are already
|
||||||
|
functionally running a Linux 2.4 kernel. Also, not all tools are
|
||||||
|
necessary on all systems; obviously, if you don't have any PCMCIA (PC
|
||||||
|
Card) hardware, for example, you probably needn't concern yourself
|
||||||
|
with pcmcia-cs.
|
||||||
|
|
||||||
|
o Gnu C 2.95.3 # gcc --version
|
||||||
|
o Gnu make 3.79.1 # make --version
|
||||||
|
o binutils 2.12 # ld -v
|
||||||
|
o util-linux 2.10o # fdformat --version
|
||||||
|
o module-init-tools 0.9.10 # depmod -V
|
||||||
|
o e2fsprogs 1.29 # tune2fs
|
||||||
|
o jfsutils 1.1.3 # fsck.jfs -V
|
||||||
|
o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs
|
||||||
|
o xfsprogs 2.6.0 # xfs_db -V
|
||||||
|
o pcmcia-cs 3.1.21 # cardmgr -V
|
||||||
|
o quota-tools 3.09 # quota -V
|
||||||
|
o PPP 2.4.0 # pppd --version
|
||||||
|
o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version
|
||||||
|
o nfs-utils 1.0.5 # showmount --version
|
||||||
|
o procps 3.2.0 # ps --version
|
||||||
|
o oprofile 0.5.3 # oprofiled --version
|
||||||
|
|
||||||
|
Kernel compilation
|
||||||
|
==================
|
||||||
|
|
||||||
|
GCC
|
||||||
|
---
|
||||||
|
|
||||||
|
The gcc version requirements may vary depending on the type of CPU in your
|
||||||
|
computer. The next paragraph applies to users of x86 CPUs, but not
|
||||||
|
necessarily to users of other CPUs. Users of other CPUs should obtain
|
||||||
|
information about their gcc version requirements from another source.
|
||||||
|
|
||||||
|
The recommended compiler for the kernel is gcc 2.95.x (x >= 3), and it
|
||||||
|
should be used when you need absolute stability. You may use gcc 3.0.x
|
||||||
|
instead if you wish, although it may cause problems. Later versions of gcc
|
||||||
|
have not received much testing for Linux kernel compilation, and there are
|
||||||
|
almost certainly bugs (mainly, but not exclusively, in the kernel) that
|
||||||
|
will need to be fixed in order to use these compilers. In any case, using
|
||||||
|
pgcc instead of plain gcc is just asking for trouble.
|
||||||
|
|
||||||
|
The Red Hat gcc 2.96 compiler subtree can also be used to build this tree.
|
||||||
|
You should ensure you use gcc-2.96-74 or later. gcc-2.96-54 will not build
|
||||||
|
the kernel correctly.
|
||||||
|
|
||||||
|
In addition, please pay attention to compiler optimization. Anything
|
||||||
|
greater than -O2 may not be wise. Similarly, if you choose to use gcc-2.95.x
|
||||||
|
or derivatives, be sure not to use -fstrict-aliasing (which, depending on
|
||||||
|
your version of gcc 2.95.x, may necessitate using -fno-strict-aliasing).
|
||||||
|
|
||||||
|
Make
|
||||||
|
----
|
||||||
|
|
||||||
|
You will need Gnu make 3.79.1 or later to build the kernel.
|
||||||
|
|
||||||
|
Binutils
|
||||||
|
--------
|
||||||
|
|
||||||
|
Linux on IA-32 has recently switched from using as86 to using gas for
|
||||||
|
assembling the 16-bit boot code, removing the need for as86 to compile
|
||||||
|
your kernel. This change does, however, mean that you need a recent
|
||||||
|
release of binutils.
|
||||||
|
|
||||||
|
System utilities
|
||||||
|
================
|
||||||
|
|
||||||
|
Architectural changes
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
DevFS has been obsoleted in favour of udev
|
||||||
|
(http://www.kernel.org/pub/linux/utils/kernel/hotplug/)
|
||||||
|
|
||||||
|
32-bit UID support is now in place. Have fun!
|
||||||
|
|
||||||
|
Linux documentation for functions is transitioning to inline
|
||||||
|
documentation via specially-formatted comments near their
|
||||||
|
definitions in the source. These comments can be combined with the
|
||||||
|
SGML templates in the Documentation/DocBook directory to make DocBook
|
||||||
|
files, which can then be converted by DocBook stylesheets to PostScript,
|
||||||
|
HTML, PDF files, and several other formats. In order to convert from
|
||||||
|
DocBook format to a format of your choice, you'll need to install Jade as
|
||||||
|
well as the desired DocBook stylesheets.
|
||||||
|
|
||||||
|
Util-linux
|
||||||
|
----------
|
||||||
|
|
||||||
|
New versions of util-linux provide *fdisk support for larger disks,
|
||||||
|
support new options to mount, recognize more supported partition
|
||||||
|
types, have a fdformat which works with 2.4 kernels, and similar goodies.
|
||||||
|
You'll probably want to upgrade.
|
||||||
|
|
||||||
|
Ksymoops
|
||||||
|
--------
|
||||||
|
|
||||||
|
If the unthinkable happens and your kernel oopses, you'll need a 2.4
|
||||||
|
version of ksymoops to decode the report; see REPORTING-BUGS in the
|
||||||
|
root of the Linux source for more information.
|
||||||
|
|
||||||
|
Module-Init-Tools
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
A new module loader is now in the kernel that requires module-init-tools
|
||||||
|
to use. It is backward compatible with the 2.4.x series kernels.
|
||||||
|
|
||||||
|
Mkinitrd
|
||||||
|
--------
|
||||||
|
|
||||||
|
These changes to the /lib/modules file tree layout also require that
|
||||||
|
mkinitrd be upgraded.
|
||||||
|
|
||||||
|
E2fsprogs
|
||||||
|
---------
|
||||||
|
|
||||||
|
The latest version of e2fsprogs fixes several bugs in fsck and
|
||||||
|
debugfs. Obviously, it's a good idea to upgrade.
|
||||||
|
|
||||||
|
JFSutils
|
||||||
|
--------
|
||||||
|
|
||||||
|
The jfsutils package contains the utilities for the file system.
|
||||||
|
The following utilities are available:
|
||||||
|
o fsck.jfs - initiate replay of the transaction log, and check
|
||||||
|
and repair a JFS formatted partition.
|
||||||
|
o mkfs.jfs - create a JFS formatted partition.
|
||||||
|
o other file system utilities are also available in this package.
|
||||||
|
|
||||||
|
Reiserfsprogs
|
||||||
|
-------------
|
||||||
|
|
||||||
|
The reiserfsprogs package should be used for reiserfs-3.6.x
|
||||||
|
(Linux kernels 2.4.x). It is a combined package and contains working
|
||||||
|
versions of mkreiserfs, resize_reiserfs, debugreiserfs and
|
||||||
|
reiserfsck. These utils work on both i386 and alpha platforms.
|
||||||
|
|
||||||
|
Xfsprogs
|
||||||
|
--------
|
||||||
|
|
||||||
|
The latest version of xfsprogs contains mkfs.xfs, xfs_db, and the
|
||||||
|
xfs_repair utilities, among others, for the XFS filesystem. It is
|
||||||
|
architecture independent and any version from 2.0.0 onward should
|
||||||
|
work correctly with this version of the XFS kernel code (2.6.0 or
|
||||||
|
later is recommended, due to some significant improvements).
|
||||||
|
|
||||||
|
|
||||||
|
Pcmcia-cs
|
||||||
|
---------
|
||||||
|
|
||||||
|
PCMCIA (PC Card) support is now partially implemented in the main
|
||||||
|
kernel source. Pay attention when you recompile your kernel ;-).
|
||||||
|
Also, be sure to upgrade to the latest pcmcia-cs release.
|
||||||
|
|
||||||
|
Quota-tools
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Support for 32 bit uid's and gid's is required if you want to use
|
||||||
|
the newer version 2 quota format. Quota-tools version 3.07 and
|
||||||
|
newer has this support. Use the recommended version or newer
|
||||||
|
from the table above.
|
||||||
|
|
||||||
|
Intel IA32 microcode
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
A driver has been added to allow updating of Intel IA32 microcode,
|
||||||
|
accessible as both a devfs regular file and as a normal (misc)
|
||||||
|
character device. If you are not using devfs you may need to:
|
||||||
|
|
||||||
|
mkdir /dev/cpu
|
||||||
|
mknod /dev/cpu/microcode c 10 184
|
||||||
|
chmod 0644 /dev/cpu/microcode
|
||||||
|
|
||||||
|
as root before you can use this. You'll probably also want to
|
||||||
|
get the user-space microcode_ctl utility to use with this.
|
||||||
|
|
||||||
|
Powertweak
|
||||||
|
----------
|
||||||
|
|
||||||
|
If you are running v0.1.17 or earlier, you should upgrade to
|
||||||
|
version v0.99.0 or higher. Running old versions may cause problems
|
||||||
|
with programs using shared memory.
|
||||||
|
|
||||||
|
udev
|
||||||
|
----
|
||||||
|
udev is a userspace application for populating /dev dynamically with
|
||||||
|
only entries for devices actually present. udev replaces devfs.
|
||||||
|
|
||||||
|
Networking
|
||||||
|
==========
|
||||||
|
|
||||||
|
General changes
|
||||||
|
---------------
|
||||||
|
|
||||||
|
If you have advanced network configuration needs, you should probably
|
||||||
|
consider using the network tools from ip-route2.
|
||||||
|
|
||||||
|
Packet Filter / NAT
|
||||||
|
-------------------
|
||||||
|
The packet filtering and NAT code uses the same tools like the previous 2.4.x
|
||||||
|
kernel series (iptables). It still includes backwards-compatibility modules
|
||||||
|
for 2.2.x-style ipchains and 2.0.x-style ipfwadm.
|
||||||
|
|
||||||
|
PPP
|
||||||
|
---
|
||||||
|
|
||||||
|
The PPP driver has been restructured to support multilink and to
|
||||||
|
enable it to operate over diverse media layers. If you use PPP,
|
||||||
|
upgrade pppd to at least 2.4.0.
|
||||||
|
|
||||||
|
If you are not using devfs, you must have the device file /dev/ppp
|
||||||
|
which can be made by:
|
||||||
|
|
||||||
|
mknod /dev/ppp c 108 0
|
||||||
|
|
||||||
|
as root.
|
||||||
|
|
||||||
|
If you use devfsd and build ppp support as modules, you will need
|
||||||
|
the following in your /etc/devfsd.conf file:
|
||||||
|
|
||||||
|
LOOKUP PPP MODLOAD
|
||||||
|
|
||||||
|
Isdn4k-utils
|
||||||
|
------------
|
||||||
|
|
||||||
|
Due to changes in the length of the phone number field, isdn4k-utils
|
||||||
|
needs to be recompiled or (preferably) upgraded.
|
||||||
|
|
||||||
|
NFS-utils
|
||||||
|
---------
|
||||||
|
|
||||||
|
In 2.4 and earlier kernels, the nfs server needed to know about any
|
||||||
|
client that expected to be able to access files via NFS. This
|
||||||
|
information would be given to the kernel by "mountd" when the client
|
||||||
|
mounted the filesystem, or by "exportfs" at system startup. exportfs
|
||||||
|
would take information about active clients from /var/lib/nfs/rmtab.
|
||||||
|
|
||||||
|
This approach is quite fragile as it depends on rmtab being correct
|
||||||
|
which is not always easy, particularly when trying to implement
|
||||||
|
fail-over. Even when the system is working well, rmtab suffers from
|
||||||
|
getting lots of old entries that never get removed.
|
||||||
|
|
||||||
|
With 2.6 we have the option of having the kernel tell mountd when it
|
||||||
|
gets a request from an unknown host, and mountd can give appropriate
|
||||||
|
export information to the kernel. This removes the dependency on
|
||||||
|
rmtab and means that the kernel only needs to know about currently
|
||||||
|
active clients.
|
||||||
|
|
||||||
|
To enable this new functionality, you need to:
|
||||||
|
|
||||||
|
mount -t nfsd nfsd /proc/fs/nfs
|
||||||
|
|
||||||
|
before running exportfs or mountd. It is recommended that all NFS
|
||||||
|
services be protected from the internet-at-large by a firewall where
|
||||||
|
that is possible.
|
||||||
|
|
||||||
|
Getting updated software
|
||||||
|
========================
|
||||||
|
|
||||||
|
Kernel compilation
|
||||||
|
******************
|
||||||
|
|
||||||
|
gcc 2.95.3
|
||||||
|
----------
|
||||||
|
o <ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3.tar.gz>
|
||||||
|
|
||||||
|
Make
|
||||||
|
----
|
||||||
|
o <ftp://ftp.gnu.org/gnu/make/>
|
||||||
|
|
||||||
|
Binutils
|
||||||
|
--------
|
||||||
|
o <ftp://ftp.kernel.org/pub/linux/devel/binutils/>
|
||||||
|
|
||||||
|
System utilities
|
||||||
|
****************
|
||||||
|
|
||||||
|
Util-linux
|
||||||
|
----------
|
||||||
|
o <ftp://ftp.kernel.org/pub/linux/utils/util-linux/>
|
||||||
|
|
||||||
|
Ksymoops
|
||||||
|
--------
|
||||||
|
o <ftp://ftp.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/>
|
||||||
|
|
||||||
|
Module-Init-Tools
|
||||||
|
-----------------
|
||||||
|
o <ftp://ftp.kernel.org/pub/linux/kernel/people/rusty/modules/>
|
||||||
|
|
||||||
|
Mkinitrd
|
||||||
|
--------
|
||||||
|
o <ftp://rawhide.redhat.com/pub/rawhide/SRPMS/SRPMS/>
|
||||||
|
|
||||||
|
E2fsprogs
|
||||||
|
---------
|
||||||
|
o <http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.29.tar.gz>
|
||||||
|
|
||||||
|
JFSutils
|
||||||
|
--------
|
||||||
|
o <http://jfs.sourceforge.net/>
|
||||||
|
|
||||||
|
Reiserfsprogs
|
||||||
|
-------------
|
||||||
|
o <http://www.namesys.com/pub/reiserfsprogs/reiserfsprogs-3.6.3.tar.gz>
|
||||||
|
|
||||||
|
Xfsprogs
|
||||||
|
--------
|
||||||
|
o <ftp://oss.sgi.com/projects/xfs/download/>
|
||||||
|
|
||||||
|
Pcmcia-cs
|
||||||
|
---------
|
||||||
|
o <ftp://pcmcia-cs.sourceforge.net/pub/pcmcia-cs/pcmcia-cs-3.1.21.tar.gz>
|
||||||
|
|
||||||
|
Quota-tools
|
||||||
|
----------
|
||||||
|
o <http://sourceforge.net/projects/linuxquota/>
|
||||||
|
|
||||||
|
Jade
|
||||||
|
----
|
||||||
|
o <ftp://ftp.jclark.com/pub/jade/jade-1.2.1.tar.gz>
|
||||||
|
|
||||||
|
DocBook Stylesheets
|
||||||
|
-------------------
|
||||||
|
o <http://nwalsh.com/docbook/dsssl/>
|
||||||
|
|
||||||
|
Intel P6 microcode
|
||||||
|
------------------
|
||||||
|
o <http://www.urbanmyth.org/microcode/>
|
||||||
|
|
||||||
|
Powertweak
|
||||||
|
----------
|
||||||
|
o <http://powertweak.sourceforge.net/>
|
||||||
|
|
||||||
|
udev
|
||||||
|
----
|
||||||
|
o <http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html>
|
||||||
|
|
||||||
|
Networking
|
||||||
|
**********
|
||||||
|
|
||||||
|
PPP
|
||||||
|
---
|
||||||
|
o <ftp://ftp.samba.org/pub/ppp/ppp-2.4.0.tar.gz>
|
||||||
|
|
||||||
|
Isdn4k-utils
|
||||||
|
------------
|
||||||
|
o <ftp://ftp.isdn4linux.de/pub/isdn4linux/utils/isdn4k-utils.v3.1pre1.tar.gz>
|
||||||
|
|
||||||
|
NFS-utils
|
||||||
|
---------
|
||||||
|
o <http://sourceforge.net/project/showfiles.php?group_id=14>
|
||||||
|
|
||||||
|
Iptables
|
||||||
|
--------
|
||||||
|
o <http://www.iptables.org/downloads.html>
|
||||||
|
|
||||||
|
Ip-route2
|
||||||
|
---------
|
||||||
|
o <ftp://ftp.tux.org/pub/net/ip-routing/iproute2-2.2.4-now-ss991023.tar.gz>
|
||||||
|
|
||||||
|
OProfile
|
||||||
|
--------
|
||||||
|
o <http://oprofile.sf.net/download/>
|
||||||
|
|
||||||
|
NFS-Utils
|
||||||
|
---------
|
||||||
|
o <http://nfs.sourceforge.net/>
|
||||||
|
|
||||||
@@ -0,0 +1,431 @@
|
|||||||
|
|
||||||
|
Linux kernel coding style
|
||||||
|
|
||||||
|
This is a short document describing the preferred coding style for the
|
||||||
|
linux kernel. Coding style is very personal, and I won't _force_ my
|
||||||
|
views on anybody, but this is what goes for anything that I have to be
|
||||||
|
able to maintain, and I'd prefer it for most other things too. Please
|
||||||
|
at least consider the points made here.
|
||||||
|
|
||||||
|
First off, I'd suggest printing out a copy of the GNU coding standards,
|
||||||
|
and NOT read it. Burn them, it's a great symbolic gesture.
|
||||||
|
|
||||||
|
Anyway, here goes:
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 1: Indentation
|
||||||
|
|
||||||
|
Tabs are 8 characters, and thus indentations are also 8 characters.
|
||||||
|
There are heretic movements that try to make indentations 4 (or even 2!)
|
||||||
|
characters deep, and that is akin to trying to define the value of PI to
|
||||||
|
be 3.
|
||||||
|
|
||||||
|
Rationale: The whole idea behind indentation is to clearly define where
|
||||||
|
a block of control starts and ends. Especially when you've been looking
|
||||||
|
at your screen for 20 straight hours, you'll find it a lot easier to see
|
||||||
|
how the indentation works if you have large indentations.
|
||||||
|
|
||||||
|
Now, some people will claim that having 8-character indentations makes
|
||||||
|
the code move too far to the right, and makes it hard to read on a
|
||||||
|
80-character terminal screen. The answer to that is that if you need
|
||||||
|
more than 3 levels of indentation, you're screwed anyway, and should fix
|
||||||
|
your program.
|
||||||
|
|
||||||
|
In short, 8-char indents make things easier to read, and have the added
|
||||||
|
benefit of warning you when you're nesting your functions too deep.
|
||||||
|
Heed that warning.
|
||||||
|
|
||||||
|
Don't put multiple statements on a single line unless you have
|
||||||
|
something to hide:
|
||||||
|
|
||||||
|
if (condition) do_this;
|
||||||
|
do_something_everytime;
|
||||||
|
|
||||||
|
Outside of comments, documentation and except in Kconfig, spaces are never
|
||||||
|
used for indentation, and the above example is deliberately broken.
|
||||||
|
|
||||||
|
Get a decent editor and don't leave whitespace at the end of lines.
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 2: Breaking long lines and strings
|
||||||
|
|
||||||
|
Coding style is all about readability and maintainability using commonly
|
||||||
|
available tools.
|
||||||
|
|
||||||
|
The limit on the length of lines is 80 columns and this is a hard limit.
|
||||||
|
|
||||||
|
Statements longer than 80 columns will be broken into sensible chunks.
|
||||||
|
Descendants are always substantially shorter than the parent and are placed
|
||||||
|
substantially to the right. The same applies to function headers with a long
|
||||||
|
argument list. Long strings are as well broken into shorter strings.
|
||||||
|
|
||||||
|
void fun(int a, int b, int c)
|
||||||
|
{
|
||||||
|
if (condition)
|
||||||
|
printk(KERN_WARNING "Warning this is a long printk with "
|
||||||
|
"3 parameters a: %u b: %u "
|
||||||
|
"c: %u \n", a, b, c);
|
||||||
|
else
|
||||||
|
next_statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
Chapter 3: Placing Braces
|
||||||
|
|
||||||
|
The other issue that always comes up in C styling is the placement of
|
||||||
|
braces. Unlike the indent size, there are few technical reasons to
|
||||||
|
choose one placement strategy over the other, but the preferred way, as
|
||||||
|
shown to us by the prophets Kernighan and Ritchie, is to put the opening
|
||||||
|
brace last on the line, and put the closing brace first, thusly:
|
||||||
|
|
||||||
|
if (x is true) {
|
||||||
|
we do y
|
||||||
|
}
|
||||||
|
|
||||||
|
However, there is one special case, namely functions: they have the
|
||||||
|
opening brace at the beginning of the next line, thus:
|
||||||
|
|
||||||
|
int function(int x)
|
||||||
|
{
|
||||||
|
body of function
|
||||||
|
}
|
||||||
|
|
||||||
|
Heretic people all over the world have claimed that this inconsistency
|
||||||
|
is ... well ... inconsistent, but all right-thinking people know that
|
||||||
|
(a) K&R are _right_ and (b) K&R are right. Besides, functions are
|
||||||
|
special anyway (you can't nest them in C).
|
||||||
|
|
||||||
|
Note that the closing brace is empty on a line of its own, _except_ in
|
||||||
|
the cases where it is followed by a continuation of the same statement,
|
||||||
|
ie a "while" in a do-statement or an "else" in an if-statement, like
|
||||||
|
this:
|
||||||
|
|
||||||
|
do {
|
||||||
|
body of do-loop
|
||||||
|
} while (condition);
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
if (x == y) {
|
||||||
|
..
|
||||||
|
} else if (x > y) {
|
||||||
|
...
|
||||||
|
} else {
|
||||||
|
....
|
||||||
|
}
|
||||||
|
|
||||||
|
Rationale: K&R.
|
||||||
|
|
||||||
|
Also, note that this brace-placement also minimizes the number of empty
|
||||||
|
(or almost empty) lines, without any loss of readability. Thus, as the
|
||||||
|
supply of new-lines on your screen is not a renewable resource (think
|
||||||
|
25-line terminal screens here), you have more empty lines to put
|
||||||
|
comments on.
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 4: Naming
|
||||||
|
|
||||||
|
C is a Spartan language, and so should your naming be. Unlike Modula-2
|
||||||
|
and Pascal programmers, C programmers do not use cute names like
|
||||||
|
ThisVariableIsATemporaryCounter. A C programmer would call that
|
||||||
|
variable "tmp", which is much easier to write, and not the least more
|
||||||
|
difficult to understand.
|
||||||
|
|
||||||
|
HOWEVER, while mixed-case names are frowned upon, descriptive names for
|
||||||
|
global variables are a must. To call a global function "foo" is a
|
||||||
|
shooting offense.
|
||||||
|
|
||||||
|
GLOBAL variables (to be used only if you _really_ need them) need to
|
||||||
|
have descriptive names, as do global functions. If you have a function
|
||||||
|
that counts the number of active users, you should call that
|
||||||
|
"count_active_users()" or similar, you should _not_ call it "cntusr()".
|
||||||
|
|
||||||
|
Encoding the type of a function into the name (so-called Hungarian
|
||||||
|
notation) is brain damaged - the compiler knows the types anyway and can
|
||||||
|
check those, and it only confuses the programmer. No wonder MicroSoft
|
||||||
|
makes buggy programs.
|
||||||
|
|
||||||
|
LOCAL variable names should be short, and to the point. If you have
|
||||||
|
some random integer loop counter, it should probably be called "i".
|
||||||
|
Calling it "loop_counter" is non-productive, if there is no chance of it
|
||||||
|
being mis-understood. Similarly, "tmp" can be just about any type of
|
||||||
|
variable that is used to hold a temporary value.
|
||||||
|
|
||||||
|
If you are afraid to mix up your local variable names, you have another
|
||||||
|
problem, which is called the function-growth-hormone-imbalance syndrome.
|
||||||
|
See next chapter.
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 5: Functions
|
||||||
|
|
||||||
|
Functions should be short and sweet, and do just one thing. They should
|
||||||
|
fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24,
|
||||||
|
as we all know), and do one thing and do that well.
|
||||||
|
|
||||||
|
The maximum length of a function is inversely proportional to the
|
||||||
|
complexity and indentation level of that function. So, if you have a
|
||||||
|
conceptually simple function that is just one long (but simple)
|
||||||
|
case-statement, where you have to do lots of small things for a lot of
|
||||||
|
different cases, it's OK to have a longer function.
|
||||||
|
|
||||||
|
However, if you have a complex function, and you suspect that a
|
||||||
|
less-than-gifted first-year high-school student might not even
|
||||||
|
understand what the function is all about, you should adhere to the
|
||||||
|
maximum limits all the more closely. Use helper functions with
|
||||||
|
descriptive names (you can ask the compiler to in-line them if you think
|
||||||
|
it's performance-critical, and it will probably do a better job of it
|
||||||
|
than you would have done).
|
||||||
|
|
||||||
|
Another measure of the function is the number of local variables. They
|
||||||
|
shouldn't exceed 5-10, or you're doing something wrong. Re-think the
|
||||||
|
function, and split it into smaller pieces. A human brain can
|
||||||
|
generally easily keep track of about 7 different things, anything more
|
||||||
|
and it gets confused. You know you're brilliant, but maybe you'd like
|
||||||
|
to understand what you did 2 weeks from now.
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 6: Centralized exiting of functions
|
||||||
|
|
||||||
|
Albeit deprecated by some people, the equivalent of the goto statement is
|
||||||
|
used frequently by compilers in form of the unconditional jump instruction.
|
||||||
|
|
||||||
|
The goto statement comes in handy when a function exits from multiple
|
||||||
|
locations and some common work such as cleanup has to be done.
|
||||||
|
|
||||||
|
The rationale is:
|
||||||
|
|
||||||
|
- unconditional statements are easier to understand and follow
|
||||||
|
- nesting is reduced
|
||||||
|
- errors by not updating individual exit points when making
|
||||||
|
modifications are prevented
|
||||||
|
- saves the compiler work to optimize redundant code away ;)
|
||||||
|
|
||||||
|
int fun(int )
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
char *buffer = kmalloc(SIZE);
|
||||||
|
|
||||||
|
if (buffer == NULL)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
if (condition1) {
|
||||||
|
while (loop1) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
result = 1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
...
|
||||||
|
out:
|
||||||
|
kfree(buffer);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Chapter 7: Commenting
|
||||||
|
|
||||||
|
Comments are good, but there is also a danger of over-commenting. NEVER
|
||||||
|
try to explain HOW your code works in a comment: it's much better to
|
||||||
|
write the code so that the _working_ is obvious, and it's a waste of
|
||||||
|
time to explain badly written code.
|
||||||
|
|
||||||
|
Generally, you want your comments to tell WHAT your code does, not HOW.
|
||||||
|
Also, try to avoid putting comments inside a function body: if the
|
||||||
|
function is so complex that you need to separately comment parts of it,
|
||||||
|
you should probably go back to chapter 5 for a while. You can make
|
||||||
|
small comments to note or warn about something particularly clever (or
|
||||||
|
ugly), but try to avoid excess. Instead, put the comments at the head
|
||||||
|
of the function, telling people what it does, and possibly WHY it does
|
||||||
|
it.
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 8: You've made a mess of it
|
||||||
|
|
||||||
|
That's OK, we all do. You've probably been told by your long-time Unix
|
||||||
|
user helper that "GNU emacs" automatically formats the C sources for
|
||||||
|
you, and you've noticed that yes, it does do that, but the defaults it
|
||||||
|
uses are less than desirable (in fact, they are worse than random
|
||||||
|
typing - an infinite number of monkeys typing into GNU emacs would never
|
||||||
|
make a good program).
|
||||||
|
|
||||||
|
So, you can either get rid of GNU emacs, or change it to use saner
|
||||||
|
values. To do the latter, you can stick the following in your .emacs file:
|
||||||
|
|
||||||
|
(defun linux-c-mode ()
|
||||||
|
"C mode with adjusted defaults for use with the Linux kernel."
|
||||||
|
(interactive)
|
||||||
|
(c-mode)
|
||||||
|
(c-set-style "K&R")
|
||||||
|
(setq tab-width 8)
|
||||||
|
(setq indent-tabs-mode t)
|
||||||
|
(setq c-basic-offset 8))
|
||||||
|
|
||||||
|
This will define the M-x linux-c-mode command. When hacking on a
|
||||||
|
module, if you put the string -*- linux-c -*- somewhere on the first
|
||||||
|
two lines, this mode will be automatically invoked. Also, you may want
|
||||||
|
to add
|
||||||
|
|
||||||
|
(setq auto-mode-alist (cons '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode)
|
||||||
|
auto-mode-alist))
|
||||||
|
|
||||||
|
to your .emacs file if you want to have linux-c-mode switched on
|
||||||
|
automagically when you edit source files under /usr/src/linux.
|
||||||
|
|
||||||
|
But even if you fail in getting emacs to do sane formatting, not
|
||||||
|
everything is lost: use "indent".
|
||||||
|
|
||||||
|
Now, again, GNU indent has the same brain-dead settings that GNU emacs
|
||||||
|
has, which is why you need to give it a few command line options.
|
||||||
|
However, that's not too bad, because even the makers of GNU indent
|
||||||
|
recognize the authority of K&R (the GNU people aren't evil, they are
|
||||||
|
just severely misguided in this matter), so you just give indent the
|
||||||
|
options "-kr -i8" (stands for "K&R, 8 character indents"), or use
|
||||||
|
"scripts/Lindent", which indents in the latest style.
|
||||||
|
|
||||||
|
"indent" has a lot of options, and especially when it comes to comment
|
||||||
|
re-formatting you may want to take a look at the man page. But
|
||||||
|
remember: "indent" is not a fix for bad programming.
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 9: Configuration-files
|
||||||
|
|
||||||
|
For configuration options (arch/xxx/Kconfig, and all the Kconfig files),
|
||||||
|
somewhat different indentation is used.
|
||||||
|
|
||||||
|
Help text is indented with 2 spaces.
|
||||||
|
|
||||||
|
if CONFIG_EXPERIMENTAL
|
||||||
|
tristate CONFIG_BOOM
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Apply nitroglycerine inside the keyboard (DANGEROUS)
|
||||||
|
bool CONFIG_CHEER
|
||||||
|
depends on CONFIG_BOOM
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Output nice messages when you explode
|
||||||
|
endif
|
||||||
|
|
||||||
|
Generally, CONFIG_EXPERIMENTAL should surround all options not considered
|
||||||
|
stable. All options that are known to trash data (experimental write-
|
||||||
|
support for file-systems, for instance) should be denoted (DANGEROUS), other
|
||||||
|
experimental options should be denoted (EXPERIMENTAL).
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 10: Data structures
|
||||||
|
|
||||||
|
Data structures that have visibility outside the single-threaded
|
||||||
|
environment they are created and destroyed in should always have
|
||||||
|
reference counts. In the kernel, garbage collection doesn't exist (and
|
||||||
|
outside the kernel garbage collection is slow and inefficient), which
|
||||||
|
means that you absolutely _have_ to reference count all your uses.
|
||||||
|
|
||||||
|
Reference counting means that you can avoid locking, and allows multiple
|
||||||
|
users to have access to the data structure in parallel - and not having
|
||||||
|
to worry about the structure suddenly going away from under them just
|
||||||
|
because they slept or did something else for a while.
|
||||||
|
|
||||||
|
Note that locking is _not_ a replacement for reference counting.
|
||||||
|
Locking is used to keep data structures coherent, while reference
|
||||||
|
counting is a memory management technique. Usually both are needed, and
|
||||||
|
they are not to be confused with each other.
|
||||||
|
|
||||||
|
Many data structures can indeed have two levels of reference counting,
|
||||||
|
when there are users of different "classes". The subclass count counts
|
||||||
|
the number of subclass users, and decrements the global count just once
|
||||||
|
when the subclass count goes to zero.
|
||||||
|
|
||||||
|
Examples of this kind of "multi-level-reference-counting" can be found in
|
||||||
|
memory management ("struct mm_struct": mm_users and mm_count), and in
|
||||||
|
filesystem code ("struct super_block": s_count and s_active).
|
||||||
|
|
||||||
|
Remember: if another thread can find your data structure, and you don't
|
||||||
|
have a reference count on it, you almost certainly have a bug.
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 11: Macros, Enums, Inline functions and RTL
|
||||||
|
|
||||||
|
Names of macros defining constants and labels in enums are capitalized.
|
||||||
|
|
||||||
|
#define CONSTANT 0x12345
|
||||||
|
|
||||||
|
Enums are preferred when defining several related constants.
|
||||||
|
|
||||||
|
CAPITALIZED macro names are appreciated but macros resembling functions
|
||||||
|
may be named in lower case.
|
||||||
|
|
||||||
|
Generally, inline functions are preferable to macros resembling functions.
|
||||||
|
|
||||||
|
Macros with multiple statements should be enclosed in a do - while block:
|
||||||
|
|
||||||
|
#define macrofun(a, b, c) \
|
||||||
|
do { \
|
||||||
|
if (a == 5) \
|
||||||
|
do_this(b, c); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
Things to avoid when using macros:
|
||||||
|
|
||||||
|
1) macros that affect control flow:
|
||||||
|
|
||||||
|
#define FOO(x) \
|
||||||
|
do { \
|
||||||
|
if (blah(x) < 0) \
|
||||||
|
return -EBUGGERED; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
is a _very_ bad idea. It looks like a function call but exits the "calling"
|
||||||
|
function; don't break the internal parsers of those who will read the code.
|
||||||
|
|
||||||
|
2) macros that depend on having a local variable with a magic name:
|
||||||
|
|
||||||
|
#define FOO(val) bar(index, val)
|
||||||
|
|
||||||
|
might look like a good thing, but it's confusing as hell when one reads the
|
||||||
|
code and it's prone to breakage from seemingly innocent changes.
|
||||||
|
|
||||||
|
3) macros with arguments that are used as l-values: FOO(x) = y; will
|
||||||
|
bite you if somebody e.g. turns FOO into an inline function.
|
||||||
|
|
||||||
|
4) forgetting about precedence: macros defining constants using expressions
|
||||||
|
must enclose the expression in parentheses. Beware of similar issues with
|
||||||
|
macros using parameters.
|
||||||
|
|
||||||
|
#define CONSTANT 0x4000
|
||||||
|
#define CONSTEXP (CONSTANT | 3)
|
||||||
|
|
||||||
|
The cpp manual deals with macros exhaustively. The gcc internals manual also
|
||||||
|
covers RTL which is used frequently with assembly language in the kernel.
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 12: Printing kernel messages
|
||||||
|
|
||||||
|
Kernel developers like to be seen as literate. Do mind the spelling
|
||||||
|
of kernel messages to make a good impression. Do not use crippled
|
||||||
|
words like "dont" and use "do not" or "don't" instead.
|
||||||
|
|
||||||
|
Kernel messages do not have to be terminated with a period.
|
||||||
|
|
||||||
|
Printing numbers in parentheses (%d) adds no value and should be avoided.
|
||||||
|
|
||||||
|
|
||||||
|
Chapter 13: References
|
||||||
|
|
||||||
|
The C Programming Language, Second Edition
|
||||||
|
by Brian W. Kernighan and Dennis M. Ritchie.
|
||||||
|
Prentice Hall, Inc., 1988.
|
||||||
|
ISBN 0-13-110362-8 (paperback), 0-13-110370-9 (hardback).
|
||||||
|
URL: http://cm.bell-labs.com/cm/cs/cbook/
|
||||||
|
|
||||||
|
The Practice of Programming
|
||||||
|
by Brian W. Kernighan and Rob Pike.
|
||||||
|
Addison-Wesley, Inc., 1999.
|
||||||
|
ISBN 0-201-61586-X.
|
||||||
|
URL: http://cm.bell-labs.com/cm/cs/tpop/
|
||||||
|
|
||||||
|
GNU manuals - where in compliance with K&R and this text - for cpp, gcc,
|
||||||
|
gcc internals and indent, all available from http://www.gnu.org
|
||||||
|
|
||||||
|
WG14 is the international standardization working group for the programming
|
||||||
|
language C, URL: http://std.dkuug.dk/JTC1/SC22/WG14/
|
||||||
|
|
||||||
|
--
|
||||||
|
Last updated on 16 February 2004 by a community effort on LKML.
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,195 @@
|
|||||||
|
###
|
||||||
|
# This makefile is used to generate the kernel documentation,
|
||||||
|
# primarily based on in-line comments in various source files.
|
||||||
|
# See Documentation/kernel-doc-nano-HOWTO.txt for instruction in how
|
||||||
|
# to ducument the SRC - and how to read it.
|
||||||
|
# To add a new book the only step required is to add the book to the
|
||||||
|
# list of DOCBOOKS.
|
||||||
|
|
||||||
|
DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
|
||||||
|
kernel-hacking.xml kernel-locking.xml via-audio.xml \
|
||||||
|
deviceiobook.xml procfs-guide.xml tulip-user.xml \
|
||||||
|
writing_usb_driver.xml scsidrivers.xml sis900.xml \
|
||||||
|
kernel-api.xml journal-api.xml lsm.xml usb.xml \
|
||||||
|
gadget.xml libata.xml mtdnand.xml librs.xml
|
||||||
|
|
||||||
|
###
|
||||||
|
# The build process is as follows (targets):
|
||||||
|
# (xmldocs)
|
||||||
|
# file.tmpl --> file.xml +--> file.ps (psdocs)
|
||||||
|
# +--> file.pdf (pdfdocs)
|
||||||
|
# +--> DIR=file (htmldocs)
|
||||||
|
# +--> man/ (mandocs)
|
||||||
|
|
||||||
|
###
|
||||||
|
# The targets that may be used.
|
||||||
|
.PHONY: xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs
|
||||||
|
|
||||||
|
BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
|
||||||
|
xmldocs: $(BOOKS)
|
||||||
|
sgmldocs: xmldocs
|
||||||
|
|
||||||
|
PS := $(patsubst %.xml, %.ps, $(BOOKS))
|
||||||
|
psdocs: $(PS)
|
||||||
|
|
||||||
|
PDF := $(patsubst %.xml, %.pdf, $(BOOKS))
|
||||||
|
pdfdocs: $(PDF)
|
||||||
|
|
||||||
|
HTML := $(patsubst %.xml, %.html, $(BOOKS))
|
||||||
|
htmldocs: $(HTML)
|
||||||
|
|
||||||
|
MAN := $(patsubst %.xml, %.9, $(BOOKS))
|
||||||
|
mandocs: $(MAN)
|
||||||
|
|
||||||
|
installmandocs: mandocs
|
||||||
|
$(MAKEMAN) install Documentation/DocBook/man
|
||||||
|
|
||||||
|
###
|
||||||
|
#External programs used
|
||||||
|
KERNELDOC = scripts/kernel-doc
|
||||||
|
DOCPROC = scripts/basic/docproc
|
||||||
|
SPLITMAN = $(PERL) $(srctree)/scripts/split-man
|
||||||
|
MAKEMAN = $(PERL) $(srctree)/scripts/makeman
|
||||||
|
|
||||||
|
###
|
||||||
|
# DOCPROC is used for two purposes:
|
||||||
|
# 1) To generate a dependency list for a .tmpl file
|
||||||
|
# 2) To preprocess a .tmpl file and call kernel-doc with
|
||||||
|
# appropriate parameters.
|
||||||
|
# The following rules are used to generate the .xml documentation
|
||||||
|
# required to generate the final targets. (ps, pdf, html).
|
||||||
|
quiet_cmd_docproc = DOCPROC $@
|
||||||
|
cmd_docproc = SRCTREE=$(srctree)/ $(DOCPROC) doc $< >$@
|
||||||
|
define rule_docproc
|
||||||
|
set -e; \
|
||||||
|
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
|
||||||
|
$(cmd_$(1)); \
|
||||||
|
( \
|
||||||
|
echo 'cmd_$@ := $(cmd_$(1))'; \
|
||||||
|
echo $@: `SRCTREE=$(srctree) $(DOCPROC) depend $<`; \
|
||||||
|
) > $(dir $@).$(notdir $@).cmd
|
||||||
|
endef
|
||||||
|
|
||||||
|
%.xml: %.tmpl FORCE
|
||||||
|
$(call if_changed_rule,docproc)
|
||||||
|
|
||||||
|
###
|
||||||
|
#Read in all saved dependency files
|
||||||
|
cmd_files := $(wildcard $(foreach f,$(BOOKS),$(dir $(f)).$(notdir $(f)).cmd))
|
||||||
|
|
||||||
|
ifneq ($(cmd_files),)
|
||||||
|
include $(cmd_files)
|
||||||
|
endif
|
||||||
|
|
||||||
|
###
|
||||||
|
# Changes in kernel-doc force a rebuild of all documentation
|
||||||
|
$(BOOKS): $(KERNELDOC)
|
||||||
|
|
||||||
|
###
|
||||||
|
# procfs guide uses a .c file as example code.
|
||||||
|
# This requires an explicit dependency
|
||||||
|
C-procfs-example = procfs_example.xml
|
||||||
|
C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example))
|
||||||
|
$(obj)/procfs-guide.xml: $(C-procfs-example2)
|
||||||
|
|
||||||
|
###
|
||||||
|
# Rules to generate postscript, PDF and HTML
|
||||||
|
# db2html creates a directory. Generate a html file used for timestamp
|
||||||
|
|
||||||
|
quiet_cmd_db2ps = DB2PS $@
|
||||||
|
cmd_db2ps = db2ps -o $(dir $@) $<
|
||||||
|
%.ps : %.xml
|
||||||
|
@(which db2ps > /dev/null 2>&1) || \
|
||||||
|
(echo "*** You need to install DocBook stylesheets ***"; \
|
||||||
|
exit 1)
|
||||||
|
$(call cmd,db2ps)
|
||||||
|
|
||||||
|
quiet_cmd_db2pdf = DB2PDF $@
|
||||||
|
cmd_db2pdf = db2pdf -o $(dir $@) $<
|
||||||
|
%.pdf : %.xml
|
||||||
|
@(which db2pdf > /dev/null 2>&1) || \
|
||||||
|
(echo "*** You need to install DocBook stylesheets ***"; \
|
||||||
|
exit 1)
|
||||||
|
$(call cmd,db2pdf)
|
||||||
|
|
||||||
|
quiet_cmd_db2html = DB2HTML $@
|
||||||
|
cmd_db2html = db2html -o $(patsubst %.html,%,$@) $< && \
|
||||||
|
echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/book1.html"> \
|
||||||
|
Goto $(patsubst %.html,%,$(notdir $@))</a><p>' > $@
|
||||||
|
|
||||||
|
%.html: %.xml
|
||||||
|
@(which db2html > /dev/null 2>&1) || \
|
||||||
|
(echo "*** You need to install DocBook stylesheets ***"; \
|
||||||
|
exit 1)
|
||||||
|
@rm -rf $@ $(patsubst %.html,%,$@)
|
||||||
|
$(call cmd,db2html)
|
||||||
|
@if [ ! -z "$(PNG-$(basename $(notdir $@)))" ]; then \
|
||||||
|
cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi
|
||||||
|
|
||||||
|
###
|
||||||
|
# Rule to generate man files - output is placed in the man subdirectory
|
||||||
|
|
||||||
|
%.9: %.xml
|
||||||
|
ifneq ($(KBUILD_SRC),)
|
||||||
|
$(Q)mkdir -p $(objtree)/Documentation/DocBook/man
|
||||||
|
endif
|
||||||
|
$(SPLITMAN) $< $(objtree)/Documentation/DocBook/man "$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)"
|
||||||
|
$(MAKEMAN) convert $(objtree)/Documentation/DocBook/man $<
|
||||||
|
|
||||||
|
###
|
||||||
|
# Rules to generate postscripts and PNG imgages from .fig format files
|
||||||
|
quiet_cmd_fig2eps = FIG2EPS $@
|
||||||
|
cmd_fig2eps = fig2dev -Leps $< $@
|
||||||
|
|
||||||
|
%.eps: %.fig
|
||||||
|
@(which fig2dev > /dev/null 2>&1) || \
|
||||||
|
(echo "*** You need to install transfig ***"; \
|
||||||
|
exit 1)
|
||||||
|
$(call cmd,fig2eps)
|
||||||
|
|
||||||
|
quiet_cmd_fig2png = FIG2PNG $@
|
||||||
|
cmd_fig2png = fig2dev -Lpng $< $@
|
||||||
|
|
||||||
|
%.png: %.fig
|
||||||
|
@(which fig2dev > /dev/null 2>&1) || \
|
||||||
|
(echo "*** You need to install transfig ***"; \
|
||||||
|
exit 1)
|
||||||
|
$(call cmd,fig2png)
|
||||||
|
|
||||||
|
###
|
||||||
|
# Rule to convert a .c file to inline XML documentation
|
||||||
|
%.xml: %.c
|
||||||
|
@echo ' GEN $@'
|
||||||
|
@( \
|
||||||
|
echo "<programlisting>"; \
|
||||||
|
expand --tabs=8 < $< | \
|
||||||
|
sed -e "s/&/\\&/g" \
|
||||||
|
-e "s/</\\</g" \
|
||||||
|
-e "s/>/\\>/g"; \
|
||||||
|
echo "</programlisting>") > $@
|
||||||
|
|
||||||
|
###
|
||||||
|
# Help targets as used by the top-level makefile
|
||||||
|
dochelp:
|
||||||
|
@echo ' Linux kernel internal documentation in different formats:'
|
||||||
|
@echo ' xmldocs (XML DocBook), psdocs (Postscript), pdfdocs (PDF)'
|
||||||
|
@echo ' htmldocs (HTML), mandocs (man pages, use installmandocs to install)'
|
||||||
|
|
||||||
|
###
|
||||||
|
# Temporary files left by various tools
|
||||||
|
clean-files := $(DOCBOOKS) \
|
||||||
|
$(patsubst %.xml, %.dvi, $(DOCBOOKS)) \
|
||||||
|
$(patsubst %.xml, %.aux, $(DOCBOOKS)) \
|
||||||
|
$(patsubst %.xml, %.tex, $(DOCBOOKS)) \
|
||||||
|
$(patsubst %.xml, %.log, $(DOCBOOKS)) \
|
||||||
|
$(patsubst %.xml, %.out, $(DOCBOOKS)) \
|
||||||
|
$(patsubst %.xml, %.ps, $(DOCBOOKS)) \
|
||||||
|
$(patsubst %.xml, %.pdf, $(DOCBOOKS)) \
|
||||||
|
$(patsubst %.xml, %.html, $(DOCBOOKS)) \
|
||||||
|
$(patsubst %.xml, %.9, $(DOCBOOKS)) \
|
||||||
|
$(C-procfs-example)
|
||||||
|
|
||||||
|
clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS))
|
||||||
|
|
||||||
|
#man put files in man subdir - traverse down
|
||||||
|
subdir- := man/
|
||||||
@@ -0,0 +1,341 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
|
||||||
|
|
||||||
|
<book id="DoingIO">
|
||||||
|
<bookinfo>
|
||||||
|
<title>Bus-Independent Device Accesses</title>
|
||||||
|
|
||||||
|
<authorgroup>
|
||||||
|
<author>
|
||||||
|
<firstname>Matthew</firstname>
|
||||||
|
<surname>Wilcox</surname>
|
||||||
|
<affiliation>
|
||||||
|
<address>
|
||||||
|
<email>matthew@wil.cx</email>
|
||||||
|
</address>
|
||||||
|
</affiliation>
|
||||||
|
</author>
|
||||||
|
</authorgroup>
|
||||||
|
|
||||||
|
<authorgroup>
|
||||||
|
<author>
|
||||||
|
<firstname>Alan</firstname>
|
||||||
|
<surname>Cox</surname>
|
||||||
|
<affiliation>
|
||||||
|
<address>
|
||||||
|
<email>alan@redhat.com</email>
|
||||||
|
</address>
|
||||||
|
</affiliation>
|
||||||
|
</author>
|
||||||
|
</authorgroup>
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
<year>2001</year>
|
||||||
|
<holder>Matthew Wilcox</holder>
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<legalnotice>
|
||||||
|
<para>
|
||||||
|
This documentation is free software; you can redistribute
|
||||||
|
it and/or modify it under the terms of the GNU General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
This program is distributed in the hope that it will be
|
||||||
|
useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
You should have received a copy of the GNU General Public
|
||||||
|
License along with this program; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
MA 02111-1307 USA
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
For more details see the file COPYING in the source
|
||||||
|
distribution of Linux.
|
||||||
|
</para>
|
||||||
|
</legalnotice>
|
||||||
|
</bookinfo>
|
||||||
|
|
||||||
|
<toc></toc>
|
||||||
|
|
||||||
|
<chapter id="intro">
|
||||||
|
<title>Introduction</title>
|
||||||
|
<para>
|
||||||
|
Linux provides an API which abstracts performing IO across all busses
|
||||||
|
and devices, allowing device drivers to be written independently of
|
||||||
|
bus type.
|
||||||
|
</para>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="bugs">
|
||||||
|
<title>Known Bugs And Assumptions</title>
|
||||||
|
<para>
|
||||||
|
None.
|
||||||
|
</para>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="mmio">
|
||||||
|
<title>Memory Mapped IO</title>
|
||||||
|
<sect1>
|
||||||
|
<title>Getting Access to the Device</title>
|
||||||
|
<para>
|
||||||
|
The most widely supported form of IO is memory mapped IO.
|
||||||
|
That is, a part of the CPU's address space is interpreted
|
||||||
|
not as accesses to memory, but as accesses to a device. Some
|
||||||
|
architectures define devices to be at a fixed address, but most
|
||||||
|
have some method of discovering devices. The PCI bus walk is a
|
||||||
|
good example of such a scheme. This document does not cover how
|
||||||
|
to receive such an address, but assumes you are starting with one.
|
||||||
|
Physical addresses are of type unsigned long.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
This address should not be used directly. Instead, to get an
|
||||||
|
address suitable for passing to the accessor functions described
|
||||||
|
below, you should call <function>ioremap</function>.
|
||||||
|
An address suitable for accessing the device will be returned to you.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
After you've finished using the device (say, in your module's
|
||||||
|
exit routine), call <function>iounmap</function> in order to return
|
||||||
|
the address space to the kernel. Most architectures allocate new
|
||||||
|
address space each time you call <function>ioremap</function>, and
|
||||||
|
they can run out unless you call <function>iounmap</function>.
|
||||||
|
</para>
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
<sect1>
|
||||||
|
<title>Accessing the device</title>
|
||||||
|
<para>
|
||||||
|
The part of the interface most used by drivers is reading and
|
||||||
|
writing memory-mapped registers on the device. Linux provides
|
||||||
|
interfaces to read and write 8-bit, 16-bit, 32-bit and 64-bit
|
||||||
|
quantities. Due to a historical accident, these are named byte,
|
||||||
|
word, long and quad accesses. Both read and write accesses are
|
||||||
|
supported; there is no prefetch support at this time.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The functions are named <function>readb</function>,
|
||||||
|
<function>readw</function>, <function>readl</function>,
|
||||||
|
<function>readq</function>, <function>readb_relaxed</function>,
|
||||||
|
<function>readw_relaxed</function>, <function>readl_relaxed</function>,
|
||||||
|
<function>readq_relaxed</function>, <function>writeb</function>,
|
||||||
|
<function>writew</function>, <function>writel</function> and
|
||||||
|
<function>writeq</function>.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Some devices (such as framebuffers) would like to use larger
|
||||||
|
transfers than 8 bytes at a time. For these devices, the
|
||||||
|
<function>memcpy_toio</function>, <function>memcpy_fromio</function>
|
||||||
|
and <function>memset_io</function> functions are provided.
|
||||||
|
Do not use memset or memcpy on IO addresses; they
|
||||||
|
are not guaranteed to copy data in order.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The read and write functions are defined to be ordered. That is the
|
||||||
|
compiler is not permitted to reorder the I/O sequence. When the
|
||||||
|
ordering can be compiler optimised, you can use <function>
|
||||||
|
__readb</function> and friends to indicate the relaxed ordering. Use
|
||||||
|
this with care.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
While the basic functions are defined to be synchronous with respect
|
||||||
|
to each other and ordered with respect to each other the busses the
|
||||||
|
devices sit on may themselves have asynchronicity. In particular many
|
||||||
|
authors are burned by the fact that PCI bus writes are posted
|
||||||
|
asynchronously. A driver author must issue a read from the same
|
||||||
|
device to ensure that writes have occurred in the specific cases the
|
||||||
|
author cares. This kind of property cannot be hidden from driver
|
||||||
|
writers in the API. In some cases, the read used to flush the device
|
||||||
|
may be expected to fail (if the card is resetting, for example). In
|
||||||
|
that case, the read should be done from config space, which is
|
||||||
|
guaranteed to soft-fail if the card doesn't respond.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The following is an example of flushing a write to a device when
|
||||||
|
the driver would like to ensure the write's effects are visible prior
|
||||||
|
to continuing execution.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
static inline void
|
||||||
|
qla1280_disable_intrs(struct scsi_qla_host *ha)
|
||||||
|
{
|
||||||
|
struct device_reg *reg;
|
||||||
|
|
||||||
|
reg = ha->iobase;
|
||||||
|
/* disable risc and host interrupts */
|
||||||
|
WRT_REG_WORD(&reg->ictrl, 0);
|
||||||
|
/*
|
||||||
|
* The following read will ensure that the above write
|
||||||
|
* has been received by the device before we return from this
|
||||||
|
* function.
|
||||||
|
*/
|
||||||
|
RD_REG_WORD(&reg->ictrl);
|
||||||
|
ha->flags.ints_enabled = 0;
|
||||||
|
}
|
||||||
|
</programlisting>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
In addition to write posting, on some large multiprocessing systems
|
||||||
|
(e.g. SGI Challenge, Origin and Altix machines) posted writes won't
|
||||||
|
be strongly ordered coming from different CPUs. Thus it's important
|
||||||
|
to properly protect parts of your driver that do memory-mapped writes
|
||||||
|
with locks and use the <function>mmiowb</function> to make sure they
|
||||||
|
arrive in the order intended. Issuing a regular <function>readX
|
||||||
|
</function> will also ensure write ordering, but should only be used
|
||||||
|
when the driver has to be sure that the write has actually arrived
|
||||||
|
at the device (not that it's simply ordered with respect to other
|
||||||
|
writes), since a full <function>readX</function> is a relatively
|
||||||
|
expensive operation.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Generally, one should use <function>mmiowb</function> prior to
|
||||||
|
releasing a spinlock that protects regions using <function>writeb
|
||||||
|
</function> or similar functions that aren't surrounded by <function>
|
||||||
|
readb</function> calls, which will ensure ordering and flushing. The
|
||||||
|
following pseudocode illustrates what might occur if write ordering
|
||||||
|
isn't guaranteed via <function>mmiowb</function> or one of the
|
||||||
|
<function>readX</function> functions.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
CPU A: spin_lock_irqsave(&dev_lock, flags)
|
||||||
|
CPU A: ...
|
||||||
|
CPU A: writel(newval, ring_ptr);
|
||||||
|
CPU A: spin_unlock_irqrestore(&dev_lock, flags)
|
||||||
|
...
|
||||||
|
CPU B: spin_lock_irqsave(&dev_lock, flags)
|
||||||
|
CPU B: writel(newval2, ring_ptr);
|
||||||
|
CPU B: ...
|
||||||
|
CPU B: spin_unlock_irqrestore(&dev_lock, flags)
|
||||||
|
</programlisting>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
In the case above, newval2 could be written to ring_ptr before
|
||||||
|
newval. Fixing it is easy though:
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
CPU A: spin_lock_irqsave(&dev_lock, flags)
|
||||||
|
CPU A: ...
|
||||||
|
CPU A: writel(newval, ring_ptr);
|
||||||
|
CPU A: mmiowb(); /* ensure no other writes beat us to the device */
|
||||||
|
CPU A: spin_unlock_irqrestore(&dev_lock, flags)
|
||||||
|
...
|
||||||
|
CPU B: spin_lock_irqsave(&dev_lock, flags)
|
||||||
|
CPU B: writel(newval2, ring_ptr);
|
||||||
|
CPU B: ...
|
||||||
|
CPU B: mmiowb();
|
||||||
|
CPU B: spin_unlock_irqrestore(&dev_lock, flags)
|
||||||
|
</programlisting>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
See tg3.c for a real world example of how to use <function>mmiowb
|
||||||
|
</function>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
PCI ordering rules also guarantee that PIO read responses arrive
|
||||||
|
after any outstanding DMA writes from that bus, since for some devices
|
||||||
|
the result of a <function>readb</function> call may signal to the
|
||||||
|
driver that a DMA transaction is complete. In many cases, however,
|
||||||
|
the driver may want to indicate that the next
|
||||||
|
<function>readb</function> call has no relation to any previous DMA
|
||||||
|
writes performed by the device. The driver can use
|
||||||
|
<function>readb_relaxed</function> for these cases, although only
|
||||||
|
some platforms will honor the relaxed semantics. Using the relaxed
|
||||||
|
read functions will provide significant performance benefits on
|
||||||
|
platforms that support it. The qla2xxx driver provides examples
|
||||||
|
of how to use <function>readX_relaxed</function>. In many cases,
|
||||||
|
a majority of the driver's <function>readX</function> calls can
|
||||||
|
safely be converted to <function>readX_relaxed</function> calls, since
|
||||||
|
only a few will indicate or depend on DMA completion.
|
||||||
|
</para>
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
<sect1>
|
||||||
|
<title>ISA legacy functions</title>
|
||||||
|
<para>
|
||||||
|
On older kernels (2.2 and earlier) the ISA bus could be read or
|
||||||
|
written with these functions and without ioremap being used. This is
|
||||||
|
no longer true in Linux 2.4. A set of equivalent functions exist for
|
||||||
|
easy legacy driver porting. The functions available are prefixed
|
||||||
|
with 'isa_' and are <function>isa_readb</function>,
|
||||||
|
<function>isa_writeb</function>, <function>isa_readw</function>,
|
||||||
|
<function>isa_writew</function>, <function>isa_readl</function>,
|
||||||
|
<function>isa_writel</function>, <function>isa_memcpy_fromio</function>
|
||||||
|
and <function>isa_memcpy_toio</function>
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
These functions should not be used in new drivers, and will
|
||||||
|
eventually be going away.
|
||||||
|
</para>
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter>
|
||||||
|
<title>Port Space Accesses</title>
|
||||||
|
<sect1>
|
||||||
|
<title>Port Space Explained</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Another form of IO commonly supported is Port Space. This is a
|
||||||
|
range of addresses separate to the normal memory address space.
|
||||||
|
Access to these addresses is generally not as fast as accesses
|
||||||
|
to the memory mapped addresses, and it also has a potentially
|
||||||
|
smaller address space.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Unlike memory mapped IO, no preparation is required
|
||||||
|
to access port space.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</sect1>
|
||||||
|
<sect1>
|
||||||
|
<title>Accessing Port Space</title>
|
||||||
|
<para>
|
||||||
|
Accesses to this space are provided through a set of functions
|
||||||
|
which allow 8-bit, 16-bit and 32-bit accesses; also
|
||||||
|
known as byte, word and long. These functions are
|
||||||
|
<function>inb</function>, <function>inw</function>,
|
||||||
|
<function>inl</function>, <function>outb</function>,
|
||||||
|
<function>outw</function> and <function>outl</function>.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Some variants are provided for these functions. Some devices
|
||||||
|
require that accesses to their ports are slowed down. This
|
||||||
|
functionality is provided by appending a <function>_p</function>
|
||||||
|
to the end of the function. There are also equivalents to memcpy.
|
||||||
|
The <function>ins</function> and <function>outs</function>
|
||||||
|
functions copy bytes, words or longs to the given port.
|
||||||
|
</para>
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="pubfunctions">
|
||||||
|
<title>Public Functions Provided</title>
|
||||||
|
!Einclude/asm-i386/io.h
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
</book>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user