Print this page
4833 Remove volrmmount
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
   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 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.


  24  */
  25 
  26 /*
  27  * rmf_slice.c :
  28  *      This file contains the functions for parsing a slice file
  29  *      for rmformat.
  30  */
  31 
  32 #include <sys/types.h>
  33 #include <ctype.h>
  34 #include <sys/vtoc.h>
  35 #include <stdlib.h>
  36 #include <unistd.h>
  37 #include <string.h>
  38 #include <fcntl.h>
  39 #include <errno.h>
  40 #include <memory.h>
  41 #include <dirent.h>
  42 #include <sys/fcntl.h>
  43 #include <sys/param.h>


 866  *                                      partition.
 867  *                      If there are no solaris partitions, its an error, stop.
 868  */
 869 
 870 static int32_t
 871 check_vtoc_sanity(smedia_handle_t handle, int32_t fd, struct extvtoc *vt)
 872 {
 873 
 874         int32_t i, j;
 875         struct dk_geom dkg;
 876         int32_t num_backup = 0;
 877         diskaddr_t backup_size = 0;
 878         struct part_struct {
 879                 diskaddr_t start;
 880                 diskaddr_t end;
 881                 int32_t num;
 882         } part[NDKMAP];
 883         diskaddr_t min_val;
 884         int32_t min_slice, num_slices;
 885         diskaddr_t media_size;
 886         uint32_t cyl_size;
 887         int sparc_style = 0;    /* sparc_style handling ? */
 888         struct fdisk_info fdisk;
 889         int sol_part;
 890         int total_parts = 0;
 891 
 892 #ifdef sparc
 893         sparc_style = 1;
 894 #endif /* sparc */
 895 
 896         if ((med_info.sm_media_type == SM_FLOPPY) ||
 897             (med_info.sm_media_type == SM_PCMCIA_MEM) ||
 898             (med_info.sm_media_type == SM_PCMCIA_ATA) ||
 899             (med_info.sm_media_type == SM_SCSI_FLOPPY)) {
 900                 sparc_style = 1;
 901         }
 902 
 903         if (sparc_style) {
 904                 DPRINTF("sparc style true\n");
 905                 if (ioctl(fd, DKIOCGGEOM, &dkg) < 0) {
 906                         PERROR("DKIOCGGEOM Failed");


   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 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2014 Andrew Stormont.
  26  */
  27 
  28 /*
  29  * rmf_slice.c :
  30  *      This file contains the functions for parsing a slice file
  31  *      for rmformat.
  32  */
  33 
  34 #include <sys/types.h>
  35 #include <ctype.h>
  36 #include <sys/vtoc.h>
  37 #include <stdlib.h>
  38 #include <unistd.h>
  39 #include <string.h>
  40 #include <fcntl.h>
  41 #include <errno.h>
  42 #include <memory.h>
  43 #include <dirent.h>
  44 #include <sys/fcntl.h>
  45 #include <sys/param.h>


 868  *                                      partition.
 869  *                      If there are no solaris partitions, its an error, stop.
 870  */
 871 
 872 static int32_t
 873 check_vtoc_sanity(smedia_handle_t handle, int32_t fd, struct extvtoc *vt)
 874 {
 875 
 876         int32_t i, j;
 877         struct dk_geom dkg;
 878         int32_t num_backup = 0;
 879         diskaddr_t backup_size = 0;
 880         struct part_struct {
 881                 diskaddr_t start;
 882                 diskaddr_t end;
 883                 int32_t num;
 884         } part[NDKMAP];
 885         diskaddr_t min_val;
 886         int32_t min_slice, num_slices;
 887         diskaddr_t media_size;
 888         uint32_t cyl_size = 0;
 889         int sparc_style = 0;    /* sparc_style handling ? */
 890         struct fdisk_info fdisk;
 891         int sol_part;
 892         int total_parts = 0;
 893 
 894 #ifdef sparc
 895         sparc_style = 1;
 896 #endif /* sparc */
 897 
 898         if ((med_info.sm_media_type == SM_FLOPPY) ||
 899             (med_info.sm_media_type == SM_PCMCIA_MEM) ||
 900             (med_info.sm_media_type == SM_PCMCIA_ATA) ||
 901             (med_info.sm_media_type == SM_SCSI_FLOPPY)) {
 902                 sparc_style = 1;
 903         }
 904 
 905         if (sparc_style) {
 906                 DPRINTF("sparc style true\n");
 907                 if (ioctl(fd, DKIOCGGEOM, &dkg) < 0) {
 908                         PERROR("DKIOCGGEOM Failed");