Skip to content

Commit

Permalink
Cherry-picking phoeagon's commit fb0a18d
Browse files Browse the repository at this point in the history
1. Change some of the "assert type() == int" statements into "assert
isinstance(, (int, long))". Apparently, this is needed for the tool to work in
some Python environments (probably for 32-bit environments).

2. Phoeagon complained that setting "use_cached = False" during replay produces
weird behavior. Haven't tried reproducing the problem, but turning it off so
that first-time users are not discouraged if there is such behavior.
  • Loading branch information
madthanu committed Mar 27, 2015
1 parent 1a98e7a commit bf7452c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions alice.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_stat(path):
return False

def get_inode_file(inode, mode = None):
assert type(inode) == int
assert isinstance(inode, (int, long))
if not get_stat(replay_dir + '/.inodes/' + str(inode)):
if mode == None:
mode = 0666
Expand All @@ -82,15 +82,15 @@ def get_inode_file(inode, mode = None):

dirinode_map = {} # From initial_inode to replayed_directory_path
def is_linked_inode_directory(inode):
assert type(inode) == int
assert isinstance(inode, (int, long))
if inode not in dirinode_map:
return False
if dirinode_map[inode] == replay_dir + '/.inodes/' + str(inode):
return False
return True

def get_inode_directory(inode, mode = None):
assert type(inode) == int
assert isinstance(inode, (int, long))
if inode not in dirinode_map:
if mode == None:
mode = 0777
Expand All @@ -101,7 +101,7 @@ def get_inode_directory(inode, mode = None):
return dirinode_map[inode]

def set_inode_directory(inode, dir_path):
assert type(inode) == int
assert isinstance(inode, (int, long))
dirinode_map[inode] = dir_path

def initialize_inode_links(initial_paths_inode_map):
Expand Down Expand Up @@ -334,7 +334,7 @@ def construct_crashed_dir(self, dirname, stdout_file):
for j in range(0, till):
if not micro_op.hidden_disk_ops[j].hidden_omitted:
to_replay.append(micro_op.hidden_disk_ops[j])
replay_disk_ops(self.path_inode_map, to_replay, dirname, stdout_file, use_cached = True)
replay_disk_ops(self.path_inode_map, to_replay, dirname, stdout_file, use_cached = False)
def get_op(self, i):
assert i <= len(self.micro_ops)
return copy.deepcopy(self.micro_ops[i])
Expand Down

0 comments on commit bf7452c

Please sign in to comment.