Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: Re: Autosave for waveform with 1 element
From: Andrew Johnson <anj@aps.anl.gov>
To: <tech-talk@aps.anl.gov>
Date: Tue, 11 Jul 2017 18:58:38 -0500
Hi Tim,

On 07/11/2017 05:10 PM, Mooney, Tim M. wrote:
> I think the line in dbrestore.c that isn't doing the same thing under
> 3.15.5 that it did under 3.14.12.5 is this:
> 
>    status = (*dbFastPutConvertRoutine[DBR_STRING][field_type])
> 
> where field_type has the value DBF_NOACCESS.

If your code really is looking up
    dbFastPutConvertRoutine[DBR_STRING][DBF_NOACCESS]
then it isn't getting the function pointer that it's looking for,
because the second index into that array only goes up to DBF_DEVICE
which is 4 less than DBF_NOACCESS. More likely the field_type value was
replaced when dbNameToAddr() called the prset->cvt_dbaddr() routine,
which sets paddr->field_type from prec->ftvl or the equivalent field.

Hmm, is this dbrestore code being run from initHooks during iocInit()?
Which hooks do you use when dealing with array fields, and how do you
detect and distinguish between arrays and scalars?

Michael Davidsaver added some tests to Base-3.16 which check the APIs
that autosave uses so we shouldn't break them when we modify Base, but
he doesn't actually call dbPut() in the initHookAfterInitDatabase state
so we might have subtly changed the behaviour without knowing it (and of
course those tests are present in 3.16, not 3.15).

> But I don't understand how
> the aSubRecord's .A field behaves differently than the waveform record's
> .VAL field, because they are both one element array fields.

Arrays with one element look to some parts of the IOC code like they are
regular fields, but to other parts like they are arrays. That
distinction has changed slightly in more recent versions.

One subtle difference that I know about is when the field's buffer
pointer gets copied into paddr->pfield. Both the waveform and aao record
types do this in their get_array_info() method:
    paddr->pfield = prec->bptr;
In the aSub record though paddr->pfield is set in the cvt_dbaddr()
method instead:
    paddr->pfield = (&prec->a  )[offset];
Thus the behaviour difference you see might be explained by something
not calling the get_array_info() method properly in 3.15.5 at the time
when you're accessing the array field.

- Andrew

-- 
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon

Replies:
Re: Autosave for waveform with 1 element Mooney, Tim M.
References:
Autosave for waveform with 1 element Paduan Donadio, Marcio
Re: Autosave for waveform with 1 element Mooney, Tim M.

Navigate by Date:
Prev: Re: Autosave for waveform with 1 element Mooney, Tim M.
Next: Re: Autosave for waveform with 1 element Mooney, Tim M.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: Re: Autosave for waveform with 1 element Mooney, Tim M.
Next: Re: Autosave for waveform with 1 element Mooney, Tim M.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 11 Jul 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·