aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/common/src/data_reader_dump.c2
-rw-r--r--lib/common/src/data_writer_ostream.c18
-rw-r--r--lib/io/src/dir_tree_iterator.c2
-rw-r--r--lib/io/src/get_line.c2
-rw-r--r--lib/io/src/istream.c6
-rw-r--r--lib/io/src/mem.c14
-rw-r--r--lib/io/src/unix/dir_iterator.c2
-rw-r--r--lib/io/src/unix/istream.c20
-rw-r--r--lib/io/src/unix/ostream.c18
-rw-r--r--lib/io/src/win32/dir_iterator.c2
-rw-r--r--lib/io/src/win32/istream.c20
-rw-r--r--lib/io/src/win32/ostream.c18
-rw-r--r--lib/io/src/xfrm/istream.c16
-rw-r--r--lib/io/src/xfrm/ostream.c14
-rw-r--r--lib/io/test/get_line.c2
-rw-r--r--lib/io/test/istream_mem.c2
-rw-r--r--lib/io/test/istream_read.c2
-rw-r--r--lib/io/test/istream_skip.c2
-rw-r--r--lib/io/test/stream_splice.c8
-rw-r--r--lib/io/test/xfrm.c14
-rw-r--r--lib/tar/src/internal.h10
-rw-r--r--lib/tar/src/iterator.c22
-rw-r--r--lib/tar/src/padd_file.c2
-rw-r--r--lib/tar/src/pax_header.c4
-rw-r--r--lib/tar/src/read_header.c2
-rw-r--r--lib/tar/src/read_sparse_map_new.c2
-rw-r--r--lib/tar/src/read_sparse_map_old.c2
-rw-r--r--lib/tar/src/record_to_memory.c2
-rw-r--r--lib/tar/src/write_header.c13
-rw-r--r--lib/tar/test/tar_big_file.c2
-rw-r--r--lib/tar/test/tar_fuzz.c2
-rw-r--r--lib/tar/test/tar_iterator.c2
-rw-r--r--lib/tar/test/tar_iterator2.c2
-rw-r--r--lib/tar/test/tar_iterator3.c2
-rw-r--r--lib/tar/test/tar_simple.c2
-rw-r--r--lib/tar/test/tar_sparse.c2
-rw-r--r--lib/tar/test/tar_sparse_gnu.c2
-rw-r--r--lib/tar/test/tar_target_filled.c2
-rw-r--r--lib/tar/test/tar_write_simple.c12
-rw-r--r--lib/tar/test/tar_xattr.c2
-rw-r--r--lib/tar/test/tar_xattr_bin.c2
-rw-r--r--lib/util/test/str_table.c2
42 files changed, 141 insertions, 138 deletions
diff --git a/lib/common/src/data_reader_dump.c b/lib/common/src/data_reader_dump.c
index 8f38bd2..e3cbb87 100644
--- a/lib/common/src/data_reader_dump.c
+++ b/lib/common/src/data_reader_dump.c
@@ -13,7 +13,7 @@
int sqfs_data_reader_dump(const char *name, sqfs_data_reader_t *data,
const sqfs_inode_generic_t *inode,
- ostream_t *fp, size_t block_size)
+ sqfs_ostream_t *fp, size_t block_size)
{
size_t i, diff, chunk_size;
sqfs_u64 filesz;
diff --git a/lib/common/src/data_writer_ostream.c b/lib/common/src/data_writer_ostream.c
index fbd0431..59abd7a 100644
--- a/lib/common/src/data_writer_ostream.c
+++ b/lib/common/src/data_writer_ostream.c
@@ -10,13 +10,13 @@
#include <stdlib.h>
typedef struct{
- ostream_t base;
+ sqfs_ostream_t base;
sqfs_block_processor_t *proc;
const char *filename;
} data_writer_ostream_t;
-static int stream_append(ostream_t *base, const void *data, size_t size)
+static int stream_append(sqfs_ostream_t *base, const void *data, size_t size)
{
data_writer_ostream_t *strm = (data_writer_ostream_t *)base;
int ret;
@@ -31,7 +31,7 @@ static int stream_append(ostream_t *base, const void *data, size_t size)
return 0;
}
-static int stream_flush(ostream_t *base)
+static int stream_flush(sqfs_ostream_t *base)
{
data_writer_ostream_t *strm = (data_writer_ostream_t *)base;
int ret;
@@ -46,7 +46,7 @@ static int stream_flush(ostream_t *base)
return 0;
}
-static const char *stream_get_filename(ostream_t *base)
+static const char *stream_get_filename(sqfs_ostream_t *base)
{
data_writer_ostream_t *strm = (data_writer_ostream_t *)base;
@@ -58,13 +58,13 @@ static void stream_destroy(sqfs_object_t *base)
free(base);
}
-ostream_t *data_writer_ostream_create(const char *filename,
- sqfs_block_processor_t *proc,
- sqfs_inode_generic_t **inode,
- int flags)
+sqfs_ostream_t *data_writer_ostream_create(const char *filename,
+ sqfs_block_processor_t *proc,
+ sqfs_inode_generic_t **inode,
+ int flags)
{
data_writer_ostream_t *strm = calloc(1, sizeof(*strm));
- ostream_t *base = (ostream_t *)strm;
+ sqfs_ostream_t *base = (sqfs_ostream_t *)strm;
int ret;
if (strm == NULL) {
diff --git a/lib/io/src/dir_tree_iterator.c b/lib/io/src/dir_tree_iterator.c
index 25cb1d9..4303817 100644
--- a/lib/io/src/dir_tree_iterator.c
+++ b/lib/io/src/dir_tree_iterator.c
@@ -272,7 +272,7 @@ static void ignore_subdir(dir_iterator_t *base)
pop(it);
}
-static int open_file_ro(dir_iterator_t *base, istream_t **out)
+static int open_file_ro(dir_iterator_t *base, sqfs_istream_t **out)
{
dir_tree_iterator_t *it = (dir_tree_iterator_t *)base;
diff --git a/lib/io/src/get_line.c b/lib/io/src/get_line.c
index 7ebce0e..9ab4928 100644
--- a/lib/io/src/get_line.c
+++ b/lib/io/src/get_line.c
@@ -38,7 +38,7 @@ static size_t trim(char *buffer, int flags)
return strlen(buffer);
}
-int istream_get_line(istream_t *strm, char **out,
+int istream_get_line(sqfs_istream_t *strm, char **out,
size_t *line_num, int flags)
{
char *line = NULL, *new;
diff --git a/lib/io/src/istream.c b/lib/io/src/istream.c
index 473f1af..6fbc67b 100644
--- a/lib/io/src/istream.c
+++ b/lib/io/src/istream.c
@@ -7,7 +7,7 @@
#include "internal.h"
-sqfs_s32 istream_read(istream_t *strm, void *data, size_t size)
+sqfs_s32 istream_read(sqfs_istream_t *strm, void *data, size_t size)
{
sqfs_s32 total = 0;
@@ -38,7 +38,7 @@ sqfs_s32 istream_read(istream_t *strm, void *data, size_t size)
return total;
}
-int istream_skip(istream_t *strm, sqfs_u64 size)
+int istream_skip(sqfs_istream_t *strm, sqfs_u64 size)
{
while (size > 0) {
const sqfs_u8 *ptr;
@@ -64,7 +64,7 @@ int istream_skip(istream_t *strm, sqfs_u64 size)
return 0;
}
-sqfs_s32 istream_splice(istream_t *in, ostream_t *out, sqfs_u32 size)
+sqfs_s32 istream_splice(sqfs_istream_t *in, sqfs_ostream_t *out, sqfs_u32 size)
{
sqfs_s32 total = 0;
diff --git a/lib/io/src/mem.c b/lib/io/src/mem.c
index bbb186a..435a169 100644
--- a/lib/io/src/mem.c
+++ b/lib/io/src/mem.c
@@ -13,7 +13,7 @@
#include <assert.h>
typedef struct {
- istream_t base;
+ sqfs_istream_t base;
sqfs_u8 *buffer;
size_t bufsz;
@@ -26,7 +26,7 @@ typedef struct {
char *name;
} mem_istream_t;
-static int mem_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
+static int mem_get_buffered_data(sqfs_istream_t *strm, const sqfs_u8 **out,
size_t *size, size_t want)
{
mem_istream_t *mem = (mem_istream_t *)strm;
@@ -50,7 +50,7 @@ static int mem_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
return (mem->visible == 0) ? 1 : 0;
}
-static void mem_advance_buffer(istream_t *strm, size_t count)
+static void mem_advance_buffer(sqfs_istream_t *strm, size_t count)
{
mem_istream_t *mem = (mem_istream_t *)strm;
@@ -68,7 +68,7 @@ static void mem_advance_buffer(istream_t *strm, size_t count)
}
}
-static const char *mem_in_get_filename(istream_t *strm)
+static const char *mem_in_get_filename(sqfs_istream_t *strm)
{
return ((mem_istream_t *)strm)->name;
}
@@ -80,11 +80,11 @@ static void mem_in_destroy(sqfs_object_t *obj)
free(obj);
}
-istream_t *istream_memory_create(const char *name, size_t bufsz,
- const void *data, size_t size)
+sqfs_istream_t *istream_memory_create(const char *name, size_t bufsz,
+ const void *data, size_t size)
{
mem_istream_t *mem = calloc(1, sizeof(*mem));
- istream_t *strm = (istream_t *)mem;
+ sqfs_istream_t *strm = (sqfs_istream_t *)mem;
if (mem == NULL)
return NULL;
diff --git a/lib/io/src/unix/dir_iterator.c b/lib/io/src/unix/dir_iterator.c
index 9ba200f..5129eb0 100644
--- a/lib/io/src/unix/dir_iterator.c
+++ b/lib/io/src/unix/dir_iterator.c
@@ -127,7 +127,7 @@ static void dir_ignore_subdir(dir_iterator_t *it)
(void)it;
}
-static int dir_open_file_ro(dir_iterator_t *it, istream_t **out)
+static int dir_open_file_ro(dir_iterator_t *it, sqfs_istream_t **out)
{
(void)it;
*out = NULL;
diff --git a/lib/io/src/unix/istream.c b/lib/io/src/unix/istream.c
index e96bc6c..fc76bab 100644
--- a/lib/io/src/unix/istream.c
+++ b/lib/io/src/unix/istream.c
@@ -7,7 +7,7 @@
#include "../internal.h"
typedef struct {
- istream_t base;
+ sqfs_istream_t base;
char *path;
int fd;
@@ -17,7 +17,7 @@ typedef struct {
sqfs_u8 buffer[BUFSZ];
} file_istream_t;
-static int precache(istream_t *strm)
+static int precache(sqfs_istream_t *strm)
{
file_istream_t *file = (file_istream_t *)strm;
@@ -56,7 +56,7 @@ static int precache(istream_t *strm)
return 0;
}
-static int file_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
+static int file_get_buffered_data(sqfs_istream_t *strm, const sqfs_u8 **out,
size_t *size, size_t want)
{
file_istream_t *file = (file_istream_t *)strm;
@@ -76,7 +76,7 @@ static int file_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
return (file->eof && *size == 0) ? 1 : 0;
}
-static void file_advance_buffer(istream_t *strm, size_t count)
+static void file_advance_buffer(sqfs_istream_t *strm, size_t count)
{
file_istream_t *file = (file_istream_t *)strm;
@@ -87,7 +87,7 @@ static void file_advance_buffer(istream_t *strm, size_t count)
assert(file->buffer_offset <= file->buffer_used);
}
-static const char *file_get_filename(istream_t *strm)
+static const char *file_get_filename(sqfs_istream_t *strm)
{
file_istream_t *file = (file_istream_t *)strm;
@@ -105,10 +105,10 @@ static void file_destroy(sqfs_object_t *obj)
free(file);
}
-istream_t *istream_open_handle(const char *path, int fd)
+sqfs_istream_t *istream_open_handle(const char *path, int fd)
{
file_istream_t *file = calloc(1, sizeof(*file));
- istream_t *strm = (istream_t *)file;
+ sqfs_istream_t *strm = (sqfs_istream_t *)file;
if (file == NULL) {
perror(path);
@@ -141,9 +141,9 @@ fail_free:
return NULL;
}
-istream_t *istream_open_file(const char *path)
+sqfs_istream_t *istream_open_file(const char *path)
{
- istream_t *out;
+ sqfs_istream_t *out;
int fd;
fd = open(path, O_RDONLY);
@@ -159,7 +159,7 @@ istream_t *istream_open_file(const char *path)
return out;
}
-istream_t *istream_open_stdin(void)
+sqfs_istream_t *istream_open_stdin(void)
{
return istream_open_handle("stdin", STDIN_FILENO);
}
diff --git a/lib/io/src/unix/ostream.c b/lib/io/src/unix/ostream.c
index 7093cc2..0e95167 100644
--- a/lib/io/src/unix/ostream.c
+++ b/lib/io/src/unix/ostream.c
@@ -8,7 +8,7 @@
#include "sqfs/io.h"
typedef struct {
- ostream_t base;
+ sqfs_ostream_t base;
char *path;
int flags;
int fd;
@@ -85,7 +85,7 @@ fail:
return -1;
}
-static int file_append(ostream_t *strm, const void *data, size_t size)
+static int file_append(sqfs_ostream_t *strm, const void *data, size_t size)
{
file_ostream_t *file = (file_ostream_t *)strm;
@@ -104,7 +104,7 @@ static int file_append(ostream_t *strm, const void *data, size_t size)
return write_all(file, data, size);
}
-static int file_flush(ostream_t *strm)
+static int file_flush(sqfs_ostream_t *strm)
{
file_ostream_t *file = (file_ostream_t *)strm;
@@ -130,17 +130,17 @@ static void file_destroy(sqfs_object_t *obj)
free(file);
}
-static const char *file_get_filename(ostream_t *strm)
+static const char *file_get_filename(sqfs_ostream_t *strm)
{
file_ostream_t *file = (file_ostream_t *)strm;
return file->path;
}
-ostream_t *ostream_open_handle(const char *path, int fd, int flags)
+sqfs_ostream_t *ostream_open_handle(const char *path, int fd, int flags)
{
file_ostream_t *file = calloc(1, sizeof(*file));
- ostream_t *strm = (ostream_t *)file;
+ sqfs_ostream_t *strm = (sqfs_ostream_t *)file;
if (file == NULL) {
perror(path);
@@ -175,9 +175,9 @@ fail_free:
return NULL;
}
-ostream_t *ostream_open_file(const char *path, int flags)
+sqfs_ostream_t *ostream_open_file(const char *path, int flags)
{
- ostream_t *out;
+ sqfs_ostream_t *out;
int fd;
if (flags & SQFS_FILE_OPEN_OVERWRITE) {
@@ -193,7 +193,7 @@ ostream_t *ostream_open_file(const char *path, int flags)
return out;
}
-ostream_t *ostream_open_stdout(void)
+sqfs_ostream_t *ostream_open_stdout(void)
{
return ostream_open_handle("stdout", STDOUT_FILENO,
SQFS_FILE_OPEN_NO_SPARSE);
diff --git a/lib/io/src/win32/dir_iterator.c b/lib/io/src/win32/dir_iterator.c
index b1045f1..c99fd64 100644
--- a/lib/io/src/win32/dir_iterator.c
+++ b/lib/io/src/win32/dir_iterator.c
@@ -115,7 +115,7 @@ static void dir_iterator_ignore_subdir(dir_iterator_t *it)
(void)it;
}
-static int dir_iterator_open_file_ro(dir_iterator_t *it, istream_t **out)
+static int dir_iterator_open_file_ro(dir_iterator_t *it, sqfs_istream_t **out)
{
(void)it;
*out = NULL;
diff --git a/lib/io/src/win32/istream.c b/lib/io/src/win32/istream.c
index d140142..223b20d 100644
--- a/lib/io/src/win32/istream.c
+++ b/lib/io/src/win32/istream.c
@@ -10,7 +10,7 @@
#include <windows.h>
typedef struct {
- istream_t base;
+ sqfs_istream_t base;
char *path;
HANDLE hnd;
@@ -20,7 +20,7 @@ typedef struct {
sqfs_u8 buffer[BUFSZ];
} file_istream_t;
-static int precache(istream_t *strm)
+static int precache(sqfs_istream_t *strm)
{
file_istream_t *file = (file_istream_t *)strm;
DWORD diff, actual;
@@ -66,7 +66,7 @@ static int precache(istream_t *strm)
return 0;
}
-static int file_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
+static int file_get_buffered_data(sqfs_istream_t *strm, const sqfs_u8 **out,
size_t *size, size_t want)
{
file_istream_t *file = (file_istream_t *)strm;
@@ -86,7 +86,7 @@ static int file_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
return (file->eof && *size == 0) ? 1 : 0;
}
-static void file_advance_buffer(istream_t *strm, size_t count)
+static void file_advance_buffer(sqfs_istream_t *strm, size_t count)
{
file_istream_t *file = (file_istream_t *)strm;
@@ -97,7 +97,7 @@ static void file_advance_buffer(istream_t *strm, size_t count)
assert(file->buffer_offset <= file->buffer_used);
}
-static const char *file_get_filename(istream_t *strm)
+static const char *file_get_filename(sqfs_istream_t *strm)
{
return ((file_istream_t *)strm)->path;
}
@@ -111,10 +111,10 @@ static void file_destroy(sqfs_object_t *obj)
free(file);
}
-istream_t *istream_open_handle(const char *path, HANDLE hnd)
+sqfs_istream_t *istream_open_handle(const char *path, HANDLE hnd)
{
file_istream_t *file = calloc(1, sizeof(*file));
- istream_t *strm = (istream_t *)file;
+ sqfs_istream_t *strm = (sqfs_istream_t *)file;
BOOL ret;
if (file == NULL) {
@@ -151,10 +151,10 @@ fail_free:
return NULL;
}
-istream_t *istream_open_file(const char *path)
+sqfs_istream_t *istream_open_file(const char *path)
{
WCHAR *wpath = NULL;
- istream_t *out;
+ sqfs_istream_t *out;
HANDLE hnd;
wpath = path_to_windows(path);
@@ -179,7 +179,7 @@ istream_t *istream_open_file(const char *path)
return out;
}
-istream_t *istream_open_stdin(void)
+sqfs_istream_t *istream_open_stdin(void)
{
HANDLE hnd = GetStdHandle(STD_INPUT_HANDLE);
diff --git a/lib/io/src/win32/ostream.c b/lib/io/src/win32/ostream.c
index 26d6f96..5b099a4 100644
--- a/lib/io/src/win32/ostream.c
+++ b/lib/io/src/win32/ostream.c
@@ -11,7 +11,7 @@
#include <windows.h>
typedef struct {
- ostream_t base;
+ sqfs_ostream_t base;
sqfs_u64 sparse_count;
char *path;
HANDLE hnd;
@@ -84,7 +84,7 @@ fail:
return -1;
}
-static int file_append(ostream_t *strm, const void *data, size_t size)
+static int file_append(sqfs_ostream_t *strm, const void *data, size_t size)
{
file_ostream_t *file = (file_ostream_t *)strm;
@@ -102,7 +102,7 @@ static int file_append(ostream_t *strm, const void *data, size_t size)
return write_data(file, data, size);
}
-static int file_flush(ostream_t *strm)
+static int file_flush(sqfs_ostream_t *strm)
{
file_ostream_t *file = (file_ostream_t *)strm;
@@ -126,17 +126,17 @@ static void file_destroy(sqfs_object_t *obj)
free(file);
}
-static const char *file_get_filename(ostream_t *strm)
+static const char *file_get_filename(sqfs_ostream_t *strm)
{
file_ostream_t *file = (file_ostream_t *)strm;
return file->path;
}
-ostream_t *ostream_open_handle(const char *path, HANDLE hnd, int flags)
+sqfs_ostream_t *ostream_open_handle(const char *path, HANDLE hnd, int flags)
{
file_ostream_t *file = calloc(1, sizeof(*file));
- ostream_t *strm = (ostream_t *)file;
+ sqfs_ostream_t *strm = (sqfs_ostream_t *)file;
BOOL ret;
if (file == NULL) {
@@ -174,11 +174,11 @@ fail_free:
return NULL;
}
-ostream_t *ostream_open_file(const char *path, int flags)
+sqfs_ostream_t *ostream_open_file(const char *path, int flags)
{
int access_flags, creation_mode;
WCHAR *wpath = NULL;
- ostream_t *out;
+ sqfs_ostream_t *out;
HANDLE hnd;
access_flags = GENERIC_WRITE;
@@ -216,7 +216,7 @@ ostream_t *ostream_open_file(const char *path, int flags)
return out;
}
-ostream_t *ostream_open_stdout(void)
+sqfs_ostream_t *ostream_open_stdout(void)
{
HANDLE hnd = GetStdHandle(STD_OUTPUT_HANDLE);
diff --git a/lib/io/src/xfrm/istream.c b/lib/io/src/xfrm/istream.c
index 632409c..5c23d28 100644
--- a/lib/io/src/xfrm/istream.c
+++ b/lib/io/src/xfrm/istream.c
@@ -7,9 +7,9 @@
#include "../internal.h"
typedef struct istream_xfrm_t {
- istream_t base;
+ sqfs_istream_t base;
- istream_t *wrapped;
+ sqfs_istream_t *wrapped;
xfrm_stream_t *xfrm;
size_t buffer_offset;
@@ -17,7 +17,7 @@ typedef struct istream_xfrm_t {
sqfs_u8 uncompressed[BUFSZ];
} istream_xfrm_t;
-static int precache(istream_t *base)
+static int precache(sqfs_istream_t *base)
{
istream_xfrm_t *xfrm = (istream_xfrm_t *)base;
int ret;
@@ -70,7 +70,7 @@ static int precache(istream_t *base)
return 0;
}
-static int xfrm_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
+static int xfrm_get_buffered_data(sqfs_istream_t *strm, const sqfs_u8 **out,
size_t *size, size_t want)
{
istream_xfrm_t *xfrm = (istream_xfrm_t *)strm;
@@ -90,7 +90,7 @@ static int xfrm_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
return (*size == 0) ? 1 : 0;
}
-static void xfrm_advance_buffer(istream_t *strm, size_t count)
+static void xfrm_advance_buffer(sqfs_istream_t *strm, size_t count)
{
istream_xfrm_t *xfrm = (istream_xfrm_t *)strm;
@@ -101,7 +101,7 @@ static void xfrm_advance_buffer(istream_t *strm, size_t count)
assert(xfrm->buffer_offset <= xfrm->buffer_used);
}
-static const char *xfrm_get_filename(istream_t *strm)
+static const char *xfrm_get_filename(sqfs_istream_t *strm)
{
istream_xfrm_t *xfrm = (istream_xfrm_t *)strm;
@@ -117,10 +117,10 @@ static void xfrm_destroy(sqfs_object_t *obj)
free(xfrm);
}
-istream_t *istream_xfrm_create(istream_t *strm, xfrm_stream_t *xfrm)
+sqfs_istream_t *istream_xfrm_create(sqfs_istream_t *strm, xfrm_stream_t *xfrm)
{
istream_xfrm_t *stream = calloc(1, sizeof(*stream));
- istream_t *base = (istream_t *)stream;
+ sqfs_istream_t *base = (sqfs_istream_t *)stream;
if (stream == NULL)
goto fail;
diff --git a/lib/io/src/xfrm/ostream.c b/lib/io/src/xfrm/ostream.c
index e55e38c..81c19dd 100644
--- a/lib/io/src/xfrm/ostream.c
+++ b/lib/io/src/xfrm/ostream.c
@@ -7,9 +7,9 @@
#include "../internal.h"
typedef struct ostream_xfrm_t {
- ostream_t base;
+ sqfs_ostream_t base;
- ostream_t *wrapped;
+ sqfs_ostream_t *wrapped;
xfrm_stream_t *xfrm;
size_t inbuf_used;
@@ -66,7 +66,7 @@ static int flush_inbuf(ostream_xfrm_t *xfrm, bool finish)
return 0;
}
-static int xfrm_append(ostream_t *strm, const void *data, size_t size)
+static int xfrm_append(sqfs_ostream_t *strm, const void *data, size_t size)
{
ostream_xfrm_t *xfrm = (ostream_xfrm_t *)strm;
size_t diff;
@@ -96,7 +96,7 @@ static int xfrm_append(ostream_t *strm, const void *data, size_t size)
return 0;
}
-static int xfrm_flush(ostream_t *strm)
+static int xfrm_flush(sqfs_ostream_t *strm)
{
ostream_xfrm_t *xfrm = (ostream_xfrm_t *)strm;
@@ -108,7 +108,7 @@ static int xfrm_flush(ostream_t *strm)
return xfrm->wrapped->flush(xfrm->wrapped);
}
-static const char *xfrm_get_filename(ostream_t *strm)
+static const char *xfrm_get_filename(sqfs_ostream_t *strm)
{
ostream_xfrm_t *xfrm = (ostream_xfrm_t *)strm;
@@ -124,10 +124,10 @@ static void xfrm_destroy(sqfs_object_t *obj)
free(xfrm);
}
-ostream_t *ostream_xfrm_create(ostream_t *strm, xfrm_stream_t *xfrm)
+sqfs_ostream_t *ostream_xfrm_create(sqfs_ostream_t *strm, xfrm_stream_t *xfrm)
{
ostream_xfrm_t *stream = calloc(1, sizeof(*stream));
- ostream_t *base = (ostream_t *)stream;
+ sqfs_ostream_t *base = (sqfs_ostream_t *)stream;
if (stream == NULL)
goto fail;
diff --git a/lib/io/test/get_line.c b/lib/io/test/get_line.c
index 0ce67ac..d300a3a 100644
--- a/lib/io/test/get_line.c
+++ b/lib/io/test/get_line.c
@@ -16,7 +16,7 @@ static void run_test_case(const char *raw, const line_t *lines, size_t count,
int flags)
{
size_t i, line_num, old_line_num;
- istream_t *fp;
+ sqfs_istream_t *fp;
char *line;
int ret;
diff --git a/lib/io/test/istream_mem.c b/lib/io/test/istream_mem.c
index ca5146c..f364fd3 100644
--- a/lib/io/test/istream_mem.c
+++ b/lib/io/test/istream_mem.c
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
size_t i, diff, size;
bool eat_all = true;
const sqfs_u8 *ptr;
- istream_t *in;
+ sqfs_istream_t *in;
int ret;
(void)argc; (void)argv;
diff --git a/lib/io/test/istream_read.c b/lib/io/test/istream_read.c
index 8ba4540..66fec4b 100644
--- a/lib/io/test/istream_read.c
+++ b/lib/io/test/istream_read.c
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
{
sqfs_u8 read_buffer[61];
sqfs_u64 read_off = 0;
- istream_t *dummy;
+ sqfs_istream_t *dummy;
(void)argc; (void)argv;
init_rd_buffer();
diff --git a/lib/io/test/istream_skip.c b/lib/io/test/istream_skip.c
index 3a02c8c..0fc3e11 100644
--- a/lib/io/test/istream_skip.c
+++ b/lib/io/test/istream_skip.c
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
{
sqfs_u8 read_buffer[61];
sqfs_u64 read_off = 0;
- istream_t *dummy;
+ sqfs_istream_t *dummy;
(void)argc; (void)argv;
init_rd_buffer();
diff --git a/lib/io/test/stream_splice.c b/lib/io/test/stream_splice.c
index 754f9cb..a9edd76 100644
--- a/lib/io/test/stream_splice.c
+++ b/lib/io/test/stream_splice.c
@@ -34,11 +34,11 @@ static void init_rd_buffer(void)
/*****************************************************************************/
-static int out_append(ostream_t *strm, const void *data, size_t size);
+static int out_append(sqfs_ostream_t *strm, const void *data, size_t size);
static sqfs_u64 out_offset = 0;
-static ostream_t out = {
+static sqfs_ostream_t out = {
{ 1, NULL, NULL },
out_append,
NULL,
@@ -46,7 +46,7 @@ static ostream_t out = {
NULL,
};
-static int out_append(ostream_t *strm, const void *data, size_t size)
+static int out_append(sqfs_ostream_t *strm, const void *data, size_t size)
{
const sqfs_u8 *ptr = data;
@@ -69,7 +69,7 @@ static int out_append(ostream_t *strm, const void *data, size_t size)
int main(int argc, char **argv)
{
sqfs_u64 total = 0;
- istream_t *in;
+ sqfs_istream_t *in;
sqfs_s32 ret;
(void)argc; (void)argv;
diff --git a/lib/io/test/xfrm.c b/lib/io/test/xfrm.c
index 184db9e..1b48e6f 100644
--- a/lib/io/test/xfrm.c
+++ b/lib/io/test/xfrm.c
@@ -368,17 +368,17 @@ static size_t mo_written = 0;
static sqfs_u8 mo_buffer[1024];
static bool mo_flushed = false;
-static int mem_append(ostream_t *strm, const void *data, size_t size);
-static int mem_flush(ostream_t *strm);
+static int mem_append(sqfs_ostream_t *strm, const void *data, size_t size);
+static int mem_flush(sqfs_ostream_t *strm);
-static ostream_t mem_ostream = {
+static sqfs_ostream_t mem_ostream = {
{ 1, NULL, NULL, },
mem_append,
mem_flush,
NULL,
};
-static int mem_append(ostream_t *strm, const void *data, size_t size)
+static int mem_append(sqfs_ostream_t *strm, const void *data, size_t size)
{
TEST_ASSERT(strm == &mem_ostream);
TEST_ASSERT(size > 0);
@@ -396,7 +396,7 @@ static int mem_append(ostream_t *strm, const void *data, size_t size)
return 0;
}
-static int mem_flush(ostream_t *strm)
+static int mem_flush(sqfs_ostream_t *strm)
{
TEST_ASSERT(strm == &mem_ostream);
TEST_ASSERT(!mo_flushed);
@@ -408,7 +408,7 @@ static int mem_flush(ostream_t *strm)
static void run_unpack_test(const void *blob, size_t size)
{
- istream_t *istream, *mem_istream;
+ sqfs_istream_t *istream, *mem_istream;
xfrm_stream_t *xfrm;
sqfs_s32 ret;
size_t i;
@@ -450,8 +450,8 @@ static void run_unpack_test(const void *blob, size_t size)
static void run_pack_test(void)
{
+ sqfs_ostream_t *ostream;
xfrm_stream_t *xfrm;
- ostream_t *ostream;
size_t i;
int ret;
diff --git a/lib/tar/src/internal.h b/lib/tar/src/internal.h
index c5483fe..56613d3 100644
--- a/lib/tar/src/internal.h
+++ b/lib/tar/src/internal.h
@@ -34,13 +34,15 @@ enum {
ETV_POSIX,
};
-sparse_map_t *read_gnu_old_sparse(istream_t *fp, tar_header_t *hdr);
+sparse_map_t *read_gnu_old_sparse(sqfs_istream_t *fp, tar_header_t *hdr);
-sparse_map_t *read_gnu_new_sparse(istream_t *fp, tar_header_decoded_t *out);
+sparse_map_t *read_gnu_new_sparse(sqfs_istream_t *fp,
+ tar_header_decoded_t *out);
-char *record_to_memory(istream_t *fp, size_t size);
+char *record_to_memory(sqfs_istream_t *fp, size_t size);
-int read_pax_header(istream_t *fp, sqfs_u64 entsize, unsigned int *set_by_pax,
+int read_pax_header(sqfs_istream_t *fp, sqfs_u64 entsize,
+ unsigned int *set_by_pax,
tar_header_decoded_t *out);
#endif /* INTERNAL_H */
diff --git a/lib/tar/src/iterator.c b/lib/tar/src/iterator.c
index 1f26e76..5920b46 100644
--- a/lib/tar/src/iterator.c
+++ b/lib/tar/src/iterator.c
@@ -20,7 +20,7 @@
typedef struct {
dir_iterator_t base;
tar_header_decoded_t current;
- istream_t *stream;
+ sqfs_istream_t *stream;
int state;
/* File I/O wrapper related */
@@ -35,7 +35,7 @@ typedef struct {
} tar_iterator_t;
typedef struct {
- istream_t base;
+ sqfs_istream_t base;
tar_iterator_t *parent;
int state;
@@ -89,12 +89,12 @@ static void drop_parent(tar_istream_t *tar, int state)
tar->state = state;
}
-static const char *strm_get_filename(istream_t *strm)
+static const char *strm_get_filename(sqfs_istream_t *strm)
{
return ((tar_istream_t *)strm)->parent->current.name;
}
-static int strm_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
+static int strm_get_buffered_data(sqfs_istream_t *strm, const sqfs_u8 **out,
size_t *size, size_t want)
{
tar_istream_t *tar = (tar_istream_t *)strm;
@@ -142,7 +142,7 @@ out_eof:
return 1;
}
-static void strm_advance_buffer(istream_t *strm, size_t count)
+static void strm_advance_buffer(sqfs_istream_t *strm, size_t count)
{
tar_istream_t *tar = (tar_istream_t *)strm;
@@ -263,7 +263,7 @@ static void it_ignore_subdir(dir_iterator_t *it)
/* TODO: skip list */
}
-static int it_open_file_ro(dir_iterator_t *it, istream_t **out)
+static int it_open_file_ro(dir_iterator_t *it, sqfs_istream_t **out)
{
tar_iterator_t *tar = (tar_iterator_t *)it;
tar_istream_t *strm;
@@ -285,12 +285,12 @@ static int it_open_file_ro(dir_iterator_t *it, istream_t **out)
sqfs_object_init(strm, strm_destroy, NULL);
strm->parent = sqfs_grab(tar);
- ((istream_t *)strm)->get_buffered_data = strm_get_buffered_data;
- ((istream_t *)strm)->advance_buffer = strm_advance_buffer;
- ((istream_t *)strm)->get_filename = strm_get_filename;
+ ((sqfs_istream_t *)strm)->get_buffered_data = strm_get_buffered_data;
+ ((sqfs_istream_t *)strm)->advance_buffer = strm_advance_buffer;
+ ((sqfs_istream_t *)strm)->get_filename = strm_get_filename;
tar->locked = true;
- *out = (istream_t *)strm;
+ *out = (sqfs_istream_t *)strm;
return 0;
}
@@ -351,7 +351,7 @@ static int tar_probe(const sqfs_u8 *data, size_t size)
return 0;
}
-dir_iterator_t *tar_open_stream(istream_t *strm)
+dir_iterator_t *tar_open_stream(sqfs_istream_t *strm)
{
tar_iterator_t *tar = calloc(1, sizeof(*tar));
dir_iterator_t *it = (dir_iterator_t *)tar;
diff --git a/lib/tar/src/padd_file.c b/lib/tar/src/padd_file.c
index 0f6ee0a..814b666 100644
--- a/lib/tar/src/padd_file.c
+++ b/lib/tar/src/padd_file.c
@@ -8,7 +8,7 @@
#include "tar/tar.h"
#include "tar/format.h"
-int padd_file(ostream_t *fp, sqfs_u64 size)
+int padd_file(sqfs_ostream_t *fp, sqfs_u64 size)
{
size_t padd_sz = size % TAR_RECORD_SIZE;
diff --git a/lib/tar/src/pax_header.c b/lib/tar/src/pax_header.c
index 74a1b24..5ed9c4b 100644
--- a/lib/tar/src/pax_header.c
+++ b/lib/tar/src/pax_header.c
@@ -293,8 +293,8 @@ static int apply_handler(tar_header_decoded_t *out,
return 0;
}
-int read_pax_header(istream_t *fp, sqfs_u64 entsize, unsigned int *set_by_pax,
- tar_header_decoded_t *out)
+int read_pax_header(sqfs_istream_t *fp, sqfs_u64 entsize,
+ unsigned int *set_by_pax, tar_header_decoded_t *out)
{
char *buffer, *line, *key, *ptr, *value, *end;
sparse_map_t *sparse_last = NULL, *sparse;
diff --git a/lib/tar/src/read_header.c b/lib/tar/src/read_header.c
index 751c5dc..3117d8a 100644
--- a/lib/tar/src/read_header.c
+++ b/lib/tar/src/read_header.c
@@ -164,7 +164,7 @@ static int decode_header(const tar_header_t *hdr, unsigned int set_by_pax,
return 0;
}
-int read_header(istream_t *fp, tar_header_decoded_t *out)
+int read_header(sqfs_istream_t *fp, tar_header_decoded_t *out)
{
unsigned int set_by_pax = 0;
bool prev_was_zero = false;
diff --git a/lib/tar/src/read_sparse_map_new.c b/lib/tar/src/read_sparse_map_new.c
index de1b6a4..a1f37fd 100644
--- a/lib/tar/src/read_sparse_map_new.c
+++ b/lib/tar/src/read_sparse_map_new.c
@@ -31,7 +31,7 @@ static int decode(const char *str, size_t len, size_t *out)
return (*str == '\n') ? ((int)count + 1) : -1;
}
-sparse_map_t *read_gnu_new_sparse(istream_t *fp, tar_header_decoded_t *out)
+sparse_map_t *read_gnu_new_sparse(sqfs_istream_t *fp, tar_header_decoded_t *out)
{
sparse_map_t *last = NULL, *list = NULL, *ent = NULL;
size_t i, count, value;
diff --git a/lib/tar/src/read_sparse_map_old.c b/lib/tar/src/read_sparse_map_old.c
index 8f193d4..832329b 100644
--- a/lib/tar/src/read_sparse_map_old.c
+++ b/lib/tar/src/read_sparse_map_old.c
@@ -45,7 +45,7 @@ static int parse(const gnu_old_sparse_t *in, size_t count,
return 0;
}
-sparse_map_t *read_gnu_old_sparse(istream_t *fp, tar_header_t *hdr)
+sparse_map_t *read_gnu_old_sparse(sqfs_istream_t *fp, tar_header_t *hdr)
{
sparse_map_t *list = NULL, *end = NULL;
gnu_old_sparse_record_t sph;
diff --git a/lib/tar/src/record_to_memory.c b/lib/tar/src/record_to_memory.c
index 43fd44c..1bd31aa 100644
--- a/lib/tar/src/record_to_memory.c
+++ b/lib/tar/src/record_to_memory.c
@@ -10,7 +10,7 @@
#include "internal.h"
#include <stdlib.h>
-char *record_to_memory(istream_t *fp, size_t size)
+char *record_to_memory(sqfs_istream_t *fp, size_t size)
{
char *buffer = malloc(size + 1);
int ret;
diff --git a/lib/tar/src/write_header.c b/lib/tar/src/write_header.c
index 726b15d..1183c9a 100644
--- a/lib/tar/src/write_header.c
+++ b/lib/tar/src/write_header.c
@@ -63,8 +63,8 @@ static void write_number_signed(char *dst, sqfs_s64 value, int digits)
}
}
-static int write_header(ostream_t *fp, const struct stat *sb, const char *name,
- const char *slink_target, int type)
+static int write_header(sqfs_ostream_t *fp, const struct stat *sb,
+ const char *name, const char *slink_target, int type)
{
int maj = 0, min = 0;
sqfs_u64 size = 0;
@@ -101,7 +101,7 @@ static int write_header(ostream_t *fp, const struct stat *sb, const char *name,
return fp->append(fp, &hdr, sizeof(hdr));
}
-static int write_ext_header(ostream_t *fp, const struct stat *orig,
+static int write_ext_header(sqfs_ostream_t *fp, const struct stat *orig,
const char *payload, size_t payload_len,
int type, const char *name)
{
@@ -144,7 +144,7 @@ static size_t prefix_digit_len(size_t len)
return ndigit;
}
-static int write_schily_xattr(ostream_t *fp, const struct stat *orig,
+static int write_schily_xattr(sqfs_ostream_t *fp, const struct stat *orig,
const char *name, const sqfs_xattr_t *xattr)
{
static const char *prefix = "SCHILY.xattr.";
@@ -183,7 +183,8 @@ static int write_schily_xattr(ostream_t *fp, const struct stat *orig,
return ret;
}
-int write_tar_header(ostream_t *fp, const struct stat *sb, const char *name,
+int write_tar_header(sqfs_ostream_t *fp,
+ const struct stat *sb, const char *name,
const char *slink_target, const sqfs_xattr_t *xattr,
unsigned int counter)
{
@@ -242,7 +243,7 @@ out_skip:
return 1;
}
-int write_hard_link(ostream_t *fp, const struct stat *sb, const char *name,
+int write_hard_link(sqfs_ostream_t *fp, const struct stat *sb, const char *name,
const char *target, unsigned int counter)
{
tar_header_t hdr;
diff --git a/lib/tar/test/tar_big_file.c b/lib/tar/test/tar_big_file.c
index deb41f4..444548b 100644
--- a/lib/tar/test/tar_big_file.c
+++ b/lib/tar/test/tar_big_file.c
@@ -12,7 +12,7 @@
int main(int argc, char **argv)
{
tar_header_decoded_t hdr;
- istream_t *fp;
+ sqfs_istream_t *fp;
(void)argc; (void)argv;
fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
diff --git a/lib/tar/test/tar_fuzz.c b/lib/tar/test/tar_fuzz.c
index 21e6978..bdea98e 100644
--- a/lib/tar/test/tar_fuzz.c
+++ b/lib/tar/test/tar_fuzz.c
@@ -15,7 +15,7 @@
int main(int argc, char **argv)
{
tar_header_decoded_t hdr;
- istream_t *fp;
+ sqfs_istream_t *fp;
int ret;
if (argc != 2) {
diff --git a/lib/tar/test/tar_iterator.c b/lib/tar/test/tar_iterator.c
index 21bd3e6..25e1389 100644
--- a/lib/tar/test/tar_iterator.c
+++ b/lib/tar/test/tar_iterator.c
@@ -30,7 +30,7 @@ static const char *fname = STRVALUE(TESTFNAME);
int main(int argc, char **argv)
{
- istream_t *fp, *ti, *ti2;
+ sqfs_istream_t *fp, *ti, *ti2;
dir_iterator_t *it;
dir_entry_t *ent;
char buffer[100];
diff --git a/lib/tar/test/tar_iterator2.c b/lib/tar/test/tar_iterator2.c
index 7f1f3bf..6f472ae 100644
--- a/lib/tar/test/tar_iterator2.c
+++ b/lib/tar/test/tar_iterator2.c
@@ -44,8 +44,8 @@ static int byte_from_offset(uint64_t offset)
int main(int argc, char **argv)
{
unsigned char buffer[941];
+ sqfs_istream_t *fp, *ti;
dir_iterator_t *it;
- istream_t *fp, *ti;
dir_entry_t *ent;
uint64_t offset;
sqfs_s32 i, ret;
diff --git a/lib/tar/test/tar_iterator3.c b/lib/tar/test/tar_iterator3.c
index b2ad6f9..39e7b42 100644
--- a/lib/tar/test/tar_iterator3.c
+++ b/lib/tar/test/tar_iterator3.c
@@ -13,8 +13,8 @@
int main(int argc, char **argv)
{
+ sqfs_istream_t *fp, *ti;
dir_iterator_t *it;
- istream_t *fp, *ti;
char buffer[100];
dir_entry_t *ent;
char *link;
diff --git a/lib/tar/test/tar_simple.c b/lib/tar/test/tar_simple.c
index cb38abb..656e59b 100644
--- a/lib/tar/test/tar_simple.c
+++ b/lib/tar/test/tar_simple.c
@@ -37,9 +37,9 @@ static const char *fname = STRVALUE(TESTFNAME);
int main(int argc, char **argv)
{
tar_header_decoded_t hdr;
+ sqfs_istream_t *fp;
char buffer[6];
sqfs_s64 ts;
- istream_t *fp;
(void)argc; (void)argv;
fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
diff --git a/lib/tar/test/tar_sparse.c b/lib/tar/test/tar_sparse.c
index 27ce053..99d4639 100644
--- a/lib/tar/test/tar_sparse.c
+++ b/lib/tar/test/tar_sparse.c
@@ -13,7 +13,7 @@ static void test_case_sparse(const char *path)
{
tar_header_decoded_t hdr;
sparse_map_t *sparse;
- istream_t *fp;
+ sqfs_istream_t *fp;
fp = istream_open_file(path);
TEST_NOT_NULL(fp);
diff --git a/lib/tar/test/tar_sparse_gnu.c b/lib/tar/test/tar_sparse_gnu.c
index 19ddd0a..675ef9a 100644
--- a/lib/tar/test/tar_sparse_gnu.c
+++ b/lib/tar/test/tar_sparse_gnu.c
@@ -13,7 +13,7 @@ int main(int argc, char **argv)
{
tar_header_decoded_t hdr;
sparse_map_t *sparse;
- istream_t *fp;
+ sqfs_istream_t *fp;
(void)argc; (void)argv;
TEST_ASSERT(chdir(TEST_PATH) == 0);
diff --git a/lib/tar/test/tar_target_filled.c b/lib/tar/test/tar_target_filled.c
index e2e1798..815728a 100644
--- a/lib/tar/test/tar_target_filled.c
+++ b/lib/tar/test/tar_target_filled.c
@@ -12,8 +12,8 @@
int main(int argc, char **argv)
{
tar_header_decoded_t hdr;
+ sqfs_istream_t *fp;
char buffer[16];
- istream_t *fp;
(void)argc; (void)argv;
TEST_ASSERT(chdir(TEST_PATH) == 0);
diff --git a/lib/tar/test/tar_write_simple.c b/lib/tar/test/tar_write_simple.c
index b34c9c5..98ac25b 100644
--- a/lib/tar/test/tar_write_simple.c
+++ b/lib/tar/test/tar_write_simple.c
@@ -14,10 +14,10 @@
/*****************************************************************************/
-static int buffer_append(ostream_t *strm, const void *data, size_t size);
-static const char *buffer_get_filename(ostream_t *strm);
+static int buffer_append(sqfs_ostream_t *strm, const void *data, size_t size);
+static const char *buffer_get_filename(sqfs_ostream_t *strm);
-static ostream_t mem_stream = {
+static sqfs_ostream_t mem_stream = {
{ 1, NULL, NULL },
buffer_append,
NULL,
@@ -29,7 +29,7 @@ static size_t wr_offset = 0;
static sqfs_u8 rd_buffer[1024 * 10];
-static int buffer_append(ostream_t *strm, const void *data, size_t size)
+static int buffer_append(sqfs_ostream_t *strm, const void *data, size_t size)
{
TEST_ASSERT(strm == &mem_stream);
TEST_ASSERT(wr_offset < sizeof(wr_buffer));
@@ -46,7 +46,7 @@ static int buffer_append(ostream_t *strm, const void *data, size_t size)
return 0;
}
-static const char *buffer_get_filename(ostream_t *strm)
+static const char *buffer_get_filename(sqfs_ostream_t *strm)
{
TEST_ASSERT(strm == &mem_stream);
return "dummy";
@@ -79,8 +79,8 @@ static sqfs_xattr_t *mkxattr_chain(void)
int main(int argc, char **argv)
{
sqfs_xattr_t *xattr;
+ sqfs_istream_t *fp;
struct stat sb;
- istream_t *fp;
int ret;
(void)argc; (void)argv;
diff --git a/lib/tar/test/tar_xattr.c b/lib/tar/test/tar_xattr.c
index 1577fc7..657b73d 100644
--- a/lib/tar/test/tar_xattr.c
+++ b/lib/tar/test/tar_xattr.c
@@ -13,8 +13,8 @@
int main(int argc, char **argv)
{
tar_header_decoded_t hdr;
+ sqfs_istream_t *fp;
char buffer[6];
- istream_t *fp;
(void)argc; (void)argv;
fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
diff --git a/lib/tar/test/tar_xattr_bin.c b/lib/tar/test/tar_xattr_bin.c
index 129d227..f897bce 100644
--- a/lib/tar/test/tar_xattr_bin.c
+++ b/lib/tar/test/tar_xattr_bin.c
@@ -21,8 +21,8 @@ static const uint8_t value[] = {
int main(int argc, char **argv)
{
tar_header_decoded_t hdr;
+ sqfs_istream_t *fp;
char buffer[6];
- istream_t *fp;
(void)argc; (void)argv;
fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
diff --git a/lib/util/test/str_table.c b/lib/util/test/str_table.c
index d4160eb..5408fc0 100644
--- a/lib/util/test/str_table.c
+++ b/lib/util/test/str_table.c
@@ -15,7 +15,7 @@ static char *strings[1000];
static int read_strings(void)
{
- istream_t *fp;
+ sqfs_istream_t *fp;
ssize_t ret;
char *line;
int i;