Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148335438
D29917.id87941.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D29917.id87941.diff
View Options
Index: usr.sbin/fstyp/Makefile
===================================================================
--- usr.sbin/fstyp/Makefile
+++ usr.sbin/fstyp/Makefile
@@ -3,8 +3,8 @@
.include <src.opts.mk>
PROG= fstyp
-SRCS= apfs.c cd9660.c exfat.c ext2fs.c fstyp.c geli.c hammer.c \
- hammer2.c hfsplus.c msdosfs.c ntfs.c ufs.c bfs.c
+SRCS= apfs.c bfs.c cd9660.c exfat.c ext2fs.c fstyp.c geli.c hammer.c \
+ hammer2.c hfsplus.c msdosfs.c ntfs.c ufs.c
.if ${MK_ZFS} != "no"
SRCS += zfs.c
Index: usr.sbin/fstyp/bfs.c
===================================================================
--- usr.sbin/fstyp/bfs.c
+++ usr.sbin/fstyp/bfs.c
@@ -1,5 +1,7 @@
/*
- * Copyright (c) 2021 Miguel Gocobachi <miguel@gocobachi.dev>. All rights reserved.
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2021 Miguel Gocobachi <miguel@gocobachi.dev>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -40,7 +42,8 @@
int32_t magic1;
};
-int fstyp_bfs(FILE *fp, char *label, size_t size)
+int
+fstyp_bfs(FILE *fp, char *label, size_t size)
{
struct bfs_disk_superblock *volume;
@@ -49,13 +52,13 @@
if (volume == NULL) {
free(volume);
- return 1;
+ return (1);
}
if (volume->magic1 != BFS_SUPER_BLOCK_MAGIC1) {
free(volume);
- return 1;
+ return (1);
}
bzero(label, size);
@@ -64,5 +67,5 @@
free(volume);
- return 0;
+ return (0);
}
Index: usr.sbin/fstyp/fstyp.h
===================================================================
--- usr.sbin/fstyp/fstyp.h
+++ usr.sbin/fstyp/fstyp.h
@@ -50,6 +50,7 @@
void rtrim(char *label, size_t size);
int fstyp_apfs(FILE *fp, char *label, size_t size);
+int fstyp_bfs(FILE *fp, char *label, size_t size);
int fstyp_cd9660(FILE *fp, char *label, size_t size);
int fstyp_exfat(FILE *fp, char *label, size_t size);
int fstyp_ext2fs(FILE *fp, char *label, size_t size);
@@ -60,7 +61,7 @@
int fstyp_msdosfs(FILE *fp, char *label, size_t size);
int fstyp_ntfs(FILE *fp, char *label, size_t size);
int fstyp_ufs(FILE *fp, char *label, size_t size);
-int fstyp_bfs(FILE *fp, char *label, size_t size);
+
#ifdef HAVE_ZFS
int fstyp_zfs(FILE *fp, char *label, size_t size);
#endif
Index: usr.sbin/fstyp/fstyp.c
===================================================================
--- usr.sbin/fstyp/fstyp.c
+++ usr.sbin/fstyp/fstyp.c
@@ -64,6 +64,7 @@
char *precache_encoding;
} fstypes[] = {
{ "apfs", &fstyp_apfs, true, NULL },
+ { "bfs", &fstyp_bfs, false, NULL },
{ "cd9660", &fstyp_cd9660, false, NULL },
{ "exfat", &fstyp_exfat, false, EXFAT_ENC },
{ "ext2fs", &fstyp_ext2fs, false, NULL },
@@ -74,7 +75,6 @@
{ "msdosfs", &fstyp_msdosfs, false, NULL },
{ "ntfs", &fstyp_ntfs, false, NTFS_ENC },
{ "ufs", &fstyp_ufs, false, NULL },
- { "bfs", &fstyp_bfs, false, NULL },
#ifdef HAVE_ZFS
{ "zfs", &fstyp_zfs, true, NULL },
#endif
Index: usr.sbin/fstyp/tests/Makefile
===================================================================
--- usr.sbin/fstyp/tests/Makefile
+++ usr.sbin/fstyp/tests/Makefile
@@ -4,6 +4,7 @@
ATF_TESTS_SH= fstyp_test
+${PACKAGE}FILES+= bfs.img.bz2
${PACKAGE}FILES+= dfr-01-xfat.img.bz2
${PACKAGE}FILES+= ext2.img.bz2
${PACKAGE}FILES+= ext3.img.bz2
@@ -11,6 +12,5 @@
${PACKAGE}FILES+= ext4_with_label.img.bz2
${PACKAGE}FILES+= ntfs.img.bz2
${PACKAGE}FILES+= ntfs_with_label.img.bz2
-${PACKAGE}FILES+= bfs.img.bz2
.include <bsd.test.mk>
Index: usr.sbin/fstyp/tests/fstyp_test.sh
===================================================================
--- usr.sbin/fstyp/tests/fstyp_test.sh
+++ usr.sbin/fstyp/tests/fstyp_test.sh
@@ -27,6 +27,16 @@
# $FreeBSD$
+atf_test_case bfs
+bfs_head() {
+ atf_set "descr" "fstyp(8) can detect bfs and label filesystems"
+}
+bfs_body() {
+ bzcat $(atf_get_srcdir)/bfs.img.bz2 > bfs.img
+ atf_check -s exit:0 -o inline:"bfs\n" fstyp bfs.img
+ atf_check -s exit:0 -o inline:"bfs BeFS\n" fstyp -l bfs.img
+}
+
atf_test_case cd9660
cd9660_head() {
atf_set "descr" "fstyp(8) should detect cd9660 filesystems"
@@ -255,17 +265,8 @@
atf_check -s exit:1 -e match:"filesystem not recognized" fstyp zeros
}
-atf_test_case bfs
-bfs_head() {
- atf_set "descr" "fstyp(8) can detect bfs and label filesystems"
-}
-bfs_body() {
- bzcat $(atf_get_srcdir)/bfs.img.bz2 > bfs.img
- atf_check -s exit:0 -o inline:"bfs\n" fstyp bfs.img
- atf_check -s exit:0 -o inline:"bfs BeFS\n" fstyp -l bfs.img
-}
-
atf_init_test_cases() {
+ atf_add_test_case bfs
atf_add_test_case cd9660
atf_add_test_case cd9660_label
atf_add_test_case dir
@@ -286,6 +287,5 @@
atf_add_test_case ufs2
atf_add_test_case ufs2_label
atf_add_test_case ufs_on_device
- atf_add_test_case bfs
atf_add_test_case zeros
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 18, 5:38 AM (13 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29884755
Default Alt Text
D29917.id87941.diff (4 KB)
Attached To
Mode
D29917: BeFS support for fstyp command
Attached
Detach File
Event Timeline
Log In to Comment