[prev in list] [next in list] [prev in thread] [next in thread]
List: fuse-devel
Subject: Re: [fuse-devel] Creation (birth) timestamp support on FreeBSD (TAKE 2)
From: Miklos Szeredi <miklos () szeredi ! hu>
Date: 2013-09-23 14:24:01
Message-ID: 20130923142401.GB17299 () tucsk ! piliscsaba ! szeredi ! hu
[Download RAW message or body]
On Sat, Jul 20, 2013 at 04:30:07PM -0500, giffunip@tutopia.com wrote:
> On Fri, 19 Jul 2013 14:24:37 -0500, Pedro Giffuni wrote:
> >Hello;
> >
> >Here is a patch to support creation timestamps in FreeBSD.
> >This is made for compatibility with MacFUSE and should be
> >pretty similar in NetBSD.
> >
>
> Here is a cleaned up patch. It completely avoids hacking the
> structures in ugly ways. I also used some unused fields when
> possible. It should be very easy to adapt for other OSs and
> it should be useful in a future for linux too.
Comments inline.
>
> best regards,
>
> Pedro.
>
> ps. I assume you want this under LGPLv2 or later but you have
> my permission to use it in the future under any opensource
> license you want.
> --- include/fuse_kernel.h.orig 2013-07-01 02:40:39.000000000 -0500
> +++ include/fuse_kernel.h 2013-07-20 16:05:30.000000000 -0500
> @@ -143,7 +143,8 @@
> __u32 gid;
> __u32 rdev;
> __u32 blksize;
> - __u32 padding;
> + __u32 crtimensec;
> + __u64 crtime;
> };
>
> struct fuse_kstatfs {
> @@ -331,7 +332,7 @@
> /* The read buffer is required to be at least 8k, but may be much larger */
> #define FUSE_MIN_READ_BUFFER 8192
>
> -#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
> +#define FUSE_COMPAT_ENTRY_OUT_SIZE 128
No, you need another compatibility size. And a new minor version. And the
changes documented in the protocol changelog.
>
> struct fuse_entry_out {
> __u64 nodeid; /* Inode ID */
> @@ -364,7 +365,7 @@
> __u64 fh;
> };
>
> -#define FUSE_COMPAT_ATTR_OUT_SIZE 96
> +#define FUSE_COMPAT_ATTR_OUT_SIZE 104
>
> struct fuse_attr_out {
> __u64 attr_valid; /* Cache timeout for the attributes */
> @@ -403,10 +404,10 @@
> __u64 lock_owner;
> __u64 atime;
> __u64 mtime;
> - __u64 unused2;
> + __u64 crtime;
You can *set* birthtime? Seems wrong.
Thanks,
Miklos
> __u32 atimensec;
> __u32 mtimensec;
> - __u32 unused3;
> + __u32 crtimensec;
> __u32 mode;
> __u32 unused4;
> __u32 uid;
> --- lib/fuse_lowlevel.c.orig 2013-07-01 02:40:39.000000000 -0500
> +++ lib/fuse_lowlevel.c 2013-07-20 16:14:34.000000000 -0500
> @@ -67,9 +67,15 @@
> attr->atime = stbuf->st_atime;
> attr->mtime = stbuf->st_mtime;
> attr->ctime = stbuf->st_ctime;
> +#ifdef __FreeBSD__
> + attr->crtime = stbuf->st_birthtime;
> +#endif
> attr->atimensec = ST_ATIM_NSEC(stbuf);
> attr->mtimensec = ST_MTIM_NSEC(stbuf);
> attr->ctimensec = ST_CTIM_NSEC(stbuf);
> +#ifdef __FreeBSD__
> + attr->crtimensec= ST_CRTIM_NSEC(stbuf);
> +#endif
> }
>
> static void convert_attr(const struct fuse_setattr_in *attr, struct stat *stbuf)
> @@ -80,6 +86,10 @@
> stbuf->st_size = attr->size;
> stbuf->st_atime = attr->atime;
> stbuf->st_mtime = attr->mtime;
> +#ifdef __FreeBSD__
> + stbuf->st_birthtime = attr->crtime;
> + ST_CRTIM_NSEC_SET(stbuf, attr->crtimensec);
> +#endif
> ST_ATIM_NSEC_SET(stbuf, attr->atimensec);
> ST_MTIM_NSEC_SET(stbuf, attr->mtimensec);
> }
> --- lib/fuse_misc.h.orig 2013-07-01 02:40:39.000000000 -0500
> +++ lib/fuse_misc.h 2013-07-20 16:08:37.000000000 -0500
> @@ -41,8 +41,12 @@
> #define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtim.tv_nsec)
> #define ST_ATIM_NSEC_SET(stbuf, val) (stbuf)->st_atim.tv_nsec = (val)
> #define ST_MTIM_NSEC_SET(stbuf, val) (stbuf)->st_mtim.tv_nsec = (val)
> +#ifdef __FreeBSD__
> +#define ST_CRTIM_NSEC(stbuf) ((stbuf)->st_birthtim.tv_nsec)
> +#define ST_CRTIM_NSEC_SET(stbuf, val) (stbuf)->st_birthtim.tv_nsec = (val)
> +#endif
> #elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC)
> -/* FreeBSD */
> +/* Older BSD ? */
> #define ST_ATIM_NSEC(stbuf) ((stbuf)->st_atimespec.tv_nsec)
> #define ST_CTIM_NSEC(stbuf) ((stbuf)->st_ctimespec.tv_nsec)
> #define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtimespec.tv_nsec)
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> fuse-devel mailing list
> fuse-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fuse-devel
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
fuse-devel mailing list
fuse-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fuse-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic