[Libvir] RFC: Add a short doc with libvirt coding style guidelines

Daniel P. Berrange berrange at redhat.com
Mon Jan 14 14:41:18 UTC 2008


On Mon, Jan 14, 2008 at 02:35:10PM +0000, Mark McLoughlin wrote:
> On Mon, 2008-01-14 at 14:11 +0000, Daniel P. Berrange wrote:
> > On Mon, Jan 14, 2008 at 08:40:35AM +0000, Mark McLoughlin wrote:
> > > Hey,
> > > 	There's a few more obvious things missing, I think - e.g. should new
> > > code use lower_case_with_underscores naming style or mixedCase ?
> > 
> > Really ? About 70% of our code currently uses mixed case, no underscores.
> > The QEMU/network driver file & mdns file are the main ones which don't.
> 
> 	But does the 70/30 split imply that it's okay for people writing new
> code for libvirt to use lower_case_with_underscores or not? I'm guessing
> not, especially since all your storage stuff is mixedCase, but it'd be
> worth pointing out in HACKING.

Yeah we've never really discussed it at all before. I decided to do the
storage stuff as mixedCase, because I want to minimise changes in case
we decide to want to expose the 'struct virStorageDef' as public API to
let people feed in a formal data structure instead of XML.

At this point I think it may well be desirable to make virStorageDef a 
public API. Once I've got NPIV impl done we'll have covered all the
different storage areas I think we should have good confidence that the
struct is stable enough to consider making public for convenience of
people creating volumes/pools.

> 	My main point was that some details on what is considered to be the
> libvirt coding style (aside form indentation) might help people.

Yes, definitely a good thing to make a note of.

Dan
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list