mirror of
https://github.com/samba-team/samba.git
synced 2024-12-28 07:21:54 +03:00
9c8ae4454c
MS-FSRVP specifies: the server MUST persist all state information into an implementation- specific configuration store. This change adds a fss_srv TDB database to preserve FSRVP server state, with the following keys used to track shadow copy state and hierarchy: - sc_set/<shadow copy set GUID> A shadow copy set tracks a collection of zero or more shadow copies, as initiated by a StartShadowCopySet FSRVP client request. - sc_set/<shadow copy set GUID>/sc/<shadow copy GUID> A shadow copy defines information about a snapshot base volume, the snapshot path, and a collection of share maps. It is initiated by an AddToShadowCopySet client request. - sc_set/<shadow copy set GUID>/sc/<shadow copy GUID>/smap/<smap GUID> A share map tracks new shares that are created to expose shadow copies. All structures are marshalled into on-disk format using the previously added fsrvp_state IDL library. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
93 lines
2.8 KiB
C
93 lines
2.8 KiB
C
/*
|
|
* File Server Remote VSS Protocol (FSRVP) server state
|
|
*
|
|
* Copyright (C) David Disseldorp 2012-2015
|
|
*
|
|
* 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; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef _SRV_FSS_PRIVATE_H_
|
|
#define _SRV_FSS_PRIVATE_H_
|
|
|
|
#define FSS_DB_NAME "srv_fss.tdb"
|
|
|
|
struct fss_sc_smap {
|
|
struct fss_sc_smap *next, *prev;
|
|
char *share_name; /* name of the base file share */
|
|
char *sc_share_name; /* share exposing the shadow copy */
|
|
char *sc_share_comment;
|
|
bool is_exposed; /* whether shadow copy is exposed */
|
|
};
|
|
|
|
struct fss_sc {
|
|
struct fss_sc *next, *prev;
|
|
struct GUID id; /* GUID of the shadow copy */
|
|
char *id_str;
|
|
char *volume_name; /* name uniquely identifying on the
|
|
* server object store on which this
|
|
* shadow copy is created. */
|
|
char *sc_path; /* path exposing the shadow copy */
|
|
time_t create_ts; /* timestamp of client initiation */
|
|
struct fss_sc_smap *smaps; /* shares mapped to this shadow copy */
|
|
uint32_t smaps_count;
|
|
struct fss_sc_set *sc_set; /* parent shadow copy set */
|
|
};
|
|
|
|
/*
|
|
* 3.1.1.2: Per ShadowCopySet
|
|
* The status of the shadow copy set. This MUST be one of "Started", "Added",
|
|
* "CreationInProgress", "Committed", "Exposed", or "Recovered".
|
|
*/
|
|
enum fss_sc_state {
|
|
FSS_SC_STARTED,
|
|
FSS_SC_ADDED,
|
|
FSS_SC_CREATING,
|
|
FSS_SC_COMMITED,
|
|
FSS_SC_EXPOSED,
|
|
FSS_SC_RECOVERED,
|
|
};
|
|
struct fss_sc_set {
|
|
struct fss_sc_set *next, *prev;
|
|
struct GUID id; /* GUID of the shadow copy set. */
|
|
char *id_str;
|
|
enum fss_sc_state state; /* status of the shadow copy set */
|
|
uint32_t context; /* attributes used for set creation */
|
|
struct fss_sc *scs; /* list of ShadowCopy objects */
|
|
uint32_t scs_count;
|
|
};
|
|
|
|
struct fss_global {
|
|
TALLOC_CTX *mem_ctx; /* parent mem ctx for sc sets */
|
|
char *db_path;
|
|
uint32_t min_vers;
|
|
uint32_t max_vers;
|
|
bool ctx_set; /* whether client has set context */
|
|
uint32_t cur_ctx;
|
|
struct fss_sc_set *sc_sets;
|
|
uint32_t sc_sets_count;
|
|
struct tevent_timer *seq_tmr; /* time to wait between client reqs */
|
|
};
|
|
|
|
NTSTATUS fss_state_store(TALLOC_CTX *mem_ctx,
|
|
struct fss_sc_set *sc_sets,
|
|
uint32_t sc_sets_count,
|
|
const char *db_path);
|
|
|
|
NTSTATUS fss_state_retrieve(TALLOC_CTX *mem_ctx,
|
|
struct fss_sc_set **sc_sets,
|
|
uint32_t *sc_sets_count,
|
|
const char *db_path);
|
|
|
|
#endif /*_SRV_FSS_PRIVATE_H_ */
|