Exemple #1
0
    def __init__(self, redo_op, undo_op, redo_data, undo_data, redo_length,
                 undo_length, deriv_inum):
        self.operation_type = None
        self.operation_object = None

        if redo_op == self.SET_BITS_IN_NONRESIDENT_BITMAP and undo_op == self.CLEAR_BITS_IN_NONRESIDENT_BITMAP:
            pass
        # getting the MFT entry out of the data
        elif redo_op == self.INITIALIZE_FILE_RECORD_SEGMENT and undo_op == self.NO_OPERATION and redo_length > 0 and len(
                redo_data) > 0:
            self.operation_type = 'embedded mft'
            self.operation_object = MFTEntry(inum=deriv_inum,
                                             data=redo_data,
                                             logfile_parse=True)
        elif redo_op == self.DELETE_ATTRIBUTE and undo_op == self.CREATE_ATTRIBUTE and undo_length > 0 and len(
                undo_data) > 0:
            self.operation_type = 'embedded mft attribute'
            self.operation_object = AttributeFactory.create_attribute(
                undo_data)
        elif redo_op == self.CREATE_ATTRIBUTE and undo_op == self.DELETE_ATTRIBUTE and redo_length > 0 and len(
                redo_data) > 0:
            self.operation_type = 'embedded mft attribute'
            self.operation_object = AttributeFactory.create_attribute(
                redo_data)
        elif redo_op == self.CREATE_ATTRIBUTE and undo_op == self.DELETE_ATTRIBUTE:
            pass
        elif redo_op == self.DELETE_INDEX_ENTRY_ALLOCATION and undo_op == self.ADD_INDEX_ENTRY_ALLOCATION:
            pass
        elif redo_op == self.ADD_INDEX_ENTRY_ALLOCATION and undo_op == self.DELETE_INDEX_ENTRY_ALLOCATION:
            pass
        elif redo_op == self.UPDATE_NONRESIDENT_VALUE and undo_op == self.NO_OPERATION:
            record = UsnRecord(redo_data, 0)
            if record:
                self.operation_object = record
                self.operation_type = 'embedded usn'
