tape_link.c (7c478bd9) tape_link.c (45916cd2)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
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/*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident "%Z%%M% %I% %E% SMI"
28
29#include <devfsadm.h>
30#include <strings.h>
31#include <stdlib.h>
32#include <limits.h>
23 * Use is subject to license terms.
24 */
25
26#pragma ident "%Z%%M% %I% %E% SMI"
27
28#include <devfsadm.h>
29#include <strings.h>
30#include <stdlib.h>
31#include <limits.h>
32#include <bsm/devalloc.h>
33
33
34extern int system_labeled;
34
35static int tape_process(di_minor_t minor, di_node_t node);
36
37static devfsadm_create_t tape_cbt[] = {
38 { "tape", "ddi_byte:tape", NULL,
39 TYPE_EXACT, ILEVEL_0, tape_process
40 },
41};

--- 13 unchanged lines hidden (view full) ---

55/*
56 * This function is called for every tape minor node.
57 * Calls enumerate to assign a logical tape id, and then
58 * devfsadm_mklink to make the link.
59 */
60static int
61tape_process(di_minor_t minor, di_node_t node)
62{
35
36static int tape_process(di_minor_t minor, di_node_t node);
37
38static devfsadm_create_t tape_cbt[] = {
39 { "tape", "ddi_byte:tape", NULL,
40 TYPE_EXACT, ILEVEL_0, tape_process
41 },
42};

--- 13 unchanged lines hidden (view full) ---

56/*
57 * This function is called for every tape minor node.
58 * Calls enumerate to assign a logical tape id, and then
59 * devfsadm_mklink to make the link.
60 */
61static int
62tape_process(di_minor_t minor, di_node_t node)
63{
64 int flags = 0;
63 char l_path[PATH_MAX + 1];
64 char *buf;
65 char *mn;
66 char *devfspath;
67 devfsadm_enumerate_t rules[1] = {"rmt/([0-9]+)", 1, MATCH_ADDR};
68
69 mn = di_minor_name(minor);
70

--- 22 unchanged lines hidden (view full) ---

93 return (DEVFSADM_CONTINUE);
94 }
95
96 (void) strcpy(l_path, "rmt/");
97 (void) strcat(l_path, buf);
98 (void) strcat(l_path, mn);
99 free(buf);
100
65 char l_path[PATH_MAX + 1];
66 char *buf;
67 char *mn;
68 char *devfspath;
69 devfsadm_enumerate_t rules[1] = {"rmt/([0-9]+)", 1, MATCH_ADDR};
70
71 mn = di_minor_name(minor);
72

--- 22 unchanged lines hidden (view full) ---

95 return (DEVFSADM_CONTINUE);
96 }
97
98 (void) strcpy(l_path, "rmt/");
99 (void) strcat(l_path, buf);
100 (void) strcat(l_path, mn);
101 free(buf);
102
101 (void) devfsadm_mklink(l_path, node, minor, 0);
103 if (system_labeled)
104 flags = DA_ADD|DA_TAPE;
102
105
106 (void) devfsadm_mklink(l_path, node, minor, flags);
107
103 return (DEVFSADM_CONTINUE);
104}
108 return (DEVFSADM_CONTINUE);
109}