Skip to content

Commit 8074f27

Browse files
committed
feat: Adding openbsd and netbsd support for ATA and SCSI
Adding low-level support for issuing ATA and SCSI commands. Part of this also meant moving some freebsd code to a common file to reduce duplication of code since the API was the same. Signed-off-by: Tyler Erickson <[email protected]>
1 parent b07f45f commit 8074f27

File tree

4 files changed

+160
-3
lines changed

4 files changed

+160
-3
lines changed

.github/workflows/vmactions.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ jobs:
2828
meson setup build -Dprefix=/ -Dmandir=/man -Dbindir=/ --buildtype=release
2929
meson install -C build
3030
31-
# builds but fails to link due to __stack_chk_fail and __stack_chk_guard being undefined.
32-
# TODO: Figure out which flags to change in meson build scripts to resolve this. use .kernel() == solaris vs .kernel() == illumos
3331
solaris:
3432
runs-on: ubuntu-latest
3533
name: Build openSeaChest for Solaris
@@ -117,3 +115,51 @@ jobs:
117115
118116
meson setup build -Dprefix=/ -Dmandir=/man -Dbindir=/ --buildtype=release
119117
meson install -C build
118+
119+
openbsd:
120+
runs-on: ubuntu-latest
121+
name: Build openSeaChest for OpenBSD
122+
strategy:
123+
fail-fast: false
124+
steps:
125+
- uses: actions/checkout@v4
126+
with:
127+
submodules: recursive
128+
- name: Build openSeaChest for OpenBSD
129+
id: freebsd
130+
uses: vmactions/openbsd-vm@v1
131+
with:
132+
usesh: true
133+
prepare: |
134+
pkg_add curl
135+
136+
run: |
137+
pkg_add -u
138+
pkg_add meson
139+
140+
meson setup build -Dprefix=/ -Dmandir=/man -Dbindir=/ --buildtype=release
141+
meson install -C build
142+
143+
netbsd:
144+
runs-on: ubuntu-latest
145+
name: Build openSeaChest for NetBSD
146+
strategy:
147+
fail-fast: false
148+
steps:
149+
- uses: actions/checkout@v4
150+
with:
151+
submodules: recursive
152+
- name: Build openSeaChest for NetBSD
153+
id: freebsd
154+
uses: vmactions/netbsd-vm@v1
155+
with:
156+
usesh: true
157+
prepare: |
158+
/usr/sbin/pkg_add curl
159+
160+
run: |
161+
/usr/sbin/pkg_add -u
162+
/usr/sbin/pkg_add meson
163+
164+
meson setup build -Dprefix=/ -Dmandir=/man -Dbindir=/ --buildtype=release
165+
meson install -C build

src/EULA.c

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,40 @@ static void print_Win_Getopt_Licenses(void)
464464
printf("SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n");
465465
}
466466

467+
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
468+
static void print_Berkeley_License(void)
469+
{
470+
printf("Berkeley Copyright to BSD source (libc, others)\n");
471+
printf("Copyright (c) 1990 The Regents of the University of California.\n");
472+
printf("All rights reserved.\n");
473+
printf("\n");
474+
printf("Redistribution and use in source and binary forms, with or without\n");
475+
printf("modification, are permitted provided that the following conditions\n");
476+
printf("are met:\n");
477+
printf("1. Redistributions of source code must retain the above copyright\n");
478+
printf(" notice, this list of conditions and the following disclaimer.\n");
479+
printf("2. Redistributions in binary form must reproduce the above copyright\n");
480+
printf(" notice, this list of conditions and the following disclaimer in the\n");
481+
printf(" documentation and/or other materials provided with the distribution.\n");
482+
printf("3. Neither the name of the University nor the names of its contributors\n");
483+
printf(" may be used to endorse or promote products derived from this software\n");
484+
printf(" without specific prior written permission.\n");
485+
printf("\n");
486+
printf("THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n");
487+
printf("ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n");
488+
printf("IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n");
489+
printf("ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n");
490+
printf("FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n");
491+
printf("DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n");
492+
printf("OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n");
493+
printf("HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n");
494+
printf("LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n");
495+
printf("OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n");
496+
printf("SUCH DAMAGE.\n");
497+
printf("\n\n");
498+
}
499+
#endif // all bsds
500+
467501
#if defined(__FreeBSD__)
468502
static void print_FreeBSD_License(void)
469503
{
@@ -493,6 +527,7 @@ static void print_FreeBSD_License(void)
493527
printf("the authors and should not be interpreted as representing official policies, either\n");
494528
printf("expressed or implied, of the FreeBSD Project.\n");
495529
printf("\n\n");
530+
print_Berkeley_License();
496531
}
497532
#endif //__FreeBSD__
498533

@@ -527,10 +562,68 @@ static void print_DragonFlyBSD_License(void)
527562
printf("OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n");
528563
printf("SUCH DAMAGE.\n");
529564
printf("\n\n");
565+
print_Berkeley_License();
530566
}
531567

532568
#endif //__DragonFly__
533569

570+
#if defined(__NetBSD__)
571+
static void print_NetBSD_License(void)
572+
{
573+
printf("NetBSD (libc)\n\n");
574+
printf("Copyright (c) 2008 The NetBSD Foundation, Inc.\n");
575+
printf("All rights reserved.\n");
576+
printf("\n");
577+
printf("This code is derived from software contributed to The NetBSD Foundation\n");
578+
printf("by \n");
579+
printf("\n");
580+
printf("Redistribution and use in source and binary forms, with or without\n");
581+
printf("modification, are permitted provided that the following conditions\n");
582+
printf("are met:\n");
583+
printf("1. Redistributions of source code must retain the above copyright\n");
584+
printf(" notice, this list of conditions and the following disclaimer.\n");
585+
printf("2. Redistributions in binary form must reproduce the above copyright\n");
586+
printf(" notice, this list of conditions and the following disclaimer in the\n");
587+
printf(" documentation and/or other materials provided with the distribution.\n");
588+
printf("\n");
589+
printf("THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n");
590+
printf("``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n");
591+
printf("TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n");
592+
printf("PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n");
593+
printf("BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n");
594+
printf("CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n");
595+
printf("SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n");
596+
printf("INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n");
597+
printf("CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n");
598+
printf("ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n");
599+
printf("POSSIBILITY OF SUCH DAMAGE.\n");
600+
printf("\n\n");
601+
print_Berkeley_License();
602+
}
603+
#endif //__NetBSD__
604+
605+
#if defined(__OpenBSD__)
606+
static void print_OpenBSD_License(void)
607+
{
608+
printf("OpenBSD (libc)\n\n");
609+
printf("Copyright (c) 2003 The OpenBSD Foundation\n");
610+
printf("\n");
611+
printf("Permission to use, copy, modify, and distribute this software for any\n");
612+
printf("purpose with or without fee is hereby granted, provided that the above\n");
613+
printf("copyright notice and this permission notice appear in all copies.\n");
614+
printf("\n");
615+
printf("THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n");
616+
printf("WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n");
617+
printf("MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n");
618+
printf("ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n");
619+
printf("WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n");
620+
printf("ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n");
621+
printf("OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n");
622+
printf("\n\n");
623+
print_Berkeley_License();
624+
}
625+
#endif //__OpenBSD__
626+
534627
#if defined(__sun)
535628
# if defined(__illumos__) || defined(THIS_IS_ILLUMOS)
536629
static void print_CDDL_License(void)
@@ -1169,6 +1262,10 @@ void print_Open_Source_Licenses(void)
11691262
print_DragonFlyBSD_License();
11701263
#elif defined(__FreeBSD__)
11711264
print_FreeBSD_License();
1265+
#elif defined(__OpenBSD__)
1266+
print_OpenBSD_License();
1267+
#elif defined(__NetBSD__)
1268+
print_NetBSD_License();
11721269
#elif defined(__linux__)
11731270
# if defined(__GLIBC__)
11741271
// in other 'nix systems, we need to show this since we are using gnu libc

src/openseachest_util_options.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ const char* commandWindowType = "terminal";
3636
const char* deviceHandleExample = "/dev/da<#>";
3737
const char* deviceHandleName = "<da_device>";
3838
const char* commandWindowType = "shell";
39+
#elif defined(__NetBSD__) || defined(__OpenBSD__)
40+
// TODO: Need a better way to handle WD vs SD devices
41+
const char* deviceHandleExample = "/dev/sd<#>";
42+
const char* deviceHandleName = "<sd_device>";
43+
const char* commandWindowType = "shell";
3944
#elif defined(_WIN32)
4045
# include "windows_version_detect.h"
4146
const char* deviceHandleExample = "PD<#>";
@@ -125,6 +130,15 @@ void print_Elevated_Privileges_Text(void)
125130
# elif defined(__FreeBSD__)
126131
printf("In FreeBSD, put sudo before the command. This may require inputting your login password.\n");
127132
printf("In FreeBSD, log in to a root terminal (su), then execute the command. This requires the root password.\n");
133+
# elif defined(__OpenBSD__)
134+
printf("In OpenBSD, put sudo before the command. This may require inputting your login password.\n");
135+
printf("In OpenBSD, log in to a root terminal (su), then execute the command. This requires the root password.\n");
136+
# elif defined(__NetBSD__)
137+
printf("In NetBSD, put sudo before the command. This may require inputting your login password.\n");
138+
printf("In NetBSD, log in to a root terminal (su), then execute the command. This requires the root password.\n");
139+
# elif defined(__illumos__) || defined(THIS_IS_ILLUMOS)
140+
printf("In Illumos, put sudo before the command. This may require inputting your login password.\n");
141+
printf("In Illumos, log in to a root terminal (su), then execute the command. This requires the root password.\n");
128142
# elif defined(__sun)
129143
printf("In Solaris, put sudo before the command. This may require inputting your login password.\n");
130144
printf("In Solaris, log in to a root terminal (su), then execute the command. This requires the root password.\n");

0 commit comments

Comments
 (0)