[openib-general] Re: questions on how to create patches to linux (openib)

Tom Duffy tduffy at sun.com
Thu May 12 14:26:30 PDT 2005


[CC'd the list to see if they know a better way for your last question]

On Thu, 2005-05-12 at 23:56 +0300, Itamar Rabenstein wrote:
> Hi Tom,
> 
> I would like to ask some questions related to how to craete patches to Linux
> (openib).
> 
> As you can see in my last patch I have learned how to send the patch 
> direct from Linux shell and not from my outlook.
> so it better from the first patch were is was warped my the mail client.

Cool!  Glad that works for you now.  Now that you have made the first
step (admitting you have a problem), you are on the path to dumping
Outlook all together ;-)

> My question is what is the rule of indentation in multiple parameters for
> function

I don't think Documentation/CodingStyle says anything specific about
this, but you should use the convention that we use in the rest of
openib.

> 1) how many params in each line ?

As many as can fit.  Although if you are hitting the end of the line, it
generally means either your function name is too long, the names of your
parameters are too long, or you have too many parameters passing into
the function.  Remember that most architectures have a limited amount of
registers reserved for function passing.

Nobody is going to shoot you if you put one parameter per line (as long
as all the parameters couldn't fit on one line).

> 2) in the second line what is the indentation rule ?
> for example:
> 
> void my_function (int param1, int param2,
> 	int param3);
> 
> or 
> 
> void my_function (int param1, int param2,
> 			int param3);
> 
> or 

You almost have this right.  What you should do is tab in as much as you
can, then use spaces for the rest until the param3 lines up with param
1.  For instance:

void my_function(int param1, int param2, int param3, int param4, int param5
		 int param6);

Also note the lack of a space between the function name and the open
parenthesis.

> void my_function (int param1,
> 			int param2,
> 			int param3);
> 
> my second question is how do you create a set of patches were the second one
> should be 
> apply on top of the first one.
> when I try to craete it the second patch include the first.
> how can I create the second patch if I want it to include only "new things"
> on top of the first patch?

subversion does not have an automagic way to do this, AFAIK.  What I
normally do is copy the whole directory to a new one and then diff -Nurp
the two directories.  When you start getting to many patches that all
have dependencies/ordering on each other, subversion is not the tool to
use.  For that, I would recommend quilt or maybe git (haven't played
with it much yet).

-tduffy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050512/afc091a9/attachment.sig>


More information about the general mailing list