Commit f87703b7 authored by claes's avatar claes

createloadfiles adapted to v4.0

parent 066c77f4
...@@ -231,7 +231,6 @@ static uted_t_command commands[ UTED_MAX_COMMANDS ] = { ...@@ -231,7 +231,6 @@ static uted_t_command commands[ UTED_MAX_COMMANDS ] = {
{ "Create LoadFiles", UTED_PROC_PWRPLC, 0, 1,{ { "Create LoadFiles", UTED_PROC_PWRPLC, 0, 1,{
{"Volume", 0, 0, 1, 0, UTED_QUAL_QUAL}, {"Volume", 0, 0, 1, 0, UTED_QUAL_QUAL},
{"All", 0, 0, 0, 1, UTED_QUAL_QUAL}, {"All", 0, 0, 0, 1, UTED_QUAL_QUAL},
{"Class" , 0, 0, 0, 1, UTED_QUAL_QUAL},
{"",}}}, {"",}}},
{ "Create BootFiles", UTED_PROC_PWRPLC, 0, 1,{ { "Create BootFiles", UTED_PROC_PWRPLC, 0, 1,{
{"NodeConfig", 0, 0, 1, 0, UTED_QUAL_QUAL}, {"NodeConfig", 0, 0, 1, 0, UTED_QUAL_QUAL},
......
...@@ -11025,8 +11025,7 @@ int utl_realloc ( ...@@ -11025,8 +11025,7 @@ int utl_realloc (
int utl_create_loadfiles ( int utl_create_loadfiles (
ldh_tSesContext ldhses, ldh_tSesContext ldhses,
char *volumes, char *volumes,
int allvolumes, int allvolumes
int classvolumes
) )
{ {
int sts; int sts;
...@@ -11042,7 +11041,6 @@ int utl_create_loadfiles ( ...@@ -11042,7 +11041,6 @@ int utl_create_loadfiles (
pwr_tVolumeId vol_id; pwr_tVolumeId vol_id;
pwr_tVolumeId current_volid; pwr_tVolumeId current_volid;
ldh_sVolumeInfo volinfo; ldh_sVolumeInfo volinfo;
int vtype;
/* Session has to be saved */ /* Session has to be saved */
sts = ldh_GetSessionInfo( ldhses, &info); sts = ldh_GetSessionInfo( ldhses, &info);
...@@ -11054,23 +11052,19 @@ int utl_create_loadfiles ( ...@@ -11054,23 +11052,19 @@ int utl_create_loadfiles (
if (EVEN(sts)) return sts; if (EVEN(sts)) return sts;
current_volid = volinfo.Volume; current_volid = volinfo.Volume;
if ( volumes != NULL) if ( volumes != NULL) {
{
/* Parse the volumestr */ /* Parse the volumestr */
nr = utl_parse( volumes, ", ", "", (char *)vol_str, nr = utl_parse( volumes, ", ", "", (char *)vol_str,
sizeof( vol_str) / sizeof( vol_str[0]), sizeof( vol_str[0])); sizeof( vol_str) / sizeof( vol_str[0]), sizeof( vol_str[0]));
if ( (nr == 0) || ( nr > UTL_INPUTLIST_MAX)) if ( (nr == 0) || ( nr > UTL_INPUTLIST_MAX)) {
{
status = FOE__PARSYNT; status = FOE__PARSYNT;
goto error_return; goto error_return;
} }
for ( i = 0; i < nr; i++) for ( i = 0; i < nr; i++) {
{
sts = ldh_VolumeNameToId( ldh_SessionToWB( ldhses), vol_str[i], sts = ldh_VolumeNameToId( ldh_SessionToWB( ldhses), vol_str[i],
&volume_vect[i]); &volume_vect[i]);
if ( EVEN(sts)) if ( EVEN(sts)) {
{
status = sts; status = sts;
goto error_return; goto error_return;
} }
...@@ -11080,23 +11074,19 @@ int utl_create_loadfiles ( ...@@ -11080,23 +11074,19 @@ int utl_create_loadfiles (
else else
volume_vect[0] = 0; volume_vect[0] = 0;
if ( allvolumes || classvolumes) if ( allvolumes) {
{ // Get all volumes that is not class, directory and wb volumes
/* Get all volumes that is not class and wb volumes */
i = 0; i = 0;
sts = ldh_GetVolumeList( ldh_SessionToWB( ldhses), &vol_id); sts = ldh_GetVolumeList( ldh_SessionToWB( ldhses), &vol_id);
while ( ODD(sts) ) while ( ODD(sts) ) {
{
sts = ldh_GetVolumeClass( ldh_SessionToWB( ldhses), vol_id, sts = ldh_GetVolumeClass( ldh_SessionToWB( ldhses), vol_id,
&vol_class); &vol_class);
if (EVEN(sts)) return sts; if (EVEN(sts)) return sts;
if ((vol_class == pwr_eClass_WorkBenchVolume) || if ( vol_class == pwr_eClass_WorkBenchVolume ||
(!classvolumes && vol_class == pwr_eClass_ClassVolume) || vol_class == pwr_eClass_ClassVolume ||
(!allvolumes && vol_class != pwr_eClass_ClassVolume)) vol_class == pwr_eClass_DirectoryVolume) {
{ sts = ldh_GetNextVolume( ldh_SessionToWB( ldhses), vol_id, &vol_id);
sts = ldh_GetNextVolume( ldh_SessionToWB( ldhses), vol_id,
&vol_id);
continue; continue;
} }
...@@ -11110,48 +11100,17 @@ int utl_create_loadfiles ( ...@@ -11110,48 +11100,17 @@ int utl_create_loadfiles (
volume_vect[i] = 0; volume_vect[i] = 0;
} }
if ( volumes == NULL && ! allvolumes && ! classvolumes) if ( volumes == NULL && !allvolumes) {
{
// Take the current volume // Take the current volume
volume_vect[0] = current_volid; volume_vect[0] = current_volid;
volume_vect[1] = 0; volume_vect[1] = 0;
} }
for ( vtype = 0; vtype < 3; vtype++) for ( i = 0; volume_vect[i] != 0; i++) {
{
for ( i = 0; volume_vect[i] != 0; i++)
{
sts = ldh_GetVolumeClass( ldh_SessionToWB( ldhses), volume_vect[i],
&vol_class);
if (EVEN(sts)) return sts;
if ( vtype == 0)
{
/* Take the systemclassvolume first */
if ( volume_vect[i] != 1)
continue;
}
else if ( vtype == 1)
{
/* Take the other classvolumes */
if ( volume_vect[i] == 1)
continue;
if ( vol_class != pwr_eClass_ClassVolume)
continue;
}
else if ( vtype == 2)
{
/* Take the other volumes */
if ( vol_class == pwr_eClass_ClassVolume)
continue;
}
other_volume_attached = 0; other_volume_attached = 0;
if ( current_volid != volume_vect[i]) if ( current_volid != volume_vect[i]) {
{
/* Attach this volume */ /* Attach this volume */
sts = ldh_AttachVolume( ldh_SessionToWB(ldhses), volume_vect[i], sts = ldh_AttachVolume( ldh_SessionToWB(ldhses), volume_vect[i], &volctx);
&volctx);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
other_volume_attached = 1; other_volume_attached = 1;
...@@ -11160,8 +11119,7 @@ int utl_create_loadfiles ( ...@@ -11160,8 +11119,7 @@ int utl_create_loadfiles (
ldh_eUtility_Pwr); ldh_eUtility_Pwr);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
} }
else else {
{
l_ldhses = ldhses; l_ldhses = ldhses;
/* Set session to ReadOnly */ /* Set session to ReadOnly */
sts = ldh_SetSession( ldhses, ldh_eAccess_ReadOnly); sts = ldh_SetSession( ldhses, ldh_eAccess_ReadOnly);
...@@ -11172,20 +11130,17 @@ int utl_create_loadfiles ( ...@@ -11172,20 +11130,17 @@ int utl_create_loadfiles (
if ( ODD(sts)) if ( ODD(sts))
status = ldh_CreateLoadFile( l_ldhses); status = ldh_CreateLoadFile( l_ldhses);
if ( other_volume_attached) if ( other_volume_attached) {
{
ldh_CloseSession( l_ldhses); ldh_CloseSession( l_ldhses);
ldh_DetachVolume( ldh_SessionToWB(ldhses), volctx); ldh_DetachVolume( ldh_SessionToWB(ldhses), volctx);
} }
else else {
{
/* Return to session access ReadWrite */ /* Return to session access ReadWrite */
sts = ldh_SetSession( ldhses, ldh_eAccess_ReadWrite); sts = ldh_SetSession( ldhses, ldh_eAccess_ReadWrite);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
} }
if ( EVEN(status)) return status; if ( EVEN(status)) return status;
} }
}
return FOE__SUCCESS; return FOE__SUCCESS;
error_return: error_return:
......
...@@ -437,8 +437,7 @@ int utl_realloc ( ...@@ -437,8 +437,7 @@ int utl_realloc (
int utl_create_loadfiles ( int utl_create_loadfiles (
ldh_tSesContext ldhses, ldh_tSesContext ldhses,
char *volumes, char *volumes,
int allvolumes, int allvolumes
int classvolumes
); );
int utl_create_bootfile ( int utl_create_bootfile (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment