/** * Obtain all snapshots for this dataset. * * @return all snapshot datasets. */ public Set<ZFSSnapshot> snapshots() { final Set<ZFSSnapshot> set = new TreeSet<ZFSSnapshot>(); String abi = library.getFeature("LIBZFS4J_ABI_zfs_iter_snapshots"); if (abi.equals("openzfs")) { LIBZFS.zfs_iter_snapshots(handle, false, new libzfs.zfs_iter_f() { public int callback(zfs_handle_t handle, Pointer arg) { set.add((ZFSSnapshot)ZFSObject.create(library, handle)); return 0; } }, null); } else { LIBZFS.zfs_iter_snapshots(handle, new libzfs.zfs_iter_f() { public int callback(zfs_handle_t handle, Pointer arg) { set.add((ZFSSnapshot)ZFSObject.create(library, handle)); return 0; } }, null); } return set; }
/** * Revokes the specified set of permissions to this dataset. * See also the detailed "NOTE" comment above. */ public void unallow(ACLBuilder acl) { String abi = library.getFeature("LIBZFS4J_ABI_zfs_perm_remove"); if (abi.equals("pre-sol10u8")) { for (PermissionBuilder b : acl.builders) { if(LIBZFS.zfs_perm_remove(handle,b.toNativeFormat(this))!=0) throw new ZFSException(library); } } else { LOGGER.log(Level.FINE, "NO-OP: libzfs4j::unallow() was called while LIBZFS4J_ABI_zfs_perm_remove=='"+abi+"' and this is currently not implemented"); } }
/** * Grants the specified set of permissions to this dataset. * NOTE that the "zfs_perm_*" libzfs.so routines are not present at * all in OpenZFS, nor even in Sun Solaris 10u8 (last seen in 10u6). * Not sure about Sol10u7 since it was a rather intermediate release. * They may have been replaced with other logic, since zfs_allow_t and * related data types and comments are still present in the headers. */ public void allow(ACLBuilder acl) { String abi = library.getFeature("LIBZFS4J_ABI_zfs_perm_set"); if (abi.equals("pre-sol10u8")) { for (PermissionBuilder b : acl.builders) { if(LIBZFS.zfs_perm_set(handle,b.toNativeFormat(this))!=0) throw new ZFSException(library); } } else { LOGGER.log(Level.FINE, "NO-OP: libzfs4j::allow() was called while LIBZFS4J_ABI_zfs_perm_set=='"+abi+"' and this is currently not implemented"); } }
/** * Destroy a named snapshot of this dataset. */ public void destroySnapshot(String name) { String abi = library.getFeature("LIBZFS4J_ABI_zfs_destroy_snaps"); if (abi.equals("openzfs")) { if (LIBZFS.zfs_destroy_snaps(handle, name, false/*?*/) != 0) throw new ZFSException(library,"Failed to destroy "+getName()); } else { if (LIBZFS.zfs_destroy_snaps(handle, name) != 0) throw new ZFSException(library,"Failed to destroy "+getName()); } }
/** * Wipes out the dataset and all its data. Very dangerous. * * <p> * If this dataset contains nested datasets, this method fails with * {@link ErrorCode#EZFS_EXISTS}. */ public void destroy() { String abi = library.getFeature("LIBZFS4J_ABI_zfs_destroy"); if (abi.equals("openzfs")) { if (LIBZFS.zfs_destroy(handle,false/*?*/) != 0) throw new ZFSException(library,"Failed to destroy "+getName()); } else { if (LIBZFS.zfs_destroy(handle) != 0) throw new ZFSException(library,"Failed to destroy "+getName()); } }
final boolean recursive) { String fullName = name + '@' + snapshotName; String abi = library.getFeature("LIBZFS4J_ABI_zfs_snapshot"); if (abi.equals("pre-nv96")) {