Date: Monday, August 2, 2010 @ 10:22:19 Author: tpowa Revision: 86506
upgpkg: util-linux-ng 2.18-3 added nilfs2 support and fixed cfdisk partition changer Added: util-linux-ng/trunk/util-linux-ng-cfdisk.patch util-linux-ng/trunk/util-linux-ng-nilfs2.patch Modified: util-linux-ng/trunk/PKGBUILD ----------------------------+ PKGBUILD | 14 +- util-linux-ng-cfdisk.patch | 57 ++++++++ util-linux-ng-nilfs2.patch | 276 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 344 insertions(+), 3 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2010-08-02 12:41:02 UTC (rev 86505) +++ PKGBUILD 2010-08-02 14:22:19 UTC (rev 86506) @@ -2,7 +2,7 @@ # Maintainer: judd <[email protected]> pkgname=util-linux-ng pkgver=2.18 -pkgrel=2 +pkgrel=3 pkgdesc="Miscellaneous system utilities for Linux" url="http://userweb.kernel.org/~kzak/util-linux-ng/" arch=('i686' 'x86_64') @@ -14,11 +14,15 @@ license=('GPL2') options=('!libtool') source=(ftp://ftp.kernel.org/pub/linux/utils/${pkgname}/v2.18/${pkgname}-${pkgver}.tar.bz2 - fix-findmnt.patch) + fix-findmnt.patch + util-linux-ng-nilfs2.patch + util-linux-ng-cfdisk.patch) optdepends=('perl: for chkdupexe support') install=util-linux-ng.install md5sums=('2f5f71e6af969d041d73ab778c141a77' - '7346673932b165faadde2fa2a9c1cd3a') + '7346673932b165faadde2fa2a9c1cd3a' + 'aa1f210aa22363605363b7b14b8f7a78' + 'e6d9309d44c258b25a7fb0b70f94f94e') build() { cd "${srcdir}/${pkgname}-${pkgver}" @@ -27,6 +31,10 @@ mkdir -p "${pkgdir}/var/lib/hwclock" || return 1 # fix findmnt patch -p1 -i "${srcdir}/fix-findmnt.patch" + # add nilfs2 support, included in next upstream release + patch -Np1 -i "${srcdir}/util-linux-ng-nilfs2.patch" + # fix cfdisk partition changing, included in next upstream release + patch -Np1 -i "${srcdir}/util-linux-ng-cfdisk.patch" autoreconf || return 1 automake || return 1 Added: util-linux-ng-cfdisk.patch =================================================================== --- util-linux-ng-cfdisk.patch (rev 0) +++ util-linux-ng-cfdisk.patch 2010-08-02 14:22:19 UTC (rev 86506) @@ -0,0 +1,57 @@ +From 54a0fe298b4d6d948cffbd6fbbbe7dbabc9a6bb1 Mon Sep 17 00:00:00 2001 +From: Karel Zak <[email protected]> +Date: Mon, 19 Jul 2010 22:52:58 +0200 +Subject: [PATCH] cfdisk: get_string not calculating correct limits + +Reported-by: James L. Hammons <[email protected]> +Signed-off-by: Karel Zak <[email protected]> +--- + fdisk/cfdisk.c | 11 ++++++++--- + 1 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c +index 7fa0b19..e7955fe 100644 +--- a/fdisk/cfdisk.c ++++ b/fdisk/cfdisk.c +@@ -421,6 +421,11 @@ fdexit(int ret) { + exit(ret); + } + ++/* ++ * Note that @len is size of @str buffer. ++ * ++ * Returns number of read bytes (without \0). ++ */ + static int + get_string(char *str, int len, char *def) { + size_t cells = 0, i = 0; +@@ -472,7 +477,7 @@ get_string(char *str, int len, char *def) { + break; + default: + #if defined(HAVE_LIBNCURSESW) && defined(HAVE_WIDECHAR) +- if (i < len && iswprint(c)) { ++ if (i + 1 < len && iswprint(c)) { + wchar_t wc = (wchar_t) c; + char s[MB_CUR_MAX + 1]; + int sz = wctomb(s, wc); +@@ -492,7 +497,7 @@ get_string(char *str, int len, char *def) { + putchar(BELL); + } + #else +- if (i < len && isprint(c)) { ++ if (i + 1 < len && isprint(c)) { + mvaddch(y, x + cells, c); + if (use_def) { + clrtoeol(); +@@ -2405,7 +2410,7 @@ change_id(int i) { + + sprintf(def, "%02X", new_id); + mvaddstr(COMMAND_LINE_Y, COMMAND_LINE_X, _("Enter filesystem type: ")); +- if ((len = get_string(id, 2, def)) <= 0 && len != GS_DEFAULT) ++ if ((len = get_string(id, 3, def)) <= 0 && len != GS_DEFAULT) + return; + + if (len != GS_DEFAULT) { +-- +1.7.2.1 + Added: util-linux-ng-nilfs2.patch =================================================================== --- util-linux-ng-nilfs2.patch (rev 0) +++ util-linux-ng-nilfs2.patch 2010-08-02 14:22:19 UTC (rev 86506) @@ -0,0 +1,276 @@ +From b44b8600d4096de8203c1fb0702bbc95ee51017f Mon Sep 17 00:00:00 2001 +From: Jiro SEKIBA <[email protected]> +Date: Tue, 13 Jul 2010 09:12:56 +0200 +Subject: [PATCH] libblkid: add nilfs2 filesystem superblock probe + +This patch implements nilfs2_idinfo to proble nilfs2 partition. +The patch probes uuid, label, version and verify crc check sum of +superblock. + +Signed-off-by: Jiro SEKIBA <[email protected]> +Signed-off-by: Karel Zak <[email protected]> +--- + shlibs/blkid/src/superblocks/Makefile.am | 1 + + shlibs/blkid/src/superblocks/nilfs.c | 120 ++++++++++++++++++++++++++++ + shlibs/blkid/src/superblocks/superblocks.c | 1 + + shlibs/blkid/src/superblocks/superblocks.h | 1 + + 4 files changed, 123 insertions(+), 0 deletions(-) + create mode 100644 shlibs/blkid/src/superblocks/nilfs.c + +diff --git a/shlibs/blkid/src/superblocks/Makefile.am b/shlibs/blkid/src/superblocks/Makefile.am +index 39b074b..1501fab 100644 +--- a/shlibs/blkid/src/superblocks/Makefile.am ++++ b/shlibs/blkid/src/superblocks/Makefile.am +@@ -47,4 +47,5 @@ libblkid_superblocks_la_SOURCES = \ + drbd.c \ + vmfs.c \ + befs.c \ ++ nilfs.c \ + exfat.c +diff --git a/shlibs/blkid/src/superblocks/nilfs.c b/shlibs/blkid/src/superblocks/nilfs.c +new file mode 100644 +index 0000000..c7aba35 +--- /dev/null ++++ b/shlibs/blkid/src/superblocks/nilfs.c +@@ -0,0 +1,120 @@ ++/* ++ * Copyright (C) 2010 by Jiro SEKIBA <[email protected]> ++ * ++ * This file may be redistributed under the terms of the ++ * GNU Lesser General Public License ++ */ ++#include <stddef.h> ++#include <string.h> ++ ++#include "superblocks.h" ++#include "crc32.h" ++ ++struct nilfs_super_block { ++ uint32_t s_rev_level; ++ uint16_t s_minor_rev_level; ++ uint16_t s_magic; ++ ++ uint16_t s_bytes; ++ ++ uint16_t s_flags; ++ uint32_t s_crc_seed; ++ uint32_t s_sum; ++ ++ uint32_t s_log_block_size; ++ ++ uint64_t s_nsegments; ++ uint64_t s_dev_size; ++ uint64_t s_first_data_block; ++ uint32_t s_blocks_per_segment; ++ uint32_t s_r_segments_percentage; ++ ++ uint64_t s_last_cno; ++ uint64_t s_last_pseg; ++ uint64_t s_last_seq; ++ uint64_t s_free_blocks_count; ++ ++ uint64_t s_ctime; ++ ++ uint64_t s_mtime; ++ uint64_t s_wtime; ++ uint16_t s_mnt_count; ++ uint16_t s_max_mnt_count; ++ uint16_t s_state; ++ uint16_t s_errors; ++ uint64_t s_lastcheck; ++ ++ uint32_t s_checkinterval; ++ uint32_t s_creator_os; ++ uint16_t s_def_resuid; ++ uint16_t s_def_resgid; ++ uint32_t s_first_ino; ++ ++ uint16_t s_inode_size; ++ uint16_t s_dat_entry_size; ++ uint16_t s_checkpoint_size; ++ uint16_t s_segment_usage_size; ++ ++ uint8_t s_uuid[16]; ++ char s_volume_name[80]; ++ ++ uint32_t s_c_interval; ++ uint32_t s_c_block_max; ++ uint32_t s_reserved[192]; ++}; ++ ++/* nilfs2 magic string */ ++#define NILFS_SB_MAGIC "\x34\x34" ++/* nilfs2 super block offset */ ++#define NILFS_SB_OFF 0x400 ++/* nilfs2 super block offset in kB */ ++#define NILFS_SB_KBOFF (NILFS_SB_OFF >> 10) ++/* nilfs2 magic string offset within super block */ ++#define NILFS_MAG_OFF 6 ++ ++static int probe_nilfs2(blkid_probe pr, const struct blkid_idmag *mag) ++{ ++ struct nilfs_super_block *sb; ++ static unsigned char sum[4]; ++ const int sumoff = offsetof(struct nilfs_super_block, s_sum); ++ size_t bytes; ++ uint32_t crc; ++ ++ sb = blkid_probe_get_sb(pr, mag, struct nilfs_super_block); ++ if (!sb) ++ return -1; ++ ++ bytes = le32_to_cpu(sb->s_bytes); ++ crc = crc32(le32_to_cpu(sb->s_crc_seed), (unsigned char *)sb, sumoff); ++ crc = crc32(crc, sum, 4); ++ crc = crc32(crc, (unsigned char *)sb + sumoff + 4, bytes - sumoff - 4); ++ ++ if (crc != le32_to_cpu(sb->s_sum)) ++ return -1; ++ ++ if (strlen(sb->s_volume_name)) ++ blkid_probe_set_label(pr, (unsigned char *) sb->s_volume_name, ++ sizeof(sb->s_volume_name)); ++ ++ blkid_probe_set_uuid(pr, sb->s_uuid); ++ blkid_probe_sprintf_version(pr, "%u", le32_to_cpu(sb->s_rev_level)); ++ ++ return 0; ++} ++ ++const struct blkid_idinfo nilfs2_idinfo = ++{ ++ .name = "nilfs", ++ .usage = BLKID_USAGE_FILESYSTEM, ++ .probefunc = probe_nilfs2, ++ .magics = ++ { ++ { ++ .magic = NILFS_SB_MAGIC, ++ .len = 2, ++ .kboff = NILFS_SB_KBOFF, ++ .sboff = NILFS_MAG_OFF ++ }, ++ { NULL } ++ } ++}; +diff --git a/shlibs/blkid/src/superblocks/superblocks.c b/shlibs/blkid/src/superblocks/superblocks.c +index b80c10b..3d66d98 100644 +--- a/shlibs/blkid/src/superblocks/superblocks.c ++++ b/shlibs/blkid/src/superblocks/superblocks.c +@@ -140,6 +140,7 @@ static const struct blkid_idinfo *idinfos[] = + &bfs_idinfo, + &vmfs_fs_idinfo, + &befs_idinfo, ++ &nilfs2_idinfo, + &exfat_idinfo + }; + +diff --git a/shlibs/blkid/src/superblocks/superblocks.h b/shlibs/blkid/src/superblocks/superblocks.h +index 74cb974..a79d7cb 100644 +--- a/shlibs/blkid/src/superblocks/superblocks.h ++++ b/shlibs/blkid/src/superblocks/superblocks.h +@@ -65,6 +65,7 @@ extern const struct blkid_idinfo vmfs_volume_idinfo; + extern const struct blkid_idinfo vmfs_fs_idinfo; + extern const struct blkid_idinfo drbd_idinfo; + extern const struct blkid_idinfo befs_idinfo; ++extern const struct blkid_idinfo nilfs2_idinfo; + extern const struct blkid_idinfo exfat_idinfo; + + /* +-- +1.7.2.1 +From 67bb0074eec2b154d15bd3dd77b482c3d6125761 Mon Sep 17 00:00:00 2001 +From: Jiro SEKIBA <[email protected]> +Date: Tue, 13 Jul 2010 09:14:08 +0200 +Subject: [PATCH] tests: add nilfs2 test for libblkid + +Signed-off-by: Jiro SEKIBA <[email protected]> +Signed-off-by: Karel Zak <[email protected]> +--- + tests/expected/blkid/low-probe-nilfs2 | 7 +++++++ + tests/ts/blkid/images-fs/nilfs2.img.bz2 | Bin 0 -> 795 bytes + 2 files changed, 7 insertions(+), 0 deletions(-) + create mode 100644 tests/expected/blkid/low-probe-nilfs2 + create mode 100644 tests/ts/blkid/images-fs/nilfs2.img.bz2 + +diff --git a/tests/expected/blkid/low-probe-nilfs2 b/tests/expected/blkid/low-probe-nilfs2 +new file mode 100644 +index 0000000..bfd8fcd +--- /dev/null ++++ b/tests/expected/blkid/low-probe-nilfs2 +@@ -0,0 +1,7 @@ ++ID_FS_LABEL=test-nilfs2 ++ID_FS_LABEL_ENC=test-nilfs2 ++ID_FS_TYPE=nilfs ++ID_FS_USAGE=filesystem ++ID_FS_UUID=524025fb-6d31-40e6-baad-1db36cfdf806 ++ID_FS_UUID_ENC=524025fb-6d31-40e6-baad-1db36cfdf806 ++ID_FS_VERSION=2 +diff --git a/tests/ts/blkid/images-fs/nilfs2.img.bz2 b/tests/ts/blkid/images-fs/nilfs2.img.bz2 +new file mode 100644 +index 0000000000000000000000000000000000000000..a9762eb1ace9f1999aaad3c40f1d836668d856ac +GIT binary patch +literal 795 +zcmZ>Y%CIzaj8qGbG`Ml9n}H$iKM?$BcJi+ANKl`nz?|o...@_@lbK*y;^...@r;iM8v +z^#r6d2yv7hdve!luvc5dpv^n...@dry>Er`xpEzs%?rp}D3rOt`HEDABm)D32?GP; +z0!EREipv^IOn^)V240{j^Q<Hzqs++;Mp8zSMhpyWZZoCW1WqjeK1)#Iz#6seeHv~( +zmx...@69=2^ia3qjknd|>vorkjN+>MH*4-%s37X<)*F#v)Rf{P;KEe-N=h(9AxK5r +zNaB>=<>ixs2r?swwru~fs...@0e2@ILyiK&T}MB??Mn}*D~htZ3cdTZRH0!*OIOhp +zuF1Yi0SZB_TmsB4k61&aUN!_Ugm_J068*5`gF*w#0teARmnpo_kuT2~GOf!|DtB62 +z!)T++5$eFKB*GXf;<I9F!NQM?v;8`}*7b6px{&k4S4E)bP}5GYFDbo;*GrVLFkN9@ +z@@Z9sSb~JGco?eycMA(Q^Ph&Ju|ft>1p%^G=UuLqkPtM9ycck)X|u7g*QFMo>QK!; +zurqkh*iwxuzsi...@rot!@1{s7l*d22$pqi7...@s1m-~sa2zm@7x...@fxr;7eg< +zQ4&<w_v...@7p(fvkiM$nYo*^O$-78_-wK~RVMkbV1D8JQ`OC<q49;V$o`^l=O3L4 +zcH6Z3#E!YsGG`s)RMF~EOO1d3>aY{zarw_8qLWfhCp?&^`$6=_69yh&whm7`...@v +z(PE04u!6IgDET?h6*ny4n=k(V{?{W7DhkUTSQr9X7>p_oxG=CVFtI2!vN$jZD6(v3 +z;O=l+m1w{)gHeLB;X+0N+bk2QBw&h...@#bchj{nh7h4xlj+2u!pe3dpvsfhcsh8sp +zT}DV?fa{Ns2bOWHVhs!t%xc}wps|W$-`>x&rn$fKjBA>})U}{HMs?HV9M&t-a)KVS +zYg}FWIQh_-FYD!hutchUy`86XxmogM<nBjObNPCsG{5_M%3n}$Xkh3NkUdt<dS{}a +Lh>ElVLy7|cD)2Ck + +literal 0 +HcmV?d00001 + +-- +1.7.2.1 +From 1326e1dfa5c1d06ff7521b8c8162452799164239 Mon Sep 17 00:00:00 2001 +From: Jiro SEKIBA <[email protected]> +Date: Thu, 15 Jul 2010 13:40:27 +0900 +Subject: [PATCH] libblkid: fix typo filesystem name nilfs to nilfs2 + +The correct filesystem name is nilfs2, not nilfs. + +Signed-off-by: Jiro SEKIBA <[email protected]> +--- + shlibs/blkid/src/superblocks/nilfs.c | 2 +- + tests/expected/blkid/low-probe-nilfs2 | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/shlibs/blkid/src/superblocks/nilfs.c b/shlibs/blkid/src/superblocks/nilfs.c +index c7aba35..bf16918 100644 +--- a/shlibs/blkid/src/superblocks/nilfs.c ++++ b/shlibs/blkid/src/superblocks/nilfs.c +@@ -104,7 +104,7 @@ static int probe_nilfs2(blkid_probe pr, const struct blkid_idmag *mag) + + const struct blkid_idinfo nilfs2_idinfo = + { +- .name = "nilfs", ++ .name = "nilfs2", + .usage = BLKID_USAGE_FILESYSTEM, + .probefunc = probe_nilfs2, + .magics = +diff --git a/tests/expected/blkid/low-probe-nilfs2 b/tests/expected/blkid/low-probe-nilfs2 +index bfd8fcd..c6c9cab 100644 +--- a/tests/expected/blkid/low-probe-nilfs2 ++++ b/tests/expected/blkid/low-probe-nilfs2 +@@ -1,6 +1,6 @@ + ID_FS_LABEL=test-nilfs2 + ID_FS_LABEL_ENC=test-nilfs2 +-ID_FS_TYPE=nilfs ++ID_FS_TYPE=nilfs2 + ID_FS_USAGE=filesystem + ID_FS_UUID=524025fb-6d31-40e6-baad-1db36cfdf806 + ID_FS_UUID_ENC=524025fb-6d31-40e6-baad-1db36cfdf806 +-- +1.7.2.1 +
