nx_storage_sdk  1.0
Storage SDK
fs_stub.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2 
3 #pragma once
4 
5 #include <common.h>
6 #include <stddef.h>
7 #include <stdint.h>
8 
9 enum FsStubEntryType
10 {
11  dir = 1,
12  file = 2
13 };
14 
15 struct FsStubNode
16 {
17  char *name;
18  int mask;
19  enum FsStubEntryType type;
20  int64_t size;
21  struct FsStubNode *next;
22  struct FsStubNode *prev;
23  struct FsStubNode *parent;
24  struct FsStubNode *child;
25 };
26 
27 struct FsStubNode *fsStubCreateTopLevel();
28 struct FsStubNode *FsStubNode_add(
29  struct FsStubNode *parent,
30  const char *path,
31  int type,
32  int mask,
33  int64_t size);
34 
35 void FsStubNode_forEach(
36  struct FsStubNode *root,
37  void *ctx,
38  void (*action)(void *ctx, struct FsStubNode *node));
39 
40 /* places full path for the node into the buf if buf size is enough, returns buffer size needed */
41 int FsStubNode_fullPath(struct FsStubNode *fsNode, char *buf, int size);
42 
43 NX_PLUGIN_API struct FsStubNode *FsStubNode_find(struct FsStubNode *topLevelNode, const char *path);
44 int FsStubNode_rename(struct FsStubNode *fsNode, const char *newName);
45 void FsStubNode_remove(struct FsStubNode *fsNode);
46 
Definition: fs_stub.h:15