Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/lib/libzfs/common Fix amd64 build w...



details:   https://anonhg.NetBSD.org/src/rev/9e25a2fe90cb
branches:  trunk
changeset: 759629:9e25a2fe90cb
user:      haad <haad%NetBSD.org@localhost>
date:      Tue Dec 14 01:22:24 2010 +0000

description:
Fix amd64 build where sysinfo was not defined, disable libshare for now.

diffstat:

 external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c |  44 ++++++++++----
 1 files changed, 31 insertions(+), 13 deletions(-)

diffs (206 lines):

diff -r 23b2b0ddff26 -r 9e25a2fe90cb external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c
--- a/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c Tue Dec 14 01:21:25 2010 +0000
+++ b/external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c Tue Dec 14 01:22:24 2010 +0000
@@ -168,7 +168,7 @@
                /* the mountpoint is the first entry on each line */
                if ((tab = strchr(buf, '\t')) == NULL)
                        continue;
-
+#if defined(sun)
                *tab = '\0';
                if (strcmp(buf, mountpoint) == 0) {
                        /*
@@ -194,6 +194,11 @@
                                }
                        }
                }
+#else
+                       if (proto == PROTO_NFS)
+                               return (SHARED_NFS);
+#endif
+
        }
 
        return (SHARED_NOT_SHARED);
@@ -515,7 +520,7 @@
  * wrapper functions that check to see that the pointers to functions
  * initialized in _zfs_init_libshare() are actually present.
  */
-
+#ifdef PORT_SOLARIS
 static sa_handle_t (*_sa_init)(int);
 static void (*_sa_fini)(sa_handle_t);
 static sa_share_t (*_sa_find_share)(sa_handle_t, char *);
@@ -528,7 +533,7 @@
 static int (*_sa_zfs_process_share)(sa_handle_t, sa_group_t, sa_share_t,
     char *, char *, zprop_source_t, char *, char *, char *);
 static void (*_sa_update_sharetab_ts)(sa_handle_t);
-
+#endif
 /*
  * _zfs_init_libshare()
  *
@@ -541,6 +546,7 @@
 static void
 _zfs_init_libshare(void)
 {
+#ifdef PORT_SOLARIS
        void *libshare;
        char path[MAXPATHLEN];
        char isa[MAXISALEN];
@@ -595,6 +601,7 @@
                        _sa_update_sharetab_ts = NULL;
                }
        }
+#endif
 }
 
 /*
@@ -609,7 +616,7 @@
 zfs_init_libshare(libzfs_handle_t *zhandle, int service)
 {
        int ret = SA_OK;
-
+#ifdef PORT_SOLARIS
        if (_sa_init == NULL)
                ret = SA_CONFIG_ERR;
 
@@ -635,7 +642,7 @@
 
        if (ret == SA_OK && zhandle->libzfs_sharehdl == NULL)
                ret = SA_NO_MEMORY;
-
+#endif
        return (ret);
 }
 
@@ -649,8 +656,10 @@
 zfs_uninit_libshare(libzfs_handle_t *zhandle)
 {
        if (zhandle != NULL && zhandle->libzfs_sharehdl != NULL) {
+#ifdef PORT_SOLARIS
                if (_sa_fini != NULL)
                        _sa_fini(zhandle->libzfs_sharehdl);
+#endif
                zhandle->libzfs_sharehdl = NULL;
        }
 }
@@ -664,13 +673,18 @@
 int
 zfs_parse_options(char *options, zfs_share_proto_t proto)
 {
+#ifdef PORT_SOLARIS
        if (_sa_parse_legacy_options != NULL) {
                return (_sa_parse_legacy_options(NULL, options,
                    proto_table[proto].p_name));
        }
        return (SA_CONFIG_ERR);
+#else
+       return (SA_OK);
+#endif
 }
 
+#ifdef PORT_SOLARIS
 /*
  * zfs_sa_find_share(handle, path)
  *
@@ -712,7 +726,7 @@
                return (_sa_disable_share(share, proto));
        return (SA_CONFIG_ERR);
 }
-
+#endif
 /*
  * Share the given filesystem according to the options in the specified
  * protocol specific properties (sharenfs, sharesmb).  We rely
@@ -728,11 +742,11 @@
        sa_share_t share;
        zfs_share_proto_t *curr_proto;
        zprop_source_t sourcetype;
-       int ret;
+       int error, ret;
 
        if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
                return (0);
-
+#ifdef PORT_SOLARIS
        if ((ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) {
                (void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
                    dgettext(TEXT_DOMAIN, "cannot share '%s': %s"),
@@ -740,7 +754,7 @@
                    _sa_errorstr(ret) : "");
                return (-1);
        }
-
+#endif
        for (curr_proto = proto; *curr_proto != PROTO_END; curr_proto++) {
                /*
                 * Return success if there are no share options.
@@ -760,6 +774,7 @@
                if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED))
                        continue;
 
+#ifdef PORT_SOLARIS
                share = zfs_sa_find_share(hdl->libzfs_sharehdl, mountpoint);
                if (share == NULL) {
                        /*
@@ -803,7 +818,7 @@
                            zfs_get_name(zhp));
                        return (-1);
                }
-
+#endif
        }
        return (0);
 }
@@ -834,6 +849,7 @@
 unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint,
     zfs_share_proto_t proto)
 {
+#ifdef PORT_SOLARIS
        sa_share_t share;
        int err;
        char *mntpt;
@@ -867,6 +883,7 @@
                    dgettext(TEXT_DOMAIN, "cannot unshare '%s': not found"),
                    name));
        }
+#endif
        return (0);
 }
 
@@ -1027,7 +1044,7 @@
            sizeof (shareopts), NULL, NULL, 0, B_FALSE) != 0 ||
            strcmp(shareopts, "off") == 0)
                return (0);
-
+#ifdef PORT_ISCSI /* NetBSD do not support zfssharing with iscsi, yet */
        if (iscsitgt_zfs_share == NULL || iscsitgt_zfs_share(dataset) != 0) {
                int error = EZFS_SHAREISCSIFAILED;
 
@@ -1042,7 +1059,7 @@
                return (zfs_error_fmt(hdl, error,
                    dgettext(TEXT_DOMAIN, "cannot share '%s'"), dataset));
        }
-
+#endif
        return (0);
 }
 
@@ -1052,6 +1069,7 @@
        const char *dataset = zfs_get_name(zhp);
        libzfs_handle_t *hdl = zhp->zfs_hdl;
 
+#ifdef PORT_ISCSI /* NetBSD do not support zfssharing with iscsi, yet */
        /*
         * Return if the volume is not shared
         */
@@ -1070,7 +1088,7 @@
                return (zfs_error_fmt(hdl, EZFS_UNSHAREISCSIFAILED,
                    dgettext(TEXT_DOMAIN, "cannot unshare '%s'"), dataset));
        }
-
+#endif
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index