dragonboards: sync up vendor userspace daemons to upstream sources
Sync up the vendor userspace daemons, used to bring
up the remoteprocs, to their upstream sources.
The following projects are being synced up to the
associated upstream commit IDs.
https://github.com/andersson/pd-mapper
9d78fc0c6143 (pd-mapper: Null terminate firmware_value string")
https://github.com/andersson/qrtr
commit 9dc7a88548c2 ("libqrtr: Zero-initialize sockaddr_qrtr")
Note: Dropped qrtr changes from commit
47e48a8d935b ("Android: Disable "treat warnings as errors".")
https://github.com/andersson/qrtr/commit/47e48a8d935b
https://github.com/andersson/rmtfs
695d0668ffa6 ("storage: fix out of bounds read")
https://github.com/andersson/tqftpserv
783425b550de ("ANDROID: Add Android.bp makefile")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: Ic08ccff151c012f17e2dfe9529a91b2d1931df57
diff --git a/qcom/rmtfs/storage.c b/qcom/rmtfs/storage.c
index c8e69ed..107b296 100644
--- a/qcom/rmtfs/storage.c
+++ b/qcom/rmtfs/storage.c
@@ -41,6 +41,7 @@
{ "/boot/modem_fs2", "modem_fs2", "modemst2" },
{ "/boot/modem_fsc", "modem_fsc", "fsc" },
{ "/boot/modem_fsg", "modem_fsg", "fsg" },
+ { "/boot/modem_tunning", "modem_tunning", "tunning" },
{}
};
@@ -150,8 +151,10 @@
void storage_close(struct rmtfd *rmtfd)
{
- close(rmtfd->fd);
- rmtfd->fd = -1;
+ if (rmtfd->fd >= 0) {
+ close(rmtfd->fd);
+ rmtfd->fd = -1;
+ }
free(rmtfd->shadow_buf);
rmtfd->shadow_buf = NULL;
@@ -188,10 +191,8 @@
{
int i;
- for (i = 0; i < MAX_CALLERS; i++) {
- if (rmtfds[i].fd >= 0)
- close(rmtfds[i].fd);
- }
+ for (i = 0; i < MAX_CALLERS; i++)
+ storage_close(&rmtfds[i]);
}
ssize_t storage_pread(const struct rmtfd *rmtfd, void *buf, size_t nbyte, off_t offset)
@@ -201,7 +202,7 @@
if (!storage_read_only) {
n = pread(rmtfd->fd, buf, nbyte, offset);
} else {
- n = MIN(nbyte, rmtfd->shadow_len - offset);
+ n = MIN((ssize_t)nbyte, (ssize_t)rmtfd->shadow_len - offset);
if (n > 0)
memcpy(buf, (char*)rmtfd->shadow_buf + offset, n);
else
@@ -244,6 +245,14 @@
return nbyte;
}
+int storage_sync(struct rmtfd *rmtfd)
+{
+ if (storage_read_only)
+ return 0;
+
+ return fdatasync(rmtfd->fd);
+}
+
static int storage_populate_shadow_buf(struct rmtfd *rmtfd, const char *file)
{
ssize_t len;