Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: What is going on with stand/ofwboot?



> You probably saw that I made a commit which fixes the build, but
> which doesn't re-do how net_tftp_bootp() behaves, and which now
> requires an ugly cast (which I added).

Well if you really want to fix buildable state I'd suggest
you'd follow minimum C style manner. Function declarations
added in net.h should also be included from a source where
they are actually implemented, so that you could notice
you also exported functions declared as static.  It's also
better to add XXX comments if you don't know if the fix is
really correct.

> BTW, won't your new net_tftp_bootp() get a warning for an unused
> function argument?

Such unused function arguments are very common for consistent
API and we have not enabled such warnings in bsd.sys.mk:
---
.if ${WARNS} > 2
CFLAGS+=        -Wcast-qual -Wwrite-strings
CFLAGS+=        -Wextra -Wno-unused-parameter
---
then we don't have to add boring __unused attributes:
http://mail-index.NetBSD.org/source-changes/2006/10/12/0002.html
http://mail-index.NetBSD.org/source-changes/2006/11/16/0006.html

In this case, net_open() in some other implementation might
return a socket in the arg of struct of_dev as an opaque and
net_tftp_bootp() might require the value returned from net_open()
for network access. (nfs_mountroot() should also take it but
I didn't bother to change it)

> > -   memset(promops, 0, sizeof(promops));
> > +   memset(&promops, 0, sizeof(promops));
> 
> ... looks like an ancient and somewhat unrelated bug(?)

WARNS often points out a real bug which should not be simply hidden?

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index