fd: add pwd_hold_proc

This commit is contained in:
Mateusz Guzik 2021-09-30 12:49:51 +02:00
parent 41e9466943
commit 85c855d31b
2 changed files with 21 additions and 0 deletions

View File

@ -3791,6 +3791,26 @@ pwd_hold(struct thread *td)
return (pwd);
}
struct pwd *
pwd_hold_proc(struct proc *p)
{
struct pwddesc *pdp;
struct pwd *pwd;
PROC_ASSERT_HELD(p);
PROC_LOCK(p);
pdp = pdhold(p);
MPASS(pdp != NULL);
PROC_UNLOCK(p);
PWDDESC_XLOCK(pdp);
pwd = pwd_hold_pwddesc(pdp);
MPASS(pwd != NULL);
PWDDESC_XUNLOCK(pdp);
pddrop(pdp);
return (pwd);
}
static struct pwd *
pwd_alloc(void)
{

View File

@ -341,6 +341,7 @@ void pwd_set_rootvnode(void);
struct pwd *pwd_hold_pwddesc(struct pwddesc *pdp);
bool pwd_hold_smr(struct pwd *pwd);
struct pwd *pwd_hold_proc(struct proc *p);
struct pwd *pwd_hold(struct thread *td);
void pwd_drop(struct pwd *pwd);
static inline void