volume: cache volume attr results with vnetroot

moved the FileSystemName definition back down to the kernel, so the daemon is no longer responsible for setting it.  the driver uses the string length to calculate the buffer size needed for NFS41_V_NET_ROOT_EXTENSION.FsAttrs, and copies in the FileSystemName after the first successful volume attributes upcall

Signed-off-by: Casey Bodley <cbodley@umich.edu>
This commit is contained in:
Casey Bodley 2010-10-12 09:51:06 -04:00
parent 25ef4d25bb
commit 827a1b7368
4 changed files with 49 additions and 29 deletions

View file

@ -98,7 +98,6 @@ static int handle_volume_attributes(
bitmap4 attr_request = { 1, { FATTR4_WORD0_CASE_INSENSITIVE |
FATTR4_WORD0_CASE_PRESERVING } };
PFILE_FS_ATTRIBUTE_INFORMATION attr = &args->info.attribute;
size_t max_length;
int status = NO_ERROR;
status = nfs41_getattr(session, NULL, &attr_request, &info);
@ -117,27 +116,14 @@ static int handle_volume_attributes(
attr->MaximumComponentNameLength = NFS41_MAX_COMPONENT_LEN;
/* calculate how much space we have for FileSystemName; args.info.buffer
* should guarantee us enough room for NFS41_FILESYSTEM_NAME */
max_length = sizeof(args->info) -
FIELD_OFFSET(FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName);
/* let the driver fill in FileSystemName/Len */
if (FAILED(StringCbCopyNW(attr->FileSystemName, max_length,
NFS41_FILESYSTEM_NAME, NFS41_FILESYSTEM_NAME_LEN))) {
status = ERROR_BUFFER_OVERFLOW;
eprintf("FileSystemName '%S' truncated to '%S'! returning %d\n",
NFS41_FILESYSTEM_NAME, attr->FileSystemName, status);
goto out;
}
attr->FileSystemNameLength = NFS41_FILESYSTEM_NAME_LEN;
args->len = sizeof(args->info.attribute) + NFS41_FILESYSTEM_NAME_LEN;
args->len = sizeof(args->info.attribute);
dprintf(2, "FileFsAttributeInformation: case_preserving %u, "
"case_insensitive %u, max component %u, name '%S', length %u\n",
"case_insensitive %u, max component %u\n",
info.case_preserving, info.case_insensitive,
attr->MaximumComponentNameLength,
attr->FileSystemName, attr->FileSystemNameLength);
attr->MaximumComponentNameLength);
out:
return status;
}