RedirectPath.py revision 13883
113883Sdavid.hashe@amd.com# Copyright (c) 2015 Advanced Micro Devices, Inc. 213883Sdavid.hashe@amd.com# All rights reserved. 313883Sdavid.hashe@amd.com# 413883Sdavid.hashe@amd.com# Redistribution and use in source and binary forms, with or without 513883Sdavid.hashe@amd.com# modification, are permitted provided that the following conditions are 613883Sdavid.hashe@amd.com# met: redistributions of source code must retain the above copyright 713883Sdavid.hashe@amd.com# notice, this list of conditions and the following disclaimer; 813883Sdavid.hashe@amd.com# redistributions in binary form must reproduce the above copyright 913883Sdavid.hashe@amd.com# notice, this list of conditions and the following disclaimer in the 1013883Sdavid.hashe@amd.com# documentation and/or other materials provided with the distribution; 1113883Sdavid.hashe@amd.com# neither the name of the copyright holders nor the names of its 1213883Sdavid.hashe@amd.com# contributors may be used to endorse or promote products derived from 1313883Sdavid.hashe@amd.com# this software without specific prior written permission. 1413883Sdavid.hashe@amd.com# 1513883Sdavid.hashe@amd.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1613883Sdavid.hashe@amd.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1713883Sdavid.hashe@amd.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1813883Sdavid.hashe@amd.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1913883Sdavid.hashe@amd.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2013883Sdavid.hashe@amd.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2113883Sdavid.hashe@amd.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2213883Sdavid.hashe@amd.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2313883Sdavid.hashe@amd.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2413883Sdavid.hashe@amd.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2513883Sdavid.hashe@amd.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2613883Sdavid.hashe@amd.com# 2713883Sdavid.hashe@amd.com# Authors: David Hashe 2813883Sdavid.hashe@amd.com 2913883Sdavid.hashe@amd.comfrom m5.SimObject import SimObject 3013883Sdavid.hashe@amd.comfrom m5.params import * 3113883Sdavid.hashe@amd.comfrom m5.proxy import * 3213883Sdavid.hashe@amd.com 3313883Sdavid.hashe@amd.comclass RedirectPath(SimObject): 3413883Sdavid.hashe@amd.com """ Stores paths for filesystem redirection during syscalls. If a path 3513883Sdavid.hashe@amd.com matches 'appPath', then the syscall is redirected to the first 'hostPath' 3613883Sdavid.hashe@amd.com that contains the non-overlapping portion of the path as a valid file. If 3713883Sdavid.hashe@amd.com there are no hits, then the syscall is redirected to the first value. 3813883Sdavid.hashe@amd.com """ 3913883Sdavid.hashe@amd.com type = 'RedirectPath' 4013883Sdavid.hashe@amd.com cxx_header = "sim/redirect_path.hh" 4113883Sdavid.hashe@amd.com 4213883Sdavid.hashe@amd.com app_path = Param.String("/", "filesystem path from an app's perspective") 4313883Sdavid.hashe@amd.com host_paths = VectorParam.String(["/"], "file path on host filesystem") 44