Merge lp:~epics-core/epics-base/array-opt into lp:~epics-core/epics-base/3.15

Proposed by mdavidsaver
Status: Merged
Merged at revision: 12411
Proposed branch: lp:~epics-core/epics-base/array-opt
Merge into: lp:~epics-core/epics-base/3.15
Diff against target: 190 lines (+41/-8) (has conflicts)
6 files modified
documentation/RELEASE_NOTES.html (+19/-0)
src/ioc/db/dbAccess.c (+12/-1)
src/std/filters/arr.c (+4/-1)
src/std/rec/aaiRecord.c (+2/-2)
src/std/rec/aaoRecord.c (+2/-2)
src/std/rec/waveformRecord.c (+2/-2)
Text conflict in documentation/RELEASE_NOTES.html
To merge this branch: bzr merge lp:~epics-core/epics-base/array-opt
Reviewer Review Type Date Requested Status
Andrew Johnson Approve
Review via email: mp+149396@code.launchpad.net

Description of the change

Allow device support code to safely replace BPTR for waveform, aai, and aao recordtypes. This avoids a copy when moving array data into and out of a record.

To post a comment you must log in.
lp:~epics-core/epics-base/array-opt updated
12400. By mdavidsaver

Don't need void* cast

Implicit case from void** to void*
is allowed.

12401. By mdavidsaver

update release notes

Revision history for this message
Andrew Johnson (anj) wrote :

