fs: binding of pipes to vnodes

This commit is contained in:
Matheus
2024-08-11 13:06:46 -03:00
parent f02a63473f
commit a24be5cbc5
5 changed files with 53 additions and 8 deletions
+17
View File
@@ -399,3 +399,20 @@ int pipefs_newpipe(vnode_t **nodep) {
return 0;
}
// assumes node is locked upon calling
int pipefs_getbinding(vnode_t *node, vnode_t **pipep) {
__assert(node->type == V_TYPE_FIFO);
if (node->fifobinding) {
*pipep = node->fifobinding;
return 0;
}
int error = pipefs_newpipe(pipep);
if (error)
return error;
node->fifobinding = *pipep;
return error;
}