From 70bbdfe760310e4a7eb8db436ee83c715053d4e4 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sat, 7 Nov 2020 17:52:10 +0100 Subject: [PATCH] zfs: ResumeToken: parse embedok, largeblockok, savedok if available Developed for #285 but ultimately not used for it. --- zfs/resume_token.go | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/zfs/resume_token.go b/zfs/resume_token.go index 5eb60cf..cf33c98 100644 --- a/zfs/resume_token.go +++ b/zfs/resume_token.go @@ -18,11 +18,14 @@ import ( // NOTE: Update ZFSSendARgs.Validate when changing fields (potentially SECURITY SENSITIVE) type ResumeToken struct { - HasFromGUID, HasToGUID bool - FromGUID, ToGUID uint64 - ToName string - HasCompressOK, CompressOK bool - HasRawOk, RawOK bool + HasFromGUID, HasToGUID bool + FromGUID, ToGUID uint64 + ToName string + HasCompressOK, CompressOK bool + HasRawOk, RawOK bool + HasLargeBlockOK, LargeBlockOK bool + HasEmbedOk, EmbedOK bool + HasSavedOk, SavedOk bool } var resumeTokenNVListRE = regexp.MustCompile(`\t(\S+) = (.*)`) @@ -240,6 +243,24 @@ func ParseResumeToken(ctx context.Context, token string) (*ResumeToken, error) { if err != nil { return nil, ResumeTokenParsingError } + case "embedok": + rt.HasEmbedOk = true + rt.EmbedOK, err = strconv.ParseBool(val) + if err != nil { + return nil, ResumeTokenParsingError + } + case "largeblockok": + rt.HasLargeBlockOK = true + rt.LargeBlockOK, err = strconv.ParseBool(val) + if err != nil { + return nil, ResumeTokenParsingError + } + case "savedok": + rt.HasSavedOk = true + rt.SavedOk, err = strconv.ParseBool(val) + if err != nil { + return nil, ResumeTokenParsingError + } } }