Exemple #2
0
class OperationCode:
    NO_OPERATION                     = 0
    COMPENSATION_LOG_RECORD          = 1
    INITIALIZE_FILE_RECORD_SEGMENT   = 2
    DEALLOCATE_FILE_RECORD_SEGMENT   = 3
    WRITE_END_OF_FILE_RECORD_SEGMENT = 4
    CREATE_ATTRIBUTE                 = 5
    DELETE_ATTRIBUTE                 = 6
    UPDATE_RESIDENT_VALUE            = 7
    UPDATE_NONRESIDENT_VALUE         = 8
    UPDATE_MAPPING_PAIRS             = 9
    DELETE_DIRTY_CLUSTERS            = 10
    SET_NEW_ATTRIBUTE_SIZES          = 11
    ADD_INDEX_ENTRY_ROOT             = 12
    DELETE_INDEX_ENTRY_ROOT          = 13
    ADD_INDEX_ENTRY_ALLOCATION       = 14
    DELETE_INDEX_ENTRY_ALLOCATION    = 15
    SET_INDEX_ENTRY_VCN_ALLOCATION   = 18
    UPDATE_FILE_NAME_ROOT            = 19
    UPDATE_FILE_NAME_ALLOCATION      = 20
    SET_BITS_IN_NONRESIDENT_BITMAP   = 21
    CLEAR_BITS_IN_NONRESIDENT_BITMAP = 22
    PREPARE_TRANSACTION              = 25
    COMMIT_TRANSACTION               = 26
    FORGET_TRANSACTION               = 27
    OPEN_NON_RESIDENT_ATTRIBUTE      = 28
    DIRTY_PAGE_TABLE_DUMP            = 31
    TRANSACTION_TABLE_DUMP           = 32
    UPDATE_RECORD_DATA_ROOT          = 33

    def __init__(self, redo_op, undo_op, redo_data, undo_data, redo_length, undo_length, deriv_inum):
        self.operation_type = None
        self.operation_object = None

        if redo_op == self.SET_BITS_IN_NONRESIDENT_BITMAP and undo_op == self.CLEAR_BITS_IN_NONRESIDENT_BITMAP:
            pass
        # getting the MFT entry out of the data
        elif redo_op == self.INITIALIZE_FILE_RECORD_SEGMENT and undo_op == self.NO_OPERATION and redo_length > 0 and len(redo_data) > 0:
            self.operation_type = 'embedded mft'
            self.operation_object = MFTEntry(inum=deriv_inum, data=redo_data, logfile_parse=True)
        elif redo_op == self.DELETE_ATTRIBUTE and undo_op == self.CREATE_ATTRIBUTE and undo_length > 0 and len(undo_data) > 0:
            self.operation_type = 'embedded mft attribute'
            self.operation_object = AttributeFactory.create_attribute(undo_data)
        elif redo_op == self.CREATE_ATTRIBUTE and undo_op == self.DELETE_ATTRIBUTE and redo_length > 0 and len(redo_data) > 0:
            self.operation_type = 'embedded mft attribute'
            self.operation_object = AttributeFactory.create_attribute(redo_data)
        elif redo_op == self.CREATE_ATTRIBUTE and undo_op == self.DELETE_ATTRIBUTE:
            pass
        elif redo_op == self.DELETE_INDEX_ENTRY_ALLOCATION and undo_op == self.ADD_INDEX_ENTRY_ALLOCATION:
            pass
        elif redo_op == self.ADD_INDEX_ENTRY_ALLOCATION and undo_op == self.DELETE_INDEX_ENTRY_ALLOCATION:
            pass
        elif redo_op == self.UPDATE_NONRESIDENT_VALUE and undo_op == self.NO_OPERATION:
            record = UsnRecord(redo_data, 0)
            if record:
                self.operation_object = record
                self.operation_type = 'embedded usn'

    def writeout_parsed(self, out):
        self.operation_object.writeout_parsed(out)
Exemple #3
0
    def __init__(self, redo_op, undo_op, redo_data, undo_data, redo_length, undo_length, deriv_inum):
        self.operation_type = None
        self.operation_object = None

        if redo_op == self.SET_BITS_IN_NONRESIDENT_BITMAP and undo_op == self.CLEAR_BITS_IN_NONRESIDENT_BITMAP:
            pass
        # getting the MFT entry out of the data
        elif redo_op == self.INITIALIZE_FILE_RECORD_SEGMENT and undo_op == self.NO_OPERATION and redo_length > 0 and len(redo_data) > 0:
            self.operation_type = 'embedded mft'
            self.operation_object = MFTEntry(inum=deriv_inum, data=redo_data, logfile_parse=True)
        elif redo_op == self.DELETE_ATTRIBUTE and undo_op == self.CREATE_ATTRIBUTE and undo_length > 0 and len(undo_data) > 0:
            self.operation_type = 'embedded mft attribute'
            self.operation_object = AttributeFactory.create_attribute(undo_data)
        elif redo_op == self.CREATE_ATTRIBUTE and undo_op == self.DELETE_ATTRIBUTE and redo_length > 0 and len(redo_data) > 0:
            self.operation_type = 'embedded mft attribute'
            self.operation_object = AttributeFactory.create_attribute(redo_data)
        elif redo_op == self.CREATE_ATTRIBUTE and undo_op == self.DELETE_ATTRIBUTE:
            pass
        elif redo_op == self.DELETE_INDEX_ENTRY_ALLOCATION and undo_op == self.ADD_INDEX_ENTRY_ALLOCATION:
            pass
        elif redo_op == self.ADD_INDEX_ENTRY_ALLOCATION and undo_op == self.DELETE_INDEX_ENTRY_ALLOCATION:
            pass
        elif redo_op == self.UPDATE_NONRESIDENT_VALUE and undo_op == self.NO_OPERATION:
            record = UsnRecord(redo_data, 0)
            if record:
                self.operation_object = record
                self.operation_type = 'embedded usn'
Exemple #4
0
class OperationCode:
    NO_OPERATION = 0
    COMPENSATION_LOG_RECORD = 1
    INITIALIZE_FILE_RECORD_SEGMENT = 2
    DEALLOCATE_FILE_RECORD_SEGMENT = 3
    WRITE_END_OF_FILE_RECORD_SEGMENT = 4
    CREATE_ATTRIBUTE = 5
    DELETE_ATTRIBUTE = 6
    UPDATE_RESIDENT_VALUE = 7
    UPDATE_NONRESIDENT_VALUE = 8
    UPDATE_MAPPING_PAIRS = 9
    DELETE_DIRTY_CLUSTERS = 10
    SET_NEW_ATTRIBUTE_SIZES = 11
    ADD_INDEX_ENTRY_ROOT = 12
    DELETE_INDEX_ENTRY_ROOT = 13
    ADD_INDEX_ENTRY_ALLOCATION = 14
    DELETE_INDEX_ENTRY_ALLOCATION = 15
    SET_INDEX_ENTRY_VCN_ALLOCATION = 18
    UPDATE_FILE_NAME_ROOT = 19
    UPDATE_FILE_NAME_ALLOCATION = 20
    SET_BITS_IN_NONRESIDENT_BITMAP = 21
    CLEAR_BITS_IN_NONRESIDENT_BITMAP = 22
    PREPARE_TRANSACTION = 25
    COMMIT_TRANSACTION = 26
    FORGET_TRANSACTION = 27
    OPEN_NON_RESIDENT_ATTRIBUTE = 28
    DIRTY_PAGE_TABLE_DUMP = 31
    TRANSACTION_TABLE_DUMP = 32
    UPDATE_RECORD_DATA_ROOT = 33

    def __init__(self, redo_op, undo_op, redo_data, undo_data, redo_length,
                 undo_length, deriv_inum):
        self.operation_type = None
        self.operation_object = None

        if redo_op == self.SET_BITS_IN_NONRESIDENT_BITMAP and undo_op == self.CLEAR_BITS_IN_NONRESIDENT_BITMAP:
            pass
        # getting the MFT entry out of the data
        elif redo_op == self.INITIALIZE_FILE_RECORD_SEGMENT and undo_op == self.NO_OPERATION and redo_length > 0 and len(
                redo_data) > 0:
            self.operation_type = 'embedded mft'
            self.operation_object = MFTEntry(inum=deriv_inum,
                                             data=redo_data,
                                             logfile_parse=True)
        elif redo_op == self.DELETE_ATTRIBUTE and undo_op == self.CREATE_ATTRIBUTE and undo_length > 0 and len(
                undo_data) > 0:
            self.operation_type = 'embedded mft attribute'
            self.operation_object = AttributeFactory.create_attribute(
                undo_data)
        elif redo_op == self.CREATE_ATTRIBUTE and undo_op == self.DELETE_ATTRIBUTE and redo_length > 0 and len(
                redo_data) > 0:
            self.operation_type = 'embedded mft attribute'
            self.operation_object = AttributeFactory.create_attribute(
                redo_data)
        elif redo_op == self.CREATE_ATTRIBUTE and undo_op == self.DELETE_ATTRIBUTE:
            pass
        elif redo_op == self.DELETE_INDEX_ENTRY_ALLOCATION and undo_op == self.ADD_INDEX_ENTRY_ALLOCATION:
            pass
        elif redo_op == self.ADD_INDEX_ENTRY_ALLOCATION and undo_op == self.DELETE_INDEX_ENTRY_ALLOCATION:
            pass
        elif redo_op == self.UPDATE_NONRESIDENT_VALUE and undo_op == self.NO_OPERATION:
            record = UsnRecord(redo_data, 0)
            if record:
                self.operation_object = record
                self.operation_type = 'embedded usn'

    def writeout_parsed(self, out):
        self.operation_object.writeout_parsed(out)