Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
184d916
Cherry pick from build-windows
Piloalucard Apr 18, 2025
f3a4e82
Cherry pick from build-windows
Piloalucard Apr 18, 2025
3bd0ba0
Update make_message_src.sh
Piloalucard Apr 18, 2025
8b88246
Undoing unwanted changes and comments
Piloalucard Apr 18, 2025
81b2ff4
Update compatibility.h
Piloalucard Apr 18, 2025
15e69c6
Corrections for Linux build with windows changes
Apr 18, 2025
a7a2591
Corrections for Linux build with windows changes
vandelvan Apr 18, 2025
80395fa
Merge branch 'windows' of https://github.com/Piloalucard/ltfs into wi…
Piloalucard Apr 18, 2025
9b03b94
Changed macros to arch ops
Piloalucard Apr 24, 2025
f2ed251
rewriting functions
Piloalucard Apr 25, 2025
c8c70bf
corrections for Linux build
vandelvan Apr 25, 2025
46488e1
Making non-static for linux
Piloalucard Apr 25, 2025
c49d6b6
Update pathname.c
Piloalucard Apr 25, 2025
b68e771
Update pathname.c
Piloalucard Apr 25, 2025
ba335dc
Update ltfs_arch_ops.h
Piloalucard Apr 25, 2025
2ef6dec
Merge branch 'v2.4-stable' into windows
Piloalucard Apr 26, 2025
ebbb858
Update ltfs_arch_ops.h
Piloalucard Apr 28, 2025
092238d
updated python2 to python3 for validate error messages
vandelvan Apr 28, 2025
14a7620
Revert "updated python2 to python3 for validate error messages"
vandelvan Apr 28, 2025
757a2ed
fix: warnings during build in linux
vandelvan Apr 29, 2025
83f8380
Asterisk fix in pointers decl to match standard
Piloalucard Apr 30, 2025
35760f9
Update ltfs_arch_ops.h
Piloalucard Apr 30, 2025
45662c0
Update ltfs_arch_ops.h
Piloalucard Apr 30, 2025
961c2b9
Updated arch_ops and added missing error msgs
Piloalucard Apr 30, 2025
f50ad91
build errors
Piloalucard May 4, 2025
5eb697e
Update filedebug_tc.c
Piloalucard May 4, 2025
08e798b
Copyright not used
Piloalucard May 4, 2025
f752cc8
Update ltfsck.c
Piloalucard May 4, 2025
9d961d3
missing correct cast
Piloalucard May 4, 2025
5bfc706
Removing unnecesary changes
Piloalucard May 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions messages/make_message_src.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh


set -e

KERNEL_NAME=`uname -s`
Expand Down Expand Up @@ -32,8 +33,11 @@ else
fi

if [ "$#" -ne "1" ]; then
echo "Missing 1 parameter"
echo "Usage: $0 object_file"
exit 1
else
echo "$1"
fi

case $KERNEL_NAME in
Expand All @@ -49,6 +53,23 @@ esac
cd ${BASENAME}

make_obj() {
RETREAT="../../"
MODE="static"

case $KERNEL_NAME in
MINGW32_NT*)
CURRENT_MSG_PATH="../../oss/messages/$BASENAME"
if [ -d "${CURRENT_MSG_PATH}" ]; then
cd ${CURRENT_MSG_PATH}
echo "Changing directory"
RETREAT="../../../../messages/"
fi
MODE="common"
;;
*)
;;
esac

echo "Processing ${BASENAME}"

# Create a fresh work directory
Expand All @@ -60,12 +81,19 @@ make_obj() {
# Generate files
${GENRB} -d work -q *.txt
cd work
echo "dir: $(pwd)"
ls *.res >packagelist.txt
${PKGDATA} -p ${BASENAME} -m static -q packagelist.txt >/dev/null
${PKGDATA} --verbose -p ${BASENAME} -m ${MODE} -q packagelist.txt > /dev/null


case $KERNEL_NAME in
MINGW32_NT*)
mv ${BASENAME}.dat ../../
mv ${BASENAME}.dat ${RETREAT}${BASENAME}.dat
if [ -e "${RETREAT}${BASENAME}.dat" ]; then
echo "File copied! -- ${RETREAT}"
else
echo "File does not exist"
fi
;;
FreeBSD)
# pkgdata with -m static generates an ar(1) archive
Expand Down Expand Up @@ -98,6 +126,7 @@ make_obj() {

# Clean up
cd ..
echo "Finishing"
rm -rf work
}

Expand Down
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ nobase_pkginclude_HEADERS = \
libltfs/arch/arch_info.h \
libltfs/arch/time_internal.h \
libltfs/arch/errormap.h \
libltfs/arch/ltfs_arch_ops.h \
tape_drivers/ibm_tape.h \
tape_drivers/spc_op_codes.h \
tape_drivers/ssc_op_codes.h \
Expand Down
12 changes: 7 additions & 5 deletions src/iosched/unified.c
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ ssize_t _unified_insert_new_request(const char *buf, off_t offset, size_t count,
{
int ret;
struct dentry_priv *dpr = d->iosched_priv;
struct write_request *new_req;
struct write_request *new_req = NULL;
size_t copy_count;

if (! (*cache)) {
Expand All @@ -1764,7 +1764,7 @@ ssize_t _unified_insert_new_request(const char *buf, off_t offset, size_t count,
memcpy(cache_manager_get_object_data(*cache), buf, copy_count);

/* Store new write request */
new_req = calloc(1, sizeof(struct write_request));
new_req = (struct write_request*)calloc(1, sizeof(struct write_request));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this cast is needed.

if (! new_req) {
ltfsmsg(LTFS_ERR, 13018E);
_unified_cache_free(*cache, 0, priv);
Expand Down Expand Up @@ -2307,10 +2307,10 @@ int unified_set_profiler(char *work_dir, bool enable, void *iosched_handle)
{
int rc = 0;
char *path;
FILE *p;
FILE * p = NULL;
struct timer_info timerinfo;
struct unified_data *priv = iosched_handle;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not keep the leading spaces in an empty line.

if (enable) {
if (priv->profiler)
return 0;
Expand All @@ -2325,7 +2325,7 @@ int unified_set_profiler(char *work_dir, bool enable, void *iosched_handle)
return -LTFS_NO_MEMORY;
}

p = fopen(path, PROFILER_FILE_MODE);
arch_fopen(path, PROFILER_FILE_MODE,p);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why fopen_s() is needed on windows?


free(path);

Expand Down Expand Up @@ -2361,6 +2361,7 @@ struct iosched_ops unified_ops = {
.set_profiler = unified_set_profiler,
};


struct iosched_ops *iosched_get_ops(void)
{
return &unified_ops;
Expand All @@ -2370,6 +2371,7 @@ struct iosched_ops *iosched_get_ops(void)
extern char iosched_unified_dat[];
#endif


const char *iosched_get_message_bundle_name(void **message_data)
{
#ifndef mingw_PLATFORM
Expand Down
9 changes: 5 additions & 4 deletions src/kmi/flatfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@
#include <errno.h>
#include "libltfs/kmi_ops.h"
#include "libltfs/ltfs_fuse_version.h"
#include <fuse.h>
#include "key_format_ltfs.h"

#include "key_format_ltfs.h"
#include <fuse.h>
#ifdef mingw_PLATFORM
#include "libltfs/arch/win/win_util.h"
#include "arch/win/win_util.h"

#endif

struct kmi_flatfile_options_data {
Expand Down Expand Up @@ -158,7 +159,7 @@ static int convert_option(const unsigned char * const path, unsigned char **dk_l
*/
void *flatfile_init(struct ltfs_volume *vol)
{
void* km;
void *km;

km = key_format_ltfs_init(vol);
if (km)
Expand Down
2 changes: 1 addition & 1 deletion src/kmi/key_format_ltfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*/

#ifdef mingw_PLATFORM
#include "libltfs/arch/win/win_util.h"
#include "arch/win/win_util.h"
#endif
#include "libltfs/ltfs.h"
#include "libltfs/base64.h"
Expand Down
20 changes: 10 additions & 10 deletions src/kmi/simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@

#include "libltfs/kmi_ops.h"
#include "libltfs/ltfs_fuse_version.h"
#include <fuse.h>
#include "key_format_ltfs.h"

#include <fuse.h>
#ifdef mingw_PLATFORM
#include "libltfs/arch/win/win_util.h"
#include "arch/win/win_util.h"

#endif

struct kmi_simple_options_data {
Expand Down Expand Up @@ -84,7 +84,7 @@ static struct fuse_opt kmi_simple_options[] = {
*/
void *simple_init(struct ltfs_volume *vol)
{
void* km;
void *km;

km = key_format_ltfs_init(vol);
if (km)
Expand Down Expand Up @@ -193,20 +193,20 @@ int simple_parse_opts(void *opt_args)
+ strlen((char *) key[i].dk) + strlen(":") + strlen((char *) key[i].dki) + 1;

if (priv.dk_list)
priv.dk_list = realloc(priv.dk_list, dk_list_len);
priv.dk_list = (unsigned char*)realloc(priv.dk_list, dk_list_len);
else
priv.dk_list = calloc(dk_list_len, sizeof(unsigned char));
priv.dk_list = (unsigned char*)calloc(dk_list_len, sizeof(unsigned char));
if (priv.dk_list == NULL) {
ltfsmsg(LTFS_ERR, 10001E, __FUNCTION__);
return -LTFS_NO_MEMORY;
}
*(priv.dk_list + original_dk_list_len) = '\0';

if (original_dk_list_len)
strcat((char *) priv.dk_list, "/");
strcat((char *) priv.dk_list, (char *) key[i].dk);
strcat((char *) priv.dk_list, ":");
strcat((char *) priv.dk_list, (char *) key[i].dki);
arch_strcat((char *) priv.dk_list, dk_list_len, "/");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot understand why strcat_s() is needed here. Every input string can be handled safely in this function...

If you have a reason please explain it by comment and add strcat_s() function into linux side. I don't like Annex K, but it is better than this, if you have a strong reason.

arch_strcat((char *) priv.dk_list, dk_list_len,(char *) key[i].dk);
arch_strcat((char *) priv.dk_list, dk_list_len, ":");
arch_strcat((char *) priv.dk_list, dk_list_len,(char *) key[i].dki);
}

return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/libltfs/arch/errormap.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*/

#ifdef mingw_PLATFORM
#include "libltfs/arch/win/win_util.h"
#include "arch/win/win_util.h"
#endif

#ifdef __FreeBSD__
Expand Down Expand Up @@ -500,7 +500,7 @@ int errormap_fuse_error(int val)
return -EIO;
}

char* errormap_msg_id(int val)
char *errormap_msg_id(int val)
{
struct error_map *out;

Expand Down
2 changes: 1 addition & 1 deletion src/libltfs/arch/errormap.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int errormap_fuse_error(int val);
* @param val Error code to look up in the table. This value must be less than or equal to zero.
* @return pointer of the mapped message. if val is not found in the error table, NULL is returned.
*/
char* errormap_msg_id(int val);
char *errormap_msg_id(int val);

#ifdef __cplusplus
}
Expand Down
18 changes: 9 additions & 9 deletions src/libltfs/arch/filename_handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
bool _replace_invalid_chars(char * file_name, bool * dosdev);
char * _generate_target_file_name(const char *prefix, const char *extension, int suffix, bool dosdev);
int _utf8_strlen(const char *s);
int _utf8_strncpy(char *t, const char *s, int n);
int _utf8_strcpy(char *t, const char *s, int n);
#endif

/**
Expand All @@ -73,11 +73,11 @@ void update_platform_safe_name(struct dentry* dentry, bool handle_invalid_char,
char source_file_name[LTFS_FILENAME_MAX*4+1];
char *source_file_name_prefix, *source_file_name_extension;
char *target_file_name;
struct dentry *d;
struct dentry* d = NULL;
int ret;

dentry->platform_safe_name = NULL;
strcpy(source_file_name, dentry->name.name);
arch_strcpy_auto(source_file_name, dentry->name.name);

if (_replace_invalid_chars(source_file_name, &dosdev)) {
if (! handle_invalid_char)
Expand Down Expand Up @@ -130,7 +130,7 @@ void update_platform_safe_name(struct dentry* dentry, bool handle_invalid_char,
}
}
#else
dentry->platform_safe_name = strdup(dentry->name.name);
dentry->platform_safe_name = arch_strdup(dentry->name.name);
#endif
}

Expand Down Expand Up @@ -208,7 +208,7 @@ char * _generate_target_file_name(const char *prefix, const char *extension, int
target = NULL;

if (suffix) {
sprintf( suffix_string, "~%d", suffix );
arch_sprintf_auto( suffix_string, "~%d", suffix );

prefix_length = prefix ? _utf8_strlen(prefix) : 0;
extension_length = extension ? _utf8_strlen(extension) : 0;
Expand All @@ -218,15 +218,15 @@ char * _generate_target_file_name(const char *prefix, const char *extension, int
/* Need to trim source file name to add suffix */
if (! dosdev && prefix_length > suffix_length) {
/* Prefix is to be trimmed. */
_utf8_strncpy(trimmed_name, prefix, prefix_length - suffix_length);
_utf8_strcpy(trimmed_name, prefix, prefix_length - suffix_length);
if (extension)
ret = asprintf(&target, "%s%s.%s", trimmed_name, suffix_string, extension);
else
ret = asprintf(&target, "%s%s", trimmed_name, suffix_string);

} else if (extension_length > suffix_length) {
/* Extension is to be trimmed. */
_utf8_strncpy(trimmed_name, extension, extension_length - suffix_length);
_utf8_strcpy(trimmed_name, extension, extension_length - suffix_length);
ret = asprintf(&target, "%s%s.%s", prefix, suffix_string, trimmed_name);
} else {
/* Unable to generate target file name. NULL is to be returned. */
Expand All @@ -241,7 +241,7 @@ char * _generate_target_file_name(const char *prefix, const char *extension, int
if (extension)
ret = asprintf(&target, "%s.%s", prefix, extension);
else {
target = strdup(prefix);
target = arch_strdup(prefix);
ret = target ? strlen(target) : -1;
}
}
Expand Down Expand Up @@ -273,7 +273,7 @@ int _utf8_strlen(const char *s)
* @param s Source string to be copied.
* @param n Maximum length to be copied.
*/
int _utf8_strncpy(char *t, const char *s, int n)
int _utf8_strcpy(char *t, const char *s, int n)
{
int ret = 0;

Expand Down
Loading
Loading