[PATCH] namespaces: utsname: use init_utsname when appropriate
authorSerge E. Hallyn <serue@us.ibm.com>
Mon, 2 Oct 2006 09:18:13 +0000 (02:18 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 2 Oct 2006 14:57:21 +0000 (07:57 -0700)
In some places, particularly drivers and __init code, the init utsns is the
appropriate one to use.  This patch replaces those with a the init_utsname
helper.

Changes: Removed several uses of init_utsname().  Hope I picked all the
right ones in net/ipv4/ipconfig.c.  These are now changed to
utsname() (the per-process namespace utsname) in the previous
patch (2/7)

[akpm@osdl.org: CIFS fix]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Cc: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
28 files changed:
arch/arm/kernel/setup.c
arch/arm26/kernel/setup.c
arch/cris/kernel/setup.c
arch/i386/kernel/process.c
arch/i386/kernel/traps.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/platforms/pseries/setup.c
arch/sh/kernel/setup.c
arch/um/kernel/um_arch.c
arch/um/sys-x86_64/sysrq.c
arch/x86_64/kernel/process.c
drivers/infiniband/hw/ipath/ipath_verbs.c
drivers/parisc/led.c
drivers/scsi/lpfc/lpfc_ct.c
drivers/usb/core/hcd.c
drivers/usb/gadget/ether.c
drivers/usb/gadget/file_storage.c
drivers/usb/gadget/gmidi.c
drivers/usb/gadget/serial.c
drivers/usb/gadget/zero.c
fs/cifs/sess.c
include/asm-i386/bugs.h
include/asm-sh/bugs.h
kernel/lockdep.c
kernel/power/snapshot.c
net/ipv4/ipconfig.c
sound/core/info_oss.c

index 0a722e77c1438af559c9068399a3ec251862c2d8..6bbd93dd186a74f43ca3bbae43cac88e90c63f4c 100644 (file)
@@ -348,7 +348,7 @@ static void __init setup_processor(void)
               cpu_name, processor_id, (int)processor_id & 15,
               proc_arch[cpu_architecture()], cr_alignment);
 
-       sprintf(system_utsname.machine, "%s%c", list->arch_name, ENDIANNESS);
+       sprintf(init_utsname()->machine, "%s%c", list->arch_name, ENDIANNESS);
        sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS);
        elf_hwcap = list->elf_hwcap;
 #ifndef CONFIG_ARM_THUMB
index e7eb070f794fbb7d7d30fbf9f6900468998fafd8..466ddb54b44ffb01bd0c1211ddaf2f6ba80fc971 100644 (file)
@@ -143,7 +143,7 @@ static void __init setup_processor(void)
 
        dump_cpu_info();
 
-       sprintf(system_utsname.machine, "%s", list->arch_name);
+       sprintf(init_utsname()->machine, "%s", list->arch_name);
        sprintf(elf_platform, "%s", list->elf_name);
        elf_hwcap = list->elf_hwcap;
 
index 7af3d5d43e43b73466212ded824b131c46ba4886..ca8b45a0fe2ed4dc8fc48cb9c0cdfdd20a5af7db 100644 (file)
@@ -160,7 +160,7 @@ setup_arch(char **cmdline_p)
        show_etrax_copyright();
 
        /* Setup utsname */
-       strcpy(system_utsname.machine, cris_machine_name);
+       strcpy(init_utsname()->machine, cris_machine_name);
 }
 
 static void *c_start(struct seq_file *m, loff_t *pos)
index 96cd0232e1e03ad24638a6837e024de24ecd0c79..dad02a960e03572046c2e9ced98186c64e7ca5a5 100644 (file)
@@ -297,9 +297,9 @@ void show_regs(struct pt_regs * regs)
        if (user_mode_vm(regs))
                printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
        printk(" EFLAGS: %08lx    %s  (%s %.*s)\n",
-              regs->eflags, print_tainted(), system_utsname.release,
-              (int)strcspn(system_utsname.version, " "),
-              system_utsname.version);
+              regs->eflags, print_tainted(), init_utsname()->release,
+              (int)strcspn(init_utsname()->version, " "),
+              init_utsname()->version);
        printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
                regs->eax,regs->ebx,regs->ecx,regs->edx);
        printk("ESI: %08lx EDI: %08lx EBP: %08lx",
index 6820b8d643c7779a07328a1668fc41e4e8035542..00489b706d2719c2083172342569381b60f5ce7e 100644 (file)
@@ -357,9 +357,9 @@ void show_registers(struct pt_regs *regs)
                KERN_EMERG "EIP:    %04x:[<%08lx>]    %s VLI\n"
                KERN_EMERG "EFLAGS: %08lx   (%s %.*s)\n",
                smp_processor_id(), 0xffff & regs->xcs, regs->eip,
-               print_tainted(), regs->eflags, system_utsname.release,
-               (int)strcspn(system_utsname.version, " "),
-               system_utsname.version);
+               print_tainted(), regs->eflags, init_utsname()->release,
+               (int)strcspn(init_utsname()->version, " "),
+               init_utsname()->version);
        print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip);
        printk(KERN_EMERG "eax: %08lx   ebx: %08lx   ecx: %08lx   edx: %08lx\n",
                regs->eax, regs->ebx, regs->ecx, regs->edx);
