Module Name: src Committed By: tsutsui Date: Sun May 19 15:51:30 UTC 2024
Modified Files: src/distrib/cdrom/macppc_installboot: Makefile cd9660.c installboot.c installboot.h Log Message: Sync with src/usr.sbin/installboot/cd9660.c: - include now properly updated cd9660_extern.h for function prototypes and remove them from local installboot.h - use ISO_MAXNAMLEN rather than (BSD specific and incorrect) MAXNAMLEN - use proper names for the secondary boot file - appease several pointer signedness warnings (not fatal on HOST tools) To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/distrib/cdrom/macppc_installboot/Makefile cvs rdiff -u -r1.4 -r1.5 src/distrib/cdrom/macppc_installboot/cd9660.c \ src/distrib/cdrom/macppc_installboot/installboot.h cvs rdiff -u -r1.5 -r1.6 src/distrib/cdrom/macppc_installboot/installboot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/cdrom/macppc_installboot/Makefile diff -u src/distrib/cdrom/macppc_installboot/Makefile:1.11 src/distrib/cdrom/macppc_installboot/Makefile:1.12 --- src/distrib/cdrom/macppc_installboot/Makefile:1.11 Tue May 1 19:59:43 2018 +++ src/distrib/cdrom/macppc_installboot/Makefile Sun May 19 15:51:30 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2018/05/01 19:59:43 christos Exp $ +# $NetBSD: Makefile,v 1.12 2024/05/19 15:51:30 tsutsui Exp $ .include <bsd.hostinit.mk> HOSTPROG= macppc_installboot @@ -16,6 +16,7 @@ HOST_CPPFLAGS+= -I. -I${.CURDIR} ${HOST_INSTALL_DIR} fs/cd9660 ${HOST_LN} -s ${NETBSDSRCDIR}/sys/fs/unicode.h fs ${HOST_LN} -s ${NETBSDSRCDIR}/sys/fs/cd9660/iso.h fs/cd9660 + ${HOST_LN} -s ${NETBSDSRCDIR}/sys/fs/cd9660/cd9660_extern.h fs/cd9660 .endif cleandir distclean: cleaninc Index: src/distrib/cdrom/macppc_installboot/cd9660.c diff -u src/distrib/cdrom/macppc_installboot/cd9660.c:1.4 src/distrib/cdrom/macppc_installboot/cd9660.c:1.5 --- src/distrib/cdrom/macppc_installboot/cd9660.c:1.4 Sat Sep 27 15:21:40 2014 +++ src/distrib/cdrom/macppc_installboot/cd9660.c Sun May 19 15:51:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.c,v 1.4 2014/09/27 15:21:40 tsutsui Exp $ */ +/* $NetBSD: cd9660.c,v 1.5 2024/05/19 15:51:30 tsutsui Exp $ */ /*- * Copyright (c) 2005 Izumi Tsutsui. All rights reserved. @@ -30,7 +30,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: cd9660.c,v 1.4 2014/09/27 15:21:40 tsutsui Exp $"); +__RCSID("$NetBSD: cd9660.c,v 1.5 2024/05/19 15:51:30 tsutsui Exp $"); #endif /* !__lint */ #include <sys/param.h> @@ -51,6 +51,7 @@ __RCSID("$NetBSD: cd9660.c,v 1.4 2014/09 #include <dirent.h> #include <fs/cd9660/iso.h> +#include <fs/cd9660/cd9660_extern.h> #include "installboot.h" @@ -87,7 +88,7 @@ cd9660_match(ib_params *params) return 0; } - blocksize = isonum_723((char *)ipd.logical_block_size); + blocksize = isonum_723((u_char *)ipd.logical_block_size); if (blocksize != ISO_DEFAULT_BLOCK_SIZE) { warnx("Invalid blocksize %d in `%s'", blocksize, params->filesystem); @@ -104,10 +105,11 @@ int cd9660_findstage2(ib_params *params, uint32_t *maxblk, ib_block *blocks) { uint8_t buf[ISO_DEFAULT_BLOCK_SIZE]; - char name[MAXNAMLEN]; - char *ofwboot; + char name[ISO_MAXNAMLEN]; + char *stage2; off_t loc; - int rv, blocksize, found, i; + int rv, blocksize, found; + u_int i; struct iso_primary_descriptor ipd; struct iso_directory_record *idr; @@ -122,20 +124,20 @@ cd9660_findstage2(ib_params *params, uin #endif /* The secondary bootstrap must be clearly in /. */ - strlcpy(name, params->stage2, MAXNAMLEN); - ofwboot = name; - if (ofwboot[0] == '/') - ofwboot++; - if (strchr(ofwboot, '/') != NULL) { + strlcpy(name, params->stage2, ISO_MAXNAMLEN); + stage2 = name; + if (stage2[0] == '/') + stage2++; + if (strchr(stage2, '/') != NULL) { warnx("The secondary bootstrap `%s' must be in / " "on filesystem `%s'", params->stage2, params->filesystem); return 0; } - if (strchr(ofwboot, '.') == NULL) { + if (strchr(stage2, '.') == NULL) { /* * XXX should fix isofncmp()? */ - strlcat(ofwboot, ".", MAXNAMLEN); + strlcat(name, ".", ISO_MAXNAMLEN); } rv = pread(params->fsfd, &ipd, sizeof(ipd), @@ -148,7 +150,7 @@ cd9660_findstage2(ib_params *params, uin params->filesystem); return 0; } - blocksize = isonum_723((char *)ipd.logical_block_size); + blocksize = isonum_723((u_char *)ipd.logical_block_size); idr = (void *)ipd.root_directory_record; loc = (off_t)isonum_733(idr->extent) * blocksize; @@ -205,8 +207,9 @@ cd9660_findstage2(ib_params *params, uin printf("\n"); } #endif - if (isofncmp(ofwboot, strlen(ofwboot), - idr->name, isonum_711(idr->name_len), 0) == 0) { + if (isofncmp((u_char *)stage2, strlen(stage2), + (u_char *)idr->name, + isonum_711((u_char *)idr->name_len), 0) == 0) { found = 1; /* ISO filesystem always has contiguous file blocks */ blocks[0].block = (int64_t)isonum_733(idr->extent); Index: src/distrib/cdrom/macppc_installboot/installboot.h diff -u src/distrib/cdrom/macppc_installboot/installboot.h:1.4 src/distrib/cdrom/macppc_installboot/installboot.h:1.5 --- src/distrib/cdrom/macppc_installboot/installboot.h:1.4 Wed Mar 9 15:44:49 2016 +++ src/distrib/cdrom/macppc_installboot/installboot.h Sun May 19 15:51:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: installboot.h,v 1.4 2016/03/09 15:44:49 christos Exp $ */ +/* $NetBSD: installboot.h,v 1.5 2024/05/19 15:51:30 tsutsui Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -43,10 +43,6 @@ #include <sys/stat.h> #include <stdint.h> -#ifndef MAXNAMLEN -#define MAXNAMLEN 511 -#endif - typedef enum { /* flags from global options */ IB_VERBOSE = 1<<0, /* verbose operation */ @@ -135,7 +131,4 @@ struct bbinfo_params { int cd9660_match(ib_params *); int cd9660_findstage2(ib_params *, uint32_t *, ib_block *); -int isofncmp(const u_char *, size_t, const u_char *, size_t, int); -void isofntrans(const u_char *, int, u_char *, u_short *, int, int, int, int); - #endif /* _INSTALLBOOT_H */ Index: src/distrib/cdrom/macppc_installboot/installboot.c diff -u src/distrib/cdrom/macppc_installboot/installboot.c:1.5 src/distrib/cdrom/macppc_installboot/installboot.c:1.6 --- src/distrib/cdrom/macppc_installboot/installboot.c:1.5 Thu Mar 27 16:34:37 2014 +++ src/distrib/cdrom/macppc_installboot/installboot.c Sun May 19 15:51:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: installboot.c,v 1.5 2014/03/27 16:34:37 apb Exp $ */ +/* $NetBSD: installboot.c,v 1.6 2024/05/19 15:51:30 tsutsui Exp $ */ /*- * Copyright (c) 2005 Izumi Tsutsui. All rights reserved. @@ -87,7 +87,7 @@ main(int argc, char **argv) if (pread(params->fsfd, &pme, sizeof pme, BSIZE * 2) != sizeof(pme)) err(1, "read pme from file system `%s'", params->filesystem); - if (strcmp(pme.pmPartName, "NetBSD_BootBlock")) + if (strcmp((char *)pme.pmPartName, "NetBSD_BootBlock")) err(1, "invalid partition map in file system `%s'", params->filesystem);