summaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2024-02-06 23:09:59 +0900
committerRyo Nakamura <upa@haeena.net>2024-02-06 23:09:59 +0900
commit93f155cffe45e1438e316ed84dcd1bd5215c8030 (patch)
tree06fa8aac9d9cb8f5ff3dd55581b80fc8e53b1a43 /src/path.h
parent4f0669f8f86acb09f10ffb5af273f86d8d6ddd34 (diff)
add .clang-format from Linux kernel and format sources
The exception is that ColumnLimit is 90.
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h73
1 files changed, 35 insertions, 38 deletions
diff --git a/src/path.h b/src/path.h
index d566947..7706458 100644
--- a/src/path.h
+++ b/src/path.h
@@ -12,39 +12,38 @@
#include <ssh.h>
struct path {
- struct list_head list; /* mscp->path_list */
+ struct list_head list; /* mscp->path_list */
- char *path; /* file path */
- size_t size; /* size of file on this path */
- mode_t mode; /* permission */
+ char *path; /* file path */
+ size_t size; /* size of file on this path */
+ mode_t mode; /* permission */
- char *dst_path; /* copy dst path */
+ char *dst_path; /* copy dst path */
- int state;
- lock lock;
- refcnt refcnt;
+ int state;
+ lock lock;
+ refcnt refcnt;
};
-#define FILE_STATE_INIT 0
-#define FILE_STATE_OPENED 1
-#define FILE_STATE_DONE 2
+#define FILE_STATE_INIT 0
+#define FILE_STATE_OPENED 1
+#define FILE_STATE_DONE 2
struct chunk {
- struct list_head list; /* chunk_pool->list */
+ struct list_head list; /* chunk_pool->list */
struct path *p;
- size_t off; /* offset of this chunk on the file on path p */
- size_t len; /* length of this chunk */
- size_t done; /* copied bytes for this chunk by a thread */
+ size_t off; /* offset of this chunk on the file on path p */
+ size_t len; /* length of this chunk */
+ size_t done; /* copied bytes for this chunk by a thread */
};
struct chunk_pool {
- struct list_head list; /* list of struct chunk */
- size_t count;
- lock lock;
- int state;
+ struct list_head list; /* list of struct chunk */
+ size_t count;
+ lock lock;
+ int state;
};
-
/* initialize chunk pool */
void chunk_pool_init(struct chunk_pool *cp);
@@ -53,7 +52,7 @@ void chunk_pool_init(struct chunk_pool *cp);
* added, or pointer to chunk.
*/
struct chunk *chunk_pool_pop(struct chunk_pool *cp);
-#define CHUNK_POP_WAIT ((void *) -1)
+#define CHUNK_POP_WAIT ((void *)-1)
/* set and check fillingchunks to this pool has finished */
void chunk_pool_set_filled(struct chunk_pool *cp);
@@ -68,24 +67,22 @@ bool chunk_pool_is_empty(struct chunk_pool *cp);
/* free chunks in the chunk_pool */
void chunk_pool_release(struct chunk_pool *cp);
-
-
struct path_resolve_args {
- size_t *total_bytes;
-
- /* args to resolve src path to dst path */
- const char *src_path;
- const char *dst_path;
- bool src_path_is_dir;
- bool dst_path_is_dir;
- bool dst_path_should_dir;
-
- /* args to resolve chunks for a path */
- struct chunk_pool *cp;
- int nr_conn;
- size_t min_chunk_sz;
- size_t max_chunk_sz;
- size_t chunk_align;
+ size_t *total_bytes;
+
+ /* args to resolve src path to dst path */
+ const char *src_path;
+ const char *dst_path;
+ bool src_path_is_dir;
+ bool dst_path_is_dir;
+ bool dst_path_should_dir;
+
+ /* args to resolve chunks for a path */
+ struct chunk_pool *cp;
+ int nr_conn;
+ size_t min_chunk_sz;
+ size_t max_chunk_sz;
+ size_t chunk_align;
};
/* recursivly walk through src_path and fill path_list for each file */