github.com/Microsoft/azure-vhd-utils@v0.0.0-20230613175315-7c30a3748a1b/vhdcore/header/parentlocator/platformCode.go (about)

     1  package parentlocator
     2  
     3  import "fmt"
     4  
     5  // The PlatformCode describes which platform-specific format is used for the file locator
     6  // This is the type of PlatformCode field in ParentLocator type.
     7  //
     8  type PlatformCode int32
     9  
    10  const (
    11  	// PlatformCodeNone indicates a nil value for platform code.
    12  	//
    13  	PlatformCodeNone PlatformCode = 0x0
    14  	// PlatformCodeWi2R [deprecated]
    15  	//
    16  	PlatformCodeWi2R = 0x57693272
    17  	// PlatformCodeWi2K [deprecated]
    18  	//
    19  	PlatformCodeWi2K = 0x5769326B
    20  	// PlatformCodeW2Ru indicate that the file locator is stored in unicode (UTF-16) format on Windows
    21  	// relative to the differencing disk pathname.
    22  	//
    23  	PlatformCodeW2Ru = 0x57327275
    24  	// PlatformCodeW2Ku indicate that the file locator is stored in unicode (UTF-16) format as absolute
    25  	// pathname on Windows.
    26  	//
    27  	PlatformCodeW2Ku = 0x57326B75
    28  	// PlatformCodeMac indicates that file locator is a Mac OS alias stored as a blob.
    29  	//
    30  	PlatformCodeMac = 0x4D616320
    31  	// PlatformCodeMacX indicates that file locator is a file URL with UTF-8 encoding conforming to RFC 2396.
    32  	//
    33  	PlatformCodeMacX = 0x4D616358
    34  )
    35  
    36  // String returns the string representation of the PlatformCode. If the int platform code
    37  // value does not match with the predefined PlatformCodes then this function convert the
    38  // int to string and return
    39  //
    40  func (p PlatformCode) String() string {
    41  	switch p {
    42  	case PlatformCodeNone:
    43  		return "None"
    44  	case PlatformCodeWi2R:
    45  		return "Wi2R [deprecated]"
    46  	case PlatformCodeWi2K:
    47  		return "Wi2K [deprecated]"
    48  	case PlatformCodeW2Ru:
    49  		return "W2Ru"
    50  	case PlatformCodeW2Ku:
    51  		return "W2Ku"
    52  	case PlatformCodeMac:
    53  		return "Mac"
    54  	case PlatformCodeMacX:
    55  		return "MacX"
    56  	}
    57  
    58  	return fmt.Sprintf("%d", p)
    59  }