Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Samba] Howto determine flags like readonly and readwrite.

52 views
Skip to first unread message

Stef Bon

unread,
Feb 5, 2010, 10:10:02 AM2/5/10
to
Hello,

I'm writing a fuse module (fuse-wokspace-union) which makes local (USB) and remote (FTP, SMB, and SSH and maybe IPX(netware)) resources available in
a map
in the homedirectory of the user.

Look for more information my website:

http://linux.bononline.nl/linux/create_workspace/index.php
http://linux.bononline.nl/linux/mount.md5key/index.php
http://linux.bononline.nl/linux/fuse-workspace/index.php

The fusemodule creates a bridge between the actual mountpoints (which are managed by autofs, this does the actual mounting) and the special
connectionsmap in the users homedirectory.

I've also made an entry at KDE Brainstorm:

http://forum.kde.org/brainstorm.php#idea84975

and added a question about it at the developers site:

http://forum.kde.org/viewtopic.php?f=18&t=85148


You may ask, it's all about tools for the workstation, and we are here at the samba maillist, which is for servers. You're right about that, but let me explain.
First it's maybe interesting for anyone to see that you can access samba shares this way, and I think it's very userfriendly.
(if it's technically optimal I do not know yet..)
Second I've been working on a tool which show information about resources used, apps using them and files and locks, just like smbstatus, and Ive a
question about it. It does works like

root [ ~/bin ]# ./mount.md5.status
Service User Security

smb://LFS20060812/sbon/ sbon private
/home/sbon/Workspace/Network/Windows\
Network/BONONLINE/LFS20060812/sbon
/test.odt
/opt/openoffice-3.1.1/program/soffice.bin-writer - 3492

I'm working on the format, maybe multiple sections like smbstatus would be nicer.
Smbstatus on the target machine gives:

smbstatus

Samba version 3.4.4
PID Username Group Machine
-------------------------------------------------------------------
7330 sbon netgroup 192.168.0.11 (192.168.0.11)

Service pid machine Connected at
-------------------------------------------------------
sbon 7330 192.168.0.11 Tue Jan 26 21:24:17 2010

Locked files:
Pid Uid DenyMode Access R/W Oplock
SharePath Name Time
--------------------------------------------------------------------------------------------------
7330 4000 DENY_NONE 0x83 RDWR NONE
/home/sbon test.odt Tue Jan 26 21:24:23 2010


My question is now, how can I determine the flags in human readable form, just like
smbstatus.
The pid of the application (here openoffice writer) is known, as well as the file/path to it.
I know where to look for info, /proc/<pidnr>/fdinfo/flags, but this gives a (hex?) number. Is this
the lock I'm looking for, and how can I translate it into terms like readonly, readwrite and exclusive.

Stef Bon
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba

Volker Lendecke

unread,
Feb 7, 2010, 10:00:02 AM2/7/10
to
On Fri, Feb 05, 2010 at 03:54:31PM +0100, Stef Bon wrote:
> My question is now, how can I determine the flags in human readable form, just like
> smbstatus.
> The pid of the application (here openoffice writer) is
> known, as well as the file/path to it.
> I know where to look for info, /proc/<pidnr>/fdinfo/flags,
> but this gives a (hex?) number. Is this
> the lock I'm looking for, and how can I translate it into
> terms like readonly, readwrite and exclusive.

You're on the same box as the smbd is, or on a different
one?

Volker

signature.asc

Stef Bon

unread,
Feb 7, 2010, 12:10:02 PM2/7/10
to

Different, I would say of course.
My construction is al about making connections from a workstation to a remote
server.

Stef
> Volker

Volker Lendecke

unread,
Feb 7, 2010, 5:30:02 PM2/7/10
to
On Sun, Feb 07, 2010 at 06:03:51PM +0100, Stef Bon wrote:
> On Sunday 07 February 2010 15:37:42 Volker Lendecke wrote:
> > On Fri, Feb 05, 2010 at 03:54:31PM +0100, Stef Bon wrote:
> > > My question is now, how can I determine the flags in human readable form,
> > > just like smbstatus.
> > > The pid of the application (here openoffice writer) is
> > > known, as well as the file/path to it.
> > > I know where to look for info, /proc/<pidnr>/fdinfo/flags,
> > > but this gives a (hex?) number. Is this
> > > the lock I'm looking for, and how can I translate it into
> > > terms like readonly, readwrite and exclusive.
> >
> > You're on the same box as the smbd is, or on a different
> > one?
> >
>
> Different, I would say of course.
> My construction is al about making connections from a workstation to a remote
> server.

Ok, then I did not fully understand what you want to
achieve. You quote smbstatus which is only available
locally where smbd is running. What kind of information do
you want to present where?

Stef Bon

unread,
Feb 8, 2010, 12:40:02 PM2/8/10
to
On Sunday 07 February 2010 23:19:15 Volker Lendecke wrote:
> On Sun, Feb 07, 2010 at 06:03:51PM +0100, Stef Bon wrote:
> > On Sunday 07 February 2010 15:37:42 Volker Lendecke wrote:
> > > On Fri, Feb 05, 2010 at 03:54:31PM +0100, Stef Bon wrote:
> > > > My question is now, how can I determine the flags in human readable
> > > > form, just like smbstatus.
> > > > The pid of the application (here openoffice writer) is
> > > > known, as well as the file/path to it.
> > > > I know where to look for info, /proc/<pidnr>/fdinfo/flags,
> > > > but this gives a (hex?) number. Is this
> > > > the lock I'm looking for, and how can I translate it into
> > > > terms like readonly, readwrite and exclusive.
> > >
> > > You're on the same box as the smbd is, or on a different
> > > one?
> >
> > Different, I would say of course.
> > My construction is al about making connections from a workstation to a
> > remote server.
>
> Ok, then I did not fully understand what you want to
> achieve. You quote smbstatus which is only available
> locally where smbd is running. What kind of information do
> you want to present where?
>
> Volker
Well,

didn't you read the original email?? All about how my construction works is in
that post.

Short: my construction is all about connections from a workstation to
different kinf of respources: FTP, SSH, SMB and local: USB (and others
follow).

This is based upon resource records.

I;m creating an utility which gives an overview of the active connections,
simular like smbstatus does for the SMB server. My utility gives such an
overview on the workstationside:

connections (mounts) , for which useron the workstation, which application,
which file, and finally which lock is set in the file. And my question is
about the last issue. The rest I've done already.

Now the pid of the application is known, so the directory

/proc/<pid>/fdinfo exists.

and the number of the filedescriptor is also known, so the file

/proc/<pid>/fdinfo/fd
exists, containing the flags parameter. Now this is the representation of the
way the file is in use, (O_RDONLY, O_EXCL, O_RDWR...etc). MY question is now,
how can I translate these values back into humanable readable form, instead of
a number.


Stef

0 new messages