Skip to content

Commit f703d9a

Browse files
committed
Zpool: simplifies implementation by dropping platform-specific code
1 parent ed6abfd commit f703d9a

File tree

5 files changed

+2
-40
lines changed

5 files changed

+2
-40
lines changed

CMakeLists.txt

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)
9292
cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF)
9393
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID OR DragonFly OR Haiku OR GNU" OFF)
9494
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
95-
cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS OR NetBSD" OFF)
9695
cmake_dependent_option(ENABLE_PCIACCESS "Enable libpciaccess" ON "GNU" OFF)
9796

9897
option(ENABLE_ZLIB "Enable zlib" ON)
@@ -410,6 +409,7 @@ set(LIBFASTFETCH_SRC
410409
src/detection/version/version.c
411410
src/detection/vulkan/vulkan.c
412411
src/detection/weather/weather.c
412+
src/detection/zpool/zpool.c
413413
src/logo/builtin.c
414414
src/logo/image/im6.c
415415
src/logo/image/im7.c
@@ -582,7 +582,6 @@ if(LINUX)
582582
src/detection/de/de_linux.c
583583
src/detection/wmtheme/wmtheme_linux.c
584584
src/detection/camera/camera_linux.c
585-
src/detection/zpool/zpool_linux.c
586585
src/util/platform/FFPlatform_unix.c
587586
src/util/binary_linux.c
588587
)
@@ -656,7 +655,6 @@ elseif(ANDROID)
656655
src/detection/de/de_linux.c
657656
src/detection/wmtheme/wmtheme_linux.c
658657
src/detection/camera/camera_android.c
659-
src/detection/zpool/zpool_nosupport.c
660658
src/util/platform/FFPlatform_unix.c
661659
src/util/binary_linux.c
662660
)
@@ -739,7 +737,6 @@ elseif(FreeBSD)
739737
src/detection/de/de_linux.c
740738
src/detection/wmtheme/wmtheme_linux.c
741739
src/detection/camera/camera_linux.c
742-
src/detection/zpool/zpool_linux.c
743740
src/util/platform/FFPlatform_unix.c
744741
src/util/binary_linux.c
745742
)
@@ -833,7 +830,6 @@ elseif(NetBSD)
833830
src/detection/de/de_linux.c
834831
src/detection/wmtheme/wmtheme_linux.c
835832
src/detection/camera/camera_linux.c
836-
src/detection/zpool/zpool_linux.c
837833
src/util/platform/FFPlatform_unix.c
838834
src/util/binary_linux.c
839835
)
@@ -916,7 +912,6 @@ elseif(OpenBSD)
916912
src/detection/de/de_linux.c
917913
src/detection/wmtheme/wmtheme_linux.c
918914
src/detection/camera/camera_linux.c
919-
src/detection/zpool/zpool_nosupport.c
920915
src/util/platform/FFPlatform_unix.c
921916
src/util/binary_linux.c
922917
src/util/smbiosHelper.c
@@ -986,7 +981,6 @@ elseif(APPLE)
986981
src/detection/de/de_nosupport.c
987982
src/detection/wmtheme/wmtheme_apple.m
988983
src/detection/camera/camera_apple.m
989-
src/detection/zpool/zpool_nosupport.c
990984
src/util/apple/cf_helpers.c
991985
src/util/apple/osascript.m
992986
src/util/apple/smc_temps.c
@@ -1056,7 +1050,6 @@ elseif(WIN32)
10561050
src/detection/de/de_nosupport.c
10571051
src/detection/wmtheme/wmtheme_windows.c
10581052
src/detection/camera/camera_windows.cpp
1059-
src/detection/zpool/zpool_nosupport.c
10601053
src/util/windows/getline.c
10611054
src/util/windows/com.cpp
10621055
src/util/windows/registry.c
@@ -1145,7 +1138,6 @@ elseif(SunOS)
11451138
src/detection/de/de_linux.c
11461139
src/detection/wmtheme/wmtheme_linux.c
11471140
src/detection/camera/camera_nosupport.c
1148-
src/detection/zpool/zpool_linux.c
11491141
src/util/platform/FFPlatform_unix.c
11501142
src/util/binary_linux.c
11511143
)
@@ -1214,7 +1206,6 @@ elseif(Haiku)
12141206
src/detection/de/de_nosupport.c
12151207
src/detection/wmtheme/wmtheme_nosupport.c
12161208
src/detection/camera/camera_nosupport.c
1217-
src/detection/zpool/zpool_nosupport.c
12181209
src/util/platform/FFPlatform_unix.c
12191210
src/util/binary_linux.c
12201211
src/util/haiku/version.cpp
@@ -1294,7 +1285,6 @@ elseif(GNU)
12941285
src/detection/de/de_linux.c
12951286
src/detection/wmtheme/wmtheme_linux.c
12961287
src/detection/camera/camera_nosupport.c
1297-
src/detection/zpool/zpool_nosupport.c
12981288
src/util/platform/FFPlatform_unix.c
12991289
src/util/binary_linux.c
13001290
)
@@ -1611,24 +1601,6 @@ ff_lib_enable(PCIACCESS
16111601
"pciaccess"
16121602
"pciaccess"
16131603
)
1614-
# The system <libzfs.h> is only usable on SunOS. We provide our local copy of it so it's always available.
1615-
if(ENABLE_LIBZFS)
1616-
if(BINARY_LINK_TYPE STREQUAL "dlopen")
1617-
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1)
1618-
else()
1619-
set(CMAKE_REQUIRED_LIBRARIES_BACKUP ${CMAKE_REQUIRED_LIBRARIES})
1620-
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} zfs)
1621-
check_function_exists("libzfs_init" LIBZFS_FOUND)
1622-
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BACKUP})
1623-
if(NOT LIBZFS_FOUND)
1624-
message(STATUS "Library: missing: LIBZFS")
1625-
else()
1626-
message(STATUS "Library: found LIBZFS")
1627-
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_LIBZFS=1)
1628-
target_link_libraries(libfastfetch PRIVATE zfs)
1629-
endif()
1630-
endif()
1631-
endif()
16321604

16331605
if(ENABLE_THREADS)
16341606
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_THREADS=1)

src/common/init.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,6 @@ void ffListFeatures(void)
244244
#if FF_HAVE_ELF || __sun || (__FreeBSD__ && !__DragonFly__) || __OpenBSD__ || __NetBSD__
245245
"libelf\n"
246246
#endif
247-
#if FF_HAVE_LIBZFS
248-
"libzfs\n"
249-
#endif
250247
#if FF_HAVE_DIRECTX_HEADERS
251248
"Directx Headers\n"
252249
#endif

src/detection/zpool/libzfs_simplified.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
// the correct value for a property at runtime.
3333
typedef int zpool_prop_t;
3434
typedef int zprop_source_t;
35-
typedef bool boolean_t;
35+
typedef int boolean_t;
3636

3737
typedef struct libzfs_handle libzfs_handle_t;
3838
typedef struct zpool_handle zpool_handle_t;

src/detection/zpool/zpool_linux.c renamed to src/detection/zpool/zpool.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "util/kmod.h"
44

55
#ifdef __sun
6-
#define FF_DISABLE_DLOPEN
76
#include <libzfs.h>
87
#else
98
#include "libzfs_simplified.h"

src/detection/zpool/zpool_nosupport.c

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)