Did not reply to the group, here is the fixed patch. it was a stupid mistake on my part. Thanks Haroon ________________________________ From: busybox <[email protected]> on behalf of Rasmus Villemoes <[email protected]> Sent: Friday, October 5, 2018 7:08 AM To: [email protected] Subject: Re: [PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX
On 2018-09-12 16:06, Rasmus Villemoes wrote: > When an application documents that it responds such and such to > SIGRTMIN+n, that almost always means with respect to the libc-provided > SIGRTMIN. Hence I disagree with the "more correct" in commit > 7b276fc17594. In any case, this is rather unfortunate: > > # kill -l RTMIN+2 > 36 > # busybox kill -l RTMIN+2 > 34 > > (the first shell is bash). We probably can't change default behaviour > after 7 years, but at least we can provide a config option. ping _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
From 421a4bb100751ba33671d2f3f337bb81d2f8206e Mon Sep 17 00:00:00 2001 From: hm <[email protected]> Date: Fri, 5 Oct 2018 11:05:37 +0100 Subject: [PATCH] fix format specifier --- include/bb_reiserfs_defs.h | 121 ++++++++++++++++++++++++++++++ util-linux/mkfs_reiser.c | 113 +++++----------------------- util-linux/volume_id/reiserfs.c | 128 ++++++++++++-------------------- 3 files changed, 185 insertions(+), 177 deletions(-) create mode 100644 include/bb_reiserfs_defs.h diff --git a/include/bb_reiserfs_defs.h b/include/bb_reiserfs_defs.h new file mode 100644 index 000000000..1d8b2db86 --- /dev/null +++ b/include/bb_reiserfs_defs.h @@ -0,0 +1,121 @@ +/* + * bb_reiserfs_defs.h + * + * Created on: 3 Oct 2018 + * Author: nharoon + */ + +#ifndef BB_REISERFS_DEFS_H_ +#define BB_REISERFS_DEFS_H_ + +struct journal_params { + uint32_t jp_journal_1st_block; /* where does journal start from on its + device */ + uint32_t jp_journal_dev; /* journal device st_rdev */ + uint32_t jp_journal_size; /* size of the journal on FS creation. used to + make sure they don't overflow it */ + uint32_t jp_journal_trans_max; /* max number of blocks in a transaction. */ + uint32_t jp_journal_magic; /* random value made on fs creation (this was + sb_journal_block_count) */ + uint32_t jp_journal_max_batch; /* max number of blocks to batch into a trans */ + uint32_t jp_journal_max_commit_age; /* in seconds, how old can an async commit be */ + uint32_t jp_journal_max_trans_age; /* in seconds, how old can a transaction be */ +}; + +struct reiserfs_journal_header { + uint32_t jh_last_flush_trans_id; /* id of last fully flushed transaction */ + uint32_t jh_first_unflushed_offset; /* offset in the log of where to start replay after a crash */ + uint32_t jh_mount_id; + struct journal_params jh_journal; + uint32_t jh_last_check_mount_id; /* the mount id of the fs during the last reiserfsck --check. */ +}; + + + +struct reiserfs_super_block_v1 +{ + uint32_t sb_block_count; /* 0 number of block on data device OK*/ + uint32_t sb_free_blocks; /* 4 free blocks count */ + uint32_t sb_root_block; /* 8 root of the tree */ + + struct journal_params sb_journal; /* 12 */ + + uint16_t sb_blocksize; /* 44 */ + uint16_t sb_oid_maxsize; /* 46 max size of object id array, see + get_objectid() commentary */ + uint16_t sb_oid_cursize; /* 48 current size of object id array */ + uint16_t sb_umount_state; /* 50 this is set to 1 when filesystem was + umounted, to 2 - when not */ + + char s_magic[10]; /* 52 reiserfs magic string indicates that + file system is reiserfs: "ReIsErFs" or + "ReIsEr2Fs" or "ReIsEr3Fs" */ + uint16_t sb_fs_state; /* 62 it is set to used by fsck to mark which phase of + rebuilding is done (used for fsck debugging) */ + uint32_t sb_hash_function_code;/* 64 code of fuction which was/is/will be + used to sort names in a directory. See + codes in above */ + uint16_t sb_tree_height; /* 68 height of filesytem tree. Tree + consisting of only one root block has 2 + here */ + uint16_t sb_bmap_nr; /* 70 amount of bitmap blocks needed to + address each block of file system */ + uint16_t sb_version; /* 72 this field is only reliable on + filesystem with non-standard journal */ + uint16_t sb_reserved_for_journal; /* 74 size in blocks of journal area on + main device, we need to keep after + non-standard journal relocation */ +}; + +struct reiserfs_super_block +{ +/* 0 */ struct reiserfs_super_block_v1 s_v1; +/* 76 */ uint32_t sb_inode_generation; +/* 80 */ uint32_t s_flags; /* Right now used only by inode-attributes, if enabled */ + unsigned char s_uuid[16]; /* filesystem unique identifier */ +/*OK 100 */ unsigned char s_label[16]; /* filesystem volume label */ +/*116 */ char s_unused[88] ; /* zero filled by mkreiserfs and reiserfs_convert_objectid_map_v1() + * so any additions must be updated there as well. *//*204*/ + + uint16_t sb_mnt_count; + uint16_t sb_max_mnt_count; + uint32_t sb_lastcheck; + uint32_t sb_check_interval; +} PACKED; +/* Header of a disk block. More precisely, header of a formatted leaf + or internal node, and not the header of an unformatted node. */ +struct block_head { + uint16_t blk2_level; /* Level of a block in the tree. */ + uint16_t blk2_nr_item; /* Number of keys/items in a block. */ + uint16_t blk2_free_space; /* Block free space in bytes. */ + uint16_t blk_reserved; + uint32_t reserved[4]; +}; + +#define REISERFS_3_5_SUPER_MAGIC_STRING "ReIsErFs" +#define REISERFS_3_6_SUPER_MAGIC_STRING "ReIsEr2Fs" +#define REISERFS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" +#define REISERFS_4_SUPER_MAGIC_STRING "ReIsEr4" + +#define REISERFS_OLD_DISK_OFFSET_IN_BYTES 8192 +#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) + +#define REISERFS_FORMAT_3_6 2 +#define DEFAULT_MAX_MNT_COUNT 30 /* 30 mounts */ +#define DEFAULT_CHECK_INTERVAL (180 * 60 * 60 * 24) /* 180 days */ + + +#define FS_CLEANLY_UMOUNTED 1 /* this was REISERFS_VALID_FS */ + +#define JOURNAL_MIN_SIZE 512 +/* biggest possible single transaction, don't change for now (8/3/99) */ +#define JOURNAL_TRANS_MAX 1024 +#define JOURNAL_TRANS_MIN 256 /* need to check whether it works */ +#define JOURNAL_DEFAULT_RATIO 8 /* default journal size / max trans length */ +#define JOURNAL_MIN_RATIO 2 +/* max blocks to batch into one transaction, don't make this any bigger than 900 */ +#define JOURNAL_MAX_BATCH 900 +#define JOURNAL_MAX_COMMIT_AGE 30 + + +#endif /* INCLUDE_BB_REISERFS_DEFS_H_ */ diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c index b4c8dda6f..ef463fe60 100644 --- a/util-linux/mkfs_reiser.c +++ b/util-linux/mkfs_reiser.c @@ -27,87 +27,7 @@ #include "libbb.h" #include <linux/fs.h> - -struct journal_params { - uint32_t jp_journal_1st_block; /* where does journal start from on its device */ - uint32_t jp_journal_dev; /* journal device st_rdev */ - uint32_t jp_journal_size; /* size of the journal on FS creation. used to make sure they don't overflow it */ - uint32_t jp_journal_trans_max; /* max number of blocks in a transaction. */ - uint32_t jp_journal_magic; /* random value made on fs creation (this was sb_journal_block_count) */ - uint32_t jp_journal_max_batch; /* max number of blocks to batch into a trans */ - uint32_t jp_journal_max_commit_age; /* in seconds, how old can an async commit be */ - uint32_t jp_journal_max_trans_age; /* in seconds, how old can a transaction be */ -}; - -struct reiserfs_journal_header { - uint32_t jh_last_flush_trans_id; /* id of last fully flushed transaction */ - uint32_t jh_first_unflushed_offset; /* offset in the log of where to start replay after a crash */ - uint32_t jh_mount_id; - struct journal_params jh_journal; - uint32_t jh_last_check_mount_id; /* the mount id of the fs during the last reiserfsck --check. */ -}; - -struct reiserfs_super_block { - uint32_t sb_block_count; /* 0 number of block on data device */ - uint32_t sb_free_blocks; /* 4 free blocks count */ - uint32_t sb_root_block; /* 8 root of the tree */ - - struct journal_params sb_journal; /* 12 */ - - uint16_t sb_blocksize; /* 44 */ - uint16_t sb_oid_maxsize; /* 46 max size of object id array, see get_objectid() commentary */ - uint16_t sb_oid_cursize; /* 48 current size of object id array */ - uint16_t sb_umount_state; /* 50 this is set to 1 when filesystem was umounted, to 2 - when not */ - - char s_magic[10]; /* 52 "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ - uint16_t sb_fs_state; /* 62 it is set to used by fsck to mark which phase of rebuilding is done (used for fsck debugging) */ - uint32_t sb_hash_function_code; /* 64 code of function which was/is/will be used to sort names in a directory. See codes in above */ - uint16_t sb_tree_height; /* 68 height of filesytem tree. Tree consisting of only one root block has 2 here */ - uint16_t sb_bmap_nr; /* 70 amount of bitmap blocks needed to address each block of file system */ - uint16_t sb_version; /* 72 this field is only reliable on filesystem with non-standard journal */ - uint16_t sb_reserved_for_journal; /* 74 size in blocks of journal area on main device, we need to keep after non-standard journal relocation */ - uint32_t sb_inode_generation; /* 76 */ - uint32_t sb_flags; /* 80 Right now used only by inode-attributes, if enabled */ - unsigned char s_uuid[16]; /* 84 filesystem unique identifier */ - unsigned char s_label[16]; /* 100 filesystem volume label */ - uint16_t sb_mnt_count; /* 116 */ - uint16_t sb_max_mnt_count; /* 118 */ - uint32_t sb_lastcheck; /* 120 */ - uint32_t sb_check_interval; /* 124 */ -/* zero filled by mkreiserfs and reiserfs_convert_objectid_map_v1() so any additions must be updated there as well. */ - char s_unused[76]; /* 128 */ - /* 204 */ -}; - -/* Header of a disk block. More precisely, header of a formatted leaf - or internal node, and not the header of an unformatted node. */ -struct block_head { - uint16_t blk2_level; /* Level of a block in the tree. */ - uint16_t blk2_nr_item; /* Number of keys/items in a block. */ - uint16_t blk2_free_space; /* Block free space in bytes. */ - uint16_t blk_reserved; - uint32_t reserved[4]; -}; - -#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) - -#define REISERFS_3_6_SUPER_MAGIC_STRING "ReIsEr2Fs" -#define REISERFS_FORMAT_3_6 2 -#define DEFAULT_MAX_MNT_COUNT 30 /* 30 mounts */ -#define DEFAULT_CHECK_INTERVAL (180 * 60 * 60 * 24) /* 180 days */ - -#define FS_CLEANLY_UMOUNTED 1 /* this was REISERFS_VALID_FS */ - -#define JOURNAL_MIN_SIZE 512 -/* biggest possible single transaction, don't change for now (8/3/99) */ -#define JOURNAL_TRANS_MAX 1024 -#define JOURNAL_TRANS_MIN 256 /* need to check whether it works */ -#define JOURNAL_DEFAULT_RATIO 8 /* default journal size / max trans length */ -#define JOURNAL_MIN_RATIO 2 -/* max blocks to batch into one transaction, don't make this any bigger than 900 */ -#define JOURNAL_MAX_BATCH 900 -#define JOURNAL_MAX_COMMIT_AGE 30 - +#include "bb_reiserfs_defs.h" // Standard mkreiserfs 3.6.21: // -b | --block-size N size of file-system block, in bytes @@ -210,12 +130,12 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv) // fill superblock sb = (struct reiserfs_super_block *)xzalloc(blocksize); // block count - STORE_LE(sb->sb_block_count, blocks); - STORE_LE(sb->sb_free_blocks, blocks - i); + STORE_LE(sb->s_v1.sb_block_count, blocks); + STORE_LE(sb->s_v1.sb_free_blocks, blocks - i); // TODO: decypher! - STORE_LE(sb->sb_root_block, block); + STORE_LE(sb->s_v1.sb_root_block, block); // fill journal related fields - jp = &sb->sb_journal; + jp = &sb->s_v1.sb_journal; STORE_LE(jp->jp_journal_1st_block, REISERFS_DISK_OFFSET_IN_BYTES / blocksize + 1/*sb*/ + 1/*bmp#0*/); timestamp = time(NULL); srand(timestamp); @@ -225,21 +145,22 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv) STORE_LE(jp->jp_journal_max_batch, JOURNAL_MAX_BATCH); STORE_LE(jp->jp_journal_max_commit_age, JOURNAL_MAX_COMMIT_AGE); // sizes - STORE_LE(sb->sb_blocksize, blocksize); - STORE_LE(sb->sb_oid_maxsize, (blocksize - sizeof(*sb)) / sizeof(uint32_t) / 2 * 2); - STORE_LE(sb->sb_oid_cursize, 2); // "." and ".." - strcpy(sb->s_magic, REISERFS_3_6_SUPER_MAGIC_STRING); - STORE_LE(sb->sb_bmap_nr, (bitmap_blocks > ((1LL << 16) - 1)) ? 0 : bitmap_blocks); + STORE_LE(sb->s_v1.sb_blocksize, blocksize); + STORE_LE(sb->s_v1.sb_oid_maxsize, (blocksize - sizeof(*sb)) / sizeof(uint32_t) / 2 * 2); + STORE_LE(sb->s_v1.sb_oid_cursize, 2); // "." and ".." + strcpy(sb->s_v1.s_magic, REISERFS_3_6_SUPER_MAGIC_STRING); + STORE_LE(sb->s_v1.sb_bmap_nr, (bitmap_blocks > ((1LL << 16) - 1)) ? 0 : bitmap_blocks); // misc - STORE_LE(sb->sb_version, REISERFS_FORMAT_3_6); + STORE_LE(sb->s_v1.sb_version, REISERFS_FORMAT_3_6); STORE_LE(sb->sb_lastcheck, timestamp); STORE_LE(sb->sb_check_interval, DEFAULT_CHECK_INTERVAL); STORE_LE(sb->sb_mnt_count, 1); STORE_LE(sb->sb_max_mnt_count, DEFAULT_MAX_MNT_COUNT); - STORE_LE(sb->sb_umount_state, FS_CLEANLY_UMOUNTED); - STORE_LE(sb->sb_tree_height, 2); - STORE_LE(sb->sb_hash_function_code, 3); // R5_HASH - STORE_LE(sb->sb_flags, 1); + + STORE_LE(sb->s_v1.sb_umount_state, FS_CLEANLY_UMOUNTED); + STORE_LE(sb->s_v1.sb_tree_height, 2); + STORE_LE(sb->s_v1.sb_hash_function_code, 3); // R5_HASH + STORE_LE(sb->s_flags, 1); //STORE_LE(sb->sb_reserved_for_journal, 0); // create UUID generate_uuid(sb->s_uuid); @@ -277,7 +198,7 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv) for (i = 0; i < journal_blocks; i++) xwrite(fd, buf, blocksize); // dump journal control block - memcpy(&((struct reiserfs_journal_header *)buf)->jh_journal, &sb->sb_journal, sizeof(sb->sb_journal)); + memcpy(&((struct reiserfs_journal_header *)buf)->jh_journal, &sb->s_v1.sb_journal, sizeof(sb->s_v1.sb_journal)); xwrite(fd, buf, blocksize); // other bitmaps are in every (8*blocksize)-th block diff --git a/util-linux/volume_id/reiserfs.c b/util-linux/volume_id/reiserfs.c index d9fd8944d..2904e2cf3 100644 --- a/util-linux/volume_id/reiserfs.c +++ b/util-linux/volume_id/reiserfs.c @@ -26,94 +26,60 @@ //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o #include "volume_id_internal.h" +#include "bb_reiserfs_defs.h" -struct reiserfs_super_block { - uint32_t blocks_count; - uint32_t free_blocks; - uint32_t root_block; - uint32_t journal_block; - uint32_t journal_dev; - uint32_t orig_journal_size; - uint32_t dummy2[5]; - uint16_t blocksize; - uint16_t dummy3[3]; - uint8_t magic[12]; - uint32_t dummy4[5]; - uint8_t uuid[16]; - uint8_t label[16]; -} PACKED; - -struct reiser4_super_block { - uint8_t magic[16]; - uint16_t dummy[2]; - uint8_t uuid[16]; - uint8_t label[16]; - uint64_t dummy2; -} PACKED; - -#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 -#define REISERFS_SUPERBLOCK_OFFSET 0x10000 +#if ENABLE_FEATURE_BLKID_TYPE +#define set_type(t) id->type = (char *) t +#else +#define set_type(t) +#endif int FAST_FUNC volume_id_probe_reiserfs(struct volume_id *id /*,uint64_t off*/) { -#define off ((uint64_t)0) - struct reiserfs_super_block *rs; - struct reiser4_super_block *rs4; - - dbg("reiserfs: probing at offset 0x%llx", (unsigned long long) off); - - rs = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); - if (rs == NULL) - return -1; - - if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { - dbg("reiserfs: ReIsErFs, no label"); -// strcpy(id->type_version, "3.5"); - goto found; - } - if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { - dbg("reiserfs: ReIsEr2Fs"); -// strcpy(id->type_version, "3.6"); - goto found_label; - } - if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { - dbg("reiserfs: ReIsEr3Fs"); -// strcpy(id->type_version, "JR"); - goto found_label; - } - - rs4 = (struct reiser4_super_block *) rs; - if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) { -// strcpy(id->type_version, "4"); -// volume_id_set_label_raw(id, rs4->label, 16); - volume_id_set_label_string(id, rs4->label, 16); - volume_id_set_uuid(id, rs4->uuid, UUID_DCE); - dbg("reiserfs: ReIsEr4, label '%s' uuid '%s'", id->label, id->uuid); - goto found; + struct reiserfs_super_block *rs = 0; + unsigned ver = 0; + unsigned len = 0; + + rs = volume_id_get_buffer(id, REISERFS_DISK_OFFSET_IN_BYTES, 0x200); + + if (!rs) + rs = volume_id_get_buffer(id, REISERFS_OLD_DISK_OFFSET_IN_BYTES, + 0x200); + + if (!rs) + return 0; + + len = sscanf(rs->s_v1.s_magic, "ReIsEr%uFs", &ver); + if (!len) { + if (strcmp(rs->s_v1.s_magic, REISERFS_3_5_SUPER_MAGIC_STRING) != 0) + goto x_mgc_str; } - rs = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); - if (rs == NULL) - return -1; - - if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { - dbg("reiserfs: ReIsErFs, no label"); -// strcpy(id->type_version, "3.5"); - goto found; + switch(ver) { + case 0: + set_type("reiserfs"); + break; + case 2: + set_type("reiserfs 3.6"); + break; + case 3: + set_type("reiserfs 3.6 JR"); + break; + case 4: + set_type("reiserfs 4"); + break; + default: + goto x_mgc_str; } - dbg("reiserfs: no signature found"); - return -1; - - found_label: -// volume_id_set_label_raw(id, rs->label, 16); - volume_id_set_label_string(id, rs->label, 16); - volume_id_set_uuid(id, rs->uuid, UUID_DCE); - dbg("reiserfs: label '%s' uuid '%s'", id->label, id->uuid); - - found: -// volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - IF_FEATURE_BLKID_TYPE(id->type = "reiserfs";) + volume_id_set_label_string(id, rs->s_label, ARRAY_SIZE(rs->s_label)); + volume_id_set_uuid(id, rs->s_uuid, ARRAY_SIZE(rs->s_uuid)); + dbg("reiserfs \n\tversion:%d \n\tlabel: %s\n\tuuid: %s\n\t ", ver, + rs->s_label, rs->s_uuid); - return 0; + return 1; + + x_mgc_str: + dbg("unknown reiserfs magic string %s", rs->s_magic); + return 0; } -- 2.17.1
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
