aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfsroot.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index 8dfefe41a8da..75f819dc0255 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -98,7 +98,7 @@
98static char nfs_root_name[256] __initdata = ""; 98static char nfs_root_name[256] __initdata = "";
99 99
100/* Address of NFS server */ 100/* Address of NFS server */
101static __u32 servaddr __initdata = 0; 101static __be32 servaddr __initdata = 0;
102 102
103/* Name of directory to mount */ 103/* Name of directory to mount */
104static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, }; 104static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, };
@@ -327,7 +327,7 @@ static int __init root_nfs_name(char *name)
327 */ 327 */
328static int __init root_nfs_addr(void) 328static int __init root_nfs_addr(void)
329{ 329{
330 if ((servaddr = root_server_addr) == INADDR_NONE) { 330 if ((servaddr = root_server_addr) == htonl(INADDR_NONE)) {
331 printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n"); 331 printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n");
332 return -1; 332 return -1;
333 } 333 }
@@ -411,7 +411,7 @@ __setup("nfsroot=", nfs_root_setup);
411 * Construct sockaddr_in from address and port number. 411 * Construct sockaddr_in from address and port number.
412 */ 412 */
413static inline void 413static inline void
414set_sockaddr(struct sockaddr_in *sin, __u32 addr, __u16 port) 414set_sockaddr(struct sockaddr_in *sin, __be32 addr, __be16 port)
415{ 415{
416 sin->sin_family = AF_INET; 416 sin->sin_family = AF_INET;
417 sin->sin_addr.s_addr = addr; 417 sin->sin_addr.s_addr = addr;
@@ -468,14 +468,13 @@ static int __init root_nfs_ports(void)
468 dprintk("Root-NFS: Portmapper on server returned %d " 468 dprintk("Root-NFS: Portmapper on server returned %d "
469 "as nfsd port\n", port); 469 "as nfsd port\n", port);
470 } 470 }
471 nfs_port = htons(nfs_port);
472 471
473 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { 472 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) {
474 printk(KERN_ERR "Root-NFS: Unable to get mountd port " 473 printk(KERN_ERR "Root-NFS: Unable to get mountd port "
475 "number from server, using default\n"); 474 "number from server, using default\n");
476 port = mountd_port; 475 port = mountd_port;
477 } 476 }
478 mount_port = htons(port); 477 mount_port = port;
479 dprintk("Root-NFS: mountd port is %d\n", port); 478 dprintk("Root-NFS: mountd port is %d\n", port);
480 479
481 return 0; 480 return 0;
@@ -496,7 +495,7 @@ static int __init root_nfs_get_handle(void)
496 int version = (nfs_data.flags & NFS_MOUNT_VER3) ? 495 int version = (nfs_data.flags & NFS_MOUNT_VER3) ?
497 NFS_MNT3_VERSION : NFS_MNT_VERSION; 496 NFS_MNT3_VERSION : NFS_MNT_VERSION;
498 497
499 set_sockaddr(&sin, servaddr, mount_port); 498 set_sockaddr(&sin, servaddr, htons(mount_port));
500 status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol); 499 status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol);
501 if (status < 0) 500 if (status < 0)
502 printk(KERN_ERR "Root-NFS: Server returned error %d " 501 printk(KERN_ERR "Root-NFS: Server returned error %d "
@@ -519,6 +518,6 @@ void * __init nfs_root_data(void)
519 || root_nfs_ports() < 0 518 || root_nfs_ports() < 0
520 || root_nfs_get_handle() < 0) 519 || root_nfs_get_handle() < 0)
521 return NULL; 520 return NULL;
522 set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, nfs_port); 521 set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, htons(nfs_port));
523 return (void*)&nfs_data; 522 return (void*)&nfs_data;
524} 523}