linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* missing get_empty_inode()
@ 2003-05-09  9:27 Ralf Oehler
  2003-05-09 10:53 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Ralf Oehler @ 2003-05-09  9:27 UTC (permalink / raw)
  To: linux-kernel

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: missing get_empty_inode()
  2003-05-09  9:27 missing get_empty_inode() Ralf Oehler
@ 2003-05-09 10:53 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2003-05-09 10:53 UTC (permalink / raw)
  To: Ralf Oehler; +Cc: linux-kernel

On Fri, May 09, 2003 at 11:27:03AM +0200, Ralf Oehler wrote:
> 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.

There is none.  Inodes must have superblocks associated to them.

> 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 ?

open it from userspace.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-09 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-09  9:27 missing get_empty_inode() Ralf Oehler
2003-05-09 10:53 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).