From 19943f093c16f1a5076259abb8854cdf67c62420 Mon Sep 17 00:00:00 2001 From: Rafal Wojtczuk Date: Fri, 11 Mar 2011 11:50:52 +0100 Subject: [PATCH] Make dvm_file_editor use ioall.c --- appvm/Makefile | 6 +++--- appvm/dvm_file_editor.c | 37 +------------------------------------ 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/appvm/Makefile b/appvm/Makefile index e247ce9b..be08e07b 100644 --- a/appvm/Makefile +++ b/appvm/Makefile @@ -1,8 +1,8 @@ CC=gcc -CFLAGS=-Wall +CFLAGS=-Wall -I../common all: qubes_penctl qubes_add_pendrive_script qvm-open-in-dvm dvm_file_editor -dvm_file_editor: dvm_file_editor.o - $(CC) -o dvm_file_editor dvm_file_editor.o +dvm_file_editor: dvm_file_editor.o ../common/ioall.o + $(CC) -o dvm_file_editor dvm_file_editor.o ../common/ioall.o qubes_penctl: qubes_penctl.o $(CC) -o qubes_penctl qubes_penctl.o -lxenstore qubes_add_pendrive_script: qubes_add_pendrive_script.o diff --git a/appvm/dvm_file_editor.c b/appvm/dvm_file_editor.c index cadb4509..fd60ca40 100644 --- a/appvm/dvm_file_editor.c +++ b/appvm/dvm_file_editor.c @@ -4,44 +4,9 @@ #include #include #include +#include #include "dvm2.h" -int write_all(int fd, void *buf, int size) -{ - int written = 0; - int ret; - while (written < size) { - ret = write(fd, (char *) buf + written, size - written); - if (ret <= 0) { - perror("write"); - return 0; - } - written += ret; - } -// fprintf(stderr, "sent %d bytes\n", size); - return 1; -} - -int read_all(int fd, void *buf, int size) -{ - int got_read = 0; - int ret; - while (got_read < size) { - ret = read(fd, (char *) buf + got_read, size - got_read); - if (ret == 0) { - fprintf(stderr, "EOF\n"); - return 0; - } - if (ret < 0) { - perror("read"); - return 0; - } - got_read += ret; - } -// fprintf(stderr, "read %d bytes\n", size); - return 1; -} - char *get_filename() { char buf[DVM_FILENAME_SIZE];