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 (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2012 Milan Jurik. All rights reserved.
24 * Copyright 2014 Toomas Soome <tsoome@me.com>
25 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 /*
29 * This file contains functions that implement the command menu commands.
30 */
31
32 #include "global.h"
33 #include <time.h>
34 #include <sys/time.h>
35 #include <sys/resource.h>
36 #include <sys/wait.h>
37 #include <strings.h>
38 #include <signal.h>
39 #include <stdlib.h>
40 #include <string.h>
41
42 #if defined(sparc)
43 #include <sys/hdio.h>
44 #endif /* defined(sparc) */
45
1604 "EFI partition and create a new\n"
1605 "Solaris partition before you can convert the "
1606 "label.\n");
1607 return (-1);
1608 #endif
1609 }
1610
1611 #if defined(_FIRMWARE_NEEDS_FDISK)
1612 if (!(((cur_disk->fdisk_part.systid != SUNIXOS) ||
1613 (cur_disk->fdisk_part.systid != SUNIXOS2)) &&
1614 (cur_disk->fdisk_part.numsect > 0))) {
1615 fmt_print("You must use fdisk to create a Solaris "
1616 "partition before you can convert the label.\n");
1617 return (-1);
1618 }
1619 #endif
1620
1621 (void) memset((char *)&label, 0, sizeof (struct dk_label));
1622
1623 (void) strcpy(x86_devname, cur_disk->disk_name);
1624 if (cur_ctype->ctype_ctype == DKC_DIRECT)
1625 dptr = auto_direct_get_geom_label(cur_file, &label);
1626 else
1627 dptr = auto_sense(cur_file, 1, &label);
1628 if (dptr == NULL) {
1629 fmt_print("Autoconfiguration failed.\n");
1630 return (-1);
1631 }
1632
1633 pcyl = label.dkl_pcyl;
1634 ncyl = label.dkl_ncyl;
1635 acyl = label.dkl_acyl;
1636 nhead = label.dkl_nhead;
1637 nsect = label.dkl_nsect;
1638
1639 if (delete_disk_type(cur_disk->disk_type) == 0) {
1640 cur_label = L_TYPE_SOLARIS;
1641 cur_disk->label_type = L_TYPE_SOLARIS;
1642 cur_disk->disk_type = dptr;
1643 cur_disk->disk_parts = dptr->dtype_plist;
1644 cur_dtype = dptr;
|
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 (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2012 Milan Jurik. All rights reserved.
24 * Copyright 2014 Toomas Soome <tsoome@me.com>
25 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
27 */
28
29 /*
30 * This file contains functions that implement the command menu commands.
31 */
32
33 #include "global.h"
34 #include <time.h>
35 #include <sys/time.h>
36 #include <sys/resource.h>
37 #include <sys/wait.h>
38 #include <strings.h>
39 #include <signal.h>
40 #include <stdlib.h>
41 #include <string.h>
42
43 #if defined(sparc)
44 #include <sys/hdio.h>
45 #endif /* defined(sparc) */
46
1605 "EFI partition and create a new\n"
1606 "Solaris partition before you can convert the "
1607 "label.\n");
1608 return (-1);
1609 #endif
1610 }
1611
1612 #if defined(_FIRMWARE_NEEDS_FDISK)
1613 if (!(((cur_disk->fdisk_part.systid != SUNIXOS) ||
1614 (cur_disk->fdisk_part.systid != SUNIXOS2)) &&
1615 (cur_disk->fdisk_part.numsect > 0))) {
1616 fmt_print("You must use fdisk to create a Solaris "
1617 "partition before you can convert the label.\n");
1618 return (-1);
1619 }
1620 #endif
1621
1622 (void) memset((char *)&label, 0, sizeof (struct dk_label));
1623
1624 (void) strcpy(x86_devname, cur_disk->disk_name);
1625 if (cur_ctype->ctype_ctype == DKC_DIRECT ||
1626 cur_ctype->ctype_ctype == DKC_BLKDEV)
1627 dptr = auto_direct_get_geom_label(cur_file, &label);
1628 else
1629 dptr = auto_sense(cur_file, 1, &label);
1630 if (dptr == NULL) {
1631 fmt_print("Autoconfiguration failed.\n");
1632 return (-1);
1633 }
1634
1635 pcyl = label.dkl_pcyl;
1636 ncyl = label.dkl_ncyl;
1637 acyl = label.dkl_acyl;
1638 nhead = label.dkl_nhead;
1639 nsect = label.dkl_nsect;
1640
1641 if (delete_disk_type(cur_disk->disk_type) == 0) {
1642 cur_label = L_TYPE_SOLARIS;
1643 cur_disk->label_type = L_TYPE_SOLARIS;
1644 cur_disk->disk_type = dptr;
1645 cur_disk->disk_parts = dptr->dtype_plist;
1646 cur_dtype = dptr;
|