@@ -54,15 +54,14 @@ static int reftable_fd_flush(void *arg)
54
54
}
55
55
56
56
int reftable_new_stack (struct reftable_stack * * dest , const char * dir ,
57
- struct reftable_write_options config )
57
+ struct reftable_write_options opts )
58
58
{
59
59
struct reftable_stack * p = reftable_calloc (1 , sizeof (* p ));
60
60
struct strbuf list_file_name = STRBUF_INIT ;
61
61
int err = 0 ;
62
62
63
- if (config .hash_id == 0 ) {
64
- config .hash_id = GIT_SHA1_FORMAT_ID ;
65
- }
63
+ if (opts .hash_id == 0 )
64
+ opts .hash_id = GIT_SHA1_FORMAT_ID ;
66
65
67
66
* dest = NULL ;
68
67
@@ -73,7 +72,7 @@ int reftable_new_stack(struct reftable_stack **dest, const char *dir,
73
72
p -> list_file = strbuf_detach (& list_file_name , NULL );
74
73
p -> list_fd = -1 ;
75
74
p -> reftable_dir = xstrdup (dir );
76
- p -> config = config ;
75
+ p -> opts = opts ;
77
76
78
77
err = reftable_stack_reload_maybe_reuse (p , 1 );
79
78
if (err < 0 ) {
@@ -255,7 +254,7 @@ static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
255
254
256
255
/* success! */
257
256
err = reftable_new_merged_table (& new_merged , new_tables ,
258
- new_readers_len , st -> config .hash_id );
257
+ new_readers_len , st -> opts .hash_id );
259
258
if (err < 0 )
260
259
goto done ;
261
260
@@ -578,8 +577,8 @@ static int reftable_stack_init_addition(struct reftable_addition *add,
578
577
}
579
578
goto done ;
580
579
}
581
- if (st -> config .default_permissions ) {
582
- if (chmod (add -> lock_file -> filename .buf , st -> config .default_permissions ) < 0 ) {
580
+ if (st -> opts .default_permissions ) {
581
+ if (chmod (add -> lock_file -> filename .buf , st -> opts .default_permissions ) < 0 ) {
583
582
err = REFTABLE_IO_ERROR ;
584
583
goto done ;
585
584
}
@@ -678,7 +677,7 @@ int reftable_addition_commit(struct reftable_addition *add)
678
677
if (err )
679
678
goto done ;
680
679
681
- if (!add -> stack -> config .disable_auto_compact ) {
680
+ if (!add -> stack -> opts .disable_auto_compact ) {
682
681
/*
683
682
* Auto-compact the stack to keep the number of tables in
684
683
* control. It is possible that a concurrent writer is already
@@ -756,17 +755,17 @@ int reftable_addition_add(struct reftable_addition *add,
756
755
err = REFTABLE_IO_ERROR ;
757
756
goto done ;
758
757
}
759
- if (add -> stack -> config .default_permissions ) {
758
+ if (add -> stack -> opts .default_permissions ) {
760
759
if (chmod (get_tempfile_path (tab_file ),
761
- add -> stack -> config .default_permissions )) {
760
+ add -> stack -> opts .default_permissions )) {
762
761
err = REFTABLE_IO_ERROR ;
763
762
goto done ;
764
763
}
765
764
}
766
765
tab_fd = get_tempfile_fd (tab_file );
767
766
768
767
wr = reftable_new_writer (reftable_fd_write , reftable_fd_flush , & tab_fd ,
769
- & add -> stack -> config );
768
+ & add -> stack -> opts );
770
769
err = write_table (wr , arg );
771
770
if (err < 0 )
772
771
goto done ;
@@ -849,14 +848,14 @@ static int stack_compact_locked(struct reftable_stack *st,
849
848
}
850
849
tab_fd = get_tempfile_fd (tab_file );
851
850
852
- if (st -> config .default_permissions &&
853
- chmod (get_tempfile_path (tab_file ), st -> config .default_permissions ) < 0 ) {
851
+ if (st -> opts .default_permissions &&
852
+ chmod (get_tempfile_path (tab_file ), st -> opts .default_permissions ) < 0 ) {
854
853
err = REFTABLE_IO_ERROR ;
855
854
goto done ;
856
855
}
857
856
858
857
wr = reftable_new_writer (reftable_fd_write , reftable_fd_flush ,
859
- & tab_fd , & st -> config );
858
+ & tab_fd , & st -> opts );
860
859
err = stack_write_compact (st , wr , first , last , config );
861
860
if (err < 0 )
862
861
goto done ;
@@ -904,7 +903,7 @@ static int stack_write_compact(struct reftable_stack *st,
904
903
st -> readers [last ]-> max_update_index );
905
904
906
905
err = reftable_new_merged_table (& mt , subtabs , subtabs_len ,
907
- st -> config .hash_id );
906
+ st -> opts .hash_id );
908
907
if (err < 0 ) {
909
908
reftable_free (subtabs );
910
909
goto done ;
@@ -1094,9 +1093,9 @@ static int stack_compact_range(struct reftable_stack *st,
1094
1093
goto done ;
1095
1094
}
1096
1095
1097
- if (st -> config .default_permissions ) {
1096
+ if (st -> opts .default_permissions ) {
1098
1097
if (chmod (get_lock_file_path (& tables_list_lock ),
1099
- st -> config .default_permissions ) < 0 ) {
1098
+ st -> opts .default_permissions ) < 0 ) {
1100
1099
err = REFTABLE_IO_ERROR ;
1101
1100
goto done ;
1102
1101
}
@@ -1286,7 +1285,7 @@ static uint64_t *stack_table_sizes_for_compaction(struct reftable_stack *st)
1286
1285
{
1287
1286
uint64_t * sizes =
1288
1287
reftable_calloc (st -> merged -> stack_len , sizeof (* sizes ));
1289
- int version = (st -> config .hash_id == GIT_SHA1_FORMAT_ID ) ? 1 : 2 ;
1288
+ int version = (st -> opts .hash_id == GIT_SHA1_FORMAT_ID ) ? 1 : 2 ;
1290
1289
int overhead = header_size (version ) - 1 ;
1291
1290
int i = 0 ;
1292
1291
for (i = 0 ; i < st -> merged -> stack_len ; i ++ ) {
@@ -1435,11 +1434,11 @@ int reftable_stack_clean(struct reftable_stack *st)
1435
1434
int reftable_stack_print_directory (const char * stackdir , uint32_t hash_id )
1436
1435
{
1437
1436
struct reftable_stack * stack = NULL ;
1438
- struct reftable_write_options cfg = { .hash_id = hash_id };
1437
+ struct reftable_write_options opts = { .hash_id = hash_id };
1439
1438
struct reftable_merged_table * merged = NULL ;
1440
1439
struct reftable_table table = { NULL };
1441
1440
1442
- int err = reftable_new_stack (& stack , stackdir , cfg );
1441
+ int err = reftable_new_stack (& stack , stackdir , opts );
1443
1442
if (err < 0 )
1444
1443
goto done ;
1445
1444
0 commit comments