1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2017-2018 HUAWEI, Inc.
 *             https://www.huawei.com/
 * Copyright (C) 2021, Alibaba Cloud
 */
#include <linux/statfs.h>
#include <linux/seq_file.h>
#include <linux/crc32c.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
#include <linux/exportfs.h>
#include <linux/backing-dev.h>
#include <linux/pseudo_fs.h>
#include "xattr.h"

#define CREATE_TRACE_POINTS
#include <trace/events/erofs.h>

static struct kmem_cache *erofs_inode_cachep __read_mostly;

void _erofs_printk(struct super_block *sb, const char *fmt, ...)
{
	struct va_format vaf;
	va_list args;
	int level;

	va_start(args, fmt);

	level = printk_get_level(fmt);
	vaf.fmt = printk_skip_level(fmt);
	vaf.va = &args;
	if (sb)
		printk("%c%cerofs (device %s): %pV",
				KERN_SOH_ASCII, level, sb->s_id, &vaf);
	else
		printk("%c%cerofs: %pV", KERN_SOH_ASCII, level, &vaf);
	va_end(args);
}

static int erofs_superblock_csum_verify(struct super_block *sb, void *sbdata)
{
	struct erofs_super_block *dsb = sbdata + EROFS_SUPER_OFFSET;
	u32 len = 1 << EROFS_SB(sb)->blkszbits, crc;

	if (len > EROFS_SUPER_OFFSET)
		len -= EROFS_SUPER_OFFSET;
	len -= offsetof(struct erofs_super_block, checksum) +
			sizeof(dsb->checksum);

	/* skip .magic(pre-verified) and .checksum(0) fields */
	crc = crc32c(0x5045B54A, (&dsb->checksum) + 1, len);
	if (crc == le32_to_cpu(dsb->checksum))
		return 0;
	erofs_err(sb, "invalid checksum 0x%08x, 0x%08x expected",
		  crc, le32_to_cpu(dsb->checksum));
	return -EBADMSG;
}

static void erofs_inode_init_once(void *ptr)
{
	struct erofs_inode *vi = ptr;

	inode_init_once(&vi->vfs_inode);
}

static struct inode *erofs_alloc_inode(struct super_block *sb)
{
	struct erofs_inode *vi =
		alloc_inode_sb(sb, erofs_inode_cachep, GFP_KERNEL);

	if (!vi)
		return NULL;

	/* zero out everything except vfs_inode */
	memset(vi, 0, offsetof(struct erofs_inode, vfs_inode));
	return &vi->vfs_inode;
}

static void erofs_free_inode(struct inode *inode)
{
	struct erofs_inode *vi = EROFS_I(inode);

	if (inode->i_op == &erofs_fast_symlink_iops)
		kfree(inode->i_link);
	kfree(vi->xattr_shared_xattrs);
	kmem_cache_free(erofs_inode_cachep, vi);
}

/* read variable-sized metadata, offset will be aligned by 4-byte */
void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf,
			  erofs_off_t *offset, int *lengthp)
{
	u8 *buffer, *ptr;
	int len, i, cnt;

	*offset = round_up(*offset, 4);
	ptr = erofs_bread(buf, *offset, true);
	if (IS_ERR(ptr))
		return ptr;

	len = le16_to_cpu(*(__le16 *)ptr);
	if (!len)
		len = U16_MAX + 1;
	buffer = kmalloc(len, GFP_KERNEL);
	if (!buffer)
		return ERR_PTR(-ENOMEM);
	*offset += sizeof(__le16);
	*lengthp = len;

	for (i = 0; i < len; i += cnt) {
		cnt = min_t(int, sb->s_blocksize - erofs_blkoff(sb, *offset),
			    len - i);
		ptr = erofs_bread(buf, *offset, true);
		if (IS_ERR(ptr)) {
			kfree(buffer);
			return ptr;
		}
		memcpy(buffer + i, ptr, cnt);
		*offset += cnt;
	}
	return buffer;
}

static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
			     struct erofs_device_info *dif, erofs_off_t *pos)
{
	struct erofs_sb_info *sbi = EROFS_SB(sb);
	struct erofs_deviceslot *dis;
	struct file *file;
	bool _48bit;

	dis = erofs_read_metabuf(buf, sb, *pos, false);
	if (IS_ERR(dis))
		return PTR_ERR(dis);

	if (!sbi->devs->flatdev && !dif->path) {
		if (!dis->tag[0]) {
			erofs_err(sb, "empty device tag @ pos %llu", *pos);
			return -EINVAL;
		}
		dif->path = kmemdup_nul(dis->tag, sizeof(dis->tag), GFP_KERNEL);
		if (!dif->path)
			return -ENOMEM;
	}

