FreeBSD/sys/fs/tmpfs/tmpfs_subr.c
/*
 * Helper function for tmpfs_readdir.  Creates a '.' entry for the given
 * directory and returns it in the uio space.  The function returns 0
 * on success, -1 if there was not enough space in the uio structure to
 * hold the directory entry or an appropriate error code if another
 * error happens.
 */
Helper function for tmpfs_readdir.  Creates a '.' entry for the given
directory and returns it in the uio space.  The function returns 0
on success, -1 if there was not enough space in the uio structure to
hold the directory entry or an appropriate error code if another
error happens.
Helper function for tmpfs_readdir . Creates a ' . ' entry for the given directory and returns it in the uio space . The function returns 0 on success - 1 if there was not enough space in the uio structure to hold the directory entry or an appropriate error code if another error happens .
static int
tmpfs_dir_getdotdent(struct tmpfs_node *node, struct uio *uio)
{
	int error;
	struct dirent dent;
	TMPFS_VALIDATE_DIR(node);
	MPASS(uio->uio_offset == TMPFS_DIRCOOKIE_DOT);
	dent.d_fileno = node->tn_id;
	dent.d_type = DT_DIR;
	dent.d_namlen = 1;
	dent.d_name[0] = '.';
	dent.d_name[1] = '\0';
	dent.d_reclen = GENERIC_DIRSIZ(&dent);
	if (dent.d_reclen > uio->uio_resid)
		error = EJUSTRETURN;
	else
		error = uiomove(&dent, dent.d_reclen, uio);
	node->tn_status |= TMPFS_NODE_ACCESSED;
	return error;
}
static int tmpfs_dir_getdotdent ( struct tmpfs_node * node , struct uio * uio ) { int error ; struct dirent dent ; TMPFS_VALIDATE_DIR ( node ) ; MPASS ( uio -> uio_offset == TMPFS_DIRCOOKIE_DOT ) ; dent . d_fileno = node -> tn_id ; dent . d_type = DT_DIR ; dent . d_namlen = 1 ; dent . d_name [ 0 ] = ' ' ; dent . d_name [ 1 ] = ' \0 ' ; dent . d_reclen = GENERIC_DIRSIZ ( & dent ) ; if ( dent . d_reclen > uio -> uio_resid ) error = EJUSTRETURN ; else error = uiomove ( & dent , dent . d_reclen , uio ) ; node -> tn_status |= TMPFS_NODE_ACCESSED ; return error ; }
Helper function for tmpfs_readdir.
Helper function for tmpfs_readdir .