github.com/rigado/snapd@v2.42.5-go-mod+incompatible/cmd/snap-confine/mount-support.h (about)

     1  /*
     2   * Copyright (C) 2015 Canonical Ltd
     3   *
     4   * This program is free software: you can redistribute it and/or modify
     5   * it under the terms of the GNU General Public License version 3 as
     6   * published by the Free Software Foundation.
     7   *
     8   * This program is distributed in the hope that it will be useful,
     9   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11   * GNU General Public License for more details.
    12   *
    13   * You should have received a copy of the GNU General Public License
    14   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15   *
    16   */
    17  
    18  #ifndef SNAP_MOUNT_SUPPORT_H
    19  #define SNAP_MOUNT_SUPPORT_H
    20  
    21  #include "../libsnap-confine-private/apparmor-support.h"
    22  #include "snap-confine-invocation.h"
    23  
    24  /**
    25   * Assuming a new mountspace, populate it accordingly.
    26   *
    27   * This function performs many internal tasks:
    28   * - prepares and chroots into the core snap (on classic systems)
    29   * - creates private /tmp
    30   * - creates private /dev/pts
    31   * - processes mount profiles
    32   **/
    33  void sc_populate_mount_ns(struct sc_apparmor *apparmor, int snap_update_ns_fd,
    34  			  const sc_invocation * inv);
    35  
    36  /**
    37   * Ensure that / or /snap is mounted with the SHARED option.
    38   *
    39   * If the system is found to be not having a shared mount for "/"
    40   * snap-confine will create a shared bind mount for "/snap" to
    41   * ensure that "/snap" is mounted shared. See LP:#1668659
    42   */
    43  void sc_ensure_shared_snap_mount(void);
    44  
    45  /**
    46   * Set up user mounts, private to this process.
    47   *
    48   * If any user mounts have been configured for this process, this does
    49   * the following:
    50   * - create a new mount namespace
    51   * - reconfigure all existing mounts to slave mode
    52   * - perform all user mounts
    53   */
    54  void sc_setup_user_mounts(struct sc_apparmor *apparmor, int snap_update_ns_fd,
    55  			  const char *snap_name);
    56  
    57  #endif