Overview
Comment: | Added support for an "appfs-cache" script calling sqlite3 directly in appfsd |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tcl-ops |
Files: | files | file ages | folders |
SHA1: |
c374111c3789989554f0143845cdd829 |
User & Date: | rkeene on 2014-11-07 04:52:29 |
Other Links: | branch diff | manifest | tags |
Context
2014-11-07
| ||
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 | |
2014-11-06
| ||
18:29 | Minor update check-in: 5bd7399e05 user: rkeene tags: tcl-ops | |
Changes
Added appfs-cache version [8c72230216].
|
Modified appfsd.c from [169ff6cab0] to [206ee97d58].
︙ | |||
69 70 71 72 73 74 75 | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | - + + | struct { off_t size; char source[256]; } symlink; } typeinfo; }; |
︙ | |||
197 198 199 200 201 202 203 | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | - + | Tcl_Interp *interp; int tcl_ret; APPFS_DEBUG("Enter: hostname = %s", hostname); interp = pthread_getspecific(interpKey); if (interp == NULL) { |
︙ | |||
223 224 225 226 227 228 229 | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | - + | static const char *appfs_getfile(const char *hostname, const char *sha1) { Tcl_Interp *interp; char *retval; int tcl_ret; interp = pthread_getspecific(interpKey); if (interp == NULL) { |
︙ | |||
250 251 252 253 254 255 256 | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | - + | static void appfs_update_manifest(const char *hostname, const char *sha1) { Tcl_Interp *interp; int tcl_ret; interp = pthread_getspecific(interpKey); if (interp == NULL) { |
︙ | |||
379 380 381 382 383 384 385 386 387 388 389 390 391 392 | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | + + + + + + + + + + + + + + + + + + + + + + + + + + | return(retval); } /* Get information about a path, and optionally list children */ static int appfs_get_path_info(const char *_path, struct appfs_pathinfo *pathinfo, struct appfs_children **children) { } static int appfs_fuse_readlink(const char *path, char *buf, size_t size) { struct appfs_pathinfo pathinfo; int res = 0; APPFS_DEBUG("Enter (path = %s, ...)", path); pathinfo.type = APPFS_PATHTYPE_INVALID; res = appfs_get_path_info(path, &pathinfo, NULL); if (res != 0) { return(res); } if (pathinfo.type != APPFS_PATHTYPE_SYMLINK) { return(-EINVAL); } if ((strlen(pathinfo.typeinfo.symlink.source) + 1) > size) { return(-ENAMETOOLONG); } memcpy(buf, pathinfo.typeinfo.symlink.source, strlen(pathinfo.typeinfo.symlink.source) + 1); return(0); } static int appfs_fuse_getattr(const char *path, struct stat *stbuf) { struct appfs_pathinfo pathinfo; int res = 0; APPFS_DEBUG("Enter (path = %s, ...)", path); |
︙ | |||
455 456 457 458 459 460 461 | 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | - + + + | filler(buf, ".", NULL, 0); filler(buf, "..", NULL, 0); for (child = children; child; child = child->_next) { filler(buf, child->name, NULL, 0); } |
︙ | |||
493 494 495 496 497 498 499 500 501 502 503 504 505 506 | 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | + | fh = open(real_path, O_RDONLY); free((void *) real_path); if (fh < 0) { return(-EIO); } fi->fh = fh; #endif return(0); } static int appfs_fuse_close(const char *path, struct fuse_file_info *fi) { int close_ret; |
︙ | |||
524 525 526 527 528 529 530 | 554 555 556 557 558 559 560 561 562 563 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 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - + + | } read_ret = read(fi->fh, buf, size); return(read_ret); } static int appfs_sqlite3(const char *sql) { Tcl_Interp *interp; const char *sql_ret; int tcl_ret; |
Modified appfsd.tcl from [1a0526f9cf] to [e0ad1bdba0].
︙ | |||
76 77 78 79 80 81 82 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - - - - | if {![regexp {^[0-9a-f]*$} $value]} { return false } return true } |
︙ | |||
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | 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 164 165 166 167 168 169 | + + + + + - - - + + + - - - + + + - + | return -code error "Unable to normalize CPU: $cpu" } proc init {} { if {[info exists ::appfs::init_called]} { return } # Force [parray] to be loaded catch { parray does_not_exist } set ::appfs::init_called 1 if {![info exists ::appfs::db]} { file mkdir $::appfs::cachedir sqlite3 ::appfs::db [file join $::appfs::cachedir cache.db] } # Create tables |
︙ | |||
184 185 186 187 188 189 190 | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | - + | } ::http::reset $token ::http::cleanup $token } if {![info exists indexhash_data]} { # Cache this result for 60 seconds |
︙ | |||
234 235 236 237 238 239 240 | 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 287 288 289 290 291 292 293 294 295 296 297 | - + - + - + - + - + - + - + - + | if {![_isHash $pkgInfo(hash)]} { continue } lappend curr_packages $pkgInfo(hash) # Do not do any additional work if we already have this package |
︙ | |||
316 317 318 319 320 321 322 | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | - - + + | } set fileInfo(name) [join $work ","] set fileInfo(name) [split [string trim $fileInfo(name) "/"] "/"] set fileInfo(directory) [join [lrange $fileInfo(name) 0 end-1] "/"] set fileInfo(name) [lindex $fileInfo(name) end] |