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) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 2N/A/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 2N/A/* All Rights Reserved */ 2N/A * manage systems files (Systems, Devices, and Dialcodes families). 2N/A * also manage new file Devconfig, allows per-device setup. 2N/A * present use is to specify what streams modules to push/pop for 2N/A * combine the 3 versions of everything (sys, dev, and dial) into one. 2N/A * allow arbitrary classes of service. 2N/A * need verifysys() for uucheck. 2N/A * nameserver interface? 2N/A * pass sysname (or 0) to getsysline(). (might want reg. exp. or 2N/A/* private variables */ 2N/A/* pointer arrays might be dynamically allocated */ 2N/Astatic char *
Systems[
64];
/* list of Systems files */ 2N/Astatic char *
Devices[
64];
/* list of Devices files */ 2N/Astatic char *
Dialers[
64];
/* list of Dialers files */ 2N/Astatic char *
Pops[
64];
/* list of STREAMS modules to be popped */ 2N/Astatic char *
Pushes[
64];
/* list of STREAMS modules to be pushed */ 2N/Astatic int nsystems;
/* index into list of Systems files */ 2N/Astatic int ndevices;
/* index into list of Devices files */ 2N/Astatic int ndialers;
/* index into list of Dialers files */ 2N/Astatic int npops;
/* index into list of STREAMS modules */ 2N/Astatic int npushes;
/* index into list of STREAMS modules */ 2N/A/* this might be dynamically allocated */ 2N/A * setservice init's Systems, Devices, Dialers lists from Sysfiles 2N/A * setdevcfg init's Pops, Pushes lists from Devconfig 2N/A/* administrative files access */ 2N/A * allow multiple entries for a given service, allow a service 2N/A * type to describe resources more than once, e.g., systems=foo:baz systems=bar. 2N/A * Release and Initialize previously allocated memory 2N/A * for Systems, Devices and Dialers. 2N/A /* got a (logical) line from Sysfiles */ 2N/A /* strtok's of this buf continue in tokenize() */ 2N/A /* if didn't find entries in Sysfiles, use defaults */ 2N/A * read Devconfig. allow multiple entries for a given service, allow a service 2N/A * type to describe resources more than once, e.g., push=foo:baz push=bar. 2N/A /* (re)initialize device-specific information */ 2N/A /* got a (logical) line from Devconfig */ 2N/A /* strtok's of this buf continue in tokenize() */ 2N/A * given a file pointer and buffer, construct logical line in buffer 2N/A * (i.e., concatenate lines ending in '\'). return length of line 2N/A * ASSUMES that buffer is BUFSIZ long! 2N/A /* empty buf or line too long! */ 2N/A *--
lend =
'\0';
/* lop off ending '\n' */ 2N/A * given a label (e.g., "service=", "device="), a name ("cu", "uucico"), 2N/A * and a line: if line begins with the label and if the name appears 2N/A * in a colon-separated list of names following the label, return true; 2N/A return (
FALSE);
/* probably a comment line */ 2N/A * can't use strtok() in the following because scansys(), 2N/A * scancfg() do an initializing call to strtok() before 2N/A * coming here and then CONTINUE calling strtok() in tokenize(), 2N/A * after returning from namematch(). 2N/A * tokenize() continues pulling tokens out of a buffer -- the 2N/A * initializing call to strtok must have been made before calling 2N/A * tokenize() -- and starts stuffing 'em into tokptr. 2N/A * look at top token in array: should be line of the form 2N/A * name=item1:item2:item3... 2N/A * if name is one we recognize, then call set[file|ioctl] to set up 2N/A * corresponding list. otherwise, log bad name. 2N/A continue;
/* may be meaningful someday? */ 2N/A /* ignore entry with empty rhs */ 2N/A * given the list for a particular type (systems, devices,...) 2N/A * and a line of colon-separated files, add 'em to list 2N/A while (*
tptr)
/* skip over existing entries to */ 2N/A tptr++;
/* concatenate multiple entries */ 2N/A /* by default, file names are relative to SYSDIR */ 2N/A /* if we can't read it, no point in adding to list */ 2N/A * given the list for a particular ioctl (push, pop) 2N/A * and a line of colon-separated modules, add 'em to list 2N/A while (*
tptr)
/* skip over existing entries to */ 2N/A tptr++;
/* concatenate multiple entries */ 2N/A * reset Systems files 2N/A * reset Devices files 2N/A * reset Dialers files 2N/A * get next line from Systems file 2N/A * return TRUE if successful, FALSE if not 2N/A /* not initialized via setservice() - use default */ 2N/A /* initialize devices and dialers whenever a new line is read */ 2N/A * move to next systems file. return TRUE if successful, FALSE if not 2N/A * get next line from Devices file 2N/A * return TRUE if successful, FALSE if not 2N/A /* not initialized via setservice() - use default */ 2N/A * move to next devices file. return TRUE if successful, FALSE if not 2N/A * get next line from Dialers file 2N/A * return TRUE if successful, FALSE if not 2N/A /* not initialized via setservice() - use default */ 2N/A * move to next dialers file. return TRUE if successful, FALSE if not 2N/A * get next module to be popped 2N/A * return TRUE if successful, FALSE if not 2N/A /* if the module name is enclosed in parentheses, */ 2N/A /* is optional. set flag & strip parens */ 2N/A * get next module to be pushed 2N/A * return TRUE if successful, FALSE if not 2N/A * return TRUE if successful, FALSE if not 2N/A /* check for streams modules to pop */ 2N/A (
const char *)
"pop_push: optionally POPing %s\n" :
2N/A (
const char *)
"pop_push: POPing %s\n"),
strmod);
2N/A DEBUG(
5,
"pop_push: I_LOOK on fd %d failed ",
fd);
2N/A /* check for streams modules to push */ 2N/A DEBUG(
5,
"pop_push: I_PUSH on fd %d failed ",
fd);
2N/A * return name of currently open Systems file 2N/A * return name of currently open Devices file 2N/A * return name of currently open Dialers file 2N/A * set configuration parameters provided in Config file 2N/A /* got a (logical) line from Config file */ 2N/A * this probably should be table driven when 2N/A * the list of configurable parameters grows. 2N/A DEBUG(
7,
"Unknown configuration parameter %s\n",