gitee.com/mysnapcore/mysnapd@v0.1.0/interfaces/builtin/ion_memory_control.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  /*
     4   * Copyright (C) 2021 Canonical Ltd
     5   *
     6   * This program is free software: you can redistribute it and/or modify
     7   * it under the terms of the GNU General Public License version 3 as
     8   * published by the Free Software Foundation.
     9   *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
    14   *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17   *
    18   */
    19  
    20  package builtin
    21  
    22  const ionMemoryControlSummary = `allows access to The Android ION memory allocator`
    23  
    24  const ionMemoryControlBaseDeclarationSlots = `
    25    ion-memory-control:
    26      allow-installation:
    27        slot-snap-type:
    28          - core
    29      deny-auto-connection: true
    30  `
    31  
    32  const ionMemoryControlBaseDeclarationPlugs = `
    33    ion-memory-control:
    34      allow-installation: false
    35      deny-auto-connection: true
    36  `
    37  
    38  const ionMemoryControlConnectedPlugAppArmor = `
    39  # Description: for those who need to talk to the Android ION memory allocator
    40  # /dev/ion
    41  # https://lwn.net/Articles/480055/
    42  
    43  /dev/ion rw,
    44  `
    45  
    46  var ionMemoryControlConnectedPlugUDev = []string{
    47  	`KERNEL=="ion"`,
    48  }
    49  
    50  func init() {
    51  	registerIface(&commonInterface{
    52  		name:                  "ion-memory-control",
    53  		summary:               ionMemoryControlSummary,
    54  		implicitOnCore:        true,
    55  		implicitOnClassic:     true,
    56  		baseDeclarationSlots:  ionMemoryControlBaseDeclarationSlots,
    57  		baseDeclarationPlugs:  ionMemoryControlBaseDeclarationPlugs,
    58  		connectedPlugAppArmor: ionMemoryControlConnectedPlugAppArmor,
    59  		connectedPlugUDev:     ionMemoryControlConnectedPlugUDev,
    60  	})
    61  }