	if (!sbi->devs->flatdev) {
		file = erofs_is_fileio_mode(sbi) ?
				filp_open(dif->path, O_RDONLY | O_LARGEFILE, 0) :
				fs_bdev_file_open_by_path(dif->path,
						BLK_OPEN_READ, sb->s_type, sb);
		if (IS_ERR(file)) {
			if (file == ERR_PTR(-ENOTBLK))
				return -EINVAL;
			return PTR_ERR(file);
		}

		if (!erofs_is_fileio_mode(sbi)) {
			dif->dax_dev = fs_dax_get_by_bdev(file_bdev(file),
					&dif->dax_part_off, NULL, NULL);
		} else if (!S_ISREG(file_inode(file)->i_mode)) {
			fput(file);
			return -EINVAL;
		}
		if (!dif->dax_dev && test_opt(&sbi->opt, DAX_ALWAYS)) {
			erofs_info(sb, "DAX unsupported by %s. Turning off DAX.",
				   dif->path);
			clear_opt(&sbi->opt, DAX_ALWAYS);
		}
		dif->file = file;
	}

	_48bit = erofs_sb_has_48bit(sbi);
	dif->blocks = le32_to_cpu(dis->blocks_lo) |
		(_48bit ? (u64)le16_to_cpu(dis->blocks_hi) << 32 : 0);
	dif->uniaddr = le32_to_cpu(dis->uniaddr_lo) |
		(_48bit ? (u64)le16_to_cpu(dis->uniaddr_hi) << 32 : 0);
	sbi->total_blocks += dif->blocks;
	*pos += EROFS_DEVT_SLOT_SIZE;
	return 0;
}

static int erofs_scan_devices(struct super_block *sb,
			      struct erofs_super_block *dsb)
{
	struct erofs_sb_info *sbi = EROFS_SB(sb);
	unsigned int ondisk_extradevs;
	erofs_off_t pos;
	struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
	struct erofs_device_info *dif;
	int id, err = 0;

	sbi->total_blocks = sbi->dif0.blocks;
	if (!erofs_sb_has_device_table(sbi))
		ondisk_extradevs = 0;
	else
		ondisk_extradevs = le16_to_cpu(dsb->extra_devices);

	if (sbi->devs->extra_devices &&
	    ondisk_extradevs != sbi->devs->extra_devices) {
		erofs_err(sb, "extra devices don't match (ondisk %u, given %u)",
			  ondisk_extradevs, sbi->devs->extra_devices);
		return -EINVAL;
	}

	if (test_opt(&sbi->opt, DAX_ALWAYS) && !sbi->dif0.dax_dev) {
		erofs_info(sb, "DAX unsupported by block device. Turning off DAX.");
		clear_opt(&sbi->opt, DAX_ALWAYS);
	}
	if (!ondisk_extradevs)
		return 0;

	if (!sbi->devs->extra_devices)
		sbi->devs->flatdev = true;

	sbi->device_id_mask = roundup_pow_of_two(ondisk_extradevs + 1) - 1;
	pos = le16_to_cpu(dsb->devt_slotoff) * EROFS_DEVT_SLOT_SIZE;
	down_read(&sbi->devs->rwsem);
	if (sbi->devs->extra_devices) {
		idr_for_each_entry(&sbi->devs->tree, dif, id) {
			err = erofs_init_device(&buf, sb, dif, &pos);
			if (err)
				break;
		}
	} else {
		for (id = 0; id < ondisk_extradevs; id++) {
			dif = kzalloc_obj(*dif);
			if (!dif) {
				err = -ENOMEM;
				break;
			}

			err = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL);
			if (err < 0) {
				kfree(dif);
				break;
			}
			++sbi->devs->extra_devices;

			err = erofs_init_device(&buf, sb, dif, &pos);
			if (err)
				break;
		}
	}
	up_read(&sbi->devs->rwsem);
	erofs_put_metabuf(&buf);
	return err;
}

static int erofs_read_superblock(struct super_block *sb)
{
	struct erofs_sb_info *sbi = EROFS_SB(sb);
	struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
	struct erofs_super_block *dsb;
	void *data;
	int ret;

	data = erofs_read_metabuf(&buf, sb, 0, false);
	if (IS_ERR(data)) {
		erofs_err(sb, "cannot read erofs superblock");
		return PTR_ERR(data);
	}

	dsb = (struct erofs_super_block *)(data + EROFS_SUPER_OFFSET);
	ret = -EINVAL;
	if (le32_to_cpu(dsb->magic) != EROFS_SUPER_MAGIC_V1) {
		erofs_err(sb, "cannot find valid erofs superblock");
		goto out;
	}

	sbi->blkszbits = dsb->blkszbits;
	if (sbi->blkszbits < 9 || sbi->blkszbits > PAGE_SHIFT) {
		erofs_err(sb, "blkszbits %u isn't supported", sbi->blkszbits);
		goto out;
	}
	if (dsb->dirblkbits) {
		erofs_err(sb, "dirblkbits %u isn't supported", dsb->dirblkbits);
		goto out;
	}

	sbi->feature_compat = le32_to_cpu(dsb->feature_compat);
	if (erofs_sb_has_sb_chksum(sbi)) {
		ret = erofs_superblock_csum_verify(sb, data);
		if (ret)
			goto out;
	}

	ret = -EINVAL;
	sbi->feature_incompat = le32_to_cpu(dsb->feature_incompat);
	if (sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT) {
		erofs_err(sb, "unidentified incompatible feature %x, please upgrade kernel",
			  sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT);
		goto out;
	}

	sbi->sb_size = 128 + dsb->sb_extslots * EROFS_SB_EXTSLOT_SIZE;
	if (sbi->sb_size > PAGE_SIZE - EROFS_SUPER_OFFSET) {
		erofs_err(sb, "invalid sb_extslots %u (more than a fs block)",
			  sbi->sb_size);
		goto out;
	}
	sbi->dif0.blocks = le32_to_cpu(dsb->blocks_lo);
	sbi->meta_blkaddr = le32_to_cpu(dsb->meta_blkaddr);
#ifdef CONFIG_EROFS_FS_XATTR
	sbi->xattr_blkaddr = le32_to_cpu(dsb->xattr_blkaddr);
	sbi->xattr_prefix_start = le32_to_cpu(dsb->xattr_prefix_start);
	sbi->xattr_prefix_count = dsb->xattr_prefix_count;
	sbi->xattr_filter_reserved = dsb->xattr_filter_reserved;
	if (erofs_sb_has_ishare_xattrs(sbi)) {
		if (dsb->ishare_xattr_prefix_id >= sbi->xattr_prefix_count) {
			erofs_err(sb, "invalid ishare xattr prefix id %u",
				  dsb->ishare_xattr_prefix_id);
			ret = -EFSCORRUPTED;
			goto out;
		}
		sbi->ishare_xattr_prefix_id = dsb->ishare_xattr_prefix_id;
	}
#endif
	sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact));
	if (erofs_sb_has_48bit(sbi) && dsb->rootnid_8b) {
		sbi->root_nid = le64_to_cpu(dsb->rootnid_8b);
		sbi->dif0.blocks = sbi->dif0.blocks |
				((u64)le16_to_cpu(dsb->rb.blocks_hi) << 32);
	} else {
		sbi->root_nid = le16_to_cpu(dsb->rb.rootnid_2b);
	}
	sbi->packed_nid = le64_to_cpu(dsb->packed_nid);
	if (erofs_sb_has_metabox(sbi)) {
		ret = -EFSCORRUPTED;
		if (sbi->sb_size <= offsetof(struct erofs_super_block,
					     metabox_nid))
			goto out;
		sbi->metabox_nid = le64_to_cpu(dsb->metabox_nid);
		if (sbi->metabox_nid & BIT_ULL(EROFS_DIRENT_NID_METABOX_BIT))
			goto out;		/* self-loop detection */
	}
	sbi->inos = le64_to_cpu(dsb->inos);

	sbi->epoch = (s64)le64_to_cpu(dsb->epoch);
	sbi->fixed_nsec = le32_to_cpu(dsb->fixed_nsec);
	super_set_uuid(sb, (void *)dsb->uuid, sizeof(dsb->uuid));

	if (dsb->volume_name[0]) {
		sbi->volume_name = kstrndup(dsb->volume_name,
					    sizeof(dsb->volume_name), GFP_KERNEL);
		if (!sbi->volume_name) {
			ret = -ENOMEM;
			goto out;
		}
	}

	if (IS_ENABLED(CONFIG_EROFS_FS_ZIP)) {
		ret = z_erofs_parse_cfgs(sb, dsb);
		if (ret < 0)
			goto out;
	} else if (dsb->u1.available_compr_algs ||
		   erofs_sb_has_lz4_0padding(sbi)) {
		erofs_err(sb, "compression disabled, unable to mount compressed EROFS");
		ret = -EOPNOTSUPP;
		goto out;
	}

	ret = erofs_scan_devices(sb, dsb);

	if (erofs_sb_has_48bit(sbi))
		erofs_info(sb, "EXPERIMENTAL 48-bit layout support in use. Use at your own risk!");
	if (erofs_sb_has_metabox(sbi))
		erofs_info(sb, "EXPERIMENTAL metadata compression support in use. Use at your own risk!");
out:
	erofs_put_metabuf(&buf);
	return ret;
}

static void erofs_default_options(struct erofs_sb_info *sbi)
{
#ifdef CONFIG_EROFS_FS_ZIP
	sbi->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND;
	sbi->sync_decompress = EROFS_SYNC_DECOMPRESS_AUTO;
#endif
	if (IS_ENABLED(CONFIG_EROFS_FS_XATTR))
		set_opt(&sbi->opt, XATTR_USER);
	if (IS_ENABLED(CONFIG_EROFS_FS_POSIX_ACL))
		set_opt(&sbi->opt, POSIX_ACL);
}

enum {
	Opt_user_xattr, Opt_acl, Opt_cache_strategy, Opt_dax, Opt_dax_enum,
	Opt_device, Opt_domain_id, Opt_directio, Opt_fsoffset, Opt_inode_share,
	Opt_source,
};

static const struct constant_table erofs_param_cache_strategy[] = {
	{"disabled",	EROFS_ZIP_CACHE_DISABLED},
	{"readahead",	EROFS_ZIP_CACHE_READAHEAD},
	{"readaround",	EROFS_ZIP_CACHE_READAROUND},
	{}
};

static const struct constant_table erofs_dax_param_enums[] = {
	{"always",	EROFS_MOUNT_DAX_ALWAYS},
	{"never",	EROFS_MOUNT_DAX_NEVER},
	{}
};

static const struct fs_parameter_spec erofs_fs_parameters[] = {
	fsparam_flag_no("user_xattr",		Opt_user_xattr),
	fsparam_flag_no("acl",			Opt_acl),
	fsparam_enum("cache_strategy",		Opt_cache_strategy,
		     erofs_param_cache_strategy),
	fsparam_flag("dax",			Opt_dax),
	fsparam_enum("dax",			Opt_dax_enum, erofs_dax_param_enums),
	fsparam_string("device",		Opt_device),
	fsparam_string("domain_id",		Opt_domain_id),
	fsparam_flag_no("directio",		Opt_directio),
	fsparam_u64("fsoffset",			Opt_fsoffset),
	fsparam_flag("inode_share",		Opt_inode_share),
	fsparam_file_or_string("source",	Opt_source),
	{}
};

static bool erofs_fc_set_dax_mode(struct fs_context *fc, unsigned int mode)
{
	if (IS_ENABLED(CONFIG_FS_DAX)) {
		struct erofs_sb_info *sbi = fc->s_fs_info;

		if (mode == EROFS_MOUNT_DAX_ALWAYS) {
			set_opt(&sbi->opt, DAX_ALWAYS);
			clear_opt(&sbi->opt, DAX_NEVER);
			return true;
		} else if (mode == EROFS_MOUNT_DAX_NEVER) {
			set_opt(&sbi->opt, DAX_NEVER);
			clear_opt(&sbi->opt, DAX_ALWAYS);
			return true;
		}
		DBG_BUGON(1);
		return false;
	}
	errorfc(fc, "dax options not supported");
	return false;
}

static int erofs_fc_parse_source(struct fs_context *fc,
				 struct fs_parameter *param)
{
	struct erofs_sb_info *sbi = fc->s_fs_info;

	if (fc->source || sbi->dif0.file)
		return invalf(fc, "Multiple sources");

	switch (param->type) {
	case fs_value_is_string:
		fc->source = param->string;
		param->string = NULL;
		return 0;
	case fs_value_is_file: {
		char *buf __free(kfree) = kmalloc(PATH_MAX, GFP_KERNEL);
		char *p;

		if (!buf)
			return -ENOMEM;
		p = file_path(param->file, buf, PATH_MAX);
		if (IS_ERR(p))
			return PTR_ERR(p);
		fc->source = kstrdup(p, GFP_KERNEL);
		if (!fc->source)
			return -ENOMEM;
		sbi->dif0.file = no_free_ptr(param->file);
		return 0;
	}
	default:
		WARN_ON_ONCE(true);
		return -EINVAL;
	}
}

static int erofs_fc_parse_param(struct fs_context *fc,
				struct fs_parameter *param)
{
	struct erofs_sb_info *sbi = fc->s_fs_info;
	struct fs_parse_result result;
	struct erofs_device_info *dif;
	int opt, ret;

	opt = fs_parse(fc, erofs_fs_parameters, param, &result);
	if (opt < 0)
		return opt;

	switch (opt) {
	case Opt_user_xattr:
		if (!IS_ENABLED(CONFIG_EROFS_FS_XATTR))
			errorfc(fc, "{,no}user_xattr options not supported");
		else if (result.boolean)
			set_opt(&sbi->opt, XATTR_USER);
		else
			clear_opt(&sbi->opt, XATTR_USER);
		break;
	case Opt_acl:
		if (!IS_ENABLED(CONFIG_EROFS_FS_POSIX_ACL))
			errorfc(fc, "{,no}acl options not supported");
		else if (result.boolean)
			set_opt(&sbi->opt, POSIX_ACL);
		else
			clear_opt(&sbi->opt, POSIX_ACL);
		break;
	case Opt_cache_strategy:
		if (!IS_ENABLED(CONFIG_EROFS_FS_ZIP))
			errorfc(fc, "compression not supported, cache_strategy ignored");
		else
			sbi->opt.cache_strategy = result.uint_32;
		break;
	case Opt_dax:
		if (!erofs_fc_set_dax_mode(fc, EROFS_MOUNT_DAX_ALWAYS))
			return -EINVAL;
		break;
	case Opt_dax_enum:
		if (!erofs_fc_set_dax_mode(fc, result.uint_32))
			return -EINVAL;
		break;
	case Opt_device:
		dif = kzalloc_obj(*dif);
		if (!dif)
			return -ENOMEM;
		dif->path = kstrdup(param->string, GFP_KERNEL);
		if (!dif->path) {
			kfree(dif);
			return -ENOMEM;
		}
		down_write(&sbi->devs->rwsem);
		ret = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL);
		up_write(&sbi->devs->rwsem);
		if (ret < 0) {
			kfree(dif->path);
			kfree(dif);
			return ret;
		}
		++sbi->devs->extra_devices;
		break;
	case Opt_domain_id:
		if (!IS_ENABLED(CONFIG_EROFS_FS_PAGE_CACHE_SHARE)) {
			errorfc(fc, "%s option not supported", erofs_fs_parameters[opt].name);
		} else {
			kfree_sensitive(sbi->domain_id);
			sbi->domain_id = no_free_ptr(param->string);
		}
		break;
	case Opt_directio:
		if (!IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE))
			errorfc(fc, "%s option not supported", erofs_fs_parameters[opt].name);
		else if (result.boolean)
			set_opt(&sbi->opt, DIRECT_IO);
		else
			clear_opt(&sbi->opt, DIRECT_IO);
		break;
	case Opt_fsoffset:
		sbi->dif0.fsoff = result.uint_64;
		break;
	case Opt_inode_share:
		if (!IS_ENABLED(CONFIG_EROFS_FS_PAGE_CACHE_SHARE))
			errorfc(fc, "%s option not supported", erofs_fs_parameters[opt].name);
		else
			set_opt(&sbi->opt, INODE_SHARE);
		break;
	case Opt_source:
		return erofs_fc_parse_source(fc, param);
	}
	return 0;
}

