Overview
Comment: | More work towards parsing directory entries |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 85bda525b9e4daa1b2c559df62df1a134f4fce8f |
User & Date: | rkeene on 2014-09-08 07:17:08 |
Other Links: | manifest | tags |
Context
2014-09-08
| ||
19:59 | Added script to create simple appfs directory tree for serving check-in: edd156adcd user: rkeene tags: trunk | |
07:17 | More work towards parsing directory entries check-in: 85bda525b9 user: rkeene tags: trunk | |
06:48 | More work towards reading package data check-in: e37bc482a9 user: rkeene tags: trunk | |
Changes
Modified appfs.c from [e4290f9d3b] to [4d722642c3].
35 35 APPFS_CPU_ALL, 36 36 APPFS_CPU_AMD64, 37 37 APPFS_CPU_I386, 38 38 APPFS_CPU_ARM 39 39 } appfs_cpuArch_t; 40 40 41 41 struct appfs_package { 42 + struct appfs_package *_next; 43 + int counter; 44 + 42 45 char name[128]; 43 46 char version[64]; 44 47 char sha1[41]; 45 48 appfs_os_t os; 46 49 appfs_cpuArch_t cpuArch; 47 50 int isLatest; 48 - 49 - int counter; 50 - struct appfs_package *_next; 51 51 }; 52 52 53 53 struct appfs_site { 54 - char name[256]; 55 - 54 + struct appfs_site *_next; 56 55 int counter; 57 - struct appfs_site *_next; 56 + 57 + char name[256]; 58 58 }; 59 59 60 60 static appfs_os_t appfs_convert_os_fromString(const char *os) { 61 61 if (strcasecmp(os, "Linux") == 0) { 62 62 return(APPFS_OS_LINUX); 63 63 } 64 64 ................................................................................ 154 154 155 155 retval = Tcl_EvalObjv(interp, objc, objv, 0); 156 156 157 157 ckfree((void *) objv); 158 158 159 159 return(retval); 160 160 } 161 + 162 +#define appfs_free_list_type(id, type) static void appfs_free_list_ ## id(type *head) { \ 163 + type *obj, *next; \ 164 + for (obj = head; obj; obj = next) { \ 165 + next = obj->_next; \ 166 + ckfree((void *) obj); \ 167 + } \ 168 +} 169 + 170 +appfs_free_list_type(site, struct appfs_site) 171 +appfs_free_list_type(package, struct appfs_package) 172 + 161 173 162 174 static int appfs_getsites_cb(void *_head, int columns, char **values, char **names) { 163 175 struct appfs_site **head_p, *obj; 164 176 165 177 head_p = _head; 166 178 167 179 obj = (void *) ckalloc(sizeof(*obj)); ................................................................................ 274 286 return(0); 275 287 } 276 288 277 289 static int appfs_getmanifest(const char *hostname, const char *sha1) { 278 290 return(0); 279 291 } 280 292 281 -static int appfs_fuse_getattr(const char *_path, struct stat *stbuf) { 293 +#if 0 294 +static int appfs_parse_path(const char *_path, struct appfs_path *pathinfo) { 282 295 char *path; 283 - char *hostname, *package; 284 - int res = 0; 285 - 286 - APPFS_DEBUG("Enter (path = %s, ...)", _path); 287 296 288 297 if (_path == NULL) { 289 298 return(-ENOENT); 290 299 } 291 300 292 301 if (_path[0] != '/') { 293 302 return(-ENOENT); ................................................................................ 298 307 } 299 308 300 309 path = strdup(_path); 301 310 302 311 hostname = path + 1; 303 312 package = strchr(hostname, '/'); 304 313 314 + if (package == NULL) { 315 + /* Request for a single hostname */ 316 + } 317 + 318 + 319 +} 320 +#else 321 +static int appfs_parse_path(const char *_path) { 322 + return(0); 323 +} 324 +#endif 325 + 326 +static int appfs_fuse_getattr(const char *path, struct stat *stbuf) { 327 + int res = 0; 328 + 329 + APPFS_DEBUG("Enter (path = %s, ...)", path); 330 + 331 + res = appfs_parse_path(path); 332 + 305 333 memset(stbuf, 0, sizeof(struct stat)); 306 334 307 335 stbuf->st_mode = S_IFDIR | 0755; 308 336 stbuf->st_nlink = 2; 309 337 310 338 return res; 311 339 } ................................................................................ 334 362 int packages_count = 0, sites_count = 0; 335 363 336 364 sites = appfs_getsites(&sites_count); 337 365 printf("Sites:\n"); 338 366 for (site = sites; site; site = site->_next) { 339 367 printf("\tname = %s\n", site->name); 340 368 } 369 + 370 + appfs_free_list_site(sites); 341 371 342 372 packages = appfs_getindex("rkeene.org", &packages_count); 343 373 if (packages == NULL || packages_count == 0) { 344 374 fprintf(stderr, "Unable to fetch package index from rkeene.org.\n"); 345 375 346 376 return(1); 347 377 } ................................................................................ 351 381 package->name, 352 382 package->version, 353 383 package->sha1, 354 384 appfs_convert_os_toString(package->os), 355 385 appfs_convert_cpuArch_toString(package->cpuArch) 356 386 ); 357 387 } 388 + 389 + appfs_free_list_package(packages); 358 390 359 391 return(0); 360 392 } 361 393 #else 362 394 static struct fuse_operations appfs_oper = { 363 395 .getattr = appfs_fuse_getattr, 364 396 .readdir = appfs_fuse_readdir,