Overview
Comment: | Added a default time to psuedo entries |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | ef5acff5c9392154b06dbf301b7e1711501e7083 |
User & Date: | rkeene on 2014-09-09 08:23:32 |
Other Links: | manifest | tags |
Context
2014-09-10
| ||
04:01 | Reduced redundant code check-in: 041086f3fb user: rkeene tags: trunk | |
2014-09-09
| ||
08:23 | Added a default time to psuedo entries check-in: ef5acff5c9 user: rkeene tags: trunk | |
08:19 | Updated to keep track of the upstream OS name and CPU check-in: ed608e7fee user: rkeene tags: trunk | |
Changes
Modified appfs.c from [4cd4495e1d] to [799a556739].
18 18 #define APPFS_DEBUG(x...) { fprintf(stderr, "[debug] %s:%i:%s: ", __FILE__, __LINE__, __func__); fprintf(stderr, x); fprintf(stderr, "\n"); } 19 19 20 20 static pthread_key_t interpKey; 21 21 22 22 struct appfs_thread_data { 23 23 sqlite3 *db; 24 24 const char *cachedir; 25 + time_t boottime; 25 26 }; 26 27 27 28 struct appfs_thread_data globalThread; 28 29 29 30 typedef enum { 30 31 APPFS_OS_UNKNOWN, 31 32 APPFS_OS_ALL, ................................................................................ 674 675 if (_path[1] == '\0') { 675 676 /* Request for the root directory */ 676 677 sites = appfs_getsites(&sites_count); 677 678 678 679 pathinfo->type = APPFS_PATHTYPE_DIRECTORY; 679 680 pathinfo->typeinfo.dir.childcount = sites_count; 680 681 pathinfo->hostname[0] = '\0'; 682 + pathinfo->time = globalThread.boottime; 681 683 682 684 if (children) { 683 685 for (site = sites; site; site = site->_next) { 684 686 node = (void *) ckalloc(sizeof(*node)); 685 687 node->_next = *children; 686 688 strcpy(node->name, site->name); 687 689 *children = node; ................................................................................ 716 718 return(-ENOENT); 717 719 } 718 720 719 721 if (packagename == NULL) { 720 722 /* Request for a single hostname */ 721 723 pathinfo->type = APPFS_PATHTYPE_DIRECTORY; 722 724 pathinfo->typeinfo.dir.childcount = packages_count; 725 + pathinfo->time = globalThread.boottime; 723 726 724 727 if (children) { 725 728 for (package = packages; package; package = package->_next) { 726 729 node = (void *) ckalloc(sizeof(*node)); 727 730 node->_next = *children; 728 731 strcpy(node->name, package->name); 729 732 *children = node; ................................................................................ 737 740 return(0); 738 741 } 739 742 740 743 os_cpuArch = strchr(packagename, '/'); 741 744 if (os_cpuArch == NULL) { 742 745 /* Request for OS and CPU Arch for a specific package */ 743 746 pathinfo->type = APPFS_PATHTYPE_DIRECTORY; 747 + pathinfo->time = globalThread.boottime; 744 748 745 749 os_cpuArch_count = 0; 746 750 for (package = packages; package; package = package->_next) { 747 751 if (strcmp(package->name, packagename) != 0) { 748 752 APPFS_DEBUG("Skipping package named \"%s\", does not match requested package: \"%s\"", package->name, packagename); 749 753 750 754 continue; ................................................................................ 791 795 } 792 796 793 797 os_val = appfs_convert_os_fromString(os); 794 798 795 799 if (version == NULL) { 796 800 /* Request for version list for a package on an OS/CPU */ 797 801 pathinfo->type = APPFS_PATHTYPE_DIRECTORY; 802 + pathinfo->time = globalThread.boottime; 798 803 799 804 version_count = 0; 800 805 for (package = packages; package; package = package->_next) { 801 806 if (strcmp(package->name, packagename) != 0) { 802 807 APPFS_DEBUG("Skipping package named \"%s\", does not match requested package: \"%s\"", package->name, packagename); 803 808 804 809 continue; ................................................................................ 853 858 return(-ENOENT); 854 859 } 855 860 856 861 APPFS_DEBUG(" ... which hash a hash of %s", package_hash); 857 862 858 863 if (strcmp(path, "") == 0) { 859 864 pathinfo->type = APPFS_PATHTYPE_DIRECTORY; 865 + pathinfo->time = globalThread.boottime; 860 866 } else { 861 867 fileinfo_ret = appfs_getfileinfo(hostname, package_hash, path, pathinfo); 862 868 if (fileinfo_ret != 0) { 863 869 free(path_s); 864 870 865 871 return(fileinfo_ret); 866 872 } ................................................................................ 1071 1077 1072 1078 int main(int argc, char **argv) { 1073 1079 const char *cachedir = APPFS_CACHEDIR; 1074 1080 char dbfilename[1024]; 1075 1081 int pthread_ret, snprintf_ret, sqlite_ret; 1076 1082 1077 1083 globalThread.cachedir = cachedir; 1084 + globalThread.boottime = time(NULL); 1078 1085 1079 1086 pthread_ret = pthread_key_create(&interpKey, NULL); 1080 1087 if (pthread_ret != 0) { 1081 1088 fprintf(stderr, "Unable to create TSD key for Tcl. Aborting.\n"); 1082 1089 1083 1090 return(1); 1084 1091 }