github.com/apptainer/singularity@v3.1.1+incompatible/pkg/util/loop/loop.go (about)

     1  // Copyright (c) 2018-2019, Sylabs Inc. All rights reserved.
     2  // This software is licensed under a 3-clause BSD license. Please consult the
     3  // LICENSE.md file distributed with the sources of this project regarding your
     4  // rights to use or distribute this software.
     5  
     6  package loop
     7  
     8  // Device describes a loop device
     9  type Device struct {
    10  	MaxLoopDevices int
    11  	Shared         bool
    12  	Info           *Info64
    13  }
    14  
    15  // Loop device flags values
    16  const (
    17  	FlagsReadOnly  = 1
    18  	FlagsAutoClear = 4
    19  	FlagsPartScan  = 8
    20  	FlagsDirectIO  = 16
    21  )
    22  
    23  // Loop device encryption types
    24  const (
    25  	CryptNone      = 0
    26  	CryptXor       = 1
    27  	CryptDes       = 2
    28  	CryptFish2     = 3
    29  	CryptBlow      = 4
    30  	CryptCast128   = 5
    31  	CryptIdea      = 6
    32  	CryptDummy     = 9
    33  	CryptSkipJack  = 10
    34  	CryptCryptoAPI = 18
    35  	CryptMax       = 20
    36  )
    37  
    38  // Loop device IOCTL commands
    39  const (
    40  	CmdSetFd       = 0x4C00
    41  	CmdClrFd       = 0x4C01
    42  	CmdSetStatus   = 0x4C02
    43  	CmdGetStatus   = 0x4C03
    44  	CmdSetStatus64 = 0x4C04
    45  	CmdGetStatus64 = 0x4C05
    46  	CmdChangeFd    = 0x4C06
    47  	CmdSetCapacity = 0x4C07
    48  	CmdSetDirectIO = 0x4C08
    49  )
    50  
    51  // Info64 contains information about a loop device.
    52  type Info64 struct {
    53  	Device         uint64
    54  	Inode          uint64
    55  	Rdevice        uint64
    56  	Offset         uint64
    57  	SizeLimit      uint64
    58  	Number         uint32
    59  	EncryptType    uint32
    60  	EncryptKeySize uint32
    61  	Flags          uint32
    62  	FileName       [64]byte
    63  	CryptName      [64]byte
    64  	EncryptKey     [32]byte
    65  	Init           [2]uint64
    66  }