Commit da16a84b authored by Marc Vef's avatar Marc Vef
Browse files

Using off64_t instead of off_t.

parent f6e9991e
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -5,23 +5,23 @@

int adafs_open(const std::string& path, mode_t mode, int flags);

int adafs_mk_node(const std::string& path, const mode_t mode);
int adafs_mk_node(const std::string& path, mode_t mode);

int adafs_rm_node(const std::string& path);

int adafs_access(const std::string& path, const int mask);
int adafs_access(const std::string& path, int mask);

int adafs_stat(const std::string& path, struct stat* buf);

int adafs_stat64(const std::string& path, struct stat64* buf);

off_t adafs_lseek(int fd, off_t offset, int whence);
off64_t adafs_lseek(int fd, off64_t offset, int whence);

off_t adafs_lseek(OpenFile* adafs_fd, off_t offset, int whence);
off64_t adafs_lseek(OpenFile* adafs_fd, off64_t offset, int whence);

ssize_t adafs_pread_ws(int fd, void* buf, size_t count, off_t offset);
ssize_t adafs_pread_ws(int fd, void* buf, size_t count, off64_t offset);

ssize_t adafs_pwrite_ws(int fd, const void* buf, size_t count, off_t offset);
ssize_t adafs_pwrite_ws(int fd, const void* buf, size_t count, off64_t offset);


#endif //IFS_ADAFS_FUNCTIONS_HPP
+3 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ class OpenFile {
private:
    std::string path_;
    std::array<bool, static_cast<int>(OpenFile_flags::flag_count)> flags_ = {false};
    off_t pos_;
    off64_t pos_;
    std::mutex pos_mutex_;
    std::mutex flag_mutex_;

@@ -36,9 +36,9 @@ public:

    void path(const std::string& path_);

    off_t pos();
    off64_t pos();

    void pos(off_t pos_);
    void pos(off64_t pos_);

    const bool get_flag(OpenFile_flags flag);

+5 −5
Original line number Diff line number Diff line
@@ -12,9 +12,9 @@ inline hg_return_t margo_forward_timed_wrap(hg_handle_t& handle, void* in_struct

void send_minimal_rpc(hg_id_t minimal_id);

int rpc_send_mk_node(const std::string& path, const mode_t mode);
int rpc_send_mk_node(const std::string& path, mode_t mode);

int rpc_send_access(const std::string& path, const int mask);
int rpc_send_access(const std::string& path, int mask);

int rpc_send_stat(const std::string& path, std::string& attr);

@@ -22,9 +22,9 @@ int rpc_send_rm_node(const std::string& path);

int rpc_send_update_metadentry(const std::string& path, const Metadentry& md, const MetadentryUpdateFlags& md_flags);

int rpc_send_update_metadentry_size(const std::string& path, size_t size, off_t offset, bool append_flag,
                                    off_t& ret_size);
int rpc_send_update_metadentry_size(const std::string& path, size_t size, off64_t offset, bool append_flag,
                                    off64_t& ret_size);

int rpc_send_get_metadentry_size(const std::string& path, off_t& ret_size);
int rpc_send_get_metadentry_size(const std::string& path, off64_t& ret_size);

#endif //IFS_PRELOAD_C_METADENTRY_HPP
+7 −6
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ int destroy_chunk_space(const std::string& path) {
 * @param [out] write_size
 * @return
 */
int write_file(const string& path, const char* buf, const rpc_chnk_id_t chnk_id, const size_t size, const off_t off,
int write_file(const string& path, const char* buf, const rpc_chnk_id_t chnk_id, const size_t size, const off64_t off,
               size_t& write_size) {
    auto fs_path = path_to_fspath(path);
    auto chnk_path = bfs::path(ADAFS_DATA->chunk_path());
@@ -82,7 +82,7 @@ int write_file(const string& path, const char* buf, const rpc_chnk_id_t chnk_id,
    int fd = open(chnk_path.c_str(), O_WRONLY | O_CREAT, 0777);
    if (fd < 0)
        return EIO;
    auto err = static_cast<size_t>(pwrite(fd, buf, size, off));
    auto err = static_cast<size_t>(pwrite64(fd, buf, size, off));
    if (err < 0) {
        ADAFS_DATA->spdlogger()->error("{}() Error {} while pwriting file {} chunk_id {} size {} off {}", __func__,
                                       strerror(errno), chnk_path.c_str(), chnk_id, size, off);
@@ -94,7 +94,8 @@ int write_file(const string& path, const char* buf, const rpc_chnk_id_t chnk_id,
}

int
write_chunks(const string& path, const vector<void*>& buf_ptrs, const vector<hg_size_t>& buf_sizes, const off_t offset,
write_chunks(const string& path, const vector<void*>& buf_ptrs, const vector<hg_size_t>& buf_sizes,
             const off64_t offset,
             size_t& write_size) {
    write_size = 0;
    int err;
@@ -132,7 +133,7 @@ write_chunks(const string& path, const vector<void*>& buf_ptrs, const vector<hg_
 * @param [out] read_size
 * @return
 */
int read_file(const string& path, const rpc_chnk_id_t chnk_id, const size_t size, const off_t off, char* buf,
int read_file(const string& path, const rpc_chnk_id_t chnk_id, const size_t size, const off64_t off, char* buf,
              size_t& read_size) {
    auto fs_path = path_to_fspath(path);
    auto chnk_path = bfs::path(ADAFS_DATA->chunk_path());
@@ -142,7 +143,7 @@ int read_file(const string& path, const rpc_chnk_id_t chnk_id, const size_t size
    int fd = open(chnk_path.c_str(), R_OK);
    if (fd < 0)
        return EIO;
    auto err = pread(fd, buf, size, off);
    auto err = pread64(fd, buf, size, off);
    if (err < 0) {
        ADAFS_DATA->spdlogger()->error("{}() Error {} while preading file {} chunk_id {} size {} off {}", __func__,
                                       strerror(errno), chnk_path.c_str(), chnk_id, size, off);
@@ -153,7 +154,7 @@ int read_file(const string& path, const rpc_chnk_id_t chnk_id, const size_t size
    return 0;
}

int read_chunks(const string& path, const off_t offset, const vector<void*>& buf_ptrs,
int read_chunks(const string& path, const off64_t offset, const vector<void*>& buf_ptrs,
                const vector<hg_size_t>& buf_sizes,
                size_t& read_size) {
    read_size = 0;
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ int get_metadentry_size(const string& path, size_t& ret_size) {
 * @param io_size
 * @return the updated size
 */
int update_metadentry_size(const string& path, size_t io_size, off_t offset, bool append, size_t& read_size) {
int update_metadentry_size(const string& path, size_t io_size, off64_t offset, bool append, size_t& read_size) {
    // XXX This function has to be completely atomic. Do we need transactions here? or a separate locking db?
#ifdef LOG_TRACE
    db_iterate_all_entries();
Loading