mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
NFS: Replace nfsroot on-stack filehandle
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
b157b06ca2
commit
1b4c6065b9
1 changed files with 8 additions and 6 deletions
|
@ -488,7 +488,6 @@ static int __init root_nfs_ports(void)
|
||||||
*/
|
*/
|
||||||
static int __init root_nfs_get_handle(void)
|
static int __init root_nfs_get_handle(void)
|
||||||
{
|
{
|
||||||
struct nfs_fh fh;
|
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
unsigned int auth_flav_len = 0;
|
unsigned int auth_flav_len = 0;
|
||||||
struct nfs_mount_request request = {
|
struct nfs_mount_request request = {
|
||||||
|
@ -499,21 +498,24 @@ static int __init root_nfs_get_handle(void)
|
||||||
NFS_MNT3_VERSION : NFS_MNT_VERSION,
|
NFS_MNT3_VERSION : NFS_MNT_VERSION,
|
||||||
.protocol = (nfs_data.flags & NFS_MOUNT_TCP) ?
|
.protocol = (nfs_data.flags & NFS_MOUNT_TCP) ?
|
||||||
XPRT_TRANSPORT_TCP : XPRT_TRANSPORT_UDP,
|
XPRT_TRANSPORT_TCP : XPRT_TRANSPORT_UDP,
|
||||||
.fh = &fh,
|
|
||||||
.auth_flav_len = &auth_flav_len,
|
.auth_flav_len = &auth_flav_len,
|
||||||
};
|
};
|
||||||
int status;
|
int status = -ENOMEM;
|
||||||
|
|
||||||
|
request.fh = nfs_alloc_fhandle();
|
||||||
|
if (!request.fh)
|
||||||
|
goto out;
|
||||||
set_sockaddr(&sin, servaddr, htons(mount_port));
|
set_sockaddr(&sin, servaddr, htons(mount_port));
|
||||||
status = nfs_mount(&request);
|
status = nfs_mount(&request);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
printk(KERN_ERR "Root-NFS: Server returned error %d "
|
printk(KERN_ERR "Root-NFS: Server returned error %d "
|
||||||
"while mounting %s\n", status, nfs_export_path);
|
"while mounting %s\n", status, nfs_export_path);
|
||||||
else {
|
else {
|
||||||
nfs_data.root.size = fh.size;
|
nfs_data.root.size = request.fh->size;
|
||||||
memcpy(nfs_data.root.data, fh.data, fh.size);
|
memcpy(&nfs_data.root.data, request.fh->data, request.fh->size);
|
||||||
}
|
}
|
||||||
|
nfs_free_fhandle(request.fh);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue