[kio] [Bug 245226] Dolphin doesn't show free space on samba shares

Mathias Tillman master.homer at gmail.com
Fri Jan 10 13:58:11 GMT 2014


https://bugs.kde.org/show_bug.cgi?id=245226

Mathias Tillman <master.homer at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |master.homer at gmail.com

--- Comment #6 from Mathias Tillman <master.homer at gmail.com> ---
Sorry to comment on such an old bug, but this is still not implemented in KDE
4.12. I know this can be done as I've done it myself using libsmbclient. Here
is an example implementation that works just fine:
void auth_fn(const char *server, const char *share,
         char *workgroup, int wgmaxlen, char *username, int unmaxlen,
         char *password, int pwmaxlen)
{
    strcpy(username, "guest");
}

bool calculateSMBSpace(char *url, unsigned long long &spaceTotal, unsigned long
long &spaceFree) {
    int err = smbc_init(auth_fn,  0);
    if (err < 0) {
        return false;
    }

    int handle = smbc_opendir(url);
    if(handle < 0) {
        return false;
    }

    struct statvfs dirStat;
    err = smbc_fstatvfs(handle, &dirStat);
    smbc_closedir(handle);

    if (err < 0) {
        return false;
    }

    spaceTotal = dirStat.f_bsize * dirStat.f_blocks;
    spaceFree = dirStat.f_bsize * dirStat.f_bavail;

    return true;
}

I would write the implementation myself, but I don't know my way around the KDE
code too well and I'm not sure if libsmbclient is cross-platform which might
mean that some OSes would be left out.

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Unassigned-bugs mailing list