2 * Copyright (C) 2020 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by the
6 * Free Software Foundation; version 2.1 of the License.
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #include <common/fs-handle-internal.h>
19 #include <common/fs-handle.h>
20 #include <common/readwrite.h>
23 int fs_handle_get_fd(struct fs_handle
*handle
)
25 return handle
->get_fd(handle
);
29 void fs_handle_put_fd(struct fs_handle
*handle
)
31 return handle
->put_fd(handle
);
35 int fs_handle_unlink(struct fs_handle
*handle
)
37 return handle
->unlink(handle
);
41 int fs_handle_close(struct fs_handle
*handle
)
43 return handle
->close(handle
);
47 ssize_t
fs_handle_read(struct fs_handle
*handle
, void *buf
, size_t count
)
50 const int fd
= fs_handle_get_fd(handle
);
57 ret
= lttng_read(fd
, buf
, count
);
58 fs_handle_put_fd(handle
);
64 ssize_t
fs_handle_write(struct fs_handle
*handle
, const void *buf
, size_t count
)
67 const int fd
= fs_handle_get_fd(handle
);
74 ret
= lttng_write(fd
, buf
, count
);
75 fs_handle_put_fd(handle
);
81 int fs_handle_truncate(struct fs_handle
*handle
, off_t offset
)
84 const int fd
= fs_handle_get_fd(handle
);
91 ret
= ftruncate(fd
, offset
);
92 fs_handle_put_fd(handle
);
98 int fs_handle_seek(struct fs_handle
*handle
, off_t offset
, int whence
)
101 const int fd
= fs_handle_get_fd(handle
);
108 ret
= lseek(fd
, offset
, whence
);
109 fs_handle_put_fd(handle
);
This page took 0.03686 seconds and 6 git commands to generate.