Skip to content

Commit 7df5a6d

Browse files
committed
initial
0 parents  commit 7df5a6d

10 files changed

Lines changed: 2246 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: FreeBSD Build and Test
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
name: Build on FreeBSD 14.1
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Build and test in FreeBSD VM
17+
uses: vmactions/freebsd-vm@v1
18+
with:
19+
release: '14.1'
20+
usesh: true
21+
prepare: |
22+
pkg install -y llvm
23+
24+
run: |
25+
# Print FreeBSD version
26+
freebsd-version
27+
uname -a
28+
29+
# Verify kernel sources are available
30+
if [ ! -d /usr/src/sys ]; then
31+
echo "ERROR: Kernel sources not found at /usr/src/sys"
32+
echo "Installing kernel sources..."
33+
fetch https://download.freebsd.org/ftp/releases/amd64/14.1-RELEASE/src.txz
34+
tar -C / -xzf src.txz
35+
fi
36+
37+
# Show compiler version
38+
cc --version
39+
40+
# Clean any previous builds
41+
make clean || true
42+
43+
# Build the kernel module
44+
echo "Building BFCFS kernel module..."
45+
make
46+
47+
# Check if module was built
48+
if [ ! -f bfcfs.ko ]; then
49+
echo "ERROR: bfcfs.ko was not created"
50+
exit 1
51+
fi
52+
53+
echo "Build successful!"
54+
ls -lh bfcfs.ko
55+
56+
# Check module information
57+
file bfcfs.ko
58+
59+
echo "All checks passed!"

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Object files
2+
*.o
3+
*.ko
4+
*.kld
5+
6+
# Build artifacts
7+
bfcfs.ko
8+
export_syms
9+
.depend.*
10+
11+
# Generated files
12+
opt_compat.h
13+
opt_global.h
14+
vnode_if.h
15+
vnode_if_newproto.h
16+
vnode_if_typedef.h
17+
18+
# Symlinks to kernel sources
19+
machine
20+
x86
21+
i386
22+
amd64
23+
arm
24+
arm64
25+
26+
# Editor temporary files
27+
*~
28+
*.swp
29+
*.swo
30+
.*.swp
31+
.*.swo
32+
33+
# IDE files
34+
.vscode/
35+
.idea/
36+
*.iml
37+
38+
# Core dumps
39+
*.core
40+
vmcore.*
41+
42+
# Backup files
43+
*.bak
44+
*.orig
45+
46+
# macOS
47+
.DS_Store
48+
49+
# Tags files
50+
tags
51+
TAGS
52+
cscope.*

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2024, Taras Havryliak (zombocoder)
4+
Copyright (c) 2024, bfcfs contributors
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# FreeBSD kernel module Makefile for BFCFS
2+
# Build with: make
3+
# Load with: kldload ./bfcfs.ko
4+
5+
KMOD= bfcfs
6+
SRCS= bfcfs_vfs.c bfcfs_vnops.c bfc_format.c bfc_io.c
7+
SRCS+= vnode_if.h opt_compat.h
8+
9+
# Compilation flags
10+
CFLAGS+= -O2 -fno-strict-aliasing -DKLD_MODULE
11+
CFLAGS+= -Wall -Wextra -Wno-unused-parameter
12+
13+
# Optional debug flag (make DEBUG=1)
14+
.if defined(DEBUG)
15+
CFLAGS+= -DDEBUG
16+
.endif
17+
18+
.include <bsd.kmod.mk>

0 commit comments

Comments
 (0)