Make dvm_file_editor use ioall.c
This commit is contained in:
parent
e19390ca1c
commit
19943f093c
@ -1,8 +1,8 @@
|
|||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=-Wall
|
CFLAGS=-Wall -I../common
|
||||||
all: qubes_penctl qubes_add_pendrive_script qvm-open-in-dvm dvm_file_editor
|
all: qubes_penctl qubes_add_pendrive_script qvm-open-in-dvm dvm_file_editor
|
||||||
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
|
$(CC) -o dvm_file_editor dvm_file_editor.o ../common/ioall.o
|
||||||
qubes_penctl: qubes_penctl.o
|
qubes_penctl: qubes_penctl.o
|
||||||
$(CC) -o qubes_penctl qubes_penctl.o -lxenstore
|
$(CC) -o qubes_penctl qubes_penctl.o -lxenstore
|
||||||
qubes_add_pendrive_script: qubes_add_pendrive_script.o
|
qubes_add_pendrive_script: qubes_add_pendrive_script.o
|
||||||
|
@ -4,44 +4,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <ioall.h>
|
||||||
#include "dvm2.h"
|
#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 *get_filename()
|
||||||
{
|
{
|
||||||
char buf[DVM_FILENAME_SIZE];
|
char buf[DVM_FILENAME_SIZE];
|
||||||
|
Loading…
Reference in New Issue
Block a user