*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> VOP_LINK (9)              
Title
Content
Arch
Section
 

VOP_LINK(9)

Contents


NAME    [Toc]    [Back]

     VOP_LINK -- create a new name for a file

SYNOPSIS    [Toc]    [Back]

     #include <sys/param.h>
     #include <sys/vnode.h>

     int
     VOP_LINK(struct vnode *dvp, struct vnode *vp, struct componentname *cnp);

DESCRIPTION    [Toc]    [Back]

     This links a new name in the specified directory to an existing file.

     Its arguments are:

     dvp       the vnode of the directory

     vp        the vnode of the file to be linked

     cnp       pathname information about the file

     The pathname info should not be released on exit because it is done by
     the caller.  The directory and file vnodes should not be released on
     exit.

LOCKS    [Toc]    [Back]

     VOP_LINK() expects the directory and file vnodes to be locked on entry
     and will leave the vnodes locked on return.

RETURN VALUES    [Toc]    [Back]

     Zero is returned if the file was linked successfully, otherwise an error
     is returned.

PSEUDOCODE    [Toc]    [Back]

     int
     vop_link(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
     {
	 int error = 0;

	 if (vp->v_mount != dvp->v_mount)
	     return (EXDEV);

	 if (vp would have too many links)
	     return (EMLINK);

	 if (vp is immutable)
	     return (EPERM);

	 /*
	  * Increment link count of vp and write back the on-disc version of it.
	  */
	 ...;

	 if (!error) {
	     /*
	      * Add the new name to the directory.
	      */
	     ...;
	 }

	 return error;
     }

ERRORS    [Toc]    [Back]

     [EMLINK]		The file has too many links.

     [EPERM]		The file is immutable.

     [EXDEV]		A hard link is not possible between different file
			systems.

SEE ALSO    [Toc]    [Back]

      
      
     vnode(9), vn_lock(9)

AUTHORS    [Toc]    [Back]

     This man page was originally written by Doug Rabson.


FreeBSD 5.2.1			 July 24, 1996			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
link Tru64 Create a hard link to an existing file on the local file system
mvOptimize IRIX optimize a movie file for playback after editing operations, or create a flattened movie file
creat OpenBSD create a new file
creat NetBSD create a new file
creat FreeBSD create a new file
mkfile IRIX create a file
tmpnam Linux create a name for a temporary file
ctags FreeBSD create a tags file
mopa.out OpenBSD create MOP image from an a.out file
ctags HP-UX create a tags file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service