You are browsing as a guest. Sign up (or log in) to start making projects!

6h 8m 25s logged

so it’s been a while, just barely 6h7m (676767676767676767). again… coding just gets me in the feels you know? you feel the breeze in the wind, the sun in the sky, the butterflies that release and change eddy currents to cause bit flips in a disc platter… just me? alright.

i added children traversal to the vfs. this was because I wanted my vfs to print out the output of all the items that got pushed through it. this also adds another feature that i took from Linux, which is that a given directory is connected to its children via a doubly linked list.

I actually took a feature from the Linux kernel: struct list_item. It’s a structure that has prev and next, which point to the addresses of struct list_item inside existing structures. So, for example

struct my_item {
struct list_item children;
struct list_item siblings;
}

would hold a prev and next pointer for each item. children would point to the first sibling, while the beginning of siblings would point to the original parent directory.

obviously though, my_item->children.next would hold a pointer to struct list_item, not struct my_item. this is where Linux’s container_of macro comes in (which i shamelessly copied word for word). it calculates the offset to subtract from different structures, given the structure and the name of the struct list_item.

this provides efficiency, since siblings and children are connected in a linked list that allows O(1) insertion and removal in a list where there’s likely to be a lot of removals.

my hashmap is also working pretty well!!! HASHMAP I WOULD USE A HASHMAP (if you get the reference LMFAO).

0
13

Comments 0

No comments yet. Be the first!