Skip to content

Commit

Permalink
C block script implementation
Browse files Browse the repository at this point in the history
This C program should be significantly faster than the shell script
version.  It does no locking and creates no subprocesses.  Furthermore,
the C program uses the Linux diskseq feature to ensure that Linux opens
the correct block device.  This requires kernel support that is not yet
upstreamed.
  • Loading branch information
DemiMarie committed Mar 11, 2023
1 parent 78a0180 commit 55b1ea3
Show file tree
Hide file tree
Showing 6 changed files with 385 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ all:
$(MAKE) -C qrexec-lib all
$(MAKE) -C qmemman all
$(MAKE) -C imgconverter all
$(MAKE) -C not-script all
selinux:
$(MAKE) -f /usr/share/selinux/devel/Makefile -C selinux qubes-meminfo-writer.pp

Expand All @@ -18,6 +19,7 @@ install:
$(MAKE) -C qrexec-lib install
$(MAKE) -C qmemman install
$(MAKE) -C imgconverter install
$(MAKE) -C not-script install

install-selinux:
install -m 0644 -D -t $(DESTDIR)/usr/share/selinux/packages selinux/qubes-meminfo-writer.pp
Expand All @@ -37,6 +39,7 @@ clean:
$(MAKE) -C qrexec-lib clean
$(MAKE) -C qmemman clean
$(MAKE) -C imgconverter clean
$(MAKE) -C not-script clean
rm -rf selinux/*.pp selinux/tmp/
rm -rf debian/changelog.*
rm -rf pkgs
4 changes: 2 additions & 2 deletions archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ md5sums=(SKIP)

build() {

for source in qrexec-lib udev qmemman core kernel-modules Makefile dracut imgconverter grub; do
(ln -s -- "$srcdir/../$source" "$srcdir/$source")
for source in qrexec-lib udev qmemman core kernel-modules Makefile dracut imgconverter grub not-script; do
ln -s -- "$srcdir/../$source" "$srcdir/$source"
done

make all
Expand Down
1 change: 1 addition & 0 deletions debian/qubes-utils.install
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ lib/systemd/system/qubes-meminfo-writer.service
usr/lib/qubes/*
usr/lib/udev/*
usr/lib/tmpfiles.d/xen-devices-qubes.conf
etc/xen/scripts/qubes-block
16 changes: 16 additions & 0 deletions not-script/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CC=gcc
CFLAGS := $(CFLAGS) -g3 -O2 -Wall -Wextra -Werror -fPIE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
.PHONY: clean install all
all: not-script

%: %.c Makefile
s=$$(pkg-config --cflags --libs xenstore) && $(CC) $(CFLAGS) -MD -MP -MF $@.dep -o $@ $< $$s

clean:
rm -f ./*.o ./*~ ./*.a ./*.so.* ./*.dep unicode-class-table.c

install:
install -d $(DESTDIR)/etc/xen/scripts
install not-script $(DESTDIR)/etc/xen/scripts/qubes-block

-include ./*.o.dep
Loading

0 comments on commit 55b1ea3

Please sign in to comment.