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
1=== modified file 'documentation/RELEASE_NOTES.html'
2--- documentation/RELEASE_NOTES.html 2013-03-15 20:23:55 +0000
3+++ documentation/RELEASE_NOTES.html 2013-04-02 21:10:26 +0000
4@@ -15,6 +15,7 @@
5 <h2 align="center">Changes between 3.15.0.1 and 3.15.0.2</h2>
6 <!-- Insert new items immediately below here ... -->
7
8+<<<<<<< TREE
9 <h3>Spin-locks API added</h3>
10
11 <p>The new header file epicsSpin.h adds a portable spin-locks API which is
12@@ -34,6 +35,24 @@
13 hostnames that begin with one or more digits. The epicsSockResolveTest program
14 was added to check this functionality.</p>
15
16+=======
17+<h3>Array field memory mangement</h3>
18+
19+<p>This allows array data to be moved, without copying, into and out of the
20+value (aka BPTR) field of the waveform, aai, and aao types.</p>
21+
22+<p>Making use of this feature involves replacing the pointer stored in the BPTR
23+field with another (user allocated) pointer. The basic rules are:</p>
24+
25+<ol>
26+ <li>BPTR, and the memory it is currently pointing to, can only be accessed
27+ while the record is locked.</li>
28+ <li>NELM may not be changed.</li>
29+ <li>BPTR must always point to a piece of memory large enough to accommodate
30+ the maximum number of elements (as given by the NELM field).</li>
31+</ol>
32+
33+>>>>>>> MERGE-SOURCE
34 <h3>mbboDirect and mbbiDirect records</h3>
35
36 <p>These record types have undergone some significant rework, and will behave
37
38=== modified file 'src/ioc/db/dbAccess.c'
39--- src/ioc/db/dbAccess.c 2012-10-29 06:20:56 +0000
40+++ src/ioc/db/dbAccess.c 2013-04-02 21:10:26 +0000
41@@ -780,6 +780,7 @@
42 void *pbuffer, long *options, long *nRequest, void *pflin)
43 {
44 char *pbuf = pbuffer;
45+ void *pfieldsave;
46 db_field_log *pfl = (db_field_log *)pflin;
47 short field_type;
48 long no_elements;
49@@ -815,6 +816,13 @@
50 return S_db_badDbrtype;
51 }
52
53+ /* For array field, the rset function
54+ * get_array_info() is allowed to modify
55+ * paddr->pfield. So we store the original
56+ * value and restore it later.
57+ */
58+ pfieldsave = paddr->pfield;
59+
60 /* check for array */
61 if ((!pfl || pfl->type == dbfl_type_rec) &&
62 paddr->special == SPC_DBADDR &&
63@@ -860,7 +868,8 @@
64 sprintf(message, "dbGet: Missing conversion for [%d][%d]\n",
65 field_type, dbrType);
66 recGblDbaddrError(S_db_badDbrtype, paddr, message);
67- return S_db_badDbrtype;
68+ status = S_db_badDbrtype;
69+ goto done;
70 }
71 /* convert database field and place it in the buffer */
72 if (n <= 0) {
73@@ -880,6 +889,8 @@
74 status = convert(&localAddr, pbuf, n, no_elements, offset);
75 }
76 }
77+done:
78+ paddr->pfield = pfieldsave;
79 return status;
80 }
81
82
83=== modified file 'src/std/filters/arr.c'
84--- src/std/filters/arr.c 2012-07-17 19:33:31 +0000
85+++ src/std/filters/arr.c 2013-04-02 21:10:26 +0000
86@@ -104,7 +104,9 @@
87 if (chan->addr.special == SPC_DBADDR &&
88 nSource > 1 &&
89 (prset = dbGetRset(&chan->addr)) &&
90- prset->get_array_info) {
91+ prset->get_array_info)
92+ {
93+ void *pfieldsave = chan->addr.pfield;
94 prec = dbChannelRecord(chan);
95 dbScanLock(prec);
96 prset->get_array_info(&chan->addr, &nSource, &offset);
97@@ -126,6 +128,7 @@
98 pfl->u.r.field = pdst;
99 }
100 dbScanUnlock(prec);
101+ chan->addr.pfield = pfieldsave;
102 }
103
104 /* Extract from buffer */
105
106=== modified file 'src/std/rec/aaiRecord.c'
107--- src/std/rec/aaiRecord.c 2012-01-21 21:20:11 +0000
108+++ src/std/rec/aaiRecord.c 2013-04-02 21:10:26 +0000
109@@ -183,7 +183,6 @@
110 {
111 aaiRecord *prec = (aaiRecord *)paddr->precord;
112
113- paddr->pfield = prec->bptr;
114 paddr->no_elements = prec->nelm;
115 paddr->field_type = prec->ftvl;
116 paddr->field_size = dbValueSize(prec->ftvl);
117@@ -195,6 +194,7 @@
118 {
119 aaiRecord *prec = (aaiRecord *)paddr->precord;
120
121+ paddr->pfield = prec->bptr;
122 *no_elements = prec->nord;
123 *offset = 0;
124 return 0;
125@@ -308,7 +308,7 @@
126 }
127
128 if (monitor_mask)
129- db_post_events(prec, prec->bptr, monitor_mask);
130+ db_post_events(prec, &prec->val, monitor_mask);
131 }
132
133 static long readValue(aaiRecord *prec)
134
135=== modified file 'src/std/rec/aaoRecord.c'
136--- src/std/rec/aaoRecord.c 2012-01-21 21:20:11 +0000
137+++ src/std/rec/aaoRecord.c 2013-04-02 21:10:26 +0000
138@@ -183,7 +183,6 @@
139 {
140 aaoRecord *prec = (aaoRecord *)paddr->precord;
141
142- paddr->pfield = prec->bptr;
143 paddr->no_elements = prec->nelm;
144 paddr->field_type = prec->ftvl;
145 paddr->field_size = dbValueSize(prec->ftvl);
146@@ -195,6 +194,7 @@
147 {
148 aaoRecord *prec = (aaoRecord *)paddr->precord;
149
150+ paddr->pfield = prec->bptr;
151 *no_elements = prec->nord;
152 *offset = 0;
153 return 0;
154@@ -308,7 +308,7 @@
155 }
156
157 if (monitor_mask)
158- db_post_events(prec, prec->bptr, monitor_mask);
159+ db_post_events(prec, &prec->val, monitor_mask);
160 }
161
162 static long writeValue(aaoRecord *prec)
163
164=== modified file 'src/std/rec/waveformRecord.c'
165--- src/std/rec/waveformRecord.c 2012-07-07 20:54:31 +0000
166+++ src/std/rec/waveformRecord.c 2013-04-02 21:10:26 +0000
167@@ -163,7 +163,6 @@
168 {
169 waveformRecord *prec = (waveformRecord *) paddr->precord;
170
171- paddr->pfield = prec->bptr;
172 paddr->no_elements = prec->nelm;
173 paddr->field_type = prec->ftvl;
174 paddr->field_size = dbValueSize(prec->ftvl);
175@@ -176,6 +175,7 @@
176 {
177 waveformRecord *prec = (waveformRecord *) paddr->precord;
178
179+ paddr->pfield = prec->bptr;
180 *no_elements = prec->nord;
181 *offset = 0;
182
183@@ -300,7 +300,7 @@
184 }
185
186 if (monitor_mask) {
187- db_post_events(prec, prec->bptr, monitor_mask);
188+ db_post_events(prec, &prec->val, monitor_mask);
189 }
190 }
191

Subscribers

People subscribed via source and target branches

to all changes: