FreeBSD/sys/fs/devfs/devfs_vnops.c
/*
 * Construct the fully qualified path name relative to the mountpoint.
 * If a NULL cnp is provided, no '/' is appended to the resulting path.
 */
Construct the fully qualified path name relative to the mountpoint.
If a NULL cnp is provided, no '/' is appended to the resulting path.
Construct the fully qualified path name relative to the mountpoint . If a NULL cnp is provided no ' / ' is appended to the resulting path .
char *
devfs_fqpn(char *buf, struct devfs_mount *dmp, struct devfs_dirent *dd,
    struct componentname *cnp)
{
	int i;
	struct devfs_dirent *de;
	sx_assert(&dmp->dm_lock, SA_LOCKED);
	i = SPECNAMELEN;
	buf[i] = '\0';
	if (cnp != NULL)
		i -= cnp->cn_namelen;
	if (i < 0)
		 return (NULL);
	if (cnp != NULL)
		bcopy(cnp->cn_nameptr, buf + i, cnp->cn_namelen);
	de = dd;
	while (de != dmp->dm_rootdir) {
		if (cnp != NULL || i < SPECNAMELEN) {
			i--;
			if (i < 0)
				 return (NULL);
			buf[i] = '/';
		}
		i -= de->de_dirent->d_namlen;
		if (i < 0)
			 return (NULL);
		bcopy(de->de_dirent->d_name, buf + i,
		    de->de_dirent->d_namlen);
		de = devfs_parent_dirent(de);
		if (de == NULL)
			return (NULL);
	}
	return (buf + i);
}
char * devfs_fqpn ( char * buf , struct devfs_mount * dmp , struct devfs_dirent * dd , struct componentname * cnp ) { int i ; struct devfs_dirent * de ; sx_assert ( & dmp -> dm_lock , SA_LOCKED ) ; i = SPECNAMELEN ; buf [ i ] = ' \0 ' ; if ( cnp != NULL ) i -= cnp -> cn_namelen ; if ( i < 0 ) return ( NULL ) ; if ( cnp != NULL ) bcopy ( cnp -> cn_nameptr , buf + i , cnp -> cn_namelen ) ; de = dd ; while ( de != dmp -> dm_rootdir ) { if ( cnp != NULL || i < SPECNAMELEN ) { i -- ; if ( i < 0 ) return ( NULL ) ; buf [ i ] = ' ' ; } i -= de -> de_dirent -> d_namlen ; if ( i < 0 ) return ( NULL ) ; bcopy ( de -> de_dirent -> d_name , buf + i , de -> de_dirent -> d_namlen ) ; de = devfs_parent_dirent ( de ) ; if ( de == NULL ) return ( NULL ) ; } return ( buf + i ) ; }
Construct the fully qualified path name relative to the mountpoint.
Construct the fully qualified path name relative to the mountpoint .