diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2013-06-05 18:26:07 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2013-06-05 18:26:07 +0000 |
commit | 532e3b6a0c874e594e7947bf17134e61193750e6 (patch) | |
tree | 8968ae2c549aa285c0344cc126911068a7310204 /lib | |
parent | 09e0efda189ed3bb0be7e760712b56d8e4e99f4d (diff) |
rename should be working now, from Sylvestre Gallon
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libfuse/fuse_ops.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/libfuse/fuse_ops.c b/lib/libfuse/fuse_ops.c index 27373dbd2e5..873b32cbd27 100644 --- a/lib/libfuse/fuse_ops.c +++ b/lib/libfuse/fuse_ops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_ops.c,v 1.3 2013/06/04 20:53:27 tedu Exp $ */ +/* $OpenBSD: fuse_ops.c,v 1.4 2013/06/05 18:26:06 tedu Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -790,6 +790,33 @@ ifuse_ops_symlink(unused struct fuse *f, struct fusebuf *fbuf) } static int +ifuse_ops_rename(struct fuse *f, struct fusebuf *fbuf) +{ + struct fuse_vnode *vnt; + struct fuse_vnode *vnf; + char *realnamef; + char *realnamet; + int len; + + CHECK_OPT(rename); + + len = strlen(fbuf->fb_dat); + vnf = get_vn_by_name_and_parent(f, fbuf->fb_dat, fbuf->fb_ino); + vnt = get_vn_by_name_and_parent(f, &fbuf->fb_dat[len + 1], + fbuf->fb_io_ino); + fbuf->fb_len = 0; + + realnamef = build_realname(f, vnf->ino); + realnamet = build_realname(f, vnt->ino); + fbuf->fb_err = f->op.rename(realnamef, realnamet); + free(realnamef); + free(realnamet); + + DPRINTF("\n"); + return (0); +} + +static int ifuse_ops_destroy(struct fuse *f, struct fusebuf *fbuf) { DPRINTF("Opcode:\tdestroy\n"); @@ -869,6 +896,9 @@ ifuse_exec_opcode(struct fuse *f, struct fusebuf *fbuf) case FBT_SYMLINK: ret = ifuse_ops_symlink(f, fbuf); break; + case FBT_RENAME: + ret = ifuse_ops_rename(f, fbuf); + break; case FBT_DESTROY: ret = ifuse_ops_destroy(f, fbuf); break; |