Linux Audio

Check our new training course

Loading...
v3.1
 
  1/*
  2 * Character device driver for writing z/VM *MONITOR service records.
  3 *
  4 * Copyright IBM Corp. 2006, 2009
  5 *
  6 * Author(s): Melissa Howland <Melissa.Howland@us.ibm.com>
  7 */
  8
  9#define KMSG_COMPONENT "monwriter"
 10#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 11
 12#include <linux/module.h>
 13#include <linux/moduleparam.h>
 14#include <linux/init.h>
 15#include <linux/errno.h>
 16#include <linux/types.h>
 17#include <linux/kernel.h>
 18#include <linux/miscdevice.h>
 19#include <linux/ctype.h>
 20#include <linux/poll.h>
 21#include <linux/mutex.h>
 22#include <linux/platform_device.h>
 23#include <linux/slab.h>
 24#include <asm/uaccess.h>
 
 25#include <asm/ebcdic.h>
 26#include <asm/io.h>
 27#include <asm/appldata.h>
 28#include <asm/monwriter.h>
 29
 30#define MONWRITE_MAX_DATALEN	4010
 31
 32static int mon_max_bufs = 255;
 33static int mon_buf_count;
 34
 35struct mon_buf {
 36	struct list_head list;
 37	struct monwrite_hdr hdr;
 38	int diag_done;
 39	char *data;
 40};
 41
 42static LIST_HEAD(mon_priv_list);
 43
 44struct mon_private {
 45	struct list_head priv_list;
 46	struct list_head list;
 47	struct monwrite_hdr hdr;
 48	size_t hdr_to_read;
 49	size_t data_to_read;
 50	struct mon_buf *current_buf;
 51	struct mutex thread_mutex;
 52};
 53
 54/*
 55 * helper functions
 56 */
 57
 58static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn)
 59{
 60	struct appldata_product_id id;
 
 61	int rc;
 62
 63	strcpy(id.prod_nr, "LNXAPPL");
 64	id.prod_fn = myhdr->applid;
 65	id.record_nr = myhdr->record_num;
 66	id.version_nr = myhdr->version;
 67	id.release_nr = myhdr->release;
 68	id.mod_lvl = myhdr->mod_level;
 69	rc = appldata_asm(&id, fcn, (void *) buffer, myhdr->datalen);
 
 
 
 
 
 
 70	if (rc <= 0)
 71		return rc;
 72	pr_err("Writing monitor data failed with rc=%i\n", rc);
 73	if (rc == 5)
 74		return -EPERM;
 75	return -EINVAL;
 
 
 76}
 77
 78static struct mon_buf *monwrite_find_hdr(struct mon_private *monpriv,
 79					 struct monwrite_hdr *monhdr)
 80{
 81	struct mon_buf *entry, *next;
 82
 83	list_for_each_entry_safe(entry, next, &monpriv->list, list)
 84		if ((entry->hdr.mon_function == monhdr->mon_function ||
 85		     monhdr->mon_function == MONWRITE_STOP_INTERVAL) &&
 86		    entry->hdr.applid == monhdr->applid &&
 87		    entry->hdr.record_num == monhdr->record_num &&
 88		    entry->hdr.version == monhdr->version &&
 89		    entry->hdr.release == monhdr->release &&
 90		    entry->hdr.mod_level == monhdr->mod_level)
 91			return entry;
 92
 93	return NULL;
 94}
 95
 96static int monwrite_new_hdr(struct mon_private *monpriv)
 97{
 98	struct monwrite_hdr *monhdr = &monpriv->hdr;
 99	struct mon_buf *monbuf;
100	int rc = 0;
101
102	if (monhdr->datalen > MONWRITE_MAX_DATALEN ||
103	    monhdr->mon_function > MONWRITE_START_CONFIG ||
104	    monhdr->hdrlen != sizeof(struct monwrite_hdr))
105		return -EINVAL;
106	monbuf = NULL;
107	if (monhdr->mon_function != MONWRITE_GEN_EVENT)
108		monbuf = monwrite_find_hdr(monpriv, monhdr);
109	if (monbuf) {
110		if (monhdr->mon_function == MONWRITE_STOP_INTERVAL) {
111			monhdr->datalen = monbuf->hdr.datalen;
112			rc = monwrite_diag(monhdr, monbuf->data,
113					   APPLDATA_STOP_REC);
114			list_del(&monbuf->list);
115			mon_buf_count--;
116			kfree(monbuf->data);
117			kfree(monbuf);
118			monbuf = NULL;
119		}
120	} else if (monhdr->mon_function != MONWRITE_STOP_INTERVAL) {
121		if (mon_buf_count >= mon_max_bufs)
122			return -ENOSPC;
123		monbuf = kzalloc(sizeof(struct mon_buf), GFP_KERNEL);
124		if (!monbuf)
125			return -ENOMEM;
126		monbuf->data = kzalloc(monhdr->datalen,
127				       GFP_KERNEL | GFP_DMA);
128		if (!monbuf->data) {
129			kfree(monbuf);
130			return -ENOMEM;
131		}
132		monbuf->hdr = *monhdr;
133		list_add_tail(&monbuf->list, &monpriv->list);
134		if (monhdr->mon_function != MONWRITE_GEN_EVENT)
135			mon_buf_count++;
136	}
137	monpriv->current_buf = monbuf;
138	return rc;
139}
140
141static int monwrite_new_data(struct mon_private *monpriv)
142{
143	struct monwrite_hdr *monhdr = &monpriv->hdr;
144	struct mon_buf *monbuf = monpriv->current_buf;
145	int rc = 0;
146
147	switch (monhdr->mon_function) {
148	case MONWRITE_START_INTERVAL:
149		if (!monbuf->diag_done) {
150			rc = monwrite_diag(monhdr, monbuf->data,
151					   APPLDATA_START_INTERVAL_REC);
152			monbuf->diag_done = 1;
153		}
154		break;
155	case MONWRITE_START_CONFIG:
156		if (!monbuf->diag_done) {
157			rc = monwrite_diag(monhdr, monbuf->data,
158					   APPLDATA_START_CONFIG_REC);
159			monbuf->diag_done = 1;
160		}
161		break;
162	case MONWRITE_GEN_EVENT:
163		rc = monwrite_diag(monhdr, monbuf->data,
164				   APPLDATA_GEN_EVENT_REC);
165		list_del(&monpriv->current_buf->list);
166		kfree(monpriv->current_buf->data);
167		kfree(monpriv->current_buf);
168		monpriv->current_buf = NULL;
169		break;
170	default:
171		/* monhdr->mon_function is checked in monwrite_new_hdr */
172		BUG();
173	}
174	return rc;
175}
176
177/*
178 * file operations
179 */
180
181static int monwrite_open(struct inode *inode, struct file *filp)
182{
183	struct mon_private *monpriv;
184
185	monpriv = kzalloc(sizeof(struct mon_private), GFP_KERNEL);
186	if (!monpriv)
187		return -ENOMEM;
188	INIT_LIST_HEAD(&monpriv->list);
189	monpriv->hdr_to_read = sizeof(monpriv->hdr);
190	mutex_init(&monpriv->thread_mutex);
191	filp->private_data = monpriv;
192	list_add_tail(&monpriv->priv_list, &mon_priv_list);
193	return nonseekable_open(inode, filp);
194}
195
196static int monwrite_close(struct inode *inode, struct file *filp)
197{
198	struct mon_private *monpriv = filp->private_data;
199	struct mon_buf *entry, *next;
200
201	list_for_each_entry_safe(entry, next, &monpriv->list, list) {
202		if (entry->hdr.mon_function != MONWRITE_GEN_EVENT)
203			monwrite_diag(&entry->hdr, entry->data,
204				      APPLDATA_STOP_REC);
205		mon_buf_count--;
206		list_del(&entry->list);
207		kfree(entry->data);
208		kfree(entry);
209	}
210	list_del(&monpriv->priv_list);
211	kfree(monpriv);
212	return 0;
213}
214
215static ssize_t monwrite_write(struct file *filp, const char __user *data,
216			      size_t count, loff_t *ppos)
217{
218	struct mon_private *monpriv = filp->private_data;
219	size_t len, written;
220	void *to;
221	int rc;
222
223	mutex_lock(&monpriv->thread_mutex);
224	for (written = 0; written < count; ) {
225		if (monpriv->hdr_to_read) {
226			len = min(count - written, monpriv->hdr_to_read);
227			to = (char *) &monpriv->hdr +
228				sizeof(monpriv->hdr) - monpriv->hdr_to_read;
229			if (copy_from_user(to, data + written, len)) {
230				rc = -EFAULT;
231				goto out_error;
232			}
233			monpriv->hdr_to_read -= len;
234			written += len;
235			if (monpriv->hdr_to_read > 0)
236				continue;
237			rc = monwrite_new_hdr(monpriv);
238			if (rc)
239				goto out_error;
240			monpriv->data_to_read = monpriv->current_buf ?
241				monpriv->current_buf->hdr.datalen : 0;
242		}
243
244		if (monpriv->data_to_read) {
245			len = min(count - written, monpriv->data_to_read);
246			to = monpriv->current_buf->data +
247				monpriv->hdr.datalen - monpriv->data_to_read;
248			if (copy_from_user(to, data + written, len)) {
249				rc = -EFAULT;
250				goto out_error;
251			}
252			monpriv->data_to_read -= len;
253			written += len;
254			if (monpriv->data_to_read > 0)
255				continue;
256			rc = monwrite_new_data(monpriv);
257			if (rc)
258				goto out_error;
259		}
260		monpriv->hdr_to_read = sizeof(monpriv->hdr);
261	}
262	mutex_unlock(&monpriv->thread_mutex);
263	return written;
264
265out_error:
266	monpriv->data_to_read = 0;
267	monpriv->hdr_to_read = sizeof(struct monwrite_hdr);
268	mutex_unlock(&monpriv->thread_mutex);
269	return rc;
270}
271
272static const struct file_operations monwrite_fops = {
273	.owner	 = THIS_MODULE,
274	.open	 = &monwrite_open,
275	.release = &monwrite_close,
276	.write	 = &monwrite_write,
277	.llseek  = noop_llseek,
278};
279
280static struct miscdevice mon_dev = {
281	.name	= "monwriter",
282	.fops	= &monwrite_fops,
283	.minor	= MISC_DYNAMIC_MINOR,
284};
285
286/*
287 * suspend/resume
288 */
289
290static int monwriter_freeze(struct device *dev)
291{
292	struct mon_private *monpriv;
293	struct mon_buf *monbuf;
294
295	list_for_each_entry(monpriv, &mon_priv_list, priv_list) {
296		list_for_each_entry(monbuf, &monpriv->list, list) {
297			if (monbuf->hdr.mon_function != MONWRITE_GEN_EVENT)
298				monwrite_diag(&monbuf->hdr, monbuf->data,
299					      APPLDATA_STOP_REC);
300		}
301	}
302	return 0;
303}
304
305static int monwriter_restore(struct device *dev)
306{
307	struct mon_private *monpriv;
308	struct mon_buf *monbuf;
309
310	list_for_each_entry(monpriv, &mon_priv_list, priv_list) {
311		list_for_each_entry(monbuf, &monpriv->list, list) {
312			if (monbuf->hdr.mon_function == MONWRITE_START_INTERVAL)
313				monwrite_diag(&monbuf->hdr, monbuf->data,
314					      APPLDATA_START_INTERVAL_REC);
315			if (monbuf->hdr.mon_function == MONWRITE_START_CONFIG)
316				monwrite_diag(&monbuf->hdr, monbuf->data,
317					      APPLDATA_START_CONFIG_REC);
318		}
319	}
320	return 0;
321}
322
323static int monwriter_thaw(struct device *dev)
324{
325	return monwriter_restore(dev);
326}
327
328static const struct dev_pm_ops monwriter_pm_ops = {
329	.freeze		= monwriter_freeze,
330	.thaw		= monwriter_thaw,
331	.restore	= monwriter_restore,
332};
333
334static struct platform_driver monwriter_pdrv = {
335	.driver = {
336		.name	= "monwriter",
337		.owner	= THIS_MODULE,
338		.pm	= &monwriter_pm_ops,
339	},
340};
341
342static struct platform_device *monwriter_pdev;
343
344/*
345 * module init/exit
346 */
347
348static int __init mon_init(void)
349{
350	int rc;
351
352	if (!MACHINE_IS_VM)
353		return -ENODEV;
354
355	rc = platform_driver_register(&monwriter_pdrv);
356	if (rc)
357		return rc;
358
359	monwriter_pdev = platform_device_register_simple("monwriter", -1, NULL,
360							0);
361	if (IS_ERR(monwriter_pdev)) {
362		rc = PTR_ERR(monwriter_pdev);
363		goto out_driver;
364	}
365
366	/*
367	 * misc_register() has to be the last action in module_init(), because
368	 * file operations will be available right after this.
369	 */
370	rc = misc_register(&mon_dev);
371	if (rc)
372		goto out_device;
373	return 0;
374
375out_device:
376	platform_device_unregister(monwriter_pdev);
377out_driver:
378	platform_driver_unregister(&monwriter_pdrv);
379	return rc;
380}
381
382static void __exit mon_exit(void)
383{
384	misc_deregister(&mon_dev);
385	platform_device_unregister(monwriter_pdev);
386	platform_driver_unregister(&monwriter_pdrv);
387}
388
389module_init(mon_init);
390module_exit(mon_exit);
391
392module_param_named(max_bufs, mon_max_bufs, int, 0644);
393MODULE_PARM_DESC(max_bufs, "Maximum number of sample monitor data buffers "
394		 "that can be active at one time");
395
396MODULE_AUTHOR("Melissa Howland <Melissa.Howland@us.ibm.com>");
397MODULE_DESCRIPTION("Character device driver for writing z/VM "
398		   "APPLDATA monitor records.");
399MODULE_LICENSE("GPL");
v6.9.4
  1// SPDX-License-Identifier: GPL-2.0
  2/*
  3 * Character device driver for writing z/VM *MONITOR service records.
  4 *
  5 * Copyright IBM Corp. 2006, 2009
  6 *
  7 * Author(s): Melissa Howland <Melissa.Howland@us.ibm.com>
  8 */
  9
 10#define KMSG_COMPONENT "monwriter"
 11#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 12
 13#include <linux/module.h>
 14#include <linux/moduleparam.h>
 15#include <linux/init.h>
 16#include <linux/errno.h>
 17#include <linux/types.h>
 18#include <linux/kernel.h>
 19#include <linux/miscdevice.h>
 20#include <linux/ctype.h>
 21#include <linux/poll.h>
 22#include <linux/mutex.h>
 
 23#include <linux/slab.h>
 24#include <linux/uaccess.h>
 25#include <linux/io.h>
 26#include <asm/ebcdic.h>
 
 27#include <asm/appldata.h>
 28#include <asm/monwriter.h>
 29
 30#define MONWRITE_MAX_DATALEN	4010
 31
 32static int mon_max_bufs = 255;
 33static int mon_buf_count;
 34
 35struct mon_buf {
 36	struct list_head list;
 37	struct monwrite_hdr hdr;
 38	int diag_done;
 39	char *data;
 40};
 41
 
 
 42struct mon_private {
 
 43	struct list_head list;
 44	struct monwrite_hdr hdr;
 45	size_t hdr_to_read;
 46	size_t data_to_read;
 47	struct mon_buf *current_buf;
 48	struct mutex thread_mutex;
 49};
 50
 51/*
 52 * helper functions
 53 */
 54
 55static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn)
 56{
 57	struct appldata_parameter_list *parm_list;
 58	struct appldata_product_id *id;
 59	int rc;
 60
 61	id = kmalloc(sizeof(*id), GFP_KERNEL);
 62	parm_list = kmalloc(sizeof(*parm_list), GFP_KERNEL);
 63	rc = -ENOMEM;
 64	if (!id || !parm_list)
 65		goto out;
 66	memcpy(id->prod_nr, "LNXAPPL", 7);
 67	id->prod_fn = myhdr->applid;
 68	id->record_nr = myhdr->record_num;
 69	id->version_nr = myhdr->version;
 70	id->release_nr = myhdr->release;
 71	id->mod_lvl = myhdr->mod_level;
 72	rc = appldata_asm(parm_list, id, fcn,
 73			  (void *) buffer, myhdr->datalen);
 74	if (rc <= 0)
 75		goto out;
 76	pr_err("Writing monitor data failed with rc=%i\n", rc);
 77	rc = (rc == 5) ? -EPERM : -EINVAL;
 78out:
 79	kfree(id);
 80	kfree(parm_list);
 81	return rc;
 82}
 83
 84static struct mon_buf *monwrite_find_hdr(struct mon_private *monpriv,
 85					 struct monwrite_hdr *monhdr)
 86{
 87	struct mon_buf *entry, *next;
 88
 89	list_for_each_entry_safe(entry, next, &monpriv->list, list)
 90		if ((entry->hdr.mon_function == monhdr->mon_function ||
 91		     monhdr->mon_function == MONWRITE_STOP_INTERVAL) &&
 92		    entry->hdr.applid == monhdr->applid &&
 93		    entry->hdr.record_num == monhdr->record_num &&
 94		    entry->hdr.version == monhdr->version &&
 95		    entry->hdr.release == monhdr->release &&
 96		    entry->hdr.mod_level == monhdr->mod_level)
 97			return entry;
 98
 99	return NULL;
100}
101
102static int monwrite_new_hdr(struct mon_private *monpriv)
103{
104	struct monwrite_hdr *monhdr = &monpriv->hdr;
105	struct mon_buf *monbuf;
106	int rc = 0;
107
108	if (monhdr->datalen > MONWRITE_MAX_DATALEN ||
109	    monhdr->mon_function > MONWRITE_START_CONFIG ||
110	    monhdr->hdrlen != sizeof(struct monwrite_hdr))
111		return -EINVAL;
112	monbuf = NULL;
113	if (monhdr->mon_function != MONWRITE_GEN_EVENT)
114		monbuf = monwrite_find_hdr(monpriv, monhdr);
115	if (monbuf) {
116		if (monhdr->mon_function == MONWRITE_STOP_INTERVAL) {
117			monhdr->datalen = monbuf->hdr.datalen;
118			rc = monwrite_diag(monhdr, monbuf->data,
119					   APPLDATA_STOP_REC);
120			list_del(&monbuf->list);
121			mon_buf_count--;
122			kfree(monbuf->data);
123			kfree(monbuf);
124			monbuf = NULL;
125		}
126	} else if (monhdr->mon_function != MONWRITE_STOP_INTERVAL) {
127		if (mon_buf_count >= mon_max_bufs)
128			return -ENOSPC;
129		monbuf = kzalloc(sizeof(struct mon_buf), GFP_KERNEL);
130		if (!monbuf)
131			return -ENOMEM;
132		monbuf->data = kzalloc(monhdr->datalen,
133				       GFP_KERNEL | GFP_DMA);
134		if (!monbuf->data) {
135			kfree(monbuf);
136			return -ENOMEM;
137		}
138		monbuf->hdr = *monhdr;
139		list_add_tail(&monbuf->list, &monpriv->list);
140		if (monhdr->mon_function != MONWRITE_GEN_EVENT)
141			mon_buf_count++;
142	}
143	monpriv->current_buf = monbuf;
144	return rc;
145}
146
147static int monwrite_new_data(struct mon_private *monpriv)
148{
149	struct monwrite_hdr *monhdr = &monpriv->hdr;
150	struct mon_buf *monbuf = monpriv->current_buf;
151	int rc = 0;
152
153	switch (monhdr->mon_function) {
154	case MONWRITE_START_INTERVAL:
155		if (!monbuf->diag_done) {
156			rc = monwrite_diag(monhdr, monbuf->data,
157					   APPLDATA_START_INTERVAL_REC);
158			monbuf->diag_done = 1;
159		}
160		break;
161	case MONWRITE_START_CONFIG:
162		if (!monbuf->diag_done) {
163			rc = monwrite_diag(monhdr, monbuf->data,
164					   APPLDATA_START_CONFIG_REC);
165			monbuf->diag_done = 1;
166		}
167		break;
168	case MONWRITE_GEN_EVENT:
169		rc = monwrite_diag(monhdr, monbuf->data,
170				   APPLDATA_GEN_EVENT_REC);
171		list_del(&monpriv->current_buf->list);
172		kfree(monpriv->current_buf->data);
173		kfree(monpriv->current_buf);
174		monpriv->current_buf = NULL;
175		break;
176	default:
177		/* monhdr->mon_function is checked in monwrite_new_hdr */
178		BUG();
179	}
180	return rc;
181}
182
183/*
184 * file operations
185 */
186
187static int monwrite_open(struct inode *inode, struct file *filp)
188{
189	struct mon_private *monpriv;
190
191	monpriv = kzalloc(sizeof(struct mon_private), GFP_KERNEL);
192	if (!monpriv)
193		return -ENOMEM;
194	INIT_LIST_HEAD(&monpriv->list);
195	monpriv->hdr_to_read = sizeof(monpriv->hdr);
196	mutex_init(&monpriv->thread_mutex);
197	filp->private_data = monpriv;
 
198	return nonseekable_open(inode, filp);
199}
200
201static int monwrite_close(struct inode *inode, struct file *filp)
202{
203	struct mon_private *monpriv = filp->private_data;
204	struct mon_buf *entry, *next;
205
206	list_for_each_entry_safe(entry, next, &monpriv->list, list) {
207		if (entry->hdr.mon_function != MONWRITE_GEN_EVENT)
208			monwrite_diag(&entry->hdr, entry->data,
209				      APPLDATA_STOP_REC);
210		mon_buf_count--;
211		list_del(&entry->list);
212		kfree(entry->data);
213		kfree(entry);
214	}
 
215	kfree(monpriv);
216	return 0;
217}
218
219static ssize_t monwrite_write(struct file *filp, const char __user *data,
220			      size_t count, loff_t *ppos)
221{
222	struct mon_private *monpriv = filp->private_data;
223	size_t len, written;
224	void *to;
225	int rc;
226
227	mutex_lock(&monpriv->thread_mutex);
228	for (written = 0; written < count; ) {
229		if (monpriv->hdr_to_read) {
230			len = min(count - written, monpriv->hdr_to_read);
231			to = (char *) &monpriv->hdr +
232				sizeof(monpriv->hdr) - monpriv->hdr_to_read;
233			if (copy_from_user(to, data + written, len)) {
234				rc = -EFAULT;
235				goto out_error;
236			}
237			monpriv->hdr_to_read -= len;
238			written += len;
239			if (monpriv->hdr_to_read > 0)
240				continue;
241			rc = monwrite_new_hdr(monpriv);
242			if (rc)
243				goto out_error;
244			monpriv->data_to_read = monpriv->current_buf ?
245				monpriv->current_buf->hdr.datalen : 0;
246		}
247
248		if (monpriv->data_to_read) {
249			len = min(count - written, monpriv->data_to_read);
250			to = monpriv->current_buf->data +
251				monpriv->hdr.datalen - monpriv->data_to_read;
252			if (copy_from_user(to, data + written, len)) {
253				rc = -EFAULT;
254				goto out_error;
255			}
256			monpriv->data_to_read -= len;
257			written += len;
258			if (monpriv->data_to_read > 0)
259				continue;
260			rc = monwrite_new_data(monpriv);
261			if (rc)
262				goto out_error;
263		}
264		monpriv->hdr_to_read = sizeof(monpriv->hdr);
265	}
266	mutex_unlock(&monpriv->thread_mutex);
267	return written;
268
269out_error:
270	monpriv->data_to_read = 0;
271	monpriv->hdr_to_read = sizeof(struct monwrite_hdr);
272	mutex_unlock(&monpriv->thread_mutex);
273	return rc;
274}
275
276static const struct file_operations monwrite_fops = {
277	.owner	 = THIS_MODULE,
278	.open	 = &monwrite_open,
279	.release = &monwrite_close,
280	.write	 = &monwrite_write,
281	.llseek  = noop_llseek,
282};
283
284static struct miscdevice mon_dev = {
285	.name	= "monwriter",
286	.fops	= &monwrite_fops,
287	.minor	= MISC_DYNAMIC_MINOR,
288};
289
290/*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291 * module init/exit
292 */
293
294static int __init mon_init(void)
295{
 
 
296	if (!MACHINE_IS_VM)
297		return -ENODEV;
 
 
 
 
 
 
 
 
 
 
 
 
298	/*
299	 * misc_register() has to be the last action in module_init(), because
300	 * file operations will be available right after this.
301	 */
302	return misc_register(&mon_dev);
 
 
 
 
 
 
 
 
 
303}
304
305static void __exit mon_exit(void)
306{
307	misc_deregister(&mon_dev);
 
 
308}
309
310module_init(mon_init);
311module_exit(mon_exit);
312
313module_param_named(max_bufs, mon_max_bufs, int, 0644);
314MODULE_PARM_DESC(max_bufs, "Maximum number of sample monitor data buffers "
315		 "that can be active at one time");
316
317MODULE_AUTHOR("Melissa Howland <Melissa.Howland@us.ibm.com>");
318MODULE_DESCRIPTION("Character device driver for writing z/VM "
319		   "APPLDATA monitor records.");
320MODULE_LICENSE("GPL");