patch-2.1.4 linux/arch/alpha/kernel/osf_sys.c

Next file: linux/arch/alpha/kernel/signal.c
Previous file: linux/arch/alpha/kernel/entry.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.3/linux/arch/alpha/kernel/osf_sys.c linux/arch/alpha/kernel/osf_sys.c
@@ -35,8 +35,8 @@
 extern int do_mount(kdev_t, const char *, const char *, char *, int, void *);
 extern int do_pipe(int *);
 
-extern struct file_operations * get_blkfops(unsigned int);
-extern struct file_operations * get_chrfops(unsigned int);
+extern struct file_operations *get_blkfops(unsigned int);
+extern struct file_operations *get_chrfops(unsigned int);
 
 extern kdev_t get_unnamed_dev(void);
 extern void put_unnamed_dev(kdev_t);
@@ -55,26 +55,26 @@
 #define ROUND_UP(x) (((x)+3) & ~3)
 
 struct osf_dirent {
-	unsigned int	d_ino;
-	unsigned short	d_reclen;
-	unsigned short	d_namlen;
-	char		d_name[1];
+	unsigned int d_ino;
+	unsigned short d_reclen;
+	unsigned short d_namlen;
+	char d_name[1];
 };
 
 struct osf_dirent_callback {
-	struct osf_dirent * dirent;
+	struct osf_dirent *dirent;
 	long *basep;
 	int count;
 	int error;
 };
 
-static int osf_filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino)
+static int osf_filldir(void *__buf, const char *name, int namlen, off_t offset, ino_t ino)
 {
-	struct osf_dirent * dirent;
-	struct osf_dirent_callback * buf = (struct osf_dirent_callback *) __buf;
+	struct osf_dirent *dirent;
+	struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
-	buf->error = -EINVAL;		/* only used if we fail */
+	buf->error = -EINVAL;	/* only used if we fail */
 	if (reclen > buf->count)
 		return -EINVAL;
 	if (buf->basep) {
@@ -85,19 +85,19 @@
 	put_user(ino, &dirent->d_ino);
 	put_user(namlen, &dirent->d_namlen);
 	put_user(reclen, &dirent->d_reclen);
-	memcpy_tofs(dirent->d_name, name, namlen);
-	put_fs_byte(0, dirent->d_name + namlen);
+	copy_to_user(dirent->d_name, name, namlen);
+	put_user(0, dirent->d_name + namlen);
 	((char *) dirent) += reclen;
 	buf->dirent = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
-asmlinkage int osf_getdirentries(unsigned int fd, struct osf_dirent * dirent,
-	unsigned int count, long *basep)
+asmlinkage int osf_getdirentries(unsigned int fd, struct osf_dirent *dirent,
+				 unsigned int count, long *basep)
 {
 	int error;
-	struct file * file;
+	struct file *file;
 	struct osf_dirent_callback buf;
 
 	if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
@@ -138,7 +138,7 @@
 	if (prio < 0)
 		return prio;
 
-	regs.r0 = 0; /* special return: no errors */
+	regs.r0 = 0;		/* special return: no errors */
 	return 20 - prio;
 }
 
@@ -152,31 +152,31 @@
 }
 
 asmlinkage unsigned long sys_getxuid(int a0, int a1, int a2, int a3, int a4, int a5,
-	struct pt_regs regs)
+				     struct pt_regs regs)
 {
 	(&regs)->r20 = current->euid;
 	return current->uid;
 }
 
 asmlinkage unsigned long sys_getxgid(int a0, int a1, int a2, int a3, int a4, int a5,
-	struct pt_regs regs)
+				     struct pt_regs regs)
 {
 	(&regs)->r20 = current->egid;
 	return current->gid;
 }
 
 asmlinkage unsigned long sys_getxpid(int a0, int a1, int a2, int a3, int a4, int a5,
-	struct pt_regs regs)
+				     struct pt_regs regs)
 {
 	(&regs)->r20 = current->p_opptr->pid;
 	return current->pid;
 }
 
 asmlinkage unsigned long osf_mmap(unsigned long addr, unsigned long len,
-	unsigned long prot, unsigned long flags, unsigned long fd,
-	unsigned long off)
+	       unsigned long prot, unsigned long flags, unsigned long fd,
+				  unsigned long off)
 {
-	struct file * file = NULL;
+	struct file *file = NULL;
 
 	if (flags & (MAP_HASSEMAPHORE | MAP_INHERIT | MAP_UNALIGNED))
 		printk("%s: unimplemented OSF mmap flags %04lx\n", current->comm, flags);
@@ -194,42 +194,42 @@
  * match the beginning, at least.
  */
 struct osf_statfs {
-	short	f_type;
-	short	f_flags;
-	int	f_fsize;
-	int	f_bsize;
-	int	f_blocks;
-	int	f_bfree;
-	int	f_bavail;
-	int	f_files;
-	int	f_ffree;
+	short f_type;
+	short f_flags;
+	int f_fsize;
+	int f_bsize;
+	int f_blocks;
+	int f_bfree;
+	int f_bavail;
+	int f_files;
+	int f_ffree;
 	__kernel_fsid_t f_fsid;
-} * osf_stat;
+} *osf_stat;
 
-static void linux_to_osf_statfs (struct statfs * linux_stat, struct osf_statfs * osf_stat)
+static void linux_to_osf_statfs(struct statfs *linux_stat, struct osf_statfs *osf_stat)
 {
-	osf_stat->f_type   = linux_stat->f_type;
-	osf_stat->f_flags  = 0;	/* mount flags */
+	osf_stat->f_type = linux_stat->f_type;
+	osf_stat->f_flags = 0;	/* mount flags */
 	/* Linux doesn't provide a "fundamental filesystem block size": */
-	osf_stat->f_fsize  = linux_stat->f_bsize;
-	osf_stat->f_bsize  = linux_stat->f_bsize;
+	osf_stat->f_fsize = linux_stat->f_bsize;
+	osf_stat->f_bsize = linux_stat->f_bsize;
 	osf_stat->f_blocks = linux_stat->f_blocks;
-	osf_stat->f_bfree  = linux_stat->f_bfree;
+	osf_stat->f_bfree = linux_stat->f_bfree;
 	osf_stat->f_bavail = linux_stat->f_bavail;
-	osf_stat->f_files  = linux_stat->f_files;
-	osf_stat->f_ffree  = linux_stat->f_ffree;
-	osf_stat->f_fsid   = linux_stat->f_fsid;
+	osf_stat->f_files = linux_stat->f_files;
+	osf_stat->f_ffree = linux_stat->f_ffree;
+	osf_stat->f_fsid = linux_stat->f_fsid;
 }
 
 
-asmlinkage int osf_statfs(char * path, struct osf_statfs * buffer, unsigned long bufsiz)
+asmlinkage int osf_statfs(char *path, struct osf_statfs *buffer, unsigned long bufsiz)
 {
 	struct statfs linux_stat;
-	struct inode * inode;
+	struct inode *inode;
 	int retval;
 
 	if (bufsiz > sizeof(struct osf_statfs))
-		bufsiz = sizeof(struct osf_statfs);
+		 bufsiz = sizeof(struct osf_statfs);
 	retval = verify_area(VERIFY_WRITE, buffer, bufsiz);
 	if (retval)
 		return retval;
@@ -246,18 +246,18 @@
 	return 0;
 }
 
-asmlinkage int osf_fstatfs(unsigned long fd, struct osf_statfs * buffer, unsigned long bufsiz)
+asmlinkage int osf_fstatfs(unsigned long fd, struct osf_statfs *buffer, unsigned long bufsiz)
 {
 	struct statfs linux_stat;
-	struct file * file;
-	struct inode * inode;
+	struct file *file;
+	struct inode *inode;
 	int retval;
 
 	retval = verify_area(VERIFY_WRITE, buffer, bufsiz);
 	if (retval)
 		return retval;
 	if (bufsiz > sizeof(struct osf_statfs))
-		bufsiz = sizeof(struct osf_statfs);
+		 bufsiz = sizeof(struct osf_statfs);
 	if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
 		return -EBADF;
 	if (!(inode = file->f_inode))
@@ -275,13 +275,13 @@
  * Although to be frank, neither are the native Linux/i386 ones..
  */
 struct ufs_args {
-	char * devname;
+	char *devname;
 	int flags;
 	uid_t exroot;
 };
 
 struct cdfs_args {
-	char * devname;
+	char *devname;
 	int flags;
 	uid_t exroot;
 /*
@@ -291,16 +291,16 @@
 };
 
 struct procfs_args {
-	char * devname;
+	char *devname;
 	int flags;
 	uid_t exroot;
 };
 
-static int getdev(const char * name, int rdonly, struct inode ** ino)
+static int getdev(const char *name, int rdonly, struct inode **ino)
 {
 	kdev_t dev;
-	struct inode * inode;
-	struct file_operations * fops;
+	struct inode *inode;
+	struct file_operations *fops;
 	int retval;
 
 	retval = namei(name, &inode);
@@ -339,9 +339,9 @@
 	return 0;
 }
 
-static void putdev(struct inode * inode)
+static void putdev(struct inode *inode)
 {
-	struct file_operations * fops;
+	struct file_operations *fops;
 
 	fops = get_blkfops(MAJOR(inode->i_rdev));
 	if (fops->release)
@@ -353,16 +353,16 @@
  * ext2fs mounts... I wouldn't mind a UFS filesystem, but the UFS
  * layout is so braindead it's a major headache doing it..
  */
-static int osf_ufs_mount(char * dirname, struct ufs_args * args, int flags)
+static int osf_ufs_mount(char *dirname, struct ufs_args *args, int flags)
 {
 	int retval;
-	struct inode * inode;
+	struct inode *inode;
 	struct cdfs_args tmp;
 
 	retval = verify_area(VERIFY_READ, args, sizeof(*args));
 	if (retval)
 		return retval;
-	memcpy_fromfs(&tmp, args, sizeof(tmp));
+	copy_from_user(&tmp, args, sizeof(tmp));
 	retval = getdev(tmp.devname, 0, &inode);
 	if (retval)
 		return retval;
@@ -373,16 +373,16 @@
 	return retval;
 }
 
-static int osf_cdfs_mount(char * dirname, struct cdfs_args * args, int flags)
+static int osf_cdfs_mount(char *dirname, struct cdfs_args *args, int flags)
 {
 	int retval;
-	struct inode * inode;
+	struct inode *inode;
 	struct cdfs_args tmp;
 
 	retval = verify_area(VERIFY_READ, args, sizeof(*args));
 	if (retval)
 		return retval;
-	memcpy_fromfs(&tmp, args, sizeof(tmp));
+	copy_from_user(&tmp, args, sizeof(tmp));
 	retval = getdev(tmp.devname, 1, &inode);
 	if (retval)
 		return retval;
@@ -393,7 +393,7 @@
 	return retval;
 }
 
-static int osf_procfs_mount(char * dirname, struct procfs_args * args, int flags)
+static int osf_procfs_mount(char *dirname, struct procfs_args *args, int flags)
 {
 	kdev_t dev;
 	int retval;
@@ -402,7 +402,7 @@
 	retval = verify_area(VERIFY_READ, args, sizeof(*args));
 	if (retval)
 		return retval;
-	memcpy_fromfs(&tmp, args, sizeof(tmp));
+	copy_from_user(&tmp, args, sizeof(tmp));
 	dev = get_unnamed_dev();
 	if (!dev)
 		return -ENODEV;
@@ -412,28 +412,28 @@
 	return retval;
 }
 
-asmlinkage int osf_mount(unsigned long typenr, char * path, int flag, void * data)
+asmlinkage int osf_mount(unsigned long typenr, char *path, int flag, void *data)
 {
 	int retval;
 
 	retval = -EINVAL;
 	switch (typenr) {
-		case 1:
-			retval = osf_ufs_mount(path, (struct ufs_args *) data, flag);
-			break;
-		case 6:
-			retval = osf_cdfs_mount(path, (struct cdfs_args *) data, flag);
-			break;
-		case 9:
-			retval = osf_procfs_mount(path, (struct procfs_args *) data, flag);
-			break;
-		default:
-			printk("osf_mount(%ld, %x)\n", typenr, flag);
+	case 1:
+		retval = osf_ufs_mount(path, (struct ufs_args *) data, flag);
+		break;
+	case 6:
+		retval = osf_cdfs_mount(path, (struct cdfs_args *) data, flag);
+		break;
+	case 9:
+		retval = osf_procfs_mount(path, (struct procfs_args *) data, flag);
+		break;
+	default:
+		printk("osf_mount(%ld, %x)\n", typenr, flag);
 	}
 	return retval;
 }
 
-asmlinkage int osf_umount(char * path, int flag)
+asmlinkage int osf_umount(char *path, int flag)
 {
 	return sys_umount(path);
 }
@@ -443,7 +443,7 @@
  * seems to be a timeval pointer, and I suspect the second
  * one is the time remaining.. Ho humm.. No documentation.
  */
-asmlinkage int osf_usleep_thread(struct timeval * sleep, struct timeval * remain)
+asmlinkage int osf_usleep_thread(struct timeval *sleep, struct timeval *remain)
 {
 	struct timeval tmp;
 	unsigned long ticks;
@@ -454,7 +454,7 @@
 		return retval;
 	if (remain && (retval = verify_area(VERIFY_WRITE, remain, sizeof(*remain))))
 		return retval;
-	memcpy_fromfs(&tmp, sleep, sizeof(*sleep));
+	copy_from_user(&tmp, sleep, sizeof(*sleep));
 	ticks = tmp.tv_usec;
 	ticks = (ticks + (1000000 / HZ) - 1) / (1000000 / HZ);
 	ticks += tmp.tv_sec * HZ;
@@ -471,24 +471,24 @@
 	current->timeout = 0;
 	tmp.tv_sec = ticks / HZ;
 	tmp.tv_usec = ticks % HZ;
-	memcpy_tofs(remain, &tmp, sizeof(*remain));
+	copy_to_user(remain, &tmp, sizeof(*remain));
 	return 0;
 }
 
-asmlinkage int osf_utsname(char * name)
+asmlinkage int osf_utsname(char *name)
 {
-	int error = verify_area(VERIFY_WRITE, name, 5*32);
+	int error = verify_area(VERIFY_WRITE, name, 5 * 32);
 	if (error)
 		return error;
-	memcpy_tofs(name +   0, system_utsname.sysname, 32);
-	memcpy_tofs(name +  32, system_utsname.nodename, 32);
-	memcpy_tofs(name +  64, system_utsname.release, 32);
-	memcpy_tofs(name +  96, system_utsname.version, 32);
-	memcpy_tofs(name + 128, system_utsname.machine, 32);
+	copy_to_user(name + 0, system_utsname.sysname, 32);
+	copy_to_user(name + 32, system_utsname.nodename, 32);
+	copy_to_user(name + 64, system_utsname.release, 32);
+	copy_to_user(name + 96, system_utsname.version, 32);
+	copy_to_user(name + 128, system_utsname.machine, 32);
 	return 0;
 }
 
-asmlinkage int osf_swapon(const char * path, int flags, int lowat, int hiwat)
+asmlinkage int osf_swapon(const char *path, int flags, int lowat, int hiwat)
 {
 	/* for now, simply ignore lowat and hiwat... */
 	return sys_swapon(path, flags);
@@ -505,7 +505,7 @@
 }
 
 asmlinkage int sys_pipe(int a0, int a1, int a2, int a3, int a4, int a5,
-	struct pt_regs regs)
+			struct pt_regs regs)
 {
 	int fd[2];
 	int error;
@@ -531,12 +531,12 @@
 
 	len = namelen;
 	if (namelen > 32)
-	  len = 32;
+		len = 32;
 
 	for (i = 0; i < len; ++i) {
 		put_user(system_utsname.domainname[i], name + i);
 		if (system_utsname.domainname[i] == '\0')
-		  break;
+			break;
 	}
 	return 0;
 }
@@ -574,9 +574,9 @@
 #define PLE_FLAG_ALL			-1	/* All flag value */
 
 struct proplistname_args {
-	unsigned int	pl_mask;
-	unsigned int	pl_numnames;
-	char		**pl_names;
+	unsigned int pl_mask;
+	unsigned int pl_numnames;
+	char **pl_names;
 };
 
 union pl_args {
@@ -618,62 +618,54 @@
 };
 
 enum pl_code {
-	PL_SET	= 1,	PL_FSET	= 2,
-	PL_GET	= 3,	PL_FGET	= 4,
-	PL_DEL	= 5,	PL_FDEL	= 6
+	PL_SET = 1, PL_FSET = 2,
+	PL_GET = 3, PL_FGET = 4,
+	PL_DEL = 5, PL_FDEL = 6
 };
 
-asmlinkage long osf_proplist_syscall (enum pl_code code, union pl_args *args)
+asmlinkage long osf_proplist_syscall(enum pl_code code, union pl_args *args)
 {
 	long error;
 	int *min_buf_size_ptr;
 
 	switch (code) {
-	      case PL_SET:
+	case PL_SET:
 		error = verify_area(VERIFY_READ, &args->set.nbytes,
 				    sizeof(args->set.nbytes));
 		if (error)
-		  return error;
+			return error;
 		return args->set.nbytes;
 
-	      case PL_FSET:
+	case PL_FSET:
 		error = verify_area(VERIFY_READ, &args->fset.nbytes,
 				    sizeof(args->fset.nbytes));
 		if (error)
-		  return error;
+			return error;
 		return args->fset.nbytes;
 
-	      case PL_GET:
-		error = verify_area(VERIFY_READ, &args->get.min_buf_size,
-				    sizeof(args->get.min_buf_size));
-		if (error)
-		  return error;
-		min_buf_size_ptr = get_user(&args->get.min_buf_size);
+	case PL_GET:
+		get_user(min_buf_size_ptr, &args->get.min_buf_size);
 		error = verify_area(VERIFY_WRITE, min_buf_size_ptr,
 				    sizeof(*min_buf_size_ptr));
 		if (error)
-		  return error;
+			return error;
 		put_user(0, min_buf_size_ptr);
 		return 0;
 
-	      case PL_FGET:
-		error = verify_area(VERIFY_READ, &args->fget.min_buf_size,
-				    sizeof(args->fget.min_buf_size));
-		if (error)
-		  return error;
-		min_buf_size_ptr = get_user(&args->fget.min_buf_size);
+	case PL_FGET:
+		get_user(min_buf_size_ptr, &args->fget.min_buf_size);
 		error = verify_area(VERIFY_WRITE, min_buf_size_ptr,
 				    sizeof(*min_buf_size_ptr));
 		if (error)
-		  return error;
+			return error;
 		put_user(0, min_buf_size_ptr);
 		return 0;
 
-	      case PL_DEL:
-	      case PL_FDEL:
+	case PL_DEL:
+	case PL_FDEL:
 		return 0;
 
-	      default:
+	default:
 		return -EOPNOTSUPP;
 	}
 }
@@ -685,12 +677,11 @@
  * create_module() because it's one of the few system calls
  * that return kernel addresses (which are negative).
  */
-asmlinkage unsigned long
-alpha_create_module (char * module_name, unsigned long size,
-		     int a3, int a4, int a5, int a6,
-		     struct pt_regs regs)
+asmlinkage unsigned long alpha_create_module(char *module_name, unsigned long size,
+					  int a3, int a4, int a5, int a6,
+					     struct pt_regs regs)
 {
-	asmlinkage unsigned long sys_create_module (char *, unsigned long);
+	asmlinkage unsigned long sys_create_module(char *, unsigned long);
 	long retval;
 
 	retval = sys_create_module(module_name, size);
@@ -701,7 +692,7 @@
 	 * much larger.
 	 */
 	if (retval + 1000 > 0)
-	  return retval;
+		return retval;
 
 	/* tell entry.S:syscall_error that this is NOT an error: */
 	regs.r0 = 0;
@@ -709,59 +700,57 @@
 }
 
 
-asmlinkage unsigned long
-osf_getsysinfo (unsigned long op, void * buffer, unsigned long nbytes,
-		int * start, void *arg)
-{
-    extern unsigned long rdfpcr (void);
-    unsigned long fpcw;
-
-    switch (op) {
-      case 45:	/* GSI_IEEE_FP_CONTROL */
-	  /* build and return current fp control word: */
-	  fpcw = current->tss.flags & IEEE_TRAP_ENABLE_MASK;
-	  fpcw |= ((rdfpcr() >> 52) << 17) & IEEE_STATUS_MASK;
-	  put_user(fpcw, (unsigned long *) buffer);
-	  return 0;
-
-      case 46:	/* GSI_IEEE_STATE_AT_SIGNAL */
-	  /*
-	   * Not sure anybody will ever use this weird stuff.  These
-	   * ops can be used (under OSF/1) to set the fpcr that should
-	   * be used when a signal handler starts executing.
-	   */
-	  break;
-
-      default:
-	  break;
-    }
-    return -EOPNOTSUPP;
+asmlinkage unsigned long osf_getsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
+					int *start, void *arg)
+{
+	extern unsigned long rdfpcr(void);
+	unsigned long fpcw;
+
+	switch (op) {
+	case 45:		/* GSI_IEEE_FP_CONTROL */
+		/* build and return current fp control word: */
+		fpcw = current->tss.flags & IEEE_TRAP_ENABLE_MASK;
+		fpcw |= ((rdfpcr() >> 52) << 17) & IEEE_STATUS_MASK;
+		put_user(fpcw, (unsigned long *) buffer);
+		return 0;
+
+	case 46:		/* GSI_IEEE_STATE_AT_SIGNAL */
+		/*
+		 * Not sure anybody will ever use this weird stuff.  These
+		 * ops can be used (under OSF/1) to set the fpcr that should
+		 * be used when a signal handler starts executing.
+		 */
+		break;
+
+	default:
+		break;
+	}
+	return -EOPNOTSUPP;
 }
 
 
-asmlinkage unsigned long
-osf_setsysinfo (unsigned long op, void * buffer, unsigned long nbytes,
-		int * start, void *arg)
-{
-    unsigned long fpcw;
-
-    switch (op) {
-      case 14:	/* SSI_IEEE_FP_CONTROL */
-	  /* update trap enable bits: */
-	  fpcw = get_user((unsigned long *) buffer);
-	  current->tss.flags &= ~IEEE_TRAP_ENABLE_MASK;
-	  current->tss.flags |= (fpcw & IEEE_TRAP_ENABLE_MASK);
-	  return 0;
-
-      case 15:	/* SSI_IEEE_STATE_AT_SIGNAL */
-      case 16:	/* SSI_IEEE_IGNORE_STATE_AT_SIGNAL */
-	  /*
-	   * Not sure anybody will ever use this weird stuff.  These
-	   * ops can be used (under OSF/1) to set the fpcr that should
-	   * be used when a signal handler starts executing.
-	   */
-      default:
-	  break;
-    }
-    return -EOPNOTSUPP;
+asmlinkage unsigned long osf_setsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
+					int *start, void *arg)
+{
+	unsigned long fpcw;
+
+	switch (op) {
+	case 14:		/* SSI_IEEE_FP_CONTROL */
+		/* update trap enable bits: */
+		get_user(fpcw, (unsigned long *) buffer);
+		current->tss.flags &= ~IEEE_TRAP_ENABLE_MASK;
+		current->tss.flags |= (fpcw & IEEE_TRAP_ENABLE_MASK);
+		return 0;
+
+	case 15:		/* SSI_IEEE_STATE_AT_SIGNAL */
+	case 16:		/* SSI_IEEE_IGNORE_STATE_AT_SIGNAL */
+		/*
+		 * Not sure anybody will ever use this weird stuff.  These
+		 * ops can be used (under OSF/1) to set the fpcr that should
+		 * be used when a signal handler starts executing.
+		 */
+	default:
+		break;
+	}
+	return -EOPNOTSUPP;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov