Skip to content

Commit

Permalink
[misc] arch/cpu refactoring
Browse files Browse the repository at this point in the history
* Move the cpu.c/cpu.h in more logical places and remove these sources files.
* Add detection for LoongArch64 EFI bootloaders.
* Pass the detected CPU arch when invoking Fido.
* Also fix some Bled Coverity warnings.
  • Loading branch information
pbatard committed Dec 2, 2024
1 parent 8f3a9c1 commit 79f1209
Show file tree
Hide file tree
Showing 16 changed files with 121 additions and 260 deletions.
2 changes: 0 additions & 2 deletions .vs/rufus.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\src\badblocks.c" />
<ClCompile Include="..\src\cpu.c" />
<ClCompile Include="..\src\dos_locale.c" />
<ClCompile Include="..\src\drive.c" />
<ClCompile Include="..\src\format.c" />
Expand Down Expand Up @@ -413,7 +412,6 @@
<ClInclude Include="..\res\grub\grub_version.h" />
<ClInclude Include="..\src\badblocks.h" />
<ClInclude Include="..\src\bled\bled.h" />
<ClInclude Include="..\src\cpu.h" />
<ClInclude Include="..\src\drive.h" />
<ClInclude Include="..\src\format.h" />
<ClInclude Include="..\src\gpt_types.h" />
Expand Down
6 changes: 0 additions & 6 deletions .vs/rufus.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@
<ClCompile Include="..\src\wue.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cpu.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\rufus.h">
Expand Down Expand Up @@ -194,9 +191,6 @@
<ClInclude Include="..\src\vhd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cpu.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\res\rufus.ico">
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AM_V_WINDRES = $(AM_V_WINDRES_$(V))
%_rc.o: %.rc ../res/loc/embedded.loc
$(AM_V_WINDRES) $(AM_RCFLAGS) -i $< -o $@

rufus_SOURCES = badblocks.c cpu.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
rufus_SOURCES = badblocks.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
localization.c net.c parser.c pki.c process.c re.c rufus.c smart.c stdfn.c stdio.c stdlg.c syslinux.c ui.c vhd.c wue.c
rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/syslinux/libinstaller -I$(srcdir)/syslinux/win -I$(srcdir)/libcdio $(AM_CFLAGS) \
-DEXT2_FLAT_INCLUDES=0 -DSOLUTION=rufus
Expand Down
19 changes: 6 additions & 13 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,11 @@ mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_rufus_OBJECTS = rufus-badblocks.$(OBJEXT) rufus-cpu.$(OBJEXT) \
rufus-dev.$(OBJEXT) rufus-dos.$(OBJEXT) \
rufus-dos_locale.$(OBJEXT) rufus-drive.$(OBJEXT) \
rufus-format.$(OBJEXT) rufus-format_ext.$(OBJEXT) \
rufus-format_fat32.$(OBJEXT) rufus-hash.$(OBJEXT) \
rufus-icon.$(OBJEXT) rufus-iso.$(OBJEXT) \
am_rufus_OBJECTS = rufus-badblocks.$(OBJEXT) rufus-dev.$(OBJEXT) \
rufus-dos.$(OBJEXT) rufus-dos_locale.$(OBJEXT) \
rufus-drive.$(OBJEXT) rufus-format.$(OBJEXT) \
rufus-format_ext.$(OBJEXT) rufus-format_fat32.$(OBJEXT) \
rufus-hash.$(OBJEXT) rufus-icon.$(OBJEXT) rufus-iso.$(OBJEXT) \
rufus-localization.$(OBJEXT) rufus-net.$(OBJEXT) \
rufus-parser.$(OBJEXT) rufus-pki.$(OBJEXT) \
rufus-process.$(OBJEXT) rufus-re.$(OBJEXT) \
Expand Down Expand Up @@ -285,7 +284,7 @@ AM_V_WINDRES_0 = @echo " RC $@";$(WINDRES)
AM_V_WINDRES_1 = $(WINDRES)
AM_V_WINDRES_ = $(AM_V_WINDRES_$(AM_DEFAULT_VERBOSITY))
AM_V_WINDRES = $(AM_V_WINDRES_$(V))
rufus_SOURCES = badblocks.c cpu.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
rufus_SOURCES = badblocks.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
localization.c net.c parser.c pki.c process.c re.c rufus.c smart.c stdfn.c stdio.c stdlg.c syslinux.c ui.c vhd.c wue.c

rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/syslinux/libinstaller -I$(srcdir)/syslinux/win -I$(srcdir)/libcdio $(AM_CFLAGS) \
Expand Down Expand Up @@ -355,12 +354,6 @@ rufus-badblocks.o: badblocks.c
rufus-badblocks.obj: badblocks.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-badblocks.obj `if test -f 'badblocks.c'; then $(CYGPATH_W) 'badblocks.c'; else $(CYGPATH_W) '$(srcdir)/badblocks.c'; fi`

rufus-cpu.o: cpu.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-cpu.o `test -f 'cpu.c' || echo '$(srcdir)/'`cpu.c

rufus-cpu.obj: cpu.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-cpu.obj `if test -f 'cpu.c'; then $(CYGPATH_W) 'cpu.c'; else $(CYGPATH_W) '$(srcdir)/cpu.c'; fi`

rufus-dev.o: dev.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-dev.o `test -f 'dev.c' || echo '$(srcdir)/'`dev.c

Expand Down
9 changes: 4 additions & 5 deletions src/bled/header_verbose_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
{
struct tm tm_time;
struct tm *ptm = &tm_time; //localtime(&file_header->mtime);
char modestr[12];

#if ENABLE_FEATURE_TAR_UNAME_GNAME
char uid[sizeof(int)*3 + 2];
Expand All @@ -29,8 +28,8 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
/*sprintf(gid, "%u", (unsigned)file_header->gid);*/
group = utoa(file_header->gid);
}
printf("%s %s/%s %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
bb_mode_string(modestr, file_header->mode),
printf("%u %s/%s %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
file_header->mode,
user,
group,
file_header->size,
Expand All @@ -46,8 +45,8 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)

localtime_r(&file_header->mtime, ptm);

printf("%s %u/%u %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
bb_mode_string(modestr, file_header->mode),
printf("%u %u/%u %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
file_header->mode,
(unsigned)file_header->uid,
(unsigned)file_header->gid,
file_header->size,
Expand Down
1 change: 0 additions & 1 deletion src/bled/libbb.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ static inline void *xrealloc(void *ptr, size_t size) {

#define bb_msg_read_error "read error"
#define bb_msg_write_error "write error"
#define bb_mode_string(str, mode) str
#define bb_make_directory(path, mode, flags) SHCreateDirectoryExU(NULL, path, NULL)

static inline int link(const char *oldpath, const char *newpath) { errno = ENOSYS; return -1; }
Expand Down
123 changes: 0 additions & 123 deletions src/cpu.c

This file was deleted.

79 changes: 0 additions & 79 deletions src/cpu.h

This file was deleted.

Loading

0 comments on commit 79f1209

Please sign in to comment.