Re: any chance we could dump the 64k subdirectory limit before 2.4 ships?

From: Andries Brouwer (aeb@veritas.com)
Date: Sat May 27 2000 - 06:38:05 EST


On Fri, May 26, 2000 at 09:07:58PM -0400, Alexander Viro wrote:

> Look: there are other good reasons to change struct stat and I'm not too
> happy about doing it in $BIGNUM steps, each resulting in new triple of
> syscalls. If we are going to do that at all we'ld better do it at once.

Yes, there are many reasons to change struct stat,
and it is unlikely that we can do it all at once.
But we only need 3 more syscalls once - they'll suffice forever.

An old patch of mine (part of the "larger dev_t" suite) goes like
...
+typedef int (*cp_stat_fn)(struct inode *, void *);
+
 /*
- * For backward compatibility? Maybe this should be moved
- * into arch/i386 instead?
+ * This struct once had a field statbuf_size for verify_area().
+ * Let's leave it a struct - it may grow again.
+ *
+ * Version 0 is oldstat - it has been obsolete since 0.96b, and
+ * there has been a printk
+ * "Warning: %s using old stat() call. Recompile your binary."
+ * since 0.99pl7 - time to remove it altogether.
  */
-asmlinkage int sys_stat(char * filename, struct __old_kernel_stat * statbuf)
+static struct {
+ cp_stat_fn cp_stat;
+} stat_versions[] = {
+ { (cp_stat_fn) 0 }, /* 0 */
+ { (cp_stat_fn) cp_new_stat }, /* 1 */
+ { (cp_stat_fn) cp_lldev_stat } /* 2 */
+};
+
+asmlinkage int sys_versioned_stat(unsigned int version,
+ char * filename, void * statbuf)
 {
        struct inode * inode;
+ cp_stat_fn fn;
        int error;

        lock_kernel();
+
+ error = -EINVAL;
+ if (version >= SIZE(stat_versions) ||
+ !(fn = stat_versions[version].cp_stat))
+ goto out;
+
        error = namei(filename,&inode);
        if (error)
                goto out;
+
        if ((error = do_revalidate(inode)) == 0)
- error = cp_old_stat(inode,statbuf);
+ error = (*fn)(inode,statbuf);
        iput(inode);
 out:
        unlock_kernel();
        return error;
 }

In other words, the new syscalls sys_versioned_{,l,f}stat
have as first argument a version, and we can slowly
remove the oldest versions while adding new versions.
[The 1995 version of this patch still had cp_old_stat,
the above 1997 version has 0 instead.]

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:17 EST