Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Aug 2005 15:28:24 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        "Jorge Mario G. Mazo" <murcielako@yahoo.com>
Cc:        freebsd-questions@freebsd.org, jdyke@azimainc.com
Subject:   Re: how to know the file system type [programming]
Message-ID:  <20050817202824.GB60291@dan.emsphone.com>
In-Reply-To: <20050817202518.64656.qmail@web50106.mail.yahoo.com>
References:  <43039A20.7030803@azimainc.com> <20050817202518.64656.qmail@web50106.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Aug 17), Jorge Mario G. Mazo said:
>  --- jdyke <jdyke@azimainc.com> escribió:
> > Jorge Mario G. Mazo wrote:
> > > hi there
> > > I've been looking for a way to check the fs type
> > > I need to do something like this
> > > 
> > > if NTFS do this
> > > if msdis do that
> > > if ufs2  do that
> > > if ext2 do this other stuff
>
> it has to be pure C and parsing the fstab in C is not an option! also
> what about if the partition is not in fstab?

You didn't say anything about needing it in C :)  The answer is much
easier then; just call statfs() and look at the f_fstypename field. 
See the statfs manpage for more details.

-- 
	Dan Nelson
	dnelson@allantgroup.com



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