]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/nfs/super.c
ide-cd: add TEAC CD-224E to the NO_AUTOCLOSE list
[linux-2.6-omap-h63xx.git] / fs / nfs / super.c
index b99096b8e82720b662e70d9ad1ac5cf2c4ec71e0..a3b0061dfd4566ea44f253b5ec952fd0f866674c 100644 (file)
@@ -99,7 +99,7 @@ enum {
        Opt_err
 };
 
-static match_table_t nfs_mount_option_tokens = {
+static const match_table_t nfs_mount_option_tokens = {
        { Opt_userspace, "bg" },
        { Opt_userspace, "fg" },
        { Opt_userspace, "retry=%s" },
@@ -166,7 +166,7 @@ enum {
        Opt_xprt_err
 };
 
-static match_table_t nfs_xprt_protocol_tokens = {
+static const match_table_t nfs_xprt_protocol_tokens = {
        { Opt_xprt_udp, "udp" },
        { Opt_xprt_tcp, "tcp" },
        { Opt_xprt_rdma, "rdma" },
@@ -183,7 +183,7 @@ enum {
        Opt_sec_err
 };
 
-static match_table_t nfs_secflavor_tokens = {
+static const match_table_t nfs_secflavor_tokens = {
        { Opt_sec_none, "none" },
        { Opt_sec_none, "null" },
        { Opt_sec_sys, "sys" },
@@ -716,20 +716,22 @@ static void nfs_parse_ipv4_address(char *string, size_t str_len,
        *addr_len = 0;
 }
 
-#define IPV6_SCOPE_DELIMITER   '%'
-
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-static void nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
-                                   const char *delim,
-                                   struct sockaddr_in6 *sin6)
+static int nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
+                                  const char *delim,
+                                  struct sockaddr_in6 *sin6)
 {
        char *p;
        size_t len;
 
-       if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
-               return ;
+       if ((string + str_len) == delim)
+               return 1;
+
        if (*delim != IPV6_SCOPE_DELIMITER)
-               return;
+               return 0;
+
+       if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
+               return 0;
 
        len = (string + str_len) - delim - 1;
        p = kstrndup(delim + 1, len, GFP_KERNEL);
@@ -742,14 +744,20 @@ static void nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
                        scope_id = dev->ifindex;
                        dev_put(dev);
                } else {
-                       /* scope_id is set to zero on error */
-                       strict_strtoul(p, 10, &scope_id);
+                       if (strict_strtoul(p, 10, &scope_id) == 0) {
+                               kfree(p);
+                               return 0;
+                       }
                }
 
                kfree(p);
+
                sin6->sin6_scope_id = scope_id;
                dfprintk(MOUNT, "NFS: IPv6 scope ID = %lu\n", scope_id);
+               return 1;
        }
+
+       return 0;
 }
 
 static void nfs_parse_ipv6_address(char *string, size_t str_len,
@@ -765,9 +773,11 @@ static void nfs_parse_ipv6_address(char *string, size_t str_len,
 
                sin6->sin6_family = AF_INET6;
                *addr_len = sizeof(*sin6);
-               if (in6_pton(string, str_len, addr, IPV6_SCOPE_DELIMITER, &delim)) {
-                       nfs_parse_ipv6_scope_id(string, str_len, delim, sin6);
-                       return;
+               if (in6_pton(string, str_len, addr,
+                                       IPV6_SCOPE_DELIMITER, &delim) != 0) {
+                       if (nfs_parse_ipv6_scope_id(string, str_len,
+                                                       delim, sin6) != 0)
+                               return;
                }
        }
 
@@ -790,7 +800,7 @@ static void nfs_parse_ipv6_address(char *string, size_t str_len,
  * If there is a problem constructing the new sockaddr, set the address
  * family to AF_UNSPEC.
  */
-static void nfs_parse_ip_address(char *string, size_t str_len,
+void nfs_parse_ip_address(char *string, size_t str_len,
                                 struct sockaddr *sap, size_t *addr_len)
 {
        unsigned int i, colons;
@@ -2449,7 +2459,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
                compare_super = NULL;
 
        /* Get a superblock - note that we may end up sharing one that already exists */
-       s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata);
+       s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata);
        if (IS_ERR(s)) {
                error = PTR_ERR(s);
                goto out_err_nosb;
@@ -2534,7 +2544,7 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
                compare_super = NULL;
 
        /* Get a superblock - note that we may end up sharing one that already exists */
-       s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata);
+       s = sget(&nfs4_fs_type, compare_super, nfs_set_super, &sb_mntdata);
        if (IS_ERR(s)) {
                error = PTR_ERR(s);
                goto out_err_nosb;