Subject: Re: Porting code with switch/case on mount type (was int)
To: Christos Zoulas <>
From: Chris G. Demetriou <>
List: current-users
Date: 05/17/1999 14:35:02 (Christos Zoulas) writes:
> In article <> (David Maxwell) writes:
> >I see that our first argument to mount is a const char now, (not sure when
> >it happened) and I'm porting some code from FreeBSD that does a switch on
> >the mount 'type' (first arg), which used to be an int, and still is for 
> >them.

FYI, the change was made ... a _long_ time ago.  from the cvs log of

revision 1.19
date: 1994/04/14 04:05:32;  author: cgd;  state: Exp;  lines: +1 -1
fs types are names now; accompanying changes.

wow, more than 5 years ago, in fact.

> >Any suggestions on a preffered way of recoding a switch/case block of
> >C, now that we have a const char there?
> Dunno, if (strcmp(..) == 0) {
>        } else if (strcmp(..) == 0) {
>        } ...

That's certainly the easiest, and what I've done whent there's no need
to do more.

if you have some weird performance needs, you could use a hash
function/table or something, but that's always seemed like overkill to

Chris Demetriou - -
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.