git://git.camperquake.de
/
zfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add linux compatibility
[zfs.git]
/
lib
/
libzfs
/
libzfs_dataset.c
diff --git
a/lib/libzfs/libzfs_dataset.c
b/lib/libzfs/libzfs_dataset.c
index
87ee182
..
baf289b
100644
(file)
--- a/
lib/libzfs/libzfs_dataset.c
+++ b/
lib/libzfs/libzfs_dataset.c
@@
-41,9
+41,11
@@
#include <grp.h>
#include <stddef.h>
#include <ucred.h>
#include <grp.h>
#include <stddef.h>
#include <ucred.h>
+#ifdef HAVE_IDMAP
#include <idmap.h>
#include <aclutils.h>
#include <directory.h>
#include <idmap.h>
#include <aclutils.h>
#include <directory.h>
+#endif /* HAVE_IDMAP */
#include <sys/dnode.h>
#include <sys/spa.h>
#include <sys/dnode.h>
#include <sys/spa.h>
@@
-902,6
+904,7
@@
zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
case ZFS_PROP_MLSLABEL:
{
case ZFS_PROP_MLSLABEL:
{
+#ifdef HAVE_MLSLABEL
/*
* Verify the mlslabel string and convert to
* internal hex label string.
/*
* Verify the mlslabel string and convert to
* internal hex label string.
@@
-951,7
+954,12
@@
badlabel:
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
m_label_free(new_sl); /* OK if null */
goto error;
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
m_label_free(new_sl); /* OK if null */
goto error;
-
+#else
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "mlslabels are unsupported"));
+ (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
+ goto error;
+#endif /* HAVE_MLSLABEL */
}
case ZFS_PROP_MOUNTPOINT:
}
case ZFS_PROP_MOUNTPOINT:
@@
-2039,6
+2047,7
@@
zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
case ZFS_PROP_MLSLABEL:
{
case ZFS_PROP_MLSLABEL:
{
+#ifdef HAVE_MLSLABEL
m_label_t *new_sl = NULL;
char *ascii = NULL; /* human readable label */
m_label_t *new_sl = NULL;
char *ascii = NULL; /* human readable label */
@@
-2072,6
+2081,10
@@
zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
(void) strlcpy(propbuf, ascii, proplen);
free(ascii);
(void) strlcpy(propbuf, ascii, proplen);
free(ascii);
+#else
+ (void) strlcpy(propbuf,
+ getprop_string(zhp, prop, &source), proplen);
+#endif /* HAVE_MLSLABEL */
}
break;
}
break;
@@
-2166,6
+2179,7
@@
zfs_prop_get_numeric(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t *value,
return (0);
}
return (0);
}
+#ifdef HAVE_IDMAP
static int
idmap_id_to_numeric_domain_rid(uid_t id, boolean_t isuser,
char **domainp, idmap_rid_t *ridp)
static int
idmap_id_to_numeric_domain_rid(uid_t id, boolean_t isuser,
char **domainp, idmap_rid_t *ridp)
@@
-2195,6
+2209,7
@@
out:
idmap_get_destroy(get_hdl);
return (err);
}
idmap_get_destroy(get_hdl);
return (err);
}
+#endif /* HAVE_IDMAP */
/*
* convert the propname into parameters needed by kernel
/*
* convert the propname into parameters needed by kernel
@@
-2228,6
+2243,7
@@
userquota_propname_decode(const char *propname, boolean_t zoned,
cp = strchr(propname, '@') + 1;
if (strchr(cp, '@')) {
cp = strchr(propname, '@') + 1;
if (strchr(cp, '@')) {
+#ifdef HAVE_IDMAP
/*
* It's a SID name (eg "user@domain") that needs to be
* turned into S-1-domainID-RID.
/*
* It's a SID name (eg "user@domain") that needs to be
* turned into S-1-domainID-RID.
@@
-2250,6
+2266,9
@@
userquota_propname_decode(const char *propname, boolean_t zoned,
return (ENOENT);
cp = numericsid;
/* will be further decoded below */
return (ENOENT);
cp = numericsid;
/* will be further decoded below */
+#else
+ return (ENOSYS);
+#endif /* HAVE_IDMAP */
}
if (strncmp(cp, "S-1-", 4) == 0) {
}
if (strncmp(cp, "S-1-", 4) == 0) {
@@
-2288,6
+2307,7
@@
userquota_propname_decode(const char *propname, boolean_t zoned,
*ridp = gr->gr_gid;
}
} else {
*ridp = gr->gr_gid;
}
} else {
+#ifdef HAVE_IDMAP
/* It's a user/group ID (eg "12345"). */
uid_t id = strtoul(cp, &end, 10);
idmap_rid_t rid;
/* It's a user/group ID (eg "12345"). */
uid_t id = strtoul(cp, &end, 10);
idmap_rid_t rid;
@@
-2305,6
+2325,9
@@
userquota_propname_decode(const char *propname, boolean_t zoned,
} else {
*ridp = id;
}
} else {
*ridp = id;
}
+#else
+ return (ENOSYS);
+#endif /* HAVE_IDMAP */
}
ASSERT3P(numericsid, ==, NULL);
}
ASSERT3P(numericsid, ==, NULL);