initcall func(七)

 

Initcall func

61. pm_qos_power_init

\kernel\pm_qos_params.c

Obj-y = pm_qos_params.o

late_initcall(pm_qos_power_init);

 

static int __init pm_qos_power_init(void)

{

       int ret = 0;

 

       ret = register_pm_qos_misc(&cpu_dma_pm_qos);

       if (ret < 0) {

              printk(KERN_ERR "pm_qos_param: cpu_dma_latency setup failed\n");

              return ret;

       }

       ret = register_pm_qos_misc(&network_lat_pm_qos);

       if (ret < 0) {

              printk(KERN_ERR "pm_qos_param: network_latency setup failed\n");

              return ret;

       }

       ret = register_pm_qos_misc(&network_throughput_pm_qos);

       if (ret < 0)

              printk(KERN_ERR

                     "pm_qos_param: network_throughput setup failed\n");

 

       return ret;

}

 

62. random32_reseed

\lib\random32.c

Obj-y = random32.o

late_initcall(random32_reseed);

 

static int __init random32_reseed(void)

{

       int i;

       for_each_possible_cpu(i) {

              struct rnd_state *state = &per_cpu(net_rand_state,i);

              u32 seeds[3];

              get_random_bytes(&seeds, sizeof(seeds));

              state->s1 = __seed(seeds[0], 1);

              state->s2 = __seed(seeds[1], 7);

              state->s3 = __seed(seeds[2], 15);

              /* mix it in */

              __random32(state);

       }

       return 0;

}

 

63. seqgen_init

\drivers\char\random.c

Obj-y = random.o

late_initcall(seqgen_init);

 

static void rekey_seq_generator(struct work_struct *work)

{

       struct keydata *keyptr = &ip_keydata[1 ^ (ip_cnt & 1)];

 

       get_random_bytes(keyptr->secret, sizeof(keyptr->secret));

       keyptr->count = (ip_cnt & COUNT_MASK) << HASH_BITS;

       smp_wmb();

       ip_cnt++;

       schedule_delayed_work(&rekey_work, REKEY_INTERVAL);

}

static __init int seqgen_init(void)

{

       rekey_seq_generator(NULL);

       return 0;

}

 

64. rtc_hctosys

\drivers\rtc\hctosys.c

obj-$(CONFIG_RTC_HCTOSYS) += hctosys.o

late_initcall(rtc_hctosys);

 

65. tcp_congestion_default

\net\ipv4\tcp_cong.c

Obj-y = tcp_cong.o

late_initcall(tcp_congestion_default);

 

static int __init tcp_congestion_default(void)

{

       return tcp_set_default_congestion_control(CONFIG_DEFAULT_TCP_CONG);

}

 

66. ip_auto_config

\net\ipv4\ipconfig.c

obj-$(CONFIG_IP_PNP) += ipconfig.o

late_initcall(ip_auto_config);

 

static int __init ip_auto_config(void)

{

       __be32 addr;

 

#ifdef CONFIG_PROC_FS

       proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);

#endif /* CONFIG_PROC_FS */

 

       if (!ic_enable)

              return 0;

       DBG(("IP-Config: Entered.\n"));

#ifdef IPCONFIG_DYNAMIC

 try_try_again:

#endif

       /* Give hardware a chance to settle */

       msleep(CONF_PRE_OPEN);

 

       /* Setup all network devices */

       if (ic_open_devs() < 0)

              return -1;

 

       /* Give drivers a chance to settle */

       ssleep(CONF_POST_OPEN);

 

       /*

        * If the config information is insufficient (e.g., our IP address or

        * IP address of the boot server is missing or we have multiple network

        * interfaces and no default was set), use BOOTP or RARP to get the

        * missing values.

        */

       if (ic_myaddr == NONE ||

#ifdef CONFIG_ROOT_NFS

           (root_server_addr == NONE

            && ic_servaddr == NONE

            && ROOT_DEV == Root_NFS) ||

#endif

           ic_first_dev->next) {

#ifdef IPCONFIG_DYNAMIC

 

              int retries = CONF_OPEN_RETRIES;

 

              if (ic_dynamic() < 0) {

                     ic_close_devs();

 

                     /*

                      * I don't know why, but sometimes the

                      * eepro100 driver (at least) gets upset and

                      * doesn't work the first time it's opened.

                      * But then if you close it and reopen it, it

                      * works just fine.  So we need to try that at

                      * least once before giving up.

                      *

                      * Also, if the root will be NFS-mounted, we

                      * have nowhere to go if DHCP fails.  So we

                      * just have to keep trying forever.

                      *

                      *                        -- Chip

                      */

#ifdef CONFIG_ROOT_NFS

                     if (ROOT_DEV ==  Root_NFS) {

                            printk(KERN_ERR

                                   "IP-Config: Retrying forever (NFS root)...\n");

                            goto try_try_again;

                     }

#endif

 

                     if (--retries) {

                            printk(KERN_ERR

                                   "IP-Config: Reopening network devices...\n");

                            goto try_try_again;

                     }

 

                     /* Oh, well.  At least we tried. */

                     printk(KERN_ERR "IP-Config: Auto-configuration of network failed.\n");

                     return -1;

              }

#else /* !DYNAMIC */

              printk(KERN_ERR "IP-Config: Incomplete network configuration information.\n");

              ic_close_devs();

              return -1;

#endif /* IPCONFIG_DYNAMIC */

       } else {

              /* Device selected manually or only one device -> use it */

              ic_dev = ic_first_dev->dev;

       }

       addr = root_nfs_parse_addr(root_server_path);

       if (root_server_addr == NONE)

              root_server_addr = addr;

       /*

        * Use defaults whereever applicable.

        */

       if (ic_defaults() < 0)

              return -1;

       /*

        * Close all network devices except the device we've

        * autoconfigured and set up routes.

        */

       ic_close_devs();

       if (ic_setup_if() < 0 || ic_setup_routes() < 0)

              return -1;

       /*

        * Record which protocol was actually used.

        */

#ifdef IPCONFIG_DYNAMIC

       ic_proto_used = ic_got_reply | (ic_proto_enabled & IC_USE_DHCP);

#endif

#ifndef IPCONFIG_SILENT

       /*

        * Clue in the operator.

        */

       printk("IP-Config: Complete:");

       printk("\n     device=%s", ic_dev->name);

       printk(", addr=" NIPQUAD_FMT, NIPQUAD(ic_myaddr));

       printk(", mask=" NIPQUAD_FMT, NIPQUAD(ic_netmask));

       printk(", gw=" NIPQUAD_FMT, NIPQUAD(ic_gateway));

       printk(",\n     host=%s, domain=%s, nis-domain=%s",

              utsname()->nodename, ic_domain, utsname()->domainname);

       printk(",\n     bootserver=" NIPQUAD_FMT, NIPQUAD(ic_servaddr));

       printk(", rootserver=" NIPQUAD_FMT, NIPQUAD(root_server_addr));

       printk(", rootpath=%s", root_server_path);

       printk("\n");

#endif /* !SILENT */

       return 0;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值