All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@transmeta.com>
To: ultralinux@vger.kernel.org
Subject: Re: 2.1.126 still no sparc64 autofsu
Date: Sun, 15 Nov 1998 23:49:21 +0000	[thread overview]
Message-ID: <marc-linux-ultrasparc-91118352418317@msgid-missing> (raw)
In-Reply-To: <marc-linux-ultrasparc-91107863319189@msgid-missing>

> 
> All of our userlands currently on sparc64 are 32-bit because we have
> not bootstrapped a 64-bit userland fully enough yet.
> 
> We have a full (sic) 32-64 bit translation layer for all user visible
> interfaces of the kernel already in files named
> arch/sparc64/kernel/*32*.c which are supposed to take care of all
> these issues.  Every once in a while an ioctl() or two slip by without
> our noticing and we have to take care of it when the user finally hits
> it.  :-)
> 

Problem is that autofs passes an "unsigned long" in the ioctl()
*argument*, not in a structure; also it passes data to the daemon via
a packetized protocol on a pipe.

Here is a patch that I think will help.  It should keep the protocol
unchanged on existing architectures (owing to the fact that
sizeof(int) = sizeof(long) on 32-bit machines) while letting SPARC
and MIPS (as far as I know the only hybrid 32/64-bit architectures)
run 32-bit binaries on a 64-bit kernel, using the fact that
sizeof(int) [32 bit] = sizeof(int) [64 bit]:

Please test this patch and give me feedback; if it works I'll pass it
on to Linus.

	-hpa

diff -ur stock/linux-2.1.128/fs/autofs/autofs_i.h linux-2.1.128-smp/fs/autofs/autofs_i.h
--- stock/linux-2.1.128/fs/autofs/autofs_i.h	Sun Nov 15 15:29:20 1998
+++ linux-2.1.128-smp/fs/autofs/autofs_i.h	Sun Nov 15 15:28:24 1998
@@ -66,9 +66,9 @@
 };
 
 struct autofs_wait_queue {
-	unsigned long wait_queue_token;
 	struct wait_queue *queue;
 	struct autofs_wait_queue *next;
+	autofs_wqt_t wait_queue_token;
 	/* We use the following to see what we are waiting for */
 	int hash;
 	int len;
@@ -79,8 +79,8 @@
 };
 
 struct autofs_symlink {
-	int len;
 	char *data;
+	int len;
 	time_t mtime;
 };
 
diff -ur stock/linux-2.1.128/fs/autofs/root.c linux-2.1.128-smp/fs/autofs/root.c
--- stock/linux-2.1.128/fs/autofs/root.c	Sun Nov 15 15:29:20 1998
+++ linux-2.1.128-smp/fs/autofs/root.c	Sun Nov 15 15:27:17 1998
@@ -112,7 +112,8 @@
 	if ( !(ent = autofs_hash_lookup(&sbi->dirhash, &dentry->d_name)) ) {
 		do {
 			if ( status && dentry->d_inode ) {
-				printk("autofs warning: lookup failure on positive dentry, status = %d, name = %s\n", status, dentry->d_name.name);
+				if ( status != -ENOENT )
+					printk("autofs warning: lookup failure on positive dentry, status = %d, name = %s\n", status, dentry->d_name.name);
 				return 0; /* Try to get the kernel to invalidate this dentry */
 			}
 
@@ -502,9 +503,9 @@
 	
 	switch(cmd) {
 	case AUTOFS_IOC_READY:	/* Wait queue: go ahead and retry */
-		return autofs_wait_release(sbi,arg,0);
+		return autofs_wait_release(sbi,(autofs_wqt_t)arg,0);
 	case AUTOFS_IOC_FAIL:	/* Wait queue: fail with ENOENT */
-		return autofs_wait_release(sbi,arg,-ENOENT);
+		return autofs_wait_release(sbi,(autofs_wqt_t)arg,-ENOENT);
 	case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */
 		autofs_catatonic_mode(sbi);
 		return 0;
diff -ur stock/linux-2.1.128/fs/autofs/waitq.c linux-2.1.128-smp/fs/autofs/waitq.c
--- stock/linux-2.1.128/fs/autofs/waitq.c	Sun Nov 15 15:29:20 1998
+++ linux-2.1.128-smp/fs/autofs/waitq.c	Sun Nov 15 15:26:17 1998
@@ -18,7 +18,7 @@
 
 /* We make this a static variable rather than a part of the superblock; it
    is better if we don't reassign numbers easily even across filesystems */
-static int autofs_next_wait_queue = 1;
+static autofs_wqt_t autofs_next_wait_queue = 1;
 
 /* These are the signals we allow interrupting a pending mount */
 #define SHUTDOWN_SIGS	(sigmask(SIGKILL) | sigmask(SIGINT) | sigmask(SIGQUIT))
@@ -168,7 +168,7 @@
 }
 
 
-int autofs_wait_release(struct autofs_sb_info *sbi, unsigned long wait_queue_token, int status)
+int autofs_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_token, int status)
 {
 	struct autofs_wait_queue *wq, **wql;
 
diff -ur stock/linux-2.1.128/include/linux/auto_fs.h linux-2.1.128-smp/include/linux/auto_fs.h
--- stock/linux-2.1.128/include/linux/auto_fs.h	Fri Oct 23 10:15:56 1998
+++ linux-2.1.128-smp/include/linux/auto_fs.h	Sun Nov 15 15:25:19 1998
@@ -22,6 +22,27 @@
 
 #define AUTOFS_PROTO_VERSION 3
 
+/*
+ * Architectures where both 32- and 64-bit binaries can be executed
+ * on 64-bit kernels need this.  This keeps the structure format
+ * uniform, and makes sure the wait_queue_token isn't too big to be
+ * passed back down to the kernel.
+ *
+ * This assumes that on these architectures:
+ * mode     32 bit    64 bit
+ * -------------------------
+ * int      32 bit    32 bit
+ * long     32 bit    64 bit
+ *
+ * If so, 32-bit user-space code should be backwards compatible.
+ */
+
+#if defined(__sparc__) || defined(__mips__)
+typedef unsigned int autofs_wqt_t;
+#else
+typedef unsigned long autofs_wqt_t;
+#endif
+
 enum autofs_packet_type {
 	autofs_ptype_missing,	/* Missing entry (mount request) */
 	autofs_ptype_expire,	/* Expire entry (umount request) */
@@ -34,7 +55,7 @@
 
 struct autofs_packet_missing {
 	struct autofs_packet_hdr hdr;
-        unsigned long wait_queue_token;
+        autofs_wqt_t wait_queue_token;
 	int len;
 	char name[NAME_MAX+1];
 };	

  parent reply	other threads:[~1998-11-15 23:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-14  8:17 2.1.126 still no sparc64 autofsu H. Peter Anvin
1998-11-14 15:45 ` Rich Sahlender
1998-11-14 19:53 ` Jakub Jelinek
1998-11-15  0:52 ` David S. Miller
1998-11-15 23:49 ` H. Peter Anvin [this message]
1998-11-15 23:54 ` David S. Miller
1998-11-16  6:47 ` H. Peter Anvin
1998-11-16  6:48 ` Jakub Jelinek
1998-11-16  7:57 ` Jakub Jelinek
1998-11-16  8:37 ` H. Peter Anvin
1998-11-16 20:33 ` Rich Sahlender

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=marc-linux-ultrasparc-91118352418317@msgid-missing \
    --to=hpa@transmeta.com \
    --cc=ultralinux@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.