summaryrefslogtreecommitdiffstats
path: root/xlators/features/trash
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-10-01 06:58:47 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-01 07:22:46 -0700
commite11d66c8d6dea72d02f9bcdbf65c67bd5c60b5cc (patch)
treeffa96a3f78b79db2704a5bc410174714fd66fa67 /xlators/features/trash
parent186a86f342625a9dce53fe537f8237c6099d5c54 (diff)
Global: NFS-friendly prototype changes
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 145 (NFSv3 related additions to 2.1 task list) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=145
Diffstat (limited to 'xlators/features/trash')
-rw-r--r--xlators/features/trash/src/trash.c78
1 files changed, 67 insertions, 11 deletions
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
index fa5d752..cc5a691 100644
--- a/xlators/features/trash/src/trash.c
+++ b/xlators/features/trash/src/trash.c
@@ -56,14 +56,22 @@ trash_unlink_rename_cbk (call_frame_t *frame,
xlator_t *this,
int32_t op_ret,
int32_t op_errno,
- struct stat *buf);
+ struct stat *buf,
+ struct stat *preoldparent,
+ struct stat *postoldparent,
+ struct stat *prenewparent,
+ struct stat *postnewparent);
int32_t
trash_rename_rename_cbk (call_frame_t *frame,
void *cookie,
xlator_t *this,
int32_t op_ret,
int32_t op_errno,
- struct stat *buf);
+ struct stat *buf,
+ struct stat *preoldparent,
+ struct stat *postoldparent,
+ struct stat *prenewparent,
+ struct stat *postnewparent);
/**
* trash_common_unwind_cbk -
@@ -73,7 +81,9 @@ trash_common_unwind_cbk (call_frame_t *frame,
void *cookie,
xlator_t *this,
int32_t op_ret,
- int32_t op_errno)
+ int32_t op_errno,
+ struct stat *preparent,
+ struct stat *postparent)
{
trash_local_t *local = frame->local;
@@ -91,6 +101,39 @@ trash_common_unwind_cbk (call_frame_t *frame,
return 0;
}
+
+/**
+ * trash_rename_unwind_buf_cbk -
+ */
+int32_t
+trash_rename_unwind_buf_cbk (call_frame_t *frame,
+ void *cookie,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *buf,
+ struct stat *preoldparent,
+ struct stat *postoldparent,
+ struct stat *prenewparent,
+ struct stat *postnewparent)
+{
+ trash_local_t *local = frame->local;
+
+ if (!local)
+ goto out;
+
+ if (local->loc1.path)
+ loc_wipe (&local->loc1);
+
+ if (local->loc2.path)
+ loc_wipe (&local->loc2);
+
+ out:
+ STACK_UNWIND (frame, op_ret, op_errno, buf);
+ return 0;
+}
+
+
/**
* trash_common_unwind_buf_cbk -
*/
@@ -125,7 +168,9 @@ trash_mkdir_cbk (call_frame_t *frame,
int32_t op_ret,
int32_t op_errno,
inode_t *inode,
- struct stat *stbuf)
+ struct stat *stbuf,
+ struct stat *preparent,
+ struct stat *postparent)
{
trash_local_t *local = frame->local;
char *tmp_str = strdup (local->newpath);
@@ -189,7 +234,11 @@ trash_unlink_rename_cbk (call_frame_t *frame,
xlator_t *this,
int32_t op_ret,
int32_t op_errno,
- struct stat *buf)
+ struct stat *buf,
+ struct stat *preoldparent,
+ struct stat *postoldparent,
+ struct stat *prenewparent,
+ struct stat *postnewparent)
{
trash_local_t *local = frame->local;
if (op_ret == -1 && op_errno == ENOENT) {
@@ -302,7 +351,9 @@ trash_rename_mkdir_cbk (call_frame_t *frame,
int32_t op_ret,
int32_t op_errno,
inode_t *inode,
- struct stat *stbuf)
+ struct stat *stbuf,
+ struct stat *preparent,
+ struct stat *postparent)
{
trash_local_t *local = frame->local;
char *tmp_str = strdup (local->newpath);
@@ -367,7 +418,11 @@ trash_rename_rename_cbk (call_frame_t *frame,
xlator_t *this,
int32_t op_ret,
int32_t op_errno,
- struct stat *buf)
+ struct stat *buf,
+ struct stat *preoldparent,
+ struct stat *postoldparent,
+ struct stat *prenewparent,
+ struct stat *postnewparent)
{
trash_local_t *local = frame->local;
if (op_ret == -1 && op_errno == ENOENT) {
@@ -407,7 +462,7 @@ trash_rename_rename_cbk (call_frame_t *frame,
.path = local->loc2.path,
};
STACK_WIND (frame,
- trash_common_unwind_buf_cbk,
+ trash_rename_unwind_buf_cbk,
this->children->xlator,
this->children->xlator->fops->rename,
&local->loc1,
@@ -427,13 +482,14 @@ trash_rename_lookup_cbk (call_frame_t *frame,
int32_t op_errno,
inode_t *inode,
struct stat *buf,
- dict_t *xattr)
+ dict_t *xattr,
+ struct stat *postparent)
{
trash_local_t *local = frame->local;
if (op_ret == -1) {
STACK_WIND (frame,
- trash_common_unwind_buf_cbk,
+ trash_rename_unwind_buf_cbk,
this->children->xlator,
this->children->xlator->fops->rename,
&local->loc1,
@@ -481,7 +537,7 @@ trash_rename (call_frame_t *frame,
/* Trying to rename from the trash can dir,
do the actual rename */
STACK_WIND (frame,
- trash_common_unwind_buf_cbk,
+ trash_rename_unwind_buf_cbk,
this->children->xlator,
this->children->xlator->fops->rename,
oldloc,