ahrens commented on this pull request.

This is good in general, though I wonder if we should be pushing more in the 
direction of using channel programs for some of this.  Some of the functions 
you're proposing could be easily changed to use a channel program under the 
hood (e.g. lzc_rename, lzc_destroy), which we could do at a later date.  The 
ones that are really specific to the current (not great) implementation are 
lzc_get_props and lzc_list_*().  The implementations in channel programs are 
much more easily consumable.

I'd especially like to avoid "blessing" the current props nvlist in any way - 
it's super gross.  We already have a much nicer interface for dealing with the 
props in channel programs, so let's use that instead.

> +}
+
+int
+lzc_destroy(const char *fsname)
+{
+       int error;
+
+       nvlist_t *args = fnvlist_alloc();
+       error = lzc_ioctl(ZFS_IOC_DESTROY, fsname, args, NULL);
+       nvlist_free(args);
+       return (error);
+}
+
+/* XXX "inherit" received values (zfs inherit -S) ? */
+int
+lzc_inherit_prop(const char *fsname, const char *name)

let's turn this into a proper comment, e.g. `Inherits the (regular, 
non-received) properties.  This doesn't provide an interface to inherit 
received values.`

> +     (void) strlcpy(zc.zc_value, name, sizeof (zc.zc_value));
+       error = ioctl(g_fd, ZFS_IOC_INHERIT_PROP, &zc);
+       if (error != 0)
+               error = errno;
+       return (error);
+}
+
+int
+lzc_set_prop(const char *fsname, nvlist_t *props)
+{
+       nvpair_t *elem;
+       int error;
+
+       /* the list must have exactly one element */
+       if ((elem = nvlist_next_nvpair(props, NULL)) == NULL ||
+           nvlist_next_nvpair(props, elem) != NULL)

why do we have this restriction?  The ioctl handles multiple props.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/508#pullrequestreview-89859209
------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/T94e916bc5cb9e1ed-M898a98aa181929e90295404d
Powered by Topicbox: https://topicbox.com

Reply via email to