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