summaryrefslogtreecommitdiff
path: root/lib9p/tests/test_server/fs_flush.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/tests/test_server/fs_flush.c')
-rw-r--r--lib9p/tests/test_server/fs_flush.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/lib9p/tests/test_server/fs_flush.c b/lib9p/tests/test_server/fs_flush.c
index dbed3e7..e6408d7 100644
--- a/lib9p/tests/test_server/fs_flush.c
+++ b/lib9p/tests/test_server/fs_flush.c
@@ -31,28 +31,23 @@ static struct lib9p_qid flush_file_qid(struct flush_file *self) {
};
}
-static struct lib9p_stat flush_file_stat(struct flush_file *self, struct lib9p_srv_ctx *ctx) {
+static struct lib9p_srv_stat flush_file_stat(struct flush_file *self, struct lib9p_srv_ctx *ctx) {
assert(self);
assert(ctx);
- return (struct lib9p_stat){
- .kern_type = 0,
- .kern_dev = 0,
- .file_qid = flush_file_qid(self),
- .file_mode = 0444,
- .file_atime = UTIL9P_ATIME,
- .file_mtime = UTIL9P_MTIME,
- .file_size = 6,
- .file_name = lib9p_str(self->name),
- .file_owner_uid = lib9p_str("root"),
- .file_owner_gid = lib9p_str("root"),
- .file_last_modified_uid = lib9p_str("root"),
- .file_extension = lib9p_str(NULL),
- .file_owner_n_uid = 0,
- .file_owner_n_gid = 0,
- .file_last_modified_n_uid = 0,
+ return (struct lib9p_srv_stat){
+ .qid = flush_file_qid(self),
+ .mode = 0444,
+ .atime_sec = UTIL9P_ATIME,
+ .mtime_sec = UTIL9P_MTIME,
+ .size = 6,
+ .name = lib9p_str(self->name),
+ .owner_uid = { .name = lib9p_str("root"), .num = 0 },
+ .owner_gid = { .name = lib9p_str("root"), .num = 0 },
+ .last_modifier_uid = { .name = lib9p_str("root"), .num = 0 },
+ .extension = lib9p_str(NULL),
};
}
-static void flush_file_wstat(struct flush_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_stat) {
+static void flush_file_wstat(struct flush_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) {
assert(self);
assert(ctx);
lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "cannot wstat API file");
@@ -107,7 +102,7 @@ static void flush_fio_pread(struct flush_fio *self, struct lib9p_srv_ctx *ctx,
assert(ret);
/* Wait for first Tflush */
- while (cr_chan_num_waiters(&ctx->flush_ch) == 0)
+ while (!lib9p_srv_flush_requested(ctx))
cr_yield();
/* Wait for the specified number of Tflush (may be higher *or*
@@ -117,7 +112,6 @@ static void flush_fio_pread(struct flush_fio *self, struct lib9p_srv_ctx *ctx,
cr_yield();
/* Return */
- bool flushed;
switch (self->parent->flush_behavior) {
case FLUSH_READ:
*ret = (struct iovec){
@@ -126,13 +120,11 @@ static void flush_fio_pread(struct flush_fio *self, struct lib9p_srv_ctx *ctx,
};
break;
case FLUSH_ERROR:
- flushed = lib9p_srv_accept_flush(ctx);
- assert(flushed);
+ lib9p_srv_acknowledge_flush(ctx);
lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_ECANCELED, "request canceled by flush");
break;
case FLUSH_SILENT:
- flushed = lib9p_srv_accept_flush(ctx);
- assert(flushed);
+ lib9p_srv_acknowledge_flush(ctx);
break;
}
cr_yield();