From: Erez Zadok Date: Sun, 25 Mar 2007 05:37:15 +0000 (-0400) Subject: Move one function off of branchman.c and remove source file. X-Git-Tag: unionfs-2.1.1~148 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=e2ea55a57da0384dd4dfdf89372e5d0fe5e6e0a4;p=unionfs-2.6.26.y.git Move one function off of branchman.c and remove source file. After branch-management support was added, branchman.c became obsolete: it used to hold the old ioctl-based branch-management commands, but now we do those commands via remount (in super.c). So move the only remaining small query-file ioctl from branchman.c to commonfops.c, close to unionfs_ioctl; and remove any leftover extern's which referred to old code in branchman.c --- diff --git a/fs/unionfs/Makefile b/fs/unionfs/Makefile index e6b2e0cd102..f9050fa1ca7 100644 --- a/fs/unionfs/Makefile +++ b/fs/unionfs/Makefile @@ -1,7 +1,7 @@ obj-$(CONFIG_UNION_FS) += unionfs.o unionfs-y := subr.o dentry.o file.o inode.o main.o super.o \ - branchman.o rdstate.o copyup.o dirhelper.o rename.o \ + rdstate.o copyup.o dirhelper.o rename.o \ unlink.o lookup.o commonfops.o dirfops.o sioq.o unionfs-$(CONFIG_UNION_FS_XATTR) += xattr.o diff --git a/fs/unionfs/branchman.c b/fs/unionfs/branchman.c deleted file mode 100644 index cd6a22bfb36..00000000000 --- a/fs/unionfs/branchman.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003-2007 Erez Zadok - * Copyright (c) 2003-2006 Charles P. Wright - * Copyright (c) 2005-2007 Josef 'Jeff' Sipek - * Copyright (c) 2005-2006 Junjiro Okajima - * Copyright (c) 2005 Arun M. Krishnakumar - * Copyright (c) 2004-2006 David P. Quigley - * Copyright (c) 2003-2004 Mohammad Nayyer Zubair - * Copyright (c) 2003 Puja Gupta - * Copyright (c) 2003 Harikesavan Krishnan - * Copyright (c) 2003-2007 Stony Brook University - * Copyright (c) 2003-2007 The Research Foundation of SUNY - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include "union.h" - -/* - * return to user-space the branch indices containing the file in question - * - * We use fd_set and therefore we are limited to the number of the branches - * to FD_SETSIZE, which is currently 1024 - plenty for most people - */ -int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int err = 0; - fd_set branchlist; - int bstart = 0, bend = 0, bindex = 0; - struct dentry *dentry, *hidden_dentry; - - dentry = file->f_dentry; - unionfs_lock_dentry(dentry); - if ((err = unionfs_partial_lookup(dentry))) - goto out; - bstart = dbstart(dentry); - bend = dbend(dentry); - - FD_ZERO(&branchlist); - - for (bindex = bstart; bindex <= bend; bindex++) { - hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex); - if (!hidden_dentry) - continue; - if (hidden_dentry->d_inode) - FD_SET(bindex, &branchlist); - } - - err = copy_to_user((void __user *)arg, &branchlist, sizeof(fd_set)); - if (err) - err = -EFAULT; - -out: - unionfs_unlock_dentry(dentry); - return err < 0 ? err : bend; -} diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c index c948108359c..d4a14e43621 100644 --- a/fs/unionfs/commonfops.c +++ b/fs/unionfs/commonfops.c @@ -629,6 +629,46 @@ out: return err; } +/* + * return to user-space the branch indices containing the file in question + * + * We use fd_set and therefore we are limited to the number of the branches + * to FD_SETSIZE, which is currently 1024 - plenty for most people + */ +static int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd, + unsigned long arg) +{ + int err = 0; + fd_set branchlist; + int bstart = 0, bend = 0, bindex = 0; + struct dentry *dentry, *hidden_dentry; + + dentry = file->f_dentry; + unionfs_lock_dentry(dentry); + if ((err = unionfs_partial_lookup(dentry))) + goto out; + bstart = dbstart(dentry); + bend = dbend(dentry); + + FD_ZERO(&branchlist); + + for (bindex = bstart; bindex <= bend; bindex++) { + hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex); + if (!hidden_dentry) + continue; + if (hidden_dentry->d_inode) + FD_SET(bindex, &branchlist); + } + + err = copy_to_user((void __user *)arg, &branchlist, sizeof(fd_set)); + if (err) + err = -EFAULT; + +out: + unionfs_unlock_dentry(dentry); + return err < 0 ? err : bend; +} + long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { long err; diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h index 50a93f2264a..8d401243a22 100644 --- a/fs/unionfs/union.h +++ b/fs/unionfs/union.h @@ -320,12 +320,6 @@ extern int __unionfs_d_revalidate_chain(struct dentry *dentry, extern int unionfs_interpose(struct dentry *this_dentry, struct super_block *sb, int flag); -/* Branch management ioctls. */ -extern int unionfs_ioctl_incgen(struct file *file, unsigned int cmd, - unsigned long arg); -extern int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd, - unsigned long arg); - #ifdef CONFIG_UNION_FS_XATTR /* Extended attribute functions. */ extern void *unionfs_xattr_alloc(size_t size, size_t limit);