Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- printk("Create surface");
- struct doomdev_ioctl_create_surface surf_arg;
- if (copy_from_user(&surf_arg, (const void __user *) arg, sizeof(struct doomdev_ioctl_create_surface))) {
- return -1;
- }
- printk("Create surface %d x %d", surf_arg.width, surf_arg.height);
- struct surface* mem_for_surface = kmalloc(sizeof(struct surface), GFP_KERNEL);
- if (IS_ERR_OR_NULL(mem_for_surface))
- return -1;
- if (create_surface(dev, mem_for_surface, surf_arg.width, surf_arg.height))
- {
- kfree(mem_for_surface);
- return -1;
- }
- struct file* surface_file = anon_inode_getfile("/doom/surface", &surface_fops, mem_for_surface, 0);
- surface_file->f_mode |= FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE;
- int fd = get_unused_fd_flags(O_CLOEXEC);
- fd_install(fd, surface_file);
- return fd;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement