Rename project to ToastyFS

This commit is contained in:
2025-11-16 02:10:59 +01:00
parent a4a37b7a36
commit e1cdc28d4d
10 changed files with 436 additions and 436 deletions
+316 -316
View File
File diff suppressed because it is too large Load Diff
+29 -29
View File
@@ -34,8 +34,8 @@ int simulation_client_init(SimulationClient *client, int argc, char **argv,
uint16_t port;
parse_server_addr(argc, argv, &addr, &port);
client->mfs = mousefs_init(addr, port);
if (client->mfs == NULL)
client->tfs = toastyfs_init(addr, port);
if (client->tfs == NULL)
return -1;
client->num_pending = 0;
@@ -43,7 +43,7 @@ int simulation_client_init(SimulationClient *client, int argc, char **argv,
printf("Client set up (remote=%s:%d)\n", addr, port);
*timeout = 0;
return mousefs_process_events(client->mfs, contexts, polled, 0);
return toastyfs_process_events(client->tfs, contexts, polled, 0);
}
static int random_in_range(int min, int max)
@@ -56,73 +56,73 @@ int simulation_client_step(SimulationClient *client, void **contexts,
struct pollfd *polled, int num_polled, int *timeout)
{
// Process any pending events from the network and get new poll descriptors
num_polled = mousefs_process_events(client->mfs, contexts, polled, num_polled);
num_polled = toastyfs_process_events(client->tfs, contexts, polled, num_polled);
for (int i = 0; i < client->num_pending; i++) {
MouseFS_Result result;
if (!mousefs_isdone(client->mfs, client->pending[i].opidx, &result))
ToastyFS_Result result;
if (!toastyfs_isdone(client->tfs, client->pending[i].opidx, &result))
continue;
PendingOperation pending = client->pending[i];
switch (result.type) {
case MOUSEFS_RESULT_EMPTY:
case TOASTYFS_RESULT_EMPTY:
assert(0);
break;
case MOUSEFS_RESULT_CREATE_ERROR:
case TOASTYFS_RESULT_CREATE_ERROR:
assert(pending.type == PENDING_OPERATION_CREATE);
//printf("[Client] create error\n");
break;
case MOUSEFS_RESULT_CREATE_SUCCESS:
case TOASTYFS_RESULT_CREATE_SUCCESS:
assert(pending.type == PENDING_OPERATION_CREATE);
//printf("[Client] create success\n");
break;
case MOUSEFS_RESULT_DELETE_ERROR:
case TOASTYFS_RESULT_DELETE_ERROR:
assert(pending.type == PENDING_OPERATION_DELETE);
//printf("[Client] delete error\n");
break;
case MOUSEFS_RESULT_DELETE_SUCCESS:
case TOASTYFS_RESULT_DELETE_SUCCESS:
assert(pending.type == PENDING_OPERATION_DELETE);
//printf("[Client] delete success\n");
break;
case MOUSEFS_RESULT_LIST_ERROR:
case TOASTYFS_RESULT_LIST_ERROR:
assert(pending.type == PENDING_OPERATION_LIST);
//printf("[Client] list error\n");
break;
case MOUSEFS_RESULT_LIST_SUCCESS:
case TOASTYFS_RESULT_LIST_SUCCESS:
assert(pending.type == PENDING_OPERATION_LIST);
//printf("[Client] list success\n");
break;
case MOUSEFS_RESULT_READ_ERROR:
case TOASTYFS_RESULT_READ_ERROR:
assert(pending.type == PENDING_OPERATION_READ);
//printf("[Client] read error\n");
break;
case MOUSEFS_RESULT_READ_SUCCESS:
case TOASTYFS_RESULT_READ_SUCCESS:
assert(pending.type == PENDING_OPERATION_READ);
//printf("[Client] read success\n");
break;
case MOUSEFS_RESULT_WRITE_ERROR:
case TOASTYFS_RESULT_WRITE_ERROR:
assert(pending.type == PENDING_OPERATION_WRITE);
//printf("[Client] write error\n");
break;
case MOUSEFS_RESULT_WRITE_SUCCESS:
case TOASTYFS_RESULT_WRITE_SUCCESS:
assert(pending.type == PENDING_OPERATION_WRITE);
//printf("[Client] write success\n");
break;
}
free(pending.ptr);
mousefs_result_free(&result);
toastyfs_result_free(&result);
client->pending[i--] = client->pending[--client->num_pending];
}
@@ -172,8 +172,8 @@ int simulation_client_step(SimulationClient *client, void **contexts,
case PENDING_OPERATION_CREATE:
entry = table[random_in_range(0, table_len-1)];
chunk_size = entry.is_dir ? 0 : random_in_range(0, 5000);
ret = mousefs_submit_create(
client->mfs,
ret = toastyfs_submit_create(
client->tfs,
entry.path,
-1,
entry.is_dir,
@@ -184,8 +184,8 @@ int simulation_client_step(SimulationClient *client, void **contexts,
case PENDING_OPERATION_DELETE:
entry = table[random_in_range(0, table_len-1)];
ret = mousefs_submit_delete(
client->mfs,
ret = toastyfs_submit_delete(
client->tfs,
entry.path,
-1
);
@@ -194,8 +194,8 @@ int simulation_client_step(SimulationClient *client, void **contexts,
case PENDING_OPERATION_LIST:
entry = table[random_in_range(0, table_len-1)];
ret = mousefs_submit_list(
client->mfs,
ret = toastyfs_submit_list(
client->tfs,
entry.path,
-1
);
@@ -208,7 +208,7 @@ int simulation_client_step(SimulationClient *client, void **contexts,
len = random_in_range(0, 5000);
ptr = malloc(len);
if (ptr == NULL) assert(0);
ret = mousefs_submit_read(client->mfs,
ret = toastyfs_submit_read(client->tfs,
entry.path,
-1,
off,
@@ -225,8 +225,8 @@ int simulation_client_step(SimulationClient *client, void **contexts,
ptr = malloc(len);
if (ptr == NULL) assert(0);
memset(ptr, 'a', len);
ret = mousefs_submit_write(
client->mfs,
ret = toastyfs_submit_write(
client->tfs,
entry.path,
-1,
off,
@@ -250,12 +250,12 @@ int simulation_client_step(SimulationClient *client, void **contexts,
*timeout = 10;
else
*timeout = -1;
return mousefs_process_events(client->mfs, contexts, polled, 0);
return toastyfs_process_events(client->tfs, contexts, polled, 0);
}
void simulation_client_free(SimulationClient *client)
{
mousefs_free(client->mfs);
toastyfs_free(client->tfs);
}
#endif // BUILD_TEST
+2 -2
View File
@@ -10,7 +10,7 @@
#include <poll.h>
#endif
#include "MouseFS.h"
#include "ToastyFS.h"
#define MAX_PENDING_OPERATION 8
@@ -29,7 +29,7 @@ typedef struct {
} PendingOperation;
typedef struct {
MouseFS *mfs;
ToastyFS *tfs;
int num_pending;
PendingOperation pending[MAX_PENDING_OPERATION];
} SimulationClient;