88 "strconv"
99 "syscall"
1010
11- "github.com/checkpoint-restore/go-criu/v6/crit/images "
11+ "github.com/checkpoint-restore/go-criu/v6/rpc "
1212 "google.golang.org/protobuf/proto"
1313)
1414
@@ -86,7 +86,7 @@ func (c *Criu) sendAndRecv(reqB []byte) ([]byte, int, error) {
8686 return respB , n , nil
8787}
8888
89- func (c * Criu ) doSwrk (reqType images .CriuReqType , opts * images .CriuOpts , nfy Notify ) error {
89+ func (c * Criu ) doSwrk (reqType rpc .CriuReqType , opts * rpc .CriuOpts , nfy Notify ) error {
9090 resp , err := c .doSwrkWithResp (reqType , opts , nfy , nil )
9191 if err != nil {
9292 return err
@@ -99,10 +99,10 @@ func (c *Criu) doSwrk(reqType images.CriuReqType, opts *images.CriuOpts, nfy Not
9999 return nil
100100}
101101
102- func (c * Criu ) doSwrkWithResp (reqType images .CriuReqType , opts * images .CriuOpts , nfy Notify , features * images .CriuFeatures ) (* images .CriuResp , error ) {
103- var resp * images .CriuResp
102+ func (c * Criu ) doSwrkWithResp (reqType rpc .CriuReqType , opts * rpc .CriuOpts , nfy Notify , features * rpc .CriuFeatures ) (* rpc .CriuResp , error ) {
103+ var resp * rpc .CriuResp
104104
105- req := images .CriuReq {
105+ req := rpc .CriuReq {
106106 Type : & reqType ,
107107 Opts : opts ,
108108 }
@@ -135,7 +135,7 @@ func (c *Criu) doSwrkWithResp(reqType images.CriuReqType, opts *images.CriuOpts,
135135 return nil , err
136136 }
137137
138- resp = & images .CriuResp {}
138+ resp = & rpc .CriuResp {}
139139 err = proto .Unmarshal (respB [:respS ], resp )
140140 if err != nil {
141141 return nil , err
@@ -147,7 +147,7 @@ func (c *Criu) doSwrkWithResp(reqType images.CriuReqType, opts *images.CriuOpts,
147147 }
148148
149149 respType := resp .GetType ()
150- if respType != images .CriuReqType_NOTIFY {
150+ if respType != rpc .CriuReqType_NOTIFY {
151151 break
152152 }
153153 if nfy == nil {
@@ -182,7 +182,7 @@ func (c *Criu) doSwrkWithResp(reqType images.CriuReqType, opts *images.CriuOpts,
182182 return resp , err
183183 }
184184
185- req = images .CriuReq {
185+ req = rpc .CriuReq {
186186 Type : & respType ,
187187 NotifySuccess : proto .Bool (true ),
188188 }
@@ -192,28 +192,28 @@ func (c *Criu) doSwrkWithResp(reqType images.CriuReqType, opts *images.CriuOpts,
192192}
193193
194194// Dump dumps a process
195- func (c * Criu ) Dump (opts * images .CriuOpts , nfy Notify ) error {
196- return c .doSwrk (images .CriuReqType_DUMP , opts , nfy )
195+ func (c * Criu ) Dump (opts * rpc .CriuOpts , nfy Notify ) error {
196+ return c .doSwrk (rpc .CriuReqType_DUMP , opts , nfy )
197197}
198198
199199// Restore restores a process
200- func (c * Criu ) Restore (opts * images .CriuOpts , nfy Notify ) error {
201- return c .doSwrk (images .CriuReqType_RESTORE , opts , nfy )
200+ func (c * Criu ) Restore (opts * rpc .CriuOpts , nfy Notify ) error {
201+ return c .doSwrk (rpc .CriuReqType_RESTORE , opts , nfy )
202202}
203203
204204// PreDump does a pre-dump
205- func (c * Criu ) PreDump (opts * images .CriuOpts , nfy Notify ) error {
206- return c .doSwrk (images .CriuReqType_PRE_DUMP , opts , nfy )
205+ func (c * Criu ) PreDump (opts * rpc .CriuOpts , nfy Notify ) error {
206+ return c .doSwrk (rpc .CriuReqType_PRE_DUMP , opts , nfy )
207207}
208208
209209// StartPageServer starts the page server
210- func (c * Criu ) StartPageServer (opts * images .CriuOpts ) error {
211- return c .doSwrk (images .CriuReqType_PAGE_SERVER , opts , nil )
210+ func (c * Criu ) StartPageServer (opts * rpc .CriuOpts ) error {
211+ return c .doSwrk (rpc .CriuReqType_PAGE_SERVER , opts , nil )
212212}
213213
214214// StartPageServerChld starts the page server and returns PID and port
215- func (c * Criu ) StartPageServerChld (opts * images .CriuOpts ) (int , int , error ) {
216- resp , err := c .doSwrkWithResp (images .CriuReqType_PAGE_SERVER_CHLD , opts , nil , nil )
215+ func (c * Criu ) StartPageServerChld (opts * rpc .CriuOpts ) (int , int , error ) {
216+ resp , err := c .doSwrkWithResp (rpc .CriuReqType_PAGE_SERVER_CHLD , opts , nil , nil )
217217 if err != nil {
218218 return 0 , 0 , err
219219 }
@@ -224,12 +224,12 @@ func (c *Criu) StartPageServerChld(opts *images.CriuOpts) (int, int, error) {
224224// GetCriuVersion executes the VERSION RPC call and returns the version
225225// as an integer. Major * 10000 + Minor * 100 + SubLevel
226226func (c * Criu ) GetCriuVersion () (int , error ) {
227- resp , err := c .doSwrkWithResp (images .CriuReqType_VERSION , nil , nil , nil )
227+ resp , err := c .doSwrkWithResp (rpc .CriuReqType_VERSION , nil , nil , nil )
228228 if err != nil {
229229 return 0 , err
230230 }
231231
232- if resp .GetType () != images .CriuReqType_VERSION {
232+ if resp .GetType () != rpc .CriuReqType_VERSION {
233233 return 0 , fmt .Errorf ("Unexpected CRIU RPC response" )
234234 }
235235
0 commit comments