summaryrefslogtreecommitdiffstats
path: root/xlators/features/trash/src/trash.h
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-11-30 01:16:35 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-01 10:02:48 -0800
commit936001b147a3adcf9731d02e8f2fb62e5e50caf4 (patch)
treeed0592d8276a3ff16ec3e15e58c4819b33352992 /xlators/features/trash/src/trash.h
parent90cebe19380b4319e3a4345f31268563b51e08c3 (diff)
features/trash initial cleanup commit
* support O_TRUNC flag in open (call comes to FS as 'truncate' or 'ftruncate' fop) * option to provide 'eliminate-pattern' so those files matching won't be kept in trash. Eg: option eliminate-pattern *.out|*~ * option to give 'maximum' file size to keep in trash, ie, when a 20GB file is deleted, it won't be kept in trash if max file size given is 1GB. Eg: option max-trashable-file-size 1GB These particular features are developped as a part of college project by following team: Sunil bhagwath <sunilkbhagwat@gmail.com> Yashaswi Kumar <yashaswikumar@gmail.com> Rashmi B K <rashmibk17@gmail.com> Sandeep M <astrophyster@gmail.com> Submitting after minor coding standard edits and memoryleak fixes. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 142 (enhance features/trash translator so it can work on client side too..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=142
Diffstat (limited to 'xlators/features/trash/src/trash.h')
-rw-r--r--xlators/features/trash/src/trash.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/xlators/features/trash/src/trash.h b/xlators/features/trash/src/trash.h
new file mode 100644
index 00000000000..7f0e13085b1
--- /dev/null
+++ b/xlators/features/trash/src/trash.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2006, 2007, 2008 Z RESEARCH, Inc. <http://www.zresearch.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __TRASH_H__
+#define __TRASH_H__
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#include "glusterfs.h"
+#include "logging.h"
+#include "dict.h"
+#include "xlator.h"
+#include "defaults.h"
+#include "inode.c"
+#include "fnmatch.h"
+
+#include <libgen.h>
+
+#ifndef GF_BLOCK_READV_SIZE
+#define GF_BLOCK_READV_SIZE (128 * GF_UNIT_KB)
+#endif
+
+#ifndef GF_DEFAULT_MAX_FILE_SIZE
+#define GF_DEFAULT_MAX_FILE_SIZE (200 * GF_UNIT_MB)
+#endif
+
+#ifndef GF_ALLOWED_MAX_FILE_SIZE
+#define GF_ALLOWED_MAX_FILE_SIZE (1 * GF_UNIT_GB)
+#endif
+
+
+struct trash_struct {
+ fd_t *fd; /* for the fd of existing file */
+ fd_t *newfd; /* for the newly created file */
+ loc_t loc; /* to store the location of the existing file */
+ loc_t newloc; /* to store the location for the new file */
+ size_t fsize; /* for keeping the size of existing file */
+ off_t cur_offset; /* current offset for read and write ops */
+ off_t fop_offset;
+ char origpath[PATH_MAX];
+ char newpath[PATH_MAX];
+ int32_t loop_count;
+ struct stat preparent;
+ struct stat postparent;
+};
+typedef struct trash_struct trash_local_t;
+
+struct _trash_elim_pattern;
+typedef struct _trash_elim_pattern {
+ struct _trash_elim_pattern *next;
+ char *pattern;
+} trash_elim_pattern_t;
+
+struct trash_priv {
+ char *trash_dir;
+ trash_elim_pattern_t *eliminate;
+ size_t max_trash_file_size;
+};
+typedef struct trash_priv trash_private_t;
+
+#endif /* __TRASH_H__ */