aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/ext2fs
diff options
context:
space:
mode:
authorvodz <vodz@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-09-19 13:48:39 +0000
committervodz <vodz@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-09-19 13:48:39 +0000
commit02b406d6855a80d406a88815315f5d3f107fc5ba (patch)
tree950358988089069ceae599d89faf0d3e1e5833b6 /e2fsprogs/ext2fs
parent1ef7ad38363a265528009f5d567dc54717fb48ff (diff)
downloadbusybox-w32-02b406d6855a80d406a88815315f5d3f107fc5ba.tar.gz
busybox-w32-02b406d6855a80d406a88815315f5d3f107fc5ba.tar.bz2
busybox-w32-02b406d6855a80d406a88815315f5d3f107fc5ba.zip
mke2fs.c can compiled for me, more bb_xstrdup and bb_xasprintf usage, remove 1 exporing, ext2fs_llseek/blkid_llseek->llseek
git-svn-id: svn://busybox.net/trunk/busybox@11502 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'e2fsprogs/ext2fs')
-rw-r--r--e2fsprogs/ext2fs/ext2_io.h29
-rw-r--r--e2fsprogs/ext2fs/llseek.c55
2 files changed, 17 insertions, 67 deletions
diff --git a/e2fsprogs/ext2fs/ext2_io.h b/e2fsprogs/ext2fs/ext2_io.h
index e17886c85..190f6c132 100644
--- a/e2fsprogs/ext2fs/ext2_io.h
+++ b/e2fsprogs/ext2fs/ext2_io.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * io.h --- the I/O manager abstraction 2 * io.h --- the I/O manager abstraction
3 * 3 *
4 * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. 4 * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
5 * 5 *
6 * %Begin-Header% 6 * %Begin-Header%
@@ -22,7 +22,12 @@ typedef long ext2_loff_t;
22#endif 22#endif
23 23
24/* llseek.c */ 24/* llseek.c */
25ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int); 25/* ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int); */
26#ifdef CONFIG_LFS
27# define ext2fs_llseek lseek64
28#else
29# define ext2fs_llseek lseek
30#endif
26 31
27typedef struct struct_io_manager *io_manager; 32typedef struct struct_io_manager *io_manager;
28typedef struct struct_io_channel *io_channel; 33typedef struct struct_io_channel *io_channel;
@@ -40,8 +45,8 @@ struct struct_io_channel {
40 void *data, 45 void *data,
41 size_t size, 46 size_t size,
42 int actual_bytes_read, 47 int actual_bytes_read,
43 errcode_t error); 48 errcode_t error);
44 errcode_t (*write_error)(io_channel channel, 49 errcode_t (*write_error)(io_channel channel,
45 unsigned long block, 50 unsigned long block,
46 int count, 51 int count,
47 const void *data, 52 const void *data,
@@ -68,9 +73,9 @@ struct struct_io_manager {
68 errcode_t (*flush)(io_channel channel); 73 errcode_t (*flush)(io_channel channel);
69 errcode_t (*write_byte)(io_channel channel, unsigned long offset, 74 errcode_t (*write_byte)(io_channel channel, unsigned long offset,
70 int count, const void *data); 75 int count, const void *data);
71 errcode_t (*set_option)(io_channel channel, const char *option, 76 errcode_t (*set_option)(io_channel channel, const char *option,
72 const char *arg); 77 const char *arg);
73 int reserved[14]; 78 int reserved[14];
74}; 79};
75 80
76#define IO_FLAG_RW 1 81#define IO_FLAG_RW 1
@@ -78,17 +83,17 @@ struct struct_io_manager {
78/* 83/*
79 * Convenience functions.... 84 * Convenience functions....
80 */ 85 */
81#define io_channel_close(c) ((c)->manager->close((c))) 86#define io_channel_close(c) ((c)->manager->close((c)))
82#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s)) 87#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s))
83#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d)) 88#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d))
84#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d)) 89#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d))
85#define io_channel_flush(c) ((c)->manager->flush((c))) 90#define io_channel_flush(c) ((c)->manager->flush((c)))
86#define io_channel_bumpcount(c) ((c)->refcount++) 91#define io_channel_bumpcount(c) ((c)->refcount++)
87 92
88/* io_manager.c */ 93/* io_manager.c */
89extern errcode_t io_channel_set_options(io_channel channel, 94extern errcode_t io_channel_set_options(io_channel channel,
90 const char *options); 95 const char *options);
91extern errcode_t io_channel_write_byte(io_channel channel, 96extern errcode_t io_channel_write_byte(io_channel channel,
92 unsigned long offset, 97 unsigned long offset,
93 int count, const void *data); 98 int count, const void *data);
94 99
@@ -105,4 +110,4 @@ extern void (*test_io_cb_set_blksize)
105 (int blksize, errcode_t err); 110 (int blksize, errcode_t err);
106 111
107#endif /* _EXT2FS_EXT2_IO_H */ 112#endif /* _EXT2FS_EXT2_IO_H */
108 113
diff --git a/e2fsprogs/ext2fs/llseek.c b/e2fsprogs/ext2fs/llseek.c
deleted file mode 100644
index 6bb84bf09..000000000
--- a/e2fsprogs/ext2fs/llseek.c
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * llseek.c -- stub calling the llseek system call
3 *
4 * Copyright (C) 1994, 1995, 1996, 1997 Theodore Ts'o.
5 *
6 * %Begin-Header%
7 * This file may be redistributed under the terms of the
8 * GNU Lesser General Public License.
9 * %End-Header%
10 */
11
12#if HAVE_SYS_TYPES_H
13#include <sys/types.h>
14#endif
15
16#if HAVE_ERRNO_H
17#include <errno.h>
18#endif
19#if HAVE_UNISTD_H
20#include <unistd.h>
21#endif
22
23#include "ext2fs/ext2_io.h"
24
25#ifdef CONFIG_LFS
26# define my_llseek lseek64
27#else
28# define my_llseek lseek
29#endif
30
31ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin)
32{
33 ext2_loff_t result;
34 static int do_compat = 0;
35
36 if ((sizeof(off_t) >= sizeof(ext2_loff_t)) ||
37 (offset < ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1))))
38 return lseek(fd, (off_t) offset, origin);
39
40 if (do_compat) {
41 errno = EINVAL;
42 return -1;
43 }
44
45 result = my_llseek (fd, offset, origin);
46 if (result == -1 && errno == ENOSYS) {
47 /*
48 * Just in case this code runs on top of an old kernel
49 * which does not support the llseek system call
50 */
51 do_compat++;
52 errno = EINVAL;
53 }
54 return result;
55}