Skip to contentSkip to conversation

kernel loop with lseek + LFS on reiser partition -- attachment pasted.

DISCUSSION [email protected] 2 participants 3 messages Apr 22, 2002

lore
Share & tools
lore
#0 lore raw

Hi all,

OK, My e-mail Program refuses to attach this file, so cut'n'paste seems just fine.
(I'm using lotus Notesunder wine, :-( )

-----------------BOF: seek.c---------------------------------------- #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <syslog.h>
#include <unistd.h>

/* compile under linux-2.4 using:

gcc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE seek.c

*/

/* This is my personal strategy to keep the boredom from plain C code...) */
#define STRINGIFYIFY(i) #i
#define STRINGIFY(i) STRINGIFYIFY(i)

#define CHECK_C_ERROR(call) if((call)==-1) { \
syslog(LOG_ERR, \
__FILE__ "(" STRINGIFY(__LINE__) "): " #call " failed: %m"); \
exit(2); \
}

#define CHECK_C_ERROR64(call) if((call)==(off_t)-1) { \
syslog(LOG_ERR, \
__FILE__ "(" STRINGIFY(__LINE__) "): " #call " failed: %m"); \
exit(2); \
}

int main()
{
int fd;
off_t pos=128*1024*1024*(off_t)1024; // 128 GB

syslog(LOG_WARNING,

         __FILE__ "(" STRINGIFY(__LINE__) "): sizeof(off_t)=%d",
         sizeof(off_t));
  CHECK_C_ERROR(close(0));
  CHECK_C_ERROR(close(1));
  CHECK_C_ERROR(close(2));

  CHECK_C_ERROR(fd=open("seek.tmp",O_CREAT|O_TRUNC|O_WRONLY,0644));

  syslog(LOG_WARNING, \
         __FILE__ "(" STRINGIFY(__LINE__) "): fd=%d, pos=%.0lf",
         fd,(double)pos);

  CHECK_C_ERROR64(lseek(fd,pos,SEEK_SET));

  CHECK_C_ERROR(write(fd,"Hello, world!",13));

CHECK_C_ERROR(close(fd));
} ----------------------EOF-------------------------------------------------------

Wolfgang

--
Dr. Wolfgang Glas EV-i Informationstechnologie
GmbH.
Geschäftsführer Sebastian-Kneipp-Weg 17
[email protected] A-6020 Innsbruck/Austria
phone: ++43-512-284883-2 fax: ++43-512-281624-31

#1 lore raw

Hello!

Well, I see the problem. Going to investigate...

Bye,
Oleg

Quoted 72 lines · On Mon, Apr 22, 2002 at 10:57:45AM +0200, [email protected] wrote:

Hi all,

OK, My e-mail Program refuses to attach this file, so cut'n'paste seems just fine.
(I'm using lotus Notesunder wine, :-( )

-----------------BOF: seek.c---------------------------------------- #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <syslog.h>
#include <unistd.h>

/* compile under linux-2.4 using:

gcc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE seek.c

*/

/* This is my personal strategy to keep the boredom from plain C code...) */
#define STRINGIFYIFY(i) #i
#define STRINGIFY(i) STRINGIFYIFY(i)

#define CHECK_C_ERROR(call) if((call)==-1) { \

syslog(LOG_ERR, \
   __FILE__ "(" STRINGIFY(__LINE__) "): " #call " failed: %m"); \

exit(2); \
}

#define CHECK_C_ERROR64(call) if((call)==(off_t)-1) { \

syslog(LOG_ERR, \
   __FILE__ "(" STRINGIFY(__LINE__) "): " #call " failed: %m"); \

exit(2); \
}

int main()
{
int fd;
off_t pos=128*1024*1024*(off_t)1024; // 128 GB

syslog(LOG_WARNING,

         __FILE__ "(" STRINGIFY(__LINE__) "): sizeof(off_t)=%d",
         sizeof(off_t));
  CHECK_C_ERROR(close(0));
  CHECK_C_ERROR(close(1));
  CHECK_C_ERROR(close(2));

  CHECK_C_ERROR(fd=open("seek.tmp",O_CREAT|O_TRUNC|O_WRONLY,0644));

  syslog(LOG_WARNING, \
         __FILE__ "(" STRINGIFY(__LINE__) "): fd=%d, pos=%.0lf",
         fd,(double)pos);

  CHECK_C_ERROR64(lseek(fd,pos,SEEK_SET));

  CHECK_C_ERROR(write(fd,"Hello, world!",13));

CHECK_C_ERROR(close(fd));
} ----------------------EOF-------------------------------------------------------

Wolfgang

--
Dr. Wolfgang Glas EV-i Informationstechnologie
GmbH.

Gesch?ftsf?hrer                          Sebastian-Kneipp-Weg 17
[email protected]                    A-6020 Innsbruck/Austria
phone: ++43-512-284883-2                 fax: ++43-512-281624-31
#2 lore raw

Hello!

I mean, Thanks a lot for your report!

Bye,
Oleg

Quoted 6 lines · Oleg Drokin

Hello!

Well, I see the problem. Going to investigate...

Bye,
Oleg