xffm fstab changes

edscott wilson garcia edscott at imp.mx
Mon Apr 7 15:25:28 CEST 2003


El lun, 07-04-2003 a las 03:57, Benedikt Meurer escribió:
> On Sun, 06, Apr 2003, edscott wilson garcia wrote:
> 
> > Benny,
> 
> Edscott,
> 
> >   I've readded the macros that check for getmntinfo(). FreeBSD won't
> > work because the open_fstab() falls into the "Solaris" section (it
> > defines HAVE_GETVFSENT) but fails miserably with:
> > fstab.c: In function `open_fstab':
> > fstab.c:356: storage size of `vbuf' isn't known
> > fstab.c:357: storage size of `mbuf' isn't known
> > fstab.c:368: too many arguments to function `getvfsent'
> > fstab.c:398: too many arguments to function `getvfsent'
> > But the getmntinfo() works like a charm. I've also added a working
> > is_mounted() function that works in both FreeBSD and Linux. With this
> > function it is no longer necessary to flag the fstab entry as mounted or
> > not (which is bugged, because another process can mount/unmount and
> > render the flag useless). The is_mounted() function has 3 return values:
> > 0 = not mounted 
> > 1 = mounted
> > -1 = can't tell (when this is returned, the "mounted" flag will be used)
> 
> Please don't use getmntinfo() if statfs() does the job. Please use
> statfs() in is_mounted as shown in my example code.

I fail to see the point... Wait, now I do. statfs() makes for cleaner
code. Ok. I changed it. 

> 
> > It's also an exported function, because both the main menu and the popup
> > menu now display either a "mount" or "unmount" item for each fstab
> > entry. 
> 
> Nice.
> 
> > Also, I've changed instances where you wrote "sizeof(text)" with text as
> > a character pointer (it causes bugs later down the road, so I avoid it).
> > I always prefer strlen(text), but in this case I directly put in the
> > array length.
> 
> I use sizeof() to determine the length of arrays (not pointers), since its
> easier to read I think. But using the array length directly is ok :-).

I used to use sizeof() like that, but not anymore.

> 
> One word about the autoconf stuff: I'm trying to get rid of most of the
> unneccessary m4 macros in order to make the stuff maintainable. Therefore
> I removed the references to the jm_* macros in the configure.ac (except for
> the gnu strftime() stuff which is going to be fixed soon). You put that in
> place again. Why?

Because the code you put in did not work for FreeBSD. A quick fix was to
revert to the old code, where it needed the check for HAVE_GETMNTINFO.
One of the macros in jm_* macros does the trick. Running them all does
no harm since they do not halt or produce errors from the configure. And
it helps me since I can later look through config.h to see if I have
other options (like a developer's HOWTO ;-).

> 
> > Edscott
> 
> regards,
> Benedikt
> 
> -- 
> Those who do not understand Unix are condemned to reinvent it, poorly.
>     -- Henry Spencer
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
> http://moongroup.com/mailman/listinfo/xfce4-dev
> 





More information about the Xfce4-dev mailing list