All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacky Malcles <Jacky.Malcles@bull.net>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] How do I enable direct IOs with ia64 ?
Date: Wed, 28 Aug 2002 12:09:34 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590701905991@msgid-missing> (raw)

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

If I run the following piece of code to an ia64 (azusa) I can see that
direct
io are not enabled, but please,
what do i have to do to have them running? 

remark: With ia32, this code works fine and I directly get:
------
"test:  completed" and the file "infile" is initialized

with ia64, it does not work and I get:
"write infile failed: Invalid argument"
... and the file "infile" is not filled up.

version:
Linux version 2.4.18 (xb@pegtst2) (gcc version 3.1) #8 SMP Wed Aug 7
14:30:09
CEST 2002

compil:
cc -O  -D_GNU_SOURCE voyons.c   -o voyons

[-- Attachment #2: voyons.c --]
[-- Type: text/plain, Size: 1418 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <sys/fcntl.h>
#include <errno.h>

#define BUFSIZE 8192
#define NBLKS   20
#define LEN     30
#define TRUE 1
void
fillbuf(char *buf, int count, char value)
{
        while (count-- > 0) *buf++ = value;
}


int
main(int argc, char *argv[])
{
        int     bufsize = BUFSIZE;      /* Buffer size. Default 8k */
        int     numblks = NBLKS;        /* Number of blocks. Default 20 */
        char    infile[LEN];            /* Input file. Default "infile" */
        int     fd1, fd2;
        int     i, n, offset;
        char    *buf;

        strcpy(infile, "infile");       /* Default input file */
        if ((fd1 = open(infile, O_DIRECT|O_RDWR|O_CREAT, 0666)) < 0) {
                fprintf(stderr, "open infile: %s\n", strerror(errno));
                exit(1);
        }

        /* Allocate for buf, Create input file */
        if ((buf = valloc(bufsize)) == 0) {
                fprintf(stderr, "valloc buf: %s\n", strerror(errno));
        }

        for (i = 0; i < numblks; i++) {
                fillbuf(buf, bufsize, 'Z');
                if (write(fd1, buf, bufsize) == -1) {
                        fprintf(stderr, "write infile failed: %s\n",
                                strerror(errno));
                }
        }
        fprintf(stdout, "test:  completed\n");
        exit(0);

}


             reply	other threads:[~2002-08-28 12:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-28 12:09 Jacky Malcles [this message]
2002-08-28 14:42 ` [Linux-ia64] How do I enable direct IOs with ia64 ? Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590701905991@msgid-missing \
    --to=jacky.malcles@bull.net \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.