Commit 214a53b4 authored by claes's avatar claes

ExternVolume in runtime implemented

parent f3f77392
/*
* Proview $Id: rt_neth.c,v 1.13 2006-03-20 06:42:21 claes Exp $
* Proview $Id: rt_neth.c,v 1.14 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -81,6 +81,7 @@ static void sendVolumesR (gdb_sNode*, net_sVolumes*, unsigned int);
static void volumes (qcom_sGet*);
static void volumesR (qcom_sGet*);
static void volumes7 (qcom_sGet*);
static void serverConnect (qcom_sGet*);
#if 0
static void linkEvent (pwr_tUInt32, net_eEvent);
static void sendIdAck (gdb_sNode*);
......@@ -121,6 +122,7 @@ static char *cMsg[net_eMsg_end] = {
"getCclassR",
"getGclass",
"getGclassR",
"serverConnect",
"net_eMsg_",
"volumes7"
};
......@@ -155,6 +157,7 @@ static void (*fromApplication[net_eMsg_end])(qcom_sGet *) = {
bugError, /* net_eMsg_GetCclassR will never reach neth */
cmvolsm_GetGclass,
bugError, /* net_eMsg_GetGclassR will never reach neth */
serverConnect, /* net_eMsg_serverConnect */
bugError, /* net_eMsg_ */
volumes7
};
......@@ -454,7 +457,7 @@ id (
cMsg[get->type.s], cdh_NodeIdToString(NULL, mp->hdr.nid, 0, 0));
}
if (get->sender.nid == gdbroot->my_qid.nid ) {
if (get->sender.nid == gdbroot->my_qid.nid && mp->hdr.nid == gdbroot->db->nid) {
errh_Error("New node using nid %s, conflicts with local node, '%s' ignored",
cdh_NodeIdToString(NULL, mp->hdr.nid, 0, 0),
cMsg[get->type.s]);
......@@ -513,6 +516,7 @@ id (
np->nod_oid = mp->node.nod_oid;
np->netver = mp->node.netver;
np->cclassSupport = cclassSupport;
np->handler = mp->node.handler;
} gdb_ScopeUnlock;
......@@ -655,6 +659,24 @@ linkDisconnect (
np->flags.b.active = 0;
}
gdb_sNode *snp;
pool_sQlink *nl;
// Disconnect any server on this node
for ( nl = pool_Qsucc(NULL, gdbroot->pool, &gdbroot->db->nod_lh);
nl != &gdbroot->db->nod_lh;
nl = pool_Qsucc(NULL, gdbroot->pool, nl)) {
snp = pool_Qitem(nl, gdb_sNode, nod_ll);
if ( snp != np && np->nid == gdb_SnidToQnid( snp->nid)) {
flushNode(snp);
snp->flags.b.connected = 0;
snp->flags.b.active = 0;
}
}
}
......@@ -834,8 +856,7 @@ sendFlush (
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0));
}
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
tgt = np->handler;
size = sizeof(msg);
......@@ -845,7 +866,7 @@ sendFlush (
msg.node.nod_oid = gdbroot->my_node->nod_oid;
msg.node.vol_oid = gdbroot->my_node->vol_oid;
net_Put(&sts, &tgt, &msg, net_eMsg_flush, 0, size);
net_Put(&sts, &tgt, &msg, net_eMsg_flush, 0, size, 0);
if (EVEN(sts))
errh_Error("Sending 'flush' to %s (%s)\n%m",
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0), sts);
......@@ -869,8 +890,12 @@ sendId (
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0));
}
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
if ( np->handler.nid)
tgt = np->handler;
else {
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
}
size = sizeof(msg);
......@@ -880,7 +905,7 @@ sendId (
msg.node.nod_oid = gdbroot->my_node->nod_oid;
msg.node.vol_oid = gdbroot->my_node->vol_oid;
net_Put(&sts, &tgt, &msg, net_eMsg_id, 0, size);
net_Put(&sts, &tgt, &msg, net_eMsg_id, 0, size, 0);
if (EVEN(sts))
errh_Error("Sending 'id' to %s (%s)\n%m",
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0), sts);
......@@ -983,15 +1008,14 @@ sendVolumes (
return;
}
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
tgt = np->handler;
if (!cclassSupport)
msgtype = net_eMsg_volumes7;
else
msgtype = net_eMsg_volumes;
if (!net_Put(&sts, &tgt, mp, msgtype, 0, size))
if (!net_Put(&sts, &tgt, mp, msgtype, 0, size, 0))
errh_Error("Sending 'volumes' to %s (%s)\n%m",
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0), sts);
......@@ -1036,10 +1060,9 @@ sendVolumesR (
mp->count = j;
mp->ctx = vmp->ctx;
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
tgt = np->handler;
if (!net_Put(&sts, &tgt, mp, net_eMsg_volumesR, 0, size)) {
if (!net_Put(&sts, &tgt, mp, net_eMsg_volumesR, 0, size, 0)) {
errh_Error("Sending 'volumesR' to %s (%s)\n%m",
np->name, cdh_NodeIdToString(NULL, (pwr_tNodeId)np->nid, 0, 0), sts);
}
......@@ -1062,6 +1085,9 @@ volumes (
gdb_sNode *np;
pwr_tUInt32 nid = get->sender.nid;
if ( vmp->count)
nid = vmp->g[0].nid;
gdb_ScopeLock {
np = hash_Search(&sts, gdbroot->nid_ht, &nid);
......@@ -1353,8 +1379,7 @@ sendIdAck (
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0));
}
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
tgt np->handler;
gdb_ScopeLock {
......@@ -1366,7 +1391,7 @@ sendIdAck (
} gdb_ScopeUnlock;
if (!net_Put(&sts, &tgt, &msg, net_eMsg_idAck, 0, sizeof(msg)))
if (!net_Put(&sts, &tgt, &msg, net_eMsg_idAck, 0, sizeof(msg), 0))
errh_Error("Sending 'idAck' to %s (%s)\n%m",
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0), sts);
......@@ -1388,12 +1413,65 @@ sendIdAck2 (
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0));
}
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
tgt = np->handler;
if (!net_Put(&sts, &tgt, &msg, net_eMsg_idAck2, 0, sizeof(msg)))
if (!net_Put(&sts, &tgt, &msg, net_eMsg_idAck2, 0, sizeof(msg), 0))
errh_Error("Sending 'idAck2' to %s (%s)\n%m",
np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0), sts);
}
#endif
static void
serverConnect (
qcom_sGet *get
)
{
net_sId *mp = get->data;
gdb_sNode *np;
pwr_tStatus sts;
int new_server;
int remote;
gdb_ScopeLock {
np = hash_Search(&sts, gdbroot->nid_ht, &mp->hdr.nid);
if (np == NULL) {
// New server
qcom_sNode node;
pwr_tNodeId nid;
new_server = 1;
for (nid = qcom_cNNid; qcom_NextNode(&sts, &node, nid); nid = node.nid) {
if ( node.nid == get->sender.nid) {
np = gdb_AddNode(&sts, mp->hdr.nid, gdb_mAdd__);
sprintf(np->name, "%s_s%d", node.name, gdb_SnidToSid(mp->hdr.nid));
np->os = node.os;
np->hw = node.hw;
co_SetFormat(&np->fm, node.bo, node.ft);
np->handler = get->reply;
np->flags.b.connected = 1;
// np->flags.b.active = 1;
break;
}
}
}
else {
new_server = 0;
np->flags.b.connected = 1;
// np->flags.b.active = 1;
}
} gdb_ScopeUnlock;
if (np == NULL)
return;
remote = (gdb_SnidToQnid( np->nid) != gdbroot->db->nid);
sendId(np);
if ( remote && !new_server) {
// nodeUp( np);
}
}
include $(pwre_dir_symbols)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_sroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(rt_msg_objs) \
$(pwr_obj)/rt_io_user.o\
-lpwr_rt -lpwr_co \
-lpwr_msg_dummy \
-lrpcsvc -lpthread -lm -lrt
endif
/*
* Proview $Id: rt_pvd_udb.cpp,v 1.1 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "pwr.h"
#include "pwr_class.h"
#include "rt_procom.h"
#include "co_provider.h"
#include "rt_gdh_msg.h"
#include "co_pvd_udb.h"
#include "wb_ldh.h"
int main()
{
co_pvd_udb provider( pvd_eEnv_Rt);
rt_procom procom( &provider,
errh_eAnix_appl20, // Application index
"rt_pvd_udb", // Process name
200, // Sid
ldh_cUserDatabaseVolume, // Vid _V254.254.254.246
"VolUserDatabase", // Volume name
0); // Global
procom.init();
procom.mainLoop();
}
/*
* Proview $Id: pwr.h,v 1.24 2006-05-21 22:30:49 lw Exp $
* Proview $Id: pwr.h,v 1.25 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -238,6 +238,7 @@ typedef unsigned int pwr_tDbId;
typedef pwr_tVolumeId pwr_tNid; //!< Node identity type.
typedef pwr_tNid pwr_tNodeId; //!< Node identity type.
typedef pwr_tNid pwr_tNodeIndex; //!< Node index type.
typedef unsigned int pwr_tSid; //!< Server identity type.
/*_*
@aref refid RefId
......
/*
* Proview $Id: pwr_class.h,v 1.22 2006-05-21 22:30:49 lw Exp $
* Proview $Id: pwr_class.h,v 1.23 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1025,10 +1025,11 @@ struct pwr_s_GraphPlcConnection
struct pwr_s_PlantHier
{
pwr_tString80 Description;
pwr_tObjid DefGraph;
pwr_tObjid DefTrend;
pwr_tAttrRef DefGraph;
pwr_tAttrRef DefTrend;
pwr_tString40 HelpTopic;
pwr_tURL DataSheet;
pwr_tURL CircuitDiagram;
pwr_tURL Photo;
};
......
/*
* Proview $Id: wb_pvd_file.h,v 1.2 2005-10-25 12:04:25 claes Exp $
* Proview $Id: co_procom.h,v 1.1 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -15,20 +15,25 @@
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
*/
#ifndef wb_pvd_file_h
#define wb_pvd_file_h
#ifndef co_procom_h
#define co_procom_h
#include "wb_provider.h"
#include <vector.h>
extern "C" {
#include "rt_errh.h"
}
#include "co_provider.h"
typedef enum {
pitem_mFlags_Deleted = 1 << 0,
pitem_mFlags_Created = 1 << 1
} pitem_mFlags;
procom_obj_mFlags_Deleted = 1 << 0,
procom_obj_mFlags_Created = 1 << 1
} procom_obj_mFlags;
class pitem {
public:
class procom_obj {
public:
int cid;
pwr_tOix oix;
pwr_tOix fthoix;
......@@ -44,11 +49,11 @@ public:
void *userdata;
unsigned int userdata_size;
pitem() : fthoix(0), bwsoix(0), fwsoix(0), fchoix(0), lchoix(0), flags(0),
procom_obj() : fthoix(0), bwsoix(0), fwsoix(0), fchoix(0), lchoix(0), flags(0),
body(0), body_size(0), userdata(0), userdata_size(0)
{ strcpy(lname,"");}
~pitem()
~procom_obj()
{
if ( body)
free(body);
......@@ -56,21 +61,21 @@ public:
free(userdata);
}
pitem( const pitem& x)
procom_obj( const procom_obj& x)
{
memcpy( this, &x, sizeof(pitem));
memcpy( this, &x, sizeof(procom_obj));
if ( x.body) {
body = malloc( body_size);
memcpy( body, x.body, body_size);
}
}
if ( x.userdata) {
userdata = malloc( userdata_size);
memcpy( userdata, x.userdata, userdata_size);
}
}
pitem& operator=(const pitem& x)
procom_obj& operator=(const procom_obj& x)
{
memcpy( this, &x, sizeof(pitem));
memcpy( this, &x, sizeof(procom_obj));
if ( body) {
body = calloc( 1, body_size);
memcpy( body, x.body, body_size);
......@@ -83,38 +88,24 @@ public:
}
};
class co_procom
{
class wb_pvd_file : public wb_provider {
public:
wb_pvd_file() : root(0), next_oix(1) {}
virtual void object( wb_procom *pcom);
virtual void objectOid( wb_procom *pcom, pwr_tOix oix);
virtual void objectName( wb_procom *pcom, char *name);
virtual void objectBody( wb_procom *pcom, pwr_tOix oix);
virtual void createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name);
virtual void moveObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix, int desttype);
virtual void copyObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix, int desttype,
char *name);
virtual void deleteObject( wb_procom *pcom, pwr_tOix oix);
virtual void deleteFamily( wb_procom *pcom, pwr_tOix oix);
virtual void renameObject( wb_procom *pcom, pwr_tOix oix, char *name);
virtual void writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size, char *buffer);
virtual void commit( wb_procom *pcom);
virtual void abort( wb_procom *pcom);
virtual char *longname( pwr_tOix oix);
virtual void delete_tree( pwr_tOix oix);
co_provider *m_provider;
virtual void save( pwr_tStatus *sts) {}
virtual void load( pwr_tStatus *sts) {}
virtual bool find( pwr_tOix fthoix, char *name, pwr_tOix *oix);
vector<pitem> m_list;
pwr_tOix root;
pwr_tOix next_oix;
co_procom( co_provider *p) : m_provider(p) {}
virtual ~co_procom() {}
virtual void provideObjects( pwr_tStatus, vector<procom_obj>&) {}
virtual void provideObject( pwr_tStatus sts, pwr_tOix oix, pwr_tOix fthoix, pwr_tOix bwsoix,
pwr_tOix fwsoix, pwr_tOix fchoix, pwr_tOix lchoix, pwr_tCid cid,
char *name, char *longname) {}
virtual void provideBody( pwr_tStatus sts, pwr_tOix oix, int size, void *body) {}
virtual void provideAttr( pwr_tStatus sts, pwr_tOix oix, int size, void *buff) {}
virtual void provideStatus( pwr_tStatus sts) {}
virtual void flushNodes() {};
};
#endif
/*
* Proview $Id: co_provider.h,v 1.1 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef co_provider_h
#define co_provider_h
class co_procom;
typedef enum {
pvd_eEnv_Wb,
pvd_eEnv_Rt
} pvd_eEnv;
class co_provider {
public:
pvd_eEnv m_env;
co_provider( pvd_eEnv env = pvd_eEnv_Wb) : m_env(env) {}
virtual ~co_provider() {}
virtual void object( co_procom *pcom) {}
virtual void objectOid( co_procom *pcom, pwr_tOix oix) {}
virtual void objectName( co_procom *pcom, char *name) {}
virtual void objectBody( co_procom *pcom, pwr_tOix oix) {}
virtual void createObject( co_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name) {}
virtual void moveObject( co_procom *pcom, pwr_tOix oix, pwr_tOix destoix,
int desttype) {}
virtual void copyObject( co_procom *pcom, pwr_tOix oix, pwr_tOix destoix, int desttype,
char *name) {}
virtual void deleteObject( co_procom *pcom, pwr_tOix oix) {}
virtual void deleteFamily( co_procom *pcom, pwr_tOix oix) {}
virtual void renameObject( co_procom *pcom, pwr_tOix oix, char *name) {}
virtual void writeAttribute( co_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size, char *buffer) {}
virtual void readAttribute( co_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size) {}
virtual void commit( co_procom *pcom) {}
virtual void abort( co_procom *pcom) {}
virtual void subAssociateBuffer( co_procom *pcom, void **buff, int oix, int offset,
int size, pwr_tSubid sid) {}
virtual void subDisassociateBuffer( co_procom *pcom, pwr_tSubid sid) {}
virtual void cyclic( co_procom *pcom) {}
};
#endif
/*
* Proview $Id: wb_pvd_file.cpp,v 1.3 2005-11-22 12:23:30 claes Exp $
* Proview $Id: co_pvd_file.cpp,v 1.1 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -26,9 +26,10 @@
#include "pwr_class.h"
#include "pwr_baseclasses.h"
#include "wb_vext.h"
#include "wb_pvd_file.h"
#include "co_pvd_file.h"
#include "wb_ldh.h"
#include "wb_ldh_msg.h"
#include "rt_gdh_msg.h"
extern "C" {
#include "co_cdh.h"
......@@ -37,7 +38,8 @@ extern "C" {
#define START_OIX 1000
void wb_pvd_file::object( wb_procom *pcom)
// Wb only
void co_pvd_file::object( co_procom *pcom)
{
if ( m_list.size() <= 1 || m_list[0].fchoix == 0) {
pcom->provideObject( LDH__NOSUCHOBJ,0,0,0,0,0,0,0,"","");
......@@ -46,33 +48,46 @@ void wb_pvd_file::object( wb_procom *pcom)
objectOid( pcom, m_list[0].fchoix);
}
void wb_pvd_file::objectOid( wb_procom *pcom, pwr_tOix oix)
void co_pvd_file::objectOid( co_procom *pcom, pwr_tOix oix)
{
if ( oix >= m_list.size() || oix <= 0) {
pcom->provideObject( LDH__NOSUCHOBJ,0,0,0,0,0,0,0,"","");
return;
if ( m_env == pvd_eEnv_Wb) {
if ( oix >= m_list.size() || oix <= 0) {
pcom->provideObject( LDH__NOSUCHOBJ,0,0,0,0,0,0,0,"","");
return;
}
pcom->provideObject( 1, oix, m_list[oix].fthoix, m_list[oix].bwsoix,
m_list[oix].fwsoix, m_list[oix].fchoix, m_list[oix].lchoix,
m_list[oix].cid, m_list[oix].name, longname(oix));
}
else {
if ( oix >= m_list.size() || oix < 0) {
pcom->provideStatus( GDH__NOSUCHOBJ);
return;
}
pcom->provideObjects( GDH__SUCCESS, m_list);
}
pcom->provideObject( 1, oix, m_list[oix].fthoix, m_list[oix].bwsoix,
m_list[oix].fwsoix, m_list[oix].fchoix, m_list[oix].lchoix,
m_list[oix].cid, m_list[oix].name, longname(oix));
}
void wb_pvd_file::objectName( wb_procom *pcom, char *name)
void co_pvd_file::objectName( co_procom *pcom, char *name)
{
for ( int i = 0; i < (int) m_list.size(); i++) {
if ( !m_list[i].flags & pitem_mFlags_Deleted) {
if ( !m_list[i].flags & procom_obj_mFlags_Deleted) {
if ( cdh_NoCaseStrcmp( name, longname(m_list[i].oix)) == 0) {
objectOid( pcom, i);
return;
}
}
}
pcom->provideObject( 0,0,0,0,0,0,0,0,"","");
if ( m_env == pvd_eEnv_Wb)
pcom->provideObject( 0,0,0,0,0,0,0,0,"","");
else
pcom->provideStatus( GDH__NOSUCHOBJ);
}
void wb_pvd_file::objectBody( wb_procom *pcom, pwr_tOix oix)
// Wb only
void co_pvd_file::objectBody( co_procom *pcom, pwr_tOix oix)
{
if ( oix >= m_list.size() || oix <= 0) {
pcom->provideBody( 0,0,0,0);
......@@ -85,10 +100,11 @@ void wb_pvd_file::objectBody( wb_procom *pcom, pwr_tOix oix)
pcom->provideBody( 0, 0, 0, 0);
}
void wb_pvd_file::createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
// Wb only
void co_pvd_file::createObject( co_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name)
{
pitem item;
procom_obj item;
if ( destoix >= m_list.size()) {
pcom->provideObject( LDH__NOSUCHOBJ,0,0,0,0,0,0,0,"","");
......@@ -200,14 +216,15 @@ void wb_pvd_file::createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
sprintf( item.name, "O%d", item.oix);
else
strcpy( item.name, name);
item.flags |= pitem_mFlags_Created;
item.flags |= procom_obj_mFlags_Created;
m_list.push_back(item);
pcom->provideObject( 1, item.oix, item.fthoix, item.bwsoix, item.fwsoix,
item.fchoix, item.lchoix, item.cid, item.name, longname(item.oix));
}
void wb_pvd_file::moveObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix,
// Wb only
void co_pvd_file::moveObject( co_procom *pcom, pwr_tOix oix, pwr_tOix destoix,
int desttype)
{
if ( destoix >= m_list.size() || destoix <= 0) {
......@@ -277,13 +294,14 @@ void wb_pvd_file::moveObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix,
pcom->provideStatus( 1);
}
void wb_pvd_file::deleteObject( wb_procom *pcom, pwr_tOix oix)
// Wb only
void co_pvd_file::deleteObject( co_procom *pcom, pwr_tOix oix)
{
if ( oix >= m_list.size() || oix <= 0) {
pcom->provideStatus( 0);
return;
}
m_list[oix].flags |= pitem_mFlags_Deleted;
m_list[oix].flags |= procom_obj_mFlags_Deleted;
// Remove from current position
if ( m_list[oix].fthoix && m_list[m_list[oix].fthoix].fchoix == oix)
......@@ -298,7 +316,8 @@ void wb_pvd_file::deleteObject( wb_procom *pcom, pwr_tOix oix)
pcom->provideStatus( 1);
}
void wb_pvd_file::copyObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix, int desttype,
// Wb only
void co_pvd_file::copyObject( co_procom *pcom, pwr_tOix oix, pwr_tOix destoix, int desttype,
char *name)
{
......@@ -306,7 +325,7 @@ void wb_pvd_file::copyObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix, i
pcom->provideObject( LDH__NOSUCHOBJ,0,0,0,0,0,0,0,"","");
return;
}
pitem item = m_list[oix];
procom_obj item = m_list[oix];
item.oix = next_oix++;
if ( strcmp( name, "") == 0)
......@@ -364,7 +383,8 @@ void wb_pvd_file::copyObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix, i
item.fchoix, item.lchoix, item.cid, item.name, longname(item.oix));
}
void wb_pvd_file::deleteFamily( wb_procom *pcom, pwr_tOix oix)
// Wb only
void co_pvd_file::deleteFamily( co_procom *pcom, pwr_tOix oix)
{
if ( oix >= m_list.size() || oix <= 0) {
pcom->provideStatus( 0);
......@@ -385,7 +405,8 @@ void wb_pvd_file::deleteFamily( wb_procom *pcom, pwr_tOix oix)
pcom->provideStatus( 1);
}
void wb_pvd_file::renameObject( wb_procom *pcom, pwr_tOix oix, char *name)
// Wb only
void co_pvd_file::renameObject( co_procom *pcom, pwr_tOix oix, char *name)
{
if ( oix >= m_list.size() || oix <= 0) {
pcom->provideStatus( 0);
......@@ -396,7 +417,7 @@ void wb_pvd_file::renameObject( wb_procom *pcom, pwr_tOix oix, char *name)
pcom->provideStatus( 1);
}
void wb_pvd_file::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset,
void co_pvd_file::writeAttribute( co_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size, char *buffer)
{
if ( oix >= m_list.size() || oix <= 0) {
......@@ -413,7 +434,36 @@ void wb_pvd_file::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int of
pcom->provideStatus( 1);
}
void wb_pvd_file::commit( wb_procom *pcom)
// Rt only
void co_pvd_file::readAttribute( co_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size)
{
if ( oix >= m_list.size() || oix <= 0) {
pcom->provideStatus( GDH__NOSUCHOBJ);
return;
}
if ( offset + size > m_list[oix].body_size) {
pcom->provideStatus( GDH__NOSUCHOBJ);
return;
}
void *p = (void *)((unsigned long)m_list[oix].body + (unsigned long)offset);
pcom->provideAttr( GDH__SUCCESS, oix, size, p);
}
// Rt only
void co_pvd_file::subAssociateBuffer( co_procom *pcom, void **buff, int oix, int offset,
int size, pwr_tSubid sid)
{
if ( oix < (int)m_list.size())
*buff = (char *)m_list[oix].body + offset;
else
*buff = 0;
}
// Wb only
void co_pvd_file::commit( co_procom *pcom)
{
pwr_tStatus sts;
......@@ -421,7 +471,8 @@ void wb_pvd_file::commit( wb_procom *pcom)
pcom->provideStatus( sts);
}
void wb_pvd_file::abort( wb_procom *pcom)
// Wb only
void co_pvd_file::abort( co_procom *pcom)
{
pwr_tStatus sts;
......@@ -431,9 +482,9 @@ void wb_pvd_file::abort( wb_procom *pcom)
pcom->provideStatus( sts);
}
void wb_pvd_file::delete_tree( pwr_tOix oix)
void co_pvd_file::delete_tree( pwr_tOix oix)
{
m_list[oix].flags = pitem_mFlags_Deleted;
m_list[oix].flags = procom_obj_mFlags_Deleted;
for ( pwr_tOix ix = m_list[oix].fchoix;
ix;
......@@ -441,7 +492,7 @@ void wb_pvd_file::delete_tree( pwr_tOix oix)
delete_tree( ix);
}
char *wb_pvd_file::longname( pwr_tOix oix)
char *co_pvd_file::longname( pwr_tOix oix)
{
if ( m_list[oix].fthoix == 0)
strcpy( m_list[oix].lname, m_list[oix].name);
......@@ -453,11 +504,11 @@ char *wb_pvd_file::longname( pwr_tOix oix)
return m_list[oix].lname;
}
bool wb_pvd_file::find( pwr_tOix fthoix, char *name, pwr_tOix *oix)
bool co_pvd_file::find( pwr_tOix fthoix, char *name, pwr_tOix *oix)
{
for ( int i = 0; i < (int) m_list.size(); i++) {
if ( !m_list[i].flags & pitem_mFlags_Deleted) {
if ( !m_list[i].flags & procom_obj_mFlags_Deleted) {
if ( m_list[i].fthoix == fthoix &&
cdh_NoCaseStrcmp( name, m_list[i].name) == 0) {
*oix = m_list[i].oix;
......
/*
* Proview $Id: co_pvd_file.h,v 1.1 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef co_pvd_file_h
#define co_pvd_file_h
#include "co_provider.h"
#include "co_procom.h"
class co_pvd_file : public co_provider {
public:
co_pvd_file( pvd_eEnv env = pvd_eEnv_Wb) : co_provider(env), root(0), next_oix(1) {}
virtual void object( co_procom *pcom);
virtual void objectOid( co_procom *pcom, pwr_tOix oix);
virtual void objectName( co_procom *pcom, char *name);
virtual void objectBody( co_procom *pcom, pwr_tOix oix);
virtual void createObject( co_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name);
virtual void moveObject( co_procom *pcom, pwr_tOix oix, pwr_tOix destoix, int desttype);
virtual void copyObject( co_procom *pcom, pwr_tOix oix, pwr_tOix destoix, int desttype,
char *name);
virtual void deleteObject( co_procom *pcom, pwr_tOix oix);
virtual void deleteFamily( co_procom *pcom, pwr_tOix oix);
virtual void renameObject( co_procom *pcom, pwr_tOix oix, char *name);
virtual void writeAttribute( co_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size, char *buffer);
virtual void readAttribute( co_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size);
virtual void subAssociateBuffer( co_procom *pcom, void **buff, int oix, int offset,
int size, pwr_tSubid sid);
virtual void commit( co_procom *pcom);
virtual void abort( co_procom *pcom);
virtual char *longname( pwr_tOix oix);
virtual void delete_tree( pwr_tOix oix);
virtual void save( pwr_tStatus *sts) {}
virtual void load( pwr_tStatus *rsts) {}
virtual bool find( pwr_tOix fthoix, char *name, pwr_tOix *oix);
vector<procom_obj> m_list;
pwr_tOix root;
pwr_tOix next_oix;
};
#endif
/*
* Proview $Id: wb_pvd_udb.cpp,v 1.2 2005-11-22 12:25:40 claes Exp $
* Proview $Id: co_pvd_udb.cpp,v 1.1 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -26,7 +26,7 @@
#include "pwr_class.h"
#include "pwr_baseclasses.h"
#include "wb_vext.h"
#include "wb_pvd_udb.h"
#include "co_pvd_udb.h"
#include "wb_ldh.h"
#include "wb_ldh_msg.h"
......@@ -35,12 +35,12 @@ extern "C" {
#include "co_dcli.h"
}
void wb_pvd_udb::save( pwr_tStatus *sts)
void co_pvd_udb::save( pwr_tStatus *sts)
{
gu->clear();
for ( int i = 1; i < (int)m_list.size(); i++) {
if ( m_list[i].flags & pitem_mFlags_Deleted)
if ( m_list[i].flags & procom_obj_mFlags_Deleted)
continue;
switch ( m_list[i].cid) {
......@@ -71,7 +71,7 @@ void wb_pvd_udb::save( pwr_tStatus *sts)
*sts = gu->save();
}
char *wb_pvd_udb::groupname( char *name)
char *co_pvd_udb::groupname( char *name)
{
static char str[200];
char *s, *t;
......@@ -86,7 +86,7 @@ char *wb_pvd_udb::groupname( char *name)
return str;
}
void wb_pvd_udb::load( pwr_tStatus *rsts)
void co_pvd_udb::load( pwr_tStatus *rsts)
{
char filename[256];
int sts;
......@@ -99,10 +99,20 @@ void wb_pvd_udb::load( pwr_tStatus *rsts)
gu->load( filename);
// Create Root object
pitem rootitem;
strcpy( rootitem.name, "UserDatabase");
rootitem.cid = pwr_eClass_PlantHier;
rootitem.oix = 0;
procom_obj rootitem;
if ( m_env == pvd_eEnv_Wb) {
strcpy( rootitem.name, "UserDatabase");
rootitem.cid = pwr_eClass_PlantHier;
rootitem.oix = 0;
}
else {
strcpy( rootitem.name, "VolUserDatabase");
rootitem.cid = pwr_eClass_ExternVolume;
rootitem.oix = 0;
rootitem.body_size = sizeof(pwr_sExternVolume);
rootitem.body = calloc( 1, rootitem.body_size);
}
m_list.push_back(rootitem);
menu_stack[menu_cnt] = rootitem.oix;
menu_cnt++;
......@@ -113,11 +123,22 @@ void wb_pvd_udb::load( pwr_tStatus *rsts)
systemgroup = systemgroup->next_system();
}
if ( m_env == pvd_eEnv_Rt) {
// Convert to Rt style
for ( int i = 1; i < (int)m_list.size(); i++) {
if ( m_list[i].bwsoix == 0)
m_list[i].bwsoix = m_list[m_list[i].fthoix].lchoix;
if ( m_list[i].fwsoix == 0)
m_list[i].fwsoix = m_list[m_list[i].fthoix].fchoix;
}
}
}
void wb_pvd_udb::load_systemgroup( SystemList *systemgroup)
void co_pvd_udb::load_systemgroup( SystemList *systemgroup)
{
pitem item;
procom_obj item;
pwr_sClass_SystemGroupReg *body;
char sname[120];
char *s;
......@@ -161,9 +182,9 @@ void wb_pvd_udb::load_systemgroup( SystemList *systemgroup)
menu_cnt--;
}
void wb_pvd_udb::load_user( UserList *user, SystemList *sg)
void co_pvd_udb::load_user( UserList *user, SystemList *sg)
{
pitem item;
procom_obj item;
pwr_sClass_UserReg *body;
item.oix = next_oix++;
......
/*
* Proview $Id: wb_pvd_udb.h,v 1.1 2005-09-20 13:14:28 claes Exp $
* Proview $Id: co_pvd_udb.h,v 1.1 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -19,20 +19,20 @@
// Provider for user database
#ifndef wb_pvd_udb_h
#define wb_pvd_udb_h
#ifndef co_pvd_udb_h
#define co_pvd_udb_h
#include "wb_pvd_file.h"
#include "co_pvd_file.h"
#include "co_user.h"
class wb_pvd_udb : public wb_pvd_file {
class co_pvd_udb : public co_pvd_file {
public:
wb_pvd_udb() : gu(0), menu_cnt(0)
co_pvd_udb( pvd_eEnv env = pvd_eEnv_Wb) : co_pvd_file(env), gu(0), menu_cnt(0)
{
pwr_tStatus sts;
load( &sts);
}
void load( pwr_tStatus *sts);
void load( pwr_tStatus *rsts);
void load_systemgroup( SystemList *systemgroup);
void load_user( UserList *user, SystemList *sg);
void save( pwr_tStatus *sts);
......
/*
* Proview $Id: rt_cmvolc.c,v 1.11 2006-07-27 10:27:01 claes Exp $
* Proview $Id: rt_cmvolc.c,v 1.12 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -230,7 +230,7 @@ cmvolc_GetCachedClass (
smp->time = time;
smp->aidx = nextIdx;
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_getCclassR, 0);
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_getCclassR, 0, 0);
if (rmp == NULL || EVEN(rmp->sts))
goto netError;
......@@ -394,7 +394,7 @@ cmvolc_GetNonExistingClass (
smp->cid = cid;
smp->aidx = nextIdx;
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_getGclassR, qdb_mGet_multipleGet);
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_getGclassR, qdb_mGet_multipleGet, 0);
if (rmp == NULL || EVEN(rmp->sts))
goto netError;
......
/*
* Proview $Id: rt_cmvolsm.c,v 1.3 2005-09-01 14:57:55 claes Exp $
* Proview $Id: rt_cmvolsm.c,v 1.4 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -141,7 +141,7 @@ cmvolsm_GetCclass (
else
rmp->sts = 1;
net_Reply(&lsts, get, &put);
net_Reply(&lsts, get, &put, 0);
}
......@@ -269,6 +269,6 @@ cmvolsm_GetGclass (
else
rmp->sts = 1;
net_Reply(&lsts, get, &put);
net_Reply(&lsts, get, &put, 0);
}
/*
* Proview $Id: rt_cvolc.c,v 1.7 2006-02-14 05:27:43 claes Exp $
* Proview $Id: rt_cvolc.c,v 1.8 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -70,12 +70,11 @@ fetch (
np = hash_Search(sts, gdbroot->nid_ht, &vp->g.nid);
if (np == NULL) return NULL;
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
tgt = np->handler;
gdb_Unlock;
rsp = net_Request(&lsts, &tgt, put, &get, net_eMsg_objectR, 0);
rsp = net_Request(&lsts, &tgt, put, &get, net_eMsg_objectR, 0, 0);
gdb_Lock;
......@@ -142,11 +141,10 @@ cvolc_GetObjectInfo (
smp = net_Alloc(sts, &put, sizeof(*smp), net_eMsg_getObjectInfo);
if (smp == NULL) return sts;
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
tgt = np->handler;
smp->aref = *rarp;
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_getObjectInfoR, 0);
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_getObjectInfoR, 0, 0);
if (rmp == NULL) {
return NULL;
......@@ -236,11 +234,10 @@ cvolc_GetObjectInfo (
smp = net_Alloc(sts, &put, sizeof(*smp), net_eMsg_getObjectInfo);
if (smp == NULL) return sts;
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
tgt = np->handler;
smp->aref = *arp;
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_getObjectInfoR, 0);
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_getObjectInfoR, 0, 0);
if (rmp == NULL) {
return NULL;
......@@ -404,8 +401,7 @@ cvolc_SetObjectInfo (
cmvolc_AssumeLocked(ccp);
}
tgt.nid = np->nid;
tgt.qix = net_cProcHandler;
tgt = np->handler;
size = MIN(arp->Size, size);
......@@ -441,7 +437,7 @@ cvolc_SetObjectInfo (
}
}
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_setObjectInfoR, 0);
rmp = net_Request(sts, &tgt, &put, NULL, net_eMsg_setObjectInfoR, 0, 0);
if (rmp == NULL) {
return NO;
......
/*
* Proview $Id: rt_cvolcm.c,v 1.2 2005-09-01 14:57:55 claes Exp $
* Proview $Id: rt_cvolcm.c,v 1.3 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -253,7 +253,7 @@ cvolcm_FlushNode (
pwr_tStatus lsts;
gdb_AssumeLocked;
pwr_Assert(np != gdbroot->my_node && np != gdbroot->no_node);
pwr_Assert( np != gdbroot->my_node && np != gdbroot->no_node);
for (
vl = pool_Qsucc(NULL, gdbroot->pool, &np->own_lh);
......@@ -456,3 +456,47 @@ cvolcm_TrimOld (
cvol_FreeObject(NULL, vp, op, vol_mLink_cacheTrim);
}
}
void
cvolcm_ExternVolumeFlush(
gdb_sNode *np
)
{
pool_sQlink *vl;
gdb_sVolume *vp;
pool_sQlink *ol;
gdb_sObject *op;
gdb_sMountServer *msp;
pwr_tStatus sts;
// Flush local node
gdb_AssumeLocked;
for (
vl = pool_Qsucc(NULL, gdbroot->pool, &np->own_lh);
vl != &np->own_lh;
vl = pool_Qsucc(NULL, gdbroot->pool, vl)
) {
vp = pool_Qitem(vl, gdb_sVolume, l.own_ll);
pwr_Assert(vp->l.flags.b.isCached);
if (vp->l.flags.b.isCached) {
for (
ol = pool_Qsucc(NULL, gdbroot->pool, &vp->l.obj_lh);
ol != &vp->l.obj_lh;
ol = pool_Qsucc(NULL, gdbroot->pool, &vp->l.obj_lh)
) {
op = pool_Qitem(ol, gdb_sObject, l.obj_ll);
if (op->l.flags.b.isMountServer) {
msp = (gdb_sMountServer *) hash_Search(&sts, gdbroot->ms_ht, &op->g.oid);
if (msp == NULL) errh_Bugcheck(sts, "mount server inconsitency");
msp->msor = pool_cNRef;
pool_Qremove(NULL, gdbroot->pool, &msp->nodms_ll);
/* Todo !!! Clear alarm and blocklevel in all mount clients. */
}
cvol_FlushObject(op);
}
}
}
}
/*
* Proview $Id: rt_cvolcm.h,v 1.2 2005-09-01 14:57:55 claes Exp $
* Proview $Id: rt_cvolcm.h,v 1.3 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -82,4 +82,8 @@ void
cvolcm_TrimOld (
);
void
cvolcm_ExternVolumeFlush(
gdb_sNode *np
);
#endif
/*
* Proview $Id: rt_cvols.c,v 1.3 2006-03-20 06:54:35 claes Exp $
* Proview $Id: rt_cvols.c,v 1.4 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -109,7 +109,7 @@ cvols_Notify (
tgt.nid = np->nid;
if (!net_Put(&lsts, &tgt, &nmp->msg, nmp->subtype, 0, nmp->size))
if (!net_Put(&lsts, &tgt, &nmp->msg, nmp->subtype, 0, nmp->size, 0))
errh_Warning("Notify: error %x sending subtype %s to node %s", lsts, "Notify", np->name);
}
......
/*
* Proview $Id: rt_cvolsm.c,v 1.4 2005-12-13 15:14:27 claes Exp $
* Proview $Id: rt_cvolsm.c,v 1.5 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -73,7 +73,7 @@ respondError (
rsp->oid = oid;
rsp->count = 0;
if (!net_Reply(&sts, get, &put))
if (!net_Reply(&sts, get, &put, 0))
errh_Bugcheck(sts, "net_Reply");
}
......@@ -166,7 +166,7 @@ respondObject (
rsp->oid = op->g.oid;
rsp->count = count + 1;
if (!net_Reply(&sts, get, &put))
if (!net_Reply(&sts, get, &put, 0))
errh_Bugcheck(sts, "net_Reply");
}
......@@ -276,7 +276,7 @@ cvolsm_GetObjectInfo (
rmp->sts = sts;
rmp->size = mp->aref.Size;
net_Reply(&sts, get, &put);
net_Reply(&sts, get, &put, 0);
}
/* Handle a NameToObject message. */
......@@ -404,5 +404,5 @@ cvolsm_SetObjectInfo (
rmp->aref = mp->aref;
rmp->sts = sts;
net_Reply(&sts, get, &put);
net_Reply(&sts, get, &put, 0);
}
/*
* Proview $Id: rt_dl.c,v 1.2 2005-09-01 14:57:55 claes Exp $
* Proview $Id: rt_dl.c,v 1.3 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -70,7 +70,7 @@ dl_Cancel (
pool_Qremove(NULL, gdbroot->pool, &dp->dl_ll);
gdbroot->db->dl_lc--;
op = pool_Address(NULL, gdbroot->pool, dp->or);
op = pool_Address(NULL, gdbroot->pool, dp->opr);
if (op == NULL) errh_Bugcheck(GDH__WEIRD, "direct link inconsitency");
gdb_UnlockObject(sts, op);
......@@ -138,7 +138,7 @@ dl_Create (
dp->user = gdbroot->my_pid;
dp->aref = *arp;
dp->or = pool_ItemReference(NULL, gdbroot->pool, ap->op);
dp->opr = pool_ItemReference(NULL, gdbroot->pool, ap->op);
/* Lock the object */
......
/*
* Proview $Id: rt_dl.h,v 1.2 2005-09-01 14:57:55 claes Exp $
* Proview $Id: rt_dl.h,v 1.3 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -39,7 +39,7 @@ typedef struct {
pwr_tSubid in subscription clients and servers */
pool_sQlink subc_htl; /* Subscription client hash table link. */
pool_sQlink dl_ll; /* Link to next/previous. */
pool_tRef or; /* Pool reference to object. */
pool_tRef opr; /* Pool reference to object. */
pid_t user; /* Who requested the direct link. */
pwr_sAttrRef aref; /* Object data referred. */
} dl_sLink;
......
/*
* Proview $Id: rt_gdb.h,v 1.12 2006-03-20 06:57:20 claes Exp $
* Proview $Id: rt_gdb.h,v 1.13 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -153,6 +153,9 @@
#define gdb_cMin_pool_isize 600000
#define gdb_cMin_rtdb_isize 600000
#define gdb_Snid( nid, sid) (nid | (sid << 24))
#define gdb_SnidToQnid( snid) (snid & 0xffffff)
#define gdb_SnidToSid( snid) (snid >> 24)
/* General database lock to keep consistency.
......@@ -961,6 +964,7 @@ typedef struct {
pwr_tUInt32 txmsg[net_eMsg_];
qcom_sQid handler; /**< Nethandler que */
} gdb_sNode;
......
/*
* Proview $Id: rt_gdh.c,v 1.27 2006-09-06 12:36:35 claes Exp $
* Proview $Id: rt_gdh.c,v 1.28 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -283,6 +283,43 @@ gdh_ClassAttrToAttrref (
return sts;
}
/**
* @brief Get the attribute name from a class and attrref.
*
* The objid of the attrref is not used.
* @return Status of the operation.
*/
pwr_tStatus
gdh_ClassAttrrefToAttr (
pwr_tClassId cid, /**< The class identity whose attribute we want to examin */
pwr_sAttrRef *arp, /**< Attribute description. */
char *name, /**< The returned name of the attribute */
int size /**< Max size of the returned name */
)
{
pwr_tStatus sts = GDH__SUCCESS;
mvol_sAttribute Attribute;
mvol_sAttribute *ap;
if (arp == NULL) return GDH__BADARG;
if (name == NULL) return GDH__BADARG;
memset(&Attribute, 0, sizeof(Attribute));
gdh_ScopeLock {
ap = mvol_ArefToAttribute( &sts, &Attribute, arp, cid);
} gdh_ScopeUnlock;
if (ap != NULL)
strncpy( name, ap->name, size);
return sts;
}
/**
* @brief Get the class identity corresponding to a class
......
/*
* Proview $Id: rt_gdh.h,v 1.14 2006-01-13 16:32:39 claes Exp $
* Proview $Id: rt_gdh.h,v 1.15 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -600,6 +600,14 @@ gdh_ClassAttrToAttrref (
pwr_sAttrRef *attributeReference
);
pwr_tStatus
gdh_ClassAttrrefToAttr (
pwr_tClassId classid,
pwr_sAttrRef *attributeReference,
char *nameBuffer,
int sizeOfNameBuffer
);
pwr_tStatus
gdh_GetAttributeCharAttrref (
pwr_sAttrRef *attributeReference,
......
/*
* Proview $Id: rt_net.c,v 1.8 2006-03-20 07:01:56 claes Exp $
* Proview $Id: rt_net.c,v 1.9 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -193,7 +193,8 @@ static tFuncXdr func_xdr[net_eMsg_] = {
(tFuncXdr)xdr_net_sGetCclass,
(tFuncXdr)xdr_net_sGetCclassR,
(tFuncXdr)xdr_net_sGetGclass,
(tFuncXdr)xdr_net_sGetGclassR
(tFuncXdr)xdr_net_sGetGclassR,
(tFuncXdr)xdr_net_sId /* Sever connect */
};
......@@ -238,10 +239,13 @@ ConvertPut (
XDR xdrs;
qdb_sNode *np;
tFuncXdr fXdr;
pwr_tNid nid;
if (put->type.b != net_cMsgClass)
pwr_Return(FALSE, sts, NET__XDRFAILED);
np = hash_Search(&lsts, &qdb->nid_ht, &qid->nid);
// Remove sid
nid = qid->nid & 0xffffff;
np = hash_Search(&lsts, &qdb->nid_ht, &nid);
if (np == NULL) pwr_Return(FALSE, sts, lsts);
/* This is a simple way to fix the net_sGvolume difference between
......@@ -605,14 +609,15 @@ pwr_tBoolean
net_Reply (
pwr_tStatus *status,
qcom_sGet *get,
qcom_sPut *put
qcom_sPut *put,
pwr_tSid sid
)
{
pwr_tBoolean ok;
pwr_dStatus (sts, status, NET__SUCCESS);
((net_sMessage *)put->data)->msn = ((net_sMessage *)get->data)->msn;
((net_sMessage *)put->data)->nid = gdbroot->db->nid;
((net_sMessage *)put->data)->nid = gdb_Snid(gdbroot->db->nid, sid);
NET_LOCK;
ok = Reply(sts, get, put);
......@@ -628,14 +633,15 @@ net_Put (
void *mp,
net_eMsg type,
unsigned int id,
int size
int size,
pwr_tSid sid
)
{
pwr_tBoolean ok;
pwr_dStatus (sts, status, NET__SUCCESS);
((net_sMessage *)mp)->msn = 0;
((net_sMessage *)mp)->nid = gdbroot->db->nid;
((net_sMessage *)mp)->nid = gdb_Snid( gdbroot->db->nid, sid);
NET_LOCK;
ok = Put(sts, tgt, mp, type, id, size);
......@@ -670,7 +676,8 @@ net_Request (
qcom_sPut *put,
qcom_sGet *get,
net_eMsg gtype,
pwr_tBitMask flags
pwr_tBitMask flags,
pwr_tSid sid
)
{
void *p;
......@@ -679,7 +686,7 @@ net_Request (
gdb_AssumeUnlocked;
((net_sMessage *)put->data)->msn = gdbroot->db->rqgen++;
((net_sMessage *)put->data)->nid = gdbroot->db->nid;
((net_sMessage *)put->data)->nid = gdb_Snid( gdbroot->db->nid, sid);
NET_LOCK;
p = Request(sts, tgt, put, get, gtype, flags);
......
#ifdef RPC_HDR
%/*
% * Proview $Id: rt_net.x,v 1.10 2006-03-20 07:01:56 claes Exp $
% * Proview $Id: rt_net.x,v 1.11 2006-09-14 14:16:07 claes Exp $
% * Copyright (C) 2005 SSAB Oxelsund AB.
% *
% * This program is free software; you can redistribute it and/or
......@@ -101,6 +101,8 @@ enum net_eMsg {
net_eMsg_getGclass, /* The whole class */
net_eMsg_getGclassR,
net_eMsg_serverConnect, /* New server */
net_eMsg_, /* Not a valid message */
net_eMsg_volumes7, /* Version 7. Internal only */
......@@ -1279,7 +1281,8 @@ struct net_sGetCclass {
%net_Reply (
% pwr_tStatus *sts,
% qcom_sGet *get,
% qcom_sPut *put
% qcom_sPut *put,
% pwr_tSid sid
%);
%
%pwr_tBoolean
......@@ -1289,7 +1292,8 @@ struct net_sGetCclass {
% void *mp,
% net_eMsg type,
% unsigned int id,
% int size
% int size,
% pwr_tSid sid
%);
%
%void *
......@@ -1306,7 +1310,8 @@ struct net_sGetCclass {
% qcom_sPut *put,
% qcom_sGet *get,
% net_eMsg gtype,
% pwr_tBitMask flags
% pwr_tBitMask flags,
% pwr_tSid sid
%);
%
%pwr_tBoolean
......
This diff is collapsed.
/*
* Proview $Id: rt_procom.h,v 1.1 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef rt_procom_h
#define rt_procom_h
#include "co_procom.h"
#include "rt_qcom.h"
class rt_procom : public co_procom {
public:
errh_eAnix m_anix;
char m_name[32];
pwr_tSid m_sid;
pwr_tVid m_vid;
char m_volumename[32];
int m_global;
qcom_sGet *m_getmsg;
rt_procom( co_provider *p, errh_eAnix anix, char *name, pwr_tSid sid, pwr_tVid vid,
char *volumename, int global);
void init();
void mainLoop();
virtual ~rt_procom() {}
virtual void provideObjects( pwr_tStatus, vector<procom_obj>&);
virtual void provideObject( pwr_tStatus sts, pwr_tOix oix, pwr_tOix fthoix, pwr_tOix bwsoix,
pwr_tOix fwsoix, pwr_tOix fchoix, pwr_tOix lchoix, pwr_tCid cid,
char *name, char *longname) {}
virtual void provideBody( pwr_tStatus sts, pwr_tOix oix, int size, void *body) {}
virtual void provideAttr( pwr_tStatus sts, pwr_tOix oix, int size, void *buff);
virtual void provideStatus( pwr_tStatus sts);
virtual void flushNodes();
};
#endif
/*
* Proview $Id: rt_sancm.c,v 1.3 2006-03-20 07:17:55 claes Exp $
* Proview $Id: rt_sancm.c,v 1.4 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -89,7 +89,7 @@ sancm_Add (
if (i >= count) {
ap->count = count;
gdb_Unlock;
net_Put(NULL, &tgt, ap, net_eMsg_sanAdd, 0, pwr_Offset(ap, sane[i]));
net_Put(NULL, &tgt, ap, net_eMsg_sanAdd, 0, pwr_Offset(ap, sane[i]), 0);
gdb_Lock;
i = 0;
}
......@@ -102,7 +102,7 @@ sancm_Add (
if (i > 0) {
ap->count = i;
gdb_Unlock;
net_Put(NULL, &tgt, ap, net_eMsg_sanAdd, 0, pwr_Offset(ap, sane[i]));
net_Put(NULL, &tgt, ap, net_eMsg_sanAdd, 0, pwr_Offset(ap, sane[i]), 0);
gdb_Lock;
}
......@@ -260,7 +260,7 @@ sancm_Remove (
if (i >= count) {
rp->count = count;
gdb_Unlock;
net_Put(NULL, &tgt, rp, net_eMsg_sanRemove, 0, pwr_Offset(rp, sid[i]));
net_Put(NULL, &tgt, rp, net_eMsg_sanRemove, 0, pwr_Offset(rp, sid[i]), 0);
gdb_Lock;
i = 0;
}
......@@ -273,7 +273,7 @@ sancm_Remove (
if (i > 0) {
rp->count = count;
gdb_Unlock;
net_Put(NULL, &tgt, rp, net_eMsg_sanRemove, 0, pwr_Offset(rp, sid[i]));
net_Put(NULL, &tgt, rp, net_eMsg_sanRemove, 0, pwr_Offset(rp, sid[i]), 0);
gdb_Lock;
}
......@@ -328,7 +328,7 @@ sancm_Update (
}
gdb_Unlock;
errh_Info("sancm_Update, sent removed count %d", rp->count);
net_Put(NULL, &tgt, rp, net_eMsg_sanRemove, 0, size);
net_Put(NULL, &tgt, rp, net_eMsg_sanRemove, 0, size, 0);
gdb_Lock;
free(rp);
}
......
/*
* Proview $Id: rt_sansm.c,v 1.3 2006-03-20 07:18:29 claes Exp $
* Proview $Id: rt_sansm.c,v 1.4 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -347,7 +347,7 @@ sansm_Update (
#if 0
errh_Info("sansm_Update, put %d to %s", up->count, np->name);
#endif
net_Put(&sts, &tgt, up, net_eMsg_sanUpdate, 0, pwr_Offset(up, data[i]));
net_Put(&sts, &tgt, up, net_eMsg_sanUpdate, 0, pwr_Offset(up, data[i]), 0);
gdb_Lock;
if (EVEN(sts)) return 0;
......
/*
* Proview $Id: rt_subc.c,v 1.5 2006-03-20 07:22:35 claes Exp $
* Proview $Id: rt_subc.c,v 1.6 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -448,10 +448,6 @@ subc_ActivateList (
sAdd *aep;
gdb_AssumeLocked;
tgt.qix = net_cProcHandler;
/* Test each client. If existing object, fill in nid field
and move the client to the appropriate nodes's subc_lh list. Turn
on timeouts. Put request in subadd message buffer.
......@@ -536,12 +532,12 @@ subc_ActivateList (
/* The message buffer is full and must be sent. */
tgt.nid = aep->nid;
tgt = np->handler;
pwr_Assert(tgt.nid != pwr_cNNodeId);
gdb_Unlock;
net_Put(NULL, &tgt, aep->msg, net_eMsg_subAdd, 0, pwr_Offset(aep->msg, spec[aep->msg->count]));
net_Put(NULL, &tgt, aep->msg, net_eMsg_subAdd, 0, pwr_Offset(aep->msg, spec[aep->msg->count]), 0);
gdb_Lock;
......@@ -586,7 +582,7 @@ subc_ActivateList (
gdb_Unlock;
net_Put(NULL, &tgt, rep->msg, net_eMsg_subRemove, 0, pwr_Offset(rep->msg, sid[rep->msg->count]));
net_Put(NULL, &tgt, rep->msg, net_eMsg_subRemove, 0, pwr_Offset(rep->msg, sid[rep->msg->count]), 0);
gdb_Lock;
......@@ -611,7 +607,7 @@ subc_ActivateList (
if (rep->msg->count > 0) {
tgt.nid = rep->nid;
pwr_Assert(tgt.nid != pwr_cNNodeId);
net_Put(NULL, &tgt, rep->msg, net_eMsg_subRemove, 0, pwr_Offset(rep->msg, sid[rep->msg->count]));
net_Put(NULL, &tgt, rep->msg, net_eMsg_subRemove, 0, pwr_Offset(rep->msg, sid[rep->msg->count]), 0);
}
free(rep->msg);
}
......@@ -622,7 +618,7 @@ subc_ActivateList (
if (aep->msg->count > 0) {
tgt.nid = aep->nid;
pwr_Assert(tgt.nid != pwr_cNNodeId);
net_Put(NULL, &tgt, aep->msg, net_eMsg_subAdd, 0, pwr_Offset(aep->msg, spec[aep->msg->count]));
net_Put(NULL, &tgt, aep->msg, net_eMsg_subAdd, 0, pwr_Offset(aep->msg, spec[aep->msg->count]), 0);
}
free(aep->msg);
}
......@@ -700,7 +696,7 @@ subc_CancelList (
gdb_Unlock;
net_Put(NULL, &tgt, rep->msg, net_eMsg_subRemove, 0, pwr_Offset(rep->msg, sid[rep->msg->count]));
net_Put(NULL, &tgt, rep->msg, net_eMsg_subRemove, 0, pwr_Offset(rep->msg, sid[rep->msg->count]), 0);
gdb_Lock;
......@@ -720,7 +716,7 @@ subc_CancelList (
if (rep->msg != NULL) {
if (rep->msg->count > 0) {
tgt.nid = rep->nid;
net_Put(NULL, &tgt, rep->msg, net_eMsg_subRemove, 0, pwr_Offset(rep->msg, sid[rep->msg->count]));
net_Put(NULL, &tgt, rep->msg, net_eMsg_subRemove, 0, pwr_Offset(rep->msg, sid[rep->msg->count]), 0);
}
free(rep->msg);
}
......
/*
* Proview $Id: rt_subcm.c,v 1.6 2006-03-20 07:21:22 claes Exp $
* Proview $Id: rt_subcm.c,v 1.7 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -259,10 +259,12 @@ subcm_Data (
gdbroot->db->subm_lc--;
pool_Free(NULL, gdbroot->pool, mp);
}
} gdb_ScopeUnlock;
if (rp != NULL) {
net_Put(NULL, &tgt, rp, net_eMsg_subRemove, 0, pwr_Offset(rp, sid[rp->count]));
if (rp != NULL) {
tgt = np->handler;
net_Put(NULL, &tgt, rp, net_eMsg_subRemove, 0, pwr_Offset(rp, sid[rp->count]), 0);
#if 0
errh_Info("Removed %d subscriptions", rp->count - 1);
#endif
......
/*
* Proview $Id: rt_subsm.c,v 1.7 2006-03-20 07:26:51 claes Exp $
* Proview $Id: rt_subsm.c,v 1.8 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -410,7 +410,7 @@ subsm_SendBuffer (
gdb_Unlock;
net_Put(&sts, &tgt, mp, net_eMsg_subData, bp->buf_id, size);
net_Put(&sts, &tgt, mp, net_eMsg_subData, bp->buf_id, size, 0);
gdb_Lock;
......
/*
* Proview $Id: rt_vol.h,v 1.4 2005-10-07 05:57:28 claes Exp $
* Proview $Id: rt_vol.h,v 1.5 2006-09-14 14:16:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -210,7 +210,7 @@ typedef union {
typedef union {
pwr_tBitMask m;
pwr_32Bits (
pwr_Bits( private , 1),
pwr_Bits( privat , 1),
pwr_Bits( native , 1),
pwr_Bits( fileCached , 1),
pwr_Bits( netCached , 1),
......
!
! Proview $Id: rs_remote_msg.msg,v 1.2 2005-09-01 14:58:00 claes Exp $
! Proview $Id: rs_remote_msg.msg,v 1.3 2006-09-14 14:16:07 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! This program is free software; you can redistribute it and/or
......@@ -62,3 +62,5 @@ udplinkdown <Remote UDP/IP link down '%s'> /info
udplinkup <Remote UDP/IP link up '%s'> /info
udpunknown <UDP message from unknown ip-address '%s' received> /info
udpweirdheader <UDP message with illegal header received> /info
disorder <Message disorder> /error
disabled <Transport disabled> /error
!
! Proview $Id: pwrs_c_externvolume.wb_load,v 1.2 2005-09-01 14:58:03 claes Exp $
! Proview $Id: pwrs_c_externvolume.wb_load,v 1.3 2006-09-14 14:16:07 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! This program is free software; you can redistribute it and/or
......@@ -26,7 +26,6 @@ SObject pwrs:Class
Object $ExternVolume $ClassDef pwr_eCix_ExternVolume
Body SysBody
Attr Flags |= pwr_mClassDef_System
Attr Flags |= pwr_mClassDef_DevOnly
Attr Flags |= pwr_mClassDef_TopObject
EndBody
Object SysBody $ObjBodyDef 1
......
......@@ -4,7 +4,7 @@ link_rule_mk := 1
ifeq ($(export_type),exp)
link = $(ldxx) $(explinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_provider.o \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
-lpwr_wb -lpwr_rt -lpwr_ge -lpwr_flow -lpwr_glow -lpwr_co \
......@@ -14,7 +14,7 @@ ifeq ($(export_type),exp)
else
link = $(ldxx) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_provider.o \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
-lpwr_wb -lpwr_rt -lpwr_ge -lpwr_flow -lpwr_glow -lpwr_co \
......
/*
* Proview $Id: wb_procom.cpp,v 1.1 2006-09-14 14:16:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
extern "C" {
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
}
extern "C" {
#include "pwr.h"
#include "pwr_class.h"
#include "co_cdh.h"
#include "wb_ldh_msg.h"
}
#include "wb_vext.h"
#include "wb_procom.h"
void wb_procom::put( vext_sAMsg *msg, int size, pwr_tStatus *sts)
{
*sts = LDH__SUCCESS;
msg->Any.message_type = 1;
switch ( m_type) {
case procom_eType_Ipc:
if ( msgsnd( m_msgsndid, (void *)msg, size, 0) == -1) {
*sts = LDH__MSGSND;
return;
}
case procom_eType_Local:
memcpy( &m_msg, msg, sizeof(m_msg));
break;
}
}
void wb_procom::receive( vext_sQMsg *msg, int size, pwr_tStatus *sts)
{
if ( !m_connected) {
key_t key;
int fd = -1;
fd = open( m_key, O_RDWR | O_CREAT, 0777);
if ( fd < 0) {
*sts = LDH__NOPROV;
return;
}
close( fd);
key = ftok( m_key, 0);
m_msgrcvid = msgget( (key_t)key, 0666 | IPC_CREAT);
if ( m_msgrcvid == -1) {
*sts = LDH__MSGGET;
return;
}
m_msgsndid = msgget( (key_t)(key + 1), 0666 | IPC_CREAT);
if ( m_msgsndid == -1) {
*sts = LDH__MSGGET;
return;
}
m_connected = 1;
}
if ( msgrcv( m_msgrcvid, (void *)msg, size, 0, 0) == -1) {
*sts = LDH__MSGRCV;
return;
}
*sts = LDH__SUCCESS;
}
void wb_procom::provideObject( pwr_tStatus sts, pwr_tOix oix, pwr_tOix fthoix, pwr_tOix bwsoix,
pwr_tOix fwsoix, pwr_tOix fchoix, pwr_tOix lchoix, pwr_tCid cid,
char *name, char *longname)
{
vext_sAMsg amsg;
pwr_tStatus asts;
amsg.Object.Type = vext_eMsgType_Object;
amsg.Object.Status = sts;
amsg.Object.oix = oix;
amsg.Object.fthoix = fthoix;
amsg.Object.bwsoix = bwsoix;
amsg.Object.fwsoix = fwsoix;
amsg.Object.fchoix = fchoix;
amsg.Object.lchoix = lchoix;
amsg.Object.cid = cid;
if ( ODD(sts)) {
strcpy( amsg.Object.name, name);
strcpy( amsg.Object.longname, longname);
}
put( &amsg, sizeof(amsg), &asts);
}
void wb_procom::provideBody( pwr_tStatus sts, pwr_tOix oix, int size, void *body)
{
vext_sAMsg amsg;
pwr_tStatus asts;
amsg.Object.Type = vext_eMsgType_ObjectBody;
amsg.ObjectBody.Status = sts;
amsg.ObjectBody.oix = oix;
if ( (int)sizeof(amsg.ObjectBody.body) < size)
size = sizeof(amsg.ObjectBody.body);
amsg.ObjectBody.size = size;
if ( ODD(sts))
memcpy( amsg.ObjectBody.body, body, size);
put( &amsg, sizeof(amsg), &asts);
}
void wb_procom::provideStatus( pwr_tStatus sts)
{
vext_sAMsg amsg;
pwr_tStatus asts;
amsg.Object.Type = vext_eMsgType_Status;
amsg.Any.Status = sts;
put( &amsg, sizeof(amsg), &asts);
}
void wb_procom::dispatch( vext_sQMsg *qmsg)
{
switch( qmsg->Any.Type) {
case vext_eMsgType_Object:
// printf( "Object\n");
m_provider->object( this);
break;
case vext_eMsgType_ObjectOid:
// printf( "ObjectOid %d\n", qmsg->Oid.Oix);
m_provider->objectOid( this, qmsg->Oid.Oix);
break;
case vext_eMsgType_ObjectBody:
// printf( "ObjectBody %d\n", qmsg->Oid.Oix);
m_provider->objectBody( this, qmsg->Oid.Oix);
break;
case vext_eMsgType_ObjectName:
// printf( "ObjectName %s\n", qmsg->ObjectName.Name);
m_provider->objectName( this, qmsg->ObjectName.Name);
break;
case vext_eMsgType_CreateObject:
// printf( "CreateObject %s\n", qmsg->CreateObject.Name);
m_provider->createObject( this, qmsg->CreateObject.DestOix, qmsg->CreateObject.DestType,
qmsg->CreateObject.Cid, qmsg->CreateObject.Name);
break;
case vext_eMsgType_MoveObject:
// printf( "MoveObject %d\n", qmsg->Oid.Oix);
m_provider->moveObject( this, qmsg->MoveObject.Oix, qmsg->MoveObject.DestOix,
qmsg->MoveObject.DestType);
break;
case vext_eMsgType_CopyObject:
// printf( "CopyObject %d\n", qmsg->Oid.Oix);
m_provider->copyObject( this, qmsg->CopyObject.Oix, qmsg->CopyObject.DestOix,
qmsg->CopyObject.DestType, qmsg->CopyObject.Name);
break;
case vext_eMsgType_DeleteObject:
// printf( "DeleteObject %d\n", qmsg->Oid.Oix);
m_provider->deleteObject( this, qmsg->DeleteObject.Oix);
break;
case vext_eMsgType_DeleteFamily:
// printf( "DeleteFamily %d\n", qmsg->Oid.Oix);
m_provider->deleteFamily( this, qmsg->DeleteFamily.Oix);
break;
case vext_eMsgType_RenameObject:
// printf( "RenameObject %d\n", qmsg->Oid.Oix);
m_provider->renameObject( this, qmsg->RenameObject.Oix, qmsg->RenameObject.Name);
break;
case vext_eMsgType_WriteAttr:
// printf( "WriteAttr %d\n", qmsg->Oid.Oix);
m_provider->writeAttribute( this, qmsg->WriteAttr.Oix, qmsg->WriteAttr.Offset,
qmsg->WriteAttr.Size, qmsg->WriteAttr.Buffer);
break;
case vext_eMsgType_Commit:
// printf( "Commit\n");
m_provider->commit( this);
break;
case vext_eMsgType_Abort:
// printf( "Abort\n");
m_provider->abort( this);
break;
default:
;
}
}
int wb_procom::lmsgsnd( int msgid, const void *msg_ptr, size_t msg_sz, int msgflg)
{
dispatch( (vext_sQMsg *)msg_ptr);
return 0;
}
int wb_procom::lmsgrcv( int msgid, const void *msg_ptr, size_t msg_sz, int msgtype,
int msgflg)
{
memcpy( (void *)msg_ptr, &m_msg, sizeof(m_msg));
return 0;
}
void wb_procom::mainloop()
{
vext_sQMsg qmsg;
pwr_tStatus sts;
for (;;) {
receive( &qmsg, sizeof(qmsg), &sts);
dispatch( &qmsg);
}
}
/*
* Proview $Id: wb_provider.h,v 1.4 2005-09-22 09:45:39 claes Exp $
* Proview $Id: wb_procom.h,v 1.1 2006-09-14 14:16:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -17,51 +17,26 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef wb_provider_h
#define wb_provider_h
#ifndef wb_procom_h
#define wb_procom_h
#include "co_procom.h"
#include "wb_vext.h"
class wb_procom;
class wb_provider {
public:
virtual ~wb_provider() {}
virtual void object( wb_procom *pcom) {}
virtual void objectOid( wb_procom *pcom, pwr_tOix oix) {}
virtual void objectName( wb_procom *pcom, char *name) {}
virtual void objectBody( wb_procom *pcom, pwr_tOix oix) {}
virtual void createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name) {}
virtual void moveObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix,
int desttype) {}
virtual void copyObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix, int desttype,
char *name) {}
virtual void deleteObject( wb_procom *pcom, pwr_tOix oix) {}
virtual void deleteFamily( wb_procom *pcom, pwr_tOix oix) {}
virtual void renameObject( wb_procom *pcom, pwr_tOix oix, char *name) {}
virtual void writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size, char *buffer) {}
virtual void commit( wb_procom *pcom) {}
virtual void abort( wb_procom *pcom) {}
};
class wb_procom
class wb_procom : public co_procom
{
char m_key[200];
int m_connected;
int m_msgsndid;
int m_msgrcvid;
procom_eType type;
wb_provider *m_provider;
vext_sAMsg m_msg;
procom_eType m_type;
public:
wb_procom( char *key, wb_provider *p, procom_eType type) :
m_connected(0), m_provider(p), m_type( type)
wb_procom( char *key, co_provider *p, procom_eType type) :
co_procom( p), m_connected(0), m_type( type)
{
strcpy( m_key, key);
}
......
/*
* Proview $Id: wb_pvd_gvl.cpp,v 1.3 2005-11-22 12:24:50 claes Exp $
* Proview $Id: wb_pvd_gvl.cpp,v 1.4 2006-09-14 14:16:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -97,7 +97,7 @@ void wb_pvd_gvl::load( pwr_tStatus *rsts)
*rsts = LDH__SUCCESS;
// Create Root object
pitem rootitem;
procom_obj rootitem;
strcpy( rootitem.name, "GlobalVolumeList");
rootitem.cid = pwr_eClass_Hier;
rootitem.oix = 0;
......@@ -133,7 +133,7 @@ void wb_pvd_gvl::load( pwr_tStatus *rsts)
continue;
}
pitem plantitem;
procom_obj plantitem;
strcpy( plantitem.name, line_item[1]);
plantitem.cid = pwr_eClass_Hier;
plantitem.oix = next_oix++;
......@@ -175,7 +175,7 @@ void wb_pvd_gvl::load( pwr_tStatus *rsts)
continue;
}
pitem volitem;
procom_obj volitem;
strcpy( volitem.name, line_item[0]);
volitem.body_size = sizeof(pwr_sClass_VolumeReg);
......
/*
* Proview $Id: wb_pvd_gvl.h,v 1.1 2005-09-20 13:14:28 claes Exp $
* Proview $Id: wb_pvd_gvl.h,v 1.2 2006-09-14 14:16:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -20,9 +20,9 @@
#ifndef wb_pvd_gvl_h
#define wb_pvd_gvl_h
#include "wb_pvd_file.h"
#include "co_pvd_file.h"
class wb_pvd_gvl : public wb_pvd_file {
class wb_pvd_gvl : public co_pvd_file {
public:
wb_pvd_gvl()
{
......
/*
* Proview $Id: wb_pvd_pl.cpp,v 1.5 2005-11-22 12:25:12 claes Exp $
* Proview $Id: wb_pvd_pl.cpp,v 1.6 2006-09-14 14:16:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -79,7 +79,7 @@ static char *pwrp_status_to_string( int value)
return str;
}
void wb_pvd_pl::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset,
void wb_pvd_pl::writeAttribute( co_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size, char *buffer)
{
if ( oix >= m_list.size() || oix <= 0) {
......@@ -103,15 +103,15 @@ void wb_pvd_pl::writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offs
default: ;
}
wb_pvd_file::writeAttribute( pcom, oix, offset, size, buffer);
co_pvd_file::writeAttribute( pcom, oix, offset, size, buffer);
}
void wb_pvd_pl::createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
void wb_pvd_pl::createObject( co_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name)
{
pwr_tOix oix = next_oix;
wb_pvd_file::createObject( pcom, destoix, desttype, cid, name);
co_pvd_file::createObject( pcom, destoix, desttype, cid, name);
switch ( cid) {
case pwr_cClass_ProjectReg: {
......@@ -188,10 +188,10 @@ bool wb_pvd_pl::check_list( pwr_tStatus *sts)
oid.oix = m_list[i].oix;
oid.vid = ldh_cProjectListVolume;
if ( m_list[i].flags & pitem_mFlags_Deleted &&
!(m_list[i].flags & pitem_mFlags_Created)) {
if ( m_list[i].flags & procom_obj_mFlags_Deleted &&
!(m_list[i].flags & procom_obj_mFlags_Created)) {
}
else if ( !(m_list[i].flags & pitem_mFlags_Deleted)) {
else if ( !(m_list[i].flags & procom_obj_mFlags_Deleted)) {
if ( strcmp( body->Path, "") == 0) {
sprintf( msg, "Path is missing, in object %s", longname(m_list[i].oix));
......@@ -217,15 +217,15 @@ bool wb_pvd_pl::check_list( pwr_tStatus *sts)
oid.oix = m_list[i].oix;
oid.vid = ldh_cProjectListVolume;
if ( m_list[i].flags & pitem_mFlags_Deleted &&
!(m_list[i].flags & pitem_mFlags_Created)) {
if ( m_list[i].flags & procom_obj_mFlags_Deleted &&
!(m_list[i].flags & procom_obj_mFlags_Created)) {
// Project deleted
sprintf( msg, "delete project %s with file tree and databases\n", body->Project);
if ( strlen(text) + strlen(msg) < sizeof(text))
strcat( text, msg);
actions_found++;
}
else if ( !(m_list[i].flags & pitem_mFlags_Deleted)) {
else if ( !(m_list[i].flags & procom_obj_mFlags_Deleted)) {
if ( strcmp( body->Project, "") == 0) {
sprintf( msg, "Project is missing, in object %s", longname(m_list[i].oix));
......@@ -246,7 +246,7 @@ bool wb_pvd_pl::check_list( pwr_tStatus *sts)
MsgWindow::message('E', msg, msgw_ePop_No, oid);
error_cnt++;
}
if ( m_list[i].flags & pitem_mFlags_Created) {
if ( m_list[i].flags & procom_obj_mFlags_Created) {
if ( strcmp( body->CopyFrom, "") == 0) {
// Create project
// Check destination path
......@@ -346,8 +346,8 @@ void wb_pvd_pl::process_list( pwr_tStatus *sts)
case pwr_cClass_ProjectReg: {
pwr_sClass_ProjectReg *body = (pwr_sClass_ProjectReg *)m_list[i].body;
if ( m_list[i].flags & pitem_mFlags_Deleted &&
!(m_list[i].flags & pitem_mFlags_Created)) {
if ( m_list[i].flags & procom_obj_mFlags_Deleted &&
!(m_list[i].flags & procom_obj_mFlags_Created)) {
printf( "Project deleted %s\n", longname(i));
sprintf( cmd, "pwrp_env.sh delete project %s noconfirm",
......@@ -360,8 +360,8 @@ void wb_pvd_pl::process_list( pwr_tStatus *sts)
return;
}
}
else if ( m_list[i].flags & pitem_mFlags_Created &&
!(m_list[i].flags & pitem_mFlags_Deleted)) {
else if ( m_list[i].flags & procom_obj_mFlags_Created &&
!(m_list[i].flags & procom_obj_mFlags_Deleted)) {
if ( strcmp( body->CopyFrom, "") == 0) {
printf( "Project created %s\n", longname(i));
......@@ -389,7 +389,7 @@ void wb_pvd_pl::process_list( pwr_tStatus *sts)
}
}
}
else if ( !(m_list[i].flags & pitem_mFlags_Deleted)) {
else if ( !(m_list[i].flags & procom_obj_mFlags_Deleted)) {
pwr_sClass_ProjectReg *body = (pwr_sClass_ProjectReg *)m_list[i].body;
pwr_sClass_ProjectReg *origbody = (pwr_sClass_ProjectReg *)m_list[i].userdata;
......@@ -439,14 +439,14 @@ void wb_pvd_pl::save_list( pwr_tStatus *sts)
// Disable deletet objects
for ( int i = 0; i < (int) m_list.size(); i++) {
if ( m_list[i].flags & pitem_mFlags_Deleted)
if ( m_list[i].flags & procom_obj_mFlags_Deleted)
m_list[i].flags |= pl_mFlags_Disabled;
}
}
void wb_pvd_pl::save_item( pwr_tOix oix, ofstream& of)
{
if ( m_list[oix].flags & pitem_mFlags_Deleted)
if ( m_list[oix].flags & procom_obj_mFlags_Deleted)
return;
m_list[oix].flags = 0;
......@@ -507,7 +507,7 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
// Create Root object
pitem rootitem;
procom_obj rootitem;
strcpy( rootitem.name, "ProjectList");
rootitem.cid = pwr_eClass_Hier;
rootitem.oix = 0;
......@@ -516,7 +516,7 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
menu_cnt++;
// Create Root for BaseReg objects
pitem brootitem;
procom_obj brootitem;
strcpy( brootitem.name, "Bases");
brootitem.cid = pwr_eClass_Hier;
brootitem.oix = next_oix++;
......@@ -553,7 +553,7 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
continue;
}
pitem hieritem;
procom_obj hieritem;
strcpy( hieritem.name, line_item[1]);
hieritem.cid = pwr_eClass_Hier;
hieritem.oix = next_oix++;
......@@ -597,7 +597,7 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
continue;
}
pitem baseitem;
procom_obj baseitem;
strcpy( baseitem.name, basename(line_item[1]));
baseitem.cid = pwr_cClass_BaseReg;
baseitem.oix = next_oix++;
......@@ -638,7 +638,7 @@ void wb_pvd_pl::load( pwr_tStatus *rsts)
menu_stack[menu_cnt++] = hieroix;
}
pitem projitem;
procom_obj projitem;
if ( (s = strrchr( line_item[3], '-')))
strcpy( projitem.name, s + 1);
else
......@@ -698,7 +698,7 @@ bool wb_pvd_pl::create_hier( char *hier, pwr_tOix *oix)
// Check if name exist
if ( !find( fthoix, segment_name[i], &ix)) {
// Create this hierarchy object
pitem hieritem;
procom_obj hieritem;
strcpy( hieritem.name, segment_name[i]);
hieritem.cid = pwr_eClass_Hier;
hieritem.oix = next_oix++;
......
/*
* Proview $Id: wb_pvd_pl.h,v 1.2 2005-10-25 12:04:25 claes Exp $
* Proview $Id: wb_pvd_pl.h,v 1.3 2006-09-14 14:16:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -20,7 +20,7 @@
#ifndef wb_pvd_pl_h
#define wb_pvd_pl_h
#include "wb_pvd_file.h"
#include "co_pvd_file.h"
typedef enum {
pl_mFlags_ProjectModified = 1 << 16,
......@@ -28,16 +28,16 @@ typedef enum {
pl_mFlags_Disabled = 1 << 18
} pl_mFlags;
class wb_pvd_pl : public wb_pvd_file {
class wb_pvd_pl : public co_pvd_file {
public:
wb_pvd_pl()
{
pwr_tStatus sts;
load( &sts);
}
void writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset,
void writeAttribute( co_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size, char *buffer);
void createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
void createObject( co_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name);
void load( pwr_tStatus *sts);
void save( pwr_tStatus *sts);
......
/*
* Proview $Id: wb_vrepext.cpp,v 1.6 2005-11-22 12:28:18 claes Exp $
* Proview $Id: wb_vrepext.cpp,v 1.7 2006-09-14 14:16:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -45,7 +45,7 @@
#include "wb_volume.h"
#include "pwr_baseclasses.h"
#include "wb_pvd_gvl.h"
#include "wb_pvd_udb.h"
#include "co_pvd_udb.h"
#include "wb_pvd_pl.h"
extern "C" {
#include "co_dcli.h"
......@@ -84,7 +84,7 @@ wb_vrepext::wb_vrepext( wb_erep *erep, pwr_tVid vid, char *name, char *provider)
}
else if ( cdh_NoCaseStrcmp( provider, "UserDatabase") == 0) {
m_ptype = procom_eType_Local;
m_provider = new wb_pvd_udb();
m_provider = new co_pvd_udb();
m_procom = new wb_procom( provider, m_provider, procom_eType_Local);
}
}
......
/*
* Proview $Id: wb_vrepext.h,v 1.8 2006-05-11 07:12:20 claes Exp $
* Proview $Id: wb_vrepext.h,v 1.9 2006-09-14 14:16:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -29,7 +29,8 @@
#include "co_dbs.h"
#include "wb_import.h"
#include "wb_vext.h"
#include "wb_provider.h"
#include "co_provider.h"
#include "wb_procom.h"
#include "wb_cdef.h"
class wb_vrepext;
......@@ -145,7 +146,7 @@ class wb_vrepext : public wb_vrep
int m_msgrcvid;
ext_object m_cashe;
wb_procom *m_procom;
wb_provider *m_provider;
co_provider *m_provider;
procom_eType m_ptype;
public:
......
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