Overview
Comment: | Add "getattr" implementation |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tcl-ops |
Files: | files | file ages | folders |
SHA1: |
d64c2e9bf72d38141c79e99db0cb0ee2 |
User & Date: | rkeene on 2014-11-07 11:36:59 |
Other Links: | branch diff | manifest | tags |
Context
2014-11-07
| ||
12:13 | Added basic "open" support check-in: ebbca87b7e user: rkeene tags: tcl-ops | |
11:36 | Add "getattr" implementation check-in: d64c2e9bf7 user: rkeene tags: tcl-ops | |
08:48 | Added basic "getchildren" implementation in Tcl check-in: ee13ee5aa4 user: rkeene tags: tcl-ops | |
Changes
Modified appfsd.c from [16b07e2510] to [70718fd2dc].
︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 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 | + - - - - - - - - | /* * Global variables, needed for all threads but only initialized before any * FUSE threads are created */ const char *appfs_cachedir; time_t appfs_boottime; int appfs_fuse_started = 0; /* * AppFS Path Type: Describes the type of path a given file is */ typedef enum { APPFS_PATHTYPE_INVALID, APPFS_PATHTYPE_FILE, APPFS_PATHTYPE_DIRECTORY, APPFS_PATHTYPE_SYMLINK } appfs_pathtype_t; |
︙ | |||
260 261 262 263 264 265 266 267 268 269 270 271 272 273 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | + + + + | /* * Determine the UID for the user making the current FUSE filesystem request. * This will be used to lookup the user's home directory so we can search for * locally modified files. */ static uid_t appfs_get_fsuid(void) { struct fuse_context *ctx; if (!appfs_fuse_started) { return(getuid()); } ctx = fuse_get_context(); if (ctx == NULL) { /* Unable to lookup user for some reason */ /* Return an unprivileged user ID */ return(1); } |
︙ | |||
373 374 375 376 377 378 379 | 370 371 372 373 374 375 376 377 378 379 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 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 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 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + - + + + - - + + + + + + | retval += 10; retval %= 4294967296ULL; return(retval); } /* Get information about a path, and optionally list children */ |
︙ | |||
440 441 442 443 444 445 446 | 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 | - + - + - | break; case APPFS_PATHTYPE_SYMLINK: stbuf->st_mode = S_IFLNK | 0555; stbuf->st_nlink = 1; stbuf->st_size = pathinfo.typeinfo.symlink.size; break; case APPFS_PATHTYPE_INVALID: |
︙ | |||
763 764 765 766 767 768 769 770 771 772 | 878 879 880 881 882 883 884 885 886 887 888 | + | fuse_opt_add_arg(&args, "-oallow_other"); } /* * Enter the FUSE main loop -- this will process any arguments * and start servicing requests. */ appfs_fuse_started = 1; return(fuse_main(args.argc, args.argv, &appfs_operations, NULL)); } |
Modified appfsd.tcl from [88b17c4a86] to [c564230658].
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | + | #! /usr/bin/env tclsh package require http 2.7 package require sqlite3 package require sha1 package require appfsd namespace eval ::appfs { variable cachedir "/tmp/appfs-cache" variable ttl 3600 variable nttl 60 # User-replacable function to convert a hostname/hash/method to an URL |
︙ | |||
335 336 337 338 339 340 341 342 343 344 345 346 347 | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 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 | + + + + + - + + + + + + + + + - - + - + - - - - + + + - - - + + + + - - - + + + + - - - - + + + + - - - - + + + + + + | db eval {INSERT INTO files (package_sha1, type, time, source, size, perms, file_sha1, file_name, file_directory) VALUES ($package_sha1, $fileInfo(type), $fileInfo(time), $fileInfo(source), $fileInfo(size), $fileInfo(perms), $fileInfo(sha1), $fileInfo(name), $fileInfo(directory) );} db eval {UPDATE packages SET haveManifest = 1 WHERE sha1 = $package_sha1;} } } return COMPLETE } proc _localpath {package hostname file} { set homedir [::appfsd::get_homedir] set dir [file join $homedir .appfs "./${package}@${hostname}" "./${file}"] } proc _parsepath {path} { set path [string trim $path "/"] set path [split $path "/"] set pathlen [llength $path] |
︙ | |||
410 411 412 413 414 415 416 | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 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 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | - - + + + + + + - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | catch { ::appfs::getindex $pathinfo(hostname) } return [::appfs::db eval {SELECT DISTINCT package FROM packages WHERE hostname = $pathinfo(hostname);}] } "os-cpu" { |