On 6/29/05, Xiangfei Jia <xjianz@xxxxxxxxx> wrote: > > There are things that I can't figure out by reading the source code. My > question are: (1) By default, each device has two megbytes. The > 'Sbull_Dev.size' is used to represent the size of the device. what I can't > understand is these two megbytes has never been allocated, how can the > device holds data. (2) the pointer variable 'Sbull_dev.data' is used to hold > the data been transferred from the buffer cache. But the pointer has never > been assigned to pointer to any memory, and has never been allocated. How > can the pointer hold the tranferred data??? > (3) This is related to the second question. At the clean_up function, the > pointer variable 'Sbull_Dev.data' is freed using 'vfree'. If a pointer has > never been allocated, how the pointer can be freed. > I think u skipped by mistake on the lines or functions which are allocating memory .... Just search for the vmalloc in sbull.c file and u will find that line dev->data = vmalloc(dev->size); and I think this is in setup_devices fucntion (in 2.6 kernel version of the sample) -- Fawad Lateef -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/