[Pkg-owncloud-commits] [owncloud-client] 84/333: csync: Remove more unneeded code

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:37 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 77d9256e0317ea2f08c8b53f1eb0836825f15493
Author: Markus Goetz <markus at woboq.com>
Date:   Thu Feb 27 13:52:30 2014 +0100

    csync: Remove more unneeded code
---
 csync/src/csync_owncloud.c       |  19 +---
 csync/src/vio/csync_vio.c        | 235 ---------------------------------------
 csync/src/vio/csync_vio.h        |  16 ---
 csync/src/vio/csync_vio_local.c  |  41 -------
 csync/src/vio/csync_vio_local.h  |   8 --
 csync/src/vio/csync_vio_method.h |  16 ---
 6 files changed, 2 insertions(+), 333 deletions(-)

diff --git a/csync/src/csync_owncloud.c b/csync/src/csync_owncloud.c
index bcfb98e..2ce333f 100644
--- a/csync/src/csync_owncloud.c
+++ b/csync/src/csync_owncloud.c
@@ -1145,29 +1145,14 @@ static int owncloud_set_property(const char *key, void *data) {
 
 csync_vio_method_t _method = {
     .method_table_size = sizeof(csync_vio_method_t),
-    .get_etag = owncloud_get_etag,
-    .open = 0,
-    .creat = 0,
-    .close = 0,
-    .read = 0,
-    .write = 0,
-    .sendfile = 0,
-    .lseek = 0,
     .opendir = owncloud_opendir,
     .closedir = owncloud_closedir,
     .readdir = owncloud_readdir,
-    .mkdir = 0,
-    .rmdir = 0,
     .stat = owncloud_stat,
-    .rename = 0,
-    .unlink = 0,
-    .chmod = 0,
-    .chown = 0,
-    .utimes = 0,
     .set_property = owncloud_set_property,
     .get_error_string = owncloud_error_string,
-    .commit = owncloud_commit
-
+    .commit = owncloud_commit,
+    .get_etag = owncloud_get_etag
 };
 
 csync_vio_method_t *vio_module_init(const char *method_name, const char *args,
diff --git a/csync/src/vio/csync_vio.c b/csync/src/vio/csync_vio.c
index d2147c8..0d8760f 100644
--- a/csync/src/vio/csync_vio.c
+++ b/csync/src/vio/csync_vio.c
@@ -100,70 +100,6 @@ void csync_vio_shutdown(CSYNC *ctx) {
     ctx->module.finish_fn = NULL;
 }
 
-int csync_vio_put(CSYNC *ctx,
-                  csync_vio_handle_t *flocal,
-                  csync_vio_handle_t *fremote,
-                  csync_file_stat_t *st) {
-  int rc = 0;
-  csync_vio_file_stat_t *vfs = csync_vio_convert_file_stat(st);
-
-  if (flocal == NULL) {
-    rc = -1;
-  }
-  if (vfs ==  NULL) {
-    rc = -1;
-  }
-
-  if (rc == 0) {
-    rc = ctx->module.method->put(flocal->method_handle,
-                                 fremote->method_handle,
-                                 vfs);
-  }
-  csync_vio_file_stat_destroy(vfs);
-  return rc;
-}
-
-int csync_vio_get(CSYNC *ctx,
-                  csync_vio_handle_t *flocal,
-                  csync_vio_handle_t *fremote,
-                  csync_file_stat_t *st) {
-  int rc = 0;
-  csync_vio_file_stat_t *vfs = csync_vio_convert_file_stat(st);
-
-  if (flocal == NULL) {
-    rc = -1;
-  }
-  if (vfs ==  NULL) {
-    rc = -1;
-  }
-
-  if (rc == 0) {
-    rc = ctx->module.method->get(flocal->method_handle,
-                                 fremote->method_handle,
-                                 vfs);
-  }
-  csync_vio_file_stat_destroy(vfs);
-  return rc;
-}
-
-int csync_vio_sendfile(CSYNC *ctx, csync_vio_handle_t *sfp, csync_vio_handle_t *dst) {
-    int rc = 0;
-
-    switch(ctx->replica) {
-      case REMOTE_REPLICA:
-        rc = ctx->module.method->sendfile(sfp->method_handle, dst->method_handle);
-        break;
-      case LOCAL_REPLICA:
-        rc = ctx->module.method->sendfile(dst->method_handle, sfp->method_handle);
-        break;
-      default:
-        CSYNC_LOG(CSYNC_LOG_PRIORITY_ALERT, "Invalid replica (%d)", (int)ctx->replica);
-        break;
-    }
-
-    return rc;
-}
-
 csync_vio_handle_t *csync_vio_opendir(CSYNC *ctx, const char *name) {
   csync_vio_handle_t *h = NULL;
   csync_vio_method_handle_t *mh = NULL;
@@ -241,89 +177,6 @@ csync_vio_file_stat_t *csync_vio_readdir(CSYNC *ctx, csync_vio_handle_t *dhandle
   return fs;
 }
 
-int csync_vio_mkdir(CSYNC *ctx, const char *uri, mode_t mode) {
-  int rc = -1;
-
-  switch(ctx->replica) {
-    case REMOTE_REPLICA:
-      rc = ctx->module.method->mkdir(uri, mode);
-      break;
-    case LOCAL_REPLICA:
-      rc = csync_vio_local_mkdir(uri, mode);
-      break;
-    default:
-      CSYNC_LOG(CSYNC_LOG_PRIORITY_ALERT, "Invalid replica (%d)", (int)ctx->replica);
-      break;
-  }
-
-  return rc;
-}
-
-int csync_vio_mkdirs(CSYNC *ctx, const char *uri, mode_t mode) {
-  int tmp = 0;
-  char errbuf[256] = {0};
-  csync_vio_file_stat_t *st = NULL;
-
-  if (uri == NULL) {
-    errno = EINVAL;
-    return -1;
-  }
-
-  tmp = strlen(uri);
-  while(tmp > 0 && uri[tmp - 1] == '/') --tmp;
-  while(tmp > 0 && uri[tmp - 1] != '/') --tmp;
-  while(tmp > 0 && uri[tmp - 1] == '/') --tmp;
-
-  if (tmp > 0) {
-    char suburi[tmp + 1];
-    memcpy(suburi, uri, tmp);
-    suburi[tmp] = '\0';
-
-    st = csync_vio_file_stat_new();
-    if (csync_vio_stat(ctx, suburi, st) == 0) {
-      if (! S_ISDIR(st->mode)) {
-        csync_vio_file_stat_destroy(st);
-        errno = ENOTDIR;
-        return -1;
-      }
-    } else if (errno != ENOENT) {
-      C_STRERROR(errno, errbuf, sizeof(errbuf));
-      CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "csync_vio_mkdirs stat failed: %s",
-          errbuf);
-      csync_vio_file_stat_destroy(st);
-      return -1;
-    } else if (csync_vio_mkdirs(ctx, suburi, mode) < 0) {
-      csync_vio_file_stat_destroy(st);
-      return -1;
-    }
-    csync_vio_file_stat_destroy(st);
-  }
-
-  tmp = csync_vio_mkdir(ctx, uri, mode);
-  if ((tmp < 0) && (errno == EEXIST)) {
-    return 0;
-  }
-
-  return tmp;
-}
-
-int csync_vio_rmdir(CSYNC *ctx, const char *uri) {
-  int rc = -1;
-
-  switch(ctx->replica) {
-    case REMOTE_REPLICA:
-      rc = ctx->module.method->rmdir(uri);
-      break;
-    case LOCAL_REPLICA:
-      rc = csync_vio_local_rmdir(uri);
-      break;
-    default:
-      CSYNC_LOG(CSYNC_LOG_PRIORITY_ALERT, "Invalid replica (%d)", (int)ctx->replica);
-      break;
-  }
-
-  return rc;
-}
 
 const char *csync_vio_get_etag(CSYNC *ctx, const char *path)
 {
@@ -361,95 +214,7 @@ int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf) {
   return rc;
 }
 
-int csync_vio_rename(CSYNC *ctx, const char *olduri, const char *newuri) {
-  int rc = -1;
-
-  switch(ctx->replica) {
-    case REMOTE_REPLICA:
-      rc = ctx->module.method->rename(olduri, newuri);
-      break;
-    case LOCAL_REPLICA:
-      rc = csync_vio_local_rename(olduri, newuri);
-      break;
-    default:
-      CSYNC_LOG(CSYNC_LOG_PRIORITY_ALERT, "Invalid replica (%d)", (int)ctx->replica);
-      break;
-  }
-
-  return rc;
-}
-
-int csync_vio_unlink(CSYNC *ctx, const char *uri) {
-  int rc = -1;
-
-  switch(ctx->replica) {
-    case REMOTE_REPLICA:
-      rc = ctx->module.method->unlink(uri);
-      break;
-    case LOCAL_REPLICA:
-      rc = csync_vio_local_unlink(uri);
-      break;
-    default:
-      CSYNC_LOG(CSYNC_LOG_PRIORITY_ALERT, "Invalid replica (%d)", (int)ctx->replica);
-      break;
-  }
-
-  return rc;
-}
-
-int csync_vio_chmod(CSYNC *ctx, const char *uri, mode_t mode) {
-  int rc = -1;
-
-  switch(ctx->replica) {
-    case REMOTE_REPLICA:
-      rc = ctx->module.method->chmod(uri, mode);
-      break;
-    case LOCAL_REPLICA:
-      rc = csync_vio_local_chmod(uri, mode);
-      break;
-    default:
-      CSYNC_LOG(CSYNC_LOG_PRIORITY_ALERT, "Invalid replica (%d)", (int)ctx->replica);
-      break;
-  }
-
-  return rc;
-}
-
-int csync_vio_chown(CSYNC *ctx, const char *uri, uid_t owner, gid_t group) {
-  int rc = -1;
-
-  switch(ctx->replica) {
-    case REMOTE_REPLICA:
-      rc = ctx->module.method->chown(uri, owner, group);
-      break;
-    case LOCAL_REPLICA:
-      rc = csync_vio_local_chown(uri, owner, group);
-      break;
-    default:
-      CSYNC_LOG(CSYNC_LOG_PRIORITY_ALERT, "Invalid replica (%d)", (int)ctx->replica);
-      break;
-  }
-
-  return rc;
-}
-
-int csync_vio_utimes(CSYNC *ctx, const char *uri, const struct timeval *times) {
-  int rc = -1;
 
-  switch(ctx->replica) {
-    case REMOTE_REPLICA:
-      rc = ctx->module.method->utimes(uri, times);
-      break;
-    case LOCAL_REPLICA:
-      rc = csync_vio_local_utimes(uri, times);
-      break;
-    default:
-      CSYNC_LOG(CSYNC_LOG_PRIORITY_ALERT, "Invalid replica (%d)", (int)ctx->replica);
-      break;
-  }
-
-  return rc;
-}
 
 char *csync_vio_get_status_string(CSYNC *ctx) {
     if(ctx->error_string) {
diff --git a/csync/src/vio/csync_vio.h b/csync/src/vio/csync_vio.h
index 159422a..a21fdc6 100644
--- a/csync/src/vio/csync_vio.h
+++ b/csync/src/vio/csync_vio.h
@@ -36,28 +36,12 @@ typedef struct fhandle_s {
 int csync_vio_init(CSYNC *ctx, const char *module, const char *args);
 void csync_vio_shutdown(CSYNC *ctx);
 
-int csync_vio_sendfile(CSYNC *ctx,  csync_vio_handle_t *sfp, csync_vio_handle_t *dst);
-
-int csync_vio_put(CSYNC *ctx, csync_vio_handle_t *flocal, csync_vio_handle_t *fremote, csync_file_stat_t *st);
-int csync_vio_get(CSYNC *ctx, csync_vio_handle_t *flocal, csync_vio_handle_t *fremote, csync_file_stat_t *st);
-
 csync_vio_handle_t *csync_vio_opendir(CSYNC *ctx, const char *name);
 int csync_vio_closedir(CSYNC *ctx, csync_vio_handle_t *dhandle);
 csync_vio_file_stat_t *csync_vio_readdir(CSYNC *ctx, csync_vio_handle_t *dhandle);
 
-int csync_vio_mkdir(CSYNC *ctx, const char *uri, mode_t mode);
-int csync_vio_mkdirs(CSYNC *ctx, const char *uri, mode_t mode);
-int csync_vio_rmdir(CSYNC *ctx, const char *uri);
-
 const char *csync_vio_get_etag(CSYNC *ctx, const char *path);
 int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf);
-int csync_vio_rename(CSYNC *ctx, const char *olduri, const char *newuri);
-int csync_vio_unlink(CSYNC *ctx, const char *uri);
-
-int csync_vio_chmod(CSYNC *ctx, const char *uri, mode_t mode);
-int csync_vio_chown(CSYNC *ctx, const char *uri, uid_t owner, gid_t group);
-
-int csync_vio_utimes(CSYNC *ctx, const char *uri, const struct timeval *times);
 
 int csync_vio_set_property(CSYNC *ctx, const char *key, void *data);
 
diff --git a/csync/src/vio/csync_vio_local.c b/csync/src/vio/csync_vio_local.c
index fe47bfa..2fb59b8 100644
--- a/csync/src/vio/csync_vio_local.c
+++ b/csync/src/vio/csync_vio_local.c
@@ -150,18 +150,6 @@ err:
   return NULL;
 }
 
-int csync_vio_local_mkdir(const char *uri, mode_t mode) {
-  return c_mkdirs(uri, mode);
-}
-
-int csync_vio_local_rmdir(const char *uri) {
-  mbchar_t *dirname = c_utf8_to_locale(uri);
-  int re = -1;
-
-  re = _trmdir(dirname);
-  c_free_locale_string(dirname);
-  return re;
-}
 
 #ifdef _WIN32
 static time_t FileTimeToUnixTime(FILETIME *filetime, DWORD *remainder)
@@ -371,35 +359,6 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) {
 }
 #endif
 
-int csync_vio_local_rename(const char *olduri, const char *newuri) {
-  return c_rename(olduri, newuri);
-}
 
-int csync_vio_local_unlink(const char *uri) {
-  mbchar_t *nuri = c_utf8_to_locale(uri);
-  int re = _tunlink( nuri );
-  c_free_locale_string(nuri);
-  return re;
-}
 
-int csync_vio_local_chmod(const char *uri, mode_t mode) {
-  mbchar_t *nuri = c_utf8_to_locale(uri);
-  int re = -1;
 
-  re = _tchmod(nuri, mode);
-  c_free_locale_string(nuri);
-  return re;
-}
-
-int csync_vio_local_chown(const char *uri, uid_t owner, gid_t group) {
-#if defined _WIN32
-    (void)uri;
-    (void)owner;
-    (void)group;
-#endif
-  return _tchown(uri, owner, group);
-}
-
-int csync_vio_local_utimes(const char *uri, const struct timeval *times) {
-    return c_utimes(uri, times);
-}
diff --git a/csync/src/vio/csync_vio_local.h b/csync/src/vio/csync_vio_local.h
index 3a4afa6..f8b770b 100644
--- a/csync/src/vio/csync_vio_local.h
+++ b/csync/src/vio/csync_vio_local.h
@@ -28,15 +28,7 @@ csync_vio_method_handle_t *csync_vio_local_opendir(const char *name);
 int csync_vio_local_closedir(csync_vio_method_handle_t *dhandle);
 csync_vio_file_stat_t *csync_vio_local_readdir(csync_vio_method_handle_t *dhandle);
 
-int csync_vio_local_mkdir(const char *uri, mode_t mode);
-int csync_vio_local_rmdir(const char *uri);
-
 int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf);
-int csync_vio_local_rename(const char *olduri, const char *newuri);
-int csync_vio_local_unlink(const char *uri);
-
-int csync_vio_local_chmod(const char *uri, mode_t mode);
-int csync_vio_local_chown(const char *uri, uid_t owner, gid_t group);
 
 int csync_vio_local_utimes(const char *uri, const struct timeval *times);
 
diff --git a/csync/src/vio/csync_vio_method.h b/csync/src/vio/csync_vio_method.h
index 9783144..1410dbe 100644
--- a/csync/src/vio/csync_vio_method.h
+++ b/csync/src/vio/csync_vio_method.h
@@ -77,30 +77,14 @@ typedef int (*csync_method_put_fn)(csync_vio_method_handle_t *flocal,
 
 struct csync_vio_method_s {
   size_t method_table_size;           /* Used for versioning */
-  csync_method_open_fn open;
-  csync_method_creat_fn creat;
-  csync_method_close_fn close;
-  csync_method_read_fn read;
-  csync_method_write_fn write;
-  csync_method_lseek_fn lseek;
   csync_method_opendir_fn opendir;
   csync_method_closedir_fn closedir;
   csync_method_readdir_fn readdir;
-  csync_method_mkdir_fn mkdir;
-  csync_method_rmdir_fn rmdir;
   csync_method_stat_fn stat;
-  csync_method_rename_fn rename;
-  csync_method_unlink_fn unlink;
-  csync_method_chmod_fn chmod;
-  csync_method_chown_fn chown;
-  csync_method_utimes_fn utimes;
   csync_method_set_property_fn set_property;
   csync_method_get_error_string_fn get_error_string;
   csync_method_commit_fn commit;
-  csync_method_put_fn put;
-  csync_method_get_fn get;
   csync_method_get_etag_fn get_etag;
-  csync_method_sendfile_fn sendfile;
 };
 
 #endif /* _CSYNC_VIO_H */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list