mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-22 10:50:15 -10:00
A download was gathered whole in a buffer of the size the server reported, then written to the local file in one piece. The local file is now opened first and each SMB read goes to it as it arrives, through one buffer the size of a read: no copy of the whole file in memory, and no allocation sized by the server. A failed local write fails the download; it was not checked before.
622 lines
17 KiB
C
622 lines
17 KiB
C
/* RetroArch - A frontend for libretro.
|
|
*
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
*
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <errno.h>
|
|
#include <fcntl.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <time.h>
|
|
|
|
#ifdef HAVE_RETROSMB
|
|
#include <net/net_smb2_compat.h>
|
|
#else
|
|
#include <smb2/smb2.h>
|
|
#include <smb2/libsmb2.h>
|
|
#endif
|
|
|
|
#include <retro_miscellaneous.h>
|
|
#include <streams/file_stream.h>
|
|
#include <string/stdstring.h>
|
|
#include <time/rtime.h>
|
|
|
|
#include "../cloud_sync_driver.h"
|
|
#include "../../configuration.h"
|
|
#include "../../libretro-common/vfs/vfs_implementation_smb.h"
|
|
#include "../../verbosity.h"
|
|
#include <compat/strl.h>
|
|
|
|
#define SMBPFX "[SMB] "
|
|
|
|
/* ========== State ========== */
|
|
|
|
typedef struct
|
|
{
|
|
struct smb2_context *ctx;
|
|
char subdir[PATH_MAX_LENGTH];
|
|
} smb_sync_state_t;
|
|
|
|
static smb_sync_state_t smb_st = {0};
|
|
|
|
/* The settings, as cloud_sync_capture() found them. */
|
|
static struct
|
|
{
|
|
char server[256];
|
|
char share[256];
|
|
char subdir[PATH_MAX_LENGTH];
|
|
char user[128];
|
|
char password[128];
|
|
char workgroup[64];
|
|
unsigned auth_mode;
|
|
unsigned timeout;
|
|
bool destructive;
|
|
} smb_set;
|
|
|
|
/* ========== Helpers ========== */
|
|
|
|
/* Build an SMB-relative path: {subdir}/{path}.
|
|
* libsmb2 paths must NOT have a leading '/'. */
|
|
static void smb_sync_build_path(char *dest, size_t dest_size,
|
|
const char *subdir, const char *path)
|
|
{
|
|
size_t _len = 0;
|
|
|
|
dest[0] = '\0';
|
|
|
|
if (subdir && *subdir)
|
|
{
|
|
_len = strlcpy(dest, subdir, dest_size);
|
|
if (_len > 0 && _len < dest_size && dest[_len - 1] != '/')
|
|
{
|
|
dest[_len++] = '/';
|
|
dest[_len ] = '\0';
|
|
}
|
|
}
|
|
|
|
if (path)
|
|
{
|
|
while (*path == '/')
|
|
path++;
|
|
if (_len < dest_size)
|
|
strlcpy(dest + _len, path, dest_size - _len);
|
|
}
|
|
}
|
|
|
|
/* Recursively ensure all directories in `path` exist.
|
|
* Walks each '/'-separated segment, calling smb2_mkdir() for each.
|
|
* Ignores "already exists" errors. */
|
|
static bool smb_sync_ensure_dir(struct smb2_context *ctx, const char *path)
|
|
{
|
|
char buf[PATH_MAX_LENGTH];
|
|
char *p;
|
|
int rc;
|
|
|
|
strlcpy(buf, path, sizeof(buf));
|
|
|
|
for (p = buf; *p; p++)
|
|
{
|
|
if (*p != '/')
|
|
continue;
|
|
|
|
*p = '\0';
|
|
if (buf[0])
|
|
{
|
|
rc = smb2_mkdir(ctx, buf);
|
|
if (rc < 0 && rc != -EEXIST)
|
|
{
|
|
RARCH_ERR(SMBPFX "mkdir '%s' failed: %s\n",
|
|
buf, smb2_get_error(ctx));
|
|
return false;
|
|
}
|
|
}
|
|
*p = '/';
|
|
}
|
|
|
|
/* Final segment (if path doesn't end with '/') */
|
|
if (buf[0])
|
|
{
|
|
rc = smb2_mkdir(ctx, buf);
|
|
if (rc < 0 && rc != -EEXIST)
|
|
{
|
|
RARCH_ERR(SMBPFX "mkdir '%s' failed: %s\n",
|
|
buf, smb2_get_error(ctx));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/* Ensure parent directories of `path` exist.
|
|
* E.g., for "saves/snes/game.srm", ensures "saves/" and "saves/snes/" exist. */
|
|
static bool smb_sync_ensure_parent_dir(struct smb2_context *ctx, const char *path)
|
|
{
|
|
char dir[PATH_MAX_LENGTH];
|
|
char *last_slash;
|
|
|
|
strlcpy(dir, path, sizeof(dir));
|
|
last_slash = strrchr(dir, '/');
|
|
if (!last_slash)
|
|
return true; /* no parent directory */
|
|
|
|
*last_slash = '\0';
|
|
return smb_sync_ensure_dir(ctx, dir);
|
|
}
|
|
|
|
/* ========== Driver functions ========== */
|
|
|
|
static void smb_sync_capture(void)
|
|
{
|
|
settings_t *settings = config_get_ptr();
|
|
strlcpy(smb_set.server, settings->arrays.smb_client_server_address,
|
|
sizeof(smb_set.server));
|
|
strlcpy(smb_set.share, settings->arrays.smb_client_share,
|
|
sizeof(smb_set.share));
|
|
strlcpy(smb_set.subdir, settings->arrays.smb_client_subdir,
|
|
sizeof(smb_set.subdir));
|
|
strlcpy(smb_set.user, settings->arrays.smb_client_username,
|
|
sizeof(smb_set.user));
|
|
strlcpy(smb_set.password, settings->arrays.smb_client_password,
|
|
sizeof(smb_set.password));
|
|
strlcpy(smb_set.workgroup, settings->arrays.smb_client_workgroup,
|
|
sizeof(smb_set.workgroup));
|
|
smb_set.auth_mode = settings->uints.smb_client_auth_mode;
|
|
smb_set.timeout = settings->uints.smb_client_timeout;
|
|
smb_set.destructive = settings->bools.cloud_sync_destructive;
|
|
}
|
|
|
|
static bool smb_sync_begin(cloud_sync_complete_handler_t cb, void *user_data)
|
|
{
|
|
const char *server = smb_set.server;
|
|
const char *share = smb_set.share;
|
|
const char *user = smb_set.user;
|
|
const char *password = smb_set.password;
|
|
const char *workgroup = smb_set.workgroup;
|
|
const char *subdir = smb_set.subdir;
|
|
unsigned auth_mode = smb_set.auth_mode;
|
|
unsigned timeout = smb_set.timeout;
|
|
struct smb2_context *ctx;
|
|
int rc;
|
|
|
|
if ((!server || !*server) || (!share || !*share))
|
|
{
|
|
RARCH_ERR(SMBPFX "Server address and share must be configured\n");
|
|
cb(user_data, NULL, false, NULL);
|
|
return true;
|
|
}
|
|
|
|
ctx = smb_ctx_new();
|
|
if (!ctx)
|
|
{
|
|
RARCH_ERR(SMBPFX "Failed to create SMB context\n");
|
|
cb(user_data, NULL, false, NULL);
|
|
return true;
|
|
}
|
|
|
|
if (user && *user)
|
|
smb2_set_user(ctx, user);
|
|
if (password && *password)
|
|
smb2_set_password(ctx, password);
|
|
if (workgroup && *workgroup)
|
|
smb2_set_domain(ctx, workgroup);
|
|
if (timeout > 0)
|
|
smb2_set_timeout(ctx, (int)timeout);
|
|
smb2_set_security_mode(ctx, SMB2_NEGOTIATE_SIGNING_ENABLED);
|
|
smb2_set_authentication(ctx, (int)auth_mode);
|
|
|
|
RARCH_LOG(SMBPFX "Connecting to %s/%s as %s\n",
|
|
server, share, (!user || !*user) ? "(anonymous)" : user);
|
|
|
|
rc = smb2_connect_share(ctx, server, share,
|
|
(!user || !*user) ? NULL : user);
|
|
if (rc < 0)
|
|
{
|
|
RARCH_ERR(SMBPFX "Connect failed: %s\n", smb2_get_error(ctx));
|
|
smb_ctx_free(ctx);
|
|
cb(user_data, NULL, false, NULL);
|
|
return true;
|
|
}
|
|
|
|
smb_st.ctx = ctx;
|
|
|
|
/* Build cloud sync subdir: {smb_client_subdir}/cloud_sync */
|
|
smb_st.subdir[0] = '\0';
|
|
{
|
|
size_t _len = 0;
|
|
size_t sz = sizeof(smb_st.subdir);
|
|
if (subdir && *subdir)
|
|
{
|
|
_len = strlcpy(smb_st.subdir, subdir, sz);
|
|
if (_len < sz)
|
|
_len += strlcpy_lit(smb_st.subdir + _len, "/", sz - _len);
|
|
}
|
|
if (_len < sz)
|
|
strlcpy_lit(smb_st.subdir + _len, "cloud_sync", sz - _len);
|
|
}
|
|
|
|
/* Ensure subdir exists */
|
|
{
|
|
if (!smb_sync_ensure_dir(ctx, smb_st.subdir))
|
|
{
|
|
RARCH_ERR(SMBPFX "Failed to create subdir '%s'\n", smb_st.subdir);
|
|
smb2_disconnect_share(ctx);
|
|
smb_ctx_free(ctx);
|
|
smb_st.ctx = NULL;
|
|
cb(user_data, NULL, false, NULL);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
RARCH_LOG(SMBPFX "Connected successfully\n");
|
|
cb(user_data, NULL, true, NULL);
|
|
return true;
|
|
}
|
|
|
|
static bool smb_sync_end(cloud_sync_complete_handler_t cb, void *user_data)
|
|
{
|
|
if (smb_st.ctx)
|
|
{
|
|
smb2_disconnect_share(smb_st.ctx);
|
|
smb_ctx_free(smb_st.ctx);
|
|
smb_st.ctx = NULL;
|
|
}
|
|
smb_st.subdir[0] = '\0';
|
|
|
|
cb(user_data, NULL, true, NULL);
|
|
return true;
|
|
}
|
|
|
|
static bool smb_read(const char *path, const char *file,
|
|
cloud_sync_complete_handler_t cb, void *user_data)
|
|
{
|
|
char smb_path[PATH_MAX_LENGTH];
|
|
struct smb2_stat_64 st;
|
|
struct smb2fh *fh;
|
|
uint8_t *buf = NULL;
|
|
uint64_t file_size = 0;
|
|
uint64_t offset = 0;
|
|
uint32_t chunk;
|
|
RFILE *rfile = NULL;
|
|
bool failed = false;
|
|
int rc;
|
|
|
|
smb_sync_build_path(smb_path, sizeof(smb_path), smb_st.subdir, path);
|
|
|
|
/* Check if file exists */
|
|
rc = smb2_stat(smb_st.ctx, smb_path, &st);
|
|
if (rc < 0)
|
|
{
|
|
if (-rc == ENOENT)
|
|
{
|
|
/* File doesn't exist on server — that's a valid "success" */
|
|
RARCH_DBG(SMBPFX "File not found: %s\n", smb_path);
|
|
cb(user_data, path, true, NULL);
|
|
return true;
|
|
}
|
|
RARCH_ERR(SMBPFX "Stat '%s' failed: %s\n",
|
|
smb_path, smb2_get_error(smb_st.ctx));
|
|
cb(user_data, path, false, NULL);
|
|
return true;
|
|
}
|
|
|
|
file_size = st.smb2_size;
|
|
|
|
fh = smb2_open(smb_st.ctx, smb_path, O_RDONLY);
|
|
if (!fh)
|
|
{
|
|
RARCH_ERR(SMBPFX "Failed to open '%s': %s\n",
|
|
smb_path, smb2_get_error(smb_st.ctx));
|
|
cb(user_data, path, false, NULL);
|
|
return true;
|
|
}
|
|
|
|
/* Each read goes to the local file as it arrives, through one
|
|
* buffer the size of a read, rather than the whole file gathered
|
|
* in memory first -- at whatever size the server reported. */
|
|
rfile = filestream_open(file, RETRO_VFS_FILE_ACCESS_READ_WRITE,
|
|
RETRO_VFS_FILE_ACCESS_HINT_SEQUENTIAL_BULK);
|
|
if (!rfile)
|
|
{
|
|
RARCH_ERR(SMBPFX "Failed to open local file '%s'\n", file);
|
|
smb2_close(smb_st.ctx, fh);
|
|
cb(user_data, path, false, NULL);
|
|
return true;
|
|
}
|
|
|
|
chunk = smb2_get_max_read_size(smb_st.ctx);
|
|
if ((uint64_t)chunk > file_size)
|
|
chunk = (uint32_t)file_size;
|
|
if (chunk && !(buf = (uint8_t *)malloc(chunk)))
|
|
{
|
|
filestream_close(rfile);
|
|
smb2_close(smb_st.ctx, fh);
|
|
cb(user_data, path, false, NULL);
|
|
return true;
|
|
}
|
|
|
|
while (offset < file_size)
|
|
{
|
|
uint32_t to_read = (uint32_t)((file_size - offset) < chunk
|
|
? (file_size - offset) : chunk);
|
|
int n = smb2_read(smb_st.ctx, fh, buf, to_read);
|
|
if (n < 0)
|
|
{
|
|
RARCH_ERR(SMBPFX "Read error on '%s': %s\n",
|
|
smb_path, smb2_get_error(smb_st.ctx));
|
|
failed = true;
|
|
break;
|
|
}
|
|
if (n == 0)
|
|
break; /* EOF */
|
|
if (filestream_write(rfile, buf, n) != n)
|
|
{
|
|
RARCH_ERR(SMBPFX "Failed to write local file '%s'\n", file);
|
|
failed = true;
|
|
break;
|
|
}
|
|
offset += (uint32_t)n;
|
|
}
|
|
|
|
free(buf);
|
|
smb2_close(smb_st.ctx, fh);
|
|
|
|
if (failed)
|
|
{
|
|
filestream_close(rfile);
|
|
cb(user_data, path, false, NULL);
|
|
return true;
|
|
}
|
|
filestream_seek(rfile, 0, SEEK_SET);
|
|
|
|
RARCH_DBG(SMBPFX "Read %s (%u bytes)\n", smb_path, (unsigned)offset);
|
|
cb(user_data, path, true, rfile);
|
|
return true;
|
|
}
|
|
|
|
/* <smb_path>-<yymmdd-hhmmss>, beside the file: where a non-destructive
|
|
* delete has always put the copy it keeps. */
|
|
static void smb_backup_path(char *s, size_t len, const char *smb_path)
|
|
{
|
|
time_t t;
|
|
struct tm tm_buf;
|
|
char ts[32];
|
|
|
|
time(&t);
|
|
rtime_localtime(&t, &tm_buf);
|
|
snprintf(ts, sizeof(ts), "-%02d%02d%02d-%02d%02d%02d",
|
|
tm_buf.tm_year % 100, tm_buf.tm_mon + 1, tm_buf.tm_mday,
|
|
tm_buf.tm_hour, tm_buf.tm_min, tm_buf.tm_sec);
|
|
strlcpy(s, smb_path, len);
|
|
strlcat(s, ts, len);
|
|
}
|
|
|
|
/* Write the whole of @buf to a new remote file at @smb_path. */
|
|
static bool smb_write_file(const char *smb_path, const uint8_t *buf,
|
|
uint64_t size)
|
|
{
|
|
uint64_t offset = 0;
|
|
uint32_t chunk = smb2_get_max_write_size(smb_st.ctx);
|
|
struct smb2fh *fh = smb2_open(smb_st.ctx, smb_path,
|
|
O_WRONLY | O_CREAT | O_TRUNC);
|
|
|
|
if (!fh)
|
|
{
|
|
RARCH_ERR(SMBPFX "Failed to open '%s' for writing: %s\n",
|
|
smb_path, smb2_get_error(smb_st.ctx));
|
|
return false;
|
|
}
|
|
|
|
/* O_TRUNC is not honoured by every server; the file is new anyway,
|
|
* but a stale one from an interrupted upload must not keep a tail. */
|
|
smb2_ftruncate(smb_st.ctx, fh, 0);
|
|
|
|
while (offset < size)
|
|
{
|
|
uint32_t to_write = (uint32_t)((size - offset) < chunk
|
|
? (size - offset) : chunk);
|
|
int n = smb2_write(smb_st.ctx, fh, buf + offset, to_write);
|
|
/* 0 would loop here forever. */
|
|
if (n <= 0)
|
|
{
|
|
RARCH_ERR(SMBPFX "Write error on '%s': %s\n",
|
|
smb_path, smb2_get_error(smb_st.ctx));
|
|
smb2_close(smb_st.ctx, fh);
|
|
return false;
|
|
}
|
|
offset += (uint32_t)n;
|
|
}
|
|
|
|
smb2_close(smb_st.ctx, fh);
|
|
return true;
|
|
}
|
|
|
|
/* The upload goes to a temporary file first and is renamed into place
|
|
* once it is complete. The old code opened the file itself, truncated
|
|
* it and wrote: a write that failed part way left the server holding a
|
|
* truncated save.
|
|
*
|
|
* Before the rename, the file being replaced is moved aside:
|
|
* with destructive sync off it becomes <path>-<yymmdd-hhmmss>, the copy
|
|
* a non-destructive delete keeps, so an upload no longer destroys the
|
|
* server's copy either; with it on, it is removed. If the final rename
|
|
* fails, the old file is put back. The server manifest is rewritten
|
|
* every sync and is never kept. */
|
|
static bool smb_update(const char *path, RFILE *rfile,
|
|
cloud_sync_complete_handler_t cb, void *user_data)
|
|
{
|
|
char smb_path[PATH_MAX_LENGTH];
|
|
char tmp_path[PATH_MAX_LENGTH];
|
|
char backup_path[PATH_MAX_LENGTH];
|
|
struct smb2_stat_64 st;
|
|
bool keep_old;
|
|
bool had_old;
|
|
int64_t file_size;
|
|
uint8_t *buf = NULL;
|
|
|
|
smb_sync_build_path(smb_path, sizeof(smb_path), smb_st.subdir, path);
|
|
strlcpy(tmp_path, smb_path, sizeof(tmp_path));
|
|
strlcat(tmp_path, ".rauploading", sizeof(tmp_path));
|
|
|
|
/* Ensure parent directories exist */
|
|
if (!smb_sync_ensure_parent_dir(smb_st.ctx, smb_path))
|
|
{
|
|
RARCH_ERR(SMBPFX "Failed to create parent dirs for '%s'\n", smb_path);
|
|
cb(user_data, path, false, rfile);
|
|
return true;
|
|
}
|
|
|
|
/* Read the local file into memory, from the start. */
|
|
file_size = filestream_get_size(rfile);
|
|
if (file_size < 0)
|
|
file_size = 0;
|
|
if (file_size > 0)
|
|
{
|
|
if ( !(buf = (uint8_t *)malloc((size_t)file_size))
|
|
|| filestream_seek(rfile, 0, SEEK_SET) < 0
|
|
|| filestream_read(rfile, buf, file_size) != file_size)
|
|
{
|
|
RARCH_ERR(SMBPFX "Could not read local file for '%s'\n", smb_path);
|
|
free(buf);
|
|
cb(user_data, path, false, rfile);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
if (!smb_write_file(tmp_path, buf, (uint64_t)file_size))
|
|
{
|
|
free(buf);
|
|
smb2_unlink(smb_st.ctx, tmp_path);
|
|
cb(user_data, path, false, rfile);
|
|
return true;
|
|
}
|
|
free(buf);
|
|
|
|
had_old = smb2_stat(smb_st.ctx, smb_path, &st) >= 0;
|
|
keep_old = had_old
|
|
&& !smb_set.destructive
|
|
&& !string_is_equal(path, CLOUD_SYNC_SERVER_MANIFEST);
|
|
|
|
if (had_old)
|
|
{
|
|
int rc;
|
|
if (keep_old)
|
|
{
|
|
smb_backup_path(backup_path, sizeof(backup_path), smb_path);
|
|
rc = smb2_rename(smb_st.ctx, smb_path, backup_path);
|
|
}
|
|
else
|
|
rc = smb2_unlink(smb_st.ctx, smb_path);
|
|
if (rc < 0)
|
|
{
|
|
RARCH_ERR(SMBPFX "Not replacing '%s': could not %s the old copy: %s\n",
|
|
smb_path, keep_old ? "back up" : "remove",
|
|
smb2_get_error(smb_st.ctx));
|
|
smb2_unlink(smb_st.ctx, tmp_path);
|
|
cb(user_data, path, false, rfile);
|
|
return true;
|
|
}
|
|
if (keep_old)
|
|
RARCH_DBG(SMBPFX "Backed up %s -> %s\n", smb_path, backup_path);
|
|
}
|
|
|
|
if (smb2_rename(smb_st.ctx, tmp_path, smb_path) < 0)
|
|
{
|
|
RARCH_ERR(SMBPFX "Rename '%s' -> '%s' failed: %s\n",
|
|
tmp_path, smb_path, smb2_get_error(smb_st.ctx));
|
|
if (keep_old)
|
|
smb2_rename(smb_st.ctx, backup_path, smb_path);
|
|
smb2_unlink(smb_st.ctx, tmp_path);
|
|
cb(user_data, path, false, rfile);
|
|
return true;
|
|
}
|
|
|
|
RARCH_DBG(SMBPFX "Updated %s (%u bytes)\n",
|
|
smb_path, (unsigned)file_size);
|
|
cb(user_data, path, true, rfile);
|
|
return true;
|
|
}
|
|
|
|
static bool smb_free(const char *path,
|
|
cloud_sync_complete_handler_t cb, void *user_data)
|
|
{
|
|
char smb_path[PATH_MAX_LENGTH];
|
|
struct smb2_stat_64 st;
|
|
int rc;
|
|
|
|
smb_sync_build_path(smb_path, sizeof(smb_path), smb_st.subdir, path);
|
|
|
|
/* Check if file exists */
|
|
rc = smb2_stat(smb_st.ctx, smb_path, &st);
|
|
if (rc < 0)
|
|
{
|
|
if (-rc == ENOENT)
|
|
{
|
|
/* Already gone — success */
|
|
cb(user_data, path, true, NULL);
|
|
return true;
|
|
}
|
|
RARCH_ERR(SMBPFX "Stat '%s' failed: %s\n",
|
|
smb_path, smb2_get_error(smb_st.ctx));
|
|
cb(user_data, path, false, NULL);
|
|
return true;
|
|
}
|
|
|
|
if (smb_set.destructive)
|
|
{
|
|
rc = smb2_unlink(smb_st.ctx, smb_path);
|
|
if (rc < 0)
|
|
{
|
|
RARCH_ERR(SMBPFX "Delete '%s' failed: %s\n",
|
|
smb_path, smb2_get_error(smb_st.ctx));
|
|
cb(user_data, path, false, NULL);
|
|
return true;
|
|
}
|
|
RARCH_DBG(SMBPFX "Deleted %s\n", smb_path);
|
|
}
|
|
else
|
|
{
|
|
/* Non-destructive: rename with timestamp */
|
|
char new_path[PATH_MAX_LENGTH];
|
|
smb_backup_path(new_path, sizeof(new_path), smb_path);
|
|
|
|
/* Ensure parent dir of backup path exists */
|
|
smb_sync_ensure_parent_dir(smb_st.ctx, new_path);
|
|
|
|
rc = smb2_rename(smb_st.ctx, smb_path, new_path);
|
|
if (rc < 0)
|
|
{
|
|
RARCH_ERR(SMBPFX "Rename '%s' -> '%s' failed: %s\n",
|
|
smb_path, new_path, smb2_get_error(smb_st.ctx));
|
|
cb(user_data, path, false, NULL);
|
|
return true;
|
|
}
|
|
RARCH_DBG(SMBPFX "Backed up %s -> %s\n", smb_path, new_path);
|
|
}
|
|
|
|
cb(user_data, path, true, NULL);
|
|
return true;
|
|
}
|
|
|
|
/* ========== Registration ========== */
|
|
|
|
cloud_sync_driver_t cloud_sync_smb = {
|
|
smb_sync_begin,
|
|
smb_sync_end,
|
|
smb_read,
|
|
smb_update,
|
|
smb_free,
|
|
"smb",
|
|
CLOUD_SYNC_DRIVER_FLG_BLOCKING,
|
|
smb_sync_capture
|
|
};
|