aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-06-28 07:46:32 +0100
committerRon Yorston <rmy@pobox.com>2021-06-28 07:46:32 +0100
commite1ad66c0b8fd58a7158d40771175a7dab224202d (patch)
tree959d687eee9637151ad5798322586174de331141 /include
parent0fdf99bee07b6c38795eb5415b5e337ab82cfba8 (diff)
parent5dbbd0a6f52befe6bc57baf97d39168e595197f1 (diff)
downloadbusybox-w32-e1ad66c0b8fd58a7158d40771175a7dab224202d.tar.gz
busybox-w32-e1ad66c0b8fd58a7158d40771175a7dab224202d.tar.bz2
busybox-w32-e1ad66c0b8fd58a7158d40771175a7dab224202d.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'include')
-rw-r--r--include/bb_e2fs_defs.h23
-rw-r--r--include/dump.h4
-rw-r--r--include/libbb.h41
3 files changed, 47 insertions, 21 deletions
diff --git a/include/bb_e2fs_defs.h b/include/bb_e2fs_defs.h
index 3f5e3c45b..608cbf0b0 100644
--- a/include/bb_e2fs_defs.h
+++ b/include/bb_e2fs_defs.h
@@ -182,11 +182,12 @@ struct ext2_dx_countlimit {
182#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ 182#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */
183#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ 183#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */
184#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 184#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
185#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ 185#define EXT2_EXTENT_FL 0x00080000 /* Extents */
186#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ 186#define EXT2_VERITY_FL 0x00100000
187 187#define EXT2_NOCOW_FL 0x00800000 /* Do not cow file */
188#define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ 188#define EXT2_INLINE_DATA_FL 0x10000000
189#define EXT2_FL_USER_MODIFIABLE 0x000080FF /* User modifiable flags */ 189#define EXT2_PROJINHERIT_FL 0x20000000
190#define EXT2_CASEFOLD_FL 0x40000000
190 191
191/* 192/*
192 * ioctl commands 193 * ioctl commands
@@ -195,6 +196,18 @@ struct ext2_dx_countlimit {
195#define EXT2_IOC_SETFLAGS _IOW('f', 2, long) 196#define EXT2_IOC_SETFLAGS _IOW('f', 2, long)
196#define EXT2_IOC_GETVERSION _IOR('v', 1, long) 197#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
197#define EXT2_IOC_SETVERSION _IOW('v', 2, long) 198#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
199//NB: despite "long" in defs above, these ioctls use an _int_!
200//passing them a pointer to long will read/write only int-sized data!
201struct ext2_fsxattr {
202 uint32_t fsx_xflags; /* xflags field value (get/set) */
203 uint32_t fsx_extsize; /* extsize field value (get/set)*/
204 uint32_t fsx_nextents; /* nextents field value (get) */
205 uint32_t fsx_projid; /* project identifier (get/set) */
206 uint32_t fsx_cowextsize; /* CoW extsize field value (get/set)*/
207 unsigned char fsx_pad[8];
208};
209#define EXT2_IOC_FSGETXATTR _IOR('X', 31, struct ext2_fsxattr)
210#define EXT2_IOC_FSSETXATTR _IOW('X', 32, struct ext2_fsxattr)
198 211
199/* 212/*
200 * Structure of an inode on the disk 213 * Structure of an inode on the disk
diff --git a/include/dump.h b/include/dump.h
index 9193a6925..10fc5d900 100644
--- a/include/dump.h
+++ b/include/dump.h
@@ -32,8 +32,10 @@ typedef struct dumper_t {
32 off_t dump_skip; /* bytes to skip */ 32 off_t dump_skip; /* bytes to skip */
33 int dump_length; /* max bytes to read */ 33 int dump_length; /* max bytes to read */
34 smallint dump_vflag; /*enum dump_vflag_t*/ 34 smallint dump_vflag; /*enum dump_vflag_t*/
35 const char *eofstring;
36 FS *fshead; 35 FS *fshead;
36 const char *xxd_eofstring;
37 off_t address; /* address/offset in stream */
38 long long xxd_displayoff;
37} dumper_t; 39} dumper_t;
38 40
39dumper_t* alloc_dumper(void) FAST_FUNC; 41dumper_t* alloc_dumper(void) FAST_FUNC;
diff --git a/include/libbb.h b/include/libbb.h
index e80ed1e32..7a43967cb 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -469,23 +469,29 @@ enum { /* cp.c, mv.c, install.c depend on these values. CAREFUL when changing th
469 FILEUTILS_RECUR = 1 << 2, /* -R */ 469 FILEUTILS_RECUR = 1 << 2, /* -R */
470 FILEUTILS_FORCE = 1 << 3, /* -f */ 470 FILEUTILS_FORCE = 1 << 3, /* -f */
471 FILEUTILS_INTERACTIVE = 1 << 4, /* -i */ 471 FILEUTILS_INTERACTIVE = 1 << 4, /* -i */
472 FILEUTILS_MAKE_HARDLINK = 1 << 5, /* -l */ 472 FILEUTILS_NO_OVERWRITE = 1 << 5, /* -n */
473 FILEUTILS_MAKE_SOFTLINK = 1 << 6, /* -s */ 473 FILEUTILS_MAKE_HARDLINK = 1 << 6, /* -l */
474 FILEUTILS_DEREF_SOFTLINK = 1 << 7, /* -L */ 474 FILEUTILS_MAKE_SOFTLINK = 1 << 7, /* -s */
475 FILEUTILS_DEREFERENCE_L0 = 1 << 8, /* -H */ 475 FILEUTILS_DEREF_SOFTLINK = 1 << 8, /* -L */
476 FILEUTILS_DEREFERENCE_L0 = 1 << 9, /* -H */
476 /* -a = -pdR (mapped in cp.c) */ 477 /* -a = -pdR (mapped in cp.c) */
477 /* -r = -dR (mapped in cp.c) */ 478 /* -r = -dR (mapped in cp.c) */
478 /* -P = -d (mapped in cp.c) */ 479 /* -P = -d (mapped in cp.c) */
479 FILEUTILS_VERBOSE = (1 << 12) * ENABLE_FEATURE_VERBOSE, /* -v */ 480 FILEUTILS_VERBOSE = (1 << 13) * ENABLE_FEATURE_VERBOSE, /* -v */
480 FILEUTILS_UPDATE = 1 << 13, /* -u */ 481 FILEUTILS_UPDATE = 1 << 14, /* -u */
481 FILEUTILS_NO_TARGET_DIR = 1 << 14, /* -T */ 482 FILEUTILS_NO_TARGET_DIR = 1 << 15, /* -T */
483 FILEUTILS_TARGET_DIR = 1 << 16, /* -t DIR */
482#if ENABLE_SELINUX 484#if ENABLE_SELINUX
483 FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 15, /* -c */ 485 FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 17, /* -c */
484#endif 486#endif
485 FILEUTILS_RMDEST = 1 << (16 - !ENABLE_SELINUX), /* --remove-destination */ 487#define FILEUTILS_CP_OPTSTR "pdRfinlsLHarPvuTt:" IF_SELINUX("c")
486 /* bit 17 skipped for "cp --parents" */ 488/* How many bits in FILEUTILS_CP_OPTSTR? */
487 FILEUTILS_REFLINK = 1 << (18 - !ENABLE_SELINUX), /* cp --reflink=auto */ 489 FILEUTILS_CP_OPTBITS = 18 - !ENABLE_SELINUX,
488 FILEUTILS_REFLINK_ALWAYS = 1 << (19 - !ENABLE_SELINUX), /* cp --reflink[=always] */ 490
491 FILEUTILS_RMDEST = 1 << (19 - !ENABLE_SELINUX), /* cp --remove-destination */
492 /* bit 18 skipped for "cp --parents" */
493 FILEUTILS_REFLINK = 1 << (20 - !ENABLE_SELINUX), /* cp --reflink=auto */
494 FILEUTILS_REFLINK_ALWAYS = 1 << (21 - !ENABLE_SELINUX), /* cp --reflink[=always] */
489 /* 495 /*
490 * Hole. cp may have some bits set here, 496 * Hole. cp may have some bits set here,
491 * they should not affect remove_file()/copy_file() 497 * they should not affect remove_file()/copy_file()
@@ -495,7 +501,7 @@ enum { /* cp.c, mv.c, install.c depend on these values. CAREFUL when changing th
495#endif 501#endif
496 FILEUTILS_IGNORE_CHMOD_ERR = 1 << 31, 502 FILEUTILS_IGNORE_CHMOD_ERR = 1 << 31,
497}; 503};
498#define FILEUTILS_CP_OPTSTR "pdRfilsLHarPvuT" IF_SELINUX("c") 504
499extern int remove_file(const char *path, int flags) FAST_FUNC; 505extern int remove_file(const char *path, int flags) FAST_FUNC;
500/* NB: without FILEUTILS_RECUR in flags, it will basically "cat" 506/* NB: without FILEUTILS_RECUR in flags, it will basically "cat"
501 * the source, not copy (unless "source" is a directory). 507 * the source, not copy (unless "source" is a directory).
@@ -525,6 +531,11 @@ int recursive_action(const char *fileName, unsigned flags,
525 void *userData 531 void *userData
526) FAST_FUNC; 532) FAST_FUNC;
527 533
534/* Simpler version: call a function on each dirent in a directory */
535int iterate_on_dir(const char *dir_name,
536 int FAST_FUNC (*func)(const char *, struct dirent *, void *),
537 void *private) FAST_FUNC;
538
528extern int device_open(const char *device, int mode) FAST_FUNC; 539extern int device_open(const char *device, int mode) FAST_FUNC;
529enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */ 540enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */
530extern int xgetpty(char *line) FAST_FUNC; 541extern int xgetpty(char *line) FAST_FUNC;
@@ -1105,10 +1116,10 @@ char *smart_ulltoa5(unsigned long long ul, char buf[5], const char *scale) FAST_
1105/* If block_size == 0, display size without fractional part, 1116/* If block_size == 0, display size without fractional part,
1106 * else display (size * block_size) with one decimal digit. 1117 * else display (size * block_size) with one decimal digit.
1107 * If display_unit == 0, show value no bigger than 1024 with suffix (K,M,G...), 1118 * If display_unit == 0, show value no bigger than 1024 with suffix (K,M,G...),
1108 * else divide by display_unit and do not use suffix. */ 1119 * else divide by display_unit and do not use suffix.
1120 * Returns "auto pointer" */
1109#define HUMAN_READABLE_MAX_WIDTH 7 /* "1024.0G" */ 1121#define HUMAN_READABLE_MAX_WIDTH 7 /* "1024.0G" */
1110#define HUMAN_READABLE_MAX_WIDTH_STR "7" 1122#define HUMAN_READABLE_MAX_WIDTH_STR "7"
1111//TODO: provide pointer to buf (avoid statics)?
1112const char *make_human_readable_str(unsigned long long size, 1123const char *make_human_readable_str(unsigned long long size,
1113 unsigned long block_size, unsigned long display_unit) FAST_FUNC; 1124 unsigned long block_size, unsigned long display_unit) FAST_FUNC;
1114/* Put a string of hex bytes ("1b2e66fe"...), return advanced pointer */ 1125/* Put a string of hex bytes ("1b2e66fe"...), return advanced pointer */