Commit f8ffbc36 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'pull-stable-struct_fd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull 'struct fd' updates from Al Viro:
 "Just the 'struct fd' layout change, with conversion to accessor
  helpers"

* tag 'pull-stable-struct_fd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  add struct fd constructors, get rid of __to_fd()
  struct fd: representation change
  introduce fd_file(), convert all accessors to it.
parents f8eb5bd9 de12c339
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -160,10 +160,10 @@ SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd,
		.count = count
	};

	if (!arg.file)
	if (!fd_file(arg))
		return -EBADF;

	error = iterate_dir(arg.file, &buf.ctx);
	error = iterate_dir(fd_file(arg), &buf.ctx);
	if (error >= 0)
		error = buf.error;
	if (count != buf.count)
+5 −5
Original line number Diff line number Diff line
@@ -239,19 +239,19 @@ asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd,
	struct flock64 flock;
	long err = -EBADF;

	if (!f.file)
	if (!fd_file(f))
		goto out;

	switch (cmd) {
	case F_GETLK64:
	case F_OFD_GETLK:
		err = security_file_fcntl(f.file, cmd, arg);
		err = security_file_fcntl(fd_file(f), cmd, arg);
		if (err)
			break;
		err = get_oabi_flock(&flock, argp);
		if (err)
			break;
		err = fcntl_getlk64(f.file, cmd, &flock);
		err = fcntl_getlk64(fd_file(f), cmd, &flock);
		if (!err)
		       err = put_oabi_flock(&flock, argp);
		break;
@@ -259,13 +259,13 @@ asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd,
	case F_SETLKW64:
	case F_OFD_SETLK:
	case F_OFD_SETLKW:
		err = security_file_fcntl(f.file, cmd, arg);
		err = security_file_fcntl(fd_file(f), cmd, arg);
		if (err)
			break;
		err = get_oabi_flock(&flock, argp);
		if (err)
			break;
		err = fcntl_setlk64(fd, f.file, cmd, &flock);
		err = fcntl_setlk64(fd, fd_file(f), cmd, &flock);
		break;
	default:
		err = sys_fcntl64(fd, cmd, arg);
+2 −2
Original line number Diff line number Diff line
@@ -118,12 +118,12 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
	struct fd f;

	f = fdget(tablefd);
	if (!f.file)
	if (!fd_file(f))
		return -EBADF;

	rcu_read_lock();
	list_for_each_entry_rcu(stt, &kvm->arch.spapr_tce_tables, list) {
		if (stt == f.file->private_data) {
		if (stt == fd_file(f)->private_data) {
			found = true;
			break;
		}
+6 −6
Original line number Diff line number Diff line
@@ -1938,11 +1938,11 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,

		r = -EBADF;
		f = fdget(cap->args[0]);
		if (!f.file)
		if (!fd_file(f))
			break;

		r = -EPERM;
		dev = kvm_device_from_filp(f.file);
		dev = kvm_device_from_filp(fd_file(f));
		if (dev)
			r = kvmppc_mpic_connect_vcpu(dev, vcpu, cap->args[1]);

@@ -1957,11 +1957,11 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,

		r = -EBADF;
		f = fdget(cap->args[0]);
		if (!f.file)
		if (!fd_file(f))
			break;

		r = -EPERM;
		dev = kvm_device_from_filp(f.file);
		dev = kvm_device_from_filp(fd_file(f));
		if (dev) {
			if (xics_on_xive())
				r = kvmppc_xive_connect_vcpu(dev, vcpu, cap->args[1]);
@@ -1980,7 +1980,7 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,

		r = -EBADF;
		f = fdget(cap->args[0]);
		if (!f.file)
		if (!fd_file(f))
			break;

		r = -ENXIO;
@@ -1990,7 +1990,7 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
		}

		r = -EPERM;
		dev = kvm_device_from_filp(f.file);
		dev = kvm_device_from_filp(fd_file(f));
		if (dev)
			r = kvmppc_xive_native_connect_vcpu(dev, vcpu,
							    cap->args[1]);
+4 −4
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
	if (flags & SPU_CREATE_AFFINITY_SPU) {
		struct fd neighbor = fdget(neighbor_fd);
		ret = -EBADF;
		if (neighbor.file) {
			ret = calls->create_thread(name, flags, mode, neighbor.file);
		if (fd_file(neighbor)) {
			ret = calls->create_thread(name, flags, mode, fd_file(neighbor));
			fdput(neighbor);
		}
	} else
@@ -89,8 +89,8 @@ SYSCALL_DEFINE3(spu_run,int, fd, __u32 __user *, unpc, __u32 __user *, ustatus)

	ret = -EBADF;
	arg = fdget(fd);
	if (arg.file) {
		ret = calls->spu_run(arg.file, unpc, ustatus);
	if (fd_file(arg)) {
		ret = calls->spu_run(fd_file(arg), unpc, ustatus);
		fdput(arg);
	}

Loading