[haiku-development] Re: Header file reuse

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 31 Aug 2010 22:22:32 +0200

Hi,

Am 31.08.2010 22:16, schrieb Andreas Färber:
Am 28.08.2010 um 12:15 schrieb Axel Dörfler:

pulkomandy@xxxxxxxxxxxxxxxxx wrote:
+ SCSI_READ_12 = 0xA8,
+ SCSI_WRITE_12 = 0xAA,

There already is a SCSI header in our repository that contains all of
those (and a lot more) in headers/private/drivers/scsi_cmds.h, btw.

It seems we have some header code duplication in the repository. In this
case there's headers/private/drivers/scsi_cmds.h as well as equivalents
for usb_disk and now usb_floppy add-ons.

Is there a policy on header file reuse? Are there good reasons not to?

What I'm in particular looking for is the proper way to share a private
header (iSCSI commands) between the boot loader and a kernel virtual
disk add-on.
* Is headers/private/drivers/ too general for a file not that universal?

That's where it should go, IMHO. If it's more specific, it should go in a sub-folder, like "scsi" perhaps in this case. But since scsi_cmds.h is already in drivers directly, I don't see the need for sub-folders. On the other hand, the more SCSI specific headers in drivers, the more reason to move them into a sub-folder of their own.

* Putting it in headers/private/kernel/boot/net/ like RemoteDiskDefs.h
seems wrong to me as medium-term solution...
* Should it go with the add-on and be reused from there?
* Anywhere else?

In general, we should always strive to have no duplication and also to place headers in an expected place. Sometimes one does not have enough overview before realizing that one is creating a duplication of something...

Best regards,
-Stephan

Other related posts: