Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/mount_portal We need to provide a size for getattr for ...
details: https://anonhg.NetBSD.org/src/rev/dd7a218f0728
branches: trunk
changeset: 353532:dd7a218f0728
user: christos <christos%NetBSD.org@localhost>
date: Wed May 10 16:35:18 2017 +0000
description:
We need to provide a size for getattr for the cp example to work, so cheat
and use fstat() to do it instead of libpuffs.
diffstat:
sbin/mount_portal/puffs_portal.c | 57 +++++++++++++++++++++++++++++----------
1 files changed, 42 insertions(+), 15 deletions(-)
diffs (80 lines):
diff -r 8466463136e2 -r dd7a218f0728 sbin/mount_portal/puffs_portal.c
--- a/sbin/mount_portal/puffs_portal.c Wed May 10 13:58:25 2017 +0000
+++ b/sbin/mount_portal/puffs_portal.c Wed May 10 16:35:18 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_portal.c,v 1.8 2017/05/09 21:17:54 christos Exp $ */
+/* $NetBSD: puffs_portal.c,v 1.9 2017/05/10 16:35:18 christos Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: puffs_portal.c,v 1.8 2017/05/09 21:17:54 christos Exp $");
+__RCSID("$NetBSD: puffs_portal.c,v 1.9 2017/05/10 16:35:18 christos Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -550,21 +550,48 @@
va->va_type = VDIR;
va->va_mode = 0777;
va->va_nlink = 2;
+ va->va_uid = va->va_gid = 0;
+ va->va_fileid = fakeid++;
+ va->va_size = va->va_bytes = 0;
+ va->va_gen = 0;
+ va->va_rdev = PUFFS_VNOVAL;
+ va->va_blocksize = DEV_BSIZE;
+
+ gettimeofday(&tv, NULL);
+ TIMEVAL_TO_TIMESPEC(&tv, &ts);
+ va->va_atime = va->va_ctime = va->va_mtime =
+ va->va_birthtime = ts;
} else {
- va->va_type = VREG;
- va->va_mode = 0666;
- va->va_nlink = 1;
+ /* cheat for now */
+ int error;
+ struct stat st;
+ struct portal_node *portn = opc;
+ struct portal_cred portc;
+ char **v = conf_match(&q, portn->path);
+ if (v == NULL)
+ return ENOENT;
+ credtr(&portc, pcr, 0777);
+ error = provide(pu, portn, &portc, v);
+ if (error)
+ return error;
+ if (fstat(portn->fd, &st) == -1)
+ return errno;
+ va->va_type = S_ISDIR(st.st_mode) ? VDIR : VREG; /* XXX */
+ va->va_mode = st.st_mode;
+ va->va_nlink = st.st_nlink;
+ va->va_uid = st.st_uid;
+ va->va_gid = st.st_gid;
+ va->va_fileid = st.st_ino;
+ va->va_size = va->va_bytes = st.st_size;
+ va->va_gen = 0;
+ va->va_rdev = st.st_rdev;
+ va->va_blocksize = st.st_blksize;
+ va->va_atime = st.st_atim;
+ va->va_ctime = st.st_ctim;
+ va->va_mtime = st.st_mtim;
+ va->va_birthtime = st.st_birthtim;
+ portal_node_reclaim(pu, opc);
}
- va->va_uid = va->va_gid = 0;
- va->va_fileid = fakeid++;
- va->va_size = va->va_bytes = 0;
- va->va_gen = 0;
- va->va_rdev = PUFFS_VNOVAL;
- va->va_blocksize = DEV_BSIZE;
-
- gettimeofday(&tv, NULL);
- TIMEVAL_TO_TIMESPEC(&tv, &ts);
- va->va_atime = va->va_ctime = va->va_mtime = va->va_birthtime = ts;
return 0;
}
Home |
Main Index |
Thread Index |
Old Index