rmf_menu.c (bbed02df) rmf_menu.c (342440ec)
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

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

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/*
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

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

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 2006 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
23 * Use is subject to license terms.
24 */
25
26#pragma ident "%Z%%M% %I% %E% SMI"
27
28/*
29 * rmf_menu.c :
30 * Command line options to rmformat are processed in this file.
31 */
32
33#include "rmformat.h"
34#include <sys/smedia.h>
35#include <priv_utils.h>

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

46extern int32_t c_flag;
47extern int32_t F_flag;
48extern int32_t R_flag;
49extern int32_t p_flag;
50extern int32_t l_flag;
51
52extern char *myname;
53extern char *slice_file;
26/*
27 * rmf_menu.c :
28 * Command line options to rmformat are processed in this file.
29 */
30
31#include "rmformat.h"
32#include <sys/smedia.h>
33#include <priv_utils.h>

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

44extern int32_t c_flag;
45extern int32_t F_flag;
46extern int32_t R_flag;
47extern int32_t p_flag;
48extern int32_t l_flag;
49
50extern char *myname;
51extern char *slice_file;
54extern uint32_t repair_blk_no;
52extern diskaddr_t repair_blk_no;
55extern int32_t quick_format;
56extern int32_t long_format;
57extern int32_t force_format;
58extern int32_t rw_protect_enable;
59extern int32_t rw_protect_disable;
60extern int32_t wp_enable_passwd;
61extern int32_t wp_disable_passwd;
62extern int32_t wp_enable;

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

70smmedium_prop_t med_info;
71int vol_running;
72
73extern void check_invalid_combinations();
74extern void check_invalid_combinations_again(int32_t);
75extern void process_options();
76extern void get_passwd(struct smwp_state *wp, int32_t confirm);
77extern int32_t valid_slice_file(smedia_handle_t, int32_t, char *,
53extern int32_t quick_format;
54extern int32_t long_format;
55extern int32_t force_format;
56extern int32_t rw_protect_enable;
57extern int32_t rw_protect_disable;
58extern int32_t wp_enable_passwd;
59extern int32_t wp_disable_passwd;
60extern int32_t wp_enable;

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

68smmedium_prop_t med_info;
69int vol_running;
70
71extern void check_invalid_combinations();
72extern void check_invalid_combinations_again(int32_t);
73extern void process_options();
74extern void get_passwd(struct smwp_state *wp, int32_t confirm);
75extern int32_t valid_slice_file(smedia_handle_t, int32_t, char *,
78 struct vtoc *);
76 struct extvtoc *);
79extern void trap_SIGINT();
80extern void release_SIGINT();
81extern int32_t verify(smedia_handle_t handle, int32_t fd,
77extern void trap_SIGINT();
78extern void release_SIGINT();
79extern int32_t verify(smedia_handle_t handle, int32_t fd,
82 uint32_t start_sector, uint32_t nblocks,
83 char *buf, int32_t flag, int32_t blocksize, int32_t no_raw_rw);
80 diskaddr_t start_sector, uint32_t nblocks,
81 char *buf, int32_t flag, int32_t blocksize, int32_t no_raw_rw);
84extern void my_perror(char *err_string);
85extern void write_default_label(smedia_handle_t, int32_t fd);
86extern int find_device(int defer, char *tmpstr);
87
88void overwrite_metadata(int32_t fd, smedia_handle_t handle);
89
90int32_t write_sunos_label(int32_t fd, int32_t media_type);
91

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

218 gettext("Get medium property failed \n"));
219 (void) smedia_release_handle(handle);
220 (void) close(fd);
221 exit(1);
222 }
223
224 DPRINTF1("media type %x\n", med_info.sm_media_type);
225 DPRINTF1("media block size %x\n", med_info.sm_blocksize);
82extern void my_perror(char *err_string);
83extern void write_default_label(smedia_handle_t, int32_t fd);
84extern int find_device(int defer, char *tmpstr);
85
86void overwrite_metadata(int32_t fd, smedia_handle_t handle);
87
88int32_t write_sunos_label(int32_t fd, int32_t media_type);
89

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

