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
This archive was generated by hypermail 2b29 : Thu May 15 2003 - 22:00:30 EST