README 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. Caseless Filesystem
  2. ---------------------
  3. The caseless filesystem is designed to allow one to access files in a
  4. case insensitive manner on a case-sensitive filesystem. A particular
  5. example of the use of this is in trying to build code that's maintained
  6. on a case insensitive operating system (e.g. windows) on Linux without
  7. having to spend time correcting all the references.
  8. e.g. on the filesystem the file might be "inc/api.h" but c source code
  9. might contain '#include "INC\Api.h"' which is case-inconsistent and will
  10. fail on Linux.
  11. Usage:
  12. caseless-fuse path/to/mountpoint path/to/source
  13. the "source" is the location with the original files. The mountpoint is
  14. the place where the apparently case-insensitive version of those files
  15. will appear to be present.
  16. When you are finished you can unmount the filesystem like so:
  17. fusermount -u path/to/mountpoint
  18. Example:
  19. If there is a file called api.h in "myproject" and you mount "myproject"
  20. onto "uc_myproject" like so:
  21. mkdir uc_myproject
  22. caseless-fuse myproject uc_myproject
  23. ...then this command will fail:
  24. cat myproject/API.H
  25. cat: cannot access myproject/API.H: No such file or directory
  26. ...but this one will succeed:
  27. cat uc_myproject/API.H
  28. /* api.h */
  29. #ifndef _API_H_
  30. #define _API_H_
  31. ....
  32. #endif
  33. Design
  34. ------
  35. Caseless has a big hashtable - the key is a lowercased version of a
  36. filename with the full path and the value is the actual filename on the
  37. storage media.
  38. On startup it fills the hashtable with all the files that exist under
  39. the source directory and then as files are created/removed in the course
  40. of running it keeps this hashtable uptodate.
  41. A chained hastable is used with a compile-time constant number of chains.
  42. When some operation is contemplated on a file: if it's an operation
  43. that requires a file to already exist then the fs lowercases the name
  44. the application asked for, uses this as a key to lookup the "real"
  45. filename and opens that instead. If the file is not in the hash table
  46. then it doesn't exist and this is only ok if the operation is "create"
  47. or "open(ccc,"w+").
  48. Lookups on non-existent keys are expensive-ish in dictionaries so we
  49. also remember when a file doesn't exist by storing a null value into
  50. the dictionary for that key. Make does a lot of lookups for non-existant
  51. things, of course.
  52. There is code for handling the file operations (caseless-fuse.c) for
  53. managing the dictionary of lowercase filenames mapping to real names
  54. (pathcache.c) and code for looking after our "own home-grown filehandles"
  55. (filehandles.c). The filename mapping dictionary uses a generic string
  56. key/string value hashtable from hashtable.c.
  57. There are some little test programs (e.g. for the hashtable
  58. implementation) and some test scripts - test.sh is for basic correctness
  59. of operations and test_perf.sh tries to check performance on "stat"
  60. operations which make does a lot of.
  61. Known-Issues
  62. -------------
  63. Memory usage is not bounded in the face of many deletes since the
  64. filesystem tries to remember what files don't exist and has no way of
  65. recovering the storage that this requires. Future versions will.
  66. It's not as fast as direct access to the filesystem.
  67. Building:
  68. -----------
  69. You need to have the fuse libraries installed.
  70. Just type "make" to build.
  71. To debug the filesystem, build with debugging on:
  72. make CFLAGS="-g -DDEBUG"
  73. then run like so:
  74. ./caseless-fuse -o debug path/to/mountpoint path/to/source
  75. The filesystem will not become a daemon and will display debugging output
  76. on the console. You can use another terminal window to run whatever
  77. testing you wish while watching this output. Debugging slows the filesystem
  78. down greatly so for real world use run "make clean; make" to rebuild before
  79. using it.