ダウンロード: SubmittingPatches.txt

現在作業中の文書です。お気づきの点がありましたら、jf@listserv.linux.or.jp、チケットフォーラムのいずれかにお寄せください。

==================================
これは、
linux-2.6.39/Documentation/SubmittingPatches の和訳
です。
翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
翻訳日: 2011/05/27
翻訳者: Keiichi Kii <k-keiichi at bx dot jp dot nec dot com>
校正者: Masanari Kobayashi さん <zap03216 at nifty dot ne dot jp>
         Matsukura さん <nbh--mats at nifty dot com>
==================================

	How to Get Your Change Into the Linux Kernel
		or
	Care And Operation Of Your Linus Torvalds

        Linux カーネルに変更を加えるための Howto
        又は
        かの Linus Torvalds の取り扱い説明書

For a person or company who wishes to submit a change to the Linux
kernel, the process can sometimes be daunting if you're not familiar
with "the system."  This text is a collection of suggestions which
can greatly increase the chances of your change being accepted.

Linux カーネルに変更を加えたいと思っている個人又は会社にとって、パッ
チの投稿に関連した仕組みに慣れていなければ、その過程は時々みなさんを
おじけづかせることもあります。この文章はあなたの変更を大いに受け入れ
てもらえやすくする提案を集めたものです。

Read Documentation/SubmitChecklist for a list of items to check
before submitting code.  If you are submitting a driver, also read
Documentation/SubmittingDrivers.

コードを投稿する前に、Documentation/SubmitChecklist の項目リストに目
を通してチェックしてください。もしあなたがドライバーを投稿しようとし
ているなら、Documentation/SubmittingDrivers にも目を通してください。

--------------------------------------------
SECTION 1 - CREATING AND SENDING YOUR CHANGE
--------------------------------------------

--------------------------------------------
セクション1 パッチの作り方と送り方
--------------------------------------------

1) "diff -up"
------------

1) 「 diff -up 」
------------

Use "diff -up" or "diff -uprN" to create patches.

パッチの作成には「 diff -up 」又は「 diff -uprN 」を使ってください。

All changes to the Linux kernel occur in the form of patches, as
generated by diff(1).  When creating your patch, make sure to create it
in "unified diff" format, as supplied by the '-u' argument to diff(1).
Also, please use the '-p' argument which shows which C function each
change is in - that makes the resultant diff a lot easier to read.
Patches should be based in the root kernel source directory,
not in any lower subdirectory.

Linux カーネルに対する全ての変更は diff(1) コマンドによるパッチの形式で
生成してください。パッチを作成するときには、diff(1) コマンドに「 -u 」引
数を指定して、unified 形式のパッチを作成することを確認してください。また、
変更がどの C 関数で行われたのかを表示する「 -p 」引数を使ってください。
この引数は生成した差分をずっと読みやすくしてくれます。パッチは Linux 
カーネルソースの中のサブディレクトリではなく Linux カーネルソースのルート
ディレクトリを基準にしないといけません。

To create a patch for a single file, it is often sufficient to do:

1個のファイルについてのパッチを作成するためには、ほとんどの場合、
以下の作業を行えば十分です。

	SRCTREE= linux-2.6
	MYFILE=  drivers/net/mydriver.c

	cd $SRCTREE
	cp $MYFILE $MYFILE.orig
	vi $MYFILE	# make your change
	cd ..
	diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch

To create a patch for multiple files, you should unpack a "vanilla",
or unmodified kernel source tree, and generate a diff against your
own source tree.  For example:

複数のファイルについてのパッチを作成するためには、素の( vanilla )、す
なわち変更を加えてない Linux カーネルを展開し、自分の Linux カーネル
ソースとの差分を生成しないといけません。例えば、

	MYSRC= /devel/linux-2.6

	tar xvfz linux-2.6.12.tar.gz
	mv linux-2.6.12 linux-2.6.12-vanilla
	diff -uprN -X linux-2.6.12-vanilla/Documentation/dontdiff \
		linux-2.6.12-vanilla $MYSRC > /tmp/patch

"dontdiff" is a list of files which are generated by the kernel during
the build process, and should be ignored in any diff(1)-generated
patch.  The "dontdiff" file is included in the kernel tree in
2.6.12 and later.  For earlier kernel versions, you can get it
from <http://www.xenotime.net/linux/doc/dontdiff>.

dontdiff ファイルには Linux カーネルのビルドプロセスの過程で生成された
ファイルの一覧がのっています。そして、それらはパッチを生成する diff(1)
コマンドで無視されるべきです。dontdiff ファイルは 2.6.12 以後のバージョ
ンの Linux カーネルソースツリーに含まれています。それより前のバージョン
の Linux カーネルソースツリーに対する dontdiff ファイルは、
<http://www.xenotime.net/linux/doc/dontdiff>から取得することができます。

Make sure your patch does not include any extra files which do not
belong in a patch submission.  Make sure to review your patch -after-
generated it with diff(1), to ensure accuracy.

投稿するパッチの中に関係のない余分なファイルが含まれていないことを確
認してください。diff(1) コマンドで生成したパッチがあなたの意図したとお
りのものであることを確認してください。

If your changes produce a lot of deltas, you may want to look into
splitting them into individual patches which modify things in
logical stages.  This will facilitate easier reviewing by other
kernel developers, very important if you want your patch accepted.
There are a number of scripts which can aid in this:

もしあなたのパッチが多くの差分を生み出すのであれば、あなたはパッチ
を意味のあるひとまとまりごとに分けたいと思うかもしれません。
これは他のカーネル開発者にとってレビューしやすくなるので、あなたの
パッチを受け入れてもらうためにはとても重要なことです。これを補助でき
る多くのスクリプトがあります。

Quilt:
http://savannah.nongnu.org/projects/quilt

Andrew Morton's patch scripts:
http://userweb.kernel.org/~akpm/stuff/patch-scripts.tar.gz
Instead of these scripts, quilt is the recommended patch management
tool (see above).

このリンクの先のスクリプトの代わりとして、quilt がパッチマネジメント
ツールとして推奨されています(上のリンクを見てください)。

2) Describe your changes.

2) パッチに対する説明

Describe the technical detail of the change(s) your patch includes.

パッチの中の変更点に対する技術的な詳細について説明してください。

Be as specific as possible.  The WORST descriptions possible include
things like "update driver X", "bug fix for driver X", or "this patch
includes updates for subsystem X.  Please apply."

説明はできる限り具体的に。もっとも悪い説明は「ドライバー X を更新」、
「ドライバー X に対するバグフィックス」あるいは「このパッチはサブシス
テム X に対する更新を含んでいます。どうか取り入れてください。」などです。

The maintainer will thank you if you write your patch description in a
form which can be easily pulled into Linux's source code management
system, git, as a "commit log".  See #15, below.

パッチの説明を Linux カーネルのソースコードマネジメントシステム「 git 」の
コミットログとして簡単に引用できる形で書けば、メンテナから感謝されるでしょう。
以下の #15 を見てください。

