glusterfs

Форк
0
/
glusterd-snapd-svc-helper.c 
75 строк · 2.0 Кб
1
/*
2
   Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
3
   This file is part of GlusterFS.
4

5
   This file is licensed to you under your choice of the GNU Lesser
6
   General Public License, version 3 or any later version (LGPLv3 or
7
   later), or the GNU General Public License, version 2 (GPLv2), in all
8
   cases as published by the Free Software Foundation.
9
*/
10

11
#include "glusterd.h"
12
#include "glusterd-utils.h"
13
#include "glusterd-snapd-svc-helper.h"
14

15
void
16
glusterd_svc_build_snapd_rundir(glusterd_volinfo_t *volinfo, char *path,
17
                                int path_len)
18
{
19
    char workdir[PATH_MAX] = {
20
        0,
21
    };
22
    glusterd_conf_t *priv = THIS->private;
23

24
    GLUSTERD_GET_VOLUME_PID_DIR(workdir, volinfo, priv);
25
    snprintf(path, path_len, "%s", workdir);
26
}
27

28
void
29
glusterd_svc_build_snapd_socket_filepath(glusterd_volinfo_t *volinfo,
30
                                         char *path, int path_len)
31
{
32
    char sockfilepath[PATH_MAX] = {
33
        0,
34
    };
35
    char rundir[PATH_MAX] = {
36
        0,
37
    };
38
    int32_t len = 0;
39

40
    glusterd_svc_build_snapd_rundir(volinfo, rundir, sizeof(rundir));
41
    len = snprintf(sockfilepath, sizeof(sockfilepath), "%s/run-%s", rundir,
42
                   uuid_utoa(MY_UUID));
43
    if ((len < 0) || (len >= sizeof(sockfilepath))) {
44
        sockfilepath[0] = 0;
45
    }
46

47
    glusterd_set_socket_filepath(sockfilepath, path, path_len);
48
}
49

50
void
51
glusterd_svc_build_snapd_pidfile(glusterd_volinfo_t *volinfo, char *path,
52
                                 int path_len)
53
{
54
    char rundir[PATH_MAX] = {
55
        0,
56
    };
57

58
    glusterd_svc_build_snapd_rundir(volinfo, rundir, sizeof(rundir));
59

60
    snprintf(path, path_len, "%s/%s-snapd.pid", rundir, volinfo->volname);
61
}
62

63
void
64
glusterd_svc_build_snapd_volfile(glusterd_volinfo_t *volinfo, char *path,
65
                                 int path_len)
66
{
67
    char workdir[PATH_MAX] = {
68
        0,
69
    };
70
    glusterd_conf_t *priv = THIS->private;
71

72
    GLUSTERD_GET_VOLUME_DIR(workdir, volinfo, priv);
73

74
    snprintf(path, path_len, "%s/%s-snapd.vol", workdir, volinfo->volname);
75
}
76

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.