Skip to contentSkip to conversation

Totally inadequate commenting in flat.h

RANT Paul Mackerras 2 participants 2 messages Nov 5, 2002 – Nov 6, 2002

lore
Share & tools
lore
#0 lore raw

Looking over the recent changes in Linus' tree, I saw there was this new file, include/linux/flat.h. Hmmm, uninformative name, what's this file about? I look in the file and here is how it starts:

/* Copyright (C) 1998  Kenneth Albanowski <[email protected]>
 *                     The Silver Hammer Group, Ltd.
 * Copyright (C) 2002  David McCullough <[email protected]>

*/

#ifndef _LINUX_FLAT_H
#define _LINUX_FLAT_H

#define FLAT_VERSION 0x00000004L

/*
* To make everything easier to port and manage cross platform
* development, all fields are in network byte order. */

struct flat_hdr {
	char magic[4];
	unsigned long rev;          /* version (as above) */

etc.

*Completely* uninformative. How is anyone supposed to know what this relates to? Is it something to do with a network device, or a filesystem, or an executable format, or what?

[And no, don't reply to this telling me what it's about, add some comments to the file instead.]

Paul.

#1 lore raw

Hi Paul,

Fair comment, however, have you looked at a lot of the other files in include/linux ? Plenty of examples with the same lack of comments, a good one that does essentially the same thing as flat.h:

include/linux/elf.h

No excuses though, here's a patch to add a comment about what the file is used for,

Cheers,
Davidm

Index: include/linux/flat.h
===================================================================
RCS file: include/linux/flat.h,v
retrieving revision 1.2

linux/flat.h +3 -0
diff -u -1 -r1.2 flat.h
@@ -4,2 +4,5 @@
  * Copyright (C) 2002  David McCullough <[email protected]>
+ *
+ * This file provides the definitions and structures needed to
+ * support uClinux flat-format executables.
  */

Jivin Paul Mackerras lays it down ...

Quoted 33 lines

Looking over the recent changes in Linus' tree, I saw there was this new file, include/linux/flat.h. Hmmm, uninformative name, what's this file about? I look in the file and here is how it starts:

/* Copyright (C) 1998  Kenneth Albanowski <[email protected]>
 *                     The Silver Hammer Group, Ltd.
 * Copyright (C) 2002  David McCullough <[email protected]>

*/

#ifndef _LINUX_FLAT_H
#define _LINUX_FLAT_H

#define FLAT_VERSION 0x00000004L

/*
* To make everything easier to port and manage cross platform
* development, all fields are in network byte order. */

struct flat_hdr {
	char magic[4];
	unsigned long rev;          /* version (as above) */

etc.

*Completely* uninformative. How is anyone supposed to know what this relates to? Is it something to do with a network device, or a filesystem, or an executable format, or what?

[And no, don't reply to this telling me what it's about, add some comments to the file instead.]

Paul.

Signature · 2 lines
David McCullough:    Ph: +61 7 3435 2815  http://www.SnapGear.com
[email protected]  Fx: +61 7 3891 3630  Custom Embedded Solutions + Security