2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 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 2004 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * This file contains public API functions for managing the legacy dhcptab 2N/A * container format. For the semantics of these functions, please see the 2N/A * Enterprise DHCP Architecture Document. 2N/A * This is a legacy format which has no header, so we neither write 2N/A * nor verify a header (we just create the file or make sure it 2N/A * exists, depending on the value of `flags'). 2N/A * Internal version of lookup_dt() used by both lookup_dt() and 2N/A * update_dt(); same semantics as lookup_dt() except that the `partial' 2N/A * argument has been generalized into a `flags' field and the handle has 2N/A * been turned into a FILE pointer. 2N/A * Skip pure comment lines; for now this just skips the 2N/A * header information at the top of the container. 2N/A * Parse out the entry into the dt_rec_t 2N/A * See if we've got a match. If so, allocate the new 2N/A * record, fill it in, and continue. 2N/A * Caller just wants a count of the number of matching 2N/A * records, not the records themselves; continue. 2N/A * Allocate record; if FIND_POSITION flag is set, then we 2N/A * need to allocate an extended (dt_recpos_t) record. 2N/A * Fill in record; if FIND_POSITION flag is set, then pass 2N/A * back additional location information. 2N/A * Chuck the record on the list; up the counter. 2N/A * Internal dhcptab record update routine, used to factor out the 2N/A * common code between add_dt(), delete_dt(), and modify_dt(). If 2N/A * `origp' is NULL, then act like add_dt(); if `newp' is NULL, then 2N/A * act like delete_dt(); otherwise act like modify_dt(). 2N/A * Open the container to update and a new container file which we 2N/A * will store the updated version of the container in. When the 2N/A * update is done, rename the new file to be the real container. 2N/A * If we're adding a new record or changing a key for an existing 2N/A * record, bail if the record we want to add already exists. 2N/A * If we're deleting or modifying record, make sure the record 2N/A * still exists. Note that we don't check signatures because this 2N/A * is a legacy format that has no signatures. 2N/A * Note the offset of the record we're modifying or deleting 2N/A * for use down below. 2N/A * No record to modify or delete, so set `recoff' and 2N/A * `recnext' appropriately. 2N/A * Make a new copy of the container. If we're deleting or 2N/A * modifying a record, don't copy that record to the new container. 2N/A * If there's a new record, append it to the new container. 2N/A * Note: we close these descriptors before the rename(2) (rather 2N/A * than just having the `out:' label clean them up) to save NFS 2N/A * some work (otherwise, NFS has to save `dtpath' to an alternate 2N/A * name since its vnode would still be active). 2N/A * Given a buffer `path' of `pathlen' bytes, fill it in with a path to 2N/A * the dhcptab in directory `dir' with a suffix of `suffix'. 2N/A * Write the dt_rec_t pointed to by `recp' into the open container `fd' at 2N/A * offset `recoff'. Returns DSVC_* error code.