[sheepdog] Converting config file

Jens WEBER jweber at tek2b.org
Sat Aug 11 15:17:06 CEST 2012


This Patch is necessary because structure of config file has changed frequently in v0.4.0.

The new structure contains a version number to identify the config file version. All together we have right now 3 config file structures as follows
/*
 * configfile version 3
 * store is 'farm'
 * size 32 bytes
 */
struct sheepdog_config {
        uint64_t configversion;
        uint64_t ctime;
        uint64_t space;
        uint16_t flags;
        uint8_t copies;
        uint8_t store[STORE_LEN];
};
/*
 * configfile version 2
 * since v0.4.0 - sheep: get the free disk space and store it in the config file (commit 5e39f98abf32faa340afc9b535a56391359b5234)
 * store is 'farm'
 * size 24 bytes or 19 bytes if gateway_only
 *
 * we keep this for converting config till version <= v0.5.0
 */
struct sheepdog_config_2 {
        uint64_t ctime;
        uint64_t space;
        uint16_t flags;
        uint8_t copies;
        uint8_t store[STORE_LEN];
};
/*
 * configfile version 1
 * since v0.4.0
 * store is 'farm'
 * size 16 bytes or 11 bytes if gateway_only
 *   sheep: don't call farm_init() for gateway-only node (commit 23168926dc519982992cc6b8f7b5244f7ed15cb2)
 *
 * we keep this for converting config till version <= v0.5.0
 */
struct sheepdog_config_1 {
        uint64_t ctime;
        uint16_t flags;
        uint8_t copies;
        uint8_t store[STORE_LEN];
};

First Patch "Always write store farm to config file" fix that config file has always the same size, gateway_only or not.

Second Patch "Converting config file and set version number" converts config version 1 and 2 to version 3.

Cheers Jens



More information about the sheepdog mailing list