summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2000-12-27 00:26:21 +0000
committerRoland McGrath <roland@gnu.org>2000-12-27 00:26:21 +0000
commit7a8f1284789ee9ded7ab0f2ee1921a35ed9ea255 (patch)
tree061f0ef907418cd9dfd4fc9d5003f4f56ec7cdeb
parent15df16bf8667f96364265f7bd80f4c338daffa87 (diff)
2000-12-26 Roland McGrath <roland@frob.com>
* file-statfs.c (diskfs_S_file_statfs): Zero out the struct statfs before calling diskfs_set_statfs. Set f_namelen to diskfs_name_max after the call. * diskfs.h: Update comment.
-rw-r--r--libdiskfs/diskfs.h6
-rw-r--r--libdiskfs/file-statfs.c9
2 files changed, 11 insertions, 4 deletions
diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h
index e8974a11..d0c745f6 100644
--- a/libdiskfs/diskfs.h
+++ b/libdiskfs/diskfs.h
@@ -212,7 +212,7 @@ extern int diskfs_name_max;
If this is exceeded, dir_pathtrans will return ELOOP. */
extern int diskfs_maxsymlinks;
-/* This variable is defined by diskfs; the suer should set it if
+/* This variable is defined by diskfs; the user should set it if
the filesystem media cannot be made writeable. */
extern int diskfs_hard_readonly;
@@ -270,7 +270,9 @@ extern int diskfs_default_sync_interval;
extern char *diskfs_disk_name;
/* The user must define this function. Set *STATFSBUF with
- appropriate values to reflect the current state of the filesystem. */
+ appropriate values to reflect the current state of the filesystem.
+ The buffer will be initialized to all zeros by the caller;
+ the caller will set f_namelen to diskfs_name_max. */
error_t diskfs_set_statfs (fsys_statfsbuf_t *statfsbuf);
/* The user must define this function. Lookup in directory DP (which
diff --git a/libdiskfs/file-statfs.c b/libdiskfs/file-statfs.c
index ff26819f..62eaf67b 100644
--- a/libdiskfs/file-statfs.c
+++ b/libdiskfs/file-statfs.c
@@ -1,5 +1,5 @@
/* libdiskfs implementation of fs.defs: file_statfs
- Copyright (C) 1992, 1993, 1994, 1998 Free Software Foundation
+ Copyright (C) 1992,93,94,98,2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -28,7 +28,10 @@ diskfs_S_file_statfs (struct protid *file,
if (!file)
return EOPNOTSUPP;
- statbuf->f_flag = 0;
+ /* Start will all zeros, so the fs can skip fields for which
+ it has no information to contribute. */
+ bzero (statbuf, sizeof *statbuf);
+
if (diskfs_readonly)
statbuf->f_flag |= ST_RDONLY;
if (_diskfs_nosuid)
@@ -40,5 +43,7 @@ diskfs_S_file_statfs (struct protid *file,
diskfs_set_statfs (statbuf);
+ statbuf->f_namelen = diskfs_name_max;
+
return 0;
}