216 gettext("Get medium property failed \n"));
217 (void) smedia_release_handle(handle);
218 (void) close(fd);
219 exit(1);
220 }
221
222 DPRINTF1("media type %x\n", med_info.sm_media_type);
223 DPRINTF1("media block size %x\n", med_info.sm_blocksize);
226 DPRINTF1("media capacity %x\n", med_info.sm_capacity);
224 DPRINTF1("media capacity %u\n", (uint32_t)med_info.sm_capacity);
227 DPRINTF3("media cyl %d head %d sect %d\n",
228 med_info.sm_pcyl, med_info.sm_nhead, med_info.sm_nsect);
229 check_invalid_combinations_again(med_info.sm_media_type);
230
231 /*
232 * Special handling for pcmcia, sometimes open the file in
233 * read-write mode.
234 */

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

813
814static void
815process_c_flag(smedia_handle_t handle)
816{
817 char error_string[256];
818
819 if (smedia_reassign_block(handle, repair_blk_no) != 0) {
820 (void) snprintf(error_string, 255,
225 DPRINTF3("media cyl %d head %d sect %d\n",
226 med_info.sm_pcyl, med_info.sm_nhead, med_info.sm_nsect);
227 check_invalid_combinations_again(med_info.sm_media_type);
228
229 /*
230 * Special handling for pcmcia, sometimes open the file in
231 * read-write mode.
232 */

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

811
812static void
813process_c_flag(smedia_handle_t handle)
814{
815 char error_string[256];
816
817 if (smedia_reassign_block(handle, repair_blk_no) != 0) {
818 (void) snprintf(error_string, 255,
821 gettext("Could not repair block no %d"), repair_blk_no);
819 gettext("Could not repair block no %llu"), repair_blk_no);
822 PERROR(error_string);
823 return;
824 }
825}
826
827/*
828 * This routine handles the -V (verify) option.
829 * There can be devices without rw_read option. If the raw_read
830 * and raw_write are not supported by the interface, then read and
831 * write system calls are used. It is assumed that either both
832 * raw_read and raw_write are supported or both are unsupported.
833 */
834
835static void
836process_V_flag(smedia_handle_t handle, int32_t fd)
837{
838 int32_t ret;
820 PERROR(error_string);
821 return;
822 }
823}
824
825/*
826 * This routine handles the -V (verify) option.
827 * There can be devices without rw_read option. If the raw_read
828 * and raw_write are not supported by the interface, then read and
829 * write system calls are used. It is assumed that either both
830 * raw_read and raw_write are supported or both are unsupported.
831 */
832
833static void
834process_V_flag(smedia_handle_t handle, int32_t fd)
835{
836 int32_t ret;
839 uint32_t i, j;
837 uint32_t j;
838 diskaddr_t bn;
840 char *read_buf, *write_buf;
841 int32_t old_per = 0;
842 int32_t new_per;
843 int32_t no_raw_rw = 0;
844 int32_t verify_size;
839 char *read_buf, *write_buf;
840 int32_t old_per = 0;
841 int32_t new_per;
842 int32_t no_raw_rw = 0;
843 int32_t verify_size;
845 uint32_t capacity;
844 diskaddr_t capacity;
846 int32_t blocksize;
847
848 DPRINTF("ANALYSE MEDIA \n");
849
850 ret = smedia_get_medium_property(handle, &med_info);
851 if (ret == -1) {
852 DPRINTF("get_media_info failed\n");
853 return;
854 }
855
856 DPRINTF1("media_type %d\n", med_info.sm_media_type);
857 DPRINTF1("sector_size %d\n", med_info.sm_blocksize);
845 int32_t blocksize;
846
847 DPRINTF("ANALYSE MEDIA \n");
848
849 ret = smedia_get_medium_property(handle, &med_info);
850 if (ret == -1) {
851 DPRINTF("get_media_info failed\n");
852 return;
853 }
854
855 DPRINTF1("media_type %d\n", med_info.sm_media_type);
856 DPRINTF1("sector_size %d\n", med_info.sm_blocksize);
858 DPRINTF1("num_sectors %d\n", med_info.sm_capacity);
857 DPRINTF1("num_sectors %u\n", (uint32_t)med_info.sm_capacity);
859 DPRINTF1("nsect %d\n", med_info.sm_nsect);
860
861 blocksize = med_info.sm_blocksize;
862
858 DPRINTF1("nsect %d\n", med_info.sm_nsect);
859
860 blocksize = med_info.sm_blocksize;
861
863 capacity = med_info.sm_capacity;
862 capacity = (uint32_t)med_info.sm_capacity;
864 verify_size = (med_info.sm_nsect > 64) ? 64 : med_info.sm_nsect;
865 read_buf = (char *)malloc(blocksize * verify_size);
866 if (read_buf == NULL) {
867 DPRINTF("Could not allocate memory\n");
868 return;
869 }
870 write_buf = (char *)malloc(blocksize * verify_size);
871 if (write_buf == NULL) {
872 DPRINTF("Could not allocate memory\n");
873 free(read_buf);
874 return;
875 }
876
877 if (!verify_write) {
878 DPRINTF("Non-destructive verify \n");
863 verify_size = (med_info.sm_nsect > 64) ? 64 : med_info.sm_nsect;
864 read_buf = (char *)malloc(blocksize * verify_size);
865 if (read_buf == NULL) {
866 DPRINTF("Could not allocate memory\n");
867 return;
868 }
869 write_buf = (char *)malloc(blocksize * verify_size);
870 if (write_buf == NULL) {
871 DPRINTF("Could not allocate memory\n");
872 free(read_buf);
873 return;
874 }
875
876 if (!verify_write) {
877 DPRINTF("Non-destructive verify \n");
879 for (i = 0; i < med_info.sm_capacity; i += verify_size) {
880 new_per = (i * 80)/med_info.sm_capacity;
878 for (bn = 0; bn < (uint32_t)med_info.sm_capacity;
879 bn += verify_size) {
880 new_per = (bn * 80)/(uint32_t)med_info.sm_capacity;
881 if (new_per >= old_per) {
882 (void) printf(".");
883 (void) fflush(stdout);
884 old_per++;
885 }
881 if (new_per >= old_per) {
882 (void) printf(".");
883 (void) fflush(stdout);
884 old_per++;
885 }
886 DPRINTF2("Reading %d blks starting at %d\n",
887 verify_size, i);
888 ret = verify(handle, fd, i, verify_size, read_buf,
889 VERIFY_READ, blocksize, no_raw_rw);
886 DPRINTF2("Reading %d blks starting at %llu\n",
887 verify_size, bn);
888 ret = verify(handle, fd, bn, verify_size, read_buf,
889 VERIFY_READ, blocksize, no_raw_rw);
890 if ((ret == -1) && (errno == ENOTSUP)) {
891 no_raw_rw = 1;
890 if ((ret == -1) && (errno == ENOTSUP)) {
891 no_raw_rw = 1;
892 ret = verify(handle, fd, i, verify_size,
893 read_buf,
894 VERIFY_READ, blocksize, no_raw_rw);
895 capacity = med_info.sm_pcyl * med_info.sm_nhead
896 * med_info.sm_nsect;
892 ret = verify(handle, fd, bn, verify_size,
893 read_buf,
894 VERIFY_READ, blocksize, no_raw_rw);
895 capacity = (diskaddr_t)med_info.sm_pcyl *
896 med_info.sm_nhead * med_info.sm_nsect;
897 }
898
899 if (ret != 0) {
900 for (j = 0; j < verify_size; j++) {
897 }
898
899 if (ret != 0) {
900 for (j = 0; j < verify_size; j++) {
901 if ((i + j) >= capacity)
901 if ((bn + j) >= capacity)
902 return;
902 return;
903 DPRINTF2(
904 "Reading %d blks starting at %d\n",
905 1, i+j);
906 ret = verify(handle, fd, i + j, 1,
907 read_buf,
908 VERIFY_READ, blocksize,
909 no_raw_rw);
903 DPRINTF2(
904 "Reading %d blks starting "
905 "at %llu\n", 1, bn + j);
906 ret = verify(handle, fd, bn + j, 1,
907 read_buf,
908 VERIFY_READ, blocksize,
909 no_raw_rw);
910 if (ret == -1) {
910 if (ret == -1) {
911 (void) printf("Bad block %d\n",
912 i+j);
911 (void) printf(
912 "Bad block %llu\n",
913 bn + j);
913 }
914 }
915 }
916 }
917 } else {
918
919 DPRINTF("Destrutive verify \n");
914 }
915 }
916 }
917 }
918 } else {
919
920 DPRINTF("Destrutive verify \n");
920 for (i = 0; i < med_info.sm_capacity; i += verify_size) {
921 new_per = (i * 80)/med_info.sm_capacity;
921 for (bn = 0; bn < (uint32_t)med_info.sm_capacity;
922 bn += verify_size) {
923 new_per = (bn * 80)/(uint32_t)med_info.sm_capacity;
922 if (new_per >= old_per) {
923 (void) printf(".");
924
925 (void) fflush(stdout);
926 old_per++;
927 }
928
929 for (j = 0; j < blocksize * verify_size; j++) {
924 if (new_per >= old_per) {
925 (void) printf(".");
926
927 (void) fflush(stdout);
928 old_per++;
929 }
930
931 for (j = 0; j < blocksize * verify_size; j++) {
930 write_buf[j] = (i|j) & 0xFF;
932 write_buf[j] = (bn | j) & 0xFF;
931 }
933 }
932 DPRINTF2("Writing %d blks starting at %d\n",
933 verify_size, i);
934 ret = verify(handle, fd, i, verify_size, write_buf,
935 VERIFY_WRITE, blocksize, no_raw_rw);
934 DPRINTF2("Writing %d blks starting at %llu\n",
935 verify_size, bn);
936 ret = verify(handle, fd, bn, verify_size, write_buf,
937 VERIFY_WRITE, blocksize, no_raw_rw);
936
937 if (ret != 0) {
938 for (j = 0; j < verify_size; j++) {
938
939 if (ret != 0) {
940 for (j = 0; j < verify_size; j++) {
939 if ((i + j) >= capacity)
941 if ((bn + j) >= capacity)
940 break;
941 DPRINTF2(
942 break;
943 DPRINTF2(
942 "Writing %d blks starting at %d\n",
943 1, i+j);
944 ret = verify(handle, fd, i + j, 1,
945 write_buf,
946 VERIFY_WRITE, blocksize,
947 no_raw_rw);
944 "Writing %d blks starting "
945 "at %llu\n", 1, bn + j);
946 ret = verify(handle, fd, bn + j, 1,
947 write_buf,
948 VERIFY_WRITE, blocksize,
949 no_raw_rw);
948 if (ret == -1) {
950 if (ret == -1) {
949 (void) printf("Bad block %d\n",
950 i+j);
951 (void) printf(
952 "Bad block %llu\n", bn + j);
951 }
952 }
953 }
953 }
954 }
955 }
954 DPRINTF2("Read after write %d blks starting at %d\n",
955 verify_size, i);
956 ret = verify(handle, fd, i, verify_size,
957 read_buf, VERIFY_READ, blocksize, no_raw_rw);
956 DPRINTF2("Read after write %d blks starting at %llu\n",
957 verify_size, bn);
958 ret = verify(handle, fd, bn, verify_size,
959 read_buf, VERIFY_READ, blocksize, no_raw_rw);
958
959 if (ret != 0) {
960 for (j = 0; j < verify_size; j++) {
960
961 if (ret != 0) {
962 for (j = 0; j < verify_size; j++) {
961 if ((i + j) >= capacity)
963 if ((bn + j) >= capacity)
962 return;
963 DPRINTF2(
964 return;
965 DPRINTF2(
964 "Read after write %d blks starting at %d\n",
965 1, i+j);
966 ret = verify(handle, fd, i + j, 1,
967 read_buf, VERIFY_READ,
968 blocksize, no_raw_rw);
966 "Read after write %d blks "
967 "starting at %llu\n", 1, bn + j);
968 ret = verify(handle, fd, bn + j, 1,
969 read_buf, VERIFY_READ,
970 blocksize, no_raw_rw);
969 if (ret == -1) {
971 if (ret == -1) {
970 (void) printf("Bad block %d\n",
971 i+j);
972 (void) printf(
973 "Bad block %llu\n", bn + j);
972 }
973 }
974 }
975
976
977 }
978 }
979}
980
981static void
982process_s_flag(smedia_handle_t handle, int32_t fd)
983{
984 int32_t i, ret;
974 }
975 }
976 }
977
978
979 }
980 }
981}
982
983static void
984process_s_flag(smedia_handle_t handle, int32_t fd)
985{
986 int32_t i, ret;
985 struct vtoc v_toc, t_vtoc;
987 struct extvtoc v_toc, t_vtoc;
986 if (valid_slice_file(handle, fd, slice_file, &v_toc)) {
987 (void) smedia_release_handle(handle);
988 (void) close(fd);
989 exit(1);
990 }
991
992 (void) memset(&t_vtoc, 0, sizeof (t_vtoc));
993
994
995 t_vtoc.v_nparts = V_NUMPAR;
996 t_vtoc.v_sanity = VTOC_SANE;
997 t_vtoc.v_version = V_VERSION;
998 t_vtoc.v_sectorsz = DEV_BSIZE;
999
1000 /* Get existing Vtoc, don't bother if it fails. */
1001
1002 /* Turn on privileges. */
1003 (void) __priv_bracket(PRIV_ON);
1004
988 if (valid_slice_file(handle, fd, slice_file, &v_toc)) {
989 (void) smedia_release_handle(handle);
990 (void) close(fd);
991 exit(1);
992 }
993
994 (void) memset(&t_vtoc, 0, sizeof (t_vtoc));
995
996
997 t_vtoc.v_nparts = V_NUMPAR;
998 t_vtoc.v_sanity = VTOC_SANE;
999 t_vtoc.v_version = V_VERSION;
1000 t_vtoc.v_sectorsz = DEV_BSIZE;
1001
1002 /* Get existing Vtoc, don't bother if it fails. */
1003
1004 /* Turn on privileges. */
1005 (void) __priv_bracket(PRIV_ON);
1006
1005 (void) read_vtoc(fd, &t_vtoc);
1007 (void) read_extvtoc(fd, &t_vtoc);
1006
1007 /* Turn off privileges. */
1008 (void) __priv_bracket(PRIV_OFF);
1009
1010 for (i = 0; i < V_NUMPAR; i++) {
1011 t_vtoc.v_part[i].p_start = v_toc.v_part[i].p_start;
1012 t_vtoc.v_part[i].p_size = v_toc.v_part[i].p_size;
1013 t_vtoc.v_part[i].p_tag = v_toc.v_part[i].p_tag;
1014 t_vtoc.v_part[i].p_flag = v_toc.v_part[i].p_flag;
1015 }
1016
1017 errno = 0;
1018
1019
1020 /* Turn on privileges. */
1021 (void) __priv_bracket(PRIV_ON);
1022
1008
1009 /* Turn off privileges. */
1010 (void) __priv_bracket(PRIV_OFF);
1011
1012 for (i = 0; i < V_NUMPAR; i++) {
1013 t_vtoc.v_part[i].p_start = v_toc.v_part[i].p_start;
1014 t_vtoc.v_part[i].p_size = v_toc.v_part[i].p_size;
1015 t_vtoc.v_part[i].p_tag = v_toc.v_part[i].p_tag;
1016 t_vtoc.v_part[i].p_flag = v_toc.v_part[i].p_flag;
1017 }
1018
1019 errno = 0;
1020
1021
1022 /* Turn on privileges. */
1023 (void) __priv_bracket(PRIV_ON);
1024
1023 ret = write_vtoc(fd, &t_vtoc);
1025 ret = write_extvtoc(fd, &t_vtoc);
1024
1025 /* Turn off privileges. */
1026 (void) __priv_bracket(PRIV_OFF);
1027
1028 if (ret < 0) {
1029#ifdef sparc
1030 PERROR("write VTOC failed");
1031 DPRINTF1("Errno = %d\n", errno);

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

1112 * Please note that, this will fail if there is no valid vtoc is
1113 * there on the medium and the vtoc is not faked.
1114 */
1115
1116static void
1117process_b_flag(int32_t fd)
1118{
1119 int32_t ret, nparts;
1026
1027 /* Turn off privileges. */
1028 (void) __priv_bracket(PRIV_OFF);
1029
1030 if (ret < 0) {
1031#ifdef sparc
1032 PERROR("write VTOC failed");
1033 DPRINTF1("Errno = %d\n", errno);

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

1114 * Please note that, this will fail if there is no valid vtoc is
1115 * there on the medium and the vtoc is not faked.
1116 */
1117
1118static void
1119process_b_flag(int32_t fd)
1120{
1121 int32_t ret, nparts;
1120 struct vtoc v_toc;
1122 struct extvtoc v_toc;
1121 struct dk_gpt *vtoc64;
1122
1123 /* For EFI disks. */
1124 if (efi_type(fd)) {
1125 if (efi_alloc_and_read(fd, &vtoc64) < 0) {
1126 /*
1127 * If reading the vtoc failed, try to
1128 * auto-sense the disk configuration.

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

1153 return;
1154 }
1155
1156 /* Get existing Vtoc */
1157
1158 /* Turn on privileges. */
1159 (void) __priv_bracket(PRIV_ON);
1160
1123 struct dk_gpt *vtoc64;
1124
1125 /* For EFI disks. */
1126 if (efi_type(fd)) {
1127 if (efi_alloc_and_read(fd, &vtoc64) < 0) {
1128 /*
1129 * If reading the vtoc failed, try to
1130 * auto-sense the disk configuration.

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

1155 return;
1156 }
1157
1158 /* Get existing Vtoc */
1159
1160 /* Turn on privileges. */
1161 (void) __priv_bracket(PRIV_ON);
1162
1161 ret = read_vtoc(fd, &v_toc);
1163 ret = read_extvtoc(fd, &v_toc);
1162
1163 /* Turn off privileges */
1164 (void) __priv_bracket(PRIV_OFF);
1165
1166 if (ret < 0) {
1167#ifdef sparc
1168 PERROR("read VTOC failed");
1169 DPRINTF1("Errno = %d\n", errno);

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

1180 }
1181
1182 (void) strncpy(v_toc.v_volume, label, LEN_DKL_VVOL);
1183
1184
1185 /* Turn on the privileges. */
1186 (void) __priv_bracket(PRIV_ON);
1187
1164
1165 /* Turn off privileges */
1166 (void) __priv_bracket(PRIV_OFF);
1167
1168 if (ret < 0) {
1169#ifdef sparc
1170 PERROR("read VTOC failed");
1171 DPRINTF1("Errno = %d\n", errno);

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

1182 }
1183
1184 (void) strncpy(v_toc.v_volume, label, LEN_DKL_VVOL);
1185
1186
1187 /* Turn on the privileges. */
1188 (void) __priv_bracket(PRIV_ON);
1189
1188 ret = write_vtoc(fd, &v_toc);
1190 ret = write_extvtoc(fd, &v_toc);
1189
1190 /* Turn off the privileges. */
1191 (void) __priv_bracket(PRIV_OFF);
1192
1193 if (ret < 0) {
1194#ifdef sparc
1195 PERROR("write VTOC failed");
1196 DPRINTF1("Errno = %d\n", errno);
1197#else /* i386 */
1198 if (errno == EIO) {
1199 PERROR("No Solaris partition, eject & retry");
1200 DPRINTF1("Errno = %d\n", errno);
1201 } else {
1202 PERROR("write VTOC failed");
1203 DPRINTF1("Errno = %d\n", errno);
1204 }
1205#endif
1206 }
1207}
1191
1192 /* Turn off the privileges. */
1193 (void) __priv_bracket(PRIV_OFF);
1194
1195 if (ret < 0) {
1196#ifdef sparc
1197 PERROR("write VTOC failed");
1198 DPRINTF1("Errno = %d\n", errno);
1199#else /* i386 */
1200 if (errno == EIO) {
1201 PERROR("No Solaris partition, eject & retry");
1202 DPRINTF1("Errno = %d\n", errno);
1203 } else {
1204 PERROR("write VTOC failed");
1205 DPRINTF1("Errno = %d\n", errno);
1206 }
1207#endif
1208 }
1209}