aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/Config.src246
-rw-r--r--util-linux/fdisk_gpt.c4
-rw-r--r--util-linux/hexdump.c9
-rw-r--r--util-linux/losetup.c37
-rw-r--r--util-linux/mdev.c47
-rw-r--r--util-linux/swaponoff.c14
-rw-r--r--util-linux/volume_id/Config.src15
-rw-r--r--util-linux/volume_id/Kbuild.src38
-rw-r--r--util-linux/volume_id/btrfs.c11
-rw-r--r--util-linux/volume_id/cramfs.c11
-rw-r--r--util-linux/volume_id/exfat.c13
-rw-r--r--util-linux/volume_id/ext.c11
-rw-r--r--util-linux/volume_id/f2fs.c95
-rw-r--r--util-linux/volume_id/fat.c11
-rw-r--r--util-linux/volume_id/get_devname.c5
-rw-r--r--util-linux/volume_id/hfs.c11
-rw-r--r--util-linux/volume_id/iso9660.c11
-rw-r--r--util-linux/volume_id/jfs.c11
-rw-r--r--util-linux/volume_id/linux_raid.c11
-rw-r--r--util-linux/volume_id/linux_swap.c11
-rw-r--r--util-linux/volume_id/luks.c11
-rw-r--r--util-linux/volume_id/nilfs.c20
-rw-r--r--util-linux/volume_id/ntfs.c13
-rw-r--r--util-linux/volume_id/ocfs2.c11
-rw-r--r--util-linux/volume_id/reiserfs.c11
-rw-r--r--util-linux/volume_id/romfs.c11
-rw-r--r--util-linux/volume_id/squashfs.c12
-rw-r--r--util-linux/volume_id/sysv.c11
-rw-r--r--util-linux/volume_id/udf.c11
-rw-r--r--util-linux/volume_id/unused_highpoint.c11
-rw-r--r--util-linux/volume_id/unused_hpfs.c11
-rw-r--r--util-linux/volume_id/unused_isw_raid.c11
-rw-r--r--util-linux/volume_id/unused_lsi_raid.c11
-rw-r--r--util-linux/volume_id/unused_lvm.c11
-rw-r--r--util-linux/volume_id/unused_mac.c11
-rw-r--r--util-linux/volume_id/unused_minix.c11
-rw-r--r--util-linux/volume_id/unused_msdos.c11
-rw-r--r--util-linux/volume_id/unused_nvidia_raid.c11
-rw-r--r--util-linux/volume_id/unused_promise_raid.c11
-rw-r--r--util-linux/volume_id/unused_silicon_raid.c11
-rw-r--r--util-linux/volume_id/unused_ufs.c11
-rw-r--r--util-linux/volume_id/unused_via_raid.c11
-rw-r--r--util-linux/volume_id/volume_id.c5
-rw-r--r--util-linux/volume_id/volume_id_internal.h54
-rw-r--r--util-linux/volume_id/xfs.c11
45 files changed, 588 insertions, 358 deletions
diff --git a/util-linux/Config.src b/util-linux/Config.src
index 6c1b928da..5a8b0063b 100644
--- a/util-linux/Config.src
+++ b/util-linux/Config.src
@@ -699,250 +699,6 @@ config FEATURE_MTAB_SUPPORT
699 About the only reason to use this is if you've removed /proc from 699 About the only reason to use this is if you've removed /proc from
700 your kernel. 700 your kernel.
701 701
702config VOLUMEID 702source util-linux/volume_id/Config.in
703 bool #No description makes it a hidden option
704 default n
705
706menu "Filesystem/Volume identification"
707 depends on VOLUMEID
708
709config FEATURE_VOLUMEID_EXT
710 bool "Ext filesystem"
711 default y
712 depends on VOLUMEID
713 help
714 TODO
715
716config FEATURE_VOLUMEID_BTRFS
717 bool "btrfs filesystem"
718 default y
719 depends on VOLUMEID
720 help
721 TODO
722
723config FEATURE_VOLUMEID_REISERFS
724 bool "Reiser filesystem"
725 default y
726 depends on VOLUMEID
727 help
728 TODO
729
730config FEATURE_VOLUMEID_FAT
731 bool "fat filesystem"
732 default y
733 depends on VOLUMEID
734 help
735 TODO
736
737config FEATURE_VOLUMEID_EXFAT
738 bool "exFAT filesystem"
739 default y
740 depends on VOLUMEID
741 help
742 exFAT (extended FAT) is a proprietary file system designed especially
743 for flash drives. It has many features from NTFS, but with less
744 overhead. exFAT is used on most SDXC cards for consumer electronics.
745
746config FEATURE_VOLUMEID_HFS
747 bool "hfs filesystem"
748 default y
749 depends on VOLUMEID
750 help
751 TODO
752
753config FEATURE_VOLUMEID_JFS
754 bool "jfs filesystem"
755 default y
756 depends on VOLUMEID
757 help
758 TODO
759
760### config FEATURE_VOLUMEID_UFS
761### bool "ufs filesystem"
762### default y
763### depends on VOLUMEID
764### help
765### TODO
766
767config FEATURE_VOLUMEID_XFS
768 bool "xfs filesystem"
769 default y
770 depends on VOLUMEID
771 help
772 TODO
773
774config FEATURE_VOLUMEID_NILFS
775 bool "nilfs filesystem"
776 default y
777 depends on VOLUMEID
778 help
779 TODO
780
781config FEATURE_VOLUMEID_NTFS
782 bool "ntfs filesystem"
783 default y
784 depends on VOLUMEID
785 help
786 TODO
787
788config FEATURE_VOLUMEID_ISO9660
789 bool "iso9660 filesystem"
790 default y
791 depends on VOLUMEID
792 help
793 TODO
794
795config FEATURE_VOLUMEID_UDF
796 bool "udf filesystem"
797 default y
798 depends on VOLUMEID
799 help
800 TODO
801
802config FEATURE_VOLUMEID_LUKS
803 bool "luks filesystem"
804 default y
805 depends on VOLUMEID
806 help
807 TODO
808
809config FEATURE_VOLUMEID_LINUXSWAP
810 bool "linux swap filesystem"
811 default y
812 depends on VOLUMEID
813 help
814 TODO
815
816### config FEATURE_VOLUMEID_LVM
817### bool "lvm"
818### default y
819### depends on VOLUMEID
820### help
821### TODO
822
823config FEATURE_VOLUMEID_CRAMFS
824 bool "cramfs filesystem"
825 default y
826 depends on VOLUMEID
827 help
828 TODO
829
830### config FEATURE_VOLUMEID_HPFS
831### bool "hpfs filesystem"
832### default y
833### depends on VOLUMEID
834### help
835### TODO
836
837config FEATURE_VOLUMEID_ROMFS
838 bool "romfs filesystem"
839 default y
840 depends on VOLUMEID
841 help
842 TODO
843
844config FEATURE_VOLUMEID_SQUASHFS
845 bool "SquashFS filesystem"
846 default y
847 depends on VOLUMEID && FEATURE_BLKID_TYPE
848 help
849 Squashfs is a compressed read-only filesystem for Linux. Squashfs is
850 intended for general read-only filesystem use and in constrained block
851 device/memory systems (e.g. embedded systems) where low overhead is
852 needed.
853
854config FEATURE_VOLUMEID_SYSV
855 bool "sysv filesystem"
856 default y
857 depends on VOLUMEID
858 help
859 TODO
860
861### config FEATURE_VOLUMEID_MINIX
862### bool "minix filesystem"
863### default y
864### depends on VOLUMEID
865### help
866### TODO
867
868### These only detect partition tables - not used (yet?)
869### config FEATURE_VOLUMEID_MAC
870### bool "mac filesystem"
871### default y
872### depends on VOLUMEID
873### help
874### TODO
875###
876### config FEATURE_VOLUMEID_MSDOS
877### bool "msdos filesystem"
878### default y
879### depends on VOLUMEID
880### help
881### TODO
882
883config FEATURE_VOLUMEID_OCFS2
884 bool "ocfs2 filesystem"
885 default y
886 depends on VOLUMEID
887 help
888 TODO
889
890### config FEATURE_VOLUMEID_HIGHPOINTRAID
891### bool "highpoint raid"
892### default y
893### depends on VOLUMEID
894### help
895### TODO
896
897### config FEATURE_VOLUMEID_ISWRAID
898### bool "intel raid"
899### default y
900### depends on VOLUMEID
901### help
902### TODO
903
904### config FEATURE_VOLUMEID_LSIRAID
905### bool "lsi raid"
906### default y
907### depends on VOLUMEID
908### help
909### TODO
910
911### config FEATURE_VOLUMEID_VIARAID
912### bool "via raid"
913### default y
914### depends on VOLUMEID
915### help
916### TODO
917
918### config FEATURE_VOLUMEID_SILICONRAID
919### bool "silicon raid"
920### default y
921### depends on VOLUMEID
922### help
923### TODO
924
925### config FEATURE_VOLUMEID_NVIDIARAID
926### bool "nvidia raid"
927### default y
928### depends on VOLUMEID
929### help
930### TODO
931
932### config FEATURE_VOLUMEID_PROMISERAID
933### bool "promise raid"
934### default y
935### depends on VOLUMEID
936### help
937### TODO
938
939config FEATURE_VOLUMEID_LINUXRAID
940 bool "linuxraid"
941 default y
942 depends on VOLUMEID
943 help
944 TODO
945
946endmenu
947 703
948endmenu 704endmenu
diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c
index d43d9c709..f45f68af0 100644
--- a/util-linux/fdisk_gpt.c
+++ b/util-linux/fdisk_gpt.c
@@ -95,7 +95,7 @@ gpt_list_table(int xtra UNUSED_PARAM)
95 95
96 numstr6[5] = '\0'; 96 numstr6[5] = '\0';
97 97
98 smart_ulltoa5(total_number_of_sectors, numstr6, " KMGTPEZY"); 98 smart_ulltoa5(total_number_of_sectors * sector_size, numstr6, " KMGTPEZY");
99 printf("Disk %s: %llu sectors, %s\n", disk_device, 99 printf("Disk %s: %llu sectors, %s\n", disk_device,
100 (unsigned long long)total_number_of_sectors, 100 (unsigned long long)total_number_of_sectors,
101 numstr6); 101 numstr6);
@@ -112,7 +112,7 @@ gpt_list_table(int xtra UNUSED_PARAM)
112 for (i = 0; i < n_parts; i++) { 112 for (i = 0; i < n_parts; i++) {
113 gpt_partition *p = gpt_part(i); 113 gpt_partition *p = gpt_part(i);
114 if (p->lba_start) { 114 if (p->lba_start) {
115 smart_ulltoa5(1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start), 115 smart_ulltoa5((1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start)) * sector_size,
116 numstr6, " KMGTPEZY"); 116 numstr6, " KMGTPEZY");
117 printf("%4u %15llu %15llu %11s %04x ", 117 printf("%4u %15llu %15llu %11s %04x ",
118 i + 1, 118 i + 1,
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index 4d998b916..ac7e24ff8 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -66,13 +66,6 @@ static const char add_first[] ALIGN1 = "\"%07.7_Ax\n\"";
66 66
67static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:v" IF_FEATURE_HEXDUMP_REVERSE("R"); 67static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:v" IF_FEATURE_HEXDUMP_REVERSE("R");
68 68
69static const struct suffix_mult suffixes[] = {
70 { "b", 512 },
71 { "k", 1024 },
72 { "m", 1024*1024 },
73 { "", 0 }
74};
75
76int hexdump_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 69int hexdump_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
77int hexdump_main(int argc, char **argv) 70int hexdump_main(int argc, char **argv)
78{ 71{
@@ -120,7 +113,7 @@ int hexdump_main(int argc, char **argv)
120 optarg, 113 optarg,
121 /*base:*/ 0, 114 /*base:*/ 0,
122 /*lo:*/ 0, /*hi:*/ OFF_T_MAX, 115 /*lo:*/ 0, /*hi:*/ OFF_T_MAX,
123 suffixes 116 bkm_suffixes
124 ); 117 );
125 } /* else */ 118 } /* else */
126 if (ch == 'v') { 119 if (ch == 'v') {
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index c69763335..d450b5a78 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -10,12 +10,12 @@
10//usage:#define losetup_trivial_usage 10//usage:#define losetup_trivial_usage
11//usage: "[-r] [-o OFS] {-f|LOOPDEV} FILE - associate loop devices\n" 11//usage: "[-r] [-o OFS] {-f|LOOPDEV} FILE - associate loop devices\n"
12//usage: " losetup -d LOOPDEV - disassociate\n" 12//usage: " losetup -d LOOPDEV - disassociate\n"
13//usage: " losetup -a - show status of all\n" 13//usage: " losetup -a - show status\n"
14//usage: " losetup -f - show next available" 14//usage: " losetup -f - show next free loop device"
15//usage:#define losetup_full_usage "\n\n" 15//usage:#define losetup_full_usage "\n\n"
16//usage: " -o OFS Start OFS bytes into FILE" 16//usage: " -o OFS Start OFS bytes into FILE"
17//usage: "\n -r Read-only" 17//usage: "\n -r Read-only"
18//usage: "\n -f Show/find first free loop device" 18//usage: "\n -f Show/use next free loop device"
19//usage: 19//usage:
20//usage:#define losetup_notes_usage 20//usage:#define losetup_notes_usage
21//usage: "One argument (losetup /dev/loop1) will display the current association\n" 21//usage: "One argument (losetup /dev/loop1) will display the current association\n"
@@ -27,6 +27,10 @@
27 27
28#include "libbb.h" 28#include "libbb.h"
29 29
30/* 1048575 is a max possible minor number in Linux circa 2010 */
31/* for now use something less extreme */
32#define MAX_LOOP_NUM 1023
33
30int losetup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 34int losetup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
31int losetup_main(int argc UNUSED_PARAM, char **argv) 35int losetup_main(int argc UNUSED_PARAM, char **argv)
32{ 36{
@@ -59,7 +63,7 @@ int losetup_main(int argc UNUSED_PARAM, char **argv)
59 } 63 }
60 64
61 /* -d LOOPDEV */ 65 /* -d LOOPDEV */
62 if (opt == OPT_d) { 66 if (opt == OPT_d && argv[0]) {
63 if (del_loop(argv[0])) 67 if (del_loop(argv[0]))
64 bb_simple_perror_msg_and_die(argv[0]); 68 bb_simple_perror_msg_and_die(argv[0]);
65 return EXIT_SUCCESS; 69 return EXIT_SUCCESS;
@@ -68,15 +72,14 @@ int losetup_main(int argc UNUSED_PARAM, char **argv)
68 /* -a */ 72 /* -a */
69 if (opt == OPT_a) { 73 if (opt == OPT_a) {
70 int n; 74 int n;
71 for (n = 0; n < 10; n++) { 75 for (n = 0; n < MAX_LOOP_NUM; n++) {
72 char *s; 76 char *s;
73 77
74 sprintf(dev, LOOP_FORMAT, n); 78 sprintf(dev, LOOP_FORMAT, n);
75 s = query_loop(dev); 79 s = query_loop(dev);
76 if (s) { 80 if (s) {
77 printf("%s: %s\n", dev, s); 81 printf("%s: %s\n", dev, s);
78 if (ENABLE_FEATURE_CLEAN_UP) 82 free(s);
79 free(s);
80 } 83 }
81 } 84 }
82 return EXIT_SUCCESS; 85 return EXIT_SUCCESS;
@@ -88,11 +91,13 @@ int losetup_main(int argc UNUSED_PARAM, char **argv)
88 int n = 0; 91 int n = 0;
89 92
90 do { 93 do {
91 sprintf(dev, LOOP_FORMAT, n); 94 if (n > MAX_LOOP_NUM)
95 bb_error_msg_and_die("no free loop devices");
96 sprintf(dev, LOOP_FORMAT, n++);
92 s = query_loop(dev); 97 s = query_loop(dev);
93 if (s && ENABLE_FEATURE_CLEAN_UP) 98 free(s);
94 free(s);
95 } while (s); 99 } while (s);
100 /* now: dev is next free "/dev/loopN" */
96 if ((opt == OPT_f) && !argv[0]) { 101 if ((opt == OPT_f) && !argv[0]) {
97 puts(dev); 102 puts(dev);
98 return EXIT_SUCCESS; 103 return EXIT_SUCCESS;
@@ -104,18 +109,18 @@ int losetup_main(int argc UNUSED_PARAM, char **argv)
104 unsigned long long offset = 0; 109 unsigned long long offset = 0;
105 char *d = dev; 110 char *d = dev;
106 111
107 if (opt == OPT_o) 112 if (opt & OPT_o)
108 offset = xatoull(opt_o); 113 offset = xatoull(opt_o);
109 if (opt != OPT_f) 114 if (!(opt & OPT_f))
110 d = *(argv++); 115 d = *argv++;
111 116
112 if (argv[0]) { 117 if (argv[0]) {
113 if (set_loop(&d, argv[0], offset, (opt / OPT_r)) < 0) 118 if (set_loop(&d, argv[0], offset, (opt & OPT_r)) < 0)
114 bb_simple_perror_msg_and_die(argv[0]); 119 bb_simple_perror_msg_and_die(argv[0]);
115 return EXIT_SUCCESS; 120 return EXIT_SUCCESS;
116 } 121 }
117 } 122 }
118 123
119 bb_show_usage(); 124 bb_show_usage(); /* does not return */
120 return EXIT_FAILURE; 125 /*return EXIT_FAILURE;*/
121} 126}
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 1d741367e..e80b58f2e 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -295,8 +295,8 @@ struct globals {
295/* Prevent infinite loops in /sys symlinks */ 295/* Prevent infinite loops in /sys symlinks */
296#define MAX_SYSFS_DEPTH 3 296#define MAX_SYSFS_DEPTH 3
297 297
298/* We use additional 64+ bytes in make_device() */ 298/* We use additional bytes in make_device() */
299#define SCRATCH_SIZE 80 299#define SCRATCH_SIZE 128
300 300
301#if ENABLE_FEATURE_MDEV_CONF 301#if ENABLE_FEATURE_MDEV_CONF
302 302
@@ -541,7 +541,7 @@ static char *build_alias(char *alias, const char *device_name)
541 541
542/* mknod in /dev based on a path like "/sys/block/hda/hda1" 542/* mknod in /dev based on a path like "/sys/block/hda/hda1"
543 * NB1: path parameter needs to have SCRATCH_SIZE scratch bytes 543 * NB1: path parameter needs to have SCRATCH_SIZE scratch bytes
544 * after NUL, but we promise to not mangle (IOW: to restore if needed) 544 * after NUL, but we promise to not mangle (IOW: to restore NUL if needed)
545 * path string. 545 * path string.
546 * NB2: "mdev -s" may call us many times, do not leak memory/fds! 546 * NB2: "mdev -s" may call us many times, do not leak memory/fds!
547 * 547 *
@@ -551,6 +551,7 @@ static char *build_alias(char *alias, const char *device_name)
551static void make_device(char *device_name, char *path, int operation) 551static void make_device(char *device_name, char *path, int operation)
552{ 552{
553 int major, minor, type, len; 553 int major, minor, type, len;
554 char *path_end = path + strlen(path);
554 555
555 /* Try to read major/minor string. Note that the kernel puts \n after 556 /* Try to read major/minor string. Note that the kernel puts \n after
556 * the data, so we don't need to worry about null terminating the string 557 * the data, so we don't need to worry about null terminating the string
@@ -559,17 +560,15 @@ static void make_device(char *device_name, char *path, int operation)
559 */ 560 */
560 major = -1; 561 major = -1;
561 if (operation == OP_add) { 562 if (operation == OP_add) {
562 char *dev_maj_min = path + strlen(path); 563 strcpy(path_end, "/dev");
563 564 len = open_read_close(path, path_end + 1, SCRATCH_SIZE - 1);
564 strcpy(dev_maj_min, "/dev"); 565 *path_end = '\0';
565 len = open_read_close(path, dev_maj_min + 1, 64);
566 *dev_maj_min = '\0';
567 if (len < 1) { 566 if (len < 1) {
568 if (!ENABLE_FEATURE_MDEV_EXEC) 567 if (!ENABLE_FEATURE_MDEV_EXEC)
569 return; 568 return;
570 /* no "dev" file, but we can still run scripts 569 /* no "dev" file, but we can still run scripts
571 * based on device name */ 570 * based on device name */
572 } else if (sscanf(++dev_maj_min, "%u:%u", &major, &minor) == 2) { 571 } else if (sscanf(path_end + 1, "%u:%u", &major, &minor) == 2) {
573 dbg1("dev %u,%u", major, minor); 572 dbg1("dev %u,%u", major, minor);
574 } else { 573 } else {
575 major = -1; 574 major = -1;
@@ -577,9 +576,33 @@ static void make_device(char *device_name, char *path, int operation)
577 } 576 }
578 /* else: for delete, -1 still deletes the node, but < -1 suppresses that */ 577 /* else: for delete, -1 still deletes the node, but < -1 suppresses that */
579 578
580 /* Determine device name, type, major and minor */ 579 /* Determine device name */
581 if (!device_name) 580 if (!device_name) {
582 device_name = (char*) bb_basename(path); 581 /*
582 * There was no $DEVNAME envvar (for example, mdev -s never has).
583 * But it is very useful: it contains the *path*, not only basename,
584 * Thankfully, uevent file has it.
585 * Example of .../sound/card0/controlC0/uevent file on Linux-3.7.7:
586 * MAJOR=116
587 * MINOR=7
588 * DEVNAME=snd/controlC0
589 */
590 strcpy(path_end, "/uevent");
591 len = open_read_close(path, path_end + 1, SCRATCH_SIZE - 1);
592 if (len < 0)
593 len = 0;
594 *path_end = '\0';
595 path_end[1 + len] = '\0';
596 device_name = strstr(path_end + 1, "\nDEVNAME=");
597 if (device_name) {
598 device_name += sizeof("\nDEVNAME=")-1;
599 strchrnul(device_name, '\n')[0] = '\0';
600 } else {
601 /* Fall back to just basename */
602 device_name = (char*) bb_basename(path);
603 }
604 }
605 /* Determine device type */
583 /* 606 /*
584 * http://kernel.org/doc/pending/hotplug.txt says that only 607 * http://kernel.org/doc/pending/hotplug.txt says that only
585 * "/sys/block/..." is for block devices. "/sys/bus" etc is not. 608 * "/sys/block/..." is for block devices. "/sys/bus" etc is not.
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 54867ec36..afad4ab8f 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -95,6 +95,20 @@ static int do_em_all(void)
95 if (applet_name[5] != 'n' 95 if (applet_name[5] != 'n'
96 || hasmntopt(m, MNTOPT_NOAUTO) == NULL 96 || hasmntopt(m, MNTOPT_NOAUTO) == NULL
97 ) { 97 ) {
98#if ENABLE_FEATURE_SWAPON_PRI
99 char *p;
100 g_flags = 0; /* each swap space might have different flags */
101 p = strstr(m->mnt_opts, "pri=");
102 if (p) {
103 /* Max allowed 32767 (==SWAP_FLAG_PRIO_MASK) */
104 int swap_prio = MIN(bb_strtoull(p + 4 , NULL, 10), SWAP_FLAG_PRIO_MASK);
105 /* We want to allow "NNNN,foo", thus errno == EINVAL is allowed too */
106 if (errno != ERANGE) {
107 g_flags = SWAP_FLAG_PREFER |
108 (swap_prio << SWAP_FLAG_PRIO_SHIFT);
109 }
110 }
111#endif
98 err += swap_enable_disable(m->mnt_fsname); 112 err += swap_enable_disable(m->mnt_fsname);
99 } 113 }
100 } 114 }
diff --git a/util-linux/volume_id/Config.src b/util-linux/volume_id/Config.src
new file mode 100644
index 000000000..ac208c9cc
--- /dev/null
+++ b/util-linux/volume_id/Config.src
@@ -0,0 +1,15 @@
1#
2# For a description of the syntax of this configuration file,
3# see scripts/kbuild/config-language.txt.
4#
5
6config VOLUMEID
7 bool #No description makes it a hidden option
8 default n
9
10menu "Filesystem/Volume identification"
11 depends on VOLUMEID
12
13INSERT
14
15endmenu
diff --git a/util-linux/volume_id/Kbuild.src b/util-linux/volume_id/Kbuild.src
index 759fdaae5..6b4fb7470 100644
--- a/util-linux/volume_id/Kbuild.src
+++ b/util-linux/volume_id/Kbuild.src
@@ -7,41 +7,3 @@
7lib-y:= 7lib-y:=
8 8
9INSERT 9INSERT
10
11lib-$(CONFIG_BLKID) += get_devname.o
12lib-$(CONFIG_FINDFS) += get_devname.o
13lib-$(CONFIG_FEATURE_MOUNT_LABEL) += get_devname.o
14
15lib-$(CONFIG_VOLUMEID) += volume_id.o util.o
16lib-$(CONFIG_FEATURE_VOLUMEID_BTRFS) += btrfs.o
17lib-$(CONFIG_FEATURE_VOLUMEID_EXT) += ext.o
18lib-$(CONFIG_FEATURE_VOLUMEID_FAT) += fat.o
19lib-$(CONFIG_FEATURE_VOLUMEID_HFS) += hfs.o
20### lib-$(CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID) += highpoint.o
21### lib-$(CONFIG_FEATURE_VOLUMEID_ISWRAID) += isw_raid.o
22### lib-$(CONFIG_FEATURE_VOLUMEID_LSIRAID) += lsi_raid.o
23### lib-$(CONFIG_FEATURE_VOLUMEID_VIARAID) += via_raid.o
24### lib-$(CONFIG_FEATURE_VOLUMEID_SILICONRAID) += silicon_raid.o
25### lib-$(CONFIG_FEATURE_VOLUMEID_NVIDIARAID) += nvidia_raid.o
26### lib-$(CONFIG_FEATURE_VOLUMEID_PROMISERAID) += promise_raid.o
27lib-$(CONFIG_FEATURE_VOLUMEID_ISO9660) += iso9660.o
28lib-$(CONFIG_FEATURE_VOLUMEID_JFS) += jfs.o
29lib-$(CONFIG_FEATURE_VOLUMEID_LINUXRAID) += linux_raid.o
30lib-$(CONFIG_FEATURE_VOLUMEID_LINUXSWAP) += linux_swap.o
31### lib-$(CONFIG_FEATURE_VOLUMEID_LVM) += lvm.o
32### lib-$(CONFIG_FEATURE_VOLUMEID_MAC) += mac.o
33### lib-$(CONFIG_FEATURE_VOLUMEID_MSDOS) += msdos.o
34lib-$(CONFIG_FEATURE_VOLUMEID_NILFS) += nilfs.o
35lib-$(CONFIG_FEATURE_VOLUMEID_NTFS) += ntfs.o
36lib-$(CONFIG_FEATURE_VOLUMEID_EXFAT) += exfat.o
37lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o
38lib-$(CONFIG_FEATURE_VOLUMEID_UDF) += udf.o
39### lib-$(CONFIG_FEATURE_VOLUMEID_UFS) += ufs.o
40lib-$(CONFIG_FEATURE_VOLUMEID_XFS) += xfs.o
41lib-$(CONFIG_FEATURE_VOLUMEID_CRAMFS) += cramfs.o
42### lib-$(CONFIG_FEATURE_VOLUMEID_HPFS) += hpfs.o
43lib-$(CONFIG_FEATURE_VOLUMEID_ROMFS) += romfs.o
44lib-$(CONFIG_FEATURE_VOLUMEID_SYSV) += sysv.o
45### lib-$(CONFIG_FEATURE_VOLUMEID_MINIX) += minix.o
46lib-$(CONFIG_FEATURE_VOLUMEID_LUKS) += luks.o
47lib-$(CONFIG_FEATURE_VOLUMEID_OCFS2) += ocfs2.o
diff --git a/util-linux/volume_id/btrfs.c b/util-linux/volume_id/btrfs.c
index ee71d2e00..e4dddf26d 100644
--- a/util-linux/volume_id/btrfs.c
+++ b/util-linux/volume_id/btrfs.c
@@ -19,6 +19,17 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_BTRFS) += btrfs.o
23
24//config:
25//config:config FEATURE_VOLUMEID_BTRFS
26//config: bool "btrfs filesystem"
27//config: default y
28//config: depends on VOLUMEID
29//config: help
30//config: TODO
31//config:
32
22#include "volume_id_internal.h" 33#include "volume_id_internal.h"
23 34
24#define BTRFS_UUID_SIZE 16 35#define BTRFS_UUID_SIZE 16
diff --git a/util-linux/volume_id/cramfs.c b/util-linux/volume_id/cramfs.c
index 28e997043..aeb7f20ac 100644
--- a/util-linux/volume_id/cramfs.c
+++ b/util-linux/volume_id/cramfs.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_CRAMFS) += cramfs.o
22
23//config:
24//config:config FEATURE_VOLUMEID_CRAMFS
25//config: bool "cramfs filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct cramfs_super { 34struct cramfs_super {
diff --git a/util-linux/volume_id/exfat.c b/util-linux/volume_id/exfat.c
index a38a8916d..c3aa36804 100644
--- a/util-linux/volume_id/exfat.c
+++ b/util-linux/volume_id/exfat.c
@@ -18,6 +18,19 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_EXFAT) += exfat.o
22
23//config:
24//config:config FEATURE_VOLUMEID_EXFAT
25//config: bool "exFAT filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: exFAT (extended FAT) is a proprietary file system designed especially
30//config: for flash drives. It has many features from NTFS, but with less
31//config: overhead. exFAT is used on most SDXC cards for consumer electronics.
32//config:
33
21#include "volume_id_internal.h" 34#include "volume_id_internal.h"
22 35
23#define EXFAT_SB_OFFSET 0 36#define EXFAT_SB_OFFSET 0
diff --git a/util-linux/volume_id/ext.c b/util-linux/volume_id/ext.c
index 97451067f..df39d9342 100644
--- a/util-linux/volume_id/ext.c
+++ b/util-linux/volume_id/ext.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_EXT) += ext.o
22
23//config:
24//config:config FEATURE_VOLUMEID_EXT
25//config: bool "Ext filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22#include "bb_e2fs_defs.h" 33#include "bb_e2fs_defs.h"
23 34
diff --git a/util-linux/volume_id/f2fs.c b/util-linux/volume_id/f2fs.c
new file mode 100644
index 000000000..bf0b66278
--- /dev/null
+++ b/util-linux/volume_id/f2fs.c
@@ -0,0 +1,95 @@
1/*
2 * volume_id - reads filesystem label and uuid
3 *
4 * Copyright (C) 2012 S-G Bergh <sgb@systemasis.org>
5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */
8
9//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_F2FS) += f2fs.o
10
11//config:
12//config:config FEATURE_VOLUMEID_F2FS
13//config: bool "f2fs filesystem"
14//config: default y
15//config: depends on VOLUMEID
16//config: help
17//config: F2FS (aka Flash-Friendly File System) is a log-structured file system,
18//config: which is adapted to newer forms of storage. F2FS also remedies some
19//config: known issues of the older log structured file systems, such as high
20//config: cleaning overhead.
21//config:
22
23#include "volume_id_internal.h"
24
25#define F2FS_MAGIC 0xF2F52010 // F2FS Magic Number
26#define F2FS_UUID_SIZE 16
27#define F2FS_LABEL_SIZE 512
28#define F2FS_LABEL_BYTES 1024
29#define F2FS_SB1_OFFSET 0x400 // offset for 1:st super block
30/*
31#define F2FS_SB2_OFFSET 0x1400 // offset for 2:nd super block
32*/
33
34struct f2fs_super_block { // According to version 1.1
35/* 0x00 */ uint32_t magic; // Magic Number
36/* 0x04 */ uint16_t major_ver; // Major Version
37/* 0x06 */ uint16_t minor_ver; // Minor Version
38/* 0x08 */ uint32_t log_sectorsize; // log2 sector size in bytes
39/* 0x0C */ uint32_t log_sectors_per_block; // log2 # of sectors per block
40/* 0x10 */ uint32_t log_blocksize; // log2 block size in bytes
41/* 0x14 */ uint32_t log_blocks_per_seg; // log2 # of blocks per segment
42/* 0x18 */ uint32_t segs_per_sec; // # of segments per section
43/* 0x1C */ uint32_t secs_per_zone; // # of sections per zone
44/* 0x20 */ uint32_t checksum_offset; // checksum offset inside super block
45/* 0x24 */ uint64_t block_count; // total # of user blocks
46/* 0x2C */ uint32_t section_count; // total # of sections
47/* 0x30 */ uint32_t segment_count; // total # of segments
48/* 0x34 */ uint32_t segment_count_ckpt; // # of segments for checkpoint
49/* 0x38 */ uint32_t segment_count_sit; // # of segments for SIT
50/* 0x3C */ uint32_t segment_count_nat; // # of segments for NAT
51/* 0x40 */ uint32_t segment_count_ssa; // # of segments for SSA
52/* 0x44 */ uint32_t segment_count_main; // # of segments for main area
53/* 0x48 */ uint32_t segment0_blkaddr; // start block address of segment 0
54/* 0x4C */ uint32_t cp_blkaddr; // start block address of checkpoint
55/* 0x50 */ uint32_t sit_blkaddr; // start block address of SIT
56/* 0x54 */ uint32_t nat_blkaddr; // start block address of NAT
57/* 0x58 */ uint32_t ssa_blkaddr; // start block address of SSA
58/* 0x5C */ uint32_t main_blkaddr; // start block address of main area
59/* 0x60 */ uint32_t root_ino; // root inode number
60/* 0x64 */ uint32_t node_ino; // node inode number
61/* 0x68 */ uint32_t meta_ino; // meta inode number
62/* 0x6C */ uint8_t uuid[F2FS_UUID_SIZE]; // 128-bit uuid for volume
63/* 0x7C */ uint16_t volume_name[F2FS_LABEL_SIZE]; // volume name
64// /* 0x47C */ uint32_t extension_count; // # of extensions below
65// /* 0x480 */ uint8_t extension_list[64][8]; // extension array
66} PACKED;
67
68
69int FAST_FUNC volume_id_probe_f2fs(struct volume_id *id /*,uint64_t off*/)
70{
71 struct f2fs_super_block *sb;
72
73 // Go for primary super block (ignore second sb)
74 dbg("f2fs: probing at offset 0x%x", F2FS_SB1_OFFSET);
75 sb = volume_id_get_buffer(id, F2FS_SB1_OFFSET, sizeof(*sb));
76
77 if (!sb)
78 return -1;
79
80 if (sb->magic != cpu_to_le32(F2FS_MAGIC))
81 return -1;
82
83 IF_FEATURE_BLKID_TYPE(id->type = "f2fs");
84
85 // For version 1.0 we don't know sb structure and can't set label/uuid
86 if (sb->major_ver == cpu_to_le16(1) && sb->minor_ver == cpu_to_le16(0))
87 return 0;
88
89 volume_id_set_label_unicode16(id, (uint8_t *)sb->volume_name,
90 LE, MIN(F2FS_LABEL_BYTES, VOLUME_ID_LABEL_SIZE));
91
92 volume_id_set_uuid(id, sb->uuid, UUID_DCE);
93
94 return 0;
95}
diff --git a/util-linux/volume_id/fat.c b/util-linux/volume_id/fat.c
index 904fbb201..476d500a6 100644
--- a/util-linux/volume_id/fat.c
+++ b/util-linux/volume_id/fat.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_FAT) += fat.o
22
23//config:
24//config:config FEATURE_VOLUMEID_FAT
25//config: bool "fat filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23/* linux/msdos_fs.h says: */ 34/* linux/msdos_fs.h says: */
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index 665cb9b6e..0c6bdfddf 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -7,6 +7,11 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11//kbuild:lib-$(CONFIG_BLKID) += get_devname.o
12//kbuild:lib-$(CONFIG_FINDFS) += get_devname.o
13//kbuild:lib-$(CONFIG_FEATURE_MOUNT_LABEL) += get_devname.o
14
10#include <sys/mount.h> /* BLKGETSIZE64 */ 15#include <sys/mount.h> /* BLKGETSIZE64 */
11#if !defined(BLKGETSIZE64) 16#if !defined(BLKGETSIZE64)
12# define BLKGETSIZE64 _IOR(0x12,114,size_t) 17# define BLKGETSIZE64 _IOR(0x12,114,size_t)
diff --git a/util-linux/volume_id/hfs.c b/util-linux/volume_id/hfs.c
index 3d9704d12..8d34aaf68 100644
--- a/util-linux/volume_id/hfs.c
+++ b/util-linux/volume_id/hfs.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_HFS) += hfs.o
22
23//config:
24//config:config FEATURE_VOLUMEID_HFS
25//config: bool "hfs filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct hfs_finder_info{ 34struct hfs_finder_info{
diff --git a/util-linux/volume_id/iso9660.c b/util-linux/volume_id/iso9660.c
index 1d7693a9c..3848de453 100644
--- a/util-linux/volume_id/iso9660.c
+++ b/util-linux/volume_id/iso9660.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_ISO9660) += iso9660.o
22
23//config:
24//config:config FEATURE_VOLUMEID_ISO9660
25//config: bool "iso9660 filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23#define ISO_SUPERBLOCK_OFFSET 0x8000 34#define ISO_SUPERBLOCK_OFFSET 0x8000
diff --git a/util-linux/volume_id/jfs.c b/util-linux/volume_id/jfs.c
index 5333af2c3..a6eaff45b 100644
--- a/util-linux/volume_id/jfs.c
+++ b/util-linux/volume_id/jfs.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_JFS) += jfs.o
22
23//config:
24//config:config FEATURE_VOLUMEID_JFS
25//config: bool "jfs filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct jfs_super_block { 34struct jfs_super_block {
diff --git a/util-linux/volume_id/linux_raid.c b/util-linux/volume_id/linux_raid.c
index 209eaabe9..f20823a6e 100644
--- a/util-linux/volume_id/linux_raid.c
+++ b/util-linux/volume_id/linux_raid.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_LINUXRAID) += linux_raid.o
22
23//config:
24//config:config FEATURE_VOLUMEID_LINUXRAID
25//config: bool "linuxraid"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct mdp_super_block { 34struct mdp_super_block {
diff --git a/util-linux/volume_id/linux_swap.c b/util-linux/volume_id/linux_swap.c
index 1ee534ab0..39470d48c 100644
--- a/util-linux/volume_id/linux_swap.c
+++ b/util-linux/volume_id/linux_swap.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_LINUXSWAP) += linux_swap.o
22
23//config:
24//config:config FEATURE_VOLUMEID_LINUXSWAP
25//config: bool "linux swap filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct swap_header_v1_2 { 34struct swap_header_v1_2 {
diff --git a/util-linux/volume_id/luks.c b/util-linux/volume_id/luks.c
index f9b376672..42bf87659 100644
--- a/util-linux/volume_id/luks.c
+++ b/util-linux/volume_id/luks.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_LUKS) += luks.o
22
23//config:
24//config:config FEATURE_VOLUMEID_LUKS
25//config: bool "luks filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23#define LUKS_MAGIC_L 6 34#define LUKS_MAGIC_L 6
diff --git a/util-linux/volume_id/nilfs.c b/util-linux/volume_id/nilfs.c
index b88a9e435..f3a9ef58d 100644
--- a/util-linux/volume_id/nilfs.c
+++ b/util-linux/volume_id/nilfs.c
@@ -19,6 +19,26 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_NILFS) += nilfs.o
23
24//config:
25//config:config FEATURE_VOLUMEID_NILFS
26//config: bool "nilfs filesystem"
27//config: default y
28//config: depends on VOLUMEID
29//config: help
30//config: NILFS is a New Implementation of a Log-Structured File System (LFS)
31//config: that supports continuous snapshots. This provides features like
32//config: versioning of the entire filesystem, restoration of files that
33//config: were deleted a few minutes ago. NILFS keeps consistency like
34//config: conventional LFS, so it provides quick recovery after system crashes.
35//config:
36//config: The possible use of NILFS includes versioning, tamper detection,
37//config: SOX compliance logging, and so forth. It can serve as an alternative
38//config: filesystem for Linux desktop environment, or as a basis of advanced
39//config: storage appliances.
40//config:
41
22#include "volume_id_internal.h" 42#include "volume_id_internal.h"
23 43
24#define NILFS_UUID_SIZE 16 44#define NILFS_UUID_SIZE 16
diff --git a/util-linux/volume_id/ntfs.c b/util-linux/volume_id/ntfs.c
index 7b2612f01..46f687a56 100644
--- a/util-linux/volume_id/ntfs.c
+++ b/util-linux/volume_id/ntfs.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_NTFS) += ntfs.o
22
23//config:
24//config:config FEATURE_VOLUMEID_NTFS
25//config: bool "ntfs filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct ntfs_super_block { 34struct ntfs_super_block {
@@ -150,7 +161,7 @@ int FAST_FUNC volume_id_probe_ntfs(struct volume_id *id /*,uint64_t off*/)
150 161
151 attr = (struct file_attribute*) &buf[attr_off]; 162 attr = (struct file_attribute*) &buf[attr_off];
152 attr_type = le32_to_cpu(attr->type); 163 attr_type = le32_to_cpu(attr->type);
153 attr_len = le16_to_cpu(attr->len); 164 attr_len = le32_to_cpu(attr->len);
154 val_off = le16_to_cpu(attr->value_offset); 165 val_off = le16_to_cpu(attr->value_offset);
155 val_len = le32_to_cpu(attr->value_len); 166 val_len = le32_to_cpu(attr->value_len);
156 attr_off += attr_len; 167 attr_off += attr_len;
diff --git a/util-linux/volume_id/ocfs2.c b/util-linux/volume_id/ocfs2.c
index fcdb15192..415e0bf61 100644
--- a/util-linux/volume_id/ocfs2.c
+++ b/util-linux/volume_id/ocfs2.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_OCFS2) += ocfs2.o
22
23//config:
24//config:config FEATURE_VOLUMEID_OCFS2
25//config: bool "ocfs2 filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23/* All these values are taken from ocfs2-tools's ocfs2_fs.h */ 34/* All these values are taken from ocfs2-tools's ocfs2_fs.h */
diff --git a/util-linux/volume_id/reiserfs.c b/util-linux/volume_id/reiserfs.c
index 67b4a1877..24979fb1c 100644
--- a/util-linux/volume_id/reiserfs.c
+++ b/util-linux/volume_id/reiserfs.c
@@ -19,6 +19,17 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o
23
24//config:
25//config:config FEATURE_VOLUMEID_REISERFS
26//config: bool "Reiser filesystem"
27//config: default y
28//config: depends on VOLUMEID
29//config: help
30//config: TODO
31//config:
32
22#include "volume_id_internal.h" 33#include "volume_id_internal.h"
23 34
24struct reiserfs_super_block { 35struct reiserfs_super_block {
diff --git a/util-linux/volume_id/romfs.c b/util-linux/volume_id/romfs.c
index 15653bedf..4754fdb37 100644
--- a/util-linux/volume_id/romfs.c
+++ b/util-linux/volume_id/romfs.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_ROMFS) += romfs.o
22
23//config:
24//config:config FEATURE_VOLUMEID_ROMFS
25//config: bool "romfs filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct romfs_super { 34struct romfs_super {
diff --git a/util-linux/volume_id/squashfs.c b/util-linux/volume_id/squashfs.c
index c5b4f9ced..079b6cc31 100644
--- a/util-linux/volume_id/squashfs.c
+++ b/util-linux/volume_id/squashfs.c
@@ -8,6 +8,18 @@
8 8
9//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_SQUASHFS) += squashfs.o 9//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_SQUASHFS) += squashfs.o
10 10
11//config:
12//config:config FEATURE_VOLUMEID_SQUASHFS
13//config: bool "SquashFS filesystem"
14//config: default y
15//config: depends on VOLUMEID && FEATURE_BLKID_TYPE
16//config: help
17//config: Squashfs is a compressed read-only filesystem for Linux. Squashfs is
18//config: intended for general read-only filesystem use and in constrained block
19//config: device/memory systems (e.g. embedded systems) where low overhead is
20//config: needed.
21//config:
22
11#include "volume_id_internal.h" 23#include "volume_id_internal.h"
12 24
13struct squashfs_superblock { 25struct squashfs_superblock {
diff --git a/util-linux/volume_id/sysv.c b/util-linux/volume_id/sysv.c
index 6eb96464d..7b4b5360b 100644
--- a/util-linux/volume_id/sysv.c
+++ b/util-linux/volume_id/sysv.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_SYSV) += sysv.o
22
23//config:
24//config:config FEATURE_VOLUMEID_SYSV
25//config: bool "sysv filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23#define SYSV_NICINOD 100 34#define SYSV_NICINOD 100
diff --git a/util-linux/volume_id/udf.c b/util-linux/volume_id/udf.c
index d3747fb8e..921454503 100644
--- a/util-linux/volume_id/udf.c
+++ b/util-linux/volume_id/udf.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_UDF) += udf.o
22
23//config:
24//config:config FEATURE_VOLUMEID_UDF
25//config: bool "udf filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct volume_descriptor { 34struct volume_descriptor {
diff --git a/util-linux/volume_id/unused_highpoint.c b/util-linux/volume_id/unused_highpoint.c
index 17b7b3291..7231a1db2 100644
--- a/util-linux/volume_id/unused_highpoint.c
+++ b/util-linux/volume_id/unused_highpoint.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID) += highpoint.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_HIGHPOINTRAID
25//config:### bool "highpoint raid"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct hpt37x_meta { 34struct hpt37x_meta {
diff --git a/util-linux/volume_id/unused_hpfs.c b/util-linux/volume_id/unused_hpfs.c
index 442952464..a87c89fb3 100644
--- a/util-linux/volume_id/unused_hpfs.c
+++ b/util-linux/volume_id/unused_hpfs.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_HPFS) += hpfs.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_HPFS
25//config:### bool "hpfs filesystem"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct hpfs_super { 34struct hpfs_super {
diff --git a/util-linux/volume_id/unused_isw_raid.c b/util-linux/volume_id/unused_isw_raid.c
index 7ab47b3a1..851bd2f8f 100644
--- a/util-linux/volume_id/unused_isw_raid.c
+++ b/util-linux/volume_id/unused_isw_raid.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_ISWRAID) += isw_raid.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_ISWRAID
25//config:### bool "intel raid"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct isw_meta { 34struct isw_meta {
diff --git a/util-linux/volume_id/unused_lsi_raid.c b/util-linux/volume_id/unused_lsi_raid.c
index e6cc8edd3..52d68deab 100644
--- a/util-linux/volume_id/unused_lsi_raid.c
+++ b/util-linux/volume_id/unused_lsi_raid.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_LSIRAID) += lsi_raid.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_LSIRAID
25//config:### bool "lsi raid"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct lsi_meta { 34struct lsi_meta {
diff --git a/util-linux/volume_id/unused_lvm.c b/util-linux/volume_id/unused_lvm.c
index 2206498bf..08fa05243 100644
--- a/util-linux/volume_id/unused_lvm.c
+++ b/util-linux/volume_id/unused_lvm.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_LVM) += lvm.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_LVM
25//config:### bool "lvm"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct lvm1_super_block { 34struct lvm1_super_block {
diff --git a/util-linux/volume_id/unused_mac.c b/util-linux/volume_id/unused_mac.c
index e8deb9720..a1a53d1fb 100644
--- a/util-linux/volume_id/unused_mac.c
+++ b/util-linux/volume_id/unused_mac.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_MAC) += mac.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_MAC
25//config:### bool "mac filesystem"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct mac_driver_desc { 34struct mac_driver_desc {
diff --git a/util-linux/volume_id/unused_minix.c b/util-linux/volume_id/unused_minix.c
index a3e1077b0..50afd5c3e 100644
--- a/util-linux/volume_id/unused_minix.c
+++ b/util-linux/volume_id/unused_minix.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_MINIX) += minix.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_MINIX
25//config:### bool "minix filesystem"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct minix_super_block { 34struct minix_super_block {
diff --git a/util-linux/volume_id/unused_msdos.c b/util-linux/volume_id/unused_msdos.c
index 2e8cb196a..d2fc66caa 100644
--- a/util-linux/volume_id/unused_msdos.c
+++ b/util-linux/volume_id/unused_msdos.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_MSDOS) += msdos.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_MSDOS
25//config:### bool "msdos filesystem"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct msdos_partition_entry { 34struct msdos_partition_entry {
diff --git a/util-linux/volume_id/unused_nvidia_raid.c b/util-linux/volume_id/unused_nvidia_raid.c
index 9e8472921..d99a108f3 100644
--- a/util-linux/volume_id/unused_nvidia_raid.c
+++ b/util-linux/volume_id/unused_nvidia_raid.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_NVIDIARAID) += nvidia_raid.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_NVIDIARAID
25//config:### bool "nvidia raid"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct nvidia_meta { 34struct nvidia_meta {
diff --git a/util-linux/volume_id/unused_promise_raid.c b/util-linux/volume_id/unused_promise_raid.c
index 0b0d0063c..cebebe35f 100644
--- a/util-linux/volume_id/unused_promise_raid.c
+++ b/util-linux/volume_id/unused_promise_raid.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_PROMISERAID) += promise_raid.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_PROMISERAID
25//config:### bool "promise raid"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct promise_meta { 34struct promise_meta {
diff --git a/util-linux/volume_id/unused_silicon_raid.c b/util-linux/volume_id/unused_silicon_raid.c
index 878b88197..40c8faa9e 100644
--- a/util-linux/volume_id/unused_silicon_raid.c
+++ b/util-linux/volume_id/unused_silicon_raid.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_SILICONRAID) += silicon_raid.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_SILICONRAID
25//config:### bool "silicon raid"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct silicon_meta { 34struct silicon_meta {
diff --git a/util-linux/volume_id/unused_ufs.c b/util-linux/volume_id/unused_ufs.c
index 9f925d983..d33c10fc4 100644
--- a/util-linux/volume_id/unused_ufs.c
+++ b/util-linux/volume_id/unused_ufs.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_UFS) += ufs.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_UFS
25//config:### bool "ufs filesystem"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct ufs_super_block { 34struct ufs_super_block {
diff --git a/util-linux/volume_id/unused_via_raid.c b/util-linux/volume_id/unused_via_raid.c
index a11eec13a..258f93a4f 100644
--- a/util-linux/volume_id/unused_via_raid.c
+++ b/util-linux/volume_id/unused_via_raid.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_VIARAID) += via_raid.o
22
23//config:
24//config:### config FEATURE_VOLUMEID_VIARAID
25//config:### bool "via raid"
26//config:### default y
27//config:### depends on VOLUMEID
28//config:### help
29//config:### TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct via_meta { 34struct via_meta {
diff --git a/util-linux/volume_id/volume_id.c b/util-linux/volume_id/volume_id.c
index f0fc84c05..5c459a0e2 100644
--- a/util-linux/volume_id/volume_id.c
+++ b/util-linux/volume_id/volume_id.c
@@ -18,6 +18,8 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_VOLUMEID) += volume_id.o util.o
22
21#include "volume_id_internal.h" 23#include "volume_id_internal.h"
22 24
23 25
@@ -136,6 +138,9 @@ static const probe_fptr fs2[] = {
136#if ENABLE_FEATURE_VOLUMEID_UFS 138#if ENABLE_FEATURE_VOLUMEID_UFS
137 volume_id_probe_ufs, 139 volume_id_probe_ufs,
138#endif 140#endif
141#if ENABLE_FEATURE_VOLUMEID_F2FS
142 volume_id_probe_f2fs,
143#endif
139#if ENABLE_FEATURE_VOLUMEID_NILFS 144#if ENABLE_FEATURE_VOLUMEID_NILFS
140 volume_id_probe_nilfs, 145 volume_id_probe_nilfs,
141#endif 146#endif
diff --git a/util-linux/volume_id/volume_id_internal.h b/util-linux/volume_id/volume_id_internal.h
index 3f02bd50d..6e2dbd7bb 100644
--- a/util-linux/volume_id/volume_id_internal.h
+++ b/util-linux/volume_id/volume_id_internal.h
@@ -96,44 +96,24 @@ void FAST_FUNC free_volume_id(struct volume_id *id);
96/* size of seek buffer, FAT cluster is 32k max */ 96/* size of seek buffer, FAT cluster is 32k max */
97#define SEEK_BUFFER_SIZE 0x10000 97#define SEEK_BUFFER_SIZE 0x10000
98 98
99#define bswap16(x) (uint16_t) ( \
100 (((uint16_t)(x) & 0x00ffu) << 8) | \
101 (((uint16_t)(x) & 0xff00u) >> 8))
102
103#define bswap32(x) (uint32_t) ( \
104 (((uint32_t)(x) & 0xff000000u) >> 24) | \
105 (((uint32_t)(x) & 0x00ff0000u) >> 8) | \
106 (((uint32_t)(x) & 0x0000ff00u) << 8) | \
107 (((uint32_t)(x) & 0x000000ffu) << 24))
108
109#define bswap64(x) (uint64_t) ( \
110 (((uint64_t)(x) & 0xff00000000000000ull) >> 56) | \
111 (((uint64_t)(x) & 0x00ff000000000000ull) >> 40) | \
112 (((uint64_t)(x) & 0x0000ff0000000000ull) >> 24) | \
113 (((uint64_t)(x) & 0x000000ff00000000ull) >> 8) | \
114 (((uint64_t)(x) & 0x00000000ff000000ull) << 8) | \
115 (((uint64_t)(x) & 0x0000000000ff0000ull) << 24) | \
116 (((uint64_t)(x) & 0x000000000000ff00ull) << 40) | \
117 (((uint64_t)(x) & 0x00000000000000ffull) << 56))
118
119#if BB_LITTLE_ENDIAN 99#if BB_LITTLE_ENDIAN
120#define le16_to_cpu(x) (x) 100# define le16_to_cpu(x) (uint16_t)(x)
121#define le32_to_cpu(x) (x) 101# define le32_to_cpu(x) (uint32_t)(x)
122#define le64_to_cpu(x) (x) 102# define le64_to_cpu(x) (uint64_t)(x)
123#define be16_to_cpu(x) bswap16(x) 103# define be16_to_cpu(x) (uint16_t)(bswap_16(x))
124#define be32_to_cpu(x) bswap32(x) 104# define be32_to_cpu(x) (uint32_t)(bswap_32(x))
125#define cpu_to_le16(x) (x) 105# define cpu_to_le16(x) (uint16_t)(x)
126#define cpu_to_le32(x) (x) 106# define cpu_to_le32(x) (uint32_t)(x)
127#define cpu_to_be32(x) bswap32(x) 107# define cpu_to_be32(x) (uint32_t)(bswap_32(x))
128#else 108#else
129#define le16_to_cpu(x) bswap16(x) 109# define le16_to_cpu(x) (uint16_t)(bswap_16(x))
130#define le32_to_cpu(x) bswap32(x) 110# define le32_to_cpu(x) (uint32_t)(bswap_32(x))
131#define le64_to_cpu(x) bswap64(x) 111# define le64_to_cpu(x) (uint64_t)(bb_bswap_64(x))
132#define be16_to_cpu(x) (x) 112# define be16_to_cpu(x) (uint16_t)(x)
133#define be32_to_cpu(x) (x) 113# define be32_to_cpu(x) (uint32_t)(x)
134#define cpu_to_le16(x) bswap16(x) 114# define cpu_to_le16(x) (uint16_t)(bswap_16(x))
135#define cpu_to_le32(x) bswap32(x) 115# define cpu_to_le32(x) (uint32_t)(bswap_32(x))
136#define cpu_to_be32(x) (x) 116# define cpu_to_be32(x) (uint32_t)(x)
137#endif 117#endif
138 118
139/* volume_id_set_uuid(id,buf,fmt) assumes size of uuid buf 119/* volume_id_set_uuid(id,buf,fmt) assumes size of uuid buf
@@ -215,6 +195,8 @@ int FAST_FUNC volume_id_probe_luks(struct volume_id *id /*,uint64_t off*/);
215 195
216//int FAST_FUNC volume_id_probe_msdos_part_table(struct volume_id *id /*,uint64_t off*/); 196//int FAST_FUNC volume_id_probe_msdos_part_table(struct volume_id *id /*,uint64_t off*/);
217 197
198int FAST_FUNC volume_id_probe_f2fs(struct volume_id *id /*,uint64_t off*/);
199
218int FAST_FUNC volume_id_probe_nilfs(struct volume_id *id /*,uint64_t off*/); 200int FAST_FUNC volume_id_probe_nilfs(struct volume_id *id /*,uint64_t off*/);
219 201
220int FAST_FUNC volume_id_probe_ntfs(struct volume_id *id /*,uint64_t off*/); 202int FAST_FUNC volume_id_probe_ntfs(struct volume_id *id /*,uint64_t off*/);
diff --git a/util-linux/volume_id/xfs.c b/util-linux/volume_id/xfs.c
index 84746020e..5eefc201d 100644
--- a/util-linux/volume_id/xfs.c
+++ b/util-linux/volume_id/xfs.c
@@ -18,6 +18,17 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21//kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_XFS) += xfs.o
22
23//config:
24//config:config FEATURE_VOLUMEID_XFS
25//config: bool "xfs filesystem"
26//config: default y
27//config: depends on VOLUMEID
28//config: help
29//config: TODO
30//config:
31
21#include "volume_id_internal.h" 32#include "volume_id_internal.h"
22 33
23struct xfs_super_block { 34struct xfs_super_block {