Re: discussion [patch] /lib/kobject.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I guess something similar could be done with snprintf?

The following code comes from /var/linuxes/linux-next/arch/ia64/pci/pci.c

	len = strlen(info->name) + 32;
        name = kzalloc(len, GFP_KERNEL);
	if (!name) {
                printk(KERN_ERR "PCI: No memory for %s I/O port space name\n",
			info->name);
                goto free_resource;
        }

        min = addr->minimum;
        max = min + addr->address_length - 1;
        if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION)
                sparse = 1;

	space_nr = new_space(addr->translation_offset, sparse);
        if (space_nr == ~0)
	        goto free_name;

	base = __pa(io_space[space_nr].mmio_base);
	base_port = IO_SPACE_BASE(space_nr);
        snprintf(name, len, "%s I/O Ports %08lx-%08lx", info->name,
                base_port + min, base_port + max);

julia
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux