Lines Matching refs:paver

37     paver,   // A disk image which should be paved to disk
47 int fd; // Pipe to paver process
51 // Buffer used for stashing data from tftp until it can be written out to the paver
58 } paver;
98 status = zx_vmo_create(size, 0, &file_info->paver.buffer_handle);
103 zx_object_set_property(file_info->paver.buffer_handle, ZX_PROP_NAME, "paver", 5);
106 0, file_info->paver.buffer_handle, 0, size, &buffer);
109 zx_handle_close(file_info->paver.buffer_handle);
112 file_info->paver.buffer = (uint8_t*)buffer;
117 zx_status_t status = zx_vmar_unmap(zx_vmar_root_self(), (uintptr_t)file_info->paver.buffer,
118 file_info->paver.size);
120 printf("netsvc: failed to unmap paver buffer: %s\n", zx_status_get_string(status));
124 status = zx_handle_close(file_info->paver.buffer_handle);
126 printf("netsvc: failed to close paver buffer handle: %s\n", zx_status_get_string(status));
130 file_info->paver.buffer = NULL;
149 // Pushes all data from the paver buffer (filled by netsvc) into the paver input pipe. When
156 while (read_ndx < file_info->paver.size) {
157 sync_completion_reset(&file_info->paver.data_ready);
158 size_t write_ndx = atomic_load(&file_info->paver.offset);
162 if (sync_completion_wait(&file_info->paver.data_ready, ZX_SEC(5 * TFTP_TIMEOUT_SECS))
166 printf("netsvc: timed out while waiting for data in paver-copy thread\n");
171 int r = write(file_info->paver.fd, &file_info->paver.buffer[read_ndx],
174 printf("netsvc: couldn't write to paver fd: %d\n", r);
181 float complete = ((float)read_ndx / (float)file_info->paver.size) * 100.0;
182 printf("netsvc: paver write progress %0.1f%%\n", complete);
188 close(file_info->paver.fd);
190 unsigned int refcount = atomic_fetch_sub(&file_info->paver.buf_refcount, 1);
194 // If all of the data has been written out to the paver process wait for it to complete
197 zx_object_wait_one(file_info->paver.process, ZX_TASK_TERMINATED,
200 zx_handle_close(file_info->paver.process);
251 {.action = FDIO_SPAWN_ACTION_SET_NAME, .name = {.data = "paver"}},
260 &file_info->paver.process, NULL);
263 printf("netsvc: tftp couldn't launch paver\n");
271 printf("netsvc: couldn't create paver log message redirection thread\n");
279 file_info->type = paver;
280 file_info->paver.fd = fds[1];
281 file_info->paver.size = size;
282 // Both the netsvc thread and the paver copy thread access the buffer, and either
284 atomic_store(&file_info->paver.buf_refcount, 2);
285 atomic_store(&file_info->paver.offset, 0);
288 if ((thrd_create(&file_info->paver.buf_copy_thrd, paver_copy_buffer, (void*)file_info))
294 thrd_detach(file_info->paver.buf_copy_thrd);
326 // paver
366 } else if (file_info->type == paver) {
368 printf("netsvc: paver exited prematurely\n");
372 if (((size_t)offset > file_info->paver.size)
373 || (offset + *length) > file_info->paver.size) {
376 memcpy(&file_info->paver.buffer[offset], data, *length);
378 atomic_store(&file_info->paver.offset, new_offset);
379 // Wake the paver thread, if it is waiting for data
380 sync_completion_signal(&file_info->paver.data_ready);
398 } else if (file_info->type == paver) {
399 unsigned int refcount = atomic_fetch_sub(&file_info->paver.buf_refcount, 1);