static int erofs_encode_fh(struct inode *inode, u32 *fh, int *max_len,
			   struct inode *parent)
{
	erofs_nid_t nid = EROFS_I(inode)->nid;
	int len = parent ? 6 : 3;

	if (*max_len < len) {
		*max_len = len;
		return FILEID_INVALID;
	}

	fh[0] = (u32)(nid >> 32);
	fh[1] = (u32)(nid & 0xffffffff);
	fh[2] = inode->i_generation;

	if (parent) {
		nid = EROFS_I(parent)->nid;

		fh[3] = (u32)(nid >> 32);
		fh[4] = (u32)(nid & 0xffffffff);
		fh[5] = parent->i_generation;
	}

	*max_len = len;
	return parent ? FILEID_INO64_GEN_PARENT : FILEID_INO64_GEN;
}

static struct dentry *erofs_fh_to_dentry(struct super_block *sb,
		struct fid *fid, int fh_len, int fh_type)
{
	if ((fh_type != FILEID_INO64_GEN &&
	     fh_type != FILEID_INO64_GEN_PARENT) || fh_len < 3)
		return NULL;

	return d_obtain_alias(erofs_iget(sb,
		((u64)fid->raw[0] << 32) | fid->raw[1]));
}

static struct dentry *erofs_fh_to_parent(struct super_block *sb,
		struct fid *fid, int fh_len, int fh_type)
{
	if (fh_type != FILEID_INO64_GEN_PARENT || fh_len < 6)
		return NULL;

	return d_obtain_alias(erofs_iget(sb,
		((u64)fid->raw[3] << 32) | fid->raw[4]));
}

static struct dentry *erofs_get_parent(struct dentry *child)
{
	erofs_nid_t nid;
	unsigned int d_type;
	int err;

	err = erofs_namei(d_inode(child), &dotdot_name, &nid, &d_type);
	if (err)
		return ERR_PTR(err);
	return d_obtain_alias(erofs_iget(child->d_sb, nid));
}

static const struct export_operations erofs_export_ops = {
	.encode_fh = erofs_encode_fh,
	.fh_to_dentry = erofs_fh_to_dentry,
	.fh_to_parent = erofs_fh_to_parent,
	.get_parent = erofs_get_parent,
};

