From owner-freebsd-questions@FreeBSD.ORG Wed Aug 17 20:28:42 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 DB3A416A41F for ; Wed, 17 Aug 2005 20:28:42 +0000 (GMT) (envelope-from dpk@dpk.net) Received: from shared10.hosting.flyingcroc.net (shared10.hosting.flyingcroc.net [207.246.149.144]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A45843D49 for ; Wed, 17 Aug 2005 20:28:42 +0000 (GMT) (envelope-from dpk@dpk.net) Received: from shared10.hosting.flyingcroc.net (localhost [127.0.0.1]) by shared10.hosting.flyingcroc.net (8.12.9p2/8.12.10) with ESMTP id j7HKSfrR003241; Wed, 17 Aug 2005 13:28:41 -0700 (PDT) Received: from localhost (dpk@localhost) by shared10.hosting.flyingcroc.net (8.12.9p2/8.12.10/Submit) with ESMTP id j7HKSfps003238; Wed, 17 Aug 2005 13:28:41 -0700 (PDT) X-Authentication-Warning: shared10.hosting.flyingcroc.net: dpk owned process doing -bs Date: Wed, 17 Aug 2005 13:28:41 -0700 (PDT) From: dpk X-X-Sender: dpk@shared10.hosting.flyingcroc.net To: "Jorge Mario G. Mazo" In-Reply-To: <20050817195522.28381.qmail@web50101.mail.yahoo.com> Message-ID: <20050817132719.N13385@shared10.hosting.flyingcroc.net> References: <20050817195522.28381.qmail@web50101.mail.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-questions@freebsd.org 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:43 -0000 On Wed, 17 Aug 2005, 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 > > thanks in advance I'd check out the fdisk code. For example: $ fdisk /dev/ad0 | grep sysid sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD) Figure out how it determines the sysid, and then you can use that in your code. You'd still need a function to determine what disks are physically present.