1
2
3
4
5
6
7
8
9
10
|
1
2
3
4
5
6
7
8
9
10
11
|
+
|
#define FUSE_USE_VERSION 26
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <fuse.h>
#include <tcl.h>
#define APPFS_DEBUG(x...) { fprintf(stderr, "%i:%s: ", __LINE__, __func__); fprintf(stderr, x); fprintf(stderr, "\n"); }
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
|
return("arm");
case APPFS_CPU_UNKNOWN:
return("unknown");
}
return("unknown");
}
static struct appfs_package *appfs_getindex(const char *hostname, int *package_count_p) {
Tcl_Obj *objv[2];
Tcl_Obj *packages_tcl;
static int appfs_Tcl_Eval(Tcl_Interp *interp, int objc, const char *cmd, ...) {
Tcl_Obj **objv;
const char *arg;
va_list argp;
int retval;
int i;
objv = ckalloc(sizeof(*objv) * objc);
objv[0] = Tcl_NewStringObj(cmd, -1);
va_start(argp, cmd);
for (i = 1; i < objc; i++) {
arg = va_arg(argp, const char *);
objv[i] = Tcl_NewStringObj(arg, -1);
}
va_end(argp);
retval = Tcl_EvalObjv(interp, objc, objv, 0);
ckfree(objv);
return(retval);
}
static struct appfs_package *appfs_getindex(const char *hostname, int *package_count_p) {
int tcl_ret;
if (package_count_p == NULL) {
return(NULL);
}
objv[0] = Tcl_NewStringObj("::appfs::getindex", -1);
tcl_ret = appfs_Tcl_Eval(interp, 2, "::appfs::getindex", hostname);
objv[1] = Tcl_NewStringObj(hostname, -1);
tcl_ret = Tcl_EvalObjv(interp, 2, objv, 0);
if (tcl_ret != TCL_OK) {
APPFS_DEBUG("Call to ::appfs::getindex failed: %s", Tcl_GetStringResult(interp));
return(NULL);
}
packages_tcl = Tcl_GetObjResult(interp);
return(NULL);
}
static int appfs_getfile(const char *hostname, const char *sha1) {
}
static int appfs_getmanifest(const char *hostname, const char *sha1) {
|
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
-
+
+
+
+
+
+
+
+
+
|
return(1);
}
tcl_ret = Tcl_Eval(interp, ""
#include "appfs.tcl.h"
"");
if (tcl_ret != TCL_OK) {
fprintf(stderr, "Unable to initialize Tcl AppFS Script. Aborting.\n");
fprintf(stderr, "Unable to initialize Tcl AppFS script. Aborting.\n");
return(1);
}
tcl_ret = appfs_Tcl_Eval(interp, 1, "::appfs::init");
if (tcl_ret != TCL_OK) {
fprintf(stderr, "Unable to initialize Tcl AppFS script (::appfs::init). Aborting.\n");
fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp));
return(1);
}
#ifdef APPFS_TEST_DRIVER
return(appfs_test_driver());
#else
return(fuse_main(argc, argv, &appfs_oper, NULL));
#endif
}
|