Print this page
6136 sysmacros.h unnecessarily polutes the namespace
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/devfsadm/fssnap_link.c
+++ new/usr/src/cmd/devfsadm/fssnap_link.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright (c) 2000-2001 by Sun Microsystems, Inc.
24 24 * All rights reserved.
25 25 */
26 26
27 -#pragma ident "%Z%%M% %I% %E% SMI"
28 -
29 27 #include <regex.h>
30 28 #include <devfsadm.h>
31 29 #include <stdio.h>
32 30 #include <strings.h>
33 31 #include <stdlib.h>
34 32 #include <limits.h>
35 33 #include <sys/fssnap_if.h>
34 +#include <sys/mkdev.h>
36 35
37 36
38 37 static int fssnap(di_minor_t minor, di_node_t node);
39 38
40 39 static devfsadm_create_t fssnap_cbt[] = {
41 40 { "pseudo", "ddi_pseudo", SNAP_NAME,
42 41 TYPE_EXACT | DRV_EXACT, ILEVEL_0, fssnap,
43 42 },
44 43 };
45 44
46 45 DEVFSADM_CREATE_INIT_V0(fssnap_cbt);
47 46
48 47 /*
49 48 * For the master device:
50 49 * /dev/fssnapctl -> /devices/pseudo/fssnap@0:ctl
51 50 * For each other device
52 51 * /dev/fssnap/1 -> /devices/pseudo/fssnap@0:1
53 52 * /dev/rfssnap/1 -> /devices/pseudo/fssnap@0:1,raw
54 53 */
55 54 static int
56 55 fssnap(di_minor_t minor, di_node_t node)
57 56 {
58 57 dev_t dev;
59 58 char mn[MAXNAMELEN + 1];
60 59 char blkname[MAXNAMELEN + 1];
61 60 char rawname[MAXNAMELEN + 1];
62 61 char path[PATH_MAX + 1];
63 62
64 63 (void) strcpy(mn, di_minor_name(minor));
65 64
66 65 if (strcmp(mn, "ctl") == 0) {
67 66 (void) devfsadm_mklink(SNAP_CTL_NAME, node, minor, 0);
68 67 } else {
69 68 dev = di_minor_devt(minor);
70 69 (void) snprintf(blkname, sizeof (blkname), "%d",
71 70 (int)minor(dev));
72 71 (void) snprintf(rawname, sizeof (rawname), "%d,raw",
73 72 (int)minor(dev));
74 73
75 74 if (strcmp(mn, blkname) == 0) {
76 75 (void) snprintf(path, sizeof (path), "%s/%s",
77 76 SNAP_BLOCK_NAME, blkname);
78 77 } else if (strcmp(mn, rawname) == 0) {
79 78 (void) snprintf(path, sizeof (path), "%s/%s",
80 79 SNAP_CHAR_NAME, blkname);
81 80 } else {
82 81 return (DEVFSADM_CONTINUE);
83 82 }
84 83
85 84 (void) devfsadm_mklink(path, node, minor, 0);
86 85 }
87 86 return (DEVFSADM_CONTINUE);
88 87 }
↓ open down ↓ |
43 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX