Bug 298801 - Samba share folder properties - show used/available space
Summary: Samba share folder properties - show used/available space
Status: RESOLVED FIXED
Alias: None
Product: kio-extras
Classification: Frameworks and Libraries
Component: Samba (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2012-04-25 11:15 UTC by Pascal d'Hermilly
Modified: 2020-02-13 11:27 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.12.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal d'Hermilly 2012-04-25 11:15:24 UTC
I would like to be able to see used/available space in the properties of a SMB share folder - just like in my home folder.
I can see that "ls" in smbclient returns this information so it should be readily available from the share. Example: "38093 blocks of size 8388608. 32358 blocks available"

Reproducible: Always
Comment 1 Harald Sitter 2020-02-06 15:39:30 UTC
This should be implemented for a while already, looking at some sample servers I am not sure that is actually working correctly though. Possibly related https://bugzilla.samba.org/show_bug.cgi?id=11810

With a windows10 or ubuntu18.04 server the actual block is f_frsize*f_bsize by the looks of it, which is I think not how statvfs should behave anywhere.

Anyway, needs investigation.
Comment 2 Harald Sitter 2020-02-06 15:57:11 UTC
Quick update: seems statvfs outright makes up its own meaning

https://github.com/samba-team/samba/blob/8b04590e4d8f817ad6d194bb9d622c18734e3011/source3/libsmb/libsmb_stat.c#L420

without unix extension the actual blocksize is f_frsize*f_bsize, with unix extension f_frsize is not getting set at all, I guess we need to handle these separately on our end as well `if(f_frsize==0)`
Comment 3 Harald Sitter 2020-02-13 11:27:24 UTC
Git commit 6832817f311bfa106ee971ae51bac288843af08b by Harald Sitter.
Committed on 13/02/2020 at 11:17.
Pushed by sitter into branch 'master'.

smb: fix free space calculation

Summary:
- collapse statvfs call, there's no purpose in manually opening the file
  when libsmbc has a convenience wrapper that does exactly what we need
  with less code on our end
- blockSize is now calculated as per the conditional branches in
  smbc_stat.c
- free space calculation is now backwards compatible with slightly busted
  legacy versions of libsmbc not setting f_bavail

FIXED-IN: 19.12.3

Test Plan: free space calculation now works with windows10, ubuntu18.04, ubuntu19.10

Reviewers: ngraham, meven

Reviewed By: ngraham, meven

Subscribers: meven, kde-frameworks-devel, kfm-devel

Tags: #dolphin, #frameworks

Differential Revision: https://phabricator.kde.org/D27294

M  +20   -17   smb/kio_smb_browse.cpp

https://commits.kde.org/kio-extras/6832817f311bfa106ee971ae51bac288843af08b