1/*
2 *  linux/fs/isofs/inode.c
3 *
4 *  (C) 1991  Linus Torvalds - minix filesystem
5 *      1992, 1993, 1994  Eric Youngdale Modified for ISO 9660 filesystem.
6 *      1994  Eberhard Moenkeberg - multi session handling.
7 *      1995  Mark Dobie - allow mounting of some weird VideoCDs and PhotoCDs.
8 *	1997  Gordon Chaffee - Joliet CDs
9 *	1998  Eric Lammerts - ISO 9660 Level 3
10 *	2004  Paul Serice - Inode Support pushed out from 4GB to 128GB
11 *	2004  Paul Serice - NFS Export Operations
12 */
13
14#include <linux/init.h>
15#include <linux/module.h>
16
17#include <linux/slab.h>
18#include <linux/nls.h>
19#include <linux/ctype.h>
20#include <linux/smp_lock.h>
21#include <linux/statfs.h>
22#include <linux/cdrom.h>
23#include <linux/parser.h>
24
25#include "isofs.h"
26#include "zisofs.h"
27
28#define BEQUIET
29
30static int isofs_hashi(struct dentry *parent, struct qstr *qstr);
31static int isofs_hash(struct dentry *parent, struct qstr *qstr);
32static int isofs_dentry_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b);
33static int isofs_dentry_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b);
34
35#ifdef CONFIG_JOLIET
36static int isofs_hashi_ms(struct dentry *parent, struct qstr *qstr);
37static int isofs_hash_ms(struct dentry *parent, struct qstr *qstr);
38static int isofs_dentry_cmpi_ms(struct dentry *dentry, struct qstr *a, struct qstr *b);
39static int isofs_dentry_cmp_ms(struct dentry *dentry, struct qstr *a, struct qstr *b);
40#endif
41
42static void isofs_put_super(struct super_block *sb)
43{
44	struct isofs_sb_info *sbi = ISOFS_SB(sb);
45#ifdef CONFIG_JOLIET
46	if (sbi->s_nls_iocharset) {
47		unload_nls(sbi->s_nls_iocharset);
48		sbi->s_nls_iocharset = NULL;
49	}
50#endif
51
52	kfree(sbi);
53	sb->s_fs_info = NULL;
54	return;
55}
56
57static void isofs_read_inode(struct inode *);
58static int isofs_statfs (struct dentry *, struct kstatfs *);
59
60static struct kmem_cache *isofs_inode_cachep;
61
62static struct inode *isofs_alloc_inode(struct super_block *sb)
63{
64	struct iso_inode_info *ei;
65	ei = kmem_cache_alloc(isofs_inode_cachep, GFP_KERNEL);
66	if (!ei)
67		return NULL;
68	return &ei->vfs_inode;
69}
70
71static void isofs_destroy_inode(struct inode *inode)
72{
73	kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
74}
75
76static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags)
77{
78	struct iso_inode_info *ei = foo;
79
80	inode_init_once(&ei->vfs_inode);
81}
82
83static int init_inodecache(void)
84{
85	isofs_inode_cachep = kmem_cache_create("isofs_inode_cache",
86					     sizeof(struct iso_inode_info),
87					     0, (SLAB_RECLAIM_ACCOUNT|
88						SLAB_MEM_SPREAD),
89					     init_once, NULL);
90	if (isofs_inode_cachep == NULL)
91		return -ENOMEM;
92	return 0;
93}
94
95static void destroy_inodecache(void)
96{
97	kmem_cache_destroy(isofs_inode_cachep);
98}
99
100static int isofs_remount(struct super_block *sb, int *flags, char *data)
101{
102	/* we probably want a lot more here */
103	*flags |= MS_RDONLY;
104	return 0;
105}
106
107static const struct super_operations isofs_sops = {
108	.alloc_inode	= isofs_alloc_inode,
109	.destroy_inode	= isofs_destroy_inode,
110	.read_inode	= isofs_read_inode,
111	.put_super	= isofs_put_super,
112	.statfs		= isofs_statfs,
113	.remount_fs	= isofs_remount,
114};
115
116
117static struct dentry_operations isofs_dentry_ops[] = {
118	{
119		.d_hash		= isofs_hash,
120		.d_compare	= isofs_dentry_cmp,
121	},
122	{
123		.d_hash		= isofs_hashi,
124		.d_compare	= isofs_dentry_cmpi,
125	},
126#ifdef CONFIG_JOLIET
127	{
128		.d_hash		= isofs_hash_ms,
129		.d_compare	= isofs_dentry_cmp_ms,
130	},
131	{
132		.d_hash		= isofs_hashi_ms,
133		.d_compare	= isofs_dentry_cmpi_ms,
134	},
135#endif
136};
137
138struct iso9660_options{
139	char map;
140	char rock;
141	char joliet;
142	char cruft;
143	char hide;
144	char showassoc;
145	char nocompress;
146	unsigned char check;
147	unsigned int blocksize;
148	mode_t mode;
149	gid_t gid;
150	uid_t uid;
151	char *iocharset;
152	unsigned char utf8;
153        /* LVE */
154        s32 session;
155        s32 sbsector;
156};
157
158/*
159 * Compute the hash for the isofs name corresponding to the dentry.
160 */
161static int
162isofs_hash_common(struct dentry *dentry, struct qstr *qstr, int ms)
163{
164	const char *name;
165	int len;
166
167	len = qstr->len;
168	name = qstr->name;
169	if (ms) {
170		while (len && name[len-1] == '.')
171			len--;
172	}
173
174	qstr->hash = full_name_hash(name, len);
175
176	return 0;
177}
178
179/*
180 * Compute the hash for the isofs name corresponding to the dentry.
181 */
182static int
183isofs_hashi_common(struct dentry *dentry, struct qstr *qstr, int ms)
184{
185	const char *name;
186	int len;
187	char c;
188	unsigned long hash;
189
190	len = qstr->len;
191	name = qstr->name;
192	if (ms) {
193		while (len && name[len-1] == '.')
194			len--;
195	}
196
197	hash = init_name_hash();
198	while (len--) {
199		c = tolower(*name++);
200		hash = partial_name_hash(tolower(c), hash);
201	}
202	qstr->hash = end_name_hash(hash);
203
204	return 0;
205}
206
207/*
208 * Case insensitive compare of two isofs names.
209 */
210static int isofs_dentry_cmpi_common(struct dentry *dentry, struct qstr *a,
211				struct qstr *b, int ms)
212{
213	int alen, blen;
214
215	/* A filename cannot end in '.' or we treat it like it has none */
216	alen = a->len;
217	blen = b->len;
218	if (ms) {
219		while (alen && a->name[alen-1] == '.')
220			alen--;
221		while (blen && b->name[blen-1] == '.')
222			blen--;
223	}
224	if (alen == blen) {
225		if (strnicmp(a->name, b->name, alen) == 0)
226			return 0;
227	}
228	return 1;
229}
230
231/*
232 * Case sensitive compare of two isofs names.
233 */
234static int isofs_dentry_cmp_common(struct dentry *dentry, struct qstr *a,
235					struct qstr *b, int ms)
236{
237	int alen, blen;
238
239	/* A filename cannot end in '.' or we treat it like it has none */
240	alen = a->len;
241	blen = b->len;
242	if (ms) {
243		while (alen && a->name[alen-1] == '.')
244			alen--;
245		while (blen && b->name[blen-1] == '.')
246			blen--;
247	}
248	if (alen == blen) {
249		if (strncmp(a->name, b->name, alen) == 0)
250			return 0;
251	}
252	return 1;
253}
254
255static int
256isofs_hash(struct dentry *dentry, struct qstr *qstr)
257{
258	return isofs_hash_common(dentry, qstr, 0);
259}
260
261static int
262isofs_hashi(struct dentry *dentry, struct qstr *qstr)
263{
264	return isofs_hashi_common(dentry, qstr, 0);
265}
266
267static int
268isofs_dentry_cmp(struct dentry *dentry,struct qstr *a,struct qstr *b)
269{
270	return isofs_dentry_cmp_common(dentry, a, b, 0);
271}
272
273static int
274isofs_dentry_cmpi(struct dentry *dentry,struct qstr *a,struct qstr *b)
275{
276	return isofs_dentry_cmpi_common(dentry, a, b, 0);
277}
278
279#ifdef CONFIG_JOLIET
280static int
281isofs_hash_ms(struct dentry *dentry, struct qstr *qstr)
282{
283	return isofs_hash_common(dentry, qstr, 1);
284}
285
286static int
287isofs_hashi_ms(struct dentry *dentry, struct qstr *qstr)
288{
289	return isofs_hashi_common(dentry, qstr, 1);
290}
291
292static int
293isofs_dentry_cmp_ms(struct dentry *dentry,struct qstr *a,struct qstr *b)
294{
295	return isofs_dentry_cmp_common(dentry, a, b, 1);
296}
297
298static int
299isofs_dentry_cmpi_ms(struct dentry *dentry,struct qstr *a,struct qstr *b)
300{
301	return isofs_dentry_cmpi_common(dentry, a, b, 1);
302}
303#endif
304
305enum {
306	Opt_block, Opt_check_r, Opt_check_s, Opt_cruft, Opt_gid, Opt_ignore,
307	Opt_iocharset, Opt_map_a, Opt_map_n, Opt_map_o, Opt_mode, Opt_nojoliet,
308	Opt_norock, Opt_sb, Opt_session, Opt_uid, Opt_unhide, Opt_utf8, Opt_err,
309	Opt_nocompress, Opt_hide, Opt_showassoc,
310};
311
312static match_table_t tokens = {
313	{Opt_norock, "norock"},
314	{Opt_nojoliet, "nojoliet"},
315	{Opt_unhide, "unhide"},
316	{Opt_hide, "hide"},
317	{Opt_showassoc, "showassoc"},
318	{Opt_cruft, "cruft"},
319	{Opt_utf8, "utf8"},
320	{Opt_iocharset, "iocharset=%s"},
321	{Opt_map_a, "map=acorn"},
322	{Opt_map_a, "map=a"},
323	{Opt_map_n, "map=normal"},
324	{Opt_map_n, "map=n"},
325	{Opt_map_o, "map=off"},
326	{Opt_map_o, "map=o"},
327	{Opt_session, "session=%u"},
328	{Opt_sb, "sbsector=%u"},
329	{Opt_check_r, "check=relaxed"},
330	{Opt_check_r, "check=r"},
331	{Opt_check_s, "check=strict"},
332	{Opt_check_s, "check=s"},
333	{Opt_uid, "uid=%u"},
334	{Opt_gid, "gid=%u"},
335	{Opt_mode, "mode=%u"},
336	{Opt_block, "block=%u"},
337	{Opt_ignore, "conv=binary"},
338	{Opt_ignore, "conv=b"},
339	{Opt_ignore, "conv=text"},
340	{Opt_ignore, "conv=t"},
341	{Opt_ignore, "conv=mtext"},
342	{Opt_ignore, "conv=m"},
343	{Opt_ignore, "conv=auto"},
344	{Opt_ignore, "conv=a"},
345	{Opt_nocompress, "nocompress"},
346	{Opt_err, NULL}
347};
348
349static int parse_options(char *options, struct iso9660_options *popt)
350{
351	char *p;
352	int option;
353
354	popt->map = 'n';
355	popt->rock = 'y';
356	popt->joliet = 'y';
357	popt->cruft = 'n';
358	popt->hide = 'n';
359	popt->showassoc = 'n';
360	popt->check = 'u';		/* unset */
361	popt->nocompress = 0;
362	popt->blocksize = 1024;
363	popt->mode = S_IRUGO | S_IXUGO; /* r-x for all.  The disc could
364					   be shared with DOS machines so
365					   virtually anything could be
366					   a valid executable. */
367	popt->gid = 0;
368	popt->uid = 0;
369	popt->iocharset = NULL;
370	popt->utf8 = 0;
371	popt->session=-1;
372	popt->sbsector=-1;
373	if (!options)
374		return 1;
375
376	while ((p = strsep(&options, ",")) != NULL) {
377		int token;
378		substring_t args[MAX_OPT_ARGS];
379		unsigned n;
380
381		if (!*p)
382			continue;
383
384		token = match_token(p, tokens, args);
385		switch (token) {
386		case Opt_norock:
387			popt->rock = 'n';
388			break;
389		case Opt_nojoliet:
390			popt->joliet = 'n';
391			break;
392		case Opt_hide:
393			popt->hide = 'y';
394			break;
395		case Opt_unhide:
396		case Opt_showassoc:
397			popt->showassoc = 'y';
398			break;
399		case Opt_cruft:
400			popt->cruft = 'y';
401			break;
402		case Opt_utf8:
403			popt->utf8 = 1;
404			break;
405#ifdef CONFIG_JOLIET
406		case Opt_iocharset:
407			popt->iocharset = match_strdup(&args[0]);
408			break;
409#endif
410		case Opt_map_a:
411			popt->map = 'a';
412			break;
413		case Opt_map_o:
414			popt->map = 'o';
415			break;
416		case Opt_map_n:
417			popt->map = 'n';
418			break;
419		case Opt_session:
420			if (match_int(&args[0], &option))
421				return 0;
422			n = option;
423			if (n > 99)
424				return 0;
425			popt->session = n + 1;
426			break;
427		case Opt_sb:
428			if (match_int(&args[0], &option))
429				return 0;
430			popt->sbsector = option;
431			break;
432		case Opt_check_r:
433			popt->check = 'r';
434			break;
435		case Opt_check_s:
436			popt->check = 's';
437			break;
438		case Opt_ignore:
439			break;
440		case Opt_uid:
441			if (match_int(&args[0], &option))
442				return 0;
443			popt->uid = option;
444			break;
445		case Opt_gid:
446			if (match_int(&args[0], &option))
447				return 0;
448			popt->gid = option;
449			break;
450		case Opt_mode:
451			if (match_int(&args[0], &option))
452				return 0;
453			popt->mode = option;
454			break;
455		case Opt_block:
456			if (match_int(&args[0], &option))
457				return 0;
458			n = option;
459			if (n != 512 && n != 1024 && n != 2048)
460				return 0;
461			popt->blocksize = n;
462			break;
463		case Opt_nocompress:
464			popt->nocompress = 1;
465			break;
466		default:
467			return 0;
468		}
469	}
470	return 1;
471}
472
473/*
474 * look if the driver can tell the multi session redirection value
475 *
476 * don't change this if you don't know what you do, please!
477 * Multisession is legal only with XA disks.
478 * A non-XA disk with more than one volume descriptor may do it right, but
479 * usually is written in a nowhere standardized "multi-partition" manner.
480 * Multisession uses absolute addressing (solely the first frame of the whole
481 * track is #0), multi-partition uses relative addressing (each first frame of
482 * each track is #0), and a track is not a session.
483 *
484 * A broken CDwriter software or drive firmware does not set new standards,
485 * at least not if conflicting with the existing ones.
486 *
487 * emoenke@gwdg.de
488 */
489#define WE_OBEY_THE_WRITTEN_STANDARDS 1
490
491static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
492{
493	struct cdrom_multisession ms_info;
494	unsigned int vol_desc_start;
495	struct block_device *bdev = sb->s_bdev;
496	int i;
497
498	vol_desc_start=0;
499	ms_info.addr_format=CDROM_LBA;
500	if(session >= 0 && session <= 99) {
501		struct cdrom_tocentry Te;
502		Te.cdte_track=session;
503		Te.cdte_format=CDROM_LBA;
504		i = ioctl_by_bdev(bdev, CDROMREADTOCENTRY, (unsigned long) &Te);
505		if (!i) {
506			printk(KERN_DEBUG "Session %d start %d type %d\n",
507			       session, Te.cdte_addr.lba,
508			       Te.cdte_ctrl&CDROM_DATA_TRACK);
509			if ((Te.cdte_ctrl&CDROM_DATA_TRACK) == 4)
510				return Te.cdte_addr.lba;
511		}
512
513		printk(KERN_ERR "Invalid session number or type of track\n");
514	}
515	i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info);
516	if (session > 0)
517		printk(KERN_ERR "Invalid session number\n");
518	if (i==0)
519#if WE_OBEY_THE_WRITTEN_STANDARDS
520        if (ms_info.xa_flag) /* necessary for a valid ms_info.addr */
521#endif
522		vol_desc_start=ms_info.addr.lba;
523	return vol_desc_start;
524}
525
526/*
527 * Initialize the superblock and read the root inode.
528 *
529 * Note: a check_disk_change() has been done immediately prior
530 * to this call, so we don't need to check again.
531 */
532static int isofs_fill_super(struct super_block *s, void *data, int silent)
533{
534	struct buffer_head	      * bh = NULL, *pri_bh = NULL;
535	struct hs_primary_descriptor  * h_pri = NULL;
536	struct iso_primary_descriptor * pri = NULL;
537	struct iso_supplementary_descriptor *sec = NULL;
538	struct iso_directory_record   * rootp;
539	int				joliet_level = 0;
540	int				iso_blknum, block;
541	int				orig_zonesize;
542	int				table;
543	unsigned int			vol_desc_start;
544	unsigned long			first_data_zone;
545	struct inode		      * inode;
546	struct iso9660_options		opt;
547	struct isofs_sb_info	      * sbi;
548
549	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
550	if (!sbi)
551		return -ENOMEM;
552	s->s_fs_info = sbi;
553
554	if (!parse_options((char *)data, &opt))
555		goto out_freesbi;
556
557	/*
558	 * First of all, get the hardware blocksize for this device.
559	 * If we don't know what it is, or the hardware blocksize is
560	 * larger than the blocksize the user specified, then use
561	 * that value.
562	 */
563	/*
564	 * What if bugger tells us to go beyond page size?
565	 */
566	opt.blocksize = sb_min_blocksize(s, opt.blocksize);
567
568	sbi->s_high_sierra = 0; /* default is iso9660 */
569
570	vol_desc_start = (opt.sbsector != -1) ?
571		opt.sbsector : isofs_get_last_session(s,opt.session);
572
573  	for (iso_blknum = vol_desc_start+16;
574             iso_blknum < vol_desc_start+100; iso_blknum++)
575	{
576	    struct hs_volume_descriptor   * hdp;
577	    struct iso_volume_descriptor  * vdp;
578
579	    block = iso_blknum << (ISOFS_BLOCK_BITS - s->s_blocksize_bits);
580	    if (!(bh = sb_bread(s, block)))
581		goto out_no_read;
582
583	    vdp = (struct iso_volume_descriptor *)bh->b_data;
584	    hdp = (struct hs_volume_descriptor *)bh->b_data;
585
586	    /* Due to the overlapping physical location of the descriptors,
587	     * ISO CDs can match hdp->id==HS_STANDARD_ID as well. To ensure
588	     * proper identification in this case, we first check for ISO.
589	     */
590	    if (strncmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) == 0) {
591		if (isonum_711 (vdp->type) == ISO_VD_END)
592		    break;
593		if (isonum_711 (vdp->type) == ISO_VD_PRIMARY) {
594		    if (pri == NULL) {
595			pri = (struct iso_primary_descriptor *)vdp;
596			/* Save the buffer in case we need it ... */
597			pri_bh = bh;
598			bh = NULL;
599		    }
600		}
601#ifdef CONFIG_JOLIET
602		else if (isonum_711 (vdp->type) == ISO_VD_SUPPLEMENTARY) {
603		    sec = (struct iso_supplementary_descriptor *)vdp;
604		    if (sec->escape[0] == 0x25 && sec->escape[1] == 0x2f) {
605			if (opt.joliet == 'y') {
606			    if (sec->escape[2] == 0x40) {
607				joliet_level = 1;
608			    } else if (sec->escape[2] == 0x43) {
609				joliet_level = 2;
610			    } else if (sec->escape[2] == 0x45) {
611				joliet_level = 3;
612			    }
613			    printk(KERN_DEBUG"ISO 9660 Extensions: Microsoft Joliet Level %d\n",
614				   joliet_level);
615			}
616			goto root_found;
617		    } else {
618			/* Unknown supplementary volume descriptor */
619			sec = NULL;
620		    }
621		}
622#endif
623	    } else {
624	        if (strncmp (hdp->id, HS_STANDARD_ID, sizeof hdp->id) == 0) {
625		    if (isonum_711 (hdp->type) != ISO_VD_PRIMARY)
626		        goto out_freebh;
627
628		    sbi->s_high_sierra = 1;
629		    opt.rock = 'n';
630		    h_pri = (struct hs_primary_descriptor *)vdp;
631		    goto root_found;
632		}
633	    }
634
635            /* Just skip any volume descriptors we don't recognize */
636
637	    brelse(bh);
638	    bh = NULL;
639	}
640	/*
641	 * If we fall through, either no volume descriptor was found,
642	 * or else we passed a primary descriptor looking for others.
643	 */
644	if (!pri)
645		goto out_unknown_format;
646	brelse(bh);
647	bh = pri_bh;
648	pri_bh = NULL;
649
650root_found:
651
652	if (joliet_level && (pri == NULL || opt.rock == 'n')) {
653	    /* This is the case of Joliet with the norock mount flag.
654	     * A disc with both Joliet and Rock Ridge is handled later
655	     */
656	    pri = (struct iso_primary_descriptor *) sec;
657	}
658
659	if(sbi->s_high_sierra){
660	  rootp = (struct iso_directory_record *) h_pri->root_directory_record;
661	  sbi->s_nzones = isonum_733 (h_pri->volume_space_size);
662	  sbi->s_log_zone_size = isonum_723 (h_pri->logical_block_size);
663	  sbi->s_max_size = isonum_733(h_pri->volume_space_size);
664	} else {
665	  if (!pri)
666	    goto out_freebh;
667	  rootp = (struct iso_directory_record *) pri->root_directory_record;
668	  sbi->s_nzones = isonum_733 (pri->volume_space_size);
669	  sbi->s_log_zone_size = isonum_723 (pri->logical_block_size);
670	  sbi->s_max_size = isonum_733(pri->volume_space_size);
671	}
672
673	sbi->s_ninodes = 0; /* No way to figure this out easily */
674
675	orig_zonesize = sbi->s_log_zone_size;
676	/*
677	 * If the zone size is smaller than the hardware sector size,
678	 * this is a fatal error.  This would occur if the disc drive
679	 * had sectors that were 2048 bytes, but the filesystem had
680	 * blocks that were 512 bytes (which should only very rarely
681	 * happen.)
682	 */
683	if(orig_zonesize < opt.blocksize)
684		goto out_bad_size;
685
686	/* RDE: convert log zone size to bit shift */
687	switch (sbi->s_log_zone_size)
688	  { case  512: sbi->s_log_zone_size =  9; break;
689	    case 1024: sbi->s_log_zone_size = 10; break;
690	    case 2048: sbi->s_log_zone_size = 11; break;
691
692	    default:
693		goto out_bad_zone_size;
694	  }
695
696	s->s_magic = ISOFS_SUPER_MAGIC;
697	s->s_maxbytes = 0xffffffff; /* We can handle files up to 4 GB */
698
699	/* The CDROM is read-only, has no nodes (devices) on it, and since
700	   all of the files appear to be owned by root, we really do not want
701	   to allow suid.  (suid or devices will not show up unless we have
702	   Rock Ridge extensions) */
703
704	s->s_flags |= MS_RDONLY /* | MS_NODEV | MS_NOSUID */;
705
706	/* Set this for reference. Its not currently used except on write
707	   which we don't have .. */
708
709	first_data_zone = isonum_733 (rootp->extent) +
710			  isonum_711 (rootp->ext_attr_length);
711	sbi->s_firstdatazone = first_data_zone;
712#ifndef BEQUIET
713	printk(KERN_DEBUG "Max size:%ld   Log zone size:%ld\n",
714	       sbi->s_max_size,
715	       1UL << sbi->s_log_zone_size);
716	printk(KERN_DEBUG "First datazone:%ld\n", sbi->s_firstdatazone);
717	if(sbi->s_high_sierra)
718		printk(KERN_DEBUG "Disc in High Sierra format.\n");
719#endif
720
721	/*
722	 * If the Joliet level is set, we _may_ decide to use the
723	 * secondary descriptor, but can't be sure until after we
724	 * read the root inode. But before reading the root inode
725	 * we may need to change the device blocksize, and would
726	 * rather release the old buffer first. So, we cache the
727	 * first_data_zone value from the secondary descriptor.
728	 */
729	if (joliet_level) {
730		pri = (struct iso_primary_descriptor *) sec;
731		rootp = (struct iso_directory_record *)
732			pri->root_directory_record;
733		first_data_zone = isonum_733 (rootp->extent) +
734			  	isonum_711 (rootp->ext_attr_length);
735	}
736
737	/*
738	 * We're all done using the volume descriptor, and may need
739	 * to change the device blocksize, so release the buffer now.
740	 */
741	brelse(pri_bh);
742	brelse(bh);
743
744	/*
745	 * Force the blocksize to 512 for 512 byte sectors.  The file
746	 * read primitives really get it wrong in a bad way if we don't
747	 * do this.
748	 *
749	 * Note - we should never be setting the blocksize to something
750	 * less than the hardware sector size for the device.  If we
751	 * do, we would end up having to read larger buffers and split
752	 * out portions to satisfy requests.
753	 *
754	 * Note2- the idea here is that we want to deal with the optimal
755	 * zonesize in the filesystem.  If we have it set to something less,
756	 * then we have horrible problems with trying to piece together
757	 * bits of adjacent blocks in order to properly read directory
758	 * entries.  By forcing the blocksize in this way, we ensure
759	 * that we will never be required to do this.
760	 */
761	sb_set_blocksize(s, orig_zonesize);
762
763	sbi->s_nls_iocharset = NULL;
764
765#ifdef CONFIG_JOLIET
766	if (joliet_level && opt.utf8 == 0) {
767		char * p = opt.iocharset ? opt.iocharset : CONFIG_NLS_DEFAULT;
768		sbi->s_nls_iocharset = load_nls(p);
769		if (! sbi->s_nls_iocharset) {
770			/* Fail only if explicit charset specified */
771			if (opt.iocharset)
772				goto out_freesbi;
773			sbi->s_nls_iocharset = load_nls_default();
774		}
775	}
776#endif
777	s->s_op = &isofs_sops;
778	s->s_export_op = &isofs_export_ops;
779	sbi->s_mapping = opt.map;
780	sbi->s_rock = (opt.rock == 'y' ? 2 : 0);
781	sbi->s_rock_offset = -1; /* initial offset, will guess until SP is found*/
782	sbi->s_cruft = opt.cruft;
783	sbi->s_hide = opt.hide;
784	sbi->s_showassoc = opt.showassoc;
785	sbi->s_uid = opt.uid;
786	sbi->s_gid = opt.gid;
787	sbi->s_utf8 = opt.utf8;
788	sbi->s_nocompress = opt.nocompress;
789	/*
790	 * It would be incredibly stupid to allow people to mark every file
791	 * on the disk as suid, so we merely allow them to set the default
792	 * permissions.
793	 */
794	sbi->s_mode = opt.mode & 0777;
795
796	/*
797	 * Read the root inode, which _may_ result in changing
798	 * the s_rock flag. Once we have the final s_rock value,
799	 * we then decide whether to use the Joliet descriptor.
800	 */
801	inode = isofs_iget(s, sbi->s_firstdatazone, 0);
802
803	/*
804	 * If this disk has both Rock Ridge and Joliet on it, then we
805	 * want to use Rock Ridge by default.  This can be overridden
806	 * by using the norock mount option.  There is still one other
807	 * possibility that is not taken into account: a Rock Ridge
808	 * CD with Unicode names.  Until someone sees such a beast, it
809	 * will not be supported.
810	 */
811	if (sbi->s_rock == 1) {
812		joliet_level = 0;
813	} else if (joliet_level) {
814		sbi->s_rock = 0;
815		if (sbi->s_firstdatazone != first_data_zone) {
816			sbi->s_firstdatazone = first_data_zone;
817			printk(KERN_DEBUG
818				"ISOFS: changing to secondary root\n");
819			iput(inode);
820			inode = isofs_iget(s, sbi->s_firstdatazone, 0);
821		}
822	}
823
824	if (opt.check == 'u') {
825		/* Only Joliet is case insensitive by default */
826		if (joliet_level) opt.check = 'r';
827		else opt.check = 's';
828	}
829	sbi->s_joliet_level = joliet_level;
830
831	/* check the root inode */
832	if (!inode)
833		goto out_no_root;
834	if (!inode->i_op)
835		goto out_bad_root;
836	/* get the root dentry */
837	s->s_root = d_alloc_root(inode);
838	if (!(s->s_root))
839		goto out_no_root;
840
841	table = 0;
842	if (joliet_level) table += 2;
843	if (opt.check == 'r') table++;
844	s->s_root->d_op = &isofs_dentry_ops[table];
845
846	kfree(opt.iocharset);
847
848	return 0;
849
850	/*
851	 * Display error messages and free resources.
852	 */
853out_bad_root:
854	printk(KERN_WARNING "isofs_fill_super: root inode not initialized\n");
855	goto out_iput;
856out_no_root:
857	printk(KERN_WARNING "isofs_fill_super: get root inode failed\n");
858out_iput:
859	iput(inode);
860#ifdef CONFIG_JOLIET
861	if (sbi->s_nls_iocharset)
862		unload_nls(sbi->s_nls_iocharset);
863#endif
864	goto out_freesbi;
865out_no_read:
866	printk(KERN_WARNING "isofs_fill_super: "
867		"bread failed, dev=%s, iso_blknum=%d, block=%d\n",
868		s->s_id, iso_blknum, block);
869	goto out_freesbi;
870out_bad_zone_size:
871	printk(KERN_WARNING "Bad logical zone size %ld\n",
872		sbi->s_log_zone_size);
873	goto out_freebh;
874out_bad_size:
875	printk(KERN_WARNING "Logical zone size(%d) < hardware blocksize(%u)\n",
876		orig_zonesize, opt.blocksize);
877	goto out_freebh;
878out_unknown_format:
879	if (!silent)
880		printk(KERN_WARNING "Unable to identify CD-ROM format.\n");
881
882out_freebh:
883	brelse(bh);
884out_freesbi:
885	kfree(opt.iocharset);
886	kfree(sbi);
887	s->s_fs_info = NULL;
888	return -EINVAL;
889}
890
891static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf)
892{
893	struct super_block *sb = dentry->d_sb;
894
895	buf->f_type = ISOFS_SUPER_MAGIC;
896	buf->f_bsize = sb->s_blocksize;
897	buf->f_blocks = (ISOFS_SB(sb)->s_nzones
898                  << (ISOFS_SB(sb)->s_log_zone_size - sb->s_blocksize_bits));
899	buf->f_bfree = 0;
900	buf->f_bavail = 0;
901	buf->f_files = ISOFS_SB(sb)->s_ninodes;
902	buf->f_ffree = 0;
903	buf->f_namelen = NAME_MAX;
904	return 0;
905}
906
907/*
908 * Get a set of blocks; filling in buffer_heads if already allocated
909 * or getblk() if they are not.  Returns the number of blocks inserted
910 * (0 == error.)
911 */
912int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
913		     struct buffer_head **bh, unsigned long nblocks)
914{
915	unsigned long b_off;
916	unsigned offset, sect_size;
917	unsigned int firstext;
918	unsigned long nextblk, nextoff;
919	long iblock = (long)iblock_s;
920	int section, rv;
921	struct iso_inode_info *ei = ISOFS_I(inode);
922
923	lock_kernel();
924
925	rv = 0;
926	if (iblock < 0 || iblock != iblock_s) {
927		printk("isofs_get_blocks: block number too large\n");
928		goto abort;
929	}
930
931	b_off = iblock;
932
933	offset    = 0;
934	firstext  = ei->i_first_extent;
935	sect_size = ei->i_section_size >> ISOFS_BUFFER_BITS(inode);
936	nextblk   = ei->i_next_section_block;
937	nextoff   = ei->i_next_section_offset;
938	section   = 0;
939
940	while ( nblocks ) {
941		/* If we are *way* beyond the end of the file, print a message.
942		 * Access beyond the end of the file up to the next page boundary
943		 * is normal, however because of the way the page cache works.
944		 * In this case, we just return 0 so that we can properly fill
945		 * the page with useless information without generating any
946		 * I/O errors.
947		 */
948		if (b_off > ((inode->i_size + PAGE_CACHE_SIZE - 1) >> ISOFS_BUFFER_BITS(inode))) {
949			printk("isofs_get_blocks: block >= EOF (%ld, %ld)\n",
950			       iblock, (unsigned long) inode->i_size);
951			goto abort;
952		}
953
954		/* On the last section, nextblk == 0, section size is likely to
955		 * exceed sect_size by a partial block, and access beyond the
956		 * end of the file will reach beyond the section size, too.
957		 */
958		while (nextblk && (b_off >= (offset + sect_size))) {
959			struct inode *ninode;
960
961			offset += sect_size;
962			ninode = isofs_iget(inode->i_sb, nextblk, nextoff);
963			if (!ninode)
964				goto abort;
965			firstext  = ISOFS_I(ninode)->i_first_extent;
966			sect_size = ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode);
967			nextblk   = ISOFS_I(ninode)->i_next_section_block;
968			nextoff   = ISOFS_I(ninode)->i_next_section_offset;
969			iput(ninode);
970
971			if (++section > 100) {
972				printk("isofs_get_blocks: More than 100 file sections ?!?, aborting...\n");
973				printk("isofs_get_blocks: block=%ld firstext=%u sect_size=%u "
974				       "nextblk=%lu nextoff=%lu\n",
975				       iblock, firstext, (unsigned) sect_size,
976				       nextblk, nextoff);
977				goto abort;
978			}
979		}
980
981		if ( *bh ) {
982			map_bh(*bh, inode->i_sb, firstext + b_off - offset);
983		} else {
984			*bh = sb_getblk(inode->i_sb, firstext+b_off-offset);
985			if ( !*bh )
986				goto abort;
987		}
988		bh++;	/* Next buffer head */
989		b_off++;	/* Next buffer offset */
990		nblocks--;
991		rv++;
992	}
993
994abort:
995	unlock_kernel();
996	return rv;
997}
998
999/*
1000 * Used by the standard interfaces.
1001 */
1002static int isofs_get_block(struct inode *inode, sector_t iblock,
1003		    struct buffer_head *bh_result, int create)
1004{
1005	if (create) {
1006		printk("isofs_get_block: Kernel tries to allocate a block\n");
1007		return -EROFS;
1008	}
1009
1010	return isofs_get_blocks(inode, iblock, &bh_result, 1) ? 0 : -EIO;
1011}
1012
1013static int isofs_bmap(struct inode *inode, sector_t block)
1014{
1015	struct buffer_head dummy;
1016	int error;
1017
1018	dummy.b_state = 0;
1019	dummy.b_blocknr = -1000;
1020	error = isofs_get_block(inode, block, &dummy, 0);
1021	if (!error)
1022		return dummy.b_blocknr;
1023	return 0;
1024}
1025
1026struct buffer_head *isofs_bread(struct inode *inode, sector_t block)
1027{
1028	sector_t blknr = isofs_bmap(inode, block);
1029	if (!blknr)
1030		return NULL;
1031	return sb_bread(inode->i_sb, blknr);
1032}
1033
1034static int isofs_readpage(struct file *file, struct page *page)
1035{
1036	return block_read_full_page(page,isofs_get_block);
1037}
1038
1039static sector_t _isofs_bmap(struct address_space *mapping, sector_t block)
1040{
1041	return generic_block_bmap(mapping,block,isofs_get_block);
1042}
1043
1044static const struct address_space_operations isofs_aops = {
1045	.readpage = isofs_readpage,
1046	.sync_page = block_sync_page,
1047	.bmap = _isofs_bmap
1048};
1049
1050static inline void test_and_set_uid(uid_t *p, uid_t value)
1051{
1052	if (value)
1053		*p = value;
1054}
1055
1056static inline void test_and_set_gid(gid_t *p, gid_t value)
1057{
1058        if (value)
1059                *p = value;
1060}
1061
1062static int isofs_read_level3_size(struct inode *inode)
1063{
1064	unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
1065	int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra;
1066	struct buffer_head * bh = NULL;
1067	unsigned long block, offset, block_saved, offset_saved;
1068	int i = 0;
1069	int more_entries = 0;
1070	struct iso_directory_record * tmpde = NULL;
1071	struct iso_inode_info *ei = ISOFS_I(inode);
1072
1073	inode->i_size = 0;
1074
1075	/* The first 16 blocks are reserved as the System Area.  Thus,
1076	 * no inodes can appear in block 0.  We use this to flag that
1077	 * this is the last section. */
1078	ei->i_next_section_block = 0;
1079	ei->i_next_section_offset = 0;
1080
1081	block = ei->i_iget5_block;
1082	offset = ei->i_iget5_offset;
1083
1084	do {
1085		struct iso_directory_record * de;
1086		unsigned int de_len;
1087
1088		if (!bh) {
1089			bh = sb_bread(inode->i_sb, block);
1090			if (!bh)
1091				goto out_noread;
1092		}
1093		de = (struct iso_directory_record *) (bh->b_data + offset);
1094		de_len = *(unsigned char *) de;
1095
1096		if (de_len == 0) {
1097			brelse(bh);
1098			bh = NULL;
1099			++block;
1100			offset = 0;
1101			continue;
1102		}
1103
1104		block_saved = block;
1105		offset_saved = offset;
1106		offset += de_len;
1107
1108		/* Make sure we have a full directory entry */
1109		if (offset >= bufsize) {
1110			int slop = bufsize - offset + de_len;
1111			if (!tmpde) {
1112				tmpde = kmalloc(256, GFP_KERNEL);
1113				if (!tmpde)
1114					goto out_nomem;
1115			}
1116			memcpy(tmpde, de, slop);
1117			offset &= bufsize - 1;
1118			block++;
1119			brelse(bh);
1120			bh = NULL;
1121			if (offset) {
1122				bh = sb_bread(inode->i_sb, block);
1123				if (!bh)
1124					goto out_noread;
1125				memcpy((void *)tmpde+slop, bh->b_data, offset);
1126			}
1127			de = tmpde;
1128		}
1129
1130		inode->i_size += isonum_733(de->size);
1131		if (i == 1) {
1132			ei->i_next_section_block = block_saved;
1133			ei->i_next_section_offset = offset_saved;
1134		}
1135
1136		more_entries = de->flags[-high_sierra] & 0x80;
1137
1138		i++;
1139		if (i > 100)
1140			goto out_toomany;
1141	} while (more_entries);
1142out:
1143	kfree(tmpde);
1144	if (bh)
1145		brelse(bh);
1146	return 0;
1147
1148out_nomem:
1149	if (bh)
1150		brelse(bh);
1151	return -ENOMEM;
1152
1153out_noread:
1154	printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block);
1155	kfree(tmpde);
1156	return -EIO;
1157
1158out_toomany:
1159	printk(KERN_INFO "isofs_read_level3_size: "
1160		"More than 100 file sections ?!?, aborting...\n"
1161	  	"isofs_read_level3_size: inode=%lu\n",
1162		inode->i_ino);
1163	goto out;
1164}
1165
1166static void isofs_read_inode(struct inode *inode)
1167{
1168	struct super_block *sb = inode->i_sb;
1169	struct isofs_sb_info *sbi = ISOFS_SB(sb);
1170	unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
1171	unsigned long block;
1172	int high_sierra = sbi->s_high_sierra;
1173	struct buffer_head * bh = NULL;
1174	struct iso_directory_record * de;
1175	struct iso_directory_record * tmpde = NULL;
1176	unsigned int de_len;
1177	unsigned long offset;
1178	struct iso_inode_info *ei = ISOFS_I(inode);
1179
1180	block = ei->i_iget5_block;
1181	bh = sb_bread(inode->i_sb, block);
1182	if (!bh)
1183		goto out_badread;
1184
1185	offset = ei->i_iget5_offset;
1186
1187	de = (struct iso_directory_record *) (bh->b_data + offset);
1188	de_len = *(unsigned char *) de;
1189
1190	if (offset + de_len > bufsize) {
1191		int frag1 = bufsize - offset;
1192
1193		tmpde = kmalloc(de_len, GFP_KERNEL);
1194		if (tmpde == NULL) {
1195			printk(KERN_INFO "isofs_read_inode: out of memory\n");
1196			goto fail;
1197		}
1198		memcpy(tmpde, bh->b_data + offset, frag1);
1199		brelse(bh);
1200		bh = sb_bread(inode->i_sb, ++block);
1201		if (!bh)
1202			goto out_badread;
1203		memcpy((char *)tmpde+frag1, bh->b_data, de_len - frag1);
1204		de = tmpde;
1205	}
1206
1207	inode->i_ino = isofs_get_ino(ei->i_iget5_block,
1208				     ei->i_iget5_offset,
1209				     ISOFS_BUFFER_BITS(inode));
1210
1211	/* Assume it is a normal-format file unless told otherwise */
1212	ei->i_file_format = isofs_file_normal;
1213
1214	if (de->flags[-high_sierra] & 2) {
1215		inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR;
1216		inode->i_nlink = 1; /* Set to 1.  We know there are 2, but
1217				       the find utility tries to optimize
1218				       if it is 2, and it screws up.  It is
1219				       easier to give 1 which tells find to
1220				       do it the hard way. */
1221	} else {
1222 		/* Everybody gets to read the file. */
1223		inode->i_mode = sbi->s_mode;
1224		inode->i_nlink = 1;
1225	        inode->i_mode |= S_IFREG;
1226	}
1227	inode->i_uid = sbi->s_uid;
1228	inode->i_gid = sbi->s_gid;
1229	inode->i_blocks = 0;
1230
1231	ei->i_format_parm[0] = 0;
1232	ei->i_format_parm[1] = 0;
1233	ei->i_format_parm[2] = 0;
1234
1235	ei->i_section_size = isonum_733 (de->size);
1236	if (de->flags[-high_sierra] & 0x80) {
1237		if(isofs_read_level3_size(inode)) goto fail;
1238	} else {
1239		ei->i_next_section_block = 0;
1240		ei->i_next_section_offset = 0;
1241		inode->i_size = isonum_733 (de->size);
1242	}
1243
1244	/*
1245	 * Some dipshit decided to store some other bit of information
1246	 * in the high byte of the file length.  Truncate size in case
1247	 * this CDROM was mounted with the cruft option.
1248	 */
1249
1250	if (sbi->s_cruft == 'y')
1251		inode->i_size &= 0x00ffffff;
1252
1253	if (de->interleave[0]) {
1254		printk("Interleaved files not (yet) supported.\n");
1255		inode->i_size = 0;
1256	}
1257
1258	/* I have no idea what file_unit_size is used for, so
1259	   we will flag it for now */
1260	if (de->file_unit_size[0] != 0) {
1261		printk("File unit size != 0 for ISO file (%ld).\n",
1262		       inode->i_ino);
1263	}
1264
1265	/* I have no idea what other flag bits are used for, so
1266	   we will flag it for now */
1267#ifdef DEBUG
1268	if((de->flags[-high_sierra] & ~2)!= 0){
1269		printk("Unusual flag settings for ISO file (%ld %x).\n",
1270		       inode->i_ino, de->flags[-high_sierra]);
1271	}
1272#endif
1273
1274	inode->i_mtime.tv_sec =
1275	inode->i_atime.tv_sec =
1276	inode->i_ctime.tv_sec = iso_date(de->date, high_sierra);
1277	inode->i_mtime.tv_nsec =
1278	inode->i_atime.tv_nsec =
1279	inode->i_ctime.tv_nsec = 0;
1280
1281	ei->i_first_extent = (isonum_733 (de->extent) +
1282			      isonum_711 (de->ext_attr_length));
1283
1284	/* Set the number of blocks for stat() - should be done before RR */
1285	inode->i_blocks  = (inode->i_size + 511) >> 9;
1286
1287	/*
1288	 * Now test for possible Rock Ridge extensions which will override
1289	 * some of these numbers in the inode structure.
1290	 */
1291
1292	if (!high_sierra) {
1293		parse_rock_ridge_inode(de, inode);
1294		/* if we want uid/gid set, override the rock ridge setting */
1295		test_and_set_uid(&inode->i_uid, sbi->s_uid);
1296		test_and_set_gid(&inode->i_gid, sbi->s_gid);
1297	}
1298
1299	/* Install the inode operations vector */
1300	if (S_ISREG(inode->i_mode)) {
1301		inode->i_fop = &generic_ro_fops;
1302		switch ( ei->i_file_format ) {
1303#ifdef CONFIG_ZISOFS
1304		case isofs_file_compressed:
1305			inode->i_data.a_ops = &zisofs_aops;
1306			break;
1307#endif
1308		default:
1309			inode->i_data.a_ops = &isofs_aops;
1310			break;
1311		}
1312	} else if (S_ISDIR(inode->i_mode)) {
1313		inode->i_op = &isofs_dir_inode_operations;
1314		inode->i_fop = &isofs_dir_operations;
1315	} else if (S_ISLNK(inode->i_mode)) {
1316		inode->i_op = &page_symlink_inode_operations;
1317		inode->i_data.a_ops = &isofs_symlink_aops;
1318	} else
1319		init_special_inode(inode, inode->i_mode, inode->i_rdev);
1320
1321out:
1322	kfree(tmpde);
1323	if (bh)
1324		brelse(bh);
1325	return;
1326
1327out_badread:
1328	printk(KERN_WARNING "ISOFS: unable to read i-node block\n");
1329fail:
1330	make_bad_inode(inode);
1331	goto out;
1332}
1333
1334struct isofs_iget5_callback_data {
1335	unsigned long block;
1336	unsigned long offset;
1337};
1338
1339static int isofs_iget5_test(struct inode *ino, void *data)
1340{
1341	struct iso_inode_info *i = ISOFS_I(ino);
1342	struct isofs_iget5_callback_data *d =
1343		(struct isofs_iget5_callback_data*)data;
1344	return (i->i_iget5_block == d->block)
1345	       && (i->i_iget5_offset == d->offset);
1346}
1347
1348static int isofs_iget5_set(struct inode *ino, void *data)
1349{
1350	struct iso_inode_info *i = ISOFS_I(ino);
1351	struct isofs_iget5_callback_data *d =
1352		(struct isofs_iget5_callback_data*)data;
1353	i->i_iget5_block = d->block;
1354	i->i_iget5_offset = d->offset;
1355	return 0;
1356}
1357
1358/* Store, in the inode's containing structure, the block and block
1359 * offset that point to the underlying meta-data for the inode.  The
1360 * code below is otherwise similar to the iget() code in
1361 * include/linux/fs.h */
1362struct inode *isofs_iget(struct super_block *sb,
1363			 unsigned long block,
1364			 unsigned long offset)
1365{
1366	unsigned long hashval;
1367	struct inode *inode;
1368	struct isofs_iget5_callback_data data;
1369
1370	if (offset >= 1ul << sb->s_blocksize_bits)
1371		return NULL;
1372
1373	data.block = block;
1374	data.offset = offset;
1375
1376	hashval = (block << sb->s_blocksize_bits) | offset;
1377
1378	inode = iget5_locked(sb, hashval, &isofs_iget5_test,
1379			     &isofs_iget5_set, &data);
1380
1381	if (inode && (inode->i_state & I_NEW)) {
1382		sb->s_op->read_inode(inode);
1383		unlock_new_inode(inode);
1384	}
1385
1386	return inode;
1387}
1388
1389static int isofs_get_sb(struct file_system_type *fs_type,
1390	int flags, const char *dev_name, void *data, struct vfsmount *mnt)
1391{
1392	return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super,
1393			   mnt);
1394}
1395
1396static struct file_system_type iso9660_fs_type = {
1397	.owner		= THIS_MODULE,
1398	.name		= "iso9660",
1399	.get_sb		= isofs_get_sb,
1400	.kill_sb	= kill_block_super,
1401	.fs_flags	= FS_REQUIRES_DEV,
1402};
1403
1404static int __init init_iso9660_fs(void)
1405{
1406	int err = init_inodecache();
1407	if (err)
1408		goto out;
1409#ifdef CONFIG_ZISOFS
1410	err = zisofs_init();
1411	if (err)
1412		goto out1;
1413#endif
1414	err = register_filesystem(&iso9660_fs_type);
1415	if (err)
1416		goto out2;
1417	return 0;
1418out2:
1419#ifdef CONFIG_ZISOFS
1420	zisofs_cleanup();
1421out1:
1422#endif
1423	destroy_inodecache();
1424out:
1425	return err;
1426}
1427
1428static void __exit exit_iso9660_fs(void)
1429{
1430        unregister_filesystem(&iso9660_fs_type);
1431#ifdef CONFIG_ZISOFS
1432	zisofs_cleanup();
1433#endif
1434	destroy_inodecache();
1435}
1436
1437module_init(init_iso9660_fs)
1438module_exit(exit_iso9660_fs)
1439MODULE_LICENSE("GPL");
1440/* Actual filesystem name is iso9660, as requested in filesystems.c */
1441MODULE_ALIAS("iso9660");
1442