2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A/* ******************************************************************** */ 2N/A/* Public Functions */ 2N/A/* ******************************************************************** */ 2N/A * Function: be_rename 2N/A * Description: Renames the BE from the original name to the new name 2N/A * passed in through be_attrs. Also the entries in vfstab are 2N/A * updated with the new name. Caller is responsible for 2N/A * updating the boot menu. 2N/A * be_attrs - pointer to nvlist_t of attributes being passed in. 2N/A * The following attribute values are used by 2N/A * BE_ATTR_ORIG_BE_NAME *required 2N/A * BE_ATTR_NEW_BE_NAME *required 2N/A * BE_SUCCESS - Success 2N/A * be_errno_t - Failure 2N/A * Check to see if we're operating inside a Solaris Container 2N/A * or the Global Zone. 2N/A * Check to see if we have write access to the root filesystem 2N/A /* Initialize libzfs handle */ 2N/A /* Get original BE name to rename from */ 2N/A "lookup BE_ATTR_ORIG_BE_NAME attribute\n"));
2N/A /* Get new BE name to rename to */ 2N/A "lookup BE_ATTR_NEW_BE_NAME attribute\n"));
2N/A * Get the currently active BE and check to see if this 2N/A * is an attempt to rename the currently active BE. 2N/A "the currently active BE, which is not supported\n"));
2N/A * If this is an attempt to rename a BE that is marked as active 2N/A * on reboot, then we fail since the zfs_rename() won't work due 2N/A "the active on boot BE, which is not supported\n"));
2N/A /* Validate original BE name */ 2N/A /* Validate new BE name */ 2N/A /* Find which zpool the BE is in */ 2N/A /* New BE will reside in the same zpool as orig BE */ 2N/A * Generate a list of file systems from the BE that are legacy 2N/A * mounted before renaming. We use this list to determine which 2N/A * entries in the vfstab we need to update after we've renamed the BE. 2N/A "get legacy mounted file system list for %s\n"),
2N/A /* Get handle to BE's root dataset */ 2N/A "open BE root dataset (%s): %s\n"),
2N/A /* Rename of BE's root dataset. */ 2N/A /* Refresh handle to BE's root dataset after the rename */ 2N/A "open BE root dataset (%s): %s\n"),
2N/A /* If BE is already mounted, get its mountpoint */ 2N/A "get altroot of mounted BE %s: %s\n"),
2N/A /* Update BE's vfstab */