On Mon, Jul 20, 2009 at 9:34 PM, Alexander Eremin<eremin at milax.org> wrote:
> Hi all,
> Is there are any way to set Solaris partition active without fdisk file?
> I know partition number - for example 2, so I try:
> ...
> prepare_fdisk_target ...
> uint8_t *pactive;
>
> pactive[1]=128;
>
> if
> (nvlist_add_uint8_array(target_attrs,
> ? ? ? ? ? ?TI_ATTR_FDISK_PART_ACTIVE, pactive, 2) != 0) {
> (void) fprintf(stderr, "Couldn't add TI_ATTR_FDISK_PART_ACTIVE to nvlist
> \n");
> return(-1);
> }
> ?and then call ? ti_create_target,etc.
>
>
> No errors after executing, but partition still is not active.
> I tested with test_ti, but it required fdisk file for work.
> Of course I can call "parted --script /dev/dsk/c2t0d0p0 ?set 2 boot"
> but I want to do this in C ;)
>
>
>
> --
>
> ::alhazredHi Alexander, all, so ... , in the past alone fdisk would have been used for it. So one would look there for the corresponding C-code. Now with gparted, is it not "C"? On OpenSolaris one can now reference libparted (cmds and functionality are split). http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libparted/common/libparted/disk.c 1128 /** 1129 * Set the state (\c 1 or \c 0) of a flag on a partition. 1130 * 1131 * Flags are disk label specific, although they have a global 1132 * "namespace": the flag PED_PARTITION_BOOT, for example, roughly means 1133 * "this" partition is bootable". But this means different things on different 1134 * disk labels (and may not be defined on some disk labels). For example, 1135 * on MS-DOS disk labels, there can only be one boot partition, and this 1136 * refers to the partition that will be booted from on startup. On PC98 1137 * disk labels, the user can choose from any bootable partition on startup. 1138 * 1139 * \note It is an error to call this on an unavailable flag -- use 1140 * ped_partition_is_flag_available() to determine which flags are available 1141 * for a given disk label. 1142 * 1143 * \throws PED_EXCEPTION_ERROR if the requested flag is not available for this 1144 * label. 1145 */ 1146 int 1147 ped_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) 1148 { 1149 PedDiskOps* ops; 1150 1151 PED_ASSERT (part != NULL, return 0); 1152 PED_ASSERT (part->disk != NULL, return 0); 1153 PED_ASSERT (ped_partition_is_active (part), return 0); 1154 1155 ops = part->disk->type->ops; 1156 PED_ASSERT (ops->partition_set_flag != NULL, return 0); 1157 PED_ASSERT (ops->partition_is_flag_available != NULL, return 0); 1158 1159 if (!ops->partition_is_flag_available (part, flag)) { 1160 ped_exception_throw ( 1161 PED_EXCEPTION_ERROR, 1162 PED_EXCEPTION_CANCEL, 1163 "The flag '%s' is not available for %s disk labels.", 1164 ped_partition_flag_get_name (flag), 1165 part->disk->type->name); 1166 return 0; 1167 } 1168 1169 return ops->partition_set_flag (part, flag, state); 1170 } 1171 1172 /** 1173 * Get the state (\c 1 or \c 0) of a flag on a partition. 1174 * 1175 * See ped_partition_set_flag() for conditions that must hold. 1176 * 1177 * \todo Where's the check for flag availability? 1178 */ 1179 int 1180 ped_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) 1181 { 1182 PED_ASSERT (part != NULL, return 0); 1183 PED_ASSERT (part->disk != NULL, return 0); 1184 PED_ASSERT (part->disk->type->ops->partition_get_flag != NULL, 1185 return 0); 1186 PED_ASSERT (ped_partition_is_active (part), return 0); 1187 1188 return part->disk->type->ops->partition_get_flag (part, flag); 1189 } 1190 Are you integrating the new curses based installer into MilaX, or something?? 'looking forward to it :) Delayed delays are delayed delays, deferrals are deferrals, neiter is necessarily THE END. And in my / Natamar's case not only "necessarily" ... -- Regards, Martin Bochnig