Looks good, merging...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'documentation/RELEASE_NOTES.html'
--- documentation/RELEASE_NOTES.html 2013-03-15 20:23:55 +0000
+++ documentation/RELEASE_NOTES.html 2013-04-02 21:10:26 +0000
@@ -15,6 +15,7 @@
15<h2 align="center">Changes between 3.15.0.1 and 3.15.0.2</h2>15<h2 align="center">Changes between 3.15.0.1 and 3.15.0.2</h2>
16<!-- Insert new items immediately below here ... -->16<!-- Insert new items immediately below here ... -->
1717
18<<<<<<< TREE
18<h3>Spin-locks API added</h3>19<h3>Spin-locks API added</h3>
1920
20<p>The new header file epicsSpin.h adds a portable spin-locks API which is21<p>The new header file epicsSpin.h adds a portable spin-locks API which is
@@ -34,6 +35,24 @@
34hostnames that begin with one or more digits. The epicsSockResolveTest program35hostnames that begin with one or more digits. The epicsSockResolveTest program
35was added to check this functionality.</p>36was added to check this functionality.</p>
3637
38=======
39<h3>Array field memory mangement</h3>
40
41<p>This allows array data to be moved, without copying, into and out of the
42value (aka BPTR) field of the waveform, aai, and aao types.</p>
43
44<p>Making use of this feature involves replacing the pointer stored in the BPTR
45field with another (user allocated) pointer. The basic rules are:</p>
46
47<ol>
48 <li>BPTR, and the memory it is currently pointing to, can only be accessed
49 while the record is locked.</li>
50 <li>NELM may not be changed.</li>
51 <li>BPTR must always point to a piece of memory large enough to accommodate
52 the maximum number of elements (as given by the NELM field).</li>
53</ol>
54
55>>>>>>> MERGE-SOURCE
37<h3>mbboDirect and mbbiDirect records</h3>56<h3>mbboDirect and mbbiDirect records</h3>
3857
39<p>These record types have undergone some significant rework, and will behave58<p>These record types have undergone some significant rework, and will behave
4059
=== modified file 'src/ioc/db/dbAccess.c'
--- src/ioc/db/dbAccess.c 2012-10-29 06:20:56 +0000
+++ src/ioc/db/dbAccess.c 2013-04-02 21:10:26 +0000
@@ -780,6 +780,7 @@
780 void *pbuffer, long *options, long *nRequest, void *pflin)780 void *pbuffer, long *options, long *nRequest, void *pflin)
781{781{
782 char *pbuf = pbuffer;782 char *pbuf = pbuffer;
783 void *pfieldsave;
783 db_field_log *pfl = (db_field_log *)pflin;784 db_field_log *pfl = (db_field_log *)pflin;
784 short field_type;785 short field_type;
785 long no_elements;786 long no_elements;
@@ -815,6 +816,13 @@
815 return S_db_badDbrtype;816 return S_db_badDbrtype;
816 }817 }
817818
819 /* For array field, the rset function
820 * get_array_info() is allowed to modify
821 * paddr->pfield. So we store the original
822 * value and restore it later.
823 */
824 pfieldsave = paddr->pfield;
825
818 /* check for array */826 /* check for array */
819 if ((!pfl || pfl->type == dbfl_type_rec) &&827 if ((!pfl || pfl->type == dbfl_type_rec) &&
820 paddr->special == SPC_DBADDR &&828 paddr->special == SPC_DBADDR &&
@@ -860,7 +868,8 @@
860 sprintf(message, "dbGet: Missing conversion for [%d][%d]\n",868 sprintf(message, "dbGet: Missing conversion for [%d][%d]\n",
861 field_type, dbrType);869 field_type, dbrType);
862 recGblDbaddrError(S_db_badDbrtype, paddr, message);870 recGblDbaddrError(S_db_badDbrtype, paddr, message);
863 return S_db_badDbrtype;871 status = S_db_badDbrtype;
872 goto done;
864 }873 }
865 /* convert database field and place it in the buffer */874 /* convert database field and place it in the buffer */
866 if (n <= 0) {875 if (n <= 0) {
@@ -880,6 +889,8 @@
880 status = convert(&localAddr, pbuf, n, no_elements, offset);889 status = convert(&localAddr, pbuf, n, no_elements, offset);
881 }890 }
882 }891 }
892done:
893 paddr->pfield = pfieldsave;
883 return status;894 return status;
884}895}
885896
886897
=== modified file 'src/std/filters/arr.c'
--- src/std/filters/arr.c 2012-07-17 19:33:31 +0000
+++ src/std/filters/arr.c 2013-04-02 21:10:26 +0000
@@ -104,7 +104,9 @@
104 if (chan->addr.special == SPC_DBADDR &&104 if (chan->addr.special == SPC_DBADDR &&
105 nSource > 1 &&105 nSource > 1 &&
106 (prset = dbGetRset(&chan->addr)) &&106 (prset = dbGetRset(&chan->addr)) &&
107 prset->get_array_info) {107 prset->get_array_info)
108 {
109 void *pfieldsave = chan->addr.pfield;
108 prec = dbChannelRecord(chan);110 prec = dbChannelRecord(chan);
109 dbScanLock(prec);111 dbScanLock(prec);
110 prset->get_array_info(&chan->addr, &nSource, &offset);112 prset->get_array_info(&chan->addr, &nSource, &offset);
@@ -126,6 +128,7 @@
126 pfl->u.r.field = pdst;128 pfl->u.r.field = pdst;
127 }129 }
128 dbScanUnlock(prec);130 dbScanUnlock(prec);
131 chan->addr.pfield = pfieldsave;
129 }132 }
130133
131 /* Extract from buffer */134 /* Extract from buffer */
132135
=== modified file 'src/std/rec/aaiRecord.c'
--- src/std/rec/aaiRecord.c 2012-01-21 21:20:11 +0000
+++ src/std/rec/aaiRecord.c 2013-04-02 21:10:26 +0000
@@ -183,7 +183,6 @@
183{183{
184 aaiRecord *prec = (aaiRecord *)paddr->precord;184 aaiRecord *prec = (aaiRecord *)paddr->precord;
185185
186 paddr->pfield = prec->bptr;
187 paddr->no_elements = prec->nelm;186 paddr->no_elements = prec->nelm;
188 paddr->field_type = prec->ftvl;187 paddr->field_type = prec->ftvl;
189 paddr->field_size = dbValueSize(prec->ftvl);188 paddr->field_size = dbValueSize(prec->ftvl);
@@ -195,6 +194,7 @@
195{194{
196 aaiRecord *prec = (aaiRecord *)paddr->precord;195 aaiRecord *prec = (aaiRecord *)paddr->precord;
197196
197 paddr->pfield = prec->bptr;
198 *no_elements = prec->nord;198 *no_elements = prec->nord;
199 *offset = 0;199 *offset = 0;
200 return 0;200 return 0;
@@ -308,7 +308,7 @@
308 }308 }
309309
310 if (monitor_mask)310 if (monitor_mask)
311 db_post_events(prec, prec->bptr, monitor_mask);311 db_post_events(prec, &prec->val, monitor_mask);
312}312}
313313
314static long readValue(aaiRecord *prec)314static long readValue(aaiRecord *prec)
315315
=== modified file 'src/std/rec/aaoRecord.c'
--- src/std/rec/aaoRecord.c 2012-01-21 21:20:11 +0000
+++ src/std/rec/aaoRecord.c 2013-04-02 21:10:26 +0000
@@ -183,7 +183,6 @@
183{183{
184 aaoRecord *prec = (aaoRecord *)paddr->precord;184 aaoRecord *prec = (aaoRecord *)paddr->precord;
185185
186 paddr->pfield = prec->bptr;
187 paddr->no_elements = prec->nelm;186 paddr->no_elements = prec->nelm;
188 paddr->field_type = prec->ftvl;187 paddr->field_type = prec->ftvl;
189 paddr->field_size = dbValueSize(prec->ftvl);188 paddr->field_size = dbValueSize(prec->ftvl);
@@ -195,6 +194,7 @@
195{194{
196 aaoRecord *prec = (aaoRecord *)paddr->precord;195 aaoRecord *prec = (aaoRecord *)paddr->precord;
197196
197 paddr->pfield = prec->bptr;
198 *no_elements = prec->nord;198 *no_elements = prec->nord;
199 *offset = 0;199 *offset = 0;
200 return 0;200 return 0;
@@ -308,7 +308,7 @@
308 }308 }
309309
310 if (monitor_mask)310 if (monitor_mask)
311 db_post_events(prec, prec->bptr, monitor_mask);311 db_post_events(prec, &prec->val, monitor_mask);
312}312}
313313
314static long writeValue(aaoRecord *prec)314static long writeValue(aaoRecord *prec)
315315
=== modified file 'src/std/rec/waveformRecord.c'
--- src/std/rec/waveformRecord.c 2012-07-07 20:54:31 +0000
+++ src/std/rec/waveformRecord.c 2013-04-02 21:10:26 +0000
@@ -163,7 +163,6 @@
163{163{
164 waveformRecord *prec = (waveformRecord *) paddr->precord;164 waveformRecord *prec = (waveformRecord *) paddr->precord;
165165
166 paddr->pfield = prec->bptr;
167 paddr->no_elements = prec->nelm;166 paddr->no_elements = prec->nelm;
168 paddr->field_type = prec->ftvl;167 paddr->field_type = prec->ftvl;
169 paddr->field_size = dbValueSize(prec->ftvl);168 paddr->field_size = dbValueSize(prec->ftvl);
@@ -176,6 +175,7 @@
176{175{
177 waveformRecord *prec = (waveformRecord *) paddr->precord;176 waveformRecord *prec = (waveformRecord *) paddr->precord;
178177
178 paddr->pfield = prec->bptr;
179 *no_elements = prec->nord;179 *no_elements = prec->nord;
180 *offset = 0;180 *offset = 0;
181181
@@ -300,7 +300,7 @@
300 }300 }
301301
302 if (monitor_mask) {302 if (monitor_mask) {
303 db_post_events(prec, prec->bptr, monitor_mask);303 db_post_events(prec, &prec->val, monitor_mask);
304 }304 }
305}305}
306306

Subscribers

People subscribed via source and target branches

to all changes: