Bug 14298 - stat()-like api with libsmb_file_info
Summary: stat()-like api with libsmb_file_info
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 4.12.0rc4
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2020-02-26 13:57 UTC by Harald Sitter
Modified: 2020-02-26 13:57 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Harald Sitter 2020-02-26 13:57:32 UTC
The newish smbc_readdirplus API introduced a new struct libsmb_file_info which kind of replaces struct stat with something more smb-centric. It'd make a lot of sense to also have stat()-like API returning a libsmb_file_info to complement the dir iteration API.

In KDE's KIO SMB tech we have a listDir() and a stat() function. They work with smbc_readdirplus2() and smbc_stat() respectively. Since stats are translated into KIO's cross-platform equivalent of a stat, both functions need to convert smbc's output. Currently that conversion code is shared and works on the struct stat data being the common denominator. If there was a stat()-like API returning libsmb_file_info instead we could get away from all use of struct stat and simply use struct libsmb_file_info as the go-to format for talking about entries.
Which then means we can use smbc_readdirplus() instead of smbc_readdirplus2().

e.g. something like

int smbc_file_info(const char *url, struct libsmb_file_info *info);