From patchwork Fri May 11 20:36:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 10395345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E1BC60153 for ; Fri, 11 May 2018 20:37:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25DEB28DC4 for ; Fri, 11 May 2018 20:37:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19E8228FC4; Fri, 11 May 2018 20:37:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0007F28DC4 for ; Fri, 11 May 2018 20:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751228AbeEKUgQ (ORCPT ); Fri, 11 May 2018 16:36:16 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:34975 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbeEKUgO (ORCPT ); Fri, 11 May 2018 16:36:14 -0400 Received: by mail-wm0-f52.google.com with SMTP id o78-v6so5346138wmg.0 for ; Fri, 11 May 2018 13:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=q+ot53QyI35lHg/BC2ib11RKTVWyjNQRjtX6Y8QkZQs=; b=nFxjdBhSSRBP8Nt/xg7NVaI2cghVqLh4N3bRWsHbvoVC03Th+jQpIcpZjTc5reUF3Y khXsBdF76EWeTuQ1hY6YI9C6x8H/x+I+ZOSzgvugseSOadQd9EYCDq4aHyRe0XRHdGMj 7L7q5YXUe0L3d1V4xeZ1jOfY1g7VMskiItkCILKg6MX7Na1FGAv9zQz6VSmv/up7EkaA /vyK0SRUldPVZZaTXoD/Aqiuvj6adbf7f5726/CmIUaiBu0T8HHUcxO0d1wjI3d8UkE+ 4eMyB4bAiPvrJl/rkbtsIPo6P5cidP/LpJbXrAJOw8aq7cwRt0A6ByoLAZ7+O+kqSk2F 4hKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=q+ot53QyI35lHg/BC2ib11RKTVWyjNQRjtX6Y8QkZQs=; b=pC/5O5ulE3ACnZJX8AdkcfbmabcEO6EATv1G9ivJitujFCUMctvm7AI9HaWoniK/LL UWR2iwpUPXvodSEkCOxjVtQJPquqtB6tZbZiNp8eMWC1KcIFI8I2ptTBIWB/GkMMJPD2 zEccJSSkNssuQ67QMsWS8RRnXKz4j950UzMPxoZ390o/f7s5RjSi/37DePF5iZ0MtHQh wY8wCA0hOVFfVFcN0jssXJ5EU4esVjj9vkx4Jsrv+7dr80uqi4l13KpsZJp6gO6+BaRE jm64oxJNHiYC2ILacqGblU7x0UzZriB3zyMMrNf/oASmqZt76Hl+QWXQ53QNVInnTALV CL1Q== X-Gm-Message-State: ALKqPweOrm7EAM95TJ+NpUc200Gb0tkwP6YWP1C8KU4psNP7+WW3vUAo ELYFcaKEYmjBxMT3DmRfSnRx X-Google-Smtp-Source: AB8JxZpj//Tc4KggA3vBzd0LFfb37UP3XnO+VfQEhTmU5Ky++5DLbONda7qb6yVtw7RQG7sSxNJ64Q== X-Received: by 2002:a1c:130d:: with SMTP id 13-v6mr2849427wmt.109.1526070970607; Fri, 11 May 2018 13:36:10 -0700 (PDT) Received: from avx2 (nat4-minsk-pool-46-53-177-92.telecom.by. [46.53.177.92]) by smtp.gmail.com with ESMTPSA id m17-v6sm3915995wrh.3.2018.05.11.13.36.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 May 2018 13:36:08 -0700 (PDT) Date: Fri, 11 May 2018 23:36:06 +0300 From: Alexey Dobriyan To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH] vfs: add and use lookup_flags_t for sparse checking Message-ID: <20180511203606.GA31801@avx2> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Few places arent't switched as they using flags & LOOKUP_... as a bool substitute. Signed-off-by: Alexey Dobriyan --- drivers/staging/lustre/lustre/llite/dcache.c | 4 - drivers/staging/lustre/lustre/llite/namei.c | 2 drivers/staging/ncpfs/dir.c | 6 +- fs/9p/v9fs.h | 2 fs/9p/vfs_dentry.c | 2 fs/9p/vfs_inode.c | 2 fs/adfs/dir.c | 2 fs/affs/affs.h | 2 fs/affs/namei.c | 2 fs/afs/dir.c | 8 +-- fs/afs/dynroot.c | 4 - fs/afs/mntpt.c | 4 - fs/autofs4/root.c | 4 - fs/bad_inode.c | 2 fs/befs/linuxvfs.c | 2 fs/bfs/dir.c | 2 fs/btrfs/inode.c | 2 fs/ceph/dir.c | 6 +- fs/cifs/cifsfs.h | 2 fs/cifs/dir.c | 4 - fs/coda/dir.c | 4 - fs/configfs/dir.c | 2 fs/cramfs/inode.c | 2 fs/crypto/crypto.c | 2 fs/ecryptfs/dentry.c | 2 fs/ecryptfs/inode.c | 2 fs/efs/efs.h | 2 fs/efs/namei.c | 2 fs/exec.c | 4 - fs/exofs/namei.c | 2 fs/ext2/namei.c | 2 fs/ext4/namei.c | 2 fs/f2fs/namei.c | 2 fs/fat/namei_msdos.c | 2 fs/fat/namei_vfat.c | 6 +- fs/fhandle.c | 2 fs/freevxfs/vxfs_lookup.c | 4 - fs/fuse/dir.c | 4 - fs/gfs2/dentry.c | 2 fs/gfs2/inode.c | 2 fs/hfs/dir.c | 2 fs/hfs/inode.c | 2 fs/hfs/sysdep.c | 2 fs/hfsplus/dir.c | 2 fs/hostfs/hostfs_kern.c | 2 fs/hpfs/dir.c | 2 fs/hpfs/hpfs_fn.h | 2 fs/internal.h | 8 +-- fs/isofs/isofs.h | 2 fs/isofs/namei.c | 2 fs/jffs2/dir.c | 4 - fs/jfs/namei.c | 4 - fs/kernfs/dir.c | 4 - fs/libfs.c | 4 - fs/minix/namei.c | 2 fs/namei.c | 68 +++++++++++++-------------- fs/namespace.c | 2 fs/nfs/dir.c | 18 +++---- fs/nfs/internal.h | 2 fs/nilfs2/namei.c | 2 fs/notify/fanotify/fanotify_user.c | 2 fs/notify/inotify/inotify_user.c | 4 - fs/ntfs/namei.c | 2 fs/ocfs2/dcache.c | 2 fs/ocfs2/namei.c | 2 fs/omfs/dir.c | 2 fs/open.c | 14 ++--- fs/openpromfs/inode.c | 4 - fs/orangefs/dcache.c | 2 fs/orangefs/namei.c | 2 fs/overlayfs/namei.c | 2 fs/overlayfs/overlayfs.h | 2 fs/overlayfs/super.c | 4 - fs/proc/base.c | 16 +++--- fs/proc/fd.c | 6 +- fs/proc/generic.c | 4 - fs/proc/internal.h | 6 +- fs/proc/namespaces.c | 2 fs/proc/proc_net.c | 2 fs/proc/proc_sysctl.c | 4 - fs/proc/root.c | 2 fs/qnx4/namei.c | 2 fs/qnx4/qnx4.h | 2 fs/qnx6/namei.c | 2 fs/qnx6/qnx6.h | 2 fs/reiserfs/namei.c | 2 fs/reiserfs/xattr.c | 2 fs/romfs/super.c | 2 fs/squashfs/namei.c | 2 fs/stat.c | 4 - fs/statfs.c | 2 fs/sysv/namei.c | 2 fs/ubifs/dir.c | 2 fs/udf/namei.c | 2 fs/ufs/namei.c | 2 fs/utimes.c | 2 fs/xattr.c | 8 +-- fs/xfs/xfs_iops.c | 4 - include/linux/dcache.h | 4 - include/linux/fs.h | 6 +- include/linux/fscrypt.h | 2 include/linux/namei.h | 44 ++++++++--------- include/linux/types.h | 1 kernel/bpf/inode.c | 2 104 files changed, 221 insertions(+), 220 deletions(-) --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -246,7 +246,7 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode) } static int ll_revalidate_dentry(struct dentry *dentry, - unsigned int lookup_flags) + lookup_flags_t lookup_flags) { struct inode *dir = d_inode(dentry->d_parent); @@ -283,7 +283,7 @@ static int ll_revalidate_dentry(struct dentry *dentry, /* * Always trust cached dentries. Update statahead window if necessary. */ -static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags) +static int ll_revalidate_nd(struct dentry *dentry, lookup_flags_t flags) { CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, flags=%u\n", dentry, flags); --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -644,7 +644,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, } static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct lookup_intent *itp, it = { .it_op = IT_GETATTR }; struct dentry *de; --- a/drivers/staging/ncpfs/dir.c +++ b/drivers/staging/ncpfs/dir.c @@ -32,7 +32,7 @@ static void ncp_do_readdir(struct file *, struct dir_context *, static int ncp_readdir(struct file *, struct dir_context *); static int ncp_create(struct inode *, struct dentry *, umode_t, bool); -static struct dentry *ncp_lookup(struct inode *, struct dentry *, unsigned int); +static struct dentry *ncp_lookup(struct inode *, struct dentry *, lookup_flags_t); static int ncp_unlink(struct inode *, struct dentry *); static int ncp_mkdir(struct inode *, struct dentry *, umode_t); static int ncp_rmdir(struct inode *, struct dentry *); @@ -299,7 +299,7 @@ leave_me:; static int -ncp_lookup_validate(struct dentry *dentry, unsigned int flags) +ncp_lookup_validate(struct dentry *dentry, lookup_flags_t flags) { struct ncp_server *server; struct dentry *parent; @@ -818,7 +818,7 @@ int ncp_conn_logged_in(struct super_block *sb) return result; } -static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct ncp_server *server = NCP_SERVER(dir); struct inode *inode = NULL; --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h @@ -146,7 +146,7 @@ extern void v9fs_session_close(struct v9fs_session_info *v9ses); extern void v9fs_session_cancel(struct v9fs_session_info *v9ses); extern void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses); extern struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags); + lookup_flags_t flags); extern int v9fs_vfs_unlink(struct inode *i, struct dentry *d); extern int v9fs_vfs_rmdir(struct inode *i, struct dentry *d); extern int v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c @@ -74,7 +74,7 @@ static void v9fs_dentry_release(struct dentry *dentry) dentry->d_fsdata = NULL; } -static int v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) +static int v9fs_lookup_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct p9_fid *fid; struct inode *inode; --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -803,7 +803,7 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode */ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct dentry *res; struct v9fs_session_info *v9ses; --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c @@ -258,7 +258,7 @@ const struct dentry_operations adfs_dentry_operations = { }; static struct dentry * -adfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +adfs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct inode *inode = NULL; struct object_info obj; --- a/fs/affs/affs.h +++ b/fs/affs/affs.h @@ -165,7 +165,7 @@ extern void affs_free_bitmap(struct super_block *sb); extern const struct export_operations affs_export_ops; extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len); -extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int); +struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t); extern int affs_unlink(struct inode *dir, struct dentry *dentry); extern int affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool); extern int affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); --- a/fs/affs/namei.c +++ b/fs/affs/namei.c @@ -196,7 +196,7 @@ affs_find_entry(struct inode *dir, struct dentry *dentry) } struct dentry * -affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +affs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct super_block *sb = dir->i_sb; struct buffer_head *bh; --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -21,10 +21,10 @@ #include "xdr_fs.h" static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags); + lookup_flags_t flags); static int afs_dir_open(struct inode *inode, struct file *file); static int afs_readdir(struct file *file, struct dir_context *ctx); -static int afs_d_revalidate(struct dentry *dentry, unsigned int flags); +static int afs_d_revalidate(struct dentry *dentry, lookup_flags_t flags); static int afs_d_delete(const struct dentry *dentry); static int afs_lookup_one_filldir(struct dir_context *ctx, const char *name, int nlen, loff_t fpos, u64 ino, unsigned dtype); @@ -820,7 +820,7 @@ static struct dentry *afs_lookup_atsys(struct inode *dir, struct dentry *dentry, * look up an entry in a directory */ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct afs_vnode *dvnode = AFS_FS_I(dir); struct inode *inode; @@ -908,7 +908,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, * - NOTE! the hit can be a negative hit too, so we can't assume we have an * inode */ -static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) +static int afs_d_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct afs_vnode *vnode, *dir; struct afs_fid uninitialized_var(fid); --- a/fs/afs/dynroot.c +++ b/fs/afs/dynroot.c @@ -139,7 +139,7 @@ static struct dentry *afs_lookup_atcell(struct dentry *dentry) * Look up an entry in a dynroot directory. */ static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct afs_vnode *vnode; struct inode *inode; @@ -185,7 +185,7 @@ const struct inode_operations afs_dynroot_inode_operations = { /* * Dirs in the dynamic root don't need revalidation. */ -static int afs_dynroot_d_revalidate(struct dentry *dentry, unsigned int flags) +static int afs_dynroot_d_revalidate(struct dentry *dentry, lookup_flags_t flags) { return 1; } --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c @@ -22,7 +22,7 @@ static struct dentry *afs_mntpt_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags); + lookup_flags_t flags); static int afs_mntpt_open(struct inode *inode, struct file *file); static void afs_mntpt_expiry_timed_out(struct work_struct *work); @@ -52,7 +52,7 @@ static unsigned long afs_mntpt_expiry_timeout = 10 * 60; */ static struct dentry *afs_mntpt_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { _enter("%p,%p{%pd2}", dir, dentry, dentry); return ERR_PTR(-EREMOTE); --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c @@ -30,7 +30,7 @@ static long autofs4_root_compat_ioctl(struct file *, #endif static int autofs4_dir_open(struct inode *inode, struct file *file); static struct dentry *autofs4_lookup(struct inode *, - struct dentry *, unsigned int); + struct dentry *, lookup_flags_t); static struct vfsmount *autofs4_d_automount(struct path *); static int autofs4_d_manage(const struct path *, bool); static void autofs4_dentry_release(struct dentry *); @@ -501,7 +501,7 @@ static int autofs4_d_manage(const struct path *path, bool rcu_walk) /* Lookups in the root directory */ static struct dentry *autofs4_lookup(struct inode *dir, - struct dentry *dentry, unsigned int flags) + struct dentry *dentry, lookup_flags_t flags) { struct autofs_sb_info *sbi; struct autofs_info *ino; --- a/fs/bad_inode.c +++ b/fs/bad_inode.c @@ -33,7 +33,7 @@ static int bad_inode_create (struct inode *dir, struct dentry *dentry, } static struct dentry *bad_inode_lookup(struct inode *dir, - struct dentry *dentry, unsigned int flags) + struct dentry *dentry, lookup_flags_t flags) { return ERR_PTR(-EIO); } --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -167,7 +167,7 @@ befs_get_block(struct inode *inode, sector_t block, } static struct dentry * -befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +befs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct inode *inode; struct super_block *sb = dir->i_sb; --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c @@ -125,7 +125,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, } static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct inode *inode = NULL; struct buffer_head *bh; --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5849,7 +5849,7 @@ static void btrfs_dentry_release(struct dentry *dentry) } static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct inode *inode; --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -727,7 +727,7 @@ static bool is_root_ceph_dentry(struct inode *inode, struct dentry *dentry) * the MDS so that it gets our 'caps wanted' value in a single op. */ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); struct ceph_mds_client *mdsc = fsc->mdsc; @@ -1135,7 +1135,7 @@ void ceph_invalidate_dentry_lease(struct dentry *dentry) * Check if dentry lease is valid. If not, delete the lease. Try to * renew if the least is more than half up. */ -static int dentry_lease_is_valid(struct dentry *dentry, unsigned int flags, +static int dentry_lease_is_valid(struct dentry *dentry, lookup_flags_t flags, struct inode *dir) { struct ceph_dentry_info *di; @@ -1210,7 +1210,7 @@ static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry) /* * Check if cached dentry can be trusted. */ -static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) +static int ceph_d_revalidate(struct dentry *dentry, lookup_flags_t flags) { int valid = 0; struct dentry *parent; --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h @@ -68,7 +68,7 @@ extern int cifs_atomic_open(struct inode *, struct dentry *, struct file *, unsigned, umode_t, int *); extern struct dentry *cifs_lookup(struct inode *, struct dentry *, - unsigned int); + lookup_flags_t); extern int cifs_unlink(struct inode *dir, struct dentry *dentry); extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *); extern int cifs_mknod(struct inode *, struct dentry *, umode_t, dev_t); --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -759,7 +759,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, struct dentry * cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, - unsigned int flags) + lookup_flags_t flags) { unsigned int xid; int rc = 0; /* to get around spurious gcc warning, set to zero here */ @@ -839,7 +839,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, } static int -cifs_d_revalidate(struct dentry *direntry, unsigned int flags) +cifs_d_revalidate(struct dentry *direntry, lookup_flags_t flags) { if (flags & LOOKUP_RCU) return -ECHILD; --- a/fs/coda/dir.c +++ b/fs/coda/dir.c @@ -38,7 +38,7 @@ static int coda_return_EIO(void) /* inode operations for directories */ /* access routines: lookup, readlink, permission */ -static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsigned int flags) +static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, lookup_flags_t flags) { struct super_block *sb = dir->i_sb; const char *name = entry->d_name.name; @@ -453,7 +453,7 @@ static int coda_readdir(struct file *coda_file, struct dir_context *ctx) } /* called when a cache lookup succeeds */ -static int coda_dentry_revalidate(struct dentry *de, unsigned int flags) +static int coda_dentry_revalidate(struct dentry *de, lookup_flags_t flags) { struct inode *inode; struct coda_inode_info *cii; --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -439,7 +439,7 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den static struct dentry * configfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct configfs_dirent * parent_sd = dentry->d_parent->d_fsdata; struct configfs_dirent * sd; --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -756,7 +756,7 @@ static int cramfs_readdir(struct file *file, struct dir_context *ctx) /* * Lookup and fill in the inode data.. */ -static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { unsigned int offset = 0; struct inode *inode = NULL; --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -312,7 +312,7 @@ EXPORT_SYMBOL(fscrypt_decrypt_page); * potentially caching stale data after a key has been added or * removed. */ -static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags) +static int fscrypt_d_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct dentry *dir; int dir_has_key, cached_with_key; --- a/fs/ecryptfs/dentry.c +++ b/fs/ecryptfs/dentry.c @@ -42,7 +42,7 @@ * Returns 1 if valid, 0 otherwise. * */ -static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) +static int ecryptfs_d_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); int rc = 1; --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -381,7 +381,7 @@ static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry, */ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, struct dentry *ecryptfs_dentry, - unsigned int flags) + lookup_flags_t flags) { char *encrypted_and_encoded_name = NULL; struct ecryptfs_mount_crypt_stat *mount_crypt_stat; --- a/fs/efs/efs.h +++ b/fs/efs/efs.h @@ -136,7 +136,7 @@ extern struct inode *efs_iget(struct super_block *, unsigned long); extern efs_block_t efs_map_block(struct inode *, efs_block_t); extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int); -extern struct dentry *efs_lookup(struct inode *, struct dentry *, unsigned int); +struct dentry *efs_lookup(struct inode *, struct dentry *, lookup_flags_t); extern struct dentry *efs_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, int fh_type); extern struct dentry *efs_fh_to_parent(struct super_block *sb, struct fid *fid, --- a/fs/efs/namei.c +++ b/fs/efs/namei.c @@ -62,7 +62,7 @@ static efs_ino_t efs_find_entry(struct inode *inode, const char *name, int len) return 0; } -struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { efs_ino_t inodenum; struct inode *inode = NULL; --- a/fs/exec.c +++ b/fs/exec.c @@ -1949,7 +1949,7 @@ SYSCALL_DEFINE5(execveat, const char __user *const __user *, envp, int, flags) { - int lookup_flags = (flags & AT_EMPTY_PATH) ? LOOKUP_EMPTY : 0; + lookup_flags_t lookup_flags = (flags & AT_EMPTY_PATH) ? LOOKUP_EMPTY : 0; return do_execveat(fd, getname_flags(filename, lookup_flags, NULL), @@ -1970,7 +1970,7 @@ COMPAT_SYSCALL_DEFINE5(execveat, int, fd, const compat_uptr_t __user *, envp, int, flags) { - int lookup_flags = (flags & AT_EMPTY_PATH) ? LOOKUP_EMPTY : 0; + lookup_flags_t lookup_flags = (flags & AT_EMPTY_PATH) ? LOOKUP_EMPTY : 0; return compat_do_execveat(fd, getname_flags(filename, lookup_flags, NULL), --- a/fs/exofs/namei.c +++ b/fs/exofs/namei.c @@ -46,7 +46,7 @@ static inline int exofs_add_nondir(struct dentry *dentry, struct inode *inode) } static struct dentry *exofs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct inode *inode; ino_t ino; --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c @@ -55,7 +55,7 @@ static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) * Methods themselves. */ -static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, unsigned int flags) +static struct dentry *ext2_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct inode * inode; ino_t ino; --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1539,7 +1539,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, return bh; } -static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct inode *inode; struct ext4_dir_entry_2 *de; --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -419,7 +419,7 @@ static int __recover_dot_dentries(struct inode *dir, nid_t pino) } static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct inode *inode = NULL; struct f2fs_dir_entry *de; --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c @@ -198,7 +198,7 @@ static const struct dentry_operations msdos_dentry_operations = { /***** Get inode using directory and name */ static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct super_block *sb = dir->i_sb; struct fat_slot_info sinfo; --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c @@ -52,7 +52,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry) return ret; } -static int vfat_revalidate(struct dentry *dentry, unsigned int flags) +static int vfat_revalidate(struct dentry *dentry, lookup_flags_t flags) { if (flags & LOOKUP_RCU) return -ECHILD; @@ -63,7 +63,7 @@ static int vfat_revalidate(struct dentry *dentry, unsigned int flags) return vfat_revalidate_shortname(dentry); } -static int vfat_revalidate_ci(struct dentry *dentry, unsigned int flags) +static int vfat_revalidate_ci(struct dentry *dentry, lookup_flags_t flags) { if (flags & LOOKUP_RCU) return -ECHILD; @@ -707,7 +707,7 @@ static int vfat_d_anon_disconn(struct dentry *dentry) } static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct super_block *sb = dir->i_sb; struct fat_slot_info sinfo; --- a/fs/fhandle.c +++ b/fs/fhandle.c @@ -95,7 +95,7 @@ SYSCALL_DEFINE5(name_to_handle_at, int, dfd, const char __user *, name, int, flag) { struct path path; - int lookup_flags; + lookup_flags_t lookup_flags; int err; if ((flag & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) --- a/fs/freevxfs/vxfs_lookup.c +++ b/fs/freevxfs/vxfs_lookup.c @@ -49,7 +49,7 @@ #define VXFS_BLOCK_PER_PAGE(sbp) ((PAGE_SIZE / (sbp)->s_blocksize)) -static struct dentry * vxfs_lookup(struct inode *, struct dentry *, unsigned int); +static struct dentry * vxfs_lookup(struct inode *, struct dentry *, lookup_flags_t); static int vxfs_readdir(struct file *, struct dir_context *); const struct inode_operations vxfs_dir_inode_ops = { @@ -184,7 +184,7 @@ vxfs_inode_by_name(struct inode *dip, struct dentry *dp) * in the return pointer. */ static struct dentry * -vxfs_lookup(struct inode *dip, struct dentry *dp, unsigned int flags) +vxfs_lookup(struct inode *dip, struct dentry *dp, lookup_flags_t flags) { struct inode *ip = NULL; ino_t ino; --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -178,7 +178,7 @@ u64 fuse_get_attr_version(struct fuse_conn *fc) * the lookup once more. If the lookup results in the same inode, * then refresh the attributes, timeouts and mark the dentry valid. */ -static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) +static int fuse_dentry_revalidate(struct dentry *entry, lookup_flags_t flags) { struct inode *inode; struct dentry *parent; @@ -348,7 +348,7 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name } static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, - unsigned int flags) + lookup_flags_t flags) { int err; struct fuse_entry_out outarg; --- a/fs/gfs2/dentry.c +++ b/fs/gfs2/dentry.c @@ -33,7 +33,7 @@ * Returns: 1 if the dentry is ok, 0 if it isn't */ -static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags) +static int gfs2_drevalidate(struct dentry *dentry, lookup_flags_t flags) { struct dentry *parent; struct gfs2_sbd *sdp; --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -877,7 +877,7 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, } static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, - unsigned flags) + lookup_flags_t flags) { return __gfs2_lookup(dir, dentry, NULL, NULL); } --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c @@ -18,7 +18,7 @@ * hfs_lookup() */ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { hfs_cat_rec rec; struct hfs_find_data fd; --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -504,7 +504,7 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc) } static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct inode *inode = NULL; hfs_cat_rec rec; --- a/fs/hfs/sysdep.c +++ b/fs/hfs/sysdep.c @@ -13,7 +13,7 @@ /* dentry case-handling: just lowercase everything */ -static int hfs_revalidate_dentry(struct dentry *dentry, unsigned int flags) +static int hfs_revalidate_dentry(struct dentry *dentry, lookup_flags_t flags) { struct inode *inode; int diff; --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c @@ -29,7 +29,7 @@ static inline void hfsplus_instantiate(struct dentry *dentry, /* Find the entry inside dir named dentry->d_name */ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct inode *inode = NULL; struct hfs_find_data fd; --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -603,7 +603,7 @@ static int hostfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, } static struct dentry *hostfs_lookup(struct inode *ino, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct inode *inode; char *name; --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c @@ -199,7 +199,7 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx) * to tell read_inode to read fnode or not. */ -struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { const unsigned char *name = dentry->d_name.name; unsigned len = dentry->d_name.len; --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h @@ -238,7 +238,7 @@ extern const struct dentry_operations hpfs_dentry_operations; /* dir.c */ -struct dentry *hpfs_lookup(struct inode *, struct dentry *, unsigned int); +struct dentry *hpfs_lookup(struct inode *, struct dentry *, lookup_flags_t); extern const struct file_operations hpfs_dir_ops; /* dnode.c */ --- a/fs/internal.h +++ b/fs/internal.h @@ -52,9 +52,9 @@ extern void __init chrdev_init(void); /* * namei.c */ -extern int user_path_mountpoint_at(int, const char __user *, unsigned int, struct path *); +int user_path_mountpoint_at(int, const char __user *, lookup_flags_t, struct path *); extern int vfs_path_lookup(struct dentry *, struct vfsmount *, - const char *, unsigned int, struct path *); + const char *, lookup_flags_t, struct path *); long do_mknodat(int dfd, const char __user *filename, umode_t mode, unsigned int dev); long do_mkdirat(int dfd, const char __user *pathname, umode_t mode); @@ -111,8 +111,8 @@ struct open_flags { int open_flag; umode_t mode; int acc_mode; - int intent; - int lookup_flags; + lookup_flags_t intent; + lookup_flags_t lookup_flags; }; extern struct file *do_filp_open(int dfd, struct filename *pathname, const struct open_flags *op); --- a/fs/isofs/isofs.h +++ b/fs/isofs/isofs.h @@ -118,7 +118,7 @@ extern int isofs_name_translate(struct iso_directory_record *, char *, struct in int get_joliet_filename(struct iso_directory_record *, unsigned char *, struct inode *); int get_acorn_filename(struct iso_directory_record *, char *, struct inode *); -extern struct dentry *isofs_lookup(struct inode *, struct dentry *, unsigned int flags); +struct dentry *isofs_lookup(struct inode *, struct dentry *, lookup_flags_t flags); extern struct buffer_head *isofs_bread(struct inode *, sector_t); extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long); --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c @@ -149,7 +149,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, return 0; } -struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { int found; unsigned long uninitialized_var(block); --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c @@ -27,7 +27,7 @@ static int jffs2_readdir (struct file *, struct dir_context *); static int jffs2_create (struct inode *,struct dentry *,umode_t, bool); static struct dentry *jffs2_lookup (struct inode *,struct dentry *, - unsigned int); + lookup_flags_t); static int jffs2_link (struct dentry *,struct inode *,struct dentry *); static int jffs2_unlink (struct inode *,struct dentry *); static int jffs2_symlink (struct inode *,struct dentry *,const char *); @@ -73,7 +73,7 @@ const struct inode_operations jffs2_dir_inode_operations = nice and simple */ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, - unsigned int flags) + lookup_flags_t flags) { struct jffs2_inode_info *dir_f; struct jffs2_full_dirent *fd = NULL, *fd_list; --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c @@ -1459,7 +1459,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, return rc; } -static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, unsigned int flags) +static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, lookup_flags_t flags) { struct btstack btstack; ino_t inum; @@ -1588,7 +1588,7 @@ static int jfs_ci_compare(const struct dentry *dentry, return result; } -static int jfs_ci_revalidate(struct dentry *dentry, unsigned int flags) +static int jfs_ci_revalidate(struct dentry *dentry, lookup_flags_t flags) { /* * This is not negative dentry. Always valid. --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -555,7 +555,7 @@ void kernfs_put(struct kernfs_node *kn) } EXPORT_SYMBOL_GPL(kernfs_put); -static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags) +static int kernfs_dop_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct kernfs_node *kn; @@ -1048,7 +1048,7 @@ struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent, static struct dentry *kernfs_iop_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct dentry *ret; struct kernfs_node *parent = dir->i_private; --- a/fs/libfs.c +++ b/fs/libfs.c @@ -59,7 +59,7 @@ EXPORT_SYMBOL(simple_dentry_operations); * Lookup the data. This is trivial - if the dentry didn't already * exist, we know it is negative. Set d_op to delete negative dentries. */ -struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { if (dentry->d_name.len > NAME_MAX) return ERR_PTR(-ENAMETOOLONG); @@ -1182,7 +1182,7 @@ EXPORT_SYMBOL(simple_symlink_inode_operations); /* * Operations for a permanently empty directory. */ -static struct dentry *empty_dir_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +static struct dentry *empty_dir_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { return ERR_PTR(-ENOENT); } --- a/fs/minix/namei.c +++ b/fs/minix/namei.c @@ -19,7 +19,7 @@ static int add_nondir(struct dentry *dentry, struct inode *inode) return err; } -static struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry, unsigned int flags) +static struct dentry *minix_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct inode * inode = NULL; ino_t ino; --- a/fs/namei.c +++ b/fs/namei.c @@ -126,7 +126,7 @@ #define EMBEDDED_NAME_MAX (PATH_MAX - offsetof(struct filename, iname)) struct filename * -getname_flags(const char __user *filename, int flags, int *empty) +getname_flags(const char __user *filename, lookup_flags_t flags, int *empty) { struct filename *result; char *kname; @@ -492,7 +492,7 @@ struct nameidata { struct qstr last; struct path root; struct inode *inode; /* path.dentry.d_inode */ - unsigned int flags; + lookup_flags_t flags; unsigned seq, m_seq; int last_type; unsigned depth; @@ -761,7 +761,7 @@ static int unlazy_child(struct nameidata *nd, struct dentry *dentry, unsigned se return -ECHILD; } -static inline int d_revalidate(struct dentry *dentry, unsigned int flags) +static inline int d_revalidate(struct dentry *dentry, lookup_flags_t flags) { if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) return dentry->d_op->d_revalidate(dentry, flags); @@ -1462,7 +1462,7 @@ static int follow_dotdot(struct nameidata *nd) */ static struct dentry *lookup_dcache(const struct qstr *name, struct dentry *dir, - unsigned int flags) + lookup_flags_t flags) { struct dentry *dentry = d_lookup(dir, name); if (dentry) { @@ -1485,7 +1485,7 @@ static struct dentry *lookup_dcache(const struct qstr *name, * at all. */ static struct dentry *__lookup_hash(const struct qstr *name, - struct dentry *base, unsigned int flags) + struct dentry *base, lookup_flags_t flags) { struct dentry *dentry = lookup_dcache(name, base, flags); struct dentry *old; @@ -1600,7 +1600,7 @@ static int lookup_fast(struct nameidata *nd, /* Fast lookup failed, do it the slow way */ static struct dentry *__lookup_slow(const struct qstr *name, struct dentry *dir, - unsigned int flags) + lookup_flags_t flags) { struct dentry *dentry, *old; struct inode *inode = dir->d_inode; @@ -1639,7 +1639,7 @@ static struct dentry *__lookup_slow(const struct qstr *name, static struct dentry *lookup_slow(const struct qstr *name, struct dentry *dir, - unsigned int flags) + lookup_flags_t flags) { struct inode *inode = dir->d_inode; struct dentry *res; @@ -2125,7 +2125,7 @@ static int link_path_walk(const char *name, struct nameidata *nd) } } -static const char *path_init(struct nameidata *nd, unsigned flags) +static const char *path_init(struct nameidata *nd, lookup_flags_t flags) { const char *s = nd->name->name; @@ -2267,7 +2267,7 @@ static int handle_lookup_down(struct nameidata *nd) } /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ -static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path) +static int path_lookupat(struct nameidata *nd, lookup_flags_t flags, struct path *path) { const char *s = path_init(nd, flags); int err; @@ -2306,7 +2306,7 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path return err; } -static int filename_lookup(int dfd, struct filename *name, unsigned flags, +static int filename_lookup(int dfd, struct filename *name, lookup_flags_t flags, struct path *path, struct path *root) { int retval; @@ -2332,7 +2332,7 @@ static int filename_lookup(int dfd, struct filename *name, unsigned flags, } /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ -static int path_parentat(struct nameidata *nd, unsigned flags, +static int path_parentat(struct nameidata *nd, lookup_flags_t flags, struct path *parent) { const char *s = path_init(nd, flags); @@ -2352,7 +2352,7 @@ static int path_parentat(struct nameidata *nd, unsigned flags, } static struct filename *filename_parentat(int dfd, struct filename *name, - unsigned int flags, struct path *parent, + lookup_flags_t flags, struct path *parent, struct qstr *last, int *type) { int retval; @@ -2405,7 +2405,7 @@ struct dentry *kern_path_locked(const char *name, struct path *path) return d; } -int kern_path(const char *name, unsigned int flags, struct path *path) +int kern_path(const char *name, lookup_flags_t flags, struct path *path) { return filename_lookup(AT_FDCWD, getname_kernel(name), flags, path, NULL); @@ -2421,7 +2421,7 @@ EXPORT_SYMBOL(kern_path); * @path: pointer to struct path to fill */ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, - const char *name, unsigned int flags, + const char *name, lookup_flags_t flags, struct path *path) { struct path root = {.mnt = mnt, .dentry = dentry}; @@ -2549,7 +2549,7 @@ int path_pts(struct path *path) } #endif -int user_path_at_empty(int dfd, const char __user *name, unsigned flags, +int user_path_at_empty(int dfd, const char __user *name, lookup_flags_t flags, struct path *path, int *empty) { return filename_lookup(dfd, getname_flags(name, flags, empty), @@ -2633,7 +2633,7 @@ mountpoint_last(struct nameidata *nd) * Returns 0 and "path" will be valid on success; Returns error otherwise. */ static int -path_mountpoint(struct nameidata *nd, unsigned flags, struct path *path) +path_mountpoint(struct nameidata *nd, lookup_flags_t flags, struct path *path) { const char *s = path_init(nd, flags); int err; @@ -2659,7 +2659,7 @@ path_mountpoint(struct nameidata *nd, unsigned flags, struct path *path) static int filename_mountpoint(int dfd, struct filename *name, struct path *path, - unsigned int flags) + lookup_flags_t flags) { struct nameidata nd; int error; @@ -2693,7 +2693,7 @@ filename_mountpoint(int dfd, struct filename *name, struct path *path, * Returns 0 and populates "path" on success. */ int -user_path_mountpoint_at(int dfd, const char __user *name, unsigned int flags, +user_path_mountpoint_at(int dfd, const char __user *name, lookup_flags_t flags, struct path *path) { return filename_mountpoint(dfd, getname(name), path, flags); @@ -2701,7 +2701,7 @@ user_path_mountpoint_at(int dfd, const char __user *name, unsigned int flags, int kern_path_mountpoint(int dfd, const char *name, struct path *path, - unsigned int flags) + lookup_flags_t flags) { return filename_mountpoint(dfd, getname_kernel(name), path, flags); } @@ -3420,7 +3420,7 @@ struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode, int open_flag) } EXPORT_SYMBOL(vfs_tmpfile); -static int do_tmpfile(struct nameidata *nd, unsigned flags, +static int do_tmpfile(struct nameidata *nd, lookup_flags_t flags, const struct open_flags *op, struct file *file, int *opened) { @@ -3454,7 +3454,7 @@ static int do_tmpfile(struct nameidata *nd, unsigned flags, return error; } -static int do_o_path(struct nameidata *nd, unsigned flags, struct file *file) +static int do_o_path(struct nameidata *nd, lookup_flags_t flags, struct file *file) { struct path path; int error = path_lookupat(nd, flags, &path); @@ -3467,7 +3467,7 @@ static int do_o_path(struct nameidata *nd, unsigned flags, struct file *file) } static struct file *path_openat(struct nameidata *nd, - const struct open_flags *op, unsigned flags) + const struct open_flags *op, lookup_flags_t flags) { const char *s; struct file *file; @@ -3528,7 +3528,7 @@ struct file *do_filp_open(int dfd, struct filename *pathname, const struct open_flags *op) { struct nameidata nd; - int flags = op->lookup_flags; + lookup_flags_t flags = op->lookup_flags; struct file *filp; set_nameidata(&nd, dfd, pathname); @@ -3547,7 +3547,7 @@ struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, struct nameidata nd; struct file *file; struct filename *filename; - int flags = op->lookup_flags | LOOKUP_ROOT; + lookup_flags_t flags = op->lookup_flags | LOOKUP_ROOT; nd.root.mnt = mnt; nd.root.dentry = dentry; @@ -3571,7 +3571,7 @@ struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, } static struct dentry *filename_create(int dfd, struct filename *name, - struct path *path, unsigned int lookup_flags) + struct path *path, lookup_flags_t lookup_flags) { struct dentry *dentry = ERR_PTR(-EEXIST); struct qstr last; @@ -3642,7 +3642,7 @@ static struct dentry *filename_create(int dfd, struct filename *name, } struct dentry *kern_path_create(int dfd, const char *pathname, - struct path *path, unsigned int lookup_flags) + struct path *path, lookup_flags_t lookup_flags) { return filename_create(dfd, getname_kernel(pathname), path, lookup_flags); @@ -3659,7 +3659,7 @@ void done_path_create(struct path *path, struct dentry *dentry) EXPORT_SYMBOL(done_path_create); inline struct dentry *user_path_create(int dfd, const char __user *pathname, - struct path *path, unsigned int lookup_flags) + struct path *path, lookup_flags_t lookup_flags) { return filename_create(dfd, getname(pathname), path, lookup_flags); } @@ -3716,7 +3716,7 @@ long do_mknodat(int dfd, const char __user *filename, umode_t mode, struct dentry *dentry; struct path path; int error; - unsigned int lookup_flags = 0; + lookup_flags_t lookup_flags = 0; error = may_mknod(mode); if (error) @@ -3796,7 +3796,7 @@ long do_mkdirat(int dfd, const char __user *pathname, umode_t mode) struct dentry *dentry; struct path path; int error; - unsigned int lookup_flags = LOOKUP_DIRECTORY; + lookup_flags_t lookup_flags = LOOKUP_DIRECTORY; retry: dentry = user_path_create(dfd, pathname, &path, lookup_flags); @@ -3873,7 +3873,7 @@ long do_rmdir(int dfd, const char __user *pathname) struct path path; struct qstr last; int type; - unsigned int lookup_flags = 0; + lookup_flags_t lookup_flags = 0; retry: name = filename_parentat(dfd, getname(pathname), lookup_flags, &path, &last, &type); @@ -4002,7 +4002,7 @@ long do_unlinkat(int dfd, struct filename *name) int type; struct inode *inode = NULL; struct inode *delegated_inode = NULL; - unsigned int lookup_flags = 0; + lookup_flags_t lookup_flags = 0; retry: name = filename_parentat(dfd, name, lookup_flags, &path, &last, &type); if (IS_ERR(name)) @@ -4108,7 +4108,7 @@ long do_symlinkat(const char __user *oldname, int newdfd, struct filename *from; struct dentry *dentry; struct path path; - unsigned int lookup_flags = 0; + lookup_flags_t lookup_flags = 0; from = getname(oldname); if (IS_ERR(from)) @@ -4238,7 +4238,7 @@ int do_linkat(int olddfd, const char __user *oldname, int newdfd, struct dentry *new_dentry; struct path old_path, new_path; struct inode *delegated_inode = NULL; - int how = 0; + lookup_flags_t how = 0; int error; if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) @@ -4494,7 +4494,7 @@ static int do_renameat2(int olddfd, const char __user *oldname, int newdfd, struct inode *delegated_inode = NULL; struct filename *from; struct filename *to; - unsigned int lookup_flags = 0, target_flags = LOOKUP_RENAME_TARGET; + lookup_flags_t lookup_flags = 0, target_flags = LOOKUP_RENAME_TARGET; bool should_retry = false; int error; --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1686,7 +1686,7 @@ int ksys_umount(char __user *name, int flags) struct path path; struct mount *mnt; int retval; - int lookup_flags = 0; + lookup_flags_t lookup_flags = 0; if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW)) return -EINVAL; --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -989,7 +989,7 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry, * Use intent information to check whether or not we're going to do * an O_EXCL create using this path component. */ -static int nfs_is_exclusive_create(struct inode *dir, unsigned int flags) +static int nfs_is_exclusive_create(struct inode *dir, lookup_flags_t flags) { if (NFS_PROTO(dir)->version == 2) return 0; @@ -1005,7 +1005,7 @@ static int nfs_is_exclusive_create(struct inode *dir, unsigned int flags) * */ static -int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags) +int nfs_lookup_verify_inode(struct inode *inode, lookup_flags_t flags) { struct nfs_server *server = NFS_SERVER(inode); int ret; @@ -1042,7 +1042,7 @@ int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags) */ static inline int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { /* Don't revalidate a negative dentry if we're creating a new file */ if (flags & LOOKUP_CREATE) @@ -1063,7 +1063,7 @@ int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry, * If the parent directory is seen to have changed, we throw out the * cached dentry and do a new lookup. */ -static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags) +static int nfs_lookup_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct inode *dir; struct inode *inode; @@ -1212,7 +1212,7 @@ static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags) * In this situation, we just want to verify that the inode itself is OK * since the dentry might have changed on the server. */ -static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags) +static int nfs_weak_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct inode *inode = d_inode(dentry); int error = 0; @@ -1316,7 +1316,7 @@ const struct dentry_operations nfs_dentry_operations = { }; EXPORT_SYMBOL_GPL(nfs_dentry_operations); -struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) +struct dentry *nfs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct dentry *res; struct inode *inode = NULL; @@ -1383,7 +1383,7 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in EXPORT_SYMBOL_GPL(nfs_lookup); #if IS_ENABLED(CONFIG_NFS_V4) -static int nfs4_lookup_revalidate(struct dentry *, unsigned int); +static int nfs4_lookup_revalidate(struct dentry *, lookup_flags_t); const struct dentry_operations nfs4_dentry_operations = { .d_revalidate = nfs4_lookup_revalidate, @@ -1443,7 +1443,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry, struct dentry *res; struct iattr attr = { .ia_valid = ATTR_OPEN }; struct inode *inode; - unsigned int lookup_flags = 0; + lookup_flags_t lookup_flags = 0; bool switched = false; int err; @@ -1555,7 +1555,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry, } EXPORT_SYMBOL_GPL(nfs_atomic_open); -static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags) +static int nfs4_lookup_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct inode *inode; int ret = 0; --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -355,7 +355,7 @@ extern unsigned long nfs_access_cache_count(struct shrinker *shrink, struct shrink_control *sc); extern unsigned long nfs_access_cache_scan(struct shrinker *shrink, struct shrink_control *sc); -struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int); +struct dentry *nfs_lookup(struct inode *, struct dentry *, lookup_flags_t); int nfs_create(struct inode *, struct dentry *, umode_t, bool); int nfs_mkdir(struct inode *, struct dentry *, umode_t); int nfs_rmdir(struct inode *, struct dentry *); --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c @@ -61,7 +61,7 @@ static inline int nilfs_add_nondir(struct dentry *dentry, struct inode *inode) */ static struct dentry * -nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +nilfs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct inode *inode; ino_t ino; --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -476,7 +476,7 @@ static int fanotify_find_path(int dfd, const char __user *filename, path_get(path); fdput(f); } else { - unsigned int lookup_flags = 0; + lookup_flags_t lookup_flags = 0; if (!(flags & FAN_MARK_DONT_FOLLOW)) lookup_flags |= LOOKUP_FOLLOW; --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -341,7 +341,7 @@ static const struct file_operations inotify_fops = { /* * find_inode - resolve a user-given path to a specific inode */ -static int inotify_find_inode(const char __user *dirname, struct path *path, unsigned flags) +static int inotify_find_inode(const char __user *dirname, struct path *path, lookup_flags_t flags) { int error; @@ -692,7 +692,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, struct path path; struct fd f; int ret; - unsigned flags = 0; + lookup_flags_t flags = 0; /* * We share a lot of code with fs/dnotify. We also share --- a/fs/ntfs/namei.c +++ b/fs/ntfs/namei.c @@ -101,7 +101,7 @@ * Locking: Caller must hold i_mutex on the directory. */ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent, - unsigned int flags) + lookup_flags_t flags) { ntfs_volume *vol = NTFS_SB(dir_ino->i_sb); struct inode *dent_inode; --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c @@ -48,7 +48,7 @@ void ocfs2_dentry_attach_gen(struct dentry *dentry) } -static int ocfs2_dentry_revalidate(struct dentry *dentry, unsigned int flags) +static int ocfs2_dentry_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct inode *inode; int ret = 0; /* if all else fails, just return false */ --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -109,7 +109,7 @@ static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2); #define OCFS2_ORPHAN_NAMELEN ((int)(2 * sizeof(u64))) static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { int status; u64 blkno; --- a/fs/omfs/dir.c +++ b/fs/omfs/dir.c @@ -291,7 +291,7 @@ static int omfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, } static struct dentry *omfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct buffer_head *bh; struct inode *inode = NULL; --- a/fs/open.c +++ b/fs/open.c @@ -130,7 +130,7 @@ EXPORT_SYMBOL_GPL(vfs_truncate); long do_sys_truncate(const char __user *pathname, loff_t length) { - unsigned int lookup_flags = LOOKUP_FOLLOW; + lookup_flags_t lookup_flags = LOOKUP_FOLLOW; struct path path; int error; @@ -362,7 +362,7 @@ long do_faccessat(int dfd, const char __user *filename, int mode) struct path path; struct inode *inode; int res; - unsigned int lookup_flags = LOOKUP_FOLLOW; + lookup_flags_t lookup_flags = LOOKUP_FOLLOW; if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */ return -EINVAL; @@ -445,7 +445,7 @@ int ksys_chdir(const char __user *filename) { struct path path; int error; - unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY; + lookup_flags_t lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY; retry: error = user_path_at(AT_FDCWD, filename, lookup_flags, &path); if (error) @@ -498,7 +498,7 @@ int ksys_chroot(const char __user *filename) { struct path path; int error; - unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY; + lookup_flags_t lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY; retry: error = user_path_at(AT_FDCWD, filename, lookup_flags, &path); if (error) @@ -583,7 +583,7 @@ int do_fchmodat(int dfd, const char __user *filename, umode_t mode) { struct path path; int error; - unsigned int lookup_flags = LOOKUP_FOLLOW; + lookup_flags_t lookup_flags = LOOKUP_FOLLOW; retry: error = user_path_at(dfd, filename, lookup_flags, &path); if (!error) { @@ -655,7 +655,7 @@ int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group, { struct path path; int error = -EINVAL; - int lookup_flags; + lookup_flags_t lookup_flags; if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) != 0) goto out; @@ -933,7 +933,7 @@ EXPORT_SYMBOL(dentry_open); static inline int build_open_flags(int flags, umode_t mode, struct open_flags *op) { - int lookup_flags = 0; + lookup_flags_t lookup_flags = 0; int acc_mode = ACC_MODE(flags); /* --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c @@ -170,13 +170,13 @@ static const struct file_operations openprom_operations = { .llseek = generic_file_llseek, }; -static struct dentry *openpromfs_lookup(struct inode *, struct dentry *, unsigned int); +static struct dentry *openpromfs_lookup(struct inode *, struct dentry *, lookup_flags_t); static const struct inode_operations openprom_inode_operations = { .lookup = openpromfs_lookup, }; -static struct dentry *openpromfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +static struct dentry *openpromfs_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { struct op_inode_info *ent_oi, *oi = OP_I(dir); struct device_node *dp, *child; --- a/fs/orangefs/dcache.c +++ b/fs/orangefs/dcache.c @@ -92,7 +92,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry) * * Should return 1 if dentry can still be trusted, else 0. */ -static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags) +static int orangefs_d_revalidate(struct dentry *dentry, lookup_flags_t flags) { int ret; unsigned long time = (unsigned long) dentry->d_fsdata; --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -106,7 +106,7 @@ static int orangefs_create(struct inode *dir, * fsid into a handle for the object. */ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct orangefs_inode_s *parent = ORANGEFS_I(dir); struct orangefs_kernel_op_s *new_op; --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c @@ -816,7 +816,7 @@ static int ovl_fix_origin(struct dentry *dentry, struct dentry *lower, } struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct ovl_entry *oe; const struct cred *old_cred; --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h @@ -288,7 +288,7 @@ struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper, struct dentry *origin, bool verify); int ovl_path_next(int idx, struct dentry *dentry, struct path *path); struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags); + lookup_flags_t flags); bool ovl_lower_positive(struct dentry *dentry); static inline int ovl_verify_origin(struct dentry *upper, --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -137,7 +137,7 @@ static struct dentry *ovl_d_real(struct dentry *dentry, return dentry; } -static int ovl_dentry_revalidate(struct dentry *dentry, unsigned int flags) +static int ovl_dentry_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct ovl_entry *oe = dentry->d_fsdata; unsigned int i; @@ -160,7 +160,7 @@ static int ovl_dentry_revalidate(struct dentry *dentry, unsigned int flags) return 1; } -static int ovl_dentry_weak_revalidate(struct dentry *dentry, unsigned int flags) +static int ovl_dentry_weak_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct ovl_entry *oe = dentry->d_fsdata; unsigned int i; --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1817,7 +1817,7 @@ int pid_getattr(const struct path *path, struct kstat *stat, * performed a setuid(), etc. * */ -int pid_revalidate(struct dentry *dentry, unsigned int flags) +int pid_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct inode *inode; struct task_struct *task; @@ -1950,7 +1950,7 @@ static int dname_to_vma_addr(struct dentry *dentry, return 0; } -static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags) +static int map_files_d_revalidate(struct dentry *dentry, lookup_flags_t flags) { unsigned long vm_start, vm_end; bool exact_vma_exists = false; @@ -2094,7 +2094,7 @@ proc_map_files_instantiate(struct inode *dir, struct dentry *dentry, } static struct dentry *proc_map_files_lookup(struct inode *dir, - struct dentry *dentry, unsigned int flags) + struct dentry *dentry, lookup_flags_t flags) { unsigned long vm_start, vm_end; struct vm_area_struct *vma; @@ -2621,7 +2621,7 @@ static const struct file_operations proc_attr_dir_operations = { }; static struct dentry *proc_attr_dir_lookup(struct inode *dir, - struct dentry *dentry, unsigned int flags) + struct dentry *dentry, lookup_flags_t flags) { return proc_pident_lookup(dir, dentry, attr_dir_stuff, ARRAY_SIZE(attr_dir_stuff)); @@ -3039,7 +3039,7 @@ static const struct file_operations proc_tgid_base_operations = { .llseek = generic_file_llseek, }; -static struct dentry *proc_tgid_base_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +static struct dentry *proc_tgid_base_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { return proc_pident_lookup(dir, dentry, tgid_base_stuff, ARRAY_SIZE(tgid_base_stuff)); @@ -3164,7 +3164,7 @@ static int proc_pid_instantiate(struct inode *dir, return -ENOENT; } -struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) +struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, lookup_flags_t flags) { int result = -ENOENT; struct task_struct *task; @@ -3417,7 +3417,7 @@ static int proc_tid_base_readdir(struct file *file, struct dir_context *ctx) tid_base_stuff, ARRAY_SIZE(tid_base_stuff)); } -static struct dentry *proc_tid_base_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +static struct dentry *proc_tid_base_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { return proc_pident_lookup(dir, dentry, tid_base_stuff, ARRAY_SIZE(tid_base_stuff)); @@ -3459,7 +3459,7 @@ static int proc_task_instantiate(struct inode *dir, return -ENOENT; } -static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) +static struct dentry *proc_task_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { int result = -ENOENT; struct task_struct *task; --- a/fs/proc/fd.c +++ b/fs/proc/fd.c @@ -81,7 +81,7 @@ static const struct file_operations proc_fdinfo_file_operations = { .release = single_release, }; -static int tid_fd_revalidate(struct dentry *dentry, unsigned int flags) +static int tid_fd_revalidate(struct dentry *dentry, lookup_flags_t flags) { struct files_struct *files; struct task_struct *task; @@ -271,7 +271,7 @@ const struct file_operations proc_fd_operations = { }; static struct dentry *proc_lookupfd(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { return proc_lookupfd_common(dir, dentry, proc_fd_instantiate); } @@ -332,7 +332,7 @@ proc_fdinfo_instantiate(struct inode *dir, struct dentry *dentry, } static struct dentry * -proc_lookupfdinfo(struct inode *dir, struct dentry *dentry, unsigned int flags) +proc_lookupfdinfo(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { return proc_lookupfd_common(dir, dentry, proc_fdinfo_instantiate); } --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -218,7 +218,7 @@ void proc_free_inum(unsigned int inum) ida_simple_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST); } -static int proc_misc_d_revalidate(struct dentry *dentry, unsigned int flags) +static int proc_misc_d_revalidate(struct dentry *dentry, lookup_flags_t flags) { if (flags & LOOKUP_RCU) return -ECHILD; @@ -264,7 +264,7 @@ struct dentry *proc_lookup_de(struct inode *dir, struct dentry *dentry, } struct dentry *proc_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { return proc_lookup_de(dir, dentry, PDE(dir)); } --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -147,10 +147,10 @@ extern const struct dentry_operations pid_dentry_operations; extern int pid_getattr(const struct path *, struct kstat *, u32, unsigned int); extern int proc_setattr(struct dentry *, struct iattr *); extern struct inode *proc_pid_make_inode(struct super_block *, struct task_struct *, umode_t); -extern int pid_revalidate(struct dentry *, unsigned int); +int pid_revalidate(struct dentry *, lookup_flags_t); extern int pid_delete_dentry(const struct dentry *); extern int proc_pid_readdir(struct file *, struct dir_context *); -extern struct dentry *proc_pid_lookup(struct inode *, struct dentry *, unsigned int); +struct dentry *proc_pid_lookup(struct inode *, struct dentry *, lookup_flags_t); extern loff_t mem_lseek(struct file *, loff_t, int); /* Lookups */ @@ -162,7 +162,7 @@ extern bool proc_fill_cache(struct file *, struct dir_context *, const char *, i /* * generic.c */ -extern struct dentry *proc_lookup(struct inode *, struct dentry *, unsigned int); +struct dentry *proc_lookup(struct inode *, struct dentry *, lookup_flags_t); struct dentry *proc_lookup_de(struct inode *, struct dentry *, struct proc_dir_entry *); extern int proc_readdir(struct file *, struct dir_context *); int proc_readdir_de(struct file *, struct dir_context *, struct proc_dir_entry *); --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c @@ -145,7 +145,7 @@ const struct file_operations proc_ns_dir_operations = { }; static struct dentry *proc_ns_dir_lookup(struct inode *dir, - struct dentry *dentry, unsigned int flags) + struct dentry *dentry, lookup_flags_t flags) { int error; struct task_struct *task = get_proc_task(dir); --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c @@ -127,7 +127,7 @@ static struct net *get_proc_task_net(struct inode *dir) } static struct dentry *proc_tgid_net_lookup(struct inode *dir, - struct dentry *dentry, unsigned int flags) + struct dentry *dentry, lookup_flags_t flags) { struct dentry *de; struct net *net; --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -522,7 +522,7 @@ static struct ctl_table_header *grab_header(struct inode *inode) } static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct ctl_table_header *head = grab_header(dir); struct ctl_table_header *h = NULL; @@ -861,7 +861,7 @@ static const struct inode_operations proc_sys_dir_operations = { .getattr = proc_sys_getattr, }; -static int proc_sys_revalidate(struct dentry *dentry, unsigned int flags) +static int proc_sys_revalidate(struct dentry *dentry, lookup_flags_t flags) { if (flags & LOOKUP_RCU) return -ECHILD; --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -152,7 +152,7 @@ static int proc_root_getattr(const struct path *path, struct kstat *stat, return 0; } -static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry, unsigned int flags) +static struct dentry *proc_root_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { if (!proc_pid_lookup(dir, dentry, flags)) return NULL; --- a/fs/qnx4/namei.c +++ b/fs/qnx4/namei.c @@ -92,7 +92,7 @@ static struct buffer_head *qnx4_find_entry(int len, struct inode *dir, return NULL; } -struct dentry * qnx4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +struct dentry *qnx4_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { int ino; struct qnx4_inode_entry *de; --- a/fs/qnx4/qnx4.h +++ b/fs/qnx4/qnx4.h @@ -22,7 +22,7 @@ struct qnx4_inode_info { }; extern struct inode *qnx4_iget(struct super_block *, unsigned long); -extern struct dentry *qnx4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags); +struct dentry *qnx4_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags); extern unsigned long qnx4_count_free_blocks(struct super_block *sb); extern unsigned long qnx4_block_map(struct inode *inode, long iblock); --- a/fs/qnx6/namei.c +++ b/fs/qnx6/namei.c @@ -14,7 +14,7 @@ #include "qnx6.h" struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { unsigned ino; struct page *page; --- a/fs/qnx6/qnx6.h +++ b/fs/qnx6/qnx6.h @@ -46,7 +46,7 @@ struct qnx6_inode_info { extern struct inode *qnx6_iget(struct super_block *sb, unsigned ino); extern struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags); + lookup_flags_t flags); #ifdef CONFIG_QNX6FS_DEBUG extern void qnx6_superblock_debug(struct qnx6_super_block *, --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c @@ -350,7 +350,7 @@ static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen, } static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { int retval; struct inode *inode = NULL; --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c @@ -927,7 +927,7 @@ int reiserfs_permission(struct inode *inode, int mask) return generic_permission(inode, mask); } -static int xattr_hide_revalidate(struct dentry *dentry, unsigned int flags) +static int xattr_hide_revalidate(struct dentry *dentry, lookup_flags_t flags) { return -EPERM; } --- a/fs/romfs/super.c +++ b/fs/romfs/super.c @@ -210,7 +210,7 @@ static int romfs_readdir(struct file *file, struct dir_context *ctx) * look up an entry in a directory */ static struct dentry *romfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { unsigned long offset, maxoff; struct inode *inode; --- a/fs/squashfs/namei.c +++ b/fs/squashfs/namei.c @@ -137,7 +137,7 @@ static int get_dir_index_using_name(struct super_block *sb, static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { const unsigned char *name = dentry->d_name.name; int len = dentry->d_name.len; --- a/fs/stat.c +++ b/fs/stat.c @@ -168,7 +168,7 @@ int vfs_statx(int dfd, const char __user *filename, int flags, { struct path path; int error = -EINVAL; - unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT; + lookup_flags_t lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT; if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0) @@ -385,7 +385,7 @@ static int do_readlinkat(int dfd, const char __user *pathname, struct path path; int error; int empty = 0; - unsigned int lookup_flags = LOOKUP_EMPTY; + lookup_flags_t lookup_flags = LOOKUP_EMPTY; if (bufsiz <= 0) return -EINVAL; --- a/fs/statfs.c +++ b/fs/statfs.c @@ -82,7 +82,7 @@ int user_statfs(const char __user *pathname, struct kstatfs *st) { struct path path; int error; - unsigned int lookup_flags = LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT; + lookup_flags_t lookup_flags = LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT; retry: error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path); if (!error) { --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c @@ -43,7 +43,7 @@ const struct dentry_operations sysv_dentry_operations = { .d_hash = sysv_hash, }; -static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, unsigned int flags) +static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, lookup_flags_t flags) { struct inode * inode = NULL; ino_t ino; --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -209,7 +209,7 @@ static int dbg_check_name(const struct ubifs_info *c, } static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { int err; union ubifs_key key; --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -294,7 +294,7 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, } static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct inode *inode = NULL; struct fileIdentDesc cfi; --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c @@ -49,7 +49,7 @@ static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) return err; } -static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, unsigned int flags) +static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, lookup_flags_t flags) { struct inode * inode = NULL; ino_t ino; --- a/fs/utimes.c +++ b/fs/utimes.c @@ -144,7 +144,7 @@ long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, fdput(f); } else { struct path path; - int lookup_flags = 0; + lookup_flags_t lookup_flags = 0; if (!(flags & AT_SYMLINK_NOFOLLOW)) lookup_flags |= LOOKUP_FOLLOW; --- a/fs/xattr.c +++ b/fs/xattr.c @@ -459,7 +459,7 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value, static int path_setxattr(const char __user *pathname, const char __user *name, const void __user *value, - size_t size, int flags, unsigned int lookup_flags) + size_t size, int flags, lookup_flags_t lookup_flags) { struct path path; int error; @@ -557,7 +557,7 @@ getxattr(struct dentry *d, const char __user *name, void __user *value, static ssize_t path_getxattr(const char __user *pathname, const char __user *name, void __user *value, - size_t size, unsigned int lookup_flags) + size_t size, lookup_flags_t lookup_flags) { struct path path; ssize_t error; @@ -633,7 +633,7 @@ listxattr(struct dentry *d, char __user *list, size_t size) } static ssize_t path_listxattr(const char __user *pathname, char __user *list, - size_t size, unsigned int lookup_flags) + size_t size, lookup_flags_t lookup_flags) { struct path path; ssize_t error; @@ -694,7 +694,7 @@ removexattr(struct dentry *d, const char __user *name) } static int path_removexattr(const char __user *pathname, - const char __user *name, unsigned int lookup_flags) + const char __user *name, lookup_flags_t lookup_flags) { struct path path; int error; --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -258,7 +258,7 @@ STATIC struct dentry * xfs_vn_lookup( struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct xfs_inode *cip; struct xfs_name name; @@ -283,7 +283,7 @@ STATIC struct dentry * xfs_vn_ci_lookup( struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { struct xfs_inode *ip; struct xfs_name xname; --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -132,8 +132,8 @@ enum dentry_d_lock_class }; struct dentry_operations { - int (*d_revalidate)(struct dentry *, unsigned int); - int (*d_weak_revalidate)(struct dentry *, unsigned int); + int (*d_revalidate)(struct dentry *, lookup_flags_t); + int (*d_weak_revalidate)(struct dentry *, lookup_flags_t); int (*d_hash)(const struct dentry *, struct qstr *); int (*d_compare)(const struct dentry *, unsigned int, const char *, const struct qstr *); --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1743,7 +1743,7 @@ struct file_operations { } __randomize_layout; struct inode_operations { - struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); + struct dentry * (*lookup) (struct inode *,struct dentry *, lookup_flags_t); const char * (*get_link) (struct dentry *, struct inode *, struct delayed_call *); int (*permission) (struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); @@ -2403,7 +2403,7 @@ extern struct file *file_open_root(struct dentry *, struct vfsmount *, extern struct file * dentry_open(const struct path *, int, const struct cred *); extern int filp_close(struct file *, fl_owner_t id); -extern struct filename *getname_flags(const char __user *, int, int *); +struct filename *getname_flags(const char __user *, lookup_flags_t, int *); extern struct filename *getname(const char __user *); extern struct filename *getname_kernel(const char *); extern void putname(struct filename *name); @@ -3150,7 +3150,7 @@ extern struct inode *alloc_anon_inode(struct super_block *); extern int simple_nosetlease(struct file *, long, struct file_lock **, void **); extern const struct dentry_operations simple_dentry_operations; -extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); +struct dentry *simple_lookup(struct inode *, struct dentry *, lookup_flags_t flags); extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); extern const struct file_operations simple_dir_operations; extern const struct inode_operations simple_dir_inode_operations; --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -155,7 +155,7 @@ static inline int fscrypt_prepare_rename(struct inode *old_dir, */ static inline int fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) + lookup_flags_t flags) { if (IS_ENCRYPTED(dir)) return __fscrypt_prepare_lookup(dir, dentry); --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -25,33 +25,33 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; * - dentry cache is untrusted; force a real lookup * - suppress terminal automount */ -#define LOOKUP_FOLLOW 0x0001 -#define LOOKUP_DIRECTORY 0x0002 -#define LOOKUP_AUTOMOUNT 0x0004 +#define LOOKUP_FOLLOW ((lookup_flags_t __force)0x0001) +#define LOOKUP_DIRECTORY ((lookup_flags_t __force)0x0002) +#define LOOKUP_AUTOMOUNT ((lookup_flags_t __force)0x0004) -#define LOOKUP_PARENT 0x0010 -#define LOOKUP_REVAL 0x0020 -#define LOOKUP_RCU 0x0040 -#define LOOKUP_NO_REVAL 0x0080 +#define LOOKUP_PARENT ((lookup_flags_t __force)0x0010) +#define LOOKUP_REVAL ((lookup_flags_t __force)0x0020) +#define LOOKUP_RCU ((lookup_flags_t __force)0x0040) +#define LOOKUP_NO_REVAL ((lookup_flags_t __force)0x0080) /* * Intent data */ -#define LOOKUP_OPEN 0x0100 -#define LOOKUP_CREATE 0x0200 -#define LOOKUP_EXCL 0x0400 -#define LOOKUP_RENAME_TARGET 0x0800 +#define LOOKUP_OPEN ((lookup_flags_t __force)0x0100) +#define LOOKUP_CREATE ((lookup_flags_t __force)0x0200) +#define LOOKUP_EXCL ((lookup_flags_t __force)0x0400) +#define LOOKUP_RENAME_TARGET ((lookup_flags_t __force)0x0800) -#define LOOKUP_JUMPED 0x1000 -#define LOOKUP_ROOT 0x2000 -#define LOOKUP_EMPTY 0x4000 -#define LOOKUP_DOWN 0x8000 +#define LOOKUP_JUMPED ((lookup_flags_t __force)0x1000) +#define LOOKUP_ROOT ((lookup_flags_t __force)0x2000) +#define LOOKUP_EMPTY ((lookup_flags_t __force)0x4000) +#define LOOKUP_DOWN ((lookup_flags_t __force)0x8000) extern int path_pts(struct path *path); -extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty); +int user_path_at_empty(int, const char __user *, lookup_flags_t, struct path *, int *empty); -static inline int user_path_at(int dfd, const char __user *name, unsigned flags, +static inline int user_path_at(int dfd, const char __user *name, lookup_flags_t flags, struct path *path) { return user_path_at_empty(dfd, name, flags, path, NULL); @@ -73,13 +73,13 @@ static inline int user_path_dir(const char __user *name, struct path *path) LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path, NULL); } -extern int kern_path(const char *, unsigned, struct path *); +int kern_path(const char *, lookup_flags_t, struct path *); -extern struct dentry *kern_path_create(int, const char *, struct path *, unsigned int); -extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); +struct dentry *kern_path_create(int, const char *, struct path *, lookup_flags_t); +struct dentry *user_path_create(int, const char __user *, struct path *, lookup_flags_t); extern void done_path_create(struct path *, struct dentry *); extern struct dentry *kern_path_locked(const char *, struct path *); -extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int); +int kern_path_mountpoint(int, const char *, struct path *, lookup_flags_t); extern struct dentry *lookup_one_len(const char *, struct dentry *, int); extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int); @@ -109,7 +109,7 @@ static inline void nd_terminate_link(void *name, size_t len, size_t maxlen) * Returns true if the caller should try the operation again. */ static inline bool -retry_estale(const long error, const unsigned int flags) +retry_estale(const long error, const lookup_flags_t flags) { return error == -ESTALE && !(flags & LOOKUP_REVAL); } --- a/include/linux/types.h +++ b/include/linux/types.h @@ -158,6 +158,7 @@ typedef u32 dma_addr_t; typedef unsigned __bitwise gfp_t; typedef unsigned __bitwise slab_flags_t; typedef unsigned __bitwise fmode_t; +typedef unsigned __bitwise lookup_flags_t; #ifdef CONFIG_PHYS_ADDR_T_64BIT typedef u64 phys_addr_t; --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c @@ -176,7 +176,7 @@ static int bpf_mkmap(struct dentry *dentry, umode_t mode, void *arg) } static struct dentry * -bpf_lookup(struct inode *dir, struct dentry *dentry, unsigned flags) +bpf_lookup(struct inode *dir, struct dentry *dentry, lookup_flags_t flags) { /* Dots in names (e.g. "/sys/fs/bpf/foo.bar") are reserved for future * extensions.