If your description starts to get long, that's a sign that you probably
need to split up your patch.  See #3, next.

説明が長くなりだしたのであれば、おそらくそれはパッチを分ける必要がある
という兆候です。次の #3 を見てください。

When you submit or resubmit a patch or patch series, include the
complete patch description and justification for it.  Don't just
say that this is version N of the patch (series).  Don't expect the
patch merger to refer back to earlier patch versions or referenced
URLs to find the patch description and put that into the patch.
I.e., the patch (series) and its description should be self-contained.
This benefits both the patch merger(s) and reviewers.  Some reviewers
probably didn't even receive earlier versions of the patch.

If the patch fixes a logged bug entry, refer to that bug entry by
number and URL.

パッチ(シリーズ)を(再)投稿する時、十分なパッチの説明とそのパッチが必要な理由を
パッチに含めてください。ただ「これはパッチ(シリーズ)のバージョン N」とだけ
書かないでください。そして、パッチをマージする人にパッチの説明を探させそれを
パッチに追記させるため、過去のバージョンのパッチやそのパッチの URL を参照する
手間をかけさせないでください。
つまり、パッチシリーズとその説明は一緒にあるべきです。これはパッチをマージする
人、レビューする人、どちらのためにもなります。レビューする人の中には、おそらく
過去のバージョンのパッチを受け取ってもいない人がいます。

登録済みのバグエントリを修正するパッチであれば、そのバグエントリを示すバグ ID
や URL を明記してください。

3) Separate your changes.

3) パッチの分割

Separate _logical changes_ into a single patch file.

意味のあるひとまとまりごとに変更を個々のパッチファイルに分けてください。

For example, if your changes include both bug fixes and performance
enhancements for a single driver, separate those changes into two
or more patches.  If your changes include an API update, and a new
driver which uses that new API, separate those into two patches.

例えば、もし1つのドライバーに対するバグフィックスとパフォーマンス強
化の両方の変更を含んでいるのであれば、その変更を2つ以上のパッチに分
けてください。もし変更箇所に API の更新と、その新しい API を使う新たな
ドライバーが含まれているなら、2つのパッチに分けてください。

On the other hand, if you make a single change to numerous files,
group those changes into a single patch.  Thus a single logical change
is contained within a single patch.

一方で、もしあなたが多数のファイルに対して意味的に同じ1つの変更を加え
るのであれば、その変更を1つのパッチにまとめてください。言いかえると、
意味的に同じ1つの変更は1つのパッチの中に含まれます。

If one patch depends on another patch in order for a change to be
complete, that is OK.  Simply note "this patch depends on patch X"
in your patch description.

あるパッチが変更を完結させるために他のパッチに依存していたとしても、
それは問題ありません。パッチの説明の中で「このパッチはパッチ X に依存
している」と簡単に注意書きをつけてください。

If you cannot condense your patch set into a smaller set of patches,
then only post say 15 or so at a time and wait for review and integration.

もしパッチをより小さなパッチの集合に凝縮することができないなら、まずは
15かそこらのパッチを送り、そのレビューと統合を待って下さい。

4) Style check your changes.

4) パッチのスタイルチェック

Check your patch for basic style violations, details of which can be
found in Documentation/CodingStyle.  Failure to do so simply wastes
the reviewers time and will get your patch rejected, probably
without even being read.

あなたのパッチが基本的な( Linux カーネルの)コーディングスタイルに違反し
ていないかをチェックして下さい。その詳細を Documentation/CodingStyle で
見つけることができます。コーディングスタイルの違反はレビューする人の
時間を無駄にするだけなので、恐らくあなたのパッチは読まれることすらなく
拒否されるでしょう。

At a minimum you should check your patches with the patch style
checker prior to submission (scripts/checkpatch.pl).  You should
be able to justify all violations that remain in your patch.

あなたはパッチを投稿する前に最低限パッチスタイルチェッカー
( scripts/checkpatch.pl )を利用してパッチをチェックすべきです。
もしパッチに違反がのこっているならば、それらの全てについてあなたは正当な
理由を示せるようにしておく必要があります。

5) Select e-mail destination.

5) 電子メールの宛先の選び方

Look through the MAINTAINERS file and the source code, and determine
if your change applies to a specific subsystem of the kernel, with
an assigned maintainer.  If so, e-mail that person.

MAINTAINERS ファイルとソースコードに目を通してください。そして、その変
更がメンテナのいる特定のサブシステムに加えられるものであることが分か
れば、その人に電子メールを送ってください。

If no maintainer is listed, or the maintainer does not respond, send
your patch to the primary Linux kernel developer's mailing list,
linux-kernel@vger.kernel.org.  Most kernel developers monitor this
e-mail list, and can comment on your changes.

もし、メンテナが載っていなかったり、メンテナからの応答がないなら、
LKML ( linux-kernel@vger.kernel.org )へパッチを送ってください。ほとんど
のカーネル開発者はこのメーリングリストに目を通しており、変更に対して
コメントを得ることができます。

Do not send more than 15 patches at once to the vger mailing lists!!!

15個より多くのパッチを同時に vger.kernel.org のメーリングリストへ送らな
いでください!!!

Linus Torvalds is the final arbiter of all changes accepted into the
Linux kernel.  His e-mail address is <torvalds@linux-foundation.org>.
He gets a lot of e-mail, so typically you should do your best to -avoid-
sending him e-mail.

Linus Torvalds は Linux カーネルに入る全ての変更に対する最終的な意思決定者
です。電子メールアドレスは torvalds@linux-foundation.org になります。彼は
多くの電子メールを受け取っているため、できる限り彼に電子メールを送るのは
避けるべきです。

Patches which are bug fixes, are "obvious" changes, or similarly
require little discussion should be sent or CC'd to Linus.  Patches
which require discussion or do not have a clear advantage should
usually be sent first to linux-kernel.  Only after the patch is
discussed should the patch then be submitted to Linus.

バグフィックスであったり、自明な変更であったり、話し合いをほとんど
必要としないパッチは Linus へ電子メールを送るか CC しなければなりません。
話し合いを必要としたり、明確なアドバンテージがないパッチは、通常まず
は LKML へ送られるべきです。パッチが議論された後にだけ、そのパッチを
Linus へ送るべきです。

6) Select your CC (e-mail carbon copy) list.

6) CC (カーボンコピー)先の選び方

Unless you have a reason NOT to do so, CC linux-kernel@vger.kernel.org.

特に理由がないなら、LKML にも CC してください。

Other kernel developers besides Linus need to be aware of your change,
so that they may comment on it and offer code review and suggestions.
linux-kernel is the primary Linux kernel developer mailing list.
Other mailing lists are available for specific subsystems, such as
USB, framebuffer devices, the VFS, the SCSI subsystem, etc.  See the
MAINTAINERS file for a mailing list that relates specifically to
your change.

Linus 以外のカーネル開発者は変更に気づく必要があり、その結果、彼らはそ
の変更に対してコメントをくれたり、コードに対してレビューや提案をくれ
るかもしれません。LKML とは Linux カーネル開発者にとって一番中心的なメー
リングリストです。USB やフレームバッファデバイスや VFS や SCSI サブシステ
ムなどの特定のサブシステムに関するメーリングリストもあります。あなた
の変更に、はっきりと関連のあるメーリングリストについて知りたければ
MAINTAINERS ファイルを参照してください。

Majordomo lists of VGER.KERNEL.ORG at:
	<http://vger.kernel.org/vger-lists.html>

VGER.KERNEL.ORG でホスティングされているメーリングリストの一覧が下記の
サイトに載っています。
<http://vger.kernel.org/vger-lists.html>

If changes affect userland-kernel interfaces, please send
the MAN-PAGES maintainer (as listed in the MAINTAINERS file)
a man-pages patch, or at least a notification of the change,
so that some information makes its way into the manual pages.

もし、変更がユーザランドのカーネルインタフェースに影響を与え
るのであれば、MAN-PAGES のメンテナ( MAINTAINERS ファイルに一覧
があります)に man ページのパッチを送ってください。少なくとも
情報がマニュアルページの中に入ってくるように、変更が起きたという
通知を送ってください。

Even if the maintainer did not respond in step #5, make sure to ALWAYS
copy the maintainer when you change their code.

たとえ、メンテナが #5 で反応がなかったとしても、メンテナのコードに変更を
加えたときには、いつもメンテナに CC するのを忘れないようにしてください。

For small patches you may want to CC the Trivial Patch Monkey
trivial@kernel.org which collects "trivial" patches. Have a look
into the MAINTAINERS file for its current manager.
Trivial patches must qualify for one of the following rules:
 Spelling fixes in documentation
 Spelling fixes which could break grep(1)
 Warning fixes (cluttering with useless warnings is bad)
 Compilation fixes (only if they are actually correct)
 Runtime fixes (only if they actually fix things)
 Removing use of deprecated functions/macros (eg. check_region)
 Contact detail and documentation fixes
 Non-portable code replaced by portable code (even in arch-specific,
 since people copy, as long as it's trivial)
 Any fix by the author/maintainer of the file (ie. patch monkey
 in re-transmission mode)

小さなパッチであれば、Trivial Patch Monkey(ちょっとしたパッチを集めている)
<trivial@kernel.org>に CC してもいいです。その現管理者については MAINTAINERS
ファイルを見てください。ちょっとしたパッチとは以下のルールのどれか1つを満たして
いなければなりません。
 ・ドキュメントのスペルミスの修正
 ・grep(1) コマンドによる検索を困難にしているスペルの修正
 ・コンパイル時の警告の修正(無駄な警告が散乱することは好ましくないた
   めです)
 ・コンパイル問題の修正(それらの修正が本当に正しい場合に限る)
 ・実行時の問題の修正(それらの修正が本当に問題を修正している場合に限る)
 ・廃止予定の関数やマクロを使用しているコードの除去(例 check_region )
 ・問い合わせ先やドキュメントの修正
 ・移植性のないコードから移植性のあるコードへの置き換え(小さい範囲で
   あればアーキテクチャ特有のことでも他の人がコピーできます)
 ・作者やメンテナによる修正(すなわち patch monkey の再転送モード)

7) No MIME, no links, no compression, no attachments.  Just plain text.

7) MIME やリンクや圧縮ファイルや添付ファイルではなくプレインテキストのみ

Linus and other kernel developers need to be able to read and comment
on the changes you are submitting.  It is important for a kernel
developer to be able to "quote" your changes, using standard e-mail
tools, so that they may comment on specific portions of your code.

Linus や他のカーネル開発者はあなたが投稿した変更を読んで、コメントでき
る必要があります。カーネル開発者にとって、あなたが書いたコードの特定の
部分にコメントをするために、標準的な電子メールクライアントで変更が引用
できることは重要です。

For this reason, all patches should be submitting e-mail "inline".
WARNING:  Be wary of your editor's word-wrap corrupting your patch,
if you choose to cut-n-paste your patch.

上記の理由で、すべてのパッチは文中に含める形式の電子メールで投稿さ
れるべきです。警告:あなたがパッチをコピー&ペーストする際には、パッ
チを改悪するエディターの折り返し機能に注意してください。

Do not attach the patch as a MIME attachment, compressed or not.
Many popular e-mail applications will not always transmit a MIME
attachment as plain text, making it impossible to comment on your
code.  A MIME attachment also takes Linus a bit more time to process,
decreasing the likelihood of your MIME-attached change being accepted.

パッチを圧縮の有無に関わらず MIME 形式で添付しないでください。多くのポ
ピュラーな電子メールクライアントは MIME 形式の添付ファイルをプレーンテ
キストとして送信するとは限らないでしょう。そうなると、電子メールクラ
イアントがコードに対するコメントを付けることをできなくします。また、
MIME 形式の添付ファイルは Linus に手間を取らせることになり、その変更を
受け入れてもらう可能性が低くなってしまいます。

Exception:  If your mailer is mangling patches then someone may ask
you to re-send them using MIME.

例外:お使いの電子メールクライアントがパッチをめちゃくちゃにするので
あれば、誰かが MIME 形式のパッチを再送するよう求めるかもしれません。

See Documentation/email-clients.txt for hints about configuring
your e-mail client so that it sends your patches untouched.

余計な変更を加えずにあなたのパッチを送信するための電子メールクライアントの設定
のヒントについては Documentation/email-clients.txt を参照してください。

8) E-mail size.

8) 電子メールのサイズ

When sending patches to Linus, always follow step #7.

パッチを Linus へ送るときは常に #7 の手順に従ってください。

Large changes are not appropriate for mailing lists, and some
maintainers.  If your patch, uncompressed, exceeds 300 kB in size,
it is preferred that you store your patch on an Internet-accessible
server, and provide instead a URL (link) pointing to your patch.

大きなパッチはメーリングリストやメンテナにとって不親切です。パッチが
未圧縮で 300KB を超えるようであるなら、インターネット上のアクセス可能な
サーバに保存し、保存場所を示す URL を伝えるほうが適切です。

9) Name your kernel version.

9) カーネルバージョンの明記

It is important to note, either in the subject line or in the patch
description, the kernel version to which this patch applies.

パッチが対象とするカーネルのバージョンをパッチの概要か電子メールの
サブジェクトに付けることが重要です。

If the patch does not apply cleanly to the latest kernel version,
Linus will not apply it.

パッチが最新バージョンのカーネルに正しく適用できなければ、Linus は
そのパッチを採用しないでしょう。

10) Don't get discouraged.  Re-submit.

10) がっかりせず再投稿

After you have submitted your change, be patient and wait.  If Linus
likes your change and applies it, it will appear in the next version
of the kernel that he releases.

パッチを投稿した後は、辛抱強く待っていてください。Linus があなたのパッ
チを気に入って採用すれば、Linus がリリースする次のバージョンのカーネル
の中で姿を見せるでしょう。

However, if your change doesn't appear in the next version of the
kernel, there could be any number of reasons.  It's YOUR job to
narrow down those reasons, correct what was wrong, and submit your
updated change.

しかし、パッチが次のバージョンのカーネルに入っていないなら、いくつもの
理由があるのでしょう。その原因を絞り込み、間違っているものを正し、更新
したパッチを投稿するのはあなたの仕事です。

It is quite common for Linus to "drop" your patch without comment.
That's the nature of the system.  If he drops your patch, it could be
due to
* Your patch did not apply cleanly to the latest kernel version.
* Your patch was not sufficiently discussed on linux-kernel.
* A style issue (see section 2).
* An e-mail formatting issue (re-read this section).
* A technical problem with your change.
* He gets tons of e-mail, and yours got lost in the shuffle.
* You are being annoying.

Linus があなたのパッチに対して何のコメントもなく不採用にすることは極め
て普通のことです。それは自然な姿です。もし、Linus があなたのパッチを受
け取っていないのであれば、以下の理由が考えられます。
* パッチが最新バージョンの Linux カーネルにきちんと適用できなかった
* パッチが LKML で十分に議論されていなかった
* スタイルの問題(セクション2を参照)
* 電子メールフォーマットの問題(このセクションを参照)
* パッチに対する技術的な問題
* Linus はたくさんの電子メールを受け取っているので、どさくさに紛れて見
  失った
* 不愉快にさせている

When in doubt, solicit comments on linux-kernel mailing list.

判断できない場合は、LKML にコメントを頼んでください。

11) Include PATCH in the subject

11) サブジェクトに「 PATCH 」

Due to high e-mail traffic to Linus, and to linux-kernel, it is common
convention to prefix your subject line with [PATCH].  This lets Linus
and other kernel developers more easily distinguish patches from other
e-mail discussions.

Linus や LKML への大量の電子メールのために、サブジェクトのプレフィックスに
「 [PATCH] 」を付けることが慣習となっています。これによって Linus や他の
カーネル開発者がパッチであるのか、又は、他の議論に関する電子メールであるの
かをより簡単に識別できます。

12) Sign your work

12) パッチへの署名

To improve tracking of who did what, especially with patches that can
percolate to their final resting place in the kernel through several
layers of maintainers, we've introduced a "sign-off" procedure on
patches that are being emailed around.

誰が何をしたのかを追いかけやすくするために (特に、パッチが何人かの
メンテナを経て最終的に Linux カーネルに取り込まれる場合のために)、電子
メールでやり取りされるパッチに対して「 sign-off 」という手続きを導入し
ました。

The sign-off is a simple line at the end of the explanation for the
patch, which certifies that you wrote it or otherwise have the right to
pass it on as a open-source patch.  The rules are pretty simple: if you
can certify the below:

「 sign-off 」とは、パッチがあなたの書いたものであるか、あるいは、
あなたがそのパッチをオープンソースとして提供する権利を保持している、
という証明をパッチの説明の末尾に一行記載するというものです。
ルールはとても単純です。以下の項目を確認して下さい。

        Developer's Certificate of Origin 1.1

        原作者の証明書( DCO ) 1.1

        By making a contribution to this project, I certify that:

        このプロジェクトに寄与するものとして、以下のことを証明する。

        (a) The contribution was created in whole or in part by me and I
            have the right to submit it under the open source license
            indicated in the file; or

        (a) 本寄与は私が全体又は一部作成したものであり、私がそのファイ
            ル中に明示されたオープンソースライセンスの下で公開する権利
            を持っている。もしくは、

        (b) The contribution is based upon previous work that, to the best
            of my knowledge, is covered under an appropriate open source
            license and I have the right under that license to submit that
            work with modifications, whether created in whole or in part
            by me, under the same open source license (unless I am
            permitted to submit under a different license), as indicated
            in the file; or

        (b) 本寄与は、私が知る限り、適切なオープンソースライセンスでカバ
            ーされている既存の作品を元にしている。同時に、私はそのライセ
            ンスの下で、私が全体又は一部作成した修正物を、ファイル中で示
            される同一のオープンソースライセンスで(異なるライセンスの下で
            投稿することが許可されている場合を除いて)投稿する権利を持って
            いる。もしくは、

        (c) The contribution was provided directly to me by some other
            person who certified (a), (b) or (c) and I have not modified
            it.

        (c) 本寄与は(a)、(b)、(c)を証明する第3者から私へ直接提供された
            ものであり、私はそれに変更を加えていない。

	(d) I understand and agree that this project and the contribution
	    are public and that a record of the contribution (including all
	    personal information I submit with it, including my sign-off) is
	    maintained indefinitely and may be redistributed consistent with
	    this project or the open source license(s) involved.

            私はこのプロジェクトと本寄与が公のものであることに理解及び同意す
            る。同時に、関与した記録(投稿の際の全ての個人情報と sign-off を
            含む)が無期限に保全されることと、当該プロジェクト又は関連する
            オープンソースライセンスに沿った形で再配布されることに理解及び
            同意する。

then you just add a line saying

もしこれに同意できるなら、以下のような1行を追加してください。

	Signed-off-by: Random J Developer <random@developer.example.org>

using your real name (sorry, no pseudonyms or anonymous contributions.)

実名を使ってください。(残念ですが、偽名や匿名による寄与はできません。)

Some people also put extra tags at the end.  They'll just be ignored for
now, but you can do this to mark internal company procedures or just
point out some special detail about the sign-off.

人によっては sign-off の近くに追加のタグを付加しています。それらは今のところ
無視されますが、あなたはそのタグを社内の手続きに利用したり、sign-off に特別
な情報を示したりすることができます。

If you are a subsystem or branch maintainer, sometimes you need to slightly
modify patches you receive in order to merge them, because the code is not
exactly the same in your tree and the submitters'. If you stick strictly to
rule (c), you should ask the submitter to rediff, but this is a totally
counter-productive waste of time and energy. Rule (b) allows you to adjust
the code, but then it is very impolite to change one submitter's code and
make him endorse your bugs. To solve this problem, it is recommended that
you add a line between the last Signed-off-by header and yours, indicating
the nature of your changes. While there is nothing mandatory about this, it
seems like prepending the description with your mail and/or name, all
enclosed in square brackets, is noticeable enough to make it obvious that
you are responsible for last-minute changes. Example :

あなたがサブシステムまたはブランチのメンテナであれば、受け取ったパッチを自身の
ツリーにマージするために、わずかに変更が必要となる場合があります。なぜなら
あなたのツリーの中のコードと投稿者のツリーの中のコードは同一ではないためです。
もし、あなたが厳密に上記ルール(c)にこだわるのであれば、投稿者に再度差分を
とるよう依頼すべきです。しかし、これは時間とエネルギーを非生産的に浪費する
ことになります。ルール(b)はあなたにコードを修正する権利を与えてくれます。
しかし、投稿者のコードを修正し、その修正によるバグを投稿者に押し付けてしまう
ことはとても失礼なことです。この問題を解決するために、末尾の投稿者の
Signed-off-by とあなたがその末尾に追加する Signed-off-by の間に、修正を
加えたことを示す1行を追加することが推奨されています。
(その1行の書き方に)決まりはありませんが、大括弧の中に電子メールアドレスや氏名
と修正内容を記載するやり方は目につきやすく、最終段階での変更の責任があなたに
あることを明確にするのに十分な方法のようです。例えば、

    Signed-off-by: Random J Developer <random@developer.example.org>
    [lucky@maintainer.example.org: struct foo moved from foo.c to foo.h]
    Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org>

This practise is particularly helpful if you maintain a stable branch and
want at the same time to credit the author, track changes, merge the fix,
and protect the submitter from complaints. Note that under no circumstances
can you change the author's identity (the From header), as it is the one
which appears in the changelog.

あなたが安定版のブランチを管理しており、作成者のクレジット、変更の追跡、
修正のマージ、と同時に苦情からの投稿者の保護を行いたい場合、この慣習は特に
有用となります。いかなる事情があってもチェンジログに出てくる作成者の
アイデンティティ情報(From ヘッダ)は変更できないことに注意してください。

Special note to back-porters: It seems to be a common and useful practise
to insert an indication of the origin of a patch at the top of the commit
message (just after the subject line) to facilitate tracking. For instance,
here's what we see in 2.6-stable :

バックポートする人のための特別な注意事項。追跡を容易に行うために、コミット
メッセージのトップ(サブジェクト行のすぐ後)にパッチの起源を示す情報を記述する
ことは一般的で有用な慣習です。例えば、これは 2.6-stable ツリーでの一例です。    

    Date:   Tue May 13 19:10:30 2008 +0000

        SCSI: libiscsi regression in 2.6.25: fix nop timer handling

        commit 4cf1043593db6a337f10e006c23c69e5fc93e722 upstream

And here's what appears in 2.4 :

そして、これは 2.4 ツリーでの一例です。

    Date:   Tue May 13 22:12:27 2008 +0200

        wireless, airo: waitbusy() won't delay

        [backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a]

Whatever the format, this information provides a valuable help to people
tracking your trees, and to people trying to trouble-shoot bugs in your
tree.

どんな形式であれ、この情報はあなたのツリーを追跡する人やあなたのツリーのバグを
解決しようとしている人にとって価値のある支援となります。

13) When to use Acked-by: and Cc:

13) いつ Acked-by: と Cc: を使うのか

The Signed-off-by: tag indicates that the signer was involved in the
development of the patch, or that he/she was in the patch's delivery path.

「 Signed-off-by: 」タグはその署名者がパッチの開発に関わっていたことやパッチ
の伝播パスにいたことを示しています。

If a person was not directly involved in the preparation or handling of a
patch but wishes to signify and record their approval of it then they can
arrange to have an Acked-by: line added to the patch's changelog.

ある人が直接パッチの準備や作成に関わっていないけれど、その人のパッチに対す
る承認を記録し、示したいとします。その場合、その人を示すのに Acked-by: が使
えます。Acked-by: はパッチのチェンジログにも追加されます。

Acked-by: is often used by the maintainer of the affected code when that
maintainer neither contributed to nor forwarded the patch.

パッチの影響を受けるコードのメンテナがパッチに関わっていなかったり、パッチ
の伝播パスにいなかった時にも、メンテナは Acked-by: をしばしば利用します。

Acked-by: is not as formal as Signed-off-by:.  It is a record that the acker
has at least reviewed the patch and has indicated acceptance.  Hence patch
mergers will sometimes manually convert an acker's "yep, looks good to me"
into an Acked-by:.

Acked-by: は Signed-off-by: のように公式なタグではありません。それはメンテナが
少なくともパッチをレビューし、同意を示しているという記録です。そのような
ことからパッチをマージする人がメンテナの「うん、良いと思うよ」という発言を
Acked-by: へ置き換えることがあります。

Acked-by: does not necessarily indicate acknowledgement of the entire patch.
For example, if a patch affects multiple subsystems and has an Acked-by: from
one subsystem maintainer then this usually indicates acknowledgement of just
the part which affects that maintainer's code.  Judgement should be used here.
When in doubt people should refer to the original discussion in the mailing
list archives.

Acked-by: が必ずしもパッチ全体の承認を示しているわけではありません。例えば、
あるパッチが複数のサブシステムへ影響を与えており、その中の1つのサブシステム
のメンテナからの Acked-by: を持っているとします。その場合、Acked-by: は通常
そのメンテナのコードに影響を与える一部分だけに対する承認を示しています。
この点は、ご自分で判断してください。(その Acked-by: が)疑わしい場合は、
メーリングリストアーカイブの中の大元の議論を参照すべきです。

If a person has had the opportunity to comment on a patch, but has not
provided such comments, you may optionally add a "Cc:" tag to the patch.
This is the only tag which might be added without an explicit action by the
person it names.  This tag documents that potentially interested parties
have been included in the discussion

パッチにコメントする機会を持っていたが、その時にコメントしなかった人がいれば、
その人を指す「Cc:」タグを任意で追加してもかまいません。これは指定された人からの
明確なアクションなしに付与できる唯一のタグです。
このタグはパッチに関心があると思われる人達がそのパッチの議論に含まれていたこと
を明文化します。

14) Using Reported-by:, Tested-by: and Reviewed-by:

14) Reported-by と Tested-by: と Reviewed-by: の利用

If this patch fixes a problem reported by somebody else, consider adding a
Reported-by: tag to credit the reporter for their contribution.  Please
note that this tag should not be added without the reporter's permission,
especially if the problem was not reported in a public forum.  That said,
if we diligently credit our bug reporters, they will, hopefully, be
inspired to help us again in the future.

他の誰かによって報告された問題を修正するパッチであれば、問題報告者という寄与を
クレジットするために、Reported-by: タグを追加することを検討してください。
こまめにバグ報告者をクレジットしていくことで、うまくいけばその人たちが将来再び
コミュニティの力となってくれるでしょう。
ただし、報告者の許可無くこのタグを追加しないように注意してください。特に、
問題が公の場で報告されていなかったのであれば。

A Tested-by: tag indicates that the patch has been successfully tested (in
some environment) by the person named.  This tag informs maintainers that
some testing has been performed, provides a means to locate testers for
future patches, and ensures credit for the testers.

Tested-by: タグはタグで指定された人によって(ある環境下で)パッチのテストに成功
していることを示します。このタグはメンテナにテストが実施済みであることを
知らせ、将来の関連パッチのテスト協力者を見つける方法を提供し、テスト実施者に
対するクレジットを保証します。

Reviewed-by:, instead, indicates that the patch has been reviewed and found
acceptable according to the Reviewer's Statement:

Reviewed-by: タグは、それとは異なり、下記のレビューア宣言の下にレビューされ、
受け入れ可能とみなされたパッチであることを示します。

       Reviewer's statement of oversight

レビューアによる監督宣言

       By offering my Reviewed-by: tag, I state that:

私は Reviewed-by: タグを提示することによって、以下のことを明言する。

        (a) I have carried out a technical review of this patch to
            evaluate its appropriateness and readiness for inclusion into
            the mainline kernel.

(a) 私はメインラインカーネルへの統合のために、その妥当性及び"readiness"を検証
    するため、技術的側面からパッチをレビュー済みである。

        (b) Any problems, concerns, or questions relating to the patch
            have been communicated back to the submitter.  I am satisfied
            with the submitter's response to my comments.

(b) パッチに関するあらゆる問題、懸念、あるいは、疑問は投稿者へ伝達済みである。
    私はそれらのコメントに対する投稿者の返答に満足している。

        (c) While there may be things that could be improved with this
            submission, I believe that it is, at this time, (1) a
            worthwhile modification to the kernel, and (2) free of known
            issues which would argue against its inclusion.

(c) 投稿に伴い修正されるコードがある一方で、現時点で、私は(1)それがカーネルに
    とって価値のある変更であること、そして、(2)統合の際の議論で明らかとなった
    問題は解決されていると確信する。

        (d) While I have reviewed the patch and believe it to be sound, I
            do not (unless explicitly stated elsewhere) make any
            warranties or guarantees that it will achieve its stated
            purpose or function properly in any given situation.

(d) 私はパッチをレビューし適切であると確信している一方で、あらゆる状況において
    その宣言した目的や機能が正しく実現することに関して、いかなる保証もしない
    (特にどこかで明示しない限り)。

A Reviewed-by tag is a statement of opinion that the patch is an
appropriate modification of the kernel without any remaining serious
technical issues.  Any interested reviewer (who has done the work) can
offer a Reviewed-by tag for a patch.  This tag serves to give credit to
reviewers and to inform maintainers of the degree of review which has been
done on the patch.  Reviewed-by: tags, when supplied by reviewers known to
understand the subject area and to perform thorough reviews, will normally
increase the likelihood of your patch getting into the kernel.

Reviewd-by タグはそのパッチがカーネルに対して適切な修正であって、深刻な技術的
問題を残していないという意見の宣言です。興味のあるレビューアは誰でも(レビュー
作業を終えたら)パッチに対して Reviewed-by タグを提示できます。このタグは
レビューアの寄与をクレジットする働き、レビューの進捗の度合いをメンテナに
知らせる働きを持ちます。そのパッチの領域に詳しく、そして、しっかりとした
レビューを実施したレビューアによって提供される時、Reviewed-by: タグがあなたの
パッチをカーネルにマージする可能性を高めるでしょう。

15) The canonical patch format

15) 標準的なパッチのフォーマット

The canonical patch subject line is:

標準的なパッチのサブジェクトは以下のとおりです。

    Subject: [PATCH 001/123] subsystem: summary phrase

The canonical patch message body contains the following:

標準的なパッチの、電子メールのボディは以下の項目を含んでいます。

  - A "from" line specifying the patch author.

  - パッチの作成者を明記する「 from 」行

  - An empty line.

  - 空行

  - The body of the explanation, which will be copied to the
    permanent changelog to describe this patch.

  - 説明本体。これはこのパッチを説明するために無期限のチェンジログ
    (変更履歴)にコピーされます。

  - The "Signed-off-by:" lines, described above, which will
    also go in the changelog.

    上述した「 Signed-off-by: 」行。これも説明本体と同じくチェン
    ジログ内にコピーされます。

  - A marker line containing simply "---".

  - マーカー行は単純に「 --- 」です。

  - Any additional comments not suitable for the changelog.

  - 余計なコメントは、チェンジログには不適切です。

  - The actual patch (diff output).

  - 実際のパッチ(差分出力)

The Subject line format makes it very easy to sort the emails
alphabetically by subject line - pretty much any email reader will
support that - since because the sequence number is zero-padded,
the numerical and alphabetic sort is the same.

サブジェクト行のフォーマットは、アルファベット順で電子メールをとても
ソートしやすいものになっています。(ほとんどの電子メールクライアント
はソートをサポートしています)パッチのサブジェクトの連番は0詰めであ
るため、数字でのソートとアルファベットでのソートは同じ結果になります。

The "subsystem" in the email's Subject should identify which
area or subsystem of the kernel is being patched.

電子メールのサブジェクト内のサブシステム表記は、パッチが適用される
分野またはサブシステムを識別できるようにすべきです。

The "summary phrase" in the email's Subject should concisely
describe the patch which that email contains.  The "summary
phrase" should not be a filename.  Do not use the same "summary
phrase" for every patch in a whole patch series (where a "patch
series" is an ordered sequence of multiple, related patches).

電子メールのサブジェクトの「summary phrase」はそのパッチの概要を正確
に表現しなければなりません。「summary phrase」をファイル名にしてはい
けません。パッチシリーズ中でそれぞれのパッチは同じ「summary phrase」を
使ってはいけません(「パッチシリーズ」とは順序付けられた関連のある複数の
パッチ群です)。

Bear in mind that the "summary phrase" of your email becomes a
globally-unique identifier for that patch.  It propagates all the way
into the git changelog.  The "summary phrase" may later be used in
developer discussions which refer to the patch.  People will want to
google for the "summary phrase" to read discussion regarding that
patch.  It will also be the only thing that people may quickly see
when, two or three months later, they are going through perhaps
thousands of patches using tools such as "gitk" or "git log
--oneline".

あなたの電子メールの「summary phrase」がそのパッチにとって世界で唯一の識別子に
なるように心がけてください。「summary phrase」は git のチェンジログの中へ
ずっと伝播していきます。「summary phrase」は、開発者が後でパッチを参照する
ために議論の中で利用するかもしれません。
人々はそのパッチに関連した議論を読むために「summary phrase」を使って google で
検索したがるでしょう。それはまた2、3ヶ月あとで、人々が「gitk」や
「git log --oneline」のようなツールを使用して何千ものパッチに目を通す時、
唯一目にとまる情報となるでしょう。

For these reasons, the "summary" must be no more than 70-75
characters, and it must describe both what the patch changes, as well
as why the patch might be necessary.  It is challenging to be both
succinct and descriptive, but that is what a well-written summary
should do.

これらの理由のため、「summary phrase」はなぜパッチが必要であるか、パッチが何を
変更するかの2つの情報をせいぜい70〜75文字で表現していなければなりません。
「summary phrase」は簡潔であり説明的である表現を目指しつつ、うまく
まとめられている概要となるべきです。

The "summary phrase" may be prefixed by tags enclosed in square
brackets: "Subject: [PATCH tag] <summary phrase>".  The tags are not
considered part of the summary phrase, but describe how the patch
should be treated.  Common tags might include a version descriptor if
the multiple versions of the patch have been sent out in response to
comments (i.e., "v1, v2, v3"), or "RFC" to indicate a request for
comments.  If there are four patches in a patch series the individual
patches may be numbered like this: 1/4, 2/4, 3/4, 4/4.  This assures
that developers understand the order in which the patches should be
applied and that they have reviewed or applied all of the patches in
the patch series.

「summary phrase」は「Subject: [PATCH tag] <summary phrase>」のように、
大括弧で閉じられたタグを接頭辞として付加してもかまいません。このタグは
「summary phrase」の一部とは考えませんが、パッチをどのように取り扱うべきかを
表現します。
一般的には「v1, v2, v3」のようなバージョン情報を表すタグ(過去のパッチに対する
コメントを反映するために複数のバージョンのパッチが投稿されているのであれば)、
「RFC」のようなコメントを要求するタグが挙げられます。パッチシリーズとして4つの
パッチがあれば、個々のパッチに「1/4, 2/4, 3/4, 4/4」のように番号を付けても
かまいません。これは開発者がパッチを適用する順番を確実に把握するためです。
そして、開発者がパッチシリーズの中のすべてのパッチをもらさずレビュー或いは
適用するのを保証するためです。

A couple of example Subjects:

サブジェクトの例を二つ

    Subject: [patch 2/5] ext2: improve scalability of bitmap searching
    Subject: [PATCHv2 001/207] x86: fix eflags tracking

The "from" line must be the very first line in the message body,
and has the form:

「 from 」行は電子メールのボディの一番最初の行でなければなりません。
その形式は以下のとおりです。

        From: Original Author <author@example.com>

The "from" line specifies who will be credited as the author of the
patch in the permanent changelog.  If the "from" line is missing,
then the "From:" line from the email header will be used to determine
the patch author in the changelog.

「 from 」行はチェンジログの中で、そのパッチの作成者としてクレジットされ
ている人を特定するものです。「 from 」行がかけていると、電子メールのヘッ
ダーの「 From: 」が、チェンジログの中でパッチの作成者を決定するために使わ
れるでしょう。

The explanation body will be committed to the permanent source
changelog, so should make sense to a competent reader who has long
since forgotten the immediate details of the discussion that might
have led to this patch.  Including symptoms of the failure which the
patch addresses (kernel log messages, oops messages, etc.) is
especially useful for people who might be searching the commit logs
looking for the applicable patch.  If a patch fixes a compile failure,
it may not be necessary to include _all_ of the compile failures; just
enough that it is likely that someone searching for the patch can find
it.  As in the "summary phrase", it is important to be both succinct as
well as descriptive.

説明本体は無期限のソースのチェンジログにコミットされます。なので、説明
本体はそのパッチに至った議論の詳細を忘れているある程度の技量を持っている人
がその詳細を思い出すことができるものでなければなりません。パッチが対処する
障害の症状(カーネルログメッセージや oops メッセージ等)を記載することは問題に
対処可能なパッチを求めてコミットログを検索する人々にとって特に有用です。
パッチがコンパイル問題を解決するのであれば、そのパッチを探している人が見つける
ことができる情報だけで十分であり、コンパイル時の全てのエラーを含める必要は
ありません。「summary phrase」と同様に、簡潔であり説明的であることが重要です。

The "---" marker line serves the essential purpose of marking for patch
handling tools where the changelog message ends.

「 --- 」マーカー行はパッチ処理ツールに対して、チェンジログメッセージの終端
部分を認識させるという重要な役目を果たします。

One good use for the additional comments after the "---" marker is for
a diffstat, to show what files have changed, and the number of
inserted and deleted lines per file.  A diffstat is especially useful
on bigger patches.  Other comments relevant only to the moment or the
maintainer, not suitable for the permanent changelog, should also go
here.  A good example of such comments might be "patch changelogs"
which describe what has changed between the v1 and v2 version of the
patch.

「 --- 」マーカー行の後の追加コメントの良い使用方法の1つに diffstat コマンド
があります。diffstat コマンドとは何のファイルが変更され、1ファイル当たり何行
追加され何行消されたかを示すものです。diffstat コマンドは特に大きなパッチに
おいて役立ちます。その時点でだけ又はメンテナにとってのみ関係のあるコメント
は無期限に保存されるチェンジログにとって適切ではありません。そのため、この
ようなコメントもマーカー行の後に書かれるべきです。

このようなコメントの良い例として、v1 と v2 のバージョン間で何が変更されたかを
表す「パッチの変更履歴」が挙げられます。

If you are going to include a diffstat after the "---" marker, please
use diffstat options "-p 1 -w 70" so that filenames are listed from
the top of the kernel source tree and don't use too much horizontal
space (easily fit in 80 columns, maybe with some indentation).

「 --- 」マーカー行の後に diffstat コマンドの結果を含めるのであれば、ファイル
名はカーネルソースツリーのトップディレクトリからの表記で列記されるため、横方向
のスペースをとり過ぎないように、diffstat コマンドにオプション「 -p 1 -w 70 」
を指定してください(インデントを含めてちょうど80列に合うでしょう)。

See more details on the proper patch format in the following
references.

適切なパッチのフォーマットの詳細についてはセクション3の参考文献を参照して
ください。

16) Sending "git pull" requests  (from Linus emails)

16) 「git pull」要求の送り方(Linus の電子メールから)

Please write the git repo address and branch name alone on the same line
so that I can't even by mistake pull from the wrong branch, and so
that a triple-click just selects the whole thing.

間違ったブランチから引っ張るのを防ぐために、git リポジトリのアドレスと
ブランチ名を同じ行に1行で記載してください。そうすることで、3回の連続クリック
で全て選択できます。

So the proper format is something along the lines of:

正しい形式は下記の通りです。

       "Please pull from

               git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus

        to get these changes:"


so that I don't have to hunt-and-peck for the address and inevitably
get it wrong (actually, I've only gotten it wrong a few times, and
checking against the diffstat tells me when I get it wrong, but I'm
just a lot more comfortable when I don't have to "look for" the right
thing to pull, and double-check that I have the right branch-name).

その結果、アドレスを自分自身でタイピングして間違えることはなくなります(実際に、
何度か間違ったブランチから引っ張ってきてしまい、その時に diffstat の結果を
検証して間違っていることに気づいたことがあります。どこから何を引っ張るべきかを
「探したり」、正しいブランチ名かどうかを重ねてチェックしたりする必要が
なくなればより快適になるでしょう)。

Please use "git diff -M --stat --summary" to generate the diffstat:
the -M enables rename detection, and the summary enables a summary of
new/deleted or renamed files.

diffstat の結果を生成するために「 git diff -M --stat --summary 」を使って
ください。-M オプションはファイル名の変更を検知でき、--summary オプションは
新規ファイル、削除されたファイル、名前が変更されたファイルの概要を生成します。

With rename detection, the statistics are rather different [...]
because git will notice that a fair number of the changes are renames.

-M オプション(ファイル名の変更検知)を指定すると、diffstat の結果はかなり
異なってきます。git は大規模な変更(追加と削除のペア)をファイル名の変更と
判断するためです。

-----------------------------------
SECTION 2 - HINTS, TIPS, AND TRICKS
-----------------------------------

------------------------------------
セクション2 - ヒントとTIPSと小技
------------------------------------

This section lists many of the common "rules" associated with code
submitted to the kernel.  There are always exceptions... but you must
have a really good reason for doing so.  You could probably call this
section Linus Computer Science 101.

このセクションは Linux カーネルに変更を適用することに関係のある一般的な
「お約束」の多くを載せています。物事には例外というものがあります。しか
し例外を適用するには、本当に妥当な理由が不可欠です。あなたは恐らくこの
セクションを Linus のコンピュータ・サイエンス101と呼ぶでしょう。

1) Read Documentation/CodingStyle

1) Documentation/CodingStyleを参照

Nuff said.  If your code deviates too much from this, it is likely
to be rejected without further review, and without comment.

言うまでもなく、あなたのコードがこのコーディングスタイルからあまりに
も逸脱していると、レビューやコメントなしに受け取ってもらえないかもし
れません。

One significant exception is when moving code from one file to
another -- in this case you should not modify the moved code at all in
the same patch which moves it.  This clearly delineates the act of
moving the code and your changes.  This greatly aids review of the
actual differences and allows tools to better track the history of
the code itself.

特筆すべき例外は、コードをあるファイルから別のファイルに移動
するときです。この場合、コードを移動するパッチでは、移動されるコード
に関して移動以外の変更を一切加えるべきではありません。これにより、
コードの移動とあなたが行ったコードの修正を明確に区別できるようにな
ります。これは実際に何が変更されたかをレビューする際の大きな助けに
なるとともに、ツールにコードの履歴を追跡させることも容易になります。

Check your patches with the patch style checker prior to submission
(scripts/checkpatch.pl).  The style checker should be viewed as
a guide not as the final word.  If your code looks better with
a violation then its probably best left alone.

投稿するより前にパッチのスタイルチェッカー( scripts/checkpatch.pl )で
あなたのパッチをチェックしてください。このスタイルチェッカーは最終結
論としてではなく、指標としてみるべきです。もし、あなたのコードが違反
はしているが修正するより良く見えるのであれば、おそらくそのままにする
のがベストです。

The checker reports at three levels:
 - ERROR: things that are very likely to be wrong
 - WARNING: things requiring careful review
 - CHECK: things requiring thought

スタイルチェッカーによる3段階のレポート:
 - エラー: 間違っている可能性が高い
 - 警告:注意してレビューする必要がある
 - チェック:考慮する必要がある

You should be able to justify all violations that remain in your
patch.

あなたはパッチに残っている全ての違反について、それがなぜ必要なのか正当な
理由を示せるようにしておく必要があります。

2) #ifdefs are ugly

2) #ifdefは見苦しい

Code cluttered with ifdefs is difficult to read and maintain.  Don't do
it.  Instead, put your ifdefs in a header, and conditionally define
'static inline' functions, or macros, which are used in the code.
Let the compiler optimize away the "no-op" case.

ifdef が散乱したコードは、読むのもメンテナンスするのも面倒です。コードの中
で ifdef を使わないでください。代わりに、ヘッダファイルの中に ifdef を入れて、
条件付きで、コードの中で使われる関数を「 static inline 」関数かマクロで定義し
てください。後はコンパイラが、何もしない箇所を最適化して取り去ってくれるで
しょう。

Simple example, of poor code:

まずいコードの簡単な例

	dev = alloc_etherdev (sizeof(struct funky_private));
	if (!dev)
		return -ENODEV;
	#ifdef CONFIG_NET_FUNKINESS
	init_funky_net(dev);
	#endif

Cleaned-up example:

クリーンアップしたコードの例

(in header)
	#ifndef CONFIG_NET_FUNKINESS
	static inline void init_funky_net (struct net_device *d) {}
	#endif

(in the code itself)
	dev = alloc_etherdev (sizeof(struct funky_private));
	if (!dev)
		return -ENODEV;
	init_funky_net(dev);

3) 'static inline' is better than a macro

3) マクロより「 static inline 」を推奨

Static inline functions are greatly preferred over macros.
They provide type safety, have no length limitations, no formatting
limitations, and under gcc they are as cheap as macros.

「 static inline 」関数はマクロよりもずっと推奨されています。それらは、
型安全性があり、長さにも制限が無く、フォーマットの制限もありません。
gcc においては、マクロと同じくらい軽いです。

Macros should only be used for cases where a static inline is clearly
suboptimal [there are a few, isolated cases of this in fast paths],
or where it is impossible to use a static inline function [such as
string-izing].

マクロは「 static inline 」が明らかに不適切であると分かる場所(高速化パスの
いくつかの特定のケース)や「 static inline 」関数を使うことができないような
場所(マクロの引数の文字列連結のような)にだけ使われるべきです。

'static inline' is preferred over 'static __inline__', 'extern inline',
and 'extern __inline__'.

「 static inline 」は「 static __inline__ 」や「 extern inline 」や
「 extern __inline__ 」よりも適切です。

4) Don't over-design.

4) 設計に凝りすぎるな

Don't try to anticipate nebulous future cases which may or may not
be useful:  "Make it as simple as you can, and no simpler."

それが有用になるかどうか分からないような不明瞭な将来を見越した設計
をしないでください。「できる限り簡単に、そして、それ以上簡単になら
ないような設計をしてください。」

----------------------
SECTION 3 - REFERENCES
----------------------

----------------------
セクション3 参考文献
----------------------

Andrew Morton, "The perfect patch" (tpp).
  <http://userweb.kernel.org/~akpm/stuff/tpp.txt>

Jeff Garzik, "Linux kernel patch submission format".
  <http://linux.yyz.us/patch-format.html>

Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer".
  <http://www.kroah.com/log/2005/03/31/>
  <http://www.kroah.com/log/2005/07/08/>
  <http://www.kroah.com/log/2005/10/19/>
  <http://www.kroah.com/log/2006/01/11/>

NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people!
  <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2>

Kernel Documentation/CodingStyle:
  <http://users.sosdg.org/~qiyong/lxr/source/Documentation/CodingStyle>

Linus Torvalds's mail on the canonical patch format:
  <http://lkml.org/lkml/2005/4/7/183>

Andi Kleen, "On submitting kernel patches"
  Some strategies to get difficult or controversial changes in.
  http://halobates.de/on-submitting-patches.pdf

--

お名前 ( )
コメント

コメントが長くなった場合は、jf@listserv.linux.or.jp にお寄せください。

JF Wiki トップページへ戻る