-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample2-fspick.c
More file actions
34 lines (27 loc) · 951 Bytes
/
Copy pathexample2-fspick.c
File metadata and controls
34 lines (27 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "common.h"
int main(void) {
char mountpoint[255] = "tmpfs/";
addcurpath(mountpoint);
printpid();
wait("* Step 1: Will fspick() the path on %s", mountpoint);
int fscontext_fd = fspick(0, mountpoint, 0);
if (fscontext_fd < 0) {
perror("fspick failed");
return 1;
}
printf("The file descriptor for the handle is fd %d\n", fscontext_fd);
wait("* Step 2: Configuring the size to 200M...");
if (fsconfig(fscontext_fd, FSCONFIG_SET_STRING, "size", "200M", 0) < 0) {
perror("fsconfig size");
return 1;
}
printf("Finished configuration\n");
wait("* Step 3: Validate and apply the configuration.");
if (fsconfig(fscontext_fd, FSCONFIG_CMD_RECONFIGURE, NULL, NULL, 0) < 0) {
perror("fsconfig create");
return 1;
}
printf("Configuration is valid and was applied. run `df -h` to see the new size\n");
close(fscontext_fd);
return 0;
}