xref: /netbsd/usr.sbin/fstyp/fstyp.h (revision 75bd7610)
1*75bd7610Stkusumi /*	$NetBSD: fstyp.h,v 1.9 2021/01/10 12:38:40 tkusumi Exp $	*/
259a9e119Schristos 
359a9e119Schristos /*-
459a9e119Schristos  * Copyright (c) 2017 The NetBSD Foundation, Inc.
559a9e119Schristos  * Copyright (c) 2016 The DragonFly Project
659a9e119Schristos  * Copyright (c) 2014 The FreeBSD Foundation
759a9e119Schristos  * All rights reserved.
859a9e119Schristos  *
959a9e119Schristos  * This code is derived from software contributed to The NetBSD Foundation
1059a9e119Schristos  * by Tomohiro Kusumi <kusumi.tomohiro@gmail.com>.
1159a9e119Schristos  *
1259a9e119Schristos  * This software was developed by Edward Tomasz Napierala under sponsorship
1359a9e119Schristos  * from the FreeBSD Foundation.
1459a9e119Schristos  *
1559a9e119Schristos  * Redistribution and use in source and binary forms, with or without
1659a9e119Schristos  * modification, are permitted provided that the following conditions
1759a9e119Schristos  * are met:
1859a9e119Schristos  * 1. Redistributions of source code must retain the above copyright
1959a9e119Schristos  *    notice, this list of conditions and the following disclaimer.
2059a9e119Schristos  * 2. Redistributions in binary form must reproduce the above copyright
2159a9e119Schristos  *    notice, this list of conditions and the following disclaimer in the
2259a9e119Schristos  *    documentation and/or other materials provided with the distribution.
2359a9e119Schristos  *
2459a9e119Schristos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2559a9e119Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2659a9e119Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2759a9e119Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2859a9e119Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2959a9e119Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3059a9e119Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3159a9e119Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3259a9e119Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3359a9e119Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3459a9e119Schristos  * SUCH DAMAGE.
3559a9e119Schristos  *
3659a9e119Schristos  * $FreeBSD$
3759a9e119Schristos  */
3859a9e119Schristos 
3959a9e119Schristos #ifndef FSTYP_H
4059a9e119Schristos #define	FSTYP_H
4159a9e119Schristos 
422542ababStkusumi #include <stdbool.h>
432542ababStkusumi 
4406620187Stkusumi /* Undefine this on FreeBSD and NetBSD. */
4506620187Stkusumi //#define HAS_DEVPATH
4606620187Stkusumi 
472542ababStkusumi /* The spec doesn't seem to permit UTF-16 surrogates; definitely LE. */
482542ababStkusumi #define	EXFAT_ENC	"UCS-2LE"
499f7be3f1Stkusumi /*
509f7be3f1Stkusumi  * NTFS itself is agnostic to encoding; it just stores 255 u16 wchars.  In
519f7be3f1Stkusumi  * practice, UTF-16 seems expected for NTFS.  (Maybe also for exFAT.)
529f7be3f1Stkusumi  */
539f7be3f1Stkusumi #define	NTFS_ENC	"UTF-16LE"
542542ababStkusumi 
552542ababStkusumi extern bool	show_label;	/* -l flag */
562542ababStkusumi 
5759a9e119Schristos void	*read_buf(FILE *, off_t, size_t);
5859a9e119Schristos char	*checked_strdup(const char *);
5959a9e119Schristos void	rtrim(char *, size_t);
6059a9e119Schristos 
61c8c69b62Stkusumi int	fstyp_apfs(FILE *, char *, size_t);
6259a9e119Schristos int	fstyp_cd9660(FILE *, char *, size_t);
63c8c69b62Stkusumi int	fstyp_exfat(FILE *, char *, size_t);
6459a9e119Schristos int	fstyp_ext2fs(FILE *, char *, size_t);
65c8c69b62Stkusumi int	fstyp_hfsp(FILE *, char *, size_t);
6659a9e119Schristos int	fstyp_msdosfs(FILE *, char *, size_t);
6759a9e119Schristos int	fstyp_ntfs(FILE *, char *, size_t);
6859a9e119Schristos int	fstyp_ufs(FILE *, char *, size_t);
6906620187Stkusumi int	fstyp_hammer(FILE *, char *, size_t);
7006620187Stkusumi int	fstyp_hammer2(FILE *, char *, size_t);
7159a9e119Schristos #ifdef HAVE_ZFS
7259a9e119Schristos int	fstyp_zfs(FILE *, char *, size_t);
7359a9e119Schristos #endif
7459a9e119Schristos 
75c8c69b62Stkusumi int	fsvtyp_hammer(const char *, char *, size_t);
76c8c69b62Stkusumi int	fsvtyp_hammer_partial(const char *, char *, size_t);
77*75bd7610Stkusumi int	fsvtyp_hammer2(const char *, char *, size_t);
78*75bd7610Stkusumi int	fsvtyp_hammer2_partial(const char *, char *, size_t);
7906620187Stkusumi 
8059a9e119Schristos #endif /* !FSTYP_H */
81