projects
/
cumulus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for octal, hexadecimal in restore.pl script.
[cumulus.git]
/
scandir.cc
diff --git
a/scandir.cc
b/scandir.cc
index
ca14cfc
..
dba840d
100644
(file)
--- a/
scandir.cc
+++ b/
scandir.cc
@@
-280,7
+280,7
@@
void dump_inode(const string& path, // Path within snapshot
printf("%s\n", path.c_str());
printf("%s\n", path.c_str());
- file_info["mode"] = encode_int(stat_buf.st_mode & 07777);
+ file_info["mode"] = encode_int(stat_buf.st_mode & 07777
, 8
);
file_info["mtime"] = encode_int(stat_buf.st_mtime);
file_info["user"] = encode_int(stat_buf.st_uid);
file_info["group"] = encode_int(stat_buf.st_gid);
file_info["mtime"] = encode_int(stat_buf.st_mtime);
file_info["user"] = encode_int(stat_buf.st_uid);
file_info["group"] = encode_int(stat_buf.st_gid);
@@
-555,7
+555,7
@@
void usage(const char *program)
" --filter-extension=EXT\n"
" string to append to segment files\n"
" (defaults to \".bz2\")\n"
" --filter-extension=EXT\n"
" string to append to segment files\n"
" (defaults to \".bz2\")\n"
- " --
name=NAME
optional name for this snapshot\n",
+ " --
scheme=NAME
optional name for this snapshot\n",
program
);
}
program
);
}
@@
-565,7
+565,7
@@
int main(int argc, char *argv[])
string backup_source = ".";
string backup_dest = "";
string localdb_dir = "";
string backup_source = ".";
string backup_dest = "";
string localdb_dir = "";
- string backup_
na
me = "";
+ string backup_
sche
me = "";
while (1) {
static struct option long_options[] = {
while (1) {
static struct option long_options[] = {
@@
-574,7
+574,7
@@
int main(int argc, char *argv[])
{"filter", 1, 0, 0}, // 2
{"filter-extension", 1, 0, 0}, // 3
{"dest", 1, 0, 0}, // 4
{"filter", 1, 0, 0}, // 2
{"filter-extension", 1, 0, 0}, // 3
{"dest", 1, 0, 0}, // 4
- {"
name", 1, 0, 0},
// 5
+ {"
scheme", 1, 0, 0},
// 5
{NULL, 0, 0, 0},
};
{NULL, 0, 0, 0},
};
@@
-604,8
+604,8
@@
int main(int argc, char *argv[])
case 4: // --dest
backup_dest = optarg;
break;
case 4: // --dest
backup_dest = optarg;
break;
- case 5: // --
na
me
- backup_
na
me = optarg;
+ case 5: // --
sche
me
+ backup_
sche
me = optarg;
break;
default:
fprintf(stderr, "Unhandled long option!\n");
break;
default:
fprintf(stderr, "Unhandled long option!\n");
@@
-617,11
+617,6
@@
int main(int argc, char *argv[])
}
}
}
}
- if (argc < optind + 2) {
- usage(argv[0]);
- return 1;
- }
-
searches.push_back(".");
if (optind == argc) {
add_include(".");
searches.push_back(".");
if (optind == argc) {
add_include(".");
@@
-683,7
+678,8
@@
int main(int argc, char *argv[])
* snapshot. */
string database_path = localdb_dir + "/localdb.sqlite";
db = new LocalDb;
* snapshot. */
string database_path = localdb_dir + "/localdb.sqlite";
db = new LocalDb;
- db->Open(database_path.c_str(), desc_buf);
+ db->Open(database_path.c_str(), desc_buf,
+ backup_scheme.size() ? backup_scheme.c_str() : NULL);
/* Initialize the stat cache, for skipping over unchanged files. */
statcache = new StatCache;
/* Initialize the stat cache, for skipping over unchanged files. */
statcache = new StatCache;
@@
-717,17
+713,17
@@
int main(int argc, char *argv[])
* where to start to restore this snapshot. The filename is based on the
* current time. */
string desc_filename = backup_dest + "/snapshot-";
* where to start to restore this snapshot. The filename is based on the
* current time. */
string desc_filename = backup_dest + "/snapshot-";
- if (backup_
na
me.size() > 0)
- desc_filename += backup_
na
me + "-";
+ if (backup_
sche
me.size() > 0)
+ desc_filename += backup_
sche
me + "-";
desc_filename = desc_filename + desc_buf + ".lbs";
std::ofstream descriptor(desc_filename.c_str());
desc_filename = desc_filename + desc_buf + ".lbs";
std::ofstream descriptor(desc_filename.c_str());
- descriptor << "Format: LBS Snapshot v0.
1
\n";
+ descriptor << "Format: LBS Snapshot v0.
2
\n";
descriptor << "Producer: LBS " << lbs_version << "\n";
strftime(desc_buf, sizeof(desc_buf), "%Y-%m-%d %H:%M:%S %z", &time_buf);
descriptor << "Date: " << desc_buf << "\n";
descriptor << "Producer: LBS " << lbs_version << "\n";
strftime(desc_buf, sizeof(desc_buf), "%Y-%m-%d %H:%M:%S %z", &time_buf);
descriptor << "Date: " << desc_buf << "\n";
- if (backup_
na
me.size() > 0)
- descriptor << "
Name: " << backup_na
me << "\n";
+ if (backup_
sche
me.size() > 0)
+ descriptor << "
Scheme: " << backup_sche
me << "\n";
descriptor << "Root: " << backup_root << "\n";
descriptor << "Segments:\n";
descriptor << "Root: " << backup_root << "\n";
descriptor << "Segments:\n";