defined(&OBD_SNAP_SETTABLE);
eval 'sub OBD_SNAP_PRINTTABLE () { &_IOC(3, ord(\'f\'), 41, 4);}' unless
defined(&OBD_SNAP_PRINTTABLE);
-
eval 'sub OBD_SNAP_DELETE() { &_IOC(3, ord(\'f\'), 42, 4);}' unless
defined(&OBD_SNAP_DELETE);
eval 'sub OBD_SNAP_RESTORE() { &_IOC(3, ord(\'f\'), 43, 4);}' unless
'create' => {func => "Create", doc => "create: creates a new inode"},
'attach' => {func => "Attach", doc => "attach type [adapter bus tid lun]"},
'detach' => {func => "Detach", doc => "detach this device"},
- 'snapattach' => {func => "SnapAttach", doc => "snapattach snapno table"},
+ 'testext2iterator' => {func => "TestExt2Iterator", doc => ""},
+ 'snapattach' => {func => "SnapAttach", doc => "snapattach snapdev snapidx tableno"},
'snapset' => {func => "SnapSetTable", doc => "snapset tableno file" },
'snapprint' => {func => "SnapPrint", doc => "snapprint tableno"},
-
- 'testext2iterator' => {func => "TestExt2Iterator", doc => ""},
'snapdelete' => {func => "SnapDelete", doc => "snapdelete: delete connected snap obd"},
'snaprestore' => {func => "SnapRestore", doc => "snaprestore: restore connected old snap to current"},
-
'snaptable' => {func => "SnapShotTable", doc => "snaptable: build a snapshot table (interactive)"},
'copy' => {func => "Copy", doc => "copy srcid tgtid"},
'migrate' => {func => "Migrate", doc => "migrate srcid tgtid"},
'format' => {func => "Format", doc => "format type adapter bus tid lun size"},
'partition' => {func => "Partition", doc => "partition type adapter bus tid lun partition size"},
- 'setup' => {func => "Setup", doc => "setup: link the ext2 partition (default /dev/loop0) to this obddev"},
+ 'setup' => {func => "Setup", doc => "setup [type]: link this OBD device to the underlying device (default type ext2_obd, filesystem /dev/loop0)"},
'connect' => {func => "Connect", doc => "connect: allocates client ID for this session"},
'disconnect' => {func => "Disconnect", doc => "disconnect [id]: frees client resources"},
'sync' => {func => "Sync", doc => "sync: flushes buffers to disk"},
- 'destroy' => {func => "Destroy", doc => "setup: destroys an inode"},
+ 'destroy' => {func => "Destroy", doc => "destroy <inode>: destroys an inode"},
'cleanup' => {func => "Cleanup", doc => "cleanup the minor obd device"},
'dec_use_count' => {func => "Decusecount", doc => "decreases the module use count so that the module can be removed following an oops"},
'read' => {func => "Read", doc => "read <inode> <count> [offset]"},
if (!defined($::st = stat($filesystem))) {
die "Unable to stat $filesystem.\n";
}
+ print "Filesystem now $filesystem\n";
}
# select the OBD device we talk to
sub Device {
my $device = shift;
+ if ($::client_id) {
+ print "Disconnecting active session ($::client_id)...";
+ Disconnect($::client_id);
+ }
if (! $device ) {
$device = "/dev/obd0";
}
sub TestExt2Iterator {
+ if (!defined($::client_id)) {
+ print "You must first ``connect''.\n";
+ return;
+ }
+
my $err = 0;
my $type = "ext2_obd";
sub SnapDelete {
+ if (!defined($::client_id)) {
+ print "You must first ``connect''.\n";
+ return;
+ }
+
my $err = 0;
my $type = "snap_obd";
}
+# FIXME the parameter to snaprestore SHOULD be the snapshot number of the
+# snapshot to be restored, and this routine should handle all of the
+# removal of intervening snapshots and changing the snaptable to have
+# the "restored" snapshot as current and move the previous current.
sub SnapRestore {
+ if (!defined($::client_id)) {
+ print "You must first ``connect''.\n";
+ return;
+ }
+
my $err = 0;
my $type = "snap_obd";
my $prevcurrent = shift;
my $err = 0;
my $type = "snap_obd";
my $snapdev = shift;
- my $snapno = shift;
+ my $snapidx = shift;
my $tableno = shift;
my $snapcount;
my $data;
my $datalen = 0;
- $data = pack("iii", $snapdev, $snapno, $tableno);
+ $data = pack("iii", $snapdev, $snapidx, $tableno);
$datalen = 3 * 4;
my $len = length($type);