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 @@ ...@@ -39,6 +39,8 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/bug.h> #include <asm/bug.h>
...@@ -152,6 +154,33 @@ static spinlock_t viocd_reqlock; ...@@ -152,6 +154,33 @@ static spinlock_t viocd_reqlock;
#define MAX_CD_REQ 1 #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) static int viocd_blk_open(struct inode *inode, struct file *file)
{ {
struct disk_info *di = inode->i_bdev->bd_disk->private_data; struct disk_info *di = inode->i_bdev->bd_disk->private_data;
...@@ -541,6 +570,7 @@ static int __init viocd_init(void) ...@@ -541,6 +570,7 @@ static int __init viocd_init(void)
struct gendisk *gendisk; struct gendisk *gendisk;
int deviceno; int deviceno;
int ret = 0; int ret = 0;
struct proc_dir_entry *e;
if (viopath_hostLp == HvLpIndexInvalid) { if (viopath_hostLp == HvLpIndexInvalid) {
vio_set_hostlp(); vio_set_hostlp();
...@@ -629,6 +659,12 @@ static int __init viocd_init(void) ...@@ -629,6 +659,12 @@ static int __init viocd_init(void)
add_disk(gendisk); 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; return 0;
out_undo_vio: out_undo_vio:
...@@ -643,6 +679,7 @@ static void __exit viocd_exit(void) ...@@ -643,6 +679,7 @@ static void __exit viocd_exit(void)
{ {
int deviceno; int deviceno;
remove_proc_entry("iSeries/viocd", NULL);
for (deviceno = 0; deviceno < viocd_numdev; deviceno++) { for (deviceno = 0; deviceno < viocd_numdev; deviceno++) {
struct disk_info *d = &viocd_diskinfo[deviceno]; struct disk_info *d = &viocd_diskinfo[deviceno];
if (unregister_cdrom(&d->viocd_info) != 0) if (unregister_cdrom(&d->viocd_info) != 0)
......
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <linux/major.h> #include <linux/major.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/ioctls.h> #include <asm/ioctls.h>
...@@ -56,7 +58,7 @@ ...@@ -56,7 +58,7 @@
#include <asm/iSeries/HvCallEvent.h> #include <asm/iSeries/HvCallEvent.h>
#include <asm/iSeries/HvLpConfig.h> #include <asm/iSeries/HvLpConfig.h>
#define VIOTAPE_VERSION "1.1" #define VIOTAPE_VERSION "1.2"
#define VIOTAPE_MAXREQ 1 #define VIOTAPE_MAXREQ 1
#define VIOTAPE_KERN_WARN KERN_WARNING "viotape: " #define VIOTAPE_KERN_WARN KERN_WARNING "viotape: "
...@@ -269,6 +271,34 @@ static struct op_struct *op_struct_list; ...@@ -269,6 +271,34 @@ static struct op_struct *op_struct_list;
/* forward declaration to resolve interdependence */ /* forward declaration to resolve interdependence */
static int chg_state(int index, unsigned char new_state, struct file *file); 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 */ /* Decode the device minor number into its parts */
void get_dev_info(struct inode *ino, struct viot_devinfo_struct *devi) void get_dev_info(struct inode *ino, struct viot_devinfo_struct *devi)
{ {
...@@ -912,6 +942,7 @@ int __init viotap_init(void) ...@@ -912,6 +942,7 @@ int __init viotap_init(void)
int ret; int ret;
char tapename[32]; char tapename[32];
int i; int i;
struct proc_dir_entry *e;
op_struct_list = NULL; op_struct_list = NULL;
if ((ret = add_op_structs(VIOTAPE_MAXREQ)) < 0) { if ((ret = add_op_structs(VIOTAPE_MAXREQ)) < 0) {
...@@ -988,6 +1019,12 @@ int __init viotap_init(void) ...@@ -988,6 +1019,12 @@ int __init viotap_init(void)
viotape_unitinfo[i].model); 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; return 0;
unreg_class: unreg_class:
...@@ -1029,6 +1066,8 @@ static void __exit viotap_exit(void) ...@@ -1029,6 +1066,8 @@ static void __exit viotap_exit(void)
{ {
int i, ret; int i, ret;
remove_proc_entry("iSeries/viotape", NULL);
for (i = 0; i < viotape_numdev; ++i) { for (i = 0; i < viotape_numdev; ++i) {
devfs_remove("iseries/nvt%d", i); devfs_remove("iseries/nvt%d", i);
devfs_remove("iseries/vt%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