f2fs-tools: change to use #pragma pack(push, 1)
PATCH 1/2 f2fs-tools: change to use #pragma pack(push, 1)
From: Hyojun Kim <[email protected]>
It was reported that #pragma pack(1) could create unwanted influences. pack(push, 1) and pack(pop) are used instead.
--- include/f2fs_fs.h | 80 ++----------------------------------------------------- include/quota.h | 11 ++------ 2 files changed, 4 insertions(+), 87 deletions(-)
include/f2fs_fs.h +2 -78
@@ -569,17 +569,12 @@ enum {/* * For superblock */ -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif +#pragma pack(push, 1)struct f2fs_device {__u8 path[MAX_PATH_LEN ];__le32 total_segments; } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_super_block {__le32 magic;/* Magic Number */ __le16 major_ver;/* Major Version */
@@ -639,9 +634,6 @@ struct f2fs_super_block {#define CP_ORPHAN_PRESENT_FLAG 0x00000002#define CP_UMOUNT_FLAG 0x00000001 -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_checkpoint {__le64 checkpoint_ver;/* checkpoint block version number */ __le64 user_block_count;/* # of user blocks */
@@ -683,9 +675,6 @@ struct f2fs_checkpoint {*/ #define F2FS_ORPHANS_PER_BLOCK 1020 -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_orphan_block {__le32 ino[F2FS_ORPHANS_PER_BLOCK ];/* inode numbers */ __le32 reserved;/* reserved */
@@ -698,9 +687,6 @@ struct f2fs_orphan_block {/* * For NODE structure */ -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_extent {__le32 fofs;/* start file offset of the extent */ __le32 blk_addr;/* start block address of the extent */
@@ -767,9 +753,6 @@ struct f2fs_extent {#define file_is_encrypt (fi) ((fi)->i_advise & FADVISE_ENCRYPT_BIT)#define file_enc_name (fi) ((fi)->i_advise & FADVISE_ENC_NAME_BIT) -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_inode {__le16 i_mode;/* file mode */ __u8 i_advise;/* file hints */
@@ -813,16 +796,10 @@ struct f2fs_inode { } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct direct_node {__le32 addr[ADDRS_PER_BLOCK ];/* array of data block address */ } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct indirect_node {__le32 nid[NIDS_PER_BLOCK ];/* array of data block address */ } __attribute__((packed));
@@ -836,9 +813,6 @@ enum {#define XATTR_NODE_OFFSET ((((unsigned int)-1) << OFFSET_BIT_SHIFT) \ >> OFFSET_BIT_SHIFT) -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct node_footer {__le32 nid;/* node id */ __le32 ino;/* inode nunmber */
@@ -847,9 +821,6 @@ struct node_footer {__le32 next_blkaddr;/* next node page block address */ } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_node {/* can be one of three types: inode, direct, and indirect types */ union {
@@ -868,18 +839,12 @@ struct f2fs_node {#define DEFAULT_NAT_ENTRY_RATIO 20 -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_nat_entry {__u8 version;/* latest version of cached nat entry */ __le32 ino;/* inode number */ __le32 block_addr;/* block address */ } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_nat_block {struct f2fs_nat_entry entries[NAT_ENTRY_PER_BLOCK ]; } __attribute__((packed));
@@ -916,18 +881,12 @@ struct f2fs_nat_block { ((le16_to_cpu ((raw_sit)->vblocks) & ~SIT_VBLOCKS_MASK ) \ >> SIT_VBLOCKS_SHIFT) -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_sit_entry {__le16 vblocks;/* reference above */ __u8 valid_map[SIT_VBLOCK_MAP_SIZE ];/* bitmap for valid blocks */ __le64 mtime;/* segment age for cleaning */ } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_sit_block {struct f2fs_sit_entry entries[SIT_ENTRY_PER_BLOCK ]; } __attribute__((packed));
@@ -953,16 +912,10 @@ struct f2fs_sit_block {#define SUM_ENTRIES_SIZE (SUMMARY_SIZE * ENTRIES_IN_SUM)/* a summary entry for a 4KB-sized block in a segment */ -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_summary { __le32 nid; /* parent node id */ union { __u8 reserved[3]; -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct { __u8 version; /* node version number */ __le16 ofs_in_node; /* block index in parent node */
@@ -974,9 +927,6 @@ struct f2fs_summary {#define SUM_TYPE_NODE (1)#define SUM_TYPE_DATA (0) -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct summary_footer {unsigned char entry_type;/* SUM_TYPE_XXX */ __le32 check_sum;/* summary checksum */
@@ -1008,49 +958,31 @@ enum {SIT_JOURNAL }; -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct nat_journal_entry {__le32 nid;struct f2fs_nat_entry ne; } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct nat_journal {struct nat_journal_entry entries[NAT_JOURNAL_ENTRIES ];__u8 reserved[NAT_JOURNAL_RESERVED ]; } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct sit_journal_entry {__le32 segno;struct f2fs_sit_entry se; } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct sit_journal {struct sit_journal_entry entries[SIT_JOURNAL_ENTRIES ];__u8 reserved[SIT_JOURNAL_RESERVED ]; } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_extra_info {__le64 kbytes_written;__u8 reserved[EXTRA_INFO_RESERVED ]; } __attribute__((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_journal { union { __le16 n_nats;
@@ -1065,9 +997,6 @@ struct f2fs_journal { } __attribute__((packed));/* 4KB-sized summary block structure */ -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_summary_block {struct f2fs_summary entries[ENTRIES_IN_SUM ];struct f2fs_journal journal;
@@ -1107,9 +1036,6 @@ typedef __le32 f2fs_hash_t; NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))/* One directory entry slot representing F2FS_SLOT_LEN-sized file name */ -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_dir_entry {__le32 hash_code;/* hash code of file name */ __le32 ino;/* inode number */
@@ -1118,9 +1044,6 @@ struct f2fs_dir_entry { } __attribute__((packed));/* 4KB-sized directory entry block */ -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct f2fs_dentry_block {/* validity bitmap for directory entries in each block */ __u8 dentry_bitmap[SIZE_OF_DENTRY_BITMAP ];
@@ -1128,6 +1051,7 @@ struct f2fs_dentry_block {struct f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK ];__u8 filename[NR_DENTRY_IN_BLOCK ][F2FS_SLOT_LEN ]; } __attribute__((packed)); +#pragma pack(pop)/* for inline stuff */ #define DEF_INLINE_RESERVED_SIZE 1
include/quota.h +2 -9
@@ -44,18 +44,13 @@ enum quota_type {#define QT_TREEOFF 1/* Offset of tree in file in blocks */ -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif +#pragma pack(push, 1)struct v2_disk_dqheader {u_int32_t dqh_magic;/* Magic number identifying file */ u_int32_t dqh_version;/* File version */ } __attribute__ ((packed));/* Header with type and version specific information */ -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct v2_disk_dqinfo {u_int32_t dqi_bgrace;/* Time before block soft limit becomes hard limit */ u_int32_t dqi_igrace;/* Time before inode soft limit becomes hard limit */
@@ -65,9 +60,6 @@ struct v2_disk_dqinfo {u_int32_t dqi_free_entry;/* Number of block with at least one free entry */ } __attribute__ ((packed)); -#ifdef ANDROID_WINDOWS_HOST -#pragma pack(1) -#endif struct v2r1_disk_dqblk {__le32 dqb_id;/* id this quota applies to */ __le32 dqb_pad;
@@ -82,5 +74,6 @@ struct v2r1_disk_dqblk {__le64 dqb_btime;/* time limit for excessive disk use */ __le64 dqb_itime;/* time limit for excessive inode use */ } __attribute__ ((packed)); +#pragma pack(pop)#endif
Signature · 6 lines
2.15.0.531.g2ccb3012c9-goog ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
PATCH 2/2 tools: sg_write_buffer: add sg_write_buffer for FFU
From: Hyojun Kim <[email protected]>
sg_write_buffer sources are added for FFU.
--- tools/sg_write_buffer/Android.bp | 27 + tools/sg_write_buffer/include/freebsd_nvme_ioctl.h | 156 + tools/sg_write_buffer/include/sg_cmds.h | 21 + tools/sg_write_buffer/include/sg_cmds_basic.h | 310 ++ tools/sg_write_buffer/include/sg_cmds_extra.h | 369 +++ tools/sg_write_buffer/include/sg_cmds_mmc.h | 52 + tools/sg_write_buffer/include/sg_io_linux.h | 185 ++ tools/sg_write_buffer/include/sg_lib.h | 602 ++++ tools/sg_write_buffer/include/sg_lib_data.h | 121 + tools/sg_write_buffer/include/sg_linux_inc.h | 56 + tools/sg_write_buffer/include/sg_pr2serr.h | 30 + tools/sg_write_buffer/include/sg_pt.h | 215 ++ tools/sg_write_buffer/include/sg_pt_linux.h | 171 + tools/sg_write_buffer/include/sg_pt_nvme.h | 172 + tools/sg_write_buffer/include/sg_pt_win32.h | 473 +++ tools/sg_write_buffer/include/sg_unaligned.h | 325 ++ tools/sg_write_buffer/sg_cmds_basic.c | 663 ++++ tools/sg_write_buffer/sg_cmds_basic2.c | 1069 ++++++ tools/sg_write_buffer/sg_cmds_extra.c | 2524 ++++++++++++++ tools/sg_write_buffer/sg_cmds_mmc.c | 382 +++ tools/sg_write_buffer/sg_io_linux.c | 256 ++ tools/sg_write_buffer/sg_lib.c | 3494 ++++++++++++++++++++ tools/sg_write_buffer/sg_lib_data.c | 1684 ++++++++++ tools/sg_write_buffer/sg_pt_common.c | 141 + tools/sg_write_buffer/sg_pt_linux.c | 964 ++++++ tools/sg_write_buffer/sg_pt_linux_nvme.c | 1185 +++++++ tools/sg_write_buffer/sg_write_buffer.c | 516 +++ 27 files changed, 16163 insertions(+) create mode 100644 tools/sg_write_buffer/Android.bp create mode 100644 tools/sg_write_buffer/include/freebsd_nvme_ioctl.h create mode 100644 tools/sg_write_buffer/include/sg_cmds.h create mode 100644 tools/sg_write_buffer/include/sg_cmds_basic.h create mode 100644 tools/sg_write_buffer/include/sg_cmds_extra.h create mode 100644 tools/sg_write_buffer/include/sg_cmds_mmc.h create mode 100644 tools/sg_write_buffer/include/sg_io_linux.h create mode 100644 tools/sg_write_buffer/include/sg_lib.h create mode 100644 tools/sg_write_buffer/include/sg_lib_data.h create mode 100644 tools/sg_write_buffer/include/sg_linux_inc.h create mode 100644 tools/sg_write_buffer/include/sg_pr2serr.h create mode 100644 tools/sg_write_buffer/include/sg_pt.h create mode 100644 tools/sg_write_buffer/include/sg_pt_linux.h create mode 100644 tools/sg_write_buffer/include/sg_pt_nvme.h create mode 100644 tools/sg_write_buffer/include/sg_pt_win32.h create mode 100644 tools/sg_write_buffer/include/sg_unaligned.h create mode 100644 tools/sg_write_buffer/sg_cmds_basic.c create mode 100644 tools/sg_write_buffer/sg_cmds_basic2.c create mode 100644 tools/sg_write_buffer/sg_cmds_extra.c create mode 100644 tools/sg_write_buffer/sg_cmds_mmc.c create mode 100644 tools/sg_write_buffer/sg_io_linux.c create mode 100644 tools/sg_write_buffer/sg_lib.c create mode 100644 tools/sg_write_buffer/sg_lib_data.c create mode 100644 tools/sg_write_buffer/sg_pt_common.c create mode 100644 tools/sg_write_buffer/sg_pt_linux.c create mode 100644 tools/sg_write_buffer/sg_pt_linux_nvme.c create mode 100644 tools/sg_write_buffer/sg_write_buffer.c
tools/sg_write_buffer/Android.bp new file +27 -0
@@ -0,0 +1,27 @@ +cc_defaults { + name: "sg3-utils-defaults", + cflags: [ + "-Wno-unused-function" + ], + local_include_dirs: [ + "include", + ], +} + +cc_binary { + name: "sg_write_buffer", + defaults: [ "sg3-utils-defaults" ], + srcs: [ + "sg_write_buffer.c", + "sg_cmds_basic.c", + "sg_cmds_basic2.c", + "sg_cmds_extra.c", + "sg_cmds_mmc.c", + "sg_io_linux.c", + "sg_lib.c", + "sg_lib_data.c", + "sg_pt_common.c", + "sg_pt_linux.c", + "sg_pt_linux_nvme.c", + ], +}
tools/sg_write_buffer/include/freebsd_nvme_ioctl.h new file +156 -0
156 lines not on this page · raw message
tools/sg_write_buffer/include/sg_cmds.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef SG_CMDS_H +#define SG_CMDS_H + +/******************************************************************** +* This header did contain wrapper declarations for many SCSI commands +* up until sg3_utils version 1.22 . In that version, the command +* wrappers were broken into two groups, the 'basic' ones found in the +* "sg_cmds_basic.h" header and the 'extra' ones found in the +* "sg_cmds_extra.h" header. This header now simply includes those two +* headers. +* In sg3_utils version 1.26 the sg_cmds_mmc.h header was added and +* contains some MMC specific commands. +* The corresponding function definitions are found in the sg_cmds_basic.c, +* sg_cmds_extra.c and sg_cmds_mmc.c files. +********************************************************************/ + +#include "sg_cmds_basic.h" +#include "sg_cmds_extra.h" +#include "sg_cmds_mmc.h" + +#endif
tools/sg_write_buffer/include/sg_cmds_basic.h new file +310 -0
310 lines not on this page · raw message
tools/sg_write_buffer/include/sg_cmds_extra.h new file +369 -0
369 lines not on this page · raw message
tools/sg_write_buffer/include/sg_cmds_mmc.h new file +52 -0
52 lines not on this page · raw message
tools/sg_write_buffer/include/sg_io_linux.h new file +185 -0
185 lines not on this page · raw message
tools/sg_write_buffer/include/sg_lib.h new file +602 -0
602 lines not on this page · raw message
tools/sg_write_buffer/include/sg_lib_data.h new file +121 -0
121 lines not on this page · raw message
tools/sg_write_buffer/include/sg_linux_inc.h new file +56 -0
56 lines not on this page · raw message
tools/sg_write_buffer/include/sg_pr2serr.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef SG_PR2SERR_H +#define SG_PR2SERR_H + +/* +* Copyright (c) 2004-2018 Douglas Gilbert. +* All rights reserved. +* Use of this source code is governed by a BSD-style +* license that can be found in the BSD_LICENSE file. +*/ + +#include <stdio.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined(__GNUC__) || defined(__clang__) +int pr2serr (const char * fmt, ...) + __attribute__ ((format (printf,1 ,2 ))); +#else +int pr2serr (const char * fmt, ...); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif
tools/sg_write_buffer/include/sg_pt.h new file +215 -0
215 lines not on this page · raw message
tools/sg_write_buffer/include/sg_pt_linux.h new file +171 -0
171 lines not on this page · raw message
tools/sg_write_buffer/include/sg_pt_nvme.h new file +172 -0
172 lines not on this page · raw message
tools/sg_write_buffer/include/sg_pt_win32.h new file +473 -0
473 lines not on this page · raw message
tools/sg_write_buffer/include/sg_unaligned.h new file +325 -0
40 lines not on this page · raw message
tools/sg_write_buffer/sg_cmds_basic.c new file +663 -0
663 lines not on this page · raw message
tools/sg_write_buffer/sg_cmds_basic2.c new file +1069 -0
1,069 lines not on this page · raw message
tools/sg_write_buffer/sg_cmds_extra.c new file +2524 -0
2,524 lines not on this page · raw message
tools/sg_write_buffer/sg_cmds_mmc.c new file +382 -0
382 lines not on this page · raw message
tools/sg_write_buffer/sg_io_linux.c new file +256 -0
256 lines not on this page · raw message
tools/sg_write_buffer/sg_lib.c new file +3494 -0
3,494 lines not on this page · raw message
tools/sg_write_buffer/sg_lib_data.c new file +1684 -0
1,684 lines not on this page · raw message
tools/sg_write_buffer/sg_pt_common.c new file +141 -0
141 lines not on this page · raw message
tools/sg_write_buffer/sg_pt_linux.c new file +964 -0
964 lines not on this page · raw message
tools/sg_write_buffer/sg_pt_linux_nvme.c new file +1185 -0
1,185 lines not on this page · raw message
tools/sg_write_buffer/sg_write_buffer.c new file +516 -0
516 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.15.0.531.g2ccb3012c9-goog ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Part of the diff is not shown here. View the raw message.
Re: [PATCH 2/2] tools: sg_write_buffer: add sg_write_buffer for FFU
Hi, Hyojun, Jaegeuk,
Quoted 8 lines · Jaegeuk Kim
From: Hyojun Kim <[email protected]>
sg_write_buffersources are added for FFU.Signed-off-by Hyojun Kim <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>--- tools/sg_write_buffer/Android.bp | 27 +
Maybe it's better to change Android.bp into Makefile.am ?
Thanks,
Junling
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH 2/2 v2] tools: sg_write_buffer: add sg_write_buffer for FFU
sg_write_buffer sources are added for FFU.
---
v2:
- add Makefile.am
- fix some build errors
configure.ac | 1 + tools/Makefile.am | 2 + tools/sg_write_buffer/Android.bp | 27 + tools/sg_write_buffer/Makefile.am | 18 + tools/sg_write_buffer/include/freebsd_nvme_ioctl.h | 156 + tools/sg_write_buffer/include/sg_cmds.h | 21 + tools/sg_write_buffer/include/sg_cmds_basic.h | 310 ++ tools/sg_write_buffer/include/sg_cmds_extra.h | 369 +++ tools/sg_write_buffer/include/sg_cmds_mmc.h | 52 + tools/sg_write_buffer/include/sg_io_linux.h | 185 ++ tools/sg_write_buffer/include/sg_lib.h | 602 ++++ tools/sg_write_buffer/include/sg_lib_data.h | 121 + tools/sg_write_buffer/include/sg_linux_inc.h | 56 + tools/sg_write_buffer/include/sg_pr2serr.h | 30 + tools/sg_write_buffer/include/sg_pt.h | 215 ++ tools/sg_write_buffer/include/sg_pt_linux.h | 171 + tools/sg_write_buffer/include/sg_pt_nvme.h | 172 + tools/sg_write_buffer/include/sg_pt_win32.h | 473 +++ tools/sg_write_buffer/include/sg_unaligned.h | 325 ++ tools/sg_write_buffer/sg_cmds_basic.c | 663 ++++ tools/sg_write_buffer/sg_cmds_basic2.c | 1069 ++++++ tools/sg_write_buffer/sg_cmds_extra.c | 2524 ++++++++++++++ tools/sg_write_buffer/sg_cmds_mmc.c | 382 +++ tools/sg_write_buffer/sg_io_linux.c | 256 ++ tools/sg_write_buffer/sg_lib.c | 3494 ++++++++++++++++++++ tools/sg_write_buffer/sg_lib_data.c | 1688 ++++++++++ tools/sg_write_buffer/sg_pt_common.c | 141 + tools/sg_write_buffer/sg_pt_linux.c | 964 ++++++ tools/sg_write_buffer/sg_pt_linux_nvme.c | 1185 +++++++ tools/sg_write_buffer/sg_write_buffer.c | 516 +++ 30 files changed, 16188 insertions(+) create mode 100644 tools/sg_write_buffer/Android.bp create mode 100644 tools/sg_write_buffer/Makefile.am create mode 100644 tools/sg_write_buffer/include/freebsd_nvme_ioctl.h create mode 100644 tools/sg_write_buffer/include/sg_cmds.h create mode 100644 tools/sg_write_buffer/include/sg_cmds_basic.h create mode 100644 tools/sg_write_buffer/include/sg_cmds_extra.h create mode 100644 tools/sg_write_buffer/include/sg_cmds_mmc.h create mode 100644 tools/sg_write_buffer/include/sg_io_linux.h create mode 100644 tools/sg_write_buffer/include/sg_lib.h create mode 100644 tools/sg_write_buffer/include/sg_lib_data.h create mode 100644 tools/sg_write_buffer/include/sg_linux_inc.h create mode 100644 tools/sg_write_buffer/include/sg_pr2serr.h create mode 100644 tools/sg_write_buffer/include/sg_pt.h create mode 100644 tools/sg_write_buffer/include/sg_pt_linux.h create mode 100644 tools/sg_write_buffer/include/sg_pt_nvme.h create mode 100644 tools/sg_write_buffer/include/sg_pt_win32.h create mode 100644 tools/sg_write_buffer/include/sg_unaligned.h create mode 100644 tools/sg_write_buffer/sg_cmds_basic.c create mode 100644 tools/sg_write_buffer/sg_cmds_basic2.c create mode 100644 tools/sg_write_buffer/sg_cmds_extra.c create mode 100644 tools/sg_write_buffer/sg_cmds_mmc.c create mode 100644 tools/sg_write_buffer/sg_io_linux.c create mode 100644 tools/sg_write_buffer/sg_lib.c create mode 100644 tools/sg_write_buffer/sg_lib_data.c create mode 100644 tools/sg_write_buffer/sg_pt_common.c create mode 100644 tools/sg_write_buffer/sg_pt_linux.c create mode 100644 tools/sg_write_buffer/sg_pt_linux_nvme.c create mode 100644 tools/sg_write_buffer/sg_write_buffer.c
configure.ac +1 -0
@@ -196,6 +196,7 @@ AC_CONFIG_FILES([ mkfs/Makefile fsck/Makefile tools/Makefile + tools/sg_write_buffer/Makefile ]) # export library version info for mkfs/libf2fs_format_la
tools/Makefile.am +2 -0
@@ -13,3 +13,5 @@ f2fscrypt_SOURCES = f2fscrypt.c sha512.c f2fscrypt_LDFLAGS = -luuid dist_man_MANS = f2fscrypt.8 endif + +SUBDIRS = sg_write_buffer
tools/sg_write_buffer/Android.bp new file +27 -0
@@ -0,0 +1,27 @@ +cc_defaults { + name: "sg3-utils-defaults", + cflags: [ + "-Wno-unused-function" + ], + local_include_dirs: [ + "include", + ], +} + +cc_binary { + name: "sg_write_buffer", + defaults: [ "sg3-utils-defaults" ], + srcs: [ + "sg_write_buffer.c", + "sg_cmds_basic.c", + "sg_cmds_basic2.c", + "sg_cmds_extra.c", + "sg_cmds_mmc.c", + "sg_io_linux.c", + "sg_lib.c", + "sg_lib_data.c", + "sg_pt_common.c", + "sg_pt_linux.c", + "sg_pt_linux_nvme.c", + ], +}
tools/sg_write_buffer/Makefile.am new file +18 -0
@@ -0,0 +1,18 @@ +## Makefile.am + +if LINUX +AM_CPPFLAGS = -I./include +AM_CFLAGS = -Wall +sbin_PROGRAMS = sg_write_buffer +sg_write_buffer_SOURCES = sg_write_buffer.c \ + sg_cmds_basic.c \ + sg_cmds_basic2.c \ + sg_cmds_extra.c \ + sg_cmds_mmc.c \ + sg_io_linux.c \ + sg_lib.c \ + sg_lib_data.c \ + sg_pt_common.c \ + sg_pt_linux.c \ + sg_pt_linux_nvme.c +endif
tools/sg_write_buffer/include/freebsd_nvme_ioctl.h new file +156 -0
156 lines not on this page · raw message
tools/sg_write_buffer/include/sg_cmds.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef SG_CMDS_H +#define SG_CMDS_H + +/******************************************************************** +* This header did contain wrapper declarations for many SCSI commands +* up until sg3_utils version 1.22 . In that version, the command +* wrappers were broken into two groups, the 'basic' ones found in the +* "sg_cmds_basic.h" header and the 'extra' ones found in the +* "sg_cmds_extra.h" header. This header now simply includes those two +* headers. +* In sg3_utils version 1.26 the sg_cmds_mmc.h header was added and +* contains some MMC specific commands. +* The corresponding function definitions are found in the sg_cmds_basic.c, +* sg_cmds_extra.c and sg_cmds_mmc.c files. +********************************************************************/ + +#include "sg_cmds_basic.h" +#include "sg_cmds_extra.h" +#include "sg_cmds_mmc.h" + +#endif
tools/sg_write_buffer/include/sg_cmds_basic.h new file +310 -0
310 lines not on this page · raw message
tools/sg_write_buffer/include/sg_cmds_extra.h new file +369 -0
369 lines not on this page · raw message
tools/sg_write_buffer/include/sg_cmds_mmc.h new file +52 -0
52 lines not on this page · raw message
tools/sg_write_buffer/include/sg_io_linux.h new file +185 -0
185 lines not on this page · raw message
tools/sg_write_buffer/include/sg_lib.h new file +602 -0
602 lines not on this page · raw message
tools/sg_write_buffer/include/sg_lib_data.h new file +121 -0
121 lines not on this page · raw message
tools/sg_write_buffer/include/sg_linux_inc.h new file +56 -0
56 lines not on this page · raw message
tools/sg_write_buffer/include/sg_pr2serr.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef SG_PR2SERR_H +#define SG_PR2SERR_H + +/* +* Copyright (c) 2004-2018 Douglas Gilbert. +* All rights reserved. +* Use of this source code is governed by a BSD-style +* license that can be found in the BSD_LICENSE file. +*/ + +#include <stdio.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined(__GNUC__) || defined(__clang__) +int pr2serr (const char * fmt, ...) + __attribute__ ((format (printf,1 ,2 ))); +#else +int pr2serr (const char * fmt, ...); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif
tools/sg_write_buffer/include/sg_pt.h new file +215 -0
215 lines not on this page · raw message
tools/sg_write_buffer/include/sg_pt_linux.h new file +171 -0
171 lines not on this page · raw message
tools/sg_write_buffer/include/sg_pt_nvme.h new file +172 -0
172 lines not on this page · raw message
tools/sg_write_buffer/include/sg_pt_win32.h new file +473 -0
473 lines not on this page · raw message
tools/sg_write_buffer/include/sg_unaligned.h new file +325 -0
10 lines not on this page · raw message
tools/sg_write_buffer/sg_cmds_basic.c new file +663 -0
663 lines not on this page · raw message
tools/sg_write_buffer/sg_cmds_basic2.c new file +1069 -0
1,069 lines not on this page · raw message
tools/sg_write_buffer/sg_cmds_extra.c new file +2524 -0
2,524 lines not on this page · raw message
tools/sg_write_buffer/sg_cmds_mmc.c new file +382 -0
382 lines not on this page · raw message
tools/sg_write_buffer/sg_io_linux.c new file +256 -0
256 lines not on this page · raw message
tools/sg_write_buffer/sg_lib.c new file +3494 -0
3,494 lines not on this page · raw message
tools/sg_write_buffer/sg_lib_data.c new file +1688 -0
1,688 lines not on this page · raw message
tools/sg_write_buffer/sg_pt_common.c new file +141 -0
141 lines not on this page · raw message
tools/sg_write_buffer/sg_pt_linux.c new file +964 -0
964 lines not on this page · raw message
tools/sg_write_buffer/sg_pt_linux_nvme.c new file +1185 -0
1,185 lines not on this page · raw message
tools/sg_write_buffer/sg_write_buffer.c new file +516 -0
516 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.15.0.531.g2ccb3012c9-goog ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Part of the diff is not shown here. View the raw message.
Re: [PATCH 2/2] tools: sg_write_buffer: add sg_write_buffer for FFU
In reply to Jaegeuk KimHi Jaegeuk,
Quoted 3 lines · Jaegeuk Kim
From: Hyojun Kim <[email protected]>
sg_write_buffersources are added for FFU.
Could you please explain more details about why we need to add those source codes? ;)
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH 2/2] tools: sg_write_buffer: add sg_write_buffer for FFU
Quoted 9 lines · Chao Yu
Hi Jaegeuk,
Quoted 3 lines · Jaegeuk Kim
From: Hyojun Kim <[email protected]>
sg_write_buffersources are added for FFU.Could you please explain more details about why we need to add those source codes? ;)
We need this for FFU. What else do we need?
Quoted 2 lines
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH 2/2] tools: sg_write_buffer: add sg_write_buffer for FFU
Quoted 4 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu
Hi Jaegeuk,
On 2018/3/14 8:08, Jaegeuk Kim wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
From: Hyojun Kim <[email protected]>
sg_write_buffersources are added for FFU.Could you please explain more details about why we need to add those source codes? ;)
We need this for FFU. What else do we need?
You mean Field Firmware Update?
Oh, I don't know, just be curious to know how f2fs using these drive to do FFU.
Thanks,
Quoted 6 lines
Quoted 3 lines
Thanks,
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 7 lines · Jaegeuk Kim
From: Hyojun Kim <[email protected]>
It was reported that #pragma pack(1) could create unwanted influences.
pack(push, 1)and pack(pop) are used instead.Signed-off-by Hyojun Kim <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot