def MatchFirst(self, ctx): pat_ptr = ctx.cpu.r_reg(REG_D1) pat = ctx.mem.access.r_cstr(pat_ptr) anchor_ptr = ctx.cpu.r_reg(REG_D2) anchor = AccessStruct(self.ctx.mem,AnchorPathDef,struct_addr=anchor_ptr) # create MatchFirstNext instance mfn = MatchFirstNext(self.path_mgr, self.lock_mgr, pat, anchor) log_dos.info("MatchFirst: pat='%s' anchor=%06x strlen=%d flags=%02x-> ok=%s" \ % (pat, anchor_ptr, mfn.str_len, mfn.flags, mfn.ok)) if not mfn.ok: self.io_err = ERROR_BAD_TEMPLATE return self.io_err log_dos.debug("MatchFirst: %s" % mfn.matcher) # try first match self.io_err = mfn.first(ctx) if self.io_err == NO_ERROR: log_dos.info("MatchFirst: found name='%s' path='%s' -> parent lock %s, io_err=%d", mfn.name, mfn.path, mfn.dir_lock, self.io_err) self.matches[anchor_ptr] = mfn # no entry found or error elif self.io_err == ERROR_OBJECT_NOT_FOUND: log_dos.info("MatchFirst: none found") self.matches[anchor_ptr] = mfn else: log_dos.info("MatchFirst: error: %d", self.io_err) return self.io_err
def MatchFirst(self, lib, ctx): pat_ptr = ctx.cpu.r_reg(REG_D1) pat = ctx.mem.access.r_cstr(pat_ptr) anchor_ptr = ctx.cpu.r_reg(REG_D2) anchor = AccessStruct(self.ctx.mem, AnchorPathDef, struct_addr=anchor_ptr) # create MatchFirstNext instance mfn = MatchFirstNext(self.path_mgr, self.lock_mgr, pat, anchor) log_dos.info("MatchFirst: pat='%s' anchor=%06x strlen=%d flags=%02x-> ok=%s" \ % (pat, anchor_ptr, mfn.str_len, mfn.flags, mfn.ok)) if not mfn.ok: self.io_err = ERROR_BAD_TEMPLATE return self.io_err log_dos.debug("MatchFirst: %s" % mfn.matcher) # no entry found if mfn.path == None: log_dos.info("MatchFirst: none found!") self.matches[anchor_ptr] = None self.io_err = ERROR_OBJECT_NOT_FOUND # first match else: self.io_err = mfn.first(ctx) log_dos.info( "MatchFirst: found path='%s' -> dir path=%s -> parent lock %s, io_err=%d", mfn.path, mfn.voldir_path, mfn.dir_lock, self.io_err) self.matches[anchor_ptr] = mfn return self.io_err