Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs set mp->mnt_stat.f_namemax on filesystem mount for us...



details:   https://anonhg.NetBSD.org/src/rev/7d2bbdbedb64
branches:  trunk
changeset: 569923:7d2bbdbedb64
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Sep 13 19:25:48 2004 +0000

description:
set mp->mnt_stat.f_namemax on filesystem mount for use by statvfs, and use
the value for also pathconf(_PC_NAME_MAX) to keep the two in sync

diffstat:

 sys/fs/adosfs/adosfs.h              |   7 +++++--
 sys/fs/adosfs/advfsops.c            |  11 ++++++-----
 sys/fs/adosfs/advnops.c             |  12 +++++++++---
 sys/fs/cd9660/cd9660_vfsops.c       |   6 ++++--
 sys/fs/filecorefs/filecore_vfsops.c |   5 +++--
 sys/fs/filecorefs/filecore_vnops.c  |   6 +++---
 sys/fs/msdosfs/msdosfs_vfsops.c     |  17 ++++++++++++-----
 sys/fs/msdosfs/msdosfs_vnops.c      |   7 +++----
 sys/fs/ntfs/ntfs_vfsops.c           |   5 +++--
 sys/fs/ntfs/ntfs_vnops.c            |   6 +++---
 sys/fs/smbfs/smbfs_vfsops.c         |   8 ++++----
 sys/fs/smbfs/smbfs_vnops.c          |   8 +++-----
 12 files changed, 58 insertions(+), 40 deletions(-)

diffs (truncated from 405 to 300 lines):

diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/adosfs/adosfs.h
--- a/sys/fs/adosfs/adosfs.h    Mon Sep 13 19:19:44 2004 +0000
+++ b/sys/fs/adosfs/adosfs.h    Mon Sep 13 19:25:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adosfs.h,v 1.3 2004/05/20 06:34:26 atatat Exp $        */
+/*     $NetBSD: adosfs.h,v 1.4 2004/09/13 19:25:48 jdolecek Exp $      */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -60,6 +60,9 @@
 
 enum anode_type { AROOT, ADIR, AFILE, ALDIR, ALFILE, ASLINK };
 
+/* Maximum file/directory name */
+#define ADMAXNAMELEN           30
+
 /* 
  * similar to inode's, we use to represent:
  * the root dir, reg dirs, reg files and extension blocks
@@ -70,7 +73,7 @@
        struct genfs_node gnode;
        LIST_ENTRY(anode) link;
        enum anode_type type;
-       char name[31];          /* (r/d/f) name for object */
+       char name[ADMAXNAMELEN+1];      /* (r/d/f) name for object */
        struct datestamp mtimev;        /* (r) volume modified */
        struct datestamp created;       /* (r) volume created */
        struct datestamp mtime; /* (r/d/f) last modified */
diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/adosfs/advfsops.c
--- a/sys/fs/adosfs/advfsops.c  Mon Sep 13 19:19:44 2004 +0000
+++ b/sys/fs/adosfs/advfsops.c  Mon Sep 13 19:25:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advfsops.c,v 1.17 2004/05/25 14:54:56 hannken Exp $    */
+/*     $NetBSD: advfsops.c,v 1.18 2004/09/13 19:25:48 jdolecek Exp $   */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.17 2004/05/25 14:54:56 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.18 2004/09/13 19:25:48 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -258,9 +258,10 @@
        amp->devvp = devvp;
        
        mp->mnt_data = amp;
-        mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)devvp->v_rdev;
-        mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_ADOSFS);
-        mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
+       mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)devvp->v_rdev;
+       mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_ADOSFS);
+       mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
+       mp->mnt_stat.f_namemax = ADMAXNAMLEN;
        mp->mnt_fs_bshift = ffs(amp->bsize) - 1;
        mp->mnt_dev_bshift = DEV_BSHIFT;        /* XXX */
        mp->mnt_flag |= MNT_LOCAL;
diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/adosfs/advnops.c
--- a/sys/fs/adosfs/advnops.c   Mon Sep 13 19:19:44 2004 +0000
+++ b/sys/fs/adosfs/advnops.c   Mon Sep 13 19:25:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advnops.c,v 1.10 2004/05/04 13:26:58 jrf Exp $ */
+/*     $NetBSD: advnops.c,v 1.11 2004/09/13 19:25:48 jdolecek Exp $    */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.10 2004/05/04 13:26:58 jrf Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.11 2004/09/13 19:25:48 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -606,7 +606,7 @@
        u_short reclen;
        char    type;
        char    namlen;
-       char    name[32];       /* maxlen of 30 plus 2 NUL's */
+       char    name[ADMAXNAMELEN+2];   /* maxlen plus 2 NUL's */
 };
        
 int 
@@ -932,6 +932,12 @@
        case _PC_LINK_MAX:
                *sp->a_retval = LINK_MAX;
                return (0);
+       case _PC_NAME_MAX:
+               *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_namemax;
+               return (0);
+       case _PC_PATH_MAX:
+               *ap->a_retval = PATH_MAX;
+               return (0);
        case _PC_PIPE_BUF:
                *sp->a_retval = PIPE_BUF;
                return (0);
diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/cd9660/cd9660_vfsops.c
--- a/sys/fs/cd9660/cd9660_vfsops.c     Mon Sep 13 19:19:44 2004 +0000
+++ b/sys/fs/cd9660/cd9660_vfsops.c     Mon Sep 13 19:25:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vfsops.c,v 1.17 2004/08/15 07:19:54 mycroft Exp $       */
+/*     $NetBSD: cd9660_vfsops.c,v 1.18 2004/09/13 19:25:48 jdolecek Exp $      */
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.17 2004/08/15 07:19:54 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.18 2004/09/13 19:25:48 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -63,6 +63,7 @@
 #include <sys/pool.h>
 #include <sys/stat.h>
 #include <sys/conf.h>
+#include <sys/dirent.h>
 
 #include <fs/cd9660/iso.h>
 #include <fs/cd9660/cd9660_extern.h>
@@ -421,6 +422,7 @@
        mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)dev;
        mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_CD9660);
        mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
+       mp->mnt_stat.f_namemax = MAXNAMLEN;
        mp->mnt_flag |= MNT_LOCAL;
        mp->mnt_dev_bshift = iso_bsize;
        mp->mnt_fs_bshift = isomp->im_bshift;
diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/filecorefs/filecore_vfsops.c
--- a/sys/fs/filecorefs/filecore_vfsops.c       Mon Sep 13 19:19:44 2004 +0000
+++ b/sys/fs/filecorefs/filecore_vfsops.c       Mon Sep 13 19:25:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_vfsops.c,v 1.15 2004/08/15 07:19:54 mycroft Exp $     */
+/*     $NetBSD: filecore_vfsops.c,v 1.16 2004/09/13 19:25:48 jdolecek Exp $    */
 
 /*-
  * Copyright (c) 1994 The Regents of the University of California.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.15 2004/08/15 07:19:54 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.16 2004/09/13 19:25:48 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -371,6 +371,7 @@
        mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)dev;
        mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_FILECORE);
        mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
+       mp->mnt_stat.f_namemax = 10;
        mp->mnt_flag |= MNT_LOCAL;
        mp->mnt_dev_bshift = fcdr->log2secsize;
        mp->mnt_fs_bshift = fcmp->log2bsize;
diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/filecorefs/filecore_vnops.c
--- a/sys/fs/filecorefs/filecore_vnops.c        Mon Sep 13 19:19:44 2004 +0000
+++ b/sys/fs/filecorefs/filecore_vnops.c        Mon Sep 13 19:25:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_vnops.c,v 1.9 2004/05/12 02:07:38 jrf Exp $   */
+/*     $NetBSD: filecore_vnops.c,v 1.10 2004/09/13 19:25:48 jdolecek Exp $     */
 
 /*-
  * Copyright (c) 1994 The Regents of the University of California.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.9 2004/05/12 02:07:38 jrf Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.10 2004/09/13 19:25:48 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -500,7 +500,7 @@
                *ap->a_retval = 1;
                return (0);
        case _PC_NAME_MAX:
-               *ap->a_retval = 10;
+               *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_namemax;
                return (0);
        case _PC_PATH_MAX:
                *ap->a_retval = 256;
diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c   Mon Sep 13 19:19:44 2004 +0000
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c   Mon Sep 13 19:25:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vfsops.c,v 1.19 2004/06/27 06:55:12 jdolecek Exp $     */
+/*     $NetBSD: msdosfs_vfsops.c,v 1.20 2004/09/13 19:25:48 jdolecek Exp $     */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.19 2004/06/27 06:55:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.20 2004/09/13 19:25:48 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -81,6 +81,9 @@
 #include <fs/msdosfs/msdosfsmount.h>
 #include <fs/msdosfs/fat.h>
 
