From 7551bc7aeea3816ca5b93e76bf27d4ee3d347ece Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Mon, 19 Jan 2004 18:11:32 +0000 Subject: [PATCH] obsoleted by more straight-forward code git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@641 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/src/vunify-operations.c | 113 ----------------------------------- util-vserver/src/vunify-operations.h | 38 ------------ 2 files changed, 151 deletions(-) delete mode 100644 util-vserver/src/vunify-operations.c delete mode 100644 util-vserver/src/vunify-operations.h diff --git a/util-vserver/src/vunify-operations.c b/util-vserver/src/vunify-operations.c deleted file mode 100644 index 7fe1907..0000000 --- a/util-vserver/src/vunify-operations.c +++ /dev/null @@ -1,113 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 Enrico Scholz -// -// This program 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; version 2 of the License. -// -// This program 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, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "vunify-operations.h" -#include "util.h" - -#include -#include -#include - - -// ====== The compare functions ========= - -// return 'true' iff both files are different and unifyable -static bool -compareUnify(struct stat const *lhs, struct stat const *rhs) -{ - return (lhs->st_dev ==rhs->st_dev && - lhs->st_ino !=rhs->st_ino && - lhs->st_mode ==rhs->st_mode && - lhs->st_uid ==rhs->st_uid && - lhs->st_gid ==rhs->st_gid && - lhs->st_size ==rhs->st_size && - lhs->st_mtime==rhs->st_mtime); - - // TODO: acl? time? -} - -// return 'true' iff both files are the same one -static bool -compareDeUnify(struct stat const *lhs, struct stat const *rhs) -{ - return (lhs->st_dev ==rhs->st_dev && - lhs->st_ino ==rhs->st_ino); -} - -// ===== The 'doit' functions =========== - - -static bool -unifyTest(char const *src, char const *dst) -{ -#if 0 - WRITE_MSG(1, "unifying '"); - WRITE_STR(1, src); - WRITE_MSG(1, "' -> '"); - WRITE_STR(1, dst); - WRITE_STR(1, "'\n"); -#endif - - return true; -} - - -static struct Operations op_unify_test = { - .compare = compareUnify, - .doit = unifyTest -}; - -static struct Operations op_deunify_test = { - .compare = compareDeUnify, - .doit = unifyTest -}; - -static struct Operations op_unify_notest = { - .compare = compareUnify, - .doit = unifyTest -}; - -static struct Operations op_deunify_notest = { - .compare = compareDeUnify, - .doit = unifyTest -}; - -// ====== - -void -Operations_init(struct Operations *op, OperationType type, bool is_test) -{ - switch (type) { - case opUNIFY : - if (is_test) *op = op_unify_test; - else *op = op_unify_notest; - break; - - case opDEUNIFY : - if (is_test) *op = op_deunify_test; - else *op = op_deunify_notest; - break; - - default : - abort(); - } -} diff --git a/util-vserver/src/vunify-operations.h b/util-vserver/src/vunify-operations.h deleted file mode 100644 index 07437c5..0000000 --- a/util-vserver/src/vunify-operations.h +++ /dev/null @@ -1,38 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 Enrico Scholz -// -// This program 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; version 2 of the License. -// -// This program 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, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -#ifndef H_UTIL_VSERVER_SRC_VUNIFY_OPERATIONS_H -#define H_UTIL_VSERVER_SRC_VUNIFY_OPERATIONS_H - -#include - -typedef enum { opUNIFY, opDEUNIFY } OperationType; - -struct stat; -struct MatchList; - -struct Operations { - bool (*compare)(struct stat const *lhs, - struct stat const *rhs); - bool (*doit)(char const *, char const *path); -}; - - -void Operations_init(struct Operations *, OperationType type, bool is_test); - -#endif // H_UTIL_VSERVER_SRC_VUNIFY_OPERATIONS_H -- 1.8.1.5