1*18c2aff7Sartem /*************************************************************************** 2*18c2aff7Sartem * 3*18c2aff7Sartem * fsutils.c : filesystem utilities 4*18c2aff7Sartem * 5*18c2aff7Sartem * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 6*18c2aff7Sartem * Use is subject to license terms. 7*18c2aff7Sartem * 8*18c2aff7Sartem * Licensed under the Academic Free License version 2.1 9*18c2aff7Sartem * 10*18c2aff7Sartem **************************************************************************/ 11*18c2aff7Sartem 12*18c2aff7Sartem #pragma ident "%Z%%M% %I% %E% SMI" 13*18c2aff7Sartem 14*18c2aff7Sartem #ifdef HAVE_CONFIG_H 15*18c2aff7Sartem # include <config.h> 16*18c2aff7Sartem #endif 17*18c2aff7Sartem 18*18c2aff7Sartem #include <stdio.h> 19*18c2aff7Sartem #include <sys/types.h> 20*18c2aff7Sartem #include <sys/scsi/impl/uscsi.h> 21*18c2aff7Sartem #include <string.h> 22*18c2aff7Sartem #include <strings.h> 23*18c2aff7Sartem #include <ctype.h> 24*18c2aff7Sartem #include <unistd.h> 25*18c2aff7Sartem #include <stdlib.h> 26*18c2aff7Sartem #include <errno.h> 27*18c2aff7Sartem #include <fcntl.h> 28*18c2aff7Sartem #include <sys/dkio.h> 29*18c2aff7Sartem #include <libintl.h> 30*18c2aff7Sartem #include <sys/dktp/fdisk.h> 31*18c2aff7Sartem #include <sys/fs/pc_label.h> 32*18c2aff7Sartem 33*18c2aff7Sartem #include <libhal.h> 34*18c2aff7Sartem #include "fsutils.h" 35*18c2aff7Sartem 36*18c2aff7Sartem /* 37*18c2aff7Sartem * Separates dos notation device spec into device and drive number 38*18c2aff7Sartem */ 39*18c2aff7Sartem boolean_t 40*18c2aff7Sartem dos_to_dev(char *path, char **devpath, int *num) 41*18c2aff7Sartem { 42*18c2aff7Sartem char *p; 43*18c2aff7Sartem 44*18c2aff7Sartem if ((p = strrchr(path, ':')) == NULL) { 45*18c2aff7Sartem return (B_FALSE); 46*18c2aff7Sartem } 47