-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathcmd-prospero.c
More file actions
86 lines (72 loc) · 2.67 KB
/
Copy pathcmd-prospero.c
File metadata and controls
86 lines (72 loc) · 2.67 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* Copyright (C) 2025 John Törnblom
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>. */
#include <string.h>
#include <sys/_iovec.h>
#include <sys/mount.h>
#include "cmd.h"
/**
* Convenient macros for nmount.
**/
#define IOVEC_SIZE(x) (sizeof(x) / sizeof(struct iovec))
#define IOVEC_ENTRY(x) {x ? x : 0, x ? strlen(x)+1 : 0}
/**
* Remount read-only mount points with write permissions.
**/
int
ftp_cmd_MTRW(ftp_env_t *env, const char* arg) {
struct iovec iov_preinst[] = {
IOVEC_ENTRY("from"), IOVEC_ENTRY("/dev/ssd0.preinst"),
IOVEC_ENTRY("fspath"), IOVEC_ENTRY("/preinst"),
IOVEC_ENTRY("fstype"), IOVEC_ENTRY("exfatfs"),
IOVEC_ENTRY("large"), IOVEC_ENTRY("yes"),
IOVEC_ENTRY("timezone"), IOVEC_ENTRY("static"),
IOVEC_ENTRY("async"), IOVEC_ENTRY(NULL),
IOVEC_ENTRY("ignoreacl"), IOVEC_ENTRY(NULL),
};
struct iovec iov_sys[] = {
IOVEC_ENTRY("from"), IOVEC_ENTRY("/dev/ssd0.system"),
IOVEC_ENTRY("fspath"), IOVEC_ENTRY("/system"),
IOVEC_ENTRY("fstype"), IOVEC_ENTRY("exfatfs"),
IOVEC_ENTRY("large"), IOVEC_ENTRY("yes"),
IOVEC_ENTRY("timezone"), IOVEC_ENTRY("static"),
IOVEC_ENTRY("async"), IOVEC_ENTRY(NULL),
IOVEC_ENTRY("ignoreacl"), IOVEC_ENTRY(NULL),
};
struct iovec iov_sysex[] = {
IOVEC_ENTRY("from"), IOVEC_ENTRY("/dev/ssd0.system_ex"),
IOVEC_ENTRY("fspath"), IOVEC_ENTRY("/system_ex"),
IOVEC_ENTRY("fstype"), IOVEC_ENTRY("exfatfs"),
IOVEC_ENTRY("large"), IOVEC_ENTRY("yes"),
IOVEC_ENTRY("timezone"), IOVEC_ENTRY("static"),
IOVEC_ENTRY("async"), IOVEC_ENTRY(NULL),
IOVEC_ENTRY("ignoreacl"), IOVEC_ENTRY(NULL),
};
if(nmount(iov_preinst, IOVEC_SIZE(iov_preinst), MNT_UPDATE)) {
return ftp_perror(env);
}
if(nmount(iov_sys, IOVEC_SIZE(iov_sys), MNT_UPDATE)) {
return ftp_perror(env);
}
if(nmount(iov_sysex, IOVEC_SIZE(iov_sysex), MNT_UPDATE)) {
return ftp_perror(env);
}
return ftp_active_printf(env,
"200- /preinst remounted\r\n"
"200- /system remounted\r\n"
"200 /system_ex remounted\r\n");
}
/*
Local Variables:
c-file-style: "gnu"
End:
*/