/* Note that the resulting string will be placed at the end of the buffer  */
static char* nfs4_pathname_string(const struct nfs4_pathname *pathname, char *buffer, ssize_t buflen)
/* Note that the resulting string will be placed at the end of the buffer  */
static char* nfs4_pathname_string(const struct nfs4_pathname *pathname, char *buffer, ssize_t buflen)
{
	char *end = buffer + buflen;
	int n;
	*--end = '\0';
	buflen--;
	n = pathname->ncomponents;
	while (--n >= 0) {
		const struct nfs4_string *component = &pathname->components[n];
		buflen -= component->len + 1;
		if (buflen < 0)
			goto Elong;
		end -= component->len;
		memcpy(end, component->data, component->len);
		*--end = '/';
	}
	return end;
Elong:
	return ERR_PTR(-ENAMETOOLONG);
}