Re: [UPDATE] sysutils/usmb

2017-12-12 Thread Helg
On Mon, Dec 11, 2017 at 12:02:43PM +, Stuart Henderson wrote:
> On 2017/12/11 19:40, Helg wrote:
> > usmb is another FUSE file system that doesn't implement mknod, which is
> > now mandatory on OpenBSD. Upstream has not been updated for a few years
> > so I've patched this operation in myself. It's not ideal because a new
> > file is created and then immediately closed and reopened when an
> > application calls open(2) with the O_CREAT flag. The best solution
> > would be to implement usmb_create as a no-op and to create and open the
> > file in usmb_open but the FUSE dictates that the O_CREAT flag is not
> > passed to the file system's open method.
> > 
> > There are no other changes.
> > 
> > ok?
> 
> You'll need to bump REVISION in ports/sysutils/usmb/Makefile.
> Otherwise ok sthen@.
> 
> Back story about the usmb port: it wasn't the nicest SMB FUSE
> implementation, but was the simplest to get working with OpenBSD's FUSE
> at the time. Now that's been improved, it might be worth looking at the
> other options again (SMBNetFS looks like a better option in general).

I've knocked together a quick port of SMBNetFS and it looks promising.
One of the nice things about usmb is that you mount an SMB share much
like you would NFS. SMBNetFS and others "mount" all visible shares on
the network indiscriminately. Having options to choose from is always
good though.

I've bumped REVISION and checked it in.

Thanks.



Re: [UPDATE] sysutils/usmb

2017-12-11 Thread Daniel Jakots
On Mon, 11 Dec 2017 20:24:48 -0500, Daniel Jakots 
wrote:

