Overview
Comment: | Updated to include a Tcl interface via AppFSd |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tcl-ops |
Files: | files | file ages | folders |
SHA1: |
4b04c967f7016def226576a72537cd51 |
User & Date: | rkeene on 2014-11-07 05:06:43 |
Other Links: | branch diff | manifest | tags |
Context
2014-11-07
| ||
05:42 | Added more functionality to "appfs-cache" control system check-in: 82982300d8 user: rkeene tags: tcl-ops | |
05:06 | Updated to include a Tcl interface via AppFSd check-in: 4b04c967f7 user: rkeene tags: tcl-ops | |
04:52 | Added support for an "appfs-cache" script calling sqlite3 directly in appfsd check-in: c374111c37 user: rkeene tags: tcl-ops | |
Changes
Modified appfsd.c from [206ee97d58] to [e20407f29f].
︙ | ︙ | |||
143 144 145 146 147 148 149 | fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp)); Tcl_DeleteInterp(interp); return(NULL); } | | | | > > | > > | > > > > > > > > > > | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp)); Tcl_DeleteInterp(interp); return(NULL); } Tcl_HideCommand(interp, "auto_load_index", "auto_load_index"); Tcl_HideCommand(interp, "unknown", "unknown"); return(interp); } static Tcl_Interp *appfs_TclInterp(void) { Tcl_Interp *interp; interp = pthread_getspecific(interpKey); if (interp == NULL) { interp = appfs_create_TclInterp(); if (interp == NULL) { return(NULL); } pthread_setspecific(interpKey, interp); } return(interp); } static int appfs_Tcl_Eval(Tcl_Interp *interp, int objc, const char *cmd, ...) { Tcl_Obj **objv; const char *arg; |
︙ | ︙ | |||
196 197 198 199 200 201 202 | static void appfs_update_index(const char *hostname) { Tcl_Interp *interp; int tcl_ret; APPFS_DEBUG("Enter: hostname = %s", hostname); | < < | < | | < < < < < | < | | < < < < < | < | | < < < > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 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 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | static void appfs_update_index(const char *hostname) { Tcl_Interp *interp; int tcl_ret; APPFS_DEBUG("Enter: hostname = %s", hostname); interp = appfs_TclInterp(); if (interp == NULL) { return; } tcl_ret = appfs_Tcl_Eval(interp, 2, "::appfs::getindex", hostname); if (tcl_ret != TCL_OK) { APPFS_DEBUG("Call to ::appfs::getindex failed: %s", Tcl_GetStringResult(interp)); return; } return; } static const char *appfs_getfile(const char *hostname, const char *sha1) { Tcl_Interp *interp; char *retval; int tcl_ret; interp = appfs_TclInterp(); if (interp == NULL) { return(NULL); } tcl_ret = appfs_Tcl_Eval(interp, 3, "::appfs::download", hostname, sha1); if (tcl_ret != TCL_OK) { APPFS_DEBUG("Call to ::appfs::download failed: %s", Tcl_GetStringResult(interp)); return(NULL); } retval = strdup(Tcl_GetStringResult(interp)); return(retval); } static void appfs_update_manifest(const char *hostname, const char *sha1) { Tcl_Interp *interp; int tcl_ret; interp = appfs_TclInterp(); if (interp == NULL) { return; } tcl_ret = appfs_Tcl_Eval(interp, 3, "::appfs::getpkgmanifest", hostname, sha1); if (tcl_ret != TCL_OK) { APPFS_DEBUG("Call to ::appfs::getpkgmanifest failed: %s", Tcl_GetStringResult(interp)); return; } return; } static uid_t appfs_get_fsuid(void) { struct fuse_context *ctx; ctx = fuse_get_context(); if (ctx == NULL) { /* Unable to lookup user for some reason */ /* Return an unprivileged user ID */ return(1); } return(ctx->uid); } static char *appfs_get_homedir(uid_t fsuid) { |
︙ | ︙ | |||
349 350 351 352 353 354 355 | Tcl_SetObjResult(interp, Tcl_NewStringObj(homedir, -1)); free(homedir); return(TCL_OK); } | < < < < < < < < < | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | Tcl_SetObjResult(interp, Tcl_NewStringObj(homedir, -1)); free(homedir); return(TCL_OK); } /* Generate an inode for a given path */ static long long appfs_get_path_inode(const char *path) { long long retval; const char *p; retval = 10; |
︙ | ︙ | |||
575 576 577 578 579 580 581 | if (tcl_ret != TCL_OK) { fprintf(stderr, "[error] %s\n", sql_ret); return(1); } | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | if (tcl_ret != TCL_OK) { fprintf(stderr, "[error] %s\n", sql_ret); return(1); } if (sql_ret && sql_ret[0] != '\0') { printf("%s\n", sql_ret); } return(0); } static int appfs_tcl(const char *tcl) { Tcl_Interp *interp; const char *tcl_result; int tcl_ret; interp = appfs_create_TclInterp(); if (interp == NULL) { fprintf(stderr, "Unable to create a Tcl interpreter. Aborting.\n"); return(1); } tcl_ret = Tcl_Eval(interp, tcl); tcl_result = Tcl_GetStringResult(interp); if (tcl_ret != TCL_OK) { fprintf(stderr, "[error] %s\n", tcl_result); return(1); } if (tcl_result && tcl_result[0] != '\0') { printf("%s\n", tcl_result); } return(0); } static int Appfsd_Init(Tcl_Interp *interp) { #ifdef USE_TCL_STUBS if (Tcl_InitStubs(interp, TCL_VERSION, 0) == 0L) { |
︙ | ︙ | |||
624 625 626 627 628 629 630 631 632 633 634 | return(1); } if (argc == 3 && strcmp(argv[1], "-sqlite3") == 0) { return(appfs_sqlite3(argv[2])); } return(fuse_main(argc, argv, &appfs_oper, NULL)); } | > > > > | 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | return(1); } if (argc == 3 && strcmp(argv[1], "-sqlite3") == 0) { return(appfs_sqlite3(argv[2])); } if (argc == 3 && strcmp(argv[1], "-tcl") == 0) { return(appfs_tcl(argv[2])); } return(fuse_main(argc, argv, &appfs_oper, NULL)); } |