Commit cec75551 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc64: add some iSeries proc entries

From: Stephen Rothwell <sfr@canb.auug.org.au>

This patch just adds some proc entries for the virtual tape and cdrom
drivers to allow mapping between linux devices and OS/400 ones.  This is
expected by existing users and there is no other way to do this
translation.
parent 32419a40
......@@ -39,6 +39,8 @@
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/completion.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/bug.h>
......@@ -152,6 +154,33 @@ static spinlock_t viocd_reqlock;
#define MAX_CD_REQ 1
/* procfs support */
static int proc_viocd_show(struct seq_file *m, void *v)
{
int i;
for (i = 0; i < viocd_numdev; i++) {
seq_printf(m, "viocd device %d is iSeries resource %10.10s"
"type %4.4s, model %3.3s\n",
i, viocd_unitinfo[i].rsrcname,
viocd_unitinfo[i].type,
viocd_unitinfo[i].model);
}
return 0;
}
static int proc_viocd_open(struct inode *inode, struct file *file)
{
return single_open(file, proc_viocd_show, NULL);
}
static struct file_operations proc_viocd_operations = {
.open = proc_viocd_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int viocd_blk_open(struct inode *inode, struct file *file)
{
struct disk_info *di = inode->i_bdev->bd_disk->private_data;
......@@ -541,6 +570,7 @@ static int __init viocd_init(void)
struct gendisk *gendisk;
int deviceno;
int ret = 0;
struct proc_dir_entry *e;
if (viopath_hostLp == HvLpIndexInvalid) {
vio_set_hostlp();
......@@ -629,6 +659,12 @@ static int __init viocd_init(void)
add_disk(gendisk);
}
e = create_proc_entry("iSeries/viocd", S_IFREG|S_IRUGO, NULL);
if (e) {
e->owner = THIS_MODULE;
e->proc_fops = &proc_viocd_operations;
}
return 0;
out_undo_vio:
......@@ -643,6 +679,7 @@ static void __exit viocd_exit(void)
{
int deviceno;
remove_proc_entry("iSeries/viocd", NULL);
for (deviceno = 0; deviceno < viocd_numdev; deviceno++) {
struct disk_info *d = &viocd_diskinfo[deviceno];
if (unregister_cdrom(&d->viocd_info) != 0)
......
......@@ -47,6 +47,8 @@
#include <linux/devfs_fs_kernel.h>
#include <linux/major.h>
#include <linux/completion.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
#include <asm/ioctls.h>
......@@ -56,7 +58,7 @@
#include <asm/iSeries/HvCallEvent.h>
#include <asm/iSeries/HvLpConfig.h>
#define VIOTAPE_VERSION "1.1"
#define VIOTAPE_VERSION "1.2"
#define VIOTAPE_MAXREQ 1
#define VIOTAPE_KERN_WARN KERN_WARNING "viotape: "
......@@ -269,6 +271,34 @@ static struct op_struct *op_struct_list;
/* forward declaration to resolve interdependence */
static int chg_state(int index, unsigned char new_state, struct file *file);
/* procfs support */
static int proc_viotape_show(struct seq_file *m, void *v)
{
int i;
seq_printf(m, "viotape driver version " VIOTAPE_VERSION "\n");
for (i = 0; i < viotape_numdev; i++) {
seq_printf(m, "viotape device %d is iSeries resource %10.10s"
"type %4.4s, model %3.3s\n",
i, viotape_unitinfo[i].rsrcname,
viotape_unitinfo[i].type,
viotape_unitinfo[i].model);
}
return 0;
}
static int proc_viotape_open(struct inode *inode, struct file *file)
{
return single_open(file, proc_viotape_show, NULL);
}
static struct file_operations proc_viotape_operations = {
.open = proc_viotape_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* Decode the device minor number into its parts */
void get_dev_info(struct inode *ino, struct viot_devinfo_struct *devi)
{
......@@ -912,6 +942,7 @@ int __init viotap_init(void)
int ret;
char tapename[32];
int i;
struct proc_dir_entry *e;
op_struct_list = NULL;
if ((ret = add_op_structs(VIOTAPE_MAXREQ)) < 0) {
......@@ -988,6 +1019,12 @@ int __init viotap_init(void)
viotape_unitinfo[i].model);
}
e = create_proc_entry("iSeries/viotape", S_IFREG|S_IRUGO, NULL);
if (e) {
e->owner = THIS_MODULE;
e->proc_fops = &proc_viotape_operations;
}
return 0;
unreg_class:
......@@ -1029,6 +1066,8 @@ static void __exit viotap_exit(void)
{
int i, ret;
remove_proc_entry("iSeries/viotape", NULL);
for (i = 0; i < viotape_numdev; ++i) {
devfs_remove("iseries/nvt%d", i);
devfs_remove("iseries/vt%d", i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment