Skip to content

Conversation

@oito8bits
Copy link
Contributor

I fixed and improved some parts of the C code.

char type[VFS_TYPE_LENGTH];
char mountpoint[VFS_TYPE_LENGTH];
char device[VFS_PATH_LENGTH];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although in theory the mountpoint_t structure should point somehow to the device, we are not covering it in the book yet (and is not even mentioend) so for the purpose of the chapter is not really needed. And also in case we add it in the future, I don't think it should be a char * but probably a a new kerneld data structure, containing the device information. So for now is not really necessary to add it.

Copy link
Contributor Author

@oito8bits oito8bits Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this because there is a part where the device is initialized in a mountpoint_t:

mountpoint_t *new_mountpoint = malloc(sizeof(mountpoint_t)); // We assume a kind of malloc is present
new_mountpoint.device = device;
new_mountpoint.type = type;
new_mountpoint.mountpoint = target;
new_mountpoint.operations = NULL

Copy link
Contributor Author

@oito8bits oito8bits Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed it was a char *, since the device from vfs_mount() is also one:

int vfs_mount(char *device, char *target, char *fs_type);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahaha you are right!
I forgot about it, and I probably should have checked.

I kind of understand maybe why I did it, but I think I overlooked at that part. Probably was more to explain the idea behind the function, so It was kept as a char. Probably this part should be improved because what I think will most likely happen under the hood is that using the string device, the vfs_mount function will search for the device that has that name (or mountpoint or whatever it is) and return a pointer to it. And that should be the one stored into the new_mountpoint struct.

@oito8bits if you want you can try to fix this part (of course feele free to ask here or on discord if you have any question) , otherwise if you don't have time, or not sure how to improve it, let me know and I'll merge this PR as it is and hopefully I'll fix it myself (or @DeanoBurrito ) in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven’t implemented this in my kernel yet, so I can’t say for sure how this structure will look. You can go ahead and merge it, and maybe in the future I’ll add it if you guys haven’t done it already.

@dreamos82 dreamos82 merged commit fe1beb5 into dreamportdev:master Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants