diff options
Diffstat (limited to 'common/constants.h')
-rw-r--r-- | common/constants.h | 75 |
1 files changed, 53 insertions, 22 deletions
diff --git a/common/constants.h b/common/constants.h index af1c0ab6..68f720db 100644 --- a/common/constants.h +++ b/common/constants.h @@ -17,8 +17,16 @@ #ifndef UPDATE_ENGINE_COMMON_CONSTANTS_H_ #define UPDATE_ENGINE_COMMON_CONSTANTS_H_ +#include <cstdint> + namespace chromeos_update_engine { +// The root path of all exclusion prefs. +extern const char kExclusionPrefsSubDir[]; + +// The root path of all DLC metadata. +extern const char kDlcPrefsSubDir[]; + // Directory for AU prefs that are preserved across powerwash. extern const char kPowerwashSafePrefsSubDirectory[]; @@ -56,13 +64,19 @@ extern const char kPrefsNumResponsesSeen[]; extern const char kPrefsOmahaCohort[]; extern const char kPrefsOmahaCohortHint[]; extern const char kPrefsOmahaCohortName[]; -extern const char kPrefsOmahaEolStatus[]; +extern const char kPrefsOmahaEolDate[]; extern const char kPrefsP2PEnabled[]; extern const char kPrefsP2PFirstAttemptTimestamp[]; extern const char kPrefsP2PNumAttempts[]; extern const char kPrefsPayloadAttemptNumber[]; +extern const char kPrefsTestUpdateCheckIntervalTimeout[]; +extern const char kPrefsPingActive[]; +extern const char kPrefsPingLastActive[]; +extern const char kPrefsPingLastRollcall[]; +extern const char kPrefsLastFp[]; extern const char kPrefsPostInstallSucceeded[]; extern const char kPrefsPreviousVersion[]; +extern const char kPrefsPreviousSlot[]; extern const char kPrefsResumedUpdateFailures[]; extern const char kPrefsRollbackHappened[]; extern const char kPrefsRollbackVersion[]; @@ -95,6 +109,7 @@ extern const char kPrefsUrlSwitchCount[]; extern const char kPrefsVerityWritten[]; extern const char kPrefsWallClockScatteringWaitPeriod[]; extern const char kPrefsWallClockStagingWaitPeriod[]; +extern const char kPrefsManifestBytes[]; // Keys used when storing and loading payload properties. extern const char kPayloadPropertyFileSize[]; @@ -108,6 +123,14 @@ extern const char kPayloadPropertyNetworkId[]; extern const char kPayloadPropertySwitchSlotOnReboot[]; extern const char kPayloadPropertyRunPostInstall[]; +extern const char kOmahaUpdaterVersion[]; + +// X-Goog-Update headers. +extern const char kXGoogleUpdateInteractivity[]; +extern const char kXGoogleUpdateAppId[]; +extern const char kXGoogleUpdateUpdater[]; +extern const char kXGoogleUpdateSessionId[]; + // A download source is any combination of protocol and server (that's of // interest to us when looking at UMA metrics) using which we may download // the payload. @@ -134,30 +157,30 @@ typedef enum { } PayloadType; // Maximum number of times we'll allow using p2p for the same update payload. -const int kMaxP2PAttempts = 10; +constexpr int kMaxP2PAttempts = 10; // Maximum wallclock time we allow attempting to update using p2p for // the same update payload - five days. -const int kMaxP2PAttemptTimeSeconds = 5 * 24 * 60 * 60; +constexpr int kMaxP2PAttemptTimeSeconds = 5 * 24 * 60 * 60; // The maximum amount of time to spend waiting for p2p-client(1) to // return while waiting in line to use the LAN - six hours. -const int kMaxP2PNetworkWaitTimeSeconds = 6 * 60 * 60; +constexpr int kMaxP2PNetworkWaitTimeSeconds = 6 * 60 * 60; // The maximum number of payload files to keep in /var/cache/p2p. -const int kMaxP2PFilesToKeep = 3; +constexpr int kMaxP2PFilesToKeep = 3; // The maximum number of days to keep a p2p file; -const int kMaxP2PFileAgeDays = 5; +constexpr int kMaxP2PFileAgeDays = 5; // The default number of UMA buckets for metrics. -const int kNumDefaultUmaBuckets = 50; +constexpr int kNumDefaultUmaBuckets = 50; -// General constants -const int kNumBytesInOneMiB = 1024 * 1024; +// General constexprants +constexpr int kNumBytesInOneMiB = 1024 * 1024; // Number of redirects allowed when downloading. -const int kDownloadMaxRedirects = 10; +constexpr int kDownloadMaxRedirects = 10; // The minimum average speed that downloads must sustain... // @@ -165,8 +188,8 @@ const int kDownloadMaxRedirects = 10; // connectivity and we want to make as much forward progress as // possible. For p2p this is high (25 kB/second) since we can assume // high bandwidth (same LAN) and we want to fail fast. -const int kDownloadLowSpeedLimitBps = 1; -const int kDownloadP2PLowSpeedLimitBps = 25 * 1000; +constexpr int kDownloadLowSpeedLimitBps = 1; +constexpr int kDownloadP2PLowSpeedLimitBps = 25 * 1000; // ... measured over this period. // @@ -175,18 +198,18 @@ const int kDownloadP2PLowSpeedLimitBps = 25 * 1000; // for the workstation to generate the payload. For normal operation // and p2p, make this relatively low since we want to fail fast in // those cases. -const int kDownloadLowSpeedTimeSeconds = 30; -const int kDownloadDevModeLowSpeedTimeSeconds = 180; -const int kDownloadP2PLowSpeedTimeSeconds = 60; +constexpr int kDownloadLowSpeedTimeSeconds = 30; +constexpr int kDownloadDevModeLowSpeedTimeSeconds = 180; +constexpr int kDownloadP2PLowSpeedTimeSeconds = 60; // The maximum amount of HTTP server reconnect attempts. // // This is set high in order to maximize the attempt's chance of // succeeding. When using p2p, this is low in order to fail fast. -const int kDownloadMaxRetryCount = 20; -const int kDownloadMaxRetryCountOobeNotComplete = 3; -const int kDownloadMaxRetryCountInteractive = 3; -const int kDownloadP2PMaxRetryCount = 5; +constexpr int kDownloadMaxRetryCount = 20; +constexpr int kDownloadMaxRetryCountOobeNotComplete = 3; +constexpr int kDownloadMaxRetryCountInteractive = 3; +constexpr int kDownloadP2PMaxRetryCount = 5; // The connect timeout, in seconds. // @@ -194,11 +217,19 @@ const int kDownloadP2PMaxRetryCount = 5; // connectivity and we may be using HTTPS which involves complicated // multi-roundtrip setup. For p2p, this is set low because we can // the server is on the same LAN and we want to fail fast. -const int kDownloadConnectTimeoutSeconds = 30; -const int kDownloadP2PConnectTimeoutSeconds = 5; +constexpr int kDownloadConnectTimeoutSeconds = 30; +constexpr int kDownloadP2PConnectTimeoutSeconds = 5; // Size in bytes of SHA256 hash. -const int kSHA256Size = 32; +constexpr int kSHA256Size = 32; + +// A hardcoded label to mark end of all InstallOps +// This number must be greater than number of install ops. +// Number of install ops is bounded by number of blocks on any partition. +// Currently, the block size is 4096. Using |kEndOfInstallLabel| of 2^48 will +// allow partitions with 2^48 * 4096 = 2^60 bytes. That's 1024PB? Partitions on +// android aren't getting that big any time soon. +constexpr uint64_t kEndOfInstallLabel = (1ULL << 48); } // namespace chromeos_update_engine |