static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
{
	struct inode *inode;
	struct erofs_sb_info *sbi = EROFS_SB(sb);
	int err;

	sb->s_magic = EROFS_SUPER_MAGIC;
	sb->s_flags |= SB_RDONLY | SB_NOATIME;
	sb->s_maxbytes = MAX_LFS_FILESIZE;
	sb->s_op = &erofs_sops;

	if (!sbi->domain_id && test_opt(&sbi->opt, INODE_SHARE)) {
		errorfc(fc, "domain_id is needed when inode_share is on");
		return -EINVAL;
	}
	if (test_opt(&sbi->opt, DAX_ALWAYS) && test_opt(&sbi->opt, INODE_SHARE)) {
		errorfc(fc, "FSDAX is not allowed when inode_share is on");
		return -EINVAL;
	}

	sbi->blkszbits = PAGE_SHIFT;
	if (!sb->s_bdev) {
		/*
		 * (File-backed mounts) EROFS claims it's safe to nest other
		 * fs contexts (including its own) due to self-controlled RO
		 * accesses/contexts and no side-effect changes that need to
		 * context save & restore so it can reuse the current thread
		 * context.
		 * However, we still need to prevent kernel stack overflow due
		 * to filesystem nesting: just ensure that s_stack_depth is 0
		 * to disallow mounting EROFS on stacked filesystems.
		 * Note: s_stack_depth is not incremented here for now, since
		 * EROFS is the only fs supporting file-backed mounts for now.
		 * It MUST change if another fs plans to support them, which
		 * may also require adjusting FILESYSTEM_MAX_STACK_DEPTH.
		 */
		if (erofs_is_fileio_mode(sbi)) {
			inode = file_inode(sbi->dif0.file);
			if ((inode->i_sb->s_op == &erofs_sops &&
			     !inode->i_sb->s_bdev) ||
			    inode->i_sb->s_stack_depth) {
				erofs_err(sb, "file-backed mounts cannot be applied to stacked fses");
				return -ENOTBLK;
			}
		}
		sb->s_blocksize = PAGE_SIZE;
		sb->s_blocksize_bits = PAGE_SHIFT;

		err = super_setup_bdi(sb);
		if (err)
			return err;

		snprintf(sb->s_id, sizeof(sb->s_id),
			 "%u:%u", MAJOR(sb->s_dev), MINOR(sb->s_dev));
	} else {
		if (!sb_set_blocksize(sb, PAGE_SIZE)) {
			errorfc(fc, "failed to set initial blksize");
			return -EINVAL;
		}
		sbi->dif0.dax_dev = fs_dax_get_by_bdev(sb->s_bdev,
				&sbi->dif0.dax_part_off, NULL, NULL);
	}

	err = erofs_read_superblock(sb);
	if (err)
		return err;

	if (sb->s_blocksize_bits != sbi->blkszbits) {
		if (erofs_is_fileio_mode(sbi)) {
			sb->s_blocksize = 1 << sbi->blkszbits;
			sb->s_blocksize_bits = sbi->blkszbits;
		} else if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) {
			errorfc(fc, "failed to set erofs blksize");
			return -EINVAL;
		}
	}
	if (sbi->dif0.fsoff & (sb->s_blocksize - 1))
		return invalfc(fc, "fsoffset %llu is not aligned to block size %lu",
			       sbi->dif0.fsoff, sb->s_blocksize);

	if (test_opt(&sbi->opt, DAX_ALWAYS) && sbi->blkszbits != PAGE_SHIFT) {
		erofs_info(sb, "unsupported blocksize for DAX");
		clear_opt(&sbi->opt, DAX_ALWAYS);
	}
	if (test_opt(&sbi->opt, INODE_SHARE) && !erofs_sb_has_ishare_xattrs(sbi)) {
		erofs_info(sb, "on-disk ishare xattrs not found. Turning off inode_share.");
		clear_opt(&sbi->opt, INODE_SHARE);
	}
	if (test_opt(&sbi->opt, INODE_SHARE))
		erofs_info(sb, "EXPERIMENTAL EROFS page cache share support in use. Use at your own risk!");

	sb->s_time_gran = 1;
	sb->s_xattr = erofs_xattr_handlers;
	sb->s_export_op = &erofs_export_ops;

	if (test_opt(&sbi->opt, POSIX_ACL))
		sb->s_flags |= SB_POSIXACL;
	else
		sb->s_flags &= ~SB_POSIXACL;

	err = z_erofs_init_super(sb);
	if (err)
		return err;

	if (erofs_sb_has_fragments(sbi) && sbi->packed_nid) {
		inode = erofs_iget(sb, sbi->packed_nid);
		if (IS_ERR(inode))
			return PTR_ERR(inode);
		sbi->packed_inode = inode;
	}
	if (erofs_sb_has_metabox(sbi)) {
		inode = erofs_iget(sb, sbi->metabox_nid);
		if (IS_ERR(inode))
			return PTR_ERR(inode);
		sbi->metabox_inode = inode;
	}

	inode = erofs_iget(sb, sbi->root_nid);
	if (IS_ERR(inode))
		return PTR_ERR(inode);

	if (!S_ISDIR(inode->i_mode)) {
		erofs_err(sb, "rootino(nid %llu) is not a directory(i_mode %o)",
			  sbi->root_nid, inode->i_mode);
		iput(inode);
		return -EINVAL;
	}
	sb->s_root = d_make_root(inode);
	if (!sb->s_root)
		return -ENOMEM;

	erofs_shrinker_register(sb);
	err = erofs_xattr_prefixes_init(sb);
	if (err)
		return err;

	super_set_sysfs_name_id(sb);
	err = erofs_register_sysfs(sb);
	if (err)
		return err;

	sbi->dir_ra_bytes = EROFS_DIR_RA_BYTES;
	erofs_info(sb, "mounted with root inode @ nid %llu.", sbi->root_nid);
	return 0;
}

static int erofs_fc_get_tree(struct fs_context *fc)
{
	struct erofs_sb_info *sbi = fc->s_fs_info;
	int ret;

	if (sbi->dif0.file) {
		if (!IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE)) {
			errorfc(fc, "source fd option not supported");
			return -EINVAL;
		}
		if (!S_ISREG(file_inode(sbi->dif0.file)->i_mode) ||
		    !sbi->dif0.file->f_mapping->a_ops->read_folio) {
			errorfc(fc, "source is unsupported");
			return -EINVAL;
		}
		return get_tree_nodev(fc, erofs_fc_fill_super);
	}

	ret = get_tree_bdev_flags(fc, erofs_fc_fill_super,
		IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) ?
			GET_TREE_BDEV_QUIET_LOOKUP : 0);
	if (IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) && ret == -ENOTBLK) {
		struct file *file;

		if (!fc->source)
			return invalf(fc, "No source specified");
		file = filp_open(fc->source, O_RDONLY | O_LARGEFILE, 0);
		if (IS_ERR(file))
			return PTR_ERR(file);
		sbi->dif0.file = file;

		if (S_ISREG(file_inode(sbi->dif0.file)->i_mode) &&
		    sbi->dif0.file->f_mapping->a_ops->read_folio)
			return get_tree_nodev(fc, erofs_fc_fill_super);
	}
	return ret;
}