+#define MSDOSFS_NAMEMAX(pmp) \
+       (pmp)->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12
+
 int msdosfs_mountroot __P((void));
 int msdosfs_mount __P((struct mount *, const char *, void *,
     struct nameidata *, struct proc *));
@@ -176,6 +179,9 @@
                        vput(rootvp);
                }
        }
+
+       mp->mnt_stat.f_namemax = MSDOSFS_NAMEMAX(pmp);
+
        return 0;
 }
 
@@ -739,9 +745,10 @@
        else
                pmp->pm_fmod = 1;
        mp->mnt_data = pmp;
-        mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)dev;
-        mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_MSDOS);
-        mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
+       mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)dev;
+       mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_MSDOS);
+       mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
+       mp->mnt_stat.f_namemax = MSDOSFS_NAMEMAX(pmp);
        mp->mnt_flag |= MNT_LOCAL;
        mp->mnt_dev_bshift = pmp->pm_bnshift;
        mp->mnt_fs_bshift = pmp->pm_cnshift;
diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/msdosfs/msdosfs_vnops.c
--- a/sys/fs/msdosfs/msdosfs_vnops.c    Mon Sep 13 19:19:44 2004 +0000
+++ b/sys/fs/msdosfs/msdosfs_vnops.c    Mon Sep 13 19:25:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vnops.c,v 1.11 2004/05/12 02:07:38 jrf Exp $   */
+/*     $NetBSD: msdosfs_vnops.c,v 1.12 2004/09/13 19:25:48 jdolecek Exp $      */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.11 2004/05/12 02:07:38 jrf Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.12 2004/09/13 19:25:48 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1817,14 +1817,13 @@
                int a_name;
                register_t *a_retval;
        } */ *ap = v;
-       struct msdosfsmount *pmp = VTODE(ap->a_vp)->de_pmp;
 
        switch (ap->a_name) {
        case _PC_LINK_MAX:
                *ap->a_retval = 1;
                return (0);
        case _PC_NAME_MAX:
-               *ap->a_retval = pmp->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12;
+               *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_namemax;
                return (0);
        case _PC_PATH_MAX:
                *ap->a_retval = PATH_MAX;
diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/ntfs/ntfs_vfsops.c
--- a/sys/fs/ntfs/ntfs_vfsops.c Mon Sep 13 19:19:44 2004 +0000
+++ b/sys/fs/ntfs/ntfs_vfsops.c Mon Sep 13 19:25:48 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntfs_vfsops.c,v 1.24 2004/08/15 07:19:54 mycroft Exp $ */
+/*     $NetBSD: ntfs_vfsops.c,v 1.25 2004/09/13 19:25:48 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.24 2004/08/15 07:19:54 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.25 2004/09/13 19:25:48 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -620,6 +620,7 @@
        mp->mnt_stat.f_fsidx.__fsid_val[0] = dev;
        mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_NTFS);
        mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
+       mp->mnt_stat.f_namemax = NTFS_MAXFILENAME;
 #endif
        mp->mnt_flag |= MNT_LOCAL;
        devvp->v_specmountpoint = mp;
diff -r 45ae2f0d9fb3 -r 7d2bbdbedb64 sys/fs/ntfs/ntfs_vnops.c



Home | Main Index | Thread Index | Old Index