From owner-freebsd-questions@FreeBSD.ORG Wed Aug 17 20:28:26 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 693E816A41F for ; Wed, 17 Aug 2005 20:28:26 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15C8043D46 for ; Wed, 17 Aug 2005 20:28:25 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j7HKSPoF065068; Wed, 17 Aug 2005 15:28:25 -0500 (CDT) (envelope-from dan) Date: Wed, 17 Aug 2005 15:28:24 -0500 From: Dan Nelson To: "Jorge Mario G. Mazo" Message-ID: <20050817202824.GB60291@dan.emsphone.com> References: <43039A20.7030803@azimainc.com> <20050817202518.64656.qmail@web50106.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20050817202518.64656.qmail@web50106.mail.yahoo.com> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.9i Cc: freebsd-questions@freebsd.org, jdyke@azimainc.com Subject: Re: how to know the file system type [programming] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2005 20:28:26 -0000 In the last episode (Aug 17), Jorge Mario G. Mazo said: > --- jdyke 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