aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfsroot.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfsroot.c')
-rw-r--r--fs/nfs/nfsroot.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index 8478fc25daee..d9ef602fbc5a 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -86,6 +86,8 @@
86#include <net/ipconfig.h> 86#include <net/ipconfig.h>
87#include <linux/parser.h> 87#include <linux/parser.h>
88 88
89#include "internal.h"
90
89/* Define this to allow debugging output */ 91/* Define this to allow debugging output */
90#undef NFSROOT_DEBUG 92#undef NFSROOT_DEBUG
91#define NFSDBG_FACILITY NFSDBG_ROOT 93#define NFSDBG_FACILITY NFSDBG_ROOT
@@ -100,7 +102,7 @@ static char nfs_root_name[256] __initdata = "";
100static __be32 servaddr __initdata = 0; 102static __be32 servaddr __initdata = 0;
101 103
102/* Name of directory to mount */ 104/* Name of directory to mount */
103static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, }; 105static char nfs_export_path[NFS_MAXPATHLEN] __initdata = { 0, };
104 106
105/* NFS-related data */ 107/* NFS-related data */
106static struct nfs_mount_data nfs_data __initdata = { 0, };/* NFS mount info */ 108static struct nfs_mount_data nfs_data __initdata = { 0, };/* NFS mount info */
@@ -312,7 +314,7 @@ static int __init root_nfs_name(char *name)
312 printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n"); 314 printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n");
313 return -1; 315 return -1;
314 } 316 }
315 sprintf(nfs_path, buf, cp); 317 sprintf(nfs_export_path, buf, cp);
316 318
317 return 1; 319 return 1;
318} 320}
@@ -329,7 +331,7 @@ static int __init root_nfs_addr(void)
329 } 331 }
330 332
331 snprintf(nfs_data.hostname, sizeof(nfs_data.hostname), 333 snprintf(nfs_data.hostname, sizeof(nfs_data.hostname),
332 "%u.%u.%u.%u", NIPQUAD(servaddr)); 334 "%pI4", &servaddr);
333 return 0; 335 return 0;
334} 336}
335 337
@@ -340,7 +342,7 @@ static int __init root_nfs_addr(void)
340static void __init root_nfs_print(void) 342static void __init root_nfs_print(void)
341{ 343{
342 printk(KERN_NOTICE "Root-NFS: Mounting %s on server %s as root\n", 344 printk(KERN_NOTICE "Root-NFS: Mounting %s on server %s as root\n",
343 nfs_path, nfs_data.hostname); 345 nfs_export_path, nfs_data.hostname);
344 printk(KERN_NOTICE "Root-NFS: rsize = %d, wsize = %d, timeo = %d, retrans = %d\n", 346 printk(KERN_NOTICE "Root-NFS: rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
345 nfs_data.rsize, nfs_data.wsize, nfs_data.timeo, nfs_data.retrans); 347 nfs_data.rsize, nfs_data.wsize, nfs_data.timeo, nfs_data.retrans);
346 printk(KERN_NOTICE "Root-NFS: acreg (min,max) = (%d,%d), acdir (min,max) = (%d,%d)\n", 348 printk(KERN_NOTICE "Root-NFS: acreg (min,max) = (%d,%d), acdir (min,max) = (%d,%d)\n",
@@ -421,8 +423,8 @@ static int __init root_nfs_getport(int program, int version, int proto)
421{ 423{
422 struct sockaddr_in sin; 424 struct sockaddr_in sin;
423 425
424 printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n", 426 printk(KERN_NOTICE "Looking up port of RPC %d/%d on %pI4\n",
425 program, version, NIPQUAD(servaddr)); 427 program, version, &servaddr);
426 set_sockaddr(&sin, servaddr, 0); 428 set_sockaddr(&sin, servaddr, 0);
427 return rpcb_getport_sync(&sin, program, version, proto); 429 return rpcb_getport_sync(&sin, program, version, proto);
428} 430}
@@ -485,18 +487,23 @@ static int __init root_nfs_get_handle(void)
485{ 487{
486 struct nfs_fh fh; 488 struct nfs_fh fh;
487 struct sockaddr_in sin; 489 struct sockaddr_in sin;
490 struct nfs_mount_request request = {
491 .sap = (struct sockaddr *)&sin,
492 .salen = sizeof(sin),
493 .dirpath = nfs_export_path,
494 .version = (nfs_data.flags & NFS_MOUNT_VER3) ?
495 NFS_MNT3_VERSION : NFS_MNT_VERSION,
496 .protocol = (nfs_data.flags & NFS_MOUNT_TCP) ?
497 XPRT_TRANSPORT_TCP : XPRT_TRANSPORT_UDP,
498 .fh = &fh,
499 };
488 int status; 500 int status;
489 int protocol = (nfs_data.flags & NFS_MOUNT_TCP) ?
490 XPRT_TRANSPORT_TCP : XPRT_TRANSPORT_UDP;
491 int version = (nfs_data.flags & NFS_MOUNT_VER3) ?
492 NFS_MNT3_VERSION : NFS_MNT_VERSION;
493 501
494 set_sockaddr(&sin, servaddr, htons(mount_port)); 502 set_sockaddr(&sin, servaddr, htons(mount_port));
495 status = nfs_mount((struct sockaddr *) &sin, sizeof(sin), NULL, 503 status = nfs_mount(&request);
496 nfs_path, version, protocol, &fh);
497 if (status < 0) 504 if (status < 0)
498 printk(KERN_ERR "Root-NFS: Server returned error %d " 505 printk(KERN_ERR "Root-NFS: Server returned error %d "
499 "while mounting %s\n", status, nfs_path); 506 "while mounting %s\n", status, nfs_export_path);
500 else { 507 else {
501 nfs_data.root.size = fh.size; 508 nfs_data.root.size = fh.size;
502 memcpy(nfs_data.root.data, fh.data, fh.size); 509 memcpy(nfs_data.root.data, fh.data, fh.size);