Prefer power-loss -> powerloss

Just trying to be a bit more consistent.
This commit is contained in:
Christopher Haster
2026-01-26 02:04:14 -06:00
parent ab39a8fde9
commit 23ac67bf34
4 changed files with 24 additions and 24 deletions
+7 -7
View File
@@ -41,7 +41,7 @@ typedef enum lfs3_emubd_badblock_behavior {
LFS3_EMUBD_BADBLOCK_MANUAL = 7, // Bits require manual flipping LFS3_EMUBD_BADBLOCK_MANUAL = 7, // Bits require manual flipping
} lfs3_emubd_badblock_behavior_t; } lfs3_emubd_badblock_behavior_t;
// Mode determining how power-loss behaves during testing. // Mode determining how powerloss behaves during testing.
typedef enum lfs3_emubd_powerloss_behavior { typedef enum lfs3_emubd_powerloss_behavior {
LFS3_EMUBD_POWERLOSS_ATOMIC = 0, // Progs are atomic LFS3_EMUBD_POWERLOSS_ATOMIC = 0, // Progs are atomic
LFS3_EMUBD_POWERLOSS_SOMEBITS = 1, // One bit is progged LFS3_EMUBD_POWERLOSS_SOMEBITS = 1, // One bit is progged
@@ -117,19 +117,19 @@ struct lfs3_emubd_cfg {
// The mode determining how bad-blocks fail // The mode determining how bad-blocks fail
lfs3_emubd_badblock_behavior_t badblock_behavior; lfs3_emubd_badblock_behavior_t badblock_behavior;
// Number of write operations (erase/prog) before triggering a power-loss. // Number of write operations (erase/prog) before triggering a powerloss.
// power_cycles=0 disables this. The exact behavior of power-loss is // power_cycles=0 disables this. The exact behavior of powerloss is
// controlled by a combination of powerloss_behavior and powerloss_cb. // controlled by a combination of powerloss_behavior and powerloss_cb.
lfs3_emubd_powercycles_t power_cycles; lfs3_emubd_powercycles_t power_cycles;
// The mode determining how power-loss affects disk // The mode determining how powerloss affects disk
lfs3_emubd_powerloss_behavior_t powerloss_behavior; lfs3_emubd_powerloss_behavior_t powerloss_behavior;
// Function to call to emulate power-loss. The exact behavior of power-loss // Function to call to emulate powerloss. The exact behavior of powerloss
// is up to the runner to provide. // is up to the runner to provide.
void (*powerloss_cb)(void*); void (*powerloss_cb)(void*);
// Data for power-loss callback // Data for powerloss callback
void *powerloss_data; void *powerloss_data;
// Seed for prng, which may be used for emulating failed progs. This does // Seed for prng, which may be used for emulating failed progs. This does
@@ -255,7 +255,7 @@ int lfs3_emubd_mkbad(const struct lfs3_cfg *cfg, lfs3_block_t block);
// Clear any simulated wear on a given block // Clear any simulated wear on a given block
int lfs3_emubd_mkgood(const struct lfs3_cfg *cfg, lfs3_block_t block); int lfs3_emubd_mkgood(const struct lfs3_cfg *cfg, lfs3_block_t block);
// Get which bit failed, this changes on erase/power-loss unless manually set // Get which bit failed, this changes on erase/powerloss unless manually set
lfs3_ssize_t lfs3_emubd_badbit(const struct lfs3_cfg *cfg, lfs3_ssize_t lfs3_emubd_badbit(const struct lfs3_cfg *cfg,
lfs3_block_t block); lfs3_block_t block);
+1 -1
View File
@@ -15968,7 +15968,7 @@ static int lfs3_mountinited(lfs3_t *lfs3) {
// pseudo-randomly using our gcksum as a prng // pseudo-randomly using our gcksum as a prng
// //
// the purpose of this is to avoid bad wear patterns such as always // the purpose of this is to avoid bad wear patterns such as always
// allocating blocks near the beginning of disk after a power-loss // allocating blocks near the beginning of disk after a powerloss
// //
lfs3->lookahead.window = lfs3->gcksum % lfs3->block_count; lfs3->lookahead.window = lfs3->gcksum % lfs3->block_count;
} }
+14 -14
View File
@@ -1315,7 +1315,7 @@ static void list_implicit_defines(void) {
// scenarios to run tests under power-loss // scenarios to run tests under powerloss
static void run_powerloss_none( static void run_powerloss_none(
const test_powerloss_t *powerloss, const test_powerloss_t *powerloss,
@@ -1468,7 +1468,7 @@ static void run_powerloss_linear(
exit(-1); exit(-1);
} }
// run the test, increasing power-cycles as power-loss events occur // run the test, increasing power-cycles as powerloss events occur
printf("running "); printf("running ");
perm_printid(suite, case_, NULL, 0); perm_printid(suite, case_, NULL, 0);
printf("\n"); printf("\n");
@@ -1480,7 +1480,7 @@ static void run_powerloss_linear(
break; break;
} }
// power-loss! // powerloss!
printf("powerloss "); printf("powerloss ");
perm_printid(suite, case_, NULL, 0); perm_printid(suite, case_, NULL, 0);
printf(":x"); printf(":x");
@@ -1552,7 +1552,7 @@ static void run_powerloss_log(
exit(-1); exit(-1);
} }
// run the test, increasing power-cycles as power-loss events occur // run the test, increasing power-cycles as powerloss events occur
printf("running "); printf("running ");
perm_printid(suite, case_, NULL, 0); perm_printid(suite, case_, NULL, 0);
printf("\n"); printf("\n");
@@ -1564,7 +1564,7 @@ static void run_powerloss_log(
break; break;
} }
// power-loss! // powerloss!
printf("powerloss "); printf("powerloss ");
perm_printid(suite, case_, NULL, 0); perm_printid(suite, case_, NULL, 0);
printf(":y"); printf(":y");
@@ -1636,7 +1636,7 @@ static void run_powerloss_cycles(
exit(-1); exit(-1);
} }
// run the test, increasing power-cycles as power-loss events occur // run the test, increasing power-cycles as powerloss events occur
printf("running "); printf("running ");
perm_printid(suite, case_, NULL, 0); perm_printid(suite, case_, NULL, 0);
printf("\n"); printf("\n");
@@ -1648,7 +1648,7 @@ static void run_powerloss_cycles(
break; break;
} }
// power-loss! // powerloss!
assert(TEST_PLS <= powerloss->cycle_count); assert(TEST_PLS <= powerloss->cycle_count);
printf("powerloss "); printf("powerloss ");
perm_printid(suite, case_, powerloss->cycles, TEST_PLS+1); perm_printid(suite, case_, powerloss->cycles, TEST_PLS+1);
@@ -1823,7 +1823,7 @@ static void run_powerloss_exhaustive(
exit(-1); exit(-1);
} }
// run the test, increasing power-cycles as power-loss events occur // run the test, increasing power-cycles as powerloss events occur
printf("running "); printf("running ");
perm_printid(suite, case_, NULL, 0); perm_printid(suite, case_, NULL, 0);
printf("\n"); printf("\n");
@@ -2038,10 +2038,10 @@ const char *const help_text[] = {
"List all defines in this test-runner.", "List all defines in this test-runner.",
"List explicit defines in this test-runner.", "List explicit defines in this test-runner.",
"List implicit defines in this test-runner.", "List implicit defines in this test-runner.",
"List the available power-loss scenarios.", "List the available powerloss scenarios.",
"Override a test define.", "Override a test define.",
"How deep to evaluate recursive defines before erroring.", "How deep to evaluate recursive defines before erroring.",
"Comma-separated list of power-loss scenarios to test.", "Comma-separated list of powerloss scenarios to test.",
"Comma-separated range of permutations to run.", "Comma-separated range of permutations to run.",
"Ignore test filters.", "Ignore test filters.",
"Direct block device operations to this file.", "Direct block device operations to this file.",
@@ -2327,7 +2327,7 @@ int main(int argc, char **argv) {
test_powerloss_count = 0; test_powerloss_count = 0;
test_powerloss_capacity = 0; test_powerloss_capacity = 0;
// parse the comma separated list of power-loss scenarios // parse the comma separated list of powerloss scenarios
while (*optarg) { while (*optarg) {
// allocate space // allocate space
test_powerloss_t *powerloss = mappend( test_powerloss_t *powerloss = mappend(
@@ -2336,10 +2336,10 @@ int main(int argc, char **argv) {
&test_powerloss_count, &test_powerloss_count,
&test_powerloss_capacity); &test_powerloss_capacity);
// parse the power-loss scenario // parse the powerloss scenario
optarg += strspn(optarg, " "); optarg += strspn(optarg, " ");
// named power-loss scenario // named powerloss scenario
size_t len = strcspn(optarg, " ,"); size_t len = strcspn(optarg, " ,");
for (size_t i = 0; builtin_powerlosses[i].name; i++) { for (size_t i = 0; builtin_powerlosses[i].name; i++) {
if (len == strlen(builtin_powerlosses[i].name) if (len == strlen(builtin_powerlosses[i].name)
@@ -2469,7 +2469,7 @@ int main(int argc, char **argv) {
powerloss_unknown:; powerloss_unknown:;
// unknown scenario? // unknown scenario?
fprintf(stderr, "error: unknown power-loss scenario: %s\n", fprintf(stderr, "error: unknown powerloss scenario: %s\n",
optarg); optarg);
exit(-1); exit(-1);
+2 -2
View File
@@ -1677,7 +1677,7 @@ if __name__ == "__main__":
test_parser.add_argument( test_parser.add_argument(
'--list-powerlosses', '--list-powerlosses',
action='store_true', action='store_true',
help="List the available power-loss scenarios.") help="List the available powerloss scenarios.")
test_parser.add_argument( test_parser.add_argument(
'-D', '--define', '-D', '--define',
action='append', action='append',
@@ -1687,7 +1687,7 @@ if __name__ == "__main__":
help="How deep to evaluate recursive defines before erroring.") help="How deep to evaluate recursive defines before erroring.")
test_parser.add_argument( test_parser.add_argument(
'-P', '--powerloss', '-P', '--powerloss',
help="Comma-separated list of power-loss scenarios to test.") help="Comma-separated list of powerloss scenarios to test.")
test_parser.add_argument( test_parser.add_argument(
'--force', '--force',
action='store_true', action='store_true',