patch-2.4.0-test9 linux/drivers/macintosh/nvram.c
Next file: linux/drivers/macintosh/rtc.c
Previous file: linux/drivers/macintosh/mediabay.c
Back to the patch index
Back to the overall index
- Lines: 45
- Date:
Sun Sep 17 09:48:05 2000
- Orig file:
v2.4.0-test8/linux/drivers/macintosh/nvram.c
- Orig date:
Tue Jun 20 13:58:42 2000
diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/nvram.c linux/drivers/macintosh/nvram.c
@@ -14,6 +14,7 @@
#include <linux/nvram.h>
#include <linux/init.h>
#include <asm/uaccess.h>
+#include <asm/nvram.h>
#define NVRAM_SIZE 8192
@@ -70,11 +71,36 @@
return p - buf;
}
+static int nvram_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ switch(cmd) {
+ case PMAC_NVRAM_GET_OFFSET:
+ {
+ int part, offset;
+ if (copy_from_user(&part,(void*)arg,sizeof(part))!=0)
+ return -EFAULT;
+ if (part < pmac_nvram_OF || part > pmac_nvram_NR)
+ return -EINVAL;
+ offset = pmac_get_partition(part);
+ if (copy_to_user((void*)arg,&offset,sizeof(offset))!=0)
+ return -EFAULT;
+ break;
+ }
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
struct file_operations nvram_fops = {
owner: THIS_MODULE,
llseek: nvram_llseek,
read: read_nvram,
write: write_nvram,
+ ioctl: nvram_ioctl,
};
static struct miscdevice nvram_dev = {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)