hsfs_susp_subr.c revision cf83459a3a773fbf09bbf2d90428884d292a6584
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 * System Use Sharing protocol subroutines for High Sierra filesystem 2N/A * Copyright 2005 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/* static declarations */ 2N/A * This is the main SUSP routine, that gets all the SUA areas and 2N/A * continuations. It calls parse_signatures() to actually interpret 2N/A * the signature fields. 2N/A * XXX - need to implement signature searching to speed things up and 2N/A * which is needed for the api, which isn't done yet. 2N/A * If there is no SUA, just return, no error 2N/A * Make sure that the continuation lenth is zero, as that is 2N/A * the way to tell if we must grab another continuation area. 2N/A * Get ready to put in a new name. If no "NM" is found, then 2N/A * hs_namecopy will come to the rescue. Make sure you don't 2N/A * have NULL names, also. 2N/A * parse_signatures() 2N/A * Find the correct handling function for the signature string that is 2N/A * passed to this function. 2N/A * signature searching: 2N/A * The two arguments of search_sig and search_num are for finding the 2N/A * search_num^th occurance of the signature search_sig. This will come 2N/A * in handy with searching for the "NM" field and is part of the api 2N/A * for rrip (which really can be used for any extension). 2N/A /* remaining to be parsed */ 2N/A /* This should never happen ... just so we don't panic, literally */ 2N/A * Until the end of SUA, search for the signatures 2N/A * (check for end of SUA (2 consecutive NULL bytes)) or the 2N/A * remaining length of the SUA is <= 3. The minimum signature 2N/A * Find appropriate extension and signature table 2N/A * look at an extension only if it is implemented 2N/A * Find the appropriate signature 2N/A * The SUA_len parameter specifies the 2N/A * length of the SUA that the kernel 2N/A * expects. There is also a length 2N/A * encoded in the SUA data. If they 2N/A * do not agree, bail out. 2N/A "parse_signatures: SUA length too big: " 2N/A "expected=%d, found=%d",
/* off to the next signature .... */ }
/* for extnp (extension parsing) */ * Opps, did not find this signature. We must * advance on the the next signature in the SUA * and pray to persumedly omniscient, omnipresent, * almighty transcendental being(s) that the next * record is in the susp format, or we get hosed. * This function reads the root directory extent to get to the SUA of * the "." entry of the root directory. It the checks to see if the "hs_check_root_dirent: vp (0x%p) not a directory",
"hs_check_root_dirent: bread: error=(%d)",
error);
* Here, we know that the "." entry is the first in the sector * just read (ISO 9660). Let's now check for the sharing * protocol and set call the susp sig_handler() if we should. * Then we run through the hs_parsedir() function to catch all * the other possibilities of SUSP fields and continuations. * If there is not SUA area, just return, and assume ISO. * We have a match of the sharing signature, so let's * call the sig_handler to do what is necessary. We can * ignore the return value, as implemented bits are set. * If we did not get at least 1 extension, let's assume ISO and * NULL out the implementation bits. * This function allocates a memory block, if necessary, and reads the * continuation area into the allocated space. * Return value : 0 if the read and allocation went OK. * 1 if there was an error. * Guard against invalid continuation area records. * Both cont_offset and cont_len must be no longer than * HS_SECTOR_SIZE. If they are, return an error. * This continuation area does not extend into the next sector * so just copy the data to the buffer. * This continuation area extends into the next sector so we * need to do some dancing: * - zero the return buffer so nothing random is returned * - copy the partial data to the *beginning* of the return buffer * - release the first sector's buffer * - copy the remainder of the data to the return buffer * simple function to just free up memory, if it exists