Changeset 481 for trunk/src/sh_fInotify.c
- Timestamp:
- Jul 18, 2015, 5:06:52 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_fInotify.c
r433 r481 35 35 #include "sh_unix.h" 36 36 #include "sh_hash.h" 37 #include "sh_dbIO.h" 37 38 #include "sh_files.h" 38 39 #include "sh_ignore.h" … … 111 112 static int sh_fInotify_process(struct inotify_event * event); 112 113 static int sh_fInotify_report(struct inotify_event * event, char * filename, 113 int class, unsigned long check_ mask, int ftype, int rdepth);114 int class, unsigned long check_flags, int ftype, int rdepth); 114 115 115 116 int sh_fInotify_init(struct mod_type * arg) … … 236 237 count2 = 0; /* Update baseline database. */ 237 238 if (sh.flag.checkSum == SH_CHECK_CHECK && sh.flag.update == S_TRUE) 238 sh_ hash_writeout();239 sh_dbIO_writeout_update (); 239 240 } 240 241 … … 329 330 int type; 330 331 int rdepth; 331 unsigned long check_ mask;332 unsigned long check_flags; 332 333 int retval; 333 334 int errnum; … … 349 350 350 351 while (NULL != (filename = sh_inotify_pop_dormant(&sh_file_watches, 351 &class, &check_ mask,352 &class, &check_flags, 352 353 &type, &rdepth))) 353 354 { 354 355 retval = sh_inotify_add_watch(filename, &sh_file_watches, &errnum, 355 class, check_ mask, type, rdepth);356 class, check_flags, type, rdepth); 356 357 357 358 if (retval < 0) … … 424 425 if (event->mask & IN_UNMOUNT) sl_strlcat(dbgbuf, "IN_UNMOUNT ", sizeof(dbgbuf)); 425 426 426 /* fprintf(stderr, "FIXME: %s\n", dbgbuf); */427 428 427 SH_MUTEX_LOCK(mutex_thread_nolog); 429 428 sh_error_handle(SH_ERR_ALL, FIL__, __LINE__, 0, MSG_E_SUBGEN, … … 437 436 int ftype; 438 437 int rdepth; 439 unsigned long check_ mask;438 unsigned long check_flags; 440 439 char * filename; 441 440 extern int flag_err_debug; 442 441 443 if (flag_err_debug == S L_TRUE)442 if (flag_err_debug == S_TRUE) 444 443 { 445 444 sh_fInotify_logmask(event); … … 449 448 { 450 449 filename = sh_inotify_search_item(&sh_file_watches, event->wd, 451 &class, &check_ mask, &ftype, &rdepth);450 &class, &check_flags, &ftype, &rdepth); 452 451 453 452 if (filename) 454 453 { 455 sh_fInotify_report(event, filename, class, check_ mask, ftype, rdepth);454 sh_fInotify_report(event, filename, class, check_flags, ftype, rdepth); 456 455 SH_FREE(filename); 457 456 } … … 488 487 } 489 488 490 void sh_fInotify_report_add(char * path, int class, unsigned long check_ mask)489 void sh_fInotify_report_add(char * path, int class, unsigned long check_flags) 491 490 { 492 491 if (S_FALSE == sh_ignore_chk_new(path)) … … 496 495 sh_files_clear_file_reported(path); 497 496 498 sh_files_search_file(path, &class, &check_ mask, &reported);497 sh_files_search_file(path, &class, &check_flags, &reported); 499 498 500 sh_files_filecheck (class, check_ mask, path, NULL,499 sh_files_filecheck (class, check_flags, path, NULL, 501 500 &reported, 0); 502 501 if (SH_FFLAG_REPORTED_SET(reported)) … … 521 520 static int sh_fInotify_report_change (struct inotify_event * event, 522 521 char * path, char * filename, 523 int class, unsigned long check_ mask, int ftype)522 int class, unsigned long check_flags, int ftype) 524 523 { 525 524 int reported; … … 529 528 if (S_FALSE == sh_ignore_chk_mod(path)) 530 529 { 531 ret = sh_files_search_file(path, &class, &check_ mask, &reported);530 ret = sh_files_search_file(path, &class, &check_flags, &reported); 532 531 533 532 if ((ret == 0) && (event->len > 0) && (ftype == SH_INOTIFY_FILE)) … … 537 536 else 538 537 { 539 sh_files_filecheck (class, check_ mask, filename,538 sh_files_filecheck (class, check_flags, filename, 540 539 (event->len > 0) ? event->name : NULL, 541 540 &reported, 0); … … 548 547 static int sh_fInotify_report_missing (struct inotify_event * event, 549 548 char * path, 550 int class, unsigned long check_ mask, int ftype)549 int class, unsigned long check_flags, int ftype) 551 550 { 552 551 int reported; … … 560 559 if (0 != hashreport_missing(path, level)) 561 560 { 562 int ret = sh_files_search_file(path, &class, &check_ mask, &reported);561 int ret = sh_files_search_file(path, &class, &check_flags, &reported); 563 562 564 563 if ((ret == 0) && (event->len > 0) && (ftype == SH_INOTIFY_FILE)) … … 578 577 } 579 578 580 #ifndef REPLACE_OLD581 sh_hash_set_visited_true(path);582 #else583 579 sh_hash_set_missing(path); 584 #endif 580 585 581 if (sh.flag.reportonce == S_TRUE) 586 582 sh_files_set_file_reported(path); … … 596 592 static int sh_fInotify_report_added (struct inotify_event * event, 597 593 char * path, char * filename, 598 int class, unsigned long check_ mask,594 int class, unsigned long check_flags, 599 595 int ftype, int rdepth) 600 596 { … … 608 604 sh_files_clear_file_reported(path); 609 605 610 ret = sh_files_search_file(path, &class, &check_ mask, &reported);606 ret = sh_files_search_file(path, &class, &check_flags, &reported); 611 607 612 608 if ((ret == 0) && (event->len > 0) && (ftype == SH_INOTIFY_FILE)) … … 618 614 int classD = class; 619 615 int reportedD = reported; 620 unsigned long check_ maskD = check_mask;616 unsigned long check_flagsD = check_flags; 621 617 622 618 if (event->mask & IN_ISDIR) 623 619 { 624 retD = sh_files_search_dir(path, &classD, &check_ maskD,620 retD = sh_files_search_dir(path, &classD, &check_flagsD, 625 621 &reportedD, &rdepthD); 626 622 if (retD != 0) … … 629 625 { 630 626 class = classD; 631 check_ mask = check_maskD;627 check_flags = check_flagsD; 632 628 } 633 629 } 634 630 } 635 631 636 sh_files_filecheck (class, check_ mask, filename,632 sh_files_filecheck (class, check_flags, filename, 637 633 (event->len > 0) ? event->name : NULL, 638 634 &reported, 0); … … 641 637 { 642 638 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_INSCAN; ); 643 sh_files_checkdir (classD, check_ maskD, rdepthD,639 sh_files_checkdir (classD, check_flagsD, rdepthD, 644 640 path, (event->len > 0) ? event->name : NULL); 645 641 SH_INOTIFY_IFUSED( sh.flag.inotify &= ~SH_INOTIFY_INSCAN; ); … … 657 653 { 658 654 sh_inotify_add_watch(path, &sh_file_watches, &ret, 659 class, check_ mask,655 class, check_flags, 660 656 (event->mask & IN_ISDIR)?SH_INOTIFY_DIR:SH_INOTIFY_FILE, 661 657 rdepthD); … … 666 662 667 663 static int sh_fInotify_report(struct inotify_event * event, char * filename, 668 int class, unsigned long check_ mask, int ftype, int rdepth)664 int class, unsigned long check_flags, int ftype, int rdepth) 669 665 { 670 666 char * fullpath = NULL; … … 684 680 { 685 681 sh_fInotify_report_change (event, path, filename, 686 class, check_ mask, ftype);682 class, check_flags, ftype); 687 683 } 688 684 else if ((event->mask & (IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_MOVED_FROM)) != 0) 689 685 { 690 686 sh_fInotify_report_missing (event, path, 691 class, check_ mask, ftype);687 class, check_flags, ftype); 692 688 } 693 689 else if((event->mask & (IN_CREATE|IN_MOVED_TO)) != 0) 694 690 { 695 691 sh_fInotify_report_added (event, path, filename, 696 class, check_ mask,692 class, check_flags, 697 693 ftype, rdepth); 698 694 }
Note:
See TracChangeset
for help on using the changeset viewer.