Some design suggestions
Bruce Cran
bruce at cran.org.uk
Mon Jun 28 10:55:50 UTC 2010
On Sun, 27 Jun 2010 00:23:34 +0200
Karsten Behrmann <BearPerson at gmx.net> wrote:
> [TL;DR: Sysinstall is old and grown, and we should make some
> adjustments to modules/headers/functions to fit the bigger size]
sysinstall is a prototype, so keeping that in mind we should feel free
to restructure it as needed.
> I suggest having each typed as
> int configFoo(void)
> where appropriate, with the following return codes:
> * 0 - success
> * 1 - unspecified error (to catch returns of a && b)
> * 2 - user initiated abort (by pressing cancel or something)
> * 3 - operation failed (no disk found, I/O error, ...)
I'd prefer something like:
struct foo* initFoo(void);
Then, pass the foo* around each of the functions. I think
that having fewer globals is a good thing. Also, we should typedef the
return type to make it clear what it refers to.
> ----- avoid libdialog in API -----
> [TL;DR: libdialog return codes suck. Don't use them. Don't use
> libdialog arguments unnecessarily either]
I agree - we should be aiming towards a UI-agnostic API so that in the
future a text or GUI frontend can be plugged in if pc-sysinstall ends
up not taking over.
> ----- use more static data -----
> [TL;DR: Don't use environment variables to store config info, use
> static globals inside the modules instead]
I disagree: globals are almost as bad as environment variables. I think
we should instead use context structures that we pass around, like geom
does.
--
Bruce Cran
brucec
More information about the freebsd-sysinstall
mailing list