index a127a1e3c0976aea0134de07ce2c6d3d1f4d0ba6..7b2f6452ba7252caa11c377553392446d44c02e0 100644 (file)
@@ -424,7 +424,7 @@ void show_regs(struct pt_regs * regs)
        printk("NIP: "REG" LR: "REG" CTR: "REG"\n",
               regs->nip, regs->link, regs->ctr);
        printk("REGS: %p TRAP: %04lx   %s  (%s)\n",
-              regs, regs->trap, print_tainted(), system_utsname.release);
+              regs, regs->trap, print_tainted(), init_utsname()->release);
        printk("MSR: "REG" ", regs->msr);
        printbits(regs->msr, msr_bits);
        printk("  CR: %08lX  XER: %08lX\n", regs->ccr, regs->xer);
index 962ad5ebc7678aad6df97f8640f6fb95a3261ac2..cda2dbe70a7656ce520d593ef57b5c3a9bf167f4 100644 (file)
@@ -414,7 +414,7 @@ void __init setup_system(void)
        smp_release_cpus();
 #endif
 
-       printk("Starting Linux PPC64 %s\n", system_utsname.version);
+       printk("Starting Linux PPC64 %s\n", init_utsname()->version);
 
        printk("-----------------------------------------------------\n");
        printk("ppc64_pft_size                = 0x%lx\n", ppc64_pft_size);
index 8ed362140452e850bb44c2bc2b32b1a68ff8bef3..98189d8efaca8810f63c0c654932a0a4e9d2e44a 100644 (file)
@@ -342,7 +342,7 @@ static int __init pSeries_init_panel(void)
 {
        /* Manually leave the kernel version on the panel. */
        ppc_md.progress("Linux ppc64\n", 0);
-       ppc_md.progress(system_utsname.release, 0);
+       ppc_md.progress(init_utsname()->version, 0);
 
        return 0;
 }
index 5f587332234a3e977cf1203477831dddfb446f50..77491cf9b2597565e23e327a0af8ca22620ac69d 100644 (file)
@@ -459,7 +459,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                seq_printf(m, "machine\t\t: %s\n", get_system_type());
 
        seq_printf(m, "processor\t: %d\n", cpu);
-       seq_printf(m, "cpu family\t: %s\n", system_utsname.machine);
+       seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
        seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype());
 
        show_cpuflags(m);
index 55005710dcbbc8254fc3bbea46f3f3b6ad065ad1..97d88e7902f7dbb71f19b62facbf652fe854575f 100644 (file)
@@ -167,7 +167,7 @@ static char *usage_string =
 
 static int __init uml_version_setup(char *line, int *add)
 {
-       printf("%s\n", system_utsname.release);
+       printf("%s\n", init_utsname()->release);
        exit(0);
 
        return 0;
@@ -278,7 +278,7 @@ static int __init Usage(char *line, int *add)
 {
        const char **p;
 
-       printf(usage_string, system_utsname.release);
+       printf(usage_string, init_utsname()->release);
        p = &__uml_help_start;
        while (p < &__uml_help_end) {
                printf("%s", *p);
@@ -403,7 +403,7 @@ int linux_main(int argc, char **argv)
        /* Reserve up to 4M after the current brk */
        uml_reserved = ROUND_4M(brk_start) + (1 << 22);
 
-       setup_machinename(system_utsname.machine);
+       setup_machinename(init_utsname()->machine);
 
 #ifdef CONFIG_CMDLINE_ON_HOST
        argv1_begin = argv[1];
index d0a25af19a5bd216dc2995807fb0ed410238b44e..ce3e07fcf283747bdb72216bcf2f7968d2abe0af 100644 (file)
@@ -16,7 +16,7 @@ void __show_regs(struct pt_regs * regs)
        printk("\n");
        print_modules();
        printk("Pid: %d, comm: %.20s %s %s\n",
-              current->pid, current->comm, print_tainted(), system_utsname.release);
+              current->pid, current->comm, print_tainted(), init_utsname()->release);
        printk("RIP: %04lx:[<%016lx>] ", PT_REGS_CS(regs) & 0xffff,
               PT_REGS_RIP(regs));
        printk("\nRSP: %016lx  EFLAGS: %08lx\n", PT_REGS_RSP(regs),
index 458006ae19f3837c240477611cdcb6c1e3df503f..de10cb8a2c97b8cde91e730bcb1486442fc4f82e 100644 (file)
@@ -294,9 +294,9 @@ void __show_regs(struct pt_regs * regs)
        print_modules();
        printk("Pid: %d, comm: %.20s %s %s %.*s\n",
                current->pid, current->comm, print_tainted(),
-               system_utsname.release,
-               (int)strcspn(system_utsname.version, " "),
-               system_utsname.version);
+               init_utsname()->release,
+               (int)strcspn(init_utsname()->version, " "),
+               init_utsname()->version);
        printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
        printk_address(regs->rip); 
        printk("RSP: %04lx:%016lx  EFLAGS: %08lx\n", regs->ss, regs->rsp,
index 42eaed88c281b2a194641c6231abc80bafa45893..a5456108dbadcae24bbfd1b753cdf77eb07a694b 100644 (file)
@@ -1601,7 +1601,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
        dev->mmap = ipath_mmap;
 
        snprintf(dev->node_desc, sizeof(dev->node_desc),
-                IPATH_IDSTR " %s", system_utsname.nodename);
+                IPATH_IDSTR " %s", init_utsname()->nodename);
 
        ret = ib_register_device(dev);
        if (ret)
index bf00fa2537bbb6f8774611eb55481751bede4965..8dac2ba82bb95ee748d6b69d5f56e02f4b30e329 100644 (file)
@@ -684,7 +684,7 @@ int __init led_init(void)
        int ret;
 
        snprintf(lcd_text_default, sizeof(lcd_text_default),
-               "Linux %s", system_utsname.release);
+               "Linux %s", init_utsname()->release);
 
        /* Work around the buggy PDC of KittyHawk-machines */
        switch (CPU_HVERSION) {
index ae4106458991890086cb81be16bbd91dbddfeabd..1b53afb1cb5768c4946e889987cd58ab1691be39 100644 (file)
@@ -933,8 +933,8 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode)
                        ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size);
                        ae->ad.bits.AttrType = be16_to_cpu(OS_NAME_VERSION);
                        sprintf(ae->un.OsNameVersion, "%s %s %s",
-                               system_utsname.sysname, system_utsname.release,
-                               system_utsname.version);
+                               init_utsname()->sysname, init_utsname()->release,
+                               init_utsname()->version);
                        len = strlen(ae->un.OsNameVersion);
                        len += (len & 3) ? (4 - (len & 3)) : 4;
                        ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len);
@@ -1052,7 +1052,7 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode)
                                                          size);
                                ae->ad.bits.AttrType = be16_to_cpu(HOST_NAME);
                                sprintf(ae->un.HostName, "%s",
-                                       system_utsname.nodename);
+                                       init_utsname()->nodename);
                                len = strlen(ae->un.HostName);
                                len += (len & 3) ? (4 - (len & 3)) : 4;
                                ae->ad.bits.AttrLen =
