Linux PARISC architecture development
 help / color / mirror / Atom feed
* Re: [parisc-linux] Probleme while compiling last CVS kernel.
@ 2002-06-07 15:31 joel.soete
  2002-06-07 18:24 ` Patrick Caulfield
  0 siblings, 1 reply; 12+ messages in thread
From: joel.soete @ 2002-06-07 15:31 UTC (permalink / raw)
  To: Patrick Caulfield; +Cc: parisc-linux

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

Hi all,

Here is attached the patch to uptdate lvm structures in ioctl32.c
(arch/parisc/kernel).

Can somebody check in for me.

I check it (Ok) for 32bit kernel on my b180l.

Patrick,

Don't you see anything else to verify?

Bruno,

Could you see if it compiles now well for 64bits.

Thanks in advance for all,
    Joel

Quoting Patrick Caulfield <patrick@tykepenguin.com>:

> On Fri, Jun 07, 2002 at 09:28:07AM +0200, joel.soete@freebel.net wrote:
> > Quoting joel.soete@freebel.net:
> > 
> > > Quoting Patrick Caulfield <patrick@tykepenguin.com>:
> > > 
> > > ...
> > 
> > > So surprised too ??
> > 
> > Not anymore, in fact all seems already include in ioctl32.
> > 
> > So I just have to find how to compile a 64bits kernel. There should it
> be some
> > hack to bring it works.
> 
> The stuff that's in there is for LVM0.8, whereas LVM 1.0 is in the rest
> of the
> kernel. The structures have changed slightly which is why it won't
> compile ATM.
> 
> patrick
> 
> 
> _______________________________________________
> parisc-linux mailing list
> parisc-linux@lists.parisc-linux.org
> http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
> 
> 


-------------------------------------------------
This mail sent through Tiscali Webmail (http://webmail.tiscali.be)

[-- Attachment #2: ioctl32-lvm10.patch --]
[-- Type: application/octet-stream, Size: 9873 bytes --]

--- ioctl32.c.orig	Fri Jun  7 10:01:04 2002
+++ ioctl32.c	Fri Jun  7 12:25:44 2002
@@ -51,8 +51,8 @@
 #include <linux/serial.h>
 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
 /* Ugh. This header really is not clean */
-#define min min
-#define max max
+/* #define min min
+#define max max */
 #include <linux/lvm.h>
 #endif /* LVM */
 
@@ -1805,6 +1805,8 @@
 	u32 proc;
 	u32 pv[ABS_MAX_PV + 1];
 	u32 lv[ABS_MAX_LV + 1];
+    	uint8_t vg_uuid[UUID_LEN+1];	/* volume group UUID */
+	uint8_t dummy1[200];
 } vg32_t;
 
 typedef struct {
@@ -1830,6 +1832,7 @@
 	uint32_t pe_stale;
 	u32 pe;
 	u32 inode;
+	uint8_t pv_uuid[UUID_LEN+1];
 } pv32_t;
 
 typedef struct {
@@ -1840,9 +1843,16 @@
 typedef struct {
 	u32 lv_index;
 	u32 lv;
+	/* Transfer size because user space and kernel space differ */
+	uint16_t size;
 } lv_status_byindex_req32_t;
 
 typedef struct {
+	__kernel_dev_t32 dev;
+	u32   lv;
+} lv_status_bydev_req32_t;
+
+typedef struct {
 	uint8_t lv_name[NAME_LEN];
 	kdev_t old_dev;
 	kdev_t new_dev;
@@ -1911,7 +1921,8 @@
 	lv_block_exception32_t *lbe32;
 	lv_block_exception_t *lbe;
 	lv32_t *ul = (lv32_t *)A(p);
-	lv_t *l = (lv_t *)kmalloc(sizeof(lv_t), GFP_KERNEL);
+	lv_t *l = (lv_t *) kmalloc(sizeof(lv_t), GFP_KERNEL);
+
 	if (!l) {
 		*errp = -ENOMEM;
 		return NULL;
@@ -1976,18 +1987,20 @@
 	err |= __copy_to_user(&ul->lv_remap_ptr, &l->lv_remap_ptr,
 				((long)&ul->dummy[0]) - ((long)&ul->lv_remap_ptr));
 	size = l->lv_allocated_le * sizeof(pe_t);
-	err |= __copy_to_user((void *)A(ptr1), l->lv_current_pe, size);
-	return -EFAULT;
+	if (ptr1)
+		err |= __copy_to_user((void *)A(ptr1), l->lv_current_pe, size);
+	return err ? -EFAULT : 0;
 }
 
 static int do_lvm_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	vg_t *v;
+	vg_t *v = NULL;
 	union {
 		lv_req_t lv_req;
 		le_remap_req_t le_remap;
 		lv_status_byindex_req_t lv_byindex;
-		pv_status_req32_t pv_status;
+	        lv_status_bydev_req_t lv_bydev;
+		pv_status_req_t pv_status;
 	} u;
 	pv_t p;
 	int err;
@@ -1999,97 +2012,144 @@
 	switch (cmd) {
 	case VG_STATUS:
 		v = kmalloc(sizeof(vg_t), GFP_KERNEL);
-		if (!v) return -ENOMEM;
+		if (!v)
+			return -ENOMEM;
 		karg = v;
 		break;
+
+	case VG_CREATE_OLD:
 	case VG_CREATE:
 		v = kmalloc(sizeof(vg_t), GFP_KERNEL);
-		if (!v) return -ENOMEM;
-		if (copy_from_user(v, (void *)arg, (long)&((vg32_t *)0)->proc) ||
-		    __get_user(v->proc, &((vg32_t *)arg)->proc)) {
+		if (!v)
+			return -ENOMEM;
+		if (copy_from_user(v, (void *)arg, (long)&((vg32_t *)0)->proc)) {
+			kfree(v);
+			return -EFAULT;
+		}
+		/* 'proc' field is unused, just NULL it out. */
+		v->proc = NULL;
+		if (copy_from_user(v->vg_uuid, ((vg32_t *)arg)->vg_uuid, UUID_LEN+1)) {
 			kfree(v);
 			return -EFAULT;
 		}
+		    
 		karg = v;
 		memset(v->pv, 0, sizeof(v->pv) + sizeof(v->lv));
-		if (v->pv_max > ABS_MAX_PV || v->lv_max == ABS_MAX_LV) return -EPERM;
+		if (v->pv_max > ABS_MAX_PV || v->lv_max > ABS_MAX_LV)
+			return -EPERM;
 		for (i = 0; i < v->pv_max; i++) {
 			err = __get_user(ptr, &((vg32_t *)arg)->pv[i]);
-			if (err) break;
+			if (err)
+				break;
 			if (ptr) {
 				v->pv[i] = kmalloc(sizeof(pv_t), GFP_KERNEL);
 				if (!v->pv[i]) {
 					err = -ENOMEM;
 					break;
 				}
-				err = copy_from_user(v->pv[i], (void *)A(ptr), sizeof(pv32_t) - 8);
+				err = copy_from_user(v->pv[i], (void *)A(ptr),
+						     sizeof(pv32_t) - 8 - UUID_LEN+1);
 				if (err) {
 					err = -EFAULT;
 					break;
 				}
-				v->pv[i]->pe = NULL; v->pv[i]->inode = NULL;
+				err = copy_from_user(v->pv[i]->pv_uuid,
+						     ((pv32_t *)A(ptr))->pv_uuid,
+						     UUID_LEN+1);
+				if (err) {
+				        err = -EFAULT;
+					break;
+				}
+
+				v->pv[i]->pe = NULL;
+				v->pv[i]->bd = NULL;
 			}
 		}
 		if (!err) {
 			for (i = 0; i < v->lv_max; i++) {
 				err = __get_user(ptr, &((vg32_t *)arg)->lv[i]);
-				if (err) break;
+				if (err)
+					break;
 				if (ptr) {
 					v->lv[i] = get_lv_t(ptr, &err);
-					if (err) break;
+					if (err)
+						break;
 				}
 			}
 		}
 		break;
+
 	case LV_CREATE:
 	case LV_EXTEND:
 	case LV_REDUCE:
 	case LV_REMOVE:
+	case LV_RENAME:
 	case LV_STATUS_BYNAME:
-		err = copy_from_user(&u.pv_status, arg, sizeof(u.pv_status.pv_name));
-		if (err) return -EFAULT;
+	        err = copy_from_user(&u.pv_status, arg, sizeof(u.pv_status.pv_name));
+		if (err)
+			return -EFAULT;
 		if (cmd != LV_REMOVE) {
 			err = __get_user(ptr, &((lv_req32_t *)arg)->lv);
-			if (err) return err;
+			if (err)
+				return err;
 			u.lv_req.lv = get_lv_t(ptr, &err);
 		} else
 			u.lv_req.lv = NULL;
 		break;
+
 	case LV_STATUS_BYINDEX:
-		err = get_user(u.lv_byindex.lv_index, &((lv_status_byindex_req32_t *)arg)->lv_index);
+		err = get_user(u.lv_byindex.lv_index,
+			       &((lv_status_byindex_req32_t *)arg)->lv_index);
 		err |= __get_user(ptr, &((lv_status_byindex_req32_t *)arg)->lv);
-		if (err) return err;
+		if (err)
+			return err;
 		u.lv_byindex.lv = get_lv_t(ptr, &err);
 		break;
+
+	case LV_STATUS_BYDEV:
+	        err = get_user(u.lv_bydev.dev, &((lv_status_bydev_req32_t *)arg)->dev);
+		err |= __get_user(ptr, &((lv_status_bydev_req32_t *)arg)->lv);
+		if (err)
+			return err;
+		u.lv_bydev.lv = get_lv_t(ptr, &err);
+		break;
+
 	case VG_EXTEND:
-		err = copy_from_user(&p, (void *)arg, sizeof(pv32_t) - 8);
-		if (err) return -EFAULT;
-		p.pe = NULL; p.inode = NULL;
+		err = copy_from_user(&p, (void *)arg, sizeof(pv32_t) - 8 - UUID_LEN+1);
+		if (err)
+			return -EFAULT;
+		err = copy_from_user(p.pv_uuid, ((pv32_t *)arg)->pv_uuid, UUID_LEN+1);
+		if (err)
+			return -EFAULT;
+		p.pe = NULL;
+		p.bd = NULL;
 		karg = &p;
 		break;
-	case LE_REMAP:
-		err = copy_from_user(&u.le_remap, (void *)arg, sizeof(le_remap_req32_t));
-		if (err) return -EFAULT;
-		u.le_remap.new_pe = ((le_remap_req32_t *)&u.le_remap)->new_pe;
-		u.le_remap.old_pe = ((le_remap_req32_t *)&u.le_remap)->old_pe;
-		break;
+
 	case PV_CHANGE:
 	case PV_STATUS:
 		err = copy_from_user(&u.pv_status, arg, sizeof(u.lv_req.lv_name));
-		if (err) return -EFAULT;
+		if (err)
+			return -EFAULT;
 		err = __get_user(ptr, &((pv_status_req32_t *)arg)->pv);
-		if (err) return err;
+		if (err)
+			return err;
 		u.pv_status.pv = &p;
 		if (cmd == PV_CHANGE) {
-			err = copy_from_user(&p, (void *)A(ptr), sizeof(pv32_t) - 8);
-			if (err) return -EFAULT;
-			p.pe = NULL; p.inode = NULL;
+			err = copy_from_user(&p, (void *)A(ptr),
+					     sizeof(pv32_t) - 8 - UUID_LEN+1);
+			if (err)
+				return -EFAULT;
+			p.pe = NULL;
+			p.bd = NULL;
 		}
 		break;
-	}
+	};
+
         old_fs = get_fs(); set_fs (KERNEL_DS);
         err = sys_ioctl (fd, cmd, (unsigned long)karg);
         set_fs (old_fs);
+
 	switch (cmd) {
 	case VG_STATUS:
 		if (!err) {
@@ -2097,35 +2157,65 @@
 			    clear_user(&((vg32_t *)arg)->proc, sizeof(vg32_t) - (long)&((vg32_t *)0)->proc))
 				err = -EFAULT;
 		}
+		if (copy_to_user(((vg32_t *)arg)->vg_uuid, v->vg_uuid, UUID_LEN+1)) {
+		        err = -EFAULT;
+		}
 		kfree(v);
 		break;
+
+	case VG_CREATE_OLD:
 	case VG_CREATE:
-		for (i = 0; i < v->pv_max; i++)
-			if (v->pv[i]) kfree(v->pv[i]);
-		for (i = 0; i < v->lv_max; i++)
-			if (v->lv[i]) put_lv_t(v->lv[i]);
+		for (i = 0; i < v->pv_max; i++) {
+			if (v->pv[i])
+				kfree(v->pv[i]);
+		}
+		for (i = 0; i < v->lv_max; i++) {
+			if (v->lv[i])
+				put_lv_t(v->lv[i]);
+		}
 		kfree(v);
 		break;
+
 	case LV_STATUS_BYNAME:
-		if (!err && u.lv_req.lv) err = copy_lv_t(ptr, u.lv_req.lv);
+		if (!err && u.lv_req.lv)
+			err = copy_lv_t(ptr, u.lv_req.lv);
 		/* Fall through */
+
         case LV_CREATE:
 	case LV_EXTEND:
 	case LV_REDUCE:
-		if (u.lv_req.lv) put_lv_t(u.lv_req.lv);
+		if (u.lv_req.lv)
+			put_lv_t(u.lv_req.lv);
 		break;
+
 	case LV_STATUS_BYINDEX:
 		if (u.lv_byindex.lv) {
-			if (!err) err = copy_lv_t(ptr, u.lv_byindex.lv);
+			if (!err)
+				err = copy_lv_t(ptr, u.lv_byindex.lv);
 			put_lv_t(u.lv_byindex.lv);
 		}
+		break;
+
+	case LV_STATUS_BYDEV:
+	        if (u.lv_bydev.lv) {
+			if (!err)
+				err = copy_lv_t(ptr, u.lv_bydev.lv);
+			put_lv_t(u.lv_byindex.lv);
+	        }
+	        break;
+
 	case PV_STATUS:
 		if (!err) {
-			err = copy_to_user((void *)A(ptr), &p, sizeof(pv32_t) - 8);
-			if (err) return -EFAULT;		
+			err = copy_to_user((void *)A(ptr), &p, sizeof(pv32_t) - 8 - UUID_LEN+1);
+			if (err)
+				return -EFAULT;
+			err = copy_to_user(((pv_t *)A(ptr))->pv_uuid, p.pv_uuid, UUID_LEN + 1);
+			if (err)
+				return -EFAULT;
 		}
 		break;
-	}
+	};
+
 	return err;
 }
 #endif
@@ -3309,6 +3399,7 @@
 COMPATIBLE_IOCTL(VG_STATUS_GET_COUNT)
 COMPATIBLE_IOCTL(VG_STATUS_GET_NAMELIST)
 COMPATIBLE_IOCTL(VG_REMOVE)
+COMPATIBLE_IOCTL(VG_RENAME)
 COMPATIBLE_IOCTL(VG_REDUCE)
 COMPATIBLE_IOCTL(PE_LOCK_UNLOCK)
 COMPATIBLE_IOCTL(PV_FLUSH)
@@ -3320,6 +3411,9 @@
 COMPATIBLE_IOCTL(LV_SET_ACCESS)
 COMPATIBLE_IOCTL(LV_SET_STATUS)
 COMPATIBLE_IOCTL(LV_SET_ALLOCATION)
+COMPATIBLE_IOCTL(LE_REMAP)
+COMPATIBLE_IOCTL(LV_BMAP)
+COMPATIBLE_IOCTL(LV_SNAPSHOT_USE_RATE)
 #endif /* LVM */
 #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
 COMPATIBLE_IOCTL(DRM_IOCTL_GET_MAGIC)
@@ -3472,15 +3566,17 @@
 HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl)
 #if defined(CONFIG_BLK_DEV_LVM) || defined(CONFIG_BLK_DEV_LVM_MODULE)
 HANDLE_IOCTL(VG_STATUS, do_lvm_ioctl)
+HANDLE_IOCTL(VG_CREATE_OLD, do_lvm_ioctl)
 HANDLE_IOCTL(VG_CREATE, do_lvm_ioctl)
 HANDLE_IOCTL(VG_EXTEND, do_lvm_ioctl)
 HANDLE_IOCTL(LV_CREATE, do_lvm_ioctl)
 HANDLE_IOCTL(LV_REMOVE, do_lvm_ioctl)
 HANDLE_IOCTL(LV_EXTEND, do_lvm_ioctl)
 HANDLE_IOCTL(LV_REDUCE, do_lvm_ioctl)
+HANDLE_IOCTL(LV_RENAME, do_lvm_ioctl)
 HANDLE_IOCTL(LV_STATUS_BYNAME, do_lvm_ioctl)
 HANDLE_IOCTL(LV_STATUS_BYINDEX, do_lvm_ioctl)
-HANDLE_IOCTL(LE_REMAP, do_lvm_ioctl)
+HANDLE_IOCTL(LV_STATUS_BYDEV, do_lvm_ioctl)
 HANDLE_IOCTL(PV_CHANGE, do_lvm_ioctl)
 HANDLE_IOCTL(PV_STATUS, do_lvm_ioctl)
 #endif /* LVM */

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [parisc-linux] Probleme while compiling last CVS kernel.
@ 2002-06-06 12:44 Bruno Vidal
  2002-06-06 13:00 ` Patrick Caulfield
  0 siblings, 1 reply; 12+ messages in thread
From: Bruno Vidal @ 2002-06-06 12:44 UTC (permalink / raw)
  To: parisc-linux@lists.parisc-linux.org

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

	Hi
I've started this morning to download latest CVS bits.
I've prepared a patche for this version from my dump driver,
and try to recompile everything, but I've found a problem
with LVM !!! See:
make dep: okay
make vmlinux:
ioctl32.c:2009: warning: assignment makes pointer from integer without a cast
ioctl32.c:2030: structure has no member named `inode'
ioctl32.c:2049: warning: passing arg 2 of `lcopy_from_user' makes pointer from integer without a cast
ioctl32.c:2067: structure has no member named `inode'
ioctl32.c:2078: warning: passing arg 2 of `lcopy_from_user' makes pointer from integer without a cast
ioctl32.c:2082: warning: assignment makes integer from pointer without a cast
ioctl32.c:2086: structure has no member named `inode'
ioctl32.c:1985: warning: `v' might be used uninitialized in this function 

-> in this file it is:
	v->pv[i]->pe = NULL; v->pv[i]->inode = NULL;
and
	p.pe = NULL; p.inode = NULL; 

It complains that there is no "inode" in structure pv[i].
So in this line v is a struct vg_t. In this structure
pv[i] is a pv_t structure, I've found this struture in
include/linux/lvm.h, and it is right, there is no "inode", 
in it !!!! Is this LVM code broken ?

