fstyp.h revision 1.5 1 /* $NetBSD: fstyp.h,v 1.5 2019/12/28 08:00:08 tkusumi Exp $ */
2
3 /*-
4 * Copyright (c) 2017 The NetBSD Foundation, Inc.
5 * Copyright (c) 2016 The DragonFly Project
6 * Copyright (c) 2014 The FreeBSD Foundation
7 * All rights reserved.
8 *
9 * This code is derived from software contributed to The NetBSD Foundation
10 * by Tomohiro Kusumi <kusumi.tomohiro (at) gmail.com>.
11 *
12 * This software was developed by Edward Tomasz Napierala under sponsorship
13 * from the FreeBSD Foundation.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * $FreeBSD$
37 */
38
39 #ifndef FSTYP_H
40 #define FSTYP_H
41
42 #include <stdbool.h>
43
44 /* The spec doesn't seem to permit UTF-16 surrogates; definitely LE. */
45 #define EXFAT_ENC "UCS-2LE"
46
47 extern bool show_label; /* -l flag */
48
49 void *read_buf(FILE *, off_t, size_t);
50 char *checked_strdup(const char *);
51 void rtrim(char *, size_t);
52
53 int fstyp_apfs(FILE *fp, char *label, size_t size);
54 int fstyp_cd9660(FILE *, char *, size_t);
55 int fstyp_exfat(FILE *fp, char *label, size_t size);
56 int fstyp_ext2fs(FILE *, char *, size_t);
57 int fstyp_hfsp(FILE *fp, char *label, size_t size);
58 int fstyp_msdosfs(FILE *, char *, size_t);
59 int fstyp_ntfs(FILE *, char *, size_t);
60 int fstyp_ufs(FILE *, char *, size_t);
61 #ifdef HAVE_ZFS
62 int fstyp_zfs(FILE *, char *, size_t);
63 #endif
64
65 #endif /* !FSTYP_H */
66