NFS Client: Hard Links

Sebastian Huber sebastian.huber at embedded-brains.de
Fri May 4 08:51:52 UTC 2012


Hi,

I have a question regarding hard link creation in the NFS client (embedded 
comment):

static int nfs_link(
	const rtems_filesystem_location_info_t *parentloc,
	const rtems_filesystem_location_info_t *targetloc,
	const char *name,
	size_t namelen
)
{
int rv = 0;
NfsNode pNode;
nfsstat status;
NfsNode tNode = targetloc->node_access;
char *dupname;

	dupname = nfs_dupname(name, namelen);
	if (dupname == NULL)
		return -1;

#if DEBUG & DEBUG_SYSCALLS
	fprintf(stderr,"Creating link '%s'\n",dupname);
#endif

/* Here in the memcpy() we copy from the not initialized pNode.  Is this 
intended? Is it maybe pNode = parentloc->node_access? */

	memcpy(&SERP_ARGS(tNode).linkarg.to.dir,
		   &SERP_FILE(pNode),
		   sizeof(SERP_FILE(pNode)));

	SERP_ARGS(tNode).linkarg.to.name = dupname;

	if ( nfscall(tNode->nfs->server,
					  NFSPROC_LINK,
					  (xdrproc_t)xdr_linkargs,	&SERP_FILE(tNode),
					  (xdrproc_t)xdr_nfsstat,	&status)
	     || (NFS_OK != (errno = status))
	   ) {
#if DEBUG & DEBUG_SYSCALLS
		perror("nfs_link");
#endif
		rv = -1;
	}

	free(dupname);

	return rv;

}

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list