summaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2023-03-13 22:35:51 +0900
committerRyo Nakamura <upa@haeena.net>2023-03-13 22:35:51 +0900
commit5f9f20f15006fab8065780eda52f32f14bb3935c (patch)
treee524527cb0994d5905690a457d3292789d0fc410 /src/path.h
parentceb9ebd5a8ee6e013cf05b51a5a0ca2aac1ff3ee (diff)
mscp_prepare() scans source paths in a thread.
This commit runs mscp_prepare() in a pthread. mscp copy threads run aysnchronously with mscp_prepare(). So, when mscp_prepare() has not finished yet (due to too many source files), we can start to copy files.
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/path.h b/src/path.h
index acf0945..41b22fa 100644
--- a/src/path.h
+++ b/src/path.h
@@ -39,6 +39,7 @@ struct chunk {
struct chunk_pool {
struct list_head list; /* list of struct chunk */
+ size_t count;
lock lock;
int state;
};
@@ -54,11 +55,12 @@ void chunk_pool_init(struct chunk_pool *cp);
struct chunk *chunk_pool_pop(struct chunk_pool *cp);
#define CHUNK_POP_WAIT ((void *) -1)
-/* set adding chunks to this pool has finished */
-void chunk_pool_done(struct chunk_pool *cp);
+/* set and check fillingchunks to this pool has finished */
+void chunk_pool_set_filled(struct chunk_pool *cp);
+bool chunk_pool_is_filled(struct chunk_pool *cp);
/* return number of chunks in the pool */
-int chunk_pool_size(struct chunk_pool *cp);
+size_t chunk_pool_size(struct chunk_pool *cp);
/* free chunks in the chunk_pool */
void chunk_pool_release(struct chunk_pool *cp);
@@ -168,6 +170,14 @@ static mdirent *mscp_readdir(mdir *d)
return &e;
}
+static void mscp_dirent_free(mdirent *e)
+{
+ if (e->r) {
+ sftp_attributes_free(e->r);
+ e->r = NULL;
+ }
+}
+
/* wrap retriving error */
static const char *mscp_strerror(sftp_session sftp)
{