Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2002 13:48:31 +0000 (UTC)
From:      omestre <omestre@SDF.LONESTAR.ORG>
To:        freebsd-hackers@freebsd.org
Cc:        freebsd-net@freebsd.org
Subject:   fh
Message-ID:  <Pine.NEB.4.44.0212021338200.5624-100000@sdf.lonestar.org>

next in thread | raw e-mail | index | archive | help

 Thanks, Tim Kientzle, but i still need one "c code" to add to
autoconf.c, and gets a NFS file handle to my root directory. We have
the solution (diskless) with dhcp/bootp... but we do not want this
anymore, due the things that i have sad before. Thanks.
 All that i need, is that c code... :)
 In vfs_syscalls.c i have found this "code":
---
/*
 * Get (NFS) file handle
 */
#ifndef _SYS_SYSPROTO_H_
struct getfh_args {
        char    *fname;
        fhandle_t *fhp;
};
#endif
int
getfh(p, uap)
        struct proc *p;
        register struct getfh_args *uap;
{
        struct nameidata nd;
        fhandle_t fh;
        register struct vnode *vp;
        int error;

        /*
         * Must be super user
         */
        error = suser(p);
        if (error)
                return (error);
        NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->fname,
p);
        error = namei(&nd);
        if (error)
                return (error);
        NDFREE(&nd, NDF_ONLY_PNBUF);
        vp = nd.ni_vp;
        bzero(&fh, sizeof(fh));
        fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
        error = VFS_VPTOFH(vp, &fh.fh_fid);
        vput(vp);
        if (error)
                return (error);
        error = copyout(&fh, uap->fhp, sizeof (fh));
        return (error);
}
---

 Can i adapt it for my porpouses?
 I need help, and i guess that here is the place... :)
 Somebody can help?

omestre@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.4.44.0212021338200.5624-100000>