/fs/

pt">); } *ppos = i; return p - buf; } static int nvram_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { switch(cmd) { #ifdef CONFIG_PPC_PMAC case OBSOLETE_PMAC_NVRAM_GET_OFFSET: printk(KERN_WARNING "nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n"); case IOC_NVRAM_GET_OFFSET: { int part, offset; if (!machine_is(powermac)) return -EINVAL; if (copy_from_user(&part, (void __user*)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 __user*)arg, &offset, sizeof(offset)) != 0) return -EFAULT; break; } #endif /* CONFIG_PPC_PMAC */ case IOC_NVRAM_SYNC: nvram_sync(); break; default: return -EINVAL; } return 0; } const 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 = { NVRAM_MINOR, "nvram", &nvram_fops }; int __init nvram_init(void) { printk(KERN_INFO "Macintosh non-volatile memory driver v%s\n", NVRAM_VERSION); return misc_register(&nvram_dev); } void __exit nvram_cleanup(void) { misc_deregister( &nvram_dev ); } module_init(nvram_init); module_exit(nvram_cleanup); MODULE_LICENSE("GPL");