]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - mkfs/fstyp.c
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <xfs/libxfs.h>
20 #include <disk/fstyp.h>
23 * fstyp allows the user to determine the filesystem identifier of
24 * mounted or unmounted filesystems using heuristics.
26 * The filesystem type is required by mount(2) and sometimes by mount(8)
27 * to mount filesystems of different types. fstyp uses exactly the same
28 * heuristics that mount does to determine whether the supplied device
29 * special file is of a known filesystem type. If it is, fstyp prints
30 * on standard output the usual filesystem identifier for that type and
31 * exits with a zero return code. If no filesystem is identified, fstyp
32 * prints "Unknown" to indicate failure and exits with a non-zero status.
34 * WARNING: The use of heuristics implies that the result of fstyp is not
35 * guaranteed to be accurate.
39 main(int argc
, char *argv
[])
44 fprintf(stderr
, "Usage: %s <device>\n", basename(argv
[0]));
48 if (access(argv
[1], R_OK
) < 0) {
53 if ((type
= fstype(argv
[1])) == NULL
) {