@@ -1140,7 +1140,7 @@ lpfc_fdmi_tmo_handler(struct lpfc_hba *phba)
 
        ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, FDMI_DID);
        if (ndlp) {
-               if (system_utsname.nodename[0] != '\0') {
+               if (init_utsname()->nodename[0] != '\0') {
                        lpfc_fdmi_cmd(phba, ndlp, SLI_MGMT_DHBA);
                } else {
                        mod_timer(&phba->fc_fdmitmo, jiffies + HZ * 60);
index 37f9f5e7425d1b5e1a518302fa36cad686989c25..e658089f7b504d9a6ba90d42bdff3abc57b150f3 100644 (file)
@@ -318,8 +318,8 @@ static int rh_string (
 
        // id 3 == vendor description
        } else if (id == 3) {
-               snprintf (buf, sizeof buf, "%s %s %s", system_utsname.sysname,
-                       system_utsname.release, hcd->driver->description);
+               snprintf (buf, sizeof buf, "%s %s %s", init_utsname()->sysname,
+                       init_utsname()->release, hcd->driver->description);
 
        // unsupported IDs --> "protocol stall"
        } else
index 366dc0a9e52c291e8057970eca7b3de8644e53ce..1c17d26d03b807d24db3d05da49b2b3431ba5a9b 100644 (file)
@@ -2260,7 +2260,7 @@ eth_bind (struct usb_gadget *gadget)
                return -ENODEV;
        }
        snprintf (manufacturer, sizeof manufacturer, "%s %s/%s",
-               system_utsname.sysname, system_utsname.release,
+               init_utsname()->sysname, init_utsname()->release,
                gadget->name);
 
        /* If there's an RNDIS configuration, that's what Windows wants to
index c83d3b6c68f2121dd574ff92fd3c30a4b9670791..8b975d15538ddff6fb93e2757e7d1888be538881 100644 (file)
@@ -4001,7 +4001,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
        usb_gadget_set_selfpowered(gadget);
 
        snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
-                       system_utsname.sysname, system_utsname.release,
+                       init_utsname()->sysname, init_utsname()->release,
                        gadget->name);
 
        /* On a real device, serial[] would be loaded from permanent
index b68cecd57411b1c13b1bd5cb44037299ff75ab64..83601d4009e36dd66a82e026b2c9c482877f612a 100644 (file)
@@ -1189,7 +1189,7 @@ static int __devinit gmidi_bind(struct usb_gadget *gadget)
                strlcpy(manufacturer, iManufacturer, sizeof(manufacturer));
        } else {
                snprintf(manufacturer, sizeof(manufacturer), "%s %s with %s",
-                       system_utsname.sysname, system_utsname.release,
+                       init_utsname()->sysname, init_utsname()->release,
                        gadget->name);
        }
        if (iProduct) {
index 489a85e58bcaecdd500fed37af01810e3f7503c0..208e55a667ac0d2124ece6bb49c17dbe1cf59d27 100644 (file)
@@ -1434,7 +1434,7 @@ static int __init gs_bind(struct usb_gadget *gadget)
                return -ENOMEM;
 
        snprintf(manufacturer, sizeof(manufacturer), "%s %s with %s",
-               system_utsname.sysname, system_utsname.release,
+               init_utsname()->sysname, init_utsname()->release,
                gadget->name);
 
        memset(dev, 0, sizeof(struct gs_dev));
index b7018ee487ea51fbe60ed42455410a4cb40feeaf..0f809dd684921662a0aa41a4dc99d54f90f3e2f7 100644 (file)
@@ -1242,7 +1242,7 @@ autoconf_fail:
                EP_OUT_NAME, EP_IN_NAME);
 
        snprintf (manufacturer, sizeof manufacturer, "%s %s with %s",
-               system_utsname.sysname, system_utsname.release,
+               init_utsname()->sysname, init_utsname()->release,
                gadget->name);
 
        return 0;
index d1705ab8136e1fc53768240d6dbca66bfcb56132..22b4c35dcfe3e4bfbc067b56880f5fb958df50ae 100644 (file)
@@ -111,7 +111,7 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
        bytes_ret = cifs_strtoUCS((__le16 *)bcc_ptr, "Linux version ", 32,
                                  nls_cp);
        bcc_ptr += 2 * bytes_ret;
-       bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release,
+       bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, init_utsname()->release,
                                  32, nls_cp);
        bcc_ptr += 2 * bytes_ret;
        bcc_ptr += 2; /* trailing null */
@@ -158,8 +158,8 @@ static void ascii_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
 
        strcpy(bcc_ptr, "Linux version ");
        bcc_ptr += strlen("Linux version ");
-       strcpy(bcc_ptr, system_utsname.release);
-       bcc_ptr += strlen(system_utsname.release) + 1;
+       strcpy(bcc_ptr, init_utsname()->release);
+       bcc_ptr += strlen(init_utsname()->release) + 1;
 
        strcpy(bcc_ptr, CIFS_NETWORK_OPSYS);
        bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1;
index 2a9e4ee5904d50b91d3b6310ed2e78451ce2630c..592ffeeda45e7745c4554201ce8a78da1a80df38 100644 (file)
@@ -189,6 +189,6 @@ static void __init check_bugs(void)
        check_fpu();
        check_hlt();
        check_popad();
-       system_utsname.machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
+       init_utsname()->machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
        alternative_instructions(); 
 }
index b4000c8bf31b8b76161b93c227a9bfa24c8ad0a3..beeea40f549ec391248d0a0673851f478c3dad17 100644 (file)
@@ -18,7 +18,7 @@ static void __init check_bugs(void)
 {
        extern char *get_cpu_subtype(void);
        extern unsigned long loops_per_jiffy;
-       char *p= &system_utsname.machine[2]; /* "sh" */
+       char *p= &init_utsname()->machine[2]; /* "sh" */
 
        cpu_data->loops_per_jiffy = loops_per_jiffy;
 
index e596525669ed4fa5018ee452c7bc429b945f8d00..4c0553461000360e4f4cb459bde0d289f9f89b97 100644 (file)
@@ -518,9 +518,9 @@ print_circular_bug_entry(struct lock_list *target, unsigned int depth)
 
 static void print_kernel_version(void)
 {
-       printk("%s %.*s\n", system_utsname.release,
-               (int)strcspn(system_utsname.version, " "),
-               system_utsname.version);
+       printk("%s %.*s\n", init_utsname()->release,
+               (int)strcspn(init_utsname()->version, " "),
+               init_utsname()->version);
 }
 
 /*
index 1b84313cbab5ad973d69dda99006d8439316af7d..99f9b7d177d6a843f5bcb3ade50e67379e169013 100644 (file)
@@ -906,7 +906,7 @@ static void init_header(struct swsusp_info *info)
        memset(info, 0, sizeof(struct swsusp_info));
        info->version_code = LINUX_VERSION_CODE;
        info->num_physpages = num_physpages;
-       memcpy(&info->uts, &system_utsname, sizeof(system_utsname));
+       memcpy(&info->uts, init_utsname(), sizeof(struct new_utsname));
        info->cpus = num_online_cpus();
        info->image_pages = nr_copy_pages;
        info->pages = nr_copy_pages + nr_meta_pages + 1;
@@ -1050,13 +1050,13 @@ static inline int check_header(struct swsusp_info *info)
                reason = "kernel version";
        if (info->num_physpages != num_physpages)
                reason = "memory size";
-       if (strcmp(info->uts.sysname,system_utsname.sysname))
+       if (strcmp(info->uts.sysname,init_utsname()->sysname))
                reason = "system type";
-       if (strcmp(info->uts.release,system_utsname.release))
+       if (strcmp(info->uts.release,init_utsname()->release))
                reason = "kernel release";
-       if (strcmp(info->uts.version,system_utsname.version))
+       if (strcmp(info->uts.version,init_utsname()->version))
                reason = "version";
-       if (strcmp(info->uts.machine,system_utsname.machine))
+       if (strcmp(info->uts.machine,init_utsname()->machine))
                reason = "machine";
        if (reason) {
                printk(KERN_ERR "swsusp: Resume mismatch: %s\n", reason);
index 99d50065aa7904813ed2351da0d3651bdb5f7f83..f8ce8475915966c7d10abbec1542f71b1ac10d0d 100644 (file)
@@ -366,7 +366,7 @@ static int __init ic_defaults(void)
         */
         
        if (!ic_host_name_set)
-               sprintf(system_utsname.nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr));
+               sprintf(init_utsname()->nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr));
 
        if (root_server_addr == INADDR_NONE)
                root_server_addr = ic_servaddr;
index 3ebc34919c76fc746a12643135b73d9c0f5b2435..a444bfe2cf7417245014562a20b06791006dbaab 100644 (file)
@@ -96,11 +96,11 @@ static void snd_sndstat_proc_read(struct snd_info_entry *entry,
 {
        snd_iprintf(buffer, "Sound Driver:3.8.1a-980706 (ALSA v" CONFIG_SND_VERSION " emulation code)\n");
        snd_iprintf(buffer, "Kernel: %s %s %s %s %s\n",
-                   system_utsname.sysname,
-                   system_utsname.nodename,
-                   system_utsname.release,
-                   system_utsname.version,
-                   system_utsname.machine);
+                   init_utsname()->sysname,
+                   init_utsname()->nodename,
+                   init_utsname()->release,
+                   init_utsname()->version,
+                   init_utsname()->machine);
        snd_iprintf(buffer, "Config options: 0\n");
        snd_iprintf(buffer, "\nInstalled drivers: \n");
        snd_iprintf(buffer, "Type 10: ALSA emulation\n");