18c2ecf20Sopenharmony_ciNOTE: 28c2ecf20Sopenharmony_ciThis is a version of Documentation/process/submitting-patches.rst into Japanese. 38c2ecf20Sopenharmony_ciThis document is maintained by Keiichi KII <k-keiichi@bx.jp.nec.com> 48c2ecf20Sopenharmony_ciand the JF Project team <http://www.linux.or.jp/JF/>. 58c2ecf20Sopenharmony_ciIf you find any difference between this document and the original file 68c2ecf20Sopenharmony_cior a problem with the translation, 78c2ecf20Sopenharmony_ciplease contact the maintainer of this file or JF project. 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciPlease also note that the purpose of this file is to be easier to read 108c2ecf20Sopenharmony_cifor non English (read: Japanese) speakers and is not intended as a 118c2ecf20Sopenharmony_cifork. So if you have any comments or updates of this file, please try 128c2ecf20Sopenharmony_cito update the original English file first. 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciLast Updated: 2011/06/09 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci================================== 178c2ecf20Sopenharmony_ciこれは、 188c2ecf20Sopenharmony_cilinux-2.6.39/Documentation/process/submitting-patches.rst の和訳 198c2ecf20Sopenharmony_ciです。 208c2ecf20Sopenharmony_ci翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > 218c2ecf20Sopenharmony_ci翻訳日: 2011/06/09 228c2ecf20Sopenharmony_ci翻訳者: Keiichi Kii <k-keiichi at bx dot jp dot nec dot com> 238c2ecf20Sopenharmony_ci校正者: Masanari Kobayashi さん <zap03216 at nifty dot ne dot jp> 248c2ecf20Sopenharmony_ci Matsukura さん <nbh--mats at nifty dot com> 258c2ecf20Sopenharmony_ci Takeshi Hamasaki さん <hmatrjp at users dot sourceforge dot jp> 268c2ecf20Sopenharmony_ci================================== 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci Linux カーネルに変更を加えるための Howto 298c2ecf20Sopenharmony_ci 又は 308c2ecf20Sopenharmony_ci かの Linus Torvalds の取り扱い説明書 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciLinux カーネルに変更を加えたいと思っている個人又は会社にとって、パッ 338c2ecf20Sopenharmony_ciチの投稿に関連した仕組みに慣れていなければ、その過程は時々みなさんを 348c2ecf20Sopenharmony_ciおじけづかせることもあります。この文章はあなたの変更を大いに受け入れ 358c2ecf20Sopenharmony_ciてもらえやすくする提案を集めたものです。 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciコードを投稿する前に、Documentation/process/submit-checklist.rst の項目リストに目 388c2ecf20Sopenharmony_ciを通してチェックしてください。もしあなたがドライバーを投稿しようとし 398c2ecf20Sopenharmony_ciているなら、Documentation/process/submitting-drivers.rst にも目を通してください。 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci-------------------------------------------- 428c2ecf20Sopenharmony_ciセクション1 パッチの作り方と送り方 438c2ecf20Sopenharmony_ci-------------------------------------------- 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci1) 「 diff -up 」 468c2ecf20Sopenharmony_ci------------ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ciパッチの作成には「 diff -up 」又は「 diff -uprN 」を使ってください。 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciLinux カーネルに対する全ての変更は diff(1) コマンドによるパッチの形式で 518c2ecf20Sopenharmony_ci生成してください。パッチを作成するときには、diff(1) コマンドに「 -u 」引 528c2ecf20Sopenharmony_ci数を指定して、unified 形式のパッチを作成することを確認してください。また、 538c2ecf20Sopenharmony_ci変更がどの C 関数で行われたのかを表示する「 -p 」引数を使ってください。 548c2ecf20Sopenharmony_ciこの引数は生成した差分をずっと読みやすくしてくれます。パッチは Linux 558c2ecf20Sopenharmony_ciカーネルソースの中のサブディレクトリではなく Linux カーネルソースのルート 568c2ecf20Sopenharmony_ciディレクトリを基準にしないといけません。 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci1個のファイルについてのパッチを作成するためには、ほとんどの場合、 598c2ecf20Sopenharmony_ci以下の作業を行えば十分です。 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci SRCTREE=linux-2.6 628c2ecf20Sopenharmony_ci MYFILE=drivers/net/mydriver.c 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci cd $SRCTREE 658c2ecf20Sopenharmony_ci cp $MYFILE $MYFILE.orig 668c2ecf20Sopenharmony_ci vi $MYFILE # make your change 678c2ecf20Sopenharmony_ci cd .. 688c2ecf20Sopenharmony_ci diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci複数のファイルについてのパッチを作成するためには、素の( vanilla )、す 718c2ecf20Sopenharmony_ciなわち変更を加えてない Linux カーネルを展開し、自分の Linux カーネル 728c2ecf20Sopenharmony_ciソースとの差分を生成しないといけません。例えば、 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci MYSRC=/devel/linux-2.6 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci tar xvfz linux-2.6.12.tar.gz 778c2ecf20Sopenharmony_ci mv linux-2.6.12 linux-2.6.12-vanilla 788c2ecf20Sopenharmony_ci diff -uprN -X linux-2.6.12-vanilla/Documentation/dontdiff \ 798c2ecf20Sopenharmony_ci linux-2.6.12-vanilla $MYSRC > /tmp/patch 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_cidontdiff ファイルには Linux カーネルのビルドプロセスの過程で生成された 828c2ecf20Sopenharmony_ciファイルの一覧がのっています。そして、それらはパッチを生成する diff(1) 838c2ecf20Sopenharmony_ciコマンドで無視されるべきです。dontdiff ファイルは 2.6.12 以後のバージョ 848c2ecf20Sopenharmony_ciンの Linux カーネルソースツリーに含まれています。それより前のバージョン 858c2ecf20Sopenharmony_ciの Linux カーネルソースツリーに対する dontdiff ファイルは、 868c2ecf20Sopenharmony_ci<http://www.xenotime.net/linux/doc/dontdiff>から取得することができます。 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci投稿するパッチの中に関係のない余分なファイルが含まれていないことを確 898c2ecf20Sopenharmony_ci認してください。diff(1) コマンドで生成したパッチがあなたの意図したとお 908c2ecf20Sopenharmony_ciりのものであることを確認してください。 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ciもしあなたのパッチが多くの差分を生み出すのであれば、あなたはパッチ 938c2ecf20Sopenharmony_ciを意味のあるひとまとまりごとに分けたいと思うかもしれません。 948c2ecf20Sopenharmony_ciこれは他のカーネル開発者にとってレビューしやすくなるので、あなたの 958c2ecf20Sopenharmony_ciパッチを受け入れてもらうためにはとても重要なことです。これを補助でき 968c2ecf20Sopenharmony_ciる多くのスクリプトがあります。 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ciQuilt: 998c2ecf20Sopenharmony_cihttp://savannah.nongnu.org/projects/quilt 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci2) パッチに対する説明 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ciパッチの中の変更点に対する技術的な詳細について説明してください。 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci説明はできる限り具体的に。もっとも悪い説明は「ドライバー X を更新」、 1068c2ecf20Sopenharmony_ci「ドライバー X に対するバグフィックス」あるいは「このパッチはサブシス 1078c2ecf20Sopenharmony_ciテム X に対する更新を含んでいます。どうか取り入れてください。」などです。 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ciパッチの説明を Linux カーネルのソースコードマネジメントシステム「 git 」の 1108c2ecf20Sopenharmony_ciコミットログとして簡単に引用できる形で書けば、メンテナから感謝されるでしょう。 1118c2ecf20Sopenharmony_ci以下の #15 を見てください。 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci説明が長くなりだしたのであれば、おそらくそれはパッチを分ける必要がある 1148c2ecf20Sopenharmony_ciという兆候です。次の #3 を見てください。 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ciパッチ(シリーズ)を(再)投稿する時、十分なパッチの説明とそのパッチが必要な理由を 1178c2ecf20Sopenharmony_ciパッチに含めてください。ただ「これはパッチ(シリーズ)のバージョン N」とだけ 1188c2ecf20Sopenharmony_ci書かないでください。そして、パッチをマージする人にパッチの説明を探させそれを 1198c2ecf20Sopenharmony_ciパッチに追記させるため、過去のバージョンのパッチやそのパッチの URL を参照する 1208c2ecf20Sopenharmony_ci手間をかけさせないでください。 1218c2ecf20Sopenharmony_ciつまり、パッチシリーズとその説明は一緒にあるべきです。これはパッチをマージする 1228c2ecf20Sopenharmony_ci人、レビューする人、どちらのためにもなります。レビューする人の中には、おそらく 1238c2ecf20Sopenharmony_ci過去のバージョンのパッチを受け取ってもいない人がいます。 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci登録済みのバグエントリを修正するパッチであれば、そのバグエントリを示すバグ ID 1268c2ecf20Sopenharmony_ciや URL を明記してください。 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci3) パッチの分割 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci意味のあるひとまとまりごとに変更を個々のパッチファイルに分けてください。 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci例えば、もし1つのドライバーに対するバグフィックスとパフォーマンス強 1338c2ecf20Sopenharmony_ci化の両方の変更を含んでいるのであれば、その変更を2つ以上のパッチに分 1348c2ecf20Sopenharmony_ciけてください。もし変更箇所に API の更新と、その新しい API を使う新たな 1358c2ecf20Sopenharmony_ciドライバーが含まれているなら、2つのパッチに分けてください。 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci一方で、もしあなたが多数のファイルに対して意味的に同じ1つの変更を加え 1388c2ecf20Sopenharmony_ciるのであれば、その変更を1つのパッチにまとめてください。言いかえると、 1398c2ecf20Sopenharmony_ci意味的に同じ1つの変更は1つのパッチの中に含まれます。 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ciあるパッチが変更を完結させるために他のパッチに依存していたとしても、 1428c2ecf20Sopenharmony_ciそれは問題ありません。パッチの説明の中で「このパッチはパッチ X に依存 1438c2ecf20Sopenharmony_ciしている」と簡単に注意書きをつけてください。 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ciもしパッチをより小さなパッチの集合に凝縮することができないなら、まずは 1468c2ecf20Sopenharmony_ci15かそこらのパッチを送り、そのレビューと統合を待って下さい。 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci4) パッチのスタイルチェック 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ciあなたのパッチが基本的な( Linux カーネルの)コーディングスタイルに違反し 1518c2ecf20Sopenharmony_ciていないかをチェックして下さい。その詳細を Documentation/process/coding-style.rst で 1528c2ecf20Sopenharmony_ci見つけることができます。コーディングスタイルの違反はレビューする人の 1538c2ecf20Sopenharmony_ci時間を無駄にするだけなので、恐らくあなたのパッチは読まれることすらなく 1548c2ecf20Sopenharmony_ci拒否されるでしょう。 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ciあなたはパッチを投稿する前に最低限パッチスタイルチェッカー 1578c2ecf20Sopenharmony_ci( scripts/checkpatch.pl )を利用してパッチをチェックすべきです。 1588c2ecf20Sopenharmony_ciもしパッチに違反がのこっているならば、それらの全てについてあなたは正当な 1598c2ecf20Sopenharmony_ci理由を示せるようにしておく必要があります。 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci5) 電子メールの宛先の選び方 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ciMAINTAINERS ファイルとソースコードに目を通してください。そして、その変 1648c2ecf20Sopenharmony_ci更がメンテナのいる特定のサブシステムに加えられるものであることが分か 1658c2ecf20Sopenharmony_ciれば、その人に電子メールを送ってください。 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ciもし、メンテナが載っていなかったり、メンテナからの応答がないなら、 1688c2ecf20Sopenharmony_ciLKML ( linux-kernel@vger.kernel.org )へパッチを送ってください。ほとんど 1698c2ecf20Sopenharmony_ciのカーネル開発者はこのメーリングリストに目を通しており、変更に対して 1708c2ecf20Sopenharmony_ciコメントを得ることができます。 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci15個より多くのパッチを同時に vger.kernel.org のメーリングリストへ送らな 1738c2ecf20Sopenharmony_ciいでください!!! 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ciLinus Torvalds は Linux カーネルに入る全ての変更に対する最終的な意思決定者 1768c2ecf20Sopenharmony_ciです。電子メールアドレスは torvalds@linux-foundation.org になります。彼は 1778c2ecf20Sopenharmony_ci多くの電子メールを受け取っているため、できる限り彼に電子メールを送るのは 1788c2ecf20Sopenharmony_ci避けるべきです。 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ciバグフィックスであったり、自明な変更であったり、話し合いをほとんど 1818c2ecf20Sopenharmony_ci必要としないパッチは Linus へ電子メールを送るか CC しなければなりません。 1828c2ecf20Sopenharmony_ci話し合いを必要としたり、明確なアドバンテージがないパッチは、通常まず 1838c2ecf20Sopenharmony_ciは LKML へ送られるべきです。パッチが議論された後にだけ、そのパッチを 1848c2ecf20Sopenharmony_ciLinus へ送るべきです。 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci6) CC (カーボンコピー)先の選び方 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci特に理由がないなら、LKML にも CC してください。 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ciLinus 以外のカーネル開発者は変更に気づく必要があり、その結果、彼らはそ 1918c2ecf20Sopenharmony_ciの変更に対してコメントをくれたり、コードに対してレビューや提案をくれ 1928c2ecf20Sopenharmony_ciるかもしれません。LKML とは Linux カーネル開発者にとって一番中心的なメー 1938c2ecf20Sopenharmony_ciリングリストです。USB やフレームバッファデバイスや VFS や SCSI サブシステ 1948c2ecf20Sopenharmony_ciムなどの特定のサブシステムに関するメーリングリストもあります。あなた 1958c2ecf20Sopenharmony_ciの変更に、はっきりと関連のあるメーリングリストについて知りたければ 1968c2ecf20Sopenharmony_ciMAINTAINERS ファイルを参照してください。 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ciVGER.KERNEL.ORG でホスティングされているメーリングリストの一覧が下記の 1998c2ecf20Sopenharmony_ciサイトに載っています。 2008c2ecf20Sopenharmony_ci<http://vger.kernel.org/vger-lists.html> 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ciもし、変更がユーザランドのカーネルインタフェースに影響を与え 2038c2ecf20Sopenharmony_ciるのであれば、MAN-PAGES のメンテナ( MAINTAINERS ファイルに一覧 2048c2ecf20Sopenharmony_ciがあります)に man ページのパッチを送ってください。少なくとも 2058c2ecf20Sopenharmony_ci情報がマニュアルページの中に入ってくるように、変更が起きたという 2068c2ecf20Sopenharmony_ci通知を送ってください。 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ciたとえ、メンテナが #5 で反応がなかったとしても、メンテナのコードに変更を 2098c2ecf20Sopenharmony_ci加えたときには、いつもメンテナに CC するのを忘れないようにしてください。 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci小さなパッチであれば、Trivial Patch Monkey(ちょっとしたパッチを集めている) 2128c2ecf20Sopenharmony_ci<trivial@kernel.org>に CC してもいいです。その現管理者については MAINTAINERS 2138c2ecf20Sopenharmony_ciファイルを見てください。ちょっとしたパッチとは以下のルールのどれか1つを満たして 2148c2ecf20Sopenharmony_ciいなければなりません。 2158c2ecf20Sopenharmony_ci ・ドキュメントのスペルミスの修正 2168c2ecf20Sopenharmony_ci ・grep(1) コマンドによる検索を困難にしているスペルの修正 2178c2ecf20Sopenharmony_ci ・コンパイル時の警告の修正(無駄な警告が散乱することは好ましくないた 2188c2ecf20Sopenharmony_ci めです) 2198c2ecf20Sopenharmony_ci ・コンパイル問題の修正(それらの修正が本当に正しい場合に限る) 2208c2ecf20Sopenharmony_ci ・実行時の問題の修正(それらの修正が本当に問題を修正している場合に限る) 2218c2ecf20Sopenharmony_ci ・廃止予定の関数やマクロを使用しているコードの除去(例 check_region ) 2228c2ecf20Sopenharmony_ci ・問い合わせ先やドキュメントの修正 2238c2ecf20Sopenharmony_ci ・移植性のないコードから移植性のあるコードへの置き換え(小さい範囲で 2248c2ecf20Sopenharmony_ci あればアーキテクチャ特有のことでも他の人がコピーできます) 2258c2ecf20Sopenharmony_ci ・作者やメンテナによる修正(すなわち patch monkey の再転送モード) 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci7) MIME やリンクや圧縮ファイルや添付ファイルではなくプレインテキストのみ 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ciLinus や他のカーネル開発者はあなたが投稿した変更を読んで、コメントでき 2308c2ecf20Sopenharmony_ciる必要があります。カーネル開発者にとって、あなたが書いたコードの特定の 2318c2ecf20Sopenharmony_ci部分にコメントをするために、標準的な電子メールクライアントで変更が引用 2328c2ecf20Sopenharmony_ciできることは重要です。 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci上記の理由で、すべてのパッチは文中に含める形式の電子メールで投稿さ 2358c2ecf20Sopenharmony_ciれるべきです。警告:あなたがパッチをコピー&ペーストする際には、パッ 2368c2ecf20Sopenharmony_ciチを改悪するエディターの折り返し機能に注意してください。 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ciパッチを圧縮の有無に関わらず MIME 形式で添付しないでください。多くのポ 2398c2ecf20Sopenharmony_ciピュラーな電子メールクライアントは MIME 形式の添付ファイルをプレーンテ 2408c2ecf20Sopenharmony_ciキストとして送信するとは限らないでしょう。そうなると、電子メールクラ 2418c2ecf20Sopenharmony_ciイアントがコードに対するコメントを付けることをできなくします。また、 2428c2ecf20Sopenharmony_ciMIME 形式の添付ファイルは Linus に手間を取らせることになり、その変更を 2438c2ecf20Sopenharmony_ci受け入れてもらう可能性が低くなってしまいます。 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci例外:お使いの電子メールクライアントがパッチをめちゃくちゃにするので 2468c2ecf20Sopenharmony_ciあれば、誰かが MIME 形式のパッチを再送するよう求めるかもしれません。 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci余計な変更を加えずにあなたのパッチを送信するための電子メールクライアントの設定 2498c2ecf20Sopenharmony_ciのヒントについては Documentation/process/email-clients.rst を参照してください。 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci8) 電子メールのサイズ 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ciパッチを Linus へ送るときは常に #7 の手順に従ってください。 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci大きなパッチはメーリングリストやメンテナにとって不親切です。パッチが 2568c2ecf20Sopenharmony_ci未圧縮で 300KB を超えるようであるなら、インターネット上のアクセス可能な 2578c2ecf20Sopenharmony_ciサーバに保存し、保存場所を示す URL を伝えるほうが適切です。 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci9) カーネルバージョンの明記 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ciパッチが対象とするカーネルのバージョンをパッチの概要か電子メールの 2628c2ecf20Sopenharmony_ciサブジェクトに付けることが重要です。 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ciパッチが最新バージョンのカーネルに正しく適用できなければ、Linus は 2658c2ecf20Sopenharmony_ciそのパッチを採用しないでしょう。 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci10) がっかりせず再投稿 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ciパッチを投稿した後は、辛抱強く待っていてください。Linus があなたのパッ 2708c2ecf20Sopenharmony_ciチを気に入って採用すれば、Linus がリリースする次のバージョンのカーネル 2718c2ecf20Sopenharmony_ciの中で姿を見せるでしょう。 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ciしかし、パッチが次のバージョンのカーネルに入っていないなら、いくつもの 2748c2ecf20Sopenharmony_ci理由があるのでしょう。その原因を絞り込み、間違っているものを正し、更新 2758c2ecf20Sopenharmony_ciしたパッチを投稿するのはあなたの仕事です。 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ciLinus があなたのパッチに対して何のコメントもなく不採用にすることは極め 2788c2ecf20Sopenharmony_ciて普通のことです。それは自然な姿です。もし、Linus があなたのパッチを受 2798c2ecf20Sopenharmony_ciけ取っていないのであれば、以下の理由が考えられます。 2808c2ecf20Sopenharmony_ci* パッチが最新バージョンの Linux カーネルにきちんと適用できなかった 2818c2ecf20Sopenharmony_ci* パッチが LKML で十分に議論されていなかった 2828c2ecf20Sopenharmony_ci* スタイルの問題(セクション2を参照) 2838c2ecf20Sopenharmony_ci* 電子メールフォーマットの問題(このセクションを参照) 2848c2ecf20Sopenharmony_ci* パッチに対する技術的な問題 2858c2ecf20Sopenharmony_ci* Linus はたくさんの電子メールを受け取っているので、どさくさに紛れて見 2868c2ecf20Sopenharmony_ci 失った 2878c2ecf20Sopenharmony_ci* 不愉快にさせている 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci判断できない場合は、LKML にコメントを頼んでください。 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci11) サブジェクトに「 PATCH 」 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ciLinus や LKML への大量の電子メールのために、サブジェクトのプレフィックスに 2948c2ecf20Sopenharmony_ci「 [PATCH] 」を付けることが慣習となっています。これによって Linus や他の 2958c2ecf20Sopenharmony_ciカーネル開発者がパッチであるのか、又は、他の議論に関する電子メールであるの 2968c2ecf20Sopenharmony_ciかをより簡単に識別できます。 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci12) パッチへの署名 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci誰が何をしたのかを追いかけやすくするために (特に、パッチが何人かの 3018c2ecf20Sopenharmony_ciメンテナを経て最終的に Linux カーネルに取り込まれる場合のために)、電子 3028c2ecf20Sopenharmony_ciメールでやり取りされるパッチに対して「 sign-off 」という手続きを導入し 3038c2ecf20Sopenharmony_ciました。 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci「 sign-off 」とは、パッチがあなたの書いたものであるか、あるいは、 3068c2ecf20Sopenharmony_ciあなたがそのパッチをオープンソースとして提供する権利を保持している、 3078c2ecf20Sopenharmony_ciという証明をパッチの説明の末尾に一行記載するというものです。 3088c2ecf20Sopenharmony_ciルールはとても単純です。以下の項目を確認して下さい。 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci 原作者の証明書( DCO ) 1.1 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci このプロジェクトに寄与するものとして、以下のことを証明する。 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci (a) 本寄与は私が全体又は一部作成したものであり、私がそのファイ 3158c2ecf20Sopenharmony_ci ル中に明示されたオープンソースライセンスの下で公開する権利 3168c2ecf20Sopenharmony_ci を持っている。もしくは、 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci (b) 本寄与は、私が知る限り、適切なオープンソースライセンスでカバ 3198c2ecf20Sopenharmony_ci ーされている既存の作品を元にしている。同時に、私はそのライセ 3208c2ecf20Sopenharmony_ci ンスの下で、私が全体又は一部作成した修正物を、ファイル中で示 3218c2ecf20Sopenharmony_ci される同一のオープンソースライセンスで(異なるライセンスの下で 3228c2ecf20Sopenharmony_ci 投稿することが許可されている場合を除いて)投稿する権利を持って 3238c2ecf20Sopenharmony_ci いる。もしくは、 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci (c) 本寄与は(a)、(b)、(c)を証明する第3者から私へ直接提供された 3268c2ecf20Sopenharmony_ci ものであり、私はそれに変更を加えていない。 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci (d) 私はこのプロジェクトと本寄与が公のものであることに理解及び同意す 3298c2ecf20Sopenharmony_ci る。同時に、関与した記録(投稿の際の全ての個人情報と sign-off を 3308c2ecf20Sopenharmony_ci 含む)が無期限に保全されることと、当該プロジェクト又は関連する 3318c2ecf20Sopenharmony_ci オープンソースライセンスに沿った形で再配布されることに理解及び 3328c2ecf20Sopenharmony_ci 同意する。 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ciもしこれに同意できるなら、以下のような1行を追加してください。 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ci Signed-off-by: Random J Developer <random@developer.example.org> 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci実名を使ってください。(残念ですが、偽名や匿名による寄与はできません。) 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci人によっては sign-off の近くに追加のタグを付加しています。それらは今のところ 3418c2ecf20Sopenharmony_ci無視されますが、あなたはそのタグを社内の手続きに利用したり、sign-off に特別 3428c2ecf20Sopenharmony_ciな情報を示したりすることができます。 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_ciあなたがサブシステムまたはブランチのメンテナであれば、受け取ったパッチを自身の 3458c2ecf20Sopenharmony_ciツリーにマージするために、わずかに変更が必要となる場合があります。なぜなら 3468c2ecf20Sopenharmony_ciあなたのツリーの中のコードと投稿者のツリーの中のコードは同一ではないためです。 3478c2ecf20Sopenharmony_ciもし、あなたが厳密に上記ルール(c)にこだわるのであれば、投稿者に再度差分を 3488c2ecf20Sopenharmony_ciとるよう依頼すべきです。しかし、これは時間とエネルギーを非生産的に浪費する 3498c2ecf20Sopenharmony_ciことになります。ルール(b)はあなたにコードを修正する権利を与えてくれます。 3508c2ecf20Sopenharmony_ciしかし、投稿者のコードを修正し、その修正によるバグを投稿者に押し付けてしまう 3518c2ecf20Sopenharmony_ciことはとても失礼なことです。この問題を解決するために、末尾の投稿者の 3528c2ecf20Sopenharmony_ciSigned-off-by とあなたがその末尾に追加する Signed-off-by の間に、修正を 3538c2ecf20Sopenharmony_ci加えたことを示す1行を追加することが推奨されています。 3548c2ecf20Sopenharmony_ci(その1行の書き方に)決まりはありませんが、大括弧の中に電子メールアドレスや氏名 3558c2ecf20Sopenharmony_ciと修正内容を記載するやり方は目につきやすく、最終段階での変更の責任があなたに 3568c2ecf20Sopenharmony_ciあることを明確にするのに十分な方法のようです。例えば、 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci Signed-off-by: Random J Developer <random@developer.example.org> 3598c2ecf20Sopenharmony_ci [lucky@maintainer.example.org: struct foo moved from foo.c to foo.h] 3608c2ecf20Sopenharmony_ci Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org> 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ciあなたが安定版のブランチを管理しており、作成者のクレジット、変更の追跡、 3638c2ecf20Sopenharmony_ci修正のマージ、と同時に苦情からの投稿者の保護を行いたい場合、この慣習は特に 3648c2ecf20Sopenharmony_ci有用となります。いかなる事情があってもチェンジログに出てくる作成者の 3658c2ecf20Sopenharmony_ciアイデンティティ情報(From ヘッダ)は変更できないことに注意してください。 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ciバックポートする人のための特別な注意事項。追跡を容易に行うために、コミット 3688c2ecf20Sopenharmony_ciメッセージのトップ(サブジェクト行のすぐ後)にパッチの起源を示す情報を記述する 3698c2ecf20Sopenharmony_ciことは一般的で有用な慣習です。例えば、これは 2.6-stable ツリーでの一例です。 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci Date: Tue May 13 19:10:30 2008 +0000 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ci SCSI: libiscsi regression in 2.6.25: fix nop timer handling 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_ci commit 4cf1043593db6a337f10e006c23c69e5fc93e722 upstream 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ciそして、これは 2.4 ツリーでの一例です。 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci Date: Tue May 13 22:12:27 2008 +0200 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci wireless, airo: waitbusy() won't delay 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci [backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a] 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ciどんな形式であれ、この情報はあなたのツリーを追跡する人やあなたのツリーのバグを 3868c2ecf20Sopenharmony_ci解決しようとしている人にとって価値のある支援となります。 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_ci13) いつ Acked-by: と Cc: を使うのか 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ci「 Signed-off-by: 」タグはその署名者がパッチの開発に関わっていたことやパッチ 3918c2ecf20Sopenharmony_ciの伝播パスにいたことを示しています。 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_ciある人が直接パッチの準備や作成に関わっていないけれど、その人のパッチに対す 3948c2ecf20Sopenharmony_ciる承認を記録し、示したいとします。その場合、その人を示すのに Acked-by: が使 3958c2ecf20Sopenharmony_ciえます。Acked-by: はパッチのチェンジログにも追加されます。 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ciパッチの影響を受けるコードのメンテナがパッチに関わっていなかったり、パッチ 3988c2ecf20Sopenharmony_ciの伝播パスにいなかった時にも、メンテナは Acked-by: をしばしば利用します。 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ciAcked-by: は Signed-off-by: のように公式なタグではありません。それはメンテナが 4018c2ecf20Sopenharmony_ci少なくともパッチをレビューし、同意を示しているという記録です。そのような 4028c2ecf20Sopenharmony_ciことからパッチをマージする人がメンテナの「うん、良いと思うよ」という発言を 4038c2ecf20Sopenharmony_ciAcked-by: へ置き換えることがあります。 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ciAcked-by: が必ずしもパッチ全体の承認を示しているわけではありません。例えば、 4068c2ecf20Sopenharmony_ciあるパッチが複数のサブシステムへ影響を与えており、その中の1つのサブシステム 4078c2ecf20Sopenharmony_ciのメンテナからの Acked-by: を持っているとします。その場合、Acked-by: は通常 4088c2ecf20Sopenharmony_ciそのメンテナのコードに影響を与える一部分だけに対する承認を示しています。 4098c2ecf20Sopenharmony_ciこの点は、ご自分で判断してください。(その Acked-by: が)疑わしい場合は、 4108c2ecf20Sopenharmony_ciメーリングリストアーカイブの中の大元の議論を参照すべきです。 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_ciパッチにコメントする機会を持っていたが、その時にコメントしなかった人がいれば、 4138c2ecf20Sopenharmony_ciその人を指す「Cc:」タグを任意で追加してもかまいません。これは指定された人からの 4148c2ecf20Sopenharmony_ci明確なアクションなしに付与できる唯一のタグです。 4158c2ecf20Sopenharmony_ciこのタグはパッチに関心があると思われる人達がそのパッチの議論に含まれていたこと 4168c2ecf20Sopenharmony_ciを明文化します。 4178c2ecf20Sopenharmony_ci 4188c2ecf20Sopenharmony_ci14) Reported-by と Tested-by: と Reviewed-by: の利用 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci他の誰かによって報告された問題を修正するパッチであれば、問題報告者という寄与を 4218c2ecf20Sopenharmony_ciクレジットするために、Reported-by: タグを追加することを検討してください。 4228c2ecf20Sopenharmony_ciこまめにバグ報告者をクレジットしていくことで、うまくいけばその人たちが将来再び 4238c2ecf20Sopenharmony_ciコミュニティの力となってくれるでしょう。 4248c2ecf20Sopenharmony_ciただし、報告者の許可無くこのタグを追加しないように注意してください。特に、 4258c2ecf20Sopenharmony_ci問題が公の場で報告されていなかったのであれば。 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_ciTested-by: タグはタグで指定された人によって(ある環境下で)パッチのテストに成功 4288c2ecf20Sopenharmony_ciしていることを示します。このタグはメンテナにテストが実施済みであることを 4298c2ecf20Sopenharmony_ci知らせ、将来の関連パッチのテスト協力者を見つける方法を提供し、テスト実施者に 4308c2ecf20Sopenharmony_ci対するクレジットを保証します。 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ciReviewed-by: タグは、それとは異なり、下記のレビューア宣言の下にレビューされ、 4338c2ecf20Sopenharmony_ci受け入れ可能とみなされたパッチであることを示します。 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_ci レビューアによる監督宣言 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_ci 私は Reviewed-by: タグを提示することによって、以下のことを明言する。 4388c2ecf20Sopenharmony_ci 4398c2ecf20Sopenharmony_ci (a) 私はメインラインカーネルへの統合に向け、その妥当性及び「即応性 4408c2ecf20Sopenharmony_ci (訳注)」を検証し、技術的側面からパッチをレビュー済みである。 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_ci 訳注: 4438c2ecf20Sopenharmony_ci 「即応性」の原文は "readiness"。 4448c2ecf20Sopenharmony_ci パッチが十分な品質を持っており、メインラインカーネルへの統合を即座に 4458c2ecf20Sopenharmony_ci 行うことができる状態であるかどうかを "readiness" という単語で表現 4468c2ecf20Sopenharmony_ci している。 4478c2ecf20Sopenharmony_ci 4488c2ecf20Sopenharmony_ci (b) パッチに関するあらゆる問題、懸念、あるいは、疑問は投稿者へ伝達済み 4498c2ecf20Sopenharmony_ci である。私はそれらのコメントに対する投稿者の返答に満足している。 4508c2ecf20Sopenharmony_ci 4518c2ecf20Sopenharmony_ci (c) 投稿に伴い改良されるコードがある一方で、現時点で、私は(1)それが 4528c2ecf20Sopenharmony_ci カーネルにとって価値のある変更であること、そして、(2)統合に際して 4538c2ecf20Sopenharmony_ci 議論になり得るような問題はないものと確信している。 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_ci (d) 私はパッチをレビューし適切であると確信している一方で、あらゆる 4568c2ecf20Sopenharmony_ci 状況においてその宣言した目的や機能が正しく実現することに関して、 4578c2ecf20Sopenharmony_ci いかなる保証もしない(特にどこかで明示しない限り)。 4588c2ecf20Sopenharmony_ci 4598c2ecf20Sopenharmony_ciReviewd-by タグはそのパッチがカーネルに対して適切な修正であって、深刻な技術的 4608c2ecf20Sopenharmony_ci問題を残していないという意見の宣言です。興味のあるレビューアは誰でも(レビュー 4618c2ecf20Sopenharmony_ci作業を終えたら)パッチに対して Reviewed-by タグを提示できます。このタグは 4628c2ecf20Sopenharmony_ciレビューアの寄与をクレジットする働き、レビューの進捗の度合いをメンテナに 4638c2ecf20Sopenharmony_ci知らせる働きを持ちます。そのパッチの領域に詳しく、そして、しっかりとした 4648c2ecf20Sopenharmony_ciレビューを実施したレビューアによって提供される時、Reviewed-by: タグがあなたの 4658c2ecf20Sopenharmony_ciパッチをカーネルにマージする可能性を高めるでしょう。 4668c2ecf20Sopenharmony_ci 4678c2ecf20Sopenharmony_ci15) 標準的なパッチのフォーマット 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci標準的なパッチのサブジェクトは以下のとおりです。 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_ci Subject: [PATCH 001/123] subsystem: summary phrase 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_ci標準的なパッチの、電子メールのボディは以下の項目を含んでいます。 4748c2ecf20Sopenharmony_ci 4758c2ecf20Sopenharmony_ci - パッチの作成者を明記する「 from 」行 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_ci - 空行 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_ci - 説明本体。これはこのパッチを説明するために無期限のチェンジログ 4808c2ecf20Sopenharmony_ci (変更履歴)にコピーされます。 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_ci - 上述した「 Signed-off-by: 」行。これも説明本体と同じくチェン 4838c2ecf20Sopenharmony_ci ジログ内にコピーされます。 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_ci - マーカー行は単純に「 --- 」です。 4868c2ecf20Sopenharmony_ci 4878c2ecf20Sopenharmony_ci - 余計なコメントは、チェンジログには不適切です。 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci - 実際のパッチ(差分出力) 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_ciサブジェクト行のフォーマットは、アルファベット順で電子メールをとても 4928c2ecf20Sopenharmony_ciソートしやすいものになっています。(ほとんどの電子メールクライアント 4938c2ecf20Sopenharmony_ciはソートをサポートしています)パッチのサブジェクトの連番は0詰めであ 4948c2ecf20Sopenharmony_ciるため、数字でのソートとアルファベットでのソートは同じ結果になります。 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci電子メールのサブジェクト内のサブシステム表記は、パッチが適用される 4978c2ecf20Sopenharmony_ci分野またはサブシステムを識別できるようにすべきです。 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_ci電子メールのサブジェクトの「summary phrase」はそのパッチの概要を正確 5008c2ecf20Sopenharmony_ciに表現しなければなりません。「summary phrase」をファイル名にしてはい 5018c2ecf20Sopenharmony_ciけません。パッチシリーズ中でそれぞれのパッチは同じ「summary phrase」を 5028c2ecf20Sopenharmony_ci使ってはいけません(「パッチシリーズ」とは順序付けられた関連のある複数の 5038c2ecf20Sopenharmony_ciパッチ群です)。 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ciあなたの電子メールの「summary phrase」がそのパッチにとって世界で唯一の識別子に 5068c2ecf20Sopenharmony_ciなるように心がけてください。「summary phrase」は git のチェンジログの中へ 5078c2ecf20Sopenharmony_ciずっと伝播していきます。「summary phrase」は、開発者が後でパッチを参照する 5088c2ecf20Sopenharmony_ciために議論の中で利用するかもしれません。 5098c2ecf20Sopenharmony_ci人々はそのパッチに関連した議論を読むために「summary phrase」を使って google で 5108c2ecf20Sopenharmony_ci検索したがるでしょう。それはまた2、3ヶ月あとで、人々が「gitk」や 5118c2ecf20Sopenharmony_ci「git log --oneline」のようなツールを使用して何千ものパッチに目を通す時、 5128c2ecf20Sopenharmony_ci唯一目にとまる情報となるでしょう。 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_ciこれらの理由のため、「summary phrase」はなぜパッチが必要であるか、パッチが何を 5158c2ecf20Sopenharmony_ci変更するかの2つの情報をせいぜい70〜75文字で表現していなければなりません。 5168c2ecf20Sopenharmony_ci「summary phrase」は簡潔であり説明的である表現を目指しつつ、うまく 5178c2ecf20Sopenharmony_ciまとめられている概要となるべきです。 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci「summary phrase」は「Subject: [PATCH tag] <summary phrase>」のように、 5208c2ecf20Sopenharmony_ci大括弧で閉じられたタグを接頭辞として付加してもかまいません。このタグは 5218c2ecf20Sopenharmony_ci「summary phrase」の一部とは考えませんが、パッチをどのように取り扱うべきかを 5228c2ecf20Sopenharmony_ci表現します。 5238c2ecf20Sopenharmony_ci一般的には「v1, v2, v3」のようなバージョン情報を表すタグ(過去のパッチに対する 5248c2ecf20Sopenharmony_ciコメントを反映するために複数のバージョンのパッチが投稿されているのであれば)、 5258c2ecf20Sopenharmony_ci「RFC」のようなコメントを要求するタグが挙げられます。パッチシリーズとして4つの 5268c2ecf20Sopenharmony_ciパッチがあれば、個々のパッチに「1/4, 2/4, 3/4, 4/4」のように番号を付けても 5278c2ecf20Sopenharmony_ciかまいません。これは開発者がパッチを適用する順番を確実に把握するためです。 5288c2ecf20Sopenharmony_ciそして、開発者がパッチシリーズの中のすべてのパッチをもらさずレビュー或いは 5298c2ecf20Sopenharmony_ci適用するのを保証するためです。 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_ciサブジェクトの例を二つ 5328c2ecf20Sopenharmony_ci 5338c2ecf20Sopenharmony_ci Subject: [patch 2/5] ext2: improve scalability of bitmap searching 5348c2ecf20Sopenharmony_ci Subject: [PATCHv2 001/207] x86: fix eflags tracking 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_ci「 from 」行は電子メールのボディの一番最初の行でなければなりません。 5378c2ecf20Sopenharmony_ciその形式は以下のとおりです。 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_ci From: Original Author <author@example.com> 5408c2ecf20Sopenharmony_ci 5418c2ecf20Sopenharmony_ci「 from 」行はチェンジログの中で、そのパッチの作成者としてクレジットされ 5428c2ecf20Sopenharmony_ciている人を特定するものです。「 from 」行がかけていると、電子メールのヘッ 5438c2ecf20Sopenharmony_ciダーの「 From: 」が、チェンジログの中でパッチの作成者を決定するために使わ 5448c2ecf20Sopenharmony_ciれるでしょう。 5458c2ecf20Sopenharmony_ci 5468c2ecf20Sopenharmony_ci説明本体は無期限のソースのチェンジログにコミットされます。なので、説明 5478c2ecf20Sopenharmony_ci本体はそのパッチに至った議論の詳細を忘れているある程度の技量を持っている人 5488c2ecf20Sopenharmony_ciがその詳細を思い出すことができるものでなければなりません。パッチが対処する 5498c2ecf20Sopenharmony_ci障害の症状(カーネルログメッセージや oops メッセージ等)を記載することは問題に 5508c2ecf20Sopenharmony_ci対処可能なパッチを求めてコミットログを検索する人々にとって特に有用です。 5518c2ecf20Sopenharmony_ciパッチがコンパイル問題を解決するのであれば、そのパッチを探している人が見つける 5528c2ecf20Sopenharmony_ciことができる情報だけで十分であり、コンパイル時の全てのエラーを含める必要は 5538c2ecf20Sopenharmony_ciありません。「summary phrase」と同様に、簡潔であり説明的であることが重要です。 5548c2ecf20Sopenharmony_ci 5558c2ecf20Sopenharmony_ci「 --- 」マーカー行はパッチ処理ツールに対して、チェンジログメッセージの終端 5568c2ecf20Sopenharmony_ci部分を認識させるという重要な役目を果たします。 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci「 --- 」マーカー行の後の追加コメントの良い使用方法の1つに diffstat コマンド 5598c2ecf20Sopenharmony_ciがあります。diffstat コマンドとは何のファイルが変更され、1ファイル当たり何行 5608c2ecf20Sopenharmony_ci追加され何行消されたかを示すものです。diffstat コマンドは特に大きなパッチに 5618c2ecf20Sopenharmony_ciおいて役立ちます。その時点でだけ又はメンテナにとってのみ関係のあるコメント 5628c2ecf20Sopenharmony_ciは無期限に保存されるチェンジログにとって適切ではありません。そのため、この 5638c2ecf20Sopenharmony_ciようなコメントもマーカー行の後に書かれるべきです。 5648c2ecf20Sopenharmony_ciこのようなコメントの良い例として、v1 と v2 のバージョン間で何が変更されたかを 5658c2ecf20Sopenharmony_ci表す「パッチの変更履歴」が挙げられます。 5668c2ecf20Sopenharmony_ci 5678c2ecf20Sopenharmony_ci「 --- 」マーカー行の後に diffstat コマンドの結果を含めるのであれば、ファイル 5688c2ecf20Sopenharmony_ci名はカーネルソースツリーのトップディレクトリからの表記で列記されるため、横方向 5698c2ecf20Sopenharmony_ciのスペースをとり過ぎないように、diffstat コマンドにオプション「 -p 1 -w 70 」 5708c2ecf20Sopenharmony_ciを指定してください(インデントを含めてちょうど80列に合うでしょう)。 5718c2ecf20Sopenharmony_ci 5728c2ecf20Sopenharmony_ci適切なパッチのフォーマットの詳細についてはセクション3の参考文献を参照して 5738c2ecf20Sopenharmony_ciください。 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci16) 「git pull」要求の送り方(Linus の電子メールから) 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_ci間違ったブランチから引っ張るのを防ぐために、git リポジトリのアドレスと 5788c2ecf20Sopenharmony_ciブランチ名を同じ行に1行で記載してください。そうすることで、3回の連続クリック 5798c2ecf20Sopenharmony_ciで全て選択できます。 5808c2ecf20Sopenharmony_ci 5818c2ecf20Sopenharmony_ci正しい形式は下記の通りです。 5828c2ecf20Sopenharmony_ci 5838c2ecf20Sopenharmony_ci "Please pull from 5848c2ecf20Sopenharmony_ci 5858c2ecf20Sopenharmony_ci git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus 5868c2ecf20Sopenharmony_ci 5878c2ecf20Sopenharmony_ci to get these changes:" 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_ciその結果、アドレスを自分自身でタイピングして間違えることはなくなります(実際に、 5908c2ecf20Sopenharmony_ci何度か間違ったブランチから引っ張ってきてしまい、その時に diffstat の結果を 5918c2ecf20Sopenharmony_ci検証して間違っていることに気づいたことがあります。どこから何を引っ張るべきかを 5928c2ecf20Sopenharmony_ci「探したり」、正しいブランチ名かどうかを重ねてチェックしたりする必要が 5938c2ecf20Sopenharmony_ciなくなればより快適になるでしょう)。 5948c2ecf20Sopenharmony_ci 5958c2ecf20Sopenharmony_cidiffstat の結果を生成するために「 git diff -M --stat --summary 」を使って 5968c2ecf20Sopenharmony_ciください。-M オプションはファイル名の変更を検知でき、--summary オプションは 5978c2ecf20Sopenharmony_ci新規ファイル、削除されたファイル、名前が変更されたファイルの概要を生成します。 5988c2ecf20Sopenharmony_ci 5998c2ecf20Sopenharmony_ci-M オプション(ファイル名の変更検知)を指定すると、diffstat の結果はかなり 6008c2ecf20Sopenharmony_ci異なってきます。git は大規模な変更(追加と削除のペア)をファイル名の変更と 6018c2ecf20Sopenharmony_ci判断するためです。 6028c2ecf20Sopenharmony_ci 6038c2ecf20Sopenharmony_ci------------------------------------ 6048c2ecf20Sopenharmony_ciセクション2 - ヒントとTIPSと小技 6058c2ecf20Sopenharmony_ci------------------------------------ 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_ciこのセクションは Linux カーネルに変更を適用することに関係のある一般的な 6088c2ecf20Sopenharmony_ci「お約束」の多くを載せています。物事には例外というものがあります。しか 6098c2ecf20Sopenharmony_ciし例外を適用するには、本当に妥当な理由が不可欠です。あなたは恐らくこの 6108c2ecf20Sopenharmony_ciセクションを Linus のコンピュータ・サイエンス101と呼ぶでしょう。 6118c2ecf20Sopenharmony_ci 6128c2ecf20Sopenharmony_ci1) Documentation/process/coding-style.rstを参照 6138c2ecf20Sopenharmony_ci 6148c2ecf20Sopenharmony_ci言うまでもなく、あなたのコードがこのコーディングスタイルからあまりに 6158c2ecf20Sopenharmony_ciも逸脱していると、レビューやコメントなしに受け取ってもらえないかもし 6168c2ecf20Sopenharmony_ciれません。 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_ci特筆すべき例外は、コードをあるファイルから別のファイルに移動 6198c2ecf20Sopenharmony_ciするときです。この場合、コードを移動するパッチでは、移動されるコード 6208c2ecf20Sopenharmony_ciに関して移動以外の変更を一切加えるべきではありません。これにより、 6218c2ecf20Sopenharmony_ciコードの移動とあなたが行ったコードの修正を明確に区別できるようにな 6228c2ecf20Sopenharmony_ciります。これは実際に何が変更されたかをレビューする際の大きな助けに 6238c2ecf20Sopenharmony_ciなるとともに、ツールにコードの履歴を追跡させることも容易になります。 6248c2ecf20Sopenharmony_ci 6258c2ecf20Sopenharmony_ci投稿するより前にパッチのスタイルチェッカー( scripts/checkpatch.pl )で 6268c2ecf20Sopenharmony_ciあなたのパッチをチェックしてください。このスタイルチェッカーは最終結 6278c2ecf20Sopenharmony_ci論としてではなく、指標としてみるべきです。もし、あなたのコードが違反 6288c2ecf20Sopenharmony_ciはしているが修正するより良く見えるのであれば、おそらくそのままにする 6298c2ecf20Sopenharmony_ciのがベストです。 6308c2ecf20Sopenharmony_ci 6318c2ecf20Sopenharmony_ciスタイルチェッカーによる3段階のレポート: 6328c2ecf20Sopenharmony_ci - エラー: 間違っている可能性が高い 6338c2ecf20Sopenharmony_ci - 警告:注意してレビューする必要がある 6348c2ecf20Sopenharmony_ci - チェック:考慮する必要がある 6358c2ecf20Sopenharmony_ci 6368c2ecf20Sopenharmony_ciあなたはパッチに残っている全ての違反について、それがなぜ必要なのか正当な 6378c2ecf20Sopenharmony_ci理由を示せるようにしておく必要があります。 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ci2) #ifdefは見苦しい 6408c2ecf20Sopenharmony_ci 6418c2ecf20Sopenharmony_ciifdef が散乱したコードは、読むのもメンテナンスするのも面倒です。コードの中 6428c2ecf20Sopenharmony_ciで ifdef を使わないでください。代わりに、ヘッダファイルの中に ifdef を入れて、 6438c2ecf20Sopenharmony_ci条件付きで、コードの中で使われる関数を「 static inline 」関数かマクロで定義し 6448c2ecf20Sopenharmony_ciてください。後はコンパイラが、何もしない箇所を最適化して取り去ってくれるで 6458c2ecf20Sopenharmony_ciしょう。 6468c2ecf20Sopenharmony_ci 6478c2ecf20Sopenharmony_ciまずいコードの簡単な例 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_ci dev = alloc_etherdev (sizeof(struct funky_private)); 6508c2ecf20Sopenharmony_ci if (!dev) 6518c2ecf20Sopenharmony_ci return -ENODEV; 6528c2ecf20Sopenharmony_ci #ifdef CONFIG_NET_FUNKINESS 6538c2ecf20Sopenharmony_ci init_funky_net(dev); 6548c2ecf20Sopenharmony_ci #endif 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_ciクリーンアップしたコードの例 6578c2ecf20Sopenharmony_ci 6588c2ecf20Sopenharmony_ci(in header) 6598c2ecf20Sopenharmony_ci #ifndef CONFIG_NET_FUNKINESS 6608c2ecf20Sopenharmony_ci static inline void init_funky_net (struct net_device *d) {} 6618c2ecf20Sopenharmony_ci #endif 6628c2ecf20Sopenharmony_ci 6638c2ecf20Sopenharmony_ci(in the code itself) 6648c2ecf20Sopenharmony_ci dev = alloc_etherdev (sizeof(struct funky_private)); 6658c2ecf20Sopenharmony_ci if (!dev) 6668c2ecf20Sopenharmony_ci return -ENODEV; 6678c2ecf20Sopenharmony_ci init_funky_net(dev); 6688c2ecf20Sopenharmony_ci 6698c2ecf20Sopenharmony_ci3) マクロより「 static inline 」を推奨 6708c2ecf20Sopenharmony_ci 6718c2ecf20Sopenharmony_ci「 static inline 」関数はマクロよりもずっと推奨されています。それらは、 6728c2ecf20Sopenharmony_ci型安全性があり、長さにも制限が無く、フォーマットの制限もありません。 6738c2ecf20Sopenharmony_cigcc においては、マクロと同じくらい軽いです。 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_ciマクロは「 static inline 」が明らかに不適切であると分かる場所(高速化パスの 6768c2ecf20Sopenharmony_ciいくつかの特定のケース)や「 static inline 」関数を使うことができないような 6778c2ecf20Sopenharmony_ci場所(マクロの引数の文字列連結のような)にだけ使われるべきです。 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_ci「 static inline 」は「 static __inline__ 」や「 extern inline 」や 6808c2ecf20Sopenharmony_ci「 extern __inline__ 」よりも適切です。 6818c2ecf20Sopenharmony_ci 6828c2ecf20Sopenharmony_ci4) 設計に凝りすぎるな 6838c2ecf20Sopenharmony_ci 6848c2ecf20Sopenharmony_ciそれが有用になるかどうか分からないような不明瞭な将来を見越した設計 6858c2ecf20Sopenharmony_ciをしないでください。「できる限り簡単に、そして、それ以上簡単になら 6868c2ecf20Sopenharmony_ciないような設計をしてください。」 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_ci---------------------- 6898c2ecf20Sopenharmony_ciセクション3 参考文献 6908c2ecf20Sopenharmony_ci---------------------- 6918c2ecf20Sopenharmony_ci 6928c2ecf20Sopenharmony_ciAndrew Morton, "The perfect patch" (tpp). 6938c2ecf20Sopenharmony_ci <http://www.ozlabs.org/~akpm/stuff/tpp.txt> 6948c2ecf20Sopenharmony_ci 6958c2ecf20Sopenharmony_ciJeff Garzik, "Linux kernel patch submission format". 6968c2ecf20Sopenharmony_ci <https://web.archive.org/web/20180829112450/http://linux.yyz.us/patch-format.html> 6978c2ecf20Sopenharmony_ci 6988c2ecf20Sopenharmony_ciGreg Kroah-Hartman, "How to piss off a kernel subsystem maintainer". 6998c2ecf20Sopenharmony_ci <http://www.kroah.com/log/2005/03/31/> 7008c2ecf20Sopenharmony_ci <http://www.kroah.com/log/2005/07/08/> 7018c2ecf20Sopenharmony_ci <http://www.kroah.com/log/2005/10/19/> 7028c2ecf20Sopenharmony_ci <http://www.kroah.com/log/2006/01/11/> 7038c2ecf20Sopenharmony_ci 7048c2ecf20Sopenharmony_ciNO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! 7058c2ecf20Sopenharmony_ci <https://lkml.org/lkml/2005/7/11/336> 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_ciKernel Documentation/process/coding-style.rst: 7088c2ecf20Sopenharmony_ci <http://users.sosdg.org/~qiyong/lxr/source/Documentation/process/coding-style.rst> 7098c2ecf20Sopenharmony_ci 7108c2ecf20Sopenharmony_ciLinus Torvalds's mail on the canonical patch format: 7118c2ecf20Sopenharmony_ci <http://lkml.org/lkml/2005/4/7/183> 7128c2ecf20Sopenharmony_ci 7138c2ecf20Sopenharmony_ciAndi Kleen, "On submitting kernel patches" 7148c2ecf20Sopenharmony_ci Some strategies to get difficult or controversial changes in. 7158c2ecf20Sopenharmony_ci http://halobates.de/on-submitting-patches.pdf 7168c2ecf20Sopenharmony_ci 7178c2ecf20Sopenharmony_ci-- 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_ci 720