Commit f3182024 authored by ml's avatar ml

Removed dependency to errh

parent 7ef66acd
......@@ -10,9 +10,9 @@
#include "pwr.h"
#include "co_dbs.h"
#include "co_dbs_msg.h"
#include "co_errno.h"
#include "co_platform.h"
#include "rt_errh.h"
......@@ -267,7 +267,7 @@ dbs_Reference(pwr_tStatus sts*, dbs_sEnv *ep, void *adrs)
pwr_tBoolean
dbs_Close(pwr_tStatus *sts, dbs_sEnv *ep)
{
*sts = 1; /** @todo msg code */
*sts = DBS__SUCCESS;
fclose(ep->f);
ep->f = NULL;
......@@ -281,19 +281,17 @@ dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename)
co_mFormat srcFormat, ownFormat;
PDR pdrs;
*sts = 1; /** @todo msg code */
*sts = DBS__SUCCESS;
memset(ep, 0, sizeof(*ep));
f = fopen(filename, "r");
if (f == NULL) {
*sts = errno_GetStatus();
errh_Error("Failed to open: %s, %m", filename, *sts);
return NULL;
}
if (fread(&ep->file, sizeof(ep->file), 1, f) == 0) {
*sts = errno_GetStatus();
errh_Error("Failed to read dbs_sFile from: %s, %m", filename, *sts);
fclose(f);
return NULL;
}
......@@ -308,9 +306,7 @@ dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename)
if (srcFormat.m != ownFormat.m) {
pdrmem_create(&pdrs, &ep->file, sizeof(ep->file), PDR_DECODE, srcFormat, ownFormat);
if (!pdr_dbs_sFile(&pdrs, &ep->file)) {
/** @todo Define error messages for co_dbs */
*sts = 2;
errh_Error("pdr_dbs_sFile failed for: %s", filename);
*sts = DBS__PDRFILE;
fclose(f);
return NULL;
}
......@@ -326,7 +322,7 @@ pwr_tBoolean
dbs_AlignedRead(pwr_tStatus *sts, void *buf, pwr_tUInt32 size, dbs_sEnv *ep)
{
int offset;
*sts = 1; /**@todo dbs errorcode */
*sts = DBS__SUCCESS;
if (fread(buf, size, 1, ep->f) == 0)
......
......@@ -6,7 +6,7 @@
%extern "C" {
%#endif
%
%/* co_dbs.h -- database snapshop files
%/* co_dbs.h -- database snapshot files
%
% PROVIEW/R
% Copyright (C) 2002 by Cell Network AB.
......@@ -104,46 +104,46 @@
%
%#if defined OS_VMS || defined OS_ELN
%
%# define dbs_cNameDirectory "pwrp_load:"
%# define dbs_cDirectory "pwrp_load:"
%# define dbs_cNamePlc "%splc_%s_%04d_%05d.exe"
%
%# define dbs_cNameBootList "pwrp_root:[common.db]pwrp_cnf_bootlist.dat"
%# define dbs_cNameVolumeList "pwrp_root:[common.db]pwrp_cnf_volumelist.dat"
%# define dbs_cNamePlcVersion "pwrp_root:[common.db]pwrp_cnf_plcvers_%s.dat"
%# define dbs_cNameDistribute "pwrp_root:[common.db]pwrp_cnf_distribute.dat"
%# define dbs_cNameSysObject "pwrp_root:[common.db]pwrp_cnf_sysobject.dat"
%# define dbs_cNameGblVolumeList "pwra_db:pwr_volumelist.dat"
%# define dbs_cNameRttCrr "rtt_crr_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttCrrObj "rtt_crro_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttCrrCode "rtt_crrc_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttPlc "rtt_plc_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameDirectory "pwrp_load:"
%# define dbs_cDirectory "pwrp_load:"
%# define dbs_cNamePlc "%splc_%s_%04d_%05d.exe"
%
%# define dbs_cNameBootList "pwrp_root:[common.db]pwrp_cnf_bootlist.dat"
%# define dbs_cNameVolumeList "pwrp_root:[common.db]pwrp_cnf_volumelist.dat"
%# define dbs_cNamePlcVersion "pwrp_root:[common.db]pwrp_cnf_plcvers_%s.dat"
%# define dbs_cNameDistribute "pwrp_root:[common.db]pwrp_cnf_distribute.dat"
%# define dbs_cNameSysObject "pwrp_root:[common.db]pwrp_cnf_sysobject.dat"
%# define dbs_cNameGblVolumeList "pwra_db:pwr_volumelist.dat"
%# define dbs_cNameRttCrr "rtt_crr_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttCrrObj "rtt_crro_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttCrrCode "rtt_crrc_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttPlc "rtt_plc_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%
%#elif defined OS_LYNX || defined OS_LINUX
%
%# define dbs_cNameDirectory "pwrp_load"
%# define dbs_cDirectory "$pwrp_load/"
%# define dbs_cNamePlc "%splc_%s_%04d_%05d"
%
%# define dbs_cNameBootList "$pwrp_root/common/db/pwrp_cnf_bootlist.dat"
%# define dbs_cNameVolumeList "$pwrp_root/common/db/pwrp_cnf_volumelist.dat"
%# define dbs_cNamePlcVersion "$pwrp_root/common/db/pwrp_cnf_plcvers_%s.dat"
%# define dbs_cNameDistribute "$pwrp_root/common/db/pwrp_cnf_distribute.dat"
%# define dbs_cNameSysObject "$pwrp_root/common/db/pwrp_cnf_sysobject.dat"
%# define dbs_cNameGblVolumeList "$pwra_db/pwr_volumelist.dat"
%# define dbs_cNameRttCrr "rtt_crr_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttCrrObj "rtt_crro_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttCrrCode "rtt_crrc_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttPlc "rtt_plc_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameDirectory "pwrp_load"
%# define dbs_cDirectory "$pwrp_load/"
%# define dbs_cNamePlc "%splc_%s_%04d_%05d"
%
%# define dbs_cNameBootList "$pwrp_root/common/db/pwrp_cnf_bootlist.dat"
%# define dbs_cNameVolumeList "$pwrp_root/common/db/pwrp_cnf_volumelist.dat"
%# define dbs_cNamePlcVersion "$pwrp_root/common/db/pwrp_cnf_plcvers_%s.dat"
%# define dbs_cNameDistribute "$pwrp_root/common/db/pwrp_cnf_distribute.dat"
%# define dbs_cNameSysObject "$pwrp_root/common/db/pwrp_cnf_sysobject.dat"
%# define dbs_cNameGblVolumeList "$pwra_db/pwr_volumelist.dat"
%# define dbs_cNameRttCrr "rtt_crr_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttCrrObj "rtt_crro_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttCrrCode "rtt_crrc_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define dbs_cNameRttPlc "rtt_plc_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%
%#endif
%
%#define dbs_cNameVolume "%s%s.dbs" /* <volume name>.dbs */
%#define dbs_cNameAlias "%spwrp_alias.dat"
%#define dbs_cNameAppl "%sld_appl_%s_%d.txt"
%#define dbs_cNameBoot "%sld_boot_%s_%04d.dat"
%#define dbs_cNameNode "%sld_node_%04d.dat"
%#define dbs_cNameRc "%sld_rc_%s_%04d.dat"
%#define dbs_cNameVolume "%s%s.dbs" /* <volume name>.dbs */
%#define dbs_cNameAlias "%spwrp_alias.dat"
%#define dbs_cNameAppl "%sld_appl_%s_%d.txt"
%#define dbs_cNameBoot "%sld_boot_%s_%04d.dat"
%#define dbs_cNameNode "%sld_node_%04d.dat"
%#define dbs_cNameRc "%sld_rc_%s_%04d.dat"
%
%/**
% * A database load file is organised in sections.
......
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