ident_ufs.c revision 6451fdbca2f79129a3a09d2fe3f6dd4d062bebff
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License, Version 1.0 only
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (the "License"). You may not use this file except in compliance
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#pragma ident "%Z%%M% %I% %E% SMI"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We call it a ufs file system iff:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The magic number for the superblock is correct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteident_fs(int fd, char *rawpath, int *clean, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Read an entire superblock's worth of data, as we know
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that that'll be properly sized for both raw and cooked
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * devices. Also, if we can't read an entire superblock,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * then we know this isn't UFS, even if it has a valid-
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * looking struct fs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fs->fs_state + (long)fs->fs_time == FSOKAY) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (fs->fs_clean == FSCLEAN || fs->fs_clean == FSSTABLE ||