File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,10 @@ namespace alg {
50
50
struct node_t {
51
51
uint16_t n; // num key
52
52
uint16_t flag; // flags
53
- uint32_t offset; // block offset (8 byte head)
53
+ uint32_t offset; // lseek offset related to file beginning
54
54
char padding[12 ]; // padding to 4096
55
55
int32_t key[509 ]; // key
56
- int32_t c[510 ]; // childs pointers (file offsets related to 0 )
56
+ int32_t c[510 ]; // childs pointers (represented as file offsets )
57
57
} __attribute__ ((packed));
58
58
typedef struct node_t *node;
59
59
@@ -473,7 +473,7 @@ namespace alg {
473
473
}
474
474
475
475
/* *
476
- * delete ith node
476
+ * delete ith key & child.
477
477
*/
478
478
void delete_i (node x, int32_t i) {
479
479
int j;
@@ -488,7 +488,10 @@ namespace alg {
488
488
}
489
489
490
490
/* *
491
- * allocate empty node struct
491
+ * Allocate empty node struct.
492
+ * A better allocator should be consider in practice,
493
+ * such as re-cycling the freed up blocks on disk, so used blocks.
494
+ * should be traced in some data strucuture, file header maybe.
492
495
*/
493
496
void * ALLOCBLK () {
494
497
node x = new node_t ;
@@ -500,6 +503,7 @@ namespace alg {
500
503
memset (x->padding , 0xcc , sizeof (x->padding ));
501
504
return x;
502
505
}
506
+
503
507
/* *
504
508
* Load the root block
505
509
*/
You can’t perform that action at this time.
0 commit comments