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.
static const unsigned int magic = 0xdeadbeef;
static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0dedULL;
-#if defined BLKTRACESETUP && defined HAVE_STRUCT_BLK_USER_TRACE_SETUP
-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 + (p - (unsigned int *) addr);
-}
-#endif
-
static struct xlat block_argless[] = {
XLAT(BLKRRPART),
XLAT(BLKFLSBUF),
#if defined BLKTRACESETUP && defined HAVE_STRUCT_BLK_USER_TRACE_SETUP
struct blk_user_trace_setup *const buts = tail_alloc(sizeof(*buts));
- init_magic(buts, sizeof(*buts));
+ fill_memory(buts, sizeof(*buts));
ioctl(-1, BLKTRACESETUP, buts);
printf("ioctl(-1, BLKTRACESETUP, {act_mask=%hu, buf_size=%u, buf_nr=%u"
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;
-}
-
# if VERBOSE
static void
print_envelope(const struct ff_envelope *const e)
const unsigned int size = get_page_size();
void *const page = tail_alloc(size);
- init_magic(page, size);
+ fill_memory(page, size);
int *const val_int = tail_alloc(sizeof(*val_int));
*val_int = magic;
# ifdef EVIOCSKEYCODE_V2
struct input_keymap_entry *const ike = tail_alloc(sizeof(*ike));
- init_magic(ike, sizeof(*ike));
+ fill_memory(ike, sizeof(*ike));
ike->keycode = 2;
ioctl(-1, EVIOCSKEYCODE_V2, ike);
# endif
struct ff_effect *const ffe = tail_alloc(sizeof(*ffe));
- init_magic(ffe, sizeof(*ffe));
+ fill_memory(ffe, sizeof(*ffe));
ffe->type = FF_CONSTANT;
ioctl(-1, EVIOCSFF, ffe);
# 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); \
" = -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 "])"
(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"
, 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);
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",
(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})"
" = -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"
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"
#include <linux/rtc.h>
#include "xlat.h"
-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;
-}
-
static void
print_rtc_time(const struct rtc_time *rt)
{
const unsigned int size = get_page_size();
void *const page = tail_alloc(size);
- init_magic(page, size);
+ fill_memory(page, size);
struct rtc_time *rt = tail_alloc(sizeof(*rt));
- init_magic(rt, sizeof(*rt));
+ fill_memory(rt, sizeof(*rt));
struct rtc_wkalrm *wk = tail_alloc(sizeof(*wk));
- init_magic(wk, sizeof(*wk));
+ fill_memory(wk, sizeof(*wk));
struct rtc_pll_info *pll = tail_alloc(sizeof(*pll));
- init_magic(pll, sizeof(*pll));
+ fill_memory(pll, sizeof(*pll));
/* RTC_ALM_READ */
ioctl(-1, RTC_ALM_READ, 0);
#include <linux/types.h>
#include <linux/videodev2.h>
-static const unsigned int magic = 0xdeadbeef;
-
-static void
-init_magic(void *addr, const unsigned int size)
-{
- unsigned int *p = addr;
- const unsigned int *end = addr + size;
-
- for (; p < end; ++p)
- *(unsigned int *) p = magic;
-}
-
#if WORDS_BIGENDIAN
# define cc0(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 24))
# define cc1(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 16))
((unsigned int)(a3) << 24))
#endif
+static const unsigned int magic = 0xdeadbeef;
+
int
main(void )
{
const unsigned int size = get_page_size();
void *const page = tail_alloc(size);
- init_magic(page, size);
+ fill_memory(page, size);
unsigned char cc[sizeof(int)] = { 'A', '\'', '\\', '\xfa' };