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 (the "License").
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 2016 Toomas Soome <tsoome@me.com>
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _SYS_CMLB_H
28 #define _SYS_CMLB_H
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #include <sys/dktp/fdisk.h>
35
36 /*
37 * structure used for getting phygeom and virtgeom from target driver
38 */
39 typedef struct cmlb_geom {
40 unsigned int g_ncyl;
41 unsigned short g_acyl;
42 unsigned short g_nhead;
43 unsigned short g_nsect;
44 unsigned short g_secsize;
45 diskaddr_t g_capacity;
46 unsigned short g_intrlv;
47 unsigned short g_rpm;
48 } cmlb_geom_t;
49
50
51 typedef struct tg_attribute {
52 int media_is_writable;
53 int media_is_solid_state;
54 int media_is_rotational;
312 * lowest 3 bits is taken as partition number
313 * the rest is instance number
314 * if _SUNOS_VTOC_16 is defined
315 * lowest 6 bits is taken as partition number
316 * the rest is instance number
317 *
318 *
319 * Return values:
320 * 0 Success
321 * ENXIO creating minor nodes failed.
322 * EINVAL invalid arg, unsupported tg_ops version
323 *
324 */
325 int
326 cmlb_attach(dev_info_t *devi, cmlb_tg_ops_t *tgopsp, int device_type,
327 boolean_t is_removable, boolean_t is_hotpluggable, char *node_type,
328 int alter_behavior, cmlb_handle_t cmlbhandle, void *tg_cookie);
329
330
331 /*
332 * cmlb_validate:
333 *
334 * Validates label.
335 *
336 * Arguments
337 * cmlbhandle cmlb handle associated with device.
338 *
339 * int flags
340 * currently used for verbosity control.
341 * CMLB_SILENT is the only current definition for it
342 * tg_cookie cookie from target driver to be passed back to target
343 * driver when we call back to it through tg_ops.
344 * Notes:
345 * If new label type is different from the current, adjust minor nodes
346 * accordingly.
347 *
348 * Return values:
349 * 0 success
350 * Note: having fdisk but no solaris partition is assumed
351 * success.
|
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 (the "License").
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 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 2016 Toomas Soome <tsoome@me.com>
29 * Copyright 2017 Nexenta Systems, Inc.
30 */
31
32 #ifndef _SYS_CMLB_H
33 #define _SYS_CMLB_H
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #include <sys/dktp/fdisk.h>
40 #include <sys/sunddi.h>
41
42 /*
43 * structure used for getting phygeom and virtgeom from target driver
44 */
45 typedef struct cmlb_geom {
46 unsigned int g_ncyl;
47 unsigned short g_acyl;
48 unsigned short g_nhead;
49 unsigned short g_nsect;
50 unsigned short g_secsize;
51 diskaddr_t g_capacity;
52 unsigned short g_intrlv;
53 unsigned short g_rpm;
54 } cmlb_geom_t;
55
56
57 typedef struct tg_attribute {
58 int media_is_writable;
59 int media_is_solid_state;
60 int media_is_rotational;
318 * lowest 3 bits is taken as partition number
319 * the rest is instance number
320 * if _SUNOS_VTOC_16 is defined
321 * lowest 6 bits is taken as partition number
322 * the rest is instance number
323 *
324 *
325 * Return values:
326 * 0 Success
327 * ENXIO creating minor nodes failed.
328 * EINVAL invalid arg, unsupported tg_ops version
329 *
330 */
331 int
332 cmlb_attach(dev_info_t *devi, cmlb_tg_ops_t *tgopsp, int device_type,
333 boolean_t is_removable, boolean_t is_hotpluggable, char *node_type,
334 int alter_behavior, cmlb_handle_t cmlbhandle, void *tg_cookie);
335
336
337 /*
338 * cmlb_workaround_off_by_one:
339 *
340 * Enables the workaround for the ancient off-by-one bug in sd.
341 * See comment preceding cmlb_attach().
342 *
343 * Arguments
344 * cmlbhandle cmlb handle associated with device.
345 *
346 *
347 * Notes:
348 * This should only be called by sd_unit_attach(), and only before
349 * validating the label for the first time.
350 *
351 * Return values:
352 * None.
353 */
354 void
355 cmlb_workaround_off_by_one(cmlb_handle_t cmlbhandle);
356
357 /*
358 * cmlb_validate:
359 *
360 * Validates label.
361 *
362 * Arguments
363 * cmlbhandle cmlb handle associated with device.
364 *
365 * int flags
366 * currently used for verbosity control.
367 * CMLB_SILENT is the only current definition for it
368 * tg_cookie cookie from target driver to be passed back to target
369 * driver when we call back to it through tg_ops.
370 * Notes:
371 * If new label type is different from the current, adjust minor nodes
372 * accordingly.
373 *
374 * Return values:
375 * 0 success
376 * Note: having fdisk but no solaris partition is assumed
377 * success.
|