|
mmcsd.h
#ifndef MMCSD_MMCSD_H
#define MMCSD_MMCSD_H
struct mmc_slot
{
int (*transfer1b)(struct mmc_slot *slot, int rd, u_long from,
u_char *buf); /* transfer 1 block for Memory Card */
};
extern int add_mmc_device(struct mmc_slot *slot);
#endif
模块1-----Mmcsd_disk.c
#include”mmcsd.h”
static struct mmc_slot *mmc_slots[MAX_MMC_SLOTS];
static int mmc_do_transfer_1blk(struct mmc_slot *slot, int rd, u_long from,
u_char *buf)
{ }
add_mmc_device(struct mmc_slot *slot)
{
slot->transfer1b = mmc_do_transfer_1blk;
mmc_slots=NULL;
}
EXPORT_SYMBOL(add_mmc_device);
模块2-----Mmcsd_bus.c
#include”mmcsd.h”
static struct mmcsd_disk {
int use_cnt;
struct mmc_slot *slot;
} mmcsd_disk[MAX_MMC_SLOTS];
#define SD_PRIV(x) ((struct mmcsd_disk *)(mmcsd_disk) + (x))
#define SD_SLOT(x) (SD_PRIV(x)->slot)
do_mmcsd_rw(req, rd)
{
int dev = DEVICE_NR(req->rq_dev) //获得设备号
SD_SLOT(dev)->transfer1b(SD_SLOT(dev), rd, from, buffer)
}
do_mmcsd_request()
{
do_mmcsd_rw(req, rd) SD_SLOT(dev)->transfer1b(SD_SLOT(dev), rd, from, buffer)
}
模块1与模块2所在的文件都已经分别通过module_init()添加到内核中去了,先module_init()模块1.
问题:
1) 模块2中执行SD_SLOT(dev)->transfer1b()时,transfer1b指向哪个函数?
2) 模块1中的变量mmc_slots也被EXPORT_SYMBOL了吗?
|
|