In the current design of zfs(1m), nearly all of the operations are limited
to working on a single filesystem at a time. This places some limitations
on the usability of zfs(1m) when using it with scripts. For example, you
cannot do:

# zfs list -H -o origin | egrep -v '^\-$' | xargs zfs destroy

Instead, you need to do this:

# zfs list -H -o origin | egrep -v '^\-$' | sh -c 'while read i; do zfs 
destroy "$i"; done'

(because not everyone uses sh as their shell...)

As an experiment, I modified zfs_main.c to allow destroy to work in
a manner that is conducive to being used with xargs - patches attached.

It's a relatively simple change but there are important questions, such
as does it fail on the first error or continue on, etc.

But I'm sure there was a reason why it was designed and implemented
the way it is rather than with what my patch suggests?

Darren


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: zfs_main.c.patch
URL: 
<http://mail.opensolaris.org/pipermail/zfs-code/attachments/20080908/30bdf0e2/attachment.ksh>

Reply via email to