Best way to store struct ata_host objects for later use

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

 



Hi,

What's the most advisable means of storing struct ata_host objects for
later reference?  Can they be constructed relatively easily from other,
more basic, kernel structures which should exist after the ahci.ko
driver has loaded?

Briefly, what's prompting this is that I'm writing a character driver to
act as a pass through from user space to ahci.ko (actually, a modified
version of ahci.ko).  One of the mods I've made is a linked list of
struct ata_host objects which is used by my character driver to know how
many device nodes to instantiate (1 for each port on however many HBAs
the LLD is driving).  At this location, http://lxr.linux.no/linux
+*/drivers/ata/ahci.c#L3230 , I placed a call to a function I added
which simply allocates, via kalloc(), a new ata_host structure.  I then
simply memcpy() the contents of what the driver has dutifully
instantiated.  I figured that copying the structure at this point was
safe because it was fully built.

The reason for all of this is so that the character driver can keep
track of which ata host owns the port, etc.  One of the things my
character driver allows is access to HBA and port registers.  In my very
early drafts, I'm calling pci_get_device(), but this just isn't workable
because I don't want the upper layer driver tied to specific hardware.
I use the ata_host, and its ata_port, objects to get access to the
iomapped memory.

Essentially, the idea was that the character driver would pass the
ata_host structure to the LLD driver for HBA registers, and an ata_port
structure for the port registers.  Apparently, however, there's more
going on and simply copying (a shallow copy at that) these structures
doesn't provide enough security.  I caused a kernel oops.

Is there a better means of going about this?

Andy
��.n��������+%������w��{.n�����{��'^�)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux