diff --git a/misc/far2l/files/patch-far2l_src_farwinapi.cpp b/misc/far2l/files/patch-far2l_src_farwinapi.cpp index c5bc3cafab73..760615a0c3b2 100644 --- a/misc/far2l/files/patch-far2l_src_farwinapi.cpp +++ b/misc/far2l/files/patch-far2l_src_farwinapi.cpp @@ -1,54 +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 #include #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) +#include #include #elif !defined(__HAIKU__) #include @@ -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,8 +484,6 @@ BOOL apiGetVolumeInformation(const wchar_t *lpwszRootP +@@ -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; -@@ -507,8 +506,22 @@ BOOL apiGetVolumeInformation(const wchar_t *lpwszRootP +- 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_panels_infolist.cpp b/misc/far2l/files/patch-far2l_src_panels_infolist.cpp index f3b70d2fc3bc..43e0f9ea1f52 100644 --- a/misc/far2l/files/patch-far2l_src_panels_infolist.cpp +++ b/misc/far2l/files/patch-far2l_src_panels_infolist.cpp @@ -1,47 +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 #include #include -#elif !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__HAIKU__) +#elif !defined(__DragonFly__) && !defined(__HAIKU__) #include #endif #include @@ -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; -@@ -444,7 +441,7 @@ void InfoList::DisplayObject() +@@ -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()) {