mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add reference counting filesystem messages.
This commit is contained in:
parent
2ea7607f4e
commit
740187674a
2 changed files with 30 additions and 1 deletions
|
@ -312,7 +312,19 @@ struct fsm_req_rename
|
||||||
//char newname[newnamelen];
|
//char newname[newnamelen];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FSM_MSG_NUM 38
|
#define FSM_REQ_REFER 38
|
||||||
|
struct fsm_req_refer
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_UNREF 39
|
||||||
|
struct fsm_req_unref
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_MSG_NUM 40
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
@ -585,10 +585,27 @@ Unode::Unode(Ref<Server> server, ino_t ino, mode_t type)
|
||||||
this->ino = ino;
|
this->ino = ino;
|
||||||
this->dev = (dev_t) server;
|
this->dev = (dev_t) server;
|
||||||
this->type = type;
|
this->type = type;
|
||||||
|
|
||||||
|
// Let the remote know that the kernel is using this inode.
|
||||||
|
if ( Channel* channel = server->Connect() )
|
||||||
|
{
|
||||||
|
struct fsm_req_refer msg;
|
||||||
|
msg.ino = ino;
|
||||||
|
SendMessage(channel, FSM_REQ_REFER, &msg, sizeof(msg));
|
||||||
|
channel->KernelClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unode::~Unode()
|
Unode::~Unode()
|
||||||
{
|
{
|
||||||
|
// Let the remote know that the kernel is no longer using this inode.
|
||||||
|
if ( Channel* channel = server->Connect() )
|
||||||
|
{
|
||||||
|
struct fsm_req_unref msg;
|
||||||
|
msg.ino = ino;
|
||||||
|
SendMessage(channel, FSM_REQ_UNREF, &msg, sizeof(msg));
|
||||||
|
channel->KernelClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unode::SendMessage(Channel* channel, size_t type, void* ptr, size_t size,
|
bool Unode::SendMessage(Channel* channel, size_t type, void* ptr, size_t size,
|
||||||
|
|
Loading…
Add table
Reference in a new issue