mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 13:02:38 +02:00
fs: Add support for setting priority through IPC context [5.0.0+]
This commit is contained in:
parent
8a0aef8824
commit
62d795a3c6
@ -262,11 +262,20 @@ typedef enum {
|
|||||||
FsBisStorageId_SystemProperPartition = 33,
|
FsBisStorageId_SystemProperPartition = 33,
|
||||||
} FsBisStorageId;
|
} FsBisStorageId;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FsPriority_Normal = 0,
|
||||||
|
FsPriority_Realtime = 1,
|
||||||
|
FsPriority_Low = 2,
|
||||||
|
FsPriority_Background = 3,
|
||||||
|
} FsPriority;
|
||||||
|
|
||||||
Result fsInitialize(void);
|
Result fsInitialize(void);
|
||||||
void fsExit(void);
|
void fsExit(void);
|
||||||
|
|
||||||
Service* fsGetServiceSession(void);
|
Service* fsGetServiceSession(void);
|
||||||
|
|
||||||
|
void fsSetPriority(FsPriority prio);
|
||||||
|
|
||||||
Result fsOpenBisStorage(FsStorage* out, FsBisStorageId partitionId);
|
Result fsOpenBisStorage(FsStorage* out, FsBisStorageId partitionId);
|
||||||
Result fsOpenBisFileSystem(FsFileSystem* out, FsBisStorageId partitionId, const char* string);
|
Result fsOpenBisFileSystem(FsFileSystem* out, FsBisStorageId partitionId, const char* string);
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ static Mutex g_fsSessionMutex;
|
|||||||
static CondVar g_fsSessionCondVar;
|
static CondVar g_fsSessionCondVar;
|
||||||
static bool g_fsSessionWaiting;
|
static bool g_fsSessionWaiting;
|
||||||
|
|
||||||
|
static __thread u32 g_fsPriority = FsPriority_Normal;
|
||||||
|
|
||||||
static int _fsGetSessionSlot(void)
|
static int _fsGetSessionSlot(void)
|
||||||
{
|
{
|
||||||
mutexLock(&g_fsSessionMutex);
|
mutexLock(&g_fsSessionMutex);
|
||||||
@ -78,6 +80,7 @@ NX_INLINE Result _fsObjectDispatchImpl(
|
|||||||
serviceAssumeDomain(s);
|
serviceAssumeDomain(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disp.context = g_fsPriority;
|
||||||
Result rc = serviceDispatchImpl(s, request_id, in_data, in_data_size, out_data, out_data_size, disp);
|
Result rc = serviceDispatchImpl(s, request_id, in_data, in_data_size, out_data, out_data_size, disp);
|
||||||
|
|
||||||
if (slot >= 0) {
|
if (slot >= 0) {
|
||||||
@ -150,6 +153,12 @@ Service* fsGetServiceSession(void) {
|
|||||||
return &g_fsSrv;
|
return &g_fsSrv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fsSetPriority(FsPriority prio)
|
||||||
|
{
|
||||||
|
if (hosversionAtLeast(5,0,0))
|
||||||
|
g_fsPriority = prio;
|
||||||
|
}
|
||||||
|
|
||||||
Result fsOpenBisStorage(FsStorage* out, FsBisStorageId partitionId) {
|
Result fsOpenBisStorage(FsStorage* out, FsBisStorageId partitionId) {
|
||||||
IpcCommand c;
|
IpcCommand c;
|
||||||
ipcInitialize(&c);
|
ipcInitialize(&c);
|
||||||
|
Loading…
Reference in New Issue
Block a user