I want to create a new system call in VFS server which will be given a filename as a parameter and will print this certain file's inode number in MINIX3.2.1. I examined the code of the do_stat() function(inside /usr/src/servers/vfs/stadir.c) and i found out that i have to assign to a vnode struct variable the faction eat_path() in order to access v_inode_nr which is the inode number.In order to do that how am i able to assign the file i am looking for,where to put the user input filename(m_in.m1_p1)?
Here is the do_stat() function inside stadir.c
int do_stat() {
/* Perform the stat(name, buf) system call. */
int r;
struct vnode *vp;
struct vmnt *vmp;
char fullpath[PATH_MAX];
struct lookup resolve;
int old_stat = 0;
vir_bytes vname1, statbuf;
size_t vname1_length;
vname1 = (vir_bytes)job_m_in.name1;
vname1_length = (size_t)job_m_in.name1_length;
statbuf = (vir_bytes)job_m_in.m1_p2;
lookup_init(&resolve, fullpath, PATH_NOFLAGS, &vmp, &vp);
resolve.l_vmnt_lock = VMNT_READ;
resolve.l_vnode_lock = VNODE_READ;
if (job_call_nr == PREV_STAT)
old_stat = 1;
if (fetch_name(vname1, vname1_length, fullpath) != OK)
return (err_code);
if ((vp = eat_path(&resolve, fp)) == NULL)
return (err_code);
r = req_stat(vp->v_fs_e, vp->v_inode_nr, who_e, statbuf, old_stat);
unlock_vnode(vp);
unlock_vmnt(vmp);
put_vnode(vp);
return r;
}