155992Swpaul/*-
255992Swpaul * Copyright (c) 2014 The FreeBSD Foundation
355992Swpaul *
455992Swpaul * This software was developed by Edward Tomasz Napierala under sponsorship
555992Swpaul * from the FreeBSD Foundation.
655992Swpaul *
755992Swpaul * Redistribution and use in source and binary forms, with or without
855992Swpaul * modification, are permitted provided that the following conditions
955992Swpaul * are met:
1055992Swpaul * 1. Redistributions of source code must retain the above copyright
1155992Swpaul *    notice, this list of conditions and the following disclaimer.
1255992Swpaul * 2. Redistributions in binary form must reproduce the above copyright
1355992Swpaul *    notice, this list of conditions and the following disclaimer in the
1455992Swpaul *    documentation and/or other materials provided with the distribution.
1555992Swpaul *
1655992Swpaul * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1755992Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1855992Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1955992Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2055992Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2155992Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2255992Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2355992Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2455992Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2555992Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2655992Swpaul * SUCH DAMAGE.
2755992Swpaul */
2855992Swpaul
2955992Swpaul#ifndef FSTYP_H
3055992Swpaul#define	FSTYP_H
3155992Swpaul
3255992Swpaul#include <stdbool.h>
3355992Swpaul
3455992Swpaul#define	MIN(a,b) (((a)<(b))?(a):(b))
3555992Swpaul
3655992Swpaul/* The spec doesn't seem to permit UTF-16 surrogates; definitely LE. */
3755992Swpaul#define	EXFAT_ENC	"UCS-2LE"
3855992Swpaul/*
3955992Swpaul * NTFS itself is agnostic to encoding; it just stores 255 u16 wchars.  In
4055992Swpaul * practice, UTF-16 seems expected for NTFS.  (Maybe also for exFAT.)
4155992Swpaul */
4255992Swpaul#define	NTFS_ENC	"UTF-16LE"
4355992Swpaul
4455992Swpaulextern bool	show_label;	/* -l flag */
4555992Swpaul
4655992Swpaulvoid	*read_buf(FILE *fp, off_t off, size_t len);
4755992Swpaulchar	*checked_strdup(const char *s);
4855992Swpaulvoid	rtrim(char *label, size_t size);
4955992Swpaul
5055992Swpaulint	fstyp_apfs(FILE *fp, char *label, size_t size);
5155992Swpaulint	fstyp_befs(FILE *fp, char *label, size_t size);
5255992Swpaulint	fstyp_cd9660(FILE *fp, char *label, size_t size);
5355992Swpaulint	fstyp_exfat(FILE *fp, char *label, size_t size);
5455992Swpaulint	fstyp_ext2fs(FILE *fp, char *label, size_t size);
5555992Swpaulint	fstyp_geli(FILE *fp, char *label, size_t size);
5655992Swpaulint	fstyp_hammer(FILE *fp, char *label, size_t size);
5755992Swpaulint	fstyp_hammer2(FILE *fp, char *label, size_t size);
5855992Swpaulint	fstyp_hfsp(FILE *fp, char *label, size_t size);
5955992Swpaulint	fstyp_msdosfs(FILE *fp, char *label, size_t size);
6055992Swpaulint	fstyp_ntfs(FILE *fp, char *label, size_t size);
6155992Swpaulint	fstyp_ufs(FILE *fp, char *label, size_t size);
6255992Swpaul#ifdef HAVE_ZFS
6355992Swpaulint	fstyp_zfs(FILE *fp, char *label, size_t size);
6455992Swpaul#endif
6555992Swpaul
6655992Swpaul#endif /* !FSTYP_H */
6755992Swpaul