> usmb package is currently available (i.e. it's not broken) so you need
> to bump revision. I don't have any opinion on the patches.

meh, sthen had already answered but I filtered my mail too strictly to
look for diffs to review..



Re: [UPDATE] sysutils/usmb

2017-12-11 Thread Daniel Jakots
usmb package is currently available (i.e. it's not broken) so you need
to bump revision. I don't have any opinion on the patches.

On Mon, 11 Dec 2017 19:40:40 +0800, Helg 
wrote:

> usmb is another FUSE file system that doesn't implement mknod, which
> is now mandatory on OpenBSD. Upstream has not been updated for a few
> years so I've patched this operation in myself. It's not ideal
> because a new file is created and then immediately closed and
> reopened when an application calls open(2) with the O_CREAT flag. The
> best solution would be to implement usmb_create as a no-op and to
> create and open the file in usmb_open but the FUSE dictates that the
> O_CREAT flag is not passed to the file system's open method.
> 
> There are no other changes.
> 
> ok?
> 
> 
> Index: patches/patch-usmb_c
> ===
> RCS file: /cvs/ports/sysutils/usmb/patches/patch-usmb_c,v
> retrieving revision 1.2
> diff -u -p -u -p -r1.2 patch-usmb_c
> --- patches/patch-usmb_c  18 May 2017 21:27:47 -  1.2
> +++ patches/patch-usmb_c  9 Dec 2017 01:26:34 -
> @@ -2,6 +2,15 @@ $OpenBSD: patch-usmb_c,v 1.2 2017/05/18 
>  Index: usmb.c
>  --- usmb.c.orig
>  +++ usmb.c
> +@@ -141,7 +141,7 @@ static struct fuse_operations fuse_ops = {
> +   SET_ELEMENT (.getattr, usmb_getattr),
> +   SET_ELEMENT (.readlink, NULL),
> +   SET_ELEMENT (.getdir, NULL),
> +-  SET_ELEMENT (.mknod, NULL),
> ++  SET_ELEMENT (.mknod, usmb_mknod),
> +   SET_ELEMENT (.mkdir, usmb_mkdir),
> +   SET_ELEMENT (.unlink, usmb_unlink),
> +   SET_ELEMENT (.rmdir, usmb_rmdir),
>  @@ -315,8 +315,8 @@ int main (int argc, char **argv)
>   
> if (umount)
> Index: patches/patch-usmb_file_c
> ===
> RCS file: patches/patch-usmb_file_c
> diff -N patches/patch-usmb_file_c
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-usmb_file_c 9 Dec 2017 01:26:34 -
> @@ -0,0 +1,36 @@
> +$OpenBSD$
> +
> +Index: usmb_file.c
> +--- usmb_file.c.orig
>  usmb_file.c
> +@@ -202,6 +202,30 @@ int usmb_write (const char *filename UNUSED,
> const cha
> + }
> + 
> + 
> ++/* File systems must support mknod on OpenBSD */
> ++int usmb_mknod (const char *filename, mode_t mode,
> __attribute__((unused)) dev_t dev) ++{
> ++  char *url = make_url (filename);
> ++  if (NULL == url)
> ++return -ENOMEM;
> ++
> ++  if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode) ||
> S_ISSOCK(mode)) ++return -EPERM;
> ++
> ++  DEBUG (fprintf (stderr, "mknod (%s)", url));
> ++
> ++  SMBCFILE *file = smbc_getFunctionCreat (ctx) (ctx, url, mode);
> ++  DEBUG (fprintf (stderr, " = %p\n", (void *)file));
> ++  int ret = (NULL == file) ? -errno : 0;
> ++
> ++  /* File must not be open when mknod returns. */
> ++  if (ret == 0)
> ++smbc_getFunctionClose (ctx) (ctx, file);
> ++  free (url);
> ++  return ret;
> ++}
> ++
> ++
> + int usmb_create (const char *filename, mode_t mode, struct
> fuse_file_info *fi)
> + {
> +   char *url = make_url (filename);
> Index: patches/patch-usmb_file_h
> ===
> RCS file: patches/patch-usmb_file_h
> diff -N patches/patch-usmb_file_h
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-usmb_file_h 9 Dec 2017 01:26:34 -
> @@ -0,0 +1,13 @@
> +$OpenBSD$
> +
> +Index: usmb_file.h
> +--- usmb_file.h.orig
>  usmb_file.h
> +@@ -31,6 +31,7 @@
> +  struct fuse_file_info *fi);
> +   int usmb_write (const char *filename, const char *buff, size_t
> len, off_t off,
> +   struct fuse_file_info *fi);
> ++  int usmb_mknod (const char *filename, mode_t mode, dev_t dev);
> +   int usmb_create (const char *filename, mode_t mode,
> +struct fuse_file_info *fi);
> +   int usmb_rename (const char *from, const char *to);
> 
> 
> - End forwarded message -
> 



Re: [UPDATE] sysutils/usmb

2017-12-11 Thread Stuart Henderson
On 2017/12/11 19:40, Helg wrote:
> usmb is another FUSE file system that doesn't implement mknod, which is
> now mandatory on OpenBSD. Upstream has not been updated for a few years
> so I've patched this operation in myself. It's not ideal because a new
> file is created and then immediately closed and reopened when an
> application calls open(2) with the O_CREAT flag. The best solution
> would be to implement usmb_create as a no-op and to create and open the
> file in usmb_open but the FUSE dictates that the O_CREAT flag is not
> passed to the file system's open method.
> 
> There are no other changes.
> 
> ok?

You'll need to bump REVISION in ports/sysutils/usmb/Makefile.
Otherwise ok sthen@.

Back story about the usmb port: it wasn't the nicest SMB FUSE
implementation, but was the simplest to get working with OpenBSD's FUSE
at the time. Now that's been improved, it might be worth looking at the
other options again (SMBNetFS looks like a better option in general).



[UPDATE] sysutils/usmb

2017-12-11 Thread Helg
usmb is another FUSE file system that doesn't implement mknod, which is
now mandatory on OpenBSD. Upstream has not been updated for a few years
so I've patched this operation in myself. It's not ideal because a new
file is created and then immediately closed and reopened when an
application calls open(2) with the O_CREAT flag. The best solution
would be to implement usmb_create as a no-op and to create and open the
file in usmb_open but the FUSE dictates that the O_CREAT flag is not
passed to the file system's open method.

There are no other changes.

ok?


Index: patches/patch-usmb_c
===
RCS file: /cvs/ports/sysutils/usmb/patches/patch-usmb_c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-usmb_c
--- patches/patch-usmb_c18 May 2017 21:27:47 -  1.2
+++ patches/patch-usmb_c9 Dec 2017 01:26:34 -
@@ -2,6 +2,15 @@ $OpenBSD: patch-usmb_c,v 1.2 2017/05/18 
 Index: usmb.c
 --- usmb.c.orig
 +++ usmb.c
+@@ -141,7 +141,7 @@ static struct fuse_operations fuse_ops = {
+   SET_ELEMENT (.getattr, usmb_getattr),
+   SET_ELEMENT (.readlink, NULL),
+   SET_ELEMENT (.getdir, NULL),
+-  SET_ELEMENT (.mknod, NULL),
++  SET_ELEMENT (.mknod, usmb_mknod),
+   SET_ELEMENT (.mkdir, usmb_mkdir),
+   SET_ELEMENT (.unlink, usmb_unlink),
+   SET_ELEMENT (.rmdir, usmb_rmdir),
 @@ -315,8 +315,8 @@ int main (int argc, char **argv)
  
if (umount)
Index: patches/patch-usmb_file_c
===
RCS file: patches/patch-usmb_file_c
diff -N patches/patch-usmb_file_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-usmb_file_c   9 Dec 2017 01:26:34 -
@@ -0,0 +1,36 @@
+$OpenBSD$
+
+Index: usmb_file.c
+--- usmb_file.c.orig
 usmb_file.c
+@@ -202,6 +202,30 @@ int usmb_write (const char *filename UNUSED, const cha
+ }
+ 
+ 
++/* File systems must support mknod on OpenBSD */
++int usmb_mknod (const char *filename, mode_t mode, __attribute__((unused)) 
dev_t dev)
++{
++  char *url = make_url (filename);
++  if (NULL == url)
++return -ENOMEM;
++
++  if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode) || S_ISSOCK(mode))
++return -EPERM;
++
++  DEBUG (fprintf (stderr, "mknod (%s)", url));
++
++  SMBCFILE *file = smbc_getFunctionCreat (ctx) (ctx, url, mode);
++  DEBUG (fprintf (stderr, " = %p\n", (void *)file));
++  int ret = (NULL == file) ? -errno : 0;
++
++  /* File must not be open when mknod returns. */
++  if (ret == 0)
++smbc_getFunctionClose (ctx) (ctx, file);
++  free (url);
++  return ret;
++}
++
++
+ int usmb_create (const char *filename, mode_t mode, struct fuse_file_info *fi)
+ {
+   char *url = make_url (filename);
Index: patches/patch-usmb_file_h
===
RCS file: patches/patch-usmb_file_h
diff -N patches/patch-usmb_file_h
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-usmb_file_h   9 Dec 2017 01:26:34 -
@@ -0,0 +1,13 @@
+$OpenBSD$
+
+Index: usmb_file.h
+--- usmb_file.h.orig
 usmb_file.h
+@@ -31,6 +31,7 @@
+  struct fuse_file_info *fi);
+   int usmb_write (const char *filename, const char *buff, size_t len, off_t 
off,
+   struct fuse_file_info *fi);
++  int usmb_mknod (const char *filename, mode_t mode, dev_t dev);
+   int usmb_create (const char *filename, mode_t mode,
+struct fuse_file_info *fi);
+   int usmb_rename (const char *from, const char *to);


- End forwarded message -