mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-09-26 07:10:46 +00:00
fix commit block fs directory to be created
This commit is contained in:
committed by
Jonathan Xu
parent
fedef3faeb
commit
48950167c2
@@ -28,8 +28,6 @@ struct _BHandle {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *v0_block_dir;
|
|
||||||
int v0_block_dir_len;
|
|
||||||
char *block_dir;
|
char *block_dir;
|
||||||
int block_dir_len;
|
int block_dir_len;
|
||||||
char *tmp_dir;
|
char *tmp_dir;
|
||||||
@@ -270,8 +268,6 @@ block_backend_fs_foreach_block (BlockBackend *bend,
|
|||||||
#if defined MIGRATION
|
#if defined MIGRATION
|
||||||
if (version > 0)
|
if (version > 0)
|
||||||
block_dir = g_build_filename (priv->block_dir, store_id, NULL);
|
block_dir = g_build_filename (priv->block_dir, store_id, NULL);
|
||||||
else
|
|
||||||
block_dir = g_strdup(priv->v0_block_dir);
|
|
||||||
#else
|
#else
|
||||||
block_dir = g_build_filename (priv->block_dir, store_id, NULL);
|
block_dir = g_build_filename (priv->block_dir, store_id, NULL);
|
||||||
#endif
|
#endif
|
||||||
@@ -415,11 +411,7 @@ get_block_path (BlockBackend *bend,
|
|||||||
if (version > 0) {
|
if (version > 0) {
|
||||||
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->block_dir, store_id);
|
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->block_dir, store_id);
|
||||||
pos += n;
|
pos += n;
|
||||||
} else {
|
} else
|
||||||
memcpy (pos, priv->v0_block_dir, priv->v0_block_dir_len);
|
|
||||||
pos[priv->v0_block_dir_len] = '/';
|
|
||||||
pos += priv->v0_block_dir_len + 1;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->block_dir, store_id);
|
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->block_dir, store_id);
|
||||||
pos += n;
|
pos += n;
|
||||||
@@ -460,9 +452,6 @@ block_backend_fs_new (const char *seaf_dir, const char *tmp_dir)
|
|||||||
priv = g_new0(FsPriv, 1);
|
priv = g_new0(FsPriv, 1);
|
||||||
bend->be_priv = priv;
|
bend->be_priv = priv;
|
||||||
|
|
||||||
priv->v0_block_dir = g_build_filename (seaf_dir, "blocks", NULL);
|
|
||||||
priv->v0_block_dir_len = strlen(priv->v0_block_dir);
|
|
||||||
|
|
||||||
priv->block_dir = g_build_filename (seaf_dir, "storage", "blocks", NULL);
|
priv->block_dir = g_build_filename (seaf_dir, "storage", "blocks", NULL);
|
||||||
priv->block_dir_len = strlen (priv->block_dir);
|
priv->block_dir_len = strlen (priv->block_dir);
|
||||||
|
|
||||||
|
@@ -21,8 +21,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
typedef struct FsPriv {
|
typedef struct FsPriv {
|
||||||
char *v0_obj_dir;
|
|
||||||
int v0_dir_len;
|
|
||||||
char *obj_dir;
|
char *obj_dir;
|
||||||
int dir_len;
|
int dir_len;
|
||||||
} FsPriv;
|
} FsPriv;
|
||||||
@@ -38,10 +36,6 @@ id_to_path (FsPriv *priv, const char *obj_id, char path[],
|
|||||||
if (version > 0) {
|
if (version > 0) {
|
||||||
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->obj_dir, repo_id);
|
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->obj_dir, repo_id);
|
||||||
pos += n;
|
pos += n;
|
||||||
} else {
|
|
||||||
memcpy (pos, priv->v0_obj_dir, priv->v0_dir_len);
|
|
||||||
pos[priv->v0_dir_len] = '/';
|
|
||||||
pos += priv->v0_dir_len + 1;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->obj_dir, repo_id);
|
n = snprintf (path, SEAF_PATH_MAX, "%s/%s/", priv->obj_dir, repo_id);
|
||||||
@@ -372,8 +366,6 @@ obj_backend_fs_foreach_obj (ObjBackend *bend,
|
|||||||
#if defined MIGRATION || defined SEAFILE_CLIENT
|
#if defined MIGRATION || defined SEAFILE_CLIENT
|
||||||
if (version > 0)
|
if (version > 0)
|
||||||
obj_dir = g_build_filename (priv->obj_dir, repo_id, NULL);
|
obj_dir = g_build_filename (priv->obj_dir, repo_id, NULL);
|
||||||
else
|
|
||||||
obj_dir = g_strdup(priv->v0_obj_dir);
|
|
||||||
#else
|
#else
|
||||||
obj_dir = g_build_filename (priv->obj_dir, repo_id, NULL);
|
obj_dir = g_build_filename (priv->obj_dir, repo_id, NULL);
|
||||||
#endif
|
#endif
|
||||||
@@ -512,18 +504,9 @@ obj_backend_fs_new (const char *seaf_dir, const char *obj_type)
|
|||||||
priv = g_new0(FsPriv, 1);
|
priv = g_new0(FsPriv, 1);
|
||||||
bend->priv = priv;
|
bend->priv = priv;
|
||||||
|
|
||||||
priv->v0_obj_dir = g_build_filename (seaf_dir, obj_type, NULL);
|
|
||||||
priv->v0_dir_len = strlen(priv->v0_obj_dir);
|
|
||||||
|
|
||||||
priv->obj_dir = g_build_filename (seaf_dir, "storage", obj_type, NULL);
|
priv->obj_dir = g_build_filename (seaf_dir, "storage", obj_type, NULL);
|
||||||
priv->dir_len = strlen (priv->obj_dir);
|
priv->dir_len = strlen (priv->obj_dir);
|
||||||
|
|
||||||
if (g_mkdir_with_parents (priv->v0_obj_dir, 0777) < 0) {
|
|
||||||
seaf_warning ("[Obj Backend] Objects dir %s does not exist and"
|
|
||||||
" is unable to create\n", priv->v0_obj_dir);
|
|
||||||
goto onerror;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_mkdir_with_parents (priv->obj_dir, 0777) < 0) {
|
if (g_mkdir_with_parents (priv->obj_dir, 0777) < 0) {
|
||||||
seaf_warning ("[Obj Backend] Objects dir %s does not exist and"
|
seaf_warning ("[Obj Backend] Objects dir %s does not exist and"
|
||||||
" is unable to create\n", priv->obj_dir);
|
" is unable to create\n", priv->obj_dir);
|
||||||
@@ -541,7 +524,6 @@ obj_backend_fs_new (const char *seaf_dir, const char *obj_type)
|
|||||||
return bend;
|
return bend;
|
||||||
|
|
||||||
onerror:
|
onerror:
|
||||||
g_free (priv->v0_obj_dir);
|
|
||||||
g_free (priv->obj_dir);
|
g_free (priv->obj_dir);
|
||||||
g_free (priv);
|
g_free (priv);
|
||||||
g_free (bend);
|
g_free (bend);
|
||||||
|
Reference in New Issue
Block a user