6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #pragma ident "%Z%%M% %I% %E% SMI"
27
28 #include <sys/types.h>
29 #include <sys/inttypes.h>
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 #include <sys/user.h>
33 #include <sys/disp.h>
34 #include <sys/conf.h>
35 #include <sys/bootconf.h>
36 #include <sys/sysconf.h>
37 #include <sys/sunddi.h>
38 #include <sys/esunddi.h>
39 #include <sys/ddi_impldefs.h>
40 #include <sys/kmem.h>
41 #include <sys/vmem.h>
42 #include <sys/fs/ufs_fsdir.h>
43 #include <sys/hwconf.h>
44 #include <sys/modctl.h>
45 #include <sys/cmn_err.h>
46 #include <sys/kobj.h>
47 #include <sys/kobj_lex.h>
682 goto bad;
683 }
684
685 cp = tok1;
686 while ((token = kobj_lex(file, cp,
687 sizeof (tok1) - (cp - tok1))) != NEWLINE && token != EOF) {
688 if (token == -1) {
689 kobj_file_err(CE_WARN, file, oversize_err);
690 goto bad;
691 }
692 cp += strlen(cp);
693 while ((ch = kobj_getc(file)) != -1 && !iswhite(ch) &&
694 !isnewline(ch) && ch != ':') {
695 if (cp - tok1 >= sizeof (tok1) - 1) {
696 kobj_file_err(CE_WARN, file,
697 oversize_err);
698 goto bad;
699 }
700 *cp++ = (char)ch;
701 }
702 *cp++ = ':';
703 if (isnewline(ch)) {
704 cp--;
705 (void) kobj_ungetc(file);
706 }
707 }
708 (void) kobj_ungetc(file);
709 *cp = '\0';
710 sysp->sys_ptr = vmem_alloc(mod_sysfile_arena, strlen(tok1) + 1,
711 VM_SLEEP);
712 (void) strcpy(sysp->sys_ptr, tok1);
713 break;
714
715 case MOD_SWAPDEV:
716 case MOD_ROOTDEV:
717 if ((token = kobj_lex(file, tok1, sizeof (tok1))) != COLON) {
718 kobj_file_err(CE_WARN, file, colon_err, cmd);
719 goto bad;
720 }
721 while ((ch = kobj_getc(file)) == ' ' || ch == '\t')
722 ;
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/types.h>
27 #include <sys/inttypes.h>
28 #include <sys/param.h>
29 #include <sys/systm.h>
30 #include <sys/user.h>
31 #include <sys/disp.h>
32 #include <sys/conf.h>
33 #include <sys/bootconf.h>
34 #include <sys/sysconf.h>
35 #include <sys/sunddi.h>
36 #include <sys/esunddi.h>
37 #include <sys/ddi_impldefs.h>
38 #include <sys/kmem.h>
39 #include <sys/vmem.h>
40 #include <sys/fs/ufs_fsdir.h>
41 #include <sys/hwconf.h>
42 #include <sys/modctl.h>
43 #include <sys/cmn_err.h>
44 #include <sys/kobj.h>
45 #include <sys/kobj_lex.h>
680 goto bad;
681 }
682
683 cp = tok1;
684 while ((token = kobj_lex(file, cp,
685 sizeof (tok1) - (cp - tok1))) != NEWLINE && token != EOF) {
686 if (token == -1) {
687 kobj_file_err(CE_WARN, file, oversize_err);
688 goto bad;
689 }
690 cp += strlen(cp);
691 while ((ch = kobj_getc(file)) != -1 && !iswhite(ch) &&
692 !isnewline(ch) && ch != ':') {
693 if (cp - tok1 >= sizeof (tok1) - 1) {
694 kobj_file_err(CE_WARN, file,
695 oversize_err);
696 goto bad;
697 }
698 *cp++ = (char)ch;
699 }
700 *cp++ = ' ';
701 if (isnewline(ch)) {
702 cp--;
703 (void) kobj_ungetc(file);
704 }
705 }
706 (void) kobj_ungetc(file);
707 *cp = '\0';
708 sysp->sys_ptr = vmem_alloc(mod_sysfile_arena, strlen(tok1) + 1,
709 VM_SLEEP);
710 (void) strcpy(sysp->sys_ptr, tok1);
711 break;
712
713 case MOD_SWAPDEV:
714 case MOD_ROOTDEV:
715 if ((token = kobj_lex(file, tok1, sizeof (tok1))) != COLON) {
716 kobj_file_err(CE_WARN, file, colon_err, cmd);
717 goto bad;
718 }
719 while ((ch = kobj_getc(file)) == ' ' || ch == '\t')
720 ;
|