translate.c revision 98d1cbfec254295273b6a761bc1861c0374bdf02
1689N/A * The contents of this file are subject to the terms of the 1689N/A * Common Development and Distribution License (the "License"). 1689N/A * You may not use this file except in compliance with the License. 1689N/A * See the License for the specific language governing permissions 1689N/A * and limitations under the License. 1689N/A * When distributing Covered Code, include this CDDL HEADER in each 1689N/A * If applicable, add the following below this CDDL HEADER, with the 1689N/A * fields enclosed by brackets "[]" replaced with your own identifying 1689N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1689N/A * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 1689N/A * Given a full path to a file, translate into a dataset name and a relative 1689N/A * path within the dataset. 'dataset' must be at least MAXNAMELEN characters, 1689N/A * and 'relpath' must be at least MAXPATHLEN characters. We also pass a stat64 1689N/A * buffer, which we need later to get the object ID. 1689N/A * Convert from a (dataset, path) pair into a (objset, object) pair. Note that 1689N/A * we grab the object number from the inode number, since looking this up via 1689N/A * Before doing any libzpool operations, call sync() to ensure that the 1689N/A * on-disk state is consistent with the in-core state. 1689N/A * Calculate the real range based on the type, level, and range given. 1689N/A * Determine the numeric range from the string. 1689N/A * If range is unspecified, set the range to [0,-1], which 1689N/A * indicates that the whole object should be treated as an 1689N/A /* XXX add support for suffixes */ 1689N/A "a numeric range of the form 'start[,end]'\n",
1689N/A * If this is a request to inject faults into the dnode, then we 1689N/A * must translate the current (objset,object) pair into an 1689N/A * offset within the metadnode for the objset. Specifying any 1689N/A * kind of range with type 'dnode' is illegal. 1689N/A * Get the dnode associated with object, so we can calculate the block 1689N/A * Translate range into block IDs. 1689N/A * Check level, and then translate level 0 blkids into ranges 1689N/A * appropriate for level of indirection. 1689N/A * MOS objects are treated specially. 3853N/A * Convert a full path into a (dataset, file) pair. 3853N/A * Convert (dataset, file) into (objset, object) 3853N/A * For the given object, calculate the real (type, level, range) 1689N/A * A raw bookmark of the form objset:object:level:blkid, where each 1689N/A * number is a hexidecimal value. 1689N/A * Given a device name or GUID, create an appropriate injection record