static int erofs_fc_reconfigure(struct fs_context *fc)
{
	struct super_block *sb = fc->root->d_sb;
	struct erofs_sb_info *sbi = EROFS_SB(sb);
	struct erofs_sb_info *new_sbi = fc->s_fs_info;

	DBG_BUGON(!sb_rdonly(sb));

	if (new_sbi->domain_id)
		erofs_info(sb, "ignoring reconfiguration for domain_id.");

	if (test_opt(&new_sbi->opt, POSIX_ACL))
		fc->sb_flags |= SB_POSIXACL;
	else
		fc->sb_flags &= ~SB_POSIXACL;

	sbi->opt = new_sbi->opt;

	fc->sb_flags |= SB_RDONLY;
	return 0;
}

static int erofs_release_device_info(int id, void *ptr, void *data)
{
	struct super_block *sb = data;
	struct erofs_device_info *dif = ptr;

	fs_put_dax(dif->dax_dev, NULL);
	if (dif->file) {
		if (S_ISBLK(file_inode(dif->file)->i_mode))
			fs_bdev_file_release(dif->file, sb);
		else
			fput(dif->file);
	}
	kfree(dif->path);
	kfree(dif);
	return 0;
}

static void erofs_free_dev_context(struct erofs_dev_context *devs,
				   struct super_block *sb)
{
	if (!devs)
		return;
	idr_for_each(&devs->tree, &erofs_release_device_info, sb);
	idr_destroy(&devs->tree);
	kfree(devs);
}

static void erofs_sb_free(struct erofs_sb_info *sbi, struct super_block *sb)
{
	erofs_free_dev_context(sbi->devs, sb);
	kfree_sensitive(sbi->domain_id);
	if (sbi->dif0.file)
		fput(sbi->dif0.file);
	kfree(sbi->volume_name);
	kfree(sbi);
}

static void erofs_fc_free(struct fs_context *fc)
{
	struct erofs_sb_info *sbi = fc->s_fs_info;

	/*
	 * Freed here only if an error occurs before the sb is set up; at that
	 * point no block-backed device has been claimed (that happens in
	 * fill_super), so the NULL sb never reaches fs_bdev_file_release().
	 */
	if (sbi)
		erofs_sb_free(sbi, NULL);
}

static const struct fs_context_operations erofs_context_ops = {
	.parse_param	= erofs_fc_parse_param,
	.get_tree       = erofs_fc_get_tree,
	.reconfigure    = erofs_fc_reconfigure,
	.free		= erofs_fc_free,
};

static int erofs_init_fs_context(struct fs_context *fc)
{
	struct erofs_sb_info *sbi;

	sbi = kzalloc_obj(*sbi);
	if (!sbi)
		return -ENOMEM;

	sbi->devs = kzalloc_obj(struct erofs_dev_context);
	if (!sbi->devs) {
		kfree(sbi);
		return -ENOMEM;
	}
	fc->s_fs_info = sbi;

	idr_init(&sbi->devs->tree);
	init_rwsem(&sbi->devs->rwsem);
	erofs_default_options(sbi);
	fc->ops = &erofs_context_ops;
	return 0;
}

static void erofs_drop_internal_inodes(struct erofs_sb_info *sbi)
{
	iput(sbi->packed_inode);
	sbi->packed_inode = NULL;
	iput(sbi->metabox_inode);
	sbi->metabox_inode = NULL;
#ifdef CONFIG_EROFS_FS_ZIP
	iput(sbi->managed_cache);
	sbi->managed_cache = NULL;
#endif
}

static void erofs_kill_sb(struct super_block *sb)
{
	struct erofs_sb_info *sbi = EROFS_SB(sb);

	if (sbi->dif0.file)
		kill_anon_super(sb);
	else
		kill_block_super(sb);
	erofs_drop_internal_inodes(sbi);
	fs_put_dax(sbi->dif0.dax_dev, NULL);
	erofs_sb_free(sbi, sb);
	sb->s_fs_info = NULL;
}

static void erofs_put_super(struct super_block *sb)
{
	struct erofs_sb_info *const sbi = EROFS_SB(sb);

	erofs_unregister_sysfs(sb);
	erofs_shrinker_unregister(sb);
	erofs_xattr_prefixes_cleanup(sb);
	erofs_drop_internal_inodes(sbi);
	erofs_free_dev_context(sbi->devs, sb);
	sbi->devs = NULL;
}

static struct file_system_type erofs_fs_type = {
	.owner          = THIS_MODULE,
	.name           = "erofs",
	.init_fs_context = erofs_init_fs_context,
	.kill_sb        = erofs_kill_sb,
	.fs_flags       = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
};
MODULE_ALIAS_FS("erofs");

#ifdef CONFIG_EROFS_FS_PAGE_CACHE_SHARE
static void erofs_free_anon_inode(struct inode *inode)
{
	struct erofs_inode *vi = EROFS_I(inode);

	kfree(vi->fingerprint.opaque);
	kmem_cache_free(erofs_inode_cachep, vi);
}

static const struct super_operations erofs_anon_sops = {
	.alloc_inode = erofs_alloc_inode,
	.drop_inode = inode_just_drop,
	.free_inode = erofs_free_anon_inode,
};

static int erofs_anon_init_fs_context(struct fs_context *fc)
{
	struct pseudo_fs_context *ctx;

	ctx = init_pseudo(fc, EROFS_SUPER_MAGIC);
	if (!ctx)
		return -ENOMEM;
	ctx->ops = &erofs_anon_sops;
	return 0;
}

struct file_system_type erofs_anon_fs_type = {
	.name           = "pseudo_erofs",
	.init_fs_context = erofs_anon_init_fs_context,
	.kill_sb        = kill_anon_super,
};
#endif

static int __init erofs_module_init(void)
{
	int err;

	erofs_check_ondisk_layout_definitions();

	erofs_inode_cachep = kmem_cache_create("erofs_inode",
			sizeof(struct erofs_inode), 0,
			SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT,
			erofs_inode_init_once);
	if (!erofs_inode_cachep)
		return -ENOMEM;

	err = erofs_init_shrinker();
	if (err)
		goto shrinker_err;

	err = z_erofs_init_subsystem();
	if (err)
		goto zip_err;

	err = erofs_init_sysfs();
	if (err)
		goto sysfs_err;

	err = erofs_init_ishare();
	if (err)
		goto ishare_err;

	err = register_filesystem(&erofs_fs_type);
	if (err)
		goto fs_err;

	return 0;

fs_err:
	erofs_exit_ishare();
ishare_err:
	erofs_exit_sysfs();
sysfs_err:
	z_erofs_exit_subsystem();
zip_err:
	erofs_exit_shrinker();
shrinker_err:
	kmem_cache_destroy(erofs_inode_cachep);
	return err;
}

static void __exit erofs_module_exit(void)
{
	unregister_filesystem(&erofs_fs_type);
	erofs_exit_ishare();

	/* ensure all delayed rcu free inodes & pclusters are flushed */
	rcu_barrier();

	erofs_exit_sysfs();
	z_erofs_exit_subsystem();
	erofs_exit_shrinker();
	kmem_cache_destroy(erofs_inode_cachep);
}

static int erofs_statfs(struct dentry *dentry, struct kstatfs *buf)
{
	struct super_block *sb = dentry->d_sb;
	struct erofs_sb_info *sbi = EROFS_SB(sb);

	buf->f_type = sb->s_magic;
	buf->f_bsize = sb->s_blocksize;
	buf->f_blocks = sbi->total_blocks;
	buf->f_bfree = buf->f_bavail = 0;
	buf->f_files = ULLONG_MAX;
	buf->f_ffree = ULLONG_MAX - sbi->inos;
	buf->f_namelen = EROFS_NAME_LEN;

	if (uuid_is_null(&sb->s_uuid))
		buf->f_fsid = u64_to_fsid(!sb->s_bdev ? 0 :
				huge_encode_dev(sb->s_bdev->bd_dev));
	else
		buf->f_fsid = uuid_to_fsid(sb->s_uuid.b);
	return 0;
}

static int erofs_show_options(struct seq_file *seq, struct dentry *root)
{
	struct erofs_sb_info *sbi = EROFS_SB(root->d_sb);
	struct erofs_mount_opts *opt = &sbi->opt;

	if (IS_ENABLED(CONFIG_EROFS_FS_XATTR))
		seq_puts(seq, test_opt(opt, XATTR_USER) ?
				",user_xattr" : ",nouser_xattr");
	if (IS_ENABLED(CONFIG_EROFS_FS_POSIX_ACL))
		seq_puts(seq, test_opt(opt, POSIX_ACL) ? ",acl" : ",noacl");
	if (IS_ENABLED(CONFIG_EROFS_FS_ZIP) && sbi->available_compr_algs)
		seq_printf(seq, ",cache_strategy=%s",
			  erofs_param_cache_strategy[opt->cache_strategy].name);
	if (test_opt(opt, DAX_ALWAYS))
		seq_puts(seq, ",dax=always");
	if (test_opt(opt, DAX_NEVER))
		seq_puts(seq, ",dax=never");
	if (erofs_is_fileio_mode(sbi) && test_opt(opt, DIRECT_IO))
		seq_puts(seq, ",directio");
	if (sbi->dif0.fsoff)
		seq_printf(seq, ",fsoffset=%llu", sbi->dif0.fsoff);
	if (test_opt(opt, INODE_SHARE))
		seq_puts(seq, ",inode_share");
	return 0;
}

static void erofs_evict_inode(struct inode *inode)
{
	if (IS_DAX(inode))
		dax_break_layout_final(inode);
	erofs_ishare_free_inode(inode);
	truncate_inode_pages_final(&inode->i_data);
	clear_inode(inode);
}

const struct super_operations erofs_sops = {
	.put_super = erofs_put_super,
	.alloc_inode = erofs_alloc_inode,
	.free_inode = erofs_free_inode,
	.evict_inode = erofs_evict_inode,
	.statfs = erofs_statfs,
	.show_options = erofs_show_options,
};

module_init(erofs_module_init);
module_exit(erofs_module_exit);

MODULE_DESCRIPTION("Enhanced ROM File System");
MODULE_AUTHOR("Gao Xiang, Chao Yu, Miao Xie, CONSUMER BG, HUAWEI Inc.");
MODULE_LICENSE("GPL");