gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/sentry/vfs/BUILD (about)

     1  load("//pkg/sync/locking:locking.bzl", "declare_mutex")
     2  load("//tools:defs.bzl", "go_library", "go_test", "proto_library")
     3  load("//tools/go_generics:defs.bzl", "go_template_instance")
     4  
     5  package(default_applicable_licenses = ["//:license"])
     6  
     7  licenses(["notice"])
     8  
     9  declare_mutex(
    10      name = "virtual_filesystem_mutex",
    11      out = "virtual_filesystem_mutex.go",
    12      package = "vfs",
    13      prefix = "virtualFilesystem",
    14  )
    15  
    16  declare_mutex(
    17      name = "inotify_event_mutex",
    18      out = "inotify_event_mutex.go",
    19      package = "vfs",
    20      prefix = "inotifyEvent",
    21  )
    22  
    23  declare_mutex(
    24      name = "inotify_mutex",
    25      out = "inotify_mutex.go",
    26      package = "vfs",
    27      prefix = "inotify",
    28  )
    29  
    30  declare_mutex(
    31      name = "epoll_instance_mutex",
    32      out = "epoll_instance_mutex.go",
    33      package = "vfs",
    34      prefix = "epollReadyInstance",
    35  )
    36  
    37  declare_mutex(
    38      name = "epoll_mutex",
    39      out = "epoll_mutex.go",
    40      package = "vfs",
    41      prefix = "epoll",
    42  )
    43  
    44  go_template_instance(
    45      name = "epoll_interest_list",
    46      out = "epoll_interest_list.go",
    47      package = "vfs",
    48      prefix = "epollInterest",
    49      template = "//pkg/ilist:generic_list",
    50      types = {
    51          "Element": "*epollInterest",
    52          "Linker": "*epollInterest",
    53      },
    54  )
    55  
    56  go_template_instance(
    57      name = "mount_ring",
    58      out = "mount_ring.go",
    59      package = "vfs",
    60      prefix = "mount",
    61      template = "//pkg/ilist:generic_ring",
    62      types = {
    63          "Container": "*Mount",
    64      },
    65  )
    66  
    67  go_template_instance(
    68      name = "mount_list",
    69      out = "mount_list.go",
    70      package = "vfs",
    71      prefix = "follower",
    72      template = "//pkg/ilist:generic_list",
    73      types = {
    74          "Element": "*Mount",
    75          "Linker": "*Mount",
    76      },
    77  )
    78  
    79  go_template_instance(
    80      name = "event_list",
    81      out = "event_list.go",
    82      package = "vfs",
    83      prefix = "event",
    84      template = "//pkg/ilist:generic_list",
    85      types = {
    86          "Element": "*Event",
    87          "Linker": "*Event",
    88      },
    89  )
    90  
    91  go_template_instance(
    92      name = "file_description_refs",
    93      out = "file_description_refs.go",
    94      package = "vfs",
    95      prefix = "FileDescription",
    96      template = "//pkg/refs:refs_template",
    97      types = {
    98          "T": "FileDescription",
    99      },
   100  )
   101  
   102  go_template_instance(
   103      name = "mount_namespace_refs",
   104      out = "mount_namespace_refs.go",
   105      package = "vfs",
   106      prefix = "namespace",
   107      template = "//pkg/refs:refs_template",
   108      types = {
   109          "T": "MountNamespace",
   110      },
   111  )
   112  
   113  go_template_instance(
   114      name = "filesystem_refs",
   115      out = "filesystem_refs.go",
   116      package = "vfs",
   117      prefix = "Filesystem",
   118      template = "//pkg/refs:refs_template",
   119      types = {
   120          "T": "Filesystem",
   121      },
   122  )
   123  
   124  proto_library(
   125      name = "events",
   126      srcs = ["events.proto"],
   127      visibility = ["//visibility:public"],
   128  )
   129  
   130  go_library(
   131      name = "vfs",
   132      srcs = [
   133          "anonfs.go",
   134          "context.go",
   135          "debug.go",
   136          "debug_testonly.go",
   137          "dentry.go",
   138          "device.go",
   139          "epoll.go",
   140          "epoll_instance_mutex.go",
   141          "epoll_interest_list.go",
   142          "epoll_mutex.go",
   143          "event_list.go",
   144          "file_description.go",
   145          "file_description_impl_util.go",
   146          "file_description_refs.go",
   147          "filesystem.go",
   148          "filesystem_impl_util.go",
   149          "filesystem_refs.go",
   150          "filesystem_type.go",
   151          "inotify.go",
   152          "inotify_event_mutex.go",
   153          "inotify_mutex.go",
   154          "lock.go",
   155          "mount.go",
   156          "mount_list.go",
   157          "mount_namespace_refs.go",
   158          "mount_ring.go",
   159          "mount_unsafe.go",
   160          "namespace.go",
   161          "opath.go",
   162          "options.go",
   163          "pathname.go",
   164          "permissions.go",
   165          "propagation.go",
   166          "resolving_path.go",
   167          "save_restore.go",
   168          "vfs.go",
   169          "virtual_filesystem_mutex.go",
   170      ],
   171      visibility = ["//pkg/sentry:internal"],
   172      deps = [
   173          ":events_go_proto",
   174          "//pkg/abi/linux",
   175          "//pkg/atomicbitops",
   176          "//pkg/bitmap",
   177          "//pkg/bits",
   178          "//pkg/cleanup",
   179          "//pkg/context",
   180          "//pkg/errors/linuxerr",
   181          "//pkg/eventchannel",
   182          "//pkg/fd",
   183          "//pkg/fdnotifier",
   184          "//pkg/fspath",
   185          "//pkg/gohacks",
   186          "//pkg/hostarch",
   187          "//pkg/log",
   188          "//pkg/refs",
   189          "//pkg/safemem",
   190          "//pkg/sentry/arch",
   191          "//pkg/sentry/fsimpl/lock",
   192          "//pkg/sentry/fsmetric",
   193          "//pkg/sentry/kernel/auth",
   194          "//pkg/sentry/kernel/time",
   195          "//pkg/sentry/limits",
   196          "//pkg/sentry/memmap",
   197          "//pkg/sentry/socket/unix/transport",
   198          "//pkg/sentry/uniqueid",
   199          "//pkg/sync",
   200          "//pkg/sync/locking",
   201          "//pkg/usermem",
   202          "//pkg/waiter",
   203          "@org_golang_x_sys//unix:go_default_library",
   204      ],
   205  )
   206  
   207  go_test(
   208      name = "vfs_test",
   209      size = "small",
   210      srcs = [
   211          "file_description_impl_util_test.go",
   212          "mount_test.go",
   213      ],
   214      library = ":vfs",
   215      deps = [
   216          "//pkg/abi/linux",
   217          "//pkg/atomicbitops",
   218          "//pkg/context",
   219          "//pkg/errors/linuxerr",
   220          "//pkg/sentry/contexttest",
   221          "//pkg/sync",
   222          "//pkg/usermem",
   223      ],
   224  )