mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ralf Oehler <R.Oehler@GDAmbH.com>
To: linux-kernel@vger.kernel.org
Subject: missing get_empty_inode()
Date: Fri, 09 May 2003 11:27:03 +0200 (MEST)	[thread overview]
Message-ID: <XFMail.20030509112703.R.Oehler@GDAmbH.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2578 bytes --]

Hello, list

Currently I'm porting my driver sources from 2.4.18 to 2.4.20 an I noticed
the absence of get_empty_inode().
I didn't find an exported function to get a sb-less inode.
My goal is to open sd- and an sg- devices in order to do
ioctl(send_scsi_cmd) on them. As my driver acts as a block device driver
(layered pseudo block device), there is no sb assigned to it.

What is, according to the current philosophy, the cleanest code-sniplet to

- open
- ioctl
- close

an sd-device ?
an sg-device ?

Currently (2.4.18), I do it like



open-sd:
        dummy_inode = get_empty_inode();
        init_special_inode( dummy_inode, 
                            S_IFBLK | 0600,
                            kdev );
        dummy_inode->i_bdev = bdev;
        dummy_inode->i_dev = dummy_inode->i_rdev;
        insert_inode_hash(dummy_inode);

close-sd:
        def_blk_fops.release(dummy_inode, &dummy_filp);

ioctl-sd:
        ioctl_by_bdev(dummy_inode->i_bdev, cmd, arg);




open-sg:
  dummy_inode = get_empty_inode();
  init_special_inode( dummy_inode, 
                      S_IFCHR | 0600,
                      kdev );
  dummy_inode->i_dev = dummy_inode->i_rdev;
  dummy_dentry.d_inode = dummy_inode;
  ret = init_private_file( dummy_file,
                           dummy_dentry,
                           FMODE_READ|FMODE_WRITE );    /* calls open() */
  insert_inode_hash(dummy_inode);

close-sg:
  dummy_file->f_op->release(dummy_inode, dummy_file);
  fops_put(filp->f_op);
  filp->f_dentry = NULL;
  dummy_inode->i_state |= I_FREEING;
  clear_inode(dummy_inode);
  dummy_inode = NULL;

ioctl-sg:
        filp->f_op->ioctl( dummy_inode, filp, cmd, arg );





Regards,
        Ralf


--
 --------------------------------------------------------------------------
|  Ralf Oehler                          
|                                       
|  GDA - Gesellschaft fuer Digitale                              _/
|        Archivierungstechnik mbH & CoKG                        _/
|  Ein Unternehmen der Bechtle AG               #/_/_/_/ _/_/_/_/ _/_/_/_/
|                                              _/    _/ _/    _/       _/
|  E-Mail:      R.Oehler@GDAmbH.com           _/    _/ _/    _/ _/    _/
|  Tel.:        +49 6182-9271-23             _/_/_/_/ _/_/_/#/ _/_/_/#/
|  Fax.:        +49 6182-25035                    _/
|  Mail:        GDA, Bensbruchstraße 11,   _/_/_/_/
|               D-63533 Mainhausen      
|  HTTP:        www.GDAmbH.com         
 --------------------------------------------------------------------------

time is a funny concept









[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

             reply	other threads:[~2003-05-09  9:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-09  9:27 Ralf Oehler [this message]
2003-05-09 10:53 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=XFMail.20030509112703.R.Oehler@GDAmbH.com \
    --to=r.oehler@gdambh.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®