lkml.org 
[lkml]   [2002]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 9/10] 2.5.44 cciss add getluninfo ioctl
patch 9 of 10
The whole set can be grabbed via anonymous cvs (empty password):
cvs -d:pserver:anonymous@cvs.cciss.sourceforge.net:/cvsroot/cciss login
cvs -z3 -d:pserver:anonymous@cvs.cciss.sourceforge.net:/cvsroot/cciss co 2.5.44

This ioctl returns the LUNID, number of partitions, and current
number of opens on a logical volume. Used by the array config utility
or any app that needs to send passthrough commands to a particular
logical disk.


drivers/block/cciss.c | 18 ++++++++++++++++++
include/linux/cciss_ioctl.h | 6 ++++++
2 files changed, 24 insertions

--- linux-2.5.44/drivers/block/cciss.c~getluninfo_ioctl Mon Oct 21 13:44:37 2002
+++ linux-2.5.44-root/drivers/block/cciss.c Tue Oct 22 13:22:15 2002
@@ -574,6 +574,24 @@ static int cciss_ioctl(struct inode *ino
case CCISS_REVALIDVOLS:
return( revalidate_allvol(inode->i_rdev));

+ case CCISS_GETLUNINFO: {
+ LogvolInfo_struct luninfo;
+ struct gendisk *disk = hba[ctlr]->gendisk[dsk];
+ drive_info_struct *drv = &hba[ctlr]->drv[dsk];
+ int i;
+
+ luninfo.LunID = drv->LunID;
+ luninfo.num_opens = drv->usage_count;
+ luninfo.num_parts = 0;
+ /* count partitions 1 to 15 with sizes > 0 */
+ for(i=1; i <MAX_PART; i++)
+ if (disk->part[i].nr_sects != 0)
+ luninfo.num_parts++;
+ if (copy_to_user((void *) arg, &luninfo,
+ sizeof(LogvolInfo_struct)))
+ return -EFAULT;
+ return(0);
+ }
case CCISS_DEREGDISK:
return( deregister_disk(ctlr,dsk));

--- linux-2.5.44/include/linux/cciss_ioctl.h~getluninfo_ioctl Mon Oct 21 13:44:37 2002
+++ linux-2.5.44-root/include/linux/cciss_ioctl.h Mon Oct 21 13:44:37 2002
@@ -169,6 +169,11 @@ typedef struct _IOCTL_Command_struct {
BYTE *buf;
} IOCTL_Command_struct;

+typedef struct _LogvolInfo_struct{
+ __u32 LunID;
+ int num_opens; /* number of opens on the logical volume */
+ int num_parts; /* number of partitions configured on logvol */
+} LogvolInfo_struct;

#define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct)

@@ -190,5 +195,6 @@ typedef struct _IOCTL_Command_struct {
#define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int)

#define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14)
+#define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)

#endif
.
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:30    [W:0.024 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site