snapxfer: convert to functions
snapxfer: Use lockfile to prevent parallel executions.