Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7cb4c332 authored by bigbiff's avatar bigbiff Committed by Dees Troy
Browse files

add function to partition.cpp to return max file size to mtp responder

Change-Id: If8114b5eac741db6c512fb35cb48e3825c2ff098
parent 253368a0
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1078,9 +1078,11 @@ MtpResponseCode MtpServer::doSendObject() {
		unlink(mSendObjectFilePath);
		if (errno == ECANCELED)
			result = MTP_RESPONSE_TRANSACTION_CANCELLED;
		else
		else {
		    	MTPD("errno: %d\n", errno);
			result = MTP_RESPONSE_GENERAL_ERROR;
		}
	}

done:
	// reset so we don't attempt to send the data back
@@ -1093,7 +1095,7 @@ done:
	mSendObjectHandle = kInvalidObjectHandle;
	MTPD("result: %d\n", result);
	mSendObjectFormat = 0;
	return MTP_RESPONSE_OK;
	return result;
}

static void deleteRecursive(const char* path) {
+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ void twmtp_MtpServer::add_storage()
				int storageID = stores->at(i)->mtpid;
				long reserveSpace = 1;
				bool removable = false;
				long maxFileSize = 1000000000L;
				long maxFileSize = stores->at(i)->maxFileSize;
				if (descriptionStr != "") {
					MtpStorage* storage = new MtpStorage(storageID, &pathStr[0], &descriptionStr[0], reserveSpace, removable, maxFileSize, refserver);
					server->addStorage(storage);
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ typedef struct Storage {
	std::string display;
	std::string mount;
	int mtpid;
	uint64_t maxFileSize;
} storage;

typedef std::vector<storage*> storages;
+2 −1
Original line number Diff line number Diff line
@@ -107,11 +107,12 @@ pid_t twrpMtp::forkserver(void) {
	return 0;
}

void twrpMtp::addStorage(std::string display, std::string path, int mtpid) {
void twrpMtp::addStorage(std::string display, std::string path, int mtpid, uint64_t maxFileSize) {
	s = new storage;
	s->display = display;
	s->mount = path;
	s->mtpid = mtpid;
	s->maxFileSize = maxFileSize;
	MTPD("twrpMtp mtpid: %d\n", s->mtpid);
	mtpstorages->push_back(s);
}
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class twrpMtp {
		twrpMtp(int debug_enabled /* = 0 */);
		pthread_t threadserver(void);
		pid_t forkserver(void);
		void addStorage(std::string display, std::string path, int mtpid);
		void addStorage(std::string display, std::string path, int mtpid, uint64_t maxFileSize);
	private:
		int start(void);
		typedef int (twrpMtp::*ThreadPtr)(void);
Loading