RE: 2.6 partition support driver methods

From: Mukund JB. (mukundjb_at_esntechnologies.co.in)
Date: 08/04/05

  • Next message: Etienne Lorrain: "Re: IDE disk and HPA"
    Date:	Thu, 4 Aug 2005 17:35:02 +0530
    To: <corbet@lwn.net>
    
    

    Dear corbet,

    Here is the over idea about the driver status.
    My driver supports 4 SD cards at a time.
    The driver works well when there are partitions are disabled.
    i.e. when alloc_disk(1); - i.e. no partitions

    Right now, I am working on getting the driver up with partitions
    supported.
    After making changes in the gendisk initialization, I am able to mount
    the device in the socket 0 but I am NOT able mount the devices in the
    rest of the sockets when partitions are enabled?

    Also, there is nothing specific that I am implementing for partition IO
    request support on the devices.

    However,
    I am in bit confusion whether the following gendisk will suffice the
    requirement or NOT?

    Will u please verify the gendisk code below?
    Here is how I am initializing the gendisk in my driver.

    ----------------------gendisk impl ----------------------------

            gDisk->blkqueue = blk_init_queue(do_request, &gDisk->qlock);
            if(gDisk->blkqueue == NULL) {
                    printk("FM ERROR | Queue Initialization failed!\n");
                    return FAILURE;
            }
            
            /* set sector size */
            blk_queue_hardsect_size(gDisk->blkqueue, DEV_SECT_SIZE);

            /* add gendisk: partitioning support.... */
            gDisk->gd = alloc_disk(4); /* 3 -> 3 partitions */
            if(! gDisk->gd) {
                    printk("FM ERROR | alloc_disk failed!\n");
                    return FAILURE;
            }
            gDisk->gd->major = major_num;
            gDisk->gd->first_minor = (int_of(Dev->dName[2]) *
    MAX_NUM_SOCKETS) +
    (iSock * 4);
            gDisk->gd->fops = &bd_op;
            gDisk->gd->private_data = Dev;

            for(i=0;i<3;i++)
                    devName[i] = Dev->dName[i];
            devName[i] = char_of(iSock);
            devName[i+1] = '\0';
            strcpy(gDisk->gd->disk_name, devName);
            PRINTK("Device Name under /dev/ = %s\n", devName);

            /* removable media */
            gDisk->gd->flags |= GENHD_FL_REMOVABLE;

            set_capacity(gDisk->gd,
            ((dSize * 1024)/DEV_SECT_SIZE) *
    (DEV_SECT_SIZE/KRNL_SECT_SIZE));

            gDisk->gd->queue = gDisk->blkqueue;

            add_disk(gDisk->gd);
    ----------------------gendisk impl ENDS ----------------------------

    This gendisk is invoked at socket initialization.

    For example, phy devices are
    /dev/tfa0 - 3: socket 1
    /dev/tfa4 - 7: socket 2
    /dev/tfa8 - 11: socket 3
    /dev/tfa12 -15: socket 4

    i.e, I have created the nodes like minors 0, 1, 2, 3 for socket0
            I have created the nodes like minors 12, 13, 14, 15 for socket3.

    With these physical nodes, I through it should work.
    When a card is inserted in the socket 0, I am able to mount.

    BUT, when a card is inserted in the socket 3, I am NOT able to mount and
    it says.
    Mount: /dev/tfa12 is not a valid block device

    Can you convey me where exactly I am missing or why is it failing?

    Regards,
    Mukund Jampala

    >-----Original Message-----
    >From: corbet@lwn.net [mailto:corbet@lwn.net]
    >Sent: Thursday, August 04, 2005 12:35 AM
    >To: Mukund JB.
    >Cc: linux-kernel@vger.kernel.org
    >Subject: Re: 2.6 partition support driver methods
    >
    >> Do I need to handle any thing in the request function to handle
    >> read/writes to the device partitions?
    >
    >It looks like you've done most of what you need; in 2.6, block drivers
    >need not worry about the details of partitioning.
    >
    >Lots of details in the block drivers chapter of LDD3 if you need them:
    >
    > http://lwn.net/Kernel/LDD3/
    >
    >jon
    >
    >Jonathan Corbet
    >Executive editor, LWN.net
    >corbet@lwn.net

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Etienne Lorrain: "Re: IDE disk and HPA"

    Relevant Pages

    • Re: NO Flash - TFAT file system integration
      ... I tested integrating the Hive-based registry and it ... Since you put the block driver ... under "BuiltIn" the block driver is allready automatically loaded by ... at least not without using multiple partitions. ...
      (microsoft.public.windowsce.platbuilder)
    • Re: XP Professional unstable and reboots
      ... In my experience partitions do not cause what you are seeing. ... To be able to pin down what driver needs replacing you have to get an Idea ... > Fresh/New first time installation of Windows XP Professional. ... > I probably should not have used the CD that came with the Seagate. ...
      (microsoft.public.windowsxp.setup_deployment)
    • Re: mounting reiserfs
      ... I have found a driver to mount those partitions as ... > Does anyone know a way to mount a reiserfs partition from freebsd? ...
      (freebsd-stable)
    • How to support partitions in driver?
      ... I have few basic queries regarding my partition implementation in my Sd ... I have a working SD driver for my multimedia controller. ... I am able to mount the SD with when inserted in socket 0. ...
      (Linux-Kernel)
    • Re: Variable path of one-partition devices
      ... > Ok.Let's say I got two USB pen drives by MyFlash and I use them the first ... partitions and reformats USB pen drives? ... driver at that point. ... devfs AND you have devfs mounted and the driver notifies devfs (or udev, ...
      (comp.os.linux.misc)