home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 8 / CDACTUAL8.iso / docs / kernel-2.0 / filesyst / vfat.txt < prev   
Encoding:
Text File  |  1996-07-11  |  17.2 KB  |  465 lines

  1. USING VFAT
  2. ----------------------------------------------------------------------
  3. To use the vfat filesystem, use the filesystem type 'vfat'.  i.e.
  4.   mount -t vfat /dev/fd0 /mnt
  5.  
  6. No special partition formatter is required.  mkdosfs will work fine
  7. if you want to format from within Linux.
  8.  
  9. VFAT MOUNT OPTIONS
  10. ----------------------------------------------------------------------
  11. uni_xlate     -- Translate unhandled Unicode characters to special
  12.          escaped sequences.  This would let you backup and
  13.          restore filenames that are created with any Unicode
  14.          characters.  Until Linux supports Unicode for real,
  15.          this gives you an alternative.  Without this option,
  16.          a '?' is used when no translation is possible.  The
  17.          escape character is ':' because it is otherwise
  18.          illegal on the vfat filesystem.  The escape sequence
  19.          that gets used, where u is the unicode character, is:
  20.             ':', (u & 0x3f), ((u>>6) & 0x3f), (u>>12),
  21. posix         -- Allow names of same letters, different case such as
  22.                  'LongFileName' and 'longfilename' to coexist.  This has some
  23.                  problems currently because 8.3 conflicts are not handled
  24.                  correctly for Posix filesystem compliance.
  25. nonumtail     -- When creating 8.3 aliases, normally the alias will
  26.                  end in '~1' or tilde followed by some number.  If this
  27.                  option is set, then if the filename is 
  28.                  "longfilename.txt" and "longfile.txt" does not
  29.                  currently exist in the directory, 'longfile.txt' will
  30.                  be the short alias instead of 'longfi~1.txt'. 
  31.                   
  32. quiet         -- Stops printing certain warning messages.
  33.  
  34.  
  35. TODO
  36. ----------------------------------------------------------------------
  37. * Need to get rid of the raw scanning stuff.  Instead, always use
  38.   a get next directory entry approach.  The only thing left that uses
  39.   raw scanning is the directory renaming code.
  40.  
  41. * Need to add dcache_lookup code msdos filesystem.  This means the
  42.   directories need to be versioned like the vfat filesystem.
  43.  
  44. * Add support for different codepages.  Right now, we only support
  45.   the a single English codepage.
  46.  
  47. * Fix the Posix filesystem support to work in 8.3 space.  This involves
  48.   renaming aliases if a conflict occurs between a new filename and
  49.   an old alias.  This is quite a mess.
  50.  
  51.  
  52. POSSIBLE PROBLEMS
  53. ----------------------------------------------------------------------
  54. * vfat_valid_longname does not properly checked reserved names.
  55. * When a volume name is the same as a directory name in the root
  56.   directory of the filesystem, the directory name sometimes shows
  57.   up empty an empty file.
  58.  
  59. BUG REPORTS
  60. ----------------------------------------------------------------------
  61. If you have trouble with the VFAT filesystem, mail bug reports to
  62. chaffee@bugs-bunny.cs.berkeley.edu.  Please specify the filename
  63. and the operation that gave you trouble.
  64.  
  65. TEST SUITE
  66. ----------------------------------------------------------------------
  67. If you plan to make any modifications to the vfat filesystem, please
  68. get the test suite that comes with the vfat distribution at
  69.  
  70.   http://www-plateau.cs.berkeley.edu/people/chaffee/vfat.html
  71.  
  72. This tests quite a few parts of the vfat filesystem and additional
  73. tests for new features or untested features would be appreciated.
  74.  
  75. NOTES ON THE STRUCTURE OF THE VFAT FILESYSTEM
  76. ----------------------------------------------------------------------
  77. (This documentation was provided by Galen C. Hunt <gchunt@cs.rochester.edu>
  78.  and lightly annotated by Gordon Chaffee).
  79.  
  80. This document presents a very rough, technical overview of my
  81. knowledge of the extended FAT file system used in Windows NT 3.5 and
  82. Windows 95.  I don't guarantee that any of the following is correct,
  83. but it appears to be so.
  84.  
  85. The extended FAT file system is almost identical to the FAT
  86. file system used in DOS versions up to and including 6.223410239847
  87. :-).  The significant change has been the addition of long file names.
  88. Theses names support up to 255 characters including spaces and lower
  89. case characters as opposed to the traditional 8.3 short names.
  90.  
  91. Here is the description of the traditional FAT entry in the current
  92. Windows 95 filesystem:
  93.  
  94.         struct directory { // Short 8.3 names 
  95.                 unsigned char name[8];          // file name 
  96.                 unsigned char ext[3];           // file extension 
  97.                 unsigned char attr;             // attribute byte 
  98.         unsigned char lcase;        // Case for base and extension
  99.         unsigned char ctime_ms;        // Creation time, milliseconds
  100.         unsigned char ctime[2];        // Creation time
  101.         unsigned char cdate[2];        // Creation date
  102.         unsigned char adate[2];        // Last access date
  103.         unsigned char reserved[2];    // reserved values (ignored) 
  104.                 unsigned char time[2];          // time stamp 
  105.                 unsigned char date[2];          // date stamp 
  106.                 unsigned char start[2];         // starting cluster number 
  107.                 unsigned char size[4];          // size of the file 
  108.         };
  109.  
  110. The lcase field specifies if the base and/or the extension of an 8.3
  111. name should be capitalized.  This field does not seem to be used by
  112. Windows 95 but it is used by Windows NT.  The case of filenames is not
  113. completely compatible from Windows NT to Windows 95.  It is not completely
  114. compatible in the reverse direction, however.  Filenames that fit in
  115. the 8.3 namespace and are written on Windows NT to be lowercase will
  116. show up as uppercase on Windows 95.
  117.  
  118. Note that the "start" and "size" values are actually little
  119. endian integer values.  The descriptions of the fields in this
  120. structure are public knowledge and can be found elsewhere.
  121.  
  122. With the extended FAT system, Microsoft has inserted extra
  123. directory entries for any files with extended names.  (Any name which
  124. legally fits within the old 8.3 encoding scheme does not have extra
  125. entries.)  I call these extra entries slots.  Basically, a slot is a
  126. specially formatted directory entry which holds up to 13 characters of
  127. a files extended name.  Think of slots as additional labeling for the
  128. directory entry of the file to which they correspond.  Microsoft
  129. prefers to refer to the 8.3 entry for a file as its alias and the
  130. extended slot directory entries as the file name. 
  131.  
  132. The C structure for a slot directory entry follows:
  133.  
  134.         struct slot { // Up to 13 characters of a long name 
  135.                 unsigned char id;               // sequence number for slot 
  136.                 unsigned char name0_4[10];      // first 5 characters in name 
  137.                 unsigned char attr;             // attribute byte
  138.                 unsigned char reserved;         // always 0 
  139.                 unsigned char alias_checksum;   // checksum for 8.3 alias 
  140.                 unsigned char name5_10[12];     // 6 more characters in name
  141.                 unsigned char start[2];         // starting cluster number
  142.                 unsigned char name11_12[4];     // last 2 characters in name
  143.         };
  144.  
  145. If the layout of the slots looks a little odd, it's only
  146. because of Microsoft's efforts to maintain compatibility with old
  147. software.  The slots must be disguised to prevent old software from
  148. panicing.  To this end, a number of measures are taken:
  149.  
  150.         1) The attribute byte for a slot directory entry is always set
  151.            to 0x0f.  This corresponds to an old directory entry with
  152.            attributes of "hidden", "system", "read-only", and "volume
  153.            label".  Most old software will ignore any directory
  154.            entries with the "volume label" bit set.  Real volume label
  155.            entries don't have the other three bits set.
  156.  
  157.         2) The starting cluster is always set to 0, an impossible
  158.            value for a DOS file.
  159.  
  160. Because the extended FAT system is backward compatible, it is
  161. possible for old software to modify directory entries.  Measures must
  162. be taken to insure the validity of slots.  An extended FAT system can
  163. verify that a slot does in fact belong to an 8.3 directory entry by
  164. the following:
  165.  
  166.         1) Positioning.  Slots for a file always immediately proceed
  167.            their corresponding 8.3 directory entry.  In addition, each
  168.            slot has an id which marks its order in the extended file
  169.            name.  Here is a very abbreviated view of an 8.3 directory
  170.            entry and its corresponding long name slots for the file
  171.            "My Big File.Extension which is long":
  172.  
  173.                 <proceeding files...>
  174.                 <slot #3, id = 0x43, characters = "h is long">
  175.                 <slot #2, id = 0x02, characters = "xtension whic">
  176.                 <slot #1, id = 0x01, characters = "My Big File.E">
  177.                 <directory entry, name = "MYBIGFIL.EXT">
  178.  
  179.            Note that the slots are stored from last to first.  Slots
  180.            are numbered from 1 to N.  The Nth slot is or'ed with 0x40
  181.            to mark it as the last one.
  182.  
  183.         2) Checksum.  Each slot has an "alias_checksum" value.  The
  184.            checksum is calculated from the 8.3 name using the
  185.            following algorithm:
  186.  
  187.                 for (sum = i = 0; i < 11; i++) {
  188.                         sum = (((sum&1)<<7)|((sum&0xfe)>>1)) + name[i]
  189.                 }
  190.  
  191.     3) If there is in the final slot, a Unicode NULL (0x0000) is stored
  192.            after the final character.  After that, all unused characters in
  193.            the final slot are set to Unicode 0xFFFF.
  194.  
  195. Finally, note that the extended name is stored in Unicode.  Each Unicode
  196. character takes two bytes.
  197.  
  198.  
  199. NOTES ON UNICODE TRANSLATION IN VFAT FILESYSTEM
  200. ----------------------------------------------------------------------
  201. (Information provided by Steve Searle <steve@mgu.bath.ac.uk>)
  202.  
  203. Char used as   Char(s) used   Char(s) used in     Entries which have
  204. filename       in shortname   longname slot       been corrected
  205. 0x80 (128)     0x80           0xC7                   
  206. 0x81 (129)     0x9A           0xFC
  207. 0x82 (130)     0x90           0xE9                     E
  208. 0x83 (131)     0xB6           0xE2                     E
  209. 0x84 (132)     0x8E           0xE4                     E
  210. 0x85 (133)     0xB7           0xE0                     E
  211. 0x86 (134)     0x8F           0xE5                     E
  212. 0x87 (135)     0x80           0xE7                     E
  213. 0x88 (136)     0xD2           0xEA                     E
  214. 0x89 (137)     0xD3           0xEB                     E
  215. 0x8A (138)     0xD4           0xE8                     E
  216. 0x8B (139)     0xD8           0xEF                     E
  217. 0x8C (140)     0xD7           0xEE                     E
  218. 0x8D (141)     0xDE           0xEC                     E
  219. 0x8E (142)     0x8E           0xC4                     E
  220. 0x8F (143)     0x8F           0xC5                     E
  221. 0x90 (144)     0x90           0xC9                     E
  222. 0x91 (145)     0x92           0xE6                     E
  223. 0x92 (146)     0x92           0xC6                     E
  224. 0x93 (147)     0xE2           0xF4                     E
  225. 0x94 (148)     0x99           0xF6
  226. 0x95 (149)     0xE3           0xF2
  227. 0x96 (150)     0xEA           0xFB
  228. 0x97 (151)     0xEB           0xF9
  229. 0x98 (152)     "_~1"          0xFF
  230. 0x99 (153)     0x99           0xD6
  231. 0x9A (154)     0x9A           0xDC
  232. 0x9B (155)     0x9D           0xF8
  233. 0x9C (156)     0x9C           0xA3
  234. 0x9D (157)     0x9D           0xD8
  235. 0x9E (158)     0x9E           0xD7
  236. 0x9F (159)     0x9F           0x92
  237. 0xA0 (160)     0xB5           0xE1
  238. 0xA1 (161)     0xD6           0xE0
  239. 0xA2 (162)     0xE0           0xF3
  240. 0xA3 (163)     0xE9           0xFA
  241. 0xA4 (164)     0xA5           0xF1
  242. 0xA5 (165)     0xA5           0xD1
  243. 0xA6 (166)     0xA6           0xAA
  244. 0xA7 (167)     0xA7           0xBA
  245. 0xA8 (168)     0xA8           0xBF
  246. 0xA9 (169)     0xA9           0xAE
  247. 0xAA (170)     0xAA           0xAC
  248. 0xAB (171)     0xAB           0xBD
  249. 0xAC (172)     0xAC           0xBC
  250. 0xAD (173)     0xAD           0xA1
  251. 0xAE (174)     0xAE           0xAB
  252. 0xAF (175)     0xAF           0xBB
  253. 0xB0 (176)     0xB0           0x91 0x25
  254. 0xB1 (177)     0xB1           0x92 0x25
  255. 0xB2 (178)     0xB2           0x93 0x25
  256. 0xB3 (179)     0xB3           0x02 0x25
  257. 0xB4 (180)     0xB4           0x24 0x25
  258. 0xB5 (181)     0xB5           0xC1
  259. 0xB6 (182)     0xB6           0xC2
  260. 0xB7 (183)     0xB7           0xC0
  261. 0xB8 (184)     0xB8           0xA9
  262. 0xB9 (185)     0xB9           0x63 0x25
  263. 0xBA (186)     0xBA           0x51 0x25
  264. 0xBB (187)     0xBB           0x57 0x25
  265. 0xBC (188)     0xBC           0x5D 0x25
  266. 0xBD (189)     0xBD           0xA2
  267. 0xBE (190)     0xBE           0xA5
  268. 0xBF (191)     0xBF           0x10 0x25
  269. 0xC0 (192)     0xC0           0x14 0x25
  270. 0xC1 (193)     0xC1           0x34 0x25
  271. 0xC2 (194)     0xC2           0x2C 0x25
  272. 0xC3 (195)     0xC3           0x1C 0x25
  273. 0xC4 (196)     0xC4           0x00 0x25
  274. 0xC5 (197)     0xC5           0x3C 0x25
  275. 0xC6 (198)     0xC7           0xE3                     E
  276. 0xC7 (199)     0xC7           0xC3
  277. 0xC8 (200)     0xC8           0x5A 0x25                E
  278. 0xC9 (201)     0xC9           0x54 0x25                E
  279. 0xCA (202)     0xCA           0x69 0x25                E
  280. 0xCB (203)     0xCB           0x66 0x25                E
  281. 0xCC (204)     0xCC           0x60 0x25                E
  282. 0xCD (205)     0xCD           0x50 0x25                E
  283. 0xCE (206)     0xCE           0x6C 0x25                E
  284. 0xCF (207)     0xCF           0xA4                     E
  285. 0xD0 (208)     0xD1           0xF0
  286. 0xD1 (209)     0xD1           0xD0
  287. 0xD2 (210)     0xD2           0xCA
  288. 0xD3 (211)     0xD3           0xCB
  289. 0xD4 (212)     0xD4           0xC8
  290. 0xD5 (213)     0x49           0x31 0x01
  291. 0xD6 (214)     0xD6           0xCD
  292. 0xD7 (215)     0xD7           0xCE
  293. 0xD8 (216)     0xD8           0xCF
  294. 0xD9 (217)     0xD9           0x18 0x25
  295. 0xDA (218)     0xDA           0x0C 0x25
  296. 0xDB (219)     0xDB           0x88 0x25
  297. 0xDC (220)     0xDC           0x84 0x25
  298. 0xDD (221)     0xDD           0xA6
  299. 0xDE (222)     0xDE           0xCC
  300. 0xDF (223)     0xDF           0x80 0x25
  301. 0xE0 (224)     0xE0           0xD3
  302. 0xE1 (225)     0xE1           0xDF
  303. 0xE2 (226)     0xE2           0xD4
  304. 0xE3 (227)     0xE3           0xD2
  305. 0xE4 (228)     0x05           0xF5
  306. 0xE5 (229)     0x05           0xD5
  307. 0xE6 (230)     0xE6           0xB5
  308. 0xE7 (231)     0xE8           0xFE
  309. 0xE8 (232)     0xE8           0xDE
  310. 0xE9 (233)     0xE9           0xDA
  311. 0xEA (234)     0xEA           0xDB
  312. 0xEB (235)     0xEB           0xD9
  313. 0xEC (236)     0xED           0xFD
  314. 0xED (237)     0xED           0xDD
  315. 0xEE (238)     0xEE           0xAF
  316. 0xEF (239)     0xEF           0xB4
  317. 0xF0 (240)     0xF0           0xAD
  318. 0xF1 (241)     0xF1           0xB1
  319. 0xF2 (242)     0xF2           0x17 0x20
  320. 0xF3 (243)     0xF3           0xBE
  321. 0xF4 (244)     0xF4           0xB6
  322. 0xF5 (245)     0xF5           0xA7
  323. 0xF6 (246)     0xF6           0xF7
  324. 0xF7 (247)     0xF7           0xB8
  325. 0xF8 (248)     0xF8           0xB0
  326. 0xF9 (249)     0xF9           0xA8
  327. 0xFA (250)     0xFA           0xB7
  328. 0xFB (251)     0xFB           0xB9
  329. 0xFC (252)     0xFC           0xB3
  330. 0xFD (253)     0xFD           0xB2
  331. 0xFE (254)     0xFE           0xA0 0x25
  332. 0xFF (255)     0xFF           0xA0
  333.  
  334.  
  335. Page 0
  336. 0x80 (128)     0x00
  337. 0x81 (129)     0x00
  338. 0x82 (130)     0x00
  339. 0x83 (131)     0x00
  340. 0x84 (132)     0x00
  341. 0x85 (133)     0x00
  342. 0x86 (134)     0x00
  343. 0x87 (135)     0x00
  344. 0x88 (136)     0x00
  345. 0x89 (137)     0x00
  346. 0x8A (138)     0x00
  347. 0x8B (139)     0x00
  348. 0x8C (140)     0x00
  349. 0x8D (141)     0x00
  350. 0x8E (142)     0x00
  351. 0x8F (143)     0x00
  352. 0x90 (144)     0x00
  353. 0x91 (145)     0x00
  354. 0x92 (146)     0x00
  355. 0x93 (147)     0x00
  356. 0x94 (148)     0x00
  357. 0x95 (149)     0x00
  358. 0x96 (150)     0x00
  359. 0x97 (151)     0x00
  360. 0x98 (152)     0x00
  361. 0x99 (153)     0x00
  362. 0x9A (154)     0x00
  363. 0x9B (155)     0x00
  364. 0x9C (156)     0x00
  365. 0x9D (157)     0x00
  366. 0x9E (158)     0x00
  367. 0x9F (159)     0x92
  368. 0xA0 (160)     0xFF
  369. 0xA1 (161)     0xAD
  370. 0xA2 (162)     0xBD
  371. 0xA3 (163)     0x9C
  372. 0xA4 (164)     0xCF
  373. 0xA5 (165)     0xBE
  374. 0xA6 (166)     0xDD
  375. 0xA7 (167)     0xF5
  376. 0xA8 (168)     0xF9
  377. 0xA9 (169)     0xB8
  378. 0xAA (170)     0x00
  379. 0xAB (171)     0xAE
  380. 0xAC (172)     0xAA
  381. 0xAD (173)     0xF0
  382. 0xAE (174)     0x00
  383. 0xAF (175)     0xEE
  384. 0xB0 (176)     0xF8
  385. 0xB1 (177)     0xF1
  386. 0xB2 (178)     0xFD
  387. 0xB3 (179)     0xFC
  388. 0xB4 (180)     0xEF
  389. 0xB5 (181)     0xE6
  390. 0xB6 (182)     0xF4
  391. 0xB7 (183)     0xFA
  392. 0xB8 (184)     0xF7
  393. 0xB9 (185)     0xFB
  394. 0xBA (186)     0x00
  395. 0xBB (187)     0xAF
  396. 0xBC (188)     0xAC
  397. 0xBD (189)     0xAB
  398. 0xBE (190)     0xF3
  399. 0xBF (191)     0x00
  400. 0xC0 (192)     0xB7
  401. 0xC1 (193)     0xB5
  402. 0xC2 (194)     0xB6
  403. 0xC3 (195)     0xC7
  404. 0xC4 (196)     0x8E
  405. 0xC5 (197)     0x8F
  406. 0xC6 (198)     0x92
  407. 0xC7 (199)     0x80
  408. 0xC8 (200)     0xD4
  409. 0xC9 (201)     0x90
  410. 0xCA (202)     0xD2
  411. 0xCB (203)     0xD3
  412. 0xCC (204)     0xDE
  413. 0xCD (205)     0xD6
  414. 0xCE (206)     0xD7
  415. 0xCF (207)     0xD8
  416. 0xD0 (208)     0x00
  417. 0xD1 (209)     0xA5
  418. 0xD2 (210)     0xE3
  419. 0xD3 (211)     0xE0
  420. 0xD4 (212)     0xE2
  421. 0xD5 (213)     0xE5
  422. 0xD6 (214)     0x99
  423. 0xD7 (215)     0x9E
  424. 0xD8 (216)     0x9D
  425. 0xD9 (217)     0xEB
  426. 0xDA (218)     0xE9
  427. 0xDB (219)     0xEA
  428. 0xDC (220)     0x9A
  429. 0xDD (221)     0xED
  430. 0xDE (222)     0xE8
  431. 0xDF (223)     0xE1
  432. 0xE0 (224)     0x85, 0xA1
  433. 0xE1 (225)     0xA0
  434. 0xE2 (226)     0x83
  435. 0xE3 (227)     0xC6
  436. 0xE4 (228)     0x84
  437. 0xE5 (229)     0x86
  438. 0xE6 (230)     0x91
  439. 0xE7 (231)     0x87
  440. 0xE8 (232)     0x8A
  441. 0xE9 (233)     0x82
  442. 0xEA (234)     0x88
  443. 0xEB (235)     0x89
  444. 0xEC (236)     0x8D
  445. 0xED (237)     0x00
  446. 0xEE (238)     0x8C
  447. 0xEF (239)     0x8B
  448. 0xF0 (240)     0xD0
  449. 0xF1 (241)     0xA4
  450. 0xF2 (242)     0x95
  451. 0xF3 (243)     0xA2
  452. 0xF4 (244)     0x93
  453. 0xF5 (245)     0xE4
  454. 0xF6 (246)     0x94
  455. 0xF7 (247)     0xF6
  456. 0xF8 (248)     0x9B
  457. 0xF9 (249)     0x97
  458. 0xFA (250)     0xA3
  459. 0xFB (251)     0x96
  460. 0xFC (252)     0x81
  461. 0xFD (253)     0xEC
  462. 0xFE (254)     0xE7
  463. 0xFF (255)     0x98
  464.  
  465.