aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/vmlogrdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char/vmlogrdr.c')
-rw-r--r--drivers/s390/char/vmlogrdr.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index 9f661426e4a1..c837d7419a6a 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -30,7 +30,6 @@
30#include <linux/kmod.h> 30#include <linux/kmod.h>
31#include <linux/cdev.h> 31#include <linux/cdev.h>
32#include <linux/device.h> 32#include <linux/device.h>
33#include <linux/smp_lock.h>
34#include <linux/string.h> 33#include <linux/string.h>
35 34
36MODULE_AUTHOR 35MODULE_AUTHOR
@@ -249,27 +248,25 @@ static int vmlogrdr_recording(struct vmlogrdr_priv_t * logptr,
249 char cp_command[80]; 248 char cp_command[80];
250 char cp_response[160]; 249 char cp_response[160];
251 char *onoff, *qid_string; 250 char *onoff, *qid_string;
251 int rc;
252 252
253 memset(cp_command, 0x00, sizeof(cp_command)); 253 onoff = ((action == 1) ? "ON" : "OFF");
254 memset(cp_response, 0x00, sizeof(cp_response));
255
256 onoff = ((action == 1) ? "ON" : "OFF");
257 qid_string = ((recording_class_AB == 1) ? " QID * " : ""); 254 qid_string = ((recording_class_AB == 1) ? " QID * " : "");
258 255
259 /* 256 /*
260 * The recording commands needs to be called with option QID 257 * The recording commands needs to be called with option QID
261 * for guests that have previlege classes A or B. 258 * for guests that have previlege classes A or B.
262 * Purging has to be done as separate step, because recording 259 * Purging has to be done as separate step, because recording
263 * can't be switched on as long as records are on the queue. 260 * can't be switched on as long as records are on the queue.
264 * Doing both at the same time doesn't work. 261 * Doing both at the same time doesn't work.
265 */ 262 */
266 263 if (purge && (action == 1)) {
267 if (purge) { 264 memset(cp_command, 0x00, sizeof(cp_command));
265 memset(cp_response, 0x00, sizeof(cp_response));
268 snprintf(cp_command, sizeof(cp_command), 266 snprintf(cp_command, sizeof(cp_command),
269 "RECORDING %s PURGE %s", 267 "RECORDING %s PURGE %s",
270 logptr->recording_name, 268 logptr->recording_name,
271 qid_string); 269 qid_string);
272
273 cpcmd(cp_command, cp_response, sizeof(cp_response), NULL); 270 cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
274 } 271 }
275 272
@@ -279,19 +276,33 @@ static int vmlogrdr_recording(struct vmlogrdr_priv_t * logptr,
279 logptr->recording_name, 276 logptr->recording_name,
280 onoff, 277 onoff,
281 qid_string); 278 qid_string);
282
283 cpcmd(cp_command, cp_response, sizeof(cp_response), NULL); 279 cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
284 /* The recording command will usually answer with 'Command complete' 280 /* The recording command will usually answer with 'Command complete'
285 * on success, but when the specific service was never connected 281 * on success, but when the specific service was never connected
286 * before then there might be an additional informational message 282 * before then there might be an additional informational message
287 * 'HCPCRC8072I Recording entry not found' before the 283 * 'HCPCRC8072I Recording entry not found' before the
288 * 'Command complete'. So I use strstr rather then the strncmp. 284 * 'Command complete'. So I use strstr rather then the strncmp.
289 */ 285 */
290 if (strstr(cp_response,"Command complete")) 286 if (strstr(cp_response,"Command complete"))
291 return 0; 287 rc = 0;
292 else 288 else
293 return -EIO; 289 rc = -EIO;
290 /*
291 * If we turn recording off, we have to purge any remaining records
292 * afterwards, as a large number of queued records may impact z/VM
293 * performance.
294 */
295 if (purge && (action == 0)) {
296 memset(cp_command, 0x00, sizeof(cp_command));
297 memset(cp_response, 0x00, sizeof(cp_response));
298 snprintf(cp_command, sizeof(cp_command),
299 "RECORDING %s PURGE %s",
300 logptr->recording_name,
301 qid_string);
302 cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
303 }
294 304
305 return rc;
295} 306}
296 307
297 308