Daniel Berger wrote:

> Is the mntent.h file in different locations depending on the OS?  That
> will need to be solved if that's the case.

Yep.

> Next, I tried to make it:
> 
> # make
> gcc -fPIC -g -O2 -I/usr/local/lib/ruby/1.6/sparc-solaris2.8 -I.
> -I/usr/local/include -c -o filesystem.o filesystem.c
> filesystem.c: In function `fs_stat':
> filesystem.c:56: storage size of `fs' isn't known
> filesystem.c: At top level:
> filesystem.c:76: warning: `struct mntent' declared inside parameter

Does Solaris even have 'getmntent'?
Hmm...  yup!  And it's totally different.  Yee-hah!
You/I need to include 'mnttab.h'.
Also change default '/etc/mtab' to '/etc/mnttab'.
Redo all the field names.
Redo file open/close.

Maybe have one core section, and separate os-dependent files?

> Also, why did you create an internal struct to store basetypes (fsid)?
>  Isn't that information already stored in the statvfs struct as
> 'basetype' (f_basetype)?

Never heard of that.  Not on Lx?  We only get 'f_type' number
in the 'statfs' and get to decode it.  Didn't think a Ruby 
programmer would care much about 0xEF53.

> Also, what happens if I don't send a path as an argument to stat()?

	> Filesystem.stat
	ArgumentError: wrong # of arguments(0 for 1)

Same as 'File.open' with no file name.
I guess it could default to root?

> Can I iterate over each filesystem? e.g.

> Filesystem.stat("/tmp") { |fs|
>    p fs.size
>    p fs.name
> }

No, it doesn't accept blocks. 
It returns a Ruby structure with all the members populated.
It gets all the info at once.

Using a block seems like the same thing as:

	Time.new { |t| 
	  p t.years
	  p t.months
	}

Didn't see the need for it.  Were my eyes closed?

--
Mike Hall
http://www.enteract.com/~mghall