Date: Tue, 13 Apr 2004 17:50:13 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 51021 for review Message-ID: <200404140050.i3E0oDO0063064@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=51021 Change 51021 by peter@peter_daintree on 2004/04/13 17:49:12 IFC @51019 Affected files ... .. //depot/projects/hammer/lib/libarchive/archive_entry.c#7 integrate .. //depot/projects/hammer/lib/libarchive/archive_entry.h#6 integrate .. //depot/projects/hammer/lib/libarchive/archive_read.c#6 integrate .. //depot/projects/hammer/lib/libarchive/archive_read_open_file.c#5 integrate .. //depot/projects/hammer/lib/libarchive/archive_read_support_format_cpio.c#6 integrate .. //depot/projects/hammer/lib/libarchive/archive_read_support_format_tar.c#7 integrate .. //depot/projects/hammer/lib/libarchive/archive_write.c#6 integrate .. //depot/projects/hammer/lib/libarchive/archive_write_set_format_cpio.c#4 integrate .. //depot/projects/hammer/lib/libarchive/archive_write_set_format_pax.c#8 integrate .. //depot/projects/hammer/lib/libarchive/archive_write_set_format_shar.c#5 integrate .. //depot/projects/hammer/lib/libarchive/archive_write_set_format_ustar.c#5 integrate .. //depot/projects/hammer/share/man/man4/man4.i386/acpi_toshiba.4#3 integrate .. //depot/projects/hammer/sys/i386/acpica/acpi_toshiba.c#4 integrate .. //depot/projects/hammer/usr.bin/tar/util.c#2 integrate .. //depot/projects/hammer/usr.bin/tar/write.c#4 integrate Differences ... ==== //depot/projects/hammer/lib/libarchive/archive_entry.c#7 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.6 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.7 2004/04/13 23:45:37 kientzle Exp $"); #include <sys/stat.h> #include <sys/types.h> @@ -481,6 +481,12 @@ } void +archive_entry_copy_hardlink(struct archive_entry *entry, const char *target) +{ + aes_copy_mbs(&entry->ae_hardlink, target); +} + +void archive_entry_copy_hardlink_w(struct archive_entry *entry, const wchar_t *target) { aes_copy_wcs(&entry->ae_hardlink, target); @@ -1111,6 +1117,7 @@ malloc(namebuff_length * sizeof(wchar_t)); } wmemcpy(namebuff, name_start, name_end - name_start); + namebuff[name_end - name_start] = L'\0'; archive_entry_acl_add_entry_w(entry, type, permset, tag, id, namebuff); } ==== //depot/projects/hammer/lib/libarchive/archive_entry.h#6 (text+ko) ==== @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.5 2004/04/12 01:16:16 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.6 2004/04/13 23:45:37 kientzle Exp $ */ #ifndef ARCHIVE_ENTRY_H_INCLUDED @@ -97,6 +97,7 @@ void archive_entry_set_gname(struct archive_entry *, const char *); void archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *); void archive_entry_set_hardlink(struct archive_entry *, const char *); +void archive_entry_copy_hardlink(struct archive_entry *, const char *); void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *); void archive_entry_set_link(struct archive_entry *, const char *); void archive_entry_set_mode(struct archive_entry *, mode_t); ==== //depot/projects/hammer/lib/libarchive/archive_read.c#6 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read.c,v 1.5 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read.c,v 1.6 2004/04/13 23:45:37 kientzle Exp $"); #include <err.h> #include <errno.h> @@ -428,8 +428,8 @@ /* Casting a pointer to int allows us to remove 'const.' */ free((void *)(uintptr_t)(const void *)a->nulls); - if (a->extract_mkdirpath.s != NULL) - free(a->extract_mkdirpath.s); + archive_string_free(&a->extract_mkdirpath); + archive_string_free(&a->error_string); if (a->entry) archive_entry_free(a->entry); a->magic = 0; @@ -455,7 +455,7 @@ for (i = 0; i < number_slots; i++) { if (a->formats[i].bid == bid) - return (0); /* We've already installed */ + return (ARCHIVE_WARN); /* We've already installed */ if (a->formats[i].bid == NULL) { a->formats[i].bid = bid; a->formats[i].read_header = read_header; ==== //depot/projects/hammer/lib/libarchive/archive_read_open_file.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_file.c,v 1.4 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_file.c,v 1.5 2004/04/13 23:45:37 kientzle Exp $"); #include <errno.h> #include <fcntl.h> @@ -68,7 +68,7 @@ strcpy(mine->filename, filename); } mine->block_size = block_size; - mine->buffer = malloc(mine->block_size); + mine->buffer = NULL; mine->fd = -1; return (archive_read_open(a, mine, file_open, file_read, file_close)); } @@ -78,6 +78,7 @@ { struct read_file_data *mine = client_data; + mine->buffer = malloc(mine->block_size); if (*mine->filename != 0) mine->fd = open(mine->filename, O_RDONLY); else @@ -108,6 +109,8 @@ (void)a; /* UNUSED */ if (mine->fd >= 0) close(mine->fd); + if (mine->buffer != NULL) + free(mine->buffer); free(mine); return (ARCHIVE_OK); } ==== //depot/projects/hammer/lib/libarchive/archive_read_support_format_cpio.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_cpio.c,v 1.6 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_cpio.c,v 1.7 2004/04/13 23:45:37 kientzle Exp $"); #include <sys/stat.h> @@ -83,16 +83,21 @@ archive_read_support_format_cpio(struct archive *a) { struct cpio *cpio; + int r; cpio = malloc(sizeof(*cpio)); memset(cpio, 0, sizeof(*cpio)); cpio->magic = CPIO_MAGIC; - return (__archive_read_register_format(a, + r = __archive_read_register_format(a, cpio, archive_read_format_cpio_bid, archive_read_format_cpio_read_header, - archive_read_format_cpio_cleanup)); + archive_read_format_cpio_cleanup); + + if (r != ARCHIVE_OK) + free(cpio); + return (ARCHIVE_OK); } ==== //depot/projects/hammer/lib/libarchive/archive_read_support_format_tar.c#7 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.7 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.8 2004/04/13 23:45:37 kientzle Exp $"); #include <sys/stat.h> #include <errno.h> @@ -131,15 +131,19 @@ archive_read_support_format_tar(struct archive *a) { struct tar *tar; + int r; tar = malloc(sizeof(*tar)); memset(tar, 0, sizeof(*tar)); - return (__archive_read_register_format(a, - tar, + r = __archive_read_register_format(a, tar, archive_read_format_tar_bid, archive_read_format_tar_read_header, - archive_read_format_tar_cleanup)); + archive_read_format_tar_cleanup); + + if (r != ARCHIVE_OK) + free(tar); + return (ARCHIVE_OK); } static int @@ -148,19 +152,15 @@ struct tar *tar; tar = *(a->pformat_data); - if (tar->entry_name.s != NULL) - free(tar->entry_name.s); - if (tar->entry_linkname.s != NULL) - free(tar->entry_linkname.s); - if (tar->entry_uname.s != NULL) - free(tar->entry_uname.s); - if (tar->entry_gname.s != NULL) - free(tar->entry_gname.s); - if (tar->pax_header.s != NULL) - free(tar->pax_header.s); - if (tar->pax_global.s != NULL) - free(tar->pax_global.s); - + archive_string_free(&tar->acl_text); + archive_string_free(&tar->entry_name); + archive_string_free(&tar->entry_linkname); + archive_string_free(&tar->entry_uname); + archive_string_free(&tar->entry_gname); + archive_string_free(&tar->pax_global); + archive_string_free(&tar->pax_header); + if (tar->pax_entry != NULL) + free(tar->pax_entry); free(tar); *(a->pformat_data) = NULL; return (ARCHIVE_OK); @@ -822,7 +822,7 @@ /* Ensure pax_entry buffer is big enough. */ if (tar->pax_entry_length <= line_length) { if (tar->pax_entry_length <= 0) - tar->pax_entry_length = 256; + tar->pax_entry_length = 1024; while (tar->pax_entry_length <= line_length + 1) tar->pax_entry_length *= 2; ==== //depot/projects/hammer/lib/libarchive/archive_write.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write.c,v 1.5 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write.c,v 1.6 2004/04/13 23:45:37 kientzle Exp $"); /* * This file contains the "essential" portions of the write API, that @@ -165,8 +165,8 @@ /* Release various dynamic buffers. */ free((void *)(uintptr_t)(const void *)a->nulls); - if (a->extract_mkdirpath.s != NULL) - free(a->extract_mkdirpath.s); + archive_string_free(&a->extract_mkdirpath); + archive_string_free(&a->error_string); a->magic = 0; free(a); } ==== //depot/projects/hammer/lib/libarchive/archive_write_set_format_cpio.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio.c,v 1.3 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio.c,v 1.4 2004/04/13 23:45:37 kientzle Exp $"); #include <sys/stat.h> #include <errno.h> @@ -207,10 +207,12 @@ static int archive_write_cpio_finish(struct archive *a) { + struct cpio *cpio; struct stat st; int er; struct archive_entry *trailer; + cpio = a->format_data; trailer = archive_entry_new(); memset(&st, 0, sizeof(st)); st.st_nlink = 1; @@ -218,6 +220,9 @@ archive_entry_set_pathname(trailer, "TRAILER!!!"); er = archive_write_cpio_header(a, trailer); archive_entry_free(trailer); + + free(cpio); + a->format_data = NULL; return (er); } ==== //depot/projects/hammer/lib/libarchive/archive_write_set_format_pax.c#8 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.7 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.8 2004/04/13 23:45:37 kientzle Exp $"); #include <sys/stat.h> #include <errno.h> @@ -611,7 +611,7 @@ pax_attr_entry, 'x'); archive_entry_free(pax_attr_entry); - free(pax_entry_name.s); + archive_string_free(&pax_entry_name); /* Note that the 'x' header shouldn't ever fail to format */ if (ret != 0) { @@ -765,12 +765,16 @@ archive_write_pax_finish(struct archive *a) { struct pax *pax; + int r; + + r = ARCHIVE_OK; pax = a->format_data; if (pax->written && a->compression_write != NULL) - return (write_nulls(a, 512 * 2)); + r = write_nulls(a, 512 * 2); + archive_string_free(&pax->pax_header); free(pax); a->format_data = NULL; - return (ARCHIVE_OK); + return (r); } static int ==== //depot/projects/hammer/lib/libarchive/archive_write_set_format_shar.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_shar.c,v 1.4 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_shar.c,v 1.5 2004/04/13 23:45:37 kientzle Exp $"); #include <sys/stat.h> #include <errno.h> @@ -38,16 +38,6 @@ #include "archive_entry.h" #include "archive_private.h" -static int archive_write_shar_finish(struct archive *); -static int archive_write_shar_header(struct archive *, - struct archive_entry *); -static int archive_write_shar_data_sed(struct archive *, - const void * buff, size_t); -static int archive_write_shar_data_uuencode(struct archive *, - const void * buff, size_t); -static int archive_write_shar_finish_entry(struct archive *); -static int shar_printf(struct archive *, const char *fmt, ...); - struct shar { int dump; int end_of_line; @@ -60,19 +50,43 @@ int uuavail; char uubuffer[3]; int wrote_header; + char *work; + size_t work_len; }; +static int archive_write_shar_finish(struct archive *); +static int archive_write_shar_header(struct archive *, + struct archive_entry *); +static int archive_write_shar_data_sed(struct archive *, + const void * buff, size_t); +static int archive_write_shar_data_uuencode(struct archive *, + const void * buff, size_t); +static int archive_write_shar_finish_entry(struct archive *); +static int shar_printf(struct archive *, const char *fmt, ...); +static void uuencode_group(struct shar *); + static int shar_printf(struct archive *a, const char *fmt, ...) { + struct shar *shar; va_list ap; - char *p; + int required; int ret; + shar = a->format_data; + if (shar->work_len <= 0) { + shar->work_len = 1024; + shar->work = malloc(shar->work_len); + } + va_start(ap, fmt); - vasprintf(&p, fmt, ap); - ret = ((a->compression_write)(a, p, strlen(p))); - free(p); + required = vsnprintf(shar->work, shar->work_len, fmt, ap); + if ((size_t)required >= shar->work_len) { + shar->work_len = required + 256; + realloc(shar->work, shar->work_len); + required = vsnprintf(shar->work, shar->work_len, fmt, ap); + } + ret = ((a->compression_write)(a, shar->work, strlen(shar->work))); va_end(ap); return (ret); } @@ -261,6 +275,7 @@ return (ARCHIVE_OK); } +/* XXX TODO: This could be more efficient XXX */ static int archive_write_shar_data_sed(struct archive *a, const void *buff, size_t length) { @@ -297,6 +312,7 @@ #define UUENC(c) (((c)!=0) ? ((c) & 077) + ' ': '`') +/* XXX This could be a lot more efficient. XXX */ static void uuencode_group(struct shar *shar) { @@ -443,6 +459,8 @@ archive_entry_free(shar->entry); if (shar->last_dir != NULL) free(shar->last_dir); + if (shar->work != NULL) + free(shar->work); free(shar); a->format_data = NULL; return (ARCHIVE_OK); ==== //depot/projects/hammer/lib/libarchive/archive_write_set_format_ustar.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ustar.c,v 1.4 2004/04/12 01:16:16 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ustar.c,v 1.5 2004/04/13 23:45:37 kientzle Exp $"); #include <sys/stat.h> #include <errno.h> @@ -373,19 +373,20 @@ archive_write_ustar_finish(struct archive *a) { struct ustar *ustar; + int r; + r = ARCHIVE_OK; ustar = a->format_data; /* * Suppress end-of-archive if nothing else was ever written. - * This fixes a problem where setting one format, then another ends up - * attempting to write a gratuitous end-of-archive marker. + * This fixes a problem where setting one format, then another + * ends up writing a gratuitous end-of-archive marker. */ if (ustar->written && a->compression_write != NULL) - if (write_nulls(a, 512*2) < 512*2) - return (ARCHIVE_FATAL); - free(a->format_data); + r = write_nulls(a, 512*2); + free(ustar); a->format_data = NULL; - return (ARCHIVE_OK); + return (r); } static int @@ -409,10 +410,11 @@ while (padding > 0) { to_write = padding < a->null_length ? padding : a->null_length; ret = (a->compression_write)(a, a->nulls, to_write); - if (ret < to_write) return (-1); + if (ret < to_write) + return (ARCHIVE_FATAL); padding -= to_write; } - return (0); + return (ARCHIVE_OK); } static int ==== //depot/projects/hammer/share/man/man4/man4.i386/acpi_toshiba.4#3 (text+ko) ==== @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/man4.i386/acpi_toshiba.4,v 1.4 2004/03/20 13:05:11 marks Exp $ +.\" $FreeBSD: src/share/man/man4/man4.i386/acpi_toshiba.4,v 1.5 2004/04/14 00:23:58 njl Exp $ .\" .Dd February 19, 2004 .Dt ACPI_TOSHIBA 4 i386 @@ -64,6 +64,12 @@ .It Li 4 TV-Out .El +.Pp +Only some systems (i.e., the Libretto L5) support video switching via +this hardware-specific driver. +Use the +.Xr acpi_video 4 +driver for generic video output support. .It Va hw.acpi.toshiba.lcd_brightness Makes the LCD backlight brighter or dimmer (higher values are brighter). .It Va hw.acpi.toshiba.lcd_backlight @@ -91,6 +97,7 @@ .Xr loader.conf 5 . .Sh SEE ALSO .Xr acpi 4 , +.Xr acpi_video 4 , .Xr loader.conf 5 , .Xr sysctl.conf 5 , .Xr sysctl 8 ==== //depot/projects/hammer/sys/i386/acpica/acpi_toshiba.c#4 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_toshiba.c,v 1.5 2004/04/08 16:45:12 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_toshiba.c,v 1.6 2004/04/14 00:23:58 njl Exp $"); #include "opt_acpi.h" #include <sys/param.h> @@ -49,6 +49,7 @@ #define METHOD_HCI "GHCI" #define METHOD_HCI_ENABLE "ENAB" +#define METHOD_VIDEO "DSSX" /* Operations */ #define HCI_SET 0xFF00 @@ -120,6 +121,7 @@ struct acpi_toshiba_softc { device_t dev; ACPI_HANDLE handle; + ACPI_HANDLE video_handle; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; }; @@ -137,9 +139,12 @@ static hci_fn_t hci_lcd_backlight; static hci_fn_t hci_cpu_speed; static int hci_call(ACPI_HANDLE h, int op, int function, UINT32 *arg); -static void hci_key_action(ACPI_HANDLE h, UINT32 key); +static void hci_key_action(struct acpi_toshiba_softc *sc, ACPI_HANDLE h, + UINT32 key); static void acpi_toshiba_notify(ACPI_HANDLE h, UINT32 notify, - void *context); + void *context); +static int acpi_toshiba_video_probe(device_t dev); +static int acpi_toshiba_video_attach(device_t dev); /* Table of sysctl names and HCI functions to call. */ static struct { @@ -171,9 +176,27 @@ static devclass_t acpi_toshiba_devclass; DRIVER_MODULE(acpi_toshiba, acpi, acpi_toshiba_driver, acpi_toshiba_devclass, - 0, 0); + 0, 0); MODULE_DEPEND(acpi_toshiba, acpi, 1, 1, 1); +static device_method_t acpi_toshiba_video_methods[] = { + DEVMETHOD(device_probe, acpi_toshiba_video_probe), + DEVMETHOD(device_attach, acpi_toshiba_video_attach), + + {0, 0} +}; + +static driver_t acpi_toshiba_video_driver = { + "acpi_toshiba_video", + acpi_toshiba_video_methods, + 0, +}; + +static devclass_t acpi_toshiba_video_devclass; +DRIVER_MODULE(acpi_toshiba_video, acpi, acpi_toshiba_video_driver, + acpi_toshiba_video_devclass, 0, 0); +MODULE_DEPEND(acpi_toshiba_video, acpi, 1, 1, 1); + static int enable_fn_keys = 1; TUNABLE_INT("hw.acpi.toshiba.enable_fn_keys", &enable_fn_keys); @@ -306,15 +329,25 @@ hci_video_output(ACPI_HANDLE h, int op, UINT32 *video_output) { int ret; + ACPI_STATUS status; if (op == HCI_SET) { if (*video_output < 1 || *video_output > 7) return (EINVAL); + if (h == NULL) + return (ENXIO); *video_output |= HCI_VIDEO_OUTPUT_FLAG; + status = acpi_SetInteger(h, "DSSX", *video_output); + if (ACPI_SUCCESS(status)) + ret = 0; + else + ret = ENXIO; + } else { + ret = hci_call(h, op, HCI_REG_VIDEO_OUTPUT, video_output); + if (ret == 0) + *video_output &= 0xff; } - ret = hci_call(h, op, HCI_REG_VIDEO_OUTPUT, video_output); - if (ret == 0 && op == HCI_GET) - *video_output &= 0xff; + return (ret); } @@ -419,7 +452,7 @@ * functionality by reading the keystrokes we send to devd(8). */ static void -hci_key_action(ACPI_HANDLE h, UINT32 key) +hci_key_action(struct acpi_toshiba_softc *sc, ACPI_HANDLE h, UINT32 key) { UINT32 arg; @@ -444,7 +477,7 @@ /* Cycle through video outputs. */ hci_video_output(h, HCI_GET, &arg); arg = (arg + 1) % 7; - hci_video_output(h, HCI_SET, &arg); + hci_video_output(sc->video_handle, HCI_SET, &arg); break; case FN_F8_RELEASE: /* Toggle LCD backlight. */ @@ -471,10 +504,45 @@ if (notify == 0x80) { while (hci_call(h, HCI_GET, HCI_REG_SYSTEM_EVENT, &key) == 0) { - hci_key_action(h, key); + hci_key_action(sc, h, key); acpi_UserNotify("TOSHIBA", h, (uint8_t)key); } - } else { + } else device_printf(sc->dev, "unknown notify: 0x%x\n", notify); +} + +/* + * Toshiba video pseudo-device to provide the DSSX method. + * + * HID Model + * ------------------------------------- + * TOS6201 Libretto L Series + */ +static int +acpi_toshiba_video_probe(device_t dev) +{ + int ret = ENXIO; + + if (!acpi_disabled("toshiba") && + acpi_get_type(dev) == ACPI_TYPE_DEVICE && + device_get_unit(dev) == 0 && + acpi_MatchHid(dev, "TOS6201")) { + device_quiet(dev); + device_set_desc(dev, "Toshiba Video"); + ret = 0; } + + return (ret); +} + +static int +acpi_toshiba_video_attach(device_t dev) +{ + struct acpi_toshiba_softc *sc; + + sc = devclass_get_softc(acpi_toshiba_devclass, 0); + if (sc == NULL) + return (ENXIO); + sc->video_handle = acpi_get_handle(dev); + return (0); } ==== //depot/projects/hammer/usr.bin/tar/util.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/util.c,v 1.1 2004/04/05 21:32:18 kientzle Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/util.c,v 1.2 2004/04/13 23:49:02 kientzle Exp $"); #include <ctype.h> #include <stdarg.h> @@ -45,19 +45,24 @@ safe_fprintf(FILE *f, const char *fmt, ...) { char *buff; + char *buffheap; + char buffstack[256]; int bufflength; int length; va_list ap; char *p; - bufflength = 512; - buff = malloc(bufflength); + /* Use a stack-allocated buffer if we can. */ + buffheap = NULL; + bufflength = 256; + buff = buffstack; va_start(ap, fmt); length = vsnprintf(buff, bufflength, fmt, ap); + /* If the result is too large, allocate a buffer on the heap. */ if (length >= bufflength) { bufflength = length+1; - buff = realloc(buff, bufflength); + buff = buffheap = malloc(bufflength); length = vsnprintf(buff, bufflength, fmt, ap); } va_end(ap); @@ -83,7 +88,9 @@ fprintf(f, "\\%03o", c); } } - free(buff); + /* If we allocated a heap-based buffer, free it now. */ + if (buffheap != NULL) + free(buffheap); } static void ==== //depot/projects/hammer/usr.bin/tar/write.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/write.c,v 1.5 2004/04/12 00:13:23 kientzle Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/write.c,v 1.6 2004/04/13 23:50:48 kientzle Exp $"); #include <sys/stat.h> #include <sys/types.h> @@ -807,7 +807,7 @@ */ for (le = bsdtar->links_head; le != NULL; le = le->next) { if (le->dev == st->st_dev && le->ino == st->st_ino) { - archive_entry_set_hardlink(entry, le->name); + archive_entry_copy_hardlink(entry, le->name); /* * Decrement link count each time and release @@ -820,6 +820,8 @@ le->previous->next = le->next; if (le->next != NULL) le->next->previous = le->previous; + if (le->name != NULL) + free(le->name); if (bsdtar->links_head == le) bsdtar->links_head = le->next; free(le);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404140050.i3E0oDO0063064>