diff options
Diffstat (limited to 'misc/far2l/files')
| -rw-r--r-- | misc/far2l/files/patch-far2l_CMakeLists.txt | 14 | ||||
| -rw-r--r-- | misc/far2l/files/patch-far2l_src_farwinapi.cpp | 73 | ||||
| -rw-r--r-- | misc/far2l/files/patch-far2l_src_farwinapi.hpp | 13 | ||||
| -rw-r--r-- | misc/far2l/files/patch-far2l_src_mix_MountInfo.cpp | 20 | ||||
| -rw-r--r-- | misc/far2l/files/patch-far2l_src_mix_MountInfo.h | 11 | ||||
| -rw-r--r-- | misc/far2l/files/patch-far2l_src_panels_infolist.cpp | 68 |
6 files changed, 199 insertions, 0 deletions
diff --git a/misc/far2l/files/patch-far2l_CMakeLists.txt b/misc/far2l/files/patch-far2l_CMakeLists.txt new file mode 100644 index 000000000000..81fa1cdd83bf --- /dev/null +++ b/misc/far2l/files/patch-far2l_CMakeLists.txt @@ -0,0 +1,14 @@ +--- far2l/CMakeLists.txt.orig 2025-10-26 08:39:52 UTC ++++ far2l/CMakeLists.txt +@@ -263,9 +263,11 @@ set_target_properties(far2l + ENABLE_EXPORTS TRUE) + + if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") ++ find_library(SYSINFO_LIBRARY NAMES sysinfo) + target_link_libraries(far2l + PRIVATE ${WINPORT} + PRIVATE c ++ PRIVATE ${SYSINFO_LIBRARY} + PRIVATE ${UCHARDET_LIBRARIES}) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Haiku") + target_link_libraries(far2l diff --git a/misc/far2l/files/patch-far2l_src_farwinapi.cpp b/misc/far2l/files/patch-far2l_src_farwinapi.cpp new file mode 100644 index 000000000000..760615a0c3b2 --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_farwinapi.cpp @@ -0,0 +1,73 @@ +--- far2l/src/farwinapi.cpp.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/farwinapi.cpp +@@ -38,6 +38,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF S + #include <fcntl.h> + #include <errno.h> + #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) ++#include <sys/disk.h> + #include <sys/mount.h> + #elif !defined(__HAIKU__) + #include <sys/statfs.h> +@@ -472,8 +473,8 @@ bool apiExpandEnvironmentStrings(const wchar_t *src, F + } + + BOOL apiGetVolumeInformation(const wchar_t *lpwszRootPathName, FARString *pVolumeName, +- DWORD64 *lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, +- FARString *pFileSystemName, FARString *pFileSystemMountPoint) ++ FARString *pDiskIdent, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, ++ FARString *pFileSystemName, FARString *pDeviceName, FARString *pFileSystemMountPoint) + { + struct statvfs svfs {}; + const std::string &path = Wide2MB(lpwszRootPathName); +@@ -483,13 +484,9 @@ BOOL apiGetVolumeInformation(const wchar_t *lpwszRootP + + if (lpMaximumComponentLength) + *lpMaximumComponentLength = svfs.f_namemax; +- if (lpVolumeSerialNumber) +- *lpVolumeSerialNumber = (DWORD)svfs.f_fsid; + if (lpFileSystemFlags) + *lpFileSystemFlags = (DWORD)svfs.f_flag; + +- if (pVolumeName) { +- pVolumeName->Clear(); + #if 0 + #if defined(FS_IOC_GETFSLABEL) && defined(FSLABEL_MAX) + int fd = open(path.c_str(), O_RDONLY); +@@ -502,13 +499,35 @@ BOOL apiGetVolumeInformation(const wchar_t *lpwszRootP + } + #endif + #endif +- } + + if (pFileSystemName) { + *pFileSystemName = MountInfo().GetFileSystem(path); + } +- if (*pFileSystemMountPoint) { ++ if (pFileSystemMountPoint) { + *pFileSystemMountPoint = MountInfo().GetFileSystemMountPoint(lpwszRootPathName); ++ } ++ // XXX: can we avoid calling GetFileSystemMountPoint() twice? ++ const std::string devname = MountInfo().GetFileSystemMountPoint(lpwszRootPathName, true); ++ if (pDeviceName) { ++ *pDeviceName = devname; ++ } ++ if (pDiskIdent) { ++ int fd = open(devname.c_str(), O_RDONLY); ++ if (fd != -1) { ++ char ident[DISK_IDENT_SIZE]; ++ if (ioctl(fd, DIOCGIDENT, ident) != -1) ++ *pDiskIdent = ident; ++ close(fd); ++ } ++ } ++ if (pVolumeName) { ++ std::string reply{}, cmd{"fstyp -l " + devname}; ++ if (POpen(reply, cmd.c_str())) { ++ const auto pos = reply.find(' ') + 1; ++ if (pos > 0) { ++ *pVolumeName = reply.substr(pos, reply.size() - pos - 1); ++ } //else pVolumeName->Clear(); ++ } //else pVolumeName->Clear(); + } + + return TRUE; diff --git a/misc/far2l/files/patch-far2l_src_farwinapi.hpp b/misc/far2l/files/patch-far2l_src_farwinapi.hpp new file mode 100644 index 000000000000..4f7eb9510547 --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_farwinapi.hpp @@ -0,0 +1,13 @@ +--- far2l/src/farwinapi.hpp.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/farwinapi.hpp +@@ -180,8 +180,8 @@ void apiGetTempPath(FARString &strBuffer); + bool apiExpandEnvironmentStrings(const wchar_t *src, FARString &strDest); + + BOOL apiGetVolumeInformation(const wchar_t *lpwszRootPathName, FARString *pVolumeName, +- DWORD64 *lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, +- FARString *pFileSystemName, FARString *pFileSystemMountPoint = nullptr); ++ FARString *pDiskIdent, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, ++ FARString *pFileSystemName, FARString *pDeviceName, FARString *pFileSystemMountPoint); + + void apiFindDataToDataEx(const FAR_FIND_DATA *pSrc, FAR_FIND_DATA_EX *pDest); + diff --git a/misc/far2l/files/patch-far2l_src_mix_MountInfo.cpp b/misc/far2l/files/patch-far2l_src_mix_MountInfo.cpp new file mode 100644 index 000000000000..3fa268388fd4 --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_mix_MountInfo.cpp @@ -0,0 +1,20 @@ +--- far2l/src/mix/MountInfo.cpp.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/mix/MountInfo.cpp +@@ -384,7 +384,7 @@ std::string MountInfo::GetFileSystem(const std::string + return out; + } + +-std::string MountInfo::GetFileSystemMountPoint(const wchar_t *lpwsz_path) const ++std::string MountInfo::GetFileSystemMountPoint(const wchar_t *lpwsz_path, bool want_device) const + { + std::string out; + size_t longest_match = 0; +@@ -394,7 +394,7 @@ std::string MountInfo::GetFileSystemMountPoint(const w + for (const auto &it : *_mountpoints) { + if (it.path.size() > longest_match && StrStartsFrom(path, it.path.c_str())) { + longest_match = it.path.size(); +- out = it.path; ++ out = want_device ? it.device : it.path; + } + } + return out; diff --git a/misc/far2l/files/patch-far2l_src_mix_MountInfo.h b/misc/far2l/files/patch-far2l_src_mix_MountInfo.h new file mode 100644 index 000000000000..f8dd9beb1695 --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_mix_MountInfo.h @@ -0,0 +1,11 @@ +--- far2l/src/mix/MountInfo.h.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/mix/MountInfo.h +@@ -40,7 +40,7 @@ class MountInfo (public) + + std::string GetFileSystem(const std::string &path) const; + +- std::string GetFileSystemMountPoint(const wchar_t *lpwsz_path) const; ++ std::string GetFileSystemMountPoint(const wchar_t *lpwsz_path, bool want_device = false) const; + + /// Returns true if path fine to be used multi-threaded-ly + bool IsMultiThreadFriendly(const std::string &path) const; diff --git a/misc/far2l/files/patch-far2l_src_panels_infolist.cpp b/misc/far2l/files/patch-far2l_src_panels_infolist.cpp new file mode 100644 index 000000000000..43e0f9ea1f52 --- /dev/null +++ b/misc/far2l/files/patch-far2l_src_panels_infolist.cpp @@ -0,0 +1,68 @@ +--- far2l/src/panels/infolist.cpp.orig 2025-10-26 08:39:52 UTC ++++ far2l/src/panels/infolist.cpp +@@ -62,7 +62,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF S + // # include <sys/sysctl.h> + #include <mach/mach_host.h> + #include <mach/vm_statistics.h> +-#elif !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__HAIKU__) ++#elif !defined(__DragonFly__) && !defined(__HAIKU__) + #include <sys/sysinfo.h> + #endif + #include <sys/statvfs.h> +@@ -171,8 +171,7 @@ void InfoList::DisplayObject() + // FARString strDriveRoot; + FARString strVolumeName, strFileSystemName, strFileSystemMountPoint; + DWORD MaxNameLength, FileSystemFlags; +- DWORD64 VolumeNumber; +- FARString strDiskNumber; ++ FARString strDeviceName, strDiskNumber; // Serial Number, really. + CloseFile(); + ClearTitles(); + +@@ -223,13 +222,11 @@ void InfoList::DisplayObject() + ConvertNameToReal(strCurDir, strRealDir); + + fprintf(stderr, "apiGetVolumeInformation: %ls\n", strRealDir.CPtr()); +- bool b_info = apiGetVolumeInformation(strRealDir, &strVolumeName, &VolumeNumber, &MaxNameLength, &FileSystemFlags, +- &strFileSystemName, &strFileSystemMountPoint); ++ bool b_info = apiGetVolumeInformation(strRealDir, &strVolumeName, &strDiskNumber, &MaxNameLength, &FileSystemFlags, ++ &strFileSystemName, &strDeviceName, &strFileSystemMountPoint); + if (b_info) { + // strTitle=FARString(L" ")+DiskType+L" "+Msg::InfoDisk+L" "+(strDriveRoot)+L" ("+strFileSystemName+L") "; +- strTitle = L"(" + strFileSystemName + L")"; +- +- strDiskNumber.Format(L"%08X-%08X", (DWORD)(VolumeNumber >> 32), (DWORD)(VolumeNumber & 0xffffffff)); ++ strTitle = strDeviceName + L" (" + strFileSystemName + L")"; + } else // Error! + strTitle = strCurDir; // strDriveRoot; + +@@ -259,9 +256,11 @@ void InfoList::DisplayObject() + PrintInfo(strVolumeName); + } + ++ if (!strDiskNumber.IsEmpty()) { + GotoXY(X1 + 2, CurY++); + PrintText(Msg::InfoDiskNumber); + PrintInfo(strDiskNumber); ++ } + + // new fields + GotoXY(X1 + 2, CurY++); +@@ -444,7 +443,7 @@ void InfoList::DisplayObject() + PrintInfo(strOutStr); + } + +-#elif !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__HAIKU__) ++#elif !defined(__DragonFly__) && !defined(__HAIKU__) + struct sysinfo si = {}; + if (sysinfo(&si) == 0) { + DWORD dwMemoryLoad = 100 - ToPercent64(si.freeram + si.freeswap, si.totalram + si.totalswap); +@@ -683,7 +682,7 @@ void InfoList::PrintInfo(const wchar_t *str) + + FARString strStr = str; + TruncStr(strStr, MaxLength); +- int Length = (int)strStr.GetLength(); ++ int Length = (int)strStr.CellsCount(); + int NewX = X2 - Length - 1; + + if (NewX > X1 && NewX > WhereX()) { |
