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

Re: some more JOBS



Neal H Walfield wrote:
> 
> > May I suggest a code generating macro instead:
> >
> > #define PRINT_FS(pref, fs, suf) \
> >       case pref##fs##suf: \
> >               printf (#fs "\n"); \
> >               break;
> 
> If all operating systems recognized all filesystems, this would be
> reasonable, however, this is not true.  For instance, I do not think
> Linux knows anything about the MSLOSS filesystem.  Thus, here your macro
> would lose.

That's why every instance of this macro has to be put inside an
#ifdef clause. So for example you can have

#ifdef FSTYPE_FTPFS
	PRINT_FS(FSTYPE_,FTPFS,)
#endif
#ifdef NTFS_SUPER_MAGIC
	PRINT_FS(,NTFS,_SUPER_MAGIC)
#endif

The first one is only defined for Hurd, the second one is only defined
for Linux. So you only need to include whichever filesystems are
recognized in either operating system.

The only problem that I could see is that if stat supports 5 different
OS's whith 5 different conventions for naming filesystem types the
code would look very bloated.

Igor



Reply to: