summaryrefslogtreecommitdiff
path: root/tests/ioctl_mtd.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2017-01-05 01:34:24 +0000
committerDmitry V. Levin <ldv@altlinux.org>2017-01-05 01:34:24 +0000
commit92ac6131a1b35b9a9d397f77b412ce8b8747eb5f (patch)
treebc0920bc14e667278251ca59e6b093e5733c1216 /tests/ioctl_mtd.c
parentff9f61dce9d5ee5aa9afee56355f628791d46c2d (diff)
downloadstrace-92ac6131a1b35b9a9d397f77b412ce8b8747eb5f.tar.gz
tests: replace init_magic with fill_memory
Use the same fill_memory/fill_memory_ex interface in all affected tests. * tests/ioctl_block.c (init_magic): Remove. (main): Replace init_magic with fill_memory. * tests/ioctl_evdev.c: Likewise. * tests/ioctl_v4l2.c: Likewise. * tests/ioctl_mtd.c (magic, init_magic): Remove. (main): Replace init_magic with fill_memory. * tests/ioctl_rtc.c: Likewise.
Diffstat (limited to 'tests/ioctl_mtd.c')
-rw-r--r--tests/ioctl_mtd.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/tests/ioctl_mtd.c b/tests/ioctl_mtd.c
index e28bcc9d5..a37d5d0f0 100644
--- a/tests/ioctl_mtd.c
+++ b/tests/ioctl_mtd.c
@@ -42,19 +42,8 @@
# include <mtd/mtd-abi.h>
#endif
-static const unsigned int magic = 0xdeadbeef;
static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0dedULL;
-static void
-init_magic(void *addr, const unsigned int size)
-{
- unsigned int *p = addr;
- const unsigned int *end = addr + size - sizeof(int);
-
- for (; p <= end; ++p)
- *(unsigned int *) p = magic;
-}
-
#define TEST_NULL_ARG(cmd) \
do { \
ioctl(-1, cmd, 0); \
@@ -113,7 +102,7 @@ main(void)
" = -1 EBADF (%m)\n", (unsigned int) _IOC_NR(OTPSELECT));
uint64_t *const v64 = tail_alloc(sizeof(*v64));
- init_magic(v64, sizeof(*v64));
+ fill_memory(v64, sizeof(*v64));
ioctl(-1, MEMGETBADBLOCK, v64);
printf("ioctl(-1, MIXER_WRITE(%u) or MEMGETBADBLOCK, [%" PRIu64 "])"
@@ -126,7 +115,7 @@ main(void)
(unsigned int) _IOC_NR(MEMSETBADBLOCK), *v64);
struct region_info_user *const riu = tail_alloc(sizeof(*riu));
- init_magic(riu, sizeof(*riu));
+ fill_memory(riu, sizeof(*riu));
ioctl(-1, MEMGETREGIONINFO, riu);
printf("ioctl(-1, %s, {regionindex=%#x}) = -1 EBADF (%m)\n",
"MEMGETREGIONINFO"
@@ -136,7 +125,7 @@ main(void)
, riu->regionindex);
struct erase_info_user *const eiu = tail_alloc(sizeof(*eiu));
- init_magic(eiu, sizeof(*eiu));
+ fill_memory(eiu, sizeof(*eiu));
TEST_erase_info_user(MEMERASE, eiu);
TEST_erase_info_user(MEMLOCK, eiu);
@@ -144,7 +133,7 @@ main(void)
TEST_erase_info_user(MEMISLOCKED, eiu);
struct erase_info_user64 *const eiu64 = tail_alloc(sizeof(*eiu64));
- init_magic(eiu64, sizeof(*eiu64));
+ fill_memory(eiu64, sizeof(*eiu64));
ioctl(-1, MEMERASE64, eiu64);
printf("ioctl(-1, MIXER_WRITE(%u) or %s, {start=%#llx, length=%#llx})"
" = -1 EBADF (%m)\n",
@@ -153,7 +142,7 @@ main(void)
(unsigned long long) eiu64->length);
struct mtd_oob_buf *const oob = tail_alloc(sizeof(*oob));
- init_magic(oob, sizeof(*oob));
+ fill_memory(oob, sizeof(*oob));
ioctl(-1, MEMWRITEOOB, oob);
printf("ioctl(-1, MEMWRITEOOB, {start=%#x, length=%#x, ptr=%p})"
@@ -164,7 +153,7 @@ main(void)
" = -1 EBADF (%m)\n", oob->start, oob->length, oob->ptr);
struct mtd_oob_buf64 *const oob64 = tail_alloc(sizeof(*oob64));
- init_magic(oob64, sizeof(*oob64));
+ fill_memory(oob64, sizeof(*oob64));
ioctl(-1, MEMWRITEOOB64, oob64);
printf("ioctl(-1, MEMWRITEOOB64"
@@ -180,14 +169,14 @@ main(void)
struct otp_info *const oi = tail_alloc(sizeof(*oi));
- init_magic(oi, sizeof(*oi));
+ fill_memory(oi, sizeof(*oi));
ioctl(-1, OTPLOCK, oi);
printf("ioctl(-1, MIXER_READ(%u) or OTPLOCK"
", {start=%#x, length=%#x, locked=%u}) = -1 EBADF (%m)\n",
(unsigned int) _IOC_NR(OTPLOCK), oi->start, oi->length, oi->locked);
struct mtd_write_req *const wr = tail_alloc(sizeof(*wr));
- init_magic(wr, sizeof(*wr));
+ fill_memory(wr, sizeof(*wr));
wr->mode = MTD_OPS_PLACE_OOB;
ioctl(-1, MEMWRITE, wr);
printf("ioctl(-1, MEMWRITE, {start=%#llx, len=%#llx, ooblen=%#llx"