Skip site navigation (1)Skip section navigation (2)
Date:      03 Dec 2001 14:57:10 +0000
From:      Wayne Pascoe <freebsd@molemanarmy.com>
To:        freebsd-hackers@freebsd.org
Subject:   Application using getmntinfo and statfs
Message-ID:  <86elmc1hdl.fsf@pan.ehsrealtime.com>

next in thread | raw e-mail | index | archive | help
Hi all,

I've written an application that uses getmntinfo which creates an
array of statfs structs and stores information about mounted
filesystems there.

The issue that I am having is detecting valid filesystems to do
further checks on. I am only interested in checking local filesystems
such as UFS. 

Originally I was checking to see if f_type in the created struct was a
certain number. The man page described this as being 
int     f_type;           /* type of filesystem */

I have now had to revert to checking f_fstypename against a string
(ufs only for now) because f_type seems to contain different numbers
for the same f_fstypename on different machines.

Eg on three different machines running FreeBSD 4.4-STABLE I got 
1, 3 and 5 for f_type where the f_fstypename was ufs.

Is the f_type supposed to be consistent? If so, where is this normally
defined? If the f_type is not supposed to be consistent, is there any
way to check a the filesystem in the current statfs struct against a
list of values without having to do 

if ( (strcmp(mounted_fs[count].f_fstypename, "ufs") != 0) ||
     (strcmp(mounted_fs[count].f_fstypename, "hfs") !=0) )

? 

Thanks 

-- 
- Wayne Pascoe
                                 | What we need is either less corruption,
freebsd@molemanarmy.com          | or more chance to participate in it.
http://www.molemanarmy.com       | 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86elmc1hdl.fsf>