typedef struct pv_v2 {
        char id[2];             /* Identifier */
        unsigned short version; /* HM lvm version */
        lvm_disk_data_t pv_on_disk;
        lvm_disk_data_t vg_on_disk;
        lvm_disk_data_t pv_uuidlist_on_disk;
        lvm_disk_data_t lv_on_disk;
        lvm_disk_data_t pe_on_disk;
        char pv_name[NAME_LEN];
        char vg_name[NAME_LEN];
        char system_id[NAME_LEN];       /* for vgexport/vgimport */
        kdev_t pv_dev;
        uint pv_number;
        uint pv_status;
        uint pv_allocatable;
        uint pv_size;           /* HM */
        uint lv_cur;
        uint pe_size;
        uint pe_total;
        uint pe_allocated;
        uint pe_stale;          /* for future use */
        pe_disk_t *pe;          /* HM */
        struct block_device *bd;
        char pv_uuid[UUID_LEN+1];

#ifndef __KERNEL__
        uint32_t pe_start;      /* in sectors */
#endif
} pv_t;
   
-- 
	Vidal Bruno, (770-4271)
        SSD-HA Team, HP-UX & LINUX Support
	bruno_vidal@admin.france.hp.com

[-- Attachment #2: Card for Bruno Vidal --]
[-- Type: text/x-vcard, Size: 386 bytes --]

begin:vcard 
n:Bruno;VIDAL
tel;fax:01-69-82-60-14
tel;work:01-69-29-42-71
x-mozilla-html:TRUE
url:www.france.hp.com
org:Solution Center
version:2.1
email;internet:bruno_vidal@hp.com
title:Expert Logiciel Environnement Haute Disponibilité
adr;quoted-printable:;;HP France=0D=0A;Z.A de Courtaboeuf;1 Av. du Canada;91947 Les Ulis cedex;France
x-mozilla-cpt:;26208
fn:VIDAL Bruno
end:vcard

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

end of thread, other threads:[~2002-06-07 18:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-07 15:31 [parisc-linux] Probleme while compiling last CVS kernel joel.soete
2002-06-07 18:24 ` Patrick Caulfield
  -- strict thread matches above, loose matches on Subject: below --
2002-06-06 12:44 Bruno Vidal
2002-06-06 13:00 ` Patrick Caulfield
2002-06-06 18:34   ` joel.soete
2002-06-06 18:43     ` Patrick Caulfield
2002-06-07  6:05       ` joel.soete
2002-06-07  7:16         ` joel.soete
2002-06-07  7:24         ` Patrick Caulfield
2002-06-07  7:28         ` joel.soete
2002-06-07  7:34           ` Patrick Caulfield
2002-06-07  7:39             ` joel.soete

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox