Skip to content

Commit f245708

Browse files
authored
Merge pull request #19 from martinezjavier/add-rmtfs-dir-service
Add systemd service to load EFS data from a directory
2 parents 33e1e40 + 0caf528 commit f245708

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ prefix = /usr/local
66
bindir := $(prefix)/bin
77
servicedir := $(prefix)/lib/systemd/system
88

9+
RMTFS_EFS_PATH ?= /var/lib/rmtfs
10+
911
SRCS := qmi_rmtfs.c rmtfs.c rproc.c sharedmem.c storage.c util.c
1012
OBJS := $(SRCS:.c=.o)
1113

@@ -15,13 +17,15 @@ $(OUT): $(OBJS)
1517
%.c: %.qmi
1618
qmic -k < $<
1719

18-
rmtfs.service: rmtfs.service.in
19-
@sed 's+RMTFS_PATH+$(bindir)+g' $< > $@
20+
%.service: %.service.in
21+
@sed -e 's+RMTFS_PATH+$(bindir)+g' -e 's+RMTFS_EFS_PATH+$(RMTFS_EFS_PATH)+g' $< > $@
2022

21-
install: $(OUT) rmtfs.service
23+
install: $(OUT) rmtfs.service rmtfs-dir.service
2224
@install -D -m 755 $(OUT) $(DESTDIR)$(prefix)/bin/$(OUT)
2325
@install -D -m 644 rmtfs.service $(DESTDIR)$(servicedir)/rmtfs.service
26+
@install -D -m 644 rmtfs-dir.service $(DESTDIR)$(servicedir)/rmtfs-dir.service
2427

2528
clean:
2629
rm -f $(OUT) $(OBJS) rmtfs.service
30+
rm -f $(OUT) $(OBJS) rmtfs-dir.service
2731

rmtfs-dir.service.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Qualcomm remotefs service
3+
Requires=qrtr-ns.service
4+
After=qrtr-ns.service
5+
6+
[Service]
7+
ExecStart=RMTFS_PATH/rmtfs -s -o RMTFS_EFS_PATH
8+
Restart=always
9+
RestartSec=1
10+
11+
[Install]
12+
WantedBy=multi-user.target

rmtfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ static void rmtfs_iovec(int sock, struct qrtr_packet *pkt)
151151
struct rmtfs_iovec_resp resp = {};
152152
struct rmtfs_iovec_req req = {};
153153
DEFINE_QRTR_PACKET(resp_buf, 256);
154-
struct rmtfd *rmtfd;
154+
struct rmtfd *rmtfd = NULL;
155155
uint32_t caller_id = 0;
156156
size_t num_entries = 0;
157157
off_t sector_base;
158-
uint8_t is_write;
158+
uint8_t is_write = 0;
159159
off_t phys_base;
160160
uint8_t force = 0;
161161
unsigned txn;

0 commit comments

Comments
 (0)