Merge branch 'for-2.6.33' of git://linux-nfs.org/~bfields/linux
[safe/jmp/linux-2.6] / fs / nfs / nfsroot.c
index f1c0a06..8c55b27 100644 (file)
 #include <net/ipconfig.h>
 #include <linux/parser.h>
 
+#include "internal.h"
+
 /* Define this to allow debugging output */
 #undef NFSROOT_DEBUG
 #define NFSDBG_FACILITY NFSDBG_ROOT
 
+/* Default port to use if server is not running a portmapper */
+#define NFS_MNT_PORT   627
+
 /* Default path we try to mount. "%s" gets replaced by our IP address */
 #define NFS_ROOT               "/tftpboot/%s"
 
@@ -127,7 +132,7 @@ enum {
        Opt_err
 };
 
-static match_table_t __initconst tokens = {
+static const match_table_t tokens __initconst = {
        {Opt_port, "port=%u"},
        {Opt_rsize, "rsize=%u"},
        {Opt_wsize, "wsize=%u"},
@@ -329,7 +334,7 @@ static int __init root_nfs_addr(void)
        }
 
        snprintf(nfs_data.hostname, sizeof(nfs_data.hostname),
-                "%u.%u.%u.%u", NIPQUAD(servaddr));
+                "%pI4", &servaddr);
        return 0;
 }
 
@@ -421,8 +426,8 @@ static int __init root_nfs_getport(int program, int version, int proto)
 {
        struct sockaddr_in sin;
 
-       printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n",
-               program, version, NIPQUAD(servaddr));
+       printk(KERN_NOTICE "Looking up port of RPC %d/%d on %pI4\n",
+               program, version, &servaddr);
        set_sockaddr(&sin, servaddr, 0);
        return rpcb_getport_sync(&sin, program, version, proto);
 }
@@ -485,15 +490,22 @@ static int __init root_nfs_get_handle(void)
 {
        struct nfs_fh fh;
        struct sockaddr_in sin;
+       unsigned int auth_flav_len = 0;
+       struct nfs_mount_request request = {
+               .sap            = (struct sockaddr *)&sin,
+               .salen          = sizeof(sin),
+               .dirpath        = nfs_export_path,
+               .version        = (nfs_data.flags & NFS_MOUNT_VER3) ?
+                                       NFS_MNT3_VERSION : NFS_MNT_VERSION,
+               .protocol       = (nfs_data.flags & NFS_MOUNT_TCP) ?
+                                       XPRT_TRANSPORT_TCP : XPRT_TRANSPORT_UDP,
+               .fh             = &fh,
+               .auth_flav_len  = &auth_flav_len,
+       };
        int status;
-       int protocol = (nfs_data.flags & NFS_MOUNT_TCP) ?
-                                       XPRT_TRANSPORT_TCP : XPRT_TRANSPORT_UDP;
-       int version = (nfs_data.flags & NFS_MOUNT_VER3) ?
-                                       NFS_MNT3_VERSION : NFS_MNT_VERSION;
 
        set_sockaddr(&sin, servaddr, htons(mount_port));
-       status = nfs_mount((struct sockaddr *) &sin, sizeof(sin), NULL,
-                          nfs_export_path, version, protocol, &fh);
+       status = nfs_mount(&request);
        if (status < 0)
                printk(KERN_ERR "Root-NFS: Server returned error %d "
                                "while mounting %s\n", status, nfs_export_path);