X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fsparc64%2Fsolaris%2Ftimod.c;h=a9d32ceabf26e5bed3c6cf2dc2810a2d94e2a07d;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=24de5062079fc823dbb8acc3cf9103643bcd8019;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c index 24de50620..a9d32ceab 100644 --- a/arch/sparc64/solaris/timod.c +++ b/arch/sparc64/solaris/timod.c @@ -29,7 +29,7 @@ asmlinkage int solaris_ioctl(unsigned int fd, unsigned int cmd, u32 arg); -static spinlock_t timod_pagelock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(timod_pagelock); static char * page = NULL ; #ifndef DEBUG_SOLARIS_KMALLOC @@ -39,7 +39,7 @@ static char * page = NULL ; #else -void * mykmalloc(size_t s, int gfp) +void * mykmalloc(size_t s, gfp_t gfp) { static char * page; static size_t free; @@ -143,9 +143,11 @@ static struct T_primsg *timod_mkctl(int size) static void timod_wake_socket(unsigned int fd) { struct socket *sock; + struct fdtable *fdt; SOLD("wakeing socket"); - sock = SOCKET_I(current->files->fd[fd]->f_dentry->d_inode); + fdt = files_fdtable(current->files); + sock = SOCKET_I(fdt->fd[fd]->f_path.dentry->d_inode); wake_up_interruptible(&sock->wait); read_lock(&sock->sk->sk_callback_lock); if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) @@ -157,9 +159,11 @@ static void timod_wake_socket(unsigned int fd) static void timod_queue(unsigned int fd, struct T_primsg *it) { struct sol_socket_struct *sock; + struct fdtable *fdt; SOLD("queuing primsg"); - sock = (struct sol_socket_struct *)current->files->fd[fd]->private_data; + fdt = files_fdtable(current->files); + sock = (struct sol_socket_struct *)fdt->fd[fd]->private_data; it->next = sock->pfirst; sock->pfirst = it; if (!sock->plast) @@ -171,9 +175,11 @@ static void timod_queue(unsigned int fd, struct T_primsg *it) static void timod_queue_end(unsigned int fd, struct T_primsg *it) { struct sol_socket_struct *sock; + struct fdtable *fdt; SOLD("queuing primsg at end"); - sock = (struct sol_socket_struct *)current->files->fd[fd]->private_data; + fdt = files_fdtable(current->files); + sock = (struct sol_socket_struct *)fdt->fd[fd]->private_data; it->next = NULL; if (sock->plast) sock->plast->next = it; @@ -344,6 +350,7 @@ int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len, char *buf; struct file *filp; struct inode *ino; + struct fdtable *fdt; struct sol_socket_struct *sock; mm_segment_t old_fs = get_fs(); long args[6]; @@ -351,8 +358,10 @@ int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len, (int (*)(int, unsigned long __user *))SYS(socketcall); int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int) = (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int))SYS(sendto); - filp = current->files->fd[fd]; - ino = filp->f_dentry->d_inode; + + fdt = files_fdtable(current->files); + filp = fdt->fd[fd]; + ino = filp->f_path.dentry->d_inode; sock = (struct sol_socket_struct *)filp->private_data; SOLD("entry"); if (get_user(ret, (int __user *)A(ctl_buf))) @@ -620,6 +629,7 @@ int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __us int oldflags; struct file *filp; struct inode *ino; + struct fdtable *fdt; struct sol_socket_struct *sock; struct T_unitdata_ind udi; mm_segment_t old_fs = get_fs(); @@ -632,8 +642,9 @@ int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __us SOLD("entry"); SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p)); - filp = current->files->fd[fd]; - ino = filp->f_dentry->d_inode; + fdt = files_fdtable(current->files); + filp = fdt->fd[fd]; + ino = filp->f_path.dentry->d_inode; sock = (struct sol_socket_struct *)filp->private_data; SOLDD(("%p %p\n", sock->pfirst, sock->pfirst ? sock->pfirst->next : NULL)); if ( ctl_maxlen > 0 && !sock->pfirst && SOCKET_I(ino)->type == SOCK_STREAM @@ -844,18 +855,18 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) int __user *flgptr; int flags; int error = -EBADF; + struct fdtable *fdt; SOLD("entry"); lock_kernel(); if(fd >= NR_OPEN) goto out; - filp = current->files->fd[fd]; + fdt = files_fdtable(current->files); + filp = fdt->fd[fd]; if(!filp) goto out; - ino = filp->f_dentry->d_inode; - if (!ino) goto out; - - if (!ino->i_sock) + ino = filp->f_path.dentry->d_inode; + if (!ino || !S_ISSOCK(ino->i_mode)) goto out; ctlptr = (struct strbuf __user *)A(arg1); @@ -912,18 +923,20 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) struct strbuf ctl, dat; int flags = (int) arg3; int error = -EBADF; + struct fdtable *fdt; SOLD("entry"); lock_kernel(); if(fd >= NR_OPEN) goto out; - filp = current->files->fd[fd]; + fdt = files_fdtable(current->files); + filp = fdt->fd[fd]; if(!filp) goto out; - ino = filp->f_dentry->d_inode; + ino = filp->f_path.dentry->d_inode; if (!ino) goto out; - if (!ino->i_sock && + if (!S_ISSOCK(ino->i_mode) && (imajor(ino) != 30 || iminor(ino) != 1)) goto out;