Implement a genfs_rename abstraction.

First major step in incrementally adapting all the file systems to a
saner rename VOP protocol.
This commit is contained in:
riastradh 2012-05-08 23:53:26 +00:00
parent 8eac82d05c
commit 5ecfdf8dea
4 changed files with 1227 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.1049 2012/05/05 19:15:10 rmind Exp $
# $NetBSD: files,v 1.1050 2012/05/08 23:53:26 riastradh Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20100430
@ -1625,6 +1625,7 @@ file kern/vnode_if.c
file miscfs/deadfs/dead_vnops.c
file miscfs/fifofs/fifo_vnops.c
file miscfs/genfs/genfs_io.c
file miscfs/genfs/genfs_rename.c
file miscfs/genfs/genfs_vfsops.c
file miscfs/genfs/genfs_vnops.c
file miscfs/genfs/layer_subr.c nullfs | overlay | umapfs

View File

@ -1,9 +1,13 @@
/* $NetBSD: genfs.h,v 1.29 2012/03/13 18:40:57 elad Exp $ */
/* $NetBSD: genfs.h,v 1.30 2012/05/08 23:53:26 riastradh Exp $ */
#ifndef _MISCFS_GENFS_GENFS_H_
#define _MISCFS_GENFS_GENFS_H_
#include <sys/vnode.h>
#include <sys/types.h>
struct componentname;
struct mount;
int genfs_badop(void *);
int genfs_nullop(void *);
@ -47,4 +51,68 @@ int genfs_can_chflags(kauth_cred_t, enum vtype, uid_t, bool);
int genfs_can_sticky(kauth_cred_t, uid_t, uid_t);
int genfs_can_extattr(kauth_cred_t, int, vnode_t *, const char *);
/*
* Rename is complicated. Sorry.
*/
struct genfs_rename_ops;
int genfs_insane_rename(void *,
int (*)(struct vnode *, struct componentname *,
struct vnode *, struct componentname *,
kauth_cred_t, bool));
int genfs_sane_rename(const struct genfs_rename_ops *,
struct vnode *, struct componentname *, void *,
struct vnode *, struct componentname *, void *,
kauth_cred_t, bool);
void genfs_rename_knote(struct vnode *, struct vnode *, struct vnode *,
struct vnode *, bool);
void genfs_rename_cache_purge(struct vnode *, struct vnode *, struct vnode *,
struct vnode *);
int genfs_ufslike_rename_check_possible(unsigned long, unsigned long,
unsigned long, unsigned long, bool,
unsigned long, unsigned long);
int genfs_ufslike_rename_check_permitted(kauth_cred_t,
struct vnode *, mode_t, uid_t,
struct vnode *, uid_t,
struct vnode *, mode_t, uid_t,
struct vnode *, uid_t);
int genfs_ufslike_remove_check_possible(unsigned long, unsigned long,
unsigned long, unsigned long);
int genfs_ufslike_remove_check_permitted(kauth_cred_t,
struct vnode *, mode_t, uid_t,
struct vnode *, uid_t);
struct genfs_rename_ops {
bool (*gro_directory_empty_p)(struct mount *mp, kauth_cred_t cred,
struct vnode *vp, struct vnode *dvp);
int (*gro_rename_check_possible)(struct mount *mp,
struct vnode *fdvp, struct vnode *fvp,
struct vnode *tdvp, struct vnode *tvp);
int (*gro_rename_check_permitted)(struct mount *mp, kauth_cred_t cred,
struct vnode *fdvp, struct vnode *fvp,
struct vnode *tdvp, struct vnode *tvp);
int (*gro_remove_check_possible)(struct mount *mp,
struct vnode *dvp, struct vnode *vp);
int (*gro_remove_check_permitted)(struct mount *mp, kauth_cred_t cred,
struct vnode *dvp, struct vnode *vp);
int (*gro_rename)(struct mount *mp, kauth_cred_t cred,
struct vnode *fdvp, struct componentname *fcnp,
void *fde, struct vnode *fvp,
struct vnode *tdvp, struct componentname *tcnp,
void *tde, struct vnode *tvp);
int (*gro_remove)(struct mount *mp, kauth_cred_t cred,
struct vnode *dvp, struct componentname *cnp, void *de,
struct vnode *vp);
int (*gro_lookup)(struct mount *mp, struct vnode *dvp,
struct componentname *cnp, void *fde_ret, struct vnode **vp_ret);
int (*gro_genealogy)(struct mount *mp, kauth_cred_t cred,
struct vnode *fdvp, struct vnode *tdvp,
struct vnode **intermediate_node_ret);
int (*gro_lock_directory)(struct mount *mp, struct vnode *vp);
};
#endif /* !_MISCFS_GENFS_GENFS_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.rumpvfs,v 1.32 2012/01/29 06:26:55 dholland Exp $
# $NetBSD: Makefile.rumpvfs,v 1.33 2012/05/08 23:53:26 riastradh Exp $
#
.include "${RUMPTOP}/Makefile.rump"
@ -42,7 +42,7 @@ SRCS+= sync_subr.c sync_vnops.c
SRCS+= dead_vnops.c
# sys/miscfs
SRCS+= genfs_io.c genfs_vfsops.c genfs_vnops.c spec_vnops.c
SRCS+= genfs_io.c genfs_rename.c genfs_vfsops.c genfs_vnops.c spec_vnops.c
# sys/kern bufq
SRCS+= subr_bufq.c bufq_disksort.c bufq_fcfs.c bufq_priocscan.c \