super.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. /* Block- or MTD-based romfs
  2. *
  3. * Copyright © 2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * Derived from: ROMFS file system, Linux implementation
  7. *
  8. * Copyright © 1997-1999 Janos Farkas <chexum@shadow.banki.hu>
  9. *
  10. * Using parts of the minix filesystem
  11. * Copyright © 1991, 1992 Linus Torvalds
  12. *
  13. * and parts of the affs filesystem additionally
  14. * Copyright © 1993 Ray Burr
  15. * Copyright © 1996 Hans-Joachim Widmaier
  16. *
  17. * Changes
  18. * Changed for 2.1.19 modules
  19. * Jan 1997 Initial release
  20. * Jun 1997 2.1.43+ changes
  21. * Proper page locking in read_folio
  22. * Changed to work with 2.1.45+ fs
  23. * Jul 1997 Fixed follow_link
  24. * 2.1.47
  25. * lookup shouldn't return -ENOENT
  26. * from Horst von Brand:
  27. * fail on wrong checksum
  28. * double unlock_super was possible
  29. * correct namelen for statfs
  30. * spotted by Bill Hawes:
  31. * readlink shouldn't iput()
  32. * Jun 1998 2.1.106 from Avery Pennarun: glibc scandir()
  33. * exposed a problem in readdir
  34. * 2.1.107 code-freeze spellchecker run
  35. * Aug 1998 2.1.118+ VFS changes
  36. * Sep 1998 2.1.122 another VFS change (follow_link)
  37. * Apr 1999 2.2.7 no more EBADF checking in
  38. * lookup/readdir, use ERR_PTR
  39. * Jun 1999 2.3.6 d_alloc_root use changed
  40. * 2.3.9 clean up usage of ENOENT/negative
  41. * dentries in lookup
  42. * clean up page flags setting
  43. * (error, uptodate, locking) in
  44. * in read_folio
  45. * use init_special_inode for
  46. * fifos/sockets (and streamline) in
  47. * read_inode, fix _ops table order
  48. * Aug 1999 2.3.16 __initfunc() => __init change
  49. * Oct 1999 2.3.24 page->owner hack obsoleted
  50. * Nov 1999 2.3.27 2.3.25+ page->offset => index change
  51. *
  52. *
  53. * This program is free software; you can redistribute it and/or
  54. * modify it under the terms of the GNU General Public Licence
  55. * as published by the Free Software Foundation; either version
  56. * 2 of the Licence, or (at your option) any later version.
  57. */
  58. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  59. #include <linux/module.h>
  60. #include <linux/string.h>
  61. #include <linux/fs.h>
  62. #include <linux/time.h>
  63. #include <linux/slab.h>
  64. #include <linux/init.h>
  65. #include <linux/blkdev.h>
  66. #include <linux/fs_context.h>
  67. #include <linux/mount.h>
  68. #include <linux/namei.h>
  69. #include <linux/statfs.h>
  70. #include <linux/mtd/super.h>
  71. #include <linux/ctype.h>
  72. #include <linux/highmem.h>
  73. #include <linux/pagemap.h>
  74. #include <linux/uaccess.h>
  75. #include <linux/major.h>
  76. #include "internal.h"
  77. static struct kmem_cache *romfs_inode_cachep;
  78. static const umode_t romfs_modemap[8] = {
  79. 0, /* hard link */
  80. S_IFDIR | 0644, /* directory */
  81. S_IFREG | 0644, /* regular file */
  82. S_IFLNK | 0777, /* symlink */
  83. S_IFBLK | 0600, /* blockdev */
  84. S_IFCHR | 0600, /* chardev */
  85. S_IFSOCK | 0644, /* socket */
  86. S_IFIFO | 0644 /* FIFO */
  87. };
  88. static const unsigned char romfs_dtype_table[] = {
  89. DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_SOCK, DT_FIFO
  90. };
  91. static struct inode *romfs_iget(struct super_block *sb, unsigned long pos);
  92. /*
  93. * read a page worth of data from the image
  94. */
  95. static int romfs_read_folio(struct file *file, struct folio *folio)
  96. {
  97. struct inode *inode = folio->mapping->host;
  98. loff_t offset, size;
  99. unsigned long fillsize, pos;
  100. void *buf;
  101. int ret;
  102. buf = kmap_local_folio(folio, 0);
  103. offset = folio_pos(folio);
  104. size = i_size_read(inode);
  105. fillsize = 0;
  106. ret = 0;
  107. if (offset < size) {
  108. size -= offset;
  109. fillsize = size > PAGE_SIZE ? PAGE_SIZE : size;
  110. pos = ROMFS_I(inode)->i_dataoffset + offset;
  111. ret = romfs_dev_read(inode->i_sb, pos, buf, fillsize);
  112. if (ret < 0) {
  113. fillsize = 0;
  114. ret = -EIO;
  115. }
  116. }
  117. buf = folio_zero_tail(folio, fillsize, buf + fillsize);
  118. kunmap_local(buf);
  119. folio_end_read(folio, ret == 0);
  120. return ret;
  121. }
  122. static const struct address_space_operations romfs_aops = {
  123. .read_folio = romfs_read_folio
  124. };
  125. /*
  126. * read the entries from a directory
  127. */
  128. static int romfs_readdir(struct file *file, struct dir_context *ctx)
  129. {
  130. struct inode *i = file_inode(file);
  131. struct romfs_inode ri;
  132. unsigned long offset, maxoff;
  133. int j, ino, nextfh;
  134. char fsname[ROMFS_MAXFN]; /* XXX dynamic? */
  135. int ret;
  136. maxoff = romfs_maxsize(i->i_sb);
  137. offset = ctx->pos;
  138. if (!offset) {
  139. offset = i->i_ino & ROMFH_MASK;
  140. ret = romfs_dev_read(i->i_sb, offset, &ri, ROMFH_SIZE);
  141. if (ret < 0)
  142. goto out;
  143. offset = be32_to_cpu(ri.spec) & ROMFH_MASK;
  144. }
  145. /* Not really failsafe, but we are read-only... */
  146. for (;;) {
  147. if (!offset || offset >= maxoff) {
  148. offset = maxoff;
  149. ctx->pos = offset;
  150. goto out;
  151. }
  152. ctx->pos = offset;
  153. /* Fetch inode info */
  154. ret = romfs_dev_read(i->i_sb, offset, &ri, ROMFH_SIZE);
  155. if (ret < 0)
  156. goto out;
  157. j = romfs_dev_strnlen(i->i_sb, offset + ROMFH_SIZE,
  158. sizeof(fsname) - 1);
  159. if (j < 0)
  160. goto out;
  161. ret = romfs_dev_read(i->i_sb, offset + ROMFH_SIZE, fsname, j);
  162. if (ret < 0)
  163. goto out;
  164. fsname[j] = '\0';
  165. ino = offset;
  166. nextfh = be32_to_cpu(ri.next);
  167. if ((nextfh & ROMFH_TYPE) == ROMFH_HRD)
  168. ino = be32_to_cpu(ri.spec);
  169. if (!dir_emit(ctx, fsname, j, ino,
  170. romfs_dtype_table[nextfh & ROMFH_TYPE]))
  171. goto out;
  172. offset = nextfh & ROMFH_MASK;
  173. }
  174. out:
  175. return 0;
  176. }
  177. /*
  178. * look up an entry in a directory
  179. */
  180. static struct dentry *romfs_lookup(struct inode *dir, struct dentry *dentry,
  181. unsigned int flags)
  182. {
  183. unsigned long offset, maxoff;
  184. struct inode *inode = NULL;
  185. struct romfs_inode ri;
  186. const char *name; /* got from dentry */
  187. int len, ret;
  188. offset = dir->i_ino & ROMFH_MASK;
  189. ret = romfs_dev_read(dir->i_sb, offset, &ri, ROMFH_SIZE);
  190. if (ret < 0)
  191. goto error;
  192. /* search all the file entries in the list starting from the one
  193. * pointed to by the directory's special data */
  194. maxoff = romfs_maxsize(dir->i_sb);
  195. offset = be32_to_cpu(ri.spec) & ROMFH_MASK;
  196. name = dentry->d_name.name;
  197. len = dentry->d_name.len;
  198. for (;;) {
  199. if (!offset || offset >= maxoff)
  200. break;
  201. ret = romfs_dev_read(dir->i_sb, offset, &ri, sizeof(ri));
  202. if (ret < 0)
  203. goto error;
  204. /* try to match the first 16 bytes of name */
  205. ret = romfs_dev_strcmp(dir->i_sb, offset + ROMFH_SIZE, name,
  206. len);
  207. if (ret < 0)
  208. goto error;
  209. if (ret == 1) {
  210. /* Hard link handling */
  211. if ((be32_to_cpu(ri.next) & ROMFH_TYPE) == ROMFH_HRD)
  212. offset = be32_to_cpu(ri.spec) & ROMFH_MASK;
  213. inode = romfs_iget(dir->i_sb, offset);
  214. break;
  215. }
  216. /* next entry */
  217. offset = be32_to_cpu(ri.next) & ROMFH_MASK;
  218. }
  219. return d_splice_alias(inode, dentry);
  220. error:
  221. return ERR_PTR(ret);
  222. }
  223. static const struct file_operations romfs_dir_operations = {
  224. .read = generic_read_dir,
  225. .iterate_shared = romfs_readdir,
  226. .llseek = generic_file_llseek,
  227. };
  228. static const struct inode_operations romfs_dir_inode_operations = {
  229. .lookup = romfs_lookup,
  230. };
  231. /*
  232. * get a romfs inode based on its position in the image (which doubles as the
  233. * inode number)
  234. */
  235. static struct inode *romfs_iget(struct super_block *sb, unsigned long pos)
  236. {
  237. struct romfs_inode_info *inode;
  238. struct romfs_inode ri;
  239. struct inode *i;
  240. unsigned long nlen;
  241. unsigned nextfh;
  242. int ret;
  243. umode_t mode;
  244. /* we might have to traverse a chain of "hard link" file entries to get
  245. * to the actual file */
  246. for (;;) {
  247. ret = romfs_dev_read(sb, pos, &ri, sizeof(ri));
  248. if (ret < 0)
  249. goto error;
  250. /* XXX: do romfs_checksum here too (with name) */
  251. nextfh = be32_to_cpu(ri.next);
  252. if ((nextfh & ROMFH_TYPE) != ROMFH_HRD)
  253. break;
  254. pos = be32_to_cpu(ri.spec) & ROMFH_MASK;
  255. }
  256. /* determine the length of the filename */
  257. nlen = romfs_dev_strnlen(sb, pos + ROMFH_SIZE, ROMFS_MAXFN);
  258. if (IS_ERR_VALUE(nlen))
  259. goto eio;
  260. /* get an inode for this image position */
  261. i = iget_locked(sb, pos);
  262. if (!i)
  263. return ERR_PTR(-ENOMEM);
  264. if (!(i->i_state & I_NEW))
  265. return i;
  266. /* precalculate the data offset */
  267. inode = ROMFS_I(i);
  268. inode->i_metasize = (ROMFH_SIZE + nlen + 1 + ROMFH_PAD) & ROMFH_MASK;
  269. inode->i_dataoffset = pos + inode->i_metasize;
  270. set_nlink(i, 1); /* Hard to decide.. */
  271. i->i_size = be32_to_cpu(ri.size);
  272. inode_set_mtime_to_ts(i,
  273. inode_set_atime_to_ts(i, inode_set_ctime(i, 0, 0)));
  274. /* set up mode and ops */
  275. mode = romfs_modemap[nextfh & ROMFH_TYPE];
  276. switch (nextfh & ROMFH_TYPE) {
  277. case ROMFH_DIR:
  278. i->i_size = ROMFS_I(i)->i_metasize;
  279. i->i_op = &romfs_dir_inode_operations;
  280. i->i_fop = &romfs_dir_operations;
  281. if (nextfh & ROMFH_EXEC)
  282. mode |= S_IXUGO;
  283. break;
  284. case ROMFH_REG:
  285. i->i_fop = &romfs_ro_fops;
  286. i->i_data.a_ops = &romfs_aops;
  287. if (nextfh & ROMFH_EXEC)
  288. mode |= S_IXUGO;
  289. break;
  290. case ROMFH_SYM:
  291. i->i_op = &page_symlink_inode_operations;
  292. inode_nohighmem(i);
  293. i->i_data.a_ops = &romfs_aops;
  294. mode |= S_IRWXUGO;
  295. break;
  296. default:
  297. /* depending on MBZ for sock/fifos */
  298. nextfh = be32_to_cpu(ri.spec);
  299. init_special_inode(i, mode, MKDEV(nextfh >> 16,
  300. nextfh & 0xffff));
  301. break;
  302. }
  303. i->i_mode = mode;
  304. i->i_blocks = (i->i_size + 511) >> 9;
  305. unlock_new_inode(i);
  306. return i;
  307. eio:
  308. ret = -EIO;
  309. error:
  310. pr_err("read error for inode 0x%lx\n", pos);
  311. return ERR_PTR(ret);
  312. }
  313. /*
  314. * allocate a new inode
  315. */
  316. static struct inode *romfs_alloc_inode(struct super_block *sb)
  317. {
  318. struct romfs_inode_info *inode;
  319. inode = alloc_inode_sb(sb, romfs_inode_cachep, GFP_KERNEL);
  320. return inode ? &inode->vfs_inode : NULL;
  321. }
  322. /*
  323. * return a spent inode to the slab cache
  324. */
  325. static void romfs_free_inode(struct inode *inode)
  326. {
  327. kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode));
  328. }
  329. /*
  330. * get filesystem statistics
  331. */
  332. static int romfs_statfs(struct dentry *dentry, struct kstatfs *buf)
  333. {
  334. struct super_block *sb = dentry->d_sb;
  335. u64 id = 0;
  336. /* When calling huge_encode_dev(),
  337. * use sb->s_bdev->bd_dev when,
  338. * - CONFIG_ROMFS_ON_BLOCK defined
  339. * use sb->s_dev when,
  340. * - CONFIG_ROMFS_ON_BLOCK undefined and
  341. * - CONFIG_ROMFS_ON_MTD defined
  342. * leave id as 0 when,
  343. * - CONFIG_ROMFS_ON_BLOCK undefined and
  344. * - CONFIG_ROMFS_ON_MTD undefined
  345. */
  346. if (sb->s_bdev)
  347. id = huge_encode_dev(sb->s_bdev->bd_dev);
  348. else if (sb->s_dev)
  349. id = huge_encode_dev(sb->s_dev);
  350. buf->f_type = ROMFS_MAGIC;
  351. buf->f_namelen = ROMFS_MAXFN;
  352. buf->f_bsize = ROMBSIZE;
  353. buf->f_bfree = buf->f_bavail = buf->f_ffree;
  354. buf->f_blocks =
  355. (romfs_maxsize(dentry->d_sb) + ROMBSIZE - 1) >> ROMBSBITS;
  356. buf->f_fsid = u64_to_fsid(id);
  357. return 0;
  358. }
  359. /*
  360. * remounting must involve read-only
  361. */
  362. static int romfs_reconfigure(struct fs_context *fc)
  363. {
  364. sync_filesystem(fc->root->d_sb);
  365. fc->sb_flags |= SB_RDONLY;
  366. return 0;
  367. }
  368. static const struct super_operations romfs_super_ops = {
  369. .alloc_inode = romfs_alloc_inode,
  370. .free_inode = romfs_free_inode,
  371. .statfs = romfs_statfs,
  372. };
  373. /*
  374. * checksum check on part of a romfs filesystem
  375. */
  376. static __u32 romfs_checksum(const void *data, int size)
  377. {
  378. const __be32 *ptr = data;
  379. __u32 sum;
  380. sum = 0;
  381. size >>= 2;
  382. while (size > 0) {
  383. sum += be32_to_cpu(*ptr++);
  384. size--;
  385. }
  386. return sum;
  387. }
  388. /*
  389. * fill in the superblock
  390. */
  391. static int romfs_fill_super(struct super_block *sb, struct fs_context *fc)
  392. {
  393. struct romfs_super_block *rsb;
  394. struct inode *root;
  395. unsigned long pos, img_size;
  396. const char *storage;
  397. size_t len;
  398. int ret;
  399. #ifdef CONFIG_BLOCK
  400. if (!sb->s_mtd) {
  401. sb_set_blocksize(sb, ROMBSIZE);
  402. } else {
  403. sb->s_blocksize = ROMBSIZE;
  404. sb->s_blocksize_bits = blksize_bits(ROMBSIZE);
  405. }
  406. #endif
  407. sb->s_maxbytes = 0xFFFFFFFF;
  408. sb->s_magic = ROMFS_MAGIC;
  409. sb->s_flags |= SB_RDONLY | SB_NOATIME;
  410. sb->s_time_min = 0;
  411. sb->s_time_max = 0;
  412. sb->s_op = &romfs_super_ops;
  413. #ifdef CONFIG_ROMFS_ON_MTD
  414. /* Use same dev ID from the underlying mtdblock device */
  415. if (sb->s_mtd)
  416. sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, sb->s_mtd->index);
  417. #endif
  418. /* read the image superblock and check it */
  419. rsb = kmalloc(512, GFP_KERNEL);
  420. if (!rsb)
  421. return -ENOMEM;
  422. sb->s_fs_info = (void *) 512;
  423. ret = romfs_dev_read(sb, 0, rsb, 512);
  424. if (ret < 0)
  425. goto error_rsb;
  426. img_size = be32_to_cpu(rsb->size);
  427. if (sb->s_mtd && img_size > sb->s_mtd->size)
  428. goto error_rsb_inval;
  429. sb->s_fs_info = (void *) img_size;
  430. if (rsb->word0 != ROMSB_WORD0 || rsb->word1 != ROMSB_WORD1 ||
  431. img_size < ROMFH_SIZE) {
  432. if (!(fc->sb_flags & SB_SILENT))
  433. errorf(fc, "VFS: Can't find a romfs filesystem on dev %s.\n",
  434. sb->s_id);
  435. goto error_rsb_inval;
  436. }
  437. if (romfs_checksum(rsb, min_t(size_t, img_size, 512))) {
  438. pr_err("bad initial checksum on dev %s.\n", sb->s_id);
  439. goto error_rsb_inval;
  440. }
  441. storage = sb->s_mtd ? "MTD" : "the block layer";
  442. len = strnlen(rsb->name, ROMFS_MAXFN);
  443. if (!(fc->sb_flags & SB_SILENT))
  444. pr_notice("Mounting image '%*.*s' through %s\n",
  445. (unsigned) len, (unsigned) len, rsb->name, storage);
  446. kfree(rsb);
  447. rsb = NULL;
  448. /* find the root directory */
  449. pos = (ROMFH_SIZE + len + 1 + ROMFH_PAD) & ROMFH_MASK;
  450. root = romfs_iget(sb, pos);
  451. if (IS_ERR(root))
  452. return PTR_ERR(root);
  453. sb->s_root = d_make_root(root);
  454. if (!sb->s_root)
  455. return -ENOMEM;
  456. return 0;
  457. error_rsb_inval:
  458. ret = -EINVAL;
  459. error_rsb:
  460. kfree(rsb);
  461. return ret;
  462. }
  463. /*
  464. * get a superblock for mounting
  465. */
  466. static int romfs_get_tree(struct fs_context *fc)
  467. {
  468. int ret = -EINVAL;
  469. #ifdef CONFIG_ROMFS_ON_MTD
  470. ret = get_tree_mtd(fc, romfs_fill_super);
  471. #endif
  472. #ifdef CONFIG_ROMFS_ON_BLOCK
  473. if (ret == -EINVAL)
  474. ret = get_tree_bdev(fc, romfs_fill_super);
  475. #endif
  476. return ret;
  477. }
  478. static const struct fs_context_operations romfs_context_ops = {
  479. .get_tree = romfs_get_tree,
  480. .reconfigure = romfs_reconfigure,
  481. };
  482. /*
  483. * Set up the filesystem mount context.
  484. */
  485. static int romfs_init_fs_context(struct fs_context *fc)
  486. {
  487. fc->ops = &romfs_context_ops;
  488. return 0;
  489. }
  490. /*
  491. * destroy a romfs superblock in the appropriate manner
  492. */
  493. static void romfs_kill_sb(struct super_block *sb)
  494. {
  495. generic_shutdown_super(sb);
  496. #ifdef CONFIG_ROMFS_ON_MTD
  497. if (sb->s_mtd) {
  498. put_mtd_device(sb->s_mtd);
  499. sb->s_mtd = NULL;
  500. }
  501. #endif
  502. #ifdef CONFIG_ROMFS_ON_BLOCK
  503. if (sb->s_bdev) {
  504. sync_blockdev(sb->s_bdev);
  505. bdev_fput(sb->s_bdev_file);
  506. }
  507. #endif
  508. }
  509. static struct file_system_type romfs_fs_type = {
  510. .owner = THIS_MODULE,
  511. .name = "romfs",
  512. .init_fs_context = romfs_init_fs_context,
  513. .kill_sb = romfs_kill_sb,
  514. .fs_flags = FS_REQUIRES_DEV,
  515. };
  516. MODULE_ALIAS_FS("romfs");
  517. /*
  518. * inode storage initialiser
  519. */
  520. static void romfs_i_init_once(void *_inode)
  521. {
  522. struct romfs_inode_info *inode = _inode;
  523. inode_init_once(&inode->vfs_inode);
  524. }
  525. /*
  526. * romfs module initialisation
  527. */
  528. static int __init init_romfs_fs(void)
  529. {
  530. int ret;
  531. pr_info("ROMFS MTD (C) 2007 Red Hat, Inc.\n");
  532. romfs_inode_cachep =
  533. kmem_cache_create("romfs_i",
  534. sizeof(struct romfs_inode_info), 0,
  535. SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT,
  536. romfs_i_init_once);
  537. if (!romfs_inode_cachep) {
  538. pr_err("Failed to initialise inode cache\n");
  539. return -ENOMEM;
  540. }
  541. ret = register_filesystem(&romfs_fs_type);
  542. if (ret) {
  543. pr_err("Failed to register filesystem\n");
  544. goto error_register;
  545. }
  546. return 0;
  547. error_register:
  548. kmem_cache_destroy(romfs_inode_cachep);
  549. return ret;
  550. }
  551. /*
  552. * romfs module removal
  553. */
  554. static void __exit exit_romfs_fs(void)
  555. {
  556. unregister_filesystem(&romfs_fs_type);
  557. /*
  558. * Make sure all delayed rcu free inodes are flushed before we
  559. * destroy cache.
  560. */
  561. rcu_barrier();
  562. kmem_cache_destroy(romfs_inode_cachep);
  563. }
  564. module_init(init_romfs_fs);
  565. module_exit(exit_romfs_fs);
  566. MODULE_DESCRIPTION("Direct-MTD Capable RomFS");
  567. MODULE_AUTHOR("Red Hat, Inc.");
  568. MODULE_LICENSE("GPL"); /* Actually dual-licensed, but it doesn't matter for */