[Samba] Howto determine flags like readonly and readwrite.

Stef Bon stef at bononline.nl
Fri Feb 5 07:54:31 MST 2010


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